text stringlengths 4 1.02M | meta dict |
|---|---|
import subprocess
def get_gitconfig(key, subkey, is_global=False):
cmd = ['git', 'config', '--null']
if is_global:
cmd.append('--global')
cmd.extend(['--get', '{}.{}'.format(key, subkey)])
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
out, err = proc.communicate()
if proc.returnc... | {
"content_hash": "021ad4b4bf8f49e0ba14a8afdc143a87",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 56,
"avg_line_length": 29.846153846153847,
"alnum_prop": 0.5927835051546392,
"repo_name": "depp/headerfix",
"id": "f7b756510eba15b0e6503528d5d8c775f2897f38",
"size": "559",... |
from mock import patch, Mock
from oslo.config import cfg
import unittest
from savanna.exceptions import NotFoundException, SavannaException
import savanna.openstack.common.exception as os_ex
from savanna.service.api import Resource
import savanna.service.validation as v
CONF = cfg.CONF
CONF.import_opt('allow_cluster... | {
"content_hash": "205ea7640b3853a9d34f9ceaa099b88e",
"timestamp": "",
"source": "github",
"line_count": 506,
"max_line_length": 79,
"avg_line_length": 35.387351778656125,
"alnum_prop": 0.5041885401541383,
"repo_name": "darionyaphets/savanna",
"id": "7ff6a322e636c145da25689e3c02c33b67161679",
"size"... |
class NullAPIKeyError(Exception):
"""Raised when the api_key is None
"""
class ConnectionError(Exception):
def __init__(self, response, content=None, message=None):
self.response = response
self.content = content
self.message = message
def __str__(self):
message = "Fai... | {
"content_hash": "ac0285612b22d18b63cc56b81190d2ab",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 77,
"avg_line_length": 27.5,
"alnum_prop": 0.638961038961039,
"repo_name": "michaeltcoelho/pagarme.py",
"id": "0c1ca94d2dfbd9e4dd7bcbcfa6b425b3cca72e0c",
"size": "1172",
... |
import sys
import json
def main(argv):
line = sys.stdin.readline()
try:
while line:
line = line.rstrip()
print line
line = sys.stdin.readline()
except "end of file":
return None
if __name__ == "__main__":
main(sys.argv)
| {
"content_hash": "94ed54f52d184db45da4062e612c2720",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 33,
"avg_line_length": 17.2,
"alnum_prop": 0.5852713178294574,
"repo_name": "dgonzo/bmdc_skullcandy",
"id": "b93c2439ede5c3480707bbba509efc741e8e4690",
"size": "281",
"bi... |
"""empty message
Revision ID: 0056_minor_updates
Revises: 0055_service_whitelist
Create Date: 2016-10-04 09:43:42.321138
"""
# revision identifiers, used by Alembic.
revision = "0056_minor_updates"
down_revision = "0055_service_whitelist"
import sqlalchemy as sa
from alembic import op
def upgrade():
### comma... | {
"content_hash": "230c3063f5287b9dcd2e0b3cb90e4314",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 119,
"avg_line_length": 43.97222222222222,
"alnum_prop": 0.7087807959570436,
"repo_name": "alphagov/notifications-api",
"id": "f5010298deb70bf5b0ca2be81489cf99c2ffdc7f",
"s... |
import csv
import os
import color
def _GetDataDirPath():
return os.path.join(os.path.dirname(__file__), 'data')
def _GetCsvPath():
return os.path.join(_GetDataDirPath(), 'dmccolors.csv')
def _GetCsvString():
with open(_GetCsvPath()) as f:
return f.read().strip()
def _CreateDmcColorFromRow(row):
number =... | {
"content_hash": "2063ad1ddc94eb279fb635471ee5a122",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 86,
"avg_line_length": 22.94871794871795,
"alnum_prop": 0.6804469273743017,
"repo_name": "nanaze/pystitch",
"id": "fd3984b534dd7ca8e09df8dadc0359fabf1e0211",
"size": "1790"... |
from random import randint
### AlphabetLengths:
alphabetLengths = [2,4,8,16,32,64,128,256]
#InstanceSize
instanceSize = 2**20
numberOfQuestions = 10*instanceSize
def generateInstance(alphabetLength,instanceSize,numberOfQuestions,name):
filer = open(name,'w')
sb = str(instanceSize) + " " + str(numberOfQue... | {
"content_hash": "4ff8b8b14f3efb0d142e2d8146585f35",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 125,
"avg_line_length": 31.77777777777778,
"alnum_prop": 0.6937062937062937,
"repo_name": "bsubercaseaux/dcc",
"id": "6877f84e4d149c770c86e39b9f288a3401e27116",
"size": "14... |
from django.http import HttpResponseNotFound
def test_404(request):
return HttpResponseNotFound("Not found")
| {
"content_hash": "d42728169004cfe057f7b9d3d43a1f4d",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 44,
"avg_line_length": 23,
"alnum_prop": 0.7913043478260869,
"repo_name": "dominicrodger/tinyblog",
"id": "f66cfc1b79f7e404c128a710f36aacadb5952c1d",
"size": "115",
"binar... |
from tempest_lib import exceptions as lib_exc
from tempest.api.network import base
from tempest import config
from tempest import test
CONF = config.CONF
class ExternalNetworksAdminNegativeTestJSON(base.BaseAdminNetworkTest):
@test.attr(type=['negative'])
@test.idempotent_id('d402ae6c-0be0-4d8e-833b-a73889... | {
"content_hash": "aac1e6d3eeb1b53355f3b2ce24e23e75",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 72,
"avg_line_length": 39.38461538461539,
"alnum_prop": 0.6451822916666666,
"repo_name": "liucode/tempest-master",
"id": "8dfce248f23eff49bcb5361229c468753910cc85",
"size":... |
from __future__ import absolute_import, division, print_function, unicode_literals
from thrift.protocol.TProtocol import *
from struct import pack, unpack
class TBinaryProtocol(TProtocolBase):
"""Binary implementation of the Thrift protocol driver."""
# For simpler THeaderTransport
PROTOCOL_ID = 0x80
... | {
"content_hash": "8668f67edf2001abf232f773d3a425bd",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 83,
"avg_line_length": 26.64503816793893,
"alnum_prop": 0.5989113307549062,
"repo_name": "facebook/fbthrift",
"id": "f93caf9bf991e5dac88ac4341ff4ab0d11f53dc6",
"size": "75... |
import unittest
import time
from django.contrib.sessions.backends.base import CreateError
from django.conf import settings
## on tests.. configure the settings manuall
settings.configure(
SESSION_ENGINE='rethinkdb_sessions.main'
)
####
from rethinkdb_sessions import main
class TestSequenceFunctions(unittest.Test... | {
"content_hash": "59f47b4a3cac0a4ce8a061f2ae6007f6",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 79,
"avg_line_length": 31.08653846153846,
"alnum_prop": 0.7015156201670275,
"repo_name": "MaxPresman/django-rethinkdb-sessions",
"id": "423fbf468b270eab7feebcd4eea4dd563e04c... |
from __future__ import division
import vtk
################################################################################
# Some fixed classes that solve a few VTK API issues
# This dictionary stores the patched class to vtk class mapping.
# This would be naturally better stored as an attribute directly on the
# p... | {
"content_hash": "92d70f0a66bddb874277c2b69ccfbc93",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 97,
"avg_line_length": 40.970588235294116,
"alnum_prop": 0.7164393395549175,
"repo_name": "VisTrails/VisTrails",
"id": "b4d351965ad4b5e6268cc33af189edb53c985446",
"size": "... |
import re
USERS = {
"UID": 0x100000000,
"GID": 0x200000000,
"ALL": 0x400000000,
"CLUSTER": 0x800000000
}
RESOURCES = {
"VM" : 0x1000000000,
"HOST": 0x2000000000,
"NET": 0x4000000000,
"IMAGE": 0x8000000000,
"USER": 0x100... | {
"content_hash": "7237c7fc708b623e0fde54af8a6867c1",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 100,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.5608880915003364,
"repo_name": "baby-gnu/one",
"id": "bf673f4e29db29c10504fcfff822c08d739b197a",
"size": "5898"... |
"""
Created on Mon Jul 17 16:17:25 2017
@author: jorgemauricio
- Definir una clase llamada Circulo que pueda ser construida por el radio.
La clase Circulo debe de contener un método que pueda calcular el área
"""
| {
"content_hash": "39b5ab1b5902c8317ad2646abbc6b89e",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 75,
"avg_line_length": 27.5,
"alnum_prop": 0.7454545454545455,
"repo_name": "jorgemauricio/INIFAP_Course",
"id": "9cae67656dc0a8f36362ce6621e6fd461d3eaf65",
"size": "269",
... |
from distutils.core import setup
setup(name='TUF',
version='0.0',
description='A secure updater framework for Python',
author='lots of people',
url='https://updateframework.com',
packages=['tuf',
'tuf.repo',
'tuf.client',
'tuf.pushtools',
'tuf.pushtools.transfer',
'simplejso... | {
"content_hash": "2e08ffa68653e1a5512fd5f7df48b185",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 122,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.643956043956044,
"repo_name": "monzum/tuf-legacy",
"id": "8a30b6be764bcc56bc1ee8c307b67d29e83deabf",
"size": "47... |
from django import template
from library.ui.models import Media
from settings import BASE_URL, MEDIA_URL, MEDIA_ROOT
import os
import string
register = template.Library()
@register.filter
def thumbnail(media):
location = media.locationSingularString.strip(string.lowercase)
name = MEDIA_URL + "thumbnails/" + ... | {
"content_hash": "02b492e2c37d724357aea67224b9b53d",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 67,
"avg_line_length": 29.19047619047619,
"alnum_prop": 0.6802610114192496,
"repo_name": "pusateri/vsd",
"id": "2f07adedded63bf22a97f31da8d84a102dc2d108",
"size": "613",
... |
"""
@package ion.agents.platform.rsn.test.oms_simple
@file ion/agents/platform/rsn/test/oms_simple.py
@author Carlos Rueda
@brief Program that connects to the real RSN OMS endpoint to do basic
verification of the operations. Note that VPN is required.
Also, port 5000 on the localhost (via corres... | {
"content_hash": "4eaf30bae8b0006cc5c880586fe4587d",
"timestamp": "",
"source": "github",
"line_count": 437,
"max_line_length": 109,
"avg_line_length": 38.11212814645309,
"alnum_prop": 0.551606124287001,
"repo_name": "mikeh77/mi-instrument",
"id": "a228e7c71dd846cba1900f9140713e941e4ac2c6",
"size":... |
import os
import argparse
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import euclidean_distances
from sklearn.manifold import MDS
from output.emission_prob import plain_posttype_txt
from sequences.label_dictionary import LabelDictionary
from readers.vocab import read_vocab
from util.util i... | {
"content_hash": "591cc8fab420ec687655dd3f7341f4c4",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 118,
"avg_line_length": 32.53,
"alnum_prop": 0.6387949584998462,
"repo_name": "rug-compling/hmm-reps",
"id": "29bf5635b315d6d38f8bcdfeb51bf510f9ddb77e",
"size": "3253",
... |
from model import TripletEmbedding
import numpy as np
import logging
logging.basicConfig(level=logging.INFO)
te = TripletEmbedding(100, 20, 5, 3, [4], learning_rate=10e-2, sigma=10e-4)
subjects = np.random.randint(0, 100, size=1000)
objects = np.random.randint(0, 100, size=1000)
predicates = np.random.randint(0, 20... | {
"content_hash": "0734bc99a46535f1398acf483a08c921",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 75,
"avg_line_length": 27.80952380952381,
"alnum_prop": 0.708904109589041,
"repo_name": "nukui-s/TripletEmbedding",
"id": "f702f70a23f3467cebe8751358af95555d5e6ac1",
"size"... |
"""Load and Unload all GitGutter modules.
This module exports __all__ modules, which Sublime Text needs to know about.
The list of __all__ exported symbols is defined in modules/__init__.py.
"""
import sublime
if int(sublime.version()) < 3176:
print('GitGutter requires ST3 3176+')
else:
import sys
prefix... | {
"content_hash": "13fb783cc568009bcea7b6a45832332c",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 76,
"avg_line_length": 30.6,
"alnum_prop": 0.6552287581699346,
"repo_name": "jisaacks/GitGutter",
"id": "91540dee49e5e0486dec34e573c37f391a4975db",
"size": "636",
"binary... |
from __future__ import unicode_literals
import readtime
AUTHOR = 'David Jenkins'
SITENAME = 'DJenkins Dev'
SITEURL = 'http://localhost:8000'
PATH = 'content'
TIMEZONE = 'America/New_York'
DEFAULT_LANG = 'en'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TR... | {
"content_hash": "d64976236ddc6eb1ff7e34d0f4f24167",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 77,
"avg_line_length": 17.864864864864863,
"alnum_prop": 0.7397881996974282,
"repo_name": "JenkinsDev/DJenkinsDev",
"id": "ecbbc7c91d95285ddd7344ff5bf4f182dbbd4684",
"size"... |
class HuluError(Exception):
pass
| {
"content_hash": "022dc1c887182fee0331eb3fa00aa150",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 27,
"avg_line_length": 18.5,
"alnum_prop": 0.7297297297297297,
"repo_name": "michaelhelmick/hulu",
"id": "a3399b5e3df750e541cc2e7ac8adf0ca72862b1b",
"size": "37",
"binary"... |
import os
from flask import Flask
from flask import render_template
from flask import url_for
from flask import request
from twilio import twiml
from twilio.util import TwilioCapability
# Declare and configure application
app = Flask(__name__, static_url_path='/static')
app.config.from_pyfile('local_settings.py')
... | {
"content_hash": "cc80762cc084978e69f52430ea0d0ae8",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 76,
"avg_line_length": 31.633802816901408,
"alnum_prop": 0.6340160284951024,
"repo_name": "jpf/Twilio-SxSW-game",
"id": "8957fd038119de886d5e04b4310c970dac3f18fd",
"size": ... |
"""
Module for ordering errata.
"""
import datetime
import os
import copy
import time
import logging
from dateutil import parser as dateutil_parser
from dateutil import tz as dateutil_tz
from updatebot import update
from updatebot import conaryhelper
from updatebot.errors import MissingErrataError
from updatebot.erro... | {
"content_hash": "7957d272a0b81e0b734e4af356353551",
"timestamp": "",
"source": "github",
"line_count": 1125,
"max_line_length": 103,
"avg_line_length": 40.31022222222222,
"alnum_prop": 0.5313016825067808,
"repo_name": "sassoftware/mirrorball",
"id": "1be4dcf87aabf021e0ec0cfe0579f42dc924bfa6",
"siz... |
import simplejson as json
import logging.config
import socket
import sys
import hpfeeds
from datetime import datetime
from logging.handlers import SocketHandler
from twisted.internet import reactor
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:... | {
"content_hash": "fcf3313aaadc971e2110d5323b431216",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 82,
"avg_line_length": 34.2020202020202,
"alnum_prop": 0.5234790313053751,
"repo_name": "aabed/opencanary",
"id": "22bbaeaaf784d742f413491a3eac39f5eed05bb7",
"size": "6772... |
"""Ino (http://inotool.org/) based arduino build wrapper."""
import argparse
import io
import logging
import os
import shutil
import subprocess
import sys
import tempfile
from ino.environment import Environment
from ino.commands.build import Build
from ino.exc import Abort
from b3.steps.step_base import StepBase
c... | {
"content_hash": "95c6804cb49a0eeb9d4a4d1b0157a270",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 78,
"avg_line_length": 28.027027027027028,
"alnum_prop": 0.6470588235294118,
"repo_name": "robionica/b3",
"id": "1d1cbc5c51ef79a42a3c06e3ec93283b0568f768",
"size": "3734",... |
import urllib, json
def results(parsed, original_query):
search_specs = [
["Thingiverse", "~thingquery", "http://www.thingiverse.com/search?q="],
]
for name, key, url in search_specs:
if key in parsed:
search_url = url + urllib.quote_plus(parsed[key])
return {
"title": "Search {0} for '{1}'".for... | {
"content_hash": "0122e2cd0d16d38b325d3a8423db52d8",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 164,
"avg_line_length": 30.5,
"alnum_prop": 0.6216897856242118,
"repo_name": "thenewhobbyist/thingiverse-flashlight-plugin",
"id": "9f4e9ffdc69542f9b8e15a5884c6efae543b4655",... |
from bot_tests import BotTests
from bot import BADLY_FORMATTED_DATA_ERROR
class InvalidPostTests(BotTests):
def test_only_one_data_set(self):
resp = self.app.post_json('/', {"data": [
[1, 2, 3],
]}, expect_errors=True)
self.assertEqual(resp.status_int, 400)
self.assertI... | {
"content_hash": "ef9b8e30178d60a978b68f8ef66ee304",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 76,
"avg_line_length": 33.857142857142854,
"alnum_prop": 0.569620253164557,
"repo_name": "skoczen/correlationbot",
"id": "2b0b71836eabb0136caf07a75b7782b90eeb6e9b",
"size":... |
import pytest
from django.contrib.auth.models import User
from django.test.testcases import TestCase, TransactionTestCase
from pydjango.patches import Function, Class, Instance
def test_no_savepoints(request):
"no fixtures and no setup_module so shouldnt have savepoints"
for node in request.node.listchain():
... | {
"content_hash": "fdc4f8ac1667cc8279c901c7c13f681c",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 65,
"avg_line_length": 33.63333333333333,
"alnum_prop": 0.6818632309217046,
"repo_name": "krya/pydjango",
"id": "3927b454a5ffa704a7d4c7ca12eae9ef368eec88",
"size": "2043",
... |
"""
Fine-tuning a 🤗 Transformers model on text translation.
"""
# You can also adapt this script on your own text translation task. Pointers for this are left as comments.
import argparse
import logging
import math
import os
import random
import datasets
import numpy as np
import torch
from datasets import load_data... | {
"content_hash": "8a967102c5dd48b60bef7ce3b51cc0e4",
"timestamp": "",
"source": "github",
"line_count": 545,
"max_line_length": 119,
"avg_line_length": 40.508256880733946,
"alnum_prop": 0.646827014540019,
"repo_name": "huggingface/pytorch-transformers",
"id": "4350d59b9a2ee0434d49c6d53da7c70fe291801f... |
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.contrib.sites.models import Site
try:
from django.apps import apps
get_model = apps.get_model
except:
from django.db.models.loading import get_model
from scoutandrove.apps.sr.models import get_te... | {
"content_hash": "1ba066d48814bb0b32cf3cd325ea7ff7",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 117,
"avg_line_length": 35.810810810810814,
"alnum_prop": 0.6120754716981132,
"repo_name": "ninapavlich/scout-and-rove",
"id": "2d1d980f13081ac0c0688976067e5392cdf0dc07",
"... |
"""Tests for the NgramAnnotator"""
from __future__ import absolute_import
import unittest
from epitator.annotator import AnnoDoc
from epitator.ngram_annotator import NgramAnnotator
class NgramAnnotatorTest(unittest.TestCase):
def setUp(self):
self.annotator = NgramAnnotator()
def test_one_word_sent... | {
"content_hash": "f33481e2a18b2d1538f783dff118cd9e",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 71,
"avg_line_length": 33.166666666666664,
"alnum_prop": 0.6454494695700725,
"repo_name": "ecohealthalliance/EpiTator",
"id": "928e6066a8b447cde434dd36546ce6078c62a4a5",
"s... |
"""Displays calibration and guide offsets
History:
2011-02-16 ROwen
2011-02-18 ROwen Removed the rotator axis since we never set rotator calib or guide offsets on the 3.5m.
"""
import Tkinter
import RO.CoordSys
import RO.StringUtil
import RO.Wdg
import TUI.TCC.TCCModel
_HelpURL = "Telescope/StatusWin.html#Offsets"... | {
"content_hash": "3c8ab6a2544d90da0651a32dab5daf0f",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 120,
"avg_line_length": 32.509803921568626,
"alnum_prop": 0.5729794933655006,
"repo_name": "r-owen/TUI",
"id": "b75c68f9a02595055107c8f3928cdff4aacc6163",
"size": "3338",
... |
from commander.public import Commander
from source.public import Source
from .cloud_commanding import \
CreateTargetCommand, \
StopTargetCommand, \
DeleteBootstrapNetworkInterfaceCommand, \
DeleteBootstrapVolumeCommand, \
ConfigureBootDeviceCommand, \
StartTargetCommand
from .target_system_inf... | {
"content_hash": "02b422367f083cccd64ed500b50d93e6",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 113,
"avg_line_length": 47.333333333333336,
"alnum_prop": 0.7953051643192488,
"repo_name": "jdepoix/goto_cloud",
"id": "a1c21401476470d1912e20b26d628cc286aa8ba1",
"size": "... |
from coapthon import defines
from coapthon.messages.option import Option
__author__ = 'Giacomo Tanganelli'
__version__ = "2.0"
class Message(object):
"""
Manage messages.
"""
def __init__(self):
"""
Initialize a CoAP Message.
"""
# The type. One of {CON, NON, ACK or ... | {
"content_hash": "d8f8518bba55f161282c2565ca042d60",
"timestamp": "",
"source": "github",
"line_count": 353,
"max_line_length": 107,
"avg_line_length": 26.059490084985836,
"alnum_prop": 0.5435373410153278,
"repo_name": "kuggenhoffen/CoAPthon",
"id": "b8b8d531e595045aba5d9512b358fbc905643dec",
"size... |
import os
import sys
from setuptools import setup
# To use:
# python setup.py bdist --format=wininst
from flopy import __version__, __name__, __author__
# trap someone trying to install flopy with something other
# than python 2 or 3
if not sys.version_info[0] in [2, 3]:
print('Sorry, Flopy not sup... | {
"content_hash": "04d46dbb65562c61eab57ca5ad002c3e",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 115,
"avg_line_length": 39.1219512195122,
"alnum_prop": 0.6396508728179551,
"repo_name": "brclark-usgs/flopy",
"id": "fbdb73cbc6a6e48ce963349d4be06209b369105e",
"size": "16... |
from google.cloud import osconfig_v1alpha
def sample_update_os_policy_assignment():
# Create a client
client = osconfig_v1alpha.OsConfigZonalServiceClient()
# Initialize request argument(s)
os_policy_assignment = osconfig_v1alpha.OSPolicyAssignment()
os_policy_assignment.os_policies.id = "id_valu... | {
"content_hash": "df7f0f6073991792d9dc3a4b4d18a998",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 92,
"avg_line_length": 36.806451612903224,
"alnum_prop": 0.7502191060473269,
"repo_name": "googleapis/python-os-config",
"id": "4cc1a2b74a84044a429a68029dcbb3828f73eecf",
"... |
"""A plugin to tag events according to rules in a tag file."""
import logging
import re
import os
from efilter import ast as efilter_ast
from efilter import api as efilter_api
from efilter import errors as efilter_errors
from efilter import query as efilter_query
from plaso.analysis import interface
from plaso.analy... | {
"content_hash": "e8e5075b4307d75cd0caed0990eac471",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 80,
"avg_line_length": 32.15384615384615,
"alnum_prop": 0.6611314382212216,
"repo_name": "dc3-plaso/plaso",
"id": "3104c3cd76281223f638b1df9ee38ffd4ddfe840",
"size": "7130... |
"""implement adder quantizer."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import copy
from absl import logging
from qkeras.qtools.quantized_operators import adder_impl
from qkeras.qtools.quantized_operators import quantizer_impl
class I... | {
"content_hash": "24da91a6e46672602741baa376832f7b",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 66,
"avg_line_length": 29.852272727272727,
"alnum_prop": 0.6128663875142748,
"repo_name": "google/qkeras",
"id": "7250c1e34c98276af17c17641cf8e228f8dbd3d5",
"size": "3284",... |
import re
import base64
import pathlib
import json
from cumulusci.tasks.salesforce import BaseSalesforceApiTask
from cumulusci.core.exceptions import CumulusCIException
from simple_salesforce.exceptions import SalesforceMalformedRequest
def join_errors(e: SalesforceMalformedRequest) -> str:
return "; ".join([err... | {
"content_hash": "51a8a3b72c5c3a812c1a5c00f54a39c5",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 107,
"avg_line_length": 35.67701863354037,
"alnum_prop": 0.6119428969359332,
"repo_name": "SalesforceFoundation/CumulusCI",
"id": "177f7b0115bad62cf66cb5eff2d843ed4db4ff75",... |
import unittest
from transformers import AutoFeatureExtractor, AutoTokenizer, Speech2TextForConditionalGeneration, Wav2Vec2ForCTC
from transformers.pipelines import AutomaticSpeechRecognitionPipeline
from transformers.testing_utils import require_datasets, require_torch, require_torchaudio, slow
# from .test_pipelin... | {
"content_hash": "9b9ed0afdab1f19e7309cbd9ec5088fa",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 119,
"avg_line_length": 41.54666666666667,
"alnum_prop": 0.6822849807445442,
"repo_name": "huggingface/pytorch-transformers",
"id": "91dcc71de0182742124b168ffe3ab197d71b5119"... |
import El
import time
m = 4000
n = 2000
display = True
worldRank = El.mpi.WorldRank()
# Make a sparse matrix with the last column dense
def Rectang(height,width):
A = El.DistSparseMatrix()
A.Resize(height,width)
firstLocalRow = A.FirstLocalRow()
localHeight = A.LocalHeight()
A.Reserve(5*localHeight)
for s... | {
"content_hash": "95be54c8fbb11770240ccfb7bb1e8f5b",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 66,
"avg_line_length": 24.342105263157894,
"alnum_prop": 0.6232432432432432,
"repo_name": "sg0/Elemental",
"id": "6d3978fe805fa43ee2fb40314a8d2d7bdc7c7f55",
"size": "2114",... |
r"""A placer that implements coordinate descent algorithm.
The placer can start from a scratch (i.e., empty grid), or from an existing node
locations specified by --init_placement.
The algorithm runs for a given number of epochs (iterations).
For each iteartion, for each node by a given --cd_node_order, place the nod... | {
"content_hash": "314ccdd3e65a1df75327c89b6e885464",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 80,
"avg_line_length": 33.20967741935484,
"alnum_prop": 0.7294803302574066,
"repo_name": "google-research/circuit_training",
"id": "ce88fe1320b844fe1e2f972b2ee3fdec56212519",... |
import requests
import numpy as np
class ModelServiceClient(object):
def __init__(self, host, api_key):
self.host = host
self.api_key = api_key
def predict(self, X):
if type(X) is np.ndarray:
X = X.tolist()
response = requests.post(self.host + '/predict', json={'X'... | {
"content_hash": "9d1071d82b9a344fdfd21ba2e80af2a6",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 71,
"avg_line_length": 26.35,
"alnum_prop": 0.5483870967741935,
"repo_name": "GoogleCloudPlatform/ml-on-gcp",
"id": "e022e432c78710a7b1e17cb3feafcec8716d8f03",
"size": "112... |
"""
callbacks functions used in training process
"""
from __future__ import annotations
import logging
import os
import re
import warnings
from collections import deque
from glob import glob
import numpy as np
from tensorflow.keras.callbacks import Callback
from tensorflow.keras.utils import Sequence
from megnet.uti... | {
"content_hash": "6652cecb7434db15ed2d7d67f1c90596",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 119,
"avg_line_length": 37.041666666666664,
"alnum_prop": 0.5492381634113918,
"repo_name": "materialsvirtuallab/megnet",
"id": "22e8da5907a2a4c3dcde5dab61e56c65e829198f",
... |
import json
from collections import namedtuple
import os
import tables
import numpy as np
from extremefill2D.systems import ExtremeFillSystem, ConstantCurrentSystem
from extremefill2D.meshes import ExtremeFill2DMesh
def assert_close(v1, v2, **kwargs):
assert np.allclose(v1, v2, **kwargs)
def get_path():
re... | {
"content_hash": "304882f8be78e422e71dfc9a10ca30dd",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 112,
"avg_line_length": 35.321739130434786,
"alnum_prop": 0.6277695716395865,
"repo_name": "wd15/extremefill2D",
"id": "c83dcb346bd9b3e4a3d86056723864ddc6a98d34",
"size": ... |
import six
import itertools
from st2common.util.enum import Enum
from st2common.constants.types import ResourceType as SystemResourceType
__all__ = [
'SystemRole',
'PermissionType',
'ResourceType',
'RESOURCE_TYPE_TO_PERMISSION_TYPES_MAP',
'PERMISION_TYPE_TO_DESCRIPTION_MAP',
'ALL_PERMISSION_... | {
"content_hash": "cce5db5052c29fe52795ed1856beeb99",
"timestamp": "",
"source": "github",
"line_count": 564,
"max_line_length": 99,
"avg_line_length": 39.001773049645394,
"alnum_prop": 0.660499158976224,
"repo_name": "tonybaloney/st2",
"id": "5b3b4f947962957957f140aa97430ca0fc3bd380",
"size": "2277... |
'''Package initialisation for asq.
'''
from .version import __version__
from .initiators import query # noqa
__author__ = 'Sixty North'
| {
"content_hash": "4cbbc7335ea9314bd121a74c3382ce6c",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 37,
"avg_line_length": 17.5,
"alnum_prop": 0.6857142857142857,
"repo_name": "rob-smallshire/asq",
"id": "faa28105cb9378f2cf10dda37e6175261aeca12e",
"size": "140",
"binary"... |
"""
CalDAV methods.
Modules in this package are imported by twistedcaldav.resource in order to
bind methods to CalDAVResource.
"""
__all__ = [
"acl",
"get",
"mkcalendar",
"mkcol",
"post",
"propfind",
"report",
"report_freebusy",
"report_calendar_multiget",
"report_calendar_quer... | {
"content_hash": "b965c75285fa6b9e0727f4aeb27b6fd6",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 74,
"avg_line_length": 19.227272727272727,
"alnum_prop": 0.6312056737588653,
"repo_name": "red-hood/calendarserver",
"id": "a58b53c0417e545c43826e8c7f79ae9ec6217056",
"size... |
from __future__ import unicode_literals
from django.db import migrations
def set_default_display_values(apps, schema_editor):
Question = apps.get_model('surveys', 'Question')
SubQuestion = apps.get_model('surveys', 'Question')
for question in Question.objects.all():
try:
question.lef... | {
"content_hash": "9ee87663e37406c5ed10d8da367e9fdc",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 69,
"avg_line_length": 26.96969696969697,
"alnum_prop": 0.6337078651685393,
"repo_name": "onepercentclub/bluebottle",
"id": "cde699988637b04877463f87380b3c327901c60c",
"siz... |
from __future__ import print_function
import re
from core.layers import *
import sys, os
import Levenshtein
import codecs
###############################################################################
# Unofficial p0f3 implementation in Python + plugins for other protos
# Python passive fingerprinter with s... | {
"content_hash": "e7bfa26a1d7bac9a6fb8c90ef5b8e442",
"timestamp": "",
"source": "github",
"line_count": 540,
"max_line_length": 152,
"avg_line_length": 42.62592592592593,
"alnum_prop": 0.4473455556520984,
"repo_name": "FlUxIuS/p0f3plus",
"id": "b0cefa6c2409bff79774289d7ac92bbd2dc11fec",
"size": "23... |
"""
Package for characters
"""
from pyherc.test.builders import CharacterBuilder
from pyherc.test.cutesy.dictionary import add_history_value
def strong(character):
"""
Modifies character to be strong
:param character: character to modify
:type character: Character
"""
character.body = 10
... | {
"content_hash": "c35eaf1e084ffe667ca18070fd673d0f",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 59,
"avg_line_length": 22.46875,
"alnum_prop": 0.5336114974501622,
"repo_name": "tuturto/pyherc",
"id": "eed895cfefe79e03891b041ff6780ed8f1a26469",
"size": "3283",
"binar... |
'''
Created on 09/08/2011
@author: mikel
'''
__all__ = ["fonts", "includes"]
import os
from os import listdir
from os.path import isdir, isfile, dirname, basename
import sys
import time
import xbmc, xbmcgui
import shutil
import re
from datetime import datetime
import xml.etree.ElementTree as ET
imp... | {
"content_hash": "c13b07a8f8ced6142ca3120db912124b",
"timestamp": "",
"source": "github",
"line_count": 387,
"max_line_length": 79,
"avg_line_length": 26.232558139534884,
"alnum_prop": 0.5689519306540584,
"repo_name": "mazkolain/xbmc-skinutils",
"id": "3c156dc041b7ec3c73269a5e44a3cfb8a2b5b1f2",
"si... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.frontdoor import FrontDoorManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-frontdoor
# USAGE
python network_experiment_update_profile.py
Before run the sample, please set the values of the client ID... | {
"content_hash": "565a4f01d5d490e7fbdc7a8d80f1f1af",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 143,
"avg_line_length": 36.26470588235294,
"alnum_prop": 0.7250608272506083,
"repo_name": "Azure/azure-sdk-for-python",
"id": "f1c4c2fd400a605d264ad97fefe3fdbb64845b92",
"s... |
"""
Custom managers for Django models registered with the tagging
application.
"""
from django.contrib.contenttypes.models import ContentType
from django.db import models
class ModelTagManager(models.Manager):
"""
A manager for retrieving tags for a particular model.
"""
def __init__(self, tag_model):... | {
"content_hash": "e962089b762f6456458c608035675759",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 94,
"avg_line_length": 35.44871794871795,
"alnum_prop": 0.6546112115732369,
"repo_name": "mstepniowski/django-newtagging",
"id": "1dbcb2999b6a281f624777d32c20b3df30f0182d",
... |
import urllib
import urllib2
import json
from BeautifulSoup import BeautifulSoup
from odm.catalogs.utils import metautils
from odm.catalogs.CatalogReader import CatalogReader
def berlin_to_odm(group):
# One dataset about WLAN locations...
if group == 'oeffentlich':
return [u'Infrastruktur, Bauen und Wo... | {
"content_hash": "c32a3188b3c92d95ad3ab6755ad32591",
"timestamp": "",
"source": "github",
"line_count": 301,
"max_line_length": 176,
"avg_line_length": 40.3421926910299,
"alnum_prop": 0.5668286255455818,
"repo_name": "mattfullerton/odm-catalogreaders",
"id": "5c66a2e79d29b5e760a05e9cb396b85db1b6e714"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('delibere', '0029_auto_20170616_0033'),
]
operations = [
migrations.AlterModelOptions(
name='amministrazione',
options={'orde... | {
"content_hash": "dfa9edb59846374d3c2a6e2025baf987",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 91,
"avg_line_length": 26.045454545454547,
"alnum_prop": 0.6003490401396161,
"repo_name": "guglielmo/mosic2-db-delibere",
"id": "4a5896152269237c9d4ce056ffb0f90fd75b584c",
... |
__author__ = 'rolandh'
INC = "http://id.incommon.org/category/research-and-scholarship"
RELEASE = {
"": ["eduPersonTargetedID"],
INC: ["eduPersonPrincipalName", "eduPersonScopedAffiliation", "mail",
"givenName", "sn", "displayName"]
}
| {
"content_hash": "434509f4844187d2239a9244b33c8374",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 73,
"avg_line_length": 25.6,
"alnum_prop": 0.6484375,
"repo_name": "arbn/pysaml2",
"id": "2956ff2b78b15a20d8b854abde0dc63ff2d6631a",
"size": "256",
"binary": false,
"co... |
import tempfile
import unittest
from telemetry.internal import story_runner
from telemetry.page import page
from telemetry.page import page_test
from telemetry.page import shared_page_state
from telemetry import story as story_module
from telemetry.testing import fakes
from telemetry.util import wpr_modes
def SetUpP... | {
"content_hash": "33fc50a73e0e74b953c9d08f2e417c7f",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 76,
"avg_line_length": 36.06194690265487,
"alnum_prop": 0.7241717791411043,
"repo_name": "Bysmyyr/chromium-crosswalk",
"id": "323f6c3dbe5235b4e07b5e77958a87c5b4b79cc1",
"s... |
"""Tests the script accuss to the basis solver.
"""
import pytest
import os
# The virtual, pseudorandom port is setup as a session fixture in conftest.py
def get_sargs(args):
"""Returns the list of arguments parsed from sys.argv.
"""
import sys
sys.argv = args
from basis.solve import _parser_options... | {
"content_hash": "8f046a692e14a93dc147cd0a006d9f3f",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 128,
"avg_line_length": 31.071428571428573,
"alnum_prop": 0.6120689655172413,
"repo_name": "wsmorgan/782",
"id": "fdcc42f048deb835b0d945d78f061097a800f45d",
"size": "1740",... |
from scrapy.item import Item, Field
class REIVAuctionItem(Item):
src_domains = Field()
src_url = Field()
prop_address = Field()
prop_suburb = Field()
prop_bedr = Field()
prop_price = Field()
prop_type = Field()
prop_url = Field()
auc_method = Field()
auc_saledate = Field()
a... | {
"content_hash": "a851ce2020ab28d13730e5c978fb0622",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 35,
"avg_line_length": 24.214285714285715,
"alnum_prop": 0.6047197640117994,
"repo_name": "johnconnelly75/RealEstateSpider",
"id": "deda6a7bee0b9b31968b65801bd796f139fde21a",... |
"""Platform for cover integration."""
from boschshcpy import SHCSession, SHCShutterControl
from homeassistant.components.cover import (
ATTR_POSITION,
SUPPORT_CLOSE,
SUPPORT_OPEN,
SUPPORT_SET_POSITION,
SUPPORT_STOP,
CoverDeviceClass,
CoverEntity,
)
from .const import DATA_SESSION, DOMAIN
f... | {
"content_hash": "0700fa60fb39209381e060f449a1f496",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 80,
"avg_line_length": 27.88372093023256,
"alnum_prop": 0.6209341117597998,
"repo_name": "home-assistant/home-assistant",
"id": "c08984ca0c222903cdaae4659935db1117efc997",
... |
from typing import List, Optional
import httpx
import networkx as nx
from qcs_api_client.models import InstructionSetArchitecture
from qcs_api_client.operations.sync import get_instruction_set_architecture
from pyquil.api import QCSClientConfiguration
from pyquil.api._qcs_client import qcs_client
from pyquil.external... | {
"content_hash": "19965c0fa0509b9c7097187904e0fd97",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 120,
"avg_line_length": 37.629629629629626,
"alnum_prop": 0.7171916010498688,
"repo_name": "rigetticomputing/pyquil",
"id": "49c96290b5b477e4648e214bc372259beff8e2e7",
"siz... |
import sys
print(sum([(int((int(line) // 3)) - 2) for line in sys.argv[1].splitlines()]))
| {
"content_hash": "b27bb61b38a964a8d911d95ab1736e05",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 78,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.6153846153846154,
"repo_name": "mre/the-coding-interview",
"id": "c39133f8fa8f41ef1d69a5365246a1da7996ad71",
"size... |
import os
import logging
from emonitor.extensions import events
from emonitor.modules.settings.settings import Settings
logger = logging.getLogger(__name__)
BEFORE = AFTER = {}
events.addEvent('file_added', handlers=[], parameters=['out.incomepath', 'out.filename'])
events.addEvent('file_removed', handlers=[], parame... | {
"content_hash": "9ad8d8e71ee00dd983ef0f7c75cf289f",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 139,
"avg_line_length": 33.47540983606557,
"alnum_prop": 0.6214495592556317,
"repo_name": "digifant/eMonitor",
"id": "9073bf65b0ee99ed9ed3f4d566d84cfaaee3903b",
"size": "20... |
import unittest
import imath
import IECore
import IECoreScene
import Gaffer
import GafferScene
import GafferSceneTest
class PointsTypeTest( GafferSceneTest.SceneTestCase ) :
def test( self ) :
points = IECoreScene.PointsPrimitive( 1 )
points["P"] = IECoreScene.PrimitiveVariable(
IECoreScene.PrimitiveVariab... | {
"content_hash": "e729b120f903272dbfbe0b2a7786c784",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 138,
"avg_line_length": 31.54945054945055,
"alnum_prop": 0.6896551724137931,
"repo_name": "ivanimanishi/gaffer",
"id": "bbbf9d45bba12bbce153d15443cd65d17050251b",
"size": "... |
import os
import sys
import unittest
import jinja2
import mock
import six
from timid import context
from timid import environment
from timid import utils
class ContextTest(unittest.TestCase):
@mock.patch.object(environment, 'Environment')
def test_init_base(self, mock_Environment):
result = context.... | {
"content_hash": "aa49d10e234e03fc505821335d44c11a",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 75,
"avg_line_length": 35.674285714285716,
"alnum_prop": 0.6452026269421752,
"repo_name": "rackerlabs/timid",
"id": "844b0b65dd75c06677b746d13974f82e03589297",
"size": "68... |
import argparse
import logging
def main():
parser = argparse.ArgumentParser(description="Boilerplate example script")
parser.add_argument('--level', '-l', default='info',
choices=['debug', 'info', 'warning', 'error', 'critical', ],
help="Set the log level")
... | {
"content_hash": "65655815569bac6ade75ea295dcacbf7",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 84,
"avg_line_length": 30.692307692307693,
"alnum_prop": 0.6040100250626567,
"repo_name": "westphahl/python-boilerplate",
"id": "3293fed612d26fbacedc8196e9fa7e938dcf53fd",
... |
from django.shortcuts import render
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib.auth.decorators import login_require... | {
"content_hash": "8b357fd99b05127ef0648b2983f20a72",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 65,
"avg_line_length": 29.545454545454547,
"alnum_prop": 0.8061538461538461,
"repo_name": "MagicWishMonkey/ronweb",
"id": "863bd2f18106a4a3f02ebe36f6bb34be8e637c6a",
"size"... |
__author__ = 'gzs2478'
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from Service import Service
class LoginService(Service):
serviceID = 1001
def __init__(self,parent):
Service.__init__(self,self.serviceID,parent)
self.initData()
def initData(self):
self.registers({\
... | {
"content_hash": "52acf1196af3f66cff7d655e57a07541",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 64,
"avg_line_length": 33.13793103448276,
"alnum_prop": 0.619146722164412,
"repo_name": "kelvict/Online-GoBang-Center",
"id": "15ffb2c3982a9afb99ea30f03b9957f33a17c855",
"s... |
"""Unit tests for the :mod:`networkx.algorithms.community.quality`
module.
"""
import networkx as nx
from networkx import barbell_graph
from networkx.algorithms.community import coverage
from networkx.algorithms.community import modularity
from networkx.algorithms.community import performance
from networkx.algorithms... | {
"content_hash": "46a182cc5665a4eaa85140f3b7bb407b",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 72,
"avg_line_length": 34.37313432835821,
"alnum_prop": 0.6261398176291794,
"repo_name": "sserrot/champion_relationships",
"id": "eda7bb3538b679172e1461202e7a42195c1ced80",
... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from django.contrib.auth.models import Group
from django.utils.translation import ugettext_lazy as _
from accounts.forms import EmailUserChangeForm, EmailUserCreationForm
from accounts.models im... | {
"content_hash": "da9963cceff5cd67b08657023481f367",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 79,
"avg_line_length": 33.95238095238095,
"alnum_prop": 0.6276297335203366,
"repo_name": "Sound-Colour-Space/sound-colour-space",
"id": "489cba73c677ced3dbf8d053934f0a6957bed... |
import paddle
import math
import numpy as np
import paddle.fluid as fluid
import paddle.fluid.layers as layers
def network(batch_size, items_num, hidden_size, step):
stdv = 1.0 / math.sqrt(hidden_size)
items = layers.data(
name="items",
shape=[batch_size, items_num, 1],
dtype="int64",... | {
"content_hash": "80b22c1e0b70005dee8f9eac121ae7e6",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 86,
"avg_line_length": 34.682539682539684,
"alnum_prop": 0.5652173913043478,
"repo_name": "kuke/models",
"id": "1cd1af9243603a9fff0554e9f2c22734e1bee217",
"size": "7157",
... |
import tensorflow as tf
import tensorlayer as tl
from tensorlayer import logging
from tensorlayer.decorators import deprecated_alias
from tensorlayer.layers.core import Layer
__all__ = [
'GaussianNoise',
]
class GaussianNoise(Layer):
"""
The :class:`GaussianNoise` class is noise layer that adding noise ... | {
"content_hash": "80b2d29e754d87461652e8c4c1854547",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 114,
"avg_line_length": 27.88607594936709,
"alnum_prop": 0.5787562414888788,
"repo_name": "zsdonghao/tensorlayer",
"id": "1a6e8546353af8e6a5051dfc50d1bb801c40b2af",
"size":... |
"""Base class for RPC testing."""
import configparser
from enum import Enum
import logging
import argparse
import os
import pdb
import shutil
import sys
import tempfile
import time
from .authproxy import JSONRPCException
from . import coverage
from .test_node import TestNode
from .mininode import NetworkThread
from .... | {
"content_hash": "82d94b4b4799ad3a85680681bfd958fe",
"timestamp": "",
"source": "github",
"line_count": 538,
"max_line_length": 334,
"avg_line_length": 42.11710037174721,
"alnum_prop": 0.6147667593450726,
"repo_name": "digibyte/digibyte",
"id": "ea011cd235f0c1d421ec647457ed62cc33c261ad",
"size": "2... |
import typing
if typing.TYPE_CHECKING: # pragma: no cover
import importlib.metadata as importlib_metadata
else:
try:
import importlib.metadata as importlib_metadata
except ImportError:
import importlib_metadata
__version__ = importlib_metadata.version(__name__.split(".", 1)[0])
__all__... | {
"content_hash": "743f19a168a043cab79fbee7f964b336",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 67,
"avg_line_length": 22.6,
"alnum_prop": 0.672566371681416,
"repo_name": "futursolo/destination",
"id": "8b4268be6becc4f8bb71a0f61093def3d2c41fe5",
"size": "1472",
"bin... |
import keystoneauth1.identity.generic as auth_plugins
from keystoneauth1 import loading
from keystoneauth1 import session as ks_session
from keystoneauth1.token_endpoint import Token
from keystoneclient import service_catalog as ks_service_catalog
from keystoneclient.v3 import client as ks_client
from keystoneclient.v3... | {
"content_hash": "6f36539b711b1cfb22747f4816167e24",
"timestamp": "",
"source": "github",
"line_count": 287,
"max_line_length": 78,
"avg_line_length": 29.627177700348433,
"alnum_prop": 0.6097847818417029,
"repo_name": "StackStorm/mistral",
"id": "088bf1c065073bc316eb6a469f5f5b521c8a0586",
"size": "... |
import itertools
from copy import copy
from django import forms
from django.conf import settings
from django.contrib.admin.widgets import AdminSplitDateTime, AdminDateWidget
from django.db.models import ObjectDoesNotExist
from django.template.loader import render_to_string
from django.utils.translation import get_lan... | {
"content_hash": "7a871d44de278725f0bfffb4f19fcaaf",
"timestamp": "",
"source": "github",
"line_count": 659,
"max_line_length": 152,
"avg_line_length": 37.4051593323217,
"alnum_prop": 0.5675456389452332,
"repo_name": "fatihzkaratana/intranet",
"id": "bdf879c6ed382c4ccc9db74b3ab3d924a74ef8f7",
"size... |
import pyro
from pyro.infer.tracegraph_elbo import TraceGraph_ELBO
from tests.common import assert_equal
from tests.integration_tests.test_conjugate_gaussian_models import GaussianChain
class ConjugateChainGradientTests(GaussianChain):
def test_gradients(self):
for N in [3, 5]:
for reparameter... | {
"content_hash": "bb6b6500e0da5b26602109c67135ade2",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 84,
"avg_line_length": 38.175,
"alnum_prop": 0.49246889325474785,
"repo_name": "uber/pyro",
"id": "4d5ef116b8670fe22e120731ba2c774e131ce885",
"size": "1616",
"binary": fa... |
"""Handler for data backup operation.
Generic datastore admin console transfers control to ConfirmBackupHandler
after selection of entities. The ConfirmBackupHandler confirms with user
his choice, enters a backup name and transfers control to
DoBackupHandler. DoBackupHandler starts backup mappers and displays confirma... | {
"content_hash": "a07e6feaa83bd6513b4de7a2ca78e259",
"timestamp": "",
"source": "github",
"line_count": 1862,
"max_line_length": 88,
"avg_line_length": 35.5171858216971,
"alnum_prop": 0.6635114088276655,
"repo_name": "levibostian/myBlanky",
"id": "849d1de19ae235cb9e09654e657030af1524fa6e",
"size": ... |
"""
Base class for gdb-remote test cases.
"""
from __future__ import print_function
import errno
import os
import os.path
import platform
import random
import re
import select
import signal
import socket
import subprocess
import sys
import tempfile
import time
from lldbsuite.test import configuration
from lldbsuite.... | {
"content_hash": "94f337ba6d6f7b58b9dfbb238aaf17f7",
"timestamp": "",
"source": "github",
"line_count": 1637,
"max_line_length": 178,
"avg_line_length": 39.42516799022602,
"alnum_prop": 0.5398441252575962,
"repo_name": "youtube/cobalt",
"id": "c5d21a9c9b7a0e13da54850a7f0747211cbc5c00",
"size": "645... |
try:
import os
import sys
import shutil
import sqlite3
import fnmatch
except ImportError,e:
print "[f] Required module missing. %s" % e.args[0]
sys.exit(-1)
COLUMNS = ['key_remote_jid','key_from_me','key_id','status','needs_push','data','timestamp','media_url','media_mime_type','media_wa_ty... | {
"content_hash": "cc62ffdc71353e79414dd88bf6a4d68b",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 322,
"avg_line_length": 33.56410256410256,
"alnum_prop": 0.5324675324675324,
"repo_name": "Abhikos/wforensic",
"id": "6c6032c69eb744644cd75ae1edf20c3277d5c2ad",
"size": "7... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.defaults import *
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'django_abm.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
... | {
"content_hash": "9636b06881b181be42c8f0e79334a03f",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 93,
"avg_line_length": 30.8125,
"alnum_prop": 0.6450304259634888,
"repo_name": "MDA2014/django-abm",
"id": "0ecffdd82d4aebba31390d08957f711daf185128",
"size": "493",
"bin... |
import gettext
import os
_localedir = os.environ.get('heat-translator'.upper() + '_LOCALEDIR')
_t = gettext.translation('heat-translator', localedir=_localedir,
fallback=True)
def _(msg):
return _t.gettext(msg)
| {
"content_hash": "cdc416b1403408c5fd7ca6e698cc5af7",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 69,
"avg_line_length": 24.3,
"alnum_prop": 0.6419753086419753,
"repo_name": "spzala/tosca-parser",
"id": "63db495196e28e2be3e9b442e2528ef2023cdb56",
"size": "816",
"binar... |
import re
import codecs
from os import path
from glob import glob
from subprocess import Popen, PIPE, STDOUT
import misaka
from misaka import Markdown, BaseRenderer, HtmlRenderer, SmartyPants, \
EXT_NO_INTRA_EMPHASIS, EXT_TABLES, EXT_FENCED_CODE, EXT_AUTOLINK, \
EXT_STRIKETHROUGH, EXT_LAX_SPACING, EXT_SPACE_H... | {
"content_hash": "fecc8cad5c6a068b7f175ccc3a854261",
"timestamp": "",
"source": "github",
"line_count": 342,
"max_line_length": 207,
"avg_line_length": 36.95029239766082,
"alnum_prop": 0.6004589696921738,
"repo_name": "hepochen/misaka",
"id": "5ae45c498f3e6df8b7550a9af8456ceddc3b5885",
"size": "127... |
import unittest
from quickbooks.objects.detailline import SalesItemLineDetail, DiscountOverride, DetailLine, SubtotalLineDetail, \
DiscountLineDetail, SubtotalLine, DescriptionLineDetail, DescriptionLine, SalesItemLine, DiscountLine, GroupLine, \
AccountBasedExpenseLineDetail, ItemBasedExpenseLineDetail, Descr... | {
"content_hash": "1ddf35186cf17896051eb09b3e5dd606",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 119,
"avg_line_length": 32.904411764705884,
"alnum_prop": 0.7275977653631285,
"repo_name": "porn/python-quickbooks",
"id": "5a7dd009d432c3dbca0d90416a91aee210b92f0d",
"siz... |
from __future__ import unicode_literals
import os
import logging
from multiprocessing.pool import Pool
from traceback import print_exc
from lxml import etree
from django.db import transaction
from django.conf import settings
from docutil.str_util import clean_breaks, normalize
from docutil.etree_util import clean_tree,... | {
"content_hash": "c28907d16d5c672a9c271136f6a13089",
"timestamp": "",
"source": "github",
"line_count": 521,
"max_line_length": 79,
"avg_line_length": 36.82341650671785,
"alnum_prop": 0.5946833463643472,
"repo_name": "bartdag/recodoc2",
"id": "63101675103f44a4c09c4df9e6567e662a7cdcca",
"size": "191... |
'''
Created on 20 Apr 2010
logging options : INFO, DEBUG
hash_method : content, timestamp
@author: Chris Filo Gorgolewski
'''
import ConfigParser
from json import load, dump
import os
import shutil
from StringIO import StringIO
from warnings import warn
from ..external import portalocker
homedir = os.environ['HOME... | {
"content_hash": "1fa292d56c21873f648f26ff3bac5f62",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 81,
"avg_line_length": 32.94193548387097,
"alnum_prop": 0.6069330199764983,
"repo_name": "Leoniela/nipype",
"id": "ef83094b0ee31f1abaeee62b5f463862bbbd6815",
"size": "5220... |
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class Rem... | {
"content_hash": "1fd05f9345244e7f7fdacfb29d3f088f",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 119,
"avg_line_length": 31.586206896551722,
"alnum_prop": 0.579967248908297,
"repo_name": "mindbody/API-Examples",
"id": "cb5a7a0e9c2947bb5a0c4579dc4144e9a82c0f8f",
"size"... |
import pickle
import pytest
from pyrsistent import CheckedPSet, PSet, InvariantException, CheckedType, CheckedPVector, CheckedValueTypeError
class Naturals(CheckedPSet):
__type__ = int
__invariant__ = lambda value: (value >= 0, 'Negative value')
def test_instantiate():
x = Naturals([1, 2, 3, 3])
ass... | {
"content_hash": "1b8f3610c1b2d30f17f46057e1648d32",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 112,
"avg_line_length": 24.3,
"alnum_prop": 0.6244855967078189,
"repo_name": "jml/pyrsistent",
"id": "c48c69cb1c81f9239d58ec53367d44e7a631494a",
"size": "1944",
"binary":... |
from __future__ import absolute_import
from nark import *
class IDb():
def connect(self):
""" Make a connection to the db engine """
pass
def disconnect(self):
""" Close the connection to the db """
pass
| {
"content_hash": "d791b727c5e99c5059a4a090aa08fd2e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 46,
"avg_line_length": 17.53846153846154,
"alnum_prop": 0.631578947368421,
"repo_name": "shadowmint/py-test-watcher",
"id": "c26cfecce88d39daace52efe046d13a8a8a6f98d",
"siz... |
import datetime
import json
from flask.ext.jwt import current_identity, jwt_required
from flask_restplus import Namespace, Resource, fields, reqparse
from packr.models import Order, OrderStatus, StatusType
api = Namespace('update',
description='Operations related to updating an order')
update_status... | {
"content_hash": "93897a839bd57efc26e94ea85c0151e5",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 79,
"avg_line_length": 36.49404761904762,
"alnum_prop": 0.5605937041265698,
"repo_name": "KnightHawk3/packr",
"id": "8e1d242a8fb27986cc9c5bfa295eb180cb23395a",
"size": "61... |
"""
SDoc
Copyright 2016 Set Based IT Consultancy
Licence MIT
"""
# ----------------------------------------------------------------------------------------------------------------------
from sdoc.sdoc2.NodeStore import NodeStore
from sdoc.sdoc2.formatter.html.HtmlFormatter import HtmlFormatter
class ItemizeHtmlForm... | {
"content_hash": "91f8ef83b1207ee6de643ffe22a85b43",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 120,
"avg_line_length": 33.40625,
"alnum_prop": 0.4490177736202058,
"repo_name": "OlegKlimenko/py-sdoc",
"id": "1d2175185aa2e2c9f4c3722c055c60d3c3d9c03c",
"size": "1069",
... |
from configurator import config_manager
from configurator.config import Option
opts = []
opts.append(Option('host', 'host', 'h', False, 'localhost', 'help...'))
opts.append(Option('vcip', 'vcip', 'v', True, True, 'help...'))
opts.append(Option('Virgo Directory', 'virgoDir', 'h', False, 'localhost', 'help...'))
opts.ap... | {
"content_hash": "7f4545309681db2f3ca1cc915645d7ca",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 86,
"avg_line_length": 37.06666666666667,
"alnum_prop": 0.6600719424460432,
"repo_name": "kaleksandrov/python-configurator",
"id": "e8b65ec6ea83ccf6de3cf5ff69e1ed80c51ac56f",... |
"""
Update packages and product definition source troves managed by Conary
"""
from rbuild import pluginapi
from rbuild.productstore.decorators import requiresStage
from rbuild.pluginapi import command
class PromoteCommand(pluginapi.command.BaseCommand):
"""Promote groups and packages to the next stage"""
co... | {
"content_hash": "1f23ea0e4c3e20546c4ba5bb54ec8b1b",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 79,
"avg_line_length": 39.32692307692308,
"alnum_prop": 0.6256723716381418,
"repo_name": "sassoftware/rbuild",
"id": "de117581f8624e7dedd372f1023c2ef21c496436",
"size": "4... |
"""Learn a Markov chain with an RNN and sample from it."""
from __future__ import print_function
import argparse
import logging
import pprint
import sys
import dill
import numpy
import theano
from theano import tensor
from blocks.bricks import Tanh
from blocks.bricks.recurrent import GatedRecurrent
from blocks.brick... | {
"content_hash": "a57ad850af0dc232edef3d282cc8f8fb",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 79,
"avg_line_length": 39.71232876712329,
"alnum_prop": 0.6105553639185927,
"repo_name": "vdumoulin/blocks-contrib",
"id": "4257d07bdd34f9074068eef4553595f699692b6e",
"siz... |
from pytac.exceptions import PvException
import pytac.device
import pytest
import mock
@pytest.fixture
def create_device(readback, setpoint):
_rb = readback
_sp = setpoint
device = pytac.device.Device(rb_pv=_rb, sp_pv=_sp, cs=mock.MagicMock())
return device
def test_set_device_value():
rb_pv = '... | {
"content_hash": "d4073156bdf70d82f6cc14afceaf8001",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 75,
"avg_line_length": 24.02777777777778,
"alnum_prop": 0.6705202312138728,
"repo_name": "willrogers/pml",
"id": "ec3a766632cf7dd91bc8bfc8344958b6c5417b36",
"size": "865",
... |
import math
import numbers
import re
import textwrap
from collections.abc import Iterator, Mapping
import sys
import traceback
from contextlib import contextmanager
import numpy as np
import pandas as pd
from pandas.api.types import (
is_categorical_dtype,
is_scalar,
is_sparse,
is_period_dtype,
is... | {
"content_hash": "5b20c2225e2944deaf95910a5ceabad4",
"timestamp": "",
"source": "github",
"line_count": 970,
"max_line_length": 94,
"avg_line_length": 32.48969072164948,
"alnum_prop": 0.5764873869585911,
"repo_name": "ContinuumIO/dask",
"id": "fb56a18882687899bb252a594f5b0e32beb2d9c4",
"size": "315... |
"""Debug code for testing module is functioning properly.
"""
import time
from pivim import temperature as t
import ptvsd # pylint: disable=unused-import
def main():
"""
Debug code for testing module is functioning properly.
Uncomment ptvsd lines to enable remote debugging from Visual Studio
Use forma... | {
"content_hash": "598283b0407c643225d7eeb191750f0a",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 71,
"avg_line_length": 25.75,
"alnum_prop": 0.6324549237170597,
"repo_name": "pleasereleaseme/PiVIM-py",
"id": "2dc62d82a9ef35bb1e7d5b59a9bc21db7fc1e322",
"size": "721",
... |
from flask_login import login_required
from flask_restful import Resource
from app.decorators import wx_required
class BusinessResource(Resource):
method_decorators = [login_required, wx_required]
| {
"content_hash": "de1a7f38e5f033c087977af8d87f7759",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 53,
"avg_line_length": 26.5,
"alnum_prop": 0.7735849056603774,
"repo_name": "by46/coffee",
"id": "4cd3a3d0cddd08a8b1dc6d0a690682298742ce3d",
"size": "212",
"binary": false... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.