text stringlengths 4 1.02M | meta dict |
|---|---|
"""
:mod:`bitdeli.widgets`: Dashboard toolkit
=========================================
The :mod:`bitdeli.widgets` module contains *widgets* that are used to compose
a dashboard in the :ref:`card-script`.
Add a card called *Widget Gallery* to see a live example of all widgets. The
source code is available on `Github ... | {
"content_hash": "6aaff2d5109e1fa45ad3d72eb3839e5c",
"timestamp": "",
"source": "github",
"line_count": 414,
"max_line_length": 93,
"avg_line_length": 29.758454106280194,
"alnum_prop": 0.6122564935064935,
"repo_name": "bitdeli/bitdeli-py",
"id": "2a3725c15de160832012b7052db6ebe8458a6961",
"size": "... |
import argparse
__author__ = 'kinpa200296'
def check_if_sorted(filename, ascending=True):
with open(filename, 'r') as f:
s = f.readline()
if s == '':
return True
prev = int(s)
s = f.readline()
while s != '':
cur = int(s)
if ascending:
... | {
"content_hash": "6ca5ac783083815ab0b8a875fcf39cf7",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 86,
"avg_line_length": 25.266666666666666,
"alnum_prop": 0.5083553210202286,
"repo_name": "kinpa200296/python_labs",
"id": "6426a7aa1144603b703bbace9e0249804b2e5c54",
"size... |
"""\
Dynamic inventory for Terraform - finds all `.tfstate` files below the working
directory and generates an inventory based on them.
"""
from __future__ import unicode_literals, print_function
import argparse
from collections import defaultdict
from functools import wraps
import json
import os
import re
def tfstat... | {
"content_hash": "98e97c2d4b61150c8b83c0f90e34d4dc",
"timestamp": "",
"source": "github",
"line_count": 376,
"max_line_length": 78,
"avg_line_length": 31.68617021276596,
"alnum_prop": 0.5683229813664596,
"repo_name": "cmgc/microservices-infrastructure",
"id": "ad6c8ac44a4d220921eacb468fb1932e5e1d06a8... |
"""Command line tool to run the Google API library generator.
Usage:
$ PYTHONPATH=$(/bin/pwd)/src \
$(/bin/pwd)/src/googleapis/codegen/generate_library.py \
--api_name=plus --api_version=v1 --output_dir=plus_lib
"""
__author__ = 'aiuto@google.com (Tony Aiuto)'
import collections
import json
import logging
impor... | {
"content_hash": "a68f5e33c2fb7c8598b427641209bd8c",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 80,
"avg_line_length": 32.53917050691244,
"alnum_prop": 0.6765330689704008,
"repo_name": "Byclosure/google-apis-client-generator",
"id": "72e4adeecd0c3966bcfcc74e99e827a098a... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class URLDecode(Choreography):
def __init__(self, temboo_session):
"""
Create a new... | {
"content_hash": "0182124105c41933b731e2fdd3a18f13",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 119,
"avg_line_length": 35.714285714285715,
"alnum_prop": 0.704,
"repo_name": "jordanemedlock/psychtruths",
"id": "df6c27d0286e024ecd425781b2c466b1672edf13",
"size": "2867"... |
"""Abortable Tasks.
Abortable tasks overview
=========================
For long-running :class:`Task`'s, it can be desirable to support
aborting during execution. Of course, these tasks should be built to
support abortion specifically.
The :class:`AbortableTask` serves as a base class for all :class:`Task`
objects ... | {
"content_hash": "3af5e5437baaf92a7d3c2466a03d9b92",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 78,
"avg_line_length": 30.11111111111111,
"alnum_prop": 0.6599339677607302,
"repo_name": "mdworks2016/work_development",
"id": "36cce30dd69a5e752a98310c3b665f9ce4ee5799",
... |
from django.conf.urls import include, patterns, url
from rest_framework.routers import SimpleRouter
import mkt.feed.views as views
from mkt.api.base import SubRouterWithFormat
from mkt.api.v1.urls import urlpatterns as v1_urls
from mkt.api.views import endpoint_removed
from mkt.search.views import RocketbarViewV2
f... | {
"content_hash": "9fd49d67f8d7b2591f432a43d937bd81",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 79,
"avg_line_length": 45.375,
"alnum_prop": 0.6938213301849665,
"repo_name": "andymckay/zamboni",
"id": "822eb818fd68bbc9bc0fbb7a1807a5b5637ec182",
"size": "2541",
"bina... |
from film_crawler.base import logger, Helper, Config
from film_crawler.crawler import DoubanCrawler, FilmDownloadInfoCrawlerFactory
from film_crawler.data import PersistenceFilmQueryInfo, StatFilmQueryInfo
def film_query_info_wrapper():
logger.info('豆瓣用户[ID:{}][{}]的电影'.format(Config.DOUBAN_USER_ID, Config.DOUBAN_... | {
"content_hash": "07d696628524fefaf1ef96e184f4a2c0",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 112,
"avg_line_length": 46.36538461538461,
"alnum_prop": 0.6507673164661966,
"repo_name": "q191201771/film_crawler",
"id": "3ca4faba0ceef51abd2648077b99034a68734272",
"size... |
'''
Contains a LinkedList class for constructing linked lists out of Node objects.
Partly adapted from:
http://en.literateprograms.org/Singly_linked_list_%28Python%29
'''
class LinkedList:
def __init__(self):
self.head = None
self.tail = None
self.number_of_created_nodes = 0
s... | {
"content_hash": "d2dbbe066443bf8d972c155db5150d5f",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 81,
"avg_line_length": 30.130434782608695,
"alnum_prop": 0.5721500721500722,
"repo_name": "BFriedland/data-structures",
"id": "1f444181be51badae1b03a8536d48a3117d8a9f7",
"... |
"""Contains the base Layer class, from which all layers inherit."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import copy
import functools
import itertools
import threading
import warnings
import weakref
import numpy as np
import si... | {
"content_hash": "70bf5cf14cfcf4efacf5925067ae8c60",
"timestamp": "",
"source": "github",
"line_count": 3219,
"max_line_length": 120,
"avg_line_length": 39.62224293258776,
"alnum_prop": 0.6588863451044346,
"repo_name": "petewarden/tensorflow",
"id": "1a9d701b5d368f9330fdb250974b3340120db530",
"size... |
from datetime import timedelta
import functools
import itertools
import warnings
import numpy as np
import pandas as pd
from . import common
from . import indexing
from . import ops
from . import utils
from .pycompat import basestring, OrderedDict, zip, dask_array_type
from .indexing import (PandasIndexAdapter, ortho... | {
"content_hash": "712ca6278195320d4333482d7a33110a",
"timestamp": "",
"source": "github",
"line_count": 951,
"max_line_length": 81,
"avg_line_length": 36.840168243953734,
"alnum_prop": 0.6000285428856857,
"repo_name": "petercable/xray",
"id": "af600ab0fe64bb525358e7461d8a952c9320aadd",
"size": "350... |
"""
Network resource backend.
"""
# W0613:unused arguments,R0201:mth could be func,R0903:too few pub mthd.
# W0232:no init
# pylint: disable=W0613,R0201,R0903,W0232
from occi import backend
from occi_os_api.extensions import os_addon
from occi_os_api.nova_glue import net
class NetworkBackend(backend.KindBackend, b... | {
"content_hash": "8682a0b33db07ec6b97f4912cea962f6",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 78,
"avg_line_length": 32.264150943396224,
"alnum_prop": 0.5681286549707603,
"repo_name": "EGI-FCTF/occi-os",
"id": "733d1a5a850c547ec8187ae06d6bad4e17cb64f8",
"size": "41... |
from Queue import Queue
from contextlib import contextmanager
class ObjectPool(object):
"""
TODOD: implement spin down of unused objects
"""
class Remove(Exception):
pass
def __init__(self, obj, size=None, maxsize=None, *args, **kwargs):
self.queue = Queue(maxsize = maxsize)
... | {
"content_hash": "8487d51c23076b136cc49dfb1677e0f3",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 77,
"avg_line_length": 27.25,
"alnum_prop": 0.581039755351682,
"repo_name": "timcherry/protobuf-rpc",
"id": "f2912798aed8561a6d8111af874f7115d436b29d",
"size": "1308",
"b... |
import imp
import os
import inspect
import logging
class YAS3FSPlugin (object):
@staticmethod
def load_from_file(yas3fs, filepath, expected_class = None):
class_inst = None
try:
mod_name,file_ext = os.path.splitext(os.path.split(filepath)[-1])
if file_ext.lower() == '.py':
py_mod = imp.load_source(mod... | {
"content_hash": "290c4cac01bd099f66ab9c71d66151cc",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 91,
"avg_line_length": 26.464788732394368,
"alnum_prop": 0.6546035125066525,
"repo_name": "padde/yas3fs",
"id": "0f6e2f81c2c57364361fac9e740da764024bd5fe",
"size": "1899",
... |
"""
A script to import initial data from ProEco into Theros
"""
import logging
import argparse
import sys
import re
import hashlib
import os
parser=argparse.ArgumentParser(description=__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("-w","--works", help="the csv file containing the... | {
"content_hash": "860c9eae096dcee17a81bee319d0e38e",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 191,
"avg_line_length": 45.27918781725889,
"alnum_prop": 0.6045964125560538,
"repo_name": "doc212/theros",
"id": "e99c6476d9928d1743a022d20ec60012629036cf",
"size": "8942"... |
import unittest
import os
from unittest import TextTestResult
from django.test.runner import DiscoverRunner
from django.db import NotSupportedError
from djangae.utils import find_project_root
from google.appengine.ext import testbed
# Many Django tests require saving instances with a PK
# of zero. App Engine doesn... | {
"content_hash": "df18d81b38106845370696d36b9d5f9d",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 123,
"avg_line_length": 38.443820224719104,
"alnum_prop": 0.6773345024112232,
"repo_name": "trik/djangae",
"id": "09d0a255b4b93f6885fcdd426e0cc68c6350216f",
"size": "6843"... |
"""library to store the fingeprints along with the document info into the DB
"""
__authors__ = [
'"Kailash Budhathoki" <kailash.buki@gmail.com>'
]
import datetime
import errno
import os
import shutil
from pymongo import Connection
STORAGE_DIR = '%s/volumes/predator/files/' % os.environ['PREDATOR_HOME']
def ... | {
"content_hash": "d6a1711c9e063bb39f4165e8cb573a13",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 100,
"avg_line_length": 24.5,
"alnum_prop": 0.6126029359112066,
"repo_name": "kailashbuki/predator",
"id": "1faa87e829cad70c6cbd9d883db849549cf4b9ce",
"size": "3922",
"b... |
extensions = [
'oslosphinx',
'reno.sphinxext',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
# source_encoding = 'utf-8-sig'
# The master toctree document.
ma... | {
"content_hash": "4a517fb8e1fa0c56992f8840730407b4",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 79,
"avg_line_length": 31.661016949152543,
"alnum_prop": 0.6992773019271948,
"repo_name": "coreycb/snap.openstack",
"id": "e0bfc4c833516794d059329a237fbd8edf7517de",
"size... |
"""
Created on Thursday June 23 14:42:21 2016
tracks a moving object using method of cross-correlation to find the shift
between successive images in video from a hand-held infrared camera
@author: foresterd
"""
from sys import path as spath
spath.append('/home/foresterd/drfpy/plotting')
import show_plots
spath.appe... | {
"content_hash": "b24e45afbc4eb0c2eb9af8616ecf2e60",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 92,
"avg_line_length": 35.254901960784316,
"alnum_prop": 0.6218020022246941,
"repo_name": "drforester/drone-tracker",
"id": "0784d91da0bbade91014d323c807f59c14f2a79e",
"si... |
""" Provides support utilities for checking cubes."""
from typing import List, Optional, Union
import iris
import numpy as np
from iris.cube import Cube, CubeList
from iris.exceptions import CoordinateNotFoundError
def check_for_x_and_y_axes(cube: Cube, require_dim_coords: bool = False) -> None:
"""
Check w... | {
"content_hash": "57cb740d847c011c5793c92a0bde1e33",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 95,
"avg_line_length": 36.0042194092827,
"alnum_prop": 0.6238134302121177,
"repo_name": "metoppv/improver",
"id": "ef548c6231890af349ec74292a60071f08109109",
"size": "1019... |
from .forms import CustomAuthenticationForm
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib.auth import views as auth_views
### Static url pattern... | {
"content_hash": "44ea06c4d049d9b00158f2c7a774973d",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 154,
"avg_line_length": 51.457142857142856,
"alnum_prop": 0.7129372570794004,
"repo_name": "pombredanne/bangoo",
"id": "63dd381763dacedbb1c24807fae1cb865846364b",
"size": "... |
from rest_framework import serializers
from api.webview.models import Document
class DocumentSerializer(serializers.ModelSerializer):
class Meta:
model = Document
fields = ('id', 'providerUpdatedDateTime', 'source', 'docID', 'raw', 'normalized')
| {
"content_hash": "8cb668045ad35b4685d1ddff249dac85",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 90,
"avg_line_length": 27,
"alnum_prop": 0.7185185185185186,
"repo_name": "mehanig/scrapi",
"id": "decdb7cba4bfba2e448c97bde87680833fe9d483",
"size": "270",
"binary": fal... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
if sys.version_info < (2, 7):
pytestmark = pytest.mark.skip("F5 Ansible modules require Python >= 2.7")
from ansible.module_utils.basic import AnsibleModule
try:
from librar... | {
"content_hash": "bfe59ab13d86aef6cc0a5c8db485c2f6",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 82,
"avg_line_length": 27.9126213592233,
"alnum_prop": 0.664,
"repo_name": "thaim/ansible",
"id": "63ac7b3a88bb33095d5a3dae268bb58da01b01d7",
"size": "3034",
"binary": f... |
from __future__ import unicode_literals
from netmiko.mellanox.mellanox_ssh import MellanoxSSH
__all__ = ['MellanoxSSH']
| {
"content_hash": "ba627432c3080e69013376503c488b21",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 53,
"avg_line_length": 30.25,
"alnum_prop": 0.7603305785123967,
"repo_name": "isidroamv/netmiko",
"id": "2df6bbc954dd8d0b5ab2c0b67e6d82b07c404286",
"size": "121",
"binary"... |
from __future__ import print_function
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
#----------------------------------------------------------------------
# Purpose: This test exercises HDFS operations from python.
#-------------------------------------------------------------------... | {
"content_hash": "61848d47becdd743058cb76cac788034",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 118,
"avg_line_length": 37.41538461538462,
"alnum_prop": 0.4979440789473684,
"repo_name": "h2oai/h2o-dev",
"id": "899b808dda4755c4599fcd505dfa7c32961529af",
"size": "2432",... |
def caches(cap, sources, srs_grids):
caches = {}
for name, source in sources.iteritems():
conf = for_source(name, source, srs_grids)
if not conf:
continue
caches[name[:-len('_wms')] + '_cache'] = conf
return caches
def for_source(name, source, srs_grids):
cache = {
... | {
"content_hash": "718775a2116830c7af1d79a5981c1045",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 53,
"avg_line_length": 20.88888888888889,
"alnum_prop": 0.5478723404255319,
"repo_name": "Anderson0026/mapproxy",
"id": "c874af30933c2a8e819cbe3c376c095ad4ffd9ac",
"size": ... |
import SP_paras
import test_algorithm as ta
#this experiment could extract paras from SP and then input these paras into SAM and got res. Switch discard_AAWP control whether use AA AW AP or not.(much bigger than AS's)
# Switch~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
discard_AAWP = 1
check_paras = 1
check_ori_ABP_bands = 0
#th... | {
"content_hash": "8a597966f323aeeed0d1a5ecdfc4c8d6",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 174,
"avg_line_length": 35,
"alnum_prop": 0.621321961620469,
"repo_name": "Vincentyao1995/Globalink2017-UBC",
"id": "bc87276a38143f67012ac03fe29838f4bc3ad8cb",
"size": "234... |
from django.shortcuts import render
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
import datetime
from mapApp.models import Incident, Hazard, Theft, AlertArea
@login_required
def recentReports(request):
user = request.user
# Get the user's alertable points in ... | {
"content_hash": "b7fa410a96ae4f474fd002a52fcdeab2",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 115,
"avg_line_length": 43.5,
"alnum_prop": 0.7136886102403344,
"repo_name": "SPARLab/BikeMaps",
"id": "dda8863250344b4d823b0062efbe870ae22f0d0b",
"size": "1914",
"binary... |
"""
This module handles messages.
"""
import logging
import json
import random
import yaml
from google.appengine.ext import deferred
from google.appengine.api import urlfetch # we've locked in the data so why not
import data.models
import data.tools
from flask import Flask
import flask
app = Flask(__name__)
USER... | {
"content_hash": "2cdc724f6041169f02c0c5d54c83ba39",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 83,
"avg_line_length": 30.287128712871286,
"alnum_prop": 0.5946387708401438,
"repo_name": "PFCM/slack-ml",
"id": "1ab6e19f6f9a4698f5f3cc51a279dd2161de2e4e",
"size": "3059"... |
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession
from virtool.subtractions.models import SubtractionFile
from virtool.subtractions.tasks import AddSubtractionFilesTask
from virtool.tasks.models import Task
async def test_add_subtraction_files_task(
snapshot,
tmp_path... | {
"content_hash": "9b4da7d87c8a39892a6d79c797db6324",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 69,
"avg_line_length": 26.571428571428573,
"alnum_prop": 0.6478494623655914,
"repo_name": "igboyes/virtool",
"id": "8efe90658ed677cd047a922d5e8f1f550b2c3b93",
"size": "1488... |
"""
Django settings for server project.
Generated by 'django-admin startproject' using Django 1.11.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
... | {
"content_hash": "028805f382056d6ad664831d09b5f61a",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 91,
"avg_line_length": 26.421965317919074,
"alnum_prop": 0.6718442353970685,
"repo_name": "damnko/angular2-django-movies",
"id": "2e721ecc4b173a8a387748d4a52543117515c3da",
... |
from distutils.core import setup
from distutils.command.install import INSTALL_SCHEMES
for scheme in INSTALL_SCHEMES.values():
scheme['data'] = scheme['purelib']
setup(name='DITA Generator',
version='@version@',
description='DITA Generator library',
author='Jarno Elovirta',
author_email='j... | {
"content_hash": "71c99208f2ed4bca603b70adabb5b8fe",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 65,
"avg_line_length": 36.96296296296296,
"alnum_prop": 0.6032064128256514,
"repo_name": "jelovirt/dita-generator",
"id": "1da7488729d678f615ededec486c07293925bfc4",
"size"... |
import requests, os, re
from urllib.parse import urljoin, urlparse
from bs4 import BeautifulSoup
class NHKNewsParser():
nhkTopStoriesJSONUrl = "http://www3.nhk.or.jp/news/json16/accessranking.json"
nhkNewsBaseUrl = "http://www3.nhk.or.jp/news/"
oldNewsFile = "oldnews.txt"
def __init__(self):
#... | {
"content_hash": "d2494938f380ec68e43256852c53d936",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 123,
"avg_line_length": 36.86138613861386,
"alnum_prop": 0.5928015041633091,
"repo_name": "KinRyuuXIV/NHKNews",
"id": "9fca18725d96eab57cdcd95694f85e405b0a4b66",
"size": "... |
from numpy import zeros
from gwlfe.Input.WaterBudget.Percolation import Percolation
from gwlfe.Input.WaterBudget.Percolation import Percolation_f
from gwlfe.Memoization import memoize
try:
from .DeepSeep_inner_compiled import DeepSeep_inner
except ImportError:
print("Unable to import compiled DeepSeep_inner, ... | {
"content_hash": "31fd42c22d2c2c64116671e5d6fc12fa",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 117,
"avg_line_length": 50.627906976744185,
"alnum_prop": 0.6159853008727607,
"repo_name": "WikiWatershed/gwlf-e",
"id": "11f8e105876613d70d4eff94148cb13c10eebf9a",
"size":... |
def aggregate(data, dataDict):
magic = data[0]
if validateMagic(magic):
id = data[1]
funcType = data[2]
storageType = data[3]
sequence = data[4]
payloadLength = data[5]
payload = []
print(str(payloadLength))
for x in range(6,payloadLength + 6):
... | {
"content_hash": "d041826c73424a8125f08ca0e6ac17ae",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 110,
"avg_line_length": 27.875,
"alnum_prop": 0.5795964125560538,
"repo_name": "BoxBlue/Box",
"id": "4f6d36bfbdea37d693b18163775808d1bcccb44b",
"size": "1786",
"binary": ... |
from django.contrib import admin
from django_unsaved_changes.admin import UnsavedChangesAdmin
from .models import *
class MatchUserInline(admin.TabularInline):
model = MatchUser
extra = 0
autocomplete_lookup_fields = {
'fk': ['user'],
}
raw_id_fields = ('user', )
class MatchAdmin(... | {
"content_hash": "f5940738b0ec1f1a9ccf4e5f24d5f457",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 72,
"avg_line_length": 23.58490566037736,
"alnum_prop": 0.6704,
"repo_name": "ninapavlich/celadon",
"id": "f4f2af9e052e02cfd64be8ba18b8fc2986f2cffd",
"size": "1250",
"bin... |
import random
def computeNextMove(floors, elevators):
numFloors = len(floors)
numElevs = len(elevators)
# the trailing , is required so that python doesn't reduce ((1,2)) to (1,2)
# the C++ code on the other end of this function expects a tuple of tuples
# of size 2, not a tuple of ints.
# wr... | {
"content_hash": "d84067ff2416b0c6af7dd89e2d36efc4",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 85,
"avg_line_length": 36.666666666666664,
"alnum_prop": 0.6439393939393939,
"repo_name": "maxdeliso/elevatorSim",
"id": "c8a6dbce22db8ce709ea973587c940dd1bb14cb1",
"size":... |
def QUIT(parent, r):
"""Close PyBot server"""
parent.run = False
return 'BYE'
def REFRESH(parent, r):
"""Search for new devices"""
parent.robot.refresh()
return ''
def OPEN(parent, r):
"""Open an 'openable' module such as motors, butia.."""
if len(r) == 1:
module = r[0]
... | {
"content_hash": "356b599688336ac59ac6199241a1b4c6",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 81,
"avg_line_length": 26.810126582278482,
"alnum_prop": 0.5651558073654391,
"repo_name": "nvazquez/Turtlebots",
"id": "f4a5f8934f1613df14a664712e675933896b59a7",
"size": "... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class ListUserIdentities(Choreography):
def __init__(self, temboo_session):
"""
Cre... | {
"content_hash": "6cef6f0aba5dff3048d01e1d5bf471fc",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 202,
"avg_line_length": 43.956043956043956,
"alnum_prop": 0.685,
"repo_name": "lupyuen/RaspberryPiImage",
"id": "11844007dbb82dc15a259af85ffa4826e6083ac2",
"size": "4866",
... |
"""Base classes for probability distributions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import contextlib
import types
import numpy as np
import six
from tensorflow.python.eager import context
from tensorflow.python.framework import d... | {
"content_hash": "2dee794fa5ca6c836cb981e15690c18b",
"timestamp": "",
"source": "github",
"line_count": 1292,
"max_line_length": 158,
"avg_line_length": 35.03792569659443,
"alnum_prop": 0.6515938059157481,
"repo_name": "kobejean/tensorflow",
"id": "12fd0393924221c4b39467221a262454a294b7f8",
"size":... |
from alembic import op
from sqlalchemy.orm import sessionmaker
"""remove WRITE_ONLY from service accounts
Revision ID: 0f1576a4e220
Revises: ed70c144ae46
Create Date: 2018-05-09 14:40:13.818624
"""
# revision identifiers, used by Alembic.
revision = '0f1576a4e220'
down_revision = 'ed70c144ae46'
Session = sessionma... | {
"content_hash": "85a1007bd68170b34dd37e6a6c68976b",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 72,
"avg_line_length": 24,
"alnum_prop": 0.6796875,
"repo_name": "uwcirg/true_nth_usa_portal",
"id": "769e97c6bbd41062241a6122346196893033be11",
"size": "768",
"binary": ... |
from django.conf import settings
from django.contrib.auth.models import User
super_user_email_list = [settings.ADMIN_USER_EMAIL]
super_user_password_list = [settings.ADMIN_USER_PASSWORD]
def create_super_user(email, password):
if User.objects.filter(email=email).count() is 0:
user = User.objects.create_s... | {
"content_hash": "587c34e65ad54e38a371628e93b98315",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 78,
"avg_line_length": 33.65,
"alnum_prop": 0.711738484398217,
"repo_name": "0PEIN0/drf-logger",
"id": "0ac0bae78ec8da2184d3dfedf9c9fab82c36085f",
"size": "673",
"binary"... |
import io
import os
import pytest
import six
from anymarkup_core import *
from test import *
class TestSerialize(object):
"""Note: testing serialization is a bit tricky, since serializing dicts can result
in different order of values in serialized string in different runs.
That means that we can't just... | {
"content_hash": "0be0e475eade777f3fd63ff7cd8c126e",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 87,
"avg_line_length": 38.666666666666664,
"alnum_prop": 0.623882503192848,
"repo_name": "bkabrda/anymarkup-core",
"id": "81915611fdfa6181e3366eef9981e82dde0d77fd",
"size":... |
"""
COHORTE Monitor package
Contains all modules and packages specific to the monitor
:author: Thomas Calmant
:license: Apache Software License 2.0
..
Copyright 2014 isandlaTech
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the Licen... | {
"content_hash": "06695504a44a3767a7ca3a078081ad2b",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 80,
"avg_line_length": 30.632653061224488,
"alnum_prop": 0.620253164556962,
"repo_name": "isandlaTech/cohorte-demos",
"id": "0ab6879093c032710f25f86d770663a972a659db",
"siz... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'DataDisplay'
db.create_table('profiles_datadisplay', (
('id', self.gf('django.db.models.fields.A... | {
"content_hash": "d66f1acbf5aa55b9dcf5d8c32976d5fd",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 192,
"avg_line_length": 81.1413612565445,
"alnum_prop": 0.5632339656729901,
"repo_name": "216software/Profiles",
"id": "570fdf5750a2541b67746c6203726cd498aac3f3",
"size": ... |
import _plotly_utils.basevalidators
class XValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="x", parent_name="sankey.node", **kwargs):
super(XValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type... | {
"content_hash": "a82ed32d6acb936da3c28af39e3747b1",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 77,
"avg_line_length": 35.833333333333336,
"alnum_prop": 0.5953488372093023,
"repo_name": "plotly/python-api",
"id": "11e796ae004cabbcffc7e9c08a3b2edb837963ec",
"size": "43... |
from unittest import TestCase
from pyhttp import Request, Response, JsonResponse, MsgpackResponse, Cookie, CookieException
import time
class RequestTestCase(TestCase):
def test_instance(self):
request = Request('GET', 'foo/bar', {'hello': 'world', 'aaa': 111}, {'bbb': 222, 'ccc': 333})
self.assert... | {
"content_hash": "06e6dc0646293e15c6bd05897a053cf4",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 135,
"avg_line_length": 34.266666666666666,
"alnum_prop": 0.6107180756986205,
"repo_name": "felixcarmona/pyhttp",
"id": "6cf421d520147aa031c7bd5ba31d0f96262a82e7",
"size":... |
"""
MoinMoin - a xmlrpc server and client for the notification bot
@copyright: 2007 by Karol Nowak <grywacz@gmail.com>
@license: GNU GPL, see COPYING for details.
"""
import logging, xmlrpclib, Queue
from SimpleXMLRPCServer import SimpleXMLRPCServer
from threading import Thread
import jabberbot.commands ... | {
"content_hash": "a253f25647a6d8c073b5f8747e2320d9",
"timestamp": "",
"source": "github",
"line_count": 395,
"max_line_length": 102,
"avg_line_length": 32.70126582278481,
"alnum_prop": 0.6021522025238059,
"repo_name": "RealTimeWeb/wikisite",
"id": "94b09b44b24db27ee4735f0b86c3592580f167e5",
"size":... |
import logging
import threading
from ceilometerclient import client as ceilometer_client
from django.conf import settings
from django.utils import datastructures
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon.utils.memoized import memoized # noqa
from openstack_d... | {
"content_hash": "c65438af6f1719e7b7bfc9b0a80351ce",
"timestamp": "",
"source": "github",
"line_count": 1175,
"max_line_length": 79,
"avg_line_length": 37.20340425531915,
"alnum_prop": 0.5541702886946973,
"repo_name": "zouyapeng/horizon_change",
"id": "c2736fd44ec3bf884e611ff7ebca0ed8c7e25070",
"si... |
import base64
import calendar
import datetime
import re
import unicodedata
from binascii import Error as BinasciiError
from email.utils import formatdate
from urllib.parse import (
ParseResult, SplitResult, _coerce_args, _splitnetloc, _splitparams, quote,
quote_plus, scheme_chars, unquote, unquote_plus,
url... | {
"content_hash": "5052948cc182beda83cf275debe9bdd6",
"timestamp": "",
"source": "github",
"line_count": 416,
"max_line_length": 93,
"avg_line_length": 34.27884615384615,
"alnum_prop": 0.6286115007012623,
"repo_name": "edmorley/django",
"id": "c13f44602bd3347047a621c1cb1251afda2f67eb",
"size": "1426... |
import core
import core.Rpg
from core import utils, config
from models import player, gender, species, saved_game
from core.localisation import _
from core import command, command_factory
import readline
class main:
_debug = False
def __init__(self, debug=False, world=''):
self._engine = core.Rpg.Rpg(debug)
t... | {
"content_hash": "331918edf0e9b8aa91eabb6709399298",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 76,
"avg_line_length": 24.26839826839827,
"alnum_prop": 0.6476988940420978,
"repo_name": "rrpg/engine",
"id": "9ec2df790c740fefe9d40ced1a2275b962c938c6",
"size": "5631",
... |
"""
Provides FileStorage implementation for Amazon S3.
This is useful for storing files in S3.
"""
from __future__ import absolute_import
from datetime import datetime
import uuid
from boto.s3.connection import S3Connection
from depot._compat import unicode_text
from .interfaces import FileStorage, StoredFile
from ... | {
"content_hash": "7f3c3df258ffdc5c90ed111de07ecd98",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 103,
"avg_line_length": 34.898989898989896,
"alnum_prop": 0.5905933429811867,
"repo_name": "eprikazc/depot",
"id": "10ea97d9a1ebab2e1f1ec7873b09753ee489b45d",
"size": "691... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "8734b9c27e7e52b94071d390951e3cc0",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 72,
"avg_line_length": 34.17857142857143,
"alnum_prop": 0.7701149425287356,
"repo_name": "alexryndin/ambari",
"id": "2731dd8821752e6386e12d8a30eb7663655eea1c",
"size": "957... |
"""
Normalizes Smart Fantasy Baseball's registry
"""
import datetime
import logging
from .models import Row
def normalize_sfbb(row):
"""Normalizes a single row of SFBB data
Args:
row: `dict`-ified row from SFBB spreadsheet
Returns:
Formatted model (`Model`)
"""
log = logging.g... | {
"content_hash": "7b9598d45a3d69b8bb77d4eab16db691",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 69,
"avg_line_length": 26.314285714285713,
"alnum_prop": 0.5618892508143323,
"repo_name": "mattdennewitz/mlb-normalize-player-ids",
"id": "136b3908526929a23b4841901318a8afb75... |
"""
Module for making various web calls. Primarily designed for webhooks and the
like, but also useful for basic http testing.
.. versionadded:: 2015.5.0
"""
import time
import salt.utils.http
from salt.exceptions import CommandExecutionError
def query(url, **kwargs):
"""
.. versionadded:: 2015.5.0
Q... | {
"content_hash": "58d0ceb4df6f20cfee959cbcde25394d",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 100,
"avg_line_length": 31.088709677419356,
"alnum_prop": 0.6337224383916991,
"repo_name": "saltstack/salt",
"id": "44464eaa11bf211b9a7e3c7eaf5a097dae240679",
"size": "385... |
"""Script for the pyim-align command.
The align command is responsible for extracting genomic reads from the
sequencing data, aligning these reads to the reference genome and extracting
insertion sites from these alignments. The command provides access to several
distinct pipelines, which perform these tasks for diffe... | {
"content_hash": "8b2883b1c7b4450d25e90d1a7e59ea22",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 77,
"avg_line_length": 25.520833333333332,
"alnum_prop": 0.7020408163265306,
"repo_name": "jrderuiter/pyim",
"id": "2aa2c2ed88a47705e0c972c8f81992f891f82b70",
"size": "1225... |
import sublime, sublime_plugin;
import os;
try:
# ST3
from ..apis.core import Core
except (ImportError, ValueError):
# ST2
from apis.core import Core
class CreateLayoutCommand(sublime_plugin.TextCommand):
project_dir = None
def run(self, edit):
core = Core()
path = self.view.fil... | {
"content_hash": "259c0cb63e5308857633d5c510b6d046",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 126,
"avg_line_length": 32.24,
"alnum_prop": 0.6215880893300249,
"repo_name": "CasperLaiTW/ERBAutocomplete",
"id": "573a5660c0ac4142641efdbf81ce79add7cd6172",
"size": "806"... |
"""Fichier contenant le contexte éditeur EdtNoms"""
from primaires.interpreteur.editeur import Editeur
class EdtNoms(Editeur):
"""Classe définissant le contexte éditeur 'noms'.
Ce contexte permet d'éditer les noms et états d'un état de bonhomme
de neige.
"""
def __init__(self, ... | {
"content_hash": "af6edfdbf7829434fb4785e97625bb8f",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 71,
"avg_line_length": 35.345454545454544,
"alnum_prop": 0.581275720164609,
"repo_name": "stormi/tsunami",
"id": "68129a133d50fa34da53a7a8d5f5c80e2f8f7e66",
"size": "3526",... |
from __future__ import unicode_literals
import datetime
from unittest import skipIf
from django.db import models
from django.test import TestCase
from django.test.utils import isolate_apps
from django.utils import six
from .models import Article, InternationalArticle
class SimpleTests(TestCase):
... | {
"content_hash": "7349f0f648a78a406ac565118d3d1e38",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 80,
"avg_line_length": 36.62264150943396,
"alnum_prop": 0.6027820710973725,
"repo_name": "yephper/django",
"id": "917887e0be7ee0439961e5b2c7f43e85ce3ab5e5",
"size": "1970",... |
import datetime
import re
from django import forms
from django.core.exceptions import ValidationError
from django.forms.widgets import MultiWidget, NumberInput
__all__ = ("DayMonthYearWidget",)
RE_DATE = re.compile(r"(\d{4})-(\d\d?)-(\d\d?)$")
class DayMonthYearWidget(MultiWidget):
template_name = "leaflets/in... | {
"content_hash": "02def82822feb470a5dfc5923d17e389",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 67,
"avg_line_length": 26.714285714285715,
"alnum_prop": 0.5704099821746881,
"repo_name": "DemocracyClub/electionleaflets",
"id": "bb0ba49baa3c2ad14d4372587e8a19343b688c14",
... |
import se34euca
from se34euca.testcase.testcase_ip_address import testcase_ip_address
class IpAddress(se34euca.TestRunner):
# default test case, if no provided
testcase = "allocate_ip_address"
# class to use for running tests
testclass = testcase_ip_address
if __name__ == "__main__":
IpAddress(... | {
"content_hash": "552897a57d993999e843950b14143b2d",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 69,
"avg_line_length": 23.928571428571427,
"alnum_prop": 0.7074626865671642,
"repo_name": "eucalyptus/se34euca",
"id": "9dcac277b848901b794688432359332384a6084f",
"size": "... |
import discord
import asyncio
import padshitpostlib
import padmathlib
import padphysicslib
import padloglib
import padgamelib
class Main:
bot = discord.Client()
shitpost = padshitpostlib.Shitpost
math = padmathlib.Mathematics
physics = padphysicslib.Physics
game = padgamelib.Game
logger = padlo... | {
"content_hash": "2647590822ba10f919a8dad4d8a12bf1",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 148,
"avg_line_length": 50,
"alnum_prop": 0.6182539682539683,
"repo_name": "georgyorgy1/padmebot_v2",
"id": "8f5b15661e76fc43f19b4fc28c603e993d57e5ec",
"size": "6395",
"... |
"""Remove resource record."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('record_id')
@environment.p... | {
"content_hash": "0c7d21c008a977ddf01d3f22fa1fc8a3",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 71,
"avg_line_length": 25.73913043478261,
"alnum_prop": 0.7415540540540541,
"repo_name": "softlayer/softlayer-python",
"id": "5d538d55ccc24f9a2e9ede2466a1ed2f3003ddbf",
"si... |
"""
pyexcel_io.database.common
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Common classes shared among database importers and exporters
:copyright: (c) 2014-2017 by Onni Software Ltd.
:license: New BSD License, see LICENSE for more details
"""
from pyexcel_io.book import BookReader
class DbExporter(BookReader)... | {
"content_hash": "ee4d06fa729bd59b22169ebea23b6222",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 78,
"avg_line_length": 33.704819277108435,
"alnum_prop": 0.6328865058087578,
"repo_name": "caspartse/QQ-Groups-Spider",
"id": "afe0c39a94a4076439161215df8f32bfac5d1be5",
"... |
import json
blob = json.load(open('kylewm.com.json'))
from config import Configuration
Configuration.SQLALCHEMY_DATABASE_URI = 'postgres:///redwind'
from redwind import db
from redwind.importer import *
db.drop_all()
db.create_all()
import_all(blob)
| {
"content_hash": "d0033b745dd0b2a947e64c6868cf5fe3",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 61,
"avg_line_length": 25.1,
"alnum_prop": 0.7729083665338645,
"repo_name": "thedod/redwind",
"id": "b2fab19d0301823e116d02d5add266780998ce68",
"size": "251",
"binary": f... |
DEBUG = True
ROOT_URLCONF = 'tests.urls'
SECRET_KEY = 'Guard of the Citadel indeed.'
| {
"content_hash": "b9fdace47deab3d85a5726fb2fd9f62b",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 43,
"avg_line_length": 28.333333333333332,
"alnum_prop": 0.7176470588235294,
"repo_name": "Visgean/urljects",
"id": "31b2a11730ec191a04e9cc6d85c556881aa83bdf",
"size": "144"... |
"""Parse CLI text products
The CLI report has lots of good data that is hard to find in other products,
so we take what data we find in this product and overwrite the database
storage of what we got from the automated observations
"""
# Local
from pywwa.workflows.cli_parser import main
if __name__ == "__main__":
... | {
"content_hash": "a0a9048177e3137d0b7f3576953c46ff",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 76,
"avg_line_length": 26.384615384615383,
"alnum_prop": 0.7201166180758017,
"repo_name": "akrherz/pyWWA",
"id": "133515f703a20d386b810abe6526b37f61f35f38",
"size": "343",
... |
def parse_nick_modes(mode_string):
"""Parse a nick mode string.
The function returns a list of lists with three members: sign,
mode and argument. The sign is "+" or "-". The argument is
always None.
Example:
>>> parse_nick_modes("+ab-c")
[['+', 'a', None], ['+', 'b', None], ['-', 'c', N... | {
"content_hash": "e24f7995b41f5107a3fa901e24914e75",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 72,
"avg_line_length": 29.642857142857142,
"alnum_prop": 0.5522088353413654,
"repo_name": "tcoppi/scrappy",
"id": "09470e26607e784600f76a1829b5ba67d1b5396f",
"size": "2490"... |
"""
IPython extension: autoreload modules before executing the next line
Try::
%autoreload?
for documentation.
"""
# Pauli Virtanen <pav@iki.fi>, 2008.
# Thomas Heller, 2000.
#
# This IPython module is written by Pauli Virtanen, based on the autoreload
# code by Thomas Heller.
#--------------------------------... | {
"content_hash": "9d2905a9c5b98f0bf90f25a1c306c931",
"timestamp": "",
"source": "github",
"line_count": 349,
"max_line_length": 79,
"avg_line_length": 30.87106017191977,
"alnum_prop": 0.577872656395025,
"repo_name": "yongshengwang/hue",
"id": "230f57531746c55f0c34ac421a3b6abdcb3de7a9",
"size": "107... |
from __future__ import unicode_literals
import platform
from flask import flash, jsonify, redirect, request
from requests.exceptions import HTTPError, RequestException, Timeout
from werkzeug.urls import url_join
import indico
from indico.core.config import config
from indico.core.db.sqlalchemy.util.queries import ge... | {
"content_hash": "ac749ea36a4027318f84015bd457d59b",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 114,
"avg_line_length": 45.68316831683168,
"alnum_prop": 0.6025140875596012,
"repo_name": "OmeGak/indico",
"id": "eb72b4cf180504f7c84808b91678d53a5735b71c",
"size": "4828"... |
from setuptools import setup
setup(
description="Easy peasy wrapper for HipChat's v1 API",
name='python-simple-hipchat',
url='https://github.com/kurttheviking/python-simple-hipchat',
version='0.3.3',
packages=['hipchat'],
author='Kurt Ericson',
author_email='kurttheviking@outlook.com',
... | {
"content_hash": "38b8274d7afb4ea74e4ae0dca5fd7368",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 70,
"avg_line_length": 34.25,
"alnum_prop": 0.6253041362530414,
"repo_name": "claudyus/python-simple-hipchat",
"id": "7684a979e3d2b93d9d0f99981a0755a5de4a7ae7",
"size": "82... |
from django.apps import AppConfig
class DjangoCloudbridgeConfig(AppConfig):
name = 'djcloudbridge'
def ready(self):
# Connect up app signals
import djcloudbridge.signals # noqa
| {
"content_hash": "ea69a495b4fcee247c54720b865f3be6",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 44,
"avg_line_length": 22.77777777777778,
"alnum_prop": 0.7024390243902439,
"repo_name": "CloudVE/djcloudbridge",
"id": "f86142f8c6e7e8e06b73362acd2e7c7750ac6866",
"size": "... |
__author__ = 'francis'
def permute(xs):
"""Returns a generator for the permutations of elements in the sequence
:param xs: a sequence of elements
"""
if len(xs) == 1:
yield xs
else:
for i in xrange(0, len(xs)):
for p in permute(xs[0:i] + xs[i + 1:]):
yie... | {
"content_hash": "c20ab6e7fb8285f5f8729a9ec5e4fdf1",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 82,
"avg_line_length": 28.59375,
"alnum_prop": 0.5229508196721312,
"repo_name": "kofrasa/pyutils",
"id": "e3e6b643898d67419ebe2e8dc4016d18ea858896",
"size": "1875",
"bina... |
import os
from google.appengine.ext.webapp import template
from base_controller import CacheableHandler
# Note, broken out into its own class for future extensibility -PJL 04272015
class EventWizardHandler(CacheableHandler):
CACHE_VERSION = 1
CACHE_KEY_FORMAT = "event_wizard"
def __init__(self, *args, *... | {
"content_hash": "24dc54456790b5fa6ba92a15f3ae41ad",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 87,
"avg_line_length": 34,
"alnum_prop": 0.6879084967320261,
"repo_name": "bvisness/the-blue-alliance",
"id": "580ead88cf9da677b18030cc7c42b7b2665c67b2",
"size": "612",
"... |
"""Integration with the Rachio Iro sprinkler system controller."""
from abc import abstractmethod
from datetime import timedelta
import logging
from homeassistant.components.switch import SwitchDevice
from homeassistant.helpers.dispatcher import dispatcher_connect
from . import (
CONF_MANUAL_RUN_MINS, DOMAIN as D... | {
"content_hash": "1cc2c2de8ab88fe79187813fe59c382e",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 79,
"avg_line_length": 33.60176991150443,
"alnum_prop": 0.6027126678957071,
"repo_name": "jnewland/home-assistant",
"id": "1b650d7281a94d9bd95b7bec8e3bd20772223449",
"size... |
class Objectify(object):
def __init__(self,tree,parent=None):
self._parent = parent
if isinstance(tree,str):
self._tree = fromstring(tree)
else:
self._tree = tree
#this is required to call on all the children
self._children = [python... | {
"content_hash": "e5cbc1b1dcf3d1e6a7bbe0b1a0c60abd",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 81,
"avg_line_length": 31.727272727272727,
"alnum_prop": 0.4991404011461318,
"repo_name": "erdosmiller/pybase",
"id": "9321fed2d8448f1546d7f986660b8246d4545b61",
"size": "1... |
__author__ = "Ryan Faulkner and Aaron Halfaker"
__date__ = "October 3rd, 2012"
__license__ = "GPL (version 2 or later)"
from user_metrics.config import logging
from collections import namedtuple
import user_metric as um
from user_metrics.metrics import query_mod
from user_metrics.etl.aggregator import weighted_rate, ... | {
"content_hash": "1cb4ed7e1eb5dc33fe975319581791d4",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 79,
"avg_line_length": 32.39473684210526,
"alnum_prop": 0.5259951259138912,
"repo_name": "rfaulkner/wikipedia_user_metrics",
"id": "7bb7e22efbf314de54ab860b843111cab85bd3fe"... |
import datetime
from urlparse import urlparse
from utils import log as logging
from django.shortcuts import get_object_or_404, render_to_response
from django.views.decorators.http import condition
from django.http import HttpResponseForbidden, HttpResponseRedirect, HttpResponse, Http404
from django.conf import settings... | {
"content_hash": "6635178e318ce84b47ce8b59d3c6bfb4",
"timestamp": "",
"source": "github",
"line_count": 548,
"max_line_length": 134,
"avg_line_length": 39.26459854014598,
"alnum_prop": 0.6417716224380722,
"repo_name": "dosiecki/NewsBlur",
"id": "b92d4de6a94209effdc43cca5f28ad37916d9d54",
"size": "2... |
from __future__ import absolute_import, division, print_function
from cryptography.hazmat.backends.multibackend import MultiBackend
from cryptography.hazmat.bindings.commoncrypto.binding import (
Binding as CommonCryptoBinding
)
from cryptography.hazmat.bindings.openssl.binding import (
Binding as OpenSSLBindi... | {
"content_hash": "b6eb176f91cad9b7f72377a89789dd89",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 66,
"avg_line_length": 26.609756097560975,
"alnum_prop": 0.7268560953253895,
"repo_name": "Lukasa/cryptography",
"id": "ae78822c6a2c523fde9d47de02222584e2456727",
"size": "... |
from django.conf import settings
from staticfiles.storage import CachedFilesMixin
from storages.backends.s3boto import S3BotoStorage
class CachedStaticS3BotoStorage(CachedFilesMixin, S3BotoStorage):
def __init__(self, *args, **kwargs):
kwargs.update(getattr(settings, "STATICFILES_S3_OPTIONS", {}))
... | {
"content_hash": "9b31d269b6dabcacf98135fcca290d50",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 72,
"avg_line_length": 42.888888888888886,
"alnum_prop": 0.7564766839378239,
"repo_name": "crateio/crate.io",
"id": "9cfd0eb034c48cef97df1dc3fae92012355d461c",
"size": "386"... |
from swgpy.object import *
def create(kernel):
result = Weapon()
result.template = "object/weapon/melee/sword/shared_sword_lightsaber_anakin.iff"
result.attribute_template_id = 10
result.stfName("weapon_name","sword_lightsaber_anakin")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return r... | {
"content_hash": "472a8a343f161aca0b368fb50b5c4156",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 81,
"avg_line_length": 25,
"alnum_prop": 0.7107692307692308,
"repo_name": "anhstudios/swganh",
"id": "aa5eff79a610d1497fb65d2bd3baf888c814a914",
"size": "470",
"binary": ... |
from flask import current_app
description = """
帮助信息,触发条件: "help [私聊]". 比如:
* help
"""
def format_desc(plugin, prefix=' '):
name = plugin.__name__.split('.')[-1]
desc = getattr(plugin, 'description', '').strip()
# 为每行内容增加前缀
desc = ('\n' + prefix).join(desc.split('\n'))
return '{name}:\n{prefix}{... | {
"content_hash": "6c57a19a6b09bc9d7c57ba96ebad51e2",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 54,
"avg_line_length": 22.517241379310345,
"alnum_prop": 0.5972434915773354,
"repo_name": "STANAPO/slack_bot",
"id": "2b6c1020afb5886934365cc8f33dccb99bdc28ac",
"size": "71... |
import uuid
from oslo.config import cfg
import webob
from cinder.api import extensions
from cinder.api.v2 import snapshot_metadata
from cinder.api.v2 import snapshots
import cinder.db
from cinder import exception
from cinder.openstack.common import jsonutils
from cinder import test
from cinder.tests.api import fakes
... | {
"content_hash": "5ab01278d491132296b851d979beb2e8",
"timestamp": "",
"source": "github",
"line_count": 539,
"max_line_length": 78,
"avg_line_length": 38.14100185528757,
"alnum_prop": 0.5680027240003891,
"repo_name": "NeCTAR-RC/cinder",
"id": "32d9eb205b454dcd6fb103287814df69ce27d667",
"size": "211... |
import re
# TODO(crbug.com/1227140): Clean up when py2 is no longer supported.
try:
_STRING_TYPE = basestring
except NameError: # pragma: no cover
_STRING_TYPE = str
from recipe_engine import recipe_api
class DepsDiffException(Exception):
pass
class RevisionResolver(object):
"""Resolves the revision based ... | {
"content_hash": "f3fabd3946e72c5aa8fa9db9fdcb7869",
"timestamp": "",
"source": "github",
"line_count": 438,
"max_line_length": 80,
"avg_line_length": 36.04109589041096,
"alnum_prop": 0.6284049157481313,
"repo_name": "CoherentLabs/depot_tools",
"id": "92b4ee2b6ae5d1fddb24e4cd4167bd2838c2aae7",
"siz... |
from __future__ import division, print_function, unicode_literals
__doc__ = """
Looks for all exit and entry anchors anywhere in the font, and disables curs feature generation.
"""
def processLayer(thisLayer):
foundExitOrEntry = False
for thisAnchor in thisLayer.anchors:
if thisAnchor.name in ("exit", "entry"):
... | {
"content_hash": "102cf89aaba159cae70d56519374a60f",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 153,
"avg_line_length": 30.20408163265306,
"alnum_prop": 0.7236486486486486,
"repo_name": "mekkablue/Glyphs-Scripts",
"id": "e4df7b3c29336661c75ce6bc01f70b2006658445",
"siz... |
import os
import sys
here = os.path.abspath(os.path.dirname(__file__))
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path... | {
"content_hash": "d76d7673b85335dd2b6c516470d93ba1",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 94,
"avg_line_length": 32.90268456375839,
"alnum_prop": 0.6994390617032127,
"repo_name": "stweil/letsencrypt",
"id": "d419326df926c57aaf6d8b3acc367b52e05eb78d",
"size": "1... |
default_app_config = 'mymoney.apps.banktransactionschedulers.apps.BankTransactionSchedulerConfig'
| {
"content_hash": "42833696fcae8b3259559f0a03308f01",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 97,
"avg_line_length": 98,
"alnum_prop": 0.8775510204081632,
"repo_name": "ychab/mymoney",
"id": "06906497c50641330e9e8c7e82dc6749a77a3932",
"size": "98",
"binary": false,... |
import os
import re
import json
import random
import tempfile
from django import forms
from django.urls import reverse
from django.http import HttpResponse, JsonResponse
from django.views.generic.base import View
from django.views.decorators.http import require_http_methods
from django.shortcuts import get_object_or_4... | {
"content_hash": "8bb68b9cafdfaa5f33777549cb811575",
"timestamp": "",
"source": "github",
"line_count": 922,
"max_line_length": 99,
"avg_line_length": 35.399132321041215,
"alnum_prop": 0.5642808995649243,
"repo_name": "ginkgobioworks/edge",
"id": "f07226c26f62a6705d876d00fc80f469eed8190e",
"size": ... |
"""Client for CKAN data repositories
Copyright (c) 2013 Clarinova. This file is licensed under the terms of the
Revised BSD License, included in this distribution as LICENSE.txt
"""
from databundles.run import get_runconfig
import ckanclient
import databundles.client.exceptions as Exceptions
import requests
import j... | {
"content_hash": "b7dd300d778495d6ef6211f61277b273",
"timestamp": "",
"source": "github",
"line_count": 452,
"max_line_length": 98,
"avg_line_length": 31.758849557522122,
"alnum_prop": 0.5118773946360153,
"repo_name": "treyhunner/databundles",
"id": "71a3bf393a45c4e0693cdd0b8481a72a191d3c92",
"size... |
"""Some tools for running tests based on MongoDB server version."""
class Version(tuple):
def __new__(cls, *version):
padded_version = cls._padded(version, 4)
return super(Version, cls).__new__(cls, tuple(padded_version))
@classmethod
def _padded(cls, iter, length, padding=0):
l ... | {
"content_hash": "067974b9926c8e0220b87603e6dedfe5",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 73,
"avg_line_length": 32.53731343283582,
"alnum_prop": 0.5573394495412844,
"repo_name": "ZeoAlliance/aiomongo",
"id": "ca081909f748c2c644cfae525c59bf5241bcef8c",
"size": "... |
"""
Exceptions module.
"""
from __future__ import unicode_literals
class EventError(Exception):
"""Using to notify subscribed clients about event failure."""
pass | {
"content_hash": "16d888e72df665510454961623d2ce8e",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 65,
"avg_line_length": 15.818181818181818,
"alnum_prop": 0.7011494252873564,
"repo_name": "ailove-dev/django-event",
"id": "3cef7263b35497b91aa845a2b987b6bb152afe20",
"size... |
"""Base class for testing serializable datasets."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
from tensorflow.python.data.experimental.ops import iterator_ops as contrib_iterator_ops
from tensorflow.python.data.experimen... | {
"content_hash": "c40d8a6a43c7ae71fd984ec7276c7628",
"timestamp": "",
"source": "github",
"line_count": 696,
"max_line_length": 92,
"avg_line_length": 36.57183908045977,
"alnum_prop": 0.6215133181425316,
"repo_name": "asimshankar/tensorflow",
"id": "bdbd8702b7f8d315a730c5cd2b000218ea5e19be",
"size"... |
"""
Tools to Unify Image Data Against Other BioVida APIs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
# Note: To use these tools, see ``biovida.unify_domains.unify_against_images()``
import numpy as np
import pandas as pd
from copy import deepcopy
from collections import defaultdict
# Import Inte... | {
"content_hash": "e74e34a8e51d1b2937cd2ecb448dc31d",
"timestamp": "",
"source": "github",
"line_count": 771,
"max_line_length": 120,
"avg_line_length": 43.784695201037614,
"alnum_prop": 0.571271994786421,
"repo_name": "TariqAHassan/BioVida",
"id": "d0dbc64e4051e051028175b70b17e7b0c27e2e6c",
"size":... |
from os import path
from time import time
import warnings
from itertools import product
import yaml
import numpy as np
import pandas as pd
from mpi4py import MPI
import h5py
from pearce.mocks import cat_dict
from sys import argv
from sys import stdout
if __name__ == '__main__':
comm = MPI.COMM_WORLD
rank =... | {
"content_hash": "ed8fe248394ebce2a0e05a0bb6883e4a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 40,
"avg_line_length": 17.708333333333332,
"alnum_prop": 0.7129411764705882,
"repo_name": "mclaughlin6464/pearce",
"id": "c222d82b18646c5ea944fd8f7e942bcfeda66908",
"size":... |
import pytest
from threddsclient import *
def test_birdhouse_root():
xml = """
<catalog xmlns="http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0" xmlns:xlink="http://www.w3.org/1999/xlink" name="THREDDS Server Default Catalog" version="1.0.1">
<service name="all" serviceType="Compound" bas... | {
"content_hash": "e8e01e34bebd114efde079836171f765",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 181,
"avg_line_length": 49.36666666666667,
"alnum_prop": 0.6512491559756921,
"repo_name": "ScottWales/threddsclient",
"id": "210b8a91b0f2a6ed2f753710254d401c808752c8",
"siz... |
from asynctest.mock import MagicMock, call
import pytest
from google.api_core.exceptions import FailedPrecondition
# All test coroutines will be treated as marked.
from google.cloud.pubsublite.cloudpubsub.internal.ack_set_tracker import AckSetTracker
from google.cloud.pubsublite.cloudpubsub.internal.ack_set_tracker_i... | {
"content_hash": "6dc6391fbd85f5def8f37b75f0c5d6c1",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 86,
"avg_line_length": 32.19178082191781,
"alnum_prop": 0.685531914893617,
"repo_name": "googleapis/python-pubsublite",
"id": "f859592fa4c856219a69e2b6c6292d7f08d2617c",
"s... |
import sys
import os
import sphinx_rtd_theme
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath... | {
"content_hash": "3204b73ea0ed13016bd7e99215af7be0",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 93,
"avg_line_length": 31.536912751677853,
"alnum_prop": 0.6938710363907215,
"repo_name": "danielhomola/mifs",
"id": "e39fed3455e79a8b99683a9647f03112dcabbb38",
"size": "9... |
shopping_list = []
def show_help():
# print instructions on how to use the app
print("What sould we pick up at the store, if you are not sure, please ring me?")
print ("""
Enter 'DONE to stop adding items
Enter 'HELP fot the help menu
Enter 'SHOW to see your current list""")
#print out the list
def show_... | {
"content_hash": "57c5c40a97ebb250a1556517be7645e1",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 85,
"avg_line_length": 18.34,
"alnum_prop": 0.6030534351145038,
"repo_name": "BIMobject-Ben/test",
"id": "3532229e49df52a799965bf6afeecc97790c9921",
"size": "944",
"binar... |
import os
import unittest
from telemetry import story
from telemetry import page as page_module
from telemetry.value import improvement_direction
from telemetry.value import list_of_scalar_values
from telemetry.value import merge_values
from telemetry.value import scalar
class TestBase(unittest.TestCase):
def setU... | {
"content_hash": "97daf616773364525437efc2bc3b16c1",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 79,
"avg_line_length": 40.07826086956522,
"alnum_prop": 0.6096767194619224,
"repo_name": "benschmaus/catapult",
"id": "7380fb4ca6eb91151d936790c02ca75b74b92fac",
"size": "... |
# -*- coding: utf-8 -*-
"""@package duo3d
@brief:
@author: Mateusz Owczarek (mateusz.owczarek@dokt.p.lodz.pl)
@version: 0.2
@date: April, 2016
@copyright: 2016 (c) Mateusz Owczarek
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LI... | {
"content_hash": "8c0d1c151c6c8b3ffaf46f055592fb39",
"timestamp": "",
"source": "github",
"line_count": 738,
"max_line_length": 91,
"avg_line_length": 31.794037940379404,
"alnum_prop": 0.6216331401295602,
"repo_name": "MateuszOwczarek/python-duo3d",
"id": "11ebdf9518556d0ac9dd78ccda4be0a91ecb293e",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.