text stringlengths 4 1.02M | meta dict |
|---|---|
import urllib.request
import urllib.parse
import getpass
class CosignPasswordMgr(object):
"""A password manager for CosignHandler objects.
"""
def newcred(self):
"""Default callback.
Ask user for username and password."""
return {'login': input('username: '),
'pas... | {
"content_hash": "369524fa28d399e3e9ad6f78104e64ec",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 78,
"avg_line_length": 33.67796610169491,
"alnum_prop": 0.5796007381311861,
"repo_name": "ActiveState/code",
"id": "7ad242832d5a4ae23fe7659d65725379e82bdf38",
"size": "596... |
import numpy as np
from sklearn.linear_model import LogisticRegression
import torch
import torchvision.datasets
import torchvision.models
import torchvision.transforms
from rbm import RBM
########## CONFIGURATION ##########
BATCH_SIZE = 64
VISIBLE_UNITS = 784 # 28 x 28 images
HIDDEN_UNITS = 128
CD_K = 2
EPOCHS = 10... | {
"content_hash": "b05d85ee920c5b99227af1e7d5b96210",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 132,
"avg_line_length": 28.462365591397848,
"alnum_prop": 0.6819040423120514,
"repo_name": "GabrielBianconi/pytorch-rbm",
"id": "943e3d95b5f3acc58f3c97ca34c37a11971d6f2a",
... |
import re
import urlparse
import pprint
import os
import sys
import redis
from beaker.middleware import SessionMiddleware
from MacroExecutor import MacroExecutorPage, MacroExecutorWiki, MacroExecutorPreprocess
from PortalAuthenticatorOSIS import PortalAuthenticatorOSIS
from RequestContext import RequestContext
from Po... | {
"content_hash": "3ca149524c2a6e3f579c1e6f77fc8d42",
"timestamp": "",
"source": "github",
"line_count": 1220,
"max_line_length": 152,
"avg_line_length": 38.722131147540985,
"alnum_prop": 0.5554920513960331,
"repo_name": "Jumpscale/jumpscale6_core",
"id": "30b2836bbdf7e39b899bf213c246b41353b0e526",
... |
from django import template
def person(user):
"""
Renders a single user object.
"""
return {'user': user}
register = template.Library()
register.inclusion_tag('profile/person.html')(person)
| {
"content_hash": "f49ae99ac5e0aab4a7360033be6280dc",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 53,
"avg_line_length": 20.8,
"alnum_prop": 0.6778846153846154,
"repo_name": "mvayngrib/startthedark",
"id": "c443d31667f01a77e9402edfc8cc88ad8ae1face",
"size": "208",
"bi... |
#!/usr/bin/env python
# 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
# "Li... | {
"content_hash": "3e5df5ebe984308b2363f3bfdbf8c53c",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 104,
"avg_line_length": 32.90756302521008,
"alnum_prop": 0.6892236976506639,
"repo_name": "airbnb/airflow",
"id": "8a6863e9296f4c45259a93f71e29d83ee47a75da",
"size": "3916... |
from __future__ import absolute_import
from __future__ import division
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from core.model import Model
from utils.init_weights import init_weights, normalized_columns_initializer
class A3CMlpMinisim... | {
"content_hash": "b72727941cc1cd8feb5ee449437c0164",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 113,
"avg_line_length": 40.35164835164835,
"alnum_prop": 0.6043028322440087,
"repo_name": "AlekseyZhelo/pytorch-rl",
"id": "b5748ee201ffde0582187fbc127a652613e9b4d7",
"size... |
from fobi.base import FormElementPluginWidget
from . import UID
__title__ = 'fobi.contrib.plugins.form_elements.test.dummy.widgets'
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__copyright__ = '2014-2017 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
__all__ = ('BaseDummyPluginWidget',)
class Ba... | {
"content_hash": "e4d61c67c9674ecbadc1b8b8de095fa0",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 67,
"avg_line_length": 29.133333333333333,
"alnum_prop": 0.7231121281464531,
"repo_name": "mansonul/events",
"id": "6439786fc02f24136f6cabfe3aec78180d38f26f",
"size": "437"... |
from django.conf.urls import url
from run_manager import views
urlpatterns = [
url(r'^create_run/$', views.create_run),
url(r'^view_runs/$', views.view_runs),
url(r'^delete_run/$', views.delete_run),
url(r'^start_run/$', views.start_run),
url(r'^stop_run/$', views.stop_run),
url(r'^run_status/... | {
"content_hash": "b5cca6fff747e8e49bef1067369c0c73",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 72,
"avg_line_length": 44.17857142857143,
"alnum_prop": 0.6491511721907841,
"repo_name": "ACME-OUI/acme-web-fe",
"id": "7d287b4d582f1888d0f85d9ed2f492e1358811ff",
"size": "... |
"""Support for Fronius devices."""
import copy
from datetime import timedelta
import logging
import voluptuous as vol
from pyfronius import Fronius
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_RESOURCE,
CONF_SENSOR_TYPE,
CONF_DEVICE,
CONF_MONITORED... | {
"content_hash": "cc6ad782d71d62dc1ccf5edd4cc7dbf5",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 86,
"avg_line_length": 31.187713310580204,
"alnum_prop": 0.6052746771722478,
"repo_name": "fbradyirl/home-assistant",
"id": "ff0694afaab38c963052354ad2dcd1efb0fba3ed",
"si... |
import random
import sys
import re
# Class containing the whole problem set.
# We can set up the maximum number of elements, and its maximum value.
class MemProblem():
cap_used = []
# Class needs the number of datastructs, membanks, and conflicts.
def __init__(self, datastructs, membanks, conflicts, penalty):
s... | {
"content_hash": "734f03a2285bbd1b3f172bf17d68b7a2",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 131,
"avg_line_length": 30.6,
"alnum_prop": 0.6336238198983297,
"repo_name": "dplbsd/memexplorerpy",
"id": "5416cb774aaa45d137fdd16fe2e822da897c7fb9",
"size": "8262",
"b... |
"""
KISSinsights template tags.
"""
from __future__ import absolute_import
import re
from django.template import Library, Node, TemplateSyntaxError
from analytical.utils import get_identity, get_required_setting
ACCOUNT_NUMBER_RE = re.compile(r'^\d+$')
SITE_CODE_RE = re.compile(r'^[\w]+$')
SETUP_CODE = """
<s... | {
"content_hash": "2d182576c415864b54f085358eb903b5",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 124,
"avg_line_length": 30.791666666666668,
"alnum_prop": 0.6364456472710871,
"repo_name": "bittner/django-analytical",
"id": "8381eb3ee69be6f61d6a72a0badb6bc2d48284e7",
"s... |
from .linear_mixed_model import LinearMixedModel
__all__ = [
'LinearMixedModel',
]
| {
"content_hash": "8e16cc680f0594a75a1575542aae66f6",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 48,
"avg_line_length": 17.6,
"alnum_prop": 0.6931818181818182,
"repo_name": "cseed/hail",
"id": "9995cbb25f5f70e4cf2f9b2b1d5548c7b8668b40",
"size": "89",
"binary": false,
... |
import multiprocessing
import random
import threading
import time
from concurrent import futures
import grpc
from src.proto.grpc.testing import control_pb2
from src.proto.grpc.testing import services_pb2_grpc
from src.proto.grpc.testing import stats_pb2
from tests.qps import benchmark_client
from tests.qps import ben... | {
"content_hash": "42681225dc01e250507393849613bdf4",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 79,
"avg_line_length": 40.16860465116279,
"alnum_prop": 0.606310609350123,
"repo_name": "hstefan/grpc",
"id": "de9535f46eb3621c3c54e91fb3ce9869bc37230f",
"size": "8438",
... |
from __future__ import absolute_import
import os
DEBUG = True
USE_TZ = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(os.path.dirname(__file__), 'test.db'),
}
}
INSTALLED_APPS = [
'taxii_services',
'django.contrib.sites',
]
SITE_ID = 1
... | {
"content_hash": "06a9a7916ba550b18c9b48128b8f6697",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 67,
"avg_line_length": 17.586206896551722,
"alnum_prop": 0.6549019607843137,
"repo_name": "TAXIIProject/django-taxii-services",
"id": "114c5c140fbf0ae5fe166ae03f4701205d8d2aa... |
"""
Build Tasks
~~~~~~~~~~~
"""
import invoke as _invoke
@_invoke.task(default=True)
def sdist(ctx):
""" Build source distribution """
with ctx.root_dir():
ctx.run('python setup.py sdist')
| {
"content_hash": "003b3dde54264b8a64982cac8abe42fe",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 40,
"avg_line_length": 14.928571428571429,
"alnum_prop": 0.5885167464114832,
"repo_name": "ndparker/hod",
"id": "fc9e6a96cec2739dde8e3b2d721bae810092edaa",
"size": "235",
... |
import re
import os
import sys
import time
import unittest
import ConfigParser
from setuptools import setup, Command
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
class SQLiteTest(Command):
"""
Run the tests on SQLite
"""
description = "Run tests on SQLite"
... | {
"content_hash": "3ac9ceeaffce5f79bf9865edfa990cc2",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 76,
"avg_line_length": 25.853146853146853,
"alnum_prop": 0.5769542872599405,
"repo_name": "fulfilio/trytond-pos",
"id": "ddbb1bb43ac940c4654c9af4feda9c1f37b13007",
"size":... |
failthresh = 0.03 # allow a little more LSB noise between platforms
failpercent = .5
outputs = [ "out.exr", "test_microfacet_dist.exr", "test_texture.exr", "test_spline.exr", "out.txt" ]
command = testrender("-optix -res 320 240 scene.xml out.exr")
command += testrender("-optix -res 320 240 test_microfacet_dist.xml... | {
"content_hash": "55624b33535166d7143b06778e1d7d6a",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 102,
"avg_line_length": 66.14285714285714,
"alnum_prop": 0.7192224622030238,
"repo_name": "brechtvl/OpenShadingLanguage",
"id": "833915c27099ecddc9dc415fe066b9d9b3f81f6f",
... |
import io
def source_event(path):
event = {
'source': {
'uri': path,
'data': io.open(path, 'rU', encoding='utf8', newline='').read(),
'mediaType': 'text/x.cucumber.gherkin+plain'
}
}
return event
class SourceEvents:
def __init__(self, paths):
... | {
"content_hash": "f4365c7912ce3ff5b24e017780351eb7",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 76,
"avg_line_length": 22.555555555555557,
"alnum_prop": 0.5295566502463054,
"repo_name": "cucumber/gherkin-python",
"id": "94f608a564cfd677ba7ebfecd838f69f8c36f20d",
"size... |
import sys, os
parentDir= os.path.dirname(os.path.abspath(__file__))+os.sep+".."
sys.path.insert(0,parentDir)
if __name__ == "__main__":
import sys
print >> sys.stderr, """
This is a support file and is designed to be imported, not run on its own.
This module amends the import path to include the parent ... | {
"content_hash": "b330484e0fed191c980c5eff9204b3e8",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 85,
"avg_line_length": 30.785714285714285,
"alnum_prop": 0.703016241299304,
"repo_name": "bbc/pydvbcss",
"id": "81d375db3a8b9215e1b5e23cb59dcba671a7b552",
"size": "1142",
... |
import sys
import struct
MESSAGE_TYPE_SEND_MESSAGE_REQUEST = 0
MESSAGE_TYPE_SEND_MESSAGE_RESPONSE = 1
MESSAGE_TYPE_CONNECT = 2
MESSAGE_TYPE_CONNECT_MESSAGE = 3
def Main():
message_number = 0
while 1:
# Read the message type (first 4 bytes).
type_bytes = sys.stdin.read(4)
if len(type_bytes) == 0:
... | {
"content_hash": "0fd0400be25f7e893f478d3e64a0afb3",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 71,
"avg_line_length": 26.02173913043478,
"alnum_prop": 0.6182121971595655,
"repo_name": "leiferikb/bitpop-private",
"id": "ffb6cefeb94761b5560cb555c9f9a0ab9ad5954f",
"size... |
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, HttpResponseRedirect, redirect
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
# Create your views here.
from billing.mo... | {
"content_hash": "7ebeb6ad05e1714f70ad3c72d1cc7796",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 100,
"avg_line_length": 27.148936170212767,
"alnum_prop": 0.734717868338558,
"repo_name": "codingforentrepreneurs/srvup-membership",
"id": "d2c85ee23db3f11ed7709d8a2594821e75... |
class PagarmeApiError(Exception): pass
class PagarmeTransactionError(Exception): pass
class NotPaidException(PagarmeTransactionError): pass
class NotBoundException(PagarmeTransactionError): pass
| {
"content_hash": "0794783ac5742328c9d344118b49a5e0",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 54,
"avg_line_length": 32.833333333333336,
"alnum_prop": 0.868020304568528,
"repo_name": "aroncds/pagarme-python",
"id": "c061bdfb19f3ae43d25992c2c8e41ed6ad839daf",
"size": ... |
import sys
import getopt
import json
import logging
import time
import requests.exceptions
import importlib
import datetime
import threading
import jenkins
import gadget
import sysutils
__version__ = '1.0.1'
class Configuration(object):
def __init__(self, path_to_config):
logging.info("Reading configura... | {
"content_hash": "b3c39db3383431cd539f571f4f3956fe",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 119,
"avg_line_length": 39.28169014084507,
"alnum_prop": 0.6158718776144376,
"repo_name": "suzukieng/dot-jenkins",
"id": "cee06e755f3ed770b88562a3fa21dbc6d68cbdde",
"size"... |
from pyparsing import *
import act
frequency = Forward().setParseAction(act.frequency)
expcode = Forward().setParseAction(act.expcode)
expansion = Forward().setParseAction(act.expansion) | {
"content_hash": "2e8725a39dcf5736fe5a2bb2b19ff24d",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 51,
"avg_line_length": 26.857142857142858,
"alnum_prop": 0.7978723404255319,
"repo_name": "jrgdiz/cardwalker",
"id": "4e6985aa267ae3776d295a5c0eaa1d76dc2df8da",
"size": "188... |
""" Provides general utility functions to be used across modules """
from __future__ import unicode_literals, absolute_import, print_function
import re
import functools
import warnings
from .compat import StringType, UnicodeType, quote_url
from .xml import XML
def really_unicode(in_string):
"""
Ensures s i... | {
"content_hash": "b7683fc1aab0a29cd0ef9f1f83feb162",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 79,
"avg_line_length": 31.80821917808219,
"alnum_prop": 0.6261843238587425,
"repo_name": "bwhaley/SoCo",
"id": "076e18c6796f783cc3e9a941e47489e4b378e79f",
"size": "4669",
... |
import sys
import queue
class Vertex:
def __init__(self):
self.edges = {}
def get_edges(self):
return self.edges
def add_edge(self, vertex, distance):
if vertex not in self.edges or distance < self.edges[vertex]:
self.edges[vertex] = distance
class Graph:
def __i... | {
"content_hash": "923a9fb860d2911bdeaf1f2e421d4893",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 69,
"avg_line_length": 27.11764705882353,
"alnum_prop": 0.5712219812002892,
"repo_name": "zeyuanxy/hacker-rank",
"id": "1eb40a79e8f5949f9d3edd6bef7edf59a0b27b2e",
"size": "... |
from django.db.models.signals import post_save
from celery import task
from fjord.base.utils import key_to_instance
from .utils import translate
@task(rate_limit='60/m')
def translate_task(instance_key, system, src_lang, src_field,
dst_lang, dst_field):
"""Celery task to perform a single tran... | {
"content_hash": "0ffb69ebfd45ba1f4a1bb8f54c0a72aa",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 77,
"avg_line_length": 32.666666666666664,
"alnum_prop": 0.6892692560895326,
"repo_name": "DESHRAJ/fjord",
"id": "b03dda10b8229bbf81cf09004c8fa8c0f0e3f23b",
"size": "3038",... |
"""
GPSDataTools.py: Utilities and class definitions for dealing with raw GPS
tracking data.
In general one is only interested in the Route class, which loads GPS data
from the database for a particular route and automatically turns it into
individual trips.
"""
# Copyright (c) 2010 Colin Bick, Robert Damphousse
#... | {
"content_hash": "0f3722144bdbb99180e1f32fb203a57a",
"timestamp": "",
"source": "github",
"line_count": 476,
"max_line_length": 130,
"avg_line_length": 32.01890756302521,
"alnum_prop": 0.6422806902434224,
"repo_name": "cbick/gps2gtfs",
"id": "9e0bbbab04d66ad55fef704ddcffab85da55194e",
"size": "1524... |
class vtkAVIWriter:
kits = ['vtk_kit']
cats = ['VTK basic writer']
help = \
"""vtkAVIWriter - Writes Windows AVI files.
Super Class:
vtkGenericMovieWriter
vtkAVIWriter writes AVI files. The data type
of the file is unsigned char regardless of the input type.
See Also:
vtkGenericMovieWrite... | {
"content_hash": "cc830b49037d933559eebfb489f73859",
"timestamp": "",
"source": "github",
"line_count": 14116,
"max_line_length": 143,
"avg_line_length": 31.663502408614338,
"alnum_prop": 0.7565945203395367,
"repo_name": "fvpolpeta/devide",
"id": "c8ed61634a58816b19d19fd6eb9f53ec43341d76",
"size": ... |
"""Typing helpers."""
from enum import IntEnum
from datetime import datetime
from typing import NamedTuple, Optional
__all__ = ('FilePriority', 'FileDownloadStrategy', 'HashingState', 'State',
'TorrentInfo', 'TorrentTrackedFile')
class HashingState(IntEnum):
"""Hashing state of the torrent."""
#:
... | {
"content_hash": "04798c7d91ffbf96397f8ccfee12bab1",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 76,
"avg_line_length": 22.50925925925926,
"alnum_prop": 0.6347182229535171,
"repo_name": "Tatsh/xirvik-tools",
"id": "779ac205052493a8c85a256f6f3ad9ef557f6dd4",
"size": "2... |
# -*- coding: utf-8 -*-
import collections
import itertools
import json
import os
import posixpath
import re
import time
from django.conf import settings
from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.core.files.storage import default_storage as s... | {
"content_hash": "0c8bf1195105a126f84848cf808ebae8",
"timestamp": "",
"source": "github",
"line_count": 2255,
"max_line_length": 79,
"avg_line_length": 37.58713968957871,
"alnum_prop": 0.5876780046956666,
"repo_name": "jpetto/olympia",
"id": "ff14f887bdd7cb8150bf7b308585e0b515710275",
"size": "8475... |
from container import Container
| {
"content_hash": "b93fb350f8b1cdc78e19db411892f5d2",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 31,
"avg_line_length": 32,
"alnum_prop": 0.875,
"repo_name": "macbinn/summer",
"id": "3e310304704c47f5e74dc757ff2a0c9a21558921",
"size": "32",
"binary": false,
"copies":... |
"""Unit tests for core identity behavior."""
import os
import uuid
import mock
from oslo_config import cfg
from keystone import exception
from keystone import identity
from keystone.tests import unit as tests
from keystone.tests.unit.ksfixtures import database
CONF = cfg.CONF
class TestDomainConfigs(tests.BaseTe... | {
"content_hash": "d372b91347496536b87e9d72df88ca6b",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 79,
"avg_line_length": 42.69911504424779,
"alnum_prop": 0.6051813471502591,
"repo_name": "rushiagr/keystone",
"id": "6c8faebbeb0bd58fabd81bc52575f1a1ce97bdb4",
"size": "53... |
import pathlib
import random
import re
import shutil
import subprocess
import tempfile
import uuid
import pytest
from ruamel import yaml
from scripts import generate_terraform
PROJECT_ROOT = generate_terraform.PROJECT_ROOT
FILE_PATHS = {
"dataset": PROJECT_ROOT / "samples" / "dataset.yaml",
"pipeline": PROJE... | {
"content_hash": "e62b2e33d15272def95bc4eec7d62631",
"timestamp": "",
"source": "github",
"line_count": 1142,
"max_line_length": 87,
"avg_line_length": 29.080560420315237,
"alnum_prop": 0.5979524239686841,
"repo_name": "GoogleCloudPlatform/public-datasets-pipelines",
"id": "7ce0fa93e86558d846c3e0197c... |
from flask import Flask, render_template, request
import requests
app = Flask(__name__)
@app.route("/")
def index():
r = requests.get('http://kritikosbot-telegram.appspot.com/gamestatusjson')
ready = r.json()["ready"]
if not ready:
return "Waiting for players..."
else:
cards = r.json()... | {
"content_hash": "9adfcbd2818ec5d8746c91525f1cbc68",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 78,
"avg_line_length": 25.61111111111111,
"alnum_prop": 0.5726681127982647,
"repo_name": "anbasile/donderskritikos",
"id": "a09089b5168e64df3cdd5ccacae1822e6c3acaa8",
"size... |
from Base.IFilesRepository import IFilesRepository
class BaseRepository(IFilesRepository):
def __init__(self):
self.BaseDirectory = "Templates/Base"
self.Pattern = "*.template"
super(BaseRepository, self).__init__(self.BaseDirectory)
def getPattern(self):
return self.Pattern | {
"content_hash": "06ddfa896a96fa7e04a71cc09f12b968",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 58,
"avg_line_length": 28.7,
"alnum_prop": 0.7630662020905923,
"repo_name": "afronski/grammar-generator",
"id": "dbd1afcc76d923fdbfa7c85e0ff3d9e0d9d4e952",
"size": "287",
... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'dirtyfields.db', ... | {
"content_hash": "e9e38496c852793e4babf3bef9cdbfd0",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 122,
"avg_line_length": 35.82105263157895,
"alnum_prop": 0.6858654128709962,
"repo_name": "chrisglass/django-dirtyfields",
"id": "4cc611a874292f746f5ce2803b7158480bc688da",
... |
from __future__ import print_function
from rdkit import Chem
from rdkit.Chem.Fraggle import FraggleSim
if __name__ =='__main__':
import sys,re
if (len(sys.argv) >= 2):
print("Program to run the first part of Fraggle. Program splits the molecule\nready for the search\n")
print("USAGE: ./fraggle.... | {
"content_hash": "5cead30644fa03ea6c96139ec34bcecc",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 110,
"avg_line_length": 32.515151515151516,
"alnum_prop": 0.5983224603914259,
"repo_name": "strets123/rdkit",
"id": "21c0cd7ad6cf8a6a383fb339e672ee27f1f48bd1",
"size": "275... |
import logging
logger = logging.getLogger("photomanager")
def __init_logger(logger):
logger.setLevel(level=logging.INFO)
handler = logging.FileHandler("photomanager.txt")
handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.s... | {
"content_hash": "edaeae08efd0b7db1d33a99aa9b4ac5b",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 89,
"avg_line_length": 25.2,
"alnum_prop": 0.7162698412698413,
"repo_name": "wrenchzc/photomanager",
"id": "0f6b82af189a4b11882473b2e702484eeb0a0c8e",
"size": "504",
"bin... |
from __future__ import unicode_literals
import socket
from django.contrib.sites.models import Site
from django.utils import six
from django.utils.six.moves.urllib.parse import urljoin
from djblets.siteconfig.models import SiteConfiguration
from reviewboard.site.urlresolvers import local_site_reverse
def get_server... | {
"content_hash": "adcd50fd22590671aaffb86a179955ae",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 78,
"avg_line_length": 32.57142857142857,
"alnum_prop": 0.6867167919799498,
"repo_name": "brennie/reviewboard",
"id": "828ad6356a319b5fc81231671b96771f23ddb6b8",
"size": "1... |
from __future__ import print_function
import os
import gc
import sys
import traceback
__all__ = ['measure', 'measure_with_rehearsal']
def measure_with_rehearsal():
"""
Runs a benchmark when used as an iterator, injecting a garbage
collection between iterations. Example::
for b in riak.benchmark... | {
"content_hash": "f4abc15573c6343ed21be9167c34f195",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 79,
"avg_line_length": 27.662576687116566,
"alnum_prop": 0.5058771346196496,
"repo_name": "basho/riak-python-client",
"id": "e1f3e55cd5b48fa381a5c72da9183b2410749f65",
"si... |
"""Module that runs application in development mode."""
import os
import click
from btt import create_app
from btt.database import (
db, User, Category, Account, Transaction, Group, MemberShip, create_db)
import unittest
from btt.classification import classification_score
app = create_app(os.getenv('FLASK_CONFIG'... | {
"content_hash": "170e2c7cdf306772049c490cd7eff0e8",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 78,
"avg_line_length": 31.102040816326532,
"alnum_prop": 0.678477690288714,
"repo_name": "gregcowell/BAM",
"id": "6dd6b8d62030e805de64379bb91517418294521b",
"size": "1524",... |
import json
import hashlib
import os
import re
import collections
import kubernetes
import yaml
from time import sleep
import lru
from metadata_helpers import *
namespace_to_watch = os.environ.get('NAMESPACE_TO_WATCH', 'default')
pod_name_to_execution_id_size = os.environ.get('POD_NAME_TO_EXECUTION_ID_SIZE', 5000)
w... | {
"content_hash": "796537883b1a4167537706019b37c986",
"timestamp": "",
"source": "github",
"line_count": 384,
"max_line_length": 173,
"avg_line_length": 44.346354166666664,
"alnum_prop": 0.5687944095366727,
"repo_name": "kubeflow/pipelines",
"id": "8f21ff6256c57fabb69a19092eeed514296e5f9d",
"size": ... |
from .base import *
DEBUG = False
ADMINS = (
(get_env('ALEX_ADMIN_NAME'), get_env('ALEX_ADMIN_EMAIL')),
)
MANAGERS = ADMINS
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.8/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['alpine-explorer.eu',... | {
"content_hash": "cac3f7c780fb377fa7fe505489af6d54",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 77,
"avg_line_length": 30.017857142857142,
"alnum_prop": 0.6145151695419393,
"repo_name": "wodo/alpine-explorer",
"id": "69673d07c41baac668f3e027541e8f18c660524e",
"size": ... |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class UserInfo(models.Model):
user = models.OneToOneField(User,primary_key=True)
class BookInfo(models.Model):
isbn = models.CharField(max_length = 13)
pic_url = models.URLField(max_length = 100,null=True... | {
"content_hash": "00d23c9df7e4740e759043aa862a74ed",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 79,
"avg_line_length": 40.58536585365854,
"alnum_prop": 0.7193509615384616,
"repo_name": "zearom32/SmartBooks",
"id": "c7ee940d6f6a15f86b04faa14bbd24cc614598d4",
"size": "1... |
"""distutils.command.install_scripts
Implements the Distutils 'install_scripts' command, for installing
Python scripts."""
# contributed by Bastian Kleineidam
__revision__ = "$Id: install_scripts.py 68943 2009-01-25 22:09:10Z tarek.ziade $"
import os
from distutils.core import Command
from distutils import log
from... | {
"content_hash": "5e44adc715e7edcb858fb3d8ac39f704",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 81,
"avg_line_length": 33.28125,
"alnum_prop": 0.5615023474178403,
"repo_name": "liangazhou/django-rdp",
"id": "d0f4a2ea456e81a68ce51b2c2133e204e219ad6d",
"size": "2130",
... |
a = {'x': 1, 'z': 3 }
b = {'y': 2, 'z': 4 }
# (a) Simple example of combining
from collections import ChainMap
c = ChainMap(a,b)
print(c['x']) # Outputs 1 (from a)
print(c['y']) # Outputs 2 (from b)
print(c['z']) # Outputs 3 (from a)
# Output some common values
print('len(c):', len(c))
print('c.keys... | {
"content_hash": "8b98b4779668f2ef2b709c4cb9ac16db",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 44,
"avg_line_length": 18.361702127659573,
"alnum_prop": 0.6164542294322132,
"repo_name": "SysCompass/compass-adapters",
"id": "6bd153385a1a5d8f378d540add36d2d3bf0ebddd",
"... |
"""
An interface to the Pluggable Authentication Modules (PAM) library,
written in pure Python (using ctypes).
"""
import io
import os
import sys
from distutils.core import setup
if 'bdist_wheel' in sys.argv:
import setuptools
with open('pamela.py') as f:
for line in f:
if line.startswith('__version... | {
"content_hash": "e4def959a0b493ac9cc68698d5e031d7",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 81,
"avg_line_length": 29.523809523809526,
"alnum_prop": 0.5959677419354839,
"repo_name": "rgbkrk/pamela",
"id": "fd03f697bb78995f001cd47fea0f2a2b88f3c98d",
"size": "1262",... |
import re
import os
import sys
import time
import datetime
import traceback
from decimal import Decimal
import threading
import electrum
from electrum.bitcoin import TYPE_ADDRESS
from electrum import WalletStorage, Wallet
from electrum_gui.kivy.i18n import _
from electrum.contacts import Contacts
from electrum.payment... | {
"content_hash": "07714789fefb7a5aaf5281e23faf0f77",
"timestamp": "",
"source": "github",
"line_count": 839,
"max_line_length": 129,
"avg_line_length": 36.71275327771156,
"alnum_prop": 0.5884682812804364,
"repo_name": "aasiutin/electrum",
"id": "1f99bc9c68c6b2291ee6b81888c39e600af53974",
"size": "3... |
import calendar
import Tkinter
import ttk
import tkFont
def get_calendar(locale, fwday):
# instantiate proper calendar class
if locale is None:
return calendar.TextCalendar(fwday)
else:
return calendar.LocaleTextCalendar(fwday, locale)
class Calendar(ttk.Frame):
# XXX ToDo: cget and c... | {
"content_hash": "8a2ff341e8b434cab141306ac5799b69",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 113,
"avg_line_length": 36.396694214876035,
"alnum_prop": 0.5977520435967303,
"repo_name": "HugoLG/SFCrimeClassification",
"id": "04c6653d725f1397c94cdde55862f5814813c2ad",
... |
from django.db import models
class IncomeBenefitsManager(models.Manager):
pass
class IncomeBenefits(models.Model):
objects = IncomeBenefitsManager()
personal_id = models.CharField(max_length=15)
project_entry_id = models.CharField(max_length=15)
income_benefits_id = models.CharField(max_length=15)... | {
"content_hash": "3ab80236f5d8b6b6f54a1cf544f4c1a4",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 80,
"avg_line_length": 50.29113924050633,
"alnum_prop": 0.7435187515731185,
"repo_name": "dborstelmann/Penguins-GH6",
"id": "e9b4111327596de08e2fd6989b95c3beeaae8fb9",
"siz... |
def test_transform(testapp):
res = testapp.get('/')
assert 'X-Transformed' in res.headers
assert 'X-After-Transform' in res.headers
res = testapp.get('/')
assert 'X-Transformed' in res.headers
assert 'X-After-Transform' in res.headers
def test_should_transform(testapp):
res = testapp.get('... | {
"content_hash": "353da7ad5152bfd14a6878436336ad00",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 99,
"avg_line_length": 31.4,
"alnum_prop": 0.679078882900539,
"repo_name": "lrowe/subprocess_middleware",
"id": "3b8eb207d0fa2b586f212be0ef98fd44717191db",
"size": "2041",
... |
import tornado.web
class WebHandler(tornado.web.RequestHandler):
def get(self):
self.render("index.html") | {
"content_hash": "77d864628baee9ab1b95f8535da9b810",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 45,
"avg_line_length": 29.25,
"alnum_prop": 0.717948717948718,
"repo_name": "jonepatr/affordance",
"id": "a614be7a9d5ad8ab1b618b6121c90a4821a5bede",
"size": "117",
"binary... |
import io
import os
from setuptools import find_packages, setup
# This reads the __version__ variable from cirq/_version.py
__version__ = ''
exec(open('cirq-core/cirq/_version.py').read())
name = 'cirq'
description = (
'A framework for creating, editing, and invoking '
'Noisy Intermediate Scale Quantum (NISQ... | {
"content_hash": "f0c25cdcf3bb499a6fa02bbe418ff57d",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 100,
"avg_line_length": 33.67272727272727,
"alnum_prop": 0.683585313174946,
"repo_name": "balopat/Cirq",
"id": "c0c1f0b90d8c4eed1f90069ca1dba16f98e6dd8f",
"size": "2437",
... |
'''"Executable documentation" for the pickle module.
Extensive comments about the pickle protocols and pickle-machine opcodes
can be found here. Some functions meant for external use:
genops(pickle)
Generate all the opcodes in a pickle, as (opcode, arg, position) triples.
dis(pickle, out=None, memo=None, indentl... | {
"content_hash": "b6b9de2d5986fc864ed0e3e5c39bb97f",
"timestamp": "",
"source": "github",
"line_count": 2271,
"max_line_length": 79,
"avg_line_length": 32.73800088066931,
"alnum_prop": 0.5914079733146823,
"repo_name": "DecipherOne/Troglodyte",
"id": "065498c2a13b98b5caa95af20fdf1de4d7d6c430",
"size... |
"""
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": "9704e63c8c9c00d32ca1579df53ce43f",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 103,
"avg_line_length": 34.0375,
"alnum_prop": 0.7278736687477048,
"repo_name": "sekikn/ambari",
"id": "ac54bc9d6eb807979a07b5fe52f00ad605376e8f",
"size": "2745",
"binary... |
"""Tests for http/websocket.py"""
import base64
import hashlib
import os
import struct
import unittest
import unittest.mock
import aiohttp
from aiohttp import websocket, multidict, protocol, errors
class WebsocketParserTests(unittest.TestCase):
def test_parse_frame(self):
buf = aiohttp.ParserBuffer()
... | {
"content_hash": "b7e414deb84f02f8cb7b1e019f7f9a58",
"timestamp": "",
"source": "github",
"line_count": 492,
"max_line_length": 79,
"avg_line_length": 34.86991869918699,
"alnum_prop": 0.580729773840056,
"repo_name": "saghul/aiohttp",
"id": "f1be1fd112d6f11e8b2e1866ed0def34b6c5cf2a",
"size": "17158"... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_bestine_capitol02.iff"
result.attribute_template_id = 9
result.stfName("npc_name","twilek_base_female")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "192fb3188d5a2bd7c05e3cd1421e98aa",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 71,
"avg_line_length": 23.692307692307693,
"alnum_prop": 0.7012987012987013,
"repo_name": "obi-two/Rebelion",
"id": "f3d63cad1a75eb1cee33ce7d4b446e6a5ae5f6bc",
"size": "453... |
"""Utilities relating to interaction with service plans
************************************************************************
FOR THE TIME BEING WHATEVER MODIFICATIONS ARE APPLIED TO THIS FILE
SHOULD ALSO BE APPLIED TO sdk_plan IN ANY OTHER PARTNER REPOS
*************************************************************... | {
"content_hash": "ffeceb30abc6abe1cf1317c2a841af17",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 115,
"avg_line_length": 31.471910112359552,
"alnum_prop": 0.6231702963227419,
"repo_name": "mesosphere/dcos-kafka-service",
"id": "e9821c25335cc9cde2477504611710bbe63cefe5",... |
import os
import glob
import numpy as np
from datetime import datetime
from astropy.io import fits
from .conf import read_conf
from ._version import __version__
try:
import configparser
except ImportError:
import ConfigParser as configparser
try:
from PIL import Image
except ImportError:
import Image
... | {
"content_hash": "c077a409a9a3f8bdd9213dfe2e0c275f",
"timestamp": "",
"source": "github",
"line_count": 308,
"max_line_length": 80,
"avg_line_length": 34.73701298701299,
"alnum_prop": 0.5010748668099823,
"repo_name": "astrotuvi/pyplate",
"id": "e5c5083e32d4fcb87f306a7513acadc65b97b133",
"size": "10... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.relay import RelayAPI
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-relay
# USAGE
python relay_name_space_delete.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
o... | {
"content_hash": "8e7bfda3dbee8aaf54e01b04a717e63e",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 138,
"avg_line_length": 33.303030303030305,
"alnum_prop": 0.72975432211101,
"repo_name": "Azure/azure-sdk-for-python",
"id": "b482aad2f50505cc73e0c7228a60a18ed4df88ae",
"si... |
"""
Turma.test_models
~~~~~~~~~~~~~~
Testa coisas relacionada ao modelo.
:copyright: (c) 2011 by Felipe Arruda Pontes.
"""
from django.test import TestCase
from model_mommy import mommy
from Materia.Turma.models import Turma
class TurmaTest(TestCase):
def setUp(self):
self.turma = momm... | {
"content_hash": "d01f5c1086f2dec514301c570421c362",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 49,
"avg_line_length": 19.653846153846153,
"alnum_prop": 0.6183953033268101,
"repo_name": "arruda/amao",
"id": "dc81c6d869d288f29215d4d1818f0a2c9ef2e92c",
"size": "535",
... |
import httplib
import json
import socket
import time
from neutron.openstack.common import excutils
from neutron.openstack.common import log as logging
from neutron.plugins.nec.common import config
from neutron.plugins.nec.common import exceptions as nexc
LOG = logging.getLogger(__name__)
class OFCClient(object):
... | {
"content_hash": "e5b0bd584c4c4973a01007731c4e2c95",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 75,
"avg_line_length": 40.194244604316545,
"alnum_prop": 0.5294433506354036,
"repo_name": "yamahata/neutron",
"id": "957f24483a89fd4b640185821d36fd2aa714ab16",
"size": "62... |
from collections import defaultdict
from Queue import Empty, Queue
import threading
import time
# project
from checks import AgentCheck
from checks.libs.thread_pool import Pool
from config import _is_affirmative
TIMEOUT = 180
DEFAULT_SIZE_POOL = 6
MAX_LOOP_ITERATIONS = 1000
FAILURE = "FAILURE"
class Status:
DOW... | {
"content_hash": "d2913a8a3bed9dbb0d8be6d3bd7ac29f",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 169,
"avg_line_length": 37.72,
"alnum_prop": 0.5852480263933074,
"repo_name": "mderomph-coolblue/dd-agent",
"id": "eb37f0b995fda913f7260c71d095d80fde235078",
"size": "8496... |
from __future__ import unicode_literals
BEFORE_EVOLUTIONS = [
'evolutions_app2',
('evolutions_app2', 'second_evolution'),
]
AFTER_EVOLUTIONS = [
'evolutions_app',
('evolutions_app', 'first_evolution'),
]
BEFORE_MIGRATIONS = [
('migrations_app2', '0002_add_field'),
]
AFTER_MIGRATIONS = [
('m... | {
"content_hash": "f3ab196bc5527fa8f0b2ed28b41a62c6",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 44,
"avg_line_length": 16.863636363636363,
"alnum_prop": 0.633423180592992,
"repo_name": "beanbaginc/django-evolution",
"id": "46aec3dfac34cec6edbdcc8a77b47487cc8c1249",
"s... |
"""Support for Satel Integra zone states- represented as binary sensors."""
import logging
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from . import (
CONF_OUTPUTS,
CONF_ZONE... | {
"content_hash": "361756d0d94660a6e0d6e6d6eda3d8f8",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 86,
"avg_line_length": 30.608695652173914,
"alnum_prop": 0.6167613636363637,
"repo_name": "titilambert/home-assistant",
"id": "19763903f2784547fbdff7f53f19005737520df6",
"... |
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
import os.path
import urllib.parse
from zipfile import ZipFile
from openelex.base.fetch import BaseFetcher
from openelex.us.wa.datasource import Datasource
class FetchResults(BaseFetcher):
def __init__(sel... | {
"content_hash": "5b6cba1fff84fd36372c13a07825cf0b",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 91,
"avg_line_length": 45.03333333333333,
"alnum_prop": 0.5474956822107081,
"repo_name": "openelections/openelections-core",
"id": "4de101388268c4b69e51ee7aee15ea73efcd77d2",... |
"""Generic interfaces to perform BMC.
It defines the results (e.g. traces, status).
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import abc
import numpy as np
import six
class InvarStatus:
Safe, Unsafe, Unknown = range(3)
@six.add_metacl... | {
"content_hash": "b5d8533d65fa7d3a037d428a67c24c3c",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 70,
"avg_line_length": 21.77027027027027,
"alnum_prop": 0.6691495965238982,
"repo_name": "zutshi/S3CAMR",
"id": "af2dab812b4d09497c6a638c92f13b423d3f6cce",
"size": "1611",
... |
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Client',
fields=[
... | {
"content_hash": "e29f5557ce709e8b9588d4f8b09b97d5",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 180,
"avg_line_length": 54.27956989247312,
"alnum_prop": 0.5641838351822503,
"repo_name": "delphcf/sis",
"id": "e1e4d567febbfd1a7814efd2260bdfd6ea02d75b",
"size": "5072",
... |
"""Operations to emit summaries."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import collections
import functools
import getpass
import os
import re
import threading
import time
import six
from tensorflow.core.framework import graph_pb2
f... | {
"content_hash": "fda768ad3d892b522915bf474486cd3d",
"timestamp": "",
"source": "github",
"line_count": 1264,
"max_line_length": 104,
"avg_line_length": 36.55537974683544,
"alnum_prop": 0.6912738605375925,
"repo_name": "gunan/tensorflow",
"id": "91b8e61b3411f6d3dd97d731c48e19800207cce2",
"size": "4... |
import re
import struct
from .util import open_if_filename, tryint
from .genres import genre_by_index
HEADER_SIZE = 8
re_atom_type = re.compile(r'[A-Za-z0-9\-©]{4}')
def read_atom_header(readfunc, offset):
header = readfunc(offset, HEADER_SIZE)
if len(header) == HEADER_SIZE:
size, byte_type = struct... | {
"content_hash": "ccfda70829856908f8385e4904579d21",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 103,
"avg_line_length": 28.68944099378882,
"alnum_prop": 0.5513098073176013,
"repo_name": "jmtchllrx/pyMuse",
"id": "be79587936bb18a8d26804afd88643b22b86a829",
"size": "95... |
from __future__ import absolute_import
from mox import IsA # noqa
from horizon import exceptions
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
class SwiftApiTests(test.APITestCase):
def test_swift_get_containers(self):
containers = self.containers.list()
... | {
"content_hash": "3188f23cba5cc8fcfe7e2f49e447c7a6",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 77,
"avg_line_length": 38.91121495327103,
"alnum_prop": 0.551579200192146,
"repo_name": "mandeepdhami/horizon",
"id": "3f244dc30bc71baf271af06e75e44222fb5c7985",
"size": "... |
"""
isotropic_turbulent_suspension_with_settling_and_bleaching.py
Example of a continuous-time, stochastic, pair-based cellular automaton model,
which simulates the diffusion of suspended particles in a turbulent fluid.
Particles start with an accumulated luminescence signal L = 1, and are bleached
by exposure to ligh... | {
"content_hash": "cd08eafed3554ba5519a9133b3cbb73d",
"timestamp": "",
"source": "github",
"line_count": 422,
"max_line_length": 122,
"avg_line_length": 39.81042654028436,
"alnum_prop": 0.5791071428571428,
"repo_name": "laijingtao/landlab",
"id": "3192053bfa0cce5e8407068931198d4fdbd2eba1",
"size": "... |
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 field 'SubscriptionPlan.theme_change'
db.add_column('subscriptions_subscriptionplan', 'theme_change', self.gf('djan... | {
"content_hash": "9e2ab166fec143b8fe07a4f90b70a289",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 186,
"avg_line_length": 82.5421052631579,
"alnum_prop": 0.5635401390040171,
"repo_name": "StephenPower/CollectorCity-Market-Place",
"id": "37d57016b229c737d0bd274616b0d6e56f... |
__author__ = 'Kevin'
#Running on python2.7
import ConfigParser
config = ConfigParser.ConfigParser()
cfg_file = open('config.ini', 'r+')
config.readfp(cfg_file)
#
def check_input():
y_or_n = raw_input()
if y_or_n == 'y':
return True
elif y_or_n != 'n':
print("Input error")
raise Va... | {
"content_hash": "9fe3786b8dd386af3ce296ad44122d7e",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 135,
"avg_line_length": 29.741666666666667,
"alnum_prop": 0.6066124964976184,
"repo_name": "KevinConti/Summary",
"id": "2928d6760339c753aa3f71027173c56918f4a61a",
"size": ... |
import os
import uuid
import pytest
import sqlalchemy
import tink
from snippets.cloud_kms_env_aead import init_tink_env_aead
from snippets.cloud_sql_connection_pool import init_db
from snippets.encrypt_and_insert_data import encrypt_and_insert_data
from snippets.query_and_decrypt_data import query_and_decrypt_data
t... | {
"content_hash": "04b52d57429d3d963223fbdf501dbec8",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 85,
"avg_line_length": 28.15714285714286,
"alnum_prop": 0.6519533231861999,
"repo_name": "GoogleCloudPlatform/python-docs-samples",
"id": "2dada45fb0ee872590fd725255af28bfaf1... |
"""
File backends with small tweaks to work with gunicorn + eventlet async
workers. These should eventually becom unecessary as the supporting libraries
continue to improve.
"""
import eventlet
from django.utils.deconstruct import deconstructible
from athumb.backends.s3boto import S3BotoStorage, S3BotoStorage_AllPub... | {
"content_hash": "093faaf7847a372912f95657dbe745c3",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 78,
"avg_line_length": 35.11904761904762,
"alnum_prop": 0.7315254237288136,
"repo_name": "bdabrowski/django-athumb",
"id": "c5600a36756943f7473688481585695e5952f5c5",
"size... |
import json
import urllib2
import urllib
import sys
import hashlib
import subprocess
import os
#You can put the version info somewhere in your program
currentVersion = 1.0
#MD5 check helper function
def md5(fileName):
"""Compute md5 hash of the specified file"""
m = hashlib.md5()
try:
fd = open(fi... | {
"content_hash": "4f13a8163227ff87cf8f0af7488fe47f",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 100,
"avg_line_length": 27.914285714285715,
"alnum_prop": 0.7048788809280109,
"repo_name": "LinkItONEDevGroup/LASS",
"id": "6df44f3e75c6d8139589f7a41bfdc59a63af36e9",
"siz... |
class Sample(object):
"""Sample"""
def __init__(self, name, duration):
self.name = name
self.duration = duration
| {
"content_hash": "6202f91f6324950fe5ad17fd9783691f",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 39,
"avg_line_length": 23,
"alnum_prop": 0.5652173913043478,
"repo_name": "gkvoelkl/python-sonic",
"id": "b53120d17b83eacd8aa33c8ccc69de3612dface7",
"size": "138",
"binary... |
from animal import Animal
from ..ai.state import State
from location import Location
from math import pi
import random
import nodebox.graphics as ng
class Dog(Animal):
def __init__(self, world):
Animal.__init__(self, world)
self.speed = 4.0
self.angle = 0.0
def reset(self):
s... | {
"content_hash": "6150d4c15f3a14492585541d739a26aa",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 160,
"avg_line_length": 31.537037037037038,
"alnum_prop": 0.6236054022313564,
"repo_name": "schmit/sheepherding",
"id": "0e9d63a7a8f3be831d30e0d2961fd9ae7f354717",
"size": ... |
__author__ = 'Daan Wierstra and Tom Schaul'
import pickle
from scipy import dot, argmax
from random import shuffle
from trainer import Trainer
from pybrain.utilities import fListToString
from pybrain.auxiliary import GradientDescent
class BackpropTrainer(Trainer):
"""Trainer that trains the parameters of a mod... | {
"content_hash": "b9f3d5c8bc2be5181dd79edafc97b671",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 96,
"avg_line_length": 40.66403162055336,
"alnum_prop": 0.5867029548989113,
"repo_name": "hassaanm/stock-trading",
"id": "061bb6d0fd809a992d8d866ff3372458f3a63e62",
"size"... |
import os
from heat.engine.resources.hwcloud.hws_service.hws_client import HWSClient
from heat.engine.resources.cloudmanager.util.retry_decorator import RetryDecorator
from heat.openstack.common import log as logging
from heat.engine.resources.cloudmanager.util.cloud_manager_exception import *
from heat.engine.resourc... | {
"content_hash": "9ea32a326efb0f50ecd9f8913c6a4f08",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 139,
"avg_line_length": 43.148459383753504,
"alnum_prop": 0.6195793300441443,
"repo_name": "Hybrid-Cloud/orchard",
"id": "da32de801d1b89c0d799c7c5a5b972bac3b73cbf",
"size"... |
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# create some random points in the unit cube centered at (.5,.5,.5)
#
math = vtk.vtkMath()
points = vtk.vtkPoints()
i = 0
while i < 25:
points.InsertPoint(i,math.Random(0,1),math.Random(0,1)... | {
"content_hash": "26db629f5986f7b316b40bd69d63ce98",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 76,
"avg_line_length": 27.346153846153847,
"alnum_prop": 0.7369901547116737,
"repo_name": "timkrentz/SunTracker",
"id": "ed7831c9b897fc01067943923ac7a7f23841d02f",
"size": ... |
"""Add ``password`` column to ``user`` table
Revision ID: 561833c1c74b
Revises: 40e67319e3a9
Create Date: 2015-11-30 06:51:25.872557
"""
from __future__ import annotations
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '561833c1c74b'
down_revision = '40e67319e3a9'... | {
"content_hash": "17416511b3aae3242ac38d330f5fba3e",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 64,
"avg_line_length": 20.23076923076923,
"alnum_prop": 0.7129277566539924,
"repo_name": "nathanielvarona/airflow",
"id": "3578fd1e7bdb0a0f2c4c08a190ac2dad47c194ae",
"size"... |
from softmax import Softmax
from mlp import MLP
from cnn import CNN
from vae import VAE
from sbn import SBN
from adgm import ADGM
from hdgm import HDGM
from dadgm import DADGM
from convvae import ConvVAE
from convadgm import ConvADGM
# load some models that require the latest version of Lasagne
try:
from resnet impo... | {
"content_hash": "30efa5aaa8278db20559a4ba971b17a8",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 61,
"avg_line_length": 22.346153846153847,
"alnum_prop": 0.7814113597246127,
"repo_name": "kuleshov/deep-learning-models",
"id": "cb5c7dd6166fa90ab2d9e214de5267cbe1467cb5",
... |
from tkFont import Font
from Tkinter import (Button, Frame, IntVar, Label,
Listbox, Menu, Scrollbar, Tk)
from nltk.draw.util import CanvasFrame, ShowText
from nltk.util import in_idle
from nltk.tag import RegexpTagger
from nltk.parse import MaltParser
from nltk.sem.logic import Variable
from nltk... | {
"content_hash": "1dfc035ada1b4c013d2c69d96c123a18",
"timestamp": "",
"source": "github",
"line_count": 472,
"max_line_length": 108,
"avg_line_length": 37.970338983050844,
"alnum_prop": 0.5431313469478852,
"repo_name": "Jaemu/haiku.py",
"id": "1bce103e63147d2ce0c3f170f7f192416a9ce137",
"size": "182... |
import os, socket, binascii
from twisted.internet import reactor
from autobahn.websocket import WebSocketClientFactory, WebSocketClientProtocol
from autobahn.websocket import WebSocketServerFactory, WebSocketServerProtocol
class BroadcastServerProtocol(WebSocketServerProtocol):
def onOpen(self):
self.fact... | {
"content_hash": "08e8a408b5857cdb0b127640c260c56a",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 87,
"avg_line_length": 26.14666666666667,
"alnum_prop": 0.6930137684854666,
"repo_name": "normanmaurer/AutobahnTestSuite",
"id": "9d72ec66bee6eb4b00ee826f755973494329414f",
... |
import sys
import os
# 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('../python_code'))
# -- ... | {
"content_hash": "c6ff8d5be671f2ce29decccb77d9d462",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 79,
"avg_line_length": 31.762096774193548,
"alnum_prop": 0.7058524819093563,
"repo_name": "bergercookie/Pump3000",
"id": "1c26be1d615b30e28c0e581abed62fb8f12904eb",
"size"... |
"""
argparse supplements
"""
# ----------------------------------------------------------------------------
from __future__ import absolute_import
import argparse
import os
import re
import shlex
__all__ = [
"action",
"type",
]
class _Registry(object):
pass
def _register(registry, name, value):
s... | {
"content_hash": "a21336d2dc10f93d8bf6be77ea828718",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 79,
"avg_line_length": 27.45263157894737,
"alnum_prop": 0.5732361963190185,
"repo_name": "ben-ng/swift",
"id": "b8e3eaef3cd04576dc2c725b23bacac0beaa1174",
"size": "5722",
... |
"""Constants for the ViCare integration."""
import enum
DOMAIN = "vicare"
PLATFORMS = ["climate", "sensor", "binary_sensor", "water_heater"]
VICARE_DEVICE_CONFIG = "device_conf"
VICARE_API = "api"
VICARE_NAME = "name"
VICARE_CIRCUITS = "circuits"
CONF_CIRCUIT = "circuit"
CONF_HEATING_TYPE = "heating_type"
DEFAULT_... | {
"content_hash": "13d4b60cd40aad7765181265c90f18ab",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 66,
"avg_line_length": 22.128205128205128,
"alnum_prop": 0.6859791425260718,
"repo_name": "aronsky/home-assistant",
"id": "2336ef40eaacd01d5cb156dd1c1d8424d0ae6f85",
"size"... |
import unittest
from problem.geocode.geocodio import GeocodeCache, GeocodioGeocoder
class GeocodioTest(unittest.TestCase):
def test_geocode(self):
with GeocodioGeocoder() as geo:
self.assertEqual(
dict(lat=38.884999,
lng=-77.094806,
f... | {
"content_hash": "01ac429ae83cf5d716c2e957e24e20ca",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 79,
"avg_line_length": 31.9,
"alnum_prop": 0.5862068965517241,
"repo_name": "jhanley634/testing-tools",
"id": "a3a05eb7a7a4d81c2be55456ae3e2967f500ae2c",
"size": "1723",
... |
from django.contrib import admin
from .models import Recipe
admin.site.register(Recipe)
| {
"content_hash": "fec8f1abe5371dae2e0586fcebafacad",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 32,
"avg_line_length": 18,
"alnum_prop": 0.8111111111111111,
"repo_name": "nowackie/leaven",
"id": "ac80ab6554306240b407f9ea0a64e15f7aa92118",
"size": "90",
"binary": fals... |
from openturns import *
TESTPREAMBLE()
RandomGenerator.SetSeed(0)
try:
iMax = 5
distributionCollection = DistributionCollection()
distributionCollection.add(Laplace(1.0, 0.0))
distributionCollection.add(Logistic(0.0, 1.0))
distributionCollection.add(LogNormal(0.0, 1.0, 0.0))
distributionCollec... | {
"content_hash": "d18d3aef5a6eecfed3c94a56f63fa2b8",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 89,
"avg_line_length": 44.0625,
"alnum_prop": 0.6943262411347517,
"repo_name": "sofianehaddad/ot-svn",
"id": "2992ea7959ff44e8e4e7b9748a1e2ccbb17ed5fd",
"size": "1434",
"... |
import os
from draco2.model.test.shopmodel import ShopModel
from draco2.database.test.support import DatabaseTest
class ModelTest(DatabaseTest):
"""Base class for model tests."""
def setup_method(cls, method):
super(ModelTest, cls).setup_method(method)
cls.model = ShopModel(cls.database)
... | {
"content_hash": "baea834618bf9829de9ad4ed84542b49",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 53,
"avg_line_length": 29.42105263157895,
"alnum_prop": 0.669051878354204,
"repo_name": "geertj/draco2",
"id": "e6329aa5ffec1a46917d7db539d3364568b63e0b",
"size": "972",
... |
from decimal import Decimal
def assert_decimal(val):
if isinstance(val, Decimal):
return val
if isinstance(val, (int, str)):
return Decimal(val)
raise ValueError("value is required to be of type 'decimal', "
"but it is of type {!r}".format(type(val).__name__))
| {
"content_hash": "2f377f771c7ad153eb8250100fa40137",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 73,
"avg_line_length": 26.166666666666668,
"alnum_prop": 0.6019108280254777,
"repo_name": "jmelett/pyFxTrader",
"id": "4f3406e90687c202104482ffdab834fe6ebfe372",
"size": "3... |
import sys
from socket import timeout
from .version import __version__
try:
import urllib.request as urllib_request
from urllib.parse import urlencode
from urllib.error import HTTPError
except ImportError: # Python 2
import urllib2 as urllib_request
from urllib2 import HTTPError
from urllib i... | {
"content_hash": "48566a84ec9ea5305b952499a68cb6ba",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 78,
"avg_line_length": 36.440677966101696,
"alnum_prop": 0.5674418604651162,
"repo_name": "rice-apps/petition-app",
"id": "c0afa10052a935a78450925543448be6b1dc8cc5",
"size... |
from __future__ import unicode_literals, division, absolute_import
from flexget import options
from flexget.event import event
from flexget.logger import console
from flexget.plugins.filter import seen
from flexget.utils.database import with_session
from flexget.utils.imdb import is_imdb_url, extract_id
def do_cli(m... | {
"content_hash": "1e1fd3982083aa4cf83226bfbaad1f9c",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 114,
"avg_line_length": 39.707692307692305,
"alnum_prop": 0.6629213483146067,
"repo_name": "Pretagonist/Flexget",
"id": "ba5284adb8ac4112ae56595f62e6f16cb013039c",
"size": ... |
from django.conf import settings
from sqjobs import create_sqs_broker, create_sqs_worker
def get_broker():
return create_sqs_broker(
access_key=settings.SQJOBS_SQS_ACCESS_KEY,
secret_key=settings.SQJOBS_SQS_SECRET_KEY,
region_name=settings.SQJOBS_SQS_REGION_NAME,
endpoint_url=geta... | {
"content_hash": "e790d4d6d43429cce5bdf3fab8d3f76e",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 72,
"avg_line_length": 30.576923076923077,
"alnum_prop": 0.680503144654088,
"repo_name": "gnufede/sqjobs",
"id": "f40c84321176a782962067dd3f2cf91faa70058f",
"size": "795",
... |
from gmusicapi import Mobileclient
import getpass
class GpmSession(object):
# Private Variables
# Public Variables
api = None
logged_in = False
songs = None
playlists = None
# Constructor with optionally passed credentials
# Omit credentials if you want to handle login, include for pr... | {
"content_hash": "fc925b803a8429419bd0b33c23fbb732",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 118,
"avg_line_length": 34.93333333333333,
"alnum_prop": 0.612118320610687,
"repo_name": "sethraymond/dootbot",
"id": "b9ba2cc55a0337eb956ecbd1ac27ddd34084f851",
"size": "2... |
import uwsgi
uwsgi.log("I am uWSGI %s" % uwsgi.version)
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
uwsgi.log(str(env))
if env['PATH_INFO'] == '/logme':
uwsgi.log_this_request()
return "log written"
| {
"content_hash": "8b3cd4e6bae161e49dd87beb02400ac4",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 57,
"avg_line_length": 23.545454545454547,
"alnum_prop": 0.6718146718146718,
"repo_name": "jyotikamboj/container",
"id": "530022dde89605ab87135a9fadc1bb5ff9523442",
"size":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.