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 unittest
from katas.kyu_6.compare_versions import compare_versions
class CompareVersionsTestCase(unittest.TestCase):
def test_true(self):
self.assertTrue(compare_versions('11', '10'))
def test_true_2(self):
self.assertTrue(compare_versions('11', '11'))
def test_true_3(self):
... | the-zebulan/CodeWars | tests/kyu_6_tests/test_compare_versions.py | Python | mit | 729 |
# Copyright (C) 2016 Fan Long, Martin Rianrd and MIT CSAIL
# Prophet
#
# This file is part of Prophet.
#
# Prophet is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at y... | jyi/ITSP | prophet-gpl/tools/php-build.py | Python | mit | 3,203 |
import os as _os
__version__='2.0.1'
__description__='General Purpose Radio Astronomy and Data Analysis Utilities'
__author__='Nithyanandan Thyagarajan'
__authoremail__='nithyanandan.t@gmail.com'
__maintainer__='Nithyanandan Thyagarajan'
__maintaineremail__='nithyanandan.t@gmail.com'
__url__='http://github.com/nithyan... | nithyanandan/general | astroutils/__init__.py | Python | mit | 473 |
from django.shortcuts import render_to_response
from django.template import RequestContext
import json
# Create your views here.
import importlib
from django.http import HttpResponse
from django_markup.markup import formatter
def build_doc(request):
try:
from project.settings import API_OBJECT_LOCATION
... | matheuscas/django-tastypie-simple-api-doc | tastypie_api_doc/views.py | Python | mit | 1,877 |
"""Maya initialisation for Mindbender pipeline"""
from maya import cmds
def setup():
assert __import__("pyblish_maya").is_setup(), (
"pyblish-mindbender depends on pyblish_maya which has not "
"yet been setup. Run pyblish_maya.setup()")
from pyblish import api
api.register_gui("pyblish_l... | pyblish/pyblish-mindbender | mindbender/maya/pythonpath/userSetup.py | Python | mit | 488 |
class Zvire(object):
def __init__(self,jmeno = "",druh = "",hmotnost =0):
self._jmeno = jmeno
self._druh = druh
self._hmotnost = hmotnost
@property
def jmeno(self):
return self._jmeno
@jmeno.setter
def jmeno(self,ajmeno):
self._jmeno = ajmeno
@proper... | xtompok/uvod-do-prg | cv10/cv10.py | Python | mit | 886 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# This file has been created by ARSF Data Analysis Node and
# is licensed under the MIT Licence. A copy of this
# licence is available to download with this file.
#
# Author: Robin Wilson
# Created: 2015-11-16
import sys
import numpy as np
import pandas as pd
# Python 2... | pmlrsg/PySpectra | PySpectra/dart.py | Python | mit | 2,368 |
#!/usr/bin/env python
""" It's a TradeBot """
import configparser
import curses
from httplib import HTTPException
import os
import signal
import socket
from ssl import SSLError
import sys
import time
from tradebot import TradeBot
def on_exit(sig, func=None):
curses.nocbreak()
stdscr.keypad(0)
curses.echo... | codemonkey2841/tradebot | run.py | Python | mit | 6,871 |
from unittest import TestCase
from intent.igt.rgxigt import RGIgt
class ConstructIGTTests(TestCase):
def setUp(self):
self.lines = [{'text':'This is a test','tag':'L'},
{'text':'blah blah blah blah','tag':'G'}]
def test_add_raw_lines(self):
inst = RGIgt(id='i1')
... | rgeorgi/intent | intent/tests/instance_construction_tests.py | Python | mit | 718 |
import logging
from subprocess import (
Popen,
PIPE,
call as subprocess_call
)
from collections import defaultdict
from past.builtins import basestring
from pyramid.response import Response
from pyramid.view import view_config
from xml.sax.saxutils import quoteattr, escape
from snovault import TYPES
log ... | ENCODE-DCC/snovault | src/snovault/schema_graph.py | Python | mit | 3,775 |
import collections
from supriya import CalculationRate
from supriya.ugens.UGen import UGen
class FBSineL(UGen):
"""
A linear-interpolating feedback sine with chaotic phase indexing.
::
>>> fbsine_l = supriya.ugens.FBSineL.ar(
... a=1.1,
... c=0.5,
... fb=0.1,... | Pulgama/supriya | supriya/ugens/FBSineL.py | Python | mit | 887 |
"""
WSGI config for 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MOD... | pannkotsky/groupmate | backend/wsgi.py | Python | mit | 384 |
import unittest
from unittest import TestCase
from array import array as array_
from genty import genty, genty_dataset
import numpy as np
from auditok import signal as signal_
from auditok import signal_numpy
@genty
class TestSignal(TestCase):
def setUp(self):
self.data = b"012345679ABC"
self.nump... | amsehili/auditok | tests/test_signal.py | Python | mit | 6,986 |
import django_filters
from dal import autocomplete
from .models import Alert
class AlertFilter(django_filters.FilterSet):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.filters["reason"].lookup_expr = "icontains"
self.filters["author"].widget = autocomplete.Mo... | watchdogpolska/feder | feder/alerts/filters.py | Python | mit | 466 |
from __future__ import print_function
import sys
import time
import threading
import Pyro4.naming
import Pyro4.core
if sys.version_info < (3, 0):
current_thread = threading.currentThread
else:
current_thread = threading.current_thread
stop = False
def myThread(nsproxy, proxy):
global stop
name = cu... | irmen/Pyro4 | examples/proxysharing/client.py | Python | mit | 3,104 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/data/battle/battle_action_type.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from go... | bellowsj/aiopogo | aiopogo/pogoprotos/data/battle/battle_action_type_pb2.py | Python | mit | 3,507 |
#!/usr/bin/env python
"""
TimerBot can manage multiple stopwatch-style timers from Slack.
Usage:
timerbot [--start_fmt=<start_fmt>] [--stop_fmt=<stop_fmt>] <slack_token>
timerbot --help
Options:
--start_fmt=<start_fmt> Format string for start responses (given a datetime) [default: {}]
--stop_fmt=<stop_fmt>... | venmo/slouch | example.py | Python | mit | 2,870 |
#!/home/jt/code/armyguys/venv/bin/python3.4
# $Id: rst2xetex.py 7038 2011-05-19 09:12:02Z milde $
# Author: Guenter Milde
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing XeLaTeX source code.
"""
try:
import locale
locale.setlocale(lo... | jtpaasch/armyguys | venv/bin/rst2xetex.py | Python | mit | 811 |
from typing import List
class Solution:
def singleNumber(self, nums: List[int]) -> int:
seen_once = seen_twice = 0
for n in nums:
seen_once = ~seen_twice & (seen_once^n)
seen_twice = ~seen_once & (seen_twice^n)
# print(seen_once, seen_twice)
return seen_once
... | daicang/Leetcode-solutions | 137-single-number-ii.py | Python | mit | 413 |
from app.notify_client import _attach_current_user, NotifyAdminAPIClient
from app.notify_client.models import InvitedUser
class InviteApiClient(NotifyAdminAPIClient):
def __init__(self):
super().__init__("a" * 73, "b")
def init_app(self, app):
self.base_url = app.config['API_HOST_NAME']
... | gov-cjwaszczuk/notifications-admin | app/notify_client/invite_api_client.py | Python | mit | 2,123 |
from __future__ import print_function, absolute_import, unicode_literals
# Kivy
from kivy.clock import Clock
from kivy.uix.boxlayout import BoxLayout
class ScreenManager(BoxLayout):
"""
Class that handles toggling between windows. So that's managing
the loading screen, game screen, victory screen, high s... | kostyll/kivy-okapi | okapi/screen_manager.py | Python | mit | 5,182 |
import os
import sublime
from sublime_plugin import WindowCommand, TextCommand
from ..commands import *
from ...common import ui
from ..git_command import GitCommand
from ...common import util
class GsShowStatusCommand(WindowCommand, GitCommand):
"""
Open a status view for the active git repository.
""... | stoivo/GitSavvy | core/interfaces/status.py | Python | mit | 26,371 |
import numpy as np
import cPickle as pickle
from sklearn.svm import LinearSVC
import gp
from full_marginal import compute_means_covs
from fastfood import FastfoodEGK
def main():
np.random.seed(111)
with open('data/ECG200-50.pkl', 'rb') as f:
ts_train, ts_test, l_train, l_test = pickle.load(f)
# E... | mlds-lab/egk | demo.py | Python | mit | 1,643 |
""":mod:`kinsumer.checkpointer` --- Persisting positions for Kinesis shards
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import abc
import json
import os.path
from typing import Optional, Dict
class Checkpointer(abc.ABC, object):
"""Checkpointer is the interface for persisting ... | balancehero/kinsumer | kinsumer/checkpointer.py | Python | mit | 1,882 |
import hail as hl
from hail.typecheck import typecheck_method
from hail.expr.expressions import unify_types, unify_types_limited, expr_any, \
expr_bool, ExpressionException, construct_expr, expr_str
from hail import ir
class ConditionalBuilder(object):
def __init__(self):
self._ret_type = None
... | cseed/hail | hail/python/hail/expr/builders.py | Python | mit | 9,202 |
# -*- coding: utf-8 -*-
class Condition(object):
operator = ''
def __init__(self, operator):
super(Condition, self).__init__()
self.operator = operator
def equal(self, value1, value2):
return (str(value1) == str(value2))
def nequal(self, value1, value2):
return (str(... | OpenSpaceProgram/pyOSP | library/components/Condition.py | Python | mit | 917 |
from django import forms
from django.core.mail import send_mail
from css.models import CUser, Room, Course, SectionType, Schedule, Section, Availability, FacultyCoursePreferences
from django.http import HttpResponseRedirect
from settings import DEPARTMENT_SETTINGS, HOSTNAME
import re
from django.forms import ModelChoic... | makennajohnstone/CSS | css/forms.py | Python | mit | 11,524 |
""" Global configurations
"""
import datetime
USER = 'user'
WIT_AI_KEY = 'your wit key'
BIRTH = datetime.datetime(2016, 6, 22, 12, 0, 0)
LANGUAGE_UNICODE = 'es'
LANGUAGE = 'Es-es'
RECORD_DURATION = 0
| stsewd/hellopy | hellopy/config.py | Python | mit | 201 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""JabberHooky"""
__name__ = "jabberhooky"
__author__ = 'Shane R. Spencer'
__email__ = "shane@bogomip.com"
__license__ = 'MIT'
__copyright__ = '2012 Shane R. Spencer'
__version__ = '0.0.1'
__status__ = "Prototype"
| whardier/jabberhooky | jabberhooky/__init__.py | Python | mit | 263 |
"""
Classes for representing solutions to boundary value problems.
@author : davidrpugh
"""
class SolutionLike(object):
@property
def basis_kwargs(self):
return self._basis_kwargs
@property
def functions(self):
return self._functions
@property
def nodes(self):
retu... | davidrpugh/pyCollocation | pycollocation/solvers/solutions.py | Python | mit | 1,746 |
import ui
import misc
import monster_template
class Location(object):
def __init__(self, level, x=0, y=0, move_pts=0):
self.level = level
self.x = x
self.y = y
self.move_pts = move_pts
class Monster(object):
def __init__(self, tmpl):
if isinstance(tmpl, str):
tmpl = monster_template.db[t... | gnar/pyhack | monster.py | Python | mit | 1,815 |
import datetime
import logging
from decimal import Decimal
from django.db import transaction
from django.http import HttpResponse
from openpyxl import Workbook
from openpyxl.utils import get_column_letter
from openpyxl.styles import Font
from .models import Transaction, LineItem, Layout, PosPayment, Item, Location, TWO... | ianastewart/cwltc-admin | pos/services.py | Python | mit | 8,750 |
"""
Provides a more structured call to the nodejs bing
"""
import os
import sys
import argparse
import subprocess
def main():
parser = argparse.ArgumentParser(description="Use Bing's API services")
parser.add_argument("query", nargs="*", help="Query string")
parser.add_argument("-s", "--service", default... | AAorris/search | src/bing/runtime.py | Python | mit | 523 |
import collections
class Command:
def __init__(self, template):
self._values = template
def __getitem__(self, key):
value = self._values[key]
if isinstance(value, dict) or isinstance(value, list):
return Command(value)
return self._values[key]
def __setitem__(s... | Fakor/congov | cli/lib/command.py | Python | mit | 530 |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import logging
import os
import shutil
import sys
import tempfile
_SRC_DIR = os.path.abspath(os.path.join(
os.path.dirname(__file__), '..', ... | junhuac/MQUIC | src/tools/android/loading/sandwich_runner.py | Python | mit | 9,553 |
# Keras code for confocal laser scanner microscopy skin lesion classification.
# M.D. Bloice,
# Inst. for Medical Informatics,
# Medical University Graz.
# <marcus.bloice@medunigraz.at>
# Portions of code from the Keras GitHub repository.
# https://github.com/fchollet/keras
'''
Train a Convolutional Neural Networ... | mdbloice/CLSM-classification | TrainNetwork.py | Python | mit | 7,030 |
#!/usr/bin/python
#
# This tool exploits the data of csv files produced by script collect-ce-job-status.py,
# to compute the running ratio R/(R+W) for each CE, as a function of time.
#
# Results are stored in files named results/CE/<CE queue>.csv.
import sys
import os
import csv
from operator import itemgetter, attrg... | frmichel/vo-support-tools | CE/monitor-ce/processors/running_ratio_per_ce.py | Python | mit | 3,434 |
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(
name='PyDL7',
version='0.0.3',
description='Python API for parsing DAN Dive Log files.',
long_description=readme(),
author='Simon Johnston',
author_email='johnstonskj@gmail.com',
do... | johnstonskj/PyDL7 | setup.py | Python | mit | 915 |
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
"""
Basic typography rules
Most regular expressions inspired by
`texytypo.py <https://gist.github.com/msgre/3805872>`, which is Python port
of typography rules from `Texy! <https://github.com/dg/texy/>`_ project.
"""
import re
__all__ = ('base_repl... | honzajavorek/tipi | tipi/langs/base.py | Python | mit | 2,966 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import re
import json
PHPHEAD = re.compile(r'<\?php.+?/\*.+?\*/', re.DOTALL)
VARS = re.compile(r'public static \$(\w+?) = \[\s+(.+?)\s+\];', re.DOTALL)
def convert(phpfile):
f = PHPHEAD.sub('', phpfile)
matches = VARS.findall(f)
zhcdict = {}
fo... | gumblex/zhconv | convmwdict.py | Python | mit | 1,082 |
#!/usr/bin/env python
import unittest
from flask_babel_test import app
class FlaskBabelTestTest(unittest.TestCase):
def test(self):
rv = app.test_client().get()
assert 'Hello' in str(rv.data)
def test_pl(self):
with app.test_request_context():
app.config['BABEL_DEFAULT_LOC... | loomchild/flask_babel_test | flask_babel_test_test.py | Python | mit | 591 |
# -*- coding: utf-8 -*-
from wtforms import Form, PasswordField, StringField, validators
class PasswordLoginForm(Form):
email = StringField('Email', [validators.Email])
password = PasswordField('Password', [validators.Length(min=4)])
class ForgotPasswordForm(Form):
email = StringField('Email', [valida... | masom/doorbot-api-python | doorbot/views/dashboard/forms/login.py | Python | mit | 333 |
# import logging
from ast.visit import visit as v
from ast.node import Node
from ast.body.methoddeclaration import MethodDeclaration
from ast.stmt.minrepeatstmt import MinrepeatStmt
class Desugar(object):
def __init__(self):
self._cur_mtd = None
@v.on("node")
def visit(self, node):
"""... | plum-umd/java-sketch | java_sk/rewrite/desugar.py | Python | mit | 1,242 |
import time
from mako import lookup
from mako.cache import CacheImpl
from mako.cache import register_plugin
from mako.lookup import TemplateLookup
from mako.template import Template
from mako.testing.assertions import eq_
from mako.testing.config import config
from mako.testing.exclusions import requires_beaker
from m... | sqlalchemy/mako | test/test_cache.py | Python | mit | 18,519 |
#!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import time
'''... | AdnCoin/AdnCoin | qa/rpc-tests/maxuploadtarget.py | Python | mit | 10,732 |
# All the code samples below have one parameter, which is where the protection level name
# for that storage type will be inserted, e.g. NSDataWritingFileProtectionCompleteUnlessOpen
CODE_SAMPLE_CORE_DATA = """
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
if (persistentStoreCoordinator_ != nil) {
... | erikr/howtostoreiosdata | howtostoreiosdata/wizard/code_samples.py | Python | mit | 1,995 |
# adpated from http://docs.scipy.org/doc/scipy-0.15.1/reference/generated/scipy.signal.correlate2d.html
import superimport
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal
from scipy import misc
print("cross correlation demo")
face = misc.face() - misc.face().mean()
face = face.sum(-1)
tem... | probml/pyprobml | scripts/xcorr_demo.py | Python | mit | 1,136 |
"""
WSGI config for starthilfe 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... | rhokhh/starthilfe | starthilfe/wsgi.py | Python | mit | 397 |
"""
Module that checks if the current directory
is a git repository or is within one
"""
import sys
import subprocess
from sub_proc import _check_output
try:
_check_output(['git', '-C', '.', 'rev-parse'])
remotes = _check_output(['git', 'remote', '-v'])
if sys.argv[1] in remotes:
print("True")
... | NOhs/git_info | git_info/check_in_git_repository.py | Python | mit | 407 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 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.
from __future__ import unicode_literals
from flask import session
from indico.core import signals
from i... | mic4ael/indico | indico/modules/groups/__init__.py | Python | mit | 889 |
"""
Custom management command to rebuild thumbnail images
- May be required after importing a new dataset, for example
"""
import os
import logging
from PIL import UnidentifiedImageError
from django.core.management.base import BaseCommand
from django.conf import settings
from django.db.utils import OperationalError... | inventree/InvenTree | InvenTree/InvenTree/management/commands/rebuild_thumbnails.py | Python | mit | 1,919 |
"""
WSGI config for songdump_django 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", "songdump_django.settings")
fr... | bkbolte181/SongDump | songdump_django/songdump_django/wsgi.py | Python | mit | 405 |
from jsonschema import validate
import jsonschema, sys
user_schema = {
"type": "object",
"properties": {
"email": {"type": "string", "pattern": "(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"},
"password": {"type": "string", "minLength": 6, "maxLength": 30},
},
"required": ["email"... | angelbarrera92/simple-python-load-balancer | loadbalancer/validator.py | Python | mit | 1,735 |
#!/usr/bin/env python
import sys
sys.dont_write_bytecode = True
import glob
import re
import yaml
import json
import os
import sys
import time
import logging
import requests
import platform
import imp
from argparse import ArgumentParser
from slackclient import SlackClient
def dbg(debug_string):
if debug:
... | zbeaver4/python-webpage-monitor-slackbot | rtmbot.py | Python | mit | 7,767 |
from pytest import fixture
from eio_userdb.main import app
from eio_userdb.model import init_db
@fixture
def client():
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite://'
app.config['TESTING'] = True
client = app.test_client()
init_db()
return client
| konstantint/eio-userdb | tests/conftest.py | Python | mit | 273 |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^grappelli/', include('grappelli.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^$', '{{ project_name }}.views.main', ... | pinkevich/django-project-template | project_name/urls.py | Python | mit | 743 |
from __future__ import print_function
from __future__ import unicode_literals
import time
import re
from netmiko.cisco_base_connection import CiscoSSHConnection
from netmiko import log
class HuaweiSSH(CiscoSSHConnection):
def session_preparation(self):
"""Prepare the session after the connection has been... | isidroamv/netmiko | netmiko/huawei/huawei_ssh.py | Python | mit | 2,964 |
"""
Basic pulsar-related functions and statistics.
"""
from __future__ import division, print_function, absolute_import
import numpy as np
import collections
from ..utils import simon, jit
from scipy.optimize import minimize, basinhopping, curve_fit
def _default_value_if_no_key(dictionary, key, default):
try:
... | dhuppenkothen/stingray | stingray/pulse/pulsar.py | Python | mit | 16,714 |
from node.dictionary import Dictionary
from nodes import Node
class Ord(Node):
char = ".o"
args = 1
results = 1
def ord(self, string: str):
"""ord(string)"""
try:
return ord(string)
except TypeError:
return [[ord(i)for i in string]]
def lookup(self... | muddyfish/PYKE | node/ord.py | Python | mit | 408 |
# ElasticQuery
# File: setup.py
# Desc: needed
from setuptools import setup
if __name__ == '__main__':
setup(
version='3.2',
name='ElasticQuery',
description='A simple query builder for Elasticsearch 2',
author='Nick Barrett',
author_email='pointlessrambler@gmail.com',
... | Fizzadar/ElasticQuery | setup.py | Python | mit | 554 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^editar/(?P<idTrabajador>\d+)$', views.editar_perfil, name='editar'),
url(r'^login$', views.login),
url(r'^register', views.register),
url(r'^logout$', views.logout),
url(r'^trabaj... | NazlyOlmos/TDD-KATA02 | polls/urls.py | Python | mit | 733 |
#-*- coding: UTF-8 -*-
from django.http import HttpResponseRedirect
from django.contrib.auth import logout as auth_logout
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
from django.shortcuts import render_to_response, redirect
from django.contrib.messages.api impo... | eduherraiz/foowill | app/views.py | Python | mit | 10,083 |
# 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 ... | Azure/azure-sdk-for-python | sdk/graphrbac/azure-graphrbac/azure/graphrbac/models/check_group_membership_result_py3.py | Python | mit | 1,366 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: booopooob@gmail.com
#
# Info:
#
#
#
import abc
from util import FixedDict
class PacketHeader(FixedDict, metaclass=abc.ABCMeta):
@abc.abstractmethod
def to_bytes(self):
pass
@abc.abstractmethod
def from_bytes(self, data):
pass
| FTwO-O/pyShadowsocks | pyshadowsocks/packet/packet_header.py | Python | mit | 320 |
# coding: utf-8
from deploy import app
if __name__ == '__main__':
app.run(debug = True) | TL4/deploy | run.py | Python | mit | 92 |
#coding: utf-8
import requests as req
from conf import *
import logging
import re
from datetime import datetime
class Api(object):
def get_promoted(self, page=1):
promoted = self._get('links/promoted', api_params = self._build_api_params({'page': page}))
self._clear_promoted(promoted)
retu... | yakxxx/memek | crawler/api_client.py | Python | mit | 2,755 |
# 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.
from indico.modules.events.models.events import EventType
from indico.web.flask.templating import get_temp... | indico/indico | indico/modules/events/reminders/util.py | Python | mit | 1,052 |
from collections import namedtuple
class HitsChecker:
REJECTED = -1
AMBIGUOUS = -2
CIGAR_GOOD = 0
CIGAR_LESS_GOOD = 1
CIGAR_FAIL = 2
CIGAR_OP_MATCH = 0 # From pysam
CIGAR_OP_REF_INSERTION = 1 # From pysam
CIGAR_OP_REF_DELETION = 2 # From pysam
CIGAR_OP_REF_SKIP = 3 # From pys... | statbio/Sargasso | sargasso/filter/hits_checker.py | Python | mit | 8,017 |
# -*- coding: utf-8 -*-
import sys
import os
import pandas as pd
import h5py
from .download import maybe_download
from .download import get_data_dir
def load_baldi2016_train_no_pile():
"""
Loads data from the baldi2016 dataset, and downloads it if necessary.
Return
------
X, y : as Dataframe, ... | victor-estrade/datawarehouse | datawarehouse/baldi2016.py | Python | mit | 2,192 |
# -*- coding: utf-8 -*-
import json
from flask import jsonify
from flask import render_template, request, url_for, redirect
import time, random
#------------------------------------------------------------------------------
def get_desktop_items_data():
"""
Returns items for Desktop in JSON array:
title
... | vsergeyev/os2online | desktop/desktop_items.py | Python | mit | 3,022 |
SECRET_KEY = 'you-will-never-guess'
MONGO_DB = 'flask_test'
| jeor0980/TeamChampion | hatServer/config.py | Python | mit | 60 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 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.
from collections import defaultdict
from operator import attrgetter
from flask import render_template, se... | ThiefMaster/indico | indico/modules/events/timetable/util.py | Python | mit | 16,943 |
#==============================================================================
#
# Author: Miles Currie
# Created: 06/21/2016
#
# Cleaned up a little
#
#
#==============================================================================
import numpy as np
import matplotlib.pyplot as plt
import dave.fileio.mastio as m... | barentsen/dave | milesplay/fitData.py | Python | mit | 20,751 |
#!/usr/bin/python
import highspeedmovieanalysis
import imageTools
import sys
pixThreshold = 0.005 # enter pixel threshold here
frameRate = 285 # enter frameRate here (usually 30 fps)
videoStream = imageTools.getVideoStream(sys.argv)
#vidInfo = deltaPix.cmdLine(pixThreshold,frameRate,videoStream)
#vidInfo = deltaPix_u... | sthyme/ZFSchizophrenia | BehaviorAnalysis/HSMovieAnalysis/pyTrack_usingprevmask_updated.py | Python | mit | 448 |
from glob import glob
import pylab as pyl
import h5py as hdf
files = glob('ML_predicted_masses*')
# get the power law masses
with hdf.File('../results_cluster.hdf5', 'r') as f:
dset = f[f.keys()[0]]
results = dset.value
# make a figure
f = pyl.figure(figsize=(6, 6 * (pyl.sqrt(5.) - 1.0) / 2.0))
ax = f.add_su... | boada/vpCluster | data/boada/analysis_all/MLmethods/plot_massComparison_scatter.py | Python | mit | 1,151 |
# Encoding: UTF-8
"""Czech conjugation
"""
from spline.i18n.formatter import Formatter, BaseWord, parse_bool
class Word(BaseWord):
@classmethod
def guess_type(cls, word, **props):
if word.endswith(u'í'):
return SoftAdjective
elif word.endswith(u'ý'):
return HardAdjecti... | veekun/spline | spline/i18n/cs/__init__.py | Python | mit | 2,365 |
from django.db import models
from django.utils import timezone
# Create your models here.
def formatDateTime(dateTime):
return timezone.localtime(dateTime).strftime("%Y-%m-%d %H:%M:%S")
class Beacon(models.Model):
macAddr = models.CharField(max_length=20, unique=True)
uuid = models.UUIDField(editable=... | SmartcitySantiagoChile/onlineGPS | beacon/models.py | Python | mit | 2,058 |
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 5 14:44:52 2014
@author: nick
Pyserial interface for communicating with mini usb Analog IO board
Usage: Send plaintext commands, separated by newline/cr or semicolon.
An eventual reply comes terminated with cr+lf.
Important commands:
*IDN? Returns device i... | CQTools/analogIO-miniUSB | analogIO.py | Python | mit | 2,908 |
from abstract_servo import AbstractServo
from PID import PID
class PitchServo(AbstractServo):
def __init__(self):
self.pid = PID()
self.pid.setSetPoint(0)
def refresh(self, WantedAngle, CurrentAngle):
AngleCorrection = (WantedAngle - CurrentAngle)
AngleCorrection = -AngleCorr... | Dronolab/antenna-tracking | pitch_servo.py | Python | mit | 713 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from GestureAgents.Recognizer import Recognizer, newHypothesis
from GestureAgents.Agent import Agent
import math
from GestureAgentsTUIO.Gestures2D.RecognizerTap import RecognizerTap
def build_and_register_TT(RTKlass=RecognizerTap):
class RecognizerTT_Test(Recognizer... | chaosct/GestureAgents | Apps/TestComposition/RecognizerTT_Test.py | Python | mit | 3,983 |
"""Support for HomeKit Controller locks."""
from __future__ import annotations
from typing import Any
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import Service, ServicesTypes
from homeassistant.components.lock import STATE_JAMMED, LockEntity
from homeassistant.co... | rohitranjan1991/home-assistant | homeassistant/components/homekit_controller/lock.py | Python | mit | 4,317 |
from unittest import TestCase
from mock import MagicMock
from django_auth_lti.verification import is_allowed
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
class TestVerification(TestCase):
def test_is_allowed_config_failure(self):
request = MagicMock(LTI={})
allowed... | UQ-UQx/PerspectivesX | perspectivesx_project/django_auth_lti/tests/test_verification.py | Python | mit | 1,706 |
"""Various Python classes"""
__author__ = 'Cyril Grima'
import numpy as np
from . import roughness, surface, utils
NAN = float('nan')
class Signal(object):
"""Signal relationships"""
def __init__(self, wf=NAN, bw=NAN, th=0., bmw=NAN, h=NAN, **kwargs):
self.wf = wf # Signal central frequency [Hz]
... | cgrima/subradar | subradar/Classdef.py | Python | mit | 2,462 |
import time
import numpy as np
import cPickle as pk
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.widgets import Slider
import mpl_toolkits.mplot3d.axes3d as p3
from matplotlib.widgets import Button
class PlotAnimation:
"""
Takes a list of PySnap and launch an intera... | dorvaljulien/StarFiddle | anim_plot.py | Python | mit | 1,736 |
from .careful import *
from .noisy import *
from . import streams
from . import resetable
from lasagne.updates import * | maxim-borisyak/craynn | craynn/updates/__init__.py | Python | mit | 121 |
from .specs import SPEC_BY_TYPE, make_msgdict
def msg2str(msg, include_time=True):
type_ = msg['type']
spec = SPEC_BY_TYPE[type_]
words = [type_]
for name in spec['value_names']:
value = msg[name]
if name == 'data':
value = '({})'.format(','.join(str(byte) for byte in va... | olemb/mido | mido/messages/strings.py | Python | mit | 1,606 |
#!/usr/bin/env python
"""Docstring."""
from collections import Counter
from functools import reduce
from common import (
get_input,
)
class RoomAnalyzer:
"""."""
def __init__(self, input_list=[]):
"""."""
self.input_list = input_list
def process_room_string(self, room_string):
... | tlake/advent-of-code | 2016/day04_security_through_obscurity/python/src/part1.py | Python | mit | 1,245 |
__author__ = 'croxis'
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'stuff lumps pumps in pajamas'
CSRF_ENABLED = True
OPENID_PROVIDERS = [
{'name': 'Google', 'url': 'https://www.google.com/accounts/o8/id'},
{'name... | croxis/kmr | config.py | Python | mit | 1,101 |
# -*- coding: utf-8 -*-
from kivy.lang import Builder
from kivy.uix.widget import Widget
from kivy.properties import NumericProperty, ListProperty, BooleanProperty
from kivy.animation import Animation
from kivymd.theming import ThemableBehavior
Builder.load_string('''
<MDSpinner>:
canvas.before:
PushMatri... | cruor99/KivyMD | kivymd/spinner.py | Python | mit | 4,907 |
from __future__ import print_function
import fuse
import stat
import errno
import os
import sys
from wellpapp import Client, Tag, raw_exts
import re
from time import time, sleep
from hashlib import md5
from struct import pack, unpack
from zlib import crc32
from xml.sax.saxutils import escape as xmlescape
from os.path ... | drougge/wellpapp-pyclient | wellpapp/shell/fusefs.py | Python | mit | 14,933 |
"""
Auxiliar functions
------------------
Collection of main auxiliar functions.
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import unicodedata
########################### Administrative functions ##########################
#############################################... | tgquintela/pyDataProcesser | pyDataProcesser/aux_functions.py | Python | mit | 13,382 |
import numpy as np
import pytest
from mathpy.numerical.roots import newtonraph, bisection, secant
class TestRoots:
@staticmethod
def _test_func1(x):
return x ** 2 - 10
@staticmethod
def _test_func2(x):
return x ** 3 - 2 * x - 5
@staticmethod
def _test_func3(x... | aschleg/mathpy | mathpy/numerical/tests/test_roots.py | Python | mit | 1,494 |
# -*- coding: utf-8 -*-
"""Raw transforms between coordinate frames, as NumPy matrices."""
from numpy import array
from .constants import ANGVEL, ASEC2RAD, DAY_S, tau
from .data.spice import inertial_frames as _inertial_frames
from .functions import mxm, rot_x, rot_z
def build_matrix():
# 'xi0', 'eta0', and 'da0'... | skyfielders/python-skyfield | skyfield/framelib.py | Python | mit | 5,257 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "shows.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| browning/shows | shows/manage.py | Python | mit | 254 |
#!/usr/bin/env python3
"""
>>> baralho = Baralho()
>>> len(baralho)
52
>>> baralho[0]
Carta(valor='2', naipe='paus')
>>> baralho[-1]
Carta(valor='A', naipe='espadas')
>>> from random import choice
>>> choice(baralho) #doctest:+SKIP
Carta(valor='4', naipe='paus')
... | pythonprobr/notmagic | pt-br/baralho_mut.py | Python | mit | 4,149 |
from setuptools import setup
from ast import literal_eval
def get_version(source='xpclr/__init__.py'):
with open(source) as sf:
for line in sf:
if line.startswith('__version__'):
return literal_eval(line.split('=')[-1].lstrip())
raise ValueError("__version__ not found")
VE... | hardingnj/xpclr | setup.py | Python | mit | 1,538 |
from lavendeux import Types, Errors
from socket import getfqdn, setdefaulttimeout
def call(args):
# Check number of arguments
if len(args) != 1:
return (Types.ERROR, Errors.INVALID_ARGS)
setdefaulttimeout(0.5)
try:
return (Types.STRING, getfqdn(args[0]))
except socket.gaierror:
return (Types.ST... | rscarson/Lavendeux | bin/extensions/hostname.py | Python | mit | 433 |
""" Module summary:
Variables:
db_session - A connection to the farmfinder database.
"""
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from dbsetup import Base
############################################################################
# Connect to database and create database ses... | courtneypattison/second-response | secondresponse/database/dbconnect.py | Python | mit | 483 |
'''
To run these tests you need to create a test database, instructions
are inside the README.md
'''
import customers
from customers.utils import db
import unittest
import json
import base64
class CustomersTestCase(unittest.TestCase):
'''
Test the customers application
'''
EMAIL = 'test@test.org'
... | hnb2/flask-customers | tests/test_customers.py | Python | mit | 8,076 |
# Generated by Django 2.1 on 2018-08-28 05:10
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Leg',
fields=[
('id', models.AutoField(auto_c... | ktarrant/options_csv | journal/trades/migrations/0001_initial.py | Python | mit | 1,392 |