text stringlengths 4 1.02M | meta dict |
|---|---|
import os.path
import pytest
from pre_commit_hooks.detect_private_key import detect_private_key
# Input, expected return value
TESTS = (
(b'-----BEGIN RSA PRIVATE KEY-----', 1),
(b'-----BEGIN DSA PRIVATE KEY-----', 1),
(b'-----BEGIN EC PRIVATE KEY-----', 1),
(b'ssh-rsa DATA', 0),
(b'ssh-dsa DATA'... | {
"content_hash": "4a5c79ced6064dff89b8e8983f002b41",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 66,
"avg_line_length": 27,
"alnum_prop": 0.6253561253561254,
"repo_name": "bgschiller/pre-commit-hooks",
"id": "d9764724f05d7e1bf46c5325bea9acf9e3c25255",
"size": "702",
... |
from Foundation import *
from PyObjCTools.TestSupport import *
class TestNSGarbageCollector (TestCase):
def testMethods(self):
self.assertResultIsBOOL(NSGarbageCollector.isCollecting)
self.assertResultIsBOOL(NSGarbageCollector.isEnabled)
if __name__ == "__main__":
main()
| {
"content_hash": "ba0c194068d358cd2aabbf3ee82aa20d",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 64,
"avg_line_length": 27.181818181818183,
"alnum_prop": 0.7357859531772575,
"repo_name": "Khan/pyobjc-framework-Cocoa",
"id": "aaf83ec8130a835fa5e4d2b5ac52b5b54a53c2fc",
"... |
from msrest.serialization import Model
class RegistryPassword(Model):
"""The login password for the container registry.
:param name: The password name. Possible values include: 'password',
'password2'
:type name: str or :class:`PasswordName
<azure.mgmt.containerregistry.v2017_03_01.models.Passw... | {
"content_hash": "040e20684ca6fd158ae4a22e7b3775d4",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 72,
"avg_line_length": 28.818181818181817,
"alnum_prop": 0.6230283911671924,
"repo_name": "v-iam/azure-sdk-for-python",
"id": "9835295c95956efc278a562623bbdc5f35e1cca0",
"s... |
from PyQt5 import QtWidgets, QtCore
from ui.mainwindow import MainWindow
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
translator = QtCore.QTranslator()
# get system locale
systemLocale = QtCore.QLocale.system().name()
translationFile = "i18n/{}".format(systemLo... | {
"content_hash": "cfa8286231db6d1566455965eca86163",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 52,
"avg_line_length": 28.68421052631579,
"alnum_prop": 0.691743119266055,
"repo_name": "Athemis/PyDSF",
"id": "10bb3b73d2d5c1da7f8b5895fd928389192c8d33",
"size": "593",
... |
from posts import views
from django.urls import path
urls = [
path(r'add/', views.PostFormView.as_view(), name="add_post"),
path(r'<slug:slug>/', views.post_detail, name='post_detail')
]
| {
"content_hash": "1899d544b44474713ae22e2547cf009a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 65,
"avg_line_length": 28,
"alnum_prop": 0.673469387755102,
"repo_name": "robotgear/robotgear",
"id": "86170bb4fb17a2b781fb8e3541072213711633c9",
"size": "196",
"binary": ... |
from behave_core.resource import *
from behave import step
## Collector for internal path.
@step('I collect data at path "{path}"')
def step_get_data_path(context, path):
full_url = context.target + path
get_and_process(context, full_url, {})
## Collector for remote resource.
@step('I collect data at URL "{ur... | {
"content_hash": "c7c0096d49a4953f3a0e8df95e1e078f",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 48,
"avg_line_length": 31.413793103448278,
"alnum_prop": 0.6652030735455543,
"repo_name": "berkeleybop/behave_core",
"id": "7068faf6701aea4ee7ffd2f364135a6f73f9605e",
"size... |
from twisted.internet import reactor, defer
from scrapy.crawler import CrawlerRunner
from scrapy.utils.log import configure_logging
from scrapy.utils.project import get_project_settings
from scrapy_example.spiders.new_crawling import MySpider
from scrapy_example.spiders.new_spider import NewSpider
from scrapy_example.s... | {
"content_hash": "a49023e5cff60f26cae53fc369a5542f",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 60,
"avg_line_length": 29.142857142857142,
"alnum_prop": 0.8055555555555556,
"repo_name": "xdlabs/crawling-tutorials",
"id": "f4fd91b6926f38311a3c71fe04f359c70bbfd286",
"si... |
import pytest
max_test_cases = 100
# The following generates up to max_test_case tests
@pytest.mark.parametrize('count', range(max_test_cases))
def test_case(count): pass
| {
"content_hash": "61bcb5fd7f97c6247e208f3cba32ae74",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 56,
"avg_line_length": 24.714285714285715,
"alnum_prop": 0.7572254335260116,
"repo_name": "s2technologies/testspace.test.ci",
"id": "305f0b68b70b7dd9feda874fa36e2b3ba6cd46ae",... |
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 2.0.21
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class UpdatePaymentRequest(object):
"""
NOTE: This class is auto generat... | {
"content_hash": "76d141c8542d2dd7f669c278d3593fa2",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 77,
"avg_line_length": 24.76865671641791,
"alnum_prop": 0.5094908104850858,
"repo_name": "kinow-io/kinow-python-sdk",
"id": "c62a45838be7d033bda958c5558b6e4f28116a12",
"si... |
__author__ = 'lisette-espin'
################################################################################
### Local
################################################################################
from org.gesis.libs import graph as c
from org.gesis.libs.janus import JANUS
from org.gesis.libs.graph import DataMatr... | {
"content_hash": "210121525705cf0022a5d7c71f6b19b2",
"timestamp": "",
"source": "github",
"line_count": 447,
"max_line_length": 199,
"avg_line_length": 35.05145413870246,
"alnum_prop": 0.5345928006127139,
"repo_name": "lisette-espin/JANUS",
"id": "44e7b6fe0e30800e2c45afd6cd75a232d9c29b2a",
"size": ... |
from BitBoard import *
import time
from collections import deque
alpha = float('inf')
beta = float('-inf')
class MoveTree(object):
"""base to create a movement tree"""
def __init__(self, bitboard, move=None, isMin=False, depth=0):
if move != None:
self.move = move
self.isMin = isMin
self.bitboard = bitboar... | {
"content_hash": "228ae09fb147313e4b1c9b82e52c64f4",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 70,
"avg_line_length": 24.1953125,
"alnum_prop": 0.6667742977074589,
"repo_name": "fabchiffre/Bob",
"id": "fa72827fd206f38487d22ecf2b27830bdc456c3c",
"size": "3097",
"bi... |
from xi_plugin import start_plugin, Plugin, edit
MATCHES = {"{": "}", "[": "]", "(": ")"}
class BracketCloser(Plugin):
"""Naively closes opened brackets, parens, & braces."""
def update(self, view, author, rev, start, end,
new_len, edit_type, text=None):
resp = 0
close_char = ... | {
"content_hash": "4a8e63d9cb07f369d9ed4fd38b4993eb",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 85,
"avg_line_length": 31.93103448275862,
"alnum_prop": 0.5658747300215983,
"repo_name": "modelorganism/xi-editor",
"id": "1a78b0f23b2e737da2a5e940dc32cb0c69bb0d5a",
"size"... |
import allure
import pytest
from hamcrest import assert_that
from allure_commons_test.report import has_test_case
from allure_commons_test.result import with_status
@allure.issue("140")
@allure.feature("Integration")
@pytest.mark.parametrize("countdown", [2, 4])
def test_pytest_rerunfailures(allured_testdir, countdow... | {
"content_hash": "7e52ca8ae8bd82eb424987f73780922a",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 84,
"avg_line_length": 32.38709677419355,
"alnum_prop": 0.6563745019920318,
"repo_name": "allure-framework/allure-python",
"id": "d6be7db1f390a51fdd57938002341d9dd7c0d584",
... |
import re
import struct
from typing import Dict, List, Callable, Sequence, Tuple, Type, Union, Optional
import logging
from mrcrowbar.common import BytesReadType
from typing_extensions import Literal
logger = logging.getLogger( __name__ )
NumberType = Union[Type[int], Type[float]]
Number = Union[int, float]
Signe... | {
"content_hash": "759ab7865616d039c9cdc631b59eab3a",
"timestamp": "",
"source": "github",
"line_count": 521,
"max_line_length": 130,
"avg_line_length": 31.464491362763916,
"alnum_prop": 0.5553589946928567,
"repo_name": "moralrecordings/mrcrowbar",
"id": "c86f7784bc22aa743dad04fa6a2f6799916bf14a",
"... |
from urllib.parse import urlencode
from urllib.request import urlopen
from django.apps import apps as django_apps
from django.conf import settings
from django.core import paginator
from django.core.exceptions import ImproperlyConfigured
from django.urls import NoReverseMatch, reverse
from django.utils import translati... | {
"content_hash": "95863102f9f67cb9a1824b604828ecc3",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 113,
"avg_line_length": 35.62672811059908,
"alnum_prop": 0.5881515974647523,
"repo_name": "elena/django",
"id": "b13507a11ede2f4566e63d9ba2992d04e6f6cf9d",
"size": "7731",... |
import os.path
TESTDATA_ROOT = os.path.abspath(os.path.dirname(__file__))
TESTFILE_PATH = os.path.join(TESTDATA_ROOT, 'example.data')
TESTIMAGE_PATH = os.path.join(TESTDATA_ROOT, 'example.jpeg')
| {
"content_hash": "99073cd9bfff6e2c58d329616bc8eb0a",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 60,
"avg_line_length": 39.2,
"alnum_prop": 0.7397959183673469,
"repo_name": "FactoryBoy/factory_boy",
"id": "b0de791a903a347c0b849d3a946a495894ebd037",
"size": "233",
"bin... |
"""
Make a big data store and see what we learn
from playing with it.
"""
import os
import py.test
import tiddlyweb.stores.text
from tiddlyweb.store import NoBagError
from tiddlyweb.serializer import Serializer
from tiddlyweb.model.bag import Bag
from tiddlyweb.model.tiddler import Tiddler
from tiddlyweb.model.recip... | {
"content_hash": "4ef9212677f36f4ff5fd0a5f2cebbe78",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 92,
"avg_line_length": 26.195121951219512,
"alnum_prop": 0.6717877094972067,
"repo_name": "funkyeah/tiddlyweb",
"id": "94d78531bb7351b78f6d9e56a5187b7f24cf24fd",
"size": "2... |
#!/usr/bin/python
#
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
"""
Responsible for generating the testing decoders based on
parsed table representations.
"""
# This file generates testing ... | {
"content_hash": "0a3d9bef14029a45b6d0cde3a737ac70",
"timestamp": "",
"source": "github",
"line_count": 1147,
"max_line_length": 81,
"avg_line_length": 35.08805579773322,
"alnum_prop": 0.6947025791382995,
"repo_name": "nacl-webkit/native_client",
"id": "0a9015701ea8eccd074845ae0801846bbf889e5f",
"s... |
import pytest
from pandas import DataFrame
from bio_hansel.const import SCHEME_FASTAS
from bio_hansel.qc.const import QC
from bio_hansel.subtype import Subtype
from bio_hansel.subtyper import subtype_contigs
from . import check_subtype_attrs, check_df_fasta_cols
genome_name = 'test'
scheme_heidelberg = 'heidelberg'
s... | {
"content_hash": "b68624e3dbd1b316c9bbe0b8199d8b76",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 103,
"avg_line_length": 43.07258064516129,
"alnum_prop": 0.617112900205954,
"repo_name": "phac-nml/bio_hansel",
"id": "bc09262044f2839dd3fff4bf5f78aa744e4ccc63",
"size": "... |
from google.cloud import notebooks_v1
async def sample_get_execution():
# Create a client
client = notebooks_v1.NotebookServiceAsyncClient()
# Initialize request argument(s)
request = notebooks_v1.GetExecutionRequest(
name="name_value",
)
# Make the request
response = await clien... | {
"content_hash": "fb88ca833efd11e6929c4ea3743caf33",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 65,
"avg_line_length": 24.57894736842105,
"alnum_prop": 0.715203426124197,
"repo_name": "googleapis/python-notebooks",
"id": "370609582297d99ed01cac5b8752f0614e4aeeb6",
"si... |
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import patterns, url
from django.contrib.auth.views import logout
from .views import login, UserCRUDL
logout_url = getattr(settings, 'LOGOUT_REDIRECT_URL', None)
urlpatterns = patterns('',
url(r'^login/$', login, dict(... | {
"content_hash": "302b7dad2a9f591af797454707e776d8",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 118,
"avg_line_length": 37.06666666666667,
"alnum_prop": 0.7248201438848921,
"repo_name": "caktus/smartmin",
"id": "4a1fdab01e016a07fe2f1861152f58a3df4b589f",
"size": "556"... |
from __future__ import absolute_import
from etsdevtools.developer.tools.envisage_browser.plugin_definition_adapter import *
| {
"content_hash": "87cefc3adc071aab2926a3c363801dac",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 84,
"avg_line_length": 62,
"alnum_prop": 0.8306451612903226,
"repo_name": "enthought/etsproxy",
"id": "5ce21ab48781dd90836762c83037f52fa3cfe441",
"size": "139",
"binary": ... |
"""Common settings and globals."""
from os.path import abspath, basename, dirname, join, normpath
from sys import path
########## PATH CONFIGURATION
# Absolute filesystem path to the Django project directory:
DJANGO_ROOT = dirname(dirname(abspath(__file__)))
# Absolute filesystem path to the top-level project fold... | {
"content_hash": "005f0b05e6627e9f9cca338e699950f1",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 100,
"avg_line_length": 29.724409448818896,
"alnum_prop": 0.683841059602649,
"repo_name": "haku86/icecream",
"id": "6b12173578727371f8268369580ac653172cfb4d",
"size": "755... |
import torch
import torch.nn as nn
import torchvision.datasets as dsets
import torchvision.transforms as transforms
from torch.autograd import Variable
from modules import IndRNN
torch.manual_seed(1111)
# Hyper Parameters
sequence_length = 28
input_size = 28
hidden_size = 128
num_layers = 2
num_classes = 10
batch_... | {
"content_hash": "9e4a951bb52618f5a7a0c6d3f7768031",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 109,
"avg_line_length": 32.34653465346535,
"alnum_prop": 0.5876951331496786,
"repo_name": "DingKe/pytorch_workplace",
"id": "b739114763a7274ab6d43163d188ef58f4bea829",
"si... |
from __future__ import absolute_import
import logging
_BASE = __name__.split(".", 1)[0]
# Add a BLATHER level, this matches the multiprocessing utils.py module (and
# kazoo and others) that declares a similar level, this level is for
# information that is even lower level than regular DEBUG and gives out so
# much r... | {
"content_hash": "768d57a02bc5173b5f9c988292b9aa6f",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 79,
"avg_line_length": 31.487179487179485,
"alnum_prop": 0.7133550488599348,
"repo_name": "pombredanne/taskflow-1",
"id": "823f8b0cac1e6b55e6edb9d008ce2a125ced0025",
"size"... |
import os, sys
from jadsh.prompt import Prompt
import jadsh.constants as constants
class Screen:
def __init__(self, stdin = sys.stdin, stdout = sys.stdout, stderr = sys.stderr):
self.stdin = stdin
self.stdout = stdout
self.stderr = stderr
self.screen = ""
self.cursor = 0
self.terminal_length = 0
self... | {
"content_hash": "1a21708423930f06dcd50de28ec516f6",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 81,
"avg_line_length": 23.394160583941606,
"alnum_prop": 0.656786271450858,
"repo_name": "BoringCode/jadsh",
"id": "e57f75d3f22a57d8704ffd36042a94b98842afb4",
"size": "320... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from thrift.protocol import fastproto, TBinaryProtocol, TCompactProtocol
from thrift.transport import TTransport
import timeit
import gc
from multiprocessing import Proc... | {
"content_hash": "f498f561943ae5e106bdc793a4e3fb52",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 75,
"avg_line_length": 29.596385542168676,
"alnum_prop": 0.6163240382658254,
"repo_name": "getyourguide/fbthrift",
"id": "e7ce69d5346a52736cf65468dd0ac9d3e26ccda4",
"size"... |
from datetime import datetime, timedelta
from django.test import TestCase
from django.conf import settings
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User,Group,Permission
from django.contrib.contenttypes.models import ContentType
import unittest
from annotatetext.models import ... | {
"content_hash": "93063889d84847cd63831ed624bb2475",
"timestamp": "",
"source": "github",
"line_count": 433,
"max_line_length": 128,
"avg_line_length": 50.43418013856813,
"alnum_prop": 0.5397930213389505,
"repo_name": "habeanf/Open-Knesset",
"id": "a8917e219a3259c4813df0bad04693336244bd48",
"size":... |
"""
Spanakopita markup tool. The markup is loosely based on a combination of
http://txt2tags.sf.net with Python's concept of significant whitespace.
Blank lines and indentation are significant. More indentation than the previous
line will cause block indentation. In a list, indentation creates sublists. I
strongly su... | {
"content_hash": "df46b50d0aa9c3e224c111286bd21114",
"timestamp": "",
"source": "github",
"line_count": 826,
"max_line_length": 90,
"avg_line_length": 29.9636803874092,
"alnum_prop": 0.5258181818181819,
"repo_name": "nikomatsakis/SpanakopitaPlugin",
"id": "f4052bd7999152984ffb8c4b4838d2ac79d21930",
... |
from random import randint
from .ValueFuzz import StringFuzzer, IntegerFuzzer, FuzzableInteger
################################################################################
# Classes
################################################################################
class XmlFuzzableAttribute(object):
"""
Xml... | {
"content_hash": "b64caa88475cc2ae9d2b852b13d72a97",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 97,
"avg_line_length": 37.964071856287426,
"alnum_prop": 0.5403785488958991,
"repo_name": "blackberry/ALF",
"id": "f97d4664d4b23a64c943a24bb0ead7ef583a3378",
"size": "7162... |
from frappe.model.document import Document
class DocTypeLayoutField(Document):
pass
| {
"content_hash": "b64ef1034f4ff02d4f0c4cbee528d968",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 42,
"avg_line_length": 21.5,
"alnum_prop": 0.8372093023255814,
"repo_name": "mhbu50/frappe",
"id": "3f8487b6593bc32922ea2a749ae413a6e27ea4d5",
"size": "214",
"binary": fal... |
"""Config flow for the MELCloud platform."""
import asyncio
import logging
from typing import Optional
from aiohttp import ClientError, ClientResponseError
from async_timeout import timeout
import pymelcloud
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_PASSWOR... | {
"content_hash": "de39fc2c1d95bcb8185dd819e6522966",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 88,
"avg_line_length": 35.69047619047619,
"alnum_prop": 0.6020680453635757,
"repo_name": "titilambert/home-assistant",
"id": "ed6fc31c41482dbcf6cf7bce78cc4ef2912bfc6f",
"si... |
"""Check the generated site."""
from collections import defaultdict
import os
import re
import sys
import time
import logbook
try:
from urllib import unquote
from urlparse import urlparse, urljoin, urldefrag
except ImportError:
from urllib.parse import unquote, urlparse, urljoin, urldefrag # NOQA
from do... | {
"content_hash": "0d032fde52d6f7bad964a23717682667",
"timestamp": "",
"source": "github",
"line_count": 413,
"max_line_length": 188,
"avg_line_length": 45.55690072639225,
"alnum_prop": 0.539622641509434,
"repo_name": "xuhdev/nikola",
"id": "dfb5820d563f7c6a9d488afca3cb39b76b4ca56f",
"size": "19961"... |
import os
from flake8.api.legacy import StyleGuide
from flake8.main.application import Application
def test_flake8_conformance():
"""Test source code for flake8 conformance."""
argv = [
'--ignore=%s' % ','.join([
'D100', 'D101', 'D102', 'D103', 'D104', 'D105',
'E501']),
... | {
"content_hash": "63fd3fca38e5903c837631dbc71d21b1",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 61,
"avg_line_length": 30.571428571428573,
"alnum_prop": 0.6370716510903427,
"repo_name": "ruffsl/ros_buildfarm",
"id": "734de29fc24b9080b32989dbaa851a6bc44f1e81",
"size": ... |
from .. import Provider as SsnProvider
def checksum(digits):
"""
Calculate and return control digit for given list of digits based on
ISO7064, MOD 11,10 standard.
"""
remainder = 10
for digit in digits:
remainder = (remainder + digit) % 10
if remainder == 0:
remaind... | {
"content_hash": "04bbf370b569c9868dc915459d73154b",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 79,
"avg_line_length": 28.775510204081634,
"alnum_prop": 0.6404255319148936,
"repo_name": "danhuss/faker",
"id": "0ccc057693457456369b377a9dc7ceaa4f311922",
"size": "1410",... |
"""
Mulled Tests
"""
import subprocess as sp
import tempfile
import tarfile
import os
import shlex
from shutil import which
import logging
from . import utils
import conda_build.api
from conda_build.metadata import MetaData
logger = logging.getLogger(__name__)
# TODO: Make this configurable in bioconda_utils.build... | {
"content_hash": "c209a9379386ad37df5549467374ac99",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 96,
"avg_line_length": 29.150837988826815,
"alnum_prop": 0.6165197393637409,
"repo_name": "bioconda/bioconda-utils",
"id": "47736c8f7eefdccb9dfb9abca9b9dba0bd0df6b2",
"siz... |
import iso8601
import mox
from oslo.config import cfg
from nova.compute import claims
from nova.compute import task_states
from nova.compute import vm_states
from nova import db
from nova.objects import instance as instance_obj
from nova.openstack.common import jsonutils
from nova.openstack.common import timeutils
fro... | {
"content_hash": "b98bcdd7c1ade341f8b494ad87d03581",
"timestamp": "",
"source": "github",
"line_count": 406,
"max_line_length": 78,
"avg_line_length": 46.63793103448276,
"alnum_prop": 0.5979403221547399,
"repo_name": "leilihh/nova",
"id": "0f4cb7c2152a028281388f6c377165158dc87559",
"size": "19508",... |
from base import DatadogBaseAction
from datadog import api
class DatadogScheduleMonitorDowntime(DatadogBaseAction):
def _run(self, **kwargs):
return api.Downtime.create(**kwargs)
| {
"content_hash": "160d823163445db4296beeef646cc19a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 56,
"avg_line_length": 27.571428571428573,
"alnum_prop": 0.7668393782383419,
"repo_name": "tonybaloney/st2contrib",
"id": "f7ca87937f0f8de268ce3f9cd9d9575399e7c763",
"size":... |
import logging
try:
import cmandelbrot
CMANDELBROT = True
except ImportError:
CMANDELBROT = False
logging.warning("cmandelbrot not present, using python implementation.")
ITERATIONS = 300
class Mandelbrot(object):
def __init__(self, width, height, min_r=-2.0, max_r=1.0, min_i=-1.5,
... | {
"content_hash": "4b0733b1043a8851f05950397cc7fecb",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 76,
"avg_line_length": 30.441860465116278,
"alnum_prop": 0.5714285714285714,
"repo_name": "Gagaro/pyfractal",
"id": "402dee23e8dc66e8b61530eafcbee401d5944b22",
"size": "130... |
import datetime
import logging
from rest_framework import status
from rest_framework.authentication import BaseAuthentication
from rest_framework.exceptions import APIException
import seaserv
from seahub.base.accounts import User
from seahub.constants import GUEST_USER
from seahub.api2.models import Token, TokenV2
fro... | {
"content_hash": "92e56bb7514313a2ae0747d42b0b8609",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 95,
"avg_line_length": 34.00694444444444,
"alnum_prop": 0.6248723708392894,
"repo_name": "saukrIppl/seahub",
"id": "f72aff11df732c260aca806b126e282388a93204",
"size": "489... |
"""Platform for light integration."""
from __future__ import annotations
from typing import Any
from devolo_home_control_api.devices.zwave import Zwave
from devolo_home_control_api.homecontrol import HomeControl
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
SUPPORT_BRIGHTNESS,
LightEntity... | {
"content_hash": "1c81456e441a623f31c6b26db7067c21",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 110,
"avg_line_length": 36.5,
"alnum_prop": 0.6264840182648402,
"repo_name": "FreekingDean/home-assistant",
"id": "28da95c8902d0d0fbf9e90f601f70258c4c62a4a",
"size": "3285"... |
import re
import json
import math
import operator
from TrainParser import *
class Naive_Bayes_Category_Classifier:
def __init__(self,TRAINING_PATH,TEST_PATH,OUTPUT_PATH):
PREDICTION_OUTPUT_PATH = OUTPUT_PATH+"prediction.txt"
## Files
test_doc = open(TEST_PATH)
train_doc = open(TRAIN... | {
"content_hash": "04136f8931ecffd7cb549ff81833c18c",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 112,
"avg_line_length": 33.39423076923077,
"alnum_prop": 0.5067664843075151,
"repo_name": "luckyleap/NLP_Projects",
"id": "7bd07a3cc2810c2e2f9634972fa3e00d931d0ac7",
"size... |
from __future__ import unicode_literals, print_function
import pytest
from gcdt_testtools.helpers_aws import check_preconditions, check_normal_mode
from gcdt_testtools.helpers_aws import awsclient # fixtures!
from gcdt_lookups.lookups import _acm_lookup, _resolve_lookups
@pytest.mark.aws
@check_preconditions
def t... | {
"content_hash": "0dd0b31038f3fe84be15b1c41c62aae7",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 81,
"avg_line_length": 29.3875,
"alnum_prop": 0.6699276903445343,
"repo_name": "glomex/gcdt-lookups",
"id": "4d330b9c991d55cba4494a9b6b18a0f4b850dd34",
"size": "2375",
"b... |
from dp_tornado.engine.controller import Controller
class SqliteController(Controller):
def get(self):
assert self.schema.tests.sqlite.fields.migrate()
self.finish('done')
| {
"content_hash": "302e6bf574ecf989077130a0dadb8600",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 56,
"avg_line_length": 27.714285714285715,
"alnum_prop": 0.7216494845360825,
"repo_name": "why2pac/dp-tornado",
"id": "6d334a0a1af69664033cbfbcc688adf1752f82c8",
"size": "22... |
"""A class to serve as proxy for the target engine for testing.
Receives documents from the oplog worker threads and indexes them
into the backend.
Please look at the Solr and ElasticSearch doc manager classes for a sample
implementation with real systems.
"""
from threading import RLock
from mongo_connector.errors... | {
"content_hash": "6817eafb54fd5b6bcfa75d33a9eed96d",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 79,
"avg_line_length": 33.45882352941177,
"alnum_prop": 0.6132208157524613,
"repo_name": "jtharpla/mongo-connector",
"id": "865ea1f601e0f9adb45466a2f7b5d25cd3f22c2a",
"siz... |
from uuid import uuid4
from traceback import format_exc
from sys import stdout
import logging
class TransactionManager:
def __init__(self):
self.transactions = []
def __begin_transaction(self, cursor):
cursor.execute('BEGIN;')
return (cursor, uuid4())
def __prepare_transaction... | {
"content_hash": "d0e9cd6447040de542f1f986982dd7df",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 70,
"avg_line_length": 28.92452830188679,
"alnum_prop": 0.6301369863013698,
"repo_name": "char-lie/software_design",
"id": "e80d2de02d2f4e73f90e3d5b985027aae0738b3f",
"size... |
from mopidy import backend, models
from mopidy.models import Ref, SearchResult
from mopidy_subidy import uri
import logging
logger = logging.getLogger(__name__)
class SubidyLibraryProvider(backend.LibraryProvider):
def __create_vdirs():
vdir_templates = [
dict(id="root", name="Subsonic"),
... | {
"content_hash": "5d3bf24ab86fd10c58ffebcb5328b3e0",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 131,
"avg_line_length": 42.11206896551724,
"alnum_prop": 0.5876151484135107,
"repo_name": "hhm0/mopidy-subidy",
"id": "ba9bcce8c2e52a20cda831fa8c6c487f3b20ea84",
"size": "... |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | {
"content_hash": "2dda8268eb2856580f7801fad5bd17c2",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 119,
"avg_line_length": 31.8,
"alnum_prop": 0.7531446540880503,
"repo_name": "alexus37/AugmentedRealityChess",
"id": "d1a995e5ef283c31c744708ef1152a2634072b78",
"size": "63... |
from django.conf.urls import url
from django.views.generic import ListView
from . import views
app_name = 'resorthub'
urlpatterns = [
url(r'^$', views.index, name = 'index'),
url(r'^resorts/$', views.resort_listing, name= 'resorts'),
url(r'^compare/$', views.compare_listing, name='compare'),
]
| {
"content_hash": "6f6eca0273311151bd546d637e61481d",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 62,
"avg_line_length": 28.09090909090909,
"alnum_prop": 0.6763754045307443,
"repo_name": "racmariano/skidom",
"id": "b8403de9cc86ab15ca987293f8ea669f3ff5ac3f",
"size": "309... |
from __future__ import unicode_literals
from django.db import models, migrations
import cms.models.pluginmodel
class Migration(migrations.Migration):
dependencies = [
('cms', '__first__'),
]
operations = [
migrations.CreateModel(
name='File',
fields=[
... | {
"content_hash": "dfac4f2f3a08cb9f050855fb309362a1",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 222,
"avg_line_length": 38.888888888888886,
"alnum_prop": 0.5742857142857143,
"repo_name": "Venturi/oldcms",
"id": "546cee3e3dc89817025f430f10e0caf4e82806c3",
"size": "1074... |
from Child import Child
from Node import Node # noqa: I201
STMT_NODES = [
# continue-stmt -> 'continue' label? ';'?
Node('ContinueStmt', kind='Stmt',
children=[
Child('ContinueKeyword', kind='ContinueToken'),
Child('Label', kind='IdentifierToken',
is_optio... | {
"content_hash": "0673b6d27dc4fbc978e4153fc8ecddaf",
"timestamp": "",
"source": "github",
"line_count": 351,
"max_line_length": 79,
"avg_line_length": 38.39316239316239,
"alnum_prop": 0.5173642030276047,
"repo_name": "lorentey/swift",
"id": "6d860abd708ade5ebf0e16364f76d226bf3b9b63",
"size": "13476... |
import unittest
from leap import is_leap_year
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.5.1
class LeapTest(unittest.TestCase):
def test_year_not_divisible_by_4(self):
self.assertIs(is_leap_year(2015), False)
def test_year_divisible_by_2_not_divisible_by_4(self):
... | {
"content_hash": "ae02a108a28dbab2b663d45ae334f9de",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 75,
"avg_line_length": 28,
"alnum_prop": 0.6761904761904762,
"repo_name": "N-Parsons/exercism-python",
"id": "92ea304e6176828101c1d1be885f99755328e843",
"size": "840",
"b... |
from ..config import GlobalConfig
class CurrentTimer:
""" Represents a command to view the current Toggl Timer """
description = "View the Toggl Timer"
args = []
def run(self):
""" View the timer """
entry = GlobalConfig.connection.timer.current()
print(entry.desc... | {
"content_hash": "c81a9957ef9cf2a2f9131c25a9103e1d",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 64,
"avg_line_length": 31.272727272727273,
"alnum_prop": 0.627906976744186,
"repo_name": "cloew/TogglDriver",
"id": "a345f73703b4c6c245e37487543120727f21b723",
"size": "344... |
from django.contrib.postgres.signals import (
get_citext_oids, get_hstore_oids, register_type_handlers,
)
from django.db.migrations import AddIndex, RemoveIndex
from django.db.migrations.operations.base import Operation
from django.db.utils import NotSupportedError
class CreateExtension(Operation):
reversible... | {
"content_hash": "9db734860556783dc5a8ce880809e779",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 104,
"avg_line_length": 35.32846715328467,
"alnum_prop": 0.6679752066115703,
"repo_name": "mdworks2016/work_development",
"id": "9e417725ec6ea373a2300e26d16cb1d178431118",
... |
"""UtilityAnalysisEngine Test"""
from absl.testing import absltest
from absl.testing import parameterized
from unittest.mock import patch
import copy
import pipeline_dp
from pipeline_dp import budget_accounting
from utility_analysis_new import dp_engine
from utility_analysis_new import metrics
import utility_analysis_... | {
"content_hash": "4e8e9071d05a399640e7b0d5d07a8b8c",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 100,
"avg_line_length": 42.9748427672956,
"alnum_prop": 0.5682716230060003,
"repo_name": "OpenMined/PipelineDP",
"id": "4b66c370e8b9ea1895643258d9cd8929198ddf8e",
"size": ... |
import pathlib
import pandas as pd
import quandl
DATA_FILE = 'nasdaq_data.csv'
DATA_TRF = 'nasdaq5.csv'
def download_data():
if pathlib.Path(DATA_FILE).exists():
print('data file already downloaded')
return
ndq = quandl.get("NASDAQOMX/COMP-NASDAQ", trim_start='2000-01-01', trim_end='2019-02-... | {
"content_hash": "00dd3fcf8cb3326234d410f5bb3f1aa5",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 93,
"avg_line_length": 23.302325581395348,
"alnum_prop": 0.6297405189620758,
"repo_name": "Tjorriemorrie/trading",
"id": "e015eddd630b74a0dcba4622787e9402a529dff5",
"size":... |
import sys
from dataunit.main import main, parse_args
if __name__ == "__main__":
args = parse_args(sys.argv[1:])
dataunit_excel_workbook = args.workbook
sys.exit(main(dataunit_excel_workbook))
| {
"content_hash": "8e8eff8cb98049720f59c51a3af1c7e8",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 43,
"avg_line_length": 25.875,
"alnum_prop": 0.6763285024154589,
"repo_name": "dataunit/dataunit",
"id": "c4967d070e015f6d03ca65193d3a6f4ce52e977e",
"size": "207",
"binary... |
from django.core.urlresolvers import resolve
from django.http import HttpRequest
from django.template.loader import render_to_string
from django.test import TestCase
from django.utils.html import escape
from lists.models import Item, List
from lists.views import home_page
from lists.forms import (
ItemForm, EMPTY_... | {
"content_hash": "c463c304f1a9e127ef9efdb5c91f83b0",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 77,
"avg_line_length": 38.406060606060606,
"alnum_prop": 0.639734890326653,
"repo_name": "fantasycheung/django_learning",
"id": "393a6190b1e1f8ff4240b9a517728587e304d385",
... |
from .totalstatistics import TotalStatisticsBuilder
from .suitestatistics import SuiteStatisticsBuilder
from .tagstatistics import TagStatisticsBuilder
from .visitor import SuiteVisitor
class Statistics(object):
"""Container for total, suite and tag statistics.
Accepted parameters have the same semantics as ... | {
"content_hash": "616fd50e4367c7efb6f97a7e508162af",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 81,
"avg_line_length": 38.75,
"alnum_prop": 0.658560794044665,
"repo_name": "robotframework/RIDE",
"id": "7d20d3f49294bb02babb81afc1f46b020e77956b",
"size": "2659",
"bina... |
import gym
import pygame
import sys
import time
import matplotlib
import matplotlib.pyplot as plt
from collections import deque
from pygame.locals import HWSURFACE, DOUBLEBUF, RESIZABLE, VIDEORESIZE
from threading import Thread
try:
matplotlib.use('GTK3Agg')
except Exception:
pass
def display_arr(screen, arr... | {
"content_hash": "c0bac4da9bcf5c468715da6229e68a7f",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 93,
"avg_line_length": 35.41968911917098,
"alnum_prop": 0.5953774136922176,
"repo_name": "dianchen96/gym",
"id": "1aafa622c3f9c215ca9102c193aefd18832cbbf1",
"size": "6836"... |
import happyforms
from django import forms
from django.contrib import messages
from remo.base.tasks import send_remo_mail
from remo.profiles.models import UserProfile
class BaseEmailUsersForm(happyforms.Form):
"""Base form to send email to multiple users."""
subject = forms.CharField(label='', widget=(
... | {
"content_hash": "0105be397b7bbc3195b9be67cad0033e",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 88,
"avg_line_length": 42.73684210526316,
"alnum_prop": 0.541871921182266,
"repo_name": "tsmrachel/remo",
"id": "09b4b55953d72c85d457865c7dd57e1b73f9b371",
"size": "4060",
... |
import os
import glob
from flexmock import flexmock, flexmock_teardown
from .. import EloquentTestCase
from eloquent.migrations import Migrator, DatabaseMigrationRepository, Migration
from eloquent import DatabaseManager
from eloquent.connections import Connection
class MigratorTestCase(EloquentTestCase):
def te... | {
"content_hash": "817551cfc412c5e44620844a25b9a59c",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 103,
"avg_line_length": 36.40723981900452,
"alnum_prop": 0.5673626646781009,
"repo_name": "sdispater/eloquent",
"id": "27e2e3e801b0612599d8650fb931d3e4a5e289c2",
"size": "... |
from django.db import models
from django.contrib.localflavor.us.models import USStateField
from wtforms.validators import u
class Group(models.Model):
name = models.CharField(max_length=20)
def __unicode__(self):
return u('%s(%d)') % (self.name, self.pk)
class User(models.Model):
username = mode... | {
"content_hash": "15fe67316e1037bcdf12502f71e9c7c8",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 61,
"avg_line_length": 33.72,
"alnum_prop": 0.6631079478054567,
"repo_name": "webitup/python3-wforms",
"id": "5d543085c11bbcdf78345030df92959e501c0c04",
"size": "843",
"b... |
"""API over the cinder service."""
from django.utils.translation import gettext_lazy as _
from django.views import generic
from openstack_dashboard import api
from openstack_dashboard.api.rest import json_encoder
from openstack_dashboard.api.rest import urls
from openstack_dashboard.api.rest import utils as rest_util... | {
"content_hash": "a37bd1b3a67c4dd55148a8d8f669d392",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 78,
"avg_line_length": 32.70754716981132,
"alnum_prop": 0.5887655033169887,
"repo_name": "openstack/horizon",
"id": "b3e36457f17e838d5f19c2c021043d81ef91f5d1",
"size": "14... |
import re
# GTK Imports
import gtk
# EVOGTK imports
from evogtk.gui import GUIClass
# Plugin class
class Plugin(GUIClass):
"""
LOTROAssist money count plugin class
"""
metadata={
'PLUGIN_NAME': 'Money Count',
'PLUGIN_CODENAME': 'lootbag',
'PLUGIN_VERSION': '0.1',
'PLUG... | {
"content_hash": "8ad7db9274f394a6dc6c31f6dfa590bd",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 261,
"avg_line_length": 31.72972972972973,
"alnum_prop": 0.5340715502555367,
"repo_name": "olivergs/lotroassist",
"id": "cd1faf4fb979dcfd370bc7c60e3cf1f167179e10",
"size": ... |
from os import listdir
from os.path import isfile, join
import argparse
import re
from PIL import Image
import pystache
def process_image(filename):
image = Image.open(args.folder[0] + '/' + filename)
data = list(image.getdata())
return filename.split('.')[0].replace('-', '_'), data
def generate_data(data):
da... | {
"content_hash": "2f5250f02a8b3dc07d45fec72d0d0f1e",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 90,
"avg_line_length": 25.166666666666668,
"alnum_prop": 0.6471144749290445,
"repo_name": "ryankurte/micro-gui",
"id": "c93952b04d8323577ba49e7b007ad5e0b2d15437",
"size": "... |
"""Definitions for the `Gaussian` class."""
import numpy as np
from scipy.special import erfinv
from mosfit.modules.parameters.parameter import Parameter
# Important: Only define one ``Module`` class per file.
class Gaussian(Parameter):
"""Parameter with Gaussian prior.
If the parameter must be positive, ... | {
"content_hash": "e8cdcd1f578ebaa7a6855c9c33d4ed2b",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 79,
"avg_line_length": 32.29545454545455,
"alnum_prop": 0.5826882477128783,
"repo_name": "mnicholl/MOSFiT",
"id": "d7cabb8202ba2fc51c98b5cce987957ce94d6399",
"size": "1421"... |
"""Module for implementing the Federated search."""
from search.common import exceptions
from search.common import utils
from search.plugin import coordinate_search_handler
from search.plugin import geplaces_search_handler
class FederatedSearch(object):
"""Class for performing the Federated search.
We initially... | {
"content_hash": "2d1170d8d4ad912613df813d5c70a1ba",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 80,
"avg_line_length": 33.76335877862596,
"alnum_prop": 0.7056296631245761,
"repo_name": "tst-ppenev/earthenterprise",
"id": "89e10d6561ba33c167989223ca83943cc412fef2",
"s... |
import numpy as np
class SpectralSub(object):
r"""
Here we have a class for performing **single channel** noise reduction via
spectral subtraction. The instantaneous signal energy and noise floor is
estimated at each time instance (for each frequency bin) and this is used
to compute a gain filter ... | {
"content_hash": "7e4cd66ed475409bdf0ebf5a86baf655",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 122,
"avg_line_length": 33.41871921182266,
"alnum_prop": 0.5994988207547169,
"repo_name": "LCAV/pyroomacoustics",
"id": "c4b3bfd165b12d53cc5a064b35985afd5859f269",
"size":... |
"""Command-line flag library.
Emulates gflags by wrapping cfg.ConfigOpts.
The idea is to move fully to cfg eventually, and this wrapper is a
stepping stone.
"""
import socket
from oslo_config import cfg
from cinder.i18n import _
CONF = cfg.CONF
def _get_my_ip():
"""
Returns the actual ip of the local ... | {
"content_hash": "140a2a583da7ab5adf1b8d6feb10120e",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 79,
"avg_line_length": 42.431372549019606,
"alnum_prop": 0.5724353049907579,
"repo_name": "blueboxgroup/cinder",
"id": "e3761bb285b0ced1cacf26151962f83f92a49f98",
"size": ... |
import decimal
from .._gae import ndb
# TODO Needs more testing
class NDBDecimalProperty(ndb.StringProperty):
"""
NDB decimal implementation
"""
data_type = decimal.Decimal
def __init__(self, precision, scale, **kwargs):
d = "1."
for x in range(scale):
d += "0"
... | {
"content_hash": "aef59a32eca9c3a957a32b43e5c47316",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 80,
"avg_line_length": 26.243243243243242,
"alnum_prop": 0.5787847579814624,
"repo_name": "web2py/pydal",
"id": "e22f2a9138bce767843062626aa19a10067ebec8",
"size": "971",
... |
import copy
from logging import config as logging_config
import os
from alembic import command as alembic_command
from alembic import config as alembic_config
from alembic import environment
from alembic import migration as alembic_migration
from alembic import script as alembic_script
from alembic import util as alem... | {
"content_hash": "39be2ccdbed0f9830ffe831db2a9febd",
"timestamp": "",
"source": "github",
"line_count": 677,
"max_line_length": 79,
"avg_line_length": 35.38552437223043,
"alnum_prop": 0.6365419936550343,
"repo_name": "igor-toga/local-snat",
"id": "2c7090f0daa2a6321546be8ee29f580e753ac58c",
"size": ... |
"""Provide a TestCase base class for PageTest subclasses' unittests."""
import unittest
from telemetry import benchmark
from telemetry import story
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.internal.results import results_options
from telemetry.internal import story_runner
f... | {
"content_hash": "d6b01ff0109e6eca6003477bcb865c22",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 79,
"avg_line_length": 36.601941747572816,
"alnum_prop": 0.7222811671087533,
"repo_name": "chuan9/chromium-crosswalk",
"id": "f753ed025da5cff5b1d9b2ab2f775dc1cab6dfff",
"s... |
import sys
import os
def getTTYSize():
def ioctl_GWINSZ(fd):
try:
import fcntl, termios, struct, os
cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ,'1234'))
except:
return None
return cr
cr = ioctl_GWINSZ(0) or ioctl_GWINSZ(1) or ioctl_GWINSZ(2)
if not cr:
try:
fd = os.open(os.ctermi... | {
"content_hash": "b133a26825e358a148544e82e623caab",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 73,
"avg_line_length": 23.214285714285715,
"alnum_prop": 0.6750769230769231,
"repo_name": "Xilinx/hopper",
"id": "47b207451a79b5dd06bdfabdb6b8f42752f340ae",
"size": "2716",... |
from pypom import Page, Region
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as expected
class Search(Page):
_search_box_locator = (By.CLASS_NAME, 'AutoSearchInput-query')
_submit_button_locator = (By.CLASS_NAME, 'AutoSearchInput-submit-button')
_s... | {
"content_hash": "ce76c2b7895a40cff7b39f0897789bba",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 78,
"avg_line_length": 38.246753246753244,
"alnum_prop": 0.6050933786078099,
"repo_name": "atiqueahmedziad/addons-server",
"id": "8592462c041b4787bbf1cbfc36cdbe0b1ec92053",
... |
"""Generate Python documentation in HTML or text for interactive use.
In the Python interpreter, do "from pydoc import help" to provide online
help. Calling help(thing) on a Python object documents the object.
Or, at the shell command line outside of Python:
Run "pydoc <name>" to show documentation on someth... | {
"content_hash": "d796e86831095663fbf8879f1ca9819a",
"timestamp": "",
"source": "github",
"line_count": 2335,
"max_line_length": 88,
"avg_line_length": 40.66895074946467,
"alnum_prop": 0.5237674016975211,
"repo_name": "hwu25/AppPkg",
"id": "4b5b387a60f41e916675b26bfd6ecf33f416ff55",
"size": "95012"... |
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/food/shared_dessert_felbar.iff"
result.attribute_template_id = -1
result.stfName("string_id_table","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "365fbd24deb6e553c7217fec5cea7143",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 74,
"avg_line_length": 23.307692307692307,
"alnum_prop": 0.693069306930693,
"repo_name": "anhstudios/swganh",
"id": "059d48f17474d4b798803e8d5534972a27fb610a",
"size": "448... |
import numpy as np
import tensorflow as tf
from federatedml.util import LOGGER
class FTLDataLoader(tf.keras.utils.Sequence):
def __init__(self, non_overlap_samples, overlap_samples, batch_size, guest_side=True):
self.batch_size = batch_size
self.guest_side = guest_side
self._overlap_ind... | {
"content_hash": "2a1ca9f47203a4c60f582e9cf69b87e5",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 114,
"avg_line_length": 32.747368421052634,
"alnum_prop": 0.5753776920604308,
"repo_name": "FederatedAI/FATE",
"id": "c7e90575bdb0ab04841913e580c0ca27d164ba61",
"size": "31... |
from django.core.management.base import BaseCommand
from optparse import make_option
import os
from jukebox.jukebox_core.utils import FileIndexer
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option("--path", action="store", dest="path",
help="Music library... | {
"content_hash": "07903497a6d3a766eb06700f1a2bf63c",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 62,
"avg_line_length": 31.325,
"alnum_prop": 0.5674381484437351,
"repo_name": "rejahrehim/jukebox",
"id": "15dce8f0e6520b15470fc51065c219a427cc477a",
"size": "1277",
"bin... |
""" PyTorch PEGASUS model."""
import copy
import math
import random
from typing import List, Optional, Tuple, Union
import numpy as np
import torch
import torch.utils.checkpoint
from torch import nn
from torch.nn import CrossEntropyLoss
from ...activations import ACT2FN
from ...modeling_outputs import (
BaseMode... | {
"content_hash": "00bd235aa20cd982328ff1255c550ea1",
"timestamp": "",
"source": "github",
"line_count": 1708,
"max_line_length": 150,
"avg_line_length": 47.37646370023419,
"alnum_prop": 0.6302104573709512,
"repo_name": "huggingface/transformers",
"id": "a78a0235e337e9a9d342de45f9f1b71459621b36",
"s... |
import random
from neutron_lib import constants
from oslo_utils import uuidutils
from neutron.agent.linux import ip_lib
from neutron.common import utils as common_utils
from neutron.tests.fullstack import base
from neutron.tests.fullstack.cmd import dhcp_agent as cmd
from neutron.tests.fullstack.resources import envi... | {
"content_hash": "1013d18deed8703412180b2701059dfc",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 79,
"avg_line_length": 36.0427807486631,
"alnum_prop": 0.622106824925816,
"repo_name": "huntxu/neutron",
"id": "16afe9942f5dda7ab73652855ee8fb2f5eb6433f",
"size": "7340",
... |
import os
import numpy as np
from matplotlib import pyplot as plt
results = []
for d, dn, fn in os.walk("."):
for dir in sorted(dn):
if "scf-" in dir:
try:
E = 0
with open(d+"/"+dir+"/scf.out") as f:
for line in f:
if ... | {
"content_hash": "690fd9e6657c91d168de1fbb2503949f",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 55,
"avg_line_length": 27.304347826086957,
"alnum_prop": 0.47770700636942676,
"repo_name": "addman2/KvantSim",
"id": "b17b6da8f7083aa735d44aafbf83518136b4912f",
"size": "65... |
import os
import pymongo
import MySQLdb
import sys
from collections import defaultdict
c = pymongo.Connection('10.5.5.40', read_preference=pymongo.ReadPreference.SECONDARY_ONLY)
tcol = c['coleta_131']['tweets_131']
tunloadcol = c['coleta_131']['unload_tweets_131']
INSERT_SQL_1 = '''INSERT INTO conteudo_itemconteudode... | {
"content_hash": "0963806d2984bb67e111c97372820854",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 149,
"avg_line_length": 40.49295774647887,
"alnum_prop": 0.6681739130434783,
"repo_name": "W3CBrasil/AI-Social",
"id": "49a012134691716d494c72e7f4ec32a7d423fa51",
"size": "... |
import os,imp,sys
from waflib import Utils,Errors,Logs
import waflib.Node
HEXVERSION=0x1060600
WAFVERSION="1.6.6"
WAFREVISION="11388"
ABI=98
DBFILE='.wafpickle-%d'%ABI
APPNAME='APPNAME'
VERSION='VERSION'
TOP='top'
OUT='out'
WSCRIPT_FILE='wscript'
launch_dir=''
run_dir=''
top_dir=''
out_dir=''
waf_dir=''
local_repo=''
r... | {
"content_hash": "a5cf810d001b047bb685bed9ed801ab8",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 99,
"avg_line_length": 25.74496644295302,
"alnum_prop": 0.6663190823774765,
"repo_name": "drayside/kodkod",
"id": "f296f85aa9bce8c8f45c92fe4f3b073984339aff",
"size": "7817... |
"""
@file
@brief Implémente une simulation d'évolution des catégories de population
selon un modèle de Schelling.
"""
import random
import copy
import os
from pyquickhelper.loghelper import noLOG
from ..helpers.pygame_helper import wait_event, empty_main_loop
def round(r, g, b):
"""
arrondit chaque couleur
... | {
"content_hash": "ade994f1bc26ba4cb4c26dad863dc5f4",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 133,
"avg_line_length": 36.218934911242606,
"alnum_prop": 0.5022872079725536,
"repo_name": "sdpython/ensae_teaching_cs",
"id": "b8dea50c067406c1405c86206bf5c9e51b9cea63",
... |
class batchConverter:
kits = ['vtk_kit', 'wx_kit']
cats = ['Readers','Writers','Converters']
keywords = ['batch','convert','read','write','vti','mha','gipl']
help = """Batch converts image volume files from one type to another.
Source and target types can be VTK ImageData (.vti), MetaImage (.mha),
... | {
"content_hash": "8d88419b85e59d50bba96d60cd37e5d8",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 87,
"avg_line_length": 31.04724409448819,
"alnum_prop": 0.6588891706822216,
"repo_name": "chrisidefix/devide",
"id": "04f76cab6e1d09617f899937201d55503189f48d",
"size": "3... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'TwitterRecentEntries'
db.create_table('cmsplugin_twitterrecententries', (
('cmsplugin_ptr', self.gf('dja... | {
"content_hash": "830d3aebc72ed4b1566e2940b3e1b36f",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 156,
"avg_line_length": 65.31168831168831,
"alnum_prop": 0.5949492940942533,
"repo_name": "nephila/djangocms_twitter",
"id": "4c295f475057de417a7a9e66d6cb7487541cef6c",
"si... |
from django.conf import settings
import djclick as click
from md.models import Agency, Stop
from tsdata.dataset_facts import compute_dataset_facts
@click.command()
def command():
facts = compute_dataset_facts(Agency, Stop, settings.MD_KEY)
for fact in facts:
click.echo(fact)
| {
"content_hash": "ca63ceb63a16b3d7cdef3b9430d24bb9",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 64,
"avg_line_length": 24.583333333333332,
"alnum_prop": 0.7423728813559322,
"repo_name": "OpenDataPolicingNC/Traffic-Stops",
"id": "506f6d616868da2b80b0d611b08cb5ad94ba8245"... |
__version__ = '2.1.0dev0'
from .vegalite import *
def load_ipython_extension(ipython):
from ._magics import vega, vegalite
ipython.register_magic_function(vega, 'cell')
ipython.register_magic_function(vegalite, 'cell')
| {
"content_hash": "4a152d02de8e86b2a87128e0f40dd5e5",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 53,
"avg_line_length": 29.125,
"alnum_prop": 0.7124463519313304,
"repo_name": "ellisonbg/altair",
"id": "4226f083ed2e72a5dfa5282a9288ac5500d09669",
"size": "248",
"binary"... |
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
from imp import reload
import alexREPO.fitting as fitting
reload(fitting)
import alexREPO.circlefinder as circlefinder
def grayscale(rgb):
r, g, b = rgb[:,:,0], rgb[:,:,1], rgb[:,:,2]
gray = 0.2989 * r + 0.5870 * g + 0.1140 * ... | {
"content_hash": "39b07572230f955118fad6429a9a66ef",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 136,
"avg_line_length": 34.964285714285715,
"alnum_prop": 0.6284473953013279,
"repo_name": "AlexProutski/Casimir-Programming-2",
"id": "d6f10a25aee8a423b447eb1f1e8939bbd0d92... |
try:
import utime as time
except ImportError:
import time
import _thread
def last(l):
return l[-1]
def thread_entry(n):
# allocate a bytearray and fill it
data = bytearray(i for i in range(128))
# run a loop which allocates a small list and uses it each iteration
lst = 8 * [0]
sum = 0... | {
"content_hash": "7154c30a1877c50f00a016a5a94a5f8b",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 72,
"avg_line_length": 22.317073170731707,
"alnum_prop": 0.614207650273224,
"repo_name": "husigeza/pycom-micropython-sigfox",
"id": "00527d05980ed120f26c6bc1f08b61b2c02dfec7"... |
import sys
from pkg_resources import resource_stream, resource_exists, resource_isdir, \
resource_listdir
import json
import re
__version__ = '0.1.2'
cache = dict()
def fetch_resource(name):
if name not in cache:
cache[name] = json.loads(resource_stream(
__name__, name).read().decode... | {
"content_hash": "1e9cff346074d574f2232b0c2221c353",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 77,
"avg_line_length": 29.808823529411764,
"alnum_prop": 0.5905278737049827,
"repo_name": "hugovk/pycorpora",
"id": "90be9831da289cb2418822b01921f354f8ab4c1e",
"size": "202... |
"""Test the UniFi Protect sensor platform."""
# pylint: disable=protected-access
from __future__ import annotations
from copy import copy
from datetime import datetime, timedelta
from unittest.mock import Mock
import pytest
from pyunifiprotect.data import NVR, Camera, Event, Sensor
from pyunifiprotect.data.base impor... | {
"content_hash": "4a6c9f696261223921f6e36a8139aec7",
"timestamp": "",
"source": "github",
"line_count": 573,
"max_line_length": 85,
"avg_line_length": 31.717277486910994,
"alnum_prop": 0.680147463409266,
"repo_name": "GenericStudent/home-assistant",
"id": "1f5624c30a90ab7bcca0db694a751945794c0d30",
... |
from __future__ import absolute_import
# This module contains abstractions for the input stream. You don't have to
# looks further, there are no pretty code.
#
# We define two classes here.
#
# Mark(source, line, column)
# It's just a record and its only use is producing nice error messages.
# Parser does not use it ... | {
"content_hash": "265670666260dccc339a2c22d99fda21",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 79,
"avg_line_length": 35.691943127962084,
"alnum_prop": 0.5406984464214579,
"repo_name": "naparuba/kunai",
"id": "376c6de8c600e1ac28a479dafdfd24402a617fac",
"size": "7548... |
import unittest
import sys
import pickle
from test import support
class G:
'Sequence using __getitem__'
def __init__(self, seqn):
self.seqn = seqn
def __getitem__(self, i):
return self.seqn[i]
class I:
'Sequence using iterator protocol'
def __init__(self, seqn):
self.seqn ... | {
"content_hash": "7de7dc505a8c33803f3c1070fefb90ad",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 86,
"avg_line_length": 29.53818181818182,
"alnum_prop": 0.570232672657885,
"repo_name": "mikehulluk/ProcessManager",
"id": "2e904cf8789f07c52efffa5d075907a3d9e1e738",
"siz... |
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server.models.tapi_common_admin_state_pac import TapiCommonAdminStatePac # noqa: F401,E501
from tapi_server.models.tapi_commo... | {
"content_hash": "59ed64befdcae1e70c3b56b6f3b16ea0",
"timestamp": "",
"source": "github",
"line_count": 602,
"max_line_length": 599,
"avg_line_length": 46.85880398671096,
"alnum_prop": 0.7022935942429721,
"repo_name": "OpenNetworkingFoundation/Snowmass-ONFOpenTransport",
"id": "887b4a851c53a095b80bf8... |
"""
Copyright (c) 2016, Marcelo Leal
Description: Simple Azure Media Services Python library
License: MIT (see LICENSE.txt file for details)
"""
import os
import json
import azurerm
import time
#import pytz
import logging
import datetime
#################################################################################... | {
"content_hash": "cd5505b88b68e45a00ff394371676508",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 123,
"avg_line_length": 42.3448275862069,
"alnum_prop": 0.5496742671009772,
"repo_name": "gbowerman/azurerm",
"id": "e2c0ed2c86d624c3a0c1b9e2b2759eef0508819b",
"size": "245... |
"""Converter for DRAGNN checkpoint+master-spec files to TF SavedModels.
This script loads a DRAGNN model from a checkpoint and master-spec and saves it
to a TF SavedModel checkpoint. The checkpoint and master-spec together must
form a complete model - see the conll_checkpoint_converter.py for an example
of how to conv... | {
"content_hash": "41617a48518438553a257d3512d83962",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 79,
"avg_line_length": 37.357142857142854,
"alnum_prop": 0.7269598470363289,
"repo_name": "jiaphuan/models",
"id": "bb0170d8b638c68aeecf616cf72a0afc5fea9ff9",
"size": "3293... |
import uuid
import psycopg2.extras
from django import forms
from django.db import models
__all__ = ('CharField', 'EmailField', 'SlugField', 'URLField', 'UUIDField')
class CharField(models.Field):
def formfield(self, **kwargs):
defaults = {'widget': forms.TextInput}
defaults.update(kwargs)
... | {
"content_hash": "5f7d33b46272bd30f36a0e0675ee796a",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 86,
"avg_line_length": 29.653333333333332,
"alnum_prop": 0.6371402877697842,
"repo_name": "jpwatts/django-pgfields",
"id": "d2d05c264e367ef20d3690181ff697ed37403efe",
"size... |
"""Contrib NDArray API of MXNet."""
from __future__ import absolute_import
import math
import numpy as np
from ..context import current_context
from ..random import uniform
from ..base import _as_list
from . import ndarray
try:
from .gen_contrib import *
except ImportError:
pass
__all__ = ["rand_zipfian", "for... | {
"content_hash": "e3611a84c563ad3536d7101e2e70dfab",
"timestamp": "",
"source": "github",
"line_count": 552,
"max_line_length": 100,
"avg_line_length": 36.846014492753625,
"alnum_prop": 0.6134519887900094,
"repo_name": "reminisce/mxnet",
"id": "601bc682db3862a8e2cae21d598baf551908457a",
"size": "21... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.