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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""Field classes.
Includes all fields from `marshmallow.fields` in addition to a custom
`Nested` field and `DelimitedList`.
All fields can optionally take a special `location` keyword argument, which tells webargs
where to parse the request argument from. ::
args = {
'active': fie... | daspots/dasapp | lib/webargs/fields.py | Python | mit | 2,488 |
from __future__ import print_function
import logging
_logger = logging.getLogger('theano.sandbox.cuda.opt')
import copy
import sys
import time
import warnings
import pdb
import numpy
import theano
from theano import scalar as scal
from theano import config, tensor, gof
import theano.ifelse
from six.moves import red... | nke001/attention-lvcsr | libs/Theano/theano/sandbox/cuda/opt.py | Python | mit | 96,948 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Komiksowiec documentation build configuration file, created by
# sphinx-quickstart on Fri Feb 3 23:11:02 2017.
#
# 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
... | pidpawel/komiksowiec | docs/source/conf.py | Python | mit | 9,830 |
if __name__ == '__main__':
a = int(raw_input())
b = int(raw_input())
print a + b
print a - b
print a * b
| LuisUrrutia/hackerrank | python/introduction/python-arithmetic-operators.py | Python | mit | 126 |
import logging
import logging.config
import sys
import threading
import os
from amberclient.collision_avoidance.collision_avoidance_proxy import CollisionAvoidanceProxy
from amberclient.common.amber_client import AmberClient
from amberclient.location.location import LocationProxy
from amberclient.roboclaw.roboclaw imp... | showmen15/testEEE | src/amberdriver/drive_to_point/drive_to_point_controller.py | Python | mit | 7,564 |
import unittest
import socket
import os
from shapy.framework.netlink.constants import *
from shapy.framework.netlink.message import *
from shapy.framework.netlink.tc import *
from shapy.framework.netlink.htb import *
from shapy.framework.netlink.connection import Connection
from tests import TCTestCase
class TestClas... | praus/shapy | tests/netlink/test_htb_class.py | Python | mit | 1,941 |
#!/usr/bin/env python
import setuptools
if __name__ == "__main__":
setuptools.setup(
name="aecg100",
version="1.1.0.18",
author="WHALETEQ Co., LTD",
description="WHALETEQ Co., LTD AECG100 Linux SDK",
url="https://www.whaleteq.com/en/Support/Download/7/Linux%20SDK",
include_package_data=Tru... | benian/aecg100 | setup.py | Python | mit | 418 |
#!/usr/local/bin/python3.5
import itertools
import sys
from .stuff import word_set
__version__ = "1.1.0"
def find_possible(lst):
"""
Return all possible combinations of letters in lst
@type lst: [str]
@rtype: [str]
"""
returned_list = []
for i in range(0, len(lst) + 1):
for subs... | patrickleweryharris/anagram-solver | anagram_solver/anagram_solver.py | Python | mit | 1,532 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-07 08:13
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations
import djstripe.fields
class Migration(migrations.Migration):
dependencies = [
('djstripe', '0020_auto_20161229_0041'),
]
... | tkwon/dj-stripe | djstripe/migrations/0021_auto_20170107_0813.py | Python | mit | 865 |
class MethodMissing(object):
def __getattr__(self, name):
try:
return self.__getattribute__(name)
except AttributeError:
def method(*args, **kw):
return self.method_missing(name, *args, **kw)
return method
def method_missing(self, name, *args,... | ganow/gq | gq/missing.py | Python | mit | 788 |
import threading
__author__ = "Piotr Gawlowicz"
__copyright__ = "Copyright (c) 2015, Technische Universitat Berlin"
__version__ = "0.1.0"
__email__ = "gawlowicz@tkn.tu-berlin.de"
class Timer(object):
def __init__(self, handler_):
assert callable(handler_)
super().__init__()
self._handler ... | uniflex/uniflex | uniflex/core/timer.py | Python | mit | 1,583 |
import pytest
import responses
from document import Document
from scrapers.knox_tn_agendas_scraper import KnoxCoTNAgendaScraper
from . import common
from . import utils
class TestKnoxAgendaScraper(object):
session = None
page_str = ""
def test_get_docs_from_page(self):
scraper = KnoxCoTNAgendaSc... | RagtagOpen/bidwire | bidwire/tests/test_knox_co_agenda_scraper.py | Python | mit | 2,136 |
"""
==========================================
Author: Tyler Brockett
Username: /u/tylerbrockett
Description: Alert Bot (Formerly sales__bot)
Date Created: 11/13/2015
Date Last Edited: 12/20/2016
Version: v2.0
==========================================
"""
import praw
im... | tylerbrockett/reddit-bot-buildapcsales | src/bot_modules/reddit_handler.py | Python | mit | 3,944 |
# -*- coding: utf-8 -*-
"""
spdypy.stream
~~~~~~~~~~~~~
Abstractions for SPDY streams.
"""
import collections
from .frame import (SYNStreamFrame, SYNReplyFrame, RSTStreamFrame,
DataFrame, HeadersFrame, WindowUpdateFrame, FLAG_FIN)
class Stream(object):
"""
A SPDY connection is made up of ... | Lukasa/spdypy | spdypy/stream.py | Python | mit | 4,701 |
#!/usr/bin/env python
# encoding: utf-8
# http://axe.g0v.tw/level/4
import urllib2, re
lines = []; last_url = None
for index in range(1, 25):
url = "http://axe-level-4.herokuapp.com/lv4/" if index == 1 \
else "http://axe-level-4.herokuapp.com/lv4/?page=" + str(index)
# The hint is that we shall make our bot loo... | zonble/axe_py | axe4.py | Python | mit | 1,045 |
from collections import deque
N = int(input())
d = deque()
i = 0
while i < N:
command = input().split()
if command[0] == 'append':
d.append(command[1])
elif command[0] == 'appendleft':
d.appendleft(command[1])
elif command[0] == 'pop':
d.pop()
else:
d.popleft()
i... | avtomato/HackerRank | Python/_07_Collections/_06_Collections.deque()/solution.py | Python | mit | 358 |
import pytest
import pwny
target_little_endian = pwny.Target(arch=pwny.Target.Arch.unknown, endian=pwny.Target.Endian.little)
target_big_endian = pwny.Target(arch=pwny.Target.Arch.unknown, endian=pwny.Target.Endian.big)
def test_pack():
assert pwny.pack('I', 0x41424344) == b'DCBA'
def test_pack_format_with_e... | edibledinos/pwnypack | tests/test_packing.py | Python | mit | 4,642 |
"""optboard URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | tanutarou/OptBoard | optboard/urls.py | Python | mit | 838 |
def maxSumSub(arr):
maxSums = [0]*len(arr)
for i in range(len(arr)):
Si = arr[i]
maxS = Si
for j in range(0,i):
if (arr[j] < arr[i]):
s = maxSums[j] + arr[i]
if (s > maxS):
maxS = s
maxSums[i] = maxS
return max(m... | KarlParkinson/practice | algs/maxSumSub.py | Python | mit | 454 |
import requests
import httpretty
from nose.tools import nottest
from pyrelic import BaseClient
@nottest # Skip until we can properly simulate timeouts
@httpretty.activate
def test_make_request_timeout():
"""
Remote calls should time out
"""
httpretty.register_uri(httpretty.GET, "www.example.com",
... | andrewgross/pyrelic | tests/unit/test_base_client.py | Python | mit | 1,927 |
from tokens.andd import And
from tokens.expression import Expression
from tokens.iff import Iff
from tokens.kfalse import ConstantFalse
from tokens.ktrue import ConstantTrue
from tokens.nop import Not
from tokens.orr import Or
from tokens.then import Then
from tokens.variable import Variable
class TokenParser:
""... | LonamiWebs/Py-Utils | logicmind/token_parser.py | Python | mit | 3,318 |
'''
author : "George Profenza"
url : ("disturb", "disturbmedia.com/blog","My blog, http://tomaterial.blogspot.com")
Export meshes the three.js 3D Engine by mr.doob's et al.
More details on the engine here:
https://github.com/mrdoob/three.js
Currently supports UVs. If the model doesn't display correctly
you might ... | flyingoctopus/three.js | utils/exporters/cinema4d/export_to_three.js.py | Python | mit | 8,574 |
"""
This module houses ctypes interfaces for GDAL objects. The following GDAL
objects are supported:
CoordTransform: Used for coordinate transformations from one spatial
reference system to another.
Driver: Wraps an OGR data source driver.
DataSource: Wrapper for the OGR data source object, supports... | diego-d5000/MisValesMd | env/lib/python2.7/site-packages/django/contrib/gis/gdal/__init__.py | Python | mit | 2,676 |
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
import assignment2_helper as helper
# Look pretty...
matplotlib.style.use('ggplot')
# Do * NOT * alter this line, until instructed!
scaleFeatures = True
# TODO: Load up the dataset and remove any and all
# Rows that have a nan. You should be a p... | rebaltina/DAT210x | Module4/assignment2_true.py | Python | mit | 3,557 |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Philipp Wagner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must... | DiUS/Physiognomy | python/align_faces.py | Python | mit | 4,189 |
import theano
from theano import shared, tensor
from blocks.bricks import Feedforward, Activation
from blocks.bricks.base import application, lazy
from blocks_extras.initialization import PermutationMatrix
from blocks_extras.utils import check_valid_permutation
from blocks.utils import shared_floatx
class FixedPermut... | mila-udem/blocks-extras | blocks_extras/bricks/__init__.py | Python | mit | 2,174 |
from rest_framework import permissions
class IsOwnerOrReadOnly(permissions.BasePermission):
"""
Object-level permission to only allow owners of an object to edit it.
Assumes the model instance has an `owner` attribute.
"""
def has_object_permission(self, request, view, obj):
# Read permis... | johnnywell/snowman | api/permissions.py | Python | mit | 595 |
from django.contrib import admin
from api.models import (
CrawlUrls,
CrawlLinks,
)
# Register your models here.
admin.site.register(CrawlUrls)
admin.site.register(CrawlLinks) | saymedia/seosuite-dashboard-api | api/admin.py | Python | mit | 187 |
"""
WSGI config for PythonAnywhere test project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_AP... | hjwp/cookiecutter-example-project | config/wsgi.py | Python | mit | 1,632 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import with_statement
import glob
import os
import hmac
import hashlib
import shutil
import socket
import subprocess
import struct
from twisted.internet import defer
from twisted.internet.interfaces i... | ghtdak/txtorcon | txtorcon/util.py | Python | mit | 8,270 |
#!/usr/bin/env python3
import os
import re
import itertools
from functools import reduce
from .version import __version__
sep_regex = re.compile(r'[ \-_~!@#%$^&*\(\)\[\]\{\}/\:;"|,./?`]')
def get_portable_filename(filename):
path, _ = os.path.split(__file__)
filename = os.path.join(path, filename)
retur... | elektito/finglish | finglish/f2p.py | Python | mit | 6,952 |
from PyQt4 import QtGui, QtCore
class Window(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.mapper = QtCore.QSignalMapper(self)
self.toolbar = self.addToolBar('Foo')
self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)
for text in 'One... | Schizo/MediaBrowser | python/Temp/sandboxSignalMapper.py | Python | mit | 1,120 |
from pydons import MatStruct, FileBrowser, LazyDataset
import netCDF4
import numpy as np
import tempfile
import os
DATADIR = os.path.join(os.path.dirname(__file__), 'data')
def test_netcdf4():
d = MatStruct()
data1 = np.random.rand(np.random.randint(1, 1000))
with tempfile.NamedTemporaryFile(suffix=".... | coobas/pydons | tests/test_file_browser_netcdf4.py | Python | mit | 740 |
from __future__ import print_function
from __future__ import unicode_literals
import re
import time
import socket
from netmiko.cisco_base_connection import CiscoSSHConnection
class HPProcurveSSH(CiscoSSHConnection):
def session_preparation(self):
"""
Prepare the session after the connection has b... | shamanu4/netmiko | netmiko/hp/hp_procurve_ssh.py | Python | mit | 2,061 |
# 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/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_subscriptions_operations.py | Python | mit | 12,046 |
# 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/labservices/azure-mgmt-labservices/azure/mgmt/labservices/operations/_labs_operations.py | Python | mit | 45,851 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from decimal import Decimal as D
class NexmoResponse(object):
"""A convenient wrapper to manipulate the Nexmo json response.
The class makes it easy to retrieve information about sent messages, total
price, etc.
Example::
>>>... | thibault/libnexmo | libnexmo/response.py | Python | mit | 1,868 |
# -*- coding:utf-8 -*-
from ...errors.httpbadrequestexception import HttpBadRequestException
import saklient
# module saklient.cloud.errors.mustbeofsamezoneexception
class MustBeOfSameZoneException(HttpBadRequestException):
## 不適切な要求です。参照するリソースは同一ゾーンに存在しなければなりません。
## @param {int} status
# @param {st... | hnakamur/saklient.python | saklient/cloud/errors/mustbeofsamezoneexception.py | Python | mit | 731 |
import math
import pandas as pd
import numpy as np
from scipy import misc
from mpl_toolkits.mplot3d import Axes3D
import matplotlib
import matplotlib.pyplot as plt
# Look pretty...
# matplotlib.style.use('ggplot')
plt.style.use('ggplot')
def Plot2D(T, title, x, y):
# This method picks a bunch of random samples (im... | szigyi/DAT210x | Module4/assignment5.py | Python | mit | 2,886 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Agency.alias'
db.add_column('lobbyingph_agency', 'alias',
self.gf('dja... | AxisPhilly/lobbying.ph-django | lobbyingph/migrations/0030_auto__add_field_agency_alias.py | Python | mit | 14,317 |
import random
import math
def estimatePi(error):
itt=1000 #itterations
previousPI=0
while True:
hits=0 # number of hits
for i in range(0,itt):
x=random.uniform(0,1)
y=random.uniform(0,1)
z=x*x+y*y #Pythagorean Theorum
if math.sqrt(z)<=1: #if point(x,y)lies within the triangle
hits=hits+1
curren... | Alexgeni/Some-implementations | EstimationOfPi.py | Python | mit | 681 |
"""
Load winds on pressure levels and calculate vorticity and divergence
"""
import os, sys
import datetime
import iris
import iris.unit as unit
diag = '30201'
cube_name_u='eastward_wind'
cube_name_v='northward_wind'
pp_file_path='/projects/cascade/pwille/moose_retrievals/'
#experiment_ids = ['djznw', 'djzny', 'djznq',... | peterwilletts24/Monsoon-Python-Scripts | vort_and_div/vorticity_and_diverg.py | Python | mit | 613 |
import time
import asyncio
from aiokafka import AIOKafkaProducer
from settings import KAFKA_SERVERS, SAVEPOINT, LOG_FILE, KAFKA_TOPIC
class LogStreamer:
def __init__(self,
KAFKA_SERVERS,
KAFKA_TOPIC,
loop,
savepoint_file,
log_fi... | artyomboyko/log-analysis | log_reader.py | Python | mit | 2,330 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-10-03 02:38
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependen... | sbuss/voteswap | users/migrations/0014_signuplog.py | Python | mit | 928 |
#!/usr/bin/env python
import copy
from cStringIO import StringIO
from fnmatch import fnmatch
import gzip
import hashlib
import mimetypes
import os
import boto
from boto.s3.key import Key
from boto.s3.connection import OrdinaryCallingFormat
import app_config
GZIP_FILE_TYPES = ['.html', '.js', '.json', '.css', '.xml'... | stlpublicradio/ferguson-project | fabfile/flat.py | Python | mit | 3,519 |
"""Imports for Python API.
This file is MACHINE GENERATED! Do not edit.
Generated by: tensorflow/tools/api/generator/create_python_api.py script.
"""
from tensorflow.python.keras import Input
from tensorflow.python.keras import Model
from tensorflow.python.keras import Sequential
from tensorflow.tools.api.generator.ap... | ryfeus/lambda-packs | Keras_tensorflow_nightly/source2.7/tensorflow/tools/api/generator/api/keras/__init__.py | Python | mit | 1,351 |
#!/usr/bin/env python3
# Copyright (c) 2017 The DigiByte Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import AuroracoinTestFramework
from test_framework.util import assert_equa... | aurarad/auroracoin | qa/rpc-tests/listsinceblock.py | Python | mit | 2,579 |
# Adrian deWynter, 2017
# Implementation of various algorithms
# applied to strings
# Given a long string find the greater
# number that is also a palindrome.
def nextPalindrome(S):
def isPalindrome(x): return x == x[::-1]
while True:
S = S + 1
if isPalindrome(S): return S
# Given two words A,B find if A = r... | adewynter/Tools | Algorithms/stringOps.py | Python | mit | 4,317 |
import numpy as np;
np.set_printoptions(linewidth=40, precision=5, suppress=True)
import pandas as pd; pd.options.display.max_rows=80;pd.options.display.expand_frame_repr=False;pd.options.display.max_columns=20
import pylab as plt;
import os; home=os.path.expanduser('~') +'/'
import sys;sys.path.insert(1,... | airanmehr/bio | Scripts/TimeSeriesPaper/Plot/Markov.py | Python | mit | 8,854 |
#! /usr/bin/env python
class Duck:
"""
this class implies a new way to express polymorphism using duck typing.
This class has 2 functions: quack() and fly() consisting no parameter.
"""
def quack(self):
print("Quack, quack!");
def fly(self):
print("Flap, Flap!");
... | IPVL/Tanvin-PythonWorks | pythonOOP/codes/duck_test.py | Python | mit | 722 |
"""
This module defines serializers for the main API data objects:
.. autosummary::
:nosignatures:
DimensionSerializer
FilterSerializer
MessageSerializer
QuestionSerializer
"""
from django.core.paginator import Paginator
from rest_framework import serializers, pagination
import emoticonvis.apps... | nanchenchen/emoticon-analysis | emoticonvis/apps/api/serializers.py | Python | mit | 4,406 |
# Log into the site with your browser, obtain the "Cookie" header,
# and put it here
cookie = ''
| jonmsawyer/site-tools | flgetpics/cookie.py | Python | mit | 97 |
import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
class TestHuberLoss(unittest.TestCase):
def setUp(self):
self.shape = ... | benob/chainer | tests/chainer_tests/functions_tests/loss_tests/test_huber_loss.py | Python | mit | 2,031 |
'''
compile_test.py - check pyximport functionality with pysam
==========================================================
test script for checking if compilation against
pysam and tabix works.
'''
# clean up previous compilation
import os
import unittest
import pysam
from TestUtils import make_data_files, BAM_DATADIR... | pysam-developers/pysam | tests/compile_test.py | Python | mit | 1,181 |
from pylab import *
import matplotlib.cm as cmx
import matplotlib.colors as colors
def MakeColourMap(N, colormap='jet'):
'''
To make colour map with N possible colours. Interpolated from map 'colormap'
'''
### Colour map for cells (if you want to plot multiple cells)
values = range(N)
jet = cm = plt.get_cmap(co... | h-mayorquin/camp_india_2016 | tutorials/Spatial Coding/makecmap.py | Python | mit | 452 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
from django.http import HttpResponse
import service.api
def api_available(request):
return HttpResponse(service.api.get_proxy())
def hello(request):
return HttpResponse("Hello world!") | Piasy/proxy-searcher | service/service/views.py | Python | mit | 233 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Generic rendering function that can handle all simulations, but makes poor renders. Nice for sketching.
import os, time, subprocess, re
def Say(text, verbosity=0, end='\n', suppressTime=False):
if verbosity<=VERBOSITY:
if suppressTime:
timeStr = ''... | tomasstorck/diatomas | blender/rendermonitor.py | Python | mit | 5,383 |
import unittest
from db.migrations import migrations_util
class TestMigrationUtil(unittest.TestCase):
"""Test the CLI API."""
@classmethod
def setUpClass(cls):
cls.db_path = '/some/random/path/file.db'
def setUp(self):
self.parser = migrations_util.make_argument_parser(self.db_path)... | im0rtel/OpenBazaar | tests/test_migrations_util.py | Python | mit | 1,060 |
import asyncio
import json
import uuid
import pytest
from photonpump import exceptions as exn
from photonpump import messages as msg
from photonpump import messages_pb2 as proto
from photonpump.conversations import CatchupSubscription
from ..fakes import TeeQueue
async def anext(it, count=1):
if count == 1:
... | madedotcom/photon-pump | test/conversations/test_catchup.py | Python | mit | 25,039 |
import numpy as np
from elephas.mllib.adapter import *
from pyspark.mllib.linalg import Matrices, Vectors
def test_to_matrix():
x = np.ones((4, 2))
mat = to_matrix(x)
assert mat.numRows == 4
assert mat.numCols == 2
def test_from_matrix():
mat = Matrices.dense(1, 2, [13, 37])
x = from_matrix(... | maxpumperla/elephas | tests/mllib/test_adapter.py | Python | mit | 570 |
# coding=utf-8
import zipfile
import re
import os
import hashlib
import json
import logging
from django.shortcuts import render
from django.db.models import Q, Count
from django.core.paginator import Paginator
from rest_framework.views import APIView
from django.conf import settings
from account.models import SUPER... | hxsf/OnlineJudge | problem/views.py | Python | mit | 12,819 |
from scrapy.commands.crawl import Command
from scrapy.exceptions import UsageError
class CustomCrawlCommand(Command):
def run(self, args, opts):
if len(args) < 1:
raise UsageError()
elif len(args) > 1:
raise UsageError("running 'scrapy crawl' with more than one spider is no... | lnxpgn/scrapy_multiple_spiders | commands/crawl.py | Python | mit | 809 |
# pylint:disable=missing-docstring,invalid-name,too-few-public-methods,old-style-class
class SomeClass: # [blank-line-after-class-required]
def __init__(self):
pass
| Shopify/shopify_python | tests/functional/blank_line_after_class_required.py | Python | mit | 178 |
"""Print all records in the pickle for the specified test"""
import sys
import argparse
from autocms.core import (load_configuration, load_records)
def main():
"""Print all records corresponding to test given as an argument"""
parser = argparse.ArgumentParser(description='Submit one or more jobs.')
pars... | appeltel/AutoCMS | print_records.py | Python | mit | 801 |
import numpy as np
import pandas as pd
"""
Specifications (So far, only implemented for the single index part below):
feature_df ... Data Frame of intervals along the genome,
equivalent of a bed file, but 1-indexed
index:
(chrom, start)
columns
required:
end
optional:
na... | feilchenfeldt/enrichme | pandas_util.py | Python | mit | 15,740 |
import sys
import os
import Image
def simpleQuant():
im = Image.open('bubbles.jpg')
w,h = im.size
for row in range(h):
for col in range(w):
r,g,b = im.getpixel((col,row))
r = r // 36 * 36
g = g // 42 * 42
b = b // 42 * 42
im.putpixel((col,r... | robin1885/algorithms-exercises-using-python | source-code-from-author-book/Listings-for-Second-Edition/listing_8_21.py | Python | mit | 347 |
# @Author: ganeshkumarm
# @Date: 2016-11-19T19:20:11+05:30
# @Last modified by: ganeshkumarm
# @Last modified time: 2016-11-19T19:20:45+05:30
#Built in modules
import os
import sys
import time
import subprocess
import datetime
import platform
from win10toast import ToastNotifier
#Used defined module
import except... | GaneshmKumar/Alertify | alertify/alertify.py | Python | mit | 3,659 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Post'
db.create_table(u'blog_post', (
(u'id', self.gf('django.db.models.fields.A... | daviferreira/leticiastallone.com | leticiastallone/blog/migrations/0001_initial.py | Python | mit | 1,393 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Q2(c): Recurrent neural nets for NER
"""
from __future__ import absolute_import
from __future__ import division
import argparse
import logging
import sys
import tensorflow as tf
import numpy as np
logger = logging.getLogger("hw3.q2.1")
logger.setLevel(logging.DEBUG... | AppleFairy/CS224n-Natural-Language-Processing-with-Deep-Learning | assignment/assignment3/q2_rnn_cell.py | Python | mit | 4,987 |
# The MIT License (MIT)
#
# Copyright (c) 2016 Sean Quinn
#
# 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... | extesla/dice-python | tests/dice/tokens/test_term.py | Python | mit | 1,315 |
import _plotly_utils.basevalidators
class CustomdatasrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="customdatasrc", parent_name="scatter", **kwargs):
super(CustomdatasrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_n... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatter/_customdatasrc.py | Python | mit | 411 |
"""
Contains base data structures for defining graph constrained group testing problem,
and interfaces to operate on them.
Basic structure to exchange graph constrained group testing problem definition is :class:`Problem`.
It consists of enumeration of faulty elements, graph of links between elements and natural langu... | szredinger/graph-constr-group-testing | graph_constr_group_testing/core/base_types.py | Python | mit | 5,126 |
import matplotlib.pyplot as pl
import numpy as np
import math
from matplotlib.collections import LineCollection
from matplotlib.colors import colorConverter
def plot(X, m, x_star, t, z_t):
fig = pl.figure(figsize=(10,10))
# Draw the grid first
ax = pl.axes()
ax.set_xlim(-4,20)
ax.set_ylim(-4,20)... | mufid/berkilau | ws/CSUIBotClass2014/util/plotter2.py | Python | mit | 1,816 |
from unittest import skipIf
from django.conf import settings
def skipIfDefaultUser(test_func):
"""
Skip a test if a default user model is in use.
"""
return skipIf(settings.AUTH_USER_MODEL == "auth.User", "Default user model in use")(
test_func
)
def skipIfCustomUser(test_func):
"""... | yunojuno/django-request-profiler | tests/utils.py | Python | mit | 491 |
from django import forms
from django.contrib.auth.models import User
from .models import Perfil,SolicitudColaboracion
class SolicitudColaboracionForm(forms.ModelForm):
class Meta:
model = SolicitudColaboracion
fields = ('name','licenciatura_leyes','telefono','fecha_nacimiento')
| SurielRuano/Orientador-Legal | colaboradores/forms.py | Python | mit | 287 |
#!/usr/bin/env python
"""
voice_nav.py allows controlling a mobile base using simple speech commands.
Based on the voice_cmd_vel.py script by Michael Ferguson in the pocketsphinx ROS package.
"""
import roslib; #roslib.load_manifest('pi_speech_tutorial')
import rospy
from geometry_msgs.msg import Twist
from std_... | jdekerautem/TurtleBot-Receptionist | pocketsphinx_files/notsotalkative.py | Python | mit | 6,969 |
from tabulate import tabulate
class Response():
message = None;
data = None;
def print(self):
if self.message:
if type(self.message) == "str":
print(self.message)
elif type(self.message) == "list":
for message in self.message:
... | mozey/taskmage | taskmage/response.py | Python | mit | 557 |
"""Add user
Revision ID: 13a57b7f084
Revises: None
Create Date: 2014-05-11 17:12:17.244013
"""
# revision identifiers, used by Alembic.
revision = '13a57b7f084'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op... | plumdog/datasheet | alembic/versions/13a57b7f084_add_user.py | Python | mit | 741 |
# project/tests/test_auth.py
import time
import json
import unittest
from project.server import db
from project.server.models import User, BlacklistToken
from project.tests.base import BaseTestCase
def register_user(self, email, password):
return self.client.post(
'/auth/register',
data=json.du... | L33tCh/afj-flask | project/tests/test_auth.py | Python | mit | 9,874 |
"""
[DEPRECATED] Run a single container in debug mode
"""
import typer
from controller import print_and_exit
from controller.app import Application
# Deprecated since 2.1
@Application.app.command(help="Replaced by run --debug command")
def volatile(
service: str = typer.Argument(
...,
help="Servi... | rapydo/do | controller/commands/volatile.py | Python | mit | 802 |
# -*- coding: utf-8 -*-
# A search engine based on probabilitistic models of the information retrival.
# Author - Janu Verma
# email - jv367@cornell.edu
# http://januverma.wordpress.com/
# @januverma
import sys
from pydoc import help
import os
from collections import defaultdict
from math import log, sqrt
impo... | Jverma/InfoR | InfoR/ProbabilitisticModels.py | Python | mit | 5,245 |
from typing import NamedTuple, List
from data import crossword
class Clue(str):
def __init__(self, value) -> None:
super(Clue, self).__init__(value)
self._tokens = crossword.tokenize_clue(value)
class _Node(object):
_clue: Clue
_occupied: int
def __init__(self, clue: Clue, occupied: int) -> None:
... | PhilHarnish/forge | src/puzzle/problems/crossword/_cryptic_nodes.py | Python | mit | 437 |
from collections import defaultdict
from datetime import datetime, timedelta
from django.contrib.auth.models import User
from django.db import models
from django.db.models import Q, Count, Sum, Max, Min
from django.db.models.signals import pre_save
from django.dispatch import receiver
from hashlib import sha1
from pros... | adaptive-learning/proso-apps | proso_concepts/models.py | Python | mit | 14,974 |
from django.contrib import admin
from simulation.models import SimulationStage, SimulationStageMatch, SimulationStageMatchResult
class SimulationStageAdmin(admin.ModelAdmin):
list_display = ["number", "created_at"]
list_filter = ["created_at"]
class SimulationStageMatchAdmin(admin.ModelAdmin):
list_disp... | bilbeyt/ituro | ituro/simulation/admin.py | Python | mit | 972 |
import os
import common_pygame
import random
pygame = common_pygame.pygame
screen = common_pygame.screen
class Bonus():
def __init__(self, sounds, menu):
self.menu = menu
self.sounds = sounds
self.bonusType = 0
self.bonusAnim = 0
self.font = pygame.font.Font(None, 64)
... | antismap/MICshooter | sources/bonus.py | Python | mit | 1,158 |
"""
https://en.wikipedia.org/wiki/Square_root_of_a_matrix
B is the sqrt of a matrix A if B*B = A
"""
import numpy as np
from scipy.linalg import sqrtm
from scipy.stats import special_ortho_group
def denman_beaver(A, n=50):
Y = A
Z = np.eye(len(A))
for i in range(n):
Yn = 0.5*(Y + np.linalg.inv(... | qeedquan/misc_utilities | math/matrix-sqrt.py | Python | mit | 1,781 |
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
u, i=np.genfromtxt('Rohdaten/Daten_1_5.txt', unpack=True)
i=np.log(i)
u=np.log(u)
def f(u, a, b):
return a * u + b
params, covariance = curve_fit(f, u, i)
errors = np.sqrt(np.diag(covariance))
print('a =', params[0], '+-', err... | mwindau/praktikum | v504/oppellog.py | Python | mit | 701 |
# -*- coding: utf-8 -*-
"""
Internet Relay Chat (IRC) protocol client library.
This library is intended to encapsulate the IRC protocol in Python.
It provides an event-driven IRC client framework. It has
a fairly thorough support for the basic IRC protocol, CTCP, and DCC chat.
To best understand how to make an IRC ... | jaraco/irc | irc/client.py | Python | mit | 41,993 |
#!/usr/bin/env python
# coding: utf-8
# # rede_gephi_com_ipca_csv
# In[6]:
ano_eleicao = '2014'
rede =f'rede{ano_eleicao}'
csv_dir = f'/home/neilor/{rede}'
# In[7]:
dbschema = f'rede{ano_eleicao}'
table_edges = f"{dbschema}.gephi_edges_com_ipca_2018"
table_nodes = f"{dbschema}.gephi_nodes_com_ipca_2018"
table... | elivre/arfe | e2014/SCRIPTS/055-rede2014_rede_gephi_com_ipca_csv.py | Python | mit | 3,896 |
#!/usr/bin/env python3
from setuptools import setup, find_packages
version = '0.2.4'
setup(
name='lolbuddy',
version=version,
description='a cli tool to update league of legends itemsets and ability order from champion.gg',
author='Cyrus Roshan',
author_email='hello@cyrusroshan.com',
license=... | CyrusRoshan/lolbuddy | setup.py | Python | mit | 674 |
from code_intelligence import graphql
import fire
import github3
import json
import logging
import os
import numpy as np
import pprint
import retrying
import json
TOKEN_NAME_PREFERENCE = ["INPUT_GITHUB_PERSONAL_ACCESS_TOKEN", "GITHUB_PERSONAL_ACCESS_TOKEN", "GITHUB_TOKEN"]
for token in TOKEN_NAME_PREFERENCE:
if os.... | kubeflow/code-intelligence | py/notifications/notifications.py | Python | mit | 6,630 |
import os
from typing import List
import click
from valohai_yaml.lint import lint_file
from valohai_cli.ctx import get_project
from valohai_cli.exceptions import CLIException
from valohai_cli.messages import success, warn
from valohai_cli.utils import get_project_directory
def validate_file(filename: str) -> int:
... | valohai/valohai-cli | valohai_cli/commands/lint.py | Python | mit | 1,886 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# uFlash documentation build configuration file, created by
# sphinx-quickstart on Thu Dec 17 19:01:47 2015.
#
# 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
# aut... | ntoll/uflash | docs/conf.py | Python | mit | 11,491 |
# 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/v2019_12_01_preview/aio/_container_registry_management_client.py | Python | mit | 6,266 |
""" RUN RUN RUN !
"""
from buttersalt import create_app
from flask_script import Manager, Shell
app = create_app('default')
manager = Manager(app)
def make_shell_context():
return dict(app=app)
manager.add_command("shell", Shell(make_context=make_shell_context))
@manager.command
def test():
"""Run the u... | lfzyx/ButterSalt | manage.py | Python | mit | 505 |
#!/usr/bin/env python
""" patrol_smach_iterator.py - Version 1.0 2013-10-23
Control a robot using SMACH to patrol a square area a specified number of times
Created for the Pi Robot Project: http://www.pirobot.org
Copyright (c) 2013 Patrick Goebel. All rights reserved.
This program is free software;... | fujy/ROS-Project | src/rbx2/rbx2_tasks/nodes/patrol_smach_iterator.py | Python | mit | 9,741 |
# Copyright (C) 2012-2019 Ben Kurtovic <ben.kurtovic@gmail.com>
#
# 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, ... | earwig/mwparserfromhell | src/mwparserfromhell/parser/contexts.py | Python | mit | 6,097 |
from django.conf import settings
from django.db import models
import jsonfield
class Feed(models.Model):
name = models.CharField(max_length=1024)
url = models.URLField()
homepage = models.URLField()
etag = models.CharField(max_length=1024, blank=True)
last_modified = models.DateTimeField(blank=Tr... | yhlam/cobble | src/reader/models.py | Python | mit | 2,241 |
import unittest
import markovify
import os
import operator
def get_sorted(chain_json):
return sorted(chain_json, key=operator.itemgetter(0))
class MarkovifyTestBase(unittest.TestCase):
__test__ = False
def test_text_too_small(self):
text = "Example phrase. This is another example sentence."
... | jsvine/markovify | test/test_basic.py | Python | mit | 7,758 |
# coding=utf-8
import json
import os
import unittest
from collections import OrderedDict
from bs4 import BeautifulSoup
from ddt import ddt, data, unpack
from elifetools import parseJATS as parser
from elifetools import rawJATS as raw_parser
from elifetools.utils import date_struct
from tests.file_utils import (
sa... | elifesciences/elife-tools | tests/test_parse_jats.py | Python | mit | 132,828 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.