text stringlengths 4 1.02M | meta dict |
|---|---|
"""Data generators for wikitext-103.
Wikitext-103: Long term dependency language modeling dataset
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import os
import zipfile
from tensor2tensor.data_generators import generator_utils
from... | {
"content_hash": "3c88fea6083a720726b1c879cd5f0eb1",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 75,
"avg_line_length": 28.62162162162162,
"alnum_prop": 0.6720963172804533,
"repo_name": "mlperf/training_results_v0.5",
"id": "24ebc27631b81c8a0e0174e816e41a24c8df9318",
... |
import six
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest.common import waiters
from tempest import test
QUOTA_KEYS = ['gigabytes', 'snapshots', 'volumes', 'backups']
QUOTA_USAGE_KEYS = ['reserved', 'limit', 'in_use']
class BaseVolumeQuotasAdminV2TestJSON(base.BaseVolume... | {
"content_hash": "b91adad59f330aa2f0140c788623735e",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 78,
"avg_line_length": 42.52469135802469,
"alnum_prop": 0.6067644070256931,
"repo_name": "sebrandon1/tempest",
"id": "b47a5f0f277987f587a261ed4dedb2cf18d21136",
"size": "7... |
"""Ptransform overrides for DataflowRunner."""
from __future__ import absolute_import
from apache_beam.coders import typecoders
from apache_beam.pipeline import PTransformOverride
class CreatePTransformOverride(PTransformOverride):
"""A ``PTransformOverride`` for ``Create`` in streaming mode."""
def matches(se... | {
"content_hash": "3ae6a44dc3e855ae53d2322cd00bc718",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 73,
"avg_line_length": 37.88,
"alnum_prop": 0.7286166842661035,
"repo_name": "markflyhigh/incubator-beam",
"id": "6e84c15cbc8fd0b16b0402dafd00991b6a6fcde5",
"size": "2679",... |
import unittest
from datetime import datetime
from unittest import mock
import pytest
from airflow.exceptions import AirflowException
from airflow.providers.amazon.aws.hooks.logs import AwsLogsHook
from airflow.providers.amazon.aws.hooks.sagemaker import LogState, SageMakerHook
from airflow.providers.amazon.aws.senso... | {
"content_hash": "eadc1d65a7bfbd8aec292f73167f9a7f",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 101,
"avg_line_length": 39.678899082568805,
"alnum_prop": 0.671907514450867,
"repo_name": "sekikn/incubator-airflow",
"id": "09d98f762ed08d644e84b5b9f054003cfa433cba",
"si... |
'''
# https://leetcode.com/forums/viewtopic.php?f=4&t=146&mc_cid=83951cfa08&mc_eid=cad0363a72
Given array a, and b.
Merge them into one array c, keep the order of elements in each array.
There are many possible results for c.
Your solution should randomly generate one of them with same probability.
For example, a = [1... | {
"content_hash": "1618a38a5372bdc0eb8ef45180bd6e34",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 123,
"avg_line_length": 34.30508474576271,
"alnum_prop": 0.5948616600790514,
"repo_name": "JulyKikuAkita/PythonPrac",
"id": "90de315783f7507d811db3168253f97199bf911d",
"siz... |
from __future__ import unicode_literals
from bpython import importcompletion
from bpython.test import unittest
class TestSimpleComplete(unittest.TestCase):
def setUp(self):
self.original_modules = importcompletion.modules
importcompletion.modules = ['zzabc', 'zzabd', 'zzefg', 'zzabc.e',
... | {
"content_hash": "d4e0633b6aa099cee08b0d5ffe1cb8ac",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 79,
"avg_line_length": 31.705882352941178,
"alnum_prop": 0.6042053184910328,
"repo_name": "MarkWh1te/xueqiu_predict",
"id": "4df736b54ba2be480837990dabfd51a3cbcbdf20",
"siz... |
from rdflib.graph import Graph
from FuXi.Rete.RuleStore import SetupRuleStore
from FuXi.Rete.Util import generateTokenSet
from FuXi.Horn.HornRules import HornFromN3
def main():
rule_store, rule_graph, network = SetupRuleStore(makeNetwork=True)
closureDeltaGraph = Graph()
network.inferredFacts = closureDe... | {
"content_hash": "8ff729f81f9bbf83eb41cca3374fb652",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 83,
"avg_line_length": 27.375,
"alnum_prop": 0.7454337899543378,
"repo_name": "mpetyx/pyrif",
"id": "4a7c0f74e067c40d972e426f7d287e33fed053b4",
"size": "876",
"binary": f... |
import abc
import importlib
from django.core.exceptions import ImproperlyConfigured
from django.conf import settings
class BaseEventsPushBackend(object, metaclass=abc.ABCMeta):
@abc.abstractmethod
def emit_event(self, message:str, *, routing_key:str, channel:str="events"):
pass
def load_class(path)... | {
"content_hash": "e31e44880ef003202ccd9bbf1728ad26",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 109,
"avg_line_length": 26.4,
"alnum_prop": 0.6641414141414141,
"repo_name": "mattcongy/itshop",
"id": "a9f0e8f2d16661bcfebb57a718887797650f51b9",
"size": "1923",
"binary... |
from types import CodeType
def copy_code_with_changes(codeobject,
argcount=None,
nlocals=None,
stacksize=None,
flags=None,
code=None,
consts=None,
... | {
"content_hash": "82f2df9f7985066996194cbb5446230b",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 67,
"avg_line_length": 35.98148148148148,
"alnum_prop": 0.43849716932578486,
"repo_name": "timm/timmnix",
"id": "9a0ec63bc85e8aa1f91eb2aaf89fa64ca3d710eb",
"size": "2834",
... |
from rally.common import logging
LOG = logging.getLogger(__name__)
class CinderQuotas(object):
"""Management of Cinder quotas."""
QUOTAS_SCHEMA = {
"type": "object",
"additionalProperties": False,
"properties": {
"gigabytes": {
"type": "integer",
... | {
"content_hash": "5989349c521a46147b68c518219a7c72",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 64,
"avg_line_length": 23.52777777777778,
"alnum_prop": 0.4734356552538371,
"repo_name": "eonpatapon/rally",
"id": "7426c8503b4122026f7d697e6ef33a17e8983245",
"size": "1445... |
import rethinkdb as r
import bigchaindb.crypto
from .assets import transfer_asset
class Account:
def __init__(self, bigchain, name, ledger, db):
self.bigchain = bigchain
self.db = db
self.name = name
self.sk, self.vk = bigchaindb.crypto.generate_key_pair()
self.ledger = le... | {
"content_hash": "a6863573bc08a9359493b848390e18d4",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 119,
"avg_line_length": 32.096385542168676,
"alnum_prop": 0.4988738738738739,
"repo_name": "enzovici/PoC-TruthChain",
"id": "61429d9de78a7852a512de81b50aa25084cf8ffb",
"siz... |
from ._cart2 import cart2
from ._cart2_append import cart2_append
from ._cartn_append import cartn_append
from ._cartn import cartn
from ._dict2list import dict2list
from ._head import head
from ._tail import tail | {
"content_hash": "980b4edebe5f2d1376332d26ddd9c4af",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 39,
"avg_line_length": 30.428571428571427,
"alnum_prop": 0.7887323943661971,
"repo_name": "FunctionalX/FunctionalX.py",
"id": "d42a0a10ae0ff226491ca38dee6129f2c706b441",
"si... |
import logging
from spyne.decorator import srpc
from spyne.service import ServiceBase
from spyne.model.complex import ComplexModel
from spyne.model.complex import Iterable
from spyne.model.primitive import Integer
from spyne.model.primitive import Unicode
from spyne.util.simple import wsgi_soap_application
class So... | {
"content_hash": "ba8cda1b5efac9089a8351cceded3e2f",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 86,
"avg_line_length": 29.404255319148938,
"alnum_prop": 0.6931982633863966,
"repo_name": "ehudmagal/robotqcapp",
"id": "d1df4fc23eaf259faef93229a30fa312b0dcb4e4",
"size": ... |
from __future__ import absolute_import
import time
import os
from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout,
AlreadyLocked)
class LinkLockFile(LockBase):
"""Lock access to a file using atomic property of link(2).
>>> lock = LinkLockFile('somefile')
>>> lock = LinkL... | {
"content_hash": "633c1f93885baa4e3839b9ced7568a32",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 75,
"avg_line_length": 34.070422535211264,
"alnum_prop": 0.5126085159156676,
"repo_name": "sorenh/cc",
"id": "f8aeaefcfc16578a51a1d2fb4c86a762e01c4047",
"size": "2419",
"... |
from .logexception import LogException
from .logresponse import LogResponse
from .util import Util
from .util import base64_encodestring as b64e
from .log_logs_pb2 import LogGroupList
class PullLogResponse(LogResponse):
""" The response of the pull_logs API from log.
:type header: dict
:param header... | {
"content_hash": "773f677cbe11eac1d591f2f323d1d63b",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 109,
"avg_line_length": 36.739583333333336,
"alnum_prop": 0.5854834136660051,
"repo_name": "wjo1212/aliyun-log-python-sdk",
"id": "a3e4aef79f18c83db5798957a19bd70d475012c8",
... |
from .euctwfreq import (EUCTWCharToFreqOrder, EUCTW_TABLE_SIZE,
EUCTW_TYPICAL_DISTRIBUTION_RATIO)
from .euckrfreq import (EUCKRCharToFreqOrder, EUCKR_TABLE_SIZE,
EUCKR_TYPICAL_DISTRIBUTION_RATIO)
from .gb2312freq import (GB2312CharToFreqOrder, GB2312_TABLE_SIZE,
... | {
"content_hash": "9d362a02e448f7c36371fdb426f17959",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 79,
"avg_line_length": 39.27093596059113,
"alnum_prop": 0.6150275965880582,
"repo_name": "Esri/geoprocessing-tools-for-hadoop",
"id": "253408f287ad9b44466137a3e547ae80ffbeda... |
"""
Base classes for cluster simulation framework.
"""
##########################################################################
# Imports
##########################################################################
from gvas.base import NamedProcess
###################################################################... | {
"content_hash": "4d9bd9917f6ad9912034f9f3edee892d",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 76,
"avg_line_length": 30.452380952380953,
"alnum_prop": 0.4659890539483972,
"repo_name": "tipsybear/actors-simulation",
"id": "ce2738dd6b43239337c0db0a336ec3870e1a40ba",
"... |
from app.views.api import api
from flask import request, session, jsonify, abort, make_response
from app.__init__ import db
from functools import wraps
@api.route('/auth', methods=['POST'])
def api_auth_login():
body = request.get_json(force=True)
try:
if attempt_auth_login(body['username'], body['pas... | {
"content_hash": "1e68f9c1215a0b114b7d446a89175d60",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 79,
"avg_line_length": 27.64179104477612,
"alnum_prop": 0.5545356371490281,
"repo_name": "krrg/gnomon",
"id": "abb59bb50b9abead6958f3e7909c2e00e5af4a6c",
"size": "1852",
... |
import os
import tensorflow as tf
from tf_utils import *
from transformation import *
### define your inference model ###
def inference(input_img, input_fp, input_ang, phase_train, conf):
"""Build the Deepwarp model.
Args: images, anchors_map of eye, angle
Returns: lcm images
"""
corse_layer ... | {
"content_hash": "b77d542addf023cd06fd5648bd38fd36",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 200,
"avg_line_length": 75.0952380952381,
"alnum_prop": 0.6515535827520609,
"repo_name": "IIS-DIRL/Study-Group",
"id": "7a19b1ccd0311d1b18e53ccf0736f1d0a1da3d1d",
"size": "... |
from __future__ import absolute_import, unicode_literals
from django.contrib.admin.utils import quote
from django.utils.encoding import force_text
from django.utils.translation import ugettext as _
class ButtonHelper(object):
default_button_classnames = ['button']
add_button_classnames = ['bicolor', 'icon',... | {
"content_hash": "291e8bbb5fe3badd2481ea26440dfe91",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 81,
"avg_line_length": 39.84153005464481,
"alnum_prop": 0.5827732821286518,
"repo_name": "Toshakins/wagtail",
"id": "f26252f0d5bb0425dac00739909dfef766ce8fcb",
"size": "72... |
from .thing import Thing
class Intangible(Thing):
"""Intangible.
You probably want to use the sub-classes and not this class directly. Known
sub-classes are: StructuredValue
Variables are only populated by the server, and will be ignored when
sending a request.
:param _type: Constant filled... | {
"content_hash": "e744ff92ef5127fd01c5764333034fb1",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 94,
"avg_line_length": 35.854838709677416,
"alnum_prop": 0.6626180836707153,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "dedf341eb6152ee00b463d72b2f40578e522b402",
... |
""" Activations
A collection of jit-scripted activations fn and modules with a common interface so that they can
easily be swapped. All have an `inplace` arg even if not used.
All jit scripted activations are lacking in-place variations on purpose, scripted kernel fusion does not
currently work across in-place op bou... | {
"content_hash": "3d7fa97e2873b285b418b8ff2820c57e",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 107,
"avg_line_length": 28.1,
"alnum_prop": 0.6611308817714512,
"repo_name": "rwightman/pytorch-image-models",
"id": "b4a516530ad0abf41f720ac83d02791179bb7b67",
"size": "25... |
'''
Test NTriples serializer
'''
import logging
import functools
# Requires pytest-mock
import pytest
from amara3 import iri
from versa import I
from versa.driver.memory import newmodel
from versa.serial.ntriples import *
# from versa.util import jsondump, jsonload
NT_SPEC = I('http://www.w3.org/2001/sw/RDFCore/ntr... | {
"content_hash": "9486a879def3cd99e116039d3a579256",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 112,
"avg_line_length": 31.5,
"alnum_prop": 0.6750208855472013,
"repo_name": "uogbuji/versa",
"id": "9f3d4f64cdfa5c4234f7351b2491c71fc2af4a60",
"size": "1224",
"binary": ... |
from django.conf.urls import url
import actions
urlpatterns = [
url(r'^create', actions.create),
url(r'^update/(?P<public_link_id>[-\w]+)', actions.update),
url(r'^delete/(?P<public_link_id>[-\w]+)', actions.delete),
url(r'^search/(?P<search_text>[-\w]+)', actions.get_search),
url(r'^(?P<public_lin... | {
"content_hash": "64c9ec08b9ef9bf46f8d4ff033d54062",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 67,
"avg_line_length": 36.18181818181818,
"alnum_prop": 0.6105527638190955,
"repo_name": "EndyKaufman/django-postgres-angularjs-blog",
"id": "608d4a4c1a81ee51f92a37835b9dfbc3... |
from __future__ import unicode_literals
import re
import six
from six.moves.urllib.parse import parse_qs, urlparse
import xmltodict
from moto.core.responses import _TemplateEnvironmentMixin
from .exceptions import BucketAlreadyExists, S3ClientError, InvalidPartOrder
from .models import s3_backend, get_canned_acl, F... | {
"content_hash": "f1080d466c01a97646f108a2df7e69fd",
"timestamp": "",
"source": "github",
"line_count": 824,
"max_line_length": 131,
"avg_line_length": 40.054611650485434,
"alnum_prop": 0.6011210422663232,
"repo_name": "behanceops/moto",
"id": "27a6d4536effe215a692d34621d610d9fcbd33a6",
"size": "33... |
import time
class Death(object):
def death(self):
time.sleep(2)
print "> You go to sleep. As it turns out, your cellmate awoke and"
print "> promptly killed you (ENDING #1)." | {
"content_hash": "e1d1a8cc7970b211a0092dc4d123b326",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 75,
"avg_line_length": 29,
"alnum_prop": 0.6206896551724138,
"repo_name": "FlippantSol/CIS-121",
"id": "15fe743b35d04721929c72ddb7e206ce06d9e945",
"size": "203",
"binary":... |
import blocks.roles
from six.moves import cPickle
def test_role_serialization():
"""Test that roles compare equal before and after serialization."""
roles = [blocks.roles.INPUT,
blocks.roles.OUTPUT,
blocks.roles.COST,
blocks.roles.PARAMETER,
blocks.roles.AUX... | {
"content_hash": "7e9ce71d434eb87c79a87bf3aeb2fcba",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 71,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.6153846153846154,
"repo_name": "nke001/attention-lvcsr",
"id": "41ceb6b16ab95c4fdc30a2d3cd76722f7b9e9f3a",
"size"... |
import time
import os
import urlparse, urllib
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from nw_util import *
def path2url(path):
return urlparse.urljoin(
'file:', urllib.pathname2url(path))
from selenium import webdriver
from selenium.webdriver.... | {
"content_hash": "e1339284ea6334dd37b6d0cf57838122",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 189,
"avg_line_length": 30.25531914893617,
"alnum_prop": 0.7137834036568214,
"repo_name": "nwjs/nw.js",
"id": "335bad5d401a5bec0de398153eda3b627ec2094b",
"size": "1422",
... |
from __future__ import absolute_import
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.models import get_client
from zerver.lib.actions import check_send_message
from zerver.lib.response import json_success, json_error
from zerver.decorator import REQ, ... | {
"content_hash": "7399463d0a98adb6dc2066bfb6466f0b",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 84,
"avg_line_length": 41.93181818181818,
"alnum_prop": 0.643360433604336,
"repo_name": "Vallher/zulip",
"id": "1620d2a42ac2071b200523f4e7614a5777715666",
"size": "1883",
... |
from PyQt4.QtGui import *
from xml.dom import minidom
class frm_Settings(QDialog):
def __init__(self, parent = None):
super(frm_Settings, self).__init__(parent)
self.setWindowTitle("Settings PEH-wifi-attack")
self.Main = QVBoxLayout()
self.frm = QFormLayout()
self.setGeometry... | {
"content_hash": "d8ed1a49688beb494d8ffc8af75b96ff",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 112,
"avg_line_length": 39.9937106918239,
"alnum_prop": 0.6131467211825758,
"repo_name": "hackerbolt-freelancer/jhv",
"id": "65f3beca12b0883df3abcfc17265a9866dd4e4f3",
"si... |
import os
import sys
import time
import glob
import misopy
from misopy.settings import Settings
from misopy.settings import miso_path as miso_settings_path
import misopy.hypothesis_test as ht
import misopy.as_events as as_events
import misopy.cluster_utils as cluster_utils
import misopy.sam_utils as sam_utils
import m... | {
"content_hash": "3bb3194686351c8ff8e3ef4c73940466",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 82,
"avg_line_length": 39.03157894736842,
"alnum_prop": 0.604638619201726,
"repo_name": "nsalomonis/AltAnalyze",
"id": "fada41f0ab1b52060c8aa7e909cbb019eb5d9fe2",
"size": "... |
from classytags.arguments import Argument
from classytags.core import Options, Tag
from classytags.helpers import InclusionTag
from cms.constants import PUBLISHER_STATE_PENDING
from cms.toolbar.utils import get_plugin_toolbar_js
from cms.utils.admin import render_admin_rows
from sekizai.helpers import get_varname
from... | {
"content_hash": "a918df8bfc546beb4e8e510ebb2b0d8f",
"timestamp": "",
"source": "github",
"line_count": 282,
"max_line_length": 120,
"avg_line_length": 34.58510638297872,
"alnum_prop": 0.632010663385625,
"repo_name": "nimbis/django-cms",
"id": "eefd79eb0ec676b56fc861267e4e289328c83ad7",
"size": "97... |
import os
import pytest
from product_search import get_similar_products_file, get_similar_products_uri
PROJECT_ID = os.getenv('GOOGLE_CLOUD_PROJECT')
LOCATION = 'us-west1'
PRODUCT_SET_ID = 'indexed_product_set_id_for_testing'
PRODUCT_CATEGORY = 'apparel'
PRODUCT_ID_1 = 'indexed_product_id_for_testing_1'
PRODUCT_ID... | {
"content_hash": "cba91e55d1b8d57f68faaeff35d91736",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 78,
"avg_line_length": 29.714285714285715,
"alnum_prop": 0.6935096153846154,
"repo_name": "GoogleCloudPlatform/python-docs-samples",
"id": "1f8eb72b6d93a9b3707695a12fca651027... |
"""
Manage port state validation
Author:
Itay Marom
"""
from .trex_stl_exceptions import *
from .utils.common import *
# type of states to be enforced
# types starting with _ are internally used
_PSV_ALL, PSV_UP, PSV_ACQUIRED, PSV_IDLE, PSV_RESOLVED, PSV_SERVICE, PSV_NON_SERVICE, PSV_L3 = range(0, 8)
class Por... | {
"content_hash": "d1db8ce5df68e9592e4e1cc1f9994a9c",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 112,
"avg_line_length": 29.579617834394906,
"alnum_prop": 0.5938845822566753,
"repo_name": "dimagol/trex-core",
"id": "5db1b6b65f0c7c00523f84d163cd562ef4df4637",
"size": "... |
"""Prepares pub packages for upload."""
# NOTE: Requires the following build artifacts:
# *) out/Config/gen/dart-pkg
# *) out/Config/apks/
# By default Config is 'android_Release'
import argparse
import os
import shutil
import tempfile
def remove_empty_dirs(root_dir):
for root, dirs, _ in os.walk(root_dir):
... | {
"content_hash": "87ea1ccc86060a5a9f43311e35db498e",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 78,
"avg_line_length": 32.3448275862069,
"alnum_prop": 0.5970149253731343,
"repo_name": "zhangxq5012/sky_engine",
"id": "e53b0c9896fd2212dc8492b363ef7d2252a46994",
"size": ... |
import matplotlib
#matplotlib.use('Agg') # prevents crashes if no X server present (clusters)
from yambopy import *
import matplotlib.pyplot as plt
import sys
import argparse
import numpy as np
import operator
"""
Study the convergence of GW calculations by looking at the change in band-gap value.
The script reads fr... | {
"content_hash": "83d36146edb9ce8d77ac284bd1beb2fc",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 111,
"avg_line_length": 35.959349593495936,
"alnum_prop": 0.6825683924937825,
"repo_name": "alexmoratalla/yambo-py",
"id": "e1cfd36cca204a0094431f1a0bd66636ac006471",
"siz... |
import logging
import time
import sys
logging.getLogger().addHandler(logging.StreamHandler())
class CustomHandler(logging.Handler):
def emit(self, record):
sys.__stdout__.write(record.getMessage().title() + '\n')
custom = logging.getLogger('custom')
custom.addHandler(CustomHandler())
nonprop = logging.... | {
"content_hash": "8254db4db104a39651734ac7c6cbec12",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 64,
"avg_line_length": 27.484375,
"alnum_prop": 0.6856168277430358,
"repo_name": "eric-stanley/robotframework",
"id": "622b084bcf829d23ef9c5ae86770da47c1ecec82",
"size": "1... |
from distutils.core import setup
setup(
name='dynamic_stock_model',
version="1.0",
packages=["dynamic_stock_model", "dynamic_stock_model.tests"],
author="Stefan Pauliuk",
description="Python class for efficient handling of dynamic stock models",
author_email="stefan.pauliuk@ntnu.no",
licens... | {
"content_hash": "f3131615c354371254cc6b58f0094e64",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 86,
"avg_line_length": 42.310344827586206,
"alnum_prop": 0.6422167889160554,
"repo_name": "stefanpauliuk/dynamic_stock_model",
"id": "36d5f50e01f467078419b6c1ad5b821a6179b695... |
"""Apply data augmentation on the Liver Tumor Segmentation (LiTS) dataset."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import os
from absl import app
from absl import flags
from six.moves import range
import tensorflow.compat.v1 as... | {
"content_hash": "6b14232442919bbbf8db8e47971456c1",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 79,
"avg_line_length": 33.95,
"alnum_prop": 0.6774668630338734,
"repo_name": "tensorflow/mesh",
"id": "98721abd587fb9941da87dace523bd194a3f9603",
"size": "4682",
"binary... |
from dns_kit.route53dump import *
from moto import mock_route53
class TestR53Dump:
def __init__(self):
self.conn = boto.connect_route53(
aws_access_key_id="aws_access_key_id",
aws_secret_access_key="aws_secret_access_key")
self.mock = mock_route53()
def setUp(self)... | {
"content_hash": "160412083b0a65681065e5b8aa16e1d8",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 114,
"avg_line_length": 36.61290322580645,
"alnum_prop": 0.5964757709251102,
"repo_name": "Livefyre/dns-kit",
"id": "15451fdc02cb71c7e7aee9899794ec4e303c6f82",
"size": "113... |
"""
Assertions for the base classes and abstract hierarchy.
"""
##########################################################################
## Imports
##########################################################################
import unittest
from yellowbrick.base import *
try:
from unittest import mock
except Im... | {
"content_hash": "a5b3e04257ff8ffddb363cf3e79b60e1",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 74,
"avg_line_length": 25.745454545454546,
"alnum_prop": 0.4766949152542373,
"repo_name": "jkeung/yellowbrick",
"id": "fe948c74bf2f0d8fee21d6e693c861f563cc637e",
"size": "1... |
"""Wrapper for tc."""
import json
from neutron.agent.linux import utils as linux_utils
from neutron.common import utils
from neutron.services.qos.common import htb
utils.synchronized('tc', external=True)
class TcManager(object):
"""Wrapper for tc."""
@staticmethod
def get_hosting_qos(namespace, root_h... | {
"content_hash": "13bb8d2049d0c22c72484909a4a6e195",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 78,
"avg_line_length": 39.869198312236286,
"alnum_prop": 0.5412212932585458,
"repo_name": "huntxu/neutron-qos",
"id": "d9ef83d3a25406b78b7625fffad7fc86c3adfc17",
"size": "... |
"""
@package mi.dataset.driver.camhd_a
@file mi-dataset/mi/dataset/driver/camhd_a/camhd_a_telemetered_driver.py
@author Ronald Ronquillo
@brief Telemetered driver for the camhd_a instrument
Release notes:
Initial Release
"""
from mi.dataset.dataset_parser import DataSetDriverConfigKeys
from mi.dataset.dataset_driver... | {
"content_hash": "171e4bc207774fa7164c07cbc49366aa",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 109,
"avg_line_length": 33.018181818181816,
"alnum_prop": 0.7191629955947136,
"repo_name": "JeffRoy/mi-dataset",
"id": "f1dc94c3e42d62c9c8134776db8c4533b519770e",
"size": "... |
from uuid import uuid1
from myTelegramBot.Exceptions import NoUserAssignedToSession
from myTelegramBot.core.auth_manager import *
class SessionManager(object):
def __init__(self, name='Default'):
self.name = name
self.sessions = {}
def add_user_session(self, session):
assert isinstanc... | {
"content_hash": "c1962e7c5f98a9f57d854188e60f87bc",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 110,
"avg_line_length": 35.05263157894737,
"alnum_prop": 0.6336336336336337,
"repo_name": "blackms/myTelegramBot",
"id": "9f60420fad08b0298ebda6ccbe90b9b0f6e81747",
"size":... |
from heapq import merge
def merge_sort2(m):
"""Sort list, using two part merge sort"""
if len(m) <= 1:
return m
# Determine the pivot point
middle = len(m) // 2
# Split the list at the pivot
right = m[middle:]
left = m[:middle]
# Sort recursively
right = merge_sort2(right... | {
"content_hash": "8ae0ff17a3ee94f224479da6b0647322",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 51,
"avg_line_length": 23.066666666666666,
"alnum_prop": 0.6165703275529865,
"repo_name": "praqma-training/gitkatas",
"id": "9de927ab8858ad4704a4e18c6ebcc62f25c6efec",
"siz... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ShortURL',
fields=[
('id', models.AutoField(auto_cr... | {
"content_hash": "8a2137e0c82d1555879a76242bdb8749",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 114,
"avg_line_length": 25.818181818181817,
"alnum_prop": 0.5757042253521126,
"repo_name": "shakib609/django-url-shortener",
"id": "93f374a9bf00cdcebd4140387fa4b90407573437",... |
"""Tests for Renault binary sensors."""
from unittest.mock import patch
import pytest
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_OFF
from homeassistant.core import HomeAssistant
from . im... | {
"content_hash": "9c9b4954c6c48dd4c6cd5edc79facdf7",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 85,
"avg_line_length": 35.91056910569106,
"alnum_prop": 0.7464342313787639,
"repo_name": "aronsky/home-assistant",
"id": "440018c01c2fe4f1ae7420caef4134dd2020ebba",
"size"... |
import _local_path
import txmongo
from twisted.internet import defer, reactor
@defer.inlineCallbacks
def example():
mongo = yield txmongo.MongoConnection()
foo = mongo.foo # `foo` database
test = foo.test # `test` collection
result = yield test.drop(safe=True)
print result
if __name__ == '__ma... | {
"content_hash": "24adeac89d27163a923cfc73158da063",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 53,
"avg_line_length": 23.470588235294116,
"alnum_prop": 0.6766917293233082,
"repo_name": "inspectlabs/txmongo",
"id": "892330a8ef38772848ad3292d4567654e85252f4",
"size": "... |
import asyncio
import discord
import random
from discord.ext import commands
from Cogs import Settings
class EightBall:
# Init with the bot reference, and a reference to the settings var
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True)
async def eightball(self, ctx, *, question ... | {
"content_hash": "42c6c3e0accb5f666e5a2a162afc9932",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 67,
"avg_line_length": 26.4,
"alnum_prop": 0.627104377104377,
"repo_name": "Mercurial/CorpBot.py",
"id": "674e23c70e2ce20e713531648df4e7070efd5d76",
"size": "1188",
"bina... |
import xml.etree.ElementTree as ET
from programy.parser.template.nodes.base import TemplateNode
from programy.parser.template.nodes.map import TemplateMapNode
from programy.parser.template.nodes.word import TemplateWordNode
from test.parser.template.base import TemplateTestsBaseClass
class TemplateMapNodeTests(Temp... | {
"content_hash": "d1ef2d63991177f339c01e0d1ab0829e",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 89,
"avg_line_length": 31.618181818181817,
"alnum_prop": 0.6497987349051179,
"repo_name": "dkamotsky/program-y",
"id": "3499d2ec296153c556a7ab88700a86d438498473",
"size": ... |
import seaborn as sns
import numpy as np
def gen_cmaps(num_maps, order=None, per_color=4, lpadding=4, rpadding=4):
if not order:
order = xrange(num_maps)
per_color += np.zeros(num_maps, dtype=int)
colors = sum([sns.blend_palette(['white', sns.hls_palette(num_maps, l=.65, s=1)[i], 'black'], n_colors... | {
"content_hash": "2adfad3065d4385a92d6b0d9e4cf7b81",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 153,
"avg_line_length": 51.25,
"alnum_prop": 0.6670731707317074,
"repo_name": "MarvinT/marvin-python",
"id": "e85efdb6c55661d9b47db1ffcac6a536e32ca639",
"size": "820",
"b... |
"""
numpy.ma : a package to handle missing or invalid values.
This package was initially written for numarray by Paul F. Dubois
at Lawrence Livermore National Laboratory.
In 2006, the package was completely rewritten by Pierre Gerard-Marchant
(University of Georgia) to make the MaskedArray class a subclass of ndarray,... | {
"content_hash": "942701a20a3049975b4392828af6cb22",
"timestamp": "",
"source": "github",
"line_count": 7195,
"max_line_length": 86,
"avg_line_length": 31.606810284920083,
"alnum_prop": 0.5303349442199365,
"repo_name": "dagss/numpy_svn",
"id": "de74856385e5d54093f8798a522cd4e1416cbccc",
"size": "22... |
"""Common functions for Rflink component tests and generic platform tests."""
import asyncio
from unittest.mock import Mock
from homeassistant.bootstrap import async_setup_component
from homeassistant.components.rflink import CONF_RECONNECT_INTERVAL
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF
fro... | {
"content_hash": "97884c6db1430dae5c7ca2b20afb6046",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 77,
"avg_line_length": 29.735955056179776,
"alnum_prop": 0.6134517286982808,
"repo_name": "kyvinh/home-assistant",
"id": "ad5e7f91b2f346ce0324f742d106f8d6e773bc04",
"size"... |
import binascii
import functools
import logging
import os
import re
import ssl
import threading
import time
import urllib, urllib.request, urllib.parse
from enum import Enum
from io import BytesIO
from typing import Callable, Optional, List, Dict, Tuple, Literal
import simplejson
from PyQt5 import QtGui, QtCore
from P... | {
"content_hash": "4dee38b293d9fd9f4ca090bfe9d3a007",
"timestamp": "",
"source": "github",
"line_count": 403,
"max_line_length": 118,
"avg_line_length": 47.80893300248139,
"alnum_prop": 0.6007681528001245,
"repo_name": "Bertrand256/dash-masternode-tool",
"id": "fb88d7ce9357b45cbc3634702bd3d2b12fa57e5a... |
import os, os.path, sys
import socket
if __name__ == "__main__":
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..',))
print "PROJECT_ROOT=", PROJECT_ROOT
sys.path.append(PROJECT_ROOT)
# Add virtualenv dirs to python path
host = socket.gethostname()
print "HOSTNA... | {
"content_hash": "d03e3e80b5ce1cf235c2da266c048cbd",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 87,
"avg_line_length": 30.65714285714286,
"alnum_prop": 0.6589002795899348,
"repo_name": "warnes/irrigatorpro",
"id": "9c32975b545badb9af610d982c9c8c7fd65449fa",
"size": "1... |
import pytest
def test_gene_upgrade_remove_go_annotations(
upgrader,
gene_1,
):
new_gene = upgrader.upgrade(
'gene', gene_1, current_version='1', target_version='2'
)
assert new_gene['schema_version'] == '2'
assert 'go_annotations' not in new_gene
def test_gene_upgrade_remove_go_annot... | {
"content_hash": "2e7b97cad62712f45f90232291c0b6fb",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 63,
"avg_line_length": 24.727272727272727,
"alnum_prop": 0.6323529411764706,
"repo_name": "ENCODE-DCC/encoded",
"id": "7749d43ddcc88fca24bdc68eb868c15bae29bb22",
"size": "5... |
import pickle
class CacheDb:
def __init__(self, db_file_name):
self.db_file_name = db_file_name
self.data = {}
self.load()
def load(self):
try:
self.data = pickle.load(open(self.db_file_name, 'rb'))
except IOError:
self.data = {}
def save(s... | {
"content_hash": "e500b5a1cc1833f52c4cf21cc73f69ec",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 66,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.5335820895522388,
"repo_name": "exzhawk/PixivLoader",
"id": "c043c7cb1ffeaeb4474d6f4917002738f1b279db",
"size": "... |
from flask import render_template
from simple_profile import app
from simple_profile.models import Photo
@app.route('/', methods=['GET'])
def index():
stored_photos = Photo.query.all()
return render_template('index.html', photos=stored_photos)
| {
"content_hash": "359eb890d7a613b0e47c0f098c423c3f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 62,
"avg_line_length": 28.22222222222222,
"alnum_prop": 0.7362204724409449,
"repo_name": "iBluemind/simple_profile",
"id": "2c58ab148e33029fe04b79350c52ccd17a6d56bc",
"size"... |
import pycaption
import re
import datetime
"""
extract the content between the time [mid_time - delta, mid_time + delta]
input mid_time format: HH:MM:SS
delta: minutes
"""
def extract_content(fname, mid_time, delta, m_s_switch='minute'):
base_dir = 'resources/subtitles/'
pattern = '(\d{2}:\d{2}:\d{2... | {
"content_hash": "a813ec2536c3209b0d45994d522ecd8f",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 106,
"avg_line_length": 33.35294117647059,
"alnum_prop": 0.6213991769547325,
"repo_name": "ZhuangER/youtube-subtitle-NLP",
"id": "9e1b2388519399497f0d1cd046bfee0228e0dec1",
... |
import mock
from nova.cmd import scheduler
from nova import config
from nova import test
# required because otherwise oslo early parse_args dies
@mock.patch.object(config, 'parse_args', new=lambda *args, **kwargs: None)
class TestScheduler(test.NoDBTestCase):
@mock.patch('nova.service.Service.create')
@mock... | {
"content_hash": "464ac810f59ed0d75893f9e1267101b8",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 76,
"avg_line_length": 40.87755102040816,
"alnum_prop": 0.6525212181727409,
"repo_name": "gooddata/openstack-nova",
"id": "2d5029cb82f44b12baf9612fc3572a1d1a1cac66",
"size"... |
import os
root = os.path.dirname(__file__)
icons = dict(
pw=os.path.join(root,'pw.png'),
all=os.path.join(root,'exec_all.png'),
sel=os.path.join(root,'exec_sel.png'),
clear=os.path.join(root,'clear.png'),
help=os.path.join(root,'help.png'),
donate=os.path.join(root,'donate.png'),
) | {
"content_hash": "0a31ce10a0aab7a99150cab3c62fb4fa",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 43,
"avg_line_length": 25.666666666666668,
"alnum_prop": 0.6298701298701299,
"repo_name": "cineuse/CNCGToolKit",
"id": "81decd691e1092287fa8f4befc66e8e352942cdc",
"size": "... |
"""
Created on 23/08/2010
@author: vbmendes
"""
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
MODELS = getattr(settings, 'SHORTURL_MODELS', None)
if not MODELS:
raise ImproperlyConfigured, "In order to use django-shorturl you" \
"must provide SHORTURL_MODELS set... | {
"content_hash": "5c13ae00676e1e225bcbfec4f566da5f",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 78,
"avg_line_length": 28.37037037037037,
"alnum_prop": 0.6827676240208878,
"repo_name": "vbmendes/django-meio-shorturl",
"id": "4b4d24ade68cfa80e9af7a6e558c792bbc6be860",
... |
import collections
import struct
import abc
import logging
logger = logging.getLogger(__name__)
from .utils import profile
from .inspecttools import UnreadableMemory
from functools import partial
class Structured(object):
@classmethod
def use_struct_helper(cls):
return True
_customization_dict = ... | {
"content_hash": "fe4656d1c3d385e9dd3fc2b845217349",
"timestamp": "",
"source": "github",
"line_count": 399,
"max_line_length": 159,
"avg_line_length": 31.015037593984964,
"alnum_prop": 0.596040404040404,
"repo_name": "notsorandomname/pytb",
"id": "03f723a37c27f853cf1e695b9f4f9d0c6d400f86",
"size":... |
from __future__ import unicode_literals
from django.core import validators
from django.db import models, migrations
from django.utils import timezone
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '__first__'),
]
operations = [
migrations.CreateModel(
... | {
"content_hash": "a69e8b124c7e03dbd97833d0d8b78b6f",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 277,
"avg_line_length": 59.6,
"alnum_prop": 0.5970573051109964,
"repo_name": "YYWen0o0/python-frame-django",
"id": "6fe7411e9f5938cbfe2d0fc123464369dae85b33",
"size": "3898... |
from netmiko.ssh_connection import SSHConnection
class AristaSSH(SSHConnection):
pass
| {
"content_hash": "cca649d2a8e34106b7cf736f2f4082e9",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 48,
"avg_line_length": 18.4,
"alnum_prop": 0.8043478260869565,
"repo_name": "mith1979/pynet_course",
"id": "dc6d148737c7d105d06ec5ed6cd082e25057c0db",
"size": "92",
"binar... |
"""Functions and classes for simulating a trainable ANN"""
import os
import numpy as np
import tensorflow as tf #pylint: disable = E0401
LEARNING_RATE = 0.15
EPOCHS = 100000
HIDDEN_LAYER_A_FACTOR = 1
HIDDEN_LAYER_B_FACTOR = .5
class NeuralNetwork():
"""Class representing a trainable NeuralNetwork"""
def __i... | {
"content_hash": "5e452c65b7f3a2c253a5c44792c689b4",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 93,
"avg_line_length": 48.52427184466019,
"alnum_prop": 0.6336534613845538,
"repo_name": "EoinM95/FYP",
"id": "ff789ddb7237f6a54f1f25fdffc5bd7272ab5a11",
"size": "4998",
... |
DOCUMENTATION = '''
---
module: ec2_ami_search
short_description: Retrieve AWS AMI information for a given operating system.
version_added: "1.6"
description:
- Look up the most recent AMI on AWS for a given operating system.
- Returns C(ami), C(aki), C(ari), C(serial), C(tag)
- If there is no AKI or ARI associat... | {
"content_hash": "5a7280c7bf02ca5b5c7ad3da907c5ae9",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 142,
"avg_line_length": 31.2707182320442,
"alnum_prop": 0.6044169611307421,
"repo_name": "marcusramberg/dotfiles",
"id": "1dd5f056e96e0debfb39cebcc1e12c59463bd33a",
"size"... |
import pytz
from django.test import TestCase
from datetime import datetime
from django.utils import timezone
from django.conf import settings
from django.test.client import RequestFactory
from restclients.sws.notice import get_notices_by_regid
from myuw.dao.notice_mapping import map_notice_category,\
get_open_date,... | {
"content_hash": "8808d0ce5a69bff1c3a0b8f6a7b1d44b",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 79,
"avg_line_length": 44.89820359281437,
"alnum_prop": 0.5998933048813017,
"repo_name": "fanglinfang/myuw",
"id": "d9964b9b18b9a188a6d840791ccf14a81fe6653d",
"size": "749... |
from __future__ import unicode_literals
from django.db import migrations
def set_question_condition(apps, schema_editor):
QuestionEntity = apps.get_model('questions', 'QuestionEntity')
for entity in QuestionEntity.objects.all():
try:
for condition in entity.attribute_entity.conditions.al... | {
"content_hash": "5d01d8e11528579becc1389a4460a13d",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 70,
"avg_line_length": 24.192307692307693,
"alnum_prop": 0.6613672496025437,
"repo_name": "DMPwerkzeug/DMPwerkzeug",
"id": "b00f51e55823a88d7a9d1280b47cb9a96771a8de",
"size... |
''' schedulerlocationhandler.py '''
import traceback
import tornado.gen
import tornado.web
from heron.common.src.python.utils.log import Log
from heron.tools.tracker.src.python.handlers import BaseHandler
class SchedulerLocationHandler(BaseHandler):
"""
URL - /topologies/schedulerlocation
Parameters:
- clus... | {
"content_hash": "fc96e3419bdde9a6398e4762602210a4",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 89,
"avg_line_length": 31.146341463414632,
"alnum_prop": 0.7141738449490994,
"repo_name": "billonahill/heron",
"id": "5f01bcc01e948af752576f93bf2eb5aed8638076",
"size": "18... |
import os
import re
import sys
import threading
from time import sleep
import azurelinuxagent.common.logger as logger
from azurelinuxagent.common.future import ustr
import azurelinuxagent.common.conf as conf
from azurelinuxagent.common.event import add_event, WALAEventOperation
import azurelinuxagent.common.utils.file... | {
"content_hash": "b46881e059ce1a4e7e9a79f25696dbb8",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 109,
"avg_line_length": 40.61846153846154,
"alnum_prop": 0.5504885993485342,
"repo_name": "hglkrijger/WALinuxAgent",
"id": "0f0925d7ae5ffab96a5a7866083db23588218f83",
"siz... |
from __future__ import annotations
import itertools
import logging
import os.path
from dataclasses import dataclass, field
from pathlib import PurePath
from pprint import pformat
from typing import Any, Iterable, Iterator, Sequence, cast
from pants.backend.visibility.glob import PathGlob, TargetGlob
from pants.engine... | {
"content_hash": "fa77ddb327d2199d46ac2cced98c7ef1",
"timestamp": "",
"source": "github",
"line_count": 328,
"max_line_length": 99,
"avg_line_length": 37.25914634146341,
"alnum_prop": 0.6077244088045168,
"repo_name": "pantsbuild/pants",
"id": "fffd0f6fe985ea9616d9c289169150011b6d5749",
"size": "123... |
from django.db import models
from django.db.models import Q
from django.contrib.contenttypes.models import ContentType
class PermissionManager(models.Manager):
def get_content_type(self, obj):
return ContentType.objects.get_for_model(obj)
def get_for_model(self, obj):
return self.filter(cont... | {
"content_hash": "fc2e5eaa79960bde45195171f109c358",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 79,
"avg_line_length": 34.28169014084507,
"alnum_prop": 0.5920295809367296,
"repo_name": "mythmon/kitsune",
"id": "0fd26fd1baf381d655109484da8c8bb434556d4d",
"size": "2434"... |
if window.get_active_title() == "Terminal":
keyboard.send_keys("<super>+c")
else:
keyboard.send_keys("<ctrl>+c")
| {
"content_hash": "eb64ba2170959c6d6f73a079e88caf11",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 43,
"avg_line_length": 30.25,
"alnum_prop": 0.6363636363636364,
"repo_name": "jargv/dotfiles",
"id": "18f91ddc14566e7f62f685adaf7a52645e949788",
"size": "121",
"binary": f... |
import os
import numpy as np
from glue.core import Data
from astropy.io import fits
from ..gridded_fits import fits_writer
def test_fits_writer_data(tmpdir):
filename = tmpdir.join('test').strpath
data = Data(x=np.arange(6).reshape(2, 3),
y=(np.arange(6) * 2).reshape(2, 3))
fits_write... | {
"content_hash": "e71dd677c0b8080a9b4aacf9507a3cb1",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 67,
"avg_line_length": 27.05,
"alnum_prop": 0.6182994454713494,
"repo_name": "stscieisenhamer/glue",
"id": "bb3b31e348d1b0950554a76a75c7f8796f26a77c",
"size": "1082",
"bi... |
'''
'''
from django import forms
class TransferenciaForm(forms.Form):
order = forms.CharField(widget=forms.HiddenInput) | {
"content_hash": "ec8890e97fd80b98a7b0d01816184156",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 53,
"avg_line_length": 17.857142857142858,
"alnum_prop": 0.744,
"repo_name": "jordic/django_tiny_shop",
"id": "605b946c743f6044f8aa7f842cb07f64b25a997d",
"size": "321",
"b... |
'''Routing rules for Tesla.'''
__author__ = 'José Lopes de Oliveira Jr.'
from flask import Blueprint, render_template
from app.queries import get_capture, get_summary, get_topcc
resp = Blueprint('resp', __name__, template_folder='templates')
@resp.route('/')
def index():
return render_template('index.html')... | {
"content_hash": "dd2d52ca7df69fe7b8292c231b9c5c09",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 63,
"avg_line_length": 22.322580645161292,
"alnum_prop": 0.6878612716763006,
"repo_name": "forkd/tesla",
"id": "75d564019c65828b2bd9f23a9c9c7f511156b455",
"size": "881",
... |
from django.contrib import admin
from .models import File
admin.site.register(File) | {
"content_hash": "b90d25495f7d5289bf64b3f334d4e84b",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 32,
"avg_line_length": 17,
"alnum_prop": 0.8117647058823529,
"repo_name": "goldhand/django-nufiles",
"id": "3377361eb622f8bc091ab0cfe28d90b0e30c6d97",
"size": "85",
"binar... |
"""
Support for The Things network.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/thethingsnetwork/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
CONF_ACCESS_K... | {
"content_hash": "e5bc03bcfe8117f1c332ba37db2437d2",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 75,
"avg_line_length": 24.022222222222222,
"alnum_prop": 0.6808510638297872,
"repo_name": "PetePriority/home-assistant",
"id": "61f9843be454a4e16a6a64c6f2d0519b3210fb68",
"... |
"""
SQSMessageContext tests.
"""
from hamcrest import assert_that, has_entries
from microcosm_pubsub.message import SQSMessage
from microcosm_pubsub.tests.fixtures import ExampleDaemon
MESSAGE_ID = "message_id"
MESSAGE_URI = "message_uri"
class TestSQSMessageContext:
def setup(self):
self.graph = Exa... | {
"content_hash": "446aa6b197b376e73f7b4d2732d31f16",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 88,
"avg_line_length": 30.339449541284402,
"alnum_prop": 0.5068037496220139,
"repo_name": "globality-corp/microcosm-pubsub",
"id": "ea884fc3008a99b9190e0f7e5204492b34ee33e4"... |
from django.db import models
from phonenumber_field.modelfields import PhoneNumberField
class TestModel(models.Model):
"""Basic Field Test"""
name = models.CharField(max_length=255, blank=True, default='')
phone = PhoneNumberField()
class TestModelPhoneB(models.Model):
"""Field Test for when Blank"... | {
"content_hash": "e27b159b6fdc0b508ba3151b4eb28e85",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 93,
"avg_line_length": 34.81159420289855,
"alnum_prop": 0.7031640299750208,
"repo_name": "hovel/django-phonenumber-field",
"id": "8d201192d5329bba5e63d7fa68f7fb7fc6a50eb9",
... |
import unittest
from Orange.data import Table
from Orange.statistics.util import stats
from Orange.classification import LogisticRegressionLearner
from Orange.widgets.classify.owlogisticregression import (create_coef_table,
OWLogisticRegression)
from Orange.wid... | {
"content_hash": "f4b677c9d2690255f54a016a21f708bc",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 80,
"avg_line_length": 43.310344827586206,
"alnum_prop": 0.6138535031847133,
"repo_name": "cheral/orange3",
"id": "32dc5ad4d1572a75d8d7f2054e05f14cb5db0d06",
"size": "2611"... |
"""Tests for cross_device_utils."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
from tensorflow.python.distribute import combinations
from tensorflow.python.distribute import cross_device_utils
from tensorflow.pyt... | {
"content_hash": "d7b48852a6410ae5af6f4a3a277f188d",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 77,
"avg_line_length": 38.36538461538461,
"alnum_prop": 0.637468671679198,
"repo_name": "gunan/tensorflow",
"id": "ae0f3b8fe764e8bc1ad4e3f3080c60878d95ce74",
"size": "8669... |
import torch
import numpy
import pytest
from allennlp.common.testing import AllenNlpTestCase
from allennlp.modules.seq2seq_encoders import ComposeEncoder, FeedForwardEncoder, Seq2SeqEncoder
from allennlp.modules import FeedForward
class MockSeq2SeqEncoder(Seq2SeqEncoder):
def __init__(self, input_dim: int, outp... | {
"content_hash": "99ad41eb72458aec9894d19cd09686a9",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 98,
"avg_line_length": 30.742574257425744,
"alnum_prop": 0.6012882447665057,
"repo_name": "allenai/allennlp",
"id": "87276ce218bafe448c73949ff49bbd077d9064e6",
"size": "31... |
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [("axes", "0002_auto_20151217_2044")]
operations = [
migrations.AlterField(
model_name="accessattempt",
name="failures_since_start",
field=models.PositiveIntegerField(ve... | {
"content_hash": "1def83511a6c601d62abe3d54a8a7529",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 80,
"avg_line_length": 33.58620689655172,
"alnum_prop": 0.5528747433264887,
"repo_name": "jazzband/django-axes",
"id": "18e39411abcde1a7d2eae378c8aa41f1cc755e0f",
"size": "... |
"""
This module contains the classes ResourceStorer and CollectionStorer for accessing WebDAV resources.
"""
from __future__ import absolute_import
from pyomni.webdav.davlib import XML_CONTENT_TYPE
from urlparse import urlsplit
import re
import types
from pyomni.webdav import Constants
from pyomni.w... | {
"content_hash": "3fcc757a52e8c08a4075d765f5a220b9",
"timestamp": "",
"source": "github",
"line_count": 884,
"max_line_length": 128,
"avg_line_length": 41.50339366515837,
"alnum_prop": 0.602714710131102,
"repo_name": "taxpon/pyomni",
"id": "2f55d5959832e4e060cf88f9e4d1f8f812f25fc6",
"size": "37364"... |
'''
sbclearn (c) University of Manchester 2017
sbclearn is licensed under the MIT License.
To view a copy of this license, visit <http://opensource.org/licenses/MIT/>.
@author: neilswainston
'''
# pylint: disable=invalid-name
# pylint: disable=wrong-import-order
import os
from synbiochem.utils import xl_converter
... | {
"content_hash": "d3c3830146cba88cdbf592f40cbd60dc",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 77,
"avg_line_length": 27.032258064516128,
"alnum_prop": 0.6264916467780429,
"repo_name": "synbiochem/synbiochem-learn",
"id": "01b4023582f7e9191339e7bee4f7391b0bdd531c",
"... |
import pytest
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support.events import EventFiringWebDriver, AbstractEventListener
class MyListener... | {
"content_hash": "c64cb717533e466795f5ce8b442e44e9",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 92,
"avg_line_length": 33.38775510204081,
"alnum_prop": 0.6735941320293398,
"repo_name": "madm0nkey/selenium-training",
"id": "6071c81a380017732b2389cc99123d7737932f41",
"s... |
import copy
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils
from six import iteritems
from toscaparser import tosca_template
from toscaparser.utils import yamlparser
from translator.hot import tosca_translator
import yaml
from tacker.common import log
from tack... | {
"content_hash": "205c4f47e9454a24bb60e57cccea9744",
"timestamp": "",
"source": "github",
"line_count": 517,
"max_line_length": 79,
"avg_line_length": 40.94003868471954,
"alnum_prop": 0.559293206085231,
"repo_name": "zeinsteinz/tacker",
"id": "29e7f2a771c21d750e1b37cad22c2f063d3d92ac",
"size": "217... |
'''
Created on 2013-3-8
@author: Administrator
'''
from scrapy import log
from scrapy.exceptions import DropItem
from scrapy.http.request import Request
from scrapy.lottery.lotterycfg import host, user, passwd, db, smtppass
from scrapy.lottery.permutation3.item import Permutation3Item
from scrapy.lottery.permutationvo... | {
"content_hash": "2fc35b0653e19b7eb90c602081422f21",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 117,
"avg_line_length": 35.15217391304348,
"alnum_prop": 0.5479282622139765,
"repo_name": "535521469/crawler_sth",
"id": "0ea05110034137ab5203ab94d1a43a2b37afaeb0",
"size":... |
from abc import abstractmethod, ABC, abstractproperty
from typing import List
from helpers import short_to_bytes, Numbers, bytes_to_short
class MemoryOwnerMixin(ABC):
# TODO check we have correct amount of memory
@abstractproperty
@property
def memory_start_location(self) -> int:
"""
... | {
"content_hash": "1682a1a9f6b69f36d982c62c09a23e06",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 80,
"avg_line_length": 31.28301886792453,
"alnum_prop": 0.5916767189384801,
"repo_name": "PyAndy/Py3NES",
"id": "23d26dea63e44189166618db4c654fa7bb49da22",
"size": "1658",
... |
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from django.views import defaults as default_views
urlpatterns = [
url(r'^$',... | {
"content_hash": "b4a7e4e0ff36ac023eee57d3b0d88df9",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 91,
"avg_line_length": 36.911764705882355,
"alnum_prop": 0.6940239043824701,
"repo_name": "pkom/gestionies",
"id": "f2cc512a0176848fe8712ed6e861988758a7a577",
"size": "1279... |
import unittest
from sqlNice import sqlnice
from sqlNice.tablenice import TableNice
from tests.test_lib.generate_tables import *
from sqlNice.functions import *
class TestFunctions(unittest.TestCase):
def test_sum(self):
db_name = 'first_db.db'
table_list = ['TABLE_1', 'TABLE_2']
build_d... | {
"content_hash": "509af77e6a776d364c1ffd9f07316725",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 83,
"avg_line_length": 30.43548387096774,
"alnum_prop": 0.6009538950715422,
"repo_name": "TRBaldim/sqlNice",
"id": "5c3dfdacead73efe55e4d7596c73b5b504bb74a1",
"size": "1887... |
from flask import Flask, jsonify
from werkzeug.exceptions import default_exceptions
from werkzeug.exceptions import HTTPException
__all__ = ['make_json_app']
def make_json_app(import_name, **kwargs):
"""
Creates a JSON-oriented Flask app.
All error responses that you don't specifically
manage yourself will have ... | {
"content_hash": "d5066de8f39b19087aa1be751d3de050",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 57,
"avg_line_length": 26.75862068965517,
"alnum_prop": 0.7242268041237113,
"repo_name": "eakron/canieatit",
"id": "d7da1458b3e3cc9885e255c7ab635294520e560b",
"size": "776"... |
from bs4 import BeautifulSoup
import os
import requests
import settings
import time
localPath = os.path.dirname( os.path.realpath( __file__ ) )
cmdLinePlaySoundCommand = "afplay -t " + settings.songTimeOutInSeconds
lastID = ""
#lastID = "38234" #Uncomment to play default song at startup
def playThemeSong(latestEntran... | {
"content_hash": "e2a1118f69c605223aafe29e9708b39e",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 142,
"avg_line_length": 35.357142857142854,
"alnum_prop": 0.7014141414141414,
"repo_name": "code128/entrance-music",
"id": "4d5c0c7e9252546a94e7db236522cf47f5041d28",
"size... |
from datetime import datetime, timedelta
import numpy as np
class fakeProfile:
'''
generate a fake simplified profile in order to test
implementations of qc-tests.
'''
def __init__(self, temperatures, depths, latitude=None, longitude=None, date=[1999, 12, 31, 0], probe_type=None, salinities=None,... | {
"content_hash": "d08d84e5a4946e9c006a1fd0a352e42a",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 187,
"avg_line_length": 33.67460317460318,
"alnum_prop": 0.5955691727551261,
"repo_name": "castelao/AutoQC",
"id": "85f92890251acfc3350275d3edb847b05bb23784",
"size": "424... |
from future import standard_library
from os.path import join, dirname, abspath
from qiita_core.exceptions import MissingConfigSection
from qiita_core.qiita_settings import qiita_config
with standard_library.hooks():
from configparser import ConfigParser
class PortalStyleManager(object):
"""Holds the portal ... | {
"content_hash": "44f3b750da317422e6d32b53c7ff967a",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 72,
"avg_line_length": 32.9375,
"alnum_prop": 0.6148007590132827,
"repo_name": "squirrelo/qiita",
"id": "6eb949c41bce332854281b90b813fe6ea8c45c9e",
"size": "2985",
"binar... |
import datetime
import uuid
from oslo_config import cfg
import webob
from nova.api.openstack.compute import plugins
from nova.api.openstack.compute.plugins.v3 import block_device_mapping as \
block_device_mapping_v21
from nova.api.openstack.compute.plugins.v3 import multiple_create as \
multiple_create_v21
fr... | {
"content_hash": "2bed8067eaea0c9de8c00430887351f0",
"timestamp": "",
"source": "github",
"line_count": 575,
"max_line_length": 79,
"avg_line_length": 38.67304347826087,
"alnum_prop": 0.5537167783424023,
"repo_name": "sajeeshcs/nested_quota_final",
"id": "eccac74eec57332eaeef212ea0e9313e2d23b60e",
... |
"""
byceps.services.shop.order.action_registry_service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2014-2022 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from ...ticketing.transfer.models import TicketCategoryID
from ...user_badge.transfer.models import BadgeID
f... | {
"content_hash": "d1fd5c433f5091642e3e101e2a30fad0",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 74,
"avg_line_length": 29.151898734177216,
"alnum_prop": 0.6695614415979158,
"repo_name": "homeworkprod/byceps",
"id": "be593144536e9e2df82dbb0741236c56ad5efe3e",
"size": "... |
'''
The Salt loader is the core to Salt's plugin system, the loader scans
directories for python loadable code and organizes the code into the
plugin interfaces used by Salt.
'''
# Import python libs
from __future__ import absolute_import
import os
import imp
import sys
import salt
import time
import yaml
import loggi... | {
"content_hash": "bfd811cf6bf074f8e61c333c47fe1a42",
"timestamp": "",
"source": "github",
"line_count": 2047,
"max_line_length": 131,
"avg_line_length": 34.72496336101612,
"alnum_prop": 0.5231000815959034,
"repo_name": "hubblestack/hubble-salt",
"id": "47f8c37fd0dde4ab23d93fbf1e3e5baf6ebb1485",
"si... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.