text stringlengths 4 1.02M | meta dict |
|---|---|
from PIL import Image, ImageFilter
import json
import os
import random
def average(num1,num2):
# average of two numbers
# note we truncate before adding, not after
return avg
def take_Average(px1,px2,pixels,width,height):
# For every pixel in the smaller dimensions
# G... | {
"content_hash": "8b537a035ff6d8928bb6169bcab12339",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 149,
"avg_line_length": 31.34285714285714,
"alnum_prop": 0.650865998176846,
"repo_name": "CS205IL-sp15/workbook",
"id": "2993aed01505946571fbf23ea11099ebb7b514b1",
"size":... |
"""
Django settings for nativx_survey project.
Generated by 'django-admin startproject' using Django 1.10a1.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
impor... | {
"content_hash": "7774213b141f7a9e6cd736789e50ed56",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 91,
"avg_line_length": 26.044444444444444,
"alnum_prop": 0.6806029579067122,
"repo_name": "DLance96/nativx-survey",
"id": "b729e315353f13e0a1ba216ff096066a1a31a2c3",
"size... |
from distutils.core import setup
setup(
name='django-availability',
version='0.1.0',
author='dashavoo',
author_email='',
packages=['availability'],
url='https://github.com/dashavoo/django-availability',
license='LICENSE.txt',
description='Manage availability of objects in Django',
l... | {
"content_hash": "f82cbf68af5d3ca6affd78535bdb3334",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 59,
"avg_line_length": 27.8,
"alnum_prop": 0.6738609112709832,
"repo_name": "dashavoo/django-availability",
"id": "b8d91fb3065c181adb0c4ce16773467946276c52",
"size": "417",... |
"""Unit tests XACML Context handler. This PIP presents a SAML interface for its
Policy Enforcement Point and has a SAML interface to query a remote attribute
authority for attributes
"""
__author__ = "P J Kershaw"
__date__ = "13/08/10"
__copyright__ = "(C) 2010 Science and Technology Facilities Council"
__license__ =... | {
"content_hash": "26955d8e94f19eb732b198d75af1f09c",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 81,
"avg_line_length": 36.37096774193548,
"alnum_prop": 0.6811529933481153,
"repo_name": "philipkershaw/ndg_security_server",
"id": "7070c7bf847d52ce24acd69b1ef9ae2759323c8f"... |
DATA_DIR='/tmp/report_data'
# Make directory, if it doesn't exist.
| {
"content_hash": "c2669dc7800ee2ba6484e53066e09184",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 38,
"avg_line_length": 33.5,
"alnum_prop": 0.7164179104477612,
"repo_name": "jfalkner/report_data",
"id": "268eef773386a1714c115673432e3aebce152559",
"size": "67",
"binary... |
"""Tests for cement.core.setup."""
import os
import sys
import json
import signal
from time import sleep
from cement.core import foundation, exc, backend, config, extension, plugin
from cement.core.handler import CementBaseHandler
from cement.core.controller import CementBaseController, expose
from cement.core import ... | {
"content_hash": "123c0284605f516ca279d28abab0b4cc",
"timestamp": "",
"source": "github",
"line_count": 495,
"max_line_length": 78,
"avg_line_length": 30.038383838383837,
"alnum_prop": 0.5673548994552424,
"repo_name": "fxstein/cement",
"id": "e5b57fbb694564a4e04aecae374a56ddbc880efc",
"size": "1486... |
from object import *
__all__ = ['Result']
| {
"content_hash": "5ef60d1997c5e65b6be79876c26d822d",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 20,
"avg_line_length": 14.333333333333334,
"alnum_prop": 0.5813953488372093,
"repo_name": "rlinguri/pyfi",
"id": "7b624988f916d2bc5ebcfa811c1734c5c5d718c7",
"size": "66",
... |
__requires__ = 'Babel==1.3'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('Babel==1.3', 'console_scripts', 'pybabel')()
)
| {
"content_hash": "282434e7178e020cd7262f6fe861d9f0",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 70,
"avg_line_length": 25.125,
"alnum_prop": 0.5920398009950248,
"repo_name": "marcosxddh/aula_script",
"id": "ebd4e781d94d4c75807b762f0fdcae035069b447",
"size": "320",
"b... |
"""Python serializer
Serialize object to Python code.
The following data types are supported:
- str,
- dict,
- list,
- set,
- tuple,
- boolean values,
- None value;
If you encounter a circular reference, an ValueError will be thrown.
"""
from typing import Any, Set
from o2a.utils.el_utils import escape_string_with_... | {
"content_hash": "87244626564dac2f5792d1340e922eae",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 97,
"avg_line_length": 29.25,
"alnum_prop": 0.5485168426344897,
"repo_name": "GoogleCloudPlatform/oozie-to-airflow",
"id": "997521b2e8fdbeba33188d295faa156760c8fa74",
"size... |
import math
from argparse import Namespace
from dataclasses import dataclass, field
from omegaconf import II
from typing import Optional
import torch
import torch.nn.functional as F
from fairseq import metrics, utils
from fairseq.criterions import FairseqCriterion, register_criterion
from fairseq.dataclass import Fair... | {
"content_hash": "ab7175139db6db460ffc2bfd61bd9b55",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 104,
"avg_line_length": 37.55709342560554,
"alnum_prop": 0.5231251151649161,
"repo_name": "pytorch/fairseq",
"id": "e966e47cf2680c6d47a75aa6bdbe5bef05113aa8",
"size": "110... |
import sys
sys.path.append("../../dependencies/Python")
import mscl
#TODO: change these constants to match your setup
COM_PORT = "COM4"
try:
#create a Serial Connection with the specified COM Port, default baud rate of 921600
connection = mscl.Connection.Serial(COM_PORT)
#create an InertialNode with the ... | {
"content_hash": "50b232d8052063922a96527ca34da985",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 88,
"avg_line_length": 30.545454545454547,
"alnum_prop": 0.7232142857142857,
"repo_name": "LORD-MicroStrain/MSCL",
"id": "f6916ed0db35814172a64df5a5cb892016531086",
"size":... |
"""
WSGI config for postero project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from .settings import ENV
os.enviro... | {
"content_hash": "9c93c7ace67b80b2dd1f64ea848b768a",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 78,
"avg_line_length": 25.761904761904763,
"alnum_prop": 0.7707948243992606,
"repo_name": "PosteroCompany/postero.com.br",
"id": "a5f3de204ed64e958f336be0c6e115738e1ef8a6",
... |
from userpass import Userpass, UserpassError
from nose.tools import assert_equal
from nose.tools import assert_not_equal
from nose.tools import assert_raises
from nose.tools import raises
class Test_Userpass(object):
def test_userpass_001(self):
"""Check userpass vs. 2 user adds, default/first user"""
... | {
"content_hash": "3c0a6f0f0cf64995985466bd2f955fc9",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 77,
"avg_line_length": 40.48717948717949,
"alnum_prop": 0.6155794806839772,
"repo_name": "francisluong/py-auth-userpass",
"id": "82d14e389b058bb371a6054695fbe9c1473bb28b",
... |
import rdflib
from rdflib import RDF, RDFS, OWL, Literal
class Entity:
"""
base class for all owllib entities, e.g. classes, individuals, object properties
"""
def __init__(self, uri=None, ontology=None, labels=None, comments=None, definitions=None):
if not uri:
uri = rdflib.BNode
... | {
"content_hash": "1f6dd1d5c9937a60277a9233bc98a177",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 119,
"avg_line_length": 29.011111111111113,
"alnum_prop": 0.607621600919188,
"repo_name": "joshhanna/owllib",
"id": "6834102081af7a510e92dc58f309a00d80584679",
"size": "52... |
from __future__ import absolute_import, division, print_function, unicode_literals
import mock
from mopidy import audio, models
from pandora import APITransport
from pandora.models.pandora import PlaylistItem
import pytest
from mopidy_pandora import playback
from mopidy_pandora.backend import MopidyAPIClient
from... | {
"content_hash": "3a31a6e5eadf14ff5d61da430341a82f",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 101,
"avg_line_length": 34.193548387096776,
"alnum_prop": 0.6757075471698113,
"repo_name": "jcass77/mopidy-pandora",
"id": "fc1886a8a6cf68d03927f6731bca9d8ea0c05502",
"siz... |
from gettext import gettext as _
import scene, game_objects, kbInput, pygame, sys
isLinux = sys.platform.startswith("linux")
if(isLinux):
try:
from gi.repository import Gtk
import sugar3.activity.activity
from sugar3.graphics.toolbarbox import ToolbarBox
from sugar3.graphics.toolbarb... | {
"content_hash": "3890324af066fc2cb1ac95acc97820fa",
"timestamp": "",
"source": "github",
"line_count": 608,
"max_line_length": 184,
"avg_line_length": 55.64473684210526,
"alnum_prop": 0.5296169307164814,
"repo_name": "ColdSauce/golems",
"id": "75058444ae32456cf45e4791ccbc9c2ef3a25f2a",
"size": "33... |
""" Module with some useful utilities for minimization of scalar functiom
- a kind of replacement for scipy.minimize.minimize_scalar when scipy is not accessible
- the actual code is copied from scipy.minimize 0.18.11
The main entry point is a function <code>minimize_scalar</code>.
- a copy from scipy 0.18.11
"""
# =... | {
"content_hash": "d87dac59858649f63a5f34db311c8a2d",
"timestamp": "",
"source": "github",
"line_count": 944,
"max_line_length": 96,
"avg_line_length": 33.940677966101696,
"alnum_prop": 0.4681647940074906,
"repo_name": "OstapHEP/ostap",
"id": "c434ff485b05e5dd4ac8d60f0b9dbc0c08aa184a",
"size": "3260... |
import os
from collections import OrderedDict
from conans.client.conf import ConanClientConfigParser, default_client_conf, default_settings_yml
from conans.client.conf.detect import detect_defaults_settings
from conans.client.output import Color
from conans.client.profile_loader import read_profile
from conans.errors ... | {
"content_hash": "99be5483ce7a58f597ac5aea068eb1af",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 123,
"avg_line_length": 40.57677902621723,
"alnum_prop": 0.6189772937050028,
"repo_name": "tivek/conan",
"id": "0ac003e7c55515ef21b1d9f330bee602223cb2e3",
"size": "10834",... |
"""DMD (hardware device)."""
import struct
from kivy.graphics.instructions import Callback
from kivy.uix.effectwidget import EffectWidget
from kivy.clock import Clock
from kivy.graphics.fbo import Fbo
from kivy.graphics.opengl import glReadPixels, GL_RGB, GL_UNSIGNED_BYTE
from kivy.graphics.texture import Texture
fr... | {
"content_hash": "7cff121a071ee618e24d9686490e3495",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 103,
"avg_line_length": 32.25471698113208,
"alnum_prop": 0.5798479087452472,
"repo_name": "missionpinball/mpf-mc",
"id": "92ed9631fd5b1cd59bdadf4f7ff31e92809dd623",
"size"... |
from datetime import datetime
from ansible.plugins.callback import CallbackBase
class PlayLogger:
"""Store log output in a single object.
We create a new object per Ansible run
"""
def __init__(self):
self.log = ''
self.runtime = 0
def append(self, log_line):
"""append to ... | {
"content_hash": "720dcf7e9ad2e6b0d9bdf6f4c31c6c92",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 191,
"avg_line_length": 39.166666666666664,
"alnum_prop": 0.5573049645390071,
"repo_name": "aivaturi/aws-terraform-ansible",
"id": "cf70bc1dbdd461fb8024396777519dc77ce6b41f"... |
from . import Graph
def get_conflict_for_node(n, graph, colors):
num_conflicts = 0
cur_color = colors[n]
edges = graph.nodes[n].edges
for e in edges:
num_conflicts += (1 if colors[e] == cur_color else 0)
return num_conflicts
def get_all_conflicts(graph, colors):
conflicts = []
for ... | {
"content_hash": "e42f9436009551145b731b940f6e08a8",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 81,
"avg_line_length": 32.736111111111114,
"alnum_prop": 0.5867628341111583,
"repo_name": "chriselion/discreteopt",
"id": "a2531a3adcf0ad868b2053a7d8666e49b83d6d1b",
"size"... |
"""
homeassistant.util.template
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Template utility methods for rendering strings with HA data.
"""
# pylint: disable=too-few-public-methods
import json
import logging
import jinja2
from jinja2.sandbox import ImmutableSandboxedEnvironment
from homeassistant.const import STATE_UNKNOWN
from hom... | {
"content_hash": "817b2593eee64e2977629c1123e1c9c3",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 74,
"avg_line_length": 28.6,
"alnum_prop": 0.6299787169352387,
"repo_name": "nnic/home-assistant",
"id": "d9b1990a252d1708cfcc7bb16206c8116c1088b7",
"size": "3289",
"bin... |
"""Diofant is a Python library for symbolic mathematics."""
import os
DIOFANT_DEBUG = os.getenv('DIOFANT_DEBUG', 'False') != 'False'
del os
import pkg_resources
__version__ = pkg_resources.get_distribution(__name__).version
del pkg_resources
from .core import *
from .logic import *
from .polys import *
from .domains... | {
"content_hash": "222bd41c893808f5e09cea1bf3b1eebb",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 62,
"avg_line_length": 23.838709677419356,
"alnum_prop": 0.7388362652232747,
"repo_name": "skirpichev/omg",
"id": "78c221bac0d85fd94f124b56a2a6148661a57e49",
"size": "739",... |
from django.conf.urls import url
from django.views.generic import RedirectView
from .views import Index, MissionDetail, MissionCreate, MissionUpdate, MissionDelete, VesselCreate, AllVessels
app_name = 'missionlogger'
urlpatterns = [
url(r'^$', RedirectView.as_view(url='missions')),
url(r'^missions$', Index.as_... | {
"content_hash": "7e4ba568a874f7d588802da2fad57b8c",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 110,
"avg_line_length": 55,
"alnum_prop": 0.6686868686868687,
"repo_name": "DeepSpace2/ksp-mission-logger",
"id": "d1066f383f719b2def2dd1642eb43941f5160c8b",
"size": "990",... |
"""SCons.Tool.nasm
Tool-specific initialization for nasm, the famous Netwide Assembler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is he... | {
"content_hash": "49afd939fd148c55b9d923a6457ecd4e",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 115,
"avg_line_length": 36.94444444444444,
"alnum_prop": 0.7274436090225563,
"repo_name": "kayhayen/Nuitka",
"id": "f08930e48e702d350027a5573019908d7374a01f",
"size": "2660... |
import csv
import codecs
import os
import json
# this code will be used to read data from each of the problem based on json file and store it as csv file
def open_text(path):
opened_file = codecs.open(path, 'r')
text = opened_file.read()
return text
def file_info(path):
info_path = open(path)
d... | {
"content_hash": "0bf7cfa211fc9a57f75861fcce01011a",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 106,
"avg_line_length": 32.86363636363637,
"alnum_prop": 0.5643153526970954,
"repo_name": "yunitata/PAN16",
"id": "feba6bef0f38fb506f2ab6f605b436ea3b1faa58",
"size": "1446"... |
'''
OpTestPNOR
----------
This testcase will deal with testing access to the host pnor
from petitboot through the pflash program
'''
import time
import subprocess
import subprocess
import re
import sys
import os
import os.path
import unittest
import OpTestConfiguration
from common.OpTestSystem import OpSystemState
... | {
"content_hash": "d379db49dfae896343d01e26bedafb43",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 152,
"avg_line_length": 39.170103092783506,
"alnum_prop": 0.5649427556257403,
"repo_name": "open-power/op-test-framework",
"id": "6b99b898fa3843fb8ec8e62c4457f7310e098dbd",
... |
COLOR_LIST = [
"white",
"black",
"brown",
"gray",
"chrome",
"stainless steel",
"whites",
"red",
"browns / tans",
"bronze",
"silver",
"blacks",
"beige",
"stainless",
"blue",
"nickel",
"metallics",
"clear",
"grays",
"green",
"multi",
"beige / cream",
"tan",
"greens",
"yellow",
"wood",
"blues",
"reds / pinks",
"brushed ni... | {
"content_hash": "d4591b9c9c5d1483b6e38e68a512cc87",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 32,
"avg_line_length": 13.196428571428571,
"alnum_prop": 0.6502029769959404,
"repo_name": "ChenglongChen/Kaggle_HomeDepot",
"id": "d5522ac8b8cf344e50d9edef09a3c75eaa6a499c",... |
import os
import sys
import string
import xml.etree.ElementTree as etree
from xml.etree.ElementTree import SubElement
from utils import _make_path_relative
from utils import xml_indent
fs_encoding = sys.getfilesystemencoding()
def _get_filetype(fn):
if fn.rfind('.cpp') != -1 or fn.rfind('.cxx') != -1:
re... | {
"content_hash": "7e92d9b69d4819a272f02bacb4285b1f",
"timestamp": "",
"source": "github",
"line_count": 412,
"max_line_length": 133,
"avg_line_length": 32.74514563106796,
"alnum_prop": 0.5791268252909347,
"repo_name": "FlyLu/rt-thread",
"id": "7d4913dcf80359754971b451e0c9aabc1b18cc6a",
"size": "144... |
from pipeline.param.base_param import BaseParam
from pipeline.param import consts
class ScaleParam(BaseParam):
"""
Define the feature scale parameters.
Parameters
----------
method : {"standard_scale", "min_max_scale"}
like scale in sklearn, now it support "min_max_scale" and "standard_sc... | {
"content_hash": "9937d514bef552dbe15c0b93f2ad1b40",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 162,
"avg_line_length": 44.98979591836735,
"alnum_prop": 0.6089816284871853,
"repo_name": "FederatedAI/FATE",
"id": "c4ec58fcd5ef36965dae707df1f206d2acbee51b",
"size": "507... |
"""xgboost init!"""
import json
from pathlib import Path
from typing import cast, TYPE_CHECKING
import warnings
import wandb
from wandb.sdk.lib import telemetry as wb_telemetry
import xgboost as xgb # type: ignore
from xgboost import Booster
MINIMIZE_METRICS = [
"rmse",
"rmsle",
"mae",
"mape",
... | {
"content_hash": "95dd18859a8455d60e8779853960eed7",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 157,
"avg_line_length": 34.37566137566137,
"alnum_prop": 0.6024318916422965,
"repo_name": "wandb/client",
"id": "8baa9c30239c65e00a561ef4c111365f43b091fb",
"size": "6497",... |
"""Routines for character coverage of fonts."""
__author__ = "[email protected] (Roozbeh Pournader)"
import argparse
import codecs
from os import path
import re
from fontTools import ttLib
from nototools import unicode_data
from nototools import lint_config
from nototools.py23 import unichr
def character_set(fon... | {
"content_hash": "71fc6a691365cbc6b99e87a56959d464",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 88,
"avg_line_length": 29.794701986754966,
"alnum_prop": 0.5943543009557679,
"repo_name": "googlefonts/nototools",
"id": "4d6e47dd2da98216addaf432940563dc93a52372",
"size"... |
class KeywordValueParse:
def parseline(self,line):
import pyre.units
uparser = pyre.units.parser()
# print "Hello from KeywordValueParse.parseline!"
self.keyvals[3] = False
comment = line.find('#')
if comment == 0: return self.keyvals
stest = line[:commen... | {
"content_hash": "63f7ae8b0b694ba9516353337bd3da14",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 67,
"avg_line_length": 24.1,
"alnum_prop": 0.5560165975103735,
"repo_name": "geodynamics/lithomop",
"id": "f6cbb6189ed68c57d510243fd4a6bd5f29b018e9",
"size": "2599",
"bin... |
from MafiaBot.MafiaRole import MafiaRole
from MafiaBot.MafiaAction import MafiaAction
class Inventor(MafiaRole):
def __init__(self, settings=dict()):
super(Inventor, self).__init__(settings)
self.items = {'gun': 1, 'vest': 1, 'check': 1, 'syringe': 1}
def GetRolePM(self):
ret = 'You ... | {
"content_hash": "e43d0bbe7ff18f173193f9f99dbf97c0",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 210,
"avg_line_length": 50.04,
"alnum_prop": 0.49480415667466027,
"repo_name": "LLCoolDave/MafiaBot",
"id": "9c890790581b8816faad42585d532edea2a2c052",
"size": "3753",
"b... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('campaign', '0013_merge'),
]
operations = [
migrations.AlterField(
model_name='campaign',
name='... | {
"content_hash": "2304e95e5ca47816248bfc494c71c323",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 81,
"avg_line_length": 25.458333333333332,
"alnum_prop": 0.602291325695581,
"repo_name": "toast38coza/FlashGiving",
"id": "a72bfdde335d4d784318b623090afeb67a767aff",
"size"... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('digest', '0030_item_additionally'),
]
operations = [
migrations.AlterModelOptions(
name='parsingrules',
options={'ordering': ['-weigh... | {
"content_hash": "c45594193f28e35f6d153ff055a87602",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 65,
"avg_line_length": 25.88888888888889,
"alnum_prop": 0.5665236051502146,
"repo_name": "pythondigest/pythondigest",
"id": "8181a92df4178066550075d2140b518fcf5ef97c",
"siz... |
import heapq
import time
import config
import logbot
from gridspace import GridSpace
from axisbox import AABB
log = logbot.getlogger("ASTAR")
class BaseEx(Exception):
def __init__(self, value=None):
self.value = value
def __repr__(self):
if self.value is None:
return self.__cla... | {
"content_hash": "703dcc8b15ea42a4fc37b7ad91840606",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 167,
"avg_line_length": 31.32857142857143,
"alnum_prop": 0.573187414500684,
"repo_name": "lukleh/TwistedBot",
"id": "97d75221b8da3a78e8b09d2e063d952d72152695",
"size": "65... |
from django.http import HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404, Http404, redirect
from django.views.decorators.csrf import csrf_exempt
def home(request):
return render_to_response('home.html', {}, context_instance=RequestContext(r... | {
"content_hash": "877f50e966d260cc207a70b7de24e524",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 88,
"avg_line_length": 41,
"alnum_prop": 0.8079268292682927,
"repo_name": "antofik/Wartech",
"id": "fca78c2181b993bd711411b6d28f8f32234a2763",
"size": "343",
"binary": fal... |
"""
[2017-11-08] Challenge #339 [Intermediate] A car renting problem
https://www.reddit.com/r/dailyprogrammer/comments/7btzrw/20171108_challenge_339_intermediate_a_car_renting/
# Description
A carriage company is renting cars and there is a particular car for which the interest is the highest so the company
decides t... | {
"content_hash": "f88c6784fa1e3ccfd483162d962f4d0f",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 119,
"avg_line_length": 41.36842105263158,
"alnum_prop": 0.7251908396946565,
"repo_name": "DayGitH/Python-Challenges",
"id": "7929ec72c9a5733923dadba411acf0cddb735310",
"si... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('exercise', '0010_exercise_steps'),
]
operations = [
migrations.AlterModelOptions(
name='exerciserecord',
options={'ordering'... | {
"content_hash": "b7c7aaea0ea0d9acfb776d7ed2ffd03e",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 52,
"avg_line_length": 26.7027027027027,
"alnum_prop": 0.5455465587044535,
"repo_name": "DADco/convalesense-web",
"id": "7bc510446fbbc81b7c00fd16e52cfd5f7606366c",
"size": ... |
"""
ANACONDA DISTRIBUTION
IDE : SPYDER
Created on Sun Jun 4 18:44:29 2017
@author: LALIT ARORA
"""
from PyQt5 import QtCore, QtGui, QtWidgets
from pycricbuzz import Cricbuzz
class Ui_PyCricket(object):
def setupUi(self, PyCricket):
c = Cricbuzz()
matches = c.matches()
liv... | {
"content_hash": "586f45349c71080ff460a8af7ea6afcc",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 402,
"avg_line_length": 47.91970802919708,
"alnum_prop": 0.5771515613099771,
"repo_name": "MCodez/PyQt",
"id": "23ca09f0ca43a090b3d13f42c259aacc715efe40",
"size": "6590",
... |
from __future__ import print_function
import pyart
from rdkit.sping.pid import *
from rdkit.sping.PDF import pdfmetrics
import Fontmapping # helps by mapping pid font classes to Pyart font names
# note for now I'm just going to do the standard PDF fonts & forget the rest
class PyartCanvas(Canvas):
"note the d... | {
"content_hash": "95ad97efedaf5c9db40d1540198244ce",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 91,
"avg_line_length": 30.95578231292517,
"alnum_prop": 0.5447752994176465,
"repo_name": "adalke/rdkit",
"id": "61f9ec466bc37d2d1f24cef054df0de147b3058d",
"size": "9324",
... |
import sys
from googletrans import Translator
import clipboard
import keyboard
import time
"""
Requerimentos:
pip install googletrans
pip install clipboard
pip install keyboard
"""
"""Abre um arquivo"""
def abrirArquivo():
try:
caminho = sys.argv[1]
except:
print("Passe o arquivo como arguem... | {
"content_hash": "b4685273b3ceff82411c57dd645ec250",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 105,
"avg_line_length": 25.13953488372093,
"alnum_prop": 0.6401480111008325,
"repo_name": "HoussemCharf/FunUtils",
"id": "9c4b0f7277e34fc18ef8381c9f2d310327f9d51d",
"size":... |
import logging
import os
try:
from alerta.plugins import app # alerta >= 5.0
except ImportError:
from alerta.app import app # alerta < 5.0
from alerta.plugins import PluginBase
LOG = logging.getLogger('alerta.plugins.timeout')
TIMEOUT = os.environ.get('ALERT_TIMEOUT') or app.config.get('ALERT_TIMEOUT', '26... | {
"content_hash": "aa4cbf944707346659a5b89695f8996a",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 84,
"avg_line_length": 23,
"alnum_prop": 0.677938808373591,
"repo_name": "alerta/alerta-contrib",
"id": "3218eacf6e3b6b8bb1905a938ab0834ff393e44d",
"size": "622",
"binary... |
from typing import Tuple, Set, Union, MutableMapping, Any, Mapping, Iterable, Generator, List
from datapipelines import Query, PipelineContext, QueryValidationError
from ..data import Region, Platform, Queue, Tier, Division, Position
from ..dto.champion import ChampionRotationDto
from ..dto.championmastery import Ch... | {
"content_hash": "a26ee1ad19f2c2d7b03dea15c71e9308",
"timestamp": "",
"source": "github",
"line_count": 2121,
"max_line_length": 264,
"avg_line_length": 36.17774634606318,
"alnum_prop": 0.660146221312864,
"repo_name": "sserrot/champion_relationships",
"id": "2f2e49932a980d7b9d6267846adfebb8f1f4abc4",... |
from django.utils.translation import ugettext_lazy as _
from horizon_lib import exceptions
from horizon_lib import tabs
from openstack_horizon import api
from openstack_horizon.dashboards.project.loadbalancers import tables
class PoolsTab(tabs.TableTab):
table_classes = (tables.PoolsTable,)
name = _("Pools... | {
"content_hash": "83e49287110fb4f6b1d68e230fd20336",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 69,
"avg_line_length": 29.094202898550726,
"alnum_prop": 0.6079701120797011,
"repo_name": "mrunge/openstack_horizon",
"id": "192d4cc2ff3962c9455b7b233c0d20e175bd5a77",
"si... |
"""
Created on 24 Dec 2018
@author: Bruno Beloff ([email protected])
example:
{"upload": "2018-12-24T13:09:03Z", "rec": "2018-12-24T13:09:01Z", "offset": 2}
"""
from collections import OrderedDict
from scs_core.data.datetime import LocalizedDatetime
from scs_core.data.json import JSONable
from scs_... | {
"content_hash": "5e2982a9593c18bb7f41ce209797b0ae",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 118,
"avg_line_length": 26.703703703703702,
"alnum_prop": 0.44140083217753123,
"repo_name": "south-coast-science/scs_core",
"id": "84f7cd0aee09b93216afc74cca56ca38e16d3625",... |
"""Script to parse Windows Jump List files:
* .automaticDestinations-ms
* .customDestinations-ms
"""
import argparse
import logging
import sys
import pyolecf
from dtformats import jump_list
from dtformats import output_writers
def Main():
"""The main program function.
Returns:
bool: True if successful or ... | {
"content_hash": "5b72072093924b072a1cda14e19e3c6a",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 72,
"avg_line_length": 24.369565217391305,
"alnum_prop": 0.6855486173059768,
"repo_name": "libyal/dtformats",
"id": "729d188b1bce97330bfd813c317e06e11bfb7df0",
"size": "228... |
import sys
import os
from distutils.sysconfig import get_python_lib
from version import VERSION
# Development Status Trove Classifiers significant for Connector/Python
DEVELOPMENT_STATUSES = {
'a': '3 - Alpha',
'b': '4 - Beta',
None: '5 - Production/Stable'
}
if sys.version_info >= (3, 1):
sys.path =... | {
"content_hash": "a3f54557781495b14936b920b9a32641",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 75,
"avg_line_length": 34.583333333333336,
"alnum_prop": 0.6536144578313253,
"repo_name": "rcosnita/fantastico",
"id": "8017ec8cbfb23d7c195190ed4fc057e884a0858c",
"size": "... |
"""Implements ThreadPoolExecutor."""
__author__ = 'Brian Quinlan ([email protected])'
import atexit
from concurrent.futures import _base
import itertools
import queue
import threading
import weakref
import os
# Workers are created as daemon threads. This is done to allow the interpreter
# to exit when there are sti... | {
"content_hash": "dbb26575c21f5b23c7fa9930db742d7d",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 82,
"avg_line_length": 36.881188118811885,
"alnum_prop": 0.5793288590604027,
"repo_name": "Microsoft/PTVS",
"id": "b65dee11f727279df53d4723eb3be40976534c5c",
"size": "7553... |
from django.contrib.gis.geos import Point, MultiPolygon, Polygon
from django.test import TestCase
from addressbase.models import UprnToCouncil, Address
from addressbase.tests.factories import UprnToCouncilFactory
from councils.tests.factories import CouncilFactory
from data_importers.management.commands.misc_fixes imp... | {
"content_hash": "53521c346ad7a4de36e6aebd51223450",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 83,
"avg_line_length": 35.24444444444445,
"alnum_prop": 0.5744010088272383,
"repo_name": "DemocracyClub/UK-Polling-Stations",
"id": "39dccd573bce9ffaee6bde0542afb32ec9e56f21... |
__author__ = 'gzs2478'
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class Service(QObject):
def __init__(self,sid,parent = None):
QObject.__init__(self,None)
self.service_id = sid
self.commands = {}
self.parent = parent
def setParent(self,dispatcher):
self.paren... | {
"content_hash": "00f053bcde7586dc3c1a506f2274c303",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 59,
"avg_line_length": 30.59259259259259,
"alnum_prop": 0.6343825665859564,
"repo_name": "kelvict/Online-GoBang-Center",
"id": "4ebcacfaee3cdd86cca5260651b7da0baec1ec99",
"... |
'''
_ _ _ _ _
| | | | |_(_) |___
| |_| | _| | (_-<
\___/ \__|_|_/__/
Behavioral Cloning Project
Utilities
'''
import os
import h5py
import numpy as np
from scipy.misc import imresize
from sklearn.utils import shuffle
try:
from sklearn.model_selection import train_test_split
except ImportEr... | {
"content_hash": "91556c8e3e8689ae797d749d57feae31",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 89,
"avg_line_length": 28.357142857142858,
"alnum_prop": 0.5575146935348446,
"repo_name": "andrescv/BehavioralCloning",
"id": "668fe9255ffefa0f627263ba29acff1fb2f4dcb1",
"s... |
from foo import foo
| {
"content_hash": "165ec81ae6e660c99eb1ec4ce8cd01f2",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 19,
"avg_line_length": 20,
"alnum_prop": 0.8,
"repo_name": "bazelbuild/rules_python",
"id": "532f11a8893226a9444d4120e64ec327917209d5",
"size": "59",
"binary": false,
"c... |
from .__about__ import __version__
from .mysql import MySql
__all__ = ['__version__', 'MySql']
| {
"content_hash": "28415761db64b83045068c4c1d5fb23a",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 34,
"avg_line_length": 24,
"alnum_prop": 0.59375,
"repo_name": "DataDog/integrations-core",
"id": "375f5393b9a804133e962df48b3c7cf0ed82a6cd",
"size": "211",
"binary": fals... |
"""Support for EverLights lights."""
import logging
from datetime import timedelta
from typing import Tuple
import voluptuous as vol
from homeassistant.const import CONF_HOSTS
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_HS_COLOR,
ATTR_EFFECT,
SUPPORT_BRIGHTNESS,
SUPPORT_EFFE... | {
"content_hash": "57a0eca539214adf17c019b71c6cd744",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 86,
"avg_line_length": 29.352601156069365,
"alnum_prop": 0.620126033871603,
"repo_name": "Cinntax/home-assistant",
"id": "506617e4c6028d82b84484acd47c83c180592e63",
"size"... |
"""Tests for slim.nasnet."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from nets.nasnet import nasnet
slim = tf.contrib.slim
class NASNetTest(tf.test.TestCase):
def testBuildLogitsCifarModel(self):
batch_size = 5
... | {
"content_hash": "61501cf66e2da9a0db3f943dac97471a",
"timestamp": "",
"source": "github",
"line_count": 380,
"max_line_length": 78,
"avg_line_length": 46.41842105263158,
"alnum_prop": 0.5770735302454788,
"repo_name": "cshallue/models",
"id": "252618120a02e8ef286c38aa1edd9a9de62cb67f",
"size": "1832... |
import os
from setuptools import find_packages, setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='voltaire.website',
v... | {
"content_hash": "da95c0872852bd8939040ce38955a4e9",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 78,
"avg_line_length": 29.862745098039216,
"alnum_prop": 0.5712409717662508,
"repo_name": "voltaire/website",
"id": "2e6b88368f3fae3a717e49394f7113211f7bc956",
"size": "154... |
"""Tests for prog_sequential."""
import random as py_rand
import time
from absl import logging
from jax import random
import jax.numpy as jnp
from absl.testing import absltest as test
from abstract_nas.abstract import depth
from abstract_nas.abstract import linear
from abstract_nas.abstract import shape
from abstrac... | {
"content_hash": "58fe53c81d4bd4394fbdc793c3faaeea",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 83,
"avg_line_length": 38.321739130434786,
"alnum_prop": 0.6898116632629907,
"repo_name": "google-research/google-research",
"id": "f88bf05b15f00b85356ce289436e370818cacbdf"... |
import csv
import os
import glob
from os import listdir
from os.path import isfile, join, split
import json
import sys
import io
#Set filepath variables
filePath_1 = str(sys.argv[1])
filePath_2 = str(sys.argv[2])
videoDict = {}
#Open RS metadata CSV and put the data in the dictionary to be held in memory
with open... | {
"content_hash": "dc09448beeba16c28563f77b725cde3b",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 302,
"avg_line_length": 42.01149425287356,
"alnum_prop": 0.7056087551299589,
"repo_name": "CarnegieHall/metadata-matching",
"id": "092bdca2110ae90b44cf5c77f4e8af36df37951e",
... |
import tensorflow as tf
import pandas
import librosa
import numpy as np
import os
import logging
import subprocess
from collections import Counter
OS_USER = subprocess.check_output(["whoami"], universal_newlines=True).splitlines()[0]
def load_graph(frozen_graph_filename):
""" Load graph/model to be used """
... | {
"content_hash": "83c9b73c545a0a4497aeac4e2b39cc37",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 119,
"avg_line_length": 33.956896551724135,
"alnum_prop": 0.6339172378776339,
"repo_name": "Oneiroe/SmartSlam",
"id": "f002ada2970b7de4b3a5a5b28fddda24f362ac35",
"size": "... |
from django.contrib import admin
from .models import BadgeAward
@admin.register(BadgeAward)
class BadgeAwardAdmin(admin.ModelAdmin):
THUMB_SIZE = 40
list_display = ('user', 'slug', 'name', 'level', 'points', 'awarded_on')
raw_id_fields = ('user', )
list_filter = ('slug', 'level', 'points', )
sea... | {
"content_hash": "34fb8004e5f560341490308b97651413",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 76,
"avg_line_length": 27,
"alnum_prop": 0.6467236467236467,
"repo_name": "fgmacedo/django-awards",
"id": "a300fdb4a120090de268cfc886c93d0bab78cffa",
"size": "351",
"bina... |
"""
Cache directory auto-detection for Windows OS.
"""
import os
from emdu.cache_detector.base_loader import BaseCacheLoader
class WindowsCacheDetector(BaseCacheLoader):
"""
Cache detection for Windows.
"""
def _get_eve_dirs(self):
"""
Platform-specific searching for EVE installation ... | {
"content_hash": "79f9de28208f905d27583a1ef5e37e9e",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 73,
"avg_line_length": 24.87878787878788,
"alnum_prop": 0.6065773447015834,
"repo_name": "gtaylor/EVE-Market-Data-Uploader",
"id": "2f2aa25dd1217f9c44f8c7cf159edc3803de086a",... |
from __future__ import unicode_literals
import six
from .base import BasePipe
from ...conf import settings
from ...backends import storage
from ...backends.exceptions import NodeDoesNotExist
class StoragePipe(BasePipe):
def get_request(self, request):
response = {}
stored_nodes = storage.get_man... | {
"content_hash": "cc32fc520510da3c9a1538cff2b4dbd3",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 103,
"avg_line_length": 35.735632183908045,
"alnum_prop": 0.5956899324541653,
"repo_name": "5monkeys/content-io",
"id": "ca6807afe95153847b64e964ab9eaf1b6e311678",
"size": ... |
from django.contrib import admin
from django.urls import include, path, re_path
from testapp import views
urlpatterns = [
re_path(r"^$", views.index),
re_path(r"^help$", views.help),
re_path(r"^slow$", views.slow, name="slow"),
re_path(r"^objection$", views.objection),
re_path(r"^sql$", views.sql),... | {
"content_hash": "7b2605456e3df30c0ded31013fcacfcb",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 69,
"avg_line_length": 34.666666666666664,
"alnum_prop": 0.6307692307692307,
"repo_name": "korfuri/django-prometheus",
"id": "2aa3d75040856cdd5363c9baf30511cfd32cbbf8",
"si... |
from enum import Enum
__all__ = (
"ActionResult",
"ActionState",
"ActionType",
"StepStatus",
"VersionType",
)
class VersionType(Enum):
FULL = "FULL RELEASE"
DEV = "DEV BUILD"
RC = "RELEASE CANDIDATE"
class StepStatus(Enum):
PASS = "PASS"
FAIL = "FAIL"
SKIP = "SKIP"
cla... | {
"content_hash": "86ea690bb9858f9e898de6669b4ff500",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 28,
"avg_line_length": 14.842105263157896,
"alnum_prop": 0.5851063829787234,
"repo_name": "ericmjl/bokeh",
"id": "ba80cb6900bc5f916c1fa099a0dc8feef5779f9d",
"size": "925",
... |
from typing import Any, Callable, Iterable, List, Optional, Sequence, Tuple, TypeVar, Union
import click
from valohai_cli.help_texts import EXECUTION_COUNTER_HELP
FuncT = TypeVar('FuncT', bound=Callable[..., Any])
def _default_name_formatter(option: Any) -> str:
if isinstance(option, dict) and 'name' in option... | {
"content_hash": "ccda81c38a8b7ba002788010b73604b9",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 119,
"avg_line_length": 37.186440677966104,
"alnum_prop": 0.6362807657247037,
"repo_name": "valohai/valohai-cli",
"id": "ca99920ade1026af18dff2dcabb70cecfb3e8b04",
"size": ... |
import unittest
from test.test_support import verbose, run_unittest
import sys
import gc
import weakref
### Support code
###############################################################################
# Bug 1055820 has several tests of longstanding bugs involving weakrefs and
# cyclic gc.
# An instance o... | {
"content_hash": "77bc90eb07a854d069442e99034652d3",
"timestamp": "",
"source": "github",
"line_count": 608,
"max_line_length": 79,
"avg_line_length": 32.4391447368421,
"alnum_prop": 0.5034224002433707,
"repo_name": "babyliynfg/cross",
"id": "bcf37866e6d7dc8ab857716001875c1095170d02",
"size": "1972... |
"""Tests for the Networks Windows Registry plugin."""
from __future__ import unicode_literals
import unittest
from dfdatetime import filetime as dfdatetime_filetime
from dfwinreg import definitions as dfwinreg_definitions
from dfwinreg import fake as dfwinreg_fake
from plaso.lib import definitions
from plaso.parser... | {
"content_hash": "6697d8fbe9806081d3c4e21da3de08be",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 79,
"avg_line_length": 37.64503816793893,
"alnum_prop": 0.7081009834735882,
"repo_name": "rgayon/plaso",
"id": "998247ab8f26678d1b2ae772b374f62a23fd027c",
"size": "9910",
... |
import json
import traceback
import unicodedata
import bel.nanopub.validate
import falcon
import structlog
log = structlog.getLogger(__name__)
class NanopubValidateResource(object):
"""Validate nanopubs"""
def on_post(self, req, resp):
# Validate nanopub only using cached assertions/annotations
... | {
"content_hash": "59fc2b23c1da4dcb68606f8324c45238",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 126,
"avg_line_length": 35.241379310344826,
"alnum_prop": 0.5963796477495108,
"repo_name": "belbio/bel_api",
"id": "47a6025ef4d16c515f7cb702e501efe24ac53ac4",
"size": "2044... |
from collections import namedtuple
from functools import wraps
import logging
import time
reload(logging)
# Disables this logging level + all levels below.
# Set to None if you want to enable all logging.
# Set to logging.CRITICAL if you want to disable all logging.
DISABLE_LOGGING_LEVEL = logging.DEBUG # logging.CR... | {
"content_hash": "9cbc1bfdd91729bbc1d58a2747e4187b",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 74,
"avg_line_length": 25.95,
"alnum_prop": 0.6348747591522158,
"repo_name": "d-grossman/magichour",
"id": "94bb508aa676dfbb1a3ac0073223f8a1c1ec3c13",
"size": "2076",
"bi... |
"""
A label command (sub-command) for the Organice management command.
"""
from django.utils.translation import ugettext as _
class BootstrapCommandMixin(object):
def bootstrap_command(self):
"""
Initialize Organice = initdb, initauth, initcms, initblog
"""
self.handle_label('init... | {
"content_hash": "64957c0ec93ec1051c22b9662eb4d643",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 66,
"avg_line_length": 26.944444444444443,
"alnum_prop": 0.643298969072165,
"repo_name": "Organice/django-organice",
"id": "c32cc16336283a2e0289fc258c9936de6a7829ef",
"size... |
import pymongo
print "..."
| {
"content_hash": "b1e1922c355053ce26f3979bcd0e2c8e",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 14,
"avg_line_length": 13.5,
"alnum_prop": 0.6666666666666666,
"repo_name": "BartGo/mongodb-drafts",
"id": "9c1e76a8e86a21920b29510cd4bfb1ee9bcfed58",
"size": "27",
"binar... |
"""
Exceptions that may be raised by rabbitpy during use
----------------------------------------------------
"""
class RabbitpyException(Exception):
"""Base exception of all rabbitpy exceptions."""
pass
class AMQPException(RabbitpyException):
"""Base exception of all AMQP exceptions."""
pass
cla... | {
"content_hash": "18ea1d280e09fd9f044ba5c64d2d8922",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 79,
"avg_line_length": 26.295384615384616,
"alnum_prop": 0.6805523051720103,
"repo_name": "jonahbull/rabbitpy",
"id": "49a2474eb639aad00080b79898716aefcaa8ffca",
"size": "... |
from collections import namedtuple
PurchasedItem = namedtuple('PurchasedItem',
'name, quantity, price, currency, sku')
class RedirectNeeded(Exception):
pass
class PaymentError(Exception):
pass
class ExternalPostNeeded(Exception):
pass
| {
"content_hash": "98b39d4879bc70fb27a1c85758f2643d",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 66,
"avg_line_length": 17.5625,
"alnum_prop": 0.6868327402135231,
"repo_name": "artursmet/django-payments",
"id": "2aeae276147602f895e7432c32acfa9386b6747e",
"size": "281",... |
def run():
global os, settings
from regs_common.processing import find_views, update_view, find_attachment_views, update_attachment_view
import os
import settings
run_for_view_type('document views', find_views, update_view)
run_for_view_type('attachment views', find_attachment_views, update_att... | {
"content_hash": "4f7e04e6e3174982d6c12371063292ad",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 109,
"avg_line_length": 32.57142857142857,
"alnum_prop": 0.6578947368421053,
"repo_name": "sunlightlabs/regulations-scraper",
"id": "c43fdb4efcbe5fc65aee75ae8b8c7c40809082e9"... |
import os
import shutil
import unittest
import docker
from docker.utils import kwargs_from_env
import six
from .. import helpers
BUSYBOX = 'busybox:buildroot-2014.02'
TEST_API_VERSION = os.environ.get('DOCKER_TEST_API_VERSION')
class BaseIntegrationTest(unittest.TestCase):
"""
A base class for integration ... | {
"content_hash": "87dca4cf6eb9233e235e5911de78c8c6",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 79,
"avg_line_length": 31.03875968992248,
"alnum_prop": 0.5899100899100899,
"repo_name": "vpetersson/docker-py",
"id": "4f929014bdc69cabf9f804fa61d03935e15a8f08",
"size": ... |
import time, sys
import mote
from moteCache import MoteCache
from mote import Mote
if __name__ == "__main__":
"""
cache = MoteCache()
cache.read()
# print "GetMotes:", cache.getMotes()
allDevs = mote.detectAllPossible()
selectedMoteId = None
for d in allDevs:
if d in cache.getMote... | {
"content_hash": "98d2bdf12687e38e3ad32ecc729e3892",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 95,
"avg_line_length": 21.767441860465116,
"alnum_prop": 0.5844017094017094,
"repo_name": "rpwagner/tiled-display",
"id": "c31bb5ac906a70239c3f095b25c066176e4c5274",
"size"... |
"""Convert a Keras model to frugally-deep format.
"""
import base64
import datetime
import hashlib
import json
import sys
import numpy as np
from tensorflow.keras import backend as K
from tensorflow.keras.layers import Input, Embedding
from tensorflow.keras.models import Model, load_model
__author__ = "Tobias Herman... | {
"content_hash": "3e205fb6d9495770da9719f0004345dc",
"timestamp": "",
"source": "github",
"line_count": 815,
"max_line_length": 129,
"avg_line_length": 34.68466257668712,
"alnum_prop": 0.6338616103014009,
"repo_name": "BerlinUnited/NaoTH",
"id": "b18286f7bf0ce05bc113f9683079de7a91b3b0ed",
"size": "... |
import logging
import time
from collections import namedtuple
from typing import List
from apscheduler.schedulers.blocking import BlockingScheduler
from player import play_jazz_radio
from player import play_rock_radio
from player import play_weather_audio_from_yle
from weather_api import fmi_forecast # FMI forecast ... | {
"content_hash": "5ee245e37a1217a77029413d34bba037",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 87,
"avg_line_length": 25.586206896551722,
"alnum_prop": 0.6545372866127583,
"repo_name": "JuhaniTakkunen/adaptive-alarm",
"id": "91d2292faecf04815296c667d50fff6249390da9",
... |
from django.contrib import admin
from readbacks.apps.reader.models import Grade, Unit, Reading, Paragraph
admin.site.register(Grade)
admin.site.register(Unit)
admin.site.register(Reading)
admin.site.register(Paragraph)
| {
"content_hash": "e6e96e9daf2ab85015afa3f55dbd0b72",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 72,
"avg_line_length": 24.666666666666668,
"alnum_prop": 0.8153153153153153,
"repo_name": "argybarg/readbacks",
"id": "80ef4d01fe07a8c484e71bdf10b701cb48b5016d",
"size": "22... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 5, transform = "Anscombe", sigma = 0.0, exog_count = 100, ar_order = 0); | {
"content_hash": "ae1743752d8922ac78b97bf40b532420",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 166,
"avg_line_length": 38,
"alnum_prop": 0.706766917293233,
"repo_name": "antoinecarme/pyaf",
"id": "460774ea4d5e355abb3f066663d60945cc3c8897",
"size": "266",
"binary": f... |
import codecs
from setuptools import setup, find_packages
from geotagger import __version__
def long_description():
with codecs.open('README.rst', encoding='utf8') as f:
return f.read()
def install_requires():
with codecs.open('requirements.txt', encoding='utf8') as f:
reqs = f.read()
... | {
"content_hash": "6cf9bfa738bd7063f32611380ac0efa1",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 78,
"avg_line_length": 25.473684210526315,
"alnum_prop": 0.6518595041322314,
"repo_name": "jkbrzt/geotagger",
"id": "d86337ef8c239fa3d73a8043f3d761e2d09aac85",
"size": "968... |
from flup.server.fcgi import WSGIServer
from frontend import app
WSGIServer(app, bindAddress=app.config['FCGI_SOCKET']).run()
| {
"content_hash": "c1e3eeaad032211d7420416538f2d8e6",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 60,
"avg_line_length": 31.75,
"alnum_prop": 0.7952755905511811,
"repo_name": "jkossen/imposter",
"id": "68c99ba0399bd761dfdc586e459dc00bc10e05a0",
"size": "149",
"binary":... |
"""
Provide functions for the trigonometric functions.
"""
from __future__ import absolute_import, division, print_function
import math
def aspect_ratio(width, height):
return float(width) / float(height)
def calculate_fov(zoom, height=1.0):
"""Calculates the required FOV to set the
view frustrum to hav... | {
"content_hash": "520c97f8325fb16d2be4e3e9501cca21",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 103,
"avg_line_length": 34.026315789473685,
"alnum_prop": 0.688708430007734,
"repo_name": "PhloxAR/math3",
"id": "646d7e19974845fa9d3e3f130e2874756cb1a457",
"size": "2610",... |
import inspect
import imp
import os
import sys
import types
import time
import importlib
import pico
_mtimes = {}
def module_dict(module):
module_dict = {}
pico_exports = getattr(module, 'pico_exports', None)
members = inspect.getmembers(module)
def function_filter(x):
(name, f) = x
... | {
"content_hash": "24dc6439785c0fae08ea10ced7f4bb64",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 76,
"avg_line_length": 33.28333333333333,
"alnum_prop": 0.5743615423134703,
"repo_name": "AdiPersonalWorks/ATOS_GOM_SystemPrototyping",
"id": "960ed034ed228684d3db5a37cdcab8... |
import os
import stat
import re
__version__ = '0.2.0'
__author__ = 'Yurii Zhytskyi'
class MSOfficeInstaller:
def __init__(self, file_name):
self.f_name = file_name
self.desktop_files = dict()
self.programs = dict()
self.wine_prefixes = dict()
self.programs_path = dict()
... | {
"content_hash": "70e934c60ab64a44624a2b80f070e04d",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 122,
"avg_line_length": 41.67391304347826,
"alnum_prop": 0.5513823682837767,
"repo_name": "sweetcolor/ms_office_installer_for_ubuntu",
"id": "16631803e6778eb15a406b2f68772e1... |
import os
import dataset
import metrics
from losses import load_myloss
from keras.optimizers import Adam
'''
contains utilities related to model training process'''
def train_model(model, model_name, num_epochs, class_weights=None):
training_gen = dataset.training(os.path.join('.', 'baseline'))
optimizer =... | {
"content_hash": "2cb2d9beb70edbfc29de7232484af8b1",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 89,
"avg_line_length": 24.52777777777778,
"alnum_prop": 0.6579841449603624,
"repo_name": "williamdjones/cv_assignment_5",
"id": "2eaa7bdd7cd9d89bdead5ef4942e024859a58c2d",
... |
import unittest
import IECore
import Gaffer
import GafferTest
class NodeTest( GafferTest.TestCase ) :
def testParenting( self ) :
c = Gaffer.GraphComponent()
n = Gaffer.Node()
self.assertEqual( n.acceptsParent( c ), False )
self.assertRaises( RuntimeError, c.addChild, n )
n2 = Gaffer.Node()
self.asse... | {
"content_hash": "24cc2d80a411e3f29f67372c7ca7ce91",
"timestamp": "",
"source": "github",
"line_count": 375,
"max_line_length": 120,
"avg_line_length": 27.218666666666667,
"alnum_prop": 0.6168315861663565,
"repo_name": "appleseedhq/gaffer",
"id": "480cb554efcea1939d6ff1c69447bc12431a9436",
"size": ... |
from __future__ import absolute_import, division, print_function, unicode_literals
import copy
import threading
import warnings
from django.core.exceptions import ImproperlyConfigured
from django.utils.encoding import force_text
from django.utils.six import with_metaclass
from haystack import connection_router, conn... | {
"content_hash": "577bf35d54efe09d9645928317b3a6f0",
"timestamp": "",
"source": "github",
"line_count": 499,
"max_line_length": 139,
"avg_line_length": 35.807615230460925,
"alnum_prop": 0.605216028654578,
"repo_name": "celerityweb/django-haystack",
"id": "3d233619656106bca9f56681b386445401fdd453",
... |
import json
from urllib import parse
import h_pyramid_sentry
from elasticsearch import exceptions
from pyramid import httpexceptions, i18n, view
from pyramid.httpexceptions import HTTPNoContent
from bouncer import util
from bouncer.embed_detector import url_embeds_client
_ = i18n.TranslationStringFactory(__package__... | {
"content_hash": "c014d2b1040b1d989ccfb6e094a97f58",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 88,
"avg_line_length": 33.7,
"alnum_prop": 0.6251589656634167,
"repo_name": "hypothesis/bouncer",
"id": "ca51fe563916b9c665c305f9aa0cdbf8fecd10e2",
"size": "9436",
"bina... |
import cStringIO
import csv
import datetime
import functools
import hashlib
import itertools
import json
import logging
import time
from funcy import project
import xlsxwriter
from flask_login import AnonymousUserMixin, UserMixin
from flask_sqlalchemy import SQLAlchemy
from passlib.apps import custom_app_context as p... | {
"content_hash": "f568103a78c7ef09620db2ad307d1e29",
"timestamp": "",
"source": "github",
"line_count": 1674,
"max_line_length": 138,
"avg_line_length": 35.24970131421745,
"alnum_prop": 0.5933602223427332,
"repo_name": "crowdworks/redash",
"id": "502f2521b79b2fab8c8f0d0d4aa7946ee7f01381",
"size": "... |
import os
from neutron.common import config # noqa
from neutron.db import model_base
import sqlalchemy as sa
from gbpservice.neutron.services.grouppolicy import (
group_policy_driver_api as api)
from gbpservice.neutron.services.grouppolicy import config
from gbpservice.neutron.tests.unit import common as cm
from... | {
"content_hash": "a681e147b39f71bd1aa86e49537d2fd5",
"timestamp": "",
"source": "github",
"line_count": 699,
"max_line_length": 79,
"avg_line_length": 41.31902718168813,
"alnum_prop": 0.619036077833945,
"repo_name": "tbachman/group-based-policy",
"id": "c9e1d217ebc1b3ddc24e0b0d07f83dbd24ae3252",
"s... |
from modeltranslation.translator import translator
from mezzanine.core.translation import (TranslatedSlugged,
TranslatedDisplayable,
TranslatedRichText)
from mezzanine.blog.models import BlogCategory, BlogPost
class TranslatedBlogPost(Tra... | {
"content_hash": "c5c88b3bdb5ec6b421e3d329f0506de0",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 68,
"avg_line_length": 34.5,
"alnum_prop": 0.7228260869565217,
"repo_name": "dekomote/mezzanine-modeltranslation-backport",
"id": "90773e7b27b0a73834be3e1ccfe5d58590e1aa18",
... |
from .resource import Resource
class ServiceDiagnosticSettingsResource(Resource):
"""Description of a service diagnostic setting.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Azure resource Id
:vartype id: str
:param name: Azure resource n... | {
"content_hash": "975bdea1e2719561bffa26b44e5d198e",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 152,
"avg_line_length": 43.984848484848484,
"alnum_prop": 0.65346193592835,
"repo_name": "rjschwei/azure-sdk-for-python",
"id": "74b1788a3ef438cab062875250297499795d0e3a",
... |
"""
Created on Wed Jul 23 10:32:51 2014
"""
import transportdata as transdat
import numpy as np
import logging
logging.basicConfig()
l = logging.getLogger(__name__)
l.setLevel(logging.DEBUG)
class DataObject():
"""
Creates a data object containing x and y data. Data can be processed by
adding operations... | {
"content_hash": "fb2bce0499012d78d3c8295c4c365f11",
"timestamp": "",
"source": "github",
"line_count": 323,
"max_line_length": 175,
"avg_line_length": 36.39009287925697,
"alnum_prop": 0.5371788327377914,
"repo_name": "transportWMI/previewTransportData",
"id": "ed1b35cb527600c274e27a1c25650b71f546689... |
from absl.testing import absltest
from absl.testing import parameterized
from clif.testing.python import return_value_policy
class ReturnValuePolicyTestCase(parameterized.TestCase):
@parameterized.parameters(
('return_value', '^return_value_MvCtor(_MvCtor)*$'),
('return_reference', r'^return_reference... | {
"content_hash": "9442b6f2c2716d94bf1122cad55a24a5",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 80,
"avg_line_length": 46.666666666666664,
"alnum_prop": 0.6738095238095239,
"repo_name": "google/clif",
"id": "21d25851a9ad33cb80bd39915595c0c9d4943e16",
"size": "3516",
... |
from ....testing import assert_equal
from ..preprocess import BlurToFWHM
def test_BlurToFWHM_inputs():
input_map = dict(args=dict(argstr='%s',
),
automask=dict(argstr='-automask',
),
blurmaster=dict(argstr='-blurmaster %s',
),
environ=dict(nohash=True,
usedefault=True,
),
fwhm=... | {
"content_hash": "bbf87ce77b413882814b9cd3690500c1",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 78,
"avg_line_length": 25.979591836734695,
"alnum_prop": 0.6135113904163394,
"repo_name": "carolFrohlich/nipype",
"id": "b0c965dc070d21f9e0538e61c4e8171ee9991112",
"size": ... |
import threading
import unittest
from trac.util.concurrency import ThreadLocal
class ThreadLocalTestCase(unittest.TestCase):
def test_thread_local(self):
local = ThreadLocal(a=1, b=2)
local.b = 3
local.c = 4
local_dict = [local.__dict__.copy()]
def f():
local.... | {
"content_hash": "3fab353b53371b6df36676e1a1f03836",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 60,
"avg_line_length": 26.29032258064516,
"alnum_prop": 0.5975460122699386,
"repo_name": "rbaumg/trac",
"id": "9928463dcfb42a2b015008b786b5780bab5301f3",
"size": "1312",
... |
from __future__ import (
absolute_import, division, print_function, unicode_literals)
import os
import pandas as pd
from Bio import SeqIO
from io import open
from logging import getLogger
from pdb.lib.create_delimiter import create_delimiter
from pdb.lib.data_paths import ProjectFolders, build_abs_path
from pdb.... | {
"content_hash": "db37173328771eec3687cdf0f0c34403",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 78,
"avg_line_length": 31.910569105691057,
"alnum_prop": 0.6048407643312101,
"repo_name": "shellydeforte/PDB",
"id": "c9df35d1f1f59488eee57b578f1e192dd09c9878",
"size": "3... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.