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 |
|---|---|---|---|---|---|
from Pyro5.api import Proxy
obj = Proxy("PYRONAME:example.chain.A")
print("Result=%s" % obj.process(["hello"]))
| irmen/Pyro5 | examples/circular/client.py | Python | mit | 114 |
# 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.
from collections import namedtuple
import numpy as np
import torch
from fairseq import utils
DecoderOut = namedtuple(
"IterativeRefinem... | pytorch/fairseq | fairseq/iterative_refinement_generator.py | Python | mit | 13,238 |
import json
from pybloom import BloomFilter
from base64 import b64encode, b64decode
from bitarray import bitarray
from struct import unpack, pack
def _bitarray_serialize(ba):
return [ba.endian(), b64encode(ba.tobytes()), len(ba)]
def _bitarray_deserialize(data):
ba = bitarray(endian=data[0])
ba.frombyte... | Storj/storjnet | storjnet/bloom.py | Python | mit | 1,321 |
# -*- coding:utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
import glob
import numpy as np
from rtmbot.core import Plugin
import re
from keras.models import model_from_json
class SinPlugin(Plugin):
model_json = open('tensorlog/rnn_model.json', 'r').read()
model = mod... | fullkawa/ml-bot-sample | plugins/sin.py | Python | mit | 1,100 |
from detectem.plugin import Plugin
class ModernizrPlugin(Plugin):
name = "modernizr"
homepage = "http://www.modernizr.com/"
tags = ["javascript"]
matchers = [
{"body": r"/\* Modernizr (?P<version>[0-9\.]+) \(Custom Build\)"},
{"url": r"/modernizr/(?P<version>[0-9\.]+)/modernizr(\.min)... | spectresearch/detectem | detectem/plugins/modernizr.py | Python | mit | 469 |
"""
Manager for movies.
.. module:: manager
:platform: Unix, Windows
:synopis: providing MovieManager class maintaining all movies
and providing load and save functionality
.. moduleauthor:: Thomas Lehmann <thomas.lehmann.private@googlemail.com>
=======
License
=======
Copyright ... | Nachtfeuer/concept-py | concept/data/movies/manager.py | Python | mit | 6,834 |
#!/usr/bin/env python
description = ">> clean and combine frames using cosmic and swarp "
usage = "%prog list_image [options] "
import os
import re
import string
import sys
import lsc
import numpy as np
from astropy.io import fits
from astropy.wcs import WCS
from optparse import OptionParser
def checkast(imglist):
... | svalenti/lcogtsnpipe | trunk/bin/lscmerge.py | Python | mit | 16,370 |
import datetime
import hashlib
from flask.ext.sqlalchemy import BaseQuery
from sqlalchemy.orm import Session
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from markdown import markdown
import bleach
from flask import cur... | XiaochenCui/algorithm_submit | app/models.py | Python | mit | 15,699 |
"""
Supervisor Blueprint
====================
Can be used as a provider to the application blueprint,
or used standalone by adding program templates under a `programs-available`
and enable them manually with the `programs` setting.
**Fabric environment:**
.. code-block:: yaml
blueprints:
- blues.superviso... | 5monkeys/blues | blues/supervisor.py | Python | mit | 7,526 |
# Copyright 2008-2017 Davide Alberani <da@erlug.linux.it>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This pro... | archerja/ilxr.py | imdb/parser/sql/alchemyadapter.py | Python | mit | 16,564 |
# 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-network/azure/mgmt/network/v2016_12_01/operations/express_route_circuits_operations.py | Python | mit | 42,813 |
import _plotly_utils.basevalidators
class TexttemplateValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="texttemplate", parent_name="scatterpolargl", **kwargs
):
super(TexttemplateValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/scatterpolargl/_texttemplate.py | Python | mit | 528 |
# File generated from our OpenAPI spec
from __future__ import absolute_import, division, print_function
from stripe import util
from stripe.api_resources.abstract import UpdateableAPIResource
from stripe.api_resources.account import Account
from stripe.six.moves.urllib.parse import quote_plus
class Person(Updateable... | stripe/stripe-python | stripe/api_resources/person.py | Python | mit | 1,089 |
#!/usr/bin/env python
#PBS -N HooverNPT
#PBS -m ae
#PBS -q long
#PBS -l nodes=1:opteron
from numpy import *
from Scientific.Statistics import *
from asap3 import *
from asap3.md.npt import *
from asap3.md.langevin import *
from ase.md.velocitydistribution import *
from ase.lattice.cubic import FaceCenteredCubic
from ... | auag92/n2dm | Asap-3.8.4/Test/HooverNPT.py | Python | mit | 5,068 |
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^', include('frontend.urls')),
]
| alexey-grom/django-webpack | example/project/urls.py | Python | mit | 136 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('djangocms_siteselector', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='siteinstance',
... | ptMuta/djangocms-siteselector | migrations/0002_siteinstance_default.py | Python | mit | 450 |
import collections
from supriya import CalculationRate
from supriya.ugens.DUGen import DUGen
class Dbufwr(DUGen):
"""
A buffer-writing demand-rate UGen.
::
>>> dbufwr = supriya.ugens.Dbufwr(
... buffer_id=0,
... source=0,
... loop=1,
... phase=0,
... | Pulgama/supriya | supriya/ugens/Dbufwr.py | Python | mit | 654 |
import magic
import base64
def EncodeBase64(buffer, force_mimetype='', charset=''):
if force_mimetype:
mimetype = force_mimetype
else:
mimetype = magic.from_buffer(buffer, mime=True)
header_parts = ['data:' + mimetype.decode('ascii')]
if charset:
header_parts.append('charset=... | whardier/python-data-uri | data_uri/encoder.py | Python | mit | 475 |
def shift_left(L):
''' (list) -> NoneType
Shift each item in L one position to the left
and shift the first item to the last position.
Precondition: len(L) >= 1
'''
first_item = L[0]
for i in range(1, len(L)):
L[i - 1] = L[i]
L[-1] = first_item
def count_adjacent_repea... | mdnu/snake | csc work/misc/w5/p/loops_over_indices.py | Python | mit | 642 |
# -*- coding: utf-8 -*-
########################################################################
#
# MIT License
#
# Copyright (c) 2017 Matej Vadnjal <matej@arnes.si>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), ... | ArnesSI/collectd-python-shower | shower/monitor.py | Python | mit | 4,991 |
#Rhea Prahlad, rp8jd
def greeting(msg):
print(msg)
| rp8jd/cs3240-labdemo | helper.py | Python | mit | 56 |
from nltk.stem.porter import PorterStemmer
from collections import Counter
import pickle
class SentenceData:
def __init__(self, path, encode='utf-8'):
self.sentences = []
self.words = []
with open(path, encoding=encode) as f:
for line in f.readlines():
sentence =... | knuu/nlp100 | chap08/72.py | Python | mit | 1,915 |
from django.contrib.syndication.views import Feed
from django.db.models import Max
from projects.models import Project
class LatestProjectsFeed(Feed):
title = "Recently updated documentation"
link = "http://readthedocs.org"
description = "Recently updated documentation on Read the Docs"
def items(sel... | johncosta/private-readthedocs.org | readthedocs/projects/feeds.py | Python | mit | 908 |
import six
import collections
import tensorflow as tf
from tensorflow import keras as ks
def sparse_filtering_loss(_, y_pred):
'''Defines the sparse filtering loss function.
Args:
y_true (tensor): The ground truth tensor (not used, since this is an
unsupervised learning algorithm).
... | KordingLab/spykes | spykes/ml/tensorflow/sparse_filtering.py | Python | mit | 6,705 |
# -*- coding: utf-8 -*-
"""
Created on 18/06/14 19:01
@author: <'Ronny Eichler'> ronny.eichler@gmail.com
""" | wonkoderverstaendige/MausverPyler_tracking | __init__.py | Python | mit | 109 |
"""
button.py
Source file implementing the button UI element.
This software is licensed under the MIT license. Refer to LICENSE.txt for more
information.
"""
import cairo
import vector
import rectangle
from .widget import Widget
class Button(Widget):
"""
A button is a widget tha... | BlackDragonN001/BZCLauncher | application/widgets/button.py | Python | mit | 3,069 |
"""
WSGI config for dominion 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETT... | jlward/dominion | dominion/wsgi.py | Python | mit | 393 |
from discord.ext import commands
"""
The permission system of the bot is based on a "just works" basis
You have permissions and the bot has permissions. If you meet the permissions
required to execute the command (and the bot does as well) then it goes through
and you can execute the command.
Certain permission... | dashwav/nano-chan | cogs/utils/checks.py | Python | mit | 2,634 |
# -*- coding: utf-8 -*-
'''
canteen page base
~~~~~~~~~~~~~~~~~
:author: Sam Gammon <sam@keen.io>
:copyright: (c) Keen IO, 2013
:license: This software makes use of the MIT Open Source License.
A copy of this license is included as ``LICENSE.md`` in
the root of the project.
'''
# ... | mindis/canteen | canteen/base/page.py | Python | mit | 439 |
import unittest
import pyphase
import numpy as np
from hypothesis import given, assume
from hypothesis.strategies import integers, floats, lists, composite
class TestModel(unittest.TestCase):
@composite
def valid_phase_type_generator(draw, k):
ptg = []
for i in range(k):
ptg.append... | sluenenglish/pyphase | pyphase/tests/test_model.py | Python | mit | 1,198 |
from ..Qt import QtGui, QtCore, QtWidgets
__all__ = ['BusyCursor']
class BusyCursor(object):
"""Class for displaying a busy mouse cursor during long operations.
Usage::
with pyqtgraph.BusyCursor():
doLongOperation()
May be nested.
"""
active = []
def __enter__(self):
... | mylxiaoyi/mypyqtgraph-qt5 | pyqtgraph/widgets/BusyCursor.py | Python | mit | 616 |
# -*- coding: utf-8 -*-
__doc__ = """
Module to host a Django application from within a CherryPy server.
Instead of creating a clone to `runserver` like other similar
packages do, we simply setup and host the Django application
using WSGI and CherryPy's capabilities to serve it.
In order to configure the application,... | l-dfa/django-spese | servizi/__init__.py | Python | mit | 1,287 |
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
from pprint import pprint
from datetime import datetime
from datetime import timedelta
import pickle
import copy
from pyhdf.SD import SD, SDC, SDS
import collections
filter_by_RH = False
timezone = -8
calib_stability_uncertainty = 0.1
#fire times... | annahs/atmos_research | WHI_long_term_v2_GEOSChem_and_meas_stats_histos_by_HYSPLIT_cluster_for_all_FT_sampling_Junwei_data.py | Python | mit | 27,320 |
# -*- coding: utf-8 -*-
# This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and
# is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012)
import types
import json
from geoq.core.models import AOI, Job, Project, Setting
from geo... | ngageoint/geoq | geoq/maps/models.py | Python | mit | 28,368 |
from axiom.test.historic.stubloader import saveStub
from axiom.userbase import LoginMethod
from xquotient.spam import SpambayesFilter
def createDatabase(s):
SpambayesFilter(store=s)
if __name__ == '__main__':
saveStub(createDatabase, 10876)
| twisted/quotient | xquotient/test/historic/stub_spambayesfilter1to2.py | Python | mit | 251 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from django.views import defaults as default_views
urlpat... | betobaz/django_docker | config/urls.py | Python | mit | 1,559 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# !!! DO NOT EDIT THIS FILE - THIS IS GENERATED FILE !!!
# Imports =====================================================================
import os
import base64
import os.path
import tempfile
from kwargs_obj import KwargsObj
from pers... | edeposit/edeposit.amqp.storage | src/edeposit/amqp/storage/structures/db/db_archive.py | Python | mit | 4,142 |
"""
"""
import os
import unittest
import arcpy
from gsfarc.test import config
class TestDatatypeByte(unittest.TestCase):
"""Tests the byte task datatype"""
@classmethod
def setUpClass(cls):
"""Class setup creates a toolbox file wrapper to GSF."""
config.setup_idl_toolbox('test_datatype_b... | geospatial-services-framework/gsfpyarc | gsfarc/test/test_datatype_byte.py | Python | mit | 1,379 |
from electrum_mona.i18n import _
fullname = 'Virtual Keyboard'
description = '%s\n%s' % (_("Add an optional virtual keyboard to the password dialog."), _("Warning: do not use this if it makes you pick a weaker password."))
available_for = ['qt']
| wakiyamap/electrum-mona | electrum_mona/plugins/virtualkeyboard/__init__.py | Python | mit | 247 |
from __future__ import unicode_literals
import platform
import pkg_resources
def matches_current_system(systems):
"""Return whether the current system matches any of the provided systems.
This will compare the current operating system or Linux distribution to
the list of systems provided and see if any... | reviewboard/rbpkg | rbpkg/utils/matches.py | Python | mit | 2,186 |
'''
Created on Sep 4, 2013
@author: anuvrat
'''
import pickle
import datetime
import urllib.request
from bs4 import BeautifulSoup
import re
def loadState():
try:
state_file = open( "state_dump", "rb" )
apps_discovered = pickle.load( state_file )
apps_pending = pickle.load( state_file )
... | anuvrat/scrape-google-play | src/crawlDroidmeter.py | Python | mit | 3,204 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import errno
import hashlib
import os
import re
import time
from datetime import datetime
from werkzeug.u... | ThiefMaster/indico | indico/util/fs.py | Python | mit | 7,516 |
import logging
from datetime import datetime
import html2text
import scrapy
from scrapy.http import FormRequest
from ptt.items import PostItem
class PTTSpider(scrapy.Spider):
name = 'ptt'
allowed_domains = ['ptt.cc']
start_urls = ('https://www.ptt.cc/bbs/Gossiping/index.html', )
_retries = 0
... | shaform/experiments | scrapy/ptt/spiders/ptt.py | Python | mit | 3,300 |
from __future__ import unicode_literals
from django.http import Http404, HttpResponseForbidden
from django.shortcuts import redirect, get_object_or_404, render
from django.utils.http import base36_to_int, int_to_base36
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _... | raytung/Slice | account/views.py | Python | mit | 28,974 |
# coding: utf-8
# In[1]:
import netCDF4
# In[2]:
nc1 = netCDF4.Dataset('http://www.smast.umassd.edu:8080/thredds/dodsC/models/fvcom/NECOFS/Archive/Seaplan_33_Hindcast_v1/gom3_201301.nc')
# In[3]:
#nc2 = netCDF4.Dataset('/usgs/data2/notebook/data/MassBay_1995_01.nc','r+')
nc2 = netCDF4.Dataset('/usgs/data2/note... | rsignell-usgs/notebook | UGRID/ugrid_add_lonlat.py | Python | mit | 606 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "techpong.settings.dev")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| collingreen/startuppong | manage.py | Python | mit | 255 |
import sys
import os
import iopc
import ops
import pprint
def buildModule(pkg_enabled, pkg_name, pkg_args, local_repo_path, output_path):
if pkg_enabled == 1:
print "===Env===[" + pkg_name + "]"
ops.mkdir(output_path)
if(os.path.exists(local_repo_path)):
build_pkg = None
... | YuanYuLin/PackMan_IOPC | pyiopc/iopc_env.py | Python | mit | 1,630 |
## module LUpivot
from numpy import argmax,dot,zeros,array
import swap
import error
def LUdecomp(a,tol=1.0e-9):
n = len(a)
seq = array(range(n))
# Set up scale factors
s = zeros(n)
for i in range(n):
s[i] = max(abs(a[i,:]))
for k in range(0,n-1):
# Row interchange, if needed
... | joonasfo/python | lupivot/LUpivot.py | Python | mit | 1,139 |
import unittest
import numpy as np
from xorshift import Xoroshiro
from xorshift import Xorshift128plus
class TestSeeding(unittest.TestCase):
def test_repeatable_seeding(self):
def assert_repeatable_seeding(cls):
SEED = 1
rng1 = cls(seed=SEED)
rng2 = cls(seed=SEED)
... | ihaque/xorshift | xorshift/tests.py | Python | mit | 4,944 |
from django.test import TestCase
from weapons import constants
from weapons.models import Weapon
class WeaponTestCase(TestCase):
fixtures = ['weapons.json']
def test_weapon(self):
weapon = Weapon.objects.get(pk=1)
self.assertIsInstance(weapon, Weapon)
self.assertEqual(weapon.name, 'D... | reiniervdwindt/power-rangers-api | src/weapons/tests.py | Python | mit | 538 |
import _plotly_utils.basevalidators
class HovertextsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="hovertextsrc", parent_name="box", **kwargs):
super(HovertextsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/box/_hovertextsrc.py | Python | mit | 404 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from flask import session
from indico.core import signals
from i... | mic4ael/indico | indico/modules/attachments/__init__.py | Python | mit | 2,413 |
"""Policy Network with naive board encoding"""
import os
from src.learn.bots.CommonLearn import CommonLearn
import src.learn.bots.utils as utils
class Learn(CommonLearn):
def handle_data(self, data):
boards = data[data.columns[3:-2]].as_matrix()
y = utils.policy_output(data['move'])
boa... | nathbo/GO_DILab | src/learn/bots/_22/learn.py | Python | mit | 694 |
# -*- coding: utf-8 -*-
# Django settings for floodlight project.
#Import private settings from config module
from config import secret,database
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Graylin Kim', 'graylin.kim@gmail.com'),
('Cihan Caglayan','caglac@rpi.edu'),
)
MANAGERS = ADMINS
DATABASES = da... | GraylinKim/Floodlight | settings.py | Python | mit | 2,574 |
'''
Tests for the Tm analysis class.
'''
from nose.tools import assert_equal
from coral import analysis, DNA
def test_finnzymes():
'''
Tests finnzymes method output.
'''
melt = analysis.tm(DNA('ATGCGATAGCGATAGC'), parameters='cloning')
assert_equal(melt, 55.2370030020752)
| klavinslab/coral | tests/tests/test_analysis/test_tm.py | Python | mit | 299 |
"""Handle configs from program name"""
from typing import Optional
from typing import List
from pysyte import __file__ as path_to_pysyte
from pysyte.oss import linux
from pysyte.config.types import ConfigPaths
from pysyte.types.dictionaries import NameSpaces
from pysyte.types.paths import DirectPath
from pysyte.types... | jalanb/dotsite | pysyte/cli/config.py | Python | mit | 1,607 |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2016 Mervin <mofei2816@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation... | mofei2816/mervinz | core/utils/time.py | Python | mit | 1,809 |
# Advection test evolution: convergence test
from models import advection
from bcs import periodic
from simulation import simulation
from methods import weno3_lf
from rk import rk3
from grid import grid
import numpy
from matplotlib import pyplot
Ngz = 3
Npoints_all = 40 * 2**numpy.arange(5)
dx_all = 1 / Npoints_all
e... | IanHawke/toy-evolve | toy-evolve/advection_sine_weno3_lf_rk3_convergence.py | Python | mit | 1,381 |
# -*- coding: utf-8 -*-
import MySQLdb, tweepy, time
from tweepy import OAuthHandler
#-----------------------------------------------------------------------------------
#Enter the keys of your twitter applicaiton to connect to the API
ckey = "***" #consumer key
csecret = "***" #consumer secret
atoken... | MikhailZherebtsov/russian_twitter_analysis | Data_collection/Friendship_collection.py | Python | mit | 4,652 |
from distutils.core import setup, Extension
from distutils.sysconfig import get_python_inc
module = Extension('checksieve',
sources = ['src/python.cc'],
include_dirs = ['src', 'src/AST', 'gen', get_python_inc(), get_python_inc(plat_specific=True)],
libraries ... | dburkart/check-sieve | test/setup.py | Python | mit | 616 |
#!/usr/bin/env python3
# Copyright (c) 2010 ArtForz -- public domain half-a-node
# Copyright (c) 2012 Jeff Garzik
# Copyright (c) 2010-2016 The Kore Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# mininode.py -... | Kore-Core/kore | qa/rpc-tests/test_framework/mininode.py | Python | mit | 39,163 |
"""Classical AMG."""
from . import classical
from . import split
from . import interpolate
from . import cr
from .classical import ruge_stuben_solver
__all__ = [
'classical',
'split',
'interpolate',
'cr',
'ruge_stuben_solver',
]
| pyamg/pyamg | pyamg/classical/__init__.py | Python | mit | 252 |
#!/usr/bin/env python
# Copyright 2013 Abram Hindle
#
# 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... | abramhindle/CMPUT404-AJAX-Slides | ObserverExample/server.py | Python | mit | 2,933 |
from __future__ import print_function
import os
import shutil
from datetime import datetime
import time
import stat
import save_reader as sr
import json
SAVE_DIR = 'C:/Users/ld/Documents/Klei/DoNotStarveTogether/Cluster_1/Master/save'
BACKUP_DIR = 'C:/Users/ld/Documents/Klei/helper/save'
INTERVAL = 8*60 # seconds
MAX_... | shenchenchester/dontstarve_tool | backup.py | Python | mit | 4,052 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class CourseItem(scrapy.Item):
# define the fields for your item here like:
name = scrapy.Field()
image = scrapy.Field()
learned = scrap... | Oblivion1221/Pycodes | scrapy_spider/General/items.py | Python | mit | 339 |
# -*- coding: utf-8 -*-
import scrapy
from tourney_scrape.items import myDatabase
import re
class TourneySpider(scrapy.Spider):
name = "tourney"
allowed_domains = "databasesports.com"
start_urls = []
for i in range(1975,2014,1):
start_urls.append('http://www.databasesports.com/ncaab/tourney.ht... | trcook/ncaa_tournament_scrape | tourney_scrape/spiders/tourney.py | Python | mit | 1,790 |
from djbase.exceptions import BaseError
class AccountError(BaseError):
pass
class AccountLoginError(AccountError):
""" Raised when the login email or password is invalid. """
pass
class AccountMissingError(AccountError):
""" Raised when the login email does not exist. """
pass
class AccountNo... | lucastan/django-starter-box | djaccount/exceptions.py | Python | mit | 1,189 |
pid = 'id'
key ='key' | chngchinboon/intercomstats | configs.py | Python | mit | 22 |
# -*- coding: utf-8 -*-
"""
Here we try to safely use crispy_form if installed
"""
from django.utils.translation import ugettext as _
from po_projects.utils.imports import safe_import_module
# Try to import "crispy-forms" base stuff to use for the default helper
try:
from crispy_forms.helper import FormHelper
... | sveetch/PO-Projects | po_projects/forms/__init__.py | Python | mit | 1,844 |
from decimal import *
import logging
import matplotlib
import matplotlib.pyplot as plt
from PIL import Image
import StringIO
import requests
from util.s3 import Uploader
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
s3 = Uploader()
"""
Tools for managing charts
"""
class ... | thecarebot/carebot | util/chart.py | Python | mit | 2,308 |
# -*- coding: utf-8 -*-
'''
Created on 2014-2-17
@author: CL.lam
'''
import os
import random
import traceback
import transaction
import shutil
import json
from datetime import datetime as dt
from tg import expose, redirect, flash, request, config, session
from tg.decorators import paginate
from repoze.what import autho... | LamCiuLoeng/aeo | rpac/controllers/ordering.py | Python | mit | 43,885 |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
setup(name='egggitinfo',
version='0.1',
description='Plants some git-related data into the .egg-info directory of a python package.',
long_d... | Doula/egggitinfo | setup.py | Python | mit | 542 |
from decimal import *
import glob
import itertools
import logging
import os
import shutil
import sys
import traceback
from simfile import Simfile
__all__ = ['SynctoolsCommand', 'FieldInputs', 'FieldTypes', 'common_fields']
class SynctoolsCommand(object):
"""
Base class for synctools commands.
The follow... | garcia/synctools | synctools/command.py | Python | mit | 4,771 |
import json
import logging
import smtplib
import threading
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import time
from elasticsearch import Elasticsearch
from apscheduler.schedulers.background import BackgroundScheduler
import random
import watcher.models as models
from django.c... | tranhuucuong91/mesos-admin | watcher/utils.py | Python | mit | 6,218 |
from django.shortcuts import render
from django.http import HttpResponse
from django.template import RequestContext, loader
from voxel_globe.tools import session
cookie_name = 'voxel_globe_order_threshold_point_cloud_session'
@session.StartSession(cookie=cookie_name)
def make_order_1(request):
from voxel_globe.met... | andyneff/voxel-globe | voxel_globe/order/threshold_point_cloud/views.py | Python | mit | 1,364 |
"""Markov Decision Processes (Chapter 17)
First we define an MDP, and the special case of a GridMDP, in which
states are laid out in a 2-dimensional grid. We also represent a policy
as a dictionary of {state:action} pairs, and a Utility function as a
dictionary of {state:number} pairs. We then define the value_itera... | mufid/berkilau | ws/CSUIBotClass2014/test/mdp-aima/mdp.py | Python | mit | 5,622 |
import codecs
import io
import json
import os
import sys
class FileWorker(object):
""" File worker - easy file loading
There can be a problem with encoding, so we have to try open file as standard
UTF-8 and as a UTF-8 with BOM.
"""
def open_file(self, file):
""" Open specified file """
... | PraserX/j3a | j3a-crypter/src/file_worker.py | Python | mit | 1,684 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "whatsnew.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| johnstcn/whatsnew | manage.py | Python | mit | 251 |
from __future__ import division
import numpy as np
from graph_tool.all import *
from matplotlib import pyplot as plt
import pickle
# wikipedia graph structural statistics
print 'before load'
network = load_graph("wikipediaNetwork.xml.gz")
print 'after load'
clust = network.vertex_properties["local_clust"]
n, bin... | linksuccess/linksuccess | parsingframework/structural_statistics_hist.py | Python | mit | 3,630 |
import sys
from ibex.geometry import ib3shapes
from ibex.utilities.constants import *
class MetaData:
def __init__(self, prefix):
# initialize the prefix variable
self.prefix = prefix
# backwards compatability variable defaults
self.affinity_filename = None
self.boundary_... | bmatejek/ibex | data_structures/meta_data.py | Python | mit | 7,278 |
from collections import OrderedDict
import logging
import urllib
from flask import current_app, session
from requests.exceptions import ConnectionError, Timeout
import slumber
from slumber.exceptions import SlumberBaseException
import json
from cla_common.constants import ELIGIBILITY_STATES
from cla_public.apps.check... | ministryofjustice/cla_public | cla_public/apps/checker/api.py | Python | mit | 8,674 |
#-*- coding: utf8 -*-
#Initial permut matrix for the datas
PI = [58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
... | ajdinm/crypto | python/pydes.py | Python | mit | 9,525 |
from libsolace import Plugin
import libsolace
@libsolace.plugin_registry.register
class NullPlugin(Plugin):
plugin_name = "NullPlugin"
args = None
kwargs = None
def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = kwargs
def some_method(self, *args, **kwargs):
... | unixunion/python-libsolace | libsolace/items/NullPlugin.py | Python | mit | 419 |
from mantle.util.fsm import *
from greenery.fsm import fsm as greenery_fsm
| bjmnbraun/icestick_fastio | thirdparty/magma/mantle/util/fsm/__init__.py | Python | mit | 75 |
import pydeck as pdk
"""
CartoSQLLayer
=============
Integration with Carto (https://carto.com).
Any urban area with greater than 100,000 in green.
"""
layer = pdk.Layer(
"CartoSQLLayer",
data="SELECT the_geom_webmercator, gn_pop FROM populated_places",
credentials={"username": "public", "apiKey": "defa... | uber-common/deck.gl | bindings/pydeck/examples/carto_sql_layer.py | Python | mit | 516 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-05 00:44
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('recipes', '0007_auto_20160330_1637'),
]
operations = [
migrations.AlterModel... | vanatteveldt/luctor | recipes/migrations/0008_auto_20160405_0044.py | Python | mit | 1,062 |
"""Handles key strokes in the media manager."""
import logging
from kivy.core.window import Window
from kivy.uix.widget import Widget as KivyWidget
class Keyboard(KivyWidget):
"""Handles key strokes in the media manager."""
def __init__(self, mc, **kwargs):
super().__init__(**kwargs)
self.... | missionpinball/mpf-mc | mpfmc/core/keyboard.py | Python | mit | 7,430 |
from __future__ import print_function, absolute_import, division
from past.builtins import reload
import logging
import sam.sam as sam
reload(sam)
class hxhal(object):
def __init__(self, actor, name,
loglevel=logging.DEBUG):
self.actor = actor
self.name = name
self.logge... | CraigLoomis/ics_hxActor | python/hxActor/Controllers/hxhal.py | Python | mit | 1,113 |
# coding=utf-8
from __future__ import absolute_import
from setuptools import setup
setup(
name='ulog',
version='0.3.3',
packages=['ulog'],
url='https://github.com/MrUPGrade/ulog',
license='MIT',
author='Jakub (Mr. UPGrade) Czapliński',
author_email='sirupgrade@gmail.com',
description='... | MrUPGrade/ulog | setup.py | Python | mit | 1,110 |
# vim: set fileencoding=utf-8
# Pavel Odvody <podvody@redhat.com>
#
# HICA - Host integrated container applications
#
# MIT License (C) 2015
import os
from base.hica_base import *
class PulseInjector(HicaInjector):
def get_description(self):
return "Bind mounts current user's Pulse audio socket into the contain... | coolhacks/docker-hacks | examples/hica/injectors/pulse.py | Python | mit | 588 |
#!/usr/bin/python3 -tt
# -*- coding: utf-8 -*-
__all__ = ['make_site']
from sqlalchemy import *
from sqlalchemy.exc import *
from werkzeug.exceptions import *
from adminator.site.util import *
from functools import wraps
from sqlalchemy import desc
from sqlalchemy.exc import SQLAlchemyError
from datetime import dat... | techlib/adminator | adminator/site/__init__.py | Python | mit | 16,826 |
from django.contrib.auth import login, authenticate
from django.shortcuts import render, redirect
from django.views.generic import View
from .forms import SignUpForm
# Create your views here.
class Home(View):
def get(self, request, *args):
return render(request, 'home.html')
def signup(request):
i... | kaiserbrito/pythonshop | catalog/views.py | Python | mit | 805 |
def getPigLatin(word):
firstLetter = word.slice(word, 1, 1)
if firstLetter in ['a', 'e', 'i', 'o', 'y']
word.append("ay")
else
word.append(firstLetter)
word.append("ay")
print word
| christieewen/Algorithms | TechInterviews/Python/piglatin.py | Python | mit | 204 |
# coding=utf-8
from __future__ import unicode_literals
from vote_bot import db
from vote_bot.utils import send_404
from vote_bot.utils import direct_msg
def update_vote(user_id, vote_id, text):
"""
Обновляет текст предложения.
Такая возможность должна быть только у автора предложения.
команда: /vot... | Iamthelaw/vote-bot | vote_bot/commands/update.py | Python | mit | 1,010 |
# all the imports
import os
import sqlite3
import datetime
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash
from flask.ext.babel import Babel, lazy_gettext
from passlib.apps import custom_app_context as pwd_context
from config import LANGUAGES
... | Bytespeicher/KANT | src/kant.py | Python | mit | 8,385 |
#!/usr/bin/env python
# encoding: utf-8
import os
from smisk.mvc import Application
if __name__ == '__main__':
Application.main(os.path.dirname(__file__))
| rsms/smisk | admin/old_examples/mvc_process.py | Python | mit | 158 |
# 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/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_private_link_resources_operations.py | Python | mit | 5,631 |
"""Tests for the add function"""
from unittest import TestCase
import adder
class TestAdd(TestCase):
"""Test the add function"""
def test_int(self):
"""Test adding integers"""
result = adder.add(3, 4)
self.assertEqual(result, 7)
def test_float(self):
"""Test adding floats"... | jamesmcdonald/adder | adder/tests/test_add.py | Python | mit | 929 |
import sys
from org.apache.pig.scripting import Pig
load = Pig.compileFromFile(sys.argv[1])
iteration = Pig.compileFromFile('iteration.pig')
store = Pig.compileFromFile('store.pig')
print '*** Loading input ***'
load_stats = load.bind({'EDGES_OUT': 'edges0.tmp'}).runSingle()
if not load_stats.isSuccessful():
ra... | AndreyLogvinov/ap-pig | workflow.py | Python | mit | 1,780 |
"""
Django settings for connectedin project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... | danieldeveloper001/Learning | Python/03_MVC/ConnectedIn/connectedin/settings.py | Python | mit | 2,632 |