text stringlengths 4 1.02M | meta dict |
|---|---|
import random
import pytest
import numpy as np
torch = pytest.importorskip("torch")
from eight_mile.pytorch.layers import VariationalDropout
@pytest.fixture
def input_():
SEQ_LEN = random.randint(20, 101)
BATCH_SIZE = random.randint(5, 21)
FEAT_SIZE = random.choice([128, 256, 300])
return torch.randn... | {
"content_hash": "ccd923b8187eb5c861a1ded17bb85d74",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 100,
"avg_line_length": 33.5,
"alnum_prop": 0.6643923240938167,
"repo_name": "dpressel/baseline",
"id": "54573127908079fc82cb1c6ffe3c29b0930f6d15",
"size": "2345",
"binar... |
"""
Copyright 2016 Basho Technologies, Inc.
This file is provided to you 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 agre... | {
"content_hash": "e9540c2fa322d882213f8eee4e65bdee",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 118,
"avg_line_length": 34.46739130434783,
"alnum_prop": 0.6710816777041942,
"repo_name": "basho/spark-riak-connector",
"id": "14220414e7bb8d9b07ee3e5b79ea2410a8ebc4b1",
"s... |
import os
import sys
import skybase.schemas
from skybase.utils.schema import read_yaml_from_file
from skybase.utils import simple_error_format
from skybase.exceptions import SkyBaseConfigurationError
from yaml.scanner import ScannerError
from yaml.parser import ParserError
# Application CONSTANTS
# Configuration
DEF... | {
"content_hash": "93143e61ecd82c5e063f7ae8fa0536d5",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 109,
"avg_line_length": 29.155172413793103,
"alnum_prop": 0.6587817859254879,
"repo_name": "lithiumtech/skybase.io",
"id": "1c48d8e1f55d7863de6f44b8a379a9fba2303204",
"siz... |
"""Tests for tf.contrib.kfac.fisher_blocks."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.contrib.kfac.python.ops import fisher_blocks as fb
from tensorflow.contrib.kfac.python.ops import layer_collection as lc
from ... | {
"content_hash": "b68cce82a43760f9a5fb578c91faa4f2",
"timestamp": "",
"source": "github",
"line_count": 989,
"max_line_length": 80,
"avg_line_length": 41.26794742163802,
"alnum_prop": 0.6589650610084775,
"repo_name": "Xeralux/tensorflow",
"id": "b70c700f0936c2d8a2eca6e0836a3ee4ffe4e46d",
"size": "4... |
from typing import List, Dict, Sequence, Any
import cirq
class PasqalNoiseModel(cirq.devices.NoiseModel):
"""A noise model for Pasqal neutral atom device """
def __init__(self, device: cirq.devices.Device):
self.noise_op_dict = self.get_default_noise_dict()
if not isinstance(device, cirq.pas... | {
"content_hash": "9f72767ea89a0a3687c3fb71db23dd1b",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 86,
"avg_line_length": 40.196969696969695,
"alnum_prop": 0.5993215228043725,
"repo_name": "balopat/Cirq",
"id": "15a2b4ccafb51c9d47f5956d647a2dcf0a19e27f",
"size": "3237",
... |
from datetime import datetime
class LoggerHandler:
def __init__(self, filename):
try:
self.file = open(filename, 'a')
except IOError:
self.file = None
print(("Couldn't open {} for log writing".format(filename)))
def on_text(self, tg, message):
if s... | {
"content_hash": "6f777726620cfd233c522fea2ec194d3",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 72,
"avg_line_length": 35.2,
"alnum_prop": 0.46117424242424243,
"repo_name": "Jumpscale/jumpscale_core8",
"id": "afb3821797e005c01680b1cff5cdfbe329b918d7",
"size": "1056",
... |
'''
Created on 17.02.2016
@author: Steve
'''
import random
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import mdp
import csv
import Oger
import datetime
import DataSet
import Evaluation
import OptDicts
import EvaluateTestFile
from Utils im... | {
"content_hash": "1d6ce64bc5ba28f807312ccdb766d8dc",
"timestamp": "",
"source": "github",
"line_count": 548,
"max_line_length": 407,
"avg_line_length": 38.503649635036496,
"alnum_prop": 0.508436018957346,
"repo_name": "ravenshooter/BA_Analysis",
"id": "13643a76f6fac6eec3f5bcd6f89a01f80627dfd4",
"si... |
from __future__ import annotations # isort:skip
import pytest ; pytest
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Bokeh imports
from bokeh.models import (
Circle,
ColumnDataSource,
... | {
"content_hash": "e980e28637f4ae377d2e5c4e0a072b43",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 85,
"avg_line_length": 36.40909090909091,
"alnum_prop": 0.4712858926342072,
"repo_name": "bokeh/bokeh",
"id": "47a4dc1afcdb0717fed1d688f9018dfc2018a2a0",
"size": "3708",
... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('AccountSystem', '0002_auto_20160724_0126'),
]
operations = [
migrations.CreateModel(
... | {
"content_hash": "2562fc5f29901dc0ae533a666dac0533",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 128,
"avg_line_length": 28.571428571428573,
"alnum_prop": 0.56375,
"repo_name": "nick6918/ThingCloud",
"id": "bce4da1e6d4e902cfa1aee639202f07fa212a306",
"size": "872",
"b... |
"""OSS multi-process library to be implemented."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import contextlib
import unittest
class Process(object):
"""A process simulating a worker for testing multi-worker training."""
def __init__(self, *arg... | {
"content_hash": "2b26292323f918ae897e92d626e01311",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 76,
"avg_line_length": 26.344827586206897,
"alnum_prop": 0.7172774869109948,
"repo_name": "DavidNorman/tensorflow",
"id": "35717a7d3eb58bf766d9eade7a1e1e963c2bba75",
"size"... |
#!/usr/bin/env python3
#
# Copyright 2014 Blender Foundation
#
# 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 l... | {
"content_hash": "6f2288139bf531e1ff86a183524265c6",
"timestamp": "",
"source": "github",
"line_count": 577,
"max_line_length": 77,
"avg_line_length": 28.795493934142115,
"alnum_prop": 0.550767378874511,
"repo_name": "pyrochlore/cycles",
"id": "a94525c52b12b3cf7af9011910dc03970989678d",
"size": "17... |
# -*- coding: utf-8 -*-
import logging
import datetime
from dateutil import parser as dateparser
import pytz
from lxml import etree
from rtrss import torrentfile
from rtrss.exceptions import TopicException, ItemProcessingFailedException
from rtrss.webclient import WebClient
from rtrss.util import save_debug_file
_l... | {
"content_hash": "d40f78a93bde0906a28005312b9d6f38",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 79,
"avg_line_length": 32.03409090909091,
"alnum_prop": 0.5765637933073193,
"repo_name": "notapresent/rtrss",
"id": "9806ce45c748bb4f1d257b3ffdf590e87bf1df83",
"size": "85... |
import sys
if sys.platform == 'win32':
import wmi
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.openstack.common import log as logging
from nova.virt.hyperv import vmutils
from nova.virt.hyperv import volumeutilsv2
LOG = logging.getLogger(__name__)
class LiveMigrationUti... | {
"content_hash": "283183a5116208f19e8dcfd780b911e6",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 79,
"avg_line_length": 45.55744680851064,
"alnum_prop": 0.5762189426489819,
"repo_name": "plumgrid/plumgrid-nova",
"id": "bc0a553fa9897175effa62135a81a6f81bfbf6e9",
"size"... |
import json
from django import test
from factories.django_models import UserFactory
from factories.workflow_models import TolaUserFactory
ENGLISH = 1
FRENCH = 2
SPANISH = 3
COVID_BANNER_TITLE = {
ENGLISH: "Remote MERL guidance (PDF)",
FRENCH: "Guide SERA à distance (PDF)",
SPANISH: "Guía de la MERL remota... | {
"content_hash": "c480ecd5aff4191089b89cfec5e43a0c",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 104,
"avg_line_length": 41.61946902654867,
"alnum_prop": 0.6678715713374442,
"repo_name": "mercycorps/TolaActivity",
"id": "90be620ac076eedf009c844f1324289b4de0f73b",
"siz... |
from .base import *
import os
DEBUG = False
TEMPLATE_DEBUG = DEBUG
SECRET_KEY = os.environ["SECRET_KEY"]
ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', 'localhost').split(',')
ADMINS = (
('Ben Cole', '[email protected]'),
)
MANAGERS = ADMINS
| {
"content_hash": "b91d2df31bf7f0ee1106d9c3db4edc57",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 71,
"avg_line_length": 15.8125,
"alnum_prop": 0.6679841897233202,
"repo_name": "wengole/nasman",
"id": "1ed899a1e38f093b4a2109705a71855087e00540",
"size": "253",
"binary"... |
"""
WinPython License Agreement (MIT License)
-----------------------------------------
Copyright (c) 2012 Pierre Raybaut
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, incl... | {
"content_hash": "dfd534de5f845077921b03afb69a7cee",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 65,
"avg_line_length": 40.96875,
"alnum_prop": 0.7520976353928299,
"repo_name": "PopCap/GameIdea",
"id": "52a7bdd028fd213eddafc7bec912b63f8f5f64d6",
"size": "1335",
"bina... |
'''
Production Configurations
'''
from configurations import values
from .common import Common
class Production(Common):
# This ensures that Django will be able to detect a secure connection
# properly on Heroku.
# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# INSTALLED_APPS
I... | {
"content_hash": "c2a23d8995b5d828ff5438e1e9a1de49",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 99,
"avg_line_length": 37.50909090909091,
"alnum_prop": 0.6737760542898691,
"repo_name": "zhiwehu/zhiwehu",
"id": "8d3f3567fd633112709692827b3ab541bea99e15",
"size": "4150... |
from lib.core.standard import CTransaction
from lib.core.extended import CPosTransaction
from lib.core.extended import CPosTransactionMessage
from lib.core.extended import CTransactionMessage
class TransactionFactory(object):
def new_transaction(self):
return CTransaction()
def build_transaction(self, data):
# ... | {
"content_hash": "d1ce44113ba9399df6ae5f3bdffcd049",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 55,
"avg_line_length": 28.642857142857142,
"alnum_prop": 0.8092269326683291,
"repo_name": "tuaris/TidePool",
"id": "a470423d797f5a743bd26b8f350608c8a995121d",
"size": "802"... |
from itertools import chain
import numpy as np
import theano.tensor as T
__all__ = ('count_parameters', 'parameters2vector', 'iter_parameters',
'setup_parameter_updates')
def iter_parameters(network):
""" Iterate over all network parameters.
Parameters
----------
network : Constructable... | {
"content_hash": "672374cf61967640964e21910d653701",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 73,
"avg_line_length": 24.406593406593405,
"alnum_prop": 0.6510580819450698,
"repo_name": "stczhc/neupy",
"id": "88ff889ddb2d0951fd42d468097946039c18c4c3",
"size": "2221",
... |
__revision__ = '$Id: views.py 21 2008-12-05 09:21:03Z jarek.zgoda $'
from django.shortcuts import render
from django.template import RequestContext
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from confirmation.models import Confirmation
from zerver.models import Preregistration... | {
"content_hash": "fd029f8b0ae6e8d9c9c30638f173b50d",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 91,
"avg_line_length": 38.52,
"alnum_prop": 0.6998961578400831,
"repo_name": "jrowan/zulip",
"id": "0a50ae69d4bbd9237f1e988a56bb481bc7b63109",
"size": "1048",
"binary": f... |
from __future__ import print_function
from subprocess import check_output, call
import urllib2
import json
import sys
if __name__ == '__main__':
"""Run a bunch of boilerplate commands to sync your local clone to its
parent github repo.
"""
print("Starting sync...", "\n")
CURRENT_REPO_CMD = ['g... | {
"content_hash": "c8844c84867d18750642b98245c610b0",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 91,
"avg_line_length": 34.45569620253165,
"alnum_prop": 0.553269654665687,
"repo_name": "niklas-heer/dotfiles",
"id": "b14df4dc40d60900a5991404d5425200c4039b7d",
"size": "2... |
import pytest
from gevent.event import Event
from devp2p.app import BaseApp
from devp2p.service import BaseService
from ethereum import slogging
from ethereum.blocks import Block, BlockHeader
from ethereum.config import Env
from ethereum.db import DB
from pyethapp.pow_service import PoWService
DIFFICULTY = 1024 # M... | {
"content_hash": "30b1a33bad77b9f55f981094c8e6fa42",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 74,
"avg_line_length": 28.15730337078652,
"alnum_prop": 0.6652035115722267,
"repo_name": "RomanZacharia/pyethapp",
"id": "680e186d31bcac14a9e43a5fba8dff99980f0890",
"size":... |
"""This is a program to calculate the estimated final score for a one day cricket match, whilst it is still in progress, also if it is a 50 over game it gives
a duckworth lewis score. There are 2 classes one to calcuate the result the other for the gui"""
from Tkinter import *
class Cricket(object):
def __init__... | {
"content_hash": "bcf482865d2fb41dfe99819b64e502a2",
"timestamp": "",
"source": "github",
"line_count": 364,
"max_line_length": 278,
"avg_line_length": 44.19230769230769,
"alnum_prop": 0.5999005346263832,
"repo_name": "ActiveState/code",
"id": "19f716f8212ad3629fea39dd9848f972607064eb",
"size": "16... |
import datetime
import unittest
import haiker
from . import samples
class TestTypes(unittest.TestCase):
def test_list_of(self):
f = haiker.types.list_of
self.assertEqual(f(str)([1, 2, 3]), ['1', '2', '3'])
self.assertEqual(f(int)(['1', '2', '3']), [1, 2, 3])
def test_none_or(self):
... | {
"content_hash": "4d24d0506343614c0fc1458176a59f9c",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 78,
"avg_line_length": 36.09756097560975,
"alnum_prop": 0.5827702702702703,
"repo_name": "saltcandy123/hatena-haiker",
"id": "c00e4cd65d17ad3732fa57caa6306ab10ca4b859",
"si... |
import sys
from .conf import settings
from .exceptions import NoRuleMatched
from .system import get_key
from .utils import get_alias
from . import logs, const
def read_actions():
"""Yields actions for pressed keys."""
while True:
key = get_key()
# Handle arrows, j/k (qwerty), and n/e (colemak... | {
"content_hash": "b87305c0bf661226e1c8313400e8cfa0",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 70,
"avg_line_length": 29.548387096774192,
"alnum_prop": 0.5978893740902474,
"repo_name": "Clpsplug/thefuck",
"id": "37b14acd4afa2e5c6c01f7b45a333390d6cc748f",
"size": "277... |
"""Define exceptions."""
class MyQError(Exception):
"""Define a base exception."""
pass
class InvalidCredentialsError(MyQError):
"""Define an exception related to invalid credentials."""
pass
class AuthenticationError(MyQError):
"""Define an exception related to invalid credentials."""
... | {
"content_hash": "bd6eec29c1fa10104efd8efd3502167a",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 61,
"avg_line_length": 17.08,
"alnum_prop": 0.6932084309133489,
"repo_name": "arraylabs/pymyq",
"id": "ea289cd78a613807df79fd3e4b9d4bf6f791a093",
"size": "427",
"binary":... |
try: #pragma: no cover
from .tw2widgets.widgets import *
except ImportError: #pragma: no cover
from .tw1widgets.widgets import *
try: #pragma: no cover
from tw2.forms import CalendarBase
except: #pragma: no cover
class CalendarBase(object):
pass
| {
"content_hash": "77ffd4ab774b32e1de751e67822eed02",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 38,
"avg_line_length": 27.1,
"alnum_prop": 0.7084870848708487,
"repo_name": "TurboGears/sprox",
"id": "aaa5bb18ad564784e277f3d2e319e26820b7515c",
"size": "271",
"binary":... |
from __future__ import absolute_import, unicode_literals
from __future__ import division, print_function
import re
import warnings
import scipy.stats as sps
import scipy.spatial.distance as spsd
from ..core.color import Color
import PhloxAR.core.image
from ..base import cv2, np, lazy_property
from .detection import Co... | {
"content_hash": "d2e6071752806436034db6d8e64e9a6b",
"timestamp": "",
"source": "github",
"line_count": 1530,
"max_line_length": 184,
"avg_line_length": 38.168627450980395,
"alnum_prop": 0.5464741943217234,
"repo_name": "PhloxAR/phloxar",
"id": "b760f86e65202e86b5ee466c853bfd179c8cb731",
"size": "5... |
"""
This script writes a value to a file. It is intended to be launched via sudo
in order to write to files that require root access so the main agent code can
run from a non-root process and only elevate to root when necessary.
"""
import sys
# from myDevices.utils.logger import setInfo, info, error, logToFile
if __n... | {
"content_hash": "d2b6a495be142d683e2343bc8ebef2f2",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 78,
"avg_line_length": 34.23529411764706,
"alnum_prop": 0.5481099656357389,
"repo_name": "myDevicesIoT/Cayenne-Agent",
"id": "783cc2577fbde19ff732d2cc2670f0f0fc059f6c",
"si... |
class Coordinate(object):
def __init__(self, x, y):
self.x = x
self.y = y
def getX(self):
# Getter method for a Coordinate object's x coordinate.
# Getter methods are better practice than just accessing an attribute directly
return self.x
def getY(self):
# ... | {
"content_hash": "430d91209dacd03c5af2715697337490",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 86,
"avg_line_length": 28.607142857142858,
"alnum_prop": 0.5792759051186017,
"repo_name": "Mdlkxzmcp/various_python",
"id": "d7fd10cec885a1c60b6760ee7b5ea4c1e2606e5e",
"siz... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Saturn.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is real... | {
"content_hash": "3877445fa7a1834befd101bc392611f0",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 77,
"avg_line_length": 37.23809523809524,
"alnum_prop": 0.6202046035805626,
"repo_name": "ZhangXiaoyu-Chief/Saturn",
"id": "c7b167d4c1e0e520f8b101479cbc2b360abbb9cd",
"size... |
"""
Code related to the Magellanic Satellites Survey (MagLiteS).
"""
import os,sys
import logging
import copy
from collections import OrderedDict as odict
import numpy as np
import fitsio
import ephem
from obztak.field import FieldArray, SISPI_DICT, SEP
from obztak.survey import Survey
from obztak.scheduler import Sc... | {
"content_hash": "5cedbb3c3d20a6ce0f93e9fc5c2fddac",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 151,
"avg_line_length": 34.62111801242236,
"alnum_prop": 0.5623430211697166,
"repo_name": "kadrlica/obztak",
"id": "c35742921b31f1fcecc24ed00c9069e8de833d1d",
"size": "111... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = '''
---
module: bigip_vlan
short_description: Manage VLANs on a BIG-IP system
description:
- Manage VLANs on a BIG-IP system
version_added: "2.2"
options:
description:
... | {
"content_hash": "0b9a41f507c7b62afc95f613de388ad3",
"timestamp": "",
"source": "github",
"line_count": 431,
"max_line_length": 108,
"avg_line_length": 29.48259860788863,
"alnum_prop": 0.5601636893051074,
"repo_name": "nwiizo/workspace_2017",
"id": "40df948f6c6b1ace40e6d45ad85f607c70ca5763",
"size"... |
from __future__ import absolute_import, division, print_function
from ..scraper import _ParserScraper
class KindOfNormal(_ParserScraper):
imageSearch = '//article[1]//div[@class="box-content"]//img'
prevSearch = '//a[@class="prev"]'
def __init__(self, name, url):
super(KindOfNormal, self).__init... | {
"content_hash": "8981f567fb1551bbb77c14fa2b130349",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 64,
"avg_line_length": 28.6,
"alnum_prop": 0.5856643356643356,
"repo_name": "peterjanes/dosage",
"id": "48165947d0bc57023198c0df5593d87f053868fa",
"size": "752",
"binary"... |
import os
import re
from BeautifulSoup import BeautifulSoup
import sys
import string
def findindex(haystack,needle):
count = 0
for line in haystack:
if needle in line:
return count
count += 1
def getsection(file,start,end):
html = ''
for i in file[start:end]:
html = "%s\r\n%s"%(html,i)
ret... | {
"content_hash": "db404e7c5380635a18e5d665b9bc2a87",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 265,
"avg_line_length": 42.05797101449275,
"alnum_prop": 0.5889042039972433,
"repo_name": "samskeller/zeroclickinfo-fathead",
"id": "4b9dae9716a7a6c111c18657a7454a731dd6d220... |
from pprint import pprint
import sys
import os
from ConfigParser import SafeConfigParser
import requests
import json
# WARNING! This file is a near-duplicat of curator/models/db.py
# Any changes here should probably be mirrored there.
conf = SafeConfigParser({})
config_file_found = None
try:
test_confi... | {
"content_hash": "16f83091ef20354eeb8f486b06778cad",
"timestamp": "",
"source": "github",
"line_count": 276,
"max_line_length": 119,
"avg_line_length": 45.492753623188406,
"alnum_prop": 0.6043325899968143,
"repo_name": "OpenTreeOfLife/opentree",
"id": "69209794c60f4ac8aabc7af5d561eaf17cc62add",
"si... |
from google.cloud import dialogflowcx_v3beta1
async def sample_get_intent():
# Create a client
client = dialogflowcx_v3beta1.IntentsAsyncClient()
# Initialize request argument(s)
request = dialogflowcx_v3beta1.GetIntentRequest(
name="name_value",
)
# Make the request
response = a... | {
"content_hash": "1f66e70cd8f6736d55032c386ff58c9e",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 60,
"avg_line_length": 24.68421052631579,
"alnum_prop": 0.7164179104477612,
"repo_name": "googleapis/python-dialogflow-cx",
"id": "fb4a5edaa37e6bd3094f8d96b9de99f70b0176d3",
... |
from __future__ import unicode_literals
import os
import traceback
from django.utils.six.moves import range
from django.utils import timezone
from django.db import transaction, Error
from django.core.exceptions import ValidationError
from .signals import export_started, export_completed, \
import_started, import... | {
"content_hash": "edf74b16b423c934ca6efd9ddae81344",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 79,
"avg_line_length": 29.946153846153845,
"alnum_prop": 0.5603647572566144,
"repo_name": "mtrgroup/django-mtr-sync",
"id": "00bab481e54b97797406666d34ff762a00b23523",
"si... |
from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union, cast
from msrest import Serializer
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline im... | {
"content_hash": "6a53a9620db30d3a312601971a948d97",
"timestamp": "",
"source": "github",
"line_count": 5436,
"max_line_length": 272,
"avg_line_length": 42.326710816777044,
"alnum_prop": 0.6119658565418449,
"repo_name": "Azure/azure-sdk-for-python",
"id": "47ee4a6be0474a295ddc7cb8522f196079de75bc",
... |
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('server', '0027_booklet'),
]
operations = [
migrations.AlterField(
model_name='booklet',
... | {
"content_hash": "84a640b93dbf7385e9cfcc9f525578d2",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 195,
"avg_line_length": 35.25,
"alnum_prop": 0.6418439716312057,
"repo_name": "wodo/WebTool3",
"id": "be62e9ddb3ef5ec85f0a0b1fae79953f1502307f",
"size": "919",
"binary": ... |
from __future__ import print_function
import sys
from setuptools import setup
long_description = """
`doit` is a task management & automation tool
`doit` comes from the idea of bringing the power of build-tools
to execute any kind of **task**
`doit` is a modern open-source build-tool written in python
designed to ... | {
"content_hash": "edd122e3979d55ae686e127fc1087460",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 74,
"avg_line_length": 35.638888888888886,
"alnum_prop": 0.6169134840218239,
"repo_name": "JohannesBuchner/doit",
"id": "3a16fafb5c0b7f930da5e59cfa1bcda3ffa97a90",
"size": ... |
from .handlers.json_handler import json
from .handlers.pickle_handler import pickle
from .handlers.print_handler import print_
from .handlers.pdb_handler import pdb
locals()['print'] = print_
| {
"content_hash": "0503228ceaf9fb520e86d4f85d68b9ed",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 43,
"avg_line_length": 32.166666666666664,
"alnum_prop": 0.7875647668393783,
"repo_name": "caioariede/pyintercept",
"id": "aa6beff1c59e7fdd9d26343a684692388b1f8016",
"size":... |
"""
Django settings for funcao project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths i... | {
"content_hash": "04de59926fbdb3b40c213da357241a56",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 71,
"avg_line_length": 25.766990291262136,
"alnum_prop": 0.6895252449133383,
"repo_name": "maryklayne/Funcao",
"id": "99bda9f474bc72fed14d4982e8967401e696939c",
"size": "2... |
import decimal
import MyDriver
from hecatoncheir import DbProfilerBase, DbProfilerValidator, logger as log
from hecatoncheir.QueryResult import QueryResult
from hecatoncheir.exception import InternalError
from hecatoncheir.logger import str2unicode as _s2u
from hecatoncheir.msgutil import gettext as _
class MyProfil... | {
"content_hash": "c612067a927a65e4fde0bc6ee664cfa4",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 82,
"avg_line_length": 34.69527896995708,
"alnum_prop": 0.5792924294903513,
"repo_name": "snaga/Hecatoncheir",
"id": "befea4dc75b7a9177e61ef728989b6ea045f3a91",
"size": "8... |
import re
import json
import requests
with open('constants.json') as _constants:
constants = json.load(_constants)
def _strip_prop(text, prop):
return re.sub(prop+':', "", text, count=1)
def _strip_JSON(res, prop, strip_chars, entry_prop):
ret = {}
for page_id, page_content in res['query']['pages'].... | {
"content_hash": "4267e497ef4bddf82d32d33d0bcff371",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 100,
"avg_line_length": 36.189655172413794,
"alnum_prop": 0.6241067174845164,
"repo_name": "abinashmeher999/pymediawiki",
"id": "a1c4c0dd040755bf13bf31a3170d30ede0608edd",
... |
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListType
from pyangbind.lib.ya... | {
"content_hash": "ebf17110e410e1f2cb0c827085f01fce",
"timestamp": "",
"source": "github",
"line_count": 1021,
"max_line_length": 883,
"avg_line_length": 44.83153770812928,
"alnum_prop": 0.5196513228322374,
"repo_name": "napalm-automation/napalm-yang",
"id": "bdfa66379670336364d05ec159aef6c6cce4a165",... |
from rest_framework import negotiation
from django.utils.xmlutils import SimplerXMLGenerator
from django.utils import six
from django.utils.six.moves import StringIO
from django.utils.encoding import smart_text
from rest_framework.renderers import BaseRenderer
from rest_framework.renderers import TemplateHTMLRenderer
... | {
"content_hash": "699fa7f0eb834ad136692e828f66502b",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 76,
"avg_line_length": 27.2,
"alnum_prop": 0.6484375,
"repo_name": "awemulya/fieldsight-kobocat",
"id": "b1f7e06157a765dacaef85dd562ff2eec8d9cbfe",
"size": "4352",
"bina... |
"""Official evaluation script for SQuAD version 2.0.
In addition to basic functionality, we also compute additional statistics and
plot precision-recall curves if an additional na_prob.json file is provided.
This file is expected to map question ID's to the model's predicted probability
that a question is unanswerable... | {
"content_hash": "ae9dc180534cc1ab67c50188ead2b61b",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 95,
"avg_line_length": 37.794701986754966,
"alnum_prop": 0.6404415629928158,
"repo_name": "google-research/electra",
"id": "d41c1444cb75a68dd6b0dd13cf97f2377ec85aa2",
"siz... |
from gengo import Gengo
# Get an instance of Gengo to work with...
gengo = Gengo(
public_key='your_public_key',
private_key='your_private_key',
sandbox=True,
debug=True
)
# Get the job group in question
print gengo.getTranslationJobGroup(id=16973)
| {
"content_hash": "4eed871f7e1f2f292941d59548aff968",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 44,
"avg_line_length": 22.166666666666668,
"alnum_prop": 0.7105263157894737,
"repo_name": "shawnps/mygengo-python",
"id": "12e24f1f80015772b2c8343fe3520ecb53ea5635",
"size"... |
r"""Evaluation of matrix factorization following the protocol of the NCF paper.
Details:
- Model: Matrix factorization with biases:
y(u,i) = b + v_{u,1}+v_{i,1}+\sum_{f=2}^d v_{u,f}*v_{i,f}
- Loss: logistic loss
- Optimization algorithm: stochastic gradient descent
- Negatives sampling: Random negatives are a... | {
"content_hash": "4c85fc6823b2986cbae3cc8d1ca5d06c",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 80,
"avg_line_length": 39.37899543378995,
"alnum_prop": 0.636943413729128,
"repo_name": "google-research/google-research",
"id": "47bf69ef6db16df4b8960dc53de2128c38aafceb",
... |
from django import forms
from django.utils.translation import ugettext_lazy as _
class RemoteSubscribeForm(forms.Form):
username = forms.CharField(max_length=64, label=_("username"))
profile_url = forms.URLField(label=_("OMB compatible profile URL"))
AUTHORIZE_CHOICES = (
(1, _('Accept')),
(0, _('Reje... | {
"content_hash": "17dbc8410f3756dd894bc9159c97e369",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 108,
"avg_line_length": 35,
"alnum_prop": 0.7314285714285714,
"repo_name": "skabber/django-omb",
"id": "378f52f65f02d48c40aa120d87d638dc811280dd",
"size": "525",
"binary"... |
from RockStar import RockStar
hack_code = """<?hh
echo 'Hello World';
"""
rock_it_bro = RockStar(days=400, file_name='helloworld.hack', code=hack_code)
rock_it_bro.make_me_a_rockstar() | {
"content_hash": "76c534861ca1972e77765c472e2da009",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 77,
"avg_line_length": 23.25,
"alnum_prop": 0.7096774193548387,
"repo_name": "nayankabir/Python",
"id": "c081dbccec7f11df304ce99bc41a41c2d51bf05e",
"size": "186",
"binary"... |
from PyQt5.QtCore import pyqtSignal, QObject
from .searchterm import SearchTerm
class Search(QObject):
__instance = None
searchTermStarted = pyqtSignal(int, int)
searchTermFinished = pyqtSignal(str, list)
def __new__(cls, searchterms, parent=None):
if Search.__instance is None:
S... | {
"content_hash": "5acb32ca31b66ebe9aa766ec7455d856",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 85,
"avg_line_length": 33.044444444444444,
"alnum_prop": 0.6301277740416947,
"repo_name": "vminakov/yozik",
"id": "7e509035018c808e5562876423c09625752d6b59",
"size": "1487"... |
import logging
import re
from textwrap import dedent
import click
from praw.errors import SubredditExists, RateLimitExceeded
from images_of import command, settings, Reddit
DRY_RUN = False
LOG = logging.getLogger(__name__)
def create_sub(r, sub):
try:
LOG.info('Attempting to create /r/{}'.format(sub))
... | {
"content_hash": "825f48a27d9d35926341b690ef0a8748",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 97,
"avg_line_length": 29.671794871794873,
"alnum_prop": 0.5890079502246802,
"repo_name": "scowcron/ImagesOfNetwork",
"id": "307bb14470af32f3bf15812f06982b2b30cde26f",
"si... |
from distutils.core import setup
setup(
name='battery-meter',
version='0.1.0',
description='A battery meter icon on the systray / system tray.',
author='Mizki SUZUMORI',
author_email='[email protected]',
url='https://github.com/mizki9577/battery-meter',
py_modules=['batterymeter.batteryme... | {
"content_hash": "5c513ea61d1881c5520f737310b548ad",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 69,
"avg_line_length": 30.076923076923077,
"alnum_prop": 0.680306905370844,
"repo_name": "mizki9577/battery-meter",
"id": "0ded40245d347758ca458e132fe05f9ba5bc3d02",
"size"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('article', '0006_article_cover'),
]
operations = [
migrations.AddField(
model_name='article',
name='views',
field... | {
"content_hash": "da472060b9947411e09f0d900a6f65ad",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 57,
"avg_line_length": 21,
"alnum_prop": 0.5952380952380952,
"repo_name": "YoungsonZhao/Blog-Django",
"id": "e1a303e1e15846e9068c092d4a2d27181ae4d73a",
"size": "451",
"bi... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.svm import SVC
from sklearn.model_selection import GridSearchCV, train_test_split
from sklearn.datasets import load_iris
import pandas as pd
def plot_cross_val_selection():
iris = load_iris()
X_trainval, X_test, y_trainval, y_test = train_test_sp... | {
"content_hash": "bdef9e9dde0d1cb38d3c1d10173368a9",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 99,
"avg_line_length": 46.4,
"alnum_prop": 0.5466056034482759,
"repo_name": "JoostVisser/ml-assignment2",
"id": "b0178bd88273f252bd8fc90c760cc75199bae418",
"size": "3712",
... |
from __future__ import absolute_import
import logging
import tensorflow as tf
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
from google.protobuf.json_format import Parse
from tfx_bsl.public.beam import RunInference
from tfx_bsl.public.proto import model_spec_pb2
impor... | {
"content_hash": "2382298b162cb2ac51d909c0a1de7202",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 98,
"avg_line_length": 36.38461538461539,
"alnum_prop": 0.5658914728682171,
"repo_name": "GoogleCloudPlatform/dataflow-sample-applications",
"id": "0b688f66741c86bf62321ec4af... |
import json
from random import randint
with open('data.json', encoding='utf-8-sig') as data_file:
data = json.load(data_file)
JOKE_COUNT = len(data)
def get_joke():
# Return random joke
random_num = randint(1, JOKE_COUNT)
joke = data[random_num]
return joke.replace('\"', "'")
| {
"content_hash": "7f6a31916c740849383b1538f0e1960c",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 58,
"avg_line_length": 23.076923076923077,
"alnum_prop": 0.6533333333333333,
"repo_name": "sameerkumar18/geek-joke-api",
"id": "091e38bacf3b56d5c7cfdcc0398bfdb51908cd7e",
"... |
"""
Start the celery daemon from the Django management command.
"""
from __future__ import absolute_import, unicode_literals
from celery.bin import worker
from djcelery.app import app
from djcelery.management.base import CeleryCommand
worker = worker.worker(app=app)
class Command(CeleryCommand):
"""Run the c... | {
"content_hash": "ba89acc414f1a3321570f5be67bee9bf",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 59,
"avg_line_length": 24,
"alnum_prop": 0.6728395061728395,
"repo_name": "celery/django-celery",
"id": "8fd1820cb64b488e274907dec6ef7c3f471aed47",
"size": "648",
"binary... |
from __future__ import print_function, absolute_import, division
import os
import time
import tempfile
from subprocess import check_call
from shutil import rmtree
import pytest
from pokerthproto.pokerth_pb2 import PokerTHMessage
__author__ = 'Florian Wilhelm'
__copyright__ = 'Florian Wilhelm'
@pytest.fixture
def ... | {
"content_hash": "3aec6da256ae22c2cae25adb925c2350",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 70,
"avg_line_length": 21.93617021276596,
"alnum_prop": 0.6750727449078564,
"repo_name": "FlorianWilhelm/pokerthproto",
"id": "7789c2def5e06b525c4723b38aa250ce2bfe58b8",
"s... |
import os
import sys
import zlib
import time
import requests
from django.core import serializers
from .models import CityAQI, ErrorLog
db_dict = {
'aqi_record':CityAQI,
'error_record':ErrorLog,
}
def sync_db(db_name, remote_host, authentication_token=None):
if db_name not in db_dict.keys():
... | {
"content_hash": "05c6d866bca59847501575317e16e803",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 85,
"avg_line_length": 32.520833333333336,
"alnum_prop": 0.5880845611787315,
"repo_name": "alen-alex/aqi_service",
"id": "e25cc24db186821917481a366ab8a3c3f0afdc5c",
"size":... |
import pkgutil
import inspect
from viper.common.abstracts import Module
def load_modules():
# Import modules package.
import modules
plugins = dict()
# Walk recursively through all modules and packages.
for loader, module_name, ispkg in pkgutil.walk_packages(modules.__path__, modules.__name__ + ... | {
"content_hash": "5f093bf4f586dda5b9e2f7dc5e420aff",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 111,
"avg_line_length": 34.05882352941177,
"alnum_prop": 0.6278065630397237,
"repo_name": "cherry-wb/viper",
"id": "2d5749c7c654b3d2d91db31a402c5ec5af186396",
"size": "1158... |
import functools
import time
import jax
from jax import lax
import jax.numpy as jnp
import numpy as np
from distla_core.analysis import pmaps
from distla_core.linalg.tensor import utils
from distla_core.utils import pops
from distla_core.utils import vops
def random_fixed_norm(shape, dtype, seed=None, serial=False,... | {
"content_hash": "3cadd4d52b0a96ca60b292c8cc15758c",
"timestamp": "",
"source": "github",
"line_count": 349,
"max_line_length": 86,
"avg_line_length": 39.34097421203438,
"alnum_prop": 0.657319737800437,
"repo_name": "google/distla_core",
"id": "202c646a2fe847923b976678b7bcc184fac397a0",
"size": "14... |
import re
import argparse
from maccli.config import MACFILE_ON_FAILURE_DESTROY_ALL, MACFILE_ON_FAILURE_DESTROY_OTHERS
def add_login_parser(subparsers):
subparsers.add_parser('login', help='Login into Manageacloud.com', description='Login into Manageacloud.com')
def add_instance_parser(subparsers):
instance_... | {
"content_hash": "21c3ea92d507854a75973ce4e9f11a16",
"timestamp": "",
"source": "github",
"line_count": 323,
"max_line_length": 171,
"avg_line_length": 57.06501547987616,
"alnum_prop": 0.5729709201388888,
"repo_name": "manageacloud/manageacloud-cli",
"id": "2307cb96589a13b1a4d83c828bce3e45a62042da",
... |
"""
Test that we correctly find private decls
"""
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
import os
import unittest2
class TestSwiftPrivateTypeAlias(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self... | {
"content_hash": "98710af126f85041d85a82634a00d764",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 93,
"avg_line_length": 34.5,
"alnum_prop": 0.6261869065467266,
"repo_name": "apple/swift-lldb",
"id": "494bc67b494ca6dfb973ab2ffd528331fc76a17c",
"size": "2461",
"binary"... |
import numpy_routines as npr
import numpy as np
import datetime as dt
import re
def vector_mask(vec,idx0,idx1):
mask = [False]*len(vec)
mask[idx0:(idx1+1)] = [True]*(idx1-idx0+1)
return np.array(mask)
def apply_dt_format(val,fmt):
if val is not None and not \
isinstance(val,(dt.time,dt.dat... | {
"content_hash": "7edaa83e45335ed59c1eb6c4da7fb405",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 90,
"avg_line_length": 42.72611464968153,
"alnum_prop": 0.5805754323196184,
"repo_name": "KimberleyOpie/common-tools",
"id": "24c87c53addaa62d9904d15149d5bc3de59fa895",
"s... |
import datetime
from base64 import b16encode
from functools import partial
from operator import __eq__, __ne__, __lt__, __le__, __gt__, __ge__
from six import (
integer_types as _integer_types,
text_type as _text_type,
PY3 as _PY3)
from cryptography import x509
from cryptography.hazmat.primitives.asymmet... | {
"content_hash": "1a22c0154727a7900886b2f5c90526ba",
"timestamp": "",
"source": "github",
"line_count": 3108,
"max_line_length": 84,
"avg_line_length": 31.876769626769626,
"alnum_prop": 0.5939458782917647,
"repo_name": "hynek/pyopenssl",
"id": "ecd055e15822ae63d471955c417395a6efd7dd95",
"size": "99... |
"""Test getnewblockhex
"""
from io import BytesIO
from test_framework.messages import CBlock
from test_framework.p2p import (
P2PDataStore,
)
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
hex_str_to_bytes,
)
class GetNewBlockHexTest(BitcoinT... | {
"content_hash": "d660e69f7eb8023f16da7bb57e09434c",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 183,
"avg_line_length": 39.75373134328358,
"alnum_prop": 0.6337525811901633,
"repo_name": "ElementsProject/elements",
"id": "4a0670e09305e98b9fa2103cb6e5cac7dc059e15",
"si... |
from .blizzard import Blizzard
__red_end_user_data_statement__ = (
"This cog does not persistently store data or metadata about users."
)
def setup(bot):
bot.add_cog(Blizzard(bot))
| {
"content_hash": "92e00982fd4b1a931e3881c0fa3741ca",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 72,
"avg_line_length": 21.333333333333332,
"alnum_prop": 0.703125,
"repo_name": "flapjax/FlapJack-Cogs",
"id": "651a67e9cb6677197debb8fd1795e6ca8959d882",
"size": "192",
"... |
import os
import xarray
from pymt.portprinter.port_printer import PortPrinter
def test_one_printer(tmpdir, with_two_components):
with tmpdir.as_cwd():
queue = PortPrinter.from_string(
"""
[print.ocean_surface__temperature]
format=nc
port=water_port
"""
)
assert isinstance(que... | {
"content_hash": "a1c54c4d425685dbbf3c8f2f68fae9c8",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 65,
"avg_line_length": 23.392857142857142,
"alnum_prop": 0.6129770992366412,
"repo_name": "csdms/coupling",
"id": "69b36448b4bfcd98d902ff999d852ed0e8aed7e3",
"size": "1333"... |
import datetime
import os
import threading
import time
import unittest
import warnings
from pyspark.sql import Row
from pyspark.sql.functions import udf
from pyspark.sql.types import *
from pyspark.testing.sqlutils import ReusedSQLTestCase, have_pandas, have_pyarrow, \
pandas_requirement_message, pyarrow_requireme... | {
"content_hash": "40ba8bfb32d7d6f76285ea6a84f42097",
"timestamp": "",
"source": "github",
"line_count": 413,
"max_line_length": 100,
"avg_line_length": 46.3680387409201,
"alnum_prop": 0.6039686684073107,
"repo_name": "aosagie/spark",
"id": "067113722adb527a5864c40e9cbc747d2dd3ed3e",
"size": "19935"... |
from django.utils.translation import ugettext_lazy as _
from django.db import models
from shop.util.fields import CurrencyField
class TextOptionBase(models.Model):
"""
This part of the option is selected by the merchant - it lets him/her "flag"
a product as being able to receive some text as an option, an... | {
"content_hash": "7f47f4e44f28560b62d3182f0f7491b8",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 83,
"avg_line_length": 34.48148148148148,
"alnum_prop": 0.6723952738990333,
"repo_name": "jrief/django-shop-productvariations",
"id": "7e2a0b54c4495a090eb03abe6a33391c16512a4... |
import logging
from Crypto import Random
from Crypto.Random.random import getrandbits
from Crypto.PublicKey import RSA
from Crypto.Cipher import AES
import hashlib
import os
logging.basicConfig(level=logging.INFO)
"""
`Message` class for creating wrapper objects for REST messages.
Accepts a few required keyword pa... | {
"content_hash": "f1bf21a8ebcbd36c0741f6e8d5dc3ade",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 83,
"avg_line_length": 32.75,
"alnum_prop": 0.610553100308022,
"repo_name": "dash1291/rest-security",
"id": "49e537a9e1a641cb097ecfdca9912c46e5c7ff3c",
"size": "7467",
"... |
"""Sorting helpers for ISY994 device classifications."""
from typing import Any, List, Optional, Union
from pyisy.constants import (
ISY_VALUE_UNKNOWN,
PROTO_GROUP,
PROTO_INSTEON,
PROTO_PROGRAM,
PROTO_ZWAVE,
TAG_FOLDER,
)
from pyisy.nodes import Group, Node, Nodes
from pyisy.programs import Pro... | {
"content_hash": "13fd43551364c6e08043550a0e9b4cd2",
"timestamp": "",
"source": "github",
"line_count": 421,
"max_line_length": 93,
"avg_line_length": 35.07600950118765,
"alnum_prop": 0.6230107672513036,
"repo_name": "partofthething/home-assistant",
"id": "fecf18f789b53638bcc53e47371b199acd9090a5",
... |
import boto3
import zipfile
import os
import time
region = 'us-east-1'
iam = boto3.client('iam')
policy_name = 'EBS-Backup'
policy_src = 'ebs-backup-iam-policy.json'
role_name = 'EBS-Backup-Lambda'
role_src = 'ebs-backup-iam-role-trust-policy.json'
function_name = 'EBS-Backup'
log_group_name = '/aws/lambda/' + funct... | {
"content_hash": "67a0ca967275df41808cfddd8c5b5d84",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 113,
"avg_line_length": 31.920289855072465,
"alnum_prop": 0.6408626560726447,
"repo_name": "jcmturner/aws-backup",
"id": "9f74667ae42e78ba50dbd38ac1ba873fde50560b",
"size"... |
"""Test hassbian config."""
import asyncio
import os
from unittest.mock import patch
from homeassistant.bootstrap import async_setup_component
from homeassistant.components import config
from homeassistant.components.config.hassbian import (
HassbianSuitesView, HassbianSuiteInstallView)
from tests.common import (
... | {
"content_hash": "bd0103549f96d1bf97e5ffa8fdf1e64c",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 74,
"avg_line_length": 36.346666666666664,
"alnum_prop": 0.6922230374174615,
"repo_name": "keerts/home-assistant",
"id": "811a8add3e29547a78c2b14609ba02ccce3913c3",
"size":... |
from magictest import MagicTest as TestCase, suite
from codetalker import pgm
from codetalker.pgm.tokens import STRING, ID, NUMBER, WHITE, CCOMMENT, NEWLINE, EOF, StringToken
from codetalker.pgm.special import star, plus, _or
from codetalker.pgm.grammar import ParseError
class SYMBOL(StringToken):
items = list('[... | {
"content_hash": "7756dec1ae90d71c55247aa5794c64ec",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 129,
"avg_line_length": 22.824074074074073,
"alnum_prop": 0.5565922920892495,
"repo_name": "jaredly/codetalker",
"id": "28531b9e96bffabdcf86ea766e57d99b18dbd562",
"size": ... |
from yubikit.core import Tlv, BadResponseError, NotSupportedError
from yubikit.core.smartcard import ApduError, SW
from yubikit.piv import (
PivSession,
SLOT,
OBJECT_ID,
KEY_TYPE,
MANAGEMENT_KEY_TYPE,
ALGORITHM,
TAG_LRC,
)
from cryptography import x509
from cryptography.exceptions import In... | {
"content_hash": "1f768600f8d3917b0a625afacf860a2d",
"timestamp": "",
"source": "github",
"line_count": 635,
"max_line_length": 88,
"avg_line_length": 33.355905511811024,
"alnum_prop": 0.6076672489495303,
"repo_name": "Yubico/yubikey-manager",
"id": "324e5aabc6686c8e008e000a0d8bedb74c09ce0d",
"size... |
"""
perform risk modelling
"""
import pandas as pd
from sklearn import cross_validation as cv
import numpy
from sklearn import preprocessing
from sklearn import linear_model, datasets, metrics
from sklearn.metrics import f1_score
from sklearn.ensemble import RandomForestClassifier
import math
import itertools
from skle... | {
"content_hash": "93ee7e81fa42d39d7f7ed6d0510a0e22",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 120,
"avg_line_length": 33.17167381974249,
"alnum_prop": 0.5892094708241687,
"repo_name": "kraktos/Data_Science_Analytics",
"id": "308ce72272b9bae1b33f55a13dd9e458ee4a0429",... |
import os
import socket
import time
import pychemia
from multiprocessing import Process
from pychemia import pcm_log, HAS_PYMONGO
if HAS_PYMONGO:
from pychemia.db import get_database
class FireballCollector:
def __init__(self, db_settings, dbname, source_dir='/fireball-archive/data-mining', nconcurrent=1,
... | {
"content_hash": "111f9d7adc3d58d65d79ace90ee0eaaf",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 120,
"avg_line_length": 39.624242424242425,
"alnum_prop": 0.5578158458244111,
"repo_name": "MaterialsDiscovery/PyChemia",
"id": "aad433709e07d1dd94b2b86294be9f955cf02247",
... |
"""jctf URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... | {
"content_hash": "3c63191a3ddc2440bf0cb7c0851912b8",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 79,
"avg_line_length": 37.40909090909091,
"alnum_prop": 0.6962332928311057,
"repo_name": "theoldmoon0602/JCTF",
"id": "4215f346e9d20ece787f78d78c0af916ba7baaf5",
"size": "8... |
"""Gherkin step implementations for chart legend features."""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from behave import given, then, when
from pptx import Presentation
from pptx.enum.chart import XL_LEGEND_POSITION
from pptx.text.text import Font
from helpers impo... | {
"content_hash": "1d7c8d9bf51ebf0ca63a54335cb12c1a",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 75,
"avg_line_length": 30.495412844036696,
"alnum_prop": 0.6353790613718412,
"repo_name": "biggihs/python-pptx",
"id": "25510dda2e2744c73e17a16b873c8abee7b2915c",
"size": ... |
import requests
import json
class Pusher(object):
API_KEY = 'o.Nej9veaxrIJNTTcHFUDCuugm8ZsgxZYv'
def __init__(self, name):
self.name = name
# Send a message to all your registered devices.
def pushMessage(title, body):
data = {
'type':'note',
'title':... | {
"content_hash": "bf2c8971e03703449cb03294c71e912b",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 98,
"avg_line_length": 25.5,
"alnum_prop": 0.5708061002178649,
"repo_name": "eddieruano/SentinelGreen",
"id": "0d0a535eeeef231669ffbadaddfc515c0b709153",
"size": "637",
"... |
'''
Module of functions for Kodi API management.
'''
import requests
import json
import logging
logger = logging.getLogger(__name__)
# API call management
def call_api(server_params, command):
if server_params['tcp']:
ret = call_api_tcp(
server_params['ip'],
server_params... | {
"content_hash": "139722f576daadc08e8163d64c420d46",
"timestamp": "",
"source": "github",
"line_count": 290,
"max_line_length": 95,
"avg_line_length": 30.482758620689655,
"alnum_prop": 0.5373303167420814,
"repo_name": "crackulator/py-kodi-remote-controller",
"id": "929317ebb0afa996634d5f685a099fa26fb... |
from __future__ import absolute_import
import time
from tchannel.net import local_ip
import opentracing
from . import glossary
from .glossary import TRACE_ATTRIBUTES_HEADER_PREFIX
from .marshaling import TraceContextEncoder, TraceContextDecoder
from .span import Span
from .version import __version__
from .thrift impo... | {
"content_hash": "e9cbab466c800a301da221665b2b49a7",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 79,
"avg_line_length": 37.755102040816325,
"alnum_prop": 0.6205405405405405,
"repo_name": "uber-common/opentracing-python",
"id": "398236a4533b2b1e3ef0eceef741c7a6d8eefeaf",
... |
'''test pysftp module - set 2 - uses py.test'''
# psftp and lsftp fixtures are from conftest.py
# pylint: disable = W0142
# pylint: disable=E1101
from common import *
from stat import S_ISLNK
def test_sftp_client(psftp):
'''test for access to the underlying, active sftpclient'''
# with pysftp.Connection(**SFT... | {
"content_hash": "81619c04b60defc9e9eb8d951e2bb742",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 62,
"avg_line_length": 31.326315789473686,
"alnum_prop": 0.5621639784946236,
"repo_name": "Clean-Cole/pysftp",
"id": "f826a8a8d901cb38e039d2870ac83a93c48d5e77",
"size": "29... |
'''
Basic reduction steps for SOAR image slicer data.
This script should be used only for a quicklook and not for science.
The basic idea is that the script provides good enough calibration
so that a science spectra can be convolved with a system throughput
curve to get a spatially resolved flux. This information can t... | {
"content_hash": "d7bdaa9cbe509bb6e2fd2d19e12d6b51",
"timestamp": "",
"source": "github",
"line_count": 643,
"max_line_length": 141,
"avg_line_length": 32.64385692068429,
"alnum_prop": 0.5677465459742734,
"repo_name": "sniemi/SamPy",
"id": "b7fa2d67ac1e6eb0692baac2b458b4560622673c",
"size": "20990"... |
import re
from http_request_randomizer.requests.errors.ParserExceptions import ParserException
__author__ = 'pgaref'
class UrlParser(object):
"""
An abstract class representing any URL containing Proxy information
To add an extra Proxy URL just implement this class and provide a 'url specific' p... | {
"content_hash": "2c400a0c56be4092ae662209ead628b1",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 130,
"avg_line_length": 31.621951219512194,
"alnum_prop": 0.5954492865406865,
"repo_name": "pgaref/HTTP_Request_Randomizer",
"id": "f76f2819313a60295d0cbf3ac0f76943a9d552b4",... |
"""Module providing functions for presenting analysis/db output."""
import sys
import logging
from pathlib import Path
from typing import Any, Dict, List, Optional, Sequence
import pandas as pd # type: ignore
def colour_rows(
series: pd.Series, even_colour: str = "#DDECF5", odd_colour: str = "#6CB6E4"
) -> Li... | {
"content_hash": "098af8e32fd9bbe93069dffa9cd41d12",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 88,
"avg_line_length": 31.31382978723404,
"alnum_prop": 0.6225581790385596,
"repo_name": "widdowquinn/pyani",
"id": "cf8092420637a2b94ecafa4fc764c9e97e10d7e8",
"size": "73... |
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas.core.dtypes.common as com
from pandas.core.dtypes.dtypes import (
CategoricalDtype, CategoricalDtypeType, DatetimeTZDtype, IntervalDtype,
PeriodDtype)
import pandas as pd
from pandas.conftest import (
ALL_EA_INT_DTYP... | {
"content_hash": "362dc7e489dc0ef98443f5f0ab2f84a2",
"timestamp": "",
"source": "github",
"line_count": 651,
"max_line_length": 79,
"avg_line_length": 36.59139784946237,
"alnum_prop": 0.6438436673523362,
"repo_name": "GuessWhoSamFoo/pandas",
"id": "62e96fd39a759612125c5a9c99eb945e96c89c67",
"size":... |
import os, sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import halyard_utils as utils
def list_nodes(driver):
nodes = driver.list_nodes()
node_list = []
for node in nodes:
node_list.append({"name": node.name,
"creationTimestamp": node.ex... | {
"content_hash": "7b642955a42b5552c035f0cf2685a5a8",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 91,
"avg_line_length": 35.617511520737324,
"alnum_prop": 0.6209082675637211,
"repo_name": "googleinterns/android-cuttlefish-halyard",
"id": "a2bd47fc5b7751dd7e5326e6ce9807f7... |
import contextlib
import locale as locale_module
import re
from datetime import datetime
from enum import Enum, auto
from typing import Optional, TypedDict, Callable
from clippings.parser import Metadata, Location
class ParseError(Exception):
def __init__(self, string, parsing_as):
super().__init__(f"Fai... | {
"content_hash": "6416cc07de0374b29343e575116627e8",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 104,
"avg_line_length": 27.052083333333332,
"alnum_prop": 0.6503658067000385,
"repo_name": "samueldg/clippings",
"id": "12ecd396bc6b2c58e4bbdffac4d78162de027475",
"size": "... |
class SquareSumComputer(object):
def __init__(self, a, b):
self.a = a
self.b = b
def transform(self, x):
return x * x
def inputs(self):
return range(self.a, self.b)
def compute(self):
return sum(self.transform(value) for value in self.inputs())
class CubeSumC... | {
"content_hash": "a594f83d4da7d7fde1d9a1f92b4dde72",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 68,
"avg_line_length": 21.217391304347824,
"alnum_prop": 0.5799180327868853,
"repo_name": "madoodia/codeLab",
"id": "23024319a4ffcf69c40b7a2ca61e269ba4f532fb",
"size": "488... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("coredb", "0011_alter_artifact_state"),
]
operations = [
migrations.AlterField(
model_name="artifact",
name="updated_at",
field=models.DateTimeField(auto_... | {
"content_hash": "919723f6b9f203592d4c62ca618695b6",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 85,
"avg_line_length": 30.452830188679247,
"alnum_prop": 0.49318463444857497,
"repo_name": "polyaxon/polyaxon",
"id": "cd1f3de35ec76ccbba7d25c405b11e58c3cc7d08",
"size": "2... |
import re
from Db import DbQuery
class TestDbQuery:
def testParse(self):
query_text = """
SELECT
'comment' AS type,
date_added, post.title AS title,
keyvalue.value || ': ' || comment.body AS body,
'?Post:' || comment.post_id || '#Comments' A... | {
"content_hash": "7dcd5a75882edaf6cc6e92f395d4fafe",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 130,
"avg_line_length": 38.354838709677416,
"alnum_prop": 0.5332211942809083,
"repo_name": "kustomzone/Fuzium",
"id": "214704a493b651a472d5daf44bda57bbd9bac1ac",
"size": "1... |
from __future__ import division
from numpy import isclose
from svgpathtools import Path, CubicBezier, Line, disvg, wsvg
from svgpathtools.path import inv_arclength
from options4rings import try_to_open_svgs_in_browser
disvg = disvg if try_to_open_svgs_in_browser else wsvg
def is_differentiable(path, tol=1e-8, return... | {
"content_hash": "bf43cd3efd0213a2d55ba9e775327949",
"timestamp": "",
"source": "github",
"line_count": 282,
"max_line_length": 108,
"avg_line_length": 39.5531914893617,
"alnum_prop": 0.6022054868208714,
"repo_name": "mathandy/svgtree",
"id": "c4740db62c18c1264ce929e681ea66706537f8a2",
"size": "111... |
from django.core.cache import cache
from django.core.files.uploadhandler import TemporaryFileUploadHandler
# copied from http://djangosnippets.org/snippets/678/
class ProgressBarUploadHandler(TemporaryFileUploadHandler):
"""
Cache system for TemporaryFileUploadHandler
"""
def __init__(self, *args, **... | {
"content_hash": "c26ee7a8df86a9626adfd288c63aad90",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 91,
"avg_line_length": 38.108695652173914,
"alnum_prop": 0.6257843696520251,
"repo_name": "CydarLtd/django-progressbarupload",
"id": "ff395ffd2c648d82e8dd1464668af149abb05e27... |
from mif_object import MifObject
class Scalar(MifObject):
"""
Class to store information about a single scalar that contains a number or a string.
The following fields must be defined:
value and/or min and and/or max
"""
def __init__(self, value=None, minimum=None, maximum=None, uncertai... | {
"content_hash": "0647ad293d8f4eaddb1e60a4a0410fa1",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 91,
"avg_line_length": 33.875,
"alnum_prop": 0.6503690036900369,
"repo_name": "CitrineInformatics/mifkit",
"id": "23613592fb77e18ca1dba7541d12e4e79b6e138f",
"size": "1084",... |
from typing import Optional, Sequence, Union
import torch.nn as nn
from torch import Tensor
from monai.apps.reconstruction.networks.nets.utils import (
complex_normalize,
divisible_pad_t,
inverse_divisible_pad_t,
reshape_channel_complex_to_last_dim,
reshape_complex_to_channel_dim,
)
from monai.net... | {
"content_hash": "dba9bfa86290b04f2d90a07939e553e3",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 114,
"avg_line_length": 41.23762376237624,
"alnum_prop": 0.6067226890756302,
"repo_name": "Project-MONAI/MONAI",
"id": "ccbb5731a1f42f96b9c52c074212da3396a7409f",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.