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 |
|---|---|---|---|---|---|
"""
The Plaid API
The Plaid REST API. Please see https://plaid.com/docs/api for more details. # noqa: E501
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from plaid.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal... | plaid/plaid-python | plaid/model/income_verification_precheck_confidence.py | Python | mit | 7,787 |
import matplotlib.pyplot as plt
import numpy
from matplotlib.ticker import FixedLocator
from matplotlib.colors import BoundaryNorm
def _produce_axis(spectra, dimension):
""" This method produces an array that represents the axis.
The array is formed of the value at the bin-centre for each bin
along the s... | mjmottram/echidna | echidna/output/plot.py | Python | mit | 11,748 |
from django.conf.urls import patterns, url
from .views import ProductList, ProductDetail
urlpatterns = patterns('',
url(r'^$', ProductList.as_view(), name="store_index"),
url(r'^product/(?P<pk>\d+)/$', ProductDetail.as_view(), name='product_detail'),
) | bliti/tienda | store/urls.py | Python | mit | 261 |
import os, sys
import imp
from authorizenet import apicontractsv1
from authorizenet.apicontrollers import *
constants = imp.load_source('modulename', 'constants.py')
from decimal import *
def update_split_tender_group():
merchantAuth = apicontractsv1.merchantAuthenticationType()
merchantAuth.name = constants.... | AuthorizeNet/sample-code-python | PaymentTransactions/update-split-tender-group.py | Python | mit | 1,244 |
"""
Class based authentication views for Django
"""
from django import http as django_http, shortcuts as django_shortcuts
from django.conf import settings as django_settings
from django.contrib import auth as django_auth
from django.contrib.auth.decorators import login_required
from django.core import urlresolvers as ... | durandj/ynot-django | ynot/django/auth/views.py | Python | mit | 3,081 |
# Copyright (c) 2011, Found IT A/S and Piped Project Contributors.
# See LICENSE for details.
import base64
import hashlib
import itertools
import logging
import operator
from urllib2 import urlparse
import zookeeper
from twisted.application import service
from twisted.internet import defer
from twisted.python import ... | foundit/Piped | contrib/zookeeper/piped_zookeeper/providers.py | Python | mit | 22,182 |
from typing import List
from pyrep.objects.object import Object
from pyrep.objects.shape import Shape
from pyrep.objects.proximity_sensor import ProximitySensor
from pyrep.objects.force_sensor import ForceSensor
class SuctionCup(Shape):
"""Represents all suction cups.
"""
def __init__(self, count: int, n... | stepjam/PyRep | pyrep/robots/end_effectors/suction_cup.py | Python | mit | 2,316 |
#/ <reference path="./testBlocks/core.ts" />
level = max(0, 10)
level2 = min(0, 10) | switch-education/pxt | tests/pydecompile-test/baselines/block_max.py | Python | mit | 84 |
import popsims
import numpy as np
import matplotlib.pyplot as plt
import wisps
import pandas as pd
import wisps.simulations as wispsim
from tqdm import tqdm
import astropy.units as u
import numba
from scipy.interpolate import griddata
from popsims import galaxy
def probability_of_selection(spt, snr):
"""
pro... | caganze/wisps | wisps/simulations/thick_disk_counts.py | Python | mit | 9,347 |
import time
t0 = time.time()
class point:
def __init__(self, x, y):
self.x = x
self.y = y
self.available = []
self.value = 0
def rowNum(p, sudoku):
row = set(sudoku[p.y * 9:(p.y + 1) * 9])
row.remove(0)
return row # set type
def colNum(p, sudoku):
col = []
... | quchunguang/test | pythonchallenge/sutuku.py | Python | mit | 2,846 |
#!/usr/bin/env python
__version__ = '0.1.0'
| akun/onepiece | onepiece/__init__.py | Python | mit | 46 |
from hashlib import md5
from scrapy.selector import Selector
from .settings import SNAPSHOT_DIR
def build_xpath_results(selectors, file_name):
feed_xpath = selectors[0]
field_xpathes = selectors[1]
fpath = "%s/%s" % (SNAPSHOT_DIR, file_name)
with open(fpath) as f:
data = f.read()
html... | taroved/pol | frontend/frontend/setup_tool_ext.py | Python | mit | 3,243 |
#!/usr/bin/env python
import PrepDataCommon
__author__ = 'mpolovyi'
simData = {
"Base": {
"Density": [0.25, 0.5, 0.75], # 0.5, 0.75],
"InitialConfiguration": [0, 1],
"KbT": [1],# 1.2, 1.8],
"LoadSavedState": 0,
"NumberOfSavePoints": 10,
"NumberOfImageLines": 1,
... | MPolovyi/SCOLSS | src/PrepareData/PrepDataMD.py | Python | mit | 865 |
from solutions import max_two
import unittest
import random
class TestMaxTwo(unittest.TestCase):
def test_neg_neg(self):
first = random.random() * -1000
second = random.random() * -1000
expected = max(first, second)
actual = max_two(first, second)
self.assertEqual... | lukin155/skola-programiranja | domaci-zadaci/05/test_max_two.py | Python | mit | 1,502 |
from django.db import models
from django.contrib.auth.models import User
class Make(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
class Car(models.Model):
doors = models.IntegerField()
make = models.ForeignKey(Make)
model = models.CharField... | cbrentharris/8700-Project | base/models.py | Python | mit | 1,241 |
from pandas import *
from ggplot import *
def unit_to_int(unit):
unit = int(unit[1:4])
return unit
def plot_weather_data(turnstile_weather):
'''
You are passed in a dataframe called turnstile_weather.
Use turnstile_weather along with ggplot to make a data visualization
focused on the... | rmhyman/DataScience | Lesson4/subway_data_visualization1.py | Python | mit | 2,443 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Provides an aptdaemon based backend
"""
# Copyright (C) 2008-2010 Sebastian Heinlein <devel@glatzor.de>
#
# Licensed under the GNU General Public License Version 2
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU G... | yasoob/PythonRSSReader | venv/lib/python2.7/dist-packages/sessioninstaller/backends/aptd.py | Python | mit | 5,751 |
###############################################################################
#
# Copyright (C) 2014-2016 PyWPS Development Team, represented by Jachym Cepicky
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# ... | ricardogsilva/PyWPS | docs/conf.py | Python | mit | 2,480 |
""" Unit tests for the Permutation explainer.
"""
# pylint: disable=missing-function-docstring
import pickle
import numpy as np
import shap
from . import common
def test_exact_second_order():
""" This tests that the Perumtation explain gives exact answers for second order functions.
"""
np.random.seed(0)
... | slundberg/shap | tests/explainers/test_permutation.py | Python | mit | 3,068 |
# Copyright (c) 2021 elParaguayo
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distrib... | qtile/qtile | test/extension/test_command_set.py | Python | mit | 2,817 |
from .SSLTester import SSLTester, init_db_tables
| De117/scanner | SSLTester/__init__.py | Python | mit | 49 |
""" requires scikit-image installed (for vfx.painting) """
from moviepy.editor import *
# WE TAKE THE SUBCLIPS WHICH ARE 2 SECONDS BEFORE & AFTER THE FREEZE
charade = VideoFileClip("../../videos/charade.mp4")
tfreeze = convert_to_seconds(19.21) # Time of the freeze, 19'21
# when using several subclips of a same cl... | kerstin/moviepy | examples/painting_effect.py | Python | mit | 1,258 |
import _plotly_utils.basevalidators
class BgcolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="bgcolor", parent_name="scatter.marker.colorbar", **kwargs
):
super(BgcolorValidator, self).__init__(
plotly_name=plotly_name,
parent... | plotly/python-api | packages/python/plotly/plotly/validators/scatter/marker/colorbar/_bgcolor.py | Python | mit | 476 |
"""
Package containing models of various machines (virtual and physical) and
associated schedulers.
"""
import decimal
import simpy
from .base import NamedObject
from .request import Cancelled
from .thread import Thread
class VirtualMachine(NamedObject):
"""
Simulates a virtual machine.
"""
ALLOWED_SC... | cristiklein/tailtamer | tailtamer/machine.py | Python | mit | 10,566 |
"""This module does blah blah."""
import sys
import types
import webbrowser
import pymel.core as pmc
HELP_2014_ROOT_URL = ('http://download.autodesk.com/global/docs/'
'maya2014/en_us/PyMel/')
HELP_2016_ROOT_URL = ('http://help.autodesk.com/cloudhelp/'
'2016/ENU/Maya-Tech-... | SonyStone/pylib | Practical Maya Programming/minspect.py | Python | mit | 5,191 |
from .classes import *
from .obj_doc_mov_stq import *
from .transfere import *
| anselmobd/fo2 | src/estoque/classes/__init__.py | Python | mit | 79 |
"""
Django settings for qp_search_project project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
im... | enlighter/ndl-question-papers-search-hub | qp_search_project/qp_search_project/settings.py | Python | mit | 5,121 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import logging
import os
import random
import re
import sys
import time
import pygame
from flight_watcher import flight_watcher
from pygame import display, draw
class DigitCache( object ):
images = {}
image_path = "images"
@classmethod
... | prehensile/pygame-flipclock | src/clock.py | Python | mit | 8,224 |
# -*- coding: utf8 -*-
import os
import logging
import pipes
import subprocess
import socket
import exceptions
from base import *
import admin
#Create a custom logger
logger = logging.getLogger("solrcl")
logger.setLevel(logging.DEBUG)
MINIMAL_REPLICABLE_SOLRCONFIG = """<?xml version="1.0" encoding="UTF-8" ?>
<config... | zaccheob/solrcl | solrcl/create.py | Python | mit | 3,681 |
fromm setuptools import setup
setup(name='FoodRS',
version='0.1',
description='https://github.com/FranciscoGutierrez/FoodRS/',
url='http://github.com/storborg/funniest',
author='Franisco G.',
author_email='francisco.g@example.com',
license='MIT',
packages=['funniest'],
i... | FranciscoGutierrez/FoodRS | setup.py | Python | mit | 408 |
'''
Performs a beam search with given parameters.
Takes as input a
interface: a BeamSearchInterface object
params: a set of parameters
n: the number of things to return
k: the number of symbols to expand at each step.
'''
''' the following actions are needed for instance:
instance.next_child(self, must_be_better_than... | dwhalen/holophrasm | beam_search.py | Python | mit | 2,317 |
import chainer
from chainer import cuda
from chainer import function_node
from chainer.utils import type_check
class ExpandDims(function_node.FunctionNode):
"""Expands dimenstions of an input array without copy."""
def __init__(self, axis):
self.axis = int(axis)
def check_type_forward(self, in_... | kashif/chainer | chainer/functions/array/expand_dims.py | Python | mit | 2,092 |
from contesto.config import config
from contesto.basis.test_case import ContestoTestCase
from contesto.basis.page import Page, WebPage, MobilePage
from contesto.basis.component import Component, WebComponent, MobileComponent
from contesto.core.locator import *
from contesto.core.finder import find_element, find_elemen... | rseek/contesto | contesto/__init__.py | Python | mit | 452 |
from django.shortcuts import render_to_response, redirect
from django.template.context import RequestContext
from members.models import HsUser, WebLink
from members.forms import HsUserForm
from django.forms.models import inlineformset_factory
import logging
from django.contrib import messages
logger = logging.getLog... | elifkus/Hackerhane | src/members/views.py | Python | mit | 2,531 |
# encoding: utf-8
import pytest
import sys
from unittest.mock import Mock
from eth_utils import (
is_hex,
)
from hypothesis import (
example,
given,
strategies as st,
)
from web3.utils.encoding import (
hex_encode_abi_type,
text_if_str,
hexstr_if_str,
to_int,
to_hex,
)
from web3... | pipermerriam/web3.py | tests/core/utilities/test_encoding.py | Python | mit | 3,969 |
from .models import Budget
class ProvideBudgetMiddleware(object):
def process_request(self, request):
if request.user.is_authenticated():
try:
budget = Budget.objects.get(pk=request.session['budget_id'])
if not budget.viewable_by(request.user):
... | koriaf/django-abudget | src/abudget/money/middleware.py | Python | mit | 773 |
import os
import cPickle
import logging
from django.core.management.base import BaseCommand
from django.core.files import File
import numpy
from sklearn import svm
from sklearn.model_selection import GridSearchCV, train_test_split
from chemtools.ml import MultiStageRegression
from data.models import DataPoint, Predic... | crcollins/chemtools-webapp | chemtools/management/commands/update_ml.py | Python | mit | 2,393 |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import datetime
import itertools
import os
import re
import sys
from contextlib import ExitStack
from func... | indico/indico | indico/cli/shell.py | Python | mit | 6,116 |
#http://stackoverflow.com/questions/5824881/python-call-special-method-practical-example
'''
# output
0! = 1
1! = 1
2! = 2
3! = 6
4! = 24
5! = 120
6! = 720
7! = 5040
8! = 40320
9! = 362880
'''
class Factorial:
def __init__(self):
self.cache = {}
def __call__(self, n):
if n not in self.cache:... | lmokto/magicmethods | __call__/example1.py | Python | mit | 624 |
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtUiTools import *
from datetime import datetime
import plugin.databaseConnect as database
import plugin.course as courseItem
class searchCourseByProfIDUI(QMainWindow):
def __init__(self,parent = None ):
QMainWindow.__init__(self,None)
... | Poom1997/GMan | searchCourseByProfIDForm.py | Python | mit | 3,270 |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from django.views.generic import RedirectView
urlpatterns = patterns('',
url(r'^$', RedirectView.as_view(url='/repositories/')),
url(r'^repositories/$', 'repoupdate.repositories.views.index'),
url(r'^repositories/add/$', 'repoupda... | gibas/repoupdate | repoupdate/urls.py | Python | mit | 1,222 |
#!/usr/bin/env python
# coding : utf-8
# author : 'Zend'
# team : "gogobirds"
from plugins.base import register_plugin
from libs.utils import http
from pprint import pprint
info = {
'app_name': "www",
'version': "0.1",
'type': "www",
'desc': "www is test",
}
plugin_info = (info['app_name'], info[... | gogobirds/Pencil | plugins/test2/www.py | Python | mit | 746 |
# -*- coding: utf-8 -*-
"""
Unit Test: orchard.system_status.formatters.data
"""
import unittest
import orchard
import orchard.system_status.formatters.data as formatter
class DataUnitTest(unittest.TestCase):
def setUp(self):
app = orchard.create_app('Testing')
self.app_context = app.app_c... | BMeu/Orchard | tests/unit/system_status/formatters/data_unit_test.py | Python | mit | 2,388 |
#!/usr/bin/env python
# Name: lepemtocrt.py
# Purpose: Let's Encrypt PEM to CRT Script.
# By: Jerry Gamblin
# Date: 04.11.15
# Modified 04.11.15
# Rev Level 0.5
# -----------------------------------------------
import os
import re
import time
import sys
import subprocess
import readline
#Make Dir to C... | jgamblin/lepemtocrt | lepemtocrt.py | Python | mit | 892 |
#!/usr/bin/env python2
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test mulitple rpc user config option rpcauth
#
from test_framework.test_framework import BitcoinTestFrame... | mexicancoin/MXNCore | qa/rpc-tests/multi_rpc.py | Python | mit | 4,587 |
import discord
from discord.ext import commands
from discord.ext.commands.core import Command
import salem
import time, os, asyncio, json, atexit
class Bot(commands.Bot):
def __init__(self, command_prefix, formatter=None, description=None, pm_help=False, **options):
super().__init__(command_prefix, forma... | bendgk/Town-of-Discord | server/bot.py | Python | mit | 2,653 |
from __future__ import absolute_import, print_function
import collections
import hashlib
import json
import os
from shutil import copy2
from pebble_tool.commands.sdk.project import SDKProjectCommand
from pebble_tool.exceptions import OutdatedProjectException, ToolError
from pebble_tool.sdk.project import NpmProject
... | pebble/pebble-tool | pebble_tool/commands/sdk/project/convert.py | Python | mit | 4,438 |
import sys
import os
from knightos.workspace import Workspace
def execute(key):
ws = Workspace()
result = ws.config.get(key)
if result == None:
sys.exit(1)
sys.stdout.write(result)
sys.exit(0)
| KnightOS/sdk | knightos/commands/query.py | Python | mit | 222 |
import psycopg2
import re
from backend.pg import PGBackend
'''
@author: anant bhardwaj
@date: Oct 3, 2013
DataHub DB wrapper for backends (only postgres implemented)
'''
class Connection:
def __init__(self, user, password, db_name=None):
self.backend = PGBackend(user, password, db_name=db_name)
def execute... | sciencewiz1/datahub | src/datahub/core/db/connection.py | Python | mit | 1,464 |
#! /usr/bin/env python
"""Static analysis tool for checking docstring conventions and style.
Implemented checks cover PEP257:
http://www.python.org/dev/peps/pep-0257/
Other checks can be added, e.g. NumPy docstring conventions:
https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
The repository is l... | j5shi/ST3_Config | Packages/Anaconda/anaconda_lib/linting/pep257.py | Python | mit | 26,613 |
import crc8
import Utilities
FLAG = 200
BASE = 100
class DataPoint(object):
def __init__(self, id, data):
self.id = id
self.data = data
class Node(object):
def __init__(self, id):
self._id = id
self._data_queue = []
def push_data(self, data):
if self._is_new_da... | boddmg/smartconfig | smartconfig/protocol.py | Python | mit | 2,089 |
# most_stat_per
# Selects two random stats and returns the player with the best stat
# per the other stat. It recalculates if more than two players are tied
# for best stat.
import random
# most_stat_per
# INPUT: stats, player_dicts
# The list of stats and the list of players' stat dictionaries.
# OUTPUT: best_stat, ... | handshakinglemma/cwhlstatbot | best_stats_per.py | Python | mit | 2,786 |
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from sel... | ibio/mini-crawler | minicrawler/provider/webbrowser.py | Python | mit | 4,824 |
def multi_cmp(keys, getter):
"""
keys - a list of keys which the getter will used compare with
getter - a getter, usually itemgetter or attrgetter from operator
T... | ActiveState/code | recipes/Python/528941_multicmp/recipe-528941.py | Python | mit | 799 |
"""
.. module:: dj-stripe.contrib.rest_framework.views.
:synopsis: Views for the dj-stripe REST API.
.. moduleauthor:: Philippe Luickx (@philippeluickx)
"""
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.view... | kavdev/dj-stripe | djstripe/contrib/rest_framework/views.py | Python | mit | 2,431 |
import os
import unittest
from parameterized.parameterized import parameterized
from conans.paths import CONANFILE
from conans.test.utils.tools import TestClient
from conans.util.files import load
from conans.test.utils.conanfile import TestConanFile
tool_conanfile = """from conans import ConanFile
class Tool(Conan... | memsharded/conan | conans/test/functional/build_requires/build_requires_test.py | Python | mit | 13,000 |
# 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/_private_endpoints_operations.py | Python | mit | 24,460 |
# 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/authorization/azure-mgmt-authorization/azure/mgmt/authorization/v2020_04_01_preview/operations/_role_assignments_operations.py | Python | mit | 38,355 |
from daddy import utils
from discord.ext import commands
import aiohttp
import discord
import json
class Exchange():
"""Crypto exchange API for Daddy"""
API_URL = "https://api.cryptonator.com/api/ticker/{}-{}"
DEFAULT_DST = "usd"
DEFAULT_EXCH = [
("btc", DEFAULT_DST),
("eth", DEFAULT_D... | GoodiesHQ/Daddy | plugins/crypto.py | Python | mit | 1,696 |
import unittest
import logging
from structure.LineGrammar.core.line_grammar_executor import LineGrammarExecutor
from timemodel.duration import Duration
from transformation.patsub.hc_expression import HCExpression
class TestHCExpression(unittest.TestCase):
logging.basicConfig(level=logging.INFO)
def setUp(se... | dpazel/music_rep | tests/transformation_tests/patsub_tests/test_hc_expression.py | Python | mit | 6,394 |
from mininet.net import Mininet
from mininet.topo import Topo
from mininet.node import Node, Host, RemoteController
from mininet.log import setLogLevel, info
from mininet.link import TCLink
from mininet.util import quietRun, dumpNodeConnections
from mininet.cli import CLI
from mininet.node import OVSController, Control... | slremy/testingpubsub | Scripts/base.py | Python | mit | 3,499 |
from django.db import models
from django.utils.encoding import smart_text, python_2_unicode_compatible
from django.core.urlresolvers import reverse
@python_2_unicode_compatible
class Category(models.Model):
name = models.CharField(max_length=255)
class Meta:
verbose_name_plural = "Categories"
de... | bahattincinic/django-101 | presentation/models.py | Python | mit | 961 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-10 10:49
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('usuarios', '0004_auto_20170109_1028'),
... | eduardoedson/scp | servicos/migrations/0001_initial.py | Python | mit | 981 |
#!/usr/bin/env python3.9
# -*- coding: utf-8 -*-
import json
import sys
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from cloudfeaster import spider
class GamesonlySpider(spider.Spider):
@cl... | simonsdave/gaming-spiders | gaming_spiders/gamesonly.py | Python | mit | 1,256 |
from numatuned.virsh import Virsh
class EntireDomainFitsInZone:
def __init__(self, domain, zone):
self.zone = zone
self.virsh = Virsh(domain)
def is_satisfied(self):
return self.virsh.get_memory_in_mb() < self.zone.free_mem_in_mb()
| dionbosschieter/numatuned | numatuned/provisioning/rules/entiredomainfitsinzone.py | Python | mit | 265 |
class Counter:
'''The Counter class is a collection of individual counters. It is
intended to count the occurences of numerals (integers), but it
may also be used to count other things.
'''
# The minimal value to consider.
_min_value = 0
# The maximal value to consider.
_max_value = ... | lbechberger/CorpusStudyNumerals | numerals/counter.py | Python | mit | 3,049 |
from django.conf.urls import url, patterns
from . import views
urlpatterns = patterns("",
)
| vivsh/django-ginger | ginger/scripts/templates/app_templates/app_name/urls.py | Python | mit | 95 |
# coding=utf8
from Pmf import Hist
import survey
from plot import plot_histogram
import scipy.stats as sts
import numpy as np
def Skewness(values, mu=None):
"""
Calculate the skewness of a number of values
Args:
values: the data set
mu: the optionally previous calculated mean
Return... | crisgc/mab719 | Downey2011_exes/skewness.py | Python | mit | 1,983 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Database operation module.
'''
import time, uuid, functools, threading, logging
# Dict object
class Dict(dict):
'''
Simple dict but support access as x.y style.
>>> d1 = Dict()
>>> d1['x'] = 100
>>> d1.x
100
>>> d1.y = 200
>>> d1['y']
... | Sin-Instance/python-web | www/transwarp/db.py | Python | mit | 12,864 |
# Copyright (c) 2016 Patricio Cubillos and contributors.
# packtree is open-source software under the MIT license (see LICENSE).
__all__ = ["filetree", "packagetree"]
import os
from .tree import filetree, packagetree
# Clean up top-level namespace--delete everything that isn't in __all__
# or is a magic attribute, a... | pcubillos/packtree | packtree/__init__.py | Python | mit | 531 |
# -*- coding: utf-8 -*-
from datetime import datetime
from PBSQuery import PBSQuery, PBSError
import time
from django.contrib.auth.models import User
import pbs
from pytorque.models import PBSServer, PBSQueue, PBSJob
class Job():
__datetime_format = "%d-%m-%Y %H:%M"
jobId = None
state = None
user ... | rauch/PyPBS | pytorque/libs/torque_service.py | Python | mit | 11,615 |
# -*- coding: utf-8 -*-
from django_envie.workroom import convertfiletovars
convertfiletovars()
from .base import *
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'Photo_Magick',
... | andela-cdike/django-photo-editor | photo_magick/photo_magick/settings/development.py | Python | mit | 675 |
# -*- coding: utf-8 -*-
"""
Supply
@author: Michael Howden (michael@sahanafoundation.org)
@date-created: 2010-08-16
Generic Supply functionality such as catalogs and items that will be used across multiple modules
"""
module = "supply"
if deployment_settings.has_module("logs"):
#===... | luisibanez/SahanaEden | models/06_supply.py | Python | mit | 5,289 |
#!/usr/bin/env python
# Author : Pierre Schnizer
"""
The python equivalent of the C example found in the GSL Reference document.
The function run_fsolver shows how to use the fsolvers (e.g. brent).
"""
import pygsl._numobj as Numeric
from pygsl.testing import minimize
def fn1(x, params):
return Numeric.cos(x) +... | juhnowski/FishingRod | production/pygsl-0.9.5/testing/examples/minimize.py | Python | mit | 1,334 |
# Python3
def validTime(time):
hour, minute = map(int, time.split(':'))
return hour < 24 and minute < 60
| RevansChen/online-judge | Codefights/arcade/intro/level-12/53.Valid-Time/Python/solution1.py | Python | mit | 114 |
from collections import OrderedDict
if __name__ == '__main__':
items = OrderedDict()
for _ in range(int(input())):
s = input().split()
price = int(s[-1])
name = " ".join(s[0:-1])
if name not in items:
items[name] = price
else:
items[name] = items[... | nifannn/HackerRank | Practice/Python/Collections/collections_ordereddict.py | Python | mit | 395 |
import boto3
import json
import os
import sys
import time
from datetime import datetime
import decimal
import uuid
class Pekl(object):
def __init__(self, bucket_name, region_name=None):
self.bucket_name = bucket_name
if region_name is not None:
self.region = region_name
else:
... | tamme-io/pekl | pekl/Pekl.py | Python | mit | 4,610 |
import subprocess
import time
import tkinter
import tkinter.filedialog
from PIL import Image, ImageTk
# subprocess.run( [ "python", "../../compile.py" ] )
# subprocess.run( [ "python", "callme.py" ] )
fileSel = '' # may as well since requiring includes
folderSel = ''
class GUI ():
''' Input and output device... | JetStarBlues/Nand-2-Tetris | PlayArea/gui/guiTest2.py | Python | mit | 3,193 |
from jinja2 import Template
from IPython.display import IFrame, HTML
import os
import json
from .base_plotter import IPlotter
class GCPlotter(IPlotter):
"""
Class for creating Google Charts in ipython notebook
"""
head = '''
<!-- Load Google Charts -->
<script type='text/javascript' s... | WaylonWalker/pyDataVizDay | src/iplotter/google_plotter.py | Python | mit | 3,968 |
from mpi4py import MPI
import numpy as np
import pytest
from pyccel.epyccel import epyccel_mpi
from modules import mpi_collective as pmod
#==============================================================================
# IMPORT MODULE TO BE TESTED, EPYCCELIZE IT, AND MAKE IT AVAILABLE TO ALL PROCS
#============... | ratnania/pyccel | tests/epyccel/test_mpi_collective.py | Python | mit | 3,969 |
"""
:class:`.GoogleV3` is the Google Maps V3 geocoder.
"""
from warnings import warn
import base64
import hashlib
import hmac
from geopy.compat import urlencode
from geopy.geocoders.base import Geocoder, DEFAULT_TIMEOUT, DEFAULT_SCHEME
from geopy.exc import (
GeocoderQueryError,
GeocoderQuotaExceeded,
Con... | XBMC-Addons/script.module.geopy | lib/geopy/geocoders/googlev3.py | Python | mit | 9,196 |
from __future__ import with_statement
from contextlib import closing
import sqlite3
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash
from pprint import pprint
import OpenSSL
import re
# configuration
DATABASE = "database.db"
DEBUG = True
SERVER_CERTIFIC... | alexchamberlain/keygen | example/python2-flask/keygen.py | Python | mit | 2,685 |
"""
WSGI config for generic_infosys project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "generic_infosys.settings")
fr... | njncalub/pct-infosys | generic_infosys/wsgi.py | Python | mit | 405 |
class Solution:
def customSortString(self, order: str, s: str) -> str:
ordermap = {c: i for i, c in enumerate(order)}
return "".join(
map(
lambda x: x[1],
sorted([(ordermap[c] if c in ordermap else -1, c) for c in s]),
)
)
# TESTS
for... | l33tdaima/l33tdaima | p791m/custom_sort_string.py | Python | mit | 513 |
'''
Implementation of the paper,
Kuo et al. 2012, "Content-Adaptive Inverse Tone Mapping"
'''
import math
import numpy as np
import scipy as sp
import scipy.ndimage
import hydra.core
import hydra.filters
def kuo_expand_map(L, gamma_removal=-1.0):
kernel_size = math.ceil(0.1 * max(L.shape))
Lflt = sp.ndimage.... | tatsy/hydra | hydra/eo/kuo.py | Python | mit | 1,277 |
"""
Base class for equipment that use message-based communication.
"""
import time
from .connection import Connection
from .exceptions import MSLTimeoutError
from .constants import LF, CR
class ConnectionMessageBased(Connection):
CR = CR
""":class:`bytes`: The carriage-return character."""
LF = LF
... | MSLNZ/msl-equipment | msl/equipment/connection_message_based.py | Python | mit | 9,176 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from rons_tutorial_formatting import *
import multiprocessing as MP
start_block('example for invoking a function in a separate process')
def print_loop(num, lock):
for i in range(num):
lock.acquire()
print ("{}: {}".format(MP.current_process().name, i))
... | ronkitay/Rons-Tutorials | Python/AdvancedTutorials/MultiProcessing/locking_shared_resources.py | Python | mit | 969 |
import numpy as np
from sklearn import linear_model
def crossvad_build_k_indices(y, k_fold, seed = 1):
"""build k indices for k-fold."""
num_row = y.shape[0]
interval = int(num_row / k_fold)
np.random.seed(seed)
indices = np.random.permutation(num_row)
k_indices = [indices[k * interval: (k + 1... | mdeff/ntds_2017 | projects/reports/stackoverflow_survey/functions.py | Python | mit | 2,492 |
from collections import Iterable
from numbers import Real, Integral
import numpy as np
import openmc.checkvalue as cv
from openmc.stats import Tabular, Univariate, Discrete, Mixture
from .angle_energy import AngleEnergy
from .function import INTERPOLATION_SCHEME
from .endf import get_tab2_record, get_tab1_record
cl... | bhermanmit/openmc | openmc/data/laboratory.py | Python | mit | 4,483 |
from django.contrib import admin
from .models import JournalEntry
admin.site.register(JournalEntry)
| whiteisnick/nickpale | journal/admin.py | Python | mit | 103 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-08-16 11:31
from __future__ import unicode_literals
from django.db import migrations, models
import pages.models
class Migration(migrations.Migration):
dependencies = [
('pages', '0014_auto_20170504_0944'),
]
operations = [
migr... | fidals/refarm-site | pages/migrations/0015_add_validation_to_template.py | Python | mit | 1,455 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import logging
from quant.observers.basicbot import BasicBot
class T_Example(BasicBot):
"""
python -m quant.cli -mBitfinex_BCH_USD,Liqui_BCC_BTC,Bitfinex_BTC_USD -oT_Example -f=example -d
"""
def __init__(self):
super(T_Example, self).__init__()... | doubleDragon/QuantBot | quant/observers/t_example.py | Python | mit | 394 |
import os
import struct
import numpy as np
"""
Loosely inspired by http://abel.ee.ucla.edu/cvxopt/_downloads/mnist.py
which is GPL licensed.
"""
def read(dataset = "training", path = "."):
"""
Python function for importing the MNIST data set. It returns an iterator
of 2-tuples with the first element bein... | ghost9023/DeepLearningPythonStudy | DeepLearning/DeepLearning/09_Deep_SongJW/garbageCan/mnist.py | Python | mit | 1,690 |
# Unicorns
'''Deterministic Push Down Automaton helpers.
This module implements helper functions to allow producing deterministic
representation of arbitrarily chained props.
'''
from functools import reduce, partial
def zero_break(stack):
'''Handle Resets in input stack.
Breaks the input stack if a Reset operat... | prashnts/hues | hues/dpda.py | Python | mit | 1,434 |
from __future__ import absolute_import
import os
# Use Agg if no DISPLAY is available
DISPLAY = os.environ.get('DISPLAY')
if DISPLAY is None or DISPLAY.startswith('localhost'):
import matplotlib
matplotlib.use('Agg')
###########
# CONSTANTS
###########
# Where are VPHAS reduced images and calibration frames... | barentsen/surveytools | surveytools/__init__.py | Python | mit | 1,400 |
from ._compat import filename_to_ui
from ._compat import get_text_stderr
from .utils import echo
def _join_param_hints(param_hint):
if isinstance(param_hint, (tuple, list)):
return " / ".join(repr(x) for x in param_hint)
return param_hint
class ClickException(Exception):
"""An exception that Cli... | rochacbruno/dynaconf | dynaconf/vendor_src/click/exceptions.py | Python | mit | 7,572 |
# -*- coding:utf-8 -*- #
#!/usr/bin/env python3
from urllib import request, parse
import gzip
UA = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/43.0.2357.81 Chrome/43.0.2357.81 Safari/537.36'
mycookie = '__cfduid=d153c0bc92db181d19b6b324c3f4608011444920557; u2=5459a00bae846ee... | vcnovember/sspanel_autosign | sspanel_autosign.py | Python | mit | 1,380 |
#!/usr/bin/python
# MIT License
#
# Copyright (c) [2016] [Okan Ulas Gezeroglu]
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... | okanulas/Pathfind3r | python/svg_parser.py | Python | mit | 2,766 |
from smartfile import BasicClient
import zlib
api = BasicClient('VATx6OASrU4KYLaWshrxIvyyYUIl8x','xkpKJ3Wti1cXilKJYnMSqaOLvmNnwe')
f = api.get('/path/data/', 'TemplateEmailTable.txt')
decompString = zlib.decompress(f.data, 16+zlib.MAX_WBITS)
print decompString | sanderej/bakeoff | smartfiletext.py | Python | mit | 264 |
#!/usr/bin/env python3
'''
lib/subl/settings.py
Plugin settings class.
Wraps the settings `dict` and exposes them as attributes on the class. Default
settings will be calculated for missing/blank settings if possible.
This is also meant to abstract the setting key names, so there aren't as many
hard-coded strings in... | sublime-ycmd/sublime-ycmd | lib/subl/settings.py | Python | mit | 23,132 |