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 is_subsequence(s, t): """ :type s: str :type t: str :rtype: bool """ if len(s) > len(t): return False matched_s = 0 for char in t: if matched_s < len(s) and s[matched_s] == char: matched_s += 1 return matched_s == len(s)
yangshun/tech-interview-handbook
experimental/utilities/python/is_subsequence.py
Python
mit
289
""" Django settings for elasticmanager project. Generated by 'django-admin startproject' using Django 1.8. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build...
InterestingLab/elasticmanager
elasticmanager/settings.py
Python
mit
4,127
from OpenGLCffi.GL import params @params(api='gl', prms=['source', 'type', 'severity', 'count', 'ids', 'enabled']) def glDebugMessageControl(source, type, severity, count, ids, enabled): pass @params(api='gl', prms=['source', 'type', 'id', 'severity', 'length', 'buf']) def glDebugMessageInsert(source, type, id, seve...
cydenix/OpenGLCffi
OpenGLCffi/GL/EXT/KHR/debug.py
Python
mit
2,870
from game.models import (Card, HEART, SPADE, CLUB, DIAMOND) def test_card_creation_without_name(): c = Card('heart', 5) assert c.name == 'heart' assert c.suit == 'heart' assert c.value == 5 def test_ca...
setphen/Donsol
tests/test_card.py
Python
mit
860
from pkgutil import extend_path from .client.client import APIClient # Allow out-of-tree submodules. __path__ = extend_path(__path__, __name__) __all__ = ["APIClient"]
nylas/nylas-python
nylas/__init__.py
Python
mit
169
#! /usr/bin/env python # -*- coding: utf-8 -*- import re import urllib import os import tempfile import traceback from grab.error import DataNotFound from grab.tools import rex from grab.spider import Task from rdflib import URIRef, Literal from rdflib.namespace import RDF, RDFS, FOAF, DCTERMS, DC, XSD from PyPDF2 im...
ailabitmo/sempubchallenge2014-task1
CeurWsParser/parsers/publication_parser.py
Python
mit
13,497
''' using matplotlib to viz dates.txt ''' from collections import Counter import numpy as np import matplotlib.pyplot as plt from matplotlib import dates as pltdates import pandas as pd import sqlite3 import dataserv def getdatesfromfile(): datefile = input('please enter datefile name: ') dates = eval(open(dat...
BMJHayward/infusionsoft_xpmt
src/matplotchart.py
Python
mit
1,300
# -*- coding: utf-8 -*- import django from django.conf import settings from django.core.exceptions import ImproperlyConfigured if django.VERSION < (2, 0): from django.core.urlresolvers import ( NoReverseMatch, resolve, Resolver404, reverse, ) else: from django.urls import (...
fabiocaccamo/django-maintenance-mode
maintenance_mode/http.py
Python
mit
6,326
# coding: utf-8 # pylint: disable = invalid-name, W0105, C0301 from __future__ import absolute_import import collections from operator import gt, lt from .compat import range_ class EarlyStopException(Exception): """Exception of early stopping. Parameters ---------- best_iteration : int The ...
fstonezst/LightGBM
python-package/lightgbm/callback.py
Python
mit
6,606
import numpy as np import tensorflow as tf import time batch_size = 128 decay = 0.99 epochs = 20 learning_rate = 0.5 is_training = tf.placeholder(tf.bool) # input image dimensions img_rows, img_cols = 28, 28 (x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data() x_train = x_...
paperrune/Neural-Networks
History/Batch-Normalization/Tensorflow.py
Python
mit
4,020
import logging import os import datetime import tba_config import time import json from google.appengine.api import taskqueue from google.appengine.ext import ndb from google.appengine.ext import webapp from google.appengine.ext.webapp import template from consts.event_type import EventType from consts.media_type imp...
bdaroz/the-blue-alliance
controllers/datafeed_controller.py
Python
mit
31,351
"""Settings that need to be set in order to run the tests.""" import os DEBUG = True SITE_ID = 1 APP_ROOT = os.path.abspath( os.path.join(os.path.dirname(__file__), '..')) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } ROOT_URLCONF = 'hijack....
pennersr/django-hijack
hijack/tests/test_settings.py
Python
mit
1,351
infile = open(input("App Zip"),"rb") outfile = open(input("AppFileName:") + ".bryapp","wb") outfile.write("BRYANTCOMPILERAPPLICATIONPACKAGE".encode('utf-8')) outfile.write(infile.read())
ArcherSys/ArcherSys
compiler.py
Python
mit
186
import os import shutil from urlparse import urlparse from hashlib import sha1 from plumbum.cmd import git, tar, wget, pip, sudo from plumbum import ProcessExecutionError def mkdir_p(path): path = os.path.abspath(os.path.expanduser(path)) if not os.path.exists(path): os.makedirs(path) return path...
mesos-magellan/enrique
enrique/package.py
Python
mit
4,717
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2017-05-23 12:18 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('club', '0007_member_autocheckout_secret_code_checksum'), ] operations = [ mig...
diegojromerolopez/djshop
src/djshop/apps/club/migrations/0008_auto_20170523_1218.py
Python
mit
752
from django.contrib import admin from django.utils.translation import ugettext_lazy as _ def _date(obj): return obj.date.strftime('%Y-%m-%d %H:%M:%S') _date.short_description = _(u'Date') class AdminContact(admin.ModelAdmin): fields = ( 'email', 'subject', 'message', ...
toopy/django-toopy-website
src/toopy/admin/admin_.py
Python
mit
638
# $Id: $ # # Test configuration parameters # class TestConfig: #hostname = "zoo-admiral-behav.zoo.ox.ac.uk" #hostname = "zoo-admiral-silk.zoo.ox.ac.uk" #hostname = "zoo-admiral-devel.zoo.ox.ac.uk" hostname = "zoo-admiral-ibrg.zoo.ox.ac.uk" #hostname = "z...
tectronics/admiral-jiscmrd
test/FileShare/tests/TestConfig.py
Python
mit
984
"""Shared functionality useful across multiple structural variant callers. Handles exclusion regions and preparing discordant regions. """ import collections import os import numpy import pybedtools import pysam import toolz as tz import yaml from bcbio import bam, utils from bcbio.distributed.transaction import fil...
brainstorm/bcbio-nextgen
bcbio/structural/shared.py
Python
mit
13,904
from django.conf import settings from django.conf.urls import patterns, include, url urlpatterns = patterns('', url(r'^', include('howtostoreiosdata.wizard.urls', namespace="wizard")), ) if settings.DEBUG: urlpatterns += patterns('', (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_r...
erikr/howtostoreiosdata
howtostoreiosdata/urls.py
Python
mit
355
""" Deploy state manager """ from py_mina.utils import _AttributeDict ################################################################################ # Default state ################################################################################ state = _AttributeDict({ 'pre_deploy': None, 'deploy': No...
py-mina-deploy/py-mina
py_mina/state.py
Python
mit
845
# -*- coding: utf-8 -*- """ 兼容Python版本 """ import sys is_py2 = (sys.version_info[0] == 2) is_py3 = (sys.version_info[0] == 3) is_py33 = (sys.version_info[0] == 3 and sys.version_info[1] == 3) try: import simplejson as json except (ImportError, SyntaxError): import json if is_py2: from urllib import q...
aliyun/aliyun-oss-python-sdk
oss2/compat.py
Python
mit
2,283
#! /usr/bin/env python3 """ mem_to_bram.py Converts a verilog mem file to init statements for 4 BRAMs arranged as a word """ import argparse import sys if __name__ == "__main__": parser = argparse.ArgumentParser( description='Split MEM file into BRAM init statements') parser.add_argument("-D", "--...
ptracton/wb_soc_template
tools/mem_to_bram.py
Python
mit
4,165
#!/usr/bin/env python3 import math import unittest from unittest.mock import MagicMock, patch import torch import gpytorch from gpytorch.test.lazy_tensor_test_case import LazyTensorTestCase, _ensure_symmetric_grad class TestLazyEvaluatedKernelTensorBatch(LazyTensorTestCase, unittest.TestCase): seed = 0 de...
jrg365/gpytorch
test/lazy/test_lazy_evaluated_kernel_tensor.py
Python
mit
6,765
"""List hardware servers.""" # :license: MIT, see LICENSE for more details. import SoftLayer from SoftLayer.CLI import columns as column_helper from SoftLayer.CLI import environment from SoftLayer.CLI import formatting from SoftLayer.CLI import helpers import click # pylint: disable=unnecessary-lambda COLUMNS = [ ...
iftekeriba/softlayer-python
SoftLayer/CLI/server/list.py
Python
mit
2,923
#!/usr/bin/env python """ Class that reads in data from decoder.py and uses a PLL to correct for phase offset. """ import numpy as np import matplotlib.pyplot as plt import helper #from decoder import Decoder j = (0 + 1j) class PLL(object): def __init__(self, data, k_p, k_i, k_d): """ Initialize d...
williamalu/mimo_usrp
scripts/pll.py
Python
mit
3,454
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 15 17:08:10 2019 @author: Tobias Andermann (tobias.andermann@bioenv.gu.se) """ import numpy as np np.set_printoptions(suppress=True) import pandas as pd import matplotlib.pyplot as plt import os import argparse class CompletePath(argparse.Action)...
AntonelliLab/seqcap_processor
secapr/utils.py
Python
mit
531
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-04-13 18:29 from __future__ import unicode_literals import datetime from django.conf import settings from django.db import migrations, models import django.db.models.deletion import mac_app.models class Migration(migrations.Migration): initial = True ...
stevarino/cmsc495
mac_app/migrations/0001_initial.py
Python
mit
4,401
#!/usr/bin/env python # -*- coding: UTF-8 -*- class Response(): def __init__(self, server): self._server = server self.response_code = 200 self.content_type = None self.content = "" self.headers = {} self.cookies = {}
akhof/PWA
PWA/src/PWA/Response.py
Python
mit
288
# encoding: utf8 from __future__ import absolute_import, division from collections import defaultdict, namedtuple import colorsys import logging import wtforms.validators from wtforms import Form, ValidationError, fields from wtforms.ext.sqlalchemy.fields import QuerySelectField import pokedex.db import pokedex.db.t...
Sanqui/spline-pokedex
splinext/pokedex/controllers/pokedex_gadgets.py
Python
mit
30,941
username = "x" password = "x" subreddit = "x" client_id = "x"
ciaranlangton/reddit-cxlive-bot
config.py
Python
mit
62
import _plotly_utils.basevalidators class ColorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__(self, plotly_name="color", parent_name="sankey.node.line", **kwargs): super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
plotly/plotly.py
packages/python/plotly/plotly/validators/sankey/node/line/_color.py
Python
mit
449
#!/usr/bin/env python import os import zipfile import hashlib def _rec_split(s): rest, tail = os.path.split(s) if rest in ('', os.path.sep): return tail, return _rec_split(rest) + (tail,) def _any_dot(s): for i in _rec_split(s): if len(i)>0 and i[0]=='.': return True return False def _zipdir(path, ziph,...
jpn--/pines
pines/zipdir.py
Python
mit
3,774
""" polaris.server ~~~~~~~~~~~~~~ :copyright: (c) 2013 Eleme, http://polaris.eleme.io :license: MIT Polaris app server. """ import hashlib import os.path from flask import Flask as _Flask from werkzeug.datastructures import ImmutableDict from werkzeug.utils import import_string __all__ = ['crea...
eleme/polaris
polaris/server.py
Python
mit
3,719
import unittest import numpy as np import bayesnet as bn class TestDeterminant(unittest.TestCase): def test_determinant(self): A = np.array([ [2., 1.], [1., 3.] ]) detA = np.linalg.det(A) self.assertTrue((detA == bn.linalg.det(A).value).all()) A = ...
ctgk/BayesianNetwork
test/linalg/test_det.py
Python
mit
626
#Exercise 1.2: Write a Hello World program #Author: Andreas Solberg Sagen - University of Oslo print("Hello World") #Or we could do the more "classic one": hello = "Hello" world = "World" print(hello + " " + world) #samplerun #Hello World #Hello World
exTerEX/PrimeOnScientificProgramming
Chapter 1/hello_world.py
Python
mit
255
# coding=utf-8 r""" This code was generated by \ / _ _ _| _ _ | (_)\/(_)(_|\/| |(/_ v1.0.0 / / """ from tests import IntegrationTestCase from tests.holodeck import Request from twilio.base.exceptions import TwilioException from twilio.http.response import Response class TriggerTestCase(Integrati...
twilio/twilio-python
tests/integration/api/v2010/account/usage/test_trigger.py
Python
mit
11,299
"""XKNX version.""" __version__ = "0.19.2.dev"
XKNX/xknx
xknx/__version__.py
Python
mit
48
#! /usr/bin/env pypy """ Command-line options for translate: See below """ import os import sys import py from rpython.config.config import (to_optparse, OptionDescription, BoolOption, ArbitraryOption, StrOption, IntOption, Config, ChoiceOption, OptHelpFormatter) from rpython.config.translationoption import (...
jptomo/rpython-lang-scheme
rpython/translator/goal/translate.py
Python
mit
12,703
# Original author: yasunorikudo # (https://github.com/yasunorikudo/chainer-ResNet) import chainer import chainer.functions as F from chainer import initializers import chainer.links as L class BottleNeckA(chainer.Chain): def __init__(self, in_size, ch, out_size, stride=2, groups=1): super(BottleNeckA, s...
anaruse/chainer
examples/imagenet/resnet50.py
Python
mit
3,641
import unittest import pinq class queryable_difference_tests(unittest.TestCase): def setUp(self): self.queryable1 = pinq.as_queryable(range(1, 11)) self.queryable2 = pinq.as_queryable(range(2, 10, 2)) def test_difference_list(self): self.assertEqual(list(self.queryable1.difference( ...
dlshriver/pinq
tests/test_queryable_difference.py
Python
mit
1,827
# -*- coding: utf-8 -*- """ Sahana Eden Human Resources Management @copyright: 2011-2021 (c) Sahana Software Foundation @license: MIT 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 S...
flavour/eden
modules/s3db/hrm.py
Python
mit
471,286
import _plotly_utils.basevalidators class GradientValidator(_plotly_utils.basevalidators.CompoundValidator): def __init__( self, plotly_name="gradient", parent_name="scattercarpet.marker", **kwargs ): super(GradientValidator, self).__init__( plotly_name=plotly_name, par...
plotly/python-api
packages/python/plotly/plotly/validators/scattercarpet/marker/_gradient.py
Python
mit
1,063
import numpy as np import pandas as pd import matplotlib.pyplot as plt
jigargandhi/UdemyMachineLearning
Machine Learning A-Z Template Folder/Part 2 - Regression/Section 4 - Simple Linear Regression/j_data_preprocessing_template.py
Python
mit
72
from socket import error as socket_error from django.http import BadHeaderError class WebSocketError(socket_error): """ Raised when an active websocket encounters a problem. """ class FrameTooLargeException(WebSocketError): """ Raised if a received frame is too large. """ class HandshakeEr...
0nkery/django-websocket-redis3
ws4redis/exceptions.py
Python
mit
517
import sys import bpy from bpy.props import StringProperty class ExportLog(object): """ Class which tracks warnings and errors during export """ WARNING = "Warning" ERROR = "Error" MESSAGE_SEPERATOR = "\n" SEVERITY_DIVIDER = "|#|" EXPORTED_MESSAGE_QUEUE = [] def __init__(self): ...
tobspr/Panda3D-Bam-Exporter
src/ExportLog.py
Python
mit
2,156
#! /usr/bin/python import os; import sys; try: import numpy as np; except Exception, e: USE_MATPLOTLIB = False; print e; print 'Warning: NumPy not installed!'; exit(0); USE_MATPLOTLIB = True; try: import matplotlib.pyplot as plt; except Exception, e: USE_MATPLOTLIB = False; print e; print 'Warning: Matplotl...
isovic/aligneval
src/plot_with_seabourne_v2.py
Python
mit
37,633
#!/usr/bin/env python # -*- coding: utf-8 -*- # マルコフテーブル等定義 import sqlalchemy from sqlalchemy.orm import scoped_session, sessionmaker, mapper from sqlalchemy import MetaData from sqlalchemy import Column, MetaData, Table, types from datetime import datetime class OhayouTime(object): pass class Markov(object): pass...
showyou/anzu
common/model.py
Python
mit
4,110
#!/usr/bin/python -u # 18-08-04 # v1.1.1 # http.py # A simple CGI script, to explore http headers, cookies etc. # Copyright Michael Foord # Free to use, modify and relicense. # No warranty express or implied for the accuracy, fitness to purpose or otherwise for this code.... # Use at your own risk !!! # E-mail or mi...
ActiveState/code
recipes/Python/298336_http__Exploring_Headers_Cookies/recipe-298336.py
Python
mit
9,871
""" Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation -- it essentially peek() at the element that will be returned by the next call to next(). Here is an example. Assume that the iterator is initialized to the beginning of t...
Ahmed--Mohsen/leetcode
peeking_iterator.py
Python
mit
2,482
N, K = map(int, input().split()) A = [int(x) for x in input().split()] print((N - 1) // (K - 1) + int((N - 1) % (K - 1) != 0))
knuu/competitive-programming
atcoder/arc/arc099_a_2.py
Python
mit
127
#!/usr/bin/env python # -*- coding=utf8 -*- """clear the mysql database yjy_archtecture tables in aa.txt""" import MySQLdb as mdb db_conn = mdb.connect("localhost","root","HEkgDDZZ","yjy_human") cursor = db_conn.cursor() with open("/root/scripts/clear_human_sql.tables") as f: tables = f.readlines() print tables try...
lgh8820/ansible-test
yjy_all_scripts/clear_arch_tables.py
Python
mit
630
""" * * Scratch_n_sketch scripting * Text screen saver * """ from libs.board import * #init board = scratch_n_sketch() #connect board board.connect() #initialize colors board.backGroundColor(0, 0, 0) board.penColor(255, 0, 255) board.textBackColor(0, 0, 0) #rotate display by 180 board.rotateDisplay(board.rotate_0) boar...
warefab/scratch-n-sketch
python/draw_arcs_tft.py
Python
mit
1,415
import os import sys sys.path.append(os.path.join(os.path.dirname(__file__), '../tools')) import files import tree def main(argv): dna = files.read_line(argv[0]) st = tree.SuffixTree(dna) print '\n'.join(st.traverse()) if __name__ == "__main__": main(sys.argv[1:])
cowboysmall/rosalind
src/stronghold/rosalind_suff.py
Python
mit
288
#!/usr/bin/python3 """ Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put. get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1. put(key, value) - Set or insert the value if the ...
algorhythms/LeetCode
146 LRU Cache py3.py
Python
mit
2,700
import uuid import numpy as np from ..data_utils import is_pandas_df, has_geo_interface, records_from_geo_interface from .json_tools import JSONMixin, camel_and_lower from pydeck.types import Image from pydeck.exceptions import BinaryTransportException TYPE_IDENTIFIER = "@@type" FUNCTION_IDENTIFIER = "@@=" QUOTE_C...
uber-common/deck.gl
bindings/pydeck/pydeck/bindings/layer.py
Python
mit
6,775
# setup for py.test import os import pytest import easypost TEST_API_KEY = os.environ["TEST_API_KEY"] PROD_API_KEY = os.environ["PROD_API_KEY"] def pytest_sessionstart(session): # this is for local unit testing with google appengine, otherwise you get a # 'No api proxy found for service "urlfetch"' respon...
dsanders11/easypost-python
tests/conftest.py
Python
mit
1,864
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('cidonkey', '0006_auto_20141105_2057'), ] operations = [ migrations.AlterField( model_name='buildinfo', ...
samuelcolvin/ci-donkey
cidonkey/migrations/0007_auto_20141105_2136.py
Python
mit
417
from collections import UserList from gear import ffxiv, xivdb from gear import power as p """Class representing a simple gear element. """ class Gear(object): """Gear(slot, item_id, **attributes) slot : in which slot of the gearset is this precise gear, as defined in ffxiv.slots. item_id : ide...
Rosslaew/OptiGear
gear/gear.py
Python
mit
2,681
# -*- coding: utf-8 -*- # Resource object code # # Created: mer. 14. sept. 10:51:53 2016 # by: The Resource Compiler for PyQt (Qt v4.8.5) # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore qt_resource_data = "\ \x00\x00\x07\xea\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x...
Geoportail-Luxembourg/qgis-pag-plugin
resources.py
Python
mit
78,761
""" Flask Documentation: http://flask.pocoo.org/docs/ Jinja2 Documentation: http://jinja.pocoo.org/2/documentation/ Werkzeug Documentation: http://werkzeug.pocoo.org/documentation/ """ import os from flask import Flask # from flask.ext.sqlalchemy import SQLAlchemy app = Flask(__name__) app.config['SECRET_KE...
richstoner/incf_engine
engine/app.py
Python
mit
679
#!/usr/bin/python import struct import sys import math if len(sys.argv) != 2: print "Usage: gen-factorial filename" sys.exit(1) outfile = open(sys.argv[1], 'wb') i = 0 try: while True: outfile.write(struct.pack("<d", float(math.factorial(i)))) i += 1 except OverflowError: pass outfi...
yellcorp/Yellib
raw/src/org/yellcorp/lib/math/gen-factorial.py
Python
mit
331
# -*- coding: utf-8 -*- # # HSPI documentation build configuration file, created by # sphinx-quickstart on Sun Feb 26 17:22:42 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All ...
dpmurphy/HSPI
docs/source/conf.py
Python
mit
5,577
""" Source: http://code.activestate.com/recipes/578225-linux-ioctl-numbers-in-python/ Linux ioctl numbers made easy size can be an integer or format string compatible with struct module for example include/linux/watchdog.h: #define WATCHDOG_IOCTL_BASE 'W' struct watchdog_info { __u32 options; ...
datacode-taavi/python-spi
spi/ioctl_numbers.py
Python
mit
1,678
#!/usr/bin/env python old_new_salaries = [ # (old_salary, new_salary) (2401, 2507), (2172, 2883), (2463, 2867), (2462, 3325), (2949, 2974), (2713, 3109), (2778, 3771), (2596, 3045), (2819, 2848), (2974, 3322), (2539, 2790), (2440, 3051), (2526, 3240), (2869, 3635), (2341, 2495), (2197, 2897), (2706...
OmniaGM/spark-training
quiz/quiz1/quiz.py
Python
mit
628
import _plotly_utils.basevalidators class ColorValidator(_plotly_utils.basevalidators.ColorValidator): def __init__( self, plotly_name="color", parent_name="layout.xaxis.tickfont", **kwargs ): super(ColorValidator, self).__init__( plotly_name=plotly_name, parent_name=pa...
plotly/plotly.py
packages/python/plotly/plotly/validators/layout/xaxis/tickfont/_color.py
Python
mit
418
import tensorflow as tf import numpy as np import sys from libgnt.character_index import character_index from utils.show_tf_image import show_tf_image from utils.array_top_n_indexes import array_top_n_indexes import os def main(): if len(sys.argv) < 3: print("usage: predict.py MODEL PNG_FILE") sys....
astromme/classify-handwritten-characters
predict.py
Python
mit
1,285
import os import sys import time from magnolia.utility import * from magnolia.utility import LOG as L from magnolia.script.kancolle import testcase_normal class TestCase(testcase_normal.TestCase_Normal): def __init__(self, *args, **kwargs): super(TestCase, self).__init__(*args, **kwargs) @classmethod...
setsulla/stir
project/magnolia/script/kancolle.old/exercises.py
Python
mit
1,442
#!/usr/bin/env python """ Copyright (C) 2014 Ivan Gregor 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 later version. ...
CAMI-challenge/evaluation
binning/igregor/algbioi/eval/cami.py
Python
mit
3,516
__author__ = 'reggie' ###START-CONF ##{ ##"object_name": "injector", ##"object_poi": "injector-9192", ##"auto-load": true, ##"remoting" : true, ##"parameters": [ ## { ## "name": "inject", ## "type": "Composite", ## "state" : "ALL_RAW", ## ...
recap/pumpkin
examples/tracula/injector.py
Python
mit
2,720
VERSION = (2, 4, 1) from .decorators import job from .queues import enqueue, get_connection, get_queue, get_scheduler from .workers import get_worker
ui/django-rq
django_rq/__init__.py
Python
mit
151
from browser import window, document as doc, console import net import sim import json CTX = None """ Bitwrap context """ CTL = None """ UI control interface """ def __onload(ctx): """ use snap to begin creating an SVG """ global CTL CTL = Editor() window.jQuery('#net').on('click', CTL.on_insert) ...
stackdump/txbitwrap
txbitwrap/_brython/ctl.py
Python
mit
7,943
# -*- coding: utf-8 -*- """ Created on Wed Jun 24 17:55:05 2015 @author: LLP-admin """ import os import time import pandas as pd import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from sklearn.decomposition import PCA #encoding from sklearn.preprocessing import LabelEncoder ...
cocoaaa/ml_gesture
feature_selection.py
Python
mit
14,963
from __future__ import print_function import os twyg = ximport('twyg') # reload(twyg) datafiles = list(filelist( os.path.abspath('example-data'))) datafile = choice(datafiles) configs = [ 'boxes', 'bubbles', 'edge', 'flowchart', 'hive', 'ios', 'jellyfish', 'junction1', 'junction2', 'modern', 'nazca', '...
karstenw/nodebox-pyobjc
examples/New Functions/twyg/demo1.py
Python
mit
1,032
from django.db import models from .querysets import SongQuerySet class SongManager(models.Manager): def get_queryset(self): return SongQuerySet(self.model, using=self._db) def available(self): return self.get_queryset().songs().enabled().published()
RecursiveGreen/spradio-django
savepointradio/radio/managers.py
Python
mit
278
# -*- coding: utf-8 -*- # Resource object code # # Created: Sun Feb 8 12:30:31 2015 # by: The Resource Compiler for PyQt (Qt v4.8.6) # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore qt_resource_data = "\ \x00\x00\x0f\x0a\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x4...
c0deforfun/LLL
ui/resources_rc.py
Python
mit
138,528
# -*- coding: utf-8 -*- import cPickle import sys, os import numpy as np # written by zhaowuxia @ 2015/5/22 # used for generate datasets for the adding problem def generate_data(pkl_path, T, norm): dataset = [] for f in os.listdir(pkl_path): data = cPickle.load(open(os.path.join(pkl_path, f), 'rb')) ...
Dlyma/keras-plus
keras/datasets/stock.py
Python
mit
1,315
from distutils.core import setup setup( name = 'loki', version = '0.5.6', description = 'Simple model for galactic kinematics of low-mass stars', author = 'Christohper Theissen', author_email = 'ctheissen@gmail.com', license = 'MIT', url = 'https://github.com/ctheissen/LoKi', download_u...
ctheissen/LoKi
setup.py
Python
mit
1,403
def revrot(digits, n): if not n: return '' result = [] for a in xrange(0, len(digits) - n + 1, n): current = digits[a:a + n] if not sum(int(b) ** 3 for b in current) % 2: result.append(current[::-1]) else: result.append('{0}{0}'.format(current)[1:n + 1...
the-zebulan/CodeWars
katas/kyu_6/reverse_or_rotate.py
Python
mit
350
#!/usr/bin/env python """Command line wrappers""" import os import sys from collections import deque import click from colorama import Fore, Style, init from loguru import logger import genomepy init(autoreset=True) CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"]) @click.group(context_settings=CONTEXT_...
simonvh/genomepy
genomepy/cli.py
Python
mit
11,846
#!/usr/bin/env python3 import csv import sqlite3 # requires python3 # requires sqlite3 # sqldb = sqlite3.connect(':memory:') def main: while True: input_location = input("Please provide the pathname of the file you wish to extract data from. Enter a blank line when you are done.") if input_location = False: ...
fedallah/dsperf
pytest_2.py
Python
mit
1,084
from flask import g, session from yoi.app import app @app.before_request def get_current_user(): if session.get('user_id'): g.user = app.db.User.get(session['user_id']) else: g.user = None
doptio/you-owe-it
yoi/authentication.py
Python
mit
215
import copy import unittest import warnings import mock import numpy import chainer from chainer.backends import cuda from chainer.backends import intel64 from chainer import initializers from chainer import testing from chainer.testing import attr class TestLink(unittest.TestCase): def setUp(self): x_...
ronekko/chainer
tests/chainer_tests/test_link.py
Python
mit
71,956
class Wifi: state = "supplicant_state" state_completed = "completed" state_scanning = "scanning" ip = "ip_address"
dimashi/TemprMonitor
src/wifi.py
Python
mit
133
"""Test suite for hash tables.""" from hash_table import HashTable, naive_hash from os import path import pytest from faker import Faker dictionary = path.realpath(__file__).replace('test_hash.py', 'american-english') with open(dictionary, 'r') as dictionary: dictiona...
CaHudson94/data-structures
src/Completed/test_hash.py
Python
mit
4,487
# -*- coding: utf-8 -*- from smtplib import SMTP_SSL from email.mime.multipart import MIMEMultipart from email.mime.image import MIMEImage from email.mime.text import MIMEText client = SMTP_SSL("smtp.qq.com") # 此处填写自己的邮箱账号和授权码, client.login('shiyanlou@qq.com', 'shiyanlou') # 打开图片文件 with open("test_img.png", "rb") a...
MiracleWong/PythonBasic
mail/send_email_and_picture.py
Python
mit
800
#-*- coding: utf-8 -*- from logpot.ext import db from logpot.models import TimestampMixin from passlib.hash import pbkdf2_sha256 class User(db.Model, TimestampMixin): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String, unique=True, nullable=False) email =...
moremorefor/Logpot
logpot/auth/models.py
Python
mit
953
import unittest from isogram import is_isogram # Tests adapted from `problem-specifications//canonical-data.json` @ v1.7.0 class IsogramTest(unittest.TestCase): def test_empty_string(self): self.assertIs(is_isogram(""), True) def test_isogram_with_only_lower_case_characters(self): self.ass...
N-Parsons/exercism-python
exercises/isogram/isogram_test.py
Python
mit
1,889
""" This module reads temperature from NTC thermistor connected to ads111x. Circuit diagram for this module should be like this: Vcc --- | | .-. | | | | R1 '-' | o----------------o------------> ads111x input | | | | | ...
Nikolay-Kha/PyCNC
cnc/sensors/thermistor.py
Python
mit
1,948
#SBaaS from .stage02_physiology_graphData_io import stage02_physiology_graphData_io from SBaaS_models.models_COBRA_execute import models_COBRA_execute from .stage02_physiology_analysis_query import stage02_physiology_analysis_query #System import copy class stage02_physiology_graphData_execute(stage02_physiology_graph...
dmccloskey/SBaaS_COBRA
SBaaS_COBRA/stage02_physiology_graphData_execute.py
Python
mit
4,655
# -*- coding: utf-8 -*- from queue.producer import Producer from queue.consumer import Consumer from queue.bloom_filter import BloomFilter class Dytt: def main(): for i in range(15): # Producer().start() Consumer().start() if __name__ == '__main__': main()
zoucaitou/azeroth-spider
azeroth_spider/dytt.py
Python
mit
310
# -*- coding: utf-8 -*- from ccxt.base.exchange import Exchange from ccxt.base.errors import ExchangeError from ccxt.base.errors import NotSupported class bitstamp1 (Exchange): def describe(self): return self.deep_extend(super(bitstamp1, self).describe(), { 'id': 'bitstamp1', 'na...
tritoanst/ccxt
python/ccxt/bitstamp1.py
Python
mit
10,277
outdata1 = divmod(20,8) # prefix an argument with a star when calling a function to unpack tuple t = (20,8) outdata2 = divmod(*t) import os # Note that filename = hh.grad _, filename = os.path.split('/nfs/j3/hh.grad') # Using * to grab excess items # Can be used in python3, but not in python2 # a, b, *rest = range...
helloTC/LearnPython
fluent_python/array_of_sequences/tuple_as_record.py
Python
mit
1,025
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Based on AboutSandwichCode in the Ruby Koans # from runner.koan import * import re # For regular expression string comparisons class AboutWithStatements(Koan): def count_lines(self, file_name): try: file = open(file_name) try: ...
kimegitee/python-koans
python3/koans/about_with_statements.py
Python
mit
3,602
#!/usr/bin/env python # coding: utf-8 from module import Module import numpy as np try: from im2col_cyt import im2col_cython, col2im_cython except ImportError: print('Installation broken, please reinstall PyFunt') from numpy.lib.stride_tricks import as_strided def tile_array(a, b1, b2): r, c = a.shape ...
dnlcrl/PyFunt
pyfunt/spatial_up_sampling_nearest.py
Python
mit
2,179
# -*- coding: utf-8 -*- """ Created on Mon Oct 23 03:24:37 2017 @author: Yuki """ import os,sys,logging ENTRYPOINT=__path__[0] ICONPATH=os.path.join(ENTRYPOINT,'Icons','logo.png') KUCHINAWA='Kuchinawa' from kuchinawa.Compile import compileUi from kuchinawa.Thread import Main #change the multiprocessing's context to...
threemeninaboat3247/kuchinawa
kuchinawa/__init__.py
Python
mit
687
import tensorflow as tf import cPickle as pickle import rnn_model import cnn_model from dataloader import Dataloader #import psycopg2 import os import datetime import numpy as np import argparse from util.util import write_status_file, read_status_file, params2name import sys """ This file contains three functions. ...
TUM-LMF/fieldRNN
train.py
Python
mit
20,521
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('workshops', '0068_auto_20160119_0629'), ('workshops', '0068_auto_20160119_1247'), ] operations = [ ]
pbanaszkiewicz/amy
amy/workshops/migrations/0069_merge.py
Python
mit
301
""" The MIT License (MIT) Copyright (c) 2013 Pawel Kalinowski 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, me...
pawelkalinowski/project-python
Fibonacci n-th number (iterative).py
Python
mit
1,745
#!/usr/bin/python # This script uses cbmc to find a WCET value of an timing-annotated C source. # it keeps running cbmc until either the user aborts or the WCET cannot be # tightened anymore. # # Major Version: 3 # - proper XML parsing # - collection of all counterexamples # Last update: # - 2018/Feb/16: allow mult...
TRDDC-TUM/wcet-benchmarks
scripts/find_wcet.py
Python
mit
38,915
import numpy as np import pytest from sklearn.preprocessing import StandardScaler from sklearn.utils import check_random_state import fri from fri import genLupiData from fri.parameter_searcher import find_best_model @pytest.fixture(scope="session") def randomstate(): return check_random_state(1337) @pytest.ma...
lpfann/fri
fri/tests/test_parameter_searcher.py
Python
mit
1,221