text stringlengths 4 1.02M | meta dict |
|---|---|
"""
TAGGING APP
This module provides a series of managers to manage
the tagging app.
"""
from django.contrib.contenttypes.models import ContentType
from django.db import models
from tunobase.core import managers as core_managers
class ContentObjectTagManager(models.Manager):
"""Retrieve various information abou... | {
"content_hash": "529bbb130bb01f88c0f737ade162b464",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 75,
"avg_line_length": 30.306451612903224,
"alnum_prop": 0.5694518360830229,
"repo_name": "unomena/tunobase",
"id": "82dd0e54c7196c8c96bc87002f023817de165526",
"size": "187... |
import validators
import unittest
import yaml
import sys
import os
# MAKING SURE THAT SETTINGS.YAML IS GOING TO BE FOUND!
TEEKA_SETTINGS = os.getenv('TEEKA_SETTINGS', "../settings.yaml")
# ADDING PARENT AND CURRENT DIRECTORIES INTO SYSTEM PATH
CURREN_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os... | {
"content_hash": "2b71942719580a539d8fe623173d308a",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 90,
"avg_line_length": 38.36,
"alnum_prop": 0.708029197080292,
"repo_name": "Cirice/Teeka",
"id": "9231b063fb467e864d45e54658e80215ff07eaa5",
"size": "1918",
"binary": fa... |
def extractShikaritoWordpressCom(item):
'''
Parser for 'shikarito.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Kusuriya no Hitorigoto', 'Kusuriya no Hitorigoto', ... | {
"content_hash": "966bdc2b1dd4bf6d63b45a95cabe857a",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 104,
"avg_line_length": 28.473684210526315,
"alnum_prop": 0.6765249537892791,
"repo_name": "fake-name/ReadableWebProxy",
"id": "1fd87112b80f3748a93be5254237b219f23dea19",
"... |
from collections import namedtuple
import logging
import os
import numpy as np
import deep_dream as dd
logger = logging.getLogger(__name__)
TileRequest = namedtuple('TileRequest', 'resp data layers cleanup')
TileResponse = namedtuple('TileResponse', 'resp grad')
class TileWorker:
def __init__(self, req_q, res... | {
"content_hash": "e1ab87f0f521a5309a6234383bec7f1b",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 97,
"avg_line_length": 32.51315789473684,
"alnum_prop": 0.5702144880615135,
"repo_name": "crowsonkb/deep_dream",
"id": "c891f6b6e1243c1fb43c595261d4cb4e27d7f778",
"size": "... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases() # NOQA
import chainer
from chainerrl.agents import dqn
class DoubleDQN(dqn.DQN):
"""Double ... | {
"content_hash": "9e6b3c380d98f607f4b674ab0d8da024",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 77,
"avg_line_length": 30.142857142857142,
"alnum_prop": 0.5815842924847664,
"repo_name": "toslunar/chainerrl",
"id": "f9e027d130827a97c912c111da5e0161ae2b56d5",
"size": "1... |
'''Module containing the Flock class, meant for containing a group of Bird and
Predator objects
'''
import random
import matplotlib.pyplot as plt
from predator import Predator
from bird import Bird
class Flock(object):
''' Class for groups of birds and a possible predator
'''
def __init__(self, number, se... | {
"content_hash": "72b7d8b6162f8bb3cb5c4594457f4290",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 80,
"avg_line_length": 31.892857142857142,
"alnum_prop": 0.5627099664053752,
"repo_name": "pederka/pythonBoids2D",
"id": "80a61e0f3af758d91e5076d44f2ec4013df7d6c6",
"size":... |
from spockbot.plugins.base import PluginBase, pl_announce
from spockbot.plugins.tools.task import Task
@pl_announce('TaskManager')
class TaskManager(PluginBase):
requires = 'Event'
def __init__(self, ploader, settings):
super(TaskManager, self).__init__(ploader, settings)
ploader.provides('Ta... | {
"content_hash": "6ab664fba4f2202e43c4af9845daaa5e",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 60,
"avg_line_length": 29.529411764705884,
"alnum_prop": 0.6613545816733067,
"repo_name": "gamingrobot/SpockBot",
"id": "1c03215df65fcbed4c671c78b2a307ba26d913c6",
"size": ... |
from cloudify import ctx
from cloudify import exceptions as cfy_exc
from cloudify.decorators import operation
from vcloud_plugin_common import (with_vca_client, get_vcloud_config,
get_mandatory, is_subscription, is_ondemand)
from network_plugin import (check_ip, save_gateway_configurat... | {
"content_hash": "9b28be81e95ca14fa1f3310a509be0e2",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 116,
"avg_line_length": 41.99666666666667,
"alnum_prop": 0.6110008730851655,
"repo_name": "nmishkin/tosca-vcloud-plugin",
"id": "7bda83f5d80936378b48243851143048c201b4e0",
... |
def tokenize(reg,debug=False):
'''Tokenizes reg'''
tokens=[""]
incharclass=False
for i in reg: #tokenize input
if debug:print("tokens",tokens[1:],incharclass)
if incharclass: #character class
if i=="]" and tokens[-1][-1]!="\\":
incharclass=False
el... | {
"content_hash": "a7ff5426f8125242c5af1ff2bee23eae",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 142,
"avg_line_length": 37.96103896103896,
"alnum_prop": 0.5008552856654123,
"repo_name": "CatsAreFluffy/regexcif.py",
"id": "127f8b5c24ae0c47710c02c674fcbd7b444d7f79",
"si... |
from scipy.optimize import curve_fit
import re
from sys import stdin
from optparse import OptionParser
# These imports are primarily for use in user-supplied functions.
from numpy import loadtxt,log,log10,log2,sqrt
from math import e,pi
op = OptionParser(usage='%prog [options] <function_of_x> [input_file]')
op.add_o... | {
"content_hash": "1976be714ac4395c8ec42f94fe45d135",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 71,
"avg_line_length": 32.557377049180324,
"alnum_prop": 0.6500503524672709,
"repo_name": "perimosocordiae/data_explorer",
"id": "59a1b7c3a5ca43c83caf44d47daeecd96ec813f6",
... |
"""Summon events and related functions."""
from .event import Event
__author__ = 'fyabc'
class Summon(Event):
def __init__(self, game, minion, loc, player_id=None):
super().__init__(game, minion)
self.loc = loc
self.player_id = player_id
@property
def minion(self):
retur... | {
"content_hash": "942bbee9c93ef8d1b9ed4034821cf222",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 79,
"avg_line_length": 18.59259259259259,
"alnum_prop": 0.5717131474103586,
"repo_name": "fyabc/MiniGames",
"id": "283865c368334da8d46bbb94f18b02028743faf5",
"size": "546",... |
"""Support for Decora dimmers."""
import copy
from functools import wraps
import logging
import time
from bluepy.btle import BTLEException # pylint: disable=import-error
import decora # pylint: disable=import-error
import voluptuous as vol
from homeassistant import util
from homeassistant.components.light import (
... | {
"content_hash": "4da93b335c7fd2e60a4d211732693328",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 80,
"avg_line_length": 27.420382165605094,
"alnum_prop": 0.6090592334494773,
"repo_name": "jawilson/home-assistant",
"id": "2564ff0cd9e2a6f417d08c9aab5e34340ab13b82",
"siz... |
"""Alpha combination models."""
import copy
import numpy as np
from mingle.utilities.simulation_utilities import combine_spectra
def alpha_model(alpha, rv, host, companion, limits, new_x=None):
"""Entangled spectrum model.
inputs:
spectrum_1
spectrum_2
alpha
rv - rv offset of spec2
xran... | {
"content_hash": "b003600b71f73640d70d701029884ecf",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 85,
"avg_line_length": 26.776785714285715,
"alnum_prop": 0.6692230743581193,
"repo_name": "jason-neal/companion_simulations",
"id": "b43aacb041369ecd6a7bdcd245c5caeca8d904f2... |
from .base import DependencyTypeName, ExternalDependency, DependencyException
from ..mesonlib import MesonException, Version, stringlistify
from .. import mlog
from pathlib import Path
import typing as T
if T.TYPE_CHECKING:
from ..environment import Environment
class ExtraFrameworkDependency(ExternalDependency):
... | {
"content_hash": "17ff2ac9eb368b9397cd93d705a3e5c7",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 133,
"avg_line_length": 46.528301886792455,
"alnum_prop": 0.6046228710462287,
"repo_name": "pexip/meson",
"id": "f2888514874ed8a1bfe7c963ac0d6db90a3941c6",
"size": "5525",... |
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
import subprocess
import os
import shutil
import sys
from io import open
import argparse
import time
import yaml
_script_abs_path = os.path.abspath(__file__)
def set_root_user_for_docker_jobs(path):... | {
"content_hash": "681ed790ddad1b7bf8204d8a24f935bf",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 114,
"avg_line_length": 33.25179856115108,
"alnum_prop": 0.6386845521419299,
"repo_name": "imron/scalyr-agent-2",
"id": "7f2b3e0c39d07939c1f7dfc739ea1259566f0dd9",
"size":... |
def extract未完待续(item):
"""
Parser for '未完待续'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'WATTT' in item['tags']:
return buildReleaseMessageWithType(item, 'WATTT', vol, chp, frag=frag, postfix=postfix)
... | {
"content_hash": "dc56c5cc413644ec040c7154bbca4b76",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 89,
"avg_line_length": 33.4,
"alnum_prop": 0.7035928143712575,
"repo_name": "fake-name/ReadableWebProxy",
"id": "dbff2d8e2b9e84057734721a6ec8ea8e58c801bc",
"size": "350",
... |
"""d4rl_mujoco_hopper dataset."""
from tensorflow_datasets.d4rl.d4rl_mujoco_hopper.d4rl_mujoco_hopper import D4rlMujocoHopper
| {
"content_hash": "7a594e7aa807cee9e9f59b4455544f7e",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 91,
"avg_line_length": 42.333333333333336,
"alnum_prop": 0.8110236220472441,
"repo_name": "tensorflow/datasets",
"id": "03c9320b7736ce7255777032763ba3f93227e12e",
"size": "7... |
from functools import partial
import numpy as np
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import random_split
import torchvision
import torchvision.transforms as transforms
import ray
from ray import tune
from ray.tune import CLIRepor... | {
"content_hash": "d9fd17ab8f7ad0ca3593eeda4ef0a21c",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 79,
"avg_line_length": 32.297872340425535,
"alnum_prop": 0.5856389986824769,
"repo_name": "robertnishihara/ray",
"id": "2e1b1cbe2556b4b986e907f3540163d53755fd3a",
"size": ... |
import os.path
from django.shortcuts import render_to_response, render
from django.template import Context, RequestContext
from django.utils._os import upath
dirs = (os.path.join(os.path.dirname(upath(__file__)), 'other_templates'),)
def render_to_response_view(request):
return render_to_response('shortcuts/re... | {
"content_hash": "f6d7ca09ac664995e3323dfc84886f8b",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 82,
"avg_line_length": 28.582417582417584,
"alnum_prop": 0.6578239138792772,
"repo_name": "szopu/django",
"id": "66196f11cfc80561c90b94a23a2ceff64b3052d0",
"size": "2601",
... |
"""
Implements a property manager based on MongoDB.
Usage: add this lines to wsgidav.conf::
from wsgidav.prop_man.mongo_property_manager import MongoPropertyManager
prop_man_opts = {}
property_manager = MongoPropertyManager(prop_man_opts)
Valid options are (sample shows defaults)::
opts = {"host": "... | {
"content_hash": "44ee3ef45180e2f2bc3a8b1a4c3f93a6",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 88,
"avg_line_length": 35.333333333333336,
"alnum_prop": 0.5493808962264151,
"repo_name": "mar10/wsgidav",
"id": "86cc7434aabfc906c18b10d838787a4c0d0c388d",
"size": "6985"... |
from asposecells import Settings
from com.aspose.cells import Workbook
from com.aspose.cells import PageOrientationType
from java.io import FileInputStream
class SettingPageOptions:
def __init__(self):
self.page_orientation()
self.scaling()
def page_orientat... | {
"content_hash": "df98d42f37ac74411d53de9727cd7bd0",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 80,
"avg_line_length": 33.016949152542374,
"alnum_prop": 0.6416837782340863,
"repo_name": "fahadadeel/Aspose.Cells-for-Java",
"id": "9e9aebbc7cb87fe4fbe4e5e959050f6eaeb4ca49"... |
"""deCONZ light platform tests."""
from copy import deepcopy
from homeassistant.components.deconz.const import (
CONF_ALLOW_DECONZ_GROUPS,
DOMAIN as DECONZ_DOMAIN,
)
from homeassistant.components.deconz.gateway import get_gateway_from_config_entry
from homeassistant.components.light import (
ATTR_BRIGHTNE... | {
"content_hash": "1657340b16f2bd8c279efc28b3cc0fe9",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 87,
"avg_line_length": 31.548192771084338,
"alnum_prop": 0.5779071987779263,
"repo_name": "soldag/home-assistant",
"id": "460f81e830cd40fc201bc5bd251a086b3dbbb31a",
"size"... |
import sys
import requests
import logging
import ssl
import json
import time
import pkg_resources
from requests.adapters import HTTPAdapter
from datetime import datetime
try:
from requests.packages.urllib3.poolmanager import PoolManager
except ImportError:
from urllib3.poolmanager import PoolManager
from qds_sd... | {
"content_hash": "20ed3e772ce78975f9ae0240c37bdb7c",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 143,
"avg_line_length": 38.06167400881057,
"alnum_prop": 0.5677083333333334,
"repo_name": "qubole/qds-sdk-py",
"id": "324c27f52187872069d840da5f7930c945378329",
"size": "8... |
"""
ncc.py: Network Conflict Creator (ncc)
Author: Vladimir Ivanov
License: MIT
Copyright 2020, Raw-packet Project
"""
# endregion
# region Import
from raw_packet.Utils.base import Base
from raw_packet.Utils.utils import Utils
from raw_packet.Utils.network import RawARP, RawSniff, RawSend
from raw_packet.Utils.tm impo... | {
"content_hash": "8206ea889589b23076875d919fa0bdcf",
"timestamp": "",
"source": "github",
"line_count": 320,
"max_line_length": 114,
"avg_line_length": 46.821875,
"alnum_prop": 0.48374824801441635,
"repo_name": "Vladimir-Ivanov-Git/raw-packet",
"id": "14765c3aa261e0dc39af41892e29a6749c6741f1",
"siz... |
import re
import urllib2
from datetime import datetime
from utils import FedoraException
from utils import DEFAULTS
from xml.dom import minidom
from fcrepo.http.restapi import FCRepoRestAPI
def denormalise_query_args(argdict):
"""
Map Python types to REST query strings.
"""
args = {}
for arg,... | {
"content_hash": "c5fa1c9c4e8d8d4ccbb474d6972aff25",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 101,
"avg_line_length": 31.893939393939394,
"alnum_prop": 0.566270783847981,
"repo_name": "vitorio/ocropodium",
"id": "18f969d7c03e267fcc1c87750d6a275db6710b5a",
"size": "... |
import os
import argparse
def touch(trigger):
# If no trigger file is provided then do a return.
if(trigger is None):
return
if os.path.exists(trigger):
os.utime(trigger, None)
else:
with open(trigger, 'w') as fp:
fp.write("")
def main():
parser = argparse.Arg... | {
"content_hash": "a27959439b9f80474b12d70633fe95ab",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 99,
"avg_line_length": 36.85526315789474,
"alnum_prop": 0.5805069617993573,
"repo_name": "kraj/zephyr",
"id": "7c71c681308cd256823c7a8fc68e5cfd64b62a3c",
"size": "2825",
... |
import contextlib
import glob
import os
import pathlib
import platform
import re
import shutil
import subprocess
import sys
import tarfile
import urllib.request
import zipfile
import click
import cryptography.fernet
import parver
@contextlib.contextmanager
def chdir(path: str): # pragma: no cover
old_dir = os.g... | {
"content_hash": "ff70c613e4142e487629cf0ca7b5e315",
"timestamp": "",
"source": "github",
"line_count": 518,
"max_line_length": 115,
"avg_line_length": 33.78378378378378,
"alnum_prop": 0.5530285714285714,
"repo_name": "cortesi/mitmproxy",
"id": "76eb377e6c0769d074d98ccdf41da8ece5da0832",
"size": "1... |
"""Configure build environment for certain Intel platforms."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import subprocess
BASIC_BUILD_OPTS = ["--cxxopt=-D_GLIBCXX_USE_CXX11_ABI=0", "--copt=-O3"]
SECURE_BUILD_OPTS = [
"... | {
"content_hash": "eeed8daadeb26d339af6225f053be204",
"timestamp": "",
"source": "github",
"line_count": 329,
"max_line_length": 94,
"avg_line_length": 35.09726443768997,
"alnum_prop": 0.6166103749891747,
"repo_name": "aldian/tensorflow",
"id": "ba5176a4b7aa88bf72dcc591cff7b14a0bee3646",
"size": "12... |
import asyncio
from django.core.management.base import BaseCommand
from vessels.crawler.ftp_client import crawl_csv, save_csv
class Command(BaseCommand):
help = 'Closes the specified poll for voting'
def add_arguments(self, parser):
parser.add_argument('--host', default='localhost', type=str)
... | {
"content_hash": "6a0530849dd7debbf5fef0be39c73c29",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 74,
"avg_line_length": 33.5625,
"alnum_prop": 0.6061452513966481,
"repo_name": "ksamuel/smit",
"id": "69025116677cdcb19d3282285d2e520a79e5b7b5",
"size": "1075",
"binary":... |
from __future__ import print_function
import os
import numpy as np
import tempfile
import zmq
from common.services import service_list
import selfdrive.messaging as messaging
from selfdrive.config import ImageParams, VehicleParams
from selfdrive.calibrationd.calibration import ViewCalibrator, CalibStatus
CALIBRATION... | {
"content_hash": "76468713e6c600713dfcc92cf164f3c1",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 86,
"avg_line_length": 31.275,
"alnum_prop": 0.6594724220623501,
"repo_name": "BrevanJ04/Comma-Test-0.2.9",
"id": "9ae83da3f33a358eb3e1811cc6864aa1494b5bdd",
"size": "3775... |
import mock
from six.moves import range
from nova.cells import state
from nova.db.sqlalchemy import models
from nova import exception
from nova.tests.functional.api_sample_tests import api_sample_base
class CellsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
sample_dir = "os-cells"
def setUp(self):
... | {
"content_hash": "bd1d1425dd4bfab26d777a0980a5e6a5",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 76,
"avg_line_length": 38.625,
"alnum_prop": 0.5378052368343631,
"repo_name": "gooddata/openstack-nova",
"id": "4824b5b5e20944625ecf74078308041a5d9842ad",
"size": "4031",
... |
import django
SITE_ID = 1
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.sites',
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.messages',
'dja... | {
"content_hash": "963808f2bc7dd12fa98eb9f8c7de5209",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 70,
"avg_line_length": 22.48780487804878,
"alnum_prop": 0.6084598698481561,
"repo_name": "django-compressor/django-appconf",
"id": "6d420a2fc7fd31f958d3855fb829887a57a68112",... |
c = get_config()
c.NotebookApp.port = 8998
c.NotebookApp.open_browser = False
c.NotebookApp.ip = "*"
c.NotebookApp.allow_origin = "*"
| {
"content_hash": "91cb433154ec170119aa78eb6144a4f8",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 34,
"avg_line_length": 26.8,
"alnum_prop": 0.7089552238805971,
"repo_name": "EricForgy/JuliaBox",
"id": "33570aaccb2e2a81091cd4492a43cbdf285c41e0",
"size": "134",
"binary"... |
"""This module contains Google Vertex AI operators."""
from typing import TYPE_CHECKING, Dict, List, Optional, Sequence, Tuple, Union
from google.api_core.exceptions import NotFound
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
from google.api_core.retry import Retry
from google.cloud.aiplatform... | {
"content_hash": "a44424b19463b2b1ab42e4b25c37dba6",
"timestamp": "",
"source": "github",
"line_count": 565,
"max_line_length": 110,
"avg_line_length": 43.72566371681416,
"alnum_prop": 0.6523780611212305,
"repo_name": "Acehaidrey/incubator-airflow",
"id": "95ec5efd9238b4ea06221df329d9f91532e08a32",
... |
from hashlib import md5
import logging
import os
import platform
import re
import signal
import socket
import sys
import time
import types
import urllib2
import uuid
# 3p
import simplejson as json
import yaml # noqa, let's guess, probably imported somewhere
from tornado import ioloop
try:
from yaml import CLoader... | {
"content_hash": "9843af99eccf5ea342a87822b13e47d2",
"timestamp": "",
"source": "github",
"line_count": 586,
"max_line_length": 174,
"avg_line_length": 33.715017064846414,
"alnum_prop": 0.59644682897201,
"repo_name": "c960657/dd-agent",
"id": "5d2aac00b0cdd5822d173dec6d29275b1290e99d",
"size": "198... |
"""TCP-specific events."""
import mitmproxy.tcp
class Events:
def tcp_start(self, flow: mitmproxy.tcp.TCPFlow):
"""
A TCP connection has started.
"""
def tcp_message(self, flow: mitmproxy.tcp.TCPFlow):
"""
A TCP connection has received a message. The most recen... | {
"content_hash": "c9ae3cb2b2597f0dad11d537d4eb0216",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 76,
"avg_line_length": 25.88,
"alnum_prop": 0.5595054095826894,
"repo_name": "vhaupert/mitmproxy",
"id": "f5a577b85db4b27e81009d5f794d269b1aca3d0b",
"size": "647",
"binar... |
"""
A Kervi controller is a class that acts upon input from users or events or the underlaying os.
"""
#import inspect
#from kervi.spine import Spine
#from kervi.utility.thread import KerviThread
from kervi.core.utility.component import KerviComponent
#from kervi.hal import GPIO
from kervi.values.value_list import Valu... | {
"content_hash": "9e8ca5198ecf0e45e554de92354439ef",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 146,
"avg_line_length": 39.72761194029851,
"alnum_prop": 0.5388372311449234,
"repo_name": "kervi/kervi",
"id": "edcf3db412c0c17ac8d520dac161a58caeb32fc4",
"size": "10745",... |
"""
C{django.db.models} adapter module.
@see: U{Django Project<http://www.djangoproject.com>}
@since: 0.4.1
"""
from django.db.models.base import Model
from django.db.models import fields
from django.db.models.fields import related, files
import datetime
import pyamf
class DjangoReferenceCollection(dict):
"""... | {
"content_hash": "9864218a3fa15c038f8fe05013eefe69",
"timestamp": "",
"source": "github",
"line_count": 303,
"max_line_length": 78,
"avg_line_length": 28.082508250825082,
"alnum_prop": 0.5601128217181808,
"repo_name": "gauribhoite/personfinder",
"id": "d62d6d8419306fa65c654982ab2a7b99c931afa3",
"si... |
from __future__ import absolute_import
import mock
from django.conf import settings
from sentry.models import Project, ProjectOption
from sentry.testutils import TestCase, fixture
from sentry.utils.http import (is_same_domain, is_valid_origin, get_origins,
absolute_uri)
class AbsoluteUriTest(TestCase):
def... | {
"content_hash": "6acf66a90788012551ed977496892ec3",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 105,
"avg_line_length": 38.103896103896105,
"alnum_prop": 0.6542263122017723,
"repo_name": "beni55/sentry",
"id": "270bdbec09b89e1200ba0ac1491b59f6c1621d8b",
"size": "5893... |
import requests
import time
from nose.tools import eq_ as eq
def assert_raises(excClass, callableObj, *args, **kwargs):
"""
Like unittest.TestCase.assertRaises, but returns the exception.
"""
try:
callableObj(*args, **kwargs)
except excClass as e:
return e
else:
if hasa... | {
"content_hash": "02dfb0835e551f739dbe536b2a9e8c1f",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 141,
"avg_line_length": 29.757575757575758,
"alnum_prop": 0.6018329938900203,
"repo_name": "Nexenta/s3-tests",
"id": "8852cfaf1be733588b991c05a535a85154dde172",
"size": "98... |
from __future__ import print_function
import sys
import struct
import logging
from Registry import RegistryParse
g_logger = logging.getLogger(__file__)
class Copy(RegistryParse.REGFBlock):
"""
Parsing of file as a Windows Registry file.
"""
def __init__(self, filelikeobject, writer):
"""
... | {
"content_hash": "d588d973f4b0e5dd2cdc0a2a4d0ebc02",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 100,
"avg_line_length": 37.24561403508772,
"alnum_prop": 0.5796043334903439,
"repo_name": "williballenthin/python-registry",
"id": "69cc9eafe22b33a955f03ea05f6871a485cb87ae"... |
"""
Import a Bugzilla items into a Trac database.
Requires: Trac 0.9b1 from http://trac.edgewall.org/
Python 2.3 from http://www.python.org/
MySQL >= 3.23 from http://www.mysql.org/
or PostGreSQL 8.4 from http://www.postgresql.org/
or SQLite 3 from http://www.sqlite.org/
$... | {
"content_hash": "7824824759339ac99e48f0a855596916",
"timestamp": "",
"source": "github",
"line_count": 962,
"max_line_length": 84,
"avg_line_length": 37.262993762993766,
"alnum_prop": 0.5544397020671186,
"repo_name": "exocad/exotrac",
"id": "bda4bc369e11f28b06cc80afab74b175ae9ab089",
"size": "3670... |
"""
unit/integration tests for the django-charitychecker package.
"""
import re
import datetime
from StringIO import StringIO
from itertools import izip
import os
from contextlib import contextmanager
from django.test import TestCase
from .models import IRSNonprofitData
from .utilities import (ignore_bl... | {
"content_hash": "080b5093492371b1f5affbf6b599e214",
"timestamp": "",
"source": "github",
"line_count": 360,
"max_line_length": 86,
"avg_line_length": 38.977777777777774,
"alnum_prop": 0.6195838084378563,
"repo_name": "nalourie/django-charitychecker",
"id": "6a955443f026290f9a67691b7af1185d41e10fe6",... |
"""Tests for the Google Analytics cookies."""
import unittest
from plaso.formatters import ganalytics as _ # pylint: disable=unused-import
from plaso.lib import eventdata
from plaso.lib import timelib
from plaso.parsers.cookie_plugins import ganalytics
from plaso.parsers.sqlite_plugins import chrome_cookies
from pla... | {
"content_hash": "55374fea0767763b2b26311ea5efa9a4",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 80,
"avg_line_length": 40.79032258064516,
"alnum_prop": 0.7056148675365758,
"repo_name": "jorik041/plaso",
"id": "795c1ccee0b54d86fc9aa1961330782631b026f8",
"size": "5100"... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
from django.conf import settings
from django.db.models.signals import post_save
from django.dispatch import receiver
from rest_framework.authtoken.models import Token
class Fav(models.Model):
user = models.Foreig... | {
"content_hash": "bdf2805f62bfeab264a58d873d5ffa6b",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 72,
"avg_line_length": 25.721153846153847,
"alnum_prop": 0.6381308411214953,
"repo_name": "marchantes/foodtruck-finder-api",
"id": "62722895d44bf66206a8e28c7b052c634d302337"... |
import os.path
from setuptools import setup, find_packages
if os.path.exists('README.rst'):
with open('README.rst') as f:
long_description = f.read()
else:
long_description = None
setup(
name = 'Lenatu',
version = '0.1.0',
description='Abstract Syntax Tree Analyzer.',
long_descript... | {
"content_hash": "58d053c395cd62c9a9b96dda4b64ab56",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 49,
"avg_line_length": 26,
"alnum_prop": 0.6538461538461539,
"repo_name": "smurn/augast",
"id": "fc482dbca8e3104230314bfdb9a742303e8f7fe9",
"size": "560",
"binary": false... |
from ....testing import assert_equal
from ..utils import DicomImport
def test_DicomImport_inputs():
input_map = dict(format=dict(field='convopts.format',
usedefault=True,
),
icedims=dict(field='convopts.icedims',
usedefault=True,
),
ignore_exception=dict(nohash=True,
usedefault=True,
... | {
"content_hash": "2139d760426a8e6552a63cc460d8a078",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 78,
"avg_line_length": 25.80851063829787,
"alnum_prop": 0.6306677658697445,
"repo_name": "sgiavasis/nipype",
"id": "9bc1c2762eba1f1be5a6d7c2bbb71c05ba607e84",
"size": "1267... |
import unittest
import gc
import os
import imath
import IECore
import IECoreScene
import Gaffer
import GafferTest
import GafferScene
import GafferSceneTest
class GroupTest( GafferSceneTest.SceneTestCase ) :
def testTwoLevels( self ) :
sphere = IECoreScene.SpherePrimitive()
input = GafferSceneTest.CompoundObje... | {
"content_hash": "41c95c24923c1d29676dca8d5f1f4d6b",
"timestamp": "",
"source": "github",
"line_count": 772,
"max_line_length": 137,
"avg_line_length": 33.10751295336787,
"alnum_prop": 0.6317931061465628,
"repo_name": "boberfly/gaffer",
"id": "f27573ef0238fd92e404187031bd262c1ce0c58f",
"size": "274... |
"""
PHP date() style date formatting
See http://www.php.net/date for format strings
Usage:
>>> import datetime
>>> d = datetime.datetime.now()
>>> df = DateFormat(d)
>>> print(df.format('jS F Y H:i'))
7th October 2003 11:39
>>>
"""
import calendar
import datetime
from email.utils import format_datetime as format_datet... | {
"content_hash": "8e152ac20b9fdb139c287cea82e816af",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 102,
"avg_line_length": 30.68975903614458,
"alnum_prop": 0.5584453822750024,
"repo_name": "freakboy3742/django",
"id": "0d4eb4bdf0d47661106c0088ee860cb135a121df",
"size": ... |
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/steerclear.db'
TEST_SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/test.db'
| {
"content_hash": "d27b9793326acf6fdca9cee12f62ba17",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 56,
"avg_line_length": 56.5,
"alnum_prop": 0.7256637168141593,
"repo_name": "beblount/Steer-Clear-Backend-Web",
"id": "ba3d8c81275b8db5d5dff64c26b7991fd75914b9",
"size": "11... |
import functools
class ValidateMethod:
def __init__(self, *, valid_methods):
self.valid_methods = valid_methods
def __call__(self, func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
method = kwargs["method"]
if method not in self.valid_methods:
... | {
"content_hash": "3d6153cc8afd9e06f7c52ce5d7410fab",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 61,
"avg_line_length": 25,
"alnum_prop": 0.5894736842105263,
"repo_name": "olivertso/pde",
"id": "552abecfd3bbfc373ce64ee7303b332a76b46cf2",
"size": "475",
"binary": fals... |
import os
import picocm
import unittest
from picocm_unittest import *
class FileTests(unittest.TestCase):
def test_file_write_then_read_yaml(self):
with TempFile() as dst:
self.assertTrue(picocm.file_write_yaml(dst.name, {'hello': 'world'}))
self.assertDictEqual({'hello': 'world'}, picocm.file_read_yaml(dst.... | {
"content_hash": "11395c66414a0425a7c830196c889938",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 83,
"avg_line_length": 31.8,
"alnum_prop": 0.7012578616352201,
"repo_name": "mediafly/picocm",
"id": "14faf46e88e5bdd4c9f3f6054f9c9248265bca58",
"size": "660",
"binary": ... |
print(__doc__)
import p_value_scoring_object
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
from sklearn.svm import SVC
from sklearn.preprocessing import StandardScaler
from sklearn.datasets import load_iris
from sklearn.cross_validation import StratifiedShuffleSplit
from s... | {
"content_hash": "d88b54a61bd63f149bd679bc1ee57075",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 127,
"avg_line_length": 35.044444444444444,
"alnum_prop": 0.6692031283026845,
"repo_name": "weissercn/MLTools",
"id": "7bcec602c6efa729d1a4eb0fcce2124bf035b902",
"size": "... |
from submissions.Becker import medal_of_honor
class DataFrame:
data = []
feature_names = []
target = []
target_names = []
dataframe = DataFrame()
awardees = medal_of_honor.get_awardees(test=True) | {
"content_hash": "d52ebcc92e9dd6f02a185f1c06a5068a",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 49,
"avg_line_length": 21.3,
"alnum_prop": 0.6713615023474179,
"repo_name": "NolanBecker/aima-python",
"id": "00e7daceb5a1e49b32afff1c143e99f56a8c14e7",
"size": "213",
"b... |
import os
from datadog_checks.dev import get_here
HERE = get_here()
def get_fixture_path(filename):
return os.path.join(HERE, 'fixtures', filename)
| {
"content_hash": "0f0c353d571afa68f7987014e62f779e",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 51,
"avg_line_length": 17.333333333333332,
"alnum_prop": 0.7243589743589743,
"repo_name": "DataDog/integrations-core",
"id": "26740897c5599f23602e8b607445a08932fc1751",
"siz... |
import pytest
from mock import patch, MagicMock
from gitfs.worker.fetch import FetchWorker
class TestFetchWorker(object):
def test_work(self):
mocked_peasant = MagicMock()
mocked_fetch = MagicMock(side_effect=ValueError)
mocked_fetch_event = MagicMock()
with patch.multiple('gitfs... | {
"content_hash": "f6d48ae070bab9c6d5c2356fd196f1bc",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 73,
"avg_line_length": 35.046875,
"alnum_prop": 0.5777975925100312,
"repo_name": "rowhit/gitfs",
"id": "404da5cbaf26cd3169116c954a6d409dee98a0aa",
"size": "2821",
"binary... |
from __future__ import unicode_literals, absolute_import
from giiit.multi_version import uu
from giiit.parsers import WrongOutputError
from giiit.models.tree import Entity, STATUS_CODES
def porcelain_z(output):
"""
`git status --porcelain -z`
also supports `--ignored` option
test output: tests/parse... | {
"content_hash": "d47ddcb7bb98ab64cd5abf544efe9b32",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 102,
"avg_line_length": 34.56818181818182,
"alnum_prop": 0.569362261669954,
"repo_name": "maizy/giiit",
"id": "0343f9465673c94c7dd87015d45af1fabc392014",
"size": "1624",
... |
"""Transition adders.
This implements an N-step transition adder which collapses trajectory sequences
into a single transition, simplifying to a simple transition adder when N=1.
"""
import copy
from typing import Optional, Tuple
from acme import specs
from acme import types
from acme.adders.reverb import base
from ... | {
"content_hash": "98dcf85a3f68f1d82cf692124f0713ea",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 80,
"avg_line_length": 40.32081911262799,
"alnum_prop": 0.6515997968511935,
"repo_name": "deepmind/acme",
"id": "fe3e16f75b008aca5b5781d2e63ee5915462f5f5",
"size": "12430"... |
from django.conf import settings
from django.test import TestCase
from django_dynamic_fixture import G
from accounts.models import Child, User
from studies.models import Lab, Response, Study, StudyType, Video
class ResponseSaveHandlingTestCase(TestCase):
def setUp(self):
self.researcher = G(
... | {
"content_hash": "801845dcd8014a887fefb2575c294861",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 108,
"avg_line_length": 39.125786163522015,
"alnum_prop": 0.5671113968815303,
"repo_name": "CenterForOpenScience/lookit-api",
"id": "81d9872b7fcdb03c62849602e30cadd481ff792e... |
import os
import tempfile
import pytest
from docker import errors
from docker.context import ContextAPI
from docker.tls import TLSConfig
from .base import BaseAPIIntegrationTest
class ContextLifecycleTest(BaseAPIIntegrationTest):
def test_lifecycle(self):
assert ContextAPI.get_context().Name == "default"
... | {
"content_hash": "37e49396ea5729276af7f34c78e2c3c1",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 73,
"avg_line_length": 35.33898305084746,
"alnum_prop": 0.6369304556354916,
"repo_name": "docker/docker-py",
"id": "a2a12a5cb08643286fbce6da907e04ae1054ece1",
"size": "2085... |
from udpServer import UDPServer
from tcpServer import TCPServer
from udpEchoServer import UDPEchoServer
from configs import SERVER
class RemoteHid():
def __init__(self):
print "Start RemoteHid Server."
udpEchoServer = UDPEchoServer(SERVER.UDP_ECHO_PORT)
udpEchoServer.start()
tcpServer = TCPServe... | {
"content_hash": "bc2822491984be805547b40b27870e13",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 53,
"avg_line_length": 23.1,
"alnum_prop": 0.7337662337662337,
"repo_name": "savionok/RemoteHID",
"id": "86da14de0f50462876560627d3aeb45e2ca320d9",
"size": "1568",
"binar... |
import datetime
import re
import sys
from contextlib import contextmanager
from unittest import SkipTest, skipIf
from xml.dom.minidom import parseString
import pytz
from django.contrib.auth.models import User
from django.core import serializers
from django.core.exceptions import ImproperlyConfigured
from django.db im... | {
"content_hash": "688a868e1ae91645fe67785141ee1dc7",
"timestamp": "",
"source": "github",
"line_count": 1196,
"max_line_length": 119,
"avg_line_length": 45.48913043478261,
"alnum_prop": 0.6101277456116165,
"repo_name": "timgraham/django",
"id": "e54b011c042696c7d3569cc5c5b2b35140d3d382",
"size": "5... |
from __future__ import print_function
import hashlib
import ctypes
from pyasn1.type import univ, namedtype
from Crypto.Cipher import DES3
from .util import xor_bytearrays, add_pkcs7_padding, strip_pkcs7_padding, BadDataLengthException
PBE_WITH_SHA1_AND_TRIPLE_DES_CBC_OID = (1,2,840,113549,1,12,1,3)
PURPOSE_KEY_MATERIA... | {
"content_hash": "e35d08430a3f8803304e4842fd139b34",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 136,
"avg_line_length": 41.283018867924525,
"alnum_prop": 0.6739792809262645,
"repo_name": "voetsjoeba/pyjks",
"id": "4dffffc687a227052bd76a3d97dafa8fcd329450",
"size": "6... |
from casexml.apps.stock.models import StockTransaction, StockReport
from corehq.apps.commtrack.models import StockState
from corehq.form_processor.tests.utils import FormProcessorTestUtils
from custom.ewsghana.tests.handlers.utils import EWSScriptTest, TEST_DOMAIN
class TestUndo(EWSScriptTest):
def tearDown(self... | {
"content_hash": "1cbe9d6e7b550a7201e9796e03c30543",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 100,
"avg_line_length": 36.65555555555556,
"alnum_prop": 0.612913003940588,
"repo_name": "qedsoftware/commcare-hq",
"id": "f088d3e825f1233c1dfc004253aec0ac0567edf9",
"size"... |
from .formatter import Formatter
from ..models import Context, Citation
class Plainlink(Formatter):
def __init__(self, ctx: Context=None):
super().__init__(ctx)
def format(self, citation: Citation):
return '[{} {}]'.format(citation.url, citation.title)
| {
"content_hash": "3d59d104993d84828ffa37c5dea4fbc4",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 61,
"avg_line_length": 28,
"alnum_prop": 0.6571428571428571,
"repo_name": "zhaofengli/refill",
"id": "a620836337169a9cfb0de754b486618334512044",
"size": "280",
"binary": ... |
import datetime
import logging
import logging.handlers
import os
import re
import socket
import sys
import threading
import ovs.dirs
import ovs.unixctl
import ovs.util
DESTINATIONS = {"console": "info", "file": "info", "syslog": "info"}
PATTERNS = {
"console": "%D{%Y-%m-%dT%H:%M:%SZ}|%05N|%c%T|%p|%m",
"file":... | {
"content_hash": "69739742767f23984609223bf849c858",
"timestamp": "",
"source": "github",
"line_count": 384,
"max_line_length": 79,
"avg_line_length": 34.828125,
"alnum_prop": 0.5320771646478242,
"repo_name": "kspviswa/dpi-enabled-ovs",
"id": "105d126fb08167a88ae9ab18e6c735af47c6e71e",
"size": "139... |
from Tkinter import *
import CommonUtil
# ******** the main page *************
class GUI_MainPg:
def __init__(self, master):
self.root = master
self.root.protocol("WM_DELETE_WINDOW", self.on_closing)
self.messageQueue = CommonUtil.Queue()
# the main frame
self.fr... | {
"content_hash": "625c000ec2a28937edf4a93681da91d7",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 89,
"avg_line_length": 35.264,
"alnum_prop": 0.5857531760435571,
"repo_name": "avlec/tdo",
"id": "9ab678bcebd81744f20f852aaeb2f27ce0e189b8",
"size": "4408",
"binary": fa... |
import datetime
import os
import glob
import time
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
base_dir = '/sys/bus/w1/devices/'
device_folders = glob.glob(base_dir + '28-*')
devices = map(lambda x: os.path.basename(x), device_folders)
device_files = map(lambda x: x + '/w1_slave', device_folders)
def... | {
"content_hash": "fbdcfed17ad9d4af77120a91c853268f",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 61,
"avg_line_length": 26.236842105263158,
"alnum_prop": 0.6198595787362087,
"repo_name": "barecode/iot_temp_sensors",
"id": "0222b1cbbec04e89d5628bd95bcf775043d1615a",
"si... |
from scrapy import signals
from scrapy.utils.project import get_project_settings
from scrapy.crawler import CrawlerProcess
from scrapy.xlib.pydispatch import dispatcher
from multiprocessing.queues import Queue
import scrapy
import multiprocessing
import urllib
from scrapy import Request as Request
# In[148]:
class C... | {
"content_hash": "1edeed4307e151e598d8e31653c4583c",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 141,
"avg_line_length": 34.40277777777778,
"alnum_prop": 0.6013322567622124,
"repo_name": "xianjunzhengbackup/code",
"id": "52b0e65414ae1742ead07ca38d4ee1c99d9cce91",
"siz... |
import io
from twitter_mysql.utils.db import build_connection_from_configfile
from twitter_mysql.utils.configfile import ConfigArgumentParser, get_configfile_from_args
#
#
# program arguments
#
#
argparser = ConfigArgumentParser(description="dump user ids in database")
argparser.add_argument("filename", help... | {
"content_hash": "f07a56381e345551f06893c72d44335a",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 89,
"avg_line_length": 24.678571428571427,
"alnum_prop": 0.7178002894356006,
"repo_name": "emCOMP/twitter-mysql",
"id": "87af19bb09a39a890eeaf42d594e884d9e26e5dd",
"size": ... |
import csv
import os
import numpy as np
import numpy.testing as npt
import tensorflow as tf
from mediapipe.model_maker.python.text.text_classifier import dataset as text_classifier_ds
from mediapipe.model_maker.python.text.text_classifier import model_spec
from mediapipe.model_maker.python.text.text_classifier import... | {
"content_hash": "9306eee7f0f78eee7f560817949265e5",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 91,
"avg_line_length": 39.98780487804878,
"alnum_prop": 0.6532479414455626,
"repo_name": "google/mediapipe",
"id": "b9558b2b5982b63ff510fcbd42ffe02743585f66",
"size": "3887... |
"""Config flow to configure the Azure DevOps integration."""
from aioazuredevops.client import DevOpsClient
import aiohttp
import voluptuous as vol
from homeassistant.config_entries import ConfigFlow
from .const import CONF_ORG, CONF_PAT, CONF_PROJECT, DOMAIN
class AzureDevOpsFlowHandler(ConfigFlow, domain=DOMAIN):... | {
"content_hash": "0fc7857c71ab5bb5e46dc0c80d30677b",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 86,
"avg_line_length": 34.01639344262295,
"alnum_prop": 0.5604819277108434,
"repo_name": "home-assistant/home-assistant",
"id": "350bad5852a40daecce12d05ffb0d5ac7bbdaa8e",
... |
from __future__ import print_function
import sys, os, subprocess, distutils.spawn, argparse, re
def main():
# Parse the arguments
parser = argparse.ArgumentParser(description='Formats all the Sparrow files found in a directory')
parser.add_argument('--dir', action='store', default='.',
help='The d... | {
"content_hash": "b40397d2d570d3b5fcdb191460d7060b",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 102,
"avg_line_length": 39.06060606060606,
"alnum_prop": 0.6245151280062063,
"repo_name": "Sparrow-lang/sparrow",
"id": "e5ac88ede49e3c39c6cc5d9cfa96e5f95f9c4bd8",
"size": ... |
import random
import math
VERY_LARGE_NUMBER = 1000000000000
def dist(x,y,error_variance=0):
'''
Calculates the eucleadean distance between two points x and y, then multiply it by a random normal variable with mean=1 and error_variance
'''
error = 1.0
if error_variance > 0:
error = random.gauss(1,err... | {
"content_hash": "e759bc63b96537a753311f2e9bc9beee",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 139,
"avg_line_length": 26.202380952380953,
"alnum_prop": 0.6388005452067242,
"repo_name": "gajduk/greedy-tsp",
"id": "f909b717fdec528b539a46678a474055c765f0bb",
"size": "2... |
import nose.tools as nose
from elevator.elevator import Elevator
def test_init_params():
"""should store correct initial parameters when elevator is initalized"""
elevator = Elevator(num_floors=5, starting_floor=2)
nose.assert_equal(elevator.num_floors, 5)
nose.assert_equal(elevator.current_floor, 2)
... | {
"content_hash": "75374163379b0ef3c3fc0b899c73b8ff",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 79,
"avg_line_length": 34.166666666666664,
"alnum_prop": 0.7111498257839721,
"repo_name": "caleb531/elevator",
"id": "8a01c663378bf902ca90d161146983f971f7e811",
"size": "28... |
import json, os, time, unittest
import dxpy
import dxpy.app_builder
from dxpy.exceptions import DXAPIError
from __future__ import print_function
src_dir = os.path.join(os.path.dirname(__file__), "..")
test_resources_dir = os.path.join(src_dir, "test", "resources")
def makeInputs():
# Please fill in this method... | {
"content_hash": "a61a2bf7eb5dfbe405a0e0e09ed6935e",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 135,
"avg_line_length": 31.636363636363637,
"alnum_prop": 0.6218390804597701,
"repo_name": "dnanexus/dx-toolkit",
"id": "b4210253f11079ba46b0b077a7e962c2a883d0c5",
"size": ... |
import sys
sys.path.insert(0, "..")
from . import login
from . import addpost
from . import logout
from . import permissions
from . import settings
from . import query
| {
"content_hash": "e490608a8ef19e046bd4b56469a3e5bd",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 25,
"avg_line_length": 21,
"alnum_prop": 0.7440476190476191,
"repo_name": "ollien/Timpani",
"id": "ff2061282071de802e80084a99b2b3414ee9314d",
"size": "168",
"binary": fals... |
from oslo_config import cfg
from oslo_log import helpers as log_helpers
from oslo_utils import importutils
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
from neutron.api.rpc.handlers import l3_rpc
from neutron.common import constants as n_const
from neutron.common import rpc as n_rpc
from neutron.common ... | {
"content_hash": "6fe52aca14a54887224e9836b6d4c848",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 78,
"avg_line_length": 41.146067415730336,
"alnum_prop": 0.6559257236482796,
"repo_name": "asgard-lab/neutron",
"id": "cca550d2b9c97a7a3f8f29bfbf1e570c61c28b55",
"size": "4... |
import random
import socket
import unittest
from framework import VppTestCase, VppTestRunner
from vpp_sub_interface import VppSubInterface, VppDot1QSubint, VppDot1ADSubint
from vpp_ip_route import VppIpRoute, VppRoutePath, VppIpMRoute, \
VppMRoutePath, MRouteItfFlags, MRouteEntryFlags, VppMplsIpBind
from scapy.pa... | {
"content_hash": "066ab522e354d822c7e3ed1001c90ea9",
"timestamp": "",
"source": "github",
"line_count": 1007,
"max_line_length": 79,
"avg_line_length": 36.19463753723932,
"alnum_prop": 0.5224429323968394,
"repo_name": "wfnex/openbras",
"id": "7a7098c36f0611459416cc7e876b993517a7091e",
"size": "3647... |
import os
CONFIG_FILE = os.path.join(os.getcwd(), "config.txt")
def add_folder(dir_name):
config_status = file_exists(CONFIG_FILE)
dir_status = dir_exists(dir_name)
if config_status:
if dir_status:
fh = open(CONFIG_FILE, "a")
fh.write("%s%s" %(dir_name, "\n"))
... | {
"content_hash": "7e2f500dfea11f872ff61052c74d9ed9",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 67,
"avg_line_length": 21.77027027027027,
"alnum_prop": 0.5443823711980137,
"repo_name": "darthvish/subtitle_automate",
"id": "e9dc507dace8d7810aef6c73e28ec634652fd099",
"s... |
import angr
######################################
# __libc_init
#
# Refer to http://androidxref.com/5.1.1_r6/xref/bionic/libc/bionic/libc_init_dynamic.cpp
# and http://androidxref.com/5.1.1_r6/xref/bionic/libc/private/KernelArgumentBlock.h
# raw_args points to argc, *argv, and *envp located on the stack
# unused is a... | {
"content_hash": "6b79aa58bf2935b33b4b45ed838d9465",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 107,
"avg_line_length": 45.21212121212121,
"alnum_prop": 0.6441018766756033,
"repo_name": "tyb0807/angr",
"id": "3a62123816cb73233142024491662f5eca010532",
"size": "1492",
... |
from collections import namedtuple
import numpy as np
from llvmlite.llvmpy.core import Type, Builder, ICMP_EQ, Constant
from llvmlite import ir
from numba.core import types, cgutils
from numba.core.compiler_lock import global_compiler_lock
from numba.core.caching import make_library_cache, NullCache
_wrapper_info ... | {
"content_hash": "bd105ff8b7ac3d27d993dab00f55a80b",
"timestamp": "",
"source": "github",
"line_count": 742,
"max_line_length": 80,
"avg_line_length": 36.57142857142857,
"alnum_prop": 0.5656323702830188,
"repo_name": "seibert/numba",
"id": "2ebacf93a48d0c09881024ed824a678fae89655a",
"size": "27136"... |
from django.db import models
from filer.fields.file import FilerFileField as OriginalFilerFileField
from filer.fields.image import FilerImageField as OriginalFilerImageField
from filer.models import File
from filer_addons.filer_gui.fields import FilerFileField, FilerImageField
class FilerOriginalFieldTest(models.Mode... | {
"content_hash": "ff6733509824b21a73d0a2fc8d4ad104",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 73,
"avg_line_length": 23.5578231292517,
"alnum_prop": 0.5991914524978342,
"repo_name": "rouxcode/django-filer-addons",
"id": "29e1f3319504cd7b0bdea817327fe78cd2a860fb",
"... |
'''Tools for loading 3D rigid body simulations.'''
import sys
import numpy
def matrixIsRotation(R):
'''Check if a 3x3 matrix is orthonormal and orientation preserving.'''
assert R.shape == (3, 3)
idresid = numpy.amax(numpy.absolute(numpy.transpose(numpy.matrix(R)) * numpy.matrix(R) - numpy.identity(3)))
... | {
"content_hash": "95555febe349e68fb6713238b31da95b",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 148,
"avg_line_length": 48.12582781456954,
"alnum_prop": 0.5273152607678547,
"repo_name": "breannansmith/scisim",
"id": "dbbb99d63a9831171b2ba899368d137c12923e5c",
"size":... |
from __future__ import annotations
from ..core.utils import indices_len, fix_loc
from ..table.module import TableModule
from ..table.table import Table
from ..core.slot import SlotDescriptor
from ..utils.psdict import PsDict
from ..core.decorators import process_slot, run_if_any
from datasketches import kll_floats_ske... | {
"content_hash": "20c857363a503096e3dd79f65ba68e83",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 87,
"avg_line_length": 37.739583333333336,
"alnum_prop": 0.5589290643113441,
"repo_name": "jdfekete/progressivis",
"id": "38795b390cc5cc7aa730c156db2c1d148d848296",
"size":... |
import os
import sys
import cgi
from urllib2 import quote, unquote
import urlparse
from cStringIO import StringIO
from ConfigParser import SafeConfigParser
from lxml import etree
from pycsw.plugins.profiles import profile as pprofile
import pycsw.plugins.outputschemas
from pycsw import config, fes, log, metadata, util,... | {
"content_hash": "4aa36e31453a60cfaa9576fb546c4887",
"timestamp": "",
"source": "github",
"line_count": 2610,
"max_line_length": 184,
"avg_line_length": 43.14406130268199,
"alnum_prop": 0.5397936166811715,
"repo_name": "ckan-fcd/pycsw-fcd",
"id": "5b6a34b4dfec08bff9312fd1d2d5d529ab1f046e",
"size": ... |
"""The implementation of `tf.data.Dataset.zip`."""
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.data.util import nest
from tensorflow.python.ops import gen_dataset_ops
def _zip(datasets, name): # pylint: disable=redefined-builtin
return _ZipDataset(datasets, name)
class _ZipDataset(... | {
"content_hash": "e8fc7ed12f68478ac54aafd2aea790eb",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 80,
"avg_line_length": 38,
"alnum_prop": 0.6242350061199511,
"repo_name": "tensorflow/tensorflow",
"id": "7c3448add9d136f24abd179679d044fbbb75f7b1",
"size": "2323",
"bina... |
from django.template import TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import SomeClass, SomeOtherException, UTF8Class, setup
class FilterSyntaxTests(SimpleTestCase):
@setup({"filter-syntax01": "{{ var|upper }}"})
def test_filter_syntax01(self):
"""
Basic filter u... | {
"content_hash": "c11c611d8343472c5424fcc0698c2b28",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 88,
"avg_line_length": 38.088,
"alnum_prop": 0.599138836378912,
"repo_name": "monetate/django",
"id": "5c9128aad832ba1b31d0bb610726924d09e0c958",
"size": "9524",
"binary... |
"""Helpers for general Python functionality."""
import functools
import six
# functools.partial objects lack several attributes present on real function
# objects. In Python 2 wraps fails on this so use a restricted set instead.
_PARTIAL_VALID_ASSIGNMENTS = ("__doc__",)
def wraps(wrapped):
"""A functools.wrap... | {
"content_hash": "5f2c28e70af803631443a8f4252c7a9c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 81,
"avg_line_length": 32.68421052631579,
"alnum_prop": 0.7278582930756844,
"repo_name": "tseaver/google-cloud-python",
"id": "d2d0c4402311e081061aa7ecc665eb7d4844d338",
"s... |
import os
import sys
import time
import glob
import datetime
def get_today_str():
today = datetime.date.today()
return today.strftime("%Y-%m-%d")
def get_begin_day_str():
return "2012-01-01"
def transid(code):
return "0" * (6 - len(str(code))) + str(code)
def get_date_from(c_day, delta_days):
... | {
"content_hash": "4c3ae645e63b217aa894497b6be6776f",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 59,
"avg_line_length": 23.756756756756758,
"alnum_prop": 0.5671217292377702,
"repo_name": "buptlishantao/stock",
"id": "0b3a17a319674b23e819ddef2f91df38c4c90f11",
"size": "... |
from __future__ import unicode_literals
import logging
from collections import OrderedDict
from django.core.cache import cache
from guardian.shortcuts import assign_perm
from rest_framework import generics
from rest_framework.filters import DjangoFilterBackend, DjangoObjectPermissionsFilter
from rest_framework.permis... | {
"content_hash": "d9c2a38b54a48e59e4ea9e22a36d0ba1",
"timestamp": "",
"source": "github",
"line_count": 624,
"max_line_length": 97,
"avg_line_length": 37.72435897435897,
"alnum_prop": 0.6924384027187765,
"repo_name": "stackdio/stackdio",
"id": "57f66aea787c1581e59b81ba11ff2aa6d20c8e80",
"size": "24... |
import json ,os,students,teachers,subjects,association
def loader():
filename=input("Enter name of file :")
if(os.path.isfile(filename)):
print("Loading...")
fp=open(filename,"r")
all_data=json.load(fp)
fp.close()
students.student_dict=all_data[0]
subjects.subject_dict=all_data[1]
teachers.teacher_dict... | {
"content_hash": "eeb7ef5b26ff9ef0f3df788a6f45fb1e",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 106,
"avg_line_length": 24.85185185185185,
"alnum_prop": 0.7153502235469449,
"repo_name": "charany1/Class-Room-Management-System",
"id": "dcc2b705482f83e85304e6c49f6ae09f527e... |
import copy
import json
import warnings
from collections import defaultdict, namedtuple
# noinspection PyProtectedMember
from dataclasses import (MISSING,
_is_dataclass_instance,
fields,
is_dataclass # type: ignore
)
fr... | {
"content_hash": "d632451e5d8d28ed1ae281ef112496a7",
"timestamp": "",
"source": "github",
"line_count": 368,
"max_line_length": 79,
"avg_line_length": 39.47826086956522,
"alnum_prop": 0.5798458149779736,
"repo_name": "lidatong/dataclasses-json",
"id": "529e153f8113398a48c2484de005f5ef5d81ce93",
"si... |
print("Hello World.")
| {
"content_hash": "aa3efea57b55f9f0c95c499c95e0f397",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 21,
"avg_line_length": 22,
"alnum_prop": 0.6818181818181818,
"repo_name": "l-althueser/NiMoNa_DCM16",
"id": "fb8c8862da313fb340ccbb4fe1822debc2d5df31",
"size": "617",
"bin... |
from os.path import join
from raptiformica.actions.modules import unload_module
from raptiformica.settings import conf
from tests.testcase import TestCase
class TestUnloadModule(TestCase):
def setUp(self):
self.determine_clone_data = self.set_up_patch(
'raptiformica.actions.modules.determine_c... | {
"content_hash": "b8501fc2090c6446f39a6b8e7d379445",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 80,
"avg_line_length": 33.46,
"alnum_prop": 0.6431560071727436,
"repo_name": "vdloo/raptiformica",
"id": "5f9d23fa910b8eb51dd0d37b79c5fc077b6c762a",
"size": "1673",
"bina... |
import argparse
import pickle
from docqa.data_processing.word_vectors import load_word_vectors
def main():
parser = argparse.ArgumentParser()
parser.add_argument("vecs")
parser.add_argument("vocab")
parser.add_argument("output")
args = parser.parse_args()
voc = set()
with open(args.vocab... | {
"content_hash": "a53540c089cbab77af10286feb05ec2a",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 64,
"avg_line_length": 21.44,
"alnum_prop": 0.6194029850746269,
"repo_name": "allenai/document-qa",
"id": "e8937d50912576688b2e84c55d7bbe10e720ef14",
"size": "536",
"bina... |
"""
Created on Wed Nov 8 11:00:05 2017
@author: Stefan Peidli
License: MIT
Tags: Neural Network
"""
import numpy as np
import matplotlib.pyplot as plt
import os
import time
import random
def softmax(x):
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum()
def relu(x):
x[x < 0] = 0
r... | {
"content_hash": "8d0d41d67e6a1bcb431259d1c88e6ed0",
"timestamp": "",
"source": "github",
"line_count": 546,
"max_line_length": 170,
"avg_line_length": 43.24542124542125,
"alnum_prop": 0.5501863459258004,
"repo_name": "stefanpeidli/GoNet",
"id": "1e12749ce9db0a0caf7450ecc127adb3ef537572",
"size": "... |
"""
color handling for mapping and geovisualization
"""
from warnings import warn
try:
import palettable as pltt
from palettable.colorbrewer import qualitative, sequential, diverging
except:
warn('palettable not installed. Functionality '
'related to it will not work')
def get_color_map(palette... | {
"content_hash": "21b1b753e3faad3faf94e23a87b7b630",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 79,
"avg_line_length": 30.233766233766232,
"alnum_prop": 0.5330756013745704,
"repo_name": "TaylorOshan/pysal",
"id": "e69b5d3fba87b9d8b5f4ff5cab8177a4fb4ccd4e",
"size": "23... |
import ConfigParser
import csv
import gzip
import os
import random
import shutil
import tempfile
import unittest
from .context import bin
class TestCampfire(unittest.TestCase):
def setUp(self):
self.subdomain = os.environ.get('CAMPFIRE_SUBDOMAIN')
self.auth_token = os.environ.get('CAMPFIRE_AUTH_... | {
"content_hash": "82480cd9eac5feada003281dc2289aea",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 79,
"avg_line_length": 32.95180722891566,
"alnum_prop": 0.6263254113345521,
"repo_name": "ampledata/splunk_app_campfire",
"id": "6b5222fd22345ead0c1d69bd267f76b0ee6d02f6",
... |
from django.conf.urls.defaults import *
from satchmo.configuration import config_get_group
config = config_get_group('PAYMENT_PROTX')
urlpatterns = patterns('satchmo',
(r'^$', 'payment.modules.protx.views.pay_ship_info',
{'SSL':config.SSL.value}, 'PROTX_satchmo_checkout-step2'),
(r'^confirm/$', 'p... | {
"content_hash": "6fe571f031f8aa12238fac80f4224b66",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 69,
"avg_line_length": 38.72222222222222,
"alnum_prop": 0.672883787661406,
"repo_name": "sankroh/satchmo",
"id": "932880aae90fc6014dd29d42a32c7656f99f8cb2",
"size": "697",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.