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 |
|---|---|---|---|---|---|
import unittest
import xen.xend.sxp
class test_sxp(unittest.TestCase):
def testAllFromString(self):
def t(inp, expected):
self.assertEqual(xen.xend.sxp.all_from_string(inp), expected)
t('String', ['String'])
t('(String Thing)', [['String', 'Thing']])
t('(... | YongMan/Xen-4.3.1 | tools/python/xen/xend/tests/test_sxp.py | Python | gpl-2.0 | 1,015 |
#!/usr/bin/env python
#
# Wrapper script for starting the Biopet JAR package
#
# This script is written for use with the Conda package manager and is copied
# from the peptide-shaker wrapper. Only the parameters are changed.
# (https://github.com/bioconda/bioconda-recipes/blob/master/recipes/peptide-shaker/peptide-shak... | joachimwolff/bioconda-recipes | recipes/biopet/biopet.py | Python | mit | 3,302 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | yosshy/nova | nova/tests/unit/scheduler/filters/test_affinity_filters.py | Python | apache-2.0 | 8,801 |
"""
========================================================
Compare Stochastic learning strategies for MLPClassifier
========================================================
This example visualizes some training loss curves for different stochastic
learning strategies, including SGD and Adam. Because of time-constrai... | RPGOne/Skynet | scikit-learn-0.18.1/examples/neural_networks/plot_mlp_training_curves.py | Python | bsd-3-clause | 3,692 |
__doc__="""Example drawings to review, used in autogenerated docs"""
| Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/reportlab/graphics/samples/__init__.py | Python | gpl-3.0 | 69 |
# SPDX-License-Identifier: GPL-2.0
#
# Copyright 2019 Google LLC.
import gdb
import zlib
from linux import utils
class LxConfigDump(gdb.Command):
"""Output kernel config to the filename specified as the command
argument. Equivalent to 'zcat /proc/config.gz > config.txt' on
a running target"""
... | gazoo74/linux | scripts/gdb/linux/config.py | Python | gpl-2.0 | 1,302 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will ... | kavardak/suds | tests/axis2.py | Python | lgpl-3.0 | 4,781 |
import unittest
from test import support
import io # C implementation.
import _pyio as pyio # Python implementation.
# Simple test to ensure that optimizations in the IO library deliver the
# expected results. For best testing, run this under a debug-build Python too
# (to exercise asserts in the C code).
lengths =... | 837468220/python-for-android | python3-alpha/python3-src/Lib/test/test_bufio.py | Python | apache-2.0 | 2,654 |
from pprint import pprint
VAR = 42
def foo():
import sys
import ast, tokenize
pass
class C:
from textwrap import dedent
pass
import codecs as C
pass
| asedunov/intellij-community | python/testData/formatter/noBlankLinesAfterLocalImports_after.py | Python | apache-2.0 | 182 |
"""Tests for License package"""
import logging
import json
from uuid import uuid4
from random import shuffle
from tempfile import NamedTemporaryFile
import factory
from factory.django import DjangoModelFactory
from django.test import TestCase
from django.test.client import Client
from django.core.management import ca... | zofuthan/edx-platform | lms/djangoapps/licenses/tests.py | Python | agpl-3.0 | 9,416 |
"""
An interpreted text role to link docs to CVE issues. To use: :cve:`XXXXX`
"""
from docutils import nodes, utils
from docutils.parsers.rst import roles
def cve_role(name, rawtext, text, lineno, inliner, options=None, content=None):
if options is None:
options = {}
url_pattern = inliner.document.se... | edmorley/django | docs/_ext/cve_role.py | Python | bsd-3-clause | 877 |
class Foo:
def __init__(self):
pass
class Bar(Foo):
pass
Bar()
#<ref> | asedunov/intellij-community | python/testData/codeInsight/controlflow/superclass.py | Python | apache-2.0 | 79 |
import os
import calendar
import datetime
import logging
from primitives import *
from constants import *
from helpers import OrderedAttrDict, utc
"""
The AS types and their FLV representations.
"""
log = logging.getLogger('flvlib.astypes')
class MalformedFLV(Exception):
pass
# Number
def get_number(f, max_... | mrquim/mrquimrepo | script.video.F4mProxy/lib/flvlib/astypes.py | Python | gpl-2.0 | 8,332 |
# Copyright 2013 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.
"""Request handler to display the debug view for a Failure."""
import jinja2
import os
import sys
import webapp2
from common import ispy_utils
import view... | s20121035/rk3288_android5.1_repo | external/chromium_org/chrome/test/ispy/server/debug_view_handler.py | Python | gpl-3.0 | 1,348 |
"""
Table of Contents Extension for Python-Markdown
* * *
(c) 2008 [Jack Miller](http://codezen.org)
Dependencies:
* [Markdown 2.0+](http://www.freewisdom.org/projects/python-markdown/)
"""
import markdown
from markdown import etree
import re
class TocTreeprocessor(markdown.treeprocessors.Treeprocessor):
# Iter... | lepture/Vealous | vealous/markdown/extensions/toc.py | Python | bsd-3-clause | 4,907 |
# -*- coding: utf-8 -*-
"""
A list of Peru regions as `choices` in a formfield.
This exists in this standalone file so that it's only imported into memory
when explicitly needed.
"""
from __future__ import unicode_literals
REGION_CHOICES = (
('AMA', 'Amazonas'),
('ANC', 'Ancash'),
('APU', 'Apurímac'),
... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.5/django/contrib/localflavor/pe/pe_region.py | Python | bsd-3-clause | 854 |
# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
#
# This file is part of Ansible
#
# Ansible 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 your option) any later... | ravello/ansible | v2/ansible/compat/tests/unittest.py | Python | gpl-3.0 | 1,147 |
import array
import unittest
from test.test_support import run_unittest, import_module, get_attribute
import os, struct
fcntl = import_module('fcntl')
termios = import_module('termios')
get_attribute(termios, 'TIOCGPGRP') #Can't run tests without this feature
try:
tty = open("/dev/tty", "r")
except IOError:
ra... | teeple/pns_server | work/install/Python-2.7.4/Lib/test/test_ioctl.py | Python | gpl-2.0 | 3,311 |
######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... | zwChan/VATEC | ~/eb-virt/Lib/site-packages/pip/_vendor/requests/packages/chardet/sjisprober.py | Python | apache-2.0 | 3,764 |
from oscar.core.loading import get_class
OrderPlacementMixin = get_class("checkout.mixins", "OrderPlacementMixin")
class OrderMessageSender(OrderPlacementMixin):
def __init__(self, request):
self.request = request
| thelabnyc/django-oscar-api-checkout | src/oscarapicheckout/email.py | Python | isc | 229 |
# -*- coding: utf-8 -*-
#
# Modoboa documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 3 22:29:25 2011.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | carragom/modoboa | doc/conf.py | Python | isc | 7,215 |
import pytest
from calc import INTEGER, EOF, PLUS, Calc, CalcError
def test_calc_raises_error_on_invalid_tokens():
"""
Test that invalid tokens cause a ``CalcError`` and that the exception stack
trace contains useful information.
"""
input_text = "lumberjack" # Now with 100% more Monty Python re... | bike-barn/red-green-refactor | tests/assignment_two/test_calc.py | Python | isc | 2,854 |
import json
import logging
import os
import sys
from datetime import datetime, timedelta, timezone
from signal import signal, SIGINT, SIGTERM, SIGUSR1
from typing import Optional
from apscheduler.schedulers import SchedulerNotRunningError
from dateutil.parser import isoparse as parse_iso_timestamp
from docker.models.c... | funkyfuture/deck-chores | deck_chores/main.py | Python | isc | 9,972 |
from random import randint
class Die():
'''A class representing a single die'''
def __init__(self, num_sides=6):
'''assume a six-side die'''
self.num_sides = num_sides
def roll(self):
'''return a random number between 1 and number of sides'''
return randint(1, self.num_si... | DoWhatILove/turtle | programming/python/data_visualization/die.py | Python | mit | 325 |
print 28433 * 2**7830457 + 1
| floppp/programming_challenges | project_euler/051-100/97.py | Python | mit | 29 |
"""
Sentiment prediction module
"""
import nltk
import numpy as np
from cPickle import load
def get_word_index_array(words, word2index):
u"""
Transform the words into list of int(word index)
Note: Unknown words are dropped
>>> words = [u"I", u"love", u"you", u"RANDOM STUFF"]
>>> word2ind... | AHAAAAAAA/HackCU2016 | sentiment.py | Python | mit | 2,307 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | Azure/azure-sdk-for-python | tools/azure-devtools/src/azure_devtools/perfstress_tests/__init__.py | Python | mit | 1,479 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from prov.model import *
EX_NS = Namespace('ex', 'http://example.org/')
EX_OTHER_NS = Namespace('other', 'http://example.org/')
class TestAttributesBase(object):
"""This is the base class for testing su... | krischer/prov | prov/tests/attributes.py | Python | mit | 5,400 |
import unittest
from flumine import config
class ConfigTest(unittest.TestCase):
def test_init(self):
self.assertFalse(config.simulated)
self.assertTrue(config.simulated_strategy_isolation)
self.assertIsInstance(config.customer_strategy_ref, str)
self.assertIsInstance(config.proces... | liampauling/flumine | tests/test_config.py | Python | mit | 865 |
# -*- coding: utf-8 -*-
import pymongo
from config import MONGO_STRING
client = pymongo.MongoClient(MONGO_STRING, tz_aware=True)
db = client['yo-water'] | YoApp/yo-water-tracker | db.py | Python | mit | 154 |
__author__ = 'phoetrymaster'
import subprocess
nodatain = -3000
nodataout = -3000
inputshape = "'/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/DepartmentSelection/ARG_adm/pellegrini.shp'"
inputimg = "'/Users/phoetrymaster/Documents/School/Geography/Thesis/Data/MODIS 7_2012-2013/argentina_1/test.tif'"
o... | jkeifer/pyHytemporal | old_TO_MIGRATE/test5.py | Python | mit | 787 |
from lfmconf.lfmconf import get_lastfm_conf
query_play_count_by_month = """
select * from view_play_count_by_month v
where substr(v.yr_month, 1, 4) =
"""
query_top_with_remaining = """
with top as (
{query_top}
),
total_count as (
{query_play_count}
)
select t.*
from t... | nicolasm/lastfm-export | queries/tops.py | Python | mit | 6,184 |
from HardwareInterface import *
from CameraInterface import *
#from ProtocolRunner import *
from DataInterface import *
| kscottz/SkinnerBox | modules/__init__.py | Python | mit | 120 |
"""JSON implementations of assessment.authoring searches."""
# pylint: disable=no-init
# Numerous classes don't require __init__.
# pylint: disable=too-many-public-methods,too-few-public-methods
# Number of methods are defined in specification
# pylint: disable=protected-access
# Access to protected method... | mitsei/dlkit | dlkit/json_/assessment_authoring/searches.py | Python | mit | 12,132 |
from django.conf.urls import url
from django.conf.urls import patterns
from pyday_alarms import views
app_name = 'pyday_alarms'
urlpatterns = [
url(r'^alarms/$', views.AlarmView.as_view(), name='alarms'),
]
'''urlpatterns += patterns('pyday_social_network.views',
url(r'^list/$', 'list', na... | 6desislava6/PyDay | pyday_alarms/urls.py | Python | mit | 336 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-21 15:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pages', '0006_auto_20160221_1241'),
]
operations = [
migrations.AlterField(
... | 501code/Fletcher-Street-Urban-Riding-Club | pages/migrations/0007_auto_20160221_1533.py | Python | mit | 473 |
#!/usr/bin/env python
"""Upserts Domains from Salesforce Domain__c.
"""
import logging
import os
from django.core.management.base import BaseCommand
import iss.models
import iss.salesforce
logger = logging.getLogger(os.path.basename(__file__))
class Command(BaseCommand):
def add_arguments(self, parser):
... | AASHE/iss | iss/management/commands/upsert_iss_domains.py | Python | mit | 1,085 |
class Label:
def collectLabel(self,l):
"""genera l'elenco delle etichette, perche' potrebbero essere presenti varie versioni di documenti nella collezione in mongodb
@param list: lista degli item in da inserire nel file excel
@return: []"""
labels = {}
for i in l:
labels = dict(labels.items()+i.items())
... | arpho/bb | exporter/Label.py | Python | mit | 342 |
import spi
from time import sleep
a = spi.SPI(0,0)
print "PY: initisalising SPI mode ...\n"
| robdobsn/SpideyWall | Old/RasPiTests/pispi1.py | Python | mit | 94 |
import time
from cortex import *
class MyDataHandler:
def __init__(self):
self.alldata = []
def MyErrorHandler(self, iLevel, msg):
print("ERROR: ")
print(iLevel, msg.contents)
return 0
def MyDataHandler(self, Frame):
print("got called")
try... | clemense/cortex-py | cortex-py/test/test_cortex.py | Python | mit | 2,711 |
#!/usr/bin/python3
from urllib.parse import urlencode
from urllib.request import urlopen, Request
from bs4 import BeautifulSoup
from argparse import ArgumentParser
from threading import Thread
import re
class HackAlunoOnline:
def __init__( self , matricula , full_search = False ):
# Exibicao default de matricula/... | hammurabi13th/haopy | hao.py | Python | mit | 12,161 |
import codecs
from setuptools import setup
VERSION = '0.2.0'
def read_long_description():
long_desc = []
with codecs.open('README.rst', 'r', 'utf8') as longdesc:
long_desc.append(longdesc.read())
with codecs.open('HISTORY.rst', 'r', 'utf8') as history:
long_desc.append(history.read())
... | scardine/image_size | setup.py | Python | mit | 776 |
"""
report.py
Functions to create various reports.
project : pf
version : 0.0.0
status : development
modifydate :
createdate :
website : https://github.com/tmthydvnprt/pf
author : tmthydvnprt
email : tim@tmthydvnprt.com
maintainer : tmthydvnprt
license : MIT
copyright : Copyright 2016, tmthy... | tmthydvnprt/pfcompute | pf/report.py | Python | mit | 345 |
from django.db import models
from django.contrib.admin import site as admin_site
class Language(models.Model):
"""
Language model
"""
name = models.CharField(max_length=64)
code = models.CharField(max_length=6, db_column='shortcut')
visible = models.BooleanField(default=True)
def __str__(... | firemark/yellowjuice | langs/models.py | Python | mit | 408 |
from flask import Flask
from flask_bootstrap import Bootstrap
app = Flask(__name__)
bootstrap = Bootstrap()
from .views import page
def create_app(config):
app.config.from_object(config)
bootstrap.init_app(app)
app.register_blueprint(page)
return app | eammx/proyectosWeb | proyectoPython/app/__init__.py | Python | mit | 269 |
import datetime
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
#GPIO.cleanup()
ypins = [17, 18, 27, 22, 23, 24, 25]
xpins = [5, 6, 12]
def setArray(myInt, array):
asBinary = "{0:b}".format(myInt).zfill(7)
for i in range(0, 7):
if (asBinary[i] == "0"):
array[i] = False
else:
... | Pharylon/PiClock | clock.py | Python | mit | 1,209 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unicodedata
from urlparse import urlparse
from threading import Thread
import httplib, sys
from Queue import Queue
import itertools
import codecs
import csv
import sys
import ssl
import re
if len(sys.argv) < 3:
print "Usage: %s <csv database> <out csv>" % (sys.argv... | florence-nocca/spanish-elections | retrieve-accounts/searx.py | Python | mit | 4,109 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-02-11 15:40
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('reports', '0010_auto_20170211_0306'),
]
operations = [
migrations.RemoveField(
... | diegojromerolopez/djanban | src/djanban/apps/reports/migrations/0011_auto_20170211_1640.py | Python | mit | 573 |
#!/usr/bin/python
import socket
import struct
import sys
message = 'very important data'
multicast_group = ('224.3.29.71', 10000)
# Create the datagram socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Set a timeout so the socket does not block indefinitely when trying
# to receive data.
sock.settime... | jhogsett/linkit | python/mc_send.py | Python | mit | 1,096 |
from scoring_engine.engine.basic_check import CHECKS_BIN_PATH
from tests.scoring_engine.checks.check_test import CheckTest
class TestFTPCheck(CheckTest):
check_name = 'FTPCheck'
properties = {
'remotefilepath': '/adir/textfile.txt',
'filecontents': 'Sample contents'
}
accounts = {
... | pwnbus/scoring_engine | tests/scoring_engine/checks/test_ftp.py | Python | mit | 474 |
# -*- coding: utf-8 -*-
# @Date : 2016-01-21 13:15
# @Author : leiyue (mr.leiyue@gmail.com)
# @Link : https://leiyue.wordpress.com/
from flask_wtf import Form
from wtforms import StringField, BooleanField, TextAreaField
from wtforms.validators import DataRequired, length
from .models import User
class LoginFo... | leiyue/microblog | app/forms.py | Python | mit | 1,399 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-20 19:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Post',
... | baltzar/alexandria | library/migrations/0001_initial.py | Python | mit | 729 |
# Based on cage v1.1.4
# http://www.alcyone.com/software/cage/
# Copyright (C) 2002-2006 Erik Max Francis <max@alcyone.com>
# GPL License
class Topology:
"""Encaptulation of the shape and dimentionality of a cellular automata"""
def get(self, address):
raise NotImplementedError
def se... | wichovw/tca-gt | server/tca/cellaut.py | Python | mit | 2,703 |
import pytest
import numpy as np
from qtpy import QtWidgets
from echo.core import CallbackProperty
from echo.selection import SelectionCallbackProperty, ChoiceSeparator
from echo.qt.connect import connect_combo_selection
class Example(object):
a = SelectionCallbackProperty(default_index=1)
b = CallbackPrope... | glue-viz/echo | echo/qt/tests/test_connect_combo_selection.py | Python | mit | 3,424 |
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import re
import sys
import os
from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style
from .winterm import WinTerm, WinColor, WinStyle
from .win32 import windll, winapi_test
winterm = None
if windll is not None:
winterm = WinT... | croxis/SpaceDrive | spacedrive/renderpipeline/rplibs/colorama/ansitowin32.py | Python | mit | 9,904 |
from unittest2 import TestCase, main
from hadafuna.core.game import KoikoiGame
class KoikoiGameTest(TestCase):
pass
if __name__ == '__main__':
main(verbosity=2)
| jimmynl/hadafuna | tests/core/test_game.py | Python | mit | 174 |
# Online training of a logistic regression model
# using Assumed Density Filtering (ADF).
# We compare the ADF result with MCMC sampling
# of the posterior distribution
# Dependencies:
# !pip install git+https://github.com/blackjax-devs/blackjax.git
# !pip install jax_cosmo
# Author: Gerardo Durán-Martín (@gerdm)... | probml/pyprobml | scripts/dummy.py | Python | mit | 6,950 |
def firstCharacter(str):
return str[:1]
assert(firstCharacter("abc") is "a")
def lastCharacter(str):
return str[-1:]
assert(lastCharacter("abc") is "c")
def middleCharacters(str):
return str[1:-1]
assert(middleCharacters("abc") == "b")
assert(middleCharacters("abcde") == "bcd")
def isPalindrome(str... | iandmyhand/python-utils | DataStructuresAndAlgorithmsInPython/Palindrome.py | Python | mit | 595 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-16 14:10
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... | bugness/ask-and-answer | qa/migrations/0001_initial.py | Python | mit | 1,214 |
'''
The MIT License (MIT)
Copyright (c) 2015 Dan Gunter
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, p... | dgunter/scapytojson | examples/basic_sniff.py | Python | mit | 1,348 |
#!/usr/bin/envpython
#-*- coding: utf-8 -*-
"""
Sananmuunnos: Transforming Finnish spoonerisms made easy (and systematic).
"""
__author__ = "Tuukka Ojala"
__email__ = "tuukka.ojala@gmail.com"
__version__ = "2015.0918"
__license__ = "MIT"
import re
#Regular expressions for detecting different types of sananmuunnose... | tuukkao/sananmuunnos | sananmuunnos.py | Python | mit | 4,465 |
from knowledgebase.models import ArticleCategory
def transform_category(value):
try:
return ArticleCategory.objects.get(name=value)
except ArticleCategory.DoesNotExist:
raise ValueError("Could not find category with name: %s" % value)
def transform_preferred_signpost(value):
value_normal... | ministryofjustice/cla_backend | cla_backend/apps/knowledgebase/utils/csv_user_import_mappings.py | Python | mit | 1,900 |
'''
Created on 15 Aug 2016
@author: sennikta
'''
import os
from os import listdir
import numpy
import json
import operator
from operator import itemgetter
from itertools import islice
import math
import dis
from itertools import islice
# TODO: try Livenstein distance,
base_dir = os.path.dirname(o... | tsennikova/scientists-analysis | clustering/u-shapelets_clustering.py | Python | mit | 10,783 |
from unittest import TestCase
import os
import json
class TestResponseObjectFactory(TestCase):
def setUp(self):
from slackly import SlackAPIDictResponse, SlackAPIObjectResponse
from slackly.schema.types import List
self.list = List
self.dict_response = SlackAPIDictResponse
... | huntcsg/slackly | tests/unit_tests/client/test_response_factory.py | Python | mit | 3,632 |
from flask import Flask, request
import sendgrid
import json
import requests
import os
app = Flask(__name__)
SENDGRID_USER = os.getenv('SENDGRID_USER')
SENDGRID_PASS = os.getenv('SENDGRID_PASS')
ONENOTE_TOKEN = os.getenv('ONENOTE_TOKEN')
# Make the WSGI interface available at the top level so wfastcgi can get it.
wsg... | thinkingserious/sendgrid-onenote | app.py | Python | mit | 2,377 |
# The MIT License (MIT)
# Copyright (c) 2014-2015 CNRS
# 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, m... | camomile-project/camomile-client-python | example/populate.py | Python | mit | 3,552 |
#!/usr/bin/python
import json
from random import randint
INPUT = "Tweet.size1000page1cnt849.json"
OUTPUT = 'new.json'
objs = json.load(open(INPUT,'r'))
print len(objs)
# for k,v in objs[0].items():
# print "%s=\n\t%s | " % (str(k),str(v))
def date_handler(obj):
import datetime
return obj.strftime("%Y-... | tedsunnyday/Tweet2DowJones | json/dev/gen.py | Python | mit | 683 |
"""
Multiple stacked lstm implemeation on the lip movement data.
Akm Ashiquzzaman
13101002@uap-bd.edu
Fall 2016
"""
from __future__ import print_function
import numpy as np
np.random.seed(1337)
#random seed fixing for reproducibility
#data load & preprocessing
X_train = np.load('../data/videopart43.npy').astype('fl... | zamanashiq3/code-DNN | time_dis_cnn.py | Python | mit | 2,449 |
# coding=utf8
from flask import Blueprint
main = Blueprint('main', __name__)
from . import views, errors
| OSorce/writeboard | writeboard/main/__init__.py | Python | mit | 106 |
"""
WSGI config for django_tutorial 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.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJA... | delainewendling/django_vue_tutorial | django_tutorial/wsgi.py | Python | mit | 408 |
# This example requires the 'message_content' privileged intent to function.
from typing import List
from discord.ext import commands
import discord
# Defines a custom button that contains the logic of the game.
# The ['TicTacToe'] bit is for type hinting purposes to tell your IDE or linter
# what the type of `self.v... | Rapptz/discord.py | examples/views/tic_tac_toe.py | Python | mit | 4,633 |
import json
import routing
from werkzeug.local import LocalProxy
from flask import Blueprint, request, current_app
blueprint = Blueprint('journal-api', __name__)
logging = LocalProxy(lambda: current_app.config['logging'])
@blueprint.errorhandler(404)
def return_404(e):
return {
'err': 'Page not found.'
},... | mrcrilly/Journal | journal/api.py | Python | mit | 1,370 |
# -*- coding: utf8 -*-
from time import time
from threading import Lock
from functools import wraps
STATE_CLOSED = "closed"
STATE_OPEN = "open"
STATE_HALF_OPEN = "half-open"
def get_now():
return int(time())
class CircuitBreakerError(Exception):
pass
class TooManyRequestsError(CircuitBreakerError):
... | xgfone/snippet | snippet/example/python/circuit_breaker.py | Python | mit | 8,647 |
#!/usr/bin/env python2
"""
submit.py
~~~~~~~~~
submit code to poj
usage:
./submit.py file_name
file_name format: probmenId_xxx.c/cpp
"""
import requests
import sys
import os
import time
from bs4 import BeautifulSoup
s = requests.Session()
try:
with open('./user') as fi:
user = fi.rea... | atupal/oj | ural/submit.py | Python | mit | 2,128 |
from django.urls import path
from . import views
urlpatterns = [
path('', views.events),
]
| fanout/django-eventstream | django_eventstream/urls.py | Python | mit | 96 |
# -*- coding: utf-8 -*-
"""
traceview.hosts
This module contains the objects associated with Hosts API resources.
http://dev.appneta.com/docs/api-v2/hosts.html
"""
from .resource import Resource
class Host(Resource):
def get(self, app=None):
if app:
path = 'app/{app}/hosts'.format(app=ap... | danriti/python-traceview | traceview/host.py | Python | mit | 688 |
from psycopg2 import InterfaceError
class CursorContextManager:
"""Instantiated once per :func:`~postgres.Postgres.get_cursor` call.
:param pool: see :mod:`psycopg2_pool`
:param bool autocommit: see :attr:`psycopg2:connection.autocommit`
:param bool readonly: see :attr:`psycopg2:connection.readonly`
... | gratipay/postgres.py | postgres/context_managers.py | Python | mit | 5,280 |
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
import tensorflow as tf
from keras.models import Model
from keras.layers import Dense, Input
from keras.callbacks import ModelCheckpoint
from resBlock import res_block_org
from data_r... | uqyge/combustionML | FPV_ANN_pureResNet/FPV_resnet_fullycoupled.py | Python | mit | 5,137 |
from django.conf.urls import url
from redisca.frontend import views
app_name = 'frontend'
urlpatterns = [
url(r'^$', views.template_list, name='template_list'),
url(r'^([a-zA-Z0-9_\./\-]+)$', views.static_template, name='template'),
]
| redisca/django-redisca | redisca/frontend/urls.py | Python | mit | 246 |
import json
import math
from common.matrix import Matrix
class SudokuDescr(object):
def __init__(self, matrix=None):
self.matrix = Matrix(matrix=matrix)
y_size = int(math.sqrt(self.matrix.shape[0]))
x_size = int(math.sqrt(self.matrix.shape[1]))
self._box_shape = (x_size, y_size)
... | zifter/nonogram | src/sudoku/sudoku_descr.py | Python | mit | 1,836 |
#!/usr/bin/env python3
"""
Copyright 2017 Ryan Wick (rrwick@gmail.com)
https://github.com/rrwick/Porechop
Porechop makes use of C++ functions which are compiled in cpp_functions.so. This module uses ctypes
to wrap them in similarly named Python functions.
This file is part of Porechop. Porechop is free software: you... | lfaino/LoReAn | code/align.py | Python | mit | 8,759 |
# Various functions for printing various specific values
# in human-readable format
import sys
import time
import pprint
# pretty print object
pp = pprint.PrettyPrinter(indent=4)
def pretty_print(value):
pp.pprint(value)
# print timedelta, provided in seconds,
# in human-readable format
def print_elapsed_tim... | budnyjj/vkstat | utils/print.py | Python | mit | 1,418 |
import _plotly_utils.basevalidators
class ColorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="colorsrc", parent_name="scattercarpet.marker", **kwargs
):
super(ColorsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_n... | plotly/plotly.py | packages/python/plotly/plotly/validators/scattercarpet/marker/_colorsrc.py | Python | mit | 423 |
#!/usr/bin/env python
#By: Guruprasad Ananda
"""
Fetch closest up/downstream interval from features corresponding to every interval in primary
usage: %prog primary_file features_file out_file direction
-1, --cols1=N,N,N,N: Columns for start, end, strand in first file
-2, --cols2=N,N,N,N: Columns for start, end... | volpino/Yeps-EURAC | tools/new_operations/flanking_features.py | Python | mit | 8,583 |
# twitter/functions.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
import tweepy
import wevote_functions.admin
from config.base import get_environment_variable
from exception.models import handle_exception
from wevote_functions.functions import positive_value_exists
logger = wevote_functions.admin.... | wevote/WeVoteServer | twitter/functions.py | Python | mit | 6,256 |
import commands
import weechat
def weechat_np(data, buffer, args):
read_track = commands.getoutput('deadbeef --nowplaying "%a - (%b) - %t [%@:BPS@bit / %@:BITRATE@kbps / %@:SAMPLERATE@Hz]"').split('\n')
weechat.command(buffer, '/me is currently listening to: ' + read_track[1])
return weechat.WEECHAT_RC_OK
... | mwgg/WeeChat-DeaDBeeF-np | deadbeef_np.py | Python | mit | 524 |
# coding: utf-8
__version__ = '0.1.0'
| Locu/djredis | djredis/__init__.py | Python | mit | 38 |
from Elements.STG.Base.IElementForStg import IElementForStg
class VisibleSpecifiedColumnElementForStg(IElementForStg):
def __init__(self, templates, settingsObject):
self.typeName = "Specified"
self.templateName = "SpecifiedVisibledColumn"
super(VisibleSpecifiedColumnElementForStg, self).__init__(templates, se... | afronski/grammar-generator | grammar-generator/Elements/STG/Visible/VisibleSpecifiedColumnElementForStg.py | Python | mit | 433 |
class TriangleMaking:
def maxPerimeter(self, a, b, c):
first = a
second = b
third = c
sides = [first, second, third]
for idx, side in enumerate(sides):
one = (idx + 1) % 3
two = (idx + 2) % 3
total = sides[one] + sides[two]
... | mikefeneley/topcoder | src/SRM-697/triangle_making.py | Python | mit | 423 |
print("This is a test")
answer = raw_input("Please give me an answer ")
print("Thank you " + answer)
def print_yes():
if answer == "yes":
print("YAS!")
else:
print("Hello World!")
print_yes()
kind_message = raw_input(answer + " you are a unique snowflake")
print(kind_message)
| engineeringbird/python_tests | test.py | Python | mit | 313 |
from django import template
from bookmarks.models import BookmarkInstance
from tagging.models import Tag
register = template.Library()
@register.inclusion_tag('bookmarks/tags.html')
def show_bookmarks_tags():
""" Show a box with tags for all articles that belong to current site.
"""
return {'bookmark_tags... | incuna/incuna-bookmarks | bookmarks/templatetags/bookmark_tags.py | Python | mit | 421 |
""" Capturing and analyzing the box information
Author: Lyu Yaopengfei
Date: 23-May-2016
"""
import cv2
import threading
import time
from PIL import Image
import Lego.dsOperation as dso
import Lego.imgPreprocessing as imgprep
from Lego.ocr import tesserOcr
capImg = None
resImg = None
stopFlat = 0
lock = ... | sotondriver/Lego_classification | src/boxCap.py | Python | mit | 6,567 |
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
__version__ = (1, 0) | shiroyuki/passerine | passerine/__init__.py | Python | mit | 96 |
"""
vimenv.py
Vim-specific environment helpers. This module uses git and pathogen to manage
vim plugins.
"""
from collections import namedtuple
from os import path, makedirs, walk, chdir, getcwd
from urllib import urlretrieve
from subprocess import check_call
VimPlugin = namedtuple('VimPlugin', ['find_file', 'frien... | GitOnUp/environs | vimenv.py | Python | mit | 2,178 |
#!/usr/bin/env python
#-*-coding:utf-8-*-
'''
Starting with the number 1 and moving to the right
in a clockwise direction a 5 by 5 spiral is formed as follows:
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13
It can be verified that the sum of the numbers on the diagonals is 101.
What is th... | smrmkt/project_euler | problem_029.py | Python | mit | 657 |
""" Simple implementation of mutinomial Naive Bayes for text classfification.
TODO: Apply to 20 Newsgroups, Reuters-21578 datasets
"""
__author__ = 'Duong Nguyen'
__version__ = '0.0'
import math
import sys
from collections import defaultdict
class NaiveBayes(object):
""" Multinomial Naive Bayes"""
def... | ntduong/ML | Misc/naivebayes.py | Python | mit | 2,081 |
# -*- coding: utf-8 -*-
"""
Helper classes.
"""
"""
Pynu - Python Node Utilities
Copyright (c) 2014 Juho Vepsäläinen
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
... | bebraw/pynu | pynu/node.py | Python | mit | 10,922 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2010 Prof. William H. Green (whgreen@mit.edu) and the
# RMG Team (rmg_dev@mit.edu)
#
# Permission is hereby granted, free of c... | comocheng/RMG-Py | rmgpy/rmg/input.py | Python | mit | 22,111 |
__version__ = '0.1.2'
| dashee87/cluster-flag | clusterflag/__init__.py | Python | mit | 23 |
import requests, json, logging
from lxml import html
from datetime import datetime
logger = logging.getLogger(__name__)
class EnphaseAPI:
API_BASE_URL = "https://api.enphaseenergy.com/api/v2/systems/{system_id}/{function}?key={key}&user_id={user_id}"
API_BASE_URL_INDEX = "https://api.enphaseenergy.com/api/v2/... | GreatLakesEnergy/sesh-dash-beta | seshdash/api/enphase.py | Python | mit | 6,147 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.