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 |
|---|---|---|---|---|---|
def lengthOfLongestSubstring(s):
if s == "":
return 0
else:
maxLength=1
for i in range(len(s)):
for j in range(i+1,len(s)):
identical = 0
for k in range(i,j):
for m in range(k+1,j+1):
if s[k]==s[m]:
... | iamwrm/coding | leetcode/lengthOfLongestSubstring.py | Python | mit | 719 |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.7
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
from os.path imp... | EnEff-BIM/EnEffBIM-Framework | SimModel_Python_API/simmodel_swig/Release/SimGeomSurfaceModel_FaceBasedSurfaceModel_Default.py | Python | mit | 11,364 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-05-15 19:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lotes', '0024_auto_20180515_1609'),
]
operations = [
migrations.AlterField(... | anselmobd/fo2 | src/lotes/migrations/0025_auto_20180515_1613.py | Python | mit | 506 |
#!/usr/bin/env python
import os, sys, re, csv
def make_and_move_zimages_lowres_thumbnails_dir_or_singlefile(pathname):
import os, sys, re, csv
from PIL import Image
import pyexiv2
import glob, os, re
size = 600, 720
regex_jpeg = re.compile(r'.+?\.[jpgJPG]{3}$')
regex_productionraw_Exports ... | relic7/prodimages | python/image_or_dir_make_thumbs_zimagesRAW.py | Python | mit | 5,518 |
import os
import numpy as np
nx_min = 1000
d_nx = 495
n_nx = 200
nt_min = 1000
d_nt = 495
n_nt = 200
output_dir = "./convergence_outputs/"
results_dir = "./convergence_results/"
resid_fname = "vd_resid_analysis.txt"
resid_matrix = np.zeros((n_nx,n_nt))
def ensure_dir(path):
# Make sure a directory exists.
... | kramer314/1d-vd-test | convergence-tests/combine-output.py | Python | mit | 1,395 |
from setuptools import setup
setup(name='rb87',
version='0.1',
description='Contains useful constants related to Rubidium 87',
url='http://github.com/shreyaspotnis/rb87',
author='Shreyas Potnis',
author_email='shreyaspotnis@gmail.com',
license='MIT',
packages=['rb87'],
z... | shreyaspotnis/rb87 | setup.py | Python | mit | 335 |
# -*- coding: utf-8 -*-
"""Entry point for the CLI"""
from __future__ import division, absolute_import
import sys
import argparse
import datetime as dt
import numpy as np
import apexpy
try:
# Python 3
STDIN = sys.stdin.buffer
STDOUT = sys.stdout.buffer
except AttributeError:
# Python 2
STDIN = ... | cmeeren/apexpy | src/apexpy/__main__.py | Python | mit | 2,748 |
import coremltools
folder = 'cnn_age_gender_models_and_data.0.0.2'
coreml_model = coremltools.converters.caffe.convert(
(folder + '/gender_net.caffemodel', folder + '/deploy_gender.prototxt'),
image_input_names = 'data',
class_labels = 'genders.txt'
)
coreml_model.author = 'Gil Levi and Tal Hassner'
corem... | cocoa-ai/FacesVisionDemo | Convert/gender.py | Python | mit | 740 |
# coding=utf-8
"""
pyserial 简单测试(python2)
"""
import serial
import struct
import logging
def run_server():
ser = serial.Serial('COM3', 38400, timeout=0,
parity=serial.PARITY_EVEN,
rtscts=1)
s = ser.read(100)
print struct.unpack('!f', s[:4])
ser.write(str... | Yuvv/LearnTestDemoTempMini | py-socket/NodeMonitor/pys.py | Python | mit | 641 |
import namespaces_lib as namespaces
import datasets_lib as datasets
import projects_lib as projects
import accounts_lib as accounts
import events_lib as events
import queries_lib as queries
import unittest
import common
from pprint import pprint
import time
teardown = False
class TestCase(unittest.TestCase):
ac... | ericmort/axelerator | backend/tests/test_datasets.py | Python | mit | 9,884 |
#!/usr/bin/env python
# Written by Greg Ver Steeg
# See readme.pdf for documentation
# Or go to http://www.isi.edu/~gregv/npeet.html
import scipy.spatial as ss
from scipy.special import digamma
from math import log
import numpy.random as nr
import numpy as np
import random
# CONTINUOUS ESTIMATORS
def entropy(x, k=3,... | sethuiyer/mlhub | Borda Count/entropy_estimators.py | Python | mit | 10,429 |
# Copyright 2014 John Reese
# Licensed under the MIT license
from app import app
from mc import mc, mcdict, Cacheable
import encoder
from routing import context, api, get, post
from template import template
| jreese/seinfeld | core/__init__.py | Python | mit | 209 |
# Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
#
# For example, given the array [-2,1,-3,4,-1,2,1,-5,4],
# the contiguous subarray [4,-1,2,1] has the largest sum = 6.
class Solution(object):
def maxSubArray(self, nums):
"""
:type nums: Li... | jigarkb/Programming | LeetCode/053-E-MaximumSubarray.py | Python | mit | 1,509 |
# Copyright 2018 Google LLC
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
import cipher
class W32(cipher.ARXCipher):
_word_bytes = 4
_byteorder = 'little'
w32 = W32()
class W64(cipher.ARXCipher):
_word_... | google/adiantum | python/nh.py | Python | mit | 2,501 |
# coding: utf-8
from fabkit import task, parallel
from fablib.openstack import Horizon
horizon = Horizon()
@task
@parallel
def setup():
horizon.setup()
return {'status': 1}
@task
def restart():
horizon.restart_services()
| syunkitada/fabkit-repo | fabscript/openstack/horizon.py | Python | mit | 240 |
__author__ = 'Jiu Moon'
if __name__ == '__main__':
<<<<<<< HEAD
print("hi")
=======
helper.greeting('develop')
>>>>>>> develop
| jkm4ca/cs3240-labdemo | dev.py | Python | mit | 130 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Import Command
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
from pyknackhq.py23compatible import (
_str_type, _int_types, _number_types, is_py3)
"""
import sys
if sys.version_info[0] == 3:
_str_type = str
_int_types = (... | MacHu-GWU/pyknackhq-project | pyknackhq/py23compatible.py | Python | mit | 496 |
"""
Direct.py
Permalink views
"""
from ViewHandler import Handler
from models.Word import Word
import logging
import Tools
class DirectParent(Handler):
"""Parent class for Permalink pages"""
def get(self, word_id):
try:
p = Word.get_by_id(int(word_id))
if p:
log... | adtraub/isthatawordadam | views/Direct.py | Python | mit | 921 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from unittest import mock
from preggy import expect
import thumbor... | thumbor/thumbor | tests/metrics/test_default_metrics.py | Python | mit | 1,085 |
import urllib2
import re
import bs4
from django.core.management.base import BaseCommand
from django.template.defaultfilters import slugify
from django.utils import timezone
from django.db import DatabaseError
from main.models import Country, CIAWFBEntry
VERBOSE = True
field_data_codes = {'administrative_divisions'... | johnmarkschofield/country-data.org | countrydata/main/management/commands/updatecountries.py | Python | mit | 12,640 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
@author: sharpdeep
@file:webwxapi.py
@time: 2016-02-13 15:47
"""
import inspect
import time
import re
import json
import random,sys,os
import subprocess
import qrcode
from bs4 import BeautifulSoup
from urllib import request, parse
from http.cookiejar import CookieJar
from... | sharpdeep/WxRobot | WxRobot/webwxapi.py | Python | mit | 28,922 |
__author__ = 'Anton'
import webapp2
#from google.appengine.ext import webapp
class Error404(webapp2.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Error 404: Page is not found') | sloot14/flexifod | view/error.py | Python | mit | 270 |
""" The Read-Evaluate-Print loop.
"""
import platform
import sys
import select
import time
import traceback
from ..util.StringBuffer import StringBuffer
from ..visitor.Parser import parseFromString
from ..eval.Interpreter import Interpreter
from ..eval.PLambdaException import PLambdaException
from ..version import ... | SRI-CSL/PLambda | plambda/eval/PLambda.py | Python | mit | 3,131 |
"""
MIT License
Copyright (c) 2013 Scott Kuroda <scott.kuroda@gmail.com>
SHA: 623a4c1ec46dbbf3268bd88131bf0dfc845af787
"""
import sublime
import os
import zipfile
import tempfile
import re
import codecs
__all__ = [
"get_resource",
"get_binary_resource",
"find_resource",
"list_package_files",
"get_... | albertyw/sublime-settings | PackageResourceViewer/package_resources.py | Python | mit | 11,378 |
from django.views.generic import TemplateView, ListView, DetailView, CreateView
from .forms import ThreadCreateUpdateForm, ThreadReplyForm
from .mixins import DetailWithListMixin, RequestForFormMixIn
from .models import ForumPost, ForumThread, ForumCategory
class ForumHome(ListView):
model = ForumCategory
d... | hellsgate1001/thatforum_django | thatforum/views.py | Python | mit | 3,749 |
"""Placeholder for scripts to inherit cli interface
"""
import argparse
import sys
import logging
import json
from sforce.client import sf_session
from sforce.models import SObj
class App(object):
def __init__(self, commons):
self.commons = commons
self.args = self.parse_options(sys.argv)
... | battlemidget/python-salesforce | sforce/cmd.py | Python | mit | 2,079 |
#!/usr/bin/env python
########################
# PriorityQueue Tool #
# Author: Yudong Qiu #
########################
from heapq import heappush, heappop
import itertools
class PriorityQueue(object):
def __len__(self):
return len(self._pq)
def __iter__(self):
return iter(task for priori... | leeping/crank | crank/PriorityQueue.py | Python | mit | 1,114 |
import arcpy, sys, os
sys.path.append('.')
import common
from networking import BulkConnectionCreator
arcpy.env.overwriteOutput = 1
# Creates a neighbourhood table of provided zones according to the principle of network neighbourhood - two zones are neighbours if they are connected by a route along the network that do... | simberaj/interactions | network_neighbour_table.py | Python | mit | 4,583 |
# This file is part of the Indico plugins.
# Copyright (C) 2002 - 2022 CERN
#
# The Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License;
# see the LICENSE file for more details.
from indico.util.i18n import make_bound_gettext
_ = make_bound_gettext('cit... | indico/indico-plugins | citadel/indico_citadel/__init__.py | Python | mit | 327 |
from subprocess import Popen, PIPE
import natlink
from dragonfly import (Grammar, AppContext, MappingRule, Dictation,
Key, Text, FocusWindow, Function, Mimic,
StartApp, IntegerRef)
grammar = Grammar("global")
def snore(**kw):
natlink.setMicState('sleeping')
examp... | drocco007/vox_commands | _global.py | Python | mit | 1,431 |
# From https://stackoverflow.com/questions/5189699/how-to-make-a-class-property#answer-5191224
class ClassPropertyDescriptor(object):
def __init__(self, fget, fset=None):
self.fget = fget
self.fset = fset
def __get__(self, obj, klass=None):
if klass is None:
klass = type(o... | gamernetwork/gn-django | gn_django/decorators.py | Python | mit | 1,014 |
# -*- coding: utf-8 -*-
import numpy as np
class ClickModel(object):
'''
Class for cascading click-models used to simulate clicks.
'''
def __init__(self, name, data_type, PCLICK, PSTOP):
'''
Name is used for logging, data_type denotes the degrees of relevance the data uses.
PCLICK and PSTOP the... | HarrieO/PairwisePreferenceMultileave | utils/clicks.py | Python | mit | 4,148 |
# -*- coding: utf-8 -*-
import math
import copy
# square root of 2 for diagonal distance
SQRT2 = math.sqrt(2)
def backtrace(node):
"""
Backtrace according to the parent records and return the path.
(including both start and end nodes)
"""
path = [(node.x, node.y)]
while node.parent:
... | brean/python-pathfinding | pathfinding/core/util.py | Python | mit | 3,262 |
"""prologues.py: identify function entry points in flat file binaries
"""
from binaryninja import *
class PrologSearch(BackgroundTaskThread):
"""Class that assists in locating function prologues in flat files binaries such as firmware
"""
def __init__(self, view):
BackgroundTaskThread.__i... | zznop/binjago | binjago/prologues.py | Python | mit | 2,001 |
# Convolution of spectra to a Instrument profile of resolution R.
#
# The spectra does not have to be equidistant in wavelength.
from __future__ import division, print_function
import logging
from datetime import datetime as dt
import matplotlib.pyplot as plt
import numpy as np
def wav_selector(wav, flux, wav_min,... | jason-neal/equanimous-octo-tribble | octotribble/Convolution/IP_Convolution.py | Python | mit | 4,929 |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import files
import sorts
def main(argv):
line = files.read_line(argv[0])
perm = [int(val) for val in line[1:-1].split(' ')]
print sorts.count_signed_breaks(perm)
if __name__ == "__main__":
main(sys.argv[1:... | cowboysmall/rosalind | src/textbook/rosalind_ba6b.py | Python | mit | 323 |
import tornado.ioloop
import tornado.web
from handlers import BlockHandler, NonBlockHandler, DefaultHandler, RedisHandler
import logging
LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) '
'-35s %(lineno) -5d: %(message)s')
LOGGER = logging.getLogger(__name__)
logging.basicConfig(lev... | joelmir/tornado-simple-api | app.py | Python | mit | 724 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-02-25 08:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("contenttypes", "0002_remove_content_type_name"),
(... | intel-hpdd/intel-manager-for-lustre | chroma_core/migrations/0010_tickets.py | Python | mit | 6,224 |
#import libraries
import pywaves as pw
from decimal import *
from Tkinter import *
import ttk
import tkMessageBox
import webbrowser
def callback(leaseId):
webbrowser.open_new(r"http://www.wavesgo.com/transactions.html?"+leaseId)
def dolease(myKey,myAmount):
msg=ttk.Label(mainframe, text="Broadcasting lease...")... | amichaelix/wavesgo-leasing | lease-gui.py | Python | mit | 2,665 |
"""
End-point to callback mapper
"""
__author__ = "Rinzler<github.com/feliphebueno>"
class RouteMapping(object):
"""
RouteMapping
"""
__routes = dict()
def __init__(self):
self.__routes = dict()
def get(self, route: str, callback: object()):
"""
Binds a GET route with... | feliphebueno/Rinzler | rinzler/core/route_mapping.py | Python | mit | 2,934 |
from setuptools import setup
# Python 2.6 will error exiting nosetests via multiprocessing without this
# import, as arbitrary as it seems.
#
import multiprocessing # noqa
from pybutton import VERSION
with open('README.rst', 'r') as f:
long_description = f.read()
setup(
name='pybutton',
version=VERSION... | button/button-client-python | setup.py | Python | mit | 1,364 |
import numpy as np
from nd2reader import ND2Reader
from frapalyzer.errors import InvalidROIError
from scipy.optimize import least_squares
class FRAPalyzer(object):
"""
Analyze Nikon ND2 stimulation FRAP experiments automatically
"""
def __init__(self, nd2_filename):
self._file = ND2Reader(nd... | rbnvrw/FRAPalyzer | frapalyzer/frapalyzer.py | Python | mit | 7,514 |
from __future__ import absolute_import
import hashlib
from unittest import TestCase
import time
class TestHandle(TestCase):
def test_handle(self):
timestamp = str(time.time())
token = "weilaidav2017"
nonce = "123321"
list = [token, timestamp, nonce]
list.sort()
sha... | tiantaozhang/wxmp | test/test_handle.py | Python | mit | 735 |
#!/usr/bin/python
from __future__ import division
import matplotlib.pyplot as plt
from pylab import savefig
from random import randint
from time import time
import sys
filelocation = "/Users/jack.sarick/Desktop/Program/Python/pi/"
filename = filelocation+"pianswer.txt"
temppoint = []
loopcounter = 0
k50, k10, k5 = 500... | jacksarick/My-Code | Python/pi/piguess.py | Python | mit | 1,059 |
__author__ = 'Алексей'
import codecs
from preparation.resources.synonyms import import_from_site
f = codecs.open('synonyms_raw.txt', mode='w', encoding='utf-8')
site = 'http://synonymonline.ru/'
import_from_site(site, f)
| hatbot-team/hatbot_resources | preparation/resources/synonyms/raw_data/extract_synonyms_raw.py | Python | mit | 232 |
import logging
import re
import socket
try:
import ssl as _ssl
_hush_pyflakes = [_ssl]
del _hush_pyflakes
except ImportError:
_ssl = None # No SSL support
from kitnirc.events import NUMERIC_EVENTS
from kitnirc.user import User
_log = logging.getLogger(__name__)
class Channel(object):
"""Informa... | ayust/kitnirc | kitnirc/client.py | Python | mit | 35,529 |
"""
"""
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = 'hrzeqwz0@nps2#ns3_qkqz*#5=)1bxcdwa*h__hta0f1bqr2e!'
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
TEMPLATE_DIRS = ("tests/templates", )
INSTALLED_APPS = (
'django_nose',
'django.contrib.contenttypes',
'django.... | alisaifee/djlimiter | tests/settings.py | Python | mit | 865 |
"""
Meraki Config Templates API Resource
"""
from .meraki_api_resource import MerakiAPIResource
class ConfigTemplates(MerakiAPIResource):
""" Meraki Config Templates API Resource. """
resource = "configTemplates"
def __init__(self, key, prefix=None, resource_id=None):
MerakiAPIResource.__init__(... | guzmonne/meraki_api | meraki_api/config_templates.py | Python | mit | 352 |
# -*- coding: utf-8 -*-
import scrapy
class QasneteaseSpider(scrapy.Spider):
name = "QASnetease"
allowed_domains = ["163.com"]
start_urls = ['http://163.com/']
def parse(self, response):
pass
| lijiabogithub/QUANTAXIS | QUANTAXIS/QASpider/QAS/QAS/spiders/QASnetease.py | Python | mit | 219 |
from typing import Union
from merakicommons.cache import lazy_property
from ..data import Region, Platform
from .common import CoreData, CassiopeiaGhost, ghost_load_on
from .summoner import Summoner
##############
# Data Types #
##############
class VerificationStringData(CoreData):
_renamed = {}
##########... | meraki-analytics/cassiopeia | cassiopeia/core/thirdpartycode.py | Python | mit | 1,356 |
#!/usr/bin/env python3
import argparse
import datetime
from html.parser import HTMLParser
import http.client
import sys
class TopListHTMLParser(HTMLParser):
def __init__(self):
super().__init__()
self.state = 'ready'
self.tmp_url = None
self.tmp_title = None
self.tmp_date ... | asgeir/old-school-projects | python/verkefni5/popular/popular.py | Python | mit | 5,406 |
# coding: utf-8
from __future__ import unicode_literals
from django.core.urlresolvers import reverse_lazy
from django.db.models.loading import get_model
from django.test import TestCase
import json
class ViewsTests(TestCase):
fixtures = ['test_data']
def test_task_view_200(self):
response = self.clie... | ToxicWar/travail-de-tests | testtask/tests/test_views.py | Python | mit | 2,637 |
import os
import sys
import numpy as np
from scipy.misc import imsave
import scipy.ndimage
import pydicom
training_dicom_dir = "./test/a"
training_labels_dir = "./test/b"
training_png_dir = "./Data/Training/Images/Sunnybrook_Part2"
training_png_labels_dir = "./Data/Training/Labels/Sunnybrook_Part2"
for root, dirs... | mshunshin/SegNetCMR | prepare_data.py | Python | mit | 1,788 |
import os
class Config(object):
SECRET_KEY = os.environ.get('SECRET_KEY')
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URI')
SQLALCHEMY_TRACK_MODIFICATIONS = False
WTF_CSRF_ENABLED = True
class DevelopmentConfig(Config):
DEBUG = True
class ProductionConfig(Config):
pass
class TestingCo... | danielrenes/data-visualization | config.py | Python | mit | 627 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import time
from extensions import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64), nullable=False)
mail = db.Column(db.String(64), nullable=False, unique=True)
token = db.Column(db.String(6... | elvis-macak/flask-restful-scaffold | scaffold/models.py | Python | mit | 1,010 |
from chocobros import app
if __name__ == "__main__":
app.run()
| insacuri/chocobros | wsgi.py | Python | mit | 68 |
from django.conf.urls import url
from django.views.generic import TemplateView
from . import views
# checkin
urlpatterns = [
url(
regex=r'^new/$',
view=views.NewCheckin.as_view(),
name='new'
),
url(
regex=r'^list/$',
view=views.ListCheckin.as_view(),
name='li... | airportmarc/the416life | src/apps/checkin/urls.py | Python | mit | 704 |
import logging
import os
from openpyxl import Workbook
logging.basicConfig(format='%(levelname)s:%(asctime)s:%(message)s \t', level=logging.INFO)
EXCEL_DIR = '/home/lucasx/PycharmProjects/DataHouse/DataSet/'
def write_excel(list_, filename):
mkdirs_if_not_exists(EXCEL_DIR)
wb = Workbook()
ws = wb.acti... | EclipseXuLu/DataHouse | DataHouse/crawler/file_helper.py | Python | mit | 1,669 |
from datetime import datetime
from dateutil.parser import parse
import inspect
import itertools
import json
import pytz
import re
from requests.exceptions import HTTPError
import six
import sys
from onecodex.exceptions import (
MethodNotSupported,
OneCodexException,
PermissionDenied,
ServerError,
)
fro... | onecodex/onecodex | onecodex/models/__init__.py | Python | mit | 23,807 |
from __future__ import division
from __future__ import print_function
import numpy as np
from acq4.util import Qt
Ui_Form = Qt.importTemplate(".contrast_ctrl_template")
class ContrastCtrl(Qt.QWidget):
"""Widget for controlling contrast with rapidly updating image content.
Provides:
* image histogram
... | acq4/acq4 | acq4/util/imaging/contrast_ctrl.py | Python | mit | 5,136 |
import pyclbr
import sys
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session, sessionmaker
engine = create_engine('sqlite:///database.db', convert_unicode=True)
db_session = scoped_session(sessionmaker(autocommit=False,
... | NemoNessuno/SecretSanta | db_handler.py | Python | mit | 1,228 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import Paper
admin.site.register(Paper)
| genonfire/bbgo | papers/admin.py | Python | mit | 153 |
from collections import OrderedDict
from itertools import chain
import pytest
from lxml import html
from app import content_loader
from app.main.helpers.diff_tools import html_diff_tables_from_sections_iter
from .helpers import BaseApplicationTest
class TestHtmlDiffTablesFromSections(BaseApplicationTest):
_expe... | alphagov/digitalmarketplace-admin-frontend | tests/app/test_diff_tool.py | Python | mit | 17,911 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Choose',
fields=[
('chooseID', models.AutoField... | g82411/Hackgen2015 | server/mobile/migrations/0001_initial.py | Python | mit | 3,639 |
import shutil
from buildall import Task, Path
class Copy(Task):
def __init__(self, destination):
self._destination = Path(destination)
def target(self):
return self._destination
def build(self, source):
assert source.exists()
self.debug('Copying %s to %s' % (source,
... | rayene/buildall | buildall/contrib/copy.py | Python | mit | 438 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('studygroups', '0046_auto_20160108_0511'),
]
operations = [
migrations.AddField(
model_name='study... | p2pu/learning-circles | studygroups/migrations/0047_auto_20160111_0735.py | Python | mit | 908 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Font(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "histogram2d.hoverlabel"
_path_str = "histogram2d.hoverlabel.font"
_valid_props = {"color", "co... | plotly/plotly.py | packages/python/plotly/plotly/graph_objs/histogram2d/hoverlabel/_font.py | Python | mit | 11,235 |
from astrosage import Horoscope
from pprint import pprint
h = Horoscope('aquarius')
pprint(h.daily())
# pprint(h.weekly())
# pprint(h.monthly())
# pprint(h.yearly())
# pprint(h.weekly_love()) | sandipbgt/astrosage-api | demo.py | Python | mit | 192 |
# coding: utf-8
RESOURCE_MAPPING = {
'sales_create': {
'resource': 'v2/sales/',
'docs': 'http://apidocs.braspag.com.br/'
#post
},
'sales_capture': {
'resource': 'v2/sales/{id}/capture',
'docs': 'http://apidocs.braspag.com.br/'
#put
},
'sales_cancel': ... | parafernalia/tapioca_braspag | tapioca_braspag/resource_mapping.py | Python | mit | 2,496 |
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'bootcamp.core.views.home', name='home'),
url(r'^admin/', include(admin.site.urls)),
ur... | maxpinto/Ptz | bootcamp/urls.py | Python | mit | 1,953 |
from typing import List, Dict, Type
from collections import deque
import pyqtgraph as pg
from vnpy.trader.ui import QtGui, QtWidgets, QtCore
from vnpy.trader.object import BarData
from .manager import BarManager
from .base import (
GREY_COLOR, WHITE_COLOR, CURSOR_COLOR, BLACK_COLOR,
to_int, NORMAL_FONT
)
from... | msincenselee/vnpy | vnpy/chart/widget.py | Python | mit | 21,789 |
import matplotlib.pyplot as plt
import numpy as np
def plot():
fig = plt.figure()
N = 10
t = np.linspace(0, 1, N)
x = np.arange(N)
plt.plot(t, x, "-o", fillstyle="none")
plt.tight_layout()
return fig
def test():
from .helpers import assert_equality
assert_equality(plot, "test_f... | nschloe/matplotlib2tikz | tests/test_fillstyle.py | Python | mit | 345 |
class Parent(object):
def override(self):
print("PARENT override()")
def implicit(self):
print("PARENT implicit()")
def altered(self):
print("PARENT altered()")
class Child(Parent):
def override(self):
print("CHILD override()")
def altered(self):
... | Paul-Haley/LPTHW_python3 | ex44d.py | Python | mit | 570 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "RetailPartners.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| darshanbagul/EntityManagement | RetailPartners/manage.py | Python | mit | 257 |
from __future__ import (absolute_import, division, print_function, unicode_literals)
__author__ = 'vlad'
__version__ = 0.2
import numpy as np
from scipy import ndimage
# from sklearn.cluster import KMeans
import skimage.morphology as morph
# from skimage.restoration import denoise_tv_bregman
from skimage.feature im... | vladpopovici/WSItk | WSItk/segm/nuclei.py | Python | mit | 2,446 |
from django.contrib import admin
from imager_profile.models import UserProfile
# Register your models here.
admin.site.register(UserProfile) | clair3st/django-imager | imagersite/imager_profile/admin.py | Python | mit | 142 |
import ftfy
import PyPDF2
import unidecode
from bs4 import BeautifulSoup
from urllib.request import urlopen
from goslate import Goslate
from mercury_api import ParserAPI
import html2text
import os
html_parser = html2text.HTML2Text()
html_parser.ignore_links = True
html_parser.ignore_images = True
html_parser.body_widt... | Zenohm/OmniReader | OmniReader/story.py | Python | mit | 12,411 |
from os.path import isfile, exists, abspath, dirname
from os import chdir, getcwd
from startup import EnumWindows, EnumWindowsProc, foreach_window, similar, windows
from pywinauto import application
from keyboard import PressKey, ReleaseKey, VK_TAB, VK_SHIFT
from time import time, sleep
import re
import pyotp
ctok = ... | wittrup/crap | python/anyconnect.py | Python | mit | 2,265 |
# f1/s/io/persistence.py
import uuid
import json
import records
import os
from .sqlite import SQlite
from .couchbase import Couchbase
class Persistence:
me = None
def __init__(self, boot_config=None, briefing=None):
"""
Central class for data storage. Handles reads/writes and sync.
... | filemakergarage/zeroclient | f1/s/io/persistence.py | Python | mit | 5,932 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rohan.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| jairtrejo/doko | app/manage.py | Python | mit | 248 |
"""Report the manhattan distance between a starting point and an ending point,
given a set of directions to follow to move between the two points."""
from distance import get_distance
from directions import load_directions, follow_directions
def main():
directions = load_directions('directions.txt')
startin... | machinelearningdeveloper/aoc_2016 | 01/solve_1.py | Python | mit | 553 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# This is a simple PMI tool based on inverted_index
#
# Reference: http://en.wikipedia.org/wiki/Pointwise_mutual_information
#
# @author: Jason Wu (bowenwu@sohu-inc.com)
from inverted_index import InvertedIndex
from topkheap import TopkHeap
import math
class PMIElement... | jasonwbw/NLPbasic | retrieval/basic/pmi.py | Python | mit | 3,869 |
import os.path
from dxr.query import Query
from dxr.utils import connect_db
from dxr.testing import SingleFileTestCase, MINIMAL_MAIN
from nose.tools import eq_
class MemberFunctionTests(SingleFileTestCase):
source = """
class MemberFunction {
public:
void member_function(int ... | erikrose/dxr | tests/test_direct.py | Python | mit | 1,544 |
# coding: utf-8
# (c) 2015-11-28 Teruhisa Okada
import netCDF4
import matplotlib.pyplot as plt
from matplotlib.dates import DateFormatter
import numpy as np
import pandas as pd
import romspy
def resample(date, var, **kw):
rule = kw.pop('resample', 'D')
if rule == 'H':
loffset = '-30min'
elif rule... | okadate/romspy | romspy/tplot/tplot_station.py | Python | mit | 2,385 |
"""
The purpose of this server is to maintain a list of
nodes connected to the P2P network. It supports traditional
passive nodes which receive connections but it also
provides a protocol to facilitate TCP hole punching
allowing >85% of nodes behind a standard router to
receive connections.
Notes: Passives nod... | Storj/pyp2p | pyp2p/rendezvous_server.py | Python | mit | 23,140 |
import sys
import time
import threading
import pygame
import simplejson as json
from utils import rabbitmq
from utils import drawable
class WorkerThread(threading.Thread):
def __init__(self, logger, status, conf, queue_rows):
threading.Thread.__init__(self)
self._error_count = 0
self._logg... | alex-dow/psistatsrd | psistatsrd/worker.py | Python | mit | 4,007 |
import multiprocessing
class SlotPool(object):
"""Execution slots pool
Helps tracking and limiting parrallel executions. Go ahead
and define a slots pool to limit the number of parrallel
executions in your program for example.
:param size: Size of the pool, aka how many parrallel
execution ... | botify-labs/process-kit | pkit/slot/pool.py | Python | mit | 990 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Remove empty dirs in the provided trees"""
import KmdCmd
import KmdFiles
import logging
class KmdTreeEmptyDirs(KmdCmd.KmdCommand):
def extendParser(self):
"""extend parser"""
super(KmdTreeEmptyDirs, self).extendParser()
#Extend parser
... | pzia/keepmydatas | src/dir_rm_empty.py | Python | mit | 761 |
from django.contrib import admin
from djpubsubhubbub.models import Subscription
admin.site.register(Subscription)
| jpadilla/feedleap | vendor/djpubsubhubbub/djpubsubhubbub/admin.py | Python | mit | 116 |
from globals import *
import life as lfe
import missions
def tick(life):
if life['missions']:
missions.do_mission(life, life['missions'].keys()[0])
| flags/Reactor-3 | alife/alife_work.py | Python | mit | 155 |
#!/usr/bin/env python
from Bio import AlignIO
from Bio.Alphabet import IUPAC,Gapped
import sys
#This script takes a FASTA alignment and converts is to a
#nexus alignment
# check for correct arguments
if len(sys.argv) != 3:
print("Usage: FastaToNexus.py <inputfile> <outputfile>")
sys.exit(0)
input_name = sys... | tatumdmortimer/formatConverters | FastaToNexus.py | Python | mit | 605 |
class Song(object):
def __init__(self, lyrics):
self.lyrics = lyrics
def sing_me_a_song(self):
for line in self.lyrics:
print(line)
happy_bday = Song(["Happy birthday to you",
"I don't want to get sued",
"So I'll stop right there"])
bulls_on... | zedshaw/learn-python3-thw-code | ex40.py | Python | mit | 488 |
#!/usr/bin/env python
# table auto-generator for zling.
# author: Zhang Li <zhangli10@baidu.com>
kBucketItemSize = 4096
matchidx_blen = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7] + [8] * 1024
matchidx_code = []
matchidx_bits = []
matchidx_base = []
while len(matchidx_code) < kBucketItemSize:
for bit... | eevans/squash-deb | plugins/zling/libzling/src/ztable.py | Python | mit | 964 |
from Auth import TokenGenerator
import requests
import json
class ListRetriever:
'Retrieve a list of our follower buddies'
URL = 'https://api.twitter.com/1.1/lists/list.json'
USER_ID = '894195594360737792'
key = ''
secret = ''
def __init__(self, key, secret):
self.key = key
se... | csdinos/twitterBot | Api/ListRetriever.py | Python | mit | 953 |
"""Wrapper for utilizing tronn on datasets
"""
import os
import h5py
import glob
import logging
import numpy as np
import pandas as pd
from ggr.analyses.baselines import compare_sig_motifs
from ggr.analyses.baselines import compare_tf_motif_corrs
from ggr.analyses.bioinformatics import run_gprofiler
from ggr.analyse... | vervacity/ggr-project | ggr/workflows/learning.py | Python | mit | 45,053 |
"""
Validation of model outputs against in situ data stored and extracted from a database.
This also includes the code to build the databases of time series data sets.
"""
import datetime as dt
import glob as gb
import os
import sqlite3 as sq
import subprocess as sp
import matplotlib.path as mplPath
import matplotl... | pwcazenave/PyFVCOM | PyFVCOM/validation.py | Python | mit | 53,848 |
import os
import psycopg2
from sqlalchemy import create_engine
from sqlalchemy import Column, Integer, String, Float
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class GeoLoc(Base):
'''
Definition of geographical location.... | eiva/nadmozg | utils/Db.py | Python | mit | 822 |
"""Classes and methods for working with the physical Mebo robot"""
import logging
import socket
import sys
import time
from abc import ABC
from collections import namedtuple
from functools import partial
from ipaddress import (
AddressValueError,
IPv4Network,
IPv4Address
)
from xml.etree.ElementTree import... | crlane/python-mebo | mebo/robot.py | Python | mit | 17,041 |
"""
Provides the :class:`Model` plugin for two-way data binding between
context and html input elements.
"""
from browser import timer
try:
from ..expression import parse
from ..tpl import _compile, register_plugin
except:
from circular.template.expression import parse
from circular.template.tp... | jonathanverner/circular | src/circular/template/tags/model.py | Python | mit | 4,421 |
#!/usr/bin/env python
from omics_pipe.parameters.default_parameters import default_parameters
from omics_pipe.utils import *
p = Bunch(default_parameters)
def Varscan_somatic(sample, tumor, normal, Varscan_somatic_flag):
'''Runs Varscan2 on paired tumor/normal samples to detect somatic point mutations in cancer ... | adammaikai/PipeMaster | modules/Varscan_somatic.py | Python | mit | 1,547 |