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
import sys
sys.path.append('./')
solutions = __import__('solutions.168_excel_sheet_column_title', fromlist='*')
class Test(unittest.TestCase):
def test_convertToTitle(self):
s = solutions.Solution()
self.assertEqual(s.convertToTitle(1), "A")
self.assertEqual(s.convertToTi... | abawchen/leetcode | tests/168.py | Python | mit | 1,045 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test case for github oauth remote app."""
from collections import namedtuple
imp... | inveniosoftware/invenio-oauthclient | tests/test_contrib_github.py | Python | mit | 12,909 |
def burn():
pass
class Toaster(object):
@classmethod
def burn(cls):
return True
print 'In a.py:', burn
print 'In a.py, Toaster:', Toaster
print 'In a.py, Toaster.burn:', Toaster.burn
| charlax/python-education | where-to-mock/a.py | Python | mit | 207 |
#!/usr/bin/env python
import os
import numpy
import math
import sys
def readMatrixMarket(pathToMatrix):
matrixFile = open(pathToMatrix)
if (not matrixFile.readline().startswith('%%MatrixMarket matrix array real general')):
print('Wrong matrix market format in file {}.'.format(pathToMatrix))
exit(1)
dim... | uphoffc/LinA | preprocessing/matricesToCode.py | Python | mit | 2,572 |
__all__ = ['PositionComponent', 'RenderComponent', 'LevelInfoComponent',
'MoveComponent', 'PhysicsComponent', 'LightComponent',
'StateComponent', 'IntermitentComponent', 'TextComponent',
'MenuButtonComponent', 'OnPressComponent', 'DirectionComponent',
'PathComponent']
from .... | GMadorell/Shades | Code/Pieces/Components/__init__.py | Python | mit | 920 |
from datetime import datetime
from email.mime.multipart import MIMEMultipart
import os
from tests import BaseTestClasses
class Direct_Arguments(BaseTestClasses.Email2PDFTestCase):
def setUp(self):
super(Direct_Arguments, self).setUp()
self.msg = MIMEMultipart()
def test_no_body(self):
... | gpgmailencrypt/email2pdf | tests/Direct/test_Direct_Arguments.py | Python | mit | 7,491 |
# ------------------------
#
# Test CSV->Object Mapping
# Base Function
#
# ------------------------
import unittest
from csvmapper import CSVObject
class ObjectTest(unittest.TestCase):
def setUp(self):
d = { 'name' : 'john', 'age': 14, 'primes':[2, 3, 5, 7, 11]}
self.object = CSVObject(d)
def testObject(self)... | samarjeet27/CSV-Mapper | tests/test_object.py | Python | mit | 451 |
from pybloom import ScalableBloomFilter
class StockTileExclusions(object):
"""
Object that keeps track of which stock tiles have already been used.
"""
def __init__(self, source_image):
self.source_image = source_image
self.bloom_filter = ScalableBloomFilter(
initial_capaci... | pipermerriam/mozy | mozy/apps/mosaic/exclusions.py | Python | mit | 1,124 |
from Common.utils import *
import sublime
import sublime_plugin
class TestConnectionCommand(sublime_plugin.WindowCommand):
def run(self):
working_dir = self.window.folders()[0]
settings = load_settings(working_dir)
if settings is not False:
response = get_list(settings, "sys_pr... | salcosta/servicenow-sync | Commands/test_connection.py | Python | mit | 609 |
# %codegen(cl_gen)
import generate_opencl_structs
def main():
cfg_defd = [
{
'type': 'float',
'length': 1,
'name': 'nu',
'default': 0.8
},
{
'type': 'float',
'length': 1,
'name': 'dt_sec',
'def... | jpanikulam/experiments | gpgpu/generators/fluid_defs.py | Python | mit | 1,051 |
#!/usr/bin/env python
# prepare for i18n
def _(value) :
return value
| gissehel/cltools | cltools/i18n.py | Python | mit | 75 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This software is licensed as described in the README.rst and LICENSE
# files, which you should have received as part of this distribution.
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
# noinspection PyPep8Na... | ricco386/trader-bot | setup.py | Python | mit | 1,547 |
from django.shortcuts import render
from django.utils.encoding import force_text
from django.utils.safestring import mark_safe
from django.views.generic import View, FormView, TemplateView
from Main.models import Category, Article, Comment
import copy;
from Main.forms import WriteForm, CommentForm
from datetime import ... | Lobo-Prix/Blog | Blog/Main/views.py | Python | mit | 3,868 |
class StateT:
pass
__all__ = ('StateT',)
| tek/amino | amino/state/base.py | Python | mit | 46 |
from unittest.mock import patch
import pytest
from model.agents.student.activities import IdleActivity, StudySessionActivity
__author__ = 'e.kolpakov'
class TestIdleActivity:
@pytest.mark.parametrize("length", [10, 15, 20, 3, 7, 11])
def test_activate_sends(self, student, env, length):
activity = ... | e-kolpakov/study-model | tests/agents/student/test_activities.py | Python | mit | 722 |
import os
from argparse import ArgumentParser
class ArgumentException(Exception):
pass
class Args:
def __init__(self):
parser = ArgumentParser(usage="usage: %(prog)s [arguments]")
parser.add_argument("--version", action="version", version="%(prog)s 1.0")
parser.add_argument("--scan",... | dypa/photoSortPy | args.py | Python | mit | 1,462 |
from api_reader_daemon import APIReaderDaemon
from models import RSSFeed, RSSEntry
import time
import datetime
import feedparser
class RSSReaderDaemon(APIReaderDaemon):
def __init__(self, **kwargs):
# we're just accessing content over the public web
# we don't need anything special.
pass
... | ndm25/notifyable | src/api_readers/rss_reader.py | Python | mit | 2,532 |
"""
py2app/py2exe build script for MyApplication.
Will automatically ensure that all build prerequisites are available
via ez_setup
Usage (Mac OS X):
python setup.py py2app
Usage (Windows):
python setup.py py2exe
"""
import ez_setup
ez_setup.use_setuptools()
import sys
from setuptools import setup
impor... | angusmacdonald/gopro-organizer | setup.py | Python | mit | 1,722 |
#!/usr/bin/env python
'''
@author: Graham Rockwell
@organization: Church Lab
Updated 20130131
Set of functions for manipulating linear optimization models of metabolic networks
'''
from core.model.LinearModel import LinearModel
from core.model.LPSolver import LPSolver
from numpy import array
import re, operator, pickl... | bionomicron/Redirector | core/model/LinearModelTools.py | Python | mit | 16,347 |
from __future__ import print_function, division
import numpy as np
from mlfromscratch.utils import calculate_covariance_matrix, normalize, standardize
class LDA():
"""The Linear Discriminant Analysis classifier, also known as Fisher's linear discriminant.
Can besides from classification also be used to reduce ... | eriklindernoren/ML-From-Scratch | mlfromscratch/supervised_learning/linear_discriminant_analysis.py | Python | mit | 1,395 |
from numpy import cos, sin, pi, absolute, arange
from scipy.signal import kaiserord, lfilter, firwin, freqz
from pylab import figure, clf, plot, xlabel, ylabel, xlim, ylim, title, grid, axes, show
#------------------------------------------------
# Create a signal for demonstration.
#--------------------------------... | jrahlf/3D-Non-Contact-Laser-Profilometer | xpcc/examples/lpcxpresso/lpc11c24/breakout_board/design/filter_design.py | Python | mit | 2,847 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from conf.dbconfig import TB_APITRACE
from core import dbmysql
from core.err_code import SEGMENT_NOT_EXIST, OCT_SUCCESS, err_desc_ch
from core.log import ERROR, WARNING
from models.Api import Api, API_STATE_NEW, API_STATE_FINISHED
from utils.commonUtil import CRC32
from models... | maqg/wcrobot | tornado/modules/api/api.py | Python | mit | 3,713 |
from django.conf.urls.defaults import *
from opstel.models import Category
urlpatterns = patterns('',
(r'^$', 'django.views.generic.list_detail.object_list', {'queryset':Category.objects.all() }, 'opstel_category_list'),
(r'^(?P<slug>[-\w]+)/$', 'opstel.views.category_detail', {}, 'opstel_category_detail'),
) | davogler/venus | opstel/urls/categories.py | Python | mit | 314 |
import bz2
print bz2.decompress('BZh91AY&SYA\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x02\x00 \x00!\x9ah3M\x07<]\xc9\x14\xe1BA\x06\xbe\x084')
print bz2.decompress('BZh91AY&SY\x94$|\x0e\x00\x00\x00\x81\x00\x03$ \x00!\x9ah3M\x13<]\xc9\x14\xe1BBP\x91\xf08')
| tdl/python-challenge | l8_bz2.py | Python | mit | 253 |
#-*- coding: utf-8 -*-
import unittest, time, os, re, codecs, sys, imp, errno
import native_manager, webview_manager, command
import code
from time import sleep
from appium import webdriver
from terminaltables import AsciiTable
from bs4 import BeautifulSoup
# monkey patching prettify
_stdin_encoding = sys.stdin.encod... | embian-inc/Appium-Python-Console | app/command_runner.py | Python | mit | 8,783 |
# -*- coding: utf-8 -*-
""" S3XML Toolkit
@see: U{B{I{S3XRC}} <http://eden.sahanafoundation.org/wiki/S3XRC>}
@requires: U{B{I{gluon}} <http://web2py.com>}
@requires: U{B{I{lxml}} <http://codespeak.net/lxml>}
@copyright: 2009-2012 (c) Sahana Software Foundation
@license: MIT
Permission is he... | smeissner/eden | modules/s3/s3xml.py | Python | mit | 69,334 |
"""
=============================================
Feature Union with Heterogeneous Data Sources
=============================================
Datasets can often contain components of that require different feature
extraction and processing pipelines. This scenario might occur when:
1. Your dataset consists of hetero... | samouri/kinja-api | Machine Learning/hetero_feature_union.py | Python | mit | 6,288 |
# import the basic python packages we need
import os
import sys
import tempfile
import pprint
import traceback
# disable python from generating a .pyc file
sys.dont_write_bytecode = True
# change me to the path of pytan if this script is not running from EXAMPLES/PYTAN_API
pytan_loc = "~/gh/pytan"
pytan_static_path =... | tanium/pytan | BUILD/doc/source/examples/pytan_api_basic_handler_example_code.py | Python | mit | 1,928 |
from numpy.linalg import norm
from math import sin, cos, asin, acos, atan2, pi, degrees
class Finesse:
@staticmethod
def forward_pack(lengths, angles):
"""
Computes the forward kinematics for the legs of DOG.
:param lengths: An array of lengths (l1, l2).
:param angles: An array... | bobbyluig/Eclipse | src/finesse/eclipse.py | Python | mit | 2,564 |
from abc import ABCMeta, abstractmethod
import MySQLdb
class DbConnector:
def __init__(self):
""" DBใฎใณใใฏใทใงใณใ็ๆ """
# ๆฅ็ถใใ
self.con = MySQLdb.connect(
user='root',
passwd='systena!',
host='localhost',
db='web_crawler')
d... | AISystena/web_crawler | lib/db_manager/db_committer/DbCommitter.py | Python | mit | 2,339 |
"""
WSGI config for celery_demo 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "celery_demo.settings")
from djang... | pynoco/celery-talk | celery_demo/celery_demo/wsgi.py | Python | mit | 397 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import serialize
from twilio.base import values
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import L... | tysonholub/twilio-python | twilio/rest/notify/v1/service/notification.py | Python | mit | 11,796 |
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage, Page, InvalidPage
from django.http import Http404
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from django.views.generic import ListView
class EndlessPaginator(Paginator):
@cache... | ultmaster/eoj3 | utils/pagination.py | Python | mit | 2,495 |
from gbf_bot.casino import Poker
class TestPoker:
def test_play(self):
# two pair
poker = Poker()
poker.new_game(("S2", "D2", "H3", "C3", "C5"))
poker.calculate()
assert poker.hold_cards_index == [0, 1, 2, 3]
# 3 kind
poker.new_game(("S2", "D2", "H2", "D4", ... | mythnc/gbf-bot | tests/test_casino.py | Python | mit | 6,074 |
#!/usr/bin/env python
import json
from functools import wraps
from django.http import HttpResponse
# From djangosnippets.org
def render_to_json(**jsonargs):
"""
Renders a JSON response with a given returned instance. Assumes json.dumps() can
handle the result. The default output uses an indent of 4.
... | myrjola/neverlate | django/neverlate/utils.py | Python | mit | 973 |
__author__ = 'jbowman'
print('Hello World!')
print('This is a Python program.')
| deo1/deo1 | Legacy/PythonTutorial/01HelloWorld.py | Python | mit | 81 |
from sendgrid import SendGridClient
from sendgrid import Mail
from markdown import markdown
from datetime import date
from dateutil.relativedelta import relativedelta
from secret_keys import SENDGRID_USER, SENDGRID_PASSWORD
from models import Show, User
ROOT_URL = 'nyc-jazz.appspot.com'
def show_to_markdown(show):... | adamreis/nyc-jazz | src/application/email_stuff.py | Python | mit | 3,434 |
from zoodb import *
from debug import *
import time
import auth_client
def transfer(sender, recipient, zoobars, token):
if not auth_client.check_token(sender, token):
raise RuntimeError()
bankdb = bank_setup()
senderp = bankdb.query(Bank).get(sender)
recipientp = bankdb.query(Bank).get(recipie... | wujiahong/CSS-lab4 | zoobar/bank.py | Python | mit | 1,805 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2012 Martin Hammerschmied
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 wit... | kolomanschaft/updatejunkie | observer.py | Python | mit | 4,425 |
from operator import add
foo = lambda b : 2 * b
print map(foo, range(1, 3))
print filter(lambda x: x % 2 == 0, range(1, 10))
print reduce(add, range(1, 4)) | deyuwang/pisio | test/lambda.py | Python | mit | 157 |
from __future__ import absolute_import
import os
import sys
import errno
import signal
import numbers
import inspect
import subprocess
import cPickle as pickle
import idiokit
from . import bot, config, utils
def iter_startups(iterable):
for obj in iterable:
startup = getattr(obj, "__startup__", None)
... | abusesa/abusehelper | abusehelper/core/startup.py | Python | mit | 12,035 |
import numpy as np
import scipy as sp
import openpnm as op
class GenericNetworkTest:
def setup_class(self):
self.net = op.network.Cubic(shape=[10, 10, 10])
def teardown_class(self):
ws = op.Workspace()
ws.clear()
def test_find_connected_pores_numeric_not_flattend(self):
a... | TomTranter/OpenPNM | tests/unit/network/GenericNetworkTest.py | Python | mit | 7,510 |
"""
Helper functions for offlineimap
"""
import locale
import re
import subprocess
encoding = locale.getdefaultlocale()[1]
gtrans = [("[Gmail]/Drafts","Drafts"),
("[Gmail]/Sent Mail","Sent Mail"),
("[Gmail]/Spam","Spam"),
("[Gmail]/Trash","Trash")]
def get_password(name):
""" Impor... | l3enny/dotfiles | bin/bin/offlineimap.py | Python | mit | 834 |
__all__ = ['base_utils', 'maya_utils']
#import base_utils
#import maya_utils
| AndresMWeber/komodo | rigger/rig_lib/core/core_utils/__init__.py | Python | mit | 78 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def HostWwnChangedEvent(vim, *args, **kwargs):
'''This event records a change in a host's... | xuru/pyvisdk | pyvisdk/do/host_wwn_changed_event.py | Python | mit | 1,226 |
############################################################################
# Original work Copyright 2018 Palantir Technologies, Inc. #
# Original work licensed under the MIT License. #
# See ThirdPartyNotices.txt in the project root for license information. #
# All modifi... | glenngillen/dotfiles | .vscode/extensions/ms-python.python-2021.5.842923320/pythonFiles/lib/jedilsp/pygls/exceptions.py | Python | mit | 5,391 |
from cms.toolbar_base import CMSToolbar
from cms.toolbar_pool import toolbar_pool
@toolbar_pool.register
class CascadeClipboardToolbar(CMSToolbar):
class Media:
css = {
'all': ['cascade/css/admin/clipboard.css']
}
| jrief/djangocms-cascade | cmsplugin_cascade/clipboard/cms_toolbars.py | Python | mit | 248 |
import unittest
import pickle
import sys
from os import path
#sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) ) )
from dataset import datawasher as dw
class TestDataWasher(unittest.TestCase):
def setUp(self):
self.dw_active_users = "./fakedataset/dw_active_users.mat"
if path.isfile("./fak... | lux-jwang/goodoos | test/test_datawasher.py | Python | mit | 2,600 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/profile/__init__.py | Python | mit | 6,039 |
# -*- coding: utf-8 -*-
from tests.wot import WotTestCase
class WOTTanksTestCase(WotTestCase):
def setUp(self):
super(WOTTanksTestCase, self).setUp()
self.account_id = 1000000000
def test_stats(self):
self.assertValidResponse(self.api.tanks.stats, account_id=self.account_id)
de... | therocode/python-wargaming | tests/wot/tanks.py | Python | mit | 437 |
from rest_framework import serializers
from qmpy.materials.structure import Structure
class StructureSerializer(serializers.ModelSerializer):
class Meta:
model = Structure
fields = ("spacegroup", "x1", "x2", "x3", "y1", "y2", "y3")
| wolverton-research-group/qmpy | qmpy/web/serializers/structure.py | Python | mit | 254 |
"""Continuous deployment script for DXR
Glossary
========
build directory - A folder, typically in the ``builds`` folder, containing
these folders...
dxr - A checkout of the DXR source code
virtualenv - A virtualenv with DXR and its dependencies installed
Builds are named after an excerpt of their git h... | gartung/dxr | dxr/cli/deploy.py | Python | mit | 15,233 |
# 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/cognitiveservices/azure-cognitiveservices-search-visualsearch/azure/cognitiveservices/search/visualsearch/models/image_tag_region.py | Python | mit | 1,659 |
from django.db import models
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from autoslug import AutoSlugField
class PlaceModel(models.Model):
"""
An abstract model for common place fields
"""
created_on = models.DateTimeField(_("Created on"), au... | moshthepitt/shulezote | places/models.py | Python | mit | 4,282 |
from __future__ import absolute_import, division, print_function
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from functools import partial
import hashlib
import logging
from operator import itemgetter
import os
import os.path as path
import tarfile
import tempfile
impor... | trec-kba/streamcorpus-pipeline | streamcorpus_pipeline/tests/test_s3_storage.py | Python | mit | 15,146 |
from os.path import isfile
from pandas import read_csv
from .establish_path import establish_path
from .make_file_name_from_str import make_file_name_from_str
from .make_match_panel import make_match_panel
def make_match_panels(
target_x_sample,
data_dicts,
drop_negative_target=False,
directory_path... | UCSD-CCAL/ccal | ccal/make_match_panels.py | Python | mit | 2,350 |
# Maintains a list in sorted order without having to call sort each time an item is added to the list. The bisect module implements an algorithm for inserting elements into a list while maintaining the list in sorted order.
import bisect
# A series of random numbers
values = [14, 85, 77, 26, 50, 45, 66, 79, 10, 3, 84,... | quchunguang/test | testpy3/testinsertordered.py | Python | mit | 516 |
# -*- coding: utf-8 -*-
"""----------------------------------------------------------------------------
Author:
Huang Quanyong (wo1fSea)
quanyongh@foxmail.com
Date:
2016/10/19
Description:
Packer.py
----------------------------------------------------------------------------"""
from .MaxRectsBinPacker.... | newnon/PyTexturePacker | PyTexturePacker/Packer.py | Python | mit | 522 |
#!/usr/bin/env python3
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Versions.
django_ver = "1.8"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Requirements.
req_base_fn = "base.txt"
req_base = """
... | nazariyg/InstaDjango | InstaDjango.py | Python | mit | 29,511 |
from django import forms
from ckeditor.widgets import CKEditorWidget
from ckeditor.fields import RichTextField
from .functions import generatePassword
from django.core.validators import validate_email
class NachrichtForm(forms.Form):
Betreff = forms.CharField(widget=forms.TextInput( attrs={'size':'60'}), label='Be... | Payamg690/txtcensoring | secureMail/forms.py | Python | mit | 822 |
# coding: utf-8
#!/usr/bin/env python
#python ใฎใใผใธใงใณๆๅฎ๏ผpython 3.5.0
#ใฆใผใถใผใฎๅ
ฅๅใใๆฅไปใ็ฒๅพใใใใญใฐใฉใ
import re
import datetime
def get_day(text,today):
#datetimeใฎๅผใณๅบใ
#today = datetime.date.today()
#one_day = datetime.timedelta(days=1)
#two_day = datetime.timedelta(days=2)
#ใไปๆฅ|ๆฌๆฅ|ใใใใใใซๅๅฟใใฆๆฅไปใๅพใ
day_today = re.search... | BlueHoleUEC/BlueHoleUEC | get_day_time.py | Python | mit | 1,910 |
# !/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
ERP+
"""
__author__ = 'Antรณnio Anacleto'
__credits__ = []
__version__ = "1.0"
__maintainer__ = "Antรณnio Anacleto"
__status__ = "Development"
__model_name__ = 'xml_linha_anexo_salario_dpr.XMLLinhaAnexoSalarioDPR'
import auth, base_models
from orm import *
from form i... | IdeaSolutionsOnline/ERP4R | core/objs/xml_linha_anexo_salario_dpr.py | Python | mit | 2,400 |
# 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_02_01/operations/_express_route_ports_locations_operations.py | Python | mit | 7,987 |
import sys
import os
# from casa_tools import myclean
from tasks import clean, feather, rmtables
'''
Cleans an MS with a single channel given a mask and a model.
This is the template file. There are too many variables to easily generalize.
'''
vis = sys.argv[-3]
model = sys.argv[-2]
mask = sys.argv[-1]
if model ... | e-koch/VLA_Lband | channel_imaging/single_channel_clean_template.py | Python | mit | 1,936 |
from tkinter import *
import random
from tkinter import font
import PIL
from PIL import Image, ImageOps
from PIL import ImageTk
from PIL import *
import math
import numpy as np
import pickle
import copy
import time
from sklearn import *
####################################
# Helper Functions
#######################... | cinnamonli/15-112-Term-Project | Doodlebug.py | Python | mit | 56,290 |
"""
WSGI config for idc 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_... | noracami/curly-guacamole | idc/idc/wsgi.py | Python | mit | 383 |
# Python script for additional style validation
# Author: Rintze M. Zelle
# Version: 2011-07-28
# * Requires lxml library (http://lxml.de/)
# Checks
# - whether ".csl" files conform to naming scheme [a-z0-9] with optional single
# hyphen delimiters
# - whether style ID (content of cs:id) exists and matches the URI ge... | citation-style-language/utilities | csl-quality-control.py | Python | mit | 8,876 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2017-01-25 13:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('product', '0011_auto_20170125_1255'),
]
operations = [
migrations.RemoveFiel... | skylifewww/pangolin-fog | product/migrations/0012_auto_20170125_1306.py | Python | mit | 731 |
import _plotly_utils.basevalidators
class ArraysrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="arraysrc", parent_name="bar.error_x", **kwargs):
super(ArraysrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/bar/error_x/_arraysrc.py | Python | mit | 400 |
# -*- coding: utf-8 -*-
"""
Resource Import Tools
@author: Graeme Foster <graeme[at]acm.org>
@author: Dominic Kรถnig <dominic[at]aidiq.com>
@copyright: 2011 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this so... | flavour/porto | modules/s3/s3import.py | Python | mit | 120,042 |
from bitcoin.main import *
from bitcoin.transaction import *
from bitcoin.bci import *
from bitcoin.deterministic import *
# Takes privkey, address, value (satoshis), fee (satoshis)
def send(frm, to, value, fee=1000):
tovalues = to + ":" + value
return sendmultitx(frm, tovalue, fee)
# Takes privkey, "addres... | CoinBlack/pyblackcointools | bitcoin/composite.py | Python | mit | 2,678 |
"""
styles.py
"""
#TODO: Special casing for Style 136? or maybe just roll into styles.csv?
import collections
Style = collections.namedtuple('Style', 'number name category')
from . import table_util
from .. import util
class _StyleLookup(object):
@util.lazy_property
def numbers(self):
return table... | hschh86/usersong-extractor | commons/messages/styles.py | Python | mit | 916 |
#!/usr/bin/env python3
import tkinter
import time
from gifplayer import GIFPlayer
from functools import partial as bind
from tkinter import filedialog, colorchooser
try:
import winsound
except:
winsound = None
class ELTimer:
player_win = None
wav_file = None
font_color = "#ffffff"
current_time = 1800
start_ti... | ShaBren/eltool | timer.py | Python | mit | 3,212 |
# 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/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2022_01_01/aio/operations/_private_endpoint_connections_operations.py | Python | mit | 15,308 |
import unittest
from surfaceimagecontentgap.bot import SurfaceContentGapBot
class TestBot(unittest.TestCase):
def test_login_fail(self):
bot = SurfaceContentGapBot()
with self.assertRaises(ValueError):
bot.login()
if __name__ == '__main__':
unittest.main()
| Commonists/SurfaceImageContentGap | tests/test_bot.py | Python | mit | 298 |
# -*- coding: utf8 -*-
import rawes
from pyramid.settings import aslist
from zope.interface import Interface
from rawes.encoders import encode_date_optional_time
from pyramid.path import (
DottedNameResolver
)
import warnings
class IRawes(Interface):
pass
def _parse_settings(settings):
rawes_args... | koenedaele/pyramid_rawes | pyramid_rawes/__init__.py | Python | mit | 3,144 |
import time
import string
from requests import get
from lxml.html import fromstring
from enum import Enum
class Timer():
def start_timer(self):
self.start = time.time()
def stop_timer(self):
self.end = time.time()
def elapsed_time(self):
return self.end - self.start
class HTTPCod... | Astonex/IRC-Bot | linkresolver.py | Python | mit | 4,280 |
from celery.task import Task
from django.conf import settings
from django.contrib.auth import get_user_model
from projects.models import Project
from projects.tasks.delete_document import DeleteDocumentTask
User = get_user_model()
class DeleteProjectTask(Task):
def run(self, *args, **kwargs):
self.proj... | bgroff/kala-app | django_kala/projects/tasks/delete_project.py | Python | mit | 839 |
# Generated by Django 3.1.6 on 2021-03-12 15:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("publicbody", "0037_foilawtranslation_legal_text"),
]
operations = [
migrations.AddField(
model_name="foilaw",
name="... | fin/froide | froide/publicbody/migrations/0038_foilaw_scale_of_fees.py | Python | mit | 481 |
# Demo program for moving average filter
# Author: Peter Hinch
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2021 Peter Hinch
# 16th Dec 2021
import array
from time import ticks_us, ticks_diff
from avg_pico import avg
data = array.array('i', (0 for _ in range(19))) # Average over 16 samples
dat... | peterhinch/micropython-filters | avgtest_pico.py | Python | mit | 874 |
from flask import Flask
app = Flask(__name__)
app.config.from_object(__name__)
app.secret_key = ("\x86#h\xfb\xd3\xd9\x1d\xf7b\x9ayG"
"\x8e\x1e\x9d);w \xf0z\x99&\xe8")
if __name__ == '__main__':
import auth
from controller import *
#http://tech.nickserra.com/2011/11/16/django-runserver-a... | johncosta/flask-oauth | web/app.py | Python | mit | 712 |
import os
from unittest import TestCase, main
from gruffy import AccumulatorBar
TARGET_FILE = 'test.png'
class TestAccumulatorBar(TestCase):
def tearDown(self):
os.remove(TARGET_FILE)
def test_writable(self):
g = AccumulatorBar()
g.theme_pastel()
g.theme_greyscale()
... | hhatto/gruffy | test/test_accumulator_bar.py | Python | mit | 416 |
revision = '355ed1e03db'
down_revision = '2ec6da9f48f'
from alembic import op
import sqlalchemy as sa
from sqlalchemy import sql
from sqlalchemy.dialects import postgresql
def upgrade():
op.create_table('chamber',
sa.Column('id', postgresql.UUID(), nullable=False),
sa.Column('slug', sa.Text(), nul... | mgax/mptracker | alembic/versions/355ed1e03db_chamber.py | Python | mit | 957 |
from argparse import ArgumentParser
import glob
import json
import os
def crosscheck_videos(video_path, ann_file):
# Get existing videos
existing_vids1 = glob.glob("%s/*.mp4" % video_path)
existing_vids2 = glob.glob("/mnt/sun-alpha/actnet/videos/*.mp4");
print len(existing_vids1),"second one",len(exis... | gurkirt/actNet-inAct | Crawler/run_crosscheck.py | Python | mit | 2,603 |
from Handshake.SessionHandler import HandleSession
# elapsetime = int(round(time.time() * 1000))
# sessi = HandleSession("SSLSocket")
# Execution_Time1 = int(round(time.time() * 1000))-elapsetime
# print("---------------Execution Time--------------------" + str(Execution_Time1))
sessi = HandleSession("Plaintext")
tr... | PanagiotisDrakatos/Light_IoT_CryptoDevice | PythonClient/Example/ExampleTest.py | Python | mit | 634 |
spider = """ `
` `
,
:
' `
+ ,
# '
@ #
@ @
@ @
@ ... | BLQ-Software/black-widow | src/spider.py | Python | mit | 2,210 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-02 00:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('imager_images', '0005_auto_20170201_0144'),
]
operations = [
migrations.Alt... | JSchatzman/django-imager | imagersite/imager_images/migrations/0006_auto_20170202_0024.py | Python | mit | 479 |
"""compd
Usage:
compd.py [options]
Options:
--version Print the version, and exit.
-h --help Display this help.
-c <file> --config <file> Use an alternative config.yaml.
"""
from docopt import docopt
from subprocess import check_output, CalledProcessError
import config
import... | prophile/compd | src/compd.py | Python | mit | 1,568 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/repair_impact_description_base.py | Python | mit | 1,083 |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sql_functions import *
# number of cities to include in search
N = 100
# number of cities to include in results
top = 10
# read and combine dataframes into one dataframe
cities = read_table('cit... | cedar10b/travelapp | main.py | Python | mit | 2,480 |
from django import template
from django.forms import CheckboxInput, HiddenInput
register = template.Library()
def is_checkbox(field):
return field.field.widget.__class__.__name__ == \
CheckboxInput().__class__.__name__
@register.filter
def addclass(field, arg):
if is_checkbox(field):
return... | samitnuk/online_shop | apps/shop/templatetags/form_filters.py | Python | mit | 512 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
import json
import re
import os.path as path
wd... | ahmed-taj/gh-strike | gh.py | Python | mit | 2,063 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import time
import logging
from PyQt5 import QtCore
from PyQt5.QtWidgets import (QWidget, QDialog, QMainWindow, QLabel, QLineEdit, QPushButton,
QTextEdit, QPlainTextEdit, QGridLayout, QApplication)
from control import Control
from ui_main import Ui_main... | intgerzero/network-computing | 1/Client/ui_login.py | Python | mit | 3,566 |
from django.contrib import admin
from mysql_fuzzycount.queryset import FuzzyCountQuerySet
class FuzzyCountModelAdminMixin(object):
def get_queryset(self, request):
qs = super(FuzzyCountModelAdminMixin, self).get_queryset(request)
return qs._clone(klass=FuzzyCountQuerySet)
class FuzzyCountModel... | educreations/django-mysql-fuzzycount | mysql_fuzzycount/admin.py | Python | mit | 381 |
from random import *
from random import gauss as random_gauss
from cmath import rect as from_polar
from math import sqrt, cos
from frostsynth import *
from frostsynth.interpolation import *
from frostsynth.ffi import uniform as fast_uniform
from frostsynth.polysequence import LinearSequence, NaturalSpline
def fast_u... | frostburn/frostsynth | frostsynth/noise.py | Python | mit | 12,150 |
"""Recurrent neural network language model with static graph optimizations.
This is a modified version of the standard Chainer Penn Tree Bank (ptb)
example that
includes static subgraph optimizations. It is mostly unchanged
from the original model except that that the RNN is unrolled for `bproplen`
slices inside of a ... | ktnyt/chainer | examples/static_graph_optimizations/ptb/train_ptb_custom_loop.py | Python | mit | 11,853 |
"""
From: http://djangosnippets.org/snippets/545/
Tags like url and trans provide no way to get the result as a context variable.
But how would you get a computed URL into a blocktrans?
This snippet solves the general problem. Just put the template code whose
output you want to capture within captureas tags. For exam... | wapcaplet/vittles | core/templatetags/capture.py | Python | mit | 1,497 |
from django.conf.urls import url
from apps.notifications import views
from oauth2_provider import views as op_views
urlpatterns = [
url(r'^$', views.notifications_by_feed, name='notifications-by-feed'),
url(r'^feed/?$', views.set_notifications_for_feed, name='set-notifications-for-feed'),
url(r'^apns_token... | samuelclay/NewsBlur | apps/notifications/urls.py | Python | mit | 533 |
import time
from .apiresource import ListableAPIResource
from .apiresource import CreateableAPIResource
from .apiresource import UpdateableAPIResource
from .solveobject import convert_to_solve_object
from .task import Task
def follow_commits(task, sleep_seconds):
"""Utility used to wait for commits"""
while ... | solvebio/solvebio-python | solvebio/resource/datasetcommit.py | Python | mit | 2,980 |
#!/usr/bin/env python3
import os
import re
import glob
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_context('poster')
sns.set_style('whitegrid')
sns.set_palette('Blues', 13)
def parse_file(path):
pat = re.compile(r'^MEM\s+([\d\.]+)\s+([\d\.]+)$', re.I)
start = None
with open(path, 'r'... | bbengfort/honu | fixtures/vms/client/mprofile/mprof_plot.py | Python | mit | 1,341 |