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 |
|---|---|---|---|---|---|
"""
Helper file to manage translations for the Meerkat Authentication module.
We have two types of translations, general and implementation specific
The general translations are extracted from the python, jijna2 and js files.
"""
from csv import DictReader
import argparse
import os
import shutil
import datetime
f... | meerkat-code/meerkat_auth | translate.py | Python | mit | 1,780 |
import requests
from backend.util.response.error import ErrorSchema
def test_order(domain_url, auth_session, es_create, willorders_ws_db_session):
prod_list = es_create("products", 2)
item_id = prod_list[0].meta["id"]
item_id2 = prod_list[1].meta["id"]
auth_session.post(
domain_url + "/api/c... | willrp/willbuyer | backend/tests/functional/api/cart/test_order.py | Python | mit | 1,226 |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 2 12:17:42 2016
@author: ibackus
"""
import numpy as np
from scipy.interpolate import interp1d
from scipy.integrate import cumtrapz
def _hexline(nx, firstSpacing=1):
"""
"""
x = np.zeros(nx)
nx0 = int((nx + 1)/2)
nx1 = nx - nx0
x0 = 3 * np.arang... | ibackus/testdust | testdust/settling/ppdgrid.py | Python | mit | 5,659 |
from __future__ import division
import state
import time
import csv
import random
import sys
POPULATION_SIZE = 100
MAX_COLLISION = 28
VALID_ARGS = "emg"
class FitnessListener():
def __init__(self, qtd=0):
self._qtd = qtd
def log(self):
self._qtd += 1
def retrive_qtd(self):
ret... | miguelarauj1o/8-Queens | eightqueens/__main__.py | Python | mit | 6,082 |
from django.contrib import admin
from django.contrib.admin import SimpleListFilter
from django.utils.translation import ugettext_lazy as _
from services.models import Service, ServiceType, Alias
# See
# <http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_filter>
# for documen... | joneskoo/sikteeri | services/admin.py | Python | mit | 1,213 |
#!/usr/bin/env python3
# Copyright (c) 2016-2019 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 processing of feefilter messages."""
from decimal import Decimal
import time
from test_framework... | qtumproject/qtum | test/functional/p2p_feefilter.py | Python | mit | 4,085 |
from django.apps import AppConfig
class ScoreConfig(AppConfig):
name = 'score'
| huaiping/pandora | score/apps.py | Python | mit | 85 |
"""
Copyright (c) 2015 Alex Kramer <kramer.alex.kramer@gmail.com>
See the LICENSE.txt file at the top-level directory of this distribution.
This module implements JSON-serializable encrypted account storage.
"""
import re
import uuid
import crypto
class PassStore(dict):
"""
Base password store class. This... | kramer314/pass | pass_store.py | Python | mit | 6,139 |
import sublime, sublime_plugin
import urllib.request, webbrowser
class PostToDayOneCommand(sublime_plugin.TextCommand):
def run(self, edit):
selections = self.view.sel()
selection = self.view.substr(selections[0])
url = "dayone://post?entry=%s" % urllib.request.quote(selection)
f = webbrowser.open(url)
... | RichardHyde/SublimeText.Packages | postToDayone.py | Python | mit | 366 |
#encoding:utf-8
subreddit = 'haikuOS'
t_channel = '@r_haikuos'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| Fillll/reddit2telegram | reddit2telegram/channels/~inactive/r_haikuos/app.py | Python | mit | 137 |
# -*- coding: utf-8 -*-
import gxf
from gxf.formatting import Token, Formattable
@gxf.register()
class Registers(gxf.DataCommand):
'''
Shows registers.
'''
def setup(self, parser):
parser.add_argument("-m", "--mark", action='append', default=[],
help="Highlight s... | wapiflapi/gxf | gxf/extensions/registers.py | Python | mit | 1,628 |
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from optparse import make_option
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option(
'--user',
action='store',
default=None,
he... | 2gis/vmmaster-frontend | vmmaster_frontend/management/commands/add_superuser.py | Python | mit | 721 |
#pragma out
#pragma repy
if callfunc=='initialize':
print 'OK!'
| sburnett/seattle | repy/tests/ut_repytests_testinit.py | Python | mit | 67 |
"""Tests for distutils.command.build_py."""
import os
import sys
import StringIO
import unittest
from distutils.command.build_py import build_py
from distutils.core import Distribution
from distutils.errors import DistutilsFileError
from distutils.tests import support
class BuildPyTestCase(support.Te... | babyliynfg/cross | tools/project-creator/Python2.6.6/Lib/distutils/tests/test_build_py.py | Python | mit | 3,817 |
# Sample Python/Pygame Programs
# Simpson College Computer Science
# http://cs.simpson.edu
# Read in a file from disk and put it in an array.
file = open("example_sorted_names.txt")
name_list = []
for line in file:
line=line.strip()
name_list.append(line)
file.close()
# Linear search
i=0
while i < len(name_... | tapomayukh/projects_in_python | sandbox_tapo/src/refs/Python Examples_Pygame/Python Examples/searching_example.py | Python | mit | 1,029 |
import numpy as np
import quimb as qu
class NNI:
"""An simple interacting hamiltonian object used, for instance, in TEBD.
Once instantiated, the ``NNI`` hamiltonian can be called like ``H_nni()``
to get the default two-site term, or ``H_nni((i, j))`` to get the term
specific to sites ``i`` and ``j``.... | jcmgray/quijy | quimb/tensor/tensor_tebd.py | Python | mit | 20,340 |
#!/usr/bin/env python
#coding: UTF-8
#
# (c) 2014 Samuel Groß <dev@samuel-gross.de>
#
import os
import sys
import importlib
from time import sleep
try:
import concurrent.futures
except ImportError:
pass
#
# Functions
#
def warn(msg):
sys.stderr.write('WARNING: ' + msg + '\n')
def err(msg):
sys.stderr.... | saelo/sekretaer | sekretaer/core.py | Python | mit | 5,590 |
#!/usr/bin/env python3
import argparse
import sys
from signal import signal, SIGINT
import networkx as nx
signal(SIGINT, lambda signum, frame: sys.exit(1))
parser = argparse.ArgumentParser()
parser.add_argument('-k', nargs='?', type=int, default=2)
args = parser.parse_args()
lines = sys.stdin.read().splitlines()
... | dustalov/watset | impl/cpm/cpm.py | Python | mit | 575 |
"""
This is the Python implementation for the Java package "jdk.management.resource.internal", compiled by Pava.
"""
import pava
from pava import nan, inf
pava_classes = {}
pava.module(__name__)
import internal
| laffra/pava | pava/implementation/natives/jdk/management/resource/__init__.py | Python | mit | 215 |
from peewee import *
from playhouse.sqlite_ext import SqliteExtDatabase
db = SqliteExtDatabase('store/virus_manager.db',
threadlocals=True)
class BaseModel(Model):
class Meta:
database = db
class ManagedMachine(BaseModel):
image_name = TextField(unique=True)
reference_image = TextField()
... | nsgomez/vboxmanager | models.py | Python | mit | 539 |
import inspect
import os
import time
import sys
import numpy as np
import tensorflow as tf
import shutil
import data_engine
VGG_MEAN = [103.939, 116.779, 123.68]
image_height = 720
image_width = 960
feature_height = int(np.ceil(image_height / 16.))
feature_width = int(np.ceil(image_width / 16.))
class RPN:
def... | huangshiyu13/RPNplus | train.py | Python | mit | 12,215 |
from email import message_from_file
from pkg_resources import working_set as WS
import path
from pathlib import Path
from pkg_resources import *
from pkg_resources import DistInfoDistribution, Distribution
import distutils.dist
import pkg_resources
import dpath
import sys, os, re
from distutils.errors import *
from dis... | KGerring/RevealMe | data/tested.py | Python | mit | 6,442 |
__author__ = 'Reuven'
import sys
class GetInfo():
def __init__(self):
self.u_name = ""
self.age = ""
self.uid = ""
def get_name(self):
while self.u_name.isalpha() is False:
self.u_name = raw_input("Please enter your name:")[:20]
if self.u_name == "exit... | reuvenderay/PythonProjects | enterInfo.py | Python | mit | 1,339 |
import pyaudio
import collections
import threading
'''
ZombieComm radio server
'''
sound_frames = collections.deque()
def record():
global sound_frames
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 10000
p = pyaudio.PyAudio()
stream = p.open(format=FORMAT,
... | benjaminy/ZombieComm | server.py | Python | mit | 845 |
#!/usr/bin/python
## Author: akshat
## Date: Dec, 3,2016
# trains the model
from keras.models import model_from_json
import load_data
import numpy
import matplotlib.pyplot as plt
import time
# load json model
json_file = open('model.json', 'r')
loaded_model = json_file.read()
json_file.close()
model = model_from_json... | sumanth-nirmal/self-driving-car-predict-steering | model/scripts/train_left.py | Python | mit | 1,982 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11b1 on 2017-06-23 09:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gwasdb', '0006_auto_20170623_0933'),
]
operations = [
migrations.AddField(
... | 1001genomes/AraGWAS | aragwas_server/gwasdb/migrations/0007_study_n_hits_thr.py | Python | mit | 462 |
# -*- coding: utf-8 -*-
''' Small Dictionary '''
class SD:
def translate_in(language):
words = {}
words["English"] = "in"
words["Chinese"] = "在"
words["Dutch"] = "in"
words["French"] = "dans"
words["Italian"] = "nel"
words["Japanese"] = "に"
words["K... | mdmintz/SeleniumBase | seleniumbase/fixtures/words.py | Python | mit | 4,708 |
#! /usr/bin/env python
# Hi There!
# You may be wondering what this giant blob of binary data here is, you might
# even be worried that we're up to something nefarious (good for you for being
# paranoid!). This is a base64 encoding of a zip file, this zip file contains
# a fully functional basic pytest script.
#
# Pyt... | mmolero/pyqode.python | runtests.py | Python | mit | 236,912 |
# -*- coding: utf-8 -*-
from __future__ import division #division en flottants par défaut
# Preprocessing primitives
import os
import numpy as np
import octaveIO as oio
import subprocess as sp
from sklearn import mixture
import string
def gmm(x, nbG):
g=mixture.GMM(n_components=nbG)
g.fit(x)
return g
de... | tomsib2001/speaker-recognition | preprocess.py | Python | mit | 4,594 |
#!/usr/bin/env python3
#
# Copyright 2015 Signal Processing Devices Sweden AB. All rights reserved.
#
# Description: ADQ14 FWDAQ streaming example
# Documentation:
#
import numpy as np
import ctypes as ct
import matplotlib.pyplot as plt
import sys
import time
import os
sys.path.insert(1, os.path.dir... | thomasbarillot/DAQ | TOF/ADQAPI_python/FWDAQ/ADQ14_FWDAQ_streaming_example.py | Python | mit | 10,179 |
"""
Validate the dependencies are installed.
"""
from __future__ import print_function
__all__ = [
'installRequiredToolbox',
'downloadDependency',
'addExtensionPath',
'loadExtensions',
'installPackage',
'tokenRefresher',
'validateToken',
'checkInstall',
'updateToken',
'TokenErro... | aldmbmtl/FloatingTools | tools/utilities.py | Python | mit | 10,347 |
#!/bin/sh
''''exec python -- "$0" ${1+"$@"} # '''
from z3 import *
import json
import sys
import traceback
#################################################################################
# Complex numbers, see: http://leodemoura.github.io/blog/2013/01/26/complex.html
################################################... | generic-group-analyzer/gga | scripts/ggt_z3.py | Python | mit | 10,372 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# BeautifulTable documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 18 15:59:32 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in th... | pri22296/beautifultable | docs/conf.py | Python | mit | 5,447 |
#import binwalk.core.C
#import binwalk.core.plugin
#from binwalk.core.common import *
#class CompressdPlugin(binwalk.core.plugin.Plugin):
# '''
# Searches for and validates compress'd data.
# '''
#MODULES = []
#READ_SIZE = 64
#COMPRESS42 = "compress42"
#COMPRESS42_FUNCTIONS = [
# bin... | emprovements/binwalk | src/binwalk/plugins/compressd.py | Python | mit | 1,413 |
from ccswm.statApi.models import *
from rest_framework import serializers
class EpisodeSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Episode
fields = ('id', 'url', 'season', 'episodeNumber', 'location')
class StarterSerializer(serializers.HyperlinkedModelSerializer):
... | RussellRiesJr/CoupleComeStatWithMe | ccswm/statApi/serializers.py | Python | mit | 1,581 |
from django.db import models
from frequencia.core.basemodel import basemodel
class FeriadoCalendarioAcademico(basemodel):
nome = models.CharField('Nome', max_length=100)
data = models.DateField('Data')
def __str__(self):
return self.nome
class Meta:
verbose_name = 'Feriado'
verbose_name_plural = 'Feria... | bczmufrn/frequencia | frequencia/calendario/models.py | Python | mit | 326 |
"""
Admin classes for photo application
"""
from django.contrib import admin
from django.contrib.admin.filters import RelatedOnlyFieldListFilter
from photo.models import FilmFormat, Manufacturer, Film, Developer, FilmRoll, \
PhotoPaper, PhotoPaperFinish, Frame, Print, Enlarger
class FilmAdmin(admin.ModelAdmin):... | rjhelms/photo | src/photo/admin.py | Python | mit | 3,376 |
from math import floor
from pip._vendor.requests.packages.urllib3.connectionpool import xrange
__author__ = 'rene_'
v = []
aux = []
size = []
############################################################
####################### HeapSort #########################
#####################################################... | renestvs/data_structure_project | data_structure/first_bim/data_structures.py | Python | mit | 4,324 |
from SublimeLinter.lint import NodeLinter, util
class Coffeelint(NodeLinter):
regex = (
r'^<issue line="(?P<line>\d+)"\s*\r?\n'
r'\s*lineEnd="\d+"\s*\r?\n'
r'\s*reason="\[(?:(?P<error>error)|(?P<warning>warn))\]\s+'
r'(?:\[stdin\]:\d+:(?P<col>\d+):\s+error:\s+)?'
r'(?P<mess... | SublimeLinter/SublimeLinter-coffeelint | linter.py | Python | mit | 752 |
from boto.connection import AWSAuthConnection
import os
class ESConnection(AWSAuthConnection):
def __init__(self, region, **kwargs):
super(ESConnection, self).__init__(**kwargs)
self._set_auth_region_name(region)
self._set_auth_service_name("es")
def _required_auth_capability(self):
return ['hmac-v4']
if ... | histograph/aws | staging/scripts/register_staging.py | Python | mit | 947 |
count, index = int(input()), input().split().index('MARKS')
print('%.2f' % (sum([float(input().split()[index]) for _ in range(count)]) / count))
# from collections import namedtuple
# count, Student = int(input()), namedtuple('Student', input())
# students = (Student(*input().split()) for _ in range(count))
# print('%.... | FireClaw/HackerRank | Python/py-collections-namedtuple.py | Python | mit | 382 |
from unittest import TestCase
from webtest import TestApp
from nose.tools import * # noqa
from ..main import app
class TestAUser(TestCase):
def setUp(self):
self.app = TestApp(app)
def tearDown(self):
pass
def test_can_see_homepage(self):
# Goes to homepage
res = self.ap... | vfulco/killtheyak.github.io | killtheyak/test/webtest_tests.py | Python | mit | 1,409 |
from django.contrib.auth import views as auth_views
from django.conf.urls import url
from . import views
app_name = "accounts"
urlpatterns = [
url(r'^login/$', auth_views.login, {'template_name': 'accounts/signin.html'}, name='signin'),
url(r'^signup/', views.SignUpView.as_view(), name="signup"),
url(r'^l... | rodriguesrl/reddit-clone-udemy | accounts/urls.py | Python | mit | 366 |
from typing import List
class Solution:
def numSubarrayProductLessThanK(self, nums: List[int], k: int) -> int:
if k <= 0:
return 0
l, r, prod, ans = 0, 0, 1, 0
while r < len(nums):
prod *= nums[r]
while l <= r and prod >= k:
prod /= nums[... | l33tdaima/l33tdaima | p713m/subarray_product_less_than_k.py | Python | mit | 707 |
# Copyright 2016, Sjoerd de Vries
from ...exceptions import SilkSyntaxError
def macro_enum(name, content):
if name != "Enum":
return
c = content.strip()
lparen = c.find("(")
if lparen == -1:
raise SilkSyntaxError("'%s': missing ( in Enum" % content)
rparen = c.rfind(")")
if rpa... | sjdv1982/seamless | docs/archive/spyder-like-silk/typeparse/macros/enum.py | Python | mit | 520 |
# -*- coding: utf-8 -*-
#
# burrahobbit documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 4 14:01:59 2011.
#
# 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.
#
#... | segfaulthunter/burrahobbit | doc/source/conf.py | Python | mit | 6,329 |
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import division
from collections import defaultdict
from logging import getLogger, DEBUG
from six import with_metaclass, PY2
from .jnius import (
JavaClass, MetaJavaClass, JavaMethod, JavaStaticMethod,
JavaField, Ja... | kivy/pyjnius | jnius/reflect.py | Python | mit | 18,170 |
from qlearner import QLearner
import numpy as np
from collections import defaultdict
class QLearner3(QLearner):
'''
Implements a more intelligent Q-Learning Mechanism. Uses Logistic function for learning learn_rate
decay. Not that the parameters have been optimized using SpearMint.
'''
def __init__(self, es... | kandluis/machine-learning | prac4/practical4-code/qlearner3.py | Python | mit | 2,670 |
import sys
out = sys.stdout
class Colors:
def black (self, fmt='', *args): self('\x1b[1;30m'+fmt+'\x1b[0m', *args)
def red (self, fmt='', *args): self('\x1b[1;31m'+fmt+'\x1b[0m', *args)
def green (self, fmt='', *args): self('\x1b[1;32m'+fmt+'\x1b[0m', *args)
def yellow (self, fmt='', *args): sel... | moertle/pyaas | pyaas/io.py | Python | mit | 1,515 |
# coding: utf-8
import datetime
import pytz
from django.test import TestCase
from httpretty import HTTPretty
from api.pypi import PyPI
from api.travis import TravisCI
from api.github import Github
class APITestCase(TestCase):
def setUp(self):
HTTPretty.reset()
HTTPretty.enable()
def tearDown(... | futurecolors/gopython3 | gopython3/api/tests/test_unit.py | Python | mit | 7,904 |
from .clear import ClearInstruction
class Cld(ClearInstruction):
flag_name = 'd'
| Hexadorsimal/pynes | nes/processors/cpu/instructions/flags/cld.py | Python | mit | 87 |
# Copyright (c) 2019-2022, Manfred Moitzi
# License: MIT License
from typing import TYPE_CHECKING
import logging
from ezdxf.lldxf import validator
from ezdxf.lldxf.attributes import (
DXFAttr,
DXFAttributes,
DefSubclass,
XType,
RETURN_DEFAULT,
group_code_mapping,
)
from ezdxf.lldxf.const import... | mozman/ezdxf | src/ezdxf/entities/view.py | Python | mit | 5,728 |
from mio import runtime
from mio.utils import method
from mio.object import Object
from mio.lexer import encoding
from mio.core.message import Message
from mio.errors import AttributeError
class String(Object):
def __init__(self, value=u""):
super(String, self).__init__(value=value)
self.create_... | prologic/mio | mio/types/string.py | Python | mit | 3,962 |
# Copyright (C) 2013-2015 MetaMorph Software, Inc
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this data, including any software or models in source or binary
# form, as well as any drawings, specifications, and documentation
# (collectively "the Data"), to deal in the Data ... | pombredanne/metamorphosys-desktop | metamorphosys/META/src/CADAssembler/ExtractACM-XMLfromCreoModels/testExtractACM.py | Python | mit | 4,969 |
# This code is licensed under the MIT License (see LICENSE file for details)
import collections
import threading
import traceback
import zmq
from ..util import trie
class PropertyClient(threading.Thread):
"""A client for receiving property updates in a background thread.
The background thread is automaticall... | zplab/rpc-scope | scope/simple_rpc/property_client.py | Python | mit | 8,483 |
import sys
import math as ma
import numpy as np
params = ["$\\varepsilon_{sph}$ & ", "$q$ & ", "$\\varepsilon$ & ", "$\mu$ & ", "R & ", "$\\theta$ & ", "$\phi$ &", " $\sigma$ & ", "$\\varepsilon$ & ", "$\mu$ & ", "R & ", "$\\theta$ & ", "$\phi$ & ", "$\sigma$ & ", "$\\varepsilon$ & ", "$\mu$ & ", "R & ", "$\\theta$ & ... | weissj3/MWTools | Scripts/MakeNormalizedHistogram.py | Python | mit | 1,516 |
# encoding: utf-8
# FastCGI-to-WSGI bridge for files/pipes transport (not socket)
#
# Copyright (c) 2002, 2003, 2005, 2006 Allan Saddi <allan@saddi.com>
# Copyright (c) 2011 - 2013 Ruslan Keba <ruslan@helicontech.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modif... | alexsilva/helicon-zoofcgi | zoofcgi.py | Python | mit | 34,047 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | DailyActie/Surrogate-Model | 01-codes/tensorflow-master/tensorflow/python/framework/tensor_util_test.py | Python | mit | 16,873 |
# -*- coding: utf-8 -*-
import logging
import chwrapper
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
class CompaniesHouseClient():
def __init__(self):
self._ch = chwrapper.Search()
def get_company_data(self, k, v):
"""Search companies house for the data"""
... | nestauk/inet | inet/sources/companies_house.py | Python | mit | 1,473 |
# -*- coding: utf-8 -*-
{%- if cookiecutter.pyapp_type == "asyncio" -%}
{%- set async = "async" -%}
{%- set appmod = "nicfit.aio" -%}
{%- else -%}
{%- set async = "" -%}
{%- set appmod = "nicfit" -%}
{%- endif %}
from {{ appmod }} import Application
from nicfit.console import pout
from . import version
{{ async }} de... | nicfit/nicfit.py | cookiecutter/{{cookiecutter.project_name}}/{{cookiecutter.py_module}}/__main__.py | Python | mit | 614 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-web/azure/mgmt/web/models/proxy_only_resource.py | Python | mit | 1,493 |
# Evy - a concurrent networking library for Python
#
# Unless otherwise noted, the files in Evy are under the following MIT license:
#
# Copyright (c) 2012, Alvaro Saurin
# Copyright (c) 2008-2010, Eventlet Contributors (see AUTHORS)
# Copyright (c) 2007-2010, Linden Research, Inc.
# Copyright (c) 2005-2006, Bob Ippoli... | inercia/evy | evy/io/convenience.py | Python | mit | 5,059 |
import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="font", parent_name="box.hoverlabel", **kwargs):
super(FontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/box/hoverlabel/_font.py | Python | mit | 1,855 |
import flask_restful as restful
from sqlalchemy import and_, desc
from flask import request, session
from synchrony import app, db, log
from synchrony.models import Priv
from synchrony.controllers.auth import auth
from synchrony.controllers.utils import make_response
class PrivCollection(restful.Resource):
def get... | Psybernetics/Synchrony | synchrony/resources/privs.py | Python | mit | 871 |
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2016) 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 limi... | andreadean5/python-hpOneView | hpOneView/resources/servers/logical_enclosures.py | Python | mit | 9,117 |
#!/usr/bin/env python
import numpy as np
# matplotlib requires wxPython 2.8+
# set the wxPython version in lib\site-packages\wx.pth file
# or if you have wxversion installed un-comment the lines below
#import wxversion
#wxversion.ensureMinimal('2.8')
import wx
import matplotlib
matplotlib.interactive(False)
matplotli... | bundgus/python-playground | matplotlib-playground/examples/user_interfaces/fourier_demo_wx.py | Python | mit | 8,955 |
# Copyright (C) 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | samuelclay/NewsBlur | vendor/oauth2client/tools.py | Python | mit | 5,656 |
"""
Read & write Java .properties files
``javaproperties`` provides support for reading & writing Java ``.properties``
files (both the simple line-oriented format and XML) with a simple API based on
the ``json`` module — though, for recovering Java addicts, it also includes a
``Properties`` class intended to match the... | jwodder/javaproperties | src/javaproperties/__init__.py | Python | mit | 1,654 |
# The palindromic number 595 is interesting because it can be written
# as the sum of consecutive squares: 6^2 + 7^2 + 8^2 + 9^2 + 10^2 +
# 11^2 + 12^2.
# There are exactly eleven palindromes below one-thousand that can
# be written as consecutive square sums, and the sum of these palindromes
# is 4164. Note that 1 = ... | cloudzfy/euler | src/125.py | Python | mit | 555 |
from axiom.test.historic import stubloader
from xmantissa.webadmin import DeveloperApplication
from xmantissa.webapp import PrivateApplication
class DATestCase(stubloader.StubbedTest):
def testUpgrade(self):
"""
Ensure upgraded fields refer to correct items.
"""
self.assertEqual(sel... | twisted/mantissa | xmantissa/test/historic/test_developerapplication1to2.py | Python | mit | 449 |
"""
Copies the CFF charstrings and subrs from src to dst fonts.
"""
__help__ = """python copyCFFCharstrings.py -src <file1> -dst <file2>[,file3,...filen_n]
Copies the CFF charstrings and subrs from src to dst.
v1.002 Aug 27 2014
"""
import os
import sys
import traceback
from fontTools.ttLib import TTFont, getTableMo... | adobe-type-tools/python-scripts | vintage/copyCFFCharstrings.py | Python | mit | 5,593 |
# Easy to use system logging for Python's logging module.
#
# Author: Peter Odding <peter@peterodding.com>
# Last Change: December 10, 2020
# URL: https://coloredlogs.readthedocs.io
"""
Easy to use UNIX system logging for Python's :mod:`logging` module.
Admittedly system logging has little to do with colored terminal... | xolox/python-coloredlogs | coloredlogs/syslog.py | Python | mit | 11,849 |
from imbroglio import InnerDict
NULL = object()
class CustomDict(InnerDict):
def __repr__(self):
return type(self).__name__ + super().__repr__()
def copy(self):
return type(self)(*self.items())
class CollisionError(ValueError):
def __init__(self, key1, val1, key2, val2):
txt = ... | thegreathippo/crispy | crispy/customdicts.py | Python | mit | 2,133 |
import csv
import matplotlib.pyplot as plt
import datetime
bit_history=[]
with open('bitHistory.csv','r') as bit_history_file:
hist_reader=csv.reader(bit_history_file,delimiter=',')
for line in hist_reader:
bit_history.append({'unix_time':int(line[0]),'price':float(line[1]),'amount':float(line[2])})
day=86400/2
... | ianrust/coinbase_autotrader | historical_bittrader.py | Python | mit | 2,613 |
from django.urls import re_path
from systextil.views import apoio_index
from systextil.views.table import (
deposito,
colecao,
estagio,
periodo_confeccao,
unidade,
)
urlpatterns = [
re_path(r'^colecao/$', colecao.view, name='colecao'),
re_path(r'^deposito/$', deposito.deposito, name='de... | anselmobd/fo2 | src/systextil/urls/table.py | Python | mit | 540 |
from django.test import TestCase
from batch_apps.maintenance import (
get_sqlite_filesize,
strip_message_body,
vacuum_sqlite
)
from django_mailbox.models import Message
import os
import shutil
class SQLiteFileSizeTest(TestCase):
def test_sqlite_filesize_should_be_human_readable(self):
... | azam-a/batcher | batch_apps/tests/test_maintenance.py | Python | mit | 1,585 |
# -*- coding: utf-8 -*-
"""Create an application instance."""
from flask.helpers import get_debug_flag
from myflaskapp.app import create_app
from myflaskapp.settings import DevConfig, ProdConfig
CONFIG = DevConfig if get_debug_flag() else ProdConfig
app = create_app(CONFIG)
| terryjbates/test-driven-development-with-python | myflaskapp/autoapp.py | Python | mit | 278 |
#!/usr/bin/python3
"""Script to determine the Pywikibot version (tag, revision and date).
.. versionchanged:: 7.0
version script was moved to the framework scripts folder
"""
#
# (C) Pywikibot team, 2007-2021
#
# Distributed under the terms of the MIT license.
#
import codecs
import os
import sys
import pywikibot
... | wikimedia/pywikibot-core | pywikibot/scripts/version.py | Python | mit | 3,279 |
"""
Django settings for ltc_huobi project.
Generated by 'django-admin startproject' using Django 1.11.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import ... | yiplee/ltc-huobi | ltc_huobi/settings.py | Python | mit | 3,262 |
__author__ = 'tilmannbruckhaus'
from collections import defaultdict
class TenThousandFirstPrime:
# 10001st prime
# Problem 7
# By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
# What is the 10 001st prime number?
LIMIT = 1000000
TARGET = 10... | bruckhaus/challenges | python_challenges/project_euler/p007_ten_thousand_first_prime.py | Python | mit | 873 |
import unittest
import timeit
import itertools
import os
from scipy.io import loadmat
import numpy as np
from hmmlearn.hmm import GaussianHMM
import hmmlearn.fhmmc as fhmmc
from sklearn.mixture.gmm import log_multivariate_normal_density
from toolkit.hmm.impl_hmmlearn import SequentialGaussianFHMM
from toolkit.hmm.imp... | matthiasplappert/motion_classification | src/tests/test_fhmm.py | Python | mit | 9,592 |
import _plotly_utils.basevalidators
class XValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="x", parent_name="streamtube.starts", **kwargs):
super(XValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edi... | plotly/plotly.py | packages/python/plotly/plotly/validators/streamtube/starts/_x.py | Python | mit | 391 |
# Copyright (c) 2011 Nokia
#
# 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, distribute, s... | skyostil/tracy | src/generator/GeneratorTest.py | Python | mit | 4,736 |
from app.deck import Deck
class TestDeck:
"""Creating a standard 52 card deck by combining all the ranks and suits."""
def test_new_deck(self):
deck = Deck()
deck.create()
assert len(deck.cards) == 52
assert str(deck) == "2c 3c 4c 5c 6c 7c 8c 9c Tc Jc Qc Kc Ac 2d 3d 4d 5d 6d 7d... | jdcald13/Winning_Texas_Holdem_Strategy | tests/test_deck.py | Python | mit | 7,189 |
# 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/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2021_06_01_preview/aio/operations/_scope_maps_operations.py | Python | mit | 24,899 |
single_numeral_to_decimal_map = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000}
| uttamk/katas | roman_numerals/python/roman_numerals/__init__.py | Python | mit | 98 |
import six
from collections import defaultdict, OrderedDict
from lieu.coordinates import latlon_to_decimal
from lieu.encoding import safe_decode
class AddressComponents:
NAME = 'house'
HOUSE_NUMBER = 'house_number'
HOUSE_NUMBER_BASE = 'house_number_base'
STREET = 'road'
BUILDING = 'building'
F... | openvenues/lieu | lib/lieu/address.py | Python | mit | 8,181 |
from django.conf import settings
from django.conf.urls import url
from .views import get_summoner_v3, live_match, test_something, live_match_detail, FrontendAppView, ApiLiveMatch, ChampionInfoView
urlpatterns = [
url(r'^summoner/', get_summoner_v3, name='summoner_lookup'),
url(r'^live/$', live_match, name='liv... | belleandindygames/league | league/champ_chooser/urls.py | Python | mit | 756 |
from django.apps import AppConfig as OAppConfig
from proso.django.enrichment import register_object_type_enricher
class AppConfig(OAppConfig):
name = 'matmat'
def ready(self):
from matmat.prediction import enrich_mean_time
register_object_type_enricher(['question'], enrich_mean_time)
| adaptive-learning/matmat-web | matmat/apps.py | Python | mit | 313 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: shirui <shirui816@gmail.com>
import re
import warnings
import argparse
from scipy.constants import Boltzmann as KB
from scipy.constants import Avogadro as NA
import numpy as np
import pandas as pd
from argparse import RawTextHelpFormatter
from scipy.integrate impo... | Shirui816/UmbrellaIntegrate.py | ubint.py | Python | mit | 9,737 |
#!/usr/bin/python
import sys
import os
import re
sys.path.append('/home/al/sites')
os.environ['DJANGO_SETTINGS_MODULE'] = '__main__'
DEFAULT_CHARSET = "utf-8"
TEMPLATE_DEBUG = False
LANGUAGE_CODE = "en"
INSTALLED_APPS = (
'django.contrib.markup',
)
TEMPLATE_DIRS = (
'/home/al/sites/liquidx/templates',
... | imownbey/dygraphs | plotkit_v091/doc/generate.py | Python | mit | 867 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutTrueAndFalse(Koan):
def truth_value(self, condition):
if condition:
return 'true stuff'
else:
return 'false stuff'
def test_true_is_treated_as_true(self):
self.assertEqual('true... | jazzabeanie/python_koans | python2/koans/about_true_and_false.py | Python | mit | 1,579 |
from __future__ import unicode_literals
import sys
from pre_commit import color
from pre_commit import five
def get_hook_message(
start,
postfix='',
end_msg=None,
end_len=0,
end_color=None,
use_color=None,
cols=80,
):
"""Prints a message for running a hook... | philipgian/pre-commit | pre_commit/output.py | Python | mit | 2,217 |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def removeNthFromEnd(self, head: ListNode, n: int) -> ListNode:
dummy = ListNode(-1)
dummy.next = head
slow = fast = dummy
for _ in range(n +... | jiadaizhao/LeetCode | 0001-0100/0019-Remove Nth Node From End of List/0019-Remove Nth Node From End of List.py | Python | mit | 493 |
from gevent import monkey
from socketio.server import SocketIOServer
from socketio import socketio_manage
from flask import Flask, request, render_template, Response
from werkzeug.serving import run_with_reloader
from socketio.namespace import BaseNamespace
from debugger import SocketIODebugger
monkey.patch_all()
c... | aldanor/SocketIO-Flask-Debug | app.py | Python | mit | 1,749 |
import itertools
from math import sqrt
import os
import re
from warnings import warn
# Isotopic abundances from Meija J, Coplen T B, et al, "Isotopic compositions
# of the elements 2013 (IUPAC Technical Report)", Pure. Appl. Chem. 88 (3),
# pp. 293-306 (2013). The "representative isotopic abundance" values from
# col... | johnnyliu27/openmc | openmc/data/data.py | Python | mit | 15,739 |
# -*- coding: utf-8 -*-
"""Top-level package for tensor_network."""
__author__ = """Prithvi Nambiar"""
__email__ = 'prithvinambiar@gmail.com'
__version__ = '0.1.0'
| prithvinambiar/tensor_network | tensor_network/__init__.py | Python | mit | 166 |
import logging
import six
from django import forms
from django.conf import settings
from django.template import Context
from django.utils.translation import ugettext as _
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template, TemplateDoesNotExist
from mgsub.mailgun import... | codetry/mgsub | mgsub/forms.py | Python | mit | 2,627 |
class WordDictionary(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.root = {}
def addWord(self, word):
"""
Adds a word into the data structure.
:type word: str
:rtype: void
"""
node = self.root
... | ChuanleiGuo/AlgorithmsPlayground | LeetCodeSolutions/python/211_Add_and_Search_Word_Data_structure_design.py | Python | mit | 1,004 |
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 25 19:54:02 2017
@author: jonathan
"""
import os
from flask import Flask, request, Response
from slackclient import SlackClient
from twilio.twiml.messaging_response import MessagingResponse
from twilio.rest import Client
TWILIO_NUMBER = os.environ.get('TWILIO_NUMBER', No... | zzyyfff/doorbot | doorbot.py | Python | mit | 918 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.