text
stringlengths
4
1.02M
meta
dict
try: from concurrent.futures import ProcessPoolExecutor have_process_pool_executor = True # pragma: no cover except ImportError: have_process_pool_executor = False class _SerialFuture(object): def __init__(self, fn, args, kwargs): self._fn = fn self._args = args self._kwargs = ...
{ "content_hash": "c37703bc51bc477ca915a05197ea86ce", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 75, "avg_line_length": 30.19298245614035, "alnum_prop": 0.6269610691458455, "repo_name": "njsmith/zs", "id": "874a6a5ef0dba03c752d410470d4213ef4e73c49", "size": "2893", "...
import os import shutil import sys import tempfile import time from importlib import import_module from pathlib import Path from unittest import mock import pytest import ray from ray._private import gcs_utils from ray._private.runtime_env.context import RuntimeEnvContext from ray._private.runtime_env.packaging impor...
{ "content_hash": "3448cf8ee4f139197b5cf7d889fed45e", "timestamp": "", "source": "github", "line_count": 576, "max_line_length": 88, "avg_line_length": 30.694444444444443, "alnum_prop": 0.5692873303167421, "repo_name": "ray-project/ray", "id": "f145eea151f8911537d00432bd16fae9f4aaa6ce", "size": "176...
from collections import defaultdict import logging import sys from .. import task from ..hooks import jug_hook, register_hook, register_hook_once from ..io import print_task_summary_table from ..jug import init from . import SubCommand, maybe_print_citation_info __all__ = [ 'execute' ] def _sigterm(_, __): ...
{ "content_hash": "5899fdfa4e29bf9364c0dc39f6e0c6a3", "timestamp": "", "source": "github", "line_count": 125, "max_line_length": 101, "avg_line_length": 32.328, "alnum_prop": 0.5515961395694136, "repo_name": "unode/jug", "id": "f560ff7275938012c541d9a32515713171a496ca", "size": "5269", "binary": f...
"""Higher level ops for building layers.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import functools import six from tensorflow.contrib.framework.python.ops import add_arg_scope from tensorflow.contrib.framework.python.ops import variables from ten...
{ "content_hash": "ff7279391bedd97ae42556e10cc937fe", "timestamp": "", "source": "github", "line_count": 2008, "max_line_length": 86, "avg_line_length": 44.044322709163346, "alnum_prop": 0.636345134044165, "repo_name": "tobegit3hub/deep_cnn", "id": "e4bcff3d2fb11cd4e81604bc7b3146450b4ba8e1", "size":...
import unittest import monitoring as mon class RecordTestCase(unittest.TestCase): def testRecordValueList(self): r = mon.Record(values=[1, 2, 3]) self.assertEqual(r.values, [1, 2, 3]) def testRecordSingleValue(self): r = mon.Record(values=1) self.assertEqual(r.values, [1]) ...
{ "content_hash": "5f8dfe83599346927e6b41fb03bfeefe", "timestamp": "", "source": "github", "line_count": 75, "max_line_length": 66, "avg_line_length": 29.333333333333332, "alnum_prop": 0.63, "repo_name": "jprine/monitoring-module", "id": "3ffb3721b03fede1677e7eae24eaadb3cbcc3ff9", "size": "2224", ...
from __future__ import division from __future__ import print_function from __future__ import absolute_import __doc__=""" ATLAS Higgs Machine Learning Challenge 2014 Read CERN Open Data Portal Dataset http://opendata.cern.ch/record/328 and manipulate it - Label is changd from charcter to integer 0 or 1 - DetailLabel ...
{ "content_hash": "adcc446a47e71454b8a2179bd4ea3a38", "timestamp": "", "source": "github", "line_count": 688, "max_line_length": 142, "avg_line_length": 34.729651162790695, "alnum_prop": 0.5682179626684524, "repo_name": "victor-estrade/datawarehouse", "id": "e7f64c66368c013525fea5e0d5fcc25193b78476", ...
import __builtin__ import gdbm import errno import hashlib import os import os.path import unittest import sys from mock import call, MagicMock, mock_open, patch from StringIO import StringIO from shardpile import HashDb class FilesMock(object): class File(object): content = 'content' def __init_...
{ "content_hash": "8d181751d5ab8ba7e60de46e1cf2a979", "timestamp": "", "source": "github", "line_count": 398, "max_line_length": 79, "avg_line_length": 39.665829145728644, "alnum_prop": 0.5682523595363274, "repo_name": "jgosmann/shardpile", "id": "4d6818264e23dcc26b6f139316e75713fe7bbd19", "size": "...
import amsoil.core.pluginmanager as pm from sqlalchemy import * from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base import logging Base = declarative_base() class Aggregate(Base): __tablename__ = 'sa_aggregate' id = Column(Integer, primary_key=True) slice_urn =...
{ "content_hash": "8d53a8564895f141b8d6a5482491edc8", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 90, "avg_line_length": 45.4, "alnum_prop": 0.6093061674008811, "repo_name": "ahelsing/geni-ch", "id": "ae4978ab176e9728b2e796345537097190f9e445", "size": "5377", "binary"...
from direct.directnotify import DirectNotifyGlobal from pandac.PandaModules import * from direct.interval.IntervalGlobal import * from toontown.fishing import FishGlobals import GardenGlobals from direct.actor import Actor import random class DirectRegion(NodePath): notify = DirectNotifyGlobal.directNotify.newCate...
{ "content_hash": "d4e673f697ecaa5bfdd00b3f105d891f", "timestamp": "", "source": "github", "line_count": 221, "max_line_length": 88, "avg_line_length": 37.199095022624434, "alnum_prop": 0.6015083323196692, "repo_name": "linktlh/Toontown-journey", "id": "0daa135a2ac8e093e76068d847a2057ff41121b5", "si...
''' Miscellaneous helpers I cannot come up with a good group at the moment.. ''' from collections import Counter import operator def avg(l): return sum(l) / float(len(l)) def is_number(s): try: float(s) return True except ValueError: return False def count_elements(l): '''...
{ "content_hash": "54620b8b7678c19d9ec48798e2796293", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 59, "avg_line_length": 18.5, "alnum_prop": 0.6169212690951822, "repo_name": "qfma/ohnolog-dc", "id": "f5f8810f6fe4b5e88bdb8d947031cafab3215129", "size": "876", "binary": ...
from tensorrec import TensorRec from tensorrec.eval import fit_and_eval from tensorrec.representation_graphs import ( LinearRepresentationGraph, ReLURepresentationGraph, NormalizedLinearRepresentationGraph ) from tensorrec.loss_graphs import WMRBLossGraph, BalancedWMRBLossGraph from tensorrec.prediction_graphs impo...
{ "content_hash": "a503abfd0c2c6f6b5860a57b7e0ca8c7", "timestamp": "", "source": "github", "line_count": 76, "max_line_length": 113, "avg_line_length": 46.89473684210526, "alnum_prop": 0.6459034792368126, "repo_name": "jfkirk/tensorrec", "id": "662528f0dd135746f0feb24107aca4e515369cf8", "size": "356...
import os import datetime import zipfile import re import shutil from math import ceil from logging import getLogger import nkf from sqlalchemy import desc from werkzeug import secure_filename from db_models.shared_models import db import common.utils as ds_util import chardet logger = getLogger(__name__) class Da...
{ "content_hash": "0cbc50431248004b708e70f94b530080", "timestamp": "", "source": "github", "line_count": 285, "max_line_length": 99, "avg_line_length": 42.00701754385965, "alnum_prop": 0.5364183093885734, "repo_name": "SonyCSL/CSLAIER", "id": "026cba8ba92e40b1ba760085a44b5e632da84127", "size": "1199...
''' This relies on font2.py, rgb_text2.py and ili9341_text2.py to display info on the TFT FeatherWing Uses umqtt_client_official.py The mqtt topic is determined by the config file but previously was hardcoded as 'esp_tft' The format of the mqtt messages is: {"header":"Weather", "text":"Some text goes here", "pos":2} my...
{ "content_hash": "f9a686ea830027958d93b63488d269e8", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 97, "avg_line_length": 24.752688172043012, "alnum_prop": 0.6355343179843614, "repo_name": "slzatz/esp8266", "id": "9a4641196a6a59fda12b1d234dec2a6d6d2787a3", "size": "2302"...
""" This web server will handle the training of the TensorFlow model and the image sets that will be used for training. """ import os from stat import * from flask import Flask, request, redirect, url_for, flash, send_from_directory, json from werkzeug.utils import secure_filename UPLOAD_FOLDER = './static/uploads' A...
{ "content_hash": "ec93bfe658d40b53e080dc137f09c86a", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 93, "avg_line_length": 35.29059829059829, "alnum_prop": 0.645919108743037, "repo_name": "odejesush/tensorflow", "id": "9b1a747372d7f405968331ecf3a8e310493ef435", "size": "...
import json import yaml from kpm.commands.deploy import DeployCmd class GenerateCmd(DeployCmd): name = 'generate' help_message = "Generate a package json" def _call(self): k = self.kub() if k.target == "docker-compose": self.output = 'yaml' self._generate() def _g...
{ "content_hash": "2ae3f58dfc3b734e28572cbaf8dbc2b0", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 78, "avg_line_length": 26.06896551724138, "alnum_prop": 0.5621693121693122, "repo_name": "ant31/kpm", "id": "b7f2a3c5ecab07adb4e4deef8ccdc6c739fc3e13", "size": "756", "bi...
""" Unit test for the programmable tuple metaclass """ import unittest import itertools from programmabletuple import ProgrammableTuple, ProgrammableExpr # # The programmable tuples class definition # ======================================== # # Some utility functions # ---------------------- # def _get_full_nam...
{ "content_hash": "502ec0fd05130c7734011ed28eddc528", "timestamp": "", "source": "github", "line_count": 275, "max_line_length": 77, "avg_line_length": 27.778181818181817, "alnum_prop": 0.5813588165990313, "repo_name": "tschijnmo/programmabletuple", "id": "a0c8451e1228869d47f1c022c4cde28f3e116631", ...
from decimal import * import getpass import math import os import os.path import platform import sys import time from jsonrpc import ServiceProxy, json BASE_FEE=Decimal("0.001") def check_json_precision(): """Make sure json library being used does not lose precision converting BTC values""" n = Decimal("20000...
{ "content_hash": "f4719a39c9d5ac05052110e23383df1c", "timestamp": "", "source": "github", "line_count": 252, "max_line_length": 111, "avg_line_length": 38.3968253968254, "alnum_prop": 0.6155436130632492, "repo_name": "007au/AmeristralianDollar", "id": "df9080a3267fb4168098e508ec98dcda9066a58f", "si...
from xml.dom import minidom class XmlNode: """An XML node represents a single field in an XML document.""" def __init__(self, domElement): """Construct an XML node from a DOM element.""" self.elem = domElement @classmethod def makeRoot(cls, xmlFileName): return cls(minidom...
{ "content_hash": "85b22a11f2d397e18d501b3bdef7410a", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 75, "avg_line_length": 34.58064516129032, "alnum_prop": 0.6361940298507462, "repo_name": "ActiveState/code", "id": "02b2defa806d84b91854e8c9c211ad7122775e78", "size": "1072...
from twisted.internet import defer # pylint: disable=import-error from twisted.spread import pb # pylint: disable=import-error class AsyncCommandBase: MAX_BUFFER_SIZE = 1024 * 1024 # 1Mb def __init__(self, options=None, on_end_callback=None): self.options = options or {} self.on_end_callb...
{ "content_hash": "717607c2cc2842e39d4aba6a50a89fcd", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 68, "avg_line_length": 26.2987012987013, "alnum_prop": 0.5466666666666666, "repo_name": "platformio/platformio-core", "id": "8105062c7040b7313c793ff61ccb2395eca19ab6", "siz...
from time import sleep from pytest import set_trace # noqa from selenium.common import exceptions from brome.core.selector import Selector from brome_config import default_config, default_browser_config from model.basetest import BaseTest from model.selector import selector_dict from model.test_dict import test_dict...
{ "content_hash": "c3b94b45fce7a95d041d8ce56b7bb808", "timestamp": "", "source": "github", "line_count": 1107, "max_line_length": 146, "avg_line_length": 31.092140921409214, "alnum_prop": 0.5035300270199599, "repo_name": "jf-parent/brome", "id": "ce0a49196f9f54ac634161f27d090349f844e06c", "size": "3...
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns( '', url(r'^admin/', include(admin.site.urls)), url(r'^', include('apps.core.urls')), url(r'^', include('apps.ctf.urls')), url(r'^api/', include('apps.core.api.urls'))...
{ "content_hash": "dda091777bafd157fa75d43ff3df7d5e", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 60, "avg_line_length": 25.58823529411765, "alnum_prop": 0.6344827586206897, "repo_name": "blstream/CaptureTheFlag", "id": "b82a9fba3894c6b255c6ecbddeb0a88de8dcc564", "size"...
"""Tests for proto_task_queue.worker.""" from unittest import mock import uuid import warnings from absl.testing import absltest from absl.testing import parameterized from google.protobuf import text_format from proto_task_queue import task_pb2 from proto_task_queue import test_task_pb2 from proto_task_queue import ...
{ "content_hash": "5098247e431f10374eb89140d6d11b38", "timestamp": "", "source": "github", "line_count": 141, "max_line_length": 79, "avg_line_length": 36.07801418439716, "alnum_prop": 0.7063102024769019, "repo_name": "google/proto-task-queue", "id": "738cda457fe066f9297780a4b5ae9d1668d824f0", "size...
BOT_NAME = 'artbot' SPIDER_MODULES = ['artbot.spiders'] NEWSPIDER_MODULE = 'artbot.spiders' # Crawl responsibly by identifying yourself (and your website) on the user-agent #USER_AGENT = 'artbot (+http://www.yourdomain.com)' USER_AGENT_LIST = [ "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like ...
{ "content_hash": "c650fe333b2dc9a29c0070780cc34c20", "timestamp": "", "source": "github", "line_count": 105, "max_line_length": 123, "avg_line_length": 47.25714285714286, "alnum_prop": 0.7392180572349859, "repo_name": "zirui/poetry", "id": "b318d90acae8381ef4c94aae1749efa03d99645c", "size": "5393",...
import mock from oslo.serialization import jsonutils from nailgun.db.sqlalchemy.models import Release from nailgun.settings import settings from nailgun.test.base import BaseIntegrationTest from nailgun.test.base import reverse class TestHandlers(BaseIntegrationTest): def test_release_put_change_name_and_versio...
{ "content_hash": "9175025358abab9772aab5379eeaea87", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 76, "avg_line_length": 38.72941176470588, "alnum_prop": 0.6008505467800729, "repo_name": "zhaochao/fuel-web", "id": "3319ef899c5a3874ac4eaf0bfe77bdb1665c3a28", "size": "392...
"""Layers used for experiments with sparsity.""" import functools import math import random as pyrandom import numpy as np from trax import fastmath from trax import layers as tl from trax.fastmath import numpy as jnp from trax.fastmath import random from trax.layers import base from trax.layers import core from trax...
{ "content_hash": "a235e69b96e5b3bdb8502fe46519091f", "timestamp": "", "source": "github", "line_count": 1718, "max_line_length": 90, "avg_line_length": 42.06461001164144, "alnum_prop": 0.6515698728326899, "repo_name": "google/trax", "id": "1ac1c8ca4841b28f837327f376aad09ea76e1536", "size": "72864",...
import os import ujson from starlette import status from starlette.concurrency import run_in_threadpool from starlette.datastructures import UploadFile from starlette.exceptions import HTTPException from starlette.requests import Request from starlette.responses import Response from polyaxon import settings from pol...
{ "content_hash": "eb1afe139754f3dcdea8c6924d344c8f", "timestamp": "", "source": "github", "line_count": 114, "max_line_length": 84, "avg_line_length": 33.166666666666664, "alnum_prop": 0.6342237503306004, "repo_name": "polyaxon/polyaxon", "id": "730725a8422d229dbacf9e15a93d59d37a5bc933", "size": "4...
from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('iom', '0037_auto_20161004_1147'), ] operations = [ migrations.RemoveField( model_name='cartodb', name='layer_sql', )...
{ "content_hash": "afb6af5c385f933571b3843f9ff163b7", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 43, "avg_line_length": 19.294117647058822, "alnum_prop": 0.5853658536585366, "repo_name": "acaciawater/iom", "id": "6a0421c819e200e725fb227cbfc2ff6a95be4d98", "size": "352"...
"""Event parser and human readable log generator.""" from datetime import timedelta from itertools import groupby import logging import voluptuous as vol from homeassistant.loader import bind_hass from homeassistant.components import sun from homeassistant.components.http import HomeAssistantView from homeassistant.c...
{ "content_hash": "815d774e6fe38ad0fd822d0d5a6af8b4", "timestamp": "", "source": "github", "line_count": 610, "max_line_length": 87, "avg_line_length": 32.91639344262295, "alnum_prop": 0.5388714577419195, "repo_name": "Cinntax/home-assistant", "id": "3c5e828765c98d8fca25865ea43e7dad569ed81b", "size"...
from __future__ import division import tensorflow as tf import numpy as np from utils import * class EncDec: """ Encoder-Decoder Model (for single sequence future prediction problem) Encoder could be arbitrarily complex passes the final state through non-linearity to initlize decoder state...
{ "content_hash": "26ec3d7c97f7fb2cffeafc3ebde7a533", "timestamp": "", "source": "github", "line_count": 277, "max_line_length": 146, "avg_line_length": 48.26714801444043, "alnum_prop": 0.5594614809274495, "repo_name": "wangkua1/sportvu", "id": "57a55f70d30c039ce72b8d7f68e775fe6ab22ddf", "size": "13...
import os, datetime, pymongo, configparser import pandas as pd from bson import json_util global_config = None global_client = None global_stocklist = None def getConfig(root_path): global global_config if global_config is None: #print("initial Config...") global_config = configparser.ConfigPa...
{ "content_hash": "e5526488df753a859d082a1d2477eaab", "timestamp": "", "source": "github", "line_count": 459, "max_line_length": 133, "avg_line_length": 36.60348583877995, "alnum_prop": 0.5974049163740254, "repo_name": "doncat99/StockRecommendSystem", "id": "fca25f53bfc0875c28e83696d91f452e023317e5", ...
from django.db import models from mercurial import hg, ui import git class EMail(models.Model): address = models.CharField(max_length=512) user = models.ForeignKey("repokarma.User", related_name="email") class Meta: app_label = "repokarma" class User(models.Model): username = models.CharFie...
{ "content_hash": "9cdc2e248928face54e375fd9bc5eb9d", "timestamp": "", "source": "github", "line_count": 147, "max_line_length": 68, "avg_line_length": 29.231292517006803, "alnum_prop": 0.577379567139865, "repo_name": "kimvais/repokarma", "id": "8900c05ebc2af5e388aad49efde00e66229e1522", "size": "54...
from django import template # import locale import math from decimal import Decimal register = template.Library() @register.filter def keyvalue(dict, key): try: return dict[key] except KeyError: return '' @register.filter def nicenumber(number): if number and number != 0: try: ...
{ "content_hash": "1a382effa7b50084adde6db754922e36", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 64, "avg_line_length": 23.11764705882353, "alnum_prop": 0.6166242578456319, "repo_name": "danst0/Portfolio", "id": "36e246570d56e3b62b6f6fbcf227de6ca74146ce", "size": "1179...
from plmrf import * import numpy as np import scipy import time # Generating a big ring by sampling variables independently, # then sampling based on each configuration's 'true' potential nvars = 1000 nsamp = 1000 print("Generating data ...") indep_data = dict() for vindex in range(nvars): samples = np.random.no...
{ "content_hash": "60e18718c30936a81667775832fc4f55", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 122, "avg_line_length": 32, "alnum_prop": 0.704133064516129, "repo_name": "dgarant/pl-markov-network", "id": "31ae3b5d46bf317355091ceb8d50c93da24b749a", "size": "2076", "...
import importlib import ckan.plugins as p from functools import partial class UserDatasetsPlugin(p.SingletonPlugin): """"UserDatasetsPlugin This plugin replaces dataset and resource authentication calls to allow users with the 'Member' role to create datasets, and edit/delete their own datasets (but...
{ "content_hash": "b38d44a0307c973bb583dcad4af80c73", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 117, "avg_line_length": 44.36065573770492, "alnum_prop": 0.6304508499630451, "repo_name": "CI-WATER/portal", "id": "604ba029f492e1076f4b95edd4c35dd98325bd2d", "size": "2706...
''' @author Luke Campbell <LCampbell at ASAScience dot com> @date Tue Feb 12 09:54:27 EST 2013 @file ion/processes/data/transforms/transform_prime.py ''' from ion.core.process.transform import TransformDataProcess from coverage_model import ParameterDictionary from interface.services.dm.ipubsub_management_service impo...
{ "content_hash": "ee1ed14385e8d4421cdef54b4b2b1800", "timestamp": "", "source": "github", "line_count": 189, "max_line_length": 136, "avg_line_length": 40.12698412698413, "alnum_prop": 0.6313291139240507, "repo_name": "ooici/coi-services", "id": "aa20048130bec22c1b05b28d7a678c9ba61280d0", "size": "...
import httplib from flask import request, session, make_response from flask_restful_swagger import swagger from flask.ext.restful import Resource from CairisHTTPError import ObjectNotFoundHTTPError from data.AssetDAO import AssetDAO from tools.JsonConverter import json_serialize from tools.MessageDefinitions import A...
{ "content_hash": "3c690ee493d585d5034d9d475eefdc4c", "timestamp": "", "source": "github", "line_count": 840, "max_line_length": 115, "avg_line_length": 32.61071428571429, "alnum_prop": 0.5129047566896653, "repo_name": "RobinQuetin/CAIRIS-web", "id": "257569d3b353c03f4e994c0e80a8f98cdaaad1fa", "size...
import threading import time import core.session ''' Periodically checks if sessions are alive ''' class Extant(object): def __init__(self, shell): self.shell = shell self.check_alive_timer = None self.check() def check(self): if self.check_alive_timer is not None: ...
{ "content_hash": "836d8ba8669b021ccd43597c8a2f60c4", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 65, "avg_line_length": 28.864864864864863, "alnum_prop": 0.5608614232209738, "repo_name": "zerosum0x0/koadic", "id": "e0400fec3fd3f9f4a985532c45a5a4cce096b9ee", "size": "10...
from django.conf.urls import patterns, include, url from datebook import data_views urlpatterns = patterns('', url(r'^ajax/event/create/', data_views.event_create, name="event_create"), url(r'^ajax/event/update/', data_views.event_update, name="event_update"), url(r'^ajax/event/delete/', dat...
{ "content_hash": "9775626ba67c65c1c7366bef50008374", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 105, "avg_line_length": 48.733333333333334, "alnum_prop": 0.667578659370725, "repo_name": "aarontropy/django-datebook", "id": "9017d5bc606d451da7907dfdb7cd32c5644db7b6", "s...
import _jpype import datetime import decimal import sys import _jpype from . import _jclass from . import _jcustomizer # Copies of all private base types for reference _JClass = _jpype._JClass _JObject = _jpype._JObject _JException = _jpype._JException _JNumberLong = _jpype._JNumberLong _JNumberFloat = _jpype._JNumber...
{ "content_hash": "444689c3bf14673fbc3bcdceecf885f1", "timestamp": "", "source": "github", "line_count": 148, "max_line_length": 112, "avg_line_length": 30.486486486486488, "alnum_prop": 0.7005762411347518, "repo_name": "originell/jpype", "id": "fc77854d01c3814421a5efb9e35874911757a125", "size": "52...
""" Bonus Tutorial: Using generators to return result bodies Instead of returning a complete result string, you can use the yield statement to return one result part after another. This may be convenient in situations where using a template package like CherryPy or Cheetah would be overkill, and messy string concatena...
{ "content_hash": "8f13894b24ec64409fb75db2b2d3d7ba", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 73, "avg_line_length": 28.26829268292683, "alnum_prop": 0.635030198446937, "repo_name": "VHAINNOVATIONS/DmD", "id": "c5be531f7bcbccd4ce1b29e901b32f42ce952d9e", "size": "115...
from typing import Optional from appium.options.common.supports_capabilities import SupportsCapabilities ENFORCE_FRESH_SIMULATOR_CREATION = 'enforceFreshSimulatorCreation' class EnforceFreshSimulatorCreationOption(SupportsCapabilities): @property def enforce_fresh_simulator_creation(self) -> Optional[bool]:...
{ "content_hash": "0776b4a1912d953bcb4aff1eee277ec6", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 87, "avg_line_length": 36.63636363636363, "alnum_prop": 0.7245657568238213, "repo_name": "appium/python-client", "id": "cea87eb05e57a2bf0186e50d1ea96e5777235cc2", "size": "...
"""HandOut db model filelist. File list. """ from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from . import Base import re import mimetypes from datetime import datetime from sqlalchemy import Column, func from sqlalchemy.dialects.mysql import INT...
{ "content_hash": "369d736b11ecb554c563b3fa330d053d", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 77, "avg_line_length": 27.14814814814815, "alnum_prop": 0.6275579809004093, "repo_name": "chatea/HandOut", "id": "a9c0597002327ae568403197854489055e41f40f", "size": "1513",...
"""engine.SCons.Options.EnumOption This file defines the option type for SCons allowing only specified input-values. Usage example: opts = Options() opts.Add(EnumOption('debug', 'debug output and symbols', 'no', allowed_values=('yes', 'no', 'full'), map={}, ignorecase=...
{ "content_hash": "501512379acc9276212f7bfeba73c4d6", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 73, "avg_line_length": 36.97029702970297, "alnum_prop": 0.6695232994108195, "repo_name": "datalogics/scons", "id": "d4e2ac1934993c6ce8026d9e2a872f274e263424", "size": "373...
import configparser # Define the names of the options option_names = [ 'from-default', 'from-section', 'section-only', 'file-only', 'init-only', 'init-and-file', 'from-vars', ] # Initialize the parser with some defaults DEFAULTS = { 'from-default': 'value from defaults passed to init', 'init-o...
{ "content_hash": "9a4f06a70a2e4ea82e13ccf75a96a5ee", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 65, "avg_line_length": 29.29090909090909, "alnum_prop": 0.6765983860955928, "repo_name": "jasonwee/asus-rt-n14uhp-mrtg", "id": "6c38ea1c45a5895090b10711a992c70a4599c152", "...
from schevo.schema import * schevo.schema.prep(locals()) import random import string class Frob(E.Entity): """Some sort of something that has four holes.""" name = f.string() _key(name) _sample_unittest = [ ('Frob 1',), ('Frob 2',), ('Frob 3',), ('Frob 4',), ...
{ "content_hash": "bd77a67ffa29901f4ea10634803e20ac", "timestamp": "", "source": "github", "line_count": 172, "max_line_length": 78, "avg_line_length": 26.627906976744185, "alnum_prop": 0.47882096069868996, "repo_name": "Schevo/schevo", "id": "7f2622b399ddaedf93ccd78873c34bd61560dddb", "size": "4580...
"""Process sampling profiler output from hardware model. USAGE: profile <objdump file> <pc dump file> Prints a breakdown of time spent per function. - 'objdump file' parameter points to a file that was produced using: /usr/local/llvm-nyuzi/bin/llvm-objdump -t <path to ELF file> - 'pc dump file' points to a file that...
{ "content_hash": "2f7400dcd45a834cb3c04df3f14e9171", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 82, "avg_line_length": 26.02469135802469, "alnum_prop": 0.5616698292220114, "repo_name": "jbush001/NyuziProcessor", "id": "1c190489f2035ef2f2f0839a6310185aad78b6ee", "size"...
""" Group of commands to manage the contexts for the current session. .. moduleauthor:: Daniel Grunwell (grunny) """ import click from zapcli.exceptions import ZAPError from zapcli.helpers import validate_regex, zap_error_handler from zapcli.log import console @click.group(name='context', short_help='Manage contex...
{ "content_hash": "9ce7aad15cbcd767d67a1873c66bed76", "timestamp": "", "source": "github", "line_count": 133, "max_line_length": 96, "avg_line_length": 35.78195488721804, "alnum_prop": 0.6677873502836731, "repo_name": "Grunny/zap-cli", "id": "4504b8870a13cca17990a2c225d025414354a3ee", "size": "4759"...
from math import ceil listOfFactors = lambda n: {i for i in range(1,ceil(abs(n)/2)+1) if n%i == 0} def removeDuplicates(mylist): if mylist: mylist.sort() last = mylist[-1] for i in range(len(mylist)-2, -1, -1): if last == mylist[i]: del mylist[i] else:...
{ "content_hash": "61f05c3694f162b5ec853f8450e8a19b", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 151, "avg_line_length": 38.16129032258065, "alnum_prop": 0.6145393068469992, "repo_name": "ActiveState/code", "id": "4f33593ea8cbaf697fd7c5b2d751bdb135eb3f7a", "size": "118...
import os,sys import xml.etree.ElementTree as ET def findObjects(xmlFile): boxes = [] tree = ET.parse(xmlFile) for child in tree.getroot().findall('object'): if child.find('difficult').text != '1': bn = child.find('bndbox') box = map(float, [bn.find('xmin').text, bn.find('ymin').text, bn.find('xm...
{ "content_hash": "1a41a40b54a27c85c890d9eb08e50e3c", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 112, "avg_line_length": 28.92105263157895, "alnum_prop": 0.5978161965423112, "repo_name": "jccaicedo/localization-agent", "id": "2662e556eb51781ea1a4b363ad19368aaa385700", ...
import base64 import sys import os import os.path import difflib import jinja2 import six.moves.urllib.request import six.moves.urllib.parse import six.moves.urllib.error import re import unicodedata import json import logging import string import random import six.moves.cPickle as pickle from hashlib import sha1 from...
{ "content_hash": "19f7f8f6ebd646498784029fc4a2e41d", "timestamp": "", "source": "github", "line_count": 1320, "max_line_length": 189, "avg_line_length": 32.08712121212121, "alnum_prop": 0.6121119112265376, "repo_name": "apache/allura", "id": "51d867ebca69ff69d8848615678645795674ec29", "size": "4322...
import mock from twisted.trial import unittest from twisted.internet import defer from buildbot.test.fake import fakedb from buildbot.process.users import manual class ManualUsersMixin(object): """ This class fakes out the master/db components to test the manual user managers located in process.users.manu...
{ "content_hash": "a20398d5e9a5d239076dad3c4e7740e7", "timestamp": "", "source": "github", "line_count": 286, "max_line_length": 87, "avg_line_length": 44.06643356643357, "alnum_prop": 0.45028961358406727, "repo_name": "denny820909/builder", "id": "9b33005185db294ee62bbb75c036e3d4bd2c62e7", "size": ...
import zookeeper import threading import logging logger = logging.getLogger(__name__) logger.setLevel(logging.WARNING) zookeeper.set_debug_level(zookeeper.LOG_LEVEL_WARN) # Mapping of connection state values to human strings. STATE_NAME_MAPPING = { zookeeper.ASSOCIATING_STATE: "associating", zookeeper.AUTH...
{ "content_hash": "584a01a1bb66bf09f485cb7e8fbac695", "timestamp": "", "source": "github", "line_count": 119, "max_line_length": 153, "avg_line_length": 29.613445378151262, "alnum_prop": 0.6118047673098751, "repo_name": "buaabarty/dpark", "id": "699f747bac6d08d40cedff14beabc36f2a564fb4", "size": "35...
''' tests/runtests.py Unit test runner. Without any arguments, this runs all available tests. Flags may be used to selectively run tests, or just show some diagnostic information. Log output is automatically captured by this script. ''' import functools import io import logging import os import sys import unittest if...
{ "content_hash": "8c3179d17765ce7a0aed7348b9d3e456", "timestamp": "", "source": "github", "line_count": 211, "max_line_length": 79, "avg_line_length": 31.81042654028436, "alnum_prop": 0.6571811680572109, "repo_name": "sublime-ycmd/sublime-ycmd", "id": "399800dd198fdb2152127473688727c2140f50a4", "si...
"""Extensions which are maintained in-tree. All public modules (those not beginning with ``_``) in this package are extensions. They could, in concept, be maintained separately from HIL core, but are in-tree as they are maintained by the core developers. """
{ "content_hash": "e9dd6185d363bde4eb864e567510e1e0", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 71, "avg_line_length": 43.333333333333336, "alnum_prop": 0.7615384615384615, "repo_name": "SahilTikale/haas", "id": "2ea1ac7def316505fb83fec27e63eacc28a278bd", "size": "260"...
from datetime import datetime import json import os from boto.s3.key import Key from fabric.api import local, require, settings, task from fabric.state import env from termcolor import colored import app_config # Other fabfiles import assets import data import flat import issues import render import text import util...
{ "content_hash": "6b62fa36da086439d3f3caac22342607", "timestamp": "", "source": "github", "line_count": 265, "max_line_length": 182, "avg_line_length": 23.343396226415095, "alnum_prop": 0.6273844164241836, "repo_name": "mroswell/m2016", "id": "d1470f639ec51d786e805e2f60fbf3cd9572571a", "size": "620...
from datetime import date from openpyxl import load_workbook if __name__ == '__main__': wb = load_workbook('LiborCurveBootstrap.xlsx') ws = wb.active # Take the input parameters today = ws['C2'].value.date() libor_tenor = ws['C3'].value libor_value = ws['C4'].value # OIS Data ois_star...
{ "content_hash": "034e0afb43a01dd68595ea912634ce12", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 102, "avg_line_length": 29.962962962962962, "alnum_prop": 0.6390605686032138, "repo_name": "gabberthomson/fm_finpy", "id": "9fe763d30d9d302bcb37421d284b921b3bf37569", "size...
from __future__ import absolute_import, division, print_function, unicode_literals import logging import math import torch import torch.nn.functional as F from fairseq import utils from fairseq.criterions import FairseqCriterion, register_criterion @register_criterion("cross_entropy_acc") class CrossEntropyWithAccC...
{ "content_hash": "4e54bf1bd57324c0e19e1f9214f1327f", "timestamp": "", "source": "github", "line_count": 125, "max_line_length": 85, "avg_line_length": 41.552, "alnum_prop": 0.5987678090103966, "repo_name": "pytorch/fairseq", "id": "7c4d8ba3802a2da9467c42b0aa18653c7bbb2ec9", "size": "5372", "binar...
"""py.test configuration file.""" import os import pytest import xal @pytest.fixture(scope='session', params=['local', 'fabric']) def session(request): # Absolute path to current working directory. This is useful to setup # working directory in tests in order to use fixtures. here = os.path.abspath(os.ge...
{ "content_hash": "b0712ef9e2c4812ac36b7e10530cbd1b", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 73, "avg_line_length": 28.904761904761905, "alnum_prop": 0.6738056013179572, "repo_name": "benoitbryon/xal", "id": "f42ffb8707736714733e434f7abd8be0927f2976", "size": "607"...
import os import sys import config import common import shutil # 该函数完成清空 target 目录操作 def freeTarget(): print common.encodeChinese("清空 target 目录 ...") targetPath = '%s%s' % ( config.PROJECT_HOME, '\\target') # 判断 target 目录是否存在,如果存在则删除 if os.path.isdir( targetPath ): try: shutil.rmtree( targetPath ) print c...
{ "content_hash": "769f30cd379992a6ac5638ae797cee55", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 57, "avg_line_length": 24.454545454545453, "alnum_prop": 0.6524163568773235, "repo_name": "xxd3vin/spp-sdk", "id": "c85f9c106158a51782a5aad8b0c225133dd63228", "size": "619"...
import argparse import autopy import socket import time from sockutil import set_tcp_keepalive def handleCommand(command): # print command # XXX if command == 'D': print 'Page Down' autopy.key.tap(autopy.key.K_PAGEDOWN) elif command == 'U': print 'Page Up' autopy.key.tap(autopy.key.K_PAGEUP) de...
{ "content_hash": "80fc437dc908e71679e9c7f4477cdb2f", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 80, "avg_line_length": 28.910714285714285, "alnum_prop": 0.6757257566399012, "repo_name": "aarmea/McMillen12Step-bitwig", "id": "46c4011eb1584c278fa3d360f106d03bd544e93d", ...
import pecan import wsmeext.pecan as wsme_pecan from cloudkitty.api.v1 import types as ck_types from cloudkitty import rating from cloudkitty.rating.hash.datamodels import group as group_models from cloudkitty.rating.hash.datamodels import threshold as threshold_models from cloudkitty.rating.hash.db import api as db_a...
{ "content_hash": "4e31269c2f81312aaabbb1f4518a9816", "timestamp": "", "source": "github", "line_count": 162, "max_line_length": 77, "avg_line_length": 38.34567901234568, "alnum_prop": 0.5692208628461043, "repo_name": "openstack/cloudkitty", "id": "f5a730553afaea515a254584aa8a128a23e6874d", "size": ...
"""Test the listtransactions API.""" from decimal import Decimal from io import BytesIO from test_framework.mininode import CTransaction, COIN from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( assert_array_result, assert_equal, bytes_to_hex_str, hex_str_to...
{ "content_hash": "4047e9996fbec9d7dbf61f0823ca902c", "timestamp": "", "source": "github", "line_count": 204, "max_line_length": 114, "avg_line_length": 51.28431372549019, "alnum_prop": 0.572739437965972, "repo_name": "donaloconnor/bitcoin", "id": "883942cc19d9e883f8dab6f61b159432660df025", "size": ...
from .. import Parser, parser, get_active_lines, LegacyItemAccess from insights.specs import Specs @parser(Specs.rhn_hibernate_conf) class RHNHibernateConf(LegacyItemAccess, Parser): def parse_content(self, content): """ Parses rhn_hibernate.conf and returns a dict. - { "hiber...
{ "content_hash": "85f48beab71a1878075736ebb033f3f3", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 79, "avg_line_length": 32.285714285714285, "alnum_prop": 0.5752212389380531, "repo_name": "RedHatInsights/insights-core", "id": "b342775526b205a97333c2d5a1c3bec78dacdea8", ...
from __future__ import division from math import sqrt import kafka_utils.kafka_cluster_manager.cluster_info.stats as stats def test_mean(): assert stats.mean([1, 2, 3, 4, 5]) == 3 def test_variance(): assert stats.variance([1, 2, 3, 4, 5]) == 2 def test_standard_deviation(): assert stats.standard_de...
{ "content_hash": "e1bf7f47f9d0fb4358b31ca3d9e8b363", "timestamp": "", "source": "github", "line_count": 170, "max_line_length": 73, "avg_line_length": 28.6, "alnum_prop": 0.6293706293706294, "repo_name": "anthonysandrin/kafka-utils", "id": "382a8f8f25a97b54d7bcbe09e8ee652f18226991", "size": "5459",...
import array from collections import defaultdict import numpy as np import tensorflow as tf def load_vocab(filename): vocab = None with open(filename) as f: vocab = f.read().splitlines() dct = defaultdict(int) for idx, word in enumerate(vocab): dct[word] = idx return [vocab, dct] ...
{ "content_hash": "0bb077c9af22fc10f983f0d989e997cf", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 107, "avg_line_length": 33.630434782608695, "alnum_prop": 0.6160310277957337, "repo_name": "excel-analytics/telegram_chat_bot", "id": "6bb0d88b7a12ea2e73c29ef11b20af4c4da7dac...
import os import eventlet from eventlet import event from eventlet.green import socket from tests import LimitedTestCase, s2b, skip_if_no_ssl certificate_file = os.path.join(os.path.dirname(__file__), 'test_server.crt') private_key_file = os.path.join(os.path.dirname(__file__), 'test_server.key') class TestServe(Lim...
{ "content_hash": "b6cb03722ac87761a746993115031e1e", "timestamp": "", "source": "github", "line_count": 132, "max_line_length": 79, "avg_line_length": 36.45454545454545, "alnum_prop": 0.580423940149626, "repo_name": "ioram7/keystone-federado-pgid2013", "id": "08e370588c2a6b1c7b2522bbf6374b48d12cadab"...
from __future__ import print_function import datetime from maka.data.Field import Date from FieldTests import FieldTests, fieldTestClass @fieldTestClass class DateFieldTests(FieldTests): fieldClass = Date validValue = datetime.date(2013, 7, 29) invalidValue = '' defaultTypeName = 'dat...
{ "content_hash": "31e5ce18f95c9afbdb5e5d338bad0e51", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 49, "avg_line_length": 18.166666666666668, "alnum_prop": 0.7064220183486238, "repo_name": "HaroldMills/Maka", "id": "4c468749d61bcb4bd09e4f2548c997375c6917a5", "size": "327...
""" Utilities for PDF rendering from HTML using WeasyPrint. Note that you need to add https://pypi.org/project/weasyprint/ to your dependencies if you want to make use of HTML-to-PDF rendering. This is not included by default as it's quite heavy and requires OS-level dependencies. This module exposes the public funct...
{ "content_hash": "14d43ee12efba3351e9793759cbe06b3", "timestamp": "", "source": "github", "line_count": 142, "max_line_length": 88, "avg_line_length": 36.24647887323944, "alnum_prop": 0.6438702156596076, "repo_name": "Clarity-89/clarityv2", "id": "a4c7cbccf2dde9952149c60d732c4c5475b1600e", "size": ...
import os from optparse import OptionParser from subprocess import call, Popen, PIPE from django.core.management import call_command HAVE_JS = ['admin'] def _get_locale_dirs(include_core=True): """ Return a tuple (contrib name, absolute path) for all locale directories, optionally including the django c...
{ "content_hash": "27bfc7822a9809f430f863809c0bc0d6", "timestamp": "", "source": "github", "line_count": 154, "max_line_length": 98, "avg_line_length": 38.12337662337662, "alnum_prop": 0.5835462442514052, "repo_name": "ericholscher/django", "id": "5460eef25e2e8c7209019d2363c635e7546b522e", "size": "...
from .alignment import Alignment from .tasks import TreeCollectionTaskInterface from .utils.decorators import lazyprop from .utils import concatenate, fileIO from Bio import AlignIO __author__ = 'kgori' class Concatenation(object): """docstring for Concatenation""" def __init__(self, collection, indices): ...
{ "content_hash": "d961b01f853a7c92a2e4c0353ddbc831", "timestamp": "", "source": "github", "line_count": 132, "max_line_length": 94, "avg_line_length": 36.85606060606061, "alnum_prop": 0.5424460431654676, "repo_name": "kgori/treeCl", "id": "0581213f2638f5fa5e7f4ed9bdaed2d82139afb5", "size": "4865", ...
from django.conf.urls import patterns, url from .views import InventoryList urlpatterns = patterns('', url(r'^inventory/$', InventoryList.as_view()), )
{ "content_hash": "d4794bc1fee99c9e7ddf2d0da050cadf", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 50, "avg_line_length": 26, "alnum_prop": 0.7307692307692307, "repo_name": "ateoto/django-boulange", "id": "75ccd139f52c16abac7ac459000e0afc68db9ef8", "size": "156", "binar...
import unittest from quickbooks.objects.bill import Bill, BillLine, AccountBasedExpenseLineDetail class AccountBasedExpenseLineDetailTests(unittest.TestCase): def test_unicode(self): acct_detail = AccountBasedExpenseLineDetail() acct_detail.BillableStatus = "test" self.assertEquals(unico...
{ "content_hash": "3fc973c29e0311e1e76781d13e8f508a", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 81, "avg_line_length": 25.88888888888889, "alnum_prop": 0.6952789699570815, "repo_name": "ferdiaz/python-quickbooks", "id": "483a93af5c2f18123ea4dfa4e3ec6dcac54bc0f5", "siz...
from collections import Sequence import unittest from requests.structures import CaseInsensitiveDict from docido_sdk.toolbox.edsl import kwargsql and_ = kwargsql.and_ or_ = kwargsql.or_ xor = kwargsql.xor class TestKwargSQL(unittest.TestCase): d = { 's': 's_value', 'i': 3, 'nested': { ...
{ "content_hash": "f42c4aaf75d368f4600d78888395f236", "timestamp": "", "source": "github", "line_count": 140, "max_line_length": 78, "avg_line_length": 41.114285714285714, "alnum_prop": 0.5927727588603197, "repo_name": "cogniteev/docido-python-sdk", "id": "08c1036aae115d1504c69d5366e3275b3d95fe27", ...
import types import json import sys from datetime import datetime import odc # Logging Levels Trace = 0 Debug = 1 Info = 2 Warn = 3 Error = 4 Critical = 5 # Exact string values for Event parameters which are passed as strings # EventTypes, ConnectState,Binary,Analog,Counter,FrozenCounter,BinaryOutputStatus,AnalogOutp...
{ "content_hash": "9e5584f618ca6178aa6bc0d6f353491f", "timestamp": "", "source": "github", "line_count": 161, "max_line_length": 148, "avg_line_length": 46.83229813664596, "alnum_prop": 0.6631299734748011, "repo_name": "neilstephens/opendatacon", "id": "b1f999cc3e012e4f3664e664ecb307dd1b303df9", "si...
import os.path from glob import glob from PIL import ImageFont def available(): """ Returns list of available font names. """ font_dir = os.path.dirname(__file__) names = [os.path.basename(os.path.splitext(f)[0]) for f in glob(os.path.join(font_dir, '*.pil'))] return sorted(names) def load(n...
{ "content_hash": "009b074475eb79169e13e377ef34740d", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 101, "avg_line_length": 31.74074074074074, "alnum_prop": 0.6289381563593932, "repo_name": "rhempel/ev3dev-lang-python", "id": "95b480446a5f7fa2c23c88d6f0c7cc4e9d19be4b", "s...
""" Parse DAT files blocks and traverse block chains. """ from binascii import hexlify from struct import unpack_from from DAT.Header import Header class Block: """ A block making up a chunk of a Directory in a DAT file. """ def __init__(self, filename=None, offset=None, size=None, next_block_offse...
{ "content_hash": "4cc26cc62e551fd50e9ab0b29136de84", "timestamp": "", "source": "github", "line_count": 113, "max_line_length": 97, "avg_line_length": 27.221238938053098, "alnum_prop": 0.5406371911573472, "repo_name": "ccressent/acnav", "id": "18229d863da7bde8d4c8f24f937fae4f13f56a0a", "size": "307...
import pytest import numpy as np import openpnm as op import numpy.testing as nt class TransportTest: def setup_class(self): self.net = op.network.Cubic(shape=[9, 9, 9]) self.net.add_model_collection( op.models.collections.geometry.spheres_and_cylinders) self.net.regenerate_mo...
{ "content_hash": "e51763e7ce9eb55eff4d1da4689f93cc", "timestamp": "", "source": "github", "line_count": 390, "max_line_length": 90, "avg_line_length": 46.88717948717949, "alnum_prop": 0.5865689598600022, "repo_name": "PMEAL/OpenPNM", "id": "b51bfc13d1c407973e8ef6655f1e733ff63d3ba0", "size": "18286"...
"""A fork of flax.optim.MultiOptimizer that works with t5x.adafactor. The original flax.optim.MultiOptimizer can be found at https://github.com/google/flax/blob/main/flax/optim/base.py """ from typing import Sequence, Tuple import flax from flax import optim from flax import traverse_util from flax.core.frozen_dict i...
{ "content_hash": "93d90fc1da2bc4c07b03a5facbb0082f", "timestamp": "", "source": "github", "line_count": 225, "max_line_length": 80, "avg_line_length": 40.43555555555555, "alnum_prop": 0.6958672235656188, "repo_name": "google-research/prompt-tuning", "id": "8313d807b4ce84cf114be604e9e64ff18c86aba7", ...
from unittest import TestCase from rfxcom.protocol.lighting2 import Lighting2 from rfxcom.exceptions import (InvalidPacketLength, UnknownPacketSubtype, UnknownPacketType) class Lighting2TestCase(TestCase): def setUp(self): self.data = bytearray(b'\x0B\x11\x00\x01\x01\x11...
{ "content_hash": "a0358709108796197f5f07d2937a5d40", "timestamp": "", "source": "github", "line_count": 96, "max_line_length": 76, "avg_line_length": 30.3125, "alnum_prop": 0.5707903780068728, "repo_name": "d0ugal-archive/python-rfxcom", "id": "7b428624f7e86de12287734c8c76a9e0d8dbe415", "size": "29...
import operator from raksha.openstack.common import jsonutils from raksha.openstack.common.scheduler import filters class JsonFilter(filters.BaseHostFilter): """Host Filter to allow simple JSON-based grammar for selecting hosts. """ def _op_compare(self, args, op): """Returns True if the spec...
{ "content_hash": "b8930a2ec57c21ccbab47a9ef96998fc", "timestamp": "", "source": "github", "line_count": 134, "max_line_length": 73, "avg_line_length": 31.828358208955223, "alnum_prop": 0.5582649472450176, "repo_name": "DPaaS-Raksha/raksha", "id": "e80d2d337db1acf71861ab0ce6d6de98686a4c70", "size": ...
import os import re from distcovery.exceptions import InvalidTestRoot _TEST_UNIT_PREFIX = 'test_' _PYTHON_TOKEN_REGEX = '([a-zA-Z0-9_]+)' _TEST_PACKAGE_REGEX = '(%s%s)' % (_TEST_UNIT_PREFIX, _PYTHON_TOKEN_REGEX) _TEST_MODULE_REGEX = '%s\\.py' % _TEST_PACKAGE_REGEX _TEST_NAME = 1 _TEST_ALIAS = 2 _TEST_PACKAGE_PATTERN...
{ "content_hash": "914b27bef8d3dfd7e06495c2f3787848", "timestamp": "", "source": "github", "line_count": 108, "max_line_length": 76, "avg_line_length": 29.425925925925927, "alnum_prop": 0.565449968533669, "repo_name": "vasili-v/distcovery", "id": "08511bd63b42e5d2982bf06c2ce73f649cfd9a96", "size": "...
""" Define Touchstone file format reader/writer. [[[cog import os, sys sys.path.append(os.environ['TRACER_DIR']) import trace_ex_eng_touchstone exobj = trace_ex_eng_touchstone.trace_module(no_print=True) ]]] [[[end]]] """ # touchstone.py # Copyright (c) 2013-2019 Pablo Acosta-Serafini # See LICENSE for details # pylin...
{ "content_hash": "a2b690de70006f20b70088800f4f5111", "timestamp": "", "source": "github", "line_count": 396, "max_line_length": 87, "avg_line_length": 37.54040404040404, "alnum_prop": 0.5830082066460379, "repo_name": "pmacosta/peng", "id": "8e28dda844402de766b067589db62d1d2277aafb", "size": "14866"...
""" Example program used by execute_code functions """ # Example comment for unit testing # pylint: disable=too-few-public-methods class Hello(object): """ Simple class to show imports """ def __init__(self): self.msg = 'Hello, ' + 'world!' def out(self): """ returns Hello, world!""" ...
{ "content_hash": "35fe3a0e3becf958a23f1e25c6945ebc", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 54, "avg_line_length": 26.066666666666666, "alnum_prop": 0.5907928388746803, "repo_name": "jpsenior/sphinx-execute-code", "id": "fafa837482485c7ecdb24261a98229ef6fd941a5", ...
"""Class for hyperparameters.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import six class HParams(object): """Class to hold a set of hyperparameters as name-value pairs.""" _HAS_DYNAMIC_ATTRIBUTES = True # Required for pytype checks. def...
{ "content_hash": "e4bc5c43746f8b59062a853a353ecd26", "timestamp": "", "source": "github", "line_count": 89, "max_line_length": 80, "avg_line_length": 34.61797752808989, "alnum_prop": 0.673482635507952, "repo_name": "google-research/valan", "id": "ff7412365abc13791dca470c65777a8c5909d7ee", "size": "...
from __future__ import print_function from ommongo.py3compat import * from functools import wraps def known_failure(fun): @wraps(fun) def wrapper(*args, **kwds): try: fun(*args, **kwds) raise Exception('Known failure passed! %s' % fun.__name__) except: pass ...
{ "content_hash": "b25fdab1eafe8d42e3f2544c78c38913", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 70, "avg_line_length": 24.214285714285715, "alnum_prop": 0.5899705014749262, "repo_name": "bapakode/OmMongo", "id": "32c4307371e27874f7470933148aea7ce5be479c", "size": "339...
from app import db from app.models import User from tests.general import AppTestCase class TestModels(AppTestCase): def test_user_initialization(self): user = User(name='foo', social_id='bar') db.session.add(user) db.session.commit() dictionary = user.dictionary self.asser...
{ "content_hash": "0be7519c8b1cd76324620a7264e8234b", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 48, "avg_line_length": 27, "alnum_prop": 0.6851851851851852, "repo_name": "Encrylize/MyDictionary", "id": "412611f6031f9c8571c059d7744c8c5029150a13", "size": "378", "bina...
import os from dataclasses import dataclass, field from functional import seq from typing import Any, Iterable, Set from anki.exporting import AnkiExporter from .file_provider import FileProvider @dataclass class NoteModelFileProvider(FileProvider): anki_collection: Any model_ids: Iterable[int] models: ...
{ "content_hash": "092b02b673433039973a2370d640f2a7", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 85, "avg_line_length": 32.57575757575758, "alnum_prop": 0.6502325581395348, "repo_name": "Stvad/CrowdAnki", "id": "c2e1b0c6ea4b3ff8fcb101f64eb146e5431e85b2", "size": "1075"...
import os import bcrypt from wtforms import form, fields, validators from flask_wtf import Form from wtforms import TextAreaField, StringField, validators from app import models class LoginForm(Form): """ Login form with built in validation of password. """ username = fields.TextField(validators=[validators...
{ "content_hash": "f1eb339edf6c6d446e60f0e58fdfb8e5", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 84, "avg_line_length": 31.102564102564102, "alnum_prop": 0.6892003297609234, "repo_name": "streety/Home", "id": "5c2f5bc318fbdf794601c986cd9a1d19ac4f0e89", "size": "1213", ...
from pprint import pprint import kaboom.api import kaboom.vm def status(api): print "Coinbase: %s" % api.coinbase() print "Listening? %s" % api.is_listening() print "Mining? %s" % api.is_mining() print "Peer count: %d" % api.peer_count() last_block = api.last_block() print "Last Block:" ...
{ "content_hash": "c01f30ff514338d0bf27fef18e5fcc3b", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 46, "avg_line_length": 23.344827586206897, "alnum_prop": 0.6026587887740029, "repo_name": "Cpt-Obvious/kaboom", "id": "11577038cfa00bb9348415bf034b08014919cfad", "size": "7...
import time from kafka import SimpleProducer, KafkaClient from kafka.common import LeaderNotAvailableError import json def print_response(response=None): if response: print('Error: {0}'.format(response[0].error)) print('Offset: {0}'.format(response[0].offset)) def main(): kafka = KafkaCl...
{ "content_hash": "9de2f055c7cc86619ef40c70055f1a28", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 176, "avg_line_length": 37.138888888888886, "alnum_prop": 0.6537023186237846, "repo_name": "jhn/generic", "id": "2facb5e9d8035380404ce2b2a71fa82dd605992a", "size": "1337", ...
import uuid from msrest.pipeline import ClientRawResponse from .. import models class ApplicationsOperations(object): """ApplicationsOperations operations. :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :...
{ "content_hash": "797bdf21e24eb4d7cfacfc03cf4adb13", "timestamp": "", "source": "github", "line_count": 564, "max_line_length": 144, "avg_line_length": 45.530141843971634, "alnum_prop": 0.6411854044160599, "repo_name": "AutorestCI/azure-sdk-for-python", "id": "5aa4cc31047c005c201ddebd0189f0186d924715...
"""Tests for cmake database generation. Attributes: FlagsFile (TYPE): Description """ import imp from os import path from unittest import TestCase from EasyClangComplete.plugin.flags_sources import flags_file from EasyClangComplete.plugin.utils import flag from EasyClangComplete.plugin.utils import search_scope ...
{ "content_hash": "da935c4b27ec35ed40233b3eb904dd30", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 71, "avg_line_length": 29.803571428571427, "alnum_prop": 0.6602756141402037, "repo_name": "niosus/EasyClangComplete", "id": "37e1f2507548e8116a1cb0e23bdac4fb80de8e84", "siz...
from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('quotes', '0001_initial'), ] ...
{ "content_hash": "4e87b448e6f3c93aee00b53293c1bf87", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 136, "avg_line_length": 31.26923076923077, "alnum_prop": 0.6445264452644527, "repo_name": "nivbend/memoir", "id": "bce87dcc42ca0420240beb40c2e46738eb95f197", "size": "885",...
import argparse import os import os.path import sqlite3 from . import zettel # TODO: 'filename' and 'document' are special fields for stuff not really part of the YAML dictionary # but still needing to be indexable and searchable. ZettelSQLFields = zettel.ZettelFieldsOrdered # Default Zettel DB name ZDB = 'zettels.d...
{ "content_hash": "57b0998d31970a12f8ca0035b48182d3", "timestamp": "", "source": "github", "line_count": 208, "max_line_length": 101, "avg_line_length": 27.903846153846153, "alnum_prop": 0.5725361819434872, "repo_name": "ZettelGeist/zettelgeist", "id": "4b4fb3b934296c0780bff0c2ad6f5aa4a54784f1", "si...
""" Copyright (c) 2010 Karl-Michael Schneider 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, dis...
{ "content_hash": "5eae7196332e62cf7016323b26f253cd", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 77, "avg_line_length": 43.924528301886795, "alnum_prop": 0.7865120274914089, "repo_name": "karlmicha/rguils", "id": "bcb1fef635c3bd6f87a0f168b1fa19c7384c4559", "size": "232...
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('devilry_compressionutil', '0001_initial'), ] operations = [ migrations.AddField( model_name='compressedarchivemeta', name='backend_id', field=models.Char...
{ "content_hash": "09dd2ab6462ab52f08dca423a98f532e", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 75, "avg_line_length": 26.476190476190474, "alnum_prop": 0.5881294964028777, "repo_name": "devilry/devilry-django", "id": "a03c4bb7d75fdf789925ab0e14e5ad0bc12add85", "size"...
""" Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree/description/ """ # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None ...
{ "content_hash": "625964f18d6cd66239e9f31064141ba7", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 90, "avg_line_length": 26.979591836734695, "alnum_prop": 0.5075642965204236, "repo_name": "ytjia/coding-practice", "id": "5a953b93e56cb224e2e74ea7571c024123e02f12", "size":...
""" ymir.loom factories for fabric commands """ import os from fabric.colors import red from fabric.contrib.console import confirm def create_version_bump_cmd(pkg_name=None, version_delta=0.1, **kargs): """ a factory for generating a 'version-bump' function, which can be called from service fabfiles ...
{ "content_hash": "da36b103cf51e2e56106d1f5c9a6f525", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 76, "avg_line_length": 39.24444444444445, "alnum_prop": 0.5996602491506229, "repo_name": "mattvonrocketstein/ymir", "id": "5293cbfe0490ff9bda18712fbc23cdca8371fb0f", "size"...
"""Tests for the conductor service.""" import mox from nova.api.ec2 import ec2utils from nova.compute import flavors from nova.compute import utils as compute_utils from nova.compute import vm_states from nova import conductor from nova.conductor import api as conductor_api from nova.conductor import manager as condu...
{ "content_hash": "1a0f806e11d9ef2cb220dee443e3bd30", "timestamp": "", "source": "github", "line_count": 1128, "max_line_length": 79, "avg_line_length": 46.71719858156028, "alnum_prop": 0.5420801943184621, "repo_name": "sridevikoushik31/nova", "id": "5044342f9f7df8059cbe53ed70f6573059788bf1", "size"...
""" Copyright 2017 ManerFan 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 distr...
{ "content_hash": "12a7453375987d2549b3741929e0eebf", "timestamp": "", "source": "github", "line_count": 125, "max_line_length": 91, "avg_line_length": 25.224, "alnum_prop": 0.6089438629876308, "repo_name": "manerfan/python-game-snake", "id": "fef50bf0989cb38b4b1639616247fc77dd4bfc6f", "size": "3291...