code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
import utilities.file_ops as file_ops
from PyQt4 import QtGui, QtCore
from dirtgui.document_util import document_match_util as match_util
NEXT_TT = u'Move to next match within this document'
PREV_TT = u'Move to prevous match within this document'
class DocumentGrid(QtGui.QGridLayout):
"""
Creates a grid wi... | gnarph/DIRT | dirtgui/document_grid.py | Python | mit | 5,149 |
# -*- coding: utf-8 -*-
# vim: ft=python:sw=4:ts=4:sts=4:et:
from django.apps import AppConfig
class DjangoBNRApp(AppConfig):
name = 'django_bnr'
verbose_name = 'BNR Exchange Rates'
| PressLabs/django-bnr | django_bnr/app.py | Python | mit | 193 |
import sys
import logging
from optparse import OptionParser
from flvlib import __versionstr__
from flvlib.constants import TAG_TYPE_AUDIO, TAG_TYPE_VIDEO, TAG_TYPE_SCRIPT
from flvlib.constants import FRAME_TYPE_KEYFRAME
from flvlib.constants import H264_PACKET_TYPE_SEQUENCE_HEADER
from flvlib.constants import H264_PA... | wulczer/flvlib | lib/flvlib/scripts/cut_flv.py | Python | mit | 7,154 |
from django.shortcuts import render, redirect
from django.http import Http404
from events.forms import Event
from django.views.generic import View
from events.services import PlacesService
from events.forms import ImageUploadForm
from django.contrib import messages
import uuid
class ChooseImageView(View):
templat... | thiagoferreiraw/mixapp | events/views/choose_image_view.py | Python | mit | 1,771 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('clientes', '0002_auto_20150530_1324'),
... | acs-um/gestion-turnos | apps/clientes/migrations/0003_auto_20150605_2119.py | Python | mit | 1,158 |
from django.conf.urls import patterns, include, url
from product_order import views, data_views
urlpatterns = patterns('',
url(r'^$', views.index),
url(r'^order_state_machine/$', views.order_state_machine),
url(r'^make_order/$', views.make_order),
url(r'^make_order2/$', views.make_order2),
u... | yejia/order_system | product_order/urls.py | Python | mit | 568 |
#!/bin/python
def swap(findex, sindex, ar):
ar[findex], ar[sindex] = ar[sindex], ar[findex]
def partition(ar, lo, hi):
'''3 way djisktra partition method'''
start = lo
pivotIndex = (lo+hi)//2
# take the elemet @ hi as the pivot and swap it to pivotIndex position
swap(pivotIndex, hi, ar)
pi... | codecakes/algorithms | algorithms/code30DaysImp/helper/quicksort.py | Python | mit | 1,313 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import audit_log.models.fields
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
operations = [
m... | JanMalte/secondhandshop_server | src/events/migrations/0001_initial.py | Python | mit | 2,181 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-02 19:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('draftin', '0005_auto_20151213_1630'),
]
operations = [
migrations.AddField(
... | whatisjasongoldstein/django-draftin | draftin/migrations/0006_collection_name.py | Python | mit | 464 |
# Multi-threaded Mandelbrot Fractal (Do not run using IDLE!)
# FB - 201104306
import threading
from PIL import Image
w = 512 # image width
h = 512 # image height
image = Image.new("RGB", (w, h))
wh = w * h
maxIt = 256 # max number of iterations allowed
# drawing region (xa < xb & ya < yb)
xa = -2.0
xb = 1.0
ya = -1.5
y... | ActiveState/code | recipes/Python/577680_Multithreaded_Mandelbrot_Fractal/recipe-577680.py | Python | mit | 1,749 |
# coding: utf-8
# pylint: disable = invalid-name, C0111, C0301
# pylint: disable = R0912, R0913, R0914, W0105, W0201, W0212
"""Wrapper c_api of LightGBM"""
from __future__ import absolute_import
import ctypes
import os
from tempfile import NamedTemporaryFile
import numpy as np
import scipy.sparse
from .compat import... | cbecker/LightGBM | python-package/lightgbm/basic.py | Python | mit | 66,093 |
#!/usr/bin/env python
#
#
"""Test harness for the logging module. Tests BufferingSMTPHandler, an alternative implementation
of SMTPHandler.
Copyright (C) 2001-2002 Vinay Sajip. All Rights Reserved.
Modified to handle SMTP_SSL connections
"""
import string, logging, logging.handlers
from logging import Formatter
cl... | gary-dalton/Twenty47 | twenty47/logging.py | Python | mit | 3,990 |
from django.contrib import admin
from django.db.models import Q
from .models import (Account, Analytic, Entry, BankStatement, Transaction,
ThirdParty, Purchase, Sale, Journal, Year,
Income, Expenditure, Cashing)
class HasScanListFilter(admin.SimpleListFilter):
title = "Ju... | eedf/jeito | accounting/admin.py | Python | mit | 3,724 |
from bs4 import BeautifulSoup
import time
from selenium import webdriver
from pyvirtualdisplay import Display
__PROCESSOR = 'lxml'
__OFFERS_CLASS = 'offer-listing'
__PRICE_CLASS = 'dollars'
__FLIGHT_DURATION_CLASS = 'duration-emphasis'
__LAYOVR_CLASS = ''
__AIRLINE_CLASS = ''
def get_page_offers(url):
display =... | Shadi-A/ExpediaCrawler | expediacrawler/soupParser.py | Python | mit | 2,286 |
#!/usr/bin/env python
#
# Original code from - https://github.com/Clete2/NessusReport, modded by Lee Baird
# John Kim - additional modification completed to support UTF-8, support cli help, renaming output files
# Thanks to Securicon, LLC. for sponsoring development
import csv
import datetime
import re
import sys
impo... | EricSB/discover | parsers/parse-nessus.py | Python | mit | 6,845 |
'''
file: ShareCalendar.py
Starter file for Share Calendar Applciation
'''
__author__ = "Kapil Somani"
__email__ = "kmsomani@ncsu.edu"
__status__ = "Prototype"
import Credentials
import Calendar
from datetime import datetime
from apiclient.discovery import build
from httplib2 import Http
creds = None
# complete ... | capsci/ShareCalendar | ShareCalendar.py | Python | mit | 1,624 |
# -*- coding: utf-8 -*-
"""
The MIT License
Copyright (c) 2010 Olle Johansson
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,... | ollej/shoutbridge | src/plugins/KraetyzPlugin.py | Python | mit | 2,235 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import strfile
import wx
import sys, os
import locale, gettext
from wx.lib.mixins.listctrl import ListCtrlAutoWidthMixin
class TransDictListCtrl(wx.ListCtrl, ListCtrlAutoWidthMixin):
"""ListCtrl for a translation dictionary"""
def __init__(self, parent):
wx.ListCtrl.... | kch42/dotstr_edit | dotstr_edit.py | Python | mit | 15,425 |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
user = Table('user', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('username', String(length=64)),
Column('email', String(length=120)),
Column('... | atlefren/beercalc | db_repository/versions/006_migration.py | Python | mit | 884 |
"""
Paginator
"""
from math import ceil
from six import string_types
from six.moves import range
class Paginator(object):
PER_PAGE = 10
total_pages = 0
total_items = 0
callback = None
def __init__(self, query, page=1, per_page=PER_PAGE, total=None,
padding=0, callback=None, stati... | mardix/Paginator.py | paginator.py | Python | mit | 4,801 |
from __future__ import print_function
import os
import sys
import numpy as np
import time
from IPython import get_ipython
np.random.seed(1337)
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.utils.np_utils import to_categorical
from keras.layers impor... | irisliu0616/Short-text-Classification | Model/Ohsumed/ohsumed_LSTM-SVM_CV.py | Python | mit | 10,500 |
import os
import click
from tifa.core import Template, File
from tifa.errors import ValidationError
from tifa.prompt import Prompt
from tifa.validation import normalize_config
here = os.path.abspath(os.path.dirname(__file__))
@click.group()
def main():
pass
@main.command(help='Generate a tifa configuration y... | wddwycc/tifa | tifa/cli.py | Python | mit | 1,220 |
#!/usr/bin/env python3
# Copyright (c) 2013-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Generate seeds.txt from Pieter's DNS seeder
#
import re
import sys
import dns.resolver
import collect... | wellenreiter01/Feathercoin | contrib/seeds/makeseeds.py | Python | mit | 5,457 |
# Copyright (c) 2015 Uber Technologies, Inc.
#
# 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, publ... | Willyham/tchannel-python | tchannel/testing/vcr/proxy/ttypes.py | Python | mit | 6,330 |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(self, plotly_name="color", parent_name="contourcarpet.line", **kwargs):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/contourcarpet/line/_color.py | Python | mit | 411 |
import struct
from .motor import Module, Motor
from .reply import Reply, TrinamicException
# MSG_STRUCTURE = ">BBBBIB"
MSG_STRUCTURE = ">BBBBiB"
MSG_STRUCTURE_CAN = ">BBBI"
# REPLY_STRUCTURE = ">BBBBIB"
REPLY_STRUCTURE = ">BBBBiB"
REPLY_STRUCTURE_CAN = ">BBBI"
REPLY_STRUCTURE_IIC = ">BBBIB"
REPLY_LENGTH = 9
REPLY_L... | NativeDesign/python-tmcl | TMCL/bus.py | Python | mit | 2,876 |
{% if current_user %}<script>
// Add the snippet here with account id
// Assuming your page has loaded the current user as the object current_user
chmln.identify({
uid: '{{ current_user.id }}',
created: '{{ current_user.created_at }}',
email: '{{ current_user.email }}',
plan: '{{ current_user.acco... | trychameleon/snippet.js | examples/chameleon-python.py | Python | mit | 415 |
from django.conf.urls import patterns, url
urlpatterns = patterns('live.views',
url('^fetch/$', 'fetch'),
url('^$', 'main_live')
)
| austinhartzheim/madhacks-live | live/urls.py | Python | mit | 140 |
import pytest
from bgmi.lib.fetch import DATA_SOURCE_MAP
from bgmi.website import mikan
from bgmi.website.base import BaseWebsite
from bgmi.website.model import Episode, SubtitleGroup, WebsiteBangumi
@pytest.mark.parametrize("source", DATA_SOURCE_MAP.keys())
def test_info(source, data_source_bangumi_name):
w = D... | BGmi/BGmi | tests/test_data_source.py | Python | mit | 1,562 |
# -*- coding: utf-8 -*-
# @Time : 2017/6/29 10:17
# @Author : Hua
# @Site :
# @File : baseClient.py
# @Software: PyCharm
import shutil
from jinja2 import Environment, PackageLoader
import os, sqlite3
from config.Config import Config
class BaseClient(object):
ENV = Environment(loader=PackageLoader('temp... | GeekerHua/develop_documentation_spider | client/BaseClient.py | Python | mit | 7,057 |
# 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
class Unity3DPipeline(object):
def process_item(self, item, spider):
return item
| TheWaWaR/scrapy-snippets | projects/unity3d/unity3d/pipelines.py | Python | mit | 261 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from qcspgen_exception import QCSPGenException
import functools
def _verify_type(func):
"""
decorator to verify item type supplied for the wrapped function
:param func: decorated function
:return: wrapper
"""
@functools.wraps(func)
def wrapper(s... | CHEN-JIANGHANG/qcspgen | qcspgen/aggregator.py | Python | mit | 2,819 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:/Users/Diego/Documents/GitHub/correlation_viewer/vcorr\gui\correlations_gui.ui'
#
# Created: Wed May 14 20:22:30 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtC... | diego0020/correlation_viewer | vcorr/gui/correlations_gui.py | Python | mit | 4,968 |
#!/usr/bin/python3
"""Tests for the date module."""
#
# (C) Pywikibot team, 2012-2022
#
# Distributed under the terms of the MIT license.
#
import unittest
from contextlib import suppress
from datetime import datetime
from pywikibot import date
from tests.aspects import MetaTestCaseClass, TestCase
class TestDateMeta... | wikimedia/pywikibot-core | tests/date_tests.py | Python | mit | 5,263 |
from __future__ import print_function, division
import myhdl
from myhdl import instance, StopSimulation
from rhea.system import Global, Clock, Reset
from rhea.system import Barebone, Wishbone, AvalonMM, AXI4Lite
from rhea.utils.test import run_testbench, tb_args, tb_default_args
from rhea.cores.memmap import periph... | NickShaffner/rhea | test/test_system/test_memmap.py | Python | mit | 992 |
#!/usr/bin/env python
#########################################
#
# fasta2tax.py
#
########################################
import sys,os
import argparse
import pymysql as MySQLdb
import json
py_pipeline_path = os.path.expanduser('~/programming/py_mbl_sequencing_pipeline')
#my $rdpFile = "$inputfile.rdp";
print "... | avoorhis/vamps-node.js | public/scripts/rdp/rdp_fasta2tax.py | Python | mit | 6,320 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def get_version(*file_paths):
"""Retrieves the version from elasticsearch_flex/__init__.py"""
filename = os.path.join(os.path.dirname(__f... | prashnts/dj-elasticsearch-flex | setup.py | Python | mit | 2,493 |
__version__ = "1.4.3"
import sys
import os
# verify that pygame is on the machine
try:
import pygame
except Exception:
print("Pygame doesn't seem to be installed on this machine.")
# add thorpy folder to Windows and Python search paths
THORPY_PATH = os.path.abspath(os.path.dirname(__file__))
try:
os.env... | YannThorimbert/ThorPy-1.4.3 | thorpy/__init__.py | Python | mit | 3,614 |
'''
- Leetcode problem: 675
- Difficulty: Hard
- Brief problem description:
You are asked to cut off trees in a forest for a golf event. The forest is represented as a non-negative 2D map, in this map:
0 represents the obstacle can't be reached.
1 represents the ground can be walked through.
The place with number b... | bzhou26/leetcode_sol | p675_Cut_Off_Trees_for_Golf_Event.py | Python | mit | 3,256 |
import _plotly_utils.basevalidators
class TextValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="text", parent_name="layout.scene.zaxis.title", **kwargs
):
super(TextValidator, self).__init__(
plotly_name=plotly_name,
parent_name=p... | plotly/python-api | packages/python/plotly/plotly/validators/layout/scene/zaxis/title/_text.py | Python | mit | 463 |
#!/usr/bin/env python2.7
import networkx as nx
import matplotlib.pyplot as plt
import sys, argparse, os, re
parser = argparse.ArgumentParser(description='''Visualizes connections in assembly
using networkx_viewer module.''',
formatter_class=argparse.ArgumentDefaultsHelpFormatter, add_help=False)
#Required argumen... | alexherns/biotite-scripts | build_connection_graph.py | Python | mit | 1,780 |
from .anneal import * # noqa
from .version import __version__ # noqa
| tcompa/anneal | anneal/__init__.py | Python | mit | 71 |
"""This module implements core module test."""
from __future__ import absolute_import
import os
from subprocess import call
import shutil
import logging
import pytest
from swak.plugin import iter_plugins, get_plugins_dir,\
get_plugins_initpy_path, PREFIX
from swak.util import which_exe
from swak.const import PL... | haje01/swak | tests/test_cli.py | Python | mit | 6,911 |
from .app import App
from .model import User, Group, ResetNonce
class ViewPermission:
pass
class EditPermission:
pass
@App.permission_rule(model=object, permission=object)
def admin_has_global_permission(identity, model, permission):
user = User.get(email=identity.userid)
return Group.get(name="Ad... | yacoma/auth-boilerplate | server/permissions.py | Python | mit | 959 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2008 Frank Scholz <coherence@beebits.net>
""" Coherence and Nautilus bridge to upload files into a DLNA/UPnP MediaServer
usable as Nautilus Extension or a Script
for u... | coherence-project/Coherence | misc/Nautilus/coherence_upnp_upload_extension.py | Python | mit | 3,481 |
from impl import FixedClientDeauthAttack,\
SniffedClientDeauthAttack,\
GlobalDisassociationAttack
class WiFiDeauthAttackBuilder(object):
'''This object finds the appropriate attack for the options supplied by the
user.'''
@classmethod
def build_from(cls, opt... | lukius/wifi-deauth | attack/builder.py | Python | mit | 2,286 |
# -*- coding: utf-8 -*-
"""
Flask app initialization.
"""
from flask import Flask
from flask_mako import MakoTemplates
app = Flask(__name__) # pylint: disable=invalid-name
MAKO = MakoTemplates(app)
| stxnext-kindergarten/stxnext-kindergarten-lcwiklinski | src/presence_analyzer/main.py | Python | mit | 200 |
import requests
from urllib import urlopen
import urllib2
from bs4 import BeautifulSoup
root_url = raw_input('Enter the URL you want to search: ')
seed_post = root_url
def get_links_in_blogger_post():
response = requests.get(seed_post)
soup = BeautifulSoup(response.text)
return [a.attrs.get('href') for a in sou... | morskyjezek/BloggerSNATools | bloggerspider.py | Python | mit | 2,627 |
#!/usr/bin/env python3
import setuptools
setuptools.setup(
name = "route_distances",
version = "1.10.0",
license = "MIT",
description = "Classes for getting the distance of a route between two"
"places using various different services",
packages = ["route_distances"],
install... | ercas/route_distances | setup.py | Python | mit | 372 |
#!/usr/bin/env python
from __future__ import print_function
import sys
integer = int(sys.argv[1])
print(integer**2)
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
| shawnsi/bisectdemo | squares.py | Python | mit | 176 |
from django.forms import ModelForm, RadioSelect
from models import Registration, Guest
class RegistrationForm(ModelForm):
class Meta:
model = Registration
exclude = ('guest', 'avec', 'event', 'reference_number', 'sum')
class GuestForm(ModelForm):
class Meta:
model = Guest
... | Teknologforeningen/tf_arsfest | tf_arsfest/forms.py | Python | mit | 366 |
"""Testing of module config."""
# pylint: disable=no-self-use, invalid-name, redundant-unittest-assert
import unittest
from hamcrest import assert_that, equal_to, contains_string
from ddt import ddt, data
from spline.components.config import ShellConfig
@ddt
class TestShellConfig(unittest.TestCase):
"""Testing of... | Nachtfeuer/pipeline | tests/components/test_shell_config.py | Python | mit | 2,422 |
from pygame import *
'''
The music must be in the same folder/project to work
You have to install pygame
command: pip install pygame
'''
mixer.init()
msc = input('Song Name: ')
mixer.music.load('{}.mp3'.format(msc))
mixer.music.play()
while mixer.music.get_busy():
time.Clock().tick(10)
if inpu... | HoussemCharf/FunUtils | Fun Scripts/Player.py | Python | mit | 351 |
import os
import click
from benchmark import option_simulation
import devito
@click.group()
def menu():
pass
@menu.command(name='generate')
@option_simulation
@click.option('-nn', multiple=True, default=[1], help='Number of nodes')
@click.option('-ncpus', default=1, help='Number of cores *per node*') # Shoul... | opesci/devito | benchmarks/user/make-pbs.py | Python | mit | 2,496 |
import floto
import logging
from floto.specs.task import ActivityTask, ChildWorkflow
from floto.specs import DeciderSpec
import floto.decider
logger = logging.getLogger(__name__)
rs = floto.specs.retry_strategy.InstantRetry(retries=3)
domain = 'floto_test'
#Define tasks and decider of the workflow
copy_files = Activ... | babbel/floto | examples/child_workflow/decider.py | Python | mit | 1,797 |
# -*- coding: utf-8 -*-
from .auto_slug import (
AutoSlugPopulateFromModel, AutoSlugModel,
AutoSlugDefaultModel, AutoSlugBadPopulateFromModel
)
from .task_result import TaskResultModel
__all__ = [
'AutoSlugPopulateFromModel', 'AutoSlugModel',
'AutoSlugDefaultModel', 'AutoSlugBadPopulateFromModel',
... | nitely/Spirit | spirit/core/tests/models/__init__.py | Python | mit | 341 |
from setuptools import setup,find_packages
setup(
name = 'pygron',
version = '0.3.1',
license = 'MIT',
author = 'Akshay B N',
description = 'Helps JSON become greppable',
zip_safe = False,
url = 'https://github.com/akshbn/pygron',
packages = find_packages(),
entry_points = {"console_scripts":["pygron=pygron.cli_entry:... | akshbn/pygron | setup.py | Python | mit | 330 |
#!/usr/bin/env python3
import sys
__author__ = 'kocsenc'
from time import sleep
from random import randint
from selenium.common.exceptions import NoSuchElementException
# noinspection PyUnresolvedReferences
from common.MyCourses import MyCourses
class ReadDiscussions(MyCourses):
def __init__(self, sleep_time)... | kocsenc/mycourses-scripts | scripts/ReadDiscussions.py | Python | mit | 2,197 |
# Used from https://github.com/philipperemy/Deep-Learning-Tinder/blob/master/tinder_token.py
import re
import requests
import robobrowser
MOBILE_USER_AGENT = "Tinder/7.5.3 (iPhone; iOS 10.3.2; Scale/2.00)"
FB_AUTH = "https://www.facebook.com/v2.6/dialog/oauth?redirect_uri=fb464891386855067%3A%2F%2Fauthorize%2F&disp... | fbessez/Tinder | fb_auth_token.py | Python | mit | 2,140 |
from datetime import timedelta
from django.contrib import admin
from django.db.models import Case, Value, When
from django.utils import timezone
from .models import Channel, Post, RssFeed
@admin.register(Channel)
class ChannelAdmin(admin.ModelAdmin):
list_display = ('__str__', 'title', 'username', 'publish_pict... | vaniakosmos/memes-reposter | apps/rss/admin.py | Python | mit | 1,262 |
#!env/bin/python
import os
from app import app
if __name__ == "__main__":
app.run(debug=True, port=int(os.environ.get("PORT", 5050)), host="0.0.0.0")
| etothemanders/GoingPostal | run.py | Python | mit | 155 |
# -*- coding: utf-8 -*-
import scrapy
import json
import re
import logging
from locations.items import GeojsonPointItem
class PigglyWigglySpider(scrapy.Spider):
''' This spider scrapes from two different places, an api which has their stores in Wisconsin
and Illinois, and a page which has all of their oth... | iandees/all-the-places | locations/spiders/pigglywiggly.py | Python | mit | 4,159 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... | rwl/PyCIM | CIM14/IEC61968/PaymentMetering/CashierShift.py | Python | mit | 5,075 |
"""Tests for basic ability to import subpackages."""
from absl.testing import absltest
from differential_value_iteration.algorithms import algorithms
from differential_value_iteration.environments import micro
class DifferentialValueIterationTest(absltest.TestCase):
def test_algorithms_package_import(self):
s... | abhisheknaik96/differential-value-iteration | src/differential_value_iteration/import_test.py | Python | mit | 834 |
import unittest
import os
import inspect
import shutil
import config
import rename_subtitles
import upload_subtitles
class TestSuit(unittest.TestCase):
# TESTS
def test_basic_match(self):
rename_subtitles.main()
upload_subtitles.main()
#Match simple Test_Series_S01E01.srt with Test_Se... | andyvandermeyde/match_subtitles | test/test_suite.py | Python | mit | 1,796 |
### write numpy array as geoitiff to disk
import sys
import numpy as np
# append path for osgeo gdal to resolve "No module named _gdal_array" conflict
sys.path.insert(0, '/home/manuel/regmod/postgis-cb-env/lib/python2.7/site-packages/')
from osgeo.gdalconst import *
def numpy2geotiff(numpyArr, lat, lon):
# modifie... | ElenorFrisbee/MSC | regmod/pcaPython/np2geotiff.py | Python | mit | 1,652 |
# -*- coding: utf-8 -*-
"""
zenfig.log
~~~~~~~~~~~~~
Nice output
:copyright: (c) 2016 by Alejandro Ricoveri
:license: MIT, see LICENSE for more details.
"""
import sys
from clint.textui.colored import white, red, cyan, yellow, green
from clint.textui import puts
# Globals
_stdout = False
def init(*, quiet_stdou... | axltxl/zenfig | zenfig/log.py | Python | mit | 1,553 |
from grow.pods import pods
from grow.pods import storage
import click
import os
@click.command()
@click.argument('pod_path', default='.')
@click.option('--source', type=click.Path(), required=True,
help='Path to source (either zip file or directory).')
def import_translations(pod_path, source):
"""Imp... | vitorio/pygrow | grow/commands/import_translations.py | Python | mit | 561 |
from bottle import route,request
from cassandra.cluster import Cluster
import uuid, collections, traceback, redis, thread, bcrypt, configparser, requests, sys, jsonpickle, random, os, zipfile, shutil, appcontext, permission
config = configparser.ConfigParser()
config.read('config.ini')
def redis():
return appcont... | lms-io/lms | src/user.py | Python | mit | 2,311 |
import pylab as plt
import pickle, csv, matplotlib, time
import numpy as np
import matplotlib.dates as mdates
import pandas as pd
import matplotlib.animation as animation
def get_data(file):
with open(file,'rb') as f:
data=pickle.load(f)
f.close()
counter=0
dates=[]
dustdata=[]
for each in data:
if counter... | wordsforthewise/shinyei-ppd42ns-arduino | plotdustlive.py | Python | mit | 995 |
# coding: utf-8
import copy
from google.appengine.ext import ndb
import flask
from apps import auth
from apps.auth import helpers
from core import task
from core import util
import config
import forms
import models
bp = flask.Blueprint(
'user',
__name__,
url_prefix='/user',
template_folder='templates... | gmist/gae-de-init | main/apps/user/views.py | Python | mit | 7,664 |
import datetime
import arrow
def arrow_datetime(value, name):
try:
value = arrow.get(value).datetime
except Exception as e:
raise ValueError(e)
return value
class BaseFilter(object):
# TODO: Move this class to be part of API FiltrableResource
# Leaving implementation to be... | sebastiandev/biyuya | biyuya/models/filters.py | Python | mit | 2,106 |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2014 Roland Bettinelli
# 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 th... | Glorfindelrb/pyBPMN20engine | HumanInteraction/models.py | Python | mit | 3,637 |
import json
import numpy as np
from pyplanknn.layer import Layer
from pyplanknn.convlayer import ConvPoolLayer
class ConvNetwork:
"""
A neural network comprised of several layers interconnected.
"""
def __init__(self, n_convs=10, hidden=4, n_outs=121):
"""
Create a series of layers.
... | bovee/planknn | pyplanknn/convnetwork.py | Python | mit | 2,361 |
n = int(input())
m = [int(input()) for _ in range(3)]
cnt = int(n / sum(m)) * 3
n %= sum(m)
m.sort()
if n == 0:
print(cnt)
elif n <= m[2]:
print(cnt+1)
elif n <= m[1] + m[2]:
print(cnt+2)
else:
print(cnt+3)
| knuu/competitive-programming | atcoder/corp/codethxfes2014a_b.py | Python | mit | 223 |
from OpenGLCffi.GL import params
@params(api='gl', prms=['value'])
def glMinSampleShadingARB(value):
pass
| cydenix/OpenGLCffi | OpenGLCffi/GL/EXT/ARB/sample_shading.py | Python | mit | 109 |
#!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import argparse
import sys
parser = argparse.ArgumentParser()
parser.add_argument("--tsv", required=True... | pytorch/fairseq | examples/wav2vec/unsupervised/scripts/filter_tsv.py | Python | mit | 955 |
def main():
a=raw_input()
print a.lstrip()
print "Hello world"
main()
| kumarisneha/practice_repo | techgig_rstrip.py | Python | mit | 83 |
__author__ = 'Sevak Mardirosian'
import sys
from PyQt4 import QtGui, uic
class DialogDemo(QtGui.QWidget):
#----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
# super(DialogDemo, self).__init__()
QtGui.QWidget.__init__(self)
... | sevmardi/University-of-Applied-Sciences-Leiden | Python/ifscp_Opdrachten/Opdracht3.py | Python | mit | 1,376 |
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
from .local import *
KEEN_PROJECT_ID = get_env_variable("KEEN_ID")
KEEN_WRITE_KEY = get_env_variable("KEEN_WRITE_KEY")
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = ()
REDIS_URL = urlparse(get_env_variable(... | phildini/cards-against-django | cah/settings/philip.py | Python | mit | 365 |
from panda3d.core import LPoint3
# EDIT GAMEMODE AT THE BOTTOM (CHESS VARIANTS)
# COLORS (for the squares)
BLACK = (0, 0, 0, 1)
WHITE = (1, 1, 1, 1)
HIGHLIGHT = (0, 1, 1, 1)
HIGHLIGHT_MOVE = (0, 1, 0, 1)
HIGHLIGHT_ATTACK = (1, 0, 0, 1)
# SCALE (for the 3D representation)
SCALE = 0.5
PIECE_SCALE = 0.3
BOARD_HEIGHT = ... | guille0/space-chess | config.py | Python | mit | 5,079 |
"""
Ax_Metrics - MQL Metrics Query Language Parser
------------------------------------------------------------------------------
Author: Dan Kamins <dos at axonchisel dot net>
Copyright (c) 2014 Dan Kamins, AxonChisel.net
"""
# ----------------------------------------------------------------------------
import co... | axonchisel/ax_metrics | py/axonchisel/metrics/foundation/query/mql.py | Python | mit | 11,429 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author: KevinMidboe
# @Date: 2017-02-08 14:00:04
# @Last Modified by: KevinMidboe
# @Last Modified time: 2017-02-16 17:08:08
import requests
from pprint import pprint
try:
from plexSearch import plexSearch
except ImportError:
from plex.plexSearch import plexSearc... | KevinMidboe/statusHandler | plex/tmdb.py | Python | mit | 1,451 |
#! /usr/bin/python
#--------------------------------------------------------------------
# PROGRAM : granule2map.py
# CREATED BY : hjkim @IIS.2015-07-13 11:56:07.989735
# MODIFED BY :
#
# USAGE : $ ./granule2map.py
#
# DESCRIPTION:
#------------------------------------------------------cf0.2@20120401
import ... | kimlab/GPyM | granule2map.py | Python | mit | 1,360 |
import unittest
from css2video.constants import ValueType
from css2video.parsers.value import Color, ColorParseException
class TestCase(unittest.TestCase):
def test_parser(self):
response = Color.parse('#ffF')
self.assertEqual(
response,
dict(type=ValueType.color, red=255... | bpsagar/css2video | tests/parsers/value/test_color.py | Python | mit | 1,086 |
from GIDEON.ml.ml_utilties import *
_run_types = ['production', 'diagnostics']
_load_types = [True, False]
class ActionModeler:
def __init__(self):
self._raw_features, self._target = load_action_data()
def run_diagnostics(self, save=True):
d = lambda x: ' ' if save else ' not '
print... | rickyschools/JARVIS | ml/learners.py | Python | mit | 1,120 |
#!/usr/bin/env python3
"""
The MIT License (MIT)
Copyright (c) 2016 davide
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, co... | raspibo/Livello1 | var/www/cgi-bin/valori2csv_search_date.py | Python | mit | 2,996 |
import argparse
import csv
import json
import re
MANUFACTURER = {
"A": "American Home Food Products",
"G": "General Mills",
"K": "Kellogs",
"N": "Nabisco",
"P": "Post",
"Q": "Quaker Oats",
"R": "Ralston Purina",
}
NORMAL_FIELDS = [
"calories",
"protein",
"fat",
"sodium"... | kyleconroy/dataflakes | etl/etl.py | Python | mit | 2,694 |
from datetime import date, datetime
from mock import patch, MagicMock
from unittest import TestCase
from django_mock_queries import utils, constants
class TestUtils(TestCase):
def test_merge_concatenates_lists(self):
l1 = [1, 2, 3]
l2 = [4, 5, 6]
result = utils.merge(l1, l2)
for x... | szykin/django-mock-queries | tests/test_utils.py | Python | mit | 11,117 |
from __future__ import print_function
import logging, re, os
import data, parser, util
from pymake.globrelative import hasglob, glob
from pymake import errors
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
_log = logging.getLogger('pymake.data')
_tabwidth = 4
class Location... | mozilla/pymake | pymake/parserdata.py | Python | mit | 33,522 |
from rest_framework import serializers
from .models import Foto
class FotoSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Foto
fields = (
'id',
'name',
'location',
'date',
'image',
'created',
... | mhotwagner/backstage | foti/serializers.py | Python | mit | 343 |
import os
import keras.backend as K
import numpy as np
from keras.layers import Dense, Activation, Flatten, Convolution2D, Permute
from keras.layers.convolutional import Conv2D
from keras.models import Sequential
from models import AbstractConfiguration, KickoffModes
from rl.memory import SequentialMemory
from rl.poli... | bewestphal/SeleniumAI | example/configuration.py | Python | mit | 6,202 |
#!/usr/bin/env python3
import sys
import os
import git_lib
import path_utils
import fsquery_adv_filter
ERRMSG_EMPTY = "Empty contents"
def _known_states():
st = ["??", "R ", "D ", "A ", "M ", " M", " D", "UU", "MM", "AM", "DD", "UA", "UD", "DU", "AA", "AU", "RM"]
return st
def _test_repo_status(repo_path... | mvendra/mvtools | git/collect_git_patch.py | Python | mit | 20,127 |
import os.path
import typing
from mitmproxy import exceptions
from mitmproxy import flowfilter
from mitmproxy import io
from mitmproxy import ctx
from mitmproxy import flow
class Save:
def __init__(self):
self.stream = None
self.filt = None
self.active_flows = set() # type: Set[flow.Flow... | StevenVanAcker/mitmproxy | mitmproxy/addons/save.py | Python | mit | 2,873 |
"""A set of stream oriented parsers for http requests and responses, inline
with the current draft recommendations from the http working group.
http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-17
Unlike other libraries, this is for clients, servers and proxies.
Missing:
comma parsing/header folding
""... | alard/warctozip | hanzo/httptools/messaging.py | Python | mit | 18,022 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-04-26 11:37
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('proposals', '0026_auto_20160425_1501'),
]
operations = [
migrations.AlterModelOption... | pycontw/pycontw2016 | src/proposals/migrations/0027_auto_20160426_1137.py | Python | mit | 659 |
"""
"""
import unittest
def inefficient_find_matching_parenthesis(string, start):
parenthesis_match = ['(']
for i, character in enumerate(string[start + 1:]):
if character == '(':
parenthesis_match.append('(')
elif character == ')':
parenthesis_match.pop(0)
... | MFry/pyAlgoDataStructures | Interview_Cake/p28_matching_parens.py | Python | mit | 1,063 |
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Export the Python grammar and symbols."""
# Python imports
import os
# Local imports
from .pgen2 import driver
# The grammar file
_GRAMMAR_FILE = os.path.join(os.path.dirname(__file__), "Grammar.txt")
_PATTERN_GRA... | liamcurry/py3kwarn | py3kwarn2to3/pygram.py | Python | mit | 1,068 |
#!/usr/bin/env python
######################################################
## Edits ROMS masks using a GUI
## Nov 2014
## rsoutelino@gmail.com
######################################################
import os
import wx
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.bac... | rsoutelino/pyeditmask | pyeditmask.py | Python | mit | 21,757 |
"""Support for OVO Energy sensors."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import Final
from ovoenergy import OVODailyUsage
from ovoenergy.ovoenergy import OVOEnergy
from homeassistant.components... | rohitranjan1991/home-assistant | homeassistant/components/ovo_energy/sensor.py | Python | mit | 6,463 |