text stringlengths 4 1.02M | meta dict |
|---|---|
import os
import sys
import pulsar as psr
def run_test():
tester = psr.PyTester("Basic Module Loading/Calling")
ma = psr.ModuleAdministrator()
ma.load_module("testmodules", "TestCppModule1", "TEST_CPP_MOD1")
ma.load_module("testmodules", "TestPyModule1", "TEST_PY_MOD1")
mcpp1 = ma.get_module("TE... | {
"content_hash": "9d01e63bfcd60aca60386053488c8125",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 115,
"avg_line_length": 37.54545454545455,
"alnum_prop": 0.6912832929782082,
"repo_name": "pulsar-chem/Pulsar-Core",
"id": "a18694c5d998817bf1b5e1849bcb37f03a310cd7",
"size... |
"""Infrastructure and implementation of in-memory graph data.
High-level Abstract Classes:
* `InMemoryGraphData`: provides nodes, edges, and features, for a
homogeneous or a heteregenous graph.
* `NodeClassificationGraphData`: an `InMemoryGraphData` that also provides
list of {train, test, validation} no... | {
"content_hash": "ba0fbee516917f0d53add255fbebe740",
"timestamp": "",
"source": "github",
"line_count": 747,
"max_line_length": 112,
"avg_line_length": 38.888888888888886,
"alnum_prop": 0.6601032702237521,
"repo_name": "tensorflow/gnn",
"id": "5c2e6f48a6b173e0c2ba22cd0d87f4575ab130fe",
"size": "297... |
import subprocess
import socket
import time
import inspect, os, sys
# From http://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder
cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"..")))
if cmd_subfolder not in sys.path:
... | {
"content_hash": "081ad8d38bf6831085ea3ba630c85f52",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 129,
"avg_line_length": 27.29268292682927,
"alnum_prop": 0.7015192135835567,
"repo_name": "else/mosquitto",
"id": "c3b2fd853d65177c092a46c496a75aa35cec2d6e",
"size": "1230"... |
import base64
from xdrlib import Packer, Unpacker
from .base import Integer
from .ledger_close_meta_v0 import LedgerCloseMetaV0
__all__ = ["LedgerCloseMeta"]
class LedgerCloseMeta:
"""
XDR Source Code::
union LedgerCloseMeta switch (int v)
{
case 0:
LedgerCloseMetaV0 v0;... | {
"content_hash": "eccac8550a6435dea5e8203ce2b6839b",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 68,
"avg_line_length": 26.301369863013697,
"alnum_prop": 0.5604166666666667,
"repo_name": "StellarCN/py-stellar-base",
"id": "19d4dad43231f4a0ac2231bb469d7c886011b5c2",
"si... |
from celery import Celery, absolute_import, unicode_literals, shared_task
from vtn.models import DREvent, Site
from datetime import timedelta
from django.db.models import Q
from django.utils import timezone
from django.conf import settings
celery = Celery('tasks', broker='amqp://localhost')
@shared_task
def update_e... | {
"content_hash": "0bc259e5ab5f8fb6351cfc2e7ba42f7d",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 97,
"avg_line_length": 28.225,
"alnum_prop": 0.6138175376439327,
"repo_name": "rlutes/volttron-applications",
"id": "3ae0b72840b3f7a9e75c8fa0ce54808885fee2c8",
"size": "403... |
import logging
logger = logging.getLogger(__name__)
import sys
import json
import requests
from requests.exceptions import Timeout, ReadTimeout, ConnectionError
import time
import threading
from functools import lru_cache
from counterpartylib.lib import script
from counterpartylib.lib import config
bitcoin_rpc_sessio... | {
"content_hash": "ff837f0703d15ec2a34f4b6b457f4889",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 171,
"avg_line_length": 35.49065420560748,
"alnum_prop": 0.619486504279131,
"repo_name": "stefcrypto/counterparty-lib",
"id": "f4fec5138388def4206d2f74c64479e3568cd216",
"... |
"""Modal base classes."""
# pylint: disable=too-few-public-methods
from lib import base
from lib.constants import locator
class BaseModal(base.Modal):
"""Base class for creation and edition modals."""
_locator_ui_title = locator.ModalCreateNewObject.UI_TITLE
_locator_ui_code = locator.ModalCreateNewObject.UI_C... | {
"content_hash": "f30d4bea79e4691fa7f4fa7f2a1bb140",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 79,
"avg_line_length": 35.51526717557252,
"alnum_prop": 0.7003761418592155,
"repo_name": "AleksNeStu/ggrc-core",
"id": "f1db49c8c5491734bd68c4329e441341298ac60a",
"size": ... |
"""Classes to generate point and figure charts."""
from collections import OrderedDict
from datetime import datetime
from decimal import Decimal
import logging
import pypf.terminal_format
class PFChart(object):
"""Base class for point and figure charts."""
TWOPLACES = Decimal('0.01')
def __init__(self,... | {
"content_hash": "35c2c8fdeb6d1acf943cd2196e794fcc",
"timestamp": "",
"source": "github",
"line_count": 671,
"max_line_length": 128,
"avg_line_length": 39.31147540983606,
"alnum_prop": 0.44404427932367885,
"repo_name": "pviglucci/pypf",
"id": "bd5d2f88eb4b9317786c5528ae6b6fa8b58e47dc",
"size": "263... |
"""
Q1. WAP that will create a new list of age given the list of year of birth using list comprehension.
Q2. Create a list which will print all the characters in a string which are not vowels using list
comprehension.
Q3. Create a list of squares of numbers given a list of ten numbers using list comprehension.
... | {
"content_hash": "d160ad41fe57f6717059f87c543327ba",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 120,
"avg_line_length": 21.877828054298643,
"alnum_prop": 0.5772492244053774,
"repo_name": "Akagi201/learning-python",
"id": "ff53c480008c31ef08be9829348c0940ae3596e4",
"s... |
"""State and behavior for ingestion during an operation."""
import abc
import collections
import enum
import six
from grpc.framework.core import _constants
from grpc.framework.core import _interfaces
from grpc.framework.core import _utilities
from grpc.framework.foundation import abandonment
from grpc.framework.foun... | {
"content_hash": "e5f8e14f0648b4078eb771889b2eddbc",
"timestamp": "",
"source": "github",
"line_count": 410,
"max_line_length": 80,
"avg_line_length": 40.52926829268293,
"alnum_prop": 0.6975988445567792,
"repo_name": "goldenbull/grpc",
"id": "f2767c981b2e3d4c62903794d581e800dd5171f6",
"size": "1814... |
def vendauth(request):
return {
'venduser': getattr(request, 'venduser'),
}
| {
"content_hash": "3e1fc5b9014a1b58f0af06f1189d3a6b",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 49,
"avg_line_length": 23,
"alnum_prop": 0.5869565217391305,
"repo_name": "remarkablerocket/django-vend",
"id": "bed2a2a067deaa7b73e2b0d3793aea5d66b6bacc",
"size": "92",
"... |
import os
from mi.core.versioning import version
from mi.dataset.driver.wfp_common.wfp_c_file_driver import WfpCFileDriver
from mi.dataset.dataset_driver import ParticleDataHandler
from mi.dataset.dataset_parser import DataSetDriverConfigKeys
from mi.dataset.parser.dofst_k_wfp import DofstKWfpParser
from mi.dataset.pa... | {
"content_hash": "b961a80ff1734dd3ec94be5d9b3fe3df",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 100,
"avg_line_length": 36.628865979381445,
"alnum_prop": 0.6681677455671263,
"repo_name": "oceanobservatories/mi-instrument",
"id": "f339394dd385ece5fd8d91a0ff4a53589d32cdf1... |
__author__ = 'ar'
import os
import nibabel as nib
import matplotlib.pyplot as plt
import numpy as np
import keras.backend as K
from run00_common import BatcherOnImageCT3D
#########################################
def createLesionMask(pathInpNii, dirWithModel, pathOutNii=None, isDebug=False):
if not os.path.isfil... | {
"content_hash": "ab33ef7f0b73b4c8ab69128e5db7e83b",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 117,
"avg_line_length": 46.795918367346935,
"alnum_prop": 0.651984300043611,
"repo_name": "gakarak/BTBDB_ImageAnalysisSubPortal",
"id": "6cbe8f8a26e3a3f13083faeb502f952273662... |
import sys
import os
import getopt
import xml.etree.ElementTree as ET
#######################################################
#
# Helper Functions
#
#######################################################
def printline(file, depth, text):
"""print line with indent"""
for i in range(0, depth):
print ... | {
"content_hash": "730cb6d5a12ace655fc120e0f31e6bce",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 162,
"avg_line_length": 37.1318407960199,
"alnum_prop": 0.49581295638775374,
"repo_name": "david-pp/tinyworld",
"id": "49cdcc3ee741fed4494e2f740e5edc07f95e7331",
"size": "... |
from p4_core import *
import p4_imperatives
import p4_headers
import exclusive_conditions
import os
import ast
import inspect
import logging
from p4_hlir.util.OrderedSet import OrderedSet
from collections import OrderedDict, defaultdict
p4_match_type = p4_create_enum("p4_match_type", [
"P4_MATCH_EXACT",
"P4_M... | {
"content_hash": "9cec306396420ae0b5f0fb7ba8cde99c",
"timestamp": "",
"source": "github",
"line_count": 562,
"max_line_length": 105,
"avg_line_length": 33.26868327402135,
"alnum_prop": 0.5264480932769963,
"repo_name": "hanw/p4-hlir",
"id": "ba2140f640f6484d6ae50319a6021f9da67183f6",
"size": "19295"... |
"""
This is the client process that distributes n simulators
"""
import sys
import os
import re
import subprocess
import time
import signal
boost_path = "/afs/csail/group/carbon/tools/boost_1_38_0/stage/lib"
# spawn_job:
# start up a command across multiple machines
# returns an object that can be passed to poll_j... | {
"content_hash": "1083a4835e12a652d0ac2029ff7417f5",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 88,
"avg_line_length": 26.733870967741936,
"alnum_prop": 0.5656108597285068,
"repo_name": "mit-carbon/Graphite-Cycle-Level",
"id": "d87402e5e99bfaa167c0d18259213e2987a0e099"... |
import json
import math
from django.shortcuts import render
from django.contrib import messages
from django.template.loader import render_to_string
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse, JsonResponse, HttpResponseRedirect, HttpResponseNotFound
from django.conf import... | {
"content_hash": "a98d11b82f23aa81696af20c5a618c60",
"timestamp": "",
"source": "github",
"line_count": 257,
"max_line_length": 105,
"avg_line_length": 31.260700389105057,
"alnum_prop": 0.6844660194174758,
"repo_name": "google/starthinker",
"id": "afa363cb7506b5be9045f7938a740cf70c835261",
"size": ... |
import unittest
import pyresample
import satistjenesten
import rasterio
class TestUtils(unittest.TestCase):
def setUp(self):
self.gtiff_fh = rasterio.open('test_data/modis.tif')
def test_geotiff_to_areadef(self):
gtiff_meta_dict = self.gtiff_fh.meta
area_def = satistjenesten.utils.geotiff_meta_to_areadef(gti... | {
"content_hash": "4bc792b66a2f4267bf9426406778bfce",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 74,
"avg_line_length": 28.785714285714285,
"alnum_prop": 0.7890818858560794,
"repo_name": "mitkin/satistjenesten",
"id": "cc7b7b668258edd649600826a68355e0f1101095",
"size":... |
"""Utilities for writing code that runs on Python 2 and 3"""
# Copyright (c) 2010-2015 Benjamin Peterson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including with... | {
"content_hash": "39440cd6313974237ecaff649ffbba1c",
"timestamp": "",
"source": "github",
"line_count": 869,
"max_line_length": 98,
"avg_line_length": 34.63636363636363,
"alnum_prop": 0.6314495498189309,
"repo_name": "sauliusl/seaborn",
"id": "c374474da105607eb66b1514701655326b3a8e83",
"size": "300... |
from django.shortcuts import redirect
from django.utils.translation import ugettext_lazy as _
from urllib.parse import urlencode
from urllib.request import urlopen
from django.core.urlresolvers import reverse
from django.conf import settings as project_settings
from .base import BackendBase
class PaypalBackend(Backe... | {
"content_hash": "0595356c039dc3d079dad947e17d43d4",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 90,
"avg_line_length": 36.47142857142857,
"alnum_prop": 0.5742264003133568,
"repo_name": "CCrypto/ccvpn3",
"id": "6a395cb76601c3b4e3e2f8cd461d488ed5764d94",
"size": "7659"... |
import os
import sys
from glob import glob
import subprocess as subp
if not os.path.isdir('examples'):
raise IOError('Must run from root dir of none repo')
# check for venv activations
cmd = 'if [ -z "$VIRTUAL_ENV" ];then exit 1;else exit 0;fi'
if subp.call(cmd, shell=True) > 0:
raise IOError('Need to activat... | {
"content_hash": "ed1dd1bc2a0e41f731d7d56e1557e87c",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 59,
"avg_line_length": 24.545454545454547,
"alnum_prop": 0.6135802469135803,
"repo_name": "dongjoon-hyun/neon",
"id": "f4380fae3fc7debc228242d64cf8804bd7bd9de7",
"size": "9... |
import logging
from fabric import api
from fabric.state import env
LOG = logging.getLogger(__name__)
class LocalExecutionFailed(RuntimeError):
def __init__(self, msg, code):
super(LocalExecutionFailed, self).__init__()
self.code = code
self.message = msg
def run(cmd, capture_output=Tru... | {
"content_hash": "054efdc865d2fa15fa66110b9b1b7c7c",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 76,
"avg_line_length": 31.583333333333332,
"alnum_prop": 0.6263852242744063,
"repo_name": "SVilgelm/CloudFerry",
"id": "66e068b54afbecb7e39b1c77a426428121ab06a7",
"size": "... |
import pi3d
import sys
from Geometry import Geometry
from PaletteTypes import PaletteTypes
from ShaderTypes import ShaderTypes
from random import uniform
class Background(Geometry):
def __init__(self, camera):
super(Background, self).__init__(camera,
pi3d.EnvironmentCube(size=40.0, maptype='FACES'), ... | {
"content_hash": "ddb96ca573d8cb8fa653221b8c4a2315",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 74,
"avg_line_length": 29.071428571428573,
"alnum_prop": 0.7174447174447175,
"repo_name": "fredericofs/devart-template",
"id": "cf64fffb65e8b4d14e6b70ac0587d4a72dd3fcba",
"... |
"""MIT License
Copyright (c) 2017 Curtis La Graff
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish... | {
"content_hash": "0e9f4e9caab63cbc5d6e9884756061b9",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 78,
"avg_line_length": 23.85185185185185,
"alnum_prop": 0.6758540372670807,
"repo_name": "clagraff/beaver",
"id": "b43a729ba526ecc913af61c55c997f408fab0f8a",
"size": "2576... |
import re
import datetime
from utils import log as logging
from django.http import HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404
from apps.recommendations.models import RecommendedFeed
from apps.reader.models import UserSubscription
from apps.... | {
"content_hash": "d1900d313019a6952f156359785094c1",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 116,
"avg_line_length": 38.280701754385966,
"alnum_prop": 0.6551329055912007,
"repo_name": "huihoo/reader",
"id": "0bf55dbece6b53d9f030cb0b824649ec46a9809e",
"size": "4364... |
"""
Client side of the compute RPC API.
"""
from oslo.config import cfg
from oslo import messaging
from nova import exception
from nova.i18n import _
from nova import objects
from nova.objects import base as objects_base
from nova.openstack.common import jsonutils
from nova import rpc
rpcapi_opts = [
cfg.StrOpt(... | {
"content_hash": "a171f2752c3eb716f761b45fc01316c8",
"timestamp": "",
"source": "github",
"line_count": 929,
"max_line_length": 79,
"avg_line_length": 46.16899892357374,
"alnum_prop": 0.5984472266909142,
"repo_name": "vmthunder/nova",
"id": "34466ac3de09a78eb6c3274f9518e729d7e50bc0",
"size": "43497... |
import logging
import tempfile
import tvm
import pytest
from tvm.meta_schedule import ReplayTraceConfig, tune_tir
from tvm.meta_schedule.tune_context import TuneContext
from tvm.meta_schedule import schedule_rule, postproc
from tvm.meta_schedule.space_generator import PostOrderApply
from tvm.script import tir as T
fro... | {
"content_hash": "ee99b4b2153dca72abe76b9b0b787e99",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 89,
"avg_line_length": 33.80099502487562,
"alnum_prop": 0.5042684721813365,
"repo_name": "dmlc/tvm",
"id": "277fa2407bd15f1c190f5c03ee32cf54501205c6",
"size": "7615",
"b... |
from translate.convert import convert
import os
import sys
from py import test
try:
import psyco
except Exception:
psyco = None
class TestConvertCommand:
"""Tests running actual commands on files"""
convertmodule = convert
defaultoptions = {"progress": "none"}
if psyco:
defaultoptions["... | {
"content_hash": "bf59eefda939db847b3bba399d5a840b",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 149,
"avg_line_length": 41.04651162790697,
"alnum_prop": 0.5998111425873466,
"repo_name": "dbbhattacharya/kitsune",
"id": "31c1b6694105f3b6d1d866e328222bd5dc752563",
"size... |
"""
scitran.data.medimg.montage
===========================
Montage provides montage writing capabilities for MR datasets read by any subclass of MedImgReader.
Provides a MedImgWriter subclass for creating image pyramids.
"""
import os
import json
import math
import logging
import zipfile
import cStringIO
import nu... | {
"content_hash": "5ee3ddcecf8afb8de84b4a2ea66d1243",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 132,
"avg_line_length": 41.227106227106226,
"alnum_prop": 0.6127054642381163,
"repo_name": "scitran/data",
"id": "4fe7973054dac7f4c84b11e7a8f121eeea868065",
"size": "11335... |
"""Deepstream event handling."""
from __future__ import absolute_import, division, print_function, with_statement
from __future__ import unicode_literals
from deepstreampy.constants import actions
from deepstreampy.constants import topic as topic_constants
from deepstreampy.constants import event as event_constants
f... | {
"content_hash": "5cd5f2c12a282ec962e20b92ecec9b35",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 80,
"avg_line_length": 35.455357142857146,
"alnum_prop": 0.5507428859229413,
"repo_name": "YavorPaunov/deepstreampy",
"id": "1bbc16675a2f5aea15cb82cb075fde95938a9438",
"si... |
"""
rstblog.modules.tags
~~~~~~~~~~~~~~~~~~~~
Implements tagging.
:copyright: (c) 2010 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from math import log
from urlparse import urljoin
from jinja2 import contextfunction
from werkzeug.contrib.atom import AtomFeed
from rstblog... | {
"content_hash": "c2de0071589f37b975c8de63e9decd55",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 75,
"avg_line_length": 31.84873949579832,
"alnum_prop": 0.6163588390501319,
"repo_name": "mitsuhiko/rstblog",
"id": "ec10242ea664c2b93dc351d0ca3c6d2f67cc426e",
"size": "38... |
from autobahn.twisted.wamp import ApplicationSession
from twisted.internet.defer import inlineCallbacks
class Authorizer(ApplicationSession):
def onConnect(self):
self.join(self.config.realm, [u'ticket'], u'authorizer')
def onChallenge(self, challenge):
if challenge.method == u'ticket':
... | {
"content_hash": "9e1c11001aa67247a08052a3627ab415",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 122,
"avg_line_length": 35.61904761904762,
"alnum_prop": 0.6831550802139037,
"repo_name": "CSF-JH/crossbarexamples",
"id": "843552a1a10d8b7b978c67d36011624117003c49",
"size... |
"""
Base codec functions for bson.
"""
import struct
import cStringIO
import calendar, pytz
from datetime import datetime
import warnings
from abc import ABCMeta, abstractmethod
# {{{ Error Classes
class MissingClassDefinition(ValueError):
def __init__(self, class_name):
super(MissingClassDefinition, self).__init__... | {
"content_hash": "843cf35972c773069f15e0c4610c4224",
"timestamp": "",
"source": "github",
"line_count": 339,
"max_line_length": 86,
"avg_line_length": 29.38938053097345,
"alnum_prop": 0.689551339957844,
"repo_name": "andreas/bson",
"id": "a01436382ade5b484db2e726c6873d356d580f41",
"size": "10188",
... |
"""
The LayerMapping class provides a way to map the contents of OGR
vector files (e.g. SHP files) to Geographic-enabled Django models.
For more information, please consult the GeoDjango documentation:
https://docs.djangoproject.com/en/dev/ref/contrib/gis/layermapping/
"""
import sys
from decimal import Decimal,... | {
"content_hash": "ad413139d5aa7e037c275b78c7a8f1f3",
"timestamp": "",
"source": "github",
"line_count": 635,
"max_line_length": 118,
"avg_line_length": 43.418897637795276,
"alnum_prop": 0.5731384425664647,
"repo_name": "kaedroho/django",
"id": "6908d20ef759ceb5fc6e01937f056b2d37da7034",
"size": "27... |
"""Common expressions data structures in the IR."""
import tvm._ffi
from .base import Node
from . import _ffi_api
class BaseExpr(Node):
"""Base class of all the expressions."""
class PrimExpr(BaseExpr):
"""Base class of all primitive expressions.
PrimExpr is used in the low-level code
optimization... | {
"content_hash": "1ae0ddfd185e65e3e3012e0e9b7aec22",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 100,
"avg_line_length": 25.696,
"alnum_prop": 0.5868617683686177,
"repo_name": "tqchen/tvm",
"id": "f6bf975621e35c078b7272488cef280d8ccb2395",
"size": "3997",
"binary": ... |
from .middleware import create_app
from .config import ServerConfig
from .server import TAXIIServer
from .utils import configure_logging
# This module is also used as a Gunicorn configuration module, i.e. passed
# as ``--config python:opentaxii.http``. ``logconfig_dict`` module-level
# variable is recognised by Gunic... | {
"content_hash": "b7d9cca61bf489b548b105a24d5b1d71",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 74,
"avg_line_length": 29.7,
"alnum_prop": 0.6790123456790124,
"repo_name": "EclecticIQ/OpenTAXII",
"id": "7a57b2825966ad3cac9c6ac0e145d1724382e8f7",
"size": "892",
"bina... |
"""Zookeeper based queue implementations.
:Maintainer: None
:Status: Possibly Buggy
.. note::
This queue was reported to cause memory leaks over long running periods.
See: https://github.com/python-zk/kazoo/issues/175
"""
import uuid
from kazoo.exceptions import NoNodeError, NodeExistsError
from kazoo.prot... | {
"content_hash": "fc1da033cbf8805d2cdebda0858d0012",
"timestamp": "",
"source": "github",
"line_count": 353,
"max_line_length": 79,
"avg_line_length": 35.22096317280453,
"alnum_prop": 0.5720260596798842,
"repo_name": "kawamon/hue",
"id": "9cf22b6cf0d0acec014a3a4ebe35fee456b165ae",
"size": "12433",
... |
from deepdetector import DeepDetector
from simpledetector import SimpleDetector
from facerecognizer import FaceRecognizer
from annotatedphotowriter import AnnotatedPhotoWriter
from annotatedframewriter import AnnotatedFrameWriter
from annotatedvideowriter import AnnotatedVideoWriter
from jsonreportwriter import JSONRep... | {
"content_hash": "6ec982d40b8844e89748960cb87f5e0d",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 110,
"avg_line_length": 37.5863453815261,
"alnum_prop": 0.566299818356662,
"repo_name": "pathbreak/deepvisualminer",
"id": "ea7cc8f7ce88e33c4052dffea6141dad67c7e91b",
"siz... |
from zeus.models import ItemStat
def test_build_details(
client, db_session, default_login, default_repo, default_build, default_repo_access
):
db_session.add(ItemStat(item_id=default_build.id, name="tests.count", value="1"))
resp = client.get(
"/api/repos/{}/builds/{}".format(
defaul... | {
"content_hash": "737ae9f497e2b81b693b03b64d7e27eb",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 87,
"avg_line_length": 31.166666666666668,
"alnum_prop": 0.6310160427807486,
"repo_name": "getsentry/zeus",
"id": "eb455ec5450fb7a0e99accdbb6087a3f56d43967",
"size": "561",... |
from __future__ import absolute_import, unicode_literals, print_function, division
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.auth.decorators import login_required
from django.conf.urls import include, url
from django.contrib import admin
from django.shortcuts impor... | {
"content_hash": "3eed0a7b5187b75de62d0adb5155e60f",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 112,
"avg_line_length": 34.96341463414634,
"alnum_prop": 0.6916637600279038,
"repo_name": "ropable/biosys",
"id": "85a2edafedc152768c1db9b00d765dd2185300a1",
"size": "2867"... |
__author__ = 'jordsti'
import item
import c_library
class decorated_button(item.item):
def __init__(self):
item.item.__init__(self)
self.obj = self.lib.DecoratedButton_new()
def set_caption(self, text):
self.lib.DecoratedButton_setCaption(self.obj, text)
def get_caption(self):
... | {
"content_hash": "d9eac41a26c9afaf22785927f0e5f15b",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 78,
"avg_line_length": 26.4,
"alnum_prop": 0.6641414141414141,
"repo_name": "jordsti/stigame",
"id": "c23753133084d2878cbc7447a7d449d40bad9b7d",
"size": "396",
"binary": ... |
import os
import shutil
import time
from threading import Timer, Event as TEvent
from apptools.preferences.preference_binding import bind_preference
from numpy import copy
from skimage.color import gray2rgb
from skimage.draw import circle_perimeter, line
# ============= enthought library imports =====================... | {
"content_hash": "2b087c3edffdd0e4fc9e6cbb8b9791e7",
"timestamp": "",
"source": "github",
"line_count": 1063,
"max_line_length": 112,
"avg_line_length": 34.24270931326435,
"alnum_prop": 0.5089285714285714,
"repo_name": "NMGRL/pychron",
"id": "a14ff2afd388ec101e61c966ae676a89cf6a840f",
"size": "3713... |
"""This tutorial introduces restricted boltzmann machines (RBM) using Theano.
Boltzmann Machines (BMs) are a particular form of energy-based model which
contain hidden variables. Restricted Boltzmann Machines further restrict BMs
to those without visible-visible and hidden-hidden connections.
"""
import time
try:
... | {
"content_hash": "f31498a4cfb3b41ced3194783be4d7cb",
"timestamp": "",
"source": "github",
"line_count": 540,
"max_line_length": 79,
"avg_line_length": 38.16111111111111,
"alnum_prop": 0.5959625370019896,
"repo_name": "h-mayorquin/mnist_dl_ann_project",
"id": "e5d48e08f7ec746a9ffcd491040c1256366df6ab"... |
from functools import wraps
from waffle.compat import CLASS_TYPES
from waffle.models import Flag, Switch, Sample
__all__ = ['override_flag', 'override_sample', 'override_switch']
class _overrider(object):
def __init__(self, name, active):
self.name = name
self.active = active
def __call__(... | {
"content_hash": "5bd752696d9e5c29a30b0b3361c46963",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 79,
"avg_line_length": 25.970588235294116,
"alnum_prop": 0.5784258210645526,
"repo_name": "crccheck/django-waffle",
"id": "d4e428205c47ad4e46503d46ee1f09e3d658e242",
"size... |
"""Interface to TerminalInteractiveShell for PyDev Interactive Console frontend
for IPython 0.11 to 1.0+.
"""
from __future__ import print_function
import os
import sys
import codeop
import traceback
from IPython.core.error import UsageError
from IPython.core.interactiveshell import InteractiveShell, InteractiveS... | {
"content_hash": "24351da36d73839cc96f63da3c8dc641",
"timestamp": "",
"source": "github",
"line_count": 434,
"max_line_length": 143,
"avg_line_length": 40.8778801843318,
"alnum_prop": 0.584070796460177,
"repo_name": "smmribeiro/intellij-community",
"id": "0246c6d2e31be69a34bd3aad748a1bc0b6375c1d",
... |
"""
A docutils node which simply shows a counter.
"""
from docutils.nodes import Text, target
from docutils.parsers.rst import roles
values = {}
class CounterNode(Text):
children = ()
def __init__(self, data, rawsource=''):
if ':' in data:
self.name, value = [s.lower() for s in data.sp... | {
"content_hash": "94b2d7b073e0a8596defaa8c09090c77",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 81,
"avg_line_length": 23.11111111111111,
"alnum_prop": 0.5949519230769231,
"repo_name": "aquavitae/rst2pdf",
"id": "aaa9b387eaf460530487e7119fd6e32e9cb7a162",
"size": "857... |
"""
Ansible module for yum-based systems determining if multiple releases
of an OpenShift package are available, and if the release requested
(if any) is available down to the given precision.
For Enterprise, multiple releases available suggest that multiple repos
are enabled for the different releases, which may caus... | {
"content_hash": "b3aaa45f78239a76086f3bce1aab8fb1",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 102,
"avg_line_length": 41.8582995951417,
"alnum_prop": 0.6697939839442886,
"repo_name": "rhdedgar/openshift-tools",
"id": "c8769b511334af42cc29c8d046b89170202aa4f5",
"siz... |
import flask
import api
import auth
import forms
import model
import task
import util
from main import app
@app.route('/cart/', methods=['GET', 'POST'])
@auth.login_required
def cart():
order, product_dbs = api.v1.recalculate_cart()
if flask.request.method == 'GET' or order['price'] < 5000:
return flask.ren... | {
"content_hash": "095a1b7e13500208bae64b9283c946de",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 79,
"avg_line_length": 28.270833333333332,
"alnum_prop": 0.6241709653647752,
"repo_name": "gmist/five-studio2",
"id": "3892a06eb176d0ab16637ec819a802ec6521a5f9",
"size": "... |
"""WSGI app setup."""
import os
import sys
# Add lib as primary libraries directory, with fallback to lib/dist
# and optionally to lib/dist.zip, loaded using zipimport.
lib_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'lib')
if lib_path not in sys.path:
sys.path[0:0] = [
lib_path,
... | {
"content_hash": "1a28b2b3db02b5038c1143ccf41445cd",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 74,
"avg_line_length": 28.155555555555555,
"alnum_prop": 0.6898184688239937,
"repo_name": "moraes/tipfy",
"id": "218cc861aeeb9c8bc1bd8f9da314bdc028c10246",
"size": "1291",
... |
from ai.h2o.sparkling.ml.params.H2OTypeConverters import H2OTypeConverters
from ai.h2o.sparkling.ml.params.H2OBaseMOJOParams import H2OBaseMOJOParams
from pyspark.ml.param import *
import warnings
class H2OAlgorithmMOJOParams(H2OBaseMOJOParams):
predictionCol = Param(
Params._dummy(),
"predictionC... | {
"content_hash": "1efc8b2e2778b7cceb4ed47b88621f0a",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 106,
"avg_line_length": 33.554054054054056,
"alnum_prop": 0.6967378171566653,
"repo_name": "h2oai/sparkling-water",
"id": "c47d600bc3d05c21de948f6f762c7b0321b58c8c",
"size"... |
import json
from tempfile import NamedTemporaryFile
from json.decoder import JSONDecodeError
from neo.Utils.NeoTestCase import NeoTestCase
from neo.UserPreferences import UserPreferencesHolder, PREFERENCES_DEFAULT
class PreferencesTestCase(NeoTestCase):
def test_prefs_json_nonexistant(self):
prefs = UserP... | {
"content_hash": "8289a8f9d689e9db42027e80e34c137d",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 102,
"avg_line_length": 44.04347826086956,
"alnum_prop": 0.6525172754195459,
"repo_name": "hal0x2328/neo-python",
"id": "475162eae7da417548ce46ab2275f4a9e52eece2",
"size": ... |
import itertools
from collections import namedtuple
import os.path as p
from pathlib import Path
from flask import safe_join
import abc
import yaml
import os
from landmarkerio import TEMPLATE_DINAME, FileExt
Group = namedtuple('Group', ['label', 'n', 'index'])
def parse_connectivity(index_lst, n):
index = []
... | {
"content_hash": "76e01a2dc4471257a4c602e0ace10e1f",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 79,
"avg_line_length": 30.789915966386555,
"alnum_prop": 0.5659115720524017,
"repo_name": "jabooth/landmarkerio-server",
"id": "f835234c91dc5da9f54f76312702df6bb5b494f0",
... |
from __future__ import unicode_literals
default_app_config = 'casepro.msgs.apps.Config'
| {
"content_hash": "599b6ec1359deb8373baf950686cdc08",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 47,
"avg_line_length": 29.666666666666668,
"alnum_prop": 0.7640449438202247,
"repo_name": "xkmato/casepro",
"id": "bea0575a7f6b1725ddef6bdd4095399bb992c04e",
"size": "89",
... |
import MySQLdb
import collections
import sys
import json
from flask import Flask, jsonify, abort, make_response, request
from flask.ext.httpauth import HTTPBasicAuth
from Lamp import Lamp
from Config import Config
app = Flask(__name__)
auth = HTTPBasicAuth()
#----------------------------------------------------------... | {
"content_hash": "12d47249504ec2de735afc280e2b16a1",
"timestamp": "",
"source": "github",
"line_count": 545,
"max_line_length": 320,
"avg_line_length": 30.146788990825687,
"alnum_prop": 0.5202678027997566,
"repo_name": "crundberg/CR-Smart-Home",
"id": "6c427117bca6bcc9e815806b9429230455f43a1e",
"si... |
from twisted.words.protocols import irc
from txircd.channel import IRCChannel
from txircd.modbase import Command
class SajoinCommand(Command):
def onUse(self, user, data):
data["targetuser"].join(data["targetchan"])
def processParams(self, user, params):
if user.registered > 0:
... | {
"content_hash": "bd9b3166747c2bdeadd834ec0a99a92c",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 122,
"avg_line_length": 35.43181818181818,
"alnum_prop": 0.568313021167415,
"repo_name": "DesertBus/txircd",
"id": "171f7169495f33f75124ef2db37312405a714eca",
"size": "1559... |
import argparse
import sys
from textwrap import fill
from . import generate_barcode
from .data import barcode_types
supported_barcode_types = "Supported barcode types are:\n" + fill(
", ".join(sorted(barcode_types)), initial_indent=" ", subsequent_indent=" "
)
def parse_opt(x):
if "=" in x:
re... | {
"content_hash": "2fbe2558b1a9a43ea01deb98b8b32cc1",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 87,
"avg_line_length": 26.324324324324323,
"alnum_prop": 0.6113963039014374,
"repo_name": "YPlan/treepoem",
"id": "bae0957b745a8ee09390ad574643796f432d7e5d",
"size": "1948"... |
from resrc.userprofile.models import Profile
def karma_rate(user_pk, diff):
user = Profile.objects.get(user__pk=user_pk)
if user.karma:
user.karma += diff
else:
user.karma = diff
user.save()
| {
"content_hash": "5690ed8fa5abeeaceb16dc776b46e994",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 48,
"avg_line_length": 22.5,
"alnum_prop": 0.6355555555555555,
"repo_name": "vhf/resrc",
"id": "689acb1f81f3ecad919a7c9facf92ca68c0e2884",
"size": "250",
"binary": false,... |
import archinfo
import logging
l = logging.getLogger(__name__)
class MinidumpThreadManager:
def __init__(self, loader, arch, **kwargs): # pylint: disable=unused-argument
self.loader = loader
self.arch = arch
self.threads = [MinidumpThread(loader, arch, loader.main_object.thread_registers(... | {
"content_hash": "d3225ed23f4839adda92854d8a8ca1b8",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 133,
"avg_line_length": 38.3235294117647,
"alnum_prop": 0.6431312356101304,
"repo_name": "angr/cle",
"id": "c02db562d57c11c2e46fe18759d32a67572b767f",
"size": "1303",
"bi... |
"""
parses a file system and returns a data structure of the results in-memory
"""
# TODO: need to come up woth a solution to handle common cases where file-system is larger than given memory.
class ftree(object):
"""
a basic n-dimensional tree that is representative of the file system
"""
node_map = [] # used t... | {
"content_hash": "f806df6d0023545b437fc5bda298db5b",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 110,
"avg_line_length": 27.015151515151516,
"alnum_prop": 0.683679192372406,
"repo_name": "baallezx/diffos",
"id": "996145fa9b7d2774b27c4ad0e8cd6afe30ffa6ba",
"size": "1783... |
from lib import config, helpers
class Cymon(object):
def __init__(self):
# lists of values that can be returned
self.ip_list = []
self.domain_list = []
self.hash_list = []
self.url_list = []
self.score_list = []
self.imphash_list = []
# get helping ... | {
"content_hash": "6a0d775a940b5ae5880327f663bdc4e3",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 117,
"avg_line_length": 45.10377358490566,
"alnum_prop": 0.5369169629784564,
"repo_name": "QTek/QRadio",
"id": "a6c6c4d55be50c37c9d203765900135574839559",
"size": "5970",
... |
from django import forms
class CommentForm(forms.Form):
username = forms.CharField(max_length=200, required=True, widget=forms.TextInput(attrs={'class': 'form-control'}))
email = forms.EmailField(label="Email", required=True, widget=forms.EmailInput(attrs={'class': 'form-control'}))
website = forms.URLFie... | {
"content_hash": "813a29fa3f39503636f7a50be8cade46",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 124,
"avg_line_length": 69.66666666666667,
"alnum_prop": 0.7272727272727273,
"repo_name": "marthaurion/blog_django",
"id": "5dbd8e56c29c68f06bedf5d623a087fedaa92ae0",
"size"... |
import sys
print("runmod1: passed %s" % sys.argv[1])
| {
"content_hash": "53d0d69766cda21dfe299b4c6419a57f",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 41,
"avg_line_length": 26.5,
"alnum_prop": 0.6792452830188679,
"repo_name": "blueyed/coveragepy",
"id": "cb1f7e999152fc5e4f937390b5538afb1d81c065",
"size": "251",
"binary"... |
import urllib2,json,sys,re
def firstautocomp(kw):
"""
Get the first autocomplete result
for kw.
"""
webpage="http://suggestqueries.google.com/complete/search?client=chrome&q="\
+kw
result=json.loads(urllib2.urlopen(webpage).read())
if len(result[1]):
return res... | {
"content_hash": "4a91e8b137c4aa07f15d853a8f4e75cc",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 80,
"avg_line_length": 32.03225806451613,
"alnum_prop": 0.5760322255790534,
"repo_name": "ckjbgames/misc-code",
"id": "20a88dd34d7bbaabe113237aa64ac803dc57723b",
"size": "1... |
"""Save and retrieve the compiler settings into a text file.
Copyright (c) 2017 carlosperate https://github.com/carlosperate/
Licensed under the Apache License, Version 2.0 (the "License"):
http://www.apache.org/licenses/LICENSE-2.0
The ServerCompilerSettings is a singleton class maintained in memory, and
the the... | {
"content_hash": "37a60451a59d704af582fbea94fbd5a2",
"timestamp": "",
"source": "github",
"line_count": 624,
"max_line_length": 79,
"avg_line_length": 42.00480769230769,
"alnum_prop": 0.5775819312502385,
"repo_name": "drissfr2017/BlocklyDriss",
"id": "f6beb3843c55f22c0808b753c97ccbfa766fc706",
"siz... |
from exabgp.util import coroutine
class UnexpectedData (Exception):
def __init__(self, line, position, token):
super(UnexpectedData, self).__init__('Unexpected data at line %d position %d : "%s"' % (line,position,token))
@coroutine.join
def unescape(s):
start = 0
while start < len(s):
pos = s.find('\\', start)... | {
"content_hash": "5525464e20e092e4a24b7ab2d454db13",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 111,
"avg_line_length": 19.868613138686133,
"alnum_prop": 0.5547391623806025,
"repo_name": "dwcarder/sdn-ix-demo",
"id": "05ea41de769f0af05cb755cb65f9b192e19883f3",
"size"... |
import datetime
from django.utils import timezone
def compute_age(born):
assert isinstance(born, datetime.date)
today = timezone.datetime.today()
age = today.year - born.year - ((today.month, today.day) < (born.month, born.day))
return age
| {
"content_hash": "352c5a15596ba6757ebcb5b833072f08",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 86,
"avg_line_length": 23.636363636363637,
"alnum_prop": 0.6961538461538461,
"repo_name": "moas/sketchbadges",
"id": "e34776ea88676f1c46614f15bfcf242dff7bbd16",
"size": "26... |
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('testreport', '0003_auto_20141023_1423'),
]
operations = [
migrations.AddField(
model_name='launch',
name='st... | {
"content_hash": "1396f62b1ca2fca77db4c4a1397a6ef5",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 117,
"avg_line_length": 27.346153846153847,
"alnum_prop": 0.5907172995780591,
"repo_name": "2gis/badger-api",
"id": "46079f4669e351b0da1c7bbc5bd17a8cbfd5e4a0",
"size": "735... |
import gettext
import netaddr
import re
import six
import socket
from otopi import base, util
from otopi import plugin as oplugin
from ovirt_setup_lib import dialog
def _(m):
return gettext.dgettext(message=m, domain='ovirt-setup-lib')
@util.export
class Hostname(base.Base):
_DOMAIN_RE = re.compile(
... | {
"content_hash": "4acc475e02bf46db436d0fac79abee24",
"timestamp": "",
"source": "github",
"line_count": 539,
"max_line_length": 79,
"avg_line_length": 29.92578849721707,
"alnum_prop": 0.44389336639801613,
"repo_name": "oVirt/ovirt-setup-lib",
"id": "b3d54caea095d71b8f7f4f09c00380a0ee3104af",
"size"... |
import unittest
import numpy as np
from lintrain import Trainer
from lintrain import ParallelTrainer
class LinTrainTest(unittest.TestCase):
"""
Must be run from outside of the LinTrain folder, otherwise parallel library fails due to relative paths.
"""
def test_trainer(self):
# generate random... | {
"content_hash": "5e2dab071c003a74e7393b850240e0d7",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 108,
"avg_line_length": 31.132530120481928,
"alnum_prop": 0.6261609907120743,
"repo_name": "nathanntg/lin-train",
"id": "5b11bff8712bad88d6d57aeabe1b39435f1c2f9c",
"size": ... |
"""
Django settings for app project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import... | {
"content_hash": "31b49d56a66a6fd84ce0e94295f86434",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 71,
"avg_line_length": 24.31578947368421,
"alnum_prop": 0.7168831168831169,
"repo_name": "kaeawc/django-auth-example",
"id": "574ddcb2bdc8034fa54fc0fa200d563d2f08679a",
"si... |
"""
Functionalities for cross-validating words-as-classifiers reference resolution (not yet finished!).
"""
__author__ = "Todd Shore <errantlinguist+github@gmail.com>"
__copyright__ = "Copyright 2017 Todd Shore"
__license__ = "Apache License, Version 2.0"
import csv
import itertools
from collections import namedtuple... | {
"content_hash": "b7ca176763ac6047fc18fe09ad65dfad",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 164,
"avg_line_length": 45.11711711711712,
"alnum_prop": 0.7434105431309904,
"repo_name": "errantlinguist/tangrams-analysis",
"id": "060d1082e4d609ebbb503e1e297bbf40969c868a... |
from django.test import TestCase
from .models import TestResource, RelatedResource1, RelatedResource2
class NestedFieldsTest(TestCase):
def setUp(self):
self.related_resource_1 = RelatedResource1.objects.create(name="Related-Resource1")
self.nested_related_resource_1_1 = RelatedResource1.objects.... | {
"content_hash": "6bf3c1df82c3eb6156d0dfd52e5f7c49",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 124,
"avg_line_length": 70.98181818181818,
"alnum_prop": 0.701844262295082,
"repo_name": "seebass/drf-nested-fields",
"id": "3d34db27aa6b776d472031cd9a9856a7512b8040",
"siz... |
description = '''
Large non-Mersenne prime
Problem 97
The first known prime found to exceed one million digits was discovered in 1999, and is a Mersenne prime of the form 26972593−1; it contains exactly 2,098,960 digits. Subsequently other Mersenne primes, of the form 2p−1, have been found which contain more digits.
H... | {
"content_hash": "0f4051dfee0903915466b095eca24788",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 263,
"avg_line_length": 35.1875,
"alnum_prop": 0.7442273534635879,
"repo_name": "mbuhot/mbuhot-euler-solutions",
"id": "bbac77f4a21d3652e19f81ecad919523eda5b3c1",
"size": "... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))
# -- General con... | {
"content_hash": "c5bdd4c224cd802eb355d00668f0112e",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 79,
"avg_line_length": 32.857142857142854,
"alnum_prop": 0.6978818283166109,
"repo_name": "dwiel/tensorflow_hmm",
"id": "709540cf9049023e734f8e3de606d61ef4e2d15c",
"size":... |
import importlib
import logging
from pathlib import Path
logger = logging.getLogger(__name__)
def main(args, result_path: Path, scenario_path: Path) -> bool:
error = False
for module in ('seqdiag', 'matplotlib', 'numpy', 'pandas'):
try:
importlib.import_module(module)
except Impor... | {
"content_hash": "71157d6dc7e2c4fa258194a3cbb77566",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 63,
"avg_line_length": 24.914285714285715,
"alnum_prop": 0.6009174311926605,
"repo_name": "reisub-de/dmpr-simulator",
"id": "8be95686c0e24ed8640d09d055b388bcdb9a992f",
"siz... |
from .. utils import TranspileTestCase, BuiltinFunctionTestCase
class MemoryviewTests(TranspileTestCase):
pass
class BuiltinMemoryviewFunctionTests(BuiltinFunctionTestCase, TranspileTestCase):
functions = ["memoryview"]
not_implemented = [
'test_bool',
'test_bytearray',
'test_by... | {
"content_hash": "99584d839aa8d04e3ac3df71e5cb1dc6",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 81,
"avg_line_length": 22.2,
"alnum_prop": 0.56006006006006,
"repo_name": "freakboy3742/voc",
"id": "608c5d76b87c869bb9a277ffbc14c78dac47de91",
"size": "666",
"binary": f... |
from traits.api import HasTraits, List, Str, Instance
from apptools.preferences.api import PreferencesHelper
###############################################################################
# `PreferencesMirror` class.
###############################################################################
class PreferencesMir... | {
"content_hash": "c67907ac14cb0ca51287cccd1787ae49",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 79,
"avg_line_length": 38.74,
"alnum_prop": 0.47083118224057824,
"repo_name": "dmsurti/mayavi",
"id": "68840163ccc9094931b2806f6e9e9cc095083be0",
"size": "2098",
"binary"... |
"""Support for the Philips Hue lights."""
import asyncio
from datetime import timedelta
import logging
from time import monotonic
import random
import aiohue
import async_timeout
from homeassistant.components import hue
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_EFFECT, AT... | {
"content_hash": "65cc5c5c1359ca76213548af126cd8fa",
"timestamp": "",
"source": "github",
"line_count": 422,
"max_line_length": 79,
"avg_line_length": 34.60900473933649,
"alnum_prop": 0.5982197877439233,
"repo_name": "DavidLP/home-assistant",
"id": "a79b0e3ee23a586c86cb2314b454c8624b346df6",
"size"... |
from django.test import TestCase
from django.core.urlresolvers import resolve
from django.template.loader import render_to_string
from lists.views import home_page
from django.http import HttpRequest
class HomePageTest(TestCase):
def test_root_url_resolves_to_home_page_view(self):
found = resolve('/')
... | {
"content_hash": "7de75c12bbcd6c2ddcfaa217e5954beb",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 68,
"avg_line_length": 30.555555555555557,
"alnum_prop": 0.6509090909090909,
"repo_name": "liulei2015/virtualRobot",
"id": "c136407bede8cf213aa666d4b7e47fcdc2c88ae5",
"size... |
"""
Convenience class for building sequential deep networks.
"""
from __future__ import division
from __future__ import unicode_literals
import warnings
import tensorflow as tf
from deepchem.models.tensorgraph.tensor_graph import TensorGraph
from deepchem.models.tensorgraph.layers import Feature
from deepchem.models.t... | {
"content_hash": "968b06006395a91d22580a2c4e6a967f",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 84,
"avg_line_length": 32.410071942446045,
"alnum_prop": 0.6526082130965594,
"repo_name": "Agent007/deepchem",
"id": "75ac1bb0c9a6940fc64d3134e689d14041e4c89e",
"size": "4... |
import pytest
import pymysql
from mycli.main import format_output
from os import getenv
# TODO: should this be somehow be divined from environment?
USER, HOST = 'root', 'localhost'
PASSWORD = getenv('PASSWORD')
def db_connection(dbname=None):
conn = pymysql.connect(user=USER, host=HOST, database=dbname, password=... | {
"content_hash": "e2b9e62f3677352393a0d712fa1911e5",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 84,
"avg_line_length": 28.35,
"alnum_prop": 0.6596119929453262,
"repo_name": "steverobbins/mycli",
"id": "484ba505a3f072dc4edf0ee38413625ce61cbe68",
"size": "1134",
"bina... |
import os
import stat
import sys
import tempfile
import unittest
from ds3.ds3 import *
from ds3.libds3 import LibDs3JobStatus
bucketName = "python_test_bucket"
resources = ["beowulf.txt", "sherlock_holmes.txt", "tale_of_two_cities.txt", "ulysses.txt"]
unicodeResources = [unicode(filename) for filename in resources]
... | {
"content_hash": "16fa311ecca32f25bad52524f31e8342",
"timestamp": "",
"source": "github",
"line_count": 537,
"max_line_length": 221,
"avg_line_length": 40.687150837988824,
"alnum_prop": 0.6608082749782599,
"repo_name": "chanchett/ds3_python_sdk",
"id": "6ce55b660064cede30452d7db1b23c8b00b8799b",
"s... |
"""
__create_time__ = '13-10-17'
__author__ = 'Madre'
"""
from django.contrib.auth.models import User
from django.db import models
from django.core.urlresolvers import reverse
from django.template.defaultfilters import slugify
class Topic(models.Model):
name = models.CharField(max_length=60, unique=True)
slug... | {
"content_hash": "cf72341858ab552ef6f87adf127bec2b",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 108,
"avg_line_length": 35.680851063829785,
"alnum_prop": 0.6535480023852117,
"repo_name": "madre/PersonalWeb",
"id": "c06eddc627f504c9e9635750999c1aefed171b29",
"size": "3... |
import datetime
import mock
from dateutil.relativedelta import relativedelta
from django.contrib.auth.models import Permission
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils import timezone
from timepiece.contracts.mo... | {
"content_hash": "1cac0163f81c449e75ba31be3256dbcd",
"timestamp": "",
"source": "github",
"line_count": 350,
"max_line_length": 95,
"avg_line_length": 40.90571428571429,
"alnum_prop": 0.6495075784032968,
"repo_name": "caktus/django-timepiece",
"id": "8157819b4740df623e989477356ac7151b9696b2",
"size... |
import sys
from zoo.pipeline.api.keras2.base import ZooKeras2Layer
if sys.version >= '3':
long = int
unicode = str
class LocallyConnected1D(ZooKeras2Layer):
"""
Locally-connected layer for 1D inputs which works similarly to the TemporalConvolution
layer, except that weights are unshared, that is, ... | {
"content_hash": "13ed5fd572e4c5a1ef673136e7ad9ce7",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 92,
"avg_line_length": 47.435483870967744,
"alnum_prop": 0.5426725603536212,
"repo_name": "intel-analytics/analytics-zoo",
"id": "63618356302163590e2a17ed9c6fa2b3aa33d24d",
... |
from unittest import mock
from nova import exception
from nova.tests.unit.virt.hyperv import test_base
from nova.virt.hyperv import serialconsolehandler
from nova.virt.hyperv import serialconsoleops
class SerialConsoleOpsTestCase(test_base.HyperVBaseTestCase):
def setUp(self):
super(SerialConsoleOpsTestC... | {
"content_hash": "67206d729a1d890019b371c3f99a0ef5",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 79,
"avg_line_length": 41,
"alnum_prop": 0.6521951219512195,
"repo_name": "openstack/nova",
"id": "4a4b7c8e4f28acfaa736af6268be6d8f3e4ba491",
"size": "4739",
"binary": f... |
from unittest import TestCase
from nose.tools import assert_equal, raises, assert_true
from wlauto.core.extension import Extension, Parameter, Param, ExtensionMeta, Module
from wlauto.utils.types import list_of_ints
from wlauto.exceptions import ConfigError
class MyMeta(ExtensionMeta):
virtual_methods = ['vali... | {
"content_hash": "616e50f36ebb97d01cd734f1003ec103",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 92,
"avg_line_length": 24.650557620817843,
"alnum_prop": 0.6190619816015684,
"repo_name": "rockyzhang/workload-automation",
"id": "41794f93c6c9d9f5e125e383a61a85e3d33bbc97",... |
import sys
import argparse
from os import getenv
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from taxcli.config import config
CONFIG = config[getenv('TAXCLI_CONFIG', 'default')]
engine = create_engine(CONFIG.sql_uri)
base = declarative_base(bind=engine)
import taxcli.... | {
"content_hash": "1d25e11af507d7f86bcb04074fcf85bb",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 82,
"avg_line_length": 32.674157303370784,
"alnum_prop": 0.6605914718019257,
"repo_name": "Nukesor/taxcli",
"id": "9b2d24d58bbf1e57567054e47083d1bfc9a10e53",
"size": "2908"... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/component/droid/shared_struct_maint_module_2.iff"
result.attribute_template_id = -1
result.stfName("craft_droid_ingredients_n","struct_maint_module_2")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS... | {
"content_hash": "5323038d0329616a252fb387dd963a62",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 85,
"avg_line_length": 26.384615384615383,
"alnum_prop": 0.7113702623906706,
"repo_name": "anhstudios/swganh",
"id": "af0543c00f30d7275a670c35eee87d051d95fd74",
"size": "48... |
import logging
import re
import urllib
import netaddr
from neutron.i18n import _LI, _LE
from novaclient import exceptions as nova_exc
from oslo.serialization import jsonutils
from oslo.utils import excutils
import requests
from vyatta.common import config
from vyatta.common import exceptions as v_exc
from vyatta.comm... | {
"content_hash": "4e2fbb3f4cd88e8b23e961eedd2fd714",
"timestamp": "",
"source": "github",
"line_count": 1032,
"max_line_length": 79,
"avg_line_length": 37.917635658914726,
"alnum_prop": 0.5559019703048734,
"repo_name": "Brocade-OpenSource/vrouter-plugins",
"id": "bfd43fb3af7803f7a7dd4a8c70b5a93dd710e... |
"""Test the VLC media player Telnet config flow."""
from __future__ import annotations
from typing import Any
from unittest.mock import patch
from aiovlc.exceptions import AuthError, ConnectError
import pytest
from homeassistant import config_entries
from homeassistant.components.hassio import HassioServiceInfo
from... | {
"content_hash": "307565b404a1964c8ff20ce08e3bf4d9",
"timestamp": "",
"source": "github",
"line_count": 342,
"max_line_length": 88,
"avg_line_length": 31.359649122807017,
"alnum_prop": 0.5940326340326341,
"repo_name": "w1ll1am23/home-assistant",
"id": "f5059517e3e36a6e7de3e6e61211ecf939b88d73",
"si... |
"""Module grouping tests for the
pydov.types.interpretaties.InformeleStratigrafie class."""
from pydov.types.interpretaties import InformeleStratigrafie
from pydov.util.dovutil import build_dov_url
from tests.abstract import AbstractTestTypes
location_wfs_getfeature = \
'tests/data/types/interpretaties/informele_s... | {
"content_hash": "49cfa8521ce547c4e251797b75cf7775",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 78,
"avg_line_length": 39.75,
"alnum_prop": 0.7163522012578616,
"repo_name": "DOV-Vlaanderen/pydov",
"id": "45686bd5cc73b31adab5cf9832f2850bf85c3268",
"size": "1590",
"bi... |
from unittest import main
from json import loads
from qiita_pet.test.tornado_test_base import TestHandlerBase
class TestOntologyHandler(TestHandlerBase):
def test_patch(self):
arguments = {'op': 'add', 'path': 'ENA', 'value': 'new-term'}
response = self.patch('/ontology/', data=arguments)
... | {
"content_hash": "c4077d61f808d1fb3cea57cecc9a9c63",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 69,
"avg_line_length": 31.25,
"alnum_prop": 0.642,
"repo_name": "squirrelo/qiita",
"id": "64eecf4a3b7332f1c703b3b79fbd39a51474d4da",
"size": "850",
"binary": false,
"co... |
"""
Sort a linked list in O(n log n) time using constant space complexity.
"""
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
"""
:type head: ListNode
:rtype: ListNode
"""
def sortList(self, head):
# base case
if head == None... | {
"content_hash": "ea7502fe83c28b40a54b12caf8f639e6",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 70,
"avg_line_length": 17.655172413793103,
"alnum_prop": 0.6373697916666666,
"repo_name": "Ahmed--Mohsen/leetcode",
"id": "a82deecfa5fba8cf87e0b48d4a27abd46a735959",
"size"... |
"""
Copyright 2014 CSIRO
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed u... | {
"content_hash": "dfa1f963d5f1a78ebe566c40d4e94e34",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 236,
"avg_line_length": 35.88461538461539,
"alnum_prop": 0.6420150053590568,
"repo_name": "CWSL/cwsl-mas",
"id": "29e8607724de168f836799212f9f140aeb60b5b8",
"size": "6531"... |
import unittest.mock
# noinspection PyUnresolvedReferences
from test_client import client, flask_app
def test_empty(client):
r = client.get('/')
# print("Got {}".format(r))
assert r is not None
def test_register_validation_valid():
# 3 A's of test: Arrange, Act, then Assert
# Arrange
from p... | {
"content_hash": "730afd4a64cb0ec0686899e092c9880c",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 86,
"avg_line_length": 26.283783783783782,
"alnum_prop": 0.6349614395886889,
"repo_name": "Wintellect/WintellectWebinars",
"id": "25592b48d9ebbb9599c056f63a042b77de0d752a",
... |
"""Collection of tests around log handling."""
import logging
import pytest
from cookiecutter.log import configure_logger
def create_log_records():
"""Test function, create log entries in expected stage of test."""
cookiecutter_logger = logging.getLogger('cookiecutter')
foo_logger = logging.getLogger('... | {
"content_hash": "a246f59252b62f696afb7efae4759bea",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 87,
"avg_line_length": 32.56198347107438,
"alnum_prop": 0.6941624365482234,
"repo_name": "michaeljoseph/cookiecutter",
"id": "7bcbff733198400cf70514d7504aaf38f3910232",
"s... |
import json
import pyudev
import re
import subprocess # nosec
from ansible.module_utils.basic import AnsibleModule
DOCUMENTATION = '''
---
module: find_disks
short_description: Return list of devices containing a specfied name or label
description:
- This will return a list of all devices with either GPT partit... | {
"content_hash": "4c4f4c85ea5540243ec628542cb4327c",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 79,
"avg_line_length": 36.96774193548387,
"alnum_prop": 0.5398223068380137,
"repo_name": "openstack/kolla",
"id": "405852f0b8f6a021d2c0a568182a6645f5bc1f3c",
"size": "1333... |
import sublime, sublime_plugin, subprocess, os
class PhpCbfCommand(sublime_plugin.TextCommand):
def run(self, edit):
settings = sublime.load_settings("phpcbf.sublime-settings")
syntaxes = settings.get('syntaxes')
cur_syntax = self.view.settings().get('syntax')
if cur_syntax not in ... | {
"content_hash": "5ac140ca3d73f10245bec5927d3b3d53",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 122,
"avg_line_length": 35.55384615384615,
"alnum_prop": 0.5629597576806578,
"repo_name": "Ennosuke/PHP-Codebeautifier",
"id": "88a9d56a01b9eeb89e95c872a103d206c9dfabb9",
"... |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
import re
from colourmaps import viridis_colormap
from pipelines import inMemoryIMS_low_mem
from collections import OrderedDict
# webserver
import bottle
# isotope pattern generation
from... | {
"content_hash": "d22d7653d24e214e0916157a7f12d754",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 111,
"avg_line_length": 38.21052631578947,
"alnum_prop": 0.612849271940181,
"repo_name": "SpatialMetabolomics/SM_standalone",
"id": "e80128f55005674a3044bc50949c9f067da21ea9... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.