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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
Production Configurations
- Use djangosecure
- Use Amazon's S3 for storing static files and uploaded media
- Use mailgun to send emails
- Use Redis on Heroku
"""
from __future__ import absolute_import, unicode_literals
from boto.s3.connection import OrdinaryCallingFormat
from django.util... | mjj55409/cpq-exporter | config/settings/production.py | Python | mit | 7,354 |
from .base import * # TODO: import the relevant names instead of importing everything.
import cuda_convnet
import corrmm | dnouri/Lasagne | nntools/layers/__init__.py | Python | mit | 120 |
# 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.
# --------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/formrecognizer/azure-ai-formrecognizer/samples/v3.1/sample_recognize_business_cards.py | Python | mit | 5,129 |
from time import sleep
import os
import shutil
import merfi
from merfi import logger
from merfi import util
from merfi.collector import RepoCollector
from merfi.backends import base
class RpmSign(base.BaseBackend):
help_menu = 'rpm-sign handler for signing files'
_help = """
Signs files with rpm-sign. Crawls ... | alfredodeza/merfi | merfi/backends/rpm_sign.py | Python | mit | 5,502 |
# -*- coding: utf-8 -*-
import arrow
import datetime
import ujson
import timeit
from flask.ext.login import login_required
from flask import (
Blueprint, render_template
)
from feedback.dashboard.vendorsurveys import (
get_rating_scale, get_surveys_by_role,
get_surveys_by_completion, get_surveys_by_pur... | codeforamerica/mdc-feedback | feedback/dashboard/views.py | Python | mit | 18,098 |
import unittest
import requests
class TranslationTests(unittest.TestCase):
def setUp(self):
self.url = 'http://127.0.0.1/api/translate'
def test_given_words(self):
"""Should pass for the basic test cases provided"""
test_words = ['pig', 'banana', 'trash', 'happy', 'duck', 'glove',
... | chrswt/vicarious-microservice | tests/translation.py | Python | mit | 2,992 |
# encoding: utf-8
import datetime
__all__ = [
'info',
]
def info():
return {
'birthday': datetime.date(1992, 2, 10),
'class': 3,
'family_name_en': u'nakagawa',
'family_name_kana': u'なかがわ',
'first_name_en': u'haruka',
'first_name_kana'... | moriyoshi/pyakb48 | akb48/member/nakagawa_haruka.py | Python | mit | 655 |
<!DOCTYPE html>
<html lang="en" class="">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#">
<meta charset='utf-8'>
<link crossorigin="anonymous" href="https://assets-cdn.github.com/ass... | hjhjw1991/monkeyJ | monkey_playback.py | Python | mit | 50,743 |
'''
modified by Chongxuan Li (chongxuanli1991@gmail.com)
'''
import sys
sys.path.append('..')
sys.path.append('../../data/')
import os, numpy as np
import scipy.io as sio
import time
import anglepy as ap
import anglepy.paramgraphics as paramgraphics
import anglepy.ndict as ndict
import theano
import theano.tensor as... | zhenxuan00/mmdgm | mlp-mmdgm/gpulearn_z_x.py | Python | mit | 50,776 |
#!/bin/python3
import praw
import smtplib
import requests
import parsel
import re
import io
import json
import os
from email.header import Header
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from argparse import ArgumentParser
from premailer import Premailer
HEADERS = requests.... | thelostt/reddit-weekly | rewe.py | Python | mit | 5,215 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.forms import ModelForm, TextInput
from django.contrib import admin
from blog.models import Post
class PostAdmin(admin.ModelAdmin):
list_display = ['id', 'title', 'created', 'status']
list_filter = ('status', )
admin.site.register(... | pythonvlc/PyConES-2015 | pycones/blog/admin.py | Python | mit | 336 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | andrewyoung1991/scons | test/Configure/Streamer1.py | Python | mit | 2,529 |
import os
import inspect
import vcr
def build_path(function):
return os.path.join(os.path.dirname(inspect.getfile(function)),
'cassettes',
function.__module__.split('.')[1],
function.__name__ + '.yml')
vcr = vcr.config.VCR(
func_path_genera... | alfakini/python-mercadobitcoin | tests/__init__.py | Python | mit | 466 |
import os
class Config(object):
SPOTIPY_REDIRECT_URI = os.environ['SPOTIPY_REDIRECT_URI']
SPOTIPY_CLIENT_ID = os.environ['SPOTIPY_CLIENT_ID']
SPOTIPY_CLIENT_SECRET = os.environ['SPOTIPY_CLIENT_SECRET']
SPOTIFY_ACCESS_SCOPE = 'playlist-modify-public playlist-modify-private playlist-read-private user-lib... | jzimbel/artist-expander | config.py | Python | mit | 1,176 |
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Name: testStream.py
# Purpose: tests for stream.py
#
# Authors: Michael Scott Cuthbert
# Christopher Ariza
#
# Copyright: Copyright © 2009-2014 Michael Scott Cuthbert and the mu... | arnavd96/Cinemiezer | myvenv/lib/python3.4/site-packages/music21/test/testStream.py | Python | mit | 284,928 |
#Python 2.7
candidates = set([str(a * b) for a in range(100, 1000) for b in range(100, 1000)])
candidates = filter(lambda x: x == x[::-1], candidates)
print max([int(x) for x in candidates])
| dooleykh/ProjectEuler | 4.py | Python | mit | 192 |
# For building youtube_downloader on windows
from distutils.core import setup
import py2exe
# Define where you want youtube_downloader to be built to below
build_dir =
data_files = [('',['settings.ini',
'LICENSE',
'README.md']),
('sessions',[])]
options = {'py2exe... | sammypg/youtube_downloader | setup.py | Python | mit | 470 |
# @Author: dileep
# @Last Modified by: dileep
import random
import pytest
from microbial_ai.regulation import Event, Action, Memory
@pytest.fixture
def random_action():
return Action(type='fixed', phi={'rxn1': (random.random(), '+')})
@pytest.fixture
def random_event(random_action):
return Event(state=ra... | dileep-kishore/microbial-ai | tests/regulation/test_memory.py | Python | mit | 1,304 |
from .utils import do, do_ex, trace
from .version import meta
from os.path import abspath, realpath
FILES_COMMAND = 'git ls-files'
DEFAULT_DESCRIBE = 'git describe --dirty --tags --long --match *.*'
def parse(root, describe_command=DEFAULT_DESCRIBE):
real_root, _, ret = do_ex('git rev-parse --show-toplevel', ro... | esben/setuptools_scm | setuptools_scm/git.py | Python | mit | 1,196 |
import logging
import utils
import options
_Warning = logging.Warning
_Info = logging.Info
#//===========================================================================//
_site_setup = []
_user_setup = {}
_tools_setup = {}
_tools_post_setup = {}
def ResetSetup( site_setup = _site_setup,
us... | menify/sandbox | trunk/setup.py | Python | mit | 5,383 |
import os
from src.core import prep
from sgprocessor import *
def ProcessSg(p, opts):
if opts.anno == True:
if 'BEDDB' not in os.environ:
p.error('$BEDDB Not Exist. See README')
str_path_sgfq = opts.sg
str_nm = os.path.basename(os.path.splitext(opts.sg)[0])
str_proj = 'aux'
str_... | bm2-lab/cage | src/core/sg/interface_sg.py | Python | mit | 2,004 |
import pandas as pd
import numpy as np
from dateutil.relativedelta import relativedelta
#### Utilities
def get_first_visit_date(data_patient):
''' Determines the first visit for a given patient'''
#IDEA Could be parallelized in Dask
data_patient['first_visit_date'] = min(data_patient.visit_date)
retur... | grlurton/hiv_retention_metrics | src/models/cohort_analysis_function.py | Python | mit | 4,874 |
import os
import sys
from Bio.Seq import Seq
def main(*args, **kwargs):
fpath = os.path.join(os.getcwd(), args[-2])
tmp = []
with open(fpath,'r') as f:
for line in f:
txt = line.strip()
tmp.append(txt)
S1 = set(tmp)
S2 = set([str(Seq(s).reverse_complement()) for s ... | crf1111/Bio-Informatics-Learning | Bio-StrongHold/src/Constructing_a_De_Bruijn_Graph.py | Python | mit | 685 |
# quick_info/models.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
# Diagrams here: https://docs.google.com/drawings/d/1fEs_f2-4Du9knJ8FXn6PQ2BcmXL4zSkMYh-cp75EeLE/edit
from ballot.models import OFFICE, CANDIDATE, POLITICIAN, MEASURE, KIND_OF_BALLOT_ITEM_CHOICES
from django.db import models
from exce... | wevote/WeVoteServer | quick_info/models.py | Python | mit | 40,696 |
# anchorGenerator
from models.anchor import *
# main function
if __name__=='__main__':
# TEMP: Wipe existing anchors
# anchors = Anchor.all(size=1000)
# Anchor.delete_all(anchors)
# THIS IS TEMPORARY:
anchors = {'Vaccination', 'Vaccinations', 'Vaccine', 'Vaccines', 'Inoculation', 'Immunization', 'Shot', 'Chicken... | ControCurator/controcurator | python_code/anchorGenerator.py | Python | mit | 1,229 |
from bs4 import BeautifulSoup
import httplib, codecs, datetime
import cPickle as pickle
import time
def stan_tag(criteria, server):
tagged = []
file_count = 47
for ix, c in enumerate(criteria[2250000:]):
# initialize list of sentences
sents = []
try:
# send text to serv... | jasonost/clinicaltrials | trial_criteria/StanfordPOStagging.py | Python | mit | 1,663 |
# 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/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_07_01/models/__init__.py | Python | mit | 10,249 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# author: J.Y Han
# start
# spawn-fcgi -d /users/hanjiyun/project/geeksoho -f /users/hanjiyun/project/geeksoho/application.py -a 127.0.0.1 -p 9001
#stop
# kill `pgrep -f "/users/hanjiyun/project/geeksoho/application.py"`
import os
import web
import rediswebpy
from web.... | naoyeye/geeksoho | application.py | Python | mit | 1,969 |
# --------------------------------------------------------------------------------------------
# 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/monitor/tests/latest/test_monitor_log_analytics_cluster.py | Python | mit | 3,370 |
import factory
from dominion.games.models import Game
class GameFactory(factory.django.DjangoModelFactory):
class Meta:
model = Game
| jlward/dominion | dominion/games/factories.py | Python | mit | 148 |
from django.core.management.base import BaseCommand
from aspc.courses.models import Schedule
from datetime import datetime, timedelta
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template
from django.template import Context
from aspc.settings import EMAIL_HOST_USER
# Assum... | aspc/mainsite | aspc/courses/management/commands/solicit_reviews.py | Python | mit | 1,761 |
"""
The utility module.
"""
import traceback
def extract_traceback(exception):
"""
Utility function for extracting the traceback from an exception.
:param exception: The exception to extract the traceback from.
:return: The extracted traceback.
"""
return ''.join(traceback.format_tb(exceptio... | tylerlaberge/Jasper | jasper/utility.py | Python | mit | 341 |
"""
@name: Modules/Computer/Nodes/nodes.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2014-2030 by D. Brian Kimmel
@license: MIT License
@note: Created on Mar 6, 2014
@summary: This module does everything for nodes.
Nodes are read in from the config Xml file.
Then no... | DBrianKimmel/PyHouse | Project/src/Modules/Computer/Nodes/nodes.py | Python | mit | 3,171 |
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 14 15:30:11 2016
@author: worm_rig
"""
import json
import os
import tables
from tierpsy.analysis.compress.compressVideo import compressVideo, initMasksGroups
from tierpsy.analysis.compress.selectVideoReader import selectVideoReader
from tierpsy.helper.misc import TimeCo... | ver228/tierpsy-tracker | tierpsy/analysis/compress/processVideo.py | Python | mit | 5,963 |
import tensorflow as tf
import hyperchamber as hc
import hypergan as hg
import numpy as np
from hypergan.losses.least_squares_loss import LeastSquaresLoss
from hypergan.ops import TensorflowOps
from unittest.mock import MagicMock
from tests.mocks import mock_gan
loss_config = {'test': True, 'reduce':'reduce_mean', 'l... | 255BITS/HyperGAN | tests/losses/test_least_squares_loss.py | Python | mit | 966 |
class Kifu:
def __init__(self):
self.kifu = []
def add(self, from_x, from_y, to_x, to_y, promote, koma):
self.kifu.append((from_x, from_y, to_x, to_y, promote, koma))
def pop(self):
return self.kifu.pop()
| setokinto/slack-shogi | app/kifu.py | Python | mit | 255 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
desk_properties = ("search_bar", "notifications", "chat", "list_sidebar",
"bulk_actions", "view_switcher", "form_sideba... | saurabh6790/frappe | frappe/core/doctype/role/role.py | Python | mit | 2,874 |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 13 23:10:40 2016
@author: zhouyu
"""
#%%
import pandas as pd
import numpy as np
import os
import re
import nltk
from nltk.corpus import stopwords
from bs4 import BeautifulSoup
os.chdir('/Users/zhouyu/Documents/Zhou_Yu/DS/kaggle_challenge/text processing')
#%% step1: impor... | sadahanu/DataScience_SideProject | Stack_Exchange/py2_text.py | Python | mit | 7,689 |
# List of modules to import when celery starts.
# CELERY_IMPORTS = ('libcloud_sandbox.tasks.code_execute', )
# Result store settings.
CELERY_RESULT_BACKEND = 'database'
CELERY_RESULT_DBURI = 'sqlite:///mydatabase.db'
# Broker settings.
BROKER_TRANSPORT = 'sqlalchemy'
BROKER_HOST = 'sqlite:///tasks.db'
BROKER_PORT = 5... | texib/bitcoin-zoo | test/celeryconfig.py | Python | mit | 525 |
def add_without_op(x, y):
while y !=0:
carry = x & y
x = x ^ y
y = carry << 1
print(x)
def main():
x, y = map(int, input().split())
add_without_op(x, y)
if __name__ == "__main__":
main() | libchaos/algorithm-python | bit/add_with_op.py | Python | mit | 233 |
# -*- coding: UTF-8 -*-
__author__ = 'Sean Yu'
__mail__ = 'try.dash.now@gmail.com'
import sqlite3
def CreateTable(dbname, table,table_define):
db = sqlite3.connect(dbname)
cu=db.cursor()
cu.execute("""create table %s ( %s )"""%(table,table_define))
db.commit()
cu.close()
db.close()
def Insert... | try-dash-now/dash-ia | lib/Database.py | Python | mit | 1,885 |
import logging
from mwoauth import ConsumerToken, Handshaker, AccessToken
from mwoauth.errors import OAuthException
import urllib.parse
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import login, authenticate
from django.contrib.auth.models import User
from django.core.e... | WikipediaLibrary/TWLight | TWLight/users/oauth.py | Python | mit | 22,204 |
#!/usr/bin/env python
"""
@author: Tobias
"""
"""@brief List of register classes"""
_registerClasses = [
['al', 'ah', 'ax', 'eax', 'rax'],
['bl', 'bh', 'bx', 'ebx', 'rbx'],
['cl', 'ch', 'cx', 'ecx', 'rcx'],
['dl', 'dh', 'dx', 'edx', 'rdx'],
['bpl', 'bp', 'ebp', 'rbp'],
['dil', 'di', 'edi', 'rd... | anatolikalysch/VMAttack | lib/Register.py | Python | mit | 2,772 |
"""Remove brief status column
Revision ID: 590
Revises: 580
Create Date: 2016-03-03 14:56:59.218753
"""
# revision identifiers, used by Alembic.
revision = '590'
down_revision = '580'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.drop_column('briefs', 'status')
def downgrade():
op.add... | alphagov/digitalmarketplace-api | migrations/versions/590_remove_brief_status_column.py | Python | mit | 619 |
class Penguin(object):
def __init__(self, name, mood, id=None):
self.name = name
self.mood = mood
self.id = id
def __repr__(self):
return '< %s the %s penguin >' % (self.name, self.mood)
class Goose(object):
def __init__(self, name, favorite_penguin, id=None):
... | natb1/query-tools | tests/examples/fixture_model.py | Python | mit | 554 |
from unittest import TestCase
from firstinbattle.deck import Card
from firstinbattle.json_util import js
class TestJson(TestCase):
def test_encode_loads(self):
cards = {
Card(5, 'diamond'),
Card(9, 'heart'),
}
encoded_str = js.encode({
'message': 'test_... | mpharrigan/firstinbattle | firstinbattle/tests/test_json.py | Python | mit | 636 |
from collections import OrderedDict
n = int(input())
occurrences = OrderedDict()
for _ in range(0, n):
word = input().strip()
occurrences[word] = occurrences.get(word, 0) + 1
print(len(occurrences))
print(sep=' ', *[count for _, count in occurrences.items()])
| alexander-matsievsky/HackerRank | All_Domains/Python/Collections/word-order.py | Python | mit | 269 |
from distutils.core import setup
setup(
name = 'ical_dict',
packages = ['ical_dict'],
version = '0.2',
description = 'A Python library to convert an .ics file into a Dictionary object.',
author = 'Jay Ravaliya',
author_email = 'jayrav13@gmail.com',
url = 'https://github.com/jayrav13/ical_di... | jayrav13/ical_dict | setup.py | Python | mit | 497 |
import os, pygame
#create window of correct size (320x200, with some multiple)
x = 320
y = 200
size_mult = 4
bright_mult = 4
pygame.init()
os.environ['SDL_VIDEO_WINDOW_POS'] = str(0) + "," + str(40) #put window in consistent location
os.environ['SDL_VIDEO_WINDOW_POS'] = str(0) + "," + str(40) #put window in consisten... | delMar43/wcmodtoolsources | WC1_clone/room_engine/win_init.py | Python | mit | 424 |
from twisted.internet import defer
from nodeset.common import log
from nodeset.core import config
class Observer(object):
def __init__(self, callable, *args, **kwargs):
self.callable = callable
self.args = args
self.kwargs = kwargs
#print "-- %s, %s" % (self.args, se... | selfsk/nodeset.core | src/nodeset/core/observer.py | Python | mit | 1,039 |
# 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/v2018_01_01/operations/_local_network_gateways_operations.py | Python | mit | 27,633 |
# check_full_toc.py - Unit tests for SWIG-based libcueify full TOC APIs
#
# Copyright (c) 2011 Ian Jacobi <pipian@pipian.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
# rest... | pipian/libcueify | tests/swig/check_full_toc.py | Python | mit | 8,463 |
from __future__ import absolute_import, unicode_literals
from qproject.celery import app as celery_app
__all__ = ['celery_app']
| KirovVerst/qproject | qproject/__init__.py | Python | mit | 130 |
# range_ex.py Test of asynchronous mqtt client with clean session False.
# Extended version publishes SSID
# (C) Copyright Peter Hinch 2017-2019.
# Released under the MIT licence.
# Public brokers https://github.com/mqtt/mqtt.github.io/wiki/public_brokers
# This demo is for wireless range tests. If OOR the red LED wi... | peterhinch/micropython-mqtt | mqtt_as/range_ex.py | Python | mit | 2,773 |
import subprocess
import os
def start_service():
subprocess.Popen("ipy start_srv.py", stdout=subprocess.PIPE)
return 0
def close_service():
os.system("taskkill /im ipy.exe /f")
| QuentinJi/pyuiautomation | initial_work.py | Python | mit | 193 |
from openslides.core.config import config
from openslides.motions.exceptions import WorkflowError
from openslides.motions.models import Motion, State, Workflow
from openslides.users.models import User
from openslides.utils.test import TestCase
class ModelTest(TestCase):
def setUp(self):
self.motion = Moti... | rolandgeider/OpenSlides | tests/old/motions/test_models.py | Python | mit | 7,023 |
>>> myTuple = (1, 2, 3)
>>> myTuple[1]
2
>>> myTuple[1:3]
(2, 3)
| schmit/intro-python-course | lectures/code/tuples_basics.py | Python | mit | 65 |
# -*- coding: utf-8 -*-
"""
eve.methods.post
~~~~~~~~~~~~~~~~
This module imlements the POST method, supported by the resources
endopints.
:copyright: (c) 2015 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
from datetime import datetime
from flask import current_app as a... | Hearen/OnceServer | Server/Eve/post.py | Python | mit | 12,002 |
# coding: utf-8
from __future__ import unicode_literals
# created by: Han Feng (https://github.com/hanx11)
import collections
import hashlib
import logging
import requests
from wxpy.api.messages import Message
from wxpy.ext.talk_bot_utils import get_context_user_id, next_topic
from wxpy.utils.misc import get_text_wi... | youfou/wxpy | wxpy/ext/xiaoi.py | Python | mit | 3,546 |
# encoding: utf-8
# Copyright 2013 maker
# License
"""
Sales module URLs
"""
from django.conf.urls.defaults import *
urlpatterns = patterns('maker.sales.views',
url(r'^(\.(?P<response_format>\w+))?$', 'index', name='sales'),
url(r'^index(\.(?P<response_format>\w+))?/?$', 'index', name='sales_index... | alejo8591/maker | sales/urls.py | Python | mit | 7,456 |
#!/usr/bin/env python
# Convert line elements with overlapping endpoints into polylines in an
# SVG file.
import os
import sys
try:
from lxml import etree
except ImportError:
import xml.etree.ElementTree as etree
from collections import defaultdict
from optparse import OptionParser
SVG_NS = 'http://www.w... | johnnovak/polylinize.py | polylinize.py | Python | mit | 6,224 |
# -*- coding: UTF-8 -*-
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns = [
url(r'^', include('symcon.urls')),
url(r'^pages/', include('django.contrib.flatpages.urls')),
url(r'^admin/', include(admin.... | lociii/symcon-index | heroku/urls.py | Python | mit | 376 |
from django.contrib import admin
from django.contrib.auth.models import User
from .models import Stock, StockHistory, StockSelection, SectorHistory, StockNews
class CommonAdmin(admin.ModelAdmin):
date_hierarchy = 'pub_date'
class SectorAdmin(CommonAdmin):
list_display = ('Symbol', 'Sector', 'pub_date')
s... | yuxiang-zhou/MarketAnalysor | MADjangoProject/market/admin.py | Python | mit | 1,065 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-02-11 08:02
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('multiexplorer', '0006_pullhistory'),
]
operations = [
... | priestc/MultiExplorer | multiexplorer/multiexplorer/migrations/0007_auto_20170211_0802.py | Python | mit | 967 |
"""
Jump Search
Find an element in a sorted array.
"""
import math
def jump_search(arr,target):
"""
Worst-case Complexity: O(√n) (root(n))
All items in list must be sorted like binary search
Find block that contains target value and search it linearly in that block
It returns a first target valu... | keon/algorithms | algorithms/search/jump_search.py | Python | mit | 1,064 |
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
from __future__ import division,print_function,absolute_import,unicode_literals
import sys
import os
os.chdir(sys.path[0])
sys.path.append('/mnt/sda2/github/TSF1KEV/TSFpy')
from TSF_io import *
#from TSF_Forth import *
from TSF_shuffle import *
from TSF_match import *
fro... | ooblog/TSF1KEV | TSFpy/debug/sample_help.py | Python | mit | 2,181 |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.biz/status_available
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.parser import parse as t... | huyphan/pyyawhois | test/record/parser/test_response_whois_biz_status_available.py | Python | mit | 1,928 |
"""
Redis Blueprint
===============
**Fabric environment:**
.. code-block:: yaml
blueprints:
- blues.redis
settings:
redis:
# bind: 0.0.0.0 # Set the bind address specifically (Default: 127.0.0.1)
"""
import re
from fabric.decorators import task
from fabric.utils import abort
from ref... | 5monkeys/blues | blues/redis.py | Python | mit | 1,983 |
# -*- coding: utf-8 -*-
import json
from flask import Flask
from flask import request
from flask import jsonify
import time
from psutil import net_io_counters
from asyncftp import __version__
import threading
from asyncftp.Logger import _LogFormatter
t = time.time()
net = net_io_counters()
formatter = _LogFormatter(co... | helloqiu/AsyncFTP | asyncftp/console/app.py | Python | mit | 2,207 |
import os
from celery import Celery
from django.apps import apps, AppConfig
from django.conf import settings
if not settings.configured:
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.local') # pragma: no cover
app = Cele... | savioabuga/lipame | lipame/taskapp/celery.py | Python | mit | 903 |
from src.interfacing.ogs.connect import Authentication
import codecs
import sys
import os
from time import sleep
def loadList(pNameFile):
iList = []
with codecs.open(pNameFile, "r", "utf-8") as f:
for line in f:
iList.append(line)
return iList
if __name__ == "__main__":
a = ... | juanchodepisa/sbtk | SBTK_League_Helper/update_tournaments.py | Python | mit | 6,552 |
"""
Helper module for Python version 3.0 and above
- Ordered dictionaries
- Encoding/decoding urls
- Unicode/Bytes (for sending/receiving data from/to socket, base64)
- Exception handling (except Exception as e)
"""
import base64
from urllib.parse import unquote, quote
from collections import OrderedDict
def modulen... | martomo/SublimeTextXdebug | xdebug/helper/helper.py | Python | mit | 1,497 |
# -*- coding: utf-8 -*-
"""
Created on 27/04/2015
@author: C&C - HardSoft
"""
from util.HOFs import *
from util.CobolPatterns import *
from util.homogenize import Homogenize
def calc_length(copy):
if isinstance(copy, list):
book = copy
else:
if isinstance(copy, str):
book = ... | flavio-casacurta/File-FixedS | calc_length.py | Python | mit | 3,848 |
from threading import local
from django.contrib.sites.models import Site
import os
_locals = local()
def get_current_request():
return getattr(_locals, 'request', None)
def get_current_site():
request = get_current_request()
host = request.get_host()
try:
return Site.objects.get(domain__iexa... | sergio-garcia/learning-django | polls/middleware.py | Python | mit | 492 |
# 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-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/generate_arm_template_request.py | Python | mit | 1,873 |
# -*- coding: utf-8 -*-
import factory
from data.tests.factories import DepartmentFactory
from ..models import Tourist, TouristCard
class TouristFactory(factory.DjangoModelFactory):
class Meta:
model = Tourist
first_name = 'Dave'
last_name = 'Greel'
email = 'greel@musicians.com'
class To... | notfier/touristique | tourists/tests/factories.py | Python | mit | 524 |
__author__ = 'kjoseph'
import itertools
import Queue
from collections import defaultdict
from dependency_parse_object import DependencyParseObject, is_noun, is_verb
def get_parse(dp_objs):
term_map = {}
map_to_head = defaultdict(list)
for parse_object in dp_objs:
if parse_object.head > 0:
... | kennyjoseph/identity_extraction_pub | python/utility_code/dependency_parse_handlers.py | Python | mit | 6,421 |
""" Python's random module includes a function choice(data) that returns a
random element from a non-empty sequence. The random module includes
a more basic function randrange, with parametrization similar to
the built-in range function, that return a random choice from the given
range. Using only the randrange functio... | claudiordgz/GoodrichTamassiaGoldwasser | ch01/r112.py | Python | mit | 3,148 |
num = input("What is the numerator")
dem = input("What is the denominator")
counta = 2
countb = 2
def math (num,dem):
remainsa = 1
remainsb = 1
remains = remainsa - remainsb
while remains > 0:
a = num / counta
b = dem / countb
remainsa = num % counta
remainsb = num % c... | cheesyc/2014KStateProgrammingCompetitionAnswers | 2011/1A.py | Python | mit | 386 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-13 04:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rii_Api', '0001_initial'),
]
operations = [
migrations.AlterField(
... | SimonHerrera/rock-island-independents | api/rii_Api/migrations/0002_auto_20160912_2314.py | Python | mit | 1,025 |
"""Some classes to support import of data files
"""
import os, glob
import numpy
import time
try:
import ConfigParser as configparser #gets rename to lowercase in python 3
except:
import configparser
class _BaseDataFile(object):
"""
"""
def __init__(self, filepath):
"""
"""
... | peircej/PsychoEEG | psychoeeg/io.py | Python | mit | 3,894 |
__author__ = 'emre'
print "hello world" | ekutlu/raspberry-test | test.py | Python | mit | 40 |
import os
from flask import Flask, g, session, redirect, request, url_for, jsonify
from requests_oauthlib import OAuth2Session
OAUTH2_CLIENT_ID = os.environ['OAUTH2_CLIENT_ID']
OAUTH2_CLIENT_SECRET = os.environ['OAUTH2_CLIENT_SECRET']
OAUTH2_REDIRECT_URI = 'http://localhost:5000/callback'
API_BASE_URL = os.environ.ge... | vishnevskiy/discord-oauth2-example | app.py | Python | mit | 2,290 |
from MirrorAI.dataset.directional.label_image import label_image
import numpy
def test():
d = numpy.array([1, 1, 0])
answer = label_image(d, target=0)
solution = [0, 0, 1]
assert (answer == solution).all()
| yuhangwang/MirrorAI | test/dataset/directional/label_image/test_3.py | Python | mit | 224 |
#!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... | WorldLeadCurrency/WLC | contrib/pyminer/pyminer.py | Python | mit | 6,435 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-12-31 23:57
from __future__ import unicode_literals
import autoslug.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependenci... | eSmelser/SnookR | SnookR/substitutes/migrations/0001_initial.py | Python | mit | 2,900 |
import re
import logging
from google.appengine.ext import db
from google.appengine.api import users, memcache
from handler import Handler, SlashRedirect
from webapp2_extras.routes import RedirectRoute, PathPrefixRoute
import webapp2
from webapp2_extras.routes import RedirectRoute, PathPrefixRoute
import articles
impo... | nixhope/UdacityX | main.py | Python | mit | 2,047 |
from datetime import datetime
import time
import json
from Commit import Commit;
import Constant;
import collections
from yattag import Doc
def generateHTML(commits, projectName, commitData, fileExtensionMap):
totalAuthors = len(commitData)
generateBestAuthors(projectName, commitData)
generateFileByExtensi... | gzc/gitstats | v1/DataDriver.py | Python | mit | 6,238 |
"""
Django settings for gnucash_explorer project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR... | peap/gnucash_explorer | gnucash_explorer/settings.py | Python | mit | 2,089 |
import sublime
from . import SblmCmmnFnctns
class Spinner:
SYMBOLS_ROW = u'←↑→↓'
SYMBOLS_BOX = u'⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏'
def __init__(self, symbols, view, startStr, endStr):
self.symbols = symbols
self.length = len(symbols)
self.position = 0
self.stopFlag = False
self.view = view
self.startStr = startStr
self.... | rusiv/BSScript | bsscript/bsscriptSblm/Spinner.py | Python | mit | 784 |
from django.conf.urls import url
from sms import views
app_name = 'sms'
urlpatterns = [
url(r'^$', views.index, name="index"),
]
| RobSpectre/garfield | garfield/sms/urls.py | Python | mit | 135 |
f = open('input.txt')
triangles = [map(int,l.split()) for l in f.readlines()]
possible = 0
for t in triangles:
t.sort()
if t[0] + t[1] > t[2]:
possible += 1
print(possible)
| pwicks86/adventofcode2016 | day03/p1.py | Python | mit | 190 |
import asyncio
import sys
import config
import sender
import receiver
print(sys.argv)
async def receiveMessageFromSerial():
return "Message"
def help():
print('Luiza 1.0 - (luiza.santost@hotmail.com)')
print('Usage: python3 app.py [Options][Message][source][dest]')
print('')
print('SENDING MESSAG... | gohackfelipe/luiza | luiza.py | Python | mit | 1,285 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Testing module from creating product using
http://www.sendfromchina.com/default/index/webservice
"""
from flask import Flask, render_template, request
from flask_wtf.csrf import CSRFProtect
from werkzeug.datastructures import MultiDict
from forms import SFCCreateO... | dremdem/sfc_sdk | sfc_main.py | Python | mit | 4,144 |
'''
# Runtime:
python 2.7.3 (win)
# Result:
0
1
<...>
998
boom
'''
def f(n):
print n
f(n+1)
try:
f(0)
except:
print 'boom' | SnowOnion/CodeForcesLee | dp/testStackDepth.py | Python | mit | 146 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# name: test_parsable.py
# author: Harold Bradley III
# email: harold@bradleystudio.net
# created on: 01/16/2016
#
# pylint: disable=invalid-name,no-member
"""
A unit test for ext_pylib file module's Parsable mixin class.
... | hbradleyiii/ext_pylib | tests/files/test_parsable.py | Python | mit | 2,936 |
#!/usr/bin/python
# coding=utf-8
import sys
base_url = sys.argv[0]
addon_handle = int(sys.argv[1])
import xbmcplugin
xbmcplugin.setContent(addon_handle, 'episodes')
import urlparse
args = urlparse.parse_qs(sys.argv[2][1:])
mode = args.get('mode', None)
from urllib import FancyURLopener, urlencode
class URLOpener(Fa... | israellevin/plugin.video.walla | addon.py | Python | mit | 2,152 |
import operator
import ply.lex as lex
from jpp.parser.operation import Operation
from jpp.parser.expression import SimpleExpression
reserved = {
'extends': 'EXTENDS',
'import': 'IMPORT',
'local': 'LOCAL',
'imported': 'IMPORTED',
'user_input': 'USER_INPUT',
}
NAME_TOK = 'NAME'
tokens = [
'IN... | asherbar/json-plus-plus | jpp/parser/lex.py | Python | mit | 2,482 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib import auth
admin.autodiscover()
urlpatterns = patterns('stepup.views',
# Examples:
# url(r'^$', 'volunteer.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
#auth
url(r'^ad... | jrouly/stepup | stepup/settings/urls.py | Python | mit | 1,653 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This program collects Portugal weather forecasts from IPMA and uploads them to the Orion Context Broker.
It uploads the list of stations on the fly from
- http://api.ipma.pt/json/locations.json.
Legal notes:
- http://www.ipma.pt/en/siteinfo/in... | Fiware/dataModels | specs/Weather/WeatherForecast/harvesters/portugal/portugal_weather_forecast.py | Python | mit | 21,328 |