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
#!/usr/bin/python # -*- coding: utf-8 -*- """ fabfile.py ~~~~~~~~~~~~~~ A brief description goes here. """ try: from config import MACHINES except ImportError as e: print "You should cp config.py.sample config.py, and modify it then" raise e for node in MACHINES['slave']: print node
luozhaoyu/TTTT
outputSlaves.py
Python
mit
313
""" .. module: _map_logic :synopsis: Defines functions used in the Map class involving the game state; for instance, collecting resources and making a move. All of these functions are stored as methods for the Map class (see map.py). """ from . import cell import numpy as np def collectResources(self):...
wshand/hex-towns
src/map/_map_logic.py
Python
mit
4,276
import os import zmq import json import logging logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.INFO) buoy_data_folder = os.path.join(os.environ['RESOURCE_DIR'], 'buoy') context = zmq.Context() socket = context.socket(zmq.SUB) socket.connect ('tcp://broker:5557') socket.setsockopt(zmq.SUBSCRIBE...
kchard/surframble
buoy_to_json/buoy_to_json.py
Python
mit
644
# THIS FILE IS AUTO-GENERATED. DO NOT EDIT from verta._swagger.base_type import BaseType class UacUpdateUserResponse(BaseType): def __init__(self, info=None): required = { "info": False, } self.info = info for k, v in required.items(): if self[k] is None and v: raise ValueError('...
mitdbg/modeldb
client/verta/verta/_swagger/_public/uac/model/UacUpdateUserResponse.py
Python
mit
575
from django.contrib import admin from .models import Book class BookAdmin(admin.ModelAdmin): pass admin.site.register(Book, BookAdmin)
bpgc-cte/python2017
Week 7/django/src/main/admin.py
Python
mit
137
#!/usr/bin/env python3 import numpy as np import matplotlib.pyplot as plt from hidespines import * import sys sys.path.append('../../code') import ld as LD if (len(sys.argv) > 1): outfile = sys.argv[1] else: outfile = None N = 100 n = 8 xb = 50 tol = 1e-6 nruns = 20 eps = np.logspace(-6, 0, nruns) ite...
smsolivier/VEF
tex/paper/s2sa.py
Python
mit
1,074
#!/usr/bin/python # # linearize.py: Construct a linear, no-fork, best version of the blockchain. # # # Copyright (c) 2013 The SaveCoin developers # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # import json import struct imp...
SureshMatsui/SaveCoin
contrib/linearize/linearize.py
Python
mit
3,354
from _ppeg import Pattern as P class Var: def __getattr__(self, name): return P.Var(name) V = Var() EndOfFile = P(-1) EndOfLine = P("\r\n") | P("\r") | P("\n") Space = P(" ") | P("\t") | V.EndOfLine Comment = P("#") + (-V.EndOfLine + P(1))**0 + V.EndOfLine Spacing = (V.Space | V.Comment)...
moreati/ppeg
pegmatcher.py
Python
mit
3,520
from django.db import models from django.contrib.auth import models as auth_models #TODO (shauno): Change this to use explicit imports from venues import models as venue_models # Create your models here. class Sighting(models.Model): when = models.DateTimeField() venue = models.ForeignKey(venue_models.Venue)...
shaunokeefe/hoponit
hoponit/sightings/models.py
Python
mit
583
# 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 ...
lmazuel/azure-sdk-for-python
azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/virtual_network_peering_py3.py
Python
mit
4,156
######################################## # Read ECMWF netcdf files for heat fluxes # # Created by: Peter Willetts # Created on: 12/06/2014 # # ECMWF heat and radiation flux - Read from netcdf # filter by date, latitude and longitude # calculate mean and t...
peterwilletts24/Python-Scripts
era_interim/netcdf_fileread_heat_fluxes_12hourly_heat.py
Python
mit
4,209
from tests.integration.create_token import create_token from tests.integration.integration_test_case import IntegrationTestCase class TestQuestionnairePreviousLink(IntegrationTestCase): def test_previous_link_doesnt_appear_on_introduction(self): # Given token = create_token('final_confirmation', ...
qateam123/eq
tests/integration/questionnaire/test_questionnaire_previous_link.py
Python
mit
2,654
#this module here is to compute the formula to calculate the new means and #new variance. def update(mean1, var1, mean2, var2): new_mean = ((mean1 * var2) + (mean2*var1))/(var1 + var2) new_var = 1/(1/var1 + 1/var2) return [new_mean, new_var] def predict(mean1, var1, mean2, var2): new_mean = mea...
napjon/moocs_solution
robotics-udacity/2.4.py
Python
mit
465
"""Impostor.""" __version__ = "2.0.5" __author__ = "Marko Samastur" __email__ = "markos@gaivo.net" __mantainer__ = "Andreu Vallbona" __mantainer_email__ = "avallbona@gmail.com" default_app_config = "impostor.apps.ImpostorConfig"
samastur/Impostor
impostor/__init__.py
Python
mit
229
#coding:utf-8 import urllib2 from t import T class P(T): def __init__(self): T.__init__(self) def verify(self,head='',context='',ip='',port='',productname={},keywords='',hackinfo=''): timeout=3 target_url = 'http://'+ip+':'+port result = {} result['result']=False ...
nanshihui/PocCollect
middileware/resin/resin_crackpass.py
Python
mit
2,249
import os import subprocess import unittest SHELLS = ['/bin/dash', '/bin/bash'] class TestStartSh(unittest.TestCase): def setUp(self): open('ut_newest.qcow2', 'a').close() def tearDown(self): os.remove('ut_newest.qcow2') def test_imageArgument(self): out = self.run_start([]) ...
lentinj/ie-vm
tests/test_start.py
Python
mit
988
# # Kivy - Cross-platform UI framework # https://kivy.org/ # import sys build_examples = False if "--build_examples" in sys.argv: build_examples = True sys.argv.remove("--build_examples") from kivy.utils import pi_version from copy import deepcopy import os from os.path import join, dirname, sep, exists, base...
rnixx/kivy
setup.py
Python
mit
44,052
#!/usr/local/bin/python # -*- coding: utf-8 -*- """ - LICENCE The MIT License (MIT) Copyright (c) 2016 Eleftherios Anagnostopoulos for Ericsson AB (EU FP7 CityPulse Project) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software...
pinac0099/dynamic-bus-scheduling
tests/mongodb_database_connection_test.py
Python
mit
29,881
#!/usr/bin/env python3 print('hello hello hello')
bobisme/hello
python/hello3.py
Python
mit
50
# -*- coding: utf-8 -*- import sublime, sublime_plugin import sys import os if sys.version_info < (3, 0): from chardet.universaldetector import UniversalDetector NONE_COMMAND = (None, None, 0) ST3 = False else: from .chardet.universaldetector import UniversalDetector NONE_COMMAND = ('', None, 0) ST3 = True impor...
naokimiyasaka/sublime-text
Backup/20140106101521/ConvertToUTF8/ConvertToUTF8.py
Python
mit
19,869
# THIS FILE IS AUTO-GENERATED. DO NOT EDIT from verta._swagger.base_type import BaseType class ModeldbFindHydratedProjectsByTeam(BaseType): def __init__(self, find_projects=None, org_id=None, name=None, id=None): required = { "find_projects": False, "org_id": False, "name": False, "id": F...
mitdbg/modeldb
client/verta/verta/_swagger/_public/modeldb/model/ModeldbFindHydratedProjectsByTeam.py
Python
mit
1,079
from bucketlist import create_app, db from bucketlist.models import User, Bucketlist, Item import json import unittest class BaseTestCase(unittest.TestCase): def setUp(self): """ this function creates the base test""" self.app = create_app(config_name="development") self.client = self.ap...
kevintumbo/Checkpoint2_Bucketlist
tests/base_test.py
Python
mit
2,589
# _*_ coding:utf-8 _*_ from django.shortcuts import render from django.views.generic.base import View from django.http import HttpResponse from pure_pagination import Paginator, EmptyPage, PageNotAnInteger from .models import Course, Lesson from operation.models import UserFavorite # Create your views here. class ...
sunzhongyuan/MxOnline
apps/courses/views.py
Python
mit
2,367
from Memory import * from Giga import * from Cube import * def executeVirtualMachine(functions, quadruples, constants): print("Virtual machine running...") countQuadruples = 0 activeMemory = Memory('module', constVarCount , tempVarCount) globalMemory = Memory('main', globalVarCount , 0) while quadruples[c...
sanchezz93/Giga-Compiler
Entrega 5/Machine.py
Python
mit
8,699
def merge_intervals(data): """ data = [(10,20), (15,30), (100, 200)] out = [(10,30), (100,200)] """ if len(data)==0: return data result = [] saved = list(data[0]) for st, en in sorted([sorted(t) for t in data]): if st <= saved[1]: saved[1] = max(saved[1], en) ...
matteocereda/RNAmotifs
m3_light/utils/__init__.py
Python
mit
2,230
from __future__ import unicode_literals from logging import getLogger from django.conf import settings from django.core.cache import cache from django.views.generic import View from django.http import JsonResponse, HttpResponseBadRequest from django.template.defaultfilters import slugify from ratelimit.mixins import ...
AASHE/hub
hub/apps/api/views.py
Python
mit
3,271
from __future__ import print_function, division import math from values import Value, Symbol from vm import numbers, pre_execute def instance_validate_value_type(types=(object,)): def inner_decorator(execute): def actual_validate(self, context, *terms): for t in terms: if not...
joe-jordan/minimalisp
minimalisp/maths.py
Python
mit
2,519
from compiler import * #################################################################################################################### # Each party record contains the following fields: # 1) Party id: used for referencing parties in other files. # The prefix p_ is automatically added before each party id. #...
Sw4T/Warband-Development
mb_warband_module_system_1166/Module_system 1.166/module_parties.py
Python
mit
34,291
import pandas as pd import re df = pd.read_csv('data/combined_clean.csv', index_col='id') #Replace name wit title regex = '.*,{1}\s{1}([a-zA-Z\s]+)\.{1}.*' name_title = df.name.map(lambda name: re.search(regex, name).group(1)) df.name = name_title #Cabin with first letter prefix_cabin = df.cabin.map(lambda c: c[:1])...
edublancas/titanic
pipeline/feature_extraction.py
Python
mit
1,081
from django.http import HttpResponse,HttpResponseRedirect from django.shortcuts import render_to_response from django import forms from django.forms import ModelForm from django.db.models import F from django.db import connection from django.utils import simplejson from django.contrib import messages from django.contri...
yejia/osl_notebook
scraps/views.py
Python
mit
5,990
# Copyright 2007 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. """Fixer for dict methods. d.keys() -> list(d.keys()) d.items() -> list(d.items()) d.values() -> list(d.values()) d.iterkeys() -> iter(d.keys()) d.iteritems() -> iter(d.items()) d.itervalues() -> iter(d.values()) Exc...
MalloyPower/parsing-python
front-end/testsuite-python-lib/Python-3.1/Lib/lib2to3/fixes/fix_dict.py
Python
mit
3,570
#!/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. # Base class for RPC testing import logging import optparse import os import sys import shutil import te...
bcamacho/diverscoin
qa/rpc-tests/test_framework/test_framework.py
Python
mit
8,261
#!/usr/bin/python3.2 # p1 = "mr" p2 = "duck" p3 = "i'm" p4 = "done" p5 ="." # print("{0}. {1}, {2} {3}{4}".format(p1,p2,p3,p4,p5)) # p1 = "mr. duck" p2 = "i'm done" print("{mrduck}. {imdone}".format(mrduck=p1,imdone=p2)) # print("{0:{1}} is the food of the gods ...".format("Ambrosia", 15)) # print("%s, %s." % ("mr. duc...
ombt/ombt
pythonsrc/quick_python_book/chap6/string_format.py
Python
mit
346
"""Measure the distance or depth with an HCSR04 Ultrasonic sound sensor and a Raspberry Pi. Imperial and Metric measurements are available""" # Al Audet # MIT License from __future__ import division import time import math import warnings import RPi.GPIO as GPIO class Measurement(object): """Create a measurem...
alaudet/hcsr04sensor
hcsr04sensor/sensor.py
Python
mit
8,573
#from django.test import TestCase from datetime import date from decimal import * from django.core.urlresolvers import reverse from django.contrib.auth.models import User from rest_framework.test import APITestCase from rest_framework.authtoken.models import Token from .models import * from .mommy_recipes import * ...
ibamacsr/painelmma_api
restApp/tests.py
Python
mit
8,630
""" A micro wx App with a list of the things checked on the checklist. """ import datetime import random import wx import hotmodel import production import hotwidgets class ProcView(hotwidgets.MVCList): """ A specialized version of MVCList that sets columns for the process op...
petrblahos/modellerkit
step07/view03.py
Python
mit
4,058
""" Cryo-EM density map I/O @warning: dragons ahead, this module is experimental """ import numpy import struct class DensityMapFormatError(ValueError): pass class ByteOrder(object): NATIVE = '=' LITTLE = '<' BIG = '>' class DensityInfo(object): def __init__(self, data, spacing, origin...
csb-toolbox/CSB
csb/bio/io/mrc.py
Python
mit
9,732
# -*- coding: utf-8 -*- # Copyright (c) 2016 Jérémie DECOCK (http://www.jdhp.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 right...
jeremiedecock/tictactoe-py
jdhp/tictactoe/game.py
Python
mit
4,264
import subprocess import pandas as pd import tempfile import os __all__ = ['runRscript'] def runRscript(Rcmd, inDf=None, outputFiles=0, removeTempFiles=None): """Runs an R cmd with option to provide a DataFrame as input and file as output. Params ------ Rcmd : str String containing the R-...
agartland/utils
.ipynb_checkpoints/quickr-checkpoint.py
Python
mit
5,563
import os import sys import PyFBA import argparse parser = argparse.ArgumentParser(description='Find reactions associated with a compound') parser.add_argument('-c', help='compound name', required=True) args = parser.parse_args() compounds, reactions, enzymes = PyFBA.parse.compounds_reactions_enzymes('gramnegative...
linsalrob/PyFBA
example_code/find_reactions_by_compound.py
Python
mit
1,297
import pytest def test_look(player, gold): player.perform("look") assert player.saw("a gold coin (50)") def test_get_all_implicit(player, gold): player.perform("get gold") assert player.saw("You pick up a gold coin (50).") player.forget() player.perform("look") assert player.did_not_see(...
vreon/figment
examples/theworldfoundry/tests/test_spatial_stackable.py
Python
mit
6,050
# -*- coding: utf-8 -*- from os import system def alert(msg, title=u'通知'): """ osascript -e 'display notification "Lorem ipsum dolor sit amet" with title "Title"' """ cmd = u"osascript -e 'display notification \"%s\" with title " \ u"\"%s\"'" % (msg, title) print cmd system(cmd.e...
graycarl/moon
moon/mac.py
Python
mit
340
#!/usr/bin/env python from distutils.core import setup version='1.0.1' setup( name='funny-codes', version=version, author='Mikhail Korobov', author_email='kmike84@gmail.com', packages=['funny_codes'], url='https://bitbucket.org/kmike/funny-codes/', license = 'MIT license', descriptio...
kmike/funny-codes
setup.py
Python
mit
712
from django.shortcuts import render from django.db.models import Count from django.core import serializers from django.http import HttpResponse from photo.models import Photo def index(request): categories = Photo.objects.raw('select id, category from swan_photo group by category') subcategories = Photo.object...
huaiping/pandora
photo/views.py
Python
mit
1,348
""" Tree and graph transformations. """ from typing import Optional, Dict, Set, List, Tuple import logging from penman.types import (Variable, Target, BasicTriple, Node) from penman.exceptions import ModelError from penman.epigraph import (Epidatum, Epidata) from penman.surface import (Alignment, RoleAlignment, alig...
goodmami/penman
penman/transform.py
Python
mit
13,014
""" Copyright 2011 Dmitry Nikulin This file is part of Captchure. Captchure 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 ...
Apkawa/simple-captcha-ocr-opencv
cap_extra/extras.py
Python
mit
4,861
import parser import geojson import os.path gateway_marker_symbols = {} def build(data_point): coords = parser.get_coords(data_point) if coords is None: raise ValueError("No GPS data") point = geojson.Point(coords) props = dict(hash=data_point['hash'], time=data_point['time'], ...
gonzalocasas/ttn-coverage-tracker
features.py
Python
mit
1,967
#!/usr/bin/env python3 import pytest from providers.mailgun import MailGunProvider from send_error import SendError import init_test_objects def test_mailgun_send_positive(): """Straightforward mailgun send test. Will fail if an error is raised by the provider.""" mailgun_provider = MailGunProvider(init_test...
lyuboraykov/columba
tests/test_mailgun_provider.py
Python
mit
1,859
""" Packetizer class. """ import asyncio import socket import struct import zlib import ipaddress from datetime import datetime from time import time from libwavesync import time_machine class Packetizer: """Read chunks from queue, add timestamp marks and send over multicast.""" HEADER_COMPRESSED_AUDIO = b...
blaa/WaveSync
libwavesync/packetizer.py
Python
mit
7,795
# imports import pandas as pd import numpy as np import time import os from tabulate import tabulate import sys from operator import add from pyspark import SparkContext from pyspark.sql import SparkSession from pyspark.sql import SQLContext from pyspark.sql import functions as F #https://stackoverflow.com/questions/3...
kcrandall/Kaggle_Mercedes_Manufacturing
spark/experiements/jingning/experiment1.py
Python
mit
13,439
# -*- coding: utf-8 -*- from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('stats', '0021_set_normalized_stress'), ] operations = [ migrations.AddField( model_name='scenario', name='is_public', field=mod...
UUDigitalHumanitieslab/timealign
stats/migrations/0022_scenario_is_public.py
Python
mit
448
# -*- coding: utf-8 -*- from random import uniform from time import sleep from selenium.common.exceptions import NoSuchElementException from pybot.whatsapp.driver import ChromeFactory from pybot.whatsapp.util.AppUtil import new_pagesource_path from pybot.whatsapp.util.AppUtil import new_screenshot_path RANDOM_SLEEP...
iren86/whatsapp-pybot
pybot/whatsapp/feature/BaseFeature.py
Python
mit
2,691
from __future__ import unicode_literals import os from mopidy import config, ext __version__ = '0.3.1' class Extension(ext.Extension): dist_name = 'Mopidy-AudioAddict' ext_name = 'audioaddict' version = __version__ def get_default_config(self): conf_file = os.path.join(os.path.dirname(__fi...
nilicule/mopidy-audioaddict
mopidy_audioaddict/__init__.py
Python
mit
1,094
import random """Define const graphs""" EX_GRAPH0 = {0: set([1, 2]), 1: set([]), 2: set([])} EX_GRAPH1 = { 0: set([1, 4, 5]), 1: set([2, 6]), 2: set([3]), 3: set([0]), 4: set([1]), 5: set([2]), 6: set([]) } EX_GRAPH2 = { 0: set([1, 4, 5]), 1: set([2, 6]), 2: set([3, 7]), 3: ...
DmitryTsybin/Study
Coursera/Algorithmic_Thinking/Project_1/Project_1_Degree_distributions_for_graphs.py
Python
mit
2,805
import asyncio import logging import signal from concurrent.futures import CancelledError, ThreadPoolExecutor from contextlib import suppress logger = logging.getLogger(__name__) class LoaferRunner: def __init__(self, max_workers=None, on_stop_callback=None): self._on_stop_callback = on_stop_callback ...
georgeyk/loafer
loafer/runners.py
Python
mit
1,955
#!/usr/bin/python3 import numpy, sys #from test.generate_test_vectors import TestVectorGenerator import pyximport; pyximport.install() from lsh import bits class Projection: def __init__(self, n_bits, n_feats): self.n_bits = n_bits self.n_feats = n_feats self.vectors = numpy.random.randn(se...
schwa-lab/lsh
lsh/hashes.py
Python
mit
2,098
# -*- coding: utf-8 -*- """ By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? """ from time import time s = time() x = 3 priem = [2, 3] while len(priem) < 10001: x += 2 for y in priem: if x % y == 0: break else: priem....
hendrikjeb/Euler
07.py
Python
mit
364
namespace SeriesNamer { partial class UpdateTool { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <p...
madeso/prettygood
dotnet/SeriesNamer/UpdateTool.Designer.py
Python
mit
4,446
import pytest import vaex pytest.importorskip("sklearn") from vaex.ml.sklearn import Predictor, IncrementalPredictor import numpy as np # Regressions from sklearn.linear_model import LinearRegression, Ridge, Lasso, SGDClassifier, SGDRegressor from sklearn.svm import SVR from sklearn.ensemble import AdaBoostRegressor,...
maartenbreddels/vaex
tests/ml/sklearn_test.py
Python
mit
11,265
import matplotlib.pyplot as plt import numpy as np from scipy.stats import gaussian_kde from scipy.stats.distributions import norm from sklearn.grid_search import GridSearchCV from sklearn.neighbors import KernelDensity data = [1.5] * 7 + [2.5] * 2 + [3.5] * 8 + [4.5] * 3 + [5.5] * 1 + [6.5] * 8 density = gaussian_kde...
linsalrob/EdwardsLab
matplotlib graphs/kde.py
Python
mit
1,377
from __future__ import absolute_import from __future__ import print_function import torch.nn as nn def l1_loss(size_ave=True): return nn.L1Loss(size_average=size_ave) def mse_loss(size_ave=True): return nn.MSELoss(size_average=size_ave) def ce_loss(loss_weight=None, size_ave=True): return nn.CrossEntrop...
deepnn/coffee
covfefe/frameworks/torch/objectives.py
Python
mit
1,703
import pytest CODEVERSION = '0.0.1' NEW_CODEVERSION = '0.0.2' @pytest.fixture() def campaign(): from psiturk.models import Campaign parameters = { 'codeversion': CODEVERSION, 'mode': 'sandbox', 'goal': 100, 'minutes_between_rounds': 1, 'assignments_per_round': 10, ...
NYUCCL/psiTurk
tests/test_tasks.py
Python
mit
3,640
#!/usr/bin/env python3 from math import factorial def memoize(func): cache = {} def inner(n, m): if not (n, m) in cache: cache[(n, m)] = func(n, m) return cache[(n, m)] return inner @memoize def choose(n, m): if not (0 <= m <= n): return 0 else: ret...
Bolt64/my_code
euler/non_bouncy_numbers.py
Python
mit
1,200
''' Class definition ''' from __future__ import print_function # from IPython.core.debugger import Tracer class SimCaseSimple: prefix='sample1' # the beta parameters; beta0 is the base value (a list of double, size nsgRNA) beta0=[] # beta1 (a nsample*r) is the beta values of different conditions beta1=[0] ...
knightjdr/screenhits
api/app/scripts/CRISPR/MAGeCK/v0.01/lib/python2.7/site-packages/mageck/mleclassdef.py
Python
mit
4,322
import ProteinAnalyzer as pa import fileManager as files import matplotlib.pyplot as plt import simulation print('End of Summer Presentation Files') simNames = pa.selectMultipleSimulations() simNames2 = pa.selectMultipleSimulations() sims = [] sims2 = [] simNames3 = pa.selectMultipleSimulations() sims3 = [] for coun...
melt6457/MMProteinAnalysis
Source/presentation.py
Python
mit
2,760
from keras.engine import Layer from keras.engine import InputSpec from .. import backend as K
stygstra/keras-contrib
keras_contrib/layers/wrappers.py
Python
mit
94
import unittest import sys import json import time sys.path.append('../../src') import fbp from fbp.port import Inport, Outport from fbp.node import Node from fbp.flow import Flow class TestFBPPort(unittest.TestCase): @classmethod def setUpClass(cls): pass @classmethod def tearDownClass(c...
gangtao/pyflow
tests/unit/test_flow.py
Python
mit
4,506
# -*- coding:utf-8 -*- import json from pony.orm import db_session, delete, select from pony.orm.serialization import to_dict from project.db.model import Template, Project class ProjectHandle(object): def add_projects(self, projects): with db_session: projects = json.loads(projects) ...
kooksee/Jmonitor
project/service/project_handle.py
Python
mit
5,640
""" REST Resource cherrypy controller mixin to make it easy to build REST applications. handles nested resources and method-based dispatching. here's a rough sample of what a controller would look like using this: cherrypy.root = MainController() cherrypy.root.user = UserController() class PostController(RESTResou...
ActiveState/code
recipes/Python/444766_cherrypy_RESTResource/recipe-444766.py
Python
mit
6,312
def max_rectangle(heights): res = 0 heights.append(0) stack = [0] for i in range(1, len(heights)): while stack and heights[i] < heights[stack[-1]]: h = heights[stack.pop()] w = i if not stack else i - stack[-1] - 1 res = max(res, h * w) stack.append(i...
shenfei/oj_codes
leetcode/python/n85_Maximal_Rectangle.py
Python
mit
1,123
from django.conf import settings from django.contrib.auth.models import AnonymousUser from django.core.exceptions import ValidationError from django.core.mail import send_mail from django.core.urlresolvers import reverse from django.db import models, transaction from django.db.models import Count from django.db.models....
wagnerluis1982/speakerfight
deck/models.py
Python
mit
12,918
# tests.ontology_tests.create_tests # Tests for the create functionality of the ontology # # Author: Benjamin Bengfort <benjamin@bengfort.com> # Created: timestamp # # Copyright (C) 2014 Bengfort.com # For license information, see LICENSE.txt # # ID: create_tests.py [] benjamin@bengfort.com $ """ Tests for the crea...
mclumd/lene
tests/ontology_tests/create_tests.py
Python
mit
3,101
from time import time import abc # Create an interface IFoo # Create a sub-interface IFooBar # Create a class FooBarBaz implementing IFooBar # Repeatedly create an instance of FooBarBaz and pass it to a function # that wants an IFoo # Call foo # Time all the above # Create a single instance of FooBarBaz. Confirm wheth...
jongiddy/jute
compare/python_abc.py
Python
mit
1,481
import arcpy, os db = os.path.join(os.path.dirname(os.path.abspath(__file__)), r'eqedocsp.sde\AGRC.VW_DSHW_FACILITY') if arcpy.Exists(db): print('pass') else: print('fail')
agrc/deq-enviro
scripts/nightly/databases/test.py
Python
mit
187
# A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). # The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below). # How many possible unique paths are there? ...
abawchen/leetcode
solutions/062_unique_paths.py
Python
mit
837
""" Flarf: Flask Request Filter ------------- Configurable request filters """ from setuptools import setup setup( name='Flask-Flarf', version='0.0.5', url='https://github.com/thrisp/flarf', license='MIT', author='Thrisp/Hurrata', author_email='blueblank@gmail.com', description='Flask requ...
thrisp/flarf
setup.py
Python
mit
1,046
#!/usr/bin/env python # -*- coding: utf-8 -*- from runner.koan import * class AboutStringManipulation(Koan): def test_use_format_to_interpolate_variables(self): value1 = 'one' value2 = 2 string = "The values are {0} and {1}".format(value1, value2) self.assertEqual('The values are...
iceout/python_koans_practice
python2/koans/about_string_manipulation.py
Python
mit
2,781
from ceo import ridge_prediction as rp import ceo import os import os.path as op import pandas as pd import inspect data_path = op.join(ceo.__path__[0], 'Data') data_path = op.join(data_path, 'Cleaned Data') def test_pred_nuclear(): """ Function to test pred_nuclear Input: None Returns: ...
uwkejia/Clean-Energy-Outlook
ceo/test_ridge_prediction.py
Python
mit
3,043
#!/usr/bin/env python import wx import images #---------------------------------------------------------------------- text = """\ Right-click on any bare area of this panel (or Ctrl-click on Macs if you don't have a multi-button mouse) to show a popup menu. Then look at the code for this sample. Notice how the Po...
dnxbjyj/python-basic
gui/wxpython/wxPython-demo-4.0.1/demo/PopupMenu.py
Python
mit
4,928
import unittest class FakeTests(unittest.TestCase): def test_trueness(self): self.assertEquals(True and True, True)
haum/hms_twitter
hms_twitter/tests/test_twitter.py
Python
mit
130
#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: Timothy # # Created: 02/02/2015 # Copyright: (c) Timothy 2015 # Licence: <your licence> #------------------------------------------------------------------------------- import py...
Neomania/BeeSimulation
fonts.py
Python
mit
808
#from ALE reconciliations, print a list of gene fams originating at a node with P > 0.5. #python gene_copies_at_node.py reconciliation_file_dir node_number protein_outputfile import re, os, sys directory = sys.argv[1] node = int(sys.argv[2]) predicted_proteome_output_file = sys.argv[3] ancestral_threshold = 0.5 total...
Tancata/phylo
ALE/gene_originations_at_node.py
Python
mit
1,475
from __future__ import print_function import time import signal from datetime import datetime from django.core.management.base import NoArgsCommand from django.conf import settings from insekta.common.virt import connections from insekta.scenario.models import ScenarioRun, RunTaskQueue, ScenarioError from insekta.vm....
teythoon/Insekta
insekta/scenario/management/commands/vmd.py
Python
mit
2,945
import pygame fonts = [] is_initialized = False FONT_TINY = 0 FONT_SMALL = 1 FONT_BIG = 2 CENTER_X = 'center_x' def render(text, x, y, font_id, surface, render_mode=0): global is_initialized global fonts if not is_initialized: fonts = [ pygame.font.Font('gfx/MunroSmall.ttf', 10), ...
homecoded/radioberry
radio/TextRenderer.py
Python
mit
779
from pandac.PandaModules import * from toontown.toonbase.ToonBaseGlobal import * from direct.directnotify import DirectNotifyGlobal from direct.fsm import StateData from direct.showbase.PythonUtil import PriorityCallbacks from toontown.safezone import PublicWalk from toontown.launcher import DownloadForceAcknowledge im...
ToontownUprising/src
toontown/hood/Place.py
Python
mit
37,237
from twisted.internet import defer from jostedal.stun.agent import StunUdpProtocol, Message from jostedal.stun.authentication import CredentialMechanism from jostedal import stun from jostedal.stun import attributes import logging logger = logging.getLogger(__name__) class StunUdpClient(StunUdpProtocol): def __...
pexip/jostedal
jostedal/stun/client.py
Python
mit
3,811
# Author: M. Emre Aydın # Source: http://eayd.in/?p=232 import re def SyllableCounter(word): word = word.lower() # exception_add are words that need extra syllables # exception_del are words that need less syllables exception_add = ['serious','crucial'] exception_del = ['fortunately','unfortuna...
IrekRybark/pyiku
pyiku/syllable_counter.py
Python
mit
4,140
# 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/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_12_01/_compute_management_client.py
Python
mit
12,428
# 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/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_04_01/aio/operations/_managed_clusters_operations.py
Python
mit
54,887
# 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/network/azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/_virtual_network_peerings_operations.py
Python
mit
22,805
# 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. # ---------------------------------------------------------------------...
Azure/azure-sdk-for-python
sdk/purview/azure-purview-administration/azure/purview/administration/_version.py
Python
mit
347
for _ in range(int(input())): N, K = map(int, input().split()) print("YES" if all(a + b >= K for a, b in zip(sorted(int(x) for x in input().split()), reversed(sorted(int(x) for x in input().split())))) else "NO")
knuu/competitive-programming
hackerrank/algorithm/two_arrays.py
Python
mit
221
from django.db import models from model_utils import Choices from ...metadata.models import ProgramType, SustainabilityTopic from ..models import ContentType, ContentTypeManager from ..search import BaseIndex class AcademicProgram(ContentType): DISTANCE_CHOICES = Choices( ('local', 'Local Only'), ...
AASHE/hub
hub/apps/content/types/academic.py
Python
mit
2,754
# -*- coding: utf-8 -*- try: # Python 2.7 from collections import OrderedDict except: # Python 2.6 from gluon.contrib.simplejson.ordered_dict import OrderedDict from datetime import timedelta from gluon import current, Field, URL from gluon.html import * from gluon.storage import Storage from gluon.v...
code-for-india/sahana_shelter_worldbank
private/templates/India/config.py
Python
mit
167,905
#!/usr/bin/env python """ spcorrdecimateall.py John Swoboda """ import os import numpy as np import tables import glob import matplotlib.pyplot as plt import pdb import ioclass from IQTools import CenteredLagProduct, FormatIQ if __name__ == "__main__": ## Define input params Input spcor_dir = '/Volumes/ISRDriv...
jswoboda/NonMaxwellianExperiments
spcorrdecimateall.py
Python
mit
12,891
""" pip install selenium """ import os from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from selenium.webdriver.common.actio...
gerbill/gerbill.github.io
selenium_boilerplate.py
Python
mit
1,886
# 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/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2021_09_01/models/_models.py
Python
mit
38,322
from .app import App as _App class UserApp(_App): ''' An object based on the relationship between a user and an app. A subclass of :class:`steamfront.app.App`. This will not contain any of the attributes for :class:`steamfront.app.App` until :meth unlazify: has been called. Should not be called manua...
4Kaylum/Steamfront
steamfront/userapp.py
Python
mit
1,396
'''Galoshes ''' from distutils.core import setup from setuptools import find_packages CLASSIFIERS = [ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python', 'Topic :: Scientific/Engineer...
bsmithyman/galoshes
setup.py
Python
mit
1,497
#!/usr/bin/env python from __future__ import print_function import numpy as np import tensorflow as tf __version__ = "1" def tf_circle(radius): ''' Calculates the circumference and area of a circle, given the specified radius. Returns (circumferece, area) as two floats ''' # set up some co...
coderfi/blog
public/2017/02/tf_circle.py
Python
mit
1,286