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 |
|---|---|---|---|---|---|
"""Redis client protocol
We have own redis wrapper because redis-py does not support python3. We also
don't want another dependency
"""
import socket
def encode_command(buf, parts):
add = buf.extend
add(('*%d\r\n' % len(parts)).encode('ascii'))
for part in parts:
if isinstance(part, str):
... | tailhook/zerogw | examples/tabbedchat/tabbedchat/redis.py | Python | mit | 2,974 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# bitk3 documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# 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
# autog... | daviortega/bitk3 | docs/conf.py | Python | mit | 8,433 |
from config import *
class Keyboard:
def __init__(self):
self.keys = None
self.left = pygame.K_LEFT
self.right = pygame.K_RIGHT
self.jump = pygame.K_UP
self.hit_left = pygame.K_a
self.hit_right = pygame.K_d
self.hit_up = pygame.K_w
if GCW_ZERO:
... | cxong/Slappa | keyboard.py | Python | mit | 1,293 |
#!/usr/bin/env python
'''
Lucas-Kanade tracker
====================
Lucas-Kanade sparse optical flow demo. Uses goodFeaturesToTrack
for track initialization and back-tracking for match verification
between frames.
Usage
-----
lk_track.py [<video_source>]
Keys
----
ESC - exit
'''
# Python 2/3 compatibility
from __... | lkumar93/Deep_Learning_Crazyflie | src/deep_learning_crazyflie/src/lk_track.py | Python | mit | 5,660 |
from django.conf.urls import url
from django.contrib import admin
from UserManagement import views
from django.contrib.auth import views as auth_views
app_name = 'UserManagement'
urlpatterns = [
url(r'^register$', views.register, name="register"),
url(r'^login$', views.login, name='login'),
url(r'^logout_us... | Piotr95/Yummy_Pies | UserManagement/urls.py | Python | mit | 359 |
#!/usr/bin/env python
import argparse
import sys
import time
import traceback
from jira.client import JIRA
from jira.exceptions import JIRAError
from fogbugz import FogBugz
from fogbugz import FogBugzLogonError, FogBugzConnectionError
RECENTLY_ADDED_CASES = {}
FOGBUGZ_FIELDS = ('ixBug,ixPersonAssignedTo,ixPersonEdite... | iserko/jira2fogbugz | src/jira2fogbugz/__init__.py | Python | mit | 8,941 |
"""
SoftLayer.tests.managers.ipsec_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
from mock import MagicMock
import SoftLayer
from SoftLayer.exceptions import SoftLayerAPIError
from SoftLayer import testing
class IPSECTests(testing.TestCase):
def set_up(s... | nanjj/softlayer-python | tests/managers/ipsec_tests.py | Python | mit | 15,462 |
"""
@author: Maneesh D
@email: maneeshd77@gmail.com
@date: 25/6/17
Worst Case Analysis: Bubble Sort -> O(n^2)
"""
from timeit import Timer, default_timer
def bubble_sort(data):
"""Bubble Sort implementation"""
n = len(data)
for i in range(n):
swapped = False
for j in range(0, n-i-1):
... | maneeshd/Algorithms-and-Data-Structures | algorithms/BubbleSort.py | Python | mit | 953 |
# coding: utf-8
__author__ = 'mhaze'
| mhaze4/jquery-textflow | django-textflow/textflow/templatetags/__init__.py | Python | mit | 37 |
from setuptools import setup, find_packages
version = '5.4.0'
setup(
name="alerta-prometheus",
version=version,
description='Alerta plugin for Prometheus Alertmanager',
url='https://github.com/alerta/alerta-contrib',
license='MIT',
author='Nick Satterly',
author_email='nick.satterly@thegu... | alerta/alerta-contrib | plugins/prometheus/setup.py | Python | mit | 663 |
#!/usr/bin/env python3
"""
WEP cracking
Automation of MitM Attack on WiFi Networks
Bachelor's Thesis UIFS FIT VUT
Martin Vondracek
2016
#Implementation notes
- Airodump-ng writes its Text User Interface to stderr, stdout is empty.
- Airodump-ng has difficulties saving PRGA XOR based on some station vendors
`"that's... | mvondracek/wifimitm | wifimitm/wep.py | Python | mit | 24,467 |
"""Settings for django-measurement."""
from appconf import AppConf
from django.conf import settings
__all__ = ("settings",)
class DjangoMeasurementConf(AppConf):
"""Settings for django-measurement."""
BIDIMENSIONAL_SEPARATOR = "/"
"""
For measurement classes subclassing a BidimensionalMeasure, this ... | coddingtonbear/django-measurement | django_measurement/conf.py | Python | mit | 378 |
#!/usr/bin/env python
#
# Copyright 2006 Google Inc.
#
# 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 o... | tzuria/Shift-It-Easy | webApp/shift-it-easy-2015/web/pages/MainManager.py | Python | mit | 87,797 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import html
import bleach
import misaka
from configparser import NoOptionError
class Sanitizer(object):
def __init__(self, elements, attributes):
# attributes found in Sundown's HTML serializer [1]
# except for <img> tag,
... | jelmer/isso | isso/utils/html.py | Python | mit | 3,145 |
#!/usr/bin/env python
#
# Test a trip planner
import sys
import argparse
from importlib import import_module
import logging
from color_logging import ColoredFormatter
PROVIDER_CHOICES = ['otp', 'hpjp']
logger = logging.getLogger(__name__)
def setup_logging(options):
SUCCESS_LEVEL_NUM = 9
logging.addLevel... | plannerstack/testset | mmri/test_runner.py | Python | mit | 2,465 |
#!/usr/bin/env python
import sys
import time
import mpd
import os
import logging
import logging.handlers
from sqlite3 import Error as SqlError
from socket import error as SocketError
from socket import timeout as SocketTimeout
import dbase
import daemon
#-------------------------------------------
# Change the follo... | mjessome/mpsd | mpsd.py | Python | mit | 10,490 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_10_01/operations/express_route_circuit_authorizations_operations.py | Python | mit | 18,188 |
# -*- coding: utf-8 -*-
"""
State tracking functionality for django models
"""
import inspect
from collections import namedtuple
from functools import wraps
from django.db import models
from django.db.models.signals import class_prepared
from django.utils.functional import curry
from django_fsm.signals import pre_tran... | deis/django-fsm | django_fsm/__init__.py | Python | mit | 9,452 |
from django.urls import path
from . import views
urlpatterns = [
path('start-ga', views.StartGA.as_view()),
path('stop-ga', views.StopGA.as_view()),
path('check-ga', views.CheckGA.as_view()),
]
| seakers/daphne_brain | example_problem/explorer/urls.py | Python | mit | 208 |
import webbrowser
# Class
class Book():
""" This class provides Book information from the Golden Lion publisher. """
# Constructor
def __init__(self, book_title, book_summary, book_author, book_release_date, book_url):
# instance variables - relative to the instances
self.title = book_... | JiwonYeom/TIL | python/python-class.py | Python | mit | 629 |
#!/usr/bin/env python3
from __future__ import print_function
from __future__ import absolute_import
import os, click
import subprocess
from taw.util import *
from taw.taw import *
# commands/subcommands
# ==============
# SSH COMMAND
# ==============
@taw.command("ssh")
@click.argument('hostname', metavar='<host n... | mkasa/taw | taw/sshlike.py | Python | mit | 5,073 |
#coding: utf-8
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Log(models.Model):
title = models.CharField(max_length=255, default='', blank=True, null=True, verbose_name=u'标题')
content = models.CharField(max_length=255, default='', blank=True, null=True, ... | wxmgcs/devops | alarm/models.py | Python | mit | 987 |
"""
Module for YamlTemplateFieldBuilder
"""
__author__ = 'DWI'
class TemplateReader(object):
"""
Class for reading complete Templates from files.
"""
def __init__(self, template_field_builder):
self.field_builder = template_field_builder
def read(self, file_name):
"""
Re... | DanielWieczorek/FancyReadmeBuilder | src/data/template/TemplateReader.py | Python | mit | 1,108 |
# -*- coding: utf-8 -*-
import re
import copy
import random
import os, sys
import MySQLdb
import requests
from time import sleep
from threading import Thread
from bs4 import BeautifulSoup
reload(sys)
sys.setdefaultencoding('utf-8')
clade = 'http://dblp.uni-trier.de/db/conf/apweb/'
months = {
'January': '01',
... | dcclogin/TextGenerator | TitleCrawler/ccf_conference/categories/database/apweb2015.py | Python | mit | 3,395 |
#!/usr/local/bin/python2.7
from sys import exit, stdout, argv
from os import environ, system
environ['KERAS_BACKEND'] = 'tensorflow'
import numpy as np
import utils
import signal
from keras.layers import Input, Dense, Dropout, concatenate, LSTM, BatchNormalization, Conv1D, concatenate
from keras.models import Model ... | sidnarayanan/BAdNet | train/pf/adv/models/train_panda_3.py | Python | mit | 9,427 |
from office365.runtime.client_result import ClientResult
from office365.runtime.queries.service_operation_query import ServiceOperationQuery
from office365.sharepoint.base_entity import BaseEntity
from office365.sharepoint.types.resource_path import ResourcePath as SPResPath
class MoveCopyUtil(BaseEntity):
@stat... | vgrem/Office365-REST-Python-Client | office365/sharepoint/utilities/move_copy_util.py | Python | mit | 3,096 |
import functools
def memoize(obj):
cache = obj.cache = {}
@functools.wraps(obj)
def memoizer(*args, **kwargs):
key = (args, tuple(kwargs.items()))
if key not in cache:
cache[key] = obj(*args, **kwargs)
return cache[key]
return memoizer
| GaretJax/i18n-utils | i18n_utils/utils.py | Python | mit | 291 |
# 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/search/azure-mgmt-search/azure/mgmt/search/operations/_shared_private_link_resources_operations.py | Python | mit | 27,117 |
# future statements for Python 2 compatibility
from __future__ import (
unicode_literals, division, print_function, absolute_import)
# built in modules
import os
import sys
import datetime
# installed modules
import spacy
from unidecode import unidecode
# project modules
try:
import toolbox
import consta... | Jaymebb/MIE | MIE/UTILS/quickumls.py | Python | mit | 10,762 |
#!/usr/bin/python
# Copyright (c) 2014 Adafruit Industries, Dots.Connect
# Author: Tony DiCola, Tim Welch
# 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 witho... | twelch/weather-station | pi2/FireflyDHT.py | Python | mit | 2,827 |
class Solution(object):
def findLadders(self, beginWord, endWord, wordlist):
"""
:type beginWord: str
:type endWord: str
:type wordlist: Set[str]
:rtype: List[List[int]]
"""
# build the whole graph for the possible solution
graph,res={},[]
bwse... | Tanych/CodeTracking | 126-Word-Ladder-II/solution.py | Python | mit | 2,034 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import mock
from shim import SystemLoadMonitor, MonitorCheckFailure
class TestSystemLoadMonitor(unittest.TestCase):
def setUp(self):
self.monitor_id = "monitor_id"
self.monitor_options = {
'upper_threshold': 1.0,
}
... | maszczyn/shim | tests/test_system_load_monitor.py | Python | mit | 1,207 |
from django.contrib import admin
from tasks import models
admin.site.register(models.Project)
admin.site.register(models.Priority)
admin.site.register(models.TaskStatus)
admin.site.register(models.Phase)
admin.site.register(models.Task)
| jarnoln/mitasny | tasks/admin.py | Python | mit | 238 |
import json
import datetime
from django import forms, http
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.views import redirect_to_login
from django.conf import settings
from django.contrib import messages
from django.core.exceptions import PermissionDenied
from django.template import Con... | lambacck/simpleblog | simpleblog/blog/views.py | Python | mit | 4,533 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-19 10:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('deployments', '0001_initial'),
]
operations = [
migrations.AddField(
... | horizon-institute/chariot | src/app/deployments/migrations/0002_auto_20170419_1040.py | Python | mit | 2,022 |
from captcha.conf import settings
from captcha.helpers import captcha_image_url
from captcha.models import CaptchaStore
from django.http import HttpResponse, Http404
from django.shortcuts import get_object_or_404
import random
import re
import tempfile
import os
import subprocess
try:
from cStringIO import StringI... | viaregio/django-simple-captcha | captcha/views.py | Python | mit | 4,373 |
from django.test import TestCase
from django.db import DataError
from django.db import IntegrityError
from pizzaplace.models import PizzaPlace
class TestPizzaPlace(TestCase):
def setUp(self):
self.prince_street_pizza_url = 'https://www.yelp.com/biz/prince-st-pizza-new-york'
self.pizza_name1 = 'Such Pizza'... | nicole-a-tesla/meetup.pizza | pizzaplace/tests/test_pizza_place.py | Python | mit | 1,885 |
import sys, os, logging, warnings
from twisted.python import log as txlog
from scrapy import log, __version__, optional_features
from scrapy.utils.python import unicode_to_str
from sh_scrapy.hsref import hsref
# keep a global reference to stderr as it is redirected on log initialization
_stderr = sys.stderr
def _lo... | scrapinghub/scrapinghub-buildpack-scrapy | vendor/sh_scrapy/sh_scrapy/log.py | Python | mit | 5,397 |
from openpyxl import Workbook, load_workbook
xl = load_workbook(filename='./ipaddr.xlsx', data_only=True)
xs = xl.active
col_rang = xl['Sheet1']
cell_rang = xs['A1':'A2']
#print(col_rang['A'].value)
print ('Getting Data From :', xl.get_sheet_names())
for row in xs.iter_rows():
for cell in row:
iprecs = cel... | phasedscum/python-as-a-waffle | xcelip.py | Python | mit | 398 |
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
xl=pd.ExcelFile("mpd2018.xlsx")
dfr=xl.parse('rgdpnapc')
dfc=xl.parse('cgdppc')
dfp=xl.parse('pop')
dfc.columns=dfc.iloc[0]
dfr.columns=dfr.iloc[0]
dfp.columns=dfp.iloc[0]
dfc.drop(dfc.index[0], inplace=True)
dfr.drop(dfr.index[0], inplace=True)
dfp... | Enopoletus/enopoletus.github.io | mpdinteractiveboth.py | Python | mit | 1,878 |
import sys
import unittest
from curtsies.formatstring import (
FmtStr,
fmtstr,
Chunk,
linesplit,
normalize_slice,
width_aware_slice,
)
from curtsies.fmtfuncs import (
blue,
red,
green,
on_blue,
on_red,
on_green,
underline,
blink,
bold,
)
from curtsies.termform... | sebastinas/curtsies | tests/test_fmtstr.py | Python | mit | 23,147 |
'''This models is an example for training a classifier on SNLI'''
from __future__ import print_function
from os.path import join
import nltk
import numpy as np
import os
import urllib
import zipfile
import sys
from spodernet.hooks import AccuracyHook, LossHook, ETAHook
from spodernet.preprocessing.pipeline import Pip... | TimDettmers/spodernet | examples/snli_verbose.py | Python | mit | 10,703 |
from echo_client import clientmessage
import pytest
def test_ping():
assert clientmessage("this is a test") == "this is a test"
def test_big():
assert clientmessage("this is a string that is much longer than the 32 bites that it has to force it to loop") == "this is a string that is much longer than the 32 ... | Jakeand3rson/network_tools | test_echo.py | Python | mit | 414 |
"""
This plugin gives the power of Selenium to nosetests
by providing a WebDriver object for the tests to use.
"""
from nose.plugins import Plugin
from pyvirtualdisplay import Display
from seleniumbase.core import proxy_helper
from seleniumbase.fixtures import constants
class SeleniumBrowser(Plugin):
"""
The... | mdmintz/seleniumspot | seleniumbase/plugins/selenium_plugin.py | Python | mit | 7,978 |
import RPi.GPIO as io
io.setwarnings(False)
io.setmode(io.BCM)
class Device:
def __init__(self,config):
self.config = config
for device in self.config['gpioPINs']['unavailable']:
io.setup(int(device),io.OUT)
io.output(int(device),False)
for device in self.config['gpioPINs']['available']:
io.setup(int... | oehokie/brwry-python | device.py | Python | mit | 1,314 |
#!/usr/bin/env python
from setuptools.depends import get_module_constant
from setuptools import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name = 'detectlanguage',
packages = ['detectlanguage'],
version = get_module_constant('detectlanguage', '__version__'),
desc... | detectlanguage/detectlanguage-python | setup.py | Python | mit | 843 |
import pytest
from vk.users import UserCareer
def test_user_career(factory):
career_json = factory('user_career.json')['career'][0]
career = UserCareer.from_json(None, career_json)
assert isinstance(career, UserCareer)
assert career.group == 22822305
assert career.company is None
assert care... | sgaynetdinov/py-vkontakte | tests/test_user_career.py | Python | mit | 1,213 |
from django.conf.urls import patterns, url
from interviews.views import ElegibilityCertificateDetailView
__author__ = 'LBerrocal'
urlpatterns = patterns('',
url(r'^certificate/(?P<pk>[\d]+)/$', ElegibilityCertificateDetailView.as_view(), name='certificate-goal'),
) | luiscberrocal/homeworkpal | homeworkpal_project/interviews/urls.py | Python | mit | 313 |
# -*- coding: utf-8 -*-
from .api import *
from .db import *
from .runner import *
from .server import *
| canaryhealth/pyramid_test | pyramid_test/__init__.py | Python | mit | 106 |
from flipsyfat.cores.sd_emulator.linklayer import SDLinkLayer
from migen import *
from misoc.interconnect.csr import *
from misoc.interconnect.csr_eventmanager import *
from misoc.interconnect import wishbone
class SDEmulator(Module, AutoCSR):
"""Core for emulating SD card memory a block at a time,
with re... | scanlime/flipsyfat | flipsyfat/cores/sd_emulator/core.py | Python | mit | 4,333 |
import _plotly_utils.basevalidators
class SizesrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="sizesrc", parent_name="bar.hoverlabel.font", **kwargs
):
super(SizesrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=... | plotly/plotly.py | packages/python/plotly/plotly/validators/bar/hoverlabel/font/_sizesrc.py | Python | mit | 419 |
"""
meuh.commands.distro
~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import absolute_import, print_function, unicode_literals
__all__ = ['InitCommand',
'DestroyAllCommand',
'DestroyCommand',
'ShowCommand']
import logging
from cliff.command import Command
from meuh.action import ... | johnnoone/meuh-python | meuh/commands/distro.py | Python | mit | 2,649 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# This file is in the public domain
### END LICENSE
### DO NOT EDIT THIS FILE ###
__all__ = [
'project_path_not_found',
'get_data_file',
'get_data_path',
]
# Where your project will look for your data (for in... | Deluxo/sms | sms_quickly_lib/sms_quicklyconfig.py | Python | mit | 1,518 |
"""
WSGI config for happyowlweb 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_APPLICATIO... | haku86/happyowlweb | happyowlweb/happyowlweb/wsgi.py | Python | mit | 1,570 |
import psycopg2
import collections
import json
import sys
def consulta(query):
cursor.execute(query)
return cursor.fetchall()
def constroi_consulta_lista(lista_tabelas):
tabelas = ""
for tabela in lista_tabelas:
tabelas = tabelas + "'" + tabela + "',"
query = "SELECT distinct cl2.relname AS ref_table FROM ... | xandmaga/migracao_py-upsert | postgres-list-table.py | Python | mit | 6,300 |
#!python
# Collect for each region the list of players by league
# Strategy: we go through the list of all the known players and check their games
# As a starting list, we can take master/challenger players
import os
import multiprocessing
import time
import pickle
import sys
from pickle import PickleError
from Inte... | vingtfranc/LoLAnalyzer | PlayersListing.py | Python | mit | 14,631 |
class Solution(object):
def lastRemaining(self, n):
"""
:type n: int
:rtype: int
"""
# a = range(1, n+1)
s = 2
if n == 1:
s = 1
length = n
step = 2
tag = 2
while length/2 > 1:
# print length, s, step
i... | xingjian-f/Leetcode-solution | 390. Elimination Game.py | Python | mit | 696 |
#!/usr/bin/env python
#
# Given an array of elements, determine how many pair-swaps (minimum) are needed
# to get array in sorted ascending order.
#
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the minimumSwaps function below.
def minimumSwaps(arr):
swaps = 0
for i in ra... | jekhokie/scriptbox | python--learnings/coding-practice/swap_sort_array.py | Python | mit | 684 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2018_01_01/models/network_interface_association_py3.py | Python | mit | 1,345 |
"""
Class for reading and parsing Picard metrics files.
"""
import logging
import re
from bs4 import BeautifulSoup
logger = logging.getLogger(__name__)
class PicardMetricsFile(object):
"""
Parser to read tables of metrics generated by one of several Picard tools,
typically stored in an HTML file, and re... | BenaroyaResearch/bripipetools | bripipetools/io/picardmetrics.py | Python | mit | 5,099 |
import numpy as np
import astropy.units as u
import astropy.constants as con
import warnings
class VelocitySet(list):
def __init__(self,input):
if input is None:
self.ranges = []
elif hasattr(input,'__iter__'):
self.ranges=input
else:
self.ranges = [inpu... | low-sky/py-low-sky | intervals.py | Python | mit | 6,216 |
# -*- coding: utf-8 -*-
"""
flask_security.decorators
~~~~~~~~~~~~~~~~~~~~~~~~~
Flask-Security decorators module
:copyright: (c) 2012 by Matt Wright.
:license: MIT, see LICENSE for more details.
"""
from collections import namedtuple
from functools import wraps
from flask import Response, _reque... | inveniosoftware/flask-security-fork | flask_security/decorators.py | Python | mit | 4,832 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import json
import codecs
import scrapy
from collections import OrderedDict
from scrapy.pipelines.images import ImagesPipeline... | Justyer/KuaikanSpider | KuaikanSpider/KuaikanSpider/pipelines.py | Python | mit | 1,794 |
"""
Script to generate "labelled" data using random playouts
A lot of this can now be done with the RunExperiment scene
"""
from models.game import *
from models.data import DatabaseConnection as DB, GameDataModel
import timeit
def full_game_experiment(total_games, purge=10):
"""
Simulates many random... | zachdj/ultimate-tic-tac-toe | generate_data.py | Python | mit | 4,760 |
import sys
import os.path
sys.path.append(os.path.join(os.path.dirname(__file__), 'src'))
sys.path.append(os.path.join(os.path.dirname(__file__), 'lib'))
sys.path.append(os.path.join(os.path.dirname(__file__), 'lib/pip'))
# Workaround the dev-environment SSL:
# http://stackoverflow.com/q/16192916/893652
if os.envir... | Bekt/tweetement | appengine_config.py | Python | mit | 639 |
# -*- coding: utf-8 -*-
import pandas as pd
from itertools import izip
import numpy as np
import glob
from facebook import FacebookCompetition
print('Loading test data')
bids = pd.read_csv(FacebookCompetition.__data__['bids'])
test = pd.read_csv(FacebookCompetition.__data__['test'])
te = pd.merge(test, bids, how='lef... | ldamewood/kaggle | facebook/combine.py | Python | mit | 1,058 |
# coding=utf-8
from django.conf.urls import url, include
from rest_framework.urlpatterns import format_suffix_patterns
from . import views
urlpatterns = format_suffix_patterns([
url(r'pm25/(?P<city>\w+)/latest$', views.AirConditionViewSets.as_view({'get': 'list'}), name='pm25-list'),
url(r'pm25-avg/(?P<city>... | banbanchs/leda | api/urls.py | Python | mit | 412 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('lists', '0002_auto_20150301_1937'),
]
operations = [
migrations.AlterModelOptions(
... | imxiaohui/django-todolist-1 | lists/migrations/0003_auto_20150308_2120.py | Python | mit | 1,229 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('carts', '0006_auto_20150930_1739'),
('carts', '0005_auto_20151022_2158'),
]
operations = [
]
| abhijitbangera/ecommerce | src/carts/migrations/0007_merge.py | Python | mit | 293 |
#!/usr/bin/env python
"""
rpgtoolkit.py
Generate a random webpage from a config file.
Lots of gaming resources are simple variations on a theme. Here's a big list, choose a random thing from the list, and interpolate a bit using data from some other lists.
Here's how this program works: given a config file, figure o... | jmcguire/rpg-toolkit-website | rpgtoolkit.py | Python | mit | 4,134 |
try:
from importlib.metadata import version
except ImportError:
from importlib_metadata import version # type: ignore
from schwifty.bic import BIC
from schwifty.iban import IBAN
__all__ = ["IBAN", "BIC"]
__version__ = version(__name__)
| figo-connect/schwifty | schwifty/__init__.py | Python | mit | 248 |
"""Test main.py
"""
import os
import json
from unittest.mock import patch, Mock
from starlette.testclient import TestClient
from toolz.curried import pipe, curry
from fastapi import UploadFile
from click.testing import CliRunner
from boxsdk import JWTAuth
from main import app, get_auth, upload_to_box, get_config_fil... | wd15/chimad-phase-field | _apps/box/test.py | Python | mit | 3,449 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from mptt.admin import MPTTModelAdmin
from .models import Channel
from .forms import ChannelAdminForm
from opps.core.admin import PublishableAdmin
from opps.core.admin import apply_opps_rules
from opps.cor... | jeanmask/opps | opps/channels/admin.py | Python | mit | 3,690 |
import io
from django.core.management import call_command
from django.test.testcases import TestCase
from 臺灣言語服務.models import 訓練過渡格式
class KIPsu試驗(TestCase):
@classmethod
def setUpClass(cls):
with io.StringIO() as tshogoo:
call_command('教育部臺灣閩南語字詞頻調查工作', stderr=tshogoo)
prin... | sih4sing5hong5/hue7jip8 | 試驗/test教育部臺灣閩南語字詞頻調查工作.py | Python | mit | 539 |
from django import forms
from django.utils.safestring import mark_safe
import re
class RangeSlider(forms.TextInput):
def __init__(self, minimum, maximum, step, elem_name,*args,**kwargs):
widget = super(RangeSlider,self).__init__(*args,**kwargs)
self.minimum = str(minimum)
self.maximum = str... | shakle17/django_range_slider | test_slider/slider_app/widgets.py | Python | mit | 1,469 |
#!/usr/bin/env python
#
# Copyright (C) 2014 Narf Industries <info@narfindustries.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
# t... | f0rki/cb-multios | original-challenges/AIS-Lite/poller/for-release/machine.py | Python | mit | 5,236 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup, find_packages
import flowbee
here = os.path.abspath(os.path.dirname(__file__))
def strip_comments(l):
return l.strip()
# return l.split('#', 1)[0].strip()
def reqs(*f):
return list(filter(None, [strip_comm... | blitzagency/flowbee | setup.py | Python | mit | 1,607 |
from memqueue import MemQueue
import sys, time
import memcache
from optparse import OptionParser
client = ['127.0.0.1:11211']
queue = MemQueue('benchmark', memcache.Client(client))
start = time.time()
if __name__ == '__main__':
parser = OptionParser(usage="usage: %prog [options] filename",
version="%pro... | abhi-bit/memcache-queue | benchmark.py | Python | mit | 1,075 |
'''Compare LSTM implementations on the IMDB sentiment classification task.
implementation=0 preprocesses input to the LSTM which typically results in
faster computations at the expense of increased peak memory usage as the
preprocessed input must be kept in memory.
implementation=1 does away with the preprocessing, m... | minimaxir/keras-cntk-docker | lstm_benchmark.py | Python | mit | 2,306 |
"""
Common routines
"""
import hmac as HMAC
from base64 import urlsafe_b64encode as b64encode
import hashlib, os
HASH_ALG = hashlib.sha256
HASH_LENGTH = 32
TAG_PASSWORD = "TAG_SAFEID_PASSWORD"
TAG_USER = "TAG_SAFEID_USER"
def hmac(tag, message, key, alg=HASH_ALG):
"""
Generates a hashed message authentication code... | ace0/safeid | safeid/common.py | Python | mit | 1,125 |
from vacuous.backends import iter_cached_backends
class commit_on_success(object):
def __init__(self, **kwargs):
self.kwargs = kwargs
def __enter__(self):
pass
def __exit__(self, exc_type, exc_val, exc_tb):
if exc_type:
for backend in iter_cached_backends():
... | emulbreh/vacuous | vacuous/transactions.py | Python | mit | 641 |
import logging
import sys
logging.basicConfig(level=logging.DEBUG)
console = logging.StreamHandler(sys.stdout)
console.setLevel(logging.DEBUG)
# add the handler to the root logger
logging.getLogger().addHandler(console)
| rob-smallshire/keeper | tests/__init__.py | Python | mit | 221 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2017-03-01 16:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('profiles', '0001_initial'),
]
operations = [
migrations.RemoveField(
... | pyladieshre/pyladies | profiles/migrations/0002_auto_20170301_1823.py | Python | mit | 1,075 |
# -*- coding: utf-8 -*-
from scrapy.spider import Spider
from scrapy.selector import Selector
from moviespider.items import Cili006Item
from moviespider.moviedb import MovieDB
import scrapy
class Cili006AllSpider(Spider):
moviedb = MovieDB()
name = "cili006all"
allowed_domains = ["cili09.com"]
maxid... | zhs007/movieSpider | moviespider/moviespider/spiders/cili006all_spider.py | Python | mit | 1,758 |
"""Assign a WFO to sites in the metadata tables that have no WFO set."""
from pyiem.util import get_dbconn, logger
LOG = logger()
def main():
"""Go Main"""
mesosite = get_dbconn("mesosite")
postgis = get_dbconn("postgis")
mcursor = mesosite.cursor()
mcursor2 = mesosite.cursor()
pcursor = pos... | akrherz/iem | scripts/dbutil/set_wfo.py | Python | mit | 2,127 |
from jsonschema import validate, ValidationError
from json import load
from src.config_schema import config_schema
import unittest
class TestUM(unittest.TestCase):
def setUp(self):
pass
def test_Config1(self):
with open("config_test1.json") as data_file1:
data1 = load(data_file1)
... | wrycu/DiscordGameManager | config_test/config_tests.py | Python | mit | 1,314 |
__author__ = 'Krishna Mudragada'
from setuptools import setup
setup(name='DataFeedsTester',
version='0.1',
description='Test your Data feeds for validity',
url='http://github.com/mudragada/DataFeeds',
author='Krishna Mudragada',
license='MIT',
install_requires = ['logging', 're'])
| 8ldesign/DataFeedsTester | setup.py | Python | mit | 318 |
import os
from tkinter import *
ALL = N+S+E+W
class Application(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.master.rowconfigure(0, weight=1)
self.master.columnconfigure(0, weight=1)
self.grid(sticky=ALL)
root.bind("<Return>", self.file_op... | ceeblet/OST_PythonCertificationTrack | Python2/MoreGuiLayout_homework/src/moreframesandbuttons2.py | Python | mit | 3,128 |
from flask.ext.flails import FlailsView
from flask import render_template, redirect, url_for, request
#from config import db
import models
import forms
class PrivatePostView(FlailsView):
def private_post_index(self):
object_list = models.Post.query.all()
return render_template('post/index.slim', ob... | thrisp/flails | tests/test_app/blueprints/private/views.py | Python | mit | 2,266 |
#!/usr/bin/python3
'''qbootstraper main application
'''
from flask import Flask
from flask_wtf import csrf
app = Flask(__name__)
csrf.CSRFProtect().init_app(app) # enable CSRF protection
from qbflask.views import *
app.config.update(dict(
DATABASE='qbflask.db',
DEBUG=True,
SECRET_KEY='secret',
USE... | kevindkeogh/qbootstrapper-flask | qbflask/__init__.py | Python | mit | 401 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | onshape-public/onshape-clients | python/onshape_client/oas/models/btp_literal_boolean255.py | Python | mit | 9,062 |
from . import app, db
from .models import User
from .dish import transfer_vote_to_current_user
from flask import url_for, redirect, session, request
import urllib2
from contextlib import closing
CAS_SERVER = "https://netid.rice.edu/cas/"
@app.route('/api/auth/login')
def login():
"""
Logs th... | rice-apps/servery-app | app/auth.py | Python | mit | 2,190 |
import json
from rhino import Mapper, get
# Our internal representation
report = {
'title': 'foo',
'author': 'Fred',
'date': '2015-01-09',
'tags': ['a', 'b', 'c'],
}
# Base class for our representations
class report_repr(object):
@classmethod
def serialize(cls, report):
obj = dict([(k... | trendels/rhino | examples/content_type_versioning.py | Python | mit | 1,165 |
# -*- coding: utf-8 -*-
"""
Request Management
"""
module = request.controller
resourcename = request.function
if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
# -----------------------------------------------------------------------------
def index():
""" Module'... | sammyshj/gci | controllers/req.py | Python | mit | 72,734 |
"""
WSGI config for mozio project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTING... | sheeshmohsin/mozioproj | mozio/wsgi.py | Python | mit | 387 |
"""edition surrogate key
Revision ID: 1ba709663f26
Revises: d9a390ebdf1e
Create Date: 2016-04-29 15:59:12.144102
"""
# revision identifiers, used by Alembic.
revision = "1ba709663f26"
down_revision = "d9a390ebdf1e"
import sqlalchemy as sa
from alembic import op
def upgrade():
op.add_column("editions", sa.Colu... | lsst-sqre/ltd-keeper | migrations/versions/1ba709663f26_edition_surrogate_key.py | Python | mit | 430 |
from operator import itemgetter
from unittest import TestCase
import pipeline as pl
from marshmallow import fields
class FakeSchema(pl.BaseSchema):
str = fields.String()
int = fields.Integer()
num = fields.Number()
datetime = fields.DateTime()
date = fields.Date(dump_to='a_different_name')
not... | UCSUR-Pitt/wprdc-etl | test/unit/test_schema.py | Python | mit | 1,363 |
# coding: utf-8
from django import forms
from django.conf import settings
from django.contrib.auth import password_validation
from django.contrib.auth.models import User
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from django.core import validators
from . import models
clas... | telminov/sw-django-division-perm | division_perm/forms.py | Python | mit | 10,182 |
#!/usr/bin/env python
#
###########################
# Sysusage info:
# 1) memory/swap usage
# 2) disk usage
# 3) load avarage
###########################
import re
import os
class MemoryUsage:
"""MEMORY USAGE STATISTICS:
memused - Total size of used memory in kilobytes.
memfree - T... | dorzheh/sysstat | SysUsage.py | Python | mit | 5,469 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
###############################################################################
#
# Created on Tue Dec 26 08:58:19 2017
# @author: NealChenZhang
# This program is personal trading platform designed when employed in
# Aihui Asset Management as a quantitative analyst.
#
# ... | nealchenzhang/Py4Invst | Backtest_Futures/__init__.py | Python | mit | 1,101 |