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
import numpy as np import pandas as pd from sklearn.feature_extraction.text import CountVectorizer def load_coefficients(): df = pd.read_csv('../data/logreg_coefficients.txt', sep='\t', header=None, quoting=3, names=['term', 'weight']) return df def load_reviews(): reviews = [] w...
juanshishido/info290-dds
assignments/assignment03/code/sedc.py
Python
mit
2,387
""" creates an (d2, w1, w2) "movie" scan """ import NISE as n import os import numpy as np import sys import time def simulate(plot=False): if __name__ == '__main__': here = os.path.dirname(__file__) t = n.experiments.trive # module for experiment class k1 - k2 + k2' ...
wright-group/WrightSim
scripts/NISE_run_for_kyle.py
Python
mit
3,131
""" roblox.py Library for interacting with the Roblox site. Useful for bots (good ones too), custom notifications, and much more. Copyright (c) 2017 James Patrick Dill, reshanie Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (t...
reshanie/roblox.py
roblox/auth.py
Python
mit
4,340
import os from animation import Animation from dmd import Frame from procgame import config from procgame import util from font import Font ################################### # Animated Fonts class AnimFont(Font): """An animated Font with multiple frames per letter. Fonts can be loaded manually, using :m...
mjocean/PyProcGameHD-SkeletonGame
procgame/dmd/animfont.py
Python
mit
5,992
#code created by NamanNimmo Gera #4:57pm, May 1, 2019. def reverse(x): return int(str(x)[::-1]) def Palindrome(x): if x == reverse(x): return True else: return False #function to check if a number is a Lychrel number or not def checkLyr(x): tot = 0 while True: x = x + rev...
DestructHub/ProjectEuler
Problem055/Python/solution_1.py
Python
mit
578
# -*- coding: utf-8 -*- from __future__ import division, print_function import numpy as np from jittermodel import u, q2unitless from jittermodel.simulation import (Simulation, SphereCapacitance, _alpha, sum_sinh, _eta, _lambda, _thetaI, _theta...
ryanpdwyer/jittermodel
jittermodel/tests/test_simulation.py
Python
mit
12,688
""" .. Copyright (c) 2014- Marshall Farrier license http://opensource.org/licenses/MIT Options (:mod:`pynance.opt`) =============================================== .. currentmodule:: pynance.opt :mod:`pynance.opt.core` :mod:`pynance.opt.covcall` :mod:`pynance.opt.price` :mod:`pynance.opt.retrieve` :mod:`pynan...
herberthudson/pynance
pynance/opt/__init__.py
Python
mit
540
#!/usr/bin/env python import sys import urllib2 def download(url): r = urllib2.urlopen(url) content = r.read().replace("\r", "")[3:] r.close() return content for line in sys.stdin: name, url = line.strip().split(',') if url.endswith("/edit"): url = url[0:-len("/edit")] url = url +...
kohyatoh/texwebpreview
scripts/download.py
Python
mit
468
#!/usr/bin/python """ This script generates the complete PCFG usable for honey encryption. The inputs to this script are, a) vault file b) password leak file (if not provided the vault password distribution is used.) c) test the accuracy or not etc. """ #import sys, os, math, struct, bz2, resource #BASE_DIR = os.ge...
rchatterjee/nocrack
complete_setup.py
Python
mit
3,534
# game.py # Author: Sébastien Combéfis # Version: April 20, 2016 from abc import * import copy import json import socket import sys DEFAULT_BUFFER_SIZE = 1024 SECTION_WIDTH = 60 def _printsection(title): print() print(' {} '.format(title).center(SECTION_WIDTH, '=')) class InvalidMoveException(Exception): ...
Diab0lix/Pylos
lib/game.py
Python
mit
9,652
from system.core.model import Model class User(Model): def __init__(self): super(User, self).__init__() def get_user(self, user_id): query = "SELECT * FROM users WHERE user_id = :user_id LIMIT 1" data = { "user_id": user_id } user = self.db.get_one(query, d...
RydrDojo/Ridr
app/models/User.py
Python
mit
1,720
from .i18n import _ message = _('Hello')
rebeccaframework/rebecca.bootstrapui
rebecca/bootstrapui/constants.py
Python
mit
42
#!/usr/bin/python2 import ConfigParser import urllib2 as ul import json import argparse import sys from unicodedata import normalize parser = argparse.ArgumentParser(description='Retrieves live CS:GO Streams') parser.add_argument('--verbose', '-v', help='Use verbose output', action='store_true') parser.add_argument(...
Spotlight0xff/scripts
streams.py
Python
mit
3,110
# coding=utf-8 import os from plugin_common.baseplugin import BasePlugin from plugin_common.baseplugin import Cmd import gi gi.require_version('Gtk', '3.0') from gi.repository import Gio, Gtk __author__ = 'peter' appList = [] def getAppIcon(name): global appList iconTheme = Gtk.IconTheme.get_default() ...
PeterHo/Linalfred
plugins/top/main.py
Python
mit
2,091
# Adapted from score written by wkentaro # https://github.com/wkentaro/pytorch-fcn/blob/master/torchfcn/utils.py import numpy as np class runningScore(object): def __init__(self, n_classes): self.n_classes = n_classes self.confusion_matrix = np.zeros((n_classes, n_classes)) def _fast_hist(se...
meetshah1995/pytorch-semseg
ptsemseg/metrics.py
Python
mit
2,166
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "datacademy.settings.local") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
mingot/datacademy_django
datacademy/manage.py
Python
mit
259
import cPickle as pickle from stellar_parameters import Star from channel import SpectralChannel class spectrum(object): pass import sick spec = sick.specutils.Spectrum.load("spectra/hermes-sun.fits") spec = sick.specutils.Spectrum.load("spectra/uvessun1.txt") blue_channel = spectrum() blue_channel.dispersi...
andycasey/precise-objective-differential-spectroscopy
code/test_hd22879.py
Python
mit
2,015
import cocotb from cocotb.triggers import Timer from cocotb.result import TestFailure import random import math TICK = 1 INPUT_WIDTH = 28 # @cocotb.test() # def sqrt_basic_test(dut): # """Test for sqrt(127)""" # i = 127 # dut.integer_input = i # dut.reset = 0 # dut.clk = 0 # yield Timer(TICK...
jeremyherbert/real_time_stdev
sqrt/tests/test_sqrt.py
Python
mit
4,259
# Give the next prime number until asked to stop from sys import argv is_prime = lambda y, p: ((map(lambda x: y % x, p)).count(0) == 0) def next_prime(n, p = None): if p is None: p = [2] i = n + 1 while not is_prime(i, p): i += 1 return i, p + [i] def primes(y = None): if y is None: ...
mykhamill/Projects-Solutions
solutions/next_prime.py
Python
mit
1,162
from django.core.management.base import BaseCommand from 語料庫.models import 語料表 class Command(BaseCommand): def handle(self, *args, **參數): for 語料 in 語料表.objects.all(): 語料.save()
i3thuan5/gi2_liau7_khoo3
檢查工具/management/commands/重做檢查狀態.py
Python
mit
234
class Solution: #@param n: Given a decimal number that is passed in as a string #@return: A string def binaryRepresentation(self, n): # write you code here length = len(n) if length == 0: return n split = n.split(".") decimalPart = self.decBinary(split[1]) ...
quake0day/oj
binaryRepresentation.py
Python
mit
1,156
def sleep_us(us): from time import sleep sleep(us/1000000)
Morteo/kiot
src/python3/utime/utime.py
Python
mit
66
''' Created on 30/01/2014 @author: jdsantana ''' class InterfaceDB: def __init__(self, host, port, user, password): self.__host = host self.__port = port self.__user = user self.__password = password def connect(self): raise NotImplementedError('No implemented yet') ...
JuanDaniel/DBOJ
Engine/src/DB/InterfaceBD.py
Python
mit
583
import types class InstanceVisibleMeta(type): def __new__(cls, cls_name, cls_parents, cls_dict): for attr_name in dir(cls): attr_value = getattr(cls, attr_name, None) if isinstance(attr_value, instancevisible) and attr_name not in cls_dict: if not isinstance(attr_va...
Quantify-world/apification
src/apification/utils/instancevisible.py
Python
mit
1,758
# -*- coding: utf-8; -*- from decimal import Decimal from collections import deque from copy import copy from io import BytesIO import xml.sax import xml.sax.handler import datetime import re import iso8601 def format_open_tag(name, attrs): attrs = [u'%s="%s"' % attr for attr in attrs.items()] return u"<%s...
nailxx/pyinsales
insales/parsing.py
Python
mit
6,197
# -*- coding: utf-8 -*- from django.conf import settings KWAY_ADMIN_LIST_EDITABLE = getattr(settings, 'KWAY_ADMIN_LIST_EDITABLE', True) KWAY_ADMIN_LIST_PER_PAGE = getattr(settings, 'KWAY_ADMIN_LIST_PER_PAGE', 100) KWAY_ADMIN_SHOW_ACTIONS = getattr(settings, 'KWAY_ADMIN_SHOW_ACTIONS', False) KWAY_ADMIN_SHOW_LIST_FIL...
fabiocaccamo/django-kway
kway/settings.py
Python
mit
1,864
import json import logging import mwparserfromhell as mwp from wikitables.client import Client from wikitables.readers import RowReader from wikitables.util import TableJSONEncoder, ftag, ustr log = logging.getLogger('wikitables') def import_tables(article, lang='en'): client = Client(lang) page = client....
bcicen/wikitables
wikitables/__init__.py
Python
mit
4,005
# -*- coding: utf-8 -*- # flake8: noqa """ A Python library for FilePreview's API. """ __title__ = 'filepreviews' __version__ = '2.0.2' __author__ = 'José Padilla' __license__ = 'MIT' __copyright__ = 'Copyright 2015 Blimp LLC' VERSION = __version__ API_URL = 'https://api.filepreviews.io/v2' from .api import FilePre...
GetBlimp/filepreviews-python
filepreviews/__init__.py
Python
mit
429
# -*- coding: utf-8 -*- from PyGcs import PyGcs from SearchResult import SearchResult
Naoto-Ida/PyGcs
PyGcs/__init__.py
Python
mit
86
#!/usr/bin/env python ### # (C) Copyright (2012-2015) Hewlett Packard Enterprise Development LP # # 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 limita...
miqui/python-hpOneView
examples/scripts/get-logical-interconnect-groups.py
Python
mit
4,072
#!/usr/bin/env python import xml.etree.ElementTree as ET import xml.dom.minidom class JunitXml(object): """ A class which is designed to create a junit test xml file. Note: currently this class is designed to return the junit xml file in a string format (through the dump method). """ def ...
dbaxa/python-junit-xml-output
junit_xml_output/__init__.py
Python
mit
2,621
import logging import xmlrpclib import time import subprocess from socket import gethostname from mode import Mode from helper import get_config, get_server_url, wrap_xmlrpc class Restore(Mode): def _initialise(self, args): logging.debug('Starting client mode checks on config file') config = ge...
mattdavis90/re-store-it
src/restore.py
Python
mit
1,295
from datetime import timedelta, date from django.test import TestCase from autoemails.actions import AskForWebsiteAction from autoemails.models import Trigger, EmailTemplate from workshops.models import Task, Role, Person, Event, Tag, Organization class TestAskForWebsiteAction(TestCase): def setUp(self): ...
swcarpentry/amy
amy/autoemails/tests/test_askforwebsiteaction.py
Python
mit
12,577
import sys import itertools from collections import deque from formula import Formula, Atomic, And, Or, Not, Imply recursion = 0 DEBUG = 1 class NotWellFormedFormula(Exception): def __init__(self, formula): self.message = '"{}" is not a WFF'.format(formula) super(NotWellFormedFormula, self).__i...
Woraufhin/logic
parsers.py
Python
mit
7,273
#!/usr/bin/python3 import serial s = serial.Serial("/dev/ttyAMA0", 57600) while 1: print(s.readline())
Restioson/Rover3
test/serial-test.py
Python
mit
103
# encoding: utf8 from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('recipebook', '0001_initial'), ] operations = [ migrations.AddField( model_name='ingredientline', name='preparation', field=models.CharFi...
ateoto/django-recipebook
recipebook/migrations/0002_ingredientline_preparation.py
Python
mit
415
from logging import getLogger from multiprocessing import Process class LoggableProcess(Process): def start(self, *args, **kwargs): super().start(*args, **kwargs) L.debug( 'started %s%s process %s', self.name, ' daemon' if self.daemon else '', self.ident) class Stoppable...
crosscompute/crosscompute
crosscompute/macros/process.py
Python
mit
944
from __future__ import (absolute_import, division, print_function, unicode_literals) from builtins import * from future.standard_library import install_aliases install_aliases() import vim import sys def proc(): pass if __name__ == '__main__': print(sys.argv)
oxnz/dot-files
.vim/pythonx/maxprod/vimext.py
Python
mit
296
import cProfile import StringIO import pstats pr = cProfile.Profile() pr.enable() import atxcf pr.disable() s = StringIO.StringIO() ps = pstats.Stats(pr, stream=s).sort_stats('cumulative') ps.print_stats() print s.getvalue()
transfix/atxcf
test_profile.py
Python
mit
229
# -*- coding: utf-8 -*- # Django settings for basic pinax project. import os.path import posixpath import pinax PINAX_ROOT = os.path.abspath(os.path.dirname(pinax.__file__)) PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) # tells Pinax to use the default theme PINAX_THEME = 'default' DEBUG = True TEMPLATE...
theju/confista
settings.py
Python
mit
6,157
from tornkts.base.server_response import ServerError class ToDictMixin(object): MODE_INCLUDE = 1 MODE_EXCLUDE = 0 def to_dict(self, name='', *args, **kwargs): depth = kwargs.get('depth', 0) kwargs.update({'depth': depth + 1}) if depth == 0: fields = kwargs.get('fields...
ktsstudio/tornkts
tornkts/mixins/to_dict_mixin.py
Python
mit
1,822
# -*- coding: utf-8 -*- """ MultiPlotWidget.py - Convenience class--GraphicsView widget displaying a MultiPlotItem Copyright 2010 Luke Campagnola Distributed under MIT/X11 license. See license.txt for more infomation. """ from .GraphicsView import GraphicsView from ..graphicsItems import MultiPlotItem as MultiPlotIt...
hiuwo/acq4
acq4/pyqtgraph/widgets/MultiPlotWidget.py
Python
mit
1,546
import numpy import matplotlib import matplotlib.mlab as mlab import matplotlib.pyplot as plt from matplotlib.ticker import NullFormatter from matplotlib import rcParams from scipy.optimize import curve_fit from data_plots.utils import labeler, titler rcParams['text.usetex'] = True def scatter_hist(x, y, *args, ...
astroswego/data-plots
src/data_plots/stats.py
Python
mit
3,782
from python.ci.common import flatten_map, get_deploy_info, create_target_matrix, get_script_locations from python.common import try_get_key from collections import defaultdict from copy import deepcopy def github_gen_config(build_info, repo_dir): script_loc = try_get_key(build_info, 'script_location', 'ci') ma...
hbirchtree/coffeecutie-imgui
toolchain/python/ci/actions.py
Python
mit
10,299
"""C interface for behaviors support (a.k.a windowless controls).""" import enum import ctypes from sciter.capi.scdom import HELEMENT from sciter.capi.scvalue import SCITER_VALUE from sciter.capi.scgraphics import HGFX from sciter.capi.sctypes import * import sciter.capi.sctiscript as sctiscript class EVENT_GROUPS...
pravic/pysciter
sciter/capi/scbehavior.py
Python
mit
20,318
#!/usr/bin/env python import os import sys import unittest import multiprocessing import tempfile import artifactory if sys.version_info[0] < 3: import StringIO as io import ConfigParser as configparser else: import io import configparser config = configparser.ConfigParser() config.read("test.cfg"...
Parallels/artifactory
int_test.py
Python
mit
4,970
""" Pre-processing and normalization functions for the ST datasets. """ import numpy as np import pandas as pd import math import os from sklearn.preprocessing import StandardScaler import re def normalize(counts, normalization): """ Wrapper around the function normalize_data() """ return normalize_...
jfnavarro/st_analysis
stanalysis/preprocessing.py
Python
mit
9,931
#From: https://djangosnippets.org/snippets/690/ import re from django.template.defaultfilters import slugify def unique_slugify(instance, value, slug_field_name='slug', queryset=None, slug_separator='-'): """ Calculates and stores a unique slug of ``value`` for an instance. ``slug_fiel...
ninapavlich/scout-and-rove
scoutandrove/utils/slugify.py
Python
mit
2,649
"""Sample unit test module using pytest-describe and expecter.""" # pylint: disable=redefined-outer-name,unused-variable,expression-not-assigned,singleton-comparison from demo import utils def describe_feet_to_meters(): def when_integer(expect): expect(utils.feet_to_meters(42)) == 12.80165 def when_...
jacebrowning/template-python-demo
demo/tests/test_utils.py
Python
mit
390
#!/usr/bin/python3 """ Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Input: [1,2,3] Output: 6 Example 2: Input: [1,2,3,4] Output: 24 Note: The length of the given array will be in range [3,104] and all elements are in the range [-1000, 1000]. Mult...
algorhythms/LeetCode
628 Maximum Product of Three Numbers.py
Python
mit
773
import re from thefuck.utils import get_closest def extract_possibilities(command): possib = re.findall(r'\n\(did you mean one of ([^\?]+)\?\)', command.stderr) if possib: return possib[0].split(', ') possib = re.findall(r'\n ([^$]+)$', command.stderr) if possib: return possib[0].sp...
zhangzhishan/thefuck
thefuck/rules/mercurial.py
Python
mit
902
"""fips verb to build the oryol samples webpage""" import os import yaml import shutil import subprocess import glob from string import Template from mod import log, util, project, emscripten, android from tools import texexport # what to build BuildEmscripten = True BuildWasm = True ExportAssets = True ExtensionSa...
floooh/oryol
fips-files/verbs/webpage.py
Python
mit
10,355
from __future__ import unicode_literals import argparse import json import logging import os import time import tensorflow as tf from ..load import yield_batch from ..convolutional import ChessConvolutionalNetwork from ..train import train_model, test_model BATCH_SIZE = 1e3 TRAIN_TEST_RATIO = 0.8 MAX_ITERATIONS_PE...
srom/chessbot
estimator/train/grid/__main__.py
Python
mit
3,679
import unittest from PrimeNumbers import prime class TestPrimeNumbers(unittest.TestCase): def setUp(self): self.result = prime.generate_prime_numbers(100) def test_only_integers(self): for my_number in self.result: self.assertIsInstance(my_number, int) def test_first_prime_nu...
SerryJohns/SLC-JOHN-PAUL
tests.py
Python
mit
1,067
import tensorflow as tf import numpy as np import model import utils import graph from scipy import misc import os import time os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' from sklearn.model_selection import train_test_split current_location = os.getcwd() learning_rate = 0.001 epoch = 1000 batch_size = 5 split_percentage ...
huseinzol05/Deep-Learning-Tensorflow
deprecated/Deep Convolutional Network/pokemon-type/old-model/main.py
Python
mit
5,482
# -*- coding: utf-8 -*- """Common variables and functions. """ __all__ = [ 'get_var_desc', 'get_label', ] _variable_description = { 'AH002': ('Absolute Feuchte 2 m', 'g/m³'), 'ALB': ('Albedo', '1 '), 'D': ('Diffuse Himmelsstrahlung', 'W/m²'), 'DD010': ('Windrichtung 10 m', '°'), 'DR': ('Di...
lkluft/lehrex
lehrex/plots/common.py
Python
mit
4,602
from setuptools import setup def readme(): with open('README.md') as f: return f.read() setup(name='monopoly', version='0.1.1', description='A karma bot for Hangouts, Slack, and IRC.', long_description=readme(), url='https://github.com/laneshetron/monopoly.git', author='Lane ...
laneshetron/monopoly
setup.py
Python
mit
687
#!/usr/bin/python2 # -*- coding: utf-8 -*- import time import datetime import inspect import simplejson as json import sys sys.path.append("../../") import sensnode.weather #import getWeatherCurrent api = 'f86d1e8be4de0136' STIMAZOWIE117='http://api.wunderground.com/api/'+ api +'/conditions/q/pws:IMAZOWIE117.json' STI...
roblad/sensmon
sensnode/decoders/outdoor.py
Python
mit
2,695
#!/usr/bin/env python3 # Copyright (c) 2009-2019 The Bitcoin Core developers # Copyright (c) 2014-2019 The DigiByte Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test node responses to invalid blocks. In this ...
digibyte/digibyte
test/functional/p2p_invalid_block.py
Python
mit
4,441
# -*- coding: utf-8 -*- from rest_framework import status from rest_framework.reverse import reverse from rest_framework.test import APITestCase from ....factories import (DiscountFactory, DiscountRegistrationFactory, TicketTypeFactory, UserFactory) class DiscountApiTests(APITestCase): ...
karservice/kobra
kobra/api/v1/tests/test_discounts.py
Python
mit
12,169
from time import sleep from sys import exc_info, exit from config_parser import get_config_key from csv_parser import get_watchlist, update_last_known_filenames from process_latest_release_info import download_and_or_notify from html_parser import get_latest_release_info from log import log_error, log_info, log_success...
SurgamIdentidem/CeilingNyaa
ceilingnyaa/__main__.py
Python
mit
1,612
from django.shortcuts import render, get_object_or_404 from django.http import HttpResponse, HttpResponseRedirect from django.urls import reverse from django.views import generic from django.utils import timezone from .models import Question, Choice # Create your views here. class IndexView(generic.ListView): tem...
samcheck/djangotest
mysite/polls/views.py
Python
mit
1,701
# 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/trafficmanager/azure-mgmt-trafficmanager/azure/mgmt/trafficmanager/models/__init__.py
Python
mit
2,693
import os import sys import signal import requests from multiprocessing import Pool signal.signal(signal.SIGINT, signal.SIG_IGN) url = os.environ.get("UNOSERVICE_URL") def request(i): path = sys.argv[1] files = {"file": open(path, "rb")} data = {"extension": "docx"} # print('send request') res = ...
alephdata/ingestors
convert/test.py
Python
mit
655
#! /usr/bin/env python # -*- coding: utf-8 -*- import csv import numpy as np class AnalytikJenaqTower2: def __init__(self): self.name = "Analytik Jena qTower 2.0/2.2" self.providesTempRange = False self.providesDeltaT = False def loadData(self, filename, reads, wells): with ...
Athemis/PyDSF
instruments/analytikJenaqTower2.py
Python
mit
956
#! /bin/python import
likewwddaa/PiFlower
hello.py
Python
mit
23
# -*- coding: utf-8 -*- from .base import FunctionalTestCase from .pages import game DATE_REGEX = r'\[\d{1,2}-\d{1,2} \d{2}:\d{2}\] ' class UndoTests(FunctionalTestCase): def test_can_undo_player_transfering_money_to_bank(self): self.story('Alice is a user who has a game with a player') self.brows...
XeryusTC/18xx-accountant
accountant/functional_tests/test_undo.py
Python
mit
25,079
import json import urllib2, base64 from auth_service import AuthCheckResult class TCAuthService(): def __init__(self, tc_url): # https://www.transparentclassroom.com/api/v1/authenticate.json self.endpoint = tc_url + '/api/v1/authenticate.json' def do_req(self, req): req.add_header('Con...
WildflowerSchools/sensei
app/tc_auth_service.py
Python
mit
1,142
#!/usr/bin/env python3 # Copyright (c) 2016-2020 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import re import fnmatch import sys import subprocess import datetime import os ########################...
midnightmagic/bitcoin
contrib/devtools/copyright_header.py
Python
mit
22,184
# ######## KADEMLIA CONSTANTS ########### # Small number representing the degree of # parallelism in network calls alpha = 3 # Maximum number of contacts stored in a bucket # NOTE: Should be an even number k = 80 # Timeout for network operations # [seconds] rpcTimeout = 0.1 # Delay between iterations of iterative n...
hoffmabc/OpenBazaar
node/constants.py
Python
mit
1,299
''' fabfile_sample.py edit this to your satisfaction, then move it in your project root as fabfile.py usage: $ fab dev pack deploy $ fab dev uptime ''' import os from fabric.api import * def dev(): env.user = 'nathaniel' env.hosts = ['tycho'] env.virtualenv_dir = '/home/nathaniel/conf/virtualenvs/i...
aquaya/ivrhub
conf/fabfile_sample.py
Python
mit
1,996
from .formfill import FormFillExtension as formfill # NOQA
Kroisse/FormEncode-Jinja2
formencode_jinja2/__init__.py
Python
mit
60
# THIS FILE IS AUTO-GENERATED. DO NOT EDIT from verta._swagger.base_type import BaseType class UacRemoveTeamUserResponse(BaseType): def __init__(self, status=None): required = { "status": False, } self.status = status for k, v in required.items(): if self[k] is None and v: raise ...
mitdbg/modeldb
client/verta/verta/_swagger/_public/uac/model/UacRemoveTeamUserResponse.py
Python
mit
535
import loggingskeleton loggingskeleton.test("l_testlogging3.py")
sburnett/seattle
repy/tests/ut_repytests_testlogging3.py
Python
mit
65
import matplotlib.pyplot as plt import json import numpy as np def visual_file(file_name, line_color, font_size, font_size2): names = [] numbs = [] n = 0 with open(file_name, 'r') as f: data = json.load(f) for d in data: cur_births = d['birth'] for cur_birth in ...
ArtezGDA/MappingTheCity-Maps
Kimberley ter Heerdt/Poster/Visual-1:2/visualisatie2.py
Python
mit
1,458
# 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/maps/azure-mgmt-maps/azure/mgmt/maps/models/_models_py3.py
Python
mit
32,038
# -*- coding: utf-8 -*- """ This script provides dev-ops tools for python project development. """ from __future__ import print_function from pathlib_mate import Path from setup import package def reformat(**kwargs): """ auto pep8 format all python file in ``source code`` and ``tests`` dir. """ # re...
MacHu-GWU/docfly-project
reformat_pep8_code_style.py
Python
mit
1,083
# -*- coding: utf-8 -*- from django.core.management.base import BaseCommand, CommandError from atados_core.models import GoogleAddress from optparse import make_option import csv import time class Command(BaseCommand): help = 'Recover typed_address2 when fucked up by command update_broken_legacy_from_csv' option_l...
atados/api
atados_core/management/commands/recover_legacy_address_from_updated_csv.py
Python
mit
1,259
#!/usr/bin/env python3 import sys sys.path[0] = sys.path[0] + "/lib/" import haldir as hd #generate lists for comparisions comp_sets = hd.build_comp_sets() #generate sets for identifying sex male_set, female_set = hd.build_male_set() #### test and fix #### #print(comp_sets["medals"]) #print(male_set) #print(typ...
meetunix/haldir
haldir.py
Python
mit
577
""" Code used to save the keras model as an image for visualization """ from keras.layers import Convolution2D, Input from keras.layers import Flatten, Dense from keras.layers import Dropout from keras.models import Model from keras.applications.vgg16 import VGG16 try: # pydot-ng is a fork of pydot that is better m...
sridhar912/Self-Driving-Car-NanoDegree
CarND-BehavioralCloning-P3/viz.py
Python
mit
4,047
from fabric.api import run, cd, env from fabric.decorators import with_settings from fabric.colors import green from fabtools import service, files ## TODO: use upload_template to prevent hardcoded ## supervisor configuration files service_name='nginx' @with_settings(warn_only=True) def setup(): print(green('Se...
streema/deployer
deployer/tasks/nginx.py
Python
mit
860
# -*- coding: utf-8 -*- """Main CLI program.""" import sys import os import logging import time import argparse from functools import partial import json_logging from .plugins.manager import DefaultPluginManager from .updater.manager import updater_classes from .detector.manager import detector_classes from .core i...
infothrill/python-dyndnsc
dyndnsc/cli.py
Python
mit
6,684
import random class RandomAgent(object): def __init__(self, seed=None): self.random = random.Random() self.random.seed(seed) def new_game(self, game_state): pass def make_move(self, game_state): move = self.random.choice(game_state.legal_moves) return move, game_state.move(move)
tarvaina/nn-planner
agents/random_agent.py
Python
mit
309
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
madgik/exareme
Exareme-Docker/src/exareme/exareme-tools/madis/src/lib/chardet/sbcharsetprober.py
Python
mit
4,703
def separate_filename_from_extension(s): slash = s.rfind('/') + 1 dex = slash + s[slash:].find('.', s[slash:].startswith('.')) return s[:dex], s[dex:]
the-zebulan/CodeWars
katas/beta/separate_filename_from_extension.py
Python
mit
163
import numpy as np problems = [ {'C': 1, 'coins': [1, 5]}, {'C': 4, 'coins': [1]}, {'C': 10, 'coins': [1, 5, 10]}, {'C': 10, 'coins': [1, 2, 4, 5, 8, 10, 12]}, {'C': 12, 'coins': [1, 2, 4, 5, 8, 10, 13]} ] def making_change(C, coins): coins = [0] + coins m = np.zeros((len(coins), C+1)) ...
lucasdavid/Use-Algorithms
src/dynamic_programing/making_change.py
Python
mit
1,084
"""This file contains code for use with "Think Bayes", by Allen B. Downey, available from greenteapress.com Copyright 2014 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function, division import numpy import thinkbayes2 import thinkplot from scrape import sc...
MattWis/PoissonFootball
football2.py
Python
mit
5,886
""" File: motif.py Purpose: Encapsulates a motif note figure plus all constraints proper to that motif, i.e. the constraint actors are all from the note figure. """ from melody.structure.abstract_motif import AbstractMotif from structure.abstract_note_collective import AbstractNoteCollective from structure....
dpazel/music_rep
melody/structure/motif.py
Python
mit
5,476
""" Package variables. .. package:: variables :platform: Unix, Windows :synopis: classes for variable objects .. moduleauthor:: Thomas Lehmann <thomas.lehmann.private@googlemail.com> """
Nachtfeuer/concept-py
concept/variables/__init__.py
Python
mit
200
from __future__ import unicode_literals __author__ = 'riegel' import socket #import threading import multiprocessing from .handler import handle_client #from .context import RequestConte import logging logger = logging.getLogger(__name__) class Server(object): def __init__(self, hostname, port): self.hos...
mrcrgl/gge-storage
lib/socket/server.py
Python
mit
1,426
GREEN = 24 RED = 26 BLUE = 22 WHITELIST = {"eb94294a", "044c4fd2222a80"} SPINTIME = 3 BLINKFRACTION = 3 #espeak ACCESSDENIED = "Access denied." SPEAKSPEED = 140 SPEAKPITCH = 50
j0sh77/nfc
settings.py
Python
mit
181
import json from configuration_builder import DEFAULT_CONFIGURATION_BUILDER def get_config(request): return { 'javascript_settings': json.dumps( DEFAULT_CONFIGURATION_BUILDER.get_configuration() ) }
pozytywnie/django-javascript-settings
javascript_settings/context_processors.py
Python
mit
238
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('feed_filter', '0005_auto_20151002_0938'), ] operations = [ migrations.AddField( model_name='filter', ...
nice-shot/FacebookFilter
feed_filter/migrations/0006_filter_name.py
Python
mit
494
''' Created on Jul 10, 2013 @author: nshearer ''' from ConsoleSimpleQuestion import ConsoleSimpleQuestion, UserAnswerValidationError class ConsoleYesNoQuestion(ConsoleSimpleQuestion): def __init__(self, question): super(ConsoleYesNoQuestion, self).__init__(question) def present_q...
shearern/PyWizard
src/py_wizard/console_wiz_iface/ConsoleYesNoQuestion.py
Python
mit
1,184
from flask import current_app import requests def is_recaptcha_valid(token): payload = { 'secret': current_app.config.get('RECAPTCHA_PRIVATE_KEY', ''), 'response': token } response = requests.post( 'https://www.google.com/recaptcha/api/siteverify', payload ) return r...
ev-agelos/Python-bookmarks
bookmarks/api/utils.py
Python
mit
354
#!usr/bin/python from osgeo import gdal import os,csv import json import utils.ogr2ogr as ogr2ogr import utils.ogrinfo as ogrinfo import utils.gdal_polygonize_edited as gdal_polygonize import get_stats def parse(inputFile=None,outputFolder="data",\ outputFile="datatiles.json",datatype=None,top=15,layernumber=None,ke...
worldbank/cv4ag
modules/parse.py
Python
mit
7,121
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('beer', '0005_beer_status'), ] operations = [ migrations.AlterField( model_name='beer', name='status'...
OckiFals/crud-django
beer/migrations/0006_auto_20150114_1451.py
Python
mit
457
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from base import Problem class Solution(Problem): def solve(self, input_): print('Solve problem {}'.format(self.number)) print(str(sum(i for i in range(1, input_ + 1))**2 - sum(i**2 for i in range(1, input_ + 1)))) if __name__ == '...
phapdv/project_euler
pe6.py
Python
mit
381
# 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_09_01/aio/operations/_vpn_gateways_operations.py
Python
mit
32,520
#!/usr/bin/env python # -*- coding: utf-8 -*- from astropy.units import Unit, def_unit, add_enabled_units new_units = dict( flam='erg * s ** (-1) * AA ** (-1) * cm **(-2)', fnu='erg * s ** (-1) * Hz ** (-1) * cm **(-2)', photflam='photon * s ** (-1) * AA ** (-1) * cm **(-2)', photfnu='photon * s ** (-1...
mfouesneau/pyphot
pyphot/astropy/__init__.py
Python
mit
703