code
stringlengths
6
947k
repo_name
stringlengths
5
100
path
stringlengths
4
226
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
6
947k
import copy import math def permutation(s): if len(s)==1: return s all=[] for x in s: other=copy.deepcopy(s) other.remove(x) for rest in permutation(other): all.append(x+rest) return all def isprime(prime): if prime<2: return False ...
milkmeat/thomas
project euler/q49.py
Python
mit
1,149
######################################## # Automatically generated, do not edit. ######################################## from pyvisdk.thirdparty import Enum ProfileNumericComparator = Enum( 'equal', 'greaterThan', 'greaterThanEqual', 'lessThan', 'lessThanEqual', 'notEqual', )
xuru/pyvisdk
pyvisdk/enums/profile_numeric_comparator.py
Python
mit
307
import os from subprocess import (Popen, PIPE) import pandas as pd from sensible.loginit import logger log = logger(__name__) LINES_COUNT="""git ls-files | grep py | while read f; do git blame -w -M -C -C --line-porcelain "$f" | grep \'^author \'; done | sort -f | uniq -ic | sort -n""" def subdirs(path): """Yiel...
noahgift/devml
devml/code_counts.py
Python
mit
2,797
"""Convert a number (n) in a reverse list of the individual numbers.""" def digitize(n): """Convert a number into a reverse list of each individual number.""" str_list = list(str(n)) str_list.reverse() num_list = [] for idx in range(len(str_list)): num_list.append(int(str_list[idx])) r...
Copenbacon/code-katas
katas/convert_array.py
Python
mit
335
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('courses', '0005_studentcourseprofile_skill_level'), ] operations = [ migrations.AlterField( model_name='studentc...
bjorncooley/maleo
courses/migrations/0006_auto_20151019_1127.py
Python
mit
552
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse from admin_tools.dashboard import modules, Dashboard, AppIndexDashboard from admin_tools.utils import get_admin_site_name ''' class CustomInde...
Sound-Colour-Space/sound-colour-space
website/project/dashboard.py
Python
mit
6,637
#!/usr/bin/env python3 # Copyright (c) 2015-2021 The Dash Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' feature_llmq_is_cl_conflicts.py Checks conflict handling between ChainLocks and InstantSend ''' from ...
thelazier/dash
test/functional/feature_llmq_is_cl_conflicts.py
Python
mit
14,908
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Interpreter version: python 2.7 # """ This module contains all structures used in AMQP communication. """ # Imports ===================================================================== from collections import namedtuple # Functions & objects ========================...
edeposit/edeposit.amqp.harvester
src/edeposit/amqp/harvester/structures.py
Python
mit
7,212
# -*- coding: utf8 from __future__ import print_function, division from vod import entropy import numpy as np import math import unittest #Calculates the entropy iteratively. def it_entropy(probs): ent = 0.0 for prob in probs: if prob == 0: continue ent -= prob * math.log(prob, 2)...
flaviovdf/vodlibs
vod/test/test_entropy.py
Python
mit
3,236
from .base import BaseCommand class IndicesGetWarmerCommand(BaseCommand): command_name = "elasticsearch:indices-get-warmer" def is_enabled(self): return True def run_request(self, name=None): if not name: self.show_warmer_list_panel(self.run) return optio...
KunihikoKido/sublime-elasticsearch-client
commands/indices_get_warmer.py
Python
mit
460
import _plotly_utils.basevalidators class LabelValidator(_plotly_utils.basevalidators.DataArrayValidator): def __init__(self, plotly_name="label", parent_name="sankey.link", **kwargs): super(LabelValidator, self).__init__( plotly_name=plotly_name, parent_name=parent_name, ...
plotly/python-api
packages/python/plotly/plotly/validators/sankey/link/_label.py
Python
mit
442
def Setup(Settings,DefaultModel): # set2_for_results/expand_dataset_forserver_minlen30_kfold_forcomparison.py Settings["experiment_name"] = "ExpandDataset_5556x_minlen30_640px_kfold10_originalComparison" Settings["graph_histories"] = ['together'] n=0 from keras.preprocessing.image import ImageD...
previtus/MGR-Project-Code
Settings/set2_dataset-expansion/expand_dataset_forserver_minlen30_kfold_forcomparison.py
Python
mit
4,101
""" Pre-process Chicago taxi data for visualization. Author: Hongjian Date: 11/7/2015 The raw file is in the ../../../dataset/ChicagoTaxi/2013-dec.txt We map those trips to CA """ from shapely.geometry import Polygon, Point, box from Block import Block fraw = '../../dataset/ChicagoTaxi/2013-dec.txt' if __name_...
thekingofkings/ChicagoTaxi
dataPreprocess.py
Python
mit
2,086
#------------------------------------------------------------------------------- # Name: automate_cf # Purpose: This module is designed to automated certain administrative # cloudfoundry operations using the cloudfoundry API and some # Stackato API functions # # Author: Daniel ...
dwatrous/self-service-onboarding-openstack-cloudfoundry
automate_cf.py
Python
mit
17,919
#!/usr/bin/env python # -*- coding: utf-8 -*- #---------------------- #Criado por Cadu #---------------------- import re, sys, time, threading #Detector de leitura (Campbell, 2001) #------------------------------------ class Detector (threading.Thread): def __init__(self, thresh, cv): threading.Thread....
elmadjian/mac0499
coletas/user_5_OK/detector.py
Python
mit
4,312
from __future__ import absolute_import, division, print_function, unicode_literals """ Allows the use of: import pi3d to drag in most of the important classes of pi3d. """ from echomesh.util import Log from pi3d.constants import * from pi3d import Display from pi3d.Camera import Camera from pi3d.Keyboard import ...
rec/echomesh
code/python/external/pi3d/__init__.py
Python
mit
1,492
#reversing the words in a string s = raw_input('enter the string:') print ' '.join(s.split(' ')[::-1])
ganesh-95/python-programs
thoughtworks/strrev.py
Python
mit
109
#!/usr/bin/env python # Source: https://gist.github.com/jtriley/1108174 import os import shlex import struct import platform import subprocess def get_terminal_size(): """ getTerminalSize() - get width and height of console - works on linux,os x,windows,cygwin(windows) originally retrieved from: ...
graveljp/smugcli
smugcli/terminal_size.py
Python
mit
2,716
# 266 - Palindrome Permutation (Easy) # https://leetcode.com/problems/palindrome-permutation/ from collections import Counter class Solution(object): def canPermutePalindrome(self, s): """ :type s: str :rtype: bool """ # Check if characters in a string can form a palindrome....
zubie7a/Algorithms
LeetCode/01_Easy/lc_266.py
Python
mit
532
#!/usr/bin/python import sys import os import re import fnmatch import string import compute import get dir_canpc = "/home/anderson/Desktop/results/homo_mem/" dir_alone = dir_canpc + "baseline/4x4_insn100K/" dir_share = dir_canpc + "mshr/" sum_ws = 0 sum_hs = 0 sum_uf = 0 eff_count = 0 ipc_alone = ...
anderson1008/NOCulator
hring/src/Script/eval_batch.py
Python
mit
2,292
# -*- coding: utf-8 -*- """ teledex.apps ~~~~~~~~~~~~ Defines the Django application teledex. """ from __future__ import absolute_import, print_function, unicode_literals from django.apps import AppConfig class DjangoTeledexAppConfig(AppConfig): name = 'django_teledex' label = 'django_teledex' ...
alexhayes/django-teledex
django_teledex/apps.py
Python
mit
354
#!/usr/bin/env python """ A simple logger. TODO: Use python logging, etc. """ import os import sys import datetime import traceback # maximum length of filename (enforced) MaxNameLength = 15 ################################################################################ # A simple logger. # # Simple usage: # ...
rzzzwilson/pyQ1300ST
log.py
Python
mit
4,784
'''GoogLeNet with PyTorch.''' import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class Inception(nn.Module): def __init__(self, in_planes, n1x1, n3x3red, n3x3, n5x5red, n5x5, pool_planes): super(Inception, self).__init__() # 1x1 conv branch ...
2prime/DeepLab
ResNet/models/googlenet.py
Python
mit
3,237
import sublime import sublime_plugin class GotoNamedMark(sublime_plugin.TextCommand): def run(self, edit, name = 'user', unset = True, set = False, set_name = None, set_icon = 'dot'): selelctions = [] for sel_item in self.view.sel(): selelctions.append([sel_item.a, sel_item.b]) regions = self...
shagabutdinov/sublime-named-mark
commands.py
Python
mit
2,443
import matplotlib.pyplot as plt import numpy as np import matplotlib.cm as cm import matplotlib.mlab as mlab def smooth1d(x, window_len): # copied from http://www.scipy.org/Cookbook/SignalSmooth s = np.r_[2*x[0] - x[window_len:1:-1], x, 2*x[-1] - x[-1:-window_len:-1]] w = np.hanning(window_len) y = ...
bundgus/python-playground
matplotlib-playground/examples/pylab_examples/demo_agg_filter.py
Python
mit
9,321
#!/usr/bin/python # -*- coding: utf-8 -*- """yield式とgeneratorについてのまとめ 参考: https://qiita.com/tomotaka_ito/items/35f3eb108f587022fa09 - next()の使い方がいまいち把握しきれてない - 一番重要なポイントは,generator関数はイテレータオブジェクトを作成するということ """ def generator_brief_check(): """ジェネレータ関数の作成""" yield 0 yield 1 yield 2 def brief_check_trial...
keii11/TIL
effective_python/yields.py
Python
mit
1,215
import collections.abc import inspect import six from .base import BaseItem, BaseSection def parse_config_schema(schema, parent_section=None, root=None): if root: parent_section = root is_valid_config_root_schema = ( inspect.ismodule(schema) or ( ...
jbasko/configmanager
configmanager/schema_parser.py
Python
mit
2,942
import _plotly_utils.basevalidators class ValueminusValidator(_plotly_utils.basevalidators.NumberValidator): def __init__( self, plotly_name="valueminus", parent_name="scatter3d.error_z", **kwargs ): super(ValueminusValidator, self).__init__( plotly_name=plotly_name, pa...
plotly/python-api
packages/python/plotly/plotly/validators/scatter3d/error_z/_valueminus.py
Python
mit
512
import pytest from mastodon.Mastodon import MastodonVersionError @pytest.mark.vcr() def test_instance(api): instance = api.instance() assert isinstance(instance, dict) # hehe, instance is instance expected_keys = set(('description', 'email', 'title', 'uri', 'version', 'urls')) assert set(instance.k...
halcy/Mastodon.py
tests/test_instance.py
Python
mit
1,396
import ure as re r = re.compile('( )') try: s = r.split("a b c foobar") except NotImplementedError: print('NotImplementedError')
mhoffma/micropython
tests/extmod/ure_split_notimpl.py
Python
mit
138
#!/usr/bin/env python3 # # List HubSpot's free email domains. from urllib.request import urlopen # pip3 install --user beautifulsoup4 # https://www.crummy.com/software/BeautifulSoup/bs4/doc/#strings-and-stripped-strings from bs4 import BeautifulSoup URL = "https://knowledge.hubspot.com/articles/kcs_article/forms/wha...
szepeviktor/debian-server-tools
mail/mx-check/hubspot-free-email-domains.py
Python
mit
772
import webapp2 import os import urllib2 from google.appengine.ext import db import jinja2 import urlparse template_dir = os.path.join(os.path.dirname(__file__), 'templates') jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template_dir), autoescape = True) def render_str(...
waseem18/Shorten-it
main.py
Python
mit
2,602
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright © 2016 Taylor C. Richberger <taywee@gmx.com> # This code is released under the license described in the LICENSE file from __future__ import absolute_import, division, print_function, unicode_literals from .makerestapiclient import make_rest_api_client
Taywee/makerestapiclient
makerestapiclient/__init__.py
Python
mit
313
#!/usr/bin/python # -*- coding: utf-8 -*- # Software License Agreement (BSD License) # # Copyright (c) 2012, Willow Garage, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistrib...
Aramist/Self-Driving-Car
ros/install/_setup_util.py
Python
mit
12,461
from formlayout import fedit from StringIO import StringIO class recommended_learning: def __init__(self): #initalize filenames self.skills_db = './knowledge_base/skills.csv' self.robot_features_db = './knowledge_base/robot_features.csv' self.environment_features_db = './knowledge_b...
deebuls/RecommenderSystemInRobotics
code/knowledge_base_creator/recommended_learning.py
Python
mit
4,956
#!/usr/bin/env python # coding=utf-8 """ Copyright (C) 2010-2013, Ryan Fan <ryan.fan@oracle.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your opti...
rfancn/wxgigo
wxgigo/wxmp/sdk/plugin/fshelper.py
Python
mit
5,556
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """nucmer.py Provides helper functions to run nucmer from pdp (c) The James Hutton Institute 2018 Author: Leighton Pritchard Contact: leighton.pritchard@hutton.ac.uk Leighton Pritchard, Information and Computing Sciences, James Hutton Institute, Errol Road, Invergowrie...
widdowquinn/find_differential_primers
diagnostic_primers/nucmer.py
Python
mit
17,605
import os import random import torch import torch.backends.cudnn as cudnn from torch.autograd import Variable import numpy as np import scipy.sparse as sp from sklearn.neighbors import NearestNeighbors, KNeighborsClassifier def align_fraction(data1, data2, params): row1, col1 = np.shape(data1) row2, col2...
LaetitiaPapaxanthos/UnionCom
test.py
Python
mit
1,911
import sys #line = sys.stdin.read() #print line datas = [] for line in sys.stdin: datas.append(line) print datas
BizShuk/code_sandbox
python/raw_input_test.py
Python
mit
120
# 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/SimAppObjNameDefault_DistributionSystem_HvacSteamLoop.py
Python
mit
9,034
# 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/v2019_11_01/operations/_virtual_hubs_operations.py
Python
mit
26,953
""" Should emit: B303 - on line 25 B304 - on line 42 """ import sys import something_else def this_is_okay(): something_else.maxint maxint = 3 maxint maxint = 3 def this_is_also_okay(): maxint class CustomClassWithBrokenMetaclass: __metaclass__ = type maxint = 5 # this is okay # th...
ambv/flake8-bugbear
tests/b303_b304.py
Python
mit
705
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf import settings from django.conf.urls import include, url from django.conf.urls.static import static from django.contrib import admin from django.views.generic import TemplateView from django.views import defaults as default_views urlpat...
luftdanmark/fifo.li
config/urls.py
Python
mit
1,716
from django.views.decorators.cache import cache_page from django.views.generic import TemplateView from djgeojson.views import GeoJSONLayerView from django.conf.urls import include, url from django.contrib import admin from permit_map import models from permit_map import views urlpatterns = [ # This URL maps to / an...
CodeForCary/django-dev-map
permit_map/urls.py
Python
mit
1,506
# -*- coding: utf-8 -*- ############################################################################### # wannabetabs by dgelessus ############################################################################### import editor import os import ui def full_path(path): # Return absolute path with expanded ~ and symli...
dgelessus/pythonista-scripts
wannabetabs.py
Python
mit
2,450
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "jstest.settings") try: from django.core.management import execute_from_command_line except ImportError: # The above import may fail for some other reason. Ensure that the ...
motobyus/moto
module_django/jstest/manage.py
Python
mit
804
# Docstrings for generated ufuncs # # The syntax is designed to look like the function add_newdoc is being # called from numpy.lib, but in this file add_newdoc puts the # docstrings in a dictionary. This dictionary is used in # generate_ufuncs.py to generate the docstrings for the ufuncs in # scipy.special at the C lev...
DailyActie/Surrogate-Model
01-codes/scipy-master/scipy/special/add_newdocs.py
Python
mit
189,015
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Line(_BaseTraceHierarchyType): # class properties # -------------------- _parent_path_str = "splom.marker" _path_str = "splom.marker.line" _valid_props = { "autocolorscale", ...
plotly/python-api
packages/python/plotly/plotly/graph_objs/splom/marker/_line.py
Python
mit
24,938
""" __init__ of the pdf2image module """ from .pdf2image import convert_from_bytes, convert_from_path
Kankroc/pdf2image
pdf2image/__init__.py
Python
mit
106
import numpy import chainer from chainer.backends import cuda from chainer import function_node from chainer.functions.activation import sigmoid from chainer import utils from chainer.utils import type_check class SigmoidCrossEntropy(function_node.FunctionNode): """Sigmoid activation followed by a sigmoid cross...
aonotas/chainer
chainer/functions/loss/sigmoid_cross_entropy.py
Python
mit
5,896
# -*- coding: utf-8 -*- from PyQt4 import QtGui, QtCore from matplotlib.backends.backend_qt4 \ import NavigationToolbar2QT as NavigationToolbar from matplotlib.backends.backend_qt4agg import \ FigureCanvasQTAgg as FigureCanvas from matplotlib.figure import Figure class PlotWidget(QtGui.QWidget): """This ...
ckaus/EpiPy
epipy/ui/view/plotwidget.py
Python
mit
1,934
from django.conf.urls import url from rest_framework.urlpatterns import format_suffix_patterns from . import views from django.views.generic.base import View app_name = 'secapp' urlpatterns = [ # Index view url(r'^$', views.index, name='index'), # List of events for a Log Source url(r'^(?P<id_log_sour...
MGautier/security-sensor
branches/webenv/secproject/secapp/urls.py
Python
mit
2,174
from insulaudit.log import io, logger as log from insulaudit import lib, core from insulaudit.data import glucose import time HEADER = [ 0x11, 0x0D ] STX = 0x02 ETX = 0x03 TIMEOUT = 0.5 RETRIES = 3 def ls_long( B ): B.reverse( ) return lib.BangLong( B ) def ls_int( B ): B.reverse( ) return lib.BangInt( ...
bewest/insulaudit
src/insulaudit/devices/onetouch2.py
Python
mit
2,920
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-11-12 18:41 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0005_auto_20161113_0317'), ] operations = [ migrations.RenameField(...
sparcs-kaist/heartbeat-server
apps/core/migrations/0006_auto_20161113_0341.py
Python
mit
645
# Python - 3.6.0 century = lambda year: year // 100 + ((year % 100) > 0)
RevansChen/online-judge
Codewars/8kyu/century-from-year/Python/solution1.py
Python
mit
74
from datetime import datetime from google.appengine.ext import ndb from models import Deletion from utils import updates def get_key(slug): return ndb.Key("Deletion", slug) def delete_entity(key): slug = key.string_id() kind = key.kind() key.delete() deletion_key = get_key(slug) ...
rockwotj/shiloh-ranch
backend/utils/deletions.py
Python
mit
543
# ============================================================================== # Copyright 2019 - Philip Paquette # # NOTICE: 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 rest...
diplomacy/research
diplomacy_research/models/datasets/feedable_dataset.py
Python
mit
5,758
import multiprocessing import warnings import six from chainer.backends import cuda from chainer.dataset import convert from chainer import reporter from chainer.training.updaters import standard_updater try: from cupy.cuda import nccl _available = True except ImportError: _available = False import num...
aonotas/chainer
chainer/training/updaters/multiprocess_parallel_updater.py
Python
mit
15,115
import ggame from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame, CircleAsset, PolygonAsset, TextAsset import random SCREEN_WIDTH = 700 SCREEN_HEIGHT = 700 # THE WALLS class wall(Sprite): Red = Color(0xF44366, 1.0) noline = LineStyle(0, Red) def __init__(self, asset, po...
DRBarnum/Final-Project
DonkeyKong.py
Python
mit
10,332
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function import os import fnmatch import logging from gcdt_bundler.bundler_utils import glob_files, get_path_info from . import here ROOT_DIR = here('./resources/static_files') log = logging.getLogger(__name__) def test_find_two_files(): re...
glomex/gcdt-bundler
tests/test_bundler_utils.py
Python
mit
2,286
# --------------------------------------------------------------------------------- # # ROUNDBUTTON wxPython IMPLEMENTATION # # Edward Sitarski, @ 27 November 2011 # # # TODO List # # 1) Anything to do? # # # For all kind of problems, requests of enhancements and bug reports, please # write to me at: # # edward.sitarsk...
ActiveState/code
recipes/Python/577951_wxPythDramatic_shaded_3D_buttons_that_look_like_/recipe-577951.py
Python
mit
18,554
''' LoLAlerter: Every LoL partner's pal Copyright (C) 2015 Redback This file is part of LoLAlerter ''' import json import threading import time import urllib.error from alerterredis import AlerterRedis from logger import Logger import constants as Constants class DonateTracker(object): ''' The DonateTracker is...
RedbackThomson/LoLAlerter
lolalerter/twitchalerts/DonateTracker.py
Python
mit
2,854
#!/usr/bin/env python # # Use the raw transactions API to spend bitcoins received on particular addresses, # and send any change back to that same address. # # Example usage: # spendfrom.py # Lists available funds # spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00 # # Assumes it will talk to a bitcoind or Bit...
DavidSantamaria/Om
contrib/spendfrom/spendfrom.py
Python
mit
10,053
""" Filename: mom_to_cmip.py Author: Damien Irving, irving.damien@gmail.com Description: convert MOM data files to be like ACCESS-CM2 CMIP6 files """ # Import general Python modules import sys, os, pdb import argparse import numpy as np import xarray as xr import iris import cf_units import cmdline_proven...
DamienIrving/ocean-analysis
data_processing/mom_to_cmip.py
Python
mit
5,922
import sys from PySide.QtGui import QPushButton, QWidget, QVBoxLayout, \ QHBoxLayout, QFormLayout, QComboBox, \ QLineEdit, QLabel, QIntValidator, QIcon class ControlLayout(QWidget): """Widget that stores the controls""" def __init__(self): QWidget.__in...
Jdash99/des-inventory-simulation
psim/psim_control.py
Python
mit
4,034
#!/usr/bin/python # # Copyright 2014, Intel Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, #...
eurogiciel-oss/Tizen-development-report
bin/checkRpmSrc.py
Python
mit
3,700
""" Script used to test the battle state functionality. Allows the user to pick a pair of creatures and then uses the game loop to fight them. Will probably crash when the battle concludes because the rest of the game will not be set up at that point. """ import argparse import CreatureRogue.creature_...
DaveTCode/CreatureRogue
battle_test.py
Python
mit
2,852
from google.appengine.ext import ndb import settings from core import model import common from webapp2_extras.i18n import gettext as _ class RPCHandler(common.BaseAPIHandler): def get(self, action, *args): args = self.request.GET for arg in args: args[arg] = self.request....
helmuthb/devfest-at-site
handlers/api.py
Python
mit
1,264
#!/usr/bin/env python # # Electrum - lightweight Bitcoin client # Copyright (C) 2011 Thomas Voegtlin # # 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...
dabura667/electrum
lib/transaction.py
Python
mit
35,844
# -*- coding: utf-8 -*- # # This file is part of Karesansui. # # Copyright (C) 2009-2012 HDE, Inc. # # 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 lim...
karesansui/karesansui
karesansui/gadget/guestby1device.py
Python
mit
11,405
import struct import hashlib magic_number = 0xD9B4BEF9 block_prefix_format = 'I32s32sIII' def read_uint1(stream): return ord(stream.read(1)) def read_uint2(stream): return struct.unpack('H', stream.read(2))[0] def read_uint4(stream): return struct.unpack('I', stream.read(4))[0] def read_uint8(stream): ...
jkthompson/block-chain-analytics
block.py
Python
mit
10,671
#!/usr/bin/env python ######################################################################################### # # Compute magnetization transfer ratio (MTR). # # --------------------------------------------------------------------------------------- # Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca> #...
neuropoly/spinalcordtoolbox
spinalcordtoolbox/scripts/sct_compute_mtr.py
Python
mit
2,861
from fframework import asfunction from moviemaker3.stacks.stack import Stack class WeightedStack(Stack): """Elements in the WeightedStack should return (*weight*, *layer*); *layer* and *weight* are extracted by indexing (tuple assignment). You might use ``fframework.compound()`` to generate tuple Functi...
friedrichromstedt/moviemaker3
moviemaker3/stacks/weighted.py
Python
mit
1,580
''' Created on Dec 7, 2012 @author: yupeng ''' class ActionGroup: def __init__(self): self.Actions = [] self.PPs = [] self.NPs = [] def addAction(self,actionString): self.Actions.append(actionString) def addActions(self,actionList): self.Acti...
yu-peng/english-pddl-translator
getElement.py
Python
mit
11,844
from distutils.core import setup from distutils.extension import Extension from Cython.Build import cythonize import re module_src = "wsgikit/wsgikit.pyx" def version(): fp = open( module_src) version = re.search( "^__version__\s*=\s*['\"]([^'\"]*)['\"]", fp.read(), re.M).group(1) fp.close() return version __ver...
Mikhus/wsgikit
setup.py
Python
mit
1,542
#!/usr/bin/env python import numpy as np import cv2 from matplotlib import pyplot as plt import sys from utils import * if __name__=="__main__": i1 = cv2.imread(sys.argv[1]) i2 = cv2.imread(sys.argv[2]) print getAlignmentCost(i1,i2)
ryucc/CS766_FINAL
tests/debug/jitter.py
Python
mit
246
import datetime from six.moves import http_client from mock import patch import unittest from drift.systesthelper import uuid_string, big_number from driftbase.utils.test_utils import BaseCloudkitTest class PlayersTest(BaseCloudkitTest): """ Tests for the /players endpoints """ def test_pl...
dgnorth/drift-base
driftbase/tests/players/test_players.py
Python
mit
6,842
import schoolopy import yaml with open('example_config.yml', 'r') as f: cfg = yaml.load(f) sc = schoolopy.Schoology(schoolopy.Auth(cfg['key'], cfg['secret'])) sc.limit = 10 # Only retrieve 10 objects max print('Your name is %s' % sc.get_me().name_display) for update in sc.get_feed(): user = sc.get_user(upda...
ErikBoesen/schoolopy
example-twolegged.py
Python
mit
481
from collections import namedtuple from django.core.management.base import BaseCommand from tqdm import tqdm Progress = namedtuple( 'Progress', [ 'progress_fraction', 'message', 'extra_data', 'level', ] ) class ProgressTracker(): def __init__(self, total=100, level=0...
jamalex/kolibri
kolibri/tasks/management/commands/base.py
Python
mit
2,905
from math import * import proteus.MeshTools from proteus import Domain from proteus.default_n import * from proteus.Profiling import logEvent # Discretization -- input options Refinement = 24 genMesh=True movingDomain=False applyRedistancing=True useOldPETSc=False useSuperlu=False timeDiscretization='be'#'vb...
erdc-cm/air-water-vv
3d/dambreak_Ubbink/dambreak_Ubbink_medium/dambreak_Ubbink_medium.py
Python
mit
13,907
# -*- coding: utf-8 -*- # # bimbo_kaggle_competition documentation build configuration file, created by # sphinx-quickstart. # # 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 configurat...
boya-zhou/kaggle_bimbo_reformat
docs/conf.py
Python
mit
7,917
# -*- coding: utf-8 -*- # Generated by Django 1.9.12 on 2017-01-10 23:56 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('telesurvideos', '0006_auto_20170110_1710'), ] operations = [ migrations.RemoveField...
dreglad/telesurvideos
telesurvideos/migrations/0007_remove_videolistpluginmodel_tiempo.py
Python
mit
413
#!/usr/bin/python # coding=UTF-8 #import RPi.GPIO as GPIO_detector #raspberry version from pyA20.gpio import gpio import time import datetime import locale import sys import os from char_lcd2 import OrangePiZero_CharLCD as LCD def file_get_contents(filename): with open(filename) as f: return f.read() ...
mhkyg/OrangePIStuff
motion/motion.py
Python
mit
2,565
from __future__ import print_function import tensorflow as tf from tensorflow.contrib.layers import batch_norm, fully_connected, flatten from tensorflow.contrib.layers import xavier_initializer from scipy.io import wavfile from generator import * from discriminator import * import numpy as np from data_loader import re...
santi-pdp/segan
model.py
Python
mit
36,546
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Projet : Editeur, Compilateur et Micro-Ordinateur pour un langage assembleur. Nom du fichier : 04-02-CPU.py Identification : 04-02-CPU Titre : CPU Auteurs : Francis Emond, Malek Khattech, ...
MarcAndreJean/PCONC
Modules/04-02-CPU.py
Python
mit
15,906
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.awards_list, name='list'), ]
fgmacedo/django-awards
awards/urls.py
Python
mit
121
ThemeID = 'UI/ColorThemes/Custom' #themeID, baseColor, hiliteColor THEMES = (('UI/ColorThemes/Custom', (0.05, 0.05, 0.05), (0.4, 0.8, 1.0)),)
EVEModX/Mods
mods/CustomThemeColor/ThemeConfig.py
Python
mit
143
import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) step_pin = 24 dir_pin = 25 ms1_pin = 23 ms2_pin = 18 GPIO.setup(step_pin, GPIO.OUT) GPIO.setup(dir_pin, GPIO.OUT) GPIO.setup(ms1_pin, GPIO.OUT) GPIO.setup(ms2_pin, GPIO.OUT) period = 0.02 def step(steps, direction, period): # (1) GPIO.output(dir_pin, di...
simonmonk/make_action
python/experiments/microstepping.py
Python
mit
1,397
from lacuna.building import MyBuilding class ssld(MyBuilding): path = 'ssld' def __init__( self, client, body_id:int = 0, building_id:int = 0 ): super().__init__( client, body_id, building_id )
tmtowtdi/MontyLacuna
lib/lacuna/buildings/boring/ssld.py
Python
mit
213
#!/usr/bin/env python3 # Copyright (c) 2016 The Oakcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test the bumpfee RPC. Verifies that the bumpfee RPC creates replacement transactions successfully when its ...
stratton-oakcoin/oakcoin
test/functional/bumpfee.py
Python
mit
13,614
# -*- coding: utf-8 -*- """ Organisation Registry - Controllers @author: Fran Boon @author: Michael Howden """ prefix = request.controller resourcename = request.function if prefix not in deployment_settings.modules: session.error = T("Module disabled!") redirect(URL(r=request, c="default", f="inde...
ksetyadi/Sahana-Eden
controllers/org.py
Python
mit
9,210
import datetime from flask import abort, render_template, request, redirect, Response import ctrl.blog from . import handlers @handlers.route('/blog') def blog_index(): pageNo = 0 if request.args.get('page'): pageNo = int(request.args.get('page')) if pageNo < 0: pageNo = 0 posts = ctrl.blog.getP...
codeka/wwmmo
website/handlers/blog.py
Python
mit
1,074
''' Created on Jun 29, 2016 @author: Thomas Adriaan Hellinger ''' import pytest from roodestem.voting_systems.voting_system import Result class TestResult: def test_null_result_not_tolerated(self): with pytest.raises(TypeError): Result() def test_passed_multiple_winners(self): ...
brotherjack/RoodeStem
tests/test_voting_systems.py
Python
mit
709
from MpfTestCase import MpfTestCase from mock import MagicMock class TestSmartVirtualPlatform(MpfTestCase): def getConfigFile(self): return 'test_smart_virtual.yaml' def getMachinePath(self): return '../tests/machine_files/platform/' def get_platform(self): return 'smart_virtual...
spierepf/mpf
tests/test_SmartVirtualPlatform.py
Python
mit
3,495
""" This script is responsible for enabling NTP and setting the NTP server Commands used: - systemsetup -setusingnetworktime on - systemsetup -setnetworktimeserver (NTP server) """ from common import CLITieIn class NTPConfigurator(CLITieIn): def enable_ntp(self): command = '/usr/sbin/systemsetup -set...
initialed85/mac_os_scripts
mac_os_scripts/configure_ntp.py
Python
mit
1,870
# Based on https://github.com/probml/pmtk3/blob/master/demos/healthyLevels.m # Converted by John Fearns - jdf22@infradead.org # Josh Tenenbaum's Healthy Levels game import superimport import numpy as np import matplotlib.pyplot as plt #from pyprobml_utils import save_fig # Ensure stochastic reproducibility. np.rando...
probml/pyprobml
scripts/healthy_levels_plot.py
Python
mit
8,021
from django.conf.urls import include, url from django.contrib.auth.views import login from registration.views import * from groupmanagement.views import * from reports.views import * from message.views import * from django.contrib import admin from django.conf import settings from django.conf.urls.static import static ...
vsc-squared/FileShareHeroku
FileShare/urls.py
Python
mit
2,578
#!/usr/bin/python3 -S # -*- coding: utf-8 -*- """ `Unit tests for cargo.builder.create_user` --·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·--·-- 2016 Jared Lunde © The MIT License (MIT) http://github.com/jaredlunde """ import unittest import psycopg2 from vital.security import ra...
jaredlunde/cargo-orm
unit_tests/builders/create_table.py
Python
mit
2,222
# coding: utf-8 from smartbot import Behaviour from smartbot import Utils from smartbot import ExternalAPI import re import os import random class JokeBehaviour(Behaviour): def __init__(self, bot): super(JokeBehaviour, self).__init__(bot) self.language = self.bot.config.get('main', 'language') if...
pedrohml/smartbot
smartbot/joke_behaviour.py
Python
mit
2,199
# Copyright 2002-2011 Nick Mathewson. See LICENSE for licensing information. """mixminion.ServerKeys Classes for servers to generate and store keys and server descriptors. """ #FFFF We need support for encrypting private keys. __all__ = [ "ServerKeyring", "generateServerDescriptorAndKeys", "genera...
Javex/mixminion
lib/mixminion/server/ServerKeys.py
Python
mit
49,832