text stringlengths 4 1.02M | meta dict |
|---|---|
"""Tests for the command line interface."""
import json
import logging
import os
import traceback
import unittest
from click.testing import CliRunner
from pybel import Manager, cli
from pybel.constants import METADATA_NAME, PYBEL_CONTEXT_TAG
from pybel.io import from_bel_script, from_nodelink, from_pickle
from pybel... | {
"content_hash": "3872e0873e01589ff68bec895126eaa8",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 120,
"avg_line_length": 33.61832061068702,
"alnum_prop": 0.534741144414169,
"repo_name": "pybel/pybel",
"id": "22f7e64e70bf8d37cb2bcc1b915ecb07da1e4bcb",
"size": "4429",
... |
import sys
import enum
import http
import time
import asyncio
import warnings
from types import TracebackType
from typing import Generic, Optional, Union, Type, List, Sequence, Any, cast
from typing import Dict, TYPE_CHECKING
try:
import ssl as _ssl
except ImportError:
_ssl = None # type: ignore
from h2.con... | {
"content_hash": "0a4040bf2b16e011d2f164ee00b8e17f",
"timestamp": "",
"source": "github",
"line_count": 949,
"max_line_length": 80,
"avg_line_length": 35.6986301369863,
"alnum_prop": 0.5865753586398252,
"repo_name": "vmagamedov/asyncgrpc",
"id": "c6da36db1ccfca1bfd9125750ba3021a603df27e",
"size": "... |
import pyexpat
from iptest import IronPythonTestCase, run_test
class PyExpatTest(IronPythonTestCase):
def test_incremental_parsing(self):
"""https://github.com/IronLanguages/ironpython3/pull/680"""
res = []
def start_element(name, attrs):
res.append("<{}>".format(name)... | {
"content_hash": "0b441be36e9105b6c34be89bac97d99a",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 67,
"avg_line_length": 31.14814814814815,
"alnum_prop": 0.5945303210463734,
"repo_name": "IronLanguages/ironpython3",
"id": "5a6d4d171f2bca4b2c60ba398e673b89412fa3ce",
"siz... |
"""
this was an attempt to achieve motion blur
hoping that fading out will do the job.
this is not quite motion blur - to see what i mean, try moving the mouse
around for a longer while - instead of motion blur what you get is motion
tail, which is unwanted.
still this example teaches something ... | {
"content_hash": "ded17a401382623734a74380dc1987c9",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 82,
"avg_line_length": 30.577464788732396,
"alnum_prop": 0.5674804237678489,
"repo_name": "projecthamster/experiments",
"id": "feb9a7ffc6df06b8d6f8b71b2fb6447d6ecb96ee",
"s... |
from typing import Optional
from airflow.models import BaseOperator
from airflow.providers.amazon.aws.hooks.dms import DmsHook
class DmsStartTaskOperator(BaseOperator):
"""
Starts AWS DMS replication task.
.. seealso::
For more information on how to use this operator, take a look at the guide:
... | {
"content_hash": "619067ec9a8a7399ba4666cddf16c73a",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 89,
"avg_line_length": 36.54545454545455,
"alnum_prop": 0.6550580431177446,
"repo_name": "apache/incubator-airflow",
"id": "a2ce635dc9c2408bf7388833fe65654289ff2ebb",
"size... |
import os
import sys
# dir = os.path.dirname(__file__)
# sys.path.insert(0, os.path.realpath(os.path.join(dir,'../../UUTrack')))
sys.path.insert(0, os.path.abspath('../../'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it he... | {
"content_hash": "c4171b626a41101d78067cbaada3bdd8",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 100,
"avg_line_length": 29.575757575757574,
"alnum_prop": 0.6620901639344262,
"repo_name": "aquilesC/UUTrack",
"id": "b1cf318c719c90a49f4b156e3748e7716430e19e",
"size": "5... |
import numpy as np
import pandas as pd
import pytest
from distributed import Nanny
from distributed.utils_test import gen_cluster
from packaging import version
from scipy.stats import loguniform
from sklearn.datasets import make_classification
from dask_ml.model_selection import IncrementalSearchCV
try:
import sc... | {
"content_hash": "cbebd9bd3e992b84d3e8262d37d778a6",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 87,
"avg_line_length": 30.13157894736842,
"alnum_prop": 0.6554585152838428,
"repo_name": "dask/dask-ml",
"id": "c3cbe645999a128a638404b34a29ce4d64e8a1e5",
"size": "2290",
... |
import json
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.common.abstract_client import AbstractClient
from tencentcloud.ocr.v20181119 import models
class OcrClient(AbstractClient):
_apiVersion = '2018-11-19'
_endpoint = 'ocr.tencentcloudapi.... | {
"content_hash": "eb5f3c05a29ad4fcccd7b8706b554985",
"timestamp": "",
"source": "github",
"line_count": 2543,
"max_line_length": 224,
"avg_line_length": 41.6283916633897,
"alnum_prop": 0.5801003202312466,
"repo_name": "tzpBingo/github-trending",
"id": "91c217705bea6397927d3cd20a431f0aba71c3f2",
"si... |
import sys
from bottle import route, run, template, static_file, request
import subprocess
import time
import datetime
import multiprocessing as mp
import threading
import socket
import correlate_with_ref
import shlex
import argparse
import collections
import numpy as np
# The record and correlate tasks run in alterna... | {
"content_hash": "4ac29391bf8c2226d3c3d14255f4ec90",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 131,
"avg_line_length": 31.32456140350877,
"alnum_prop": 0.5817698123774853,
"repo_name": "mpbraendli/dab-autocorrelation",
"id": "8b7a3b6c61de9e364ab9a8f04ae0dd957079df34",... |
'''
http://explorer.viacoin.org/
'''
import logging
from lib import config, util, util_bitcoin
def get_host():
if config.BLOCKCHAIN_SERVICE_CONNECT:
return config.BLOCKCHAIN_SERVICE_CONNECT
else:
return 'http://localhost:3001' if config.TESTNET else 'http://localhost:3000'
def check():
re... | {
"content_hash": "88d1c57be661eeefee0a83ddb00e8e77",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 145,
"avg_line_length": 38.42,
"alnum_prop": 0.659552316501822,
"repo_name": "ClearingHouse/clearblockd",
"id": "1a15c68e3d89bbfdb5ce2ea97532d0132fc287fc",
"size": "1921",
... |
from PyObjCTools.TestSupport import *
from Quartz.QuartzCore import *
class TestCABase (TestCase):
@min_os_level('10.5')
def testFunctions(self):
v = CACurrentMediaTime()
self.assertIsInstance(v, float)
if __name__ == "__main__":
main()
| {
"content_hash": "1b3eb6db83bac54a87ada60bed158b4e",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 39,
"avg_line_length": 24.272727272727273,
"alnum_prop": 0.6479400749063671,
"repo_name": "albertz/music-player",
"id": "5f241945a3ad088dbb7f487896c92c178ca2b061",
"size": ... |
import os
from setuptools import find_packages, setup
pkgname = "vdt.versionplugin.gitchain"
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name=pkgname,
version="0.0.4",
description="Instead of building packages as a freezed state, propagate tags between gi... | {
"content_hash": "21daf03db8bb194ac7e7a7a65bcf4343",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 110,
"avg_line_length": 31.22222222222222,
"alnum_prop": 0.6524317912218268,
"repo_name": "devopsconsulting/vdt.versionplugin.gitchain",
"id": "69678af229f7c0d3dab82a1a7fb45d... |
try:
import unittest2 as unittest
except ImportError:
import unittest
import logging
import time
import os
import datetime
import random
from wia import Wia
from wia.error import WiaError, WiaValidationError, WiaUnauthorisedError, WiaForbiddenError, WiaNotFoundError
class SpacesTest(unittest.TestCase):
de... | {
"content_hash": "fa99358415516b8ee4beac2330475dd6",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 112,
"avg_line_length": 38.101851851851855,
"alnum_prop": 0.6376670716889429,
"repo_name": "wiaio/wia-python-sdk",
"id": "72f5c7626cca729f35f9b48a915339274bead5fb",
"size"... |
"Filter definition for underline_columns"
from .abstract import AbstractFilter
class UnderlineColumns(AbstractFilter):
"Create columns from underlined text file"
name = "Colonne par souligné"
description = """Recherche des colonnes soulignées dans un fichier texte"""
node_in = ['fichier']
node_ou... | {
"content_hash": "384856d6e7b9c2067b69dbdd4a8a938a",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 79,
"avg_line_length": 29.484848484848484,
"alnum_prop": 0.4773895169578623,
"repo_name": "Exanis/cannelloni",
"id": "da6fc69c4b27fe738b34c6f9503765a6bde06ea2",
"size": "19... |
from userflow.forms import signin, signup, password, profile
| {
"content_hash": "f8b51e879667e263a3146b1c272e56c2",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 60,
"avg_line_length": 61,
"alnum_prop": 0.819672131147541,
"repo_name": "alexey-grom/django-userflow",
"id": "8efaf4d09bb9199b41076afcf905ac965fb1dd9d",
"size": "80",
"bi... |
import operator
import sys
import unittest
import numpy
import six
import chainer
from chainer.backends import cuda
from chainer import basic_math
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product({
'shape': [(3, 2), ()],
'... | {
"content_hash": "59cfce1a416c0ff313234fb7fbe51f5e",
"timestamp": "",
"source": "github",
"line_count": 1402,
"max_line_length": 79,
"avg_line_length": 31.420114122681884,
"alnum_prop": 0.5805316564890695,
"repo_name": "aonotas/chainer",
"id": "45dc32e88c5844f86d9bc755f5c8f038d0220f8c",
"size": "44... |
import os
import sys
from django.core.management import execute_from_command_line
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "fetchkeys.settings")
execute_from_command_line(sys.argv)
| {
"content_hash": "113605e70406fb62b7efb2dff821f477",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 73,
"avg_line_length": 28.125,
"alnum_prop": 0.7288888888888889,
"repo_name": "vicaroni/fetch",
"id": "c91a869eee05e1147ef7019f69e47dc55e00bb4d",
"size": "247",
"binary": ... |
__author__ = "Rastislav Szabo <[email protected]>, Lukas Macko <[email protected]>"
__copyright__ = "Copyright 2016, Cisco Systems, Inc."
__license__ = "Apache 2.0"
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | {
"content_hash": "495229bcb02f20c4ae6fc1a67c520c56",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 123,
"avg_line_length": 34.31333333333333,
"alnum_prop": 0.5655721779677482,
"repo_name": "morganzhh/sysrepo",
"id": "f414bf8990b568deb790b8a8289b0f14c84c68c8",
"size": "5... |
from pyIGTLink import * # noqa
| {
"content_hash": "d9df952dc13292cedd0068d0fe4b516a",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 31,
"avg_line_length": 32,
"alnum_prop": 0.71875,
"repo_name": "Danielhiversen/pyIGTLink",
"id": "6da0aaf112b30f218c517e8a07567cff4cccfb6e",
"size": "32",
"binary": false,... |
import os
import re
from migrate.changeset import ansisql
from migrate.changeset.databases import sqlite
from migrate import exceptions as versioning_exceptions
from migrate.versioning import api as versioning_api
from migrate.versioning.repository import Repository
import sqlalchemy
from sqlalchemy.schema import Uniq... | {
"content_hash": "23835f68505de777243c1024c121e02b",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 79,
"avg_line_length": 36.27391304347826,
"alnum_prop": 0.6629509768668345,
"repo_name": "ytsarev/rally",
"id": "73ef73c45fe325f417c9ded47c7540479a88d19e",
"size": "10212"... |
import itertools
import logging
import os
import stat
import pytest
from funcy import first
from dvc.dvcfile import PIPELINE_FILE
from dvc.exceptions import DvcException
from dvc.repo.experiments.utils import exp_refs_by_rev
from dvc.scm import resolve_rev
from dvc.utils.serialize import PythonFileCorruptedError
from... | {
"content_hash": "d3f42316f4fa75961ba99e5b373cc3a8",
"timestamp": "",
"source": "github",
"line_count": 705,
"max_line_length": 79,
"avg_line_length": 32.13758865248227,
"alnum_prop": 0.5942975680805049,
"repo_name": "efiop/dvc",
"id": "a1c051df1f00f29378ca06506834e6fa3e8e1fff",
"size": "22657",
... |
# Copyright 2020 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | {
"content_hash": "1e1114078bc120af06ce56e009167f3d",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 114,
"avg_line_length": 33.181372549019606,
"alnum_prop": 0.6497266952282464,
"repo_name": "HewlettPackard/python-ilorest-library",
"id": "7aa7e86c0a8457e14089805d7e714fc6ef... |
from nova.compute import stats as nova_stats
from nova.compute import task_states
from nova.compute import vm_states
class Stats(nova_stats.Stats):
"""Handler for updates to compute node workload stats."""
def __init__(self):
super(Stats, self).__init__()
@property
def io_workload(self):
... | {
"content_hash": "3e167a91956898ce50309284fefa6f68",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 79,
"avg_line_length": 33.583333333333336,
"alnum_prop": 0.6439205955334988,
"repo_name": "nash-x/hws",
"id": "64bb87a1d8b4bb3a35dee992266729a170cf07ce",
"size": "1446",
... |
import subprocess
from gitviewfs_objects import CommitTreeSymLink
from tests.structs.default import paths
from tests.structs.default.utils import BaseDefaultDirStructTest,\
BaseDefaultDirStructIntegrationTest
class CommitTreeSymLinkPathTest(BaseDefaultDirStructTest):
def test_path(self):
self.assertPathIs(pat... | {
"content_hash": "416626dcb02c5ba395364a4c6134a373",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 82,
"avg_line_length": 35.91304347826087,
"alnum_prop": 0.7905569007263923,
"repo_name": "erdavila/gitviewfs",
"id": "cdc59d358e279967f893e0f6c848628db0c96a1f",
"size": "82... |
"""
The innovative bucketlist app is an application that allows users to
record and share things they want to achieve or experience before
reaching a certain age meeting the needs of keeping track of their
dreams and goals
"""
class BucketList:
def __init__(self, bl_username, bl_name=None):
... | {
"content_hash": "15174c7377ac8678314ef7b81d62d38b",
"timestamp": "",
"source": "github",
"line_count": 489,
"max_line_length": 91,
"avg_line_length": 27.897750511247445,
"alnum_prop": 0.5555637003371939,
"repo_name": "okotieno/BucketList",
"id": "8f5b1b8704462c9954153cee374c23caf0b841b4",
"size": ... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('editor', '0019_auto_20160601_1528'),
]
operations = [
migrations.AddField(
model_name='newexamquestion',
name='group',
... | {
"content_hash": "3b0e63c7e26e7b1f92fb6493a83c2f89",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 57,
"avg_line_length": 21.666666666666668,
"alnum_prop": 0.6051282051282051,
"repo_name": "numbas/editor",
"id": "aae8a409f61a40b8c4dfaf8f51d60bccedeb704c",
"size": "414",
... |
"""Copyright 2011 Urban Airship"""
import errno
import os
import signal
import socket
import sys
import time
import traceback
RETRY_ERRORS = frozenset((
None, # socket.timeout().errno is None
errno.ENOENT,
errno.EPIPE,
errno.ECONNREFUSED,
errno.ECONNRESET,
))
def connect(url):
s = socket.soc... | {
"content_hash": "7e9a8d39a741970b4f29f3f468c4c26f",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 71,
"avg_line_length": 25.723214285714285,
"alnum_prop": 0.4842068726136758,
"repo_name": "schmichael/gologd",
"id": "1c7573c1e6bcc9c26aa227dc1d575a4a310d1af8",
"size": "2... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("mqr", "0002_baselinesurveyresult"),
]
operations = [
migrations.AddField(
model_name="baselinesurveyresult",
name="airtime_sent",
field=models.BooleanFie... | {
"content_hash": "d2e43c1e360548043f8ebab4b66613cb",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 53,
"avg_line_length": 25.238095238095237,
"alnum_prop": 0.5830188679245283,
"repo_name": "praekeltfoundation/ndoh-hub",
"id": "b8f1df03a7a857b1493a309b71bdbc330c7681f7",
"... |
import unittest
from coveragelink import CoverageLink
class CoverageLinkTestsCase(unittest.TestCase):
def test_object(self):
project = 'demo'
url = 'invalid'
link = CoverageLink(project, url, type)
assertEquals(link.project, project)
assertEquals(link.url, url)
as... | {
"content_hash": "8f1aa8960d20b667c577a2eefdb7ed1d",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 47,
"avg_line_length": 25.933333333333334,
"alnum_prop": 0.6658097686375322,
"repo_name": "ronaldbradford/os-demo",
"id": "b0f50abd8b49f179e4b4abff5bfba1459ffbdabb",
"size"... |
from __future__ import print_function, division
import os
import sys
import numpy as np
from numpy import zeros, empty
from scipy.sparse import csr_matrix
import warnings
class gpaw_hsx_c():
def __init__(self, sv, calc):
"""
Gather information on the Hamiltonian
"""
from gpaw.utilities import un... | {
"content_hash": "6ead043ad45f250e7d560b4017c1051a",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 101,
"avg_line_length": 36,
"alnum_prop": 0.6240560949298813,
"repo_name": "gkc1000/pyscf",
"id": "2d1faa9705dbe7ed7997950483bb702e6e9887f7",
"size": "4320",
"binary": f... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0008_merge_20161114_0228'),
]
operations = [
migrations.AlterField(
model_name='volunteer',
name='email',
... | {
"content_hash": "17557cb44c94a9a8e08a9a8a6cc2623b",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 50,
"avg_line_length": 24.928571428571427,
"alnum_prop": 0.5544412607449857,
"repo_name": "jumbocodespring2017/bostonathleticsassociation",
"id": "2b415380261e34d510fb8b47a74... |
from __future__ import absolute_import
import sys
import traceback
import cStringIO
from unittest import suite
from unittest import case
from unittest import runner
import mut
from . import actions
class MpiTestSuite(suite.TestSuite):
_instance = None
def __init__(self, *args, **kwargs):
suite.TestSuite.... | {
"content_hash": "79a4c051fae3bb2da5ab0479fe7ff960",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 141,
"avg_line_length": 36.61635220125786,
"alnum_prop": 0.623497080041223,
"repo_name": "SimplyKnownAsG/mpiunittest",
"id": "7d04c224bc4688c212a2a64c75859c8b0f19b91a",
"s... |
from argparse import ArgumentParser
from multiprocessing import Pool, Manager
from tests import faker
import datetime
import json
import time
import uuid
import sys
import random
INSTANCE_TEMPLATE = { 'uuid':'uuid_replace',
'display_name':'display_name_replace',
'host':'h1',
... | {
"content_hash": "dbc9b52ab07cdf1ffd63b241cb2b8ecd",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 211,
"avg_line_length": 42.4936170212766,
"alnum_prop": 0.5923292609653515,
"repo_name": "StackStorm/search",
"id": "31faf5e6b2b62d3e3bba98937fc463a0b8c50d47",
"size": "99... |
import six
from django.core.exceptions import ObjectDoesNotExist
from django.views import generic
from django.db.models import Q
from django.http import HttpResponseRedirect, Http404
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _... | {
"content_hash": "ff4582b395db29c50ea27b0601d8c602",
"timestamp": "",
"source": "github",
"line_count": 469,
"max_line_length": 79,
"avg_line_length": 36.97867803837953,
"alnum_prop": 0.6193853427895981,
"repo_name": "MrReN/django-oscar",
"id": "c83d6a5c6708b3fcddad01a7e784fd4ba96fc69d",
"size": "1... |
"""Tests for feature_column."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import copy
import numpy as np
from tensorflow.core.example import example_pb2
from tensorflow.core.example import feature_pb2
from tensorflow.core.protobuf... | {
"content_hash": "e166bc713df551ef52d390d2200b1ac3",
"timestamp": "",
"source": "github",
"line_count": 8441,
"max_line_length": 124,
"avg_line_length": 39.32733088496624,
"alnum_prop": 0.6034034015941584,
"repo_name": "ghchinoy/tensorflow",
"id": "1bc43ba7dd43e2baf3dbad520bfc211931b5f544",
"size":... |
from helper import greeting
greeting("BLAHHHHH")
| {
"content_hash": "26a3effa8fb254dcaa31b1dc56bb453c",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 27,
"avg_line_length": 16.666666666666668,
"alnum_prop": 0.8,
"repo_name": "artpomm/cs3240-labdemo",
"id": "cadedea00ecab3c4f0838f32a613244b105328d0",
"size": "50",
"binar... |
"""Base class and functions for compilers"""
from itertools import product
from collections import namedtuple, OrderedDict
from compilertools._utils import import_class, BaseClass
from compilertools._config import CONFIG
from compilertools.processors import get_processor, get_arch
__all__ = ["CompilerBase", "get_compi... | {
"content_hash": "f4a32db172694dcee006a241774af671",
"timestamp": "",
"source": "github",
"line_count": 288,
"max_line_length": 87,
"avg_line_length": 28.256944444444443,
"alnum_prop": 0.5844187761120668,
"repo_name": "JGoutin/compilertools",
"id": "aaa61df4a82ded9033ce24b8d79a15962383a235",
"size"... |
from ripcordclient.common import base
from ripcordclient.common import exception
CREATE_ATTRIBUTES = [
'disabled',
'name',
]
UPDATE_ATTRIBUTES = CREATE_ATTRIBUTES
class Domain(base.Resource):
def __repr__(self):
return '<Domain %s>' % self._info
class DomainManager(base.Manager):
resource... | {
"content_hash": "431865a9870d01af21bd19d0355b7c44",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 65,
"avg_line_length": 24.746268656716417,
"alnum_prop": 0.5922798552472859,
"repo_name": "kickstandproject/python-ripcordclient",
"id": "a8aaad6308b7a5744487bc0628ce51aab5bd... |
__author__ = 'ghost'
import tornado.web
from app.helper import BaseRequestHandler, has_pet_cache, set_pet_cache, BaseApiRequestHandler
from app.helper import get_to_tomorrow
from app.libs import router
from app.models.admin import Award, Banner
from app.models.home import Pet
from settings import logger, rdb
@router... | {
"content_hash": "82f912c9020b15e61f2cc1375d82acab",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 100,
"avg_line_length": 30.240837696335078,
"alnum_prop": 0.5618074792243767,
"repo_name": "rsj217/tongdao",
"id": "6acd4633696a5286aa15d6cdf11a1febc82d67a0",
"size": "620... |
import scrapy
import json
import re
from locations.items import GeojsonPointItem
class CircleKSpider(scrapy.Spider):
name = "circle_k"
allowed_domains = ["www.circlek.com"]
start_urls = (
'https://www.circlek.com/copy_new_stores.php?lat=36.70099&lng=-95.93642399999999&distance=16000&services=',
... | {
"content_hash": "c87ec5a109ae7f796707c16324dc120a",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 115,
"avg_line_length": 33.25,
"alnum_prop": 0.5319548872180451,
"repo_name": "iandees/all-the-places",
"id": "8fed8b6ec3a4d8873897b2997101465a6e6178dc",
"size": "1088",
... |
from mock import MagicMock
import pytest
import f5_cccl.resource.ltm.monitor.http_monitor as target
@pytest.fixture
def http_config():
return {"name": "test_monitor",
"partition": "Test",
"interval": 1,
"timeout": 10,
"send": "GET /\r\n",
"recv": "SERVE... | {
"content_hash": "319d2257a21015051505be117db91554",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 58,
"avg_line_length": 26.164556962025316,
"alnum_prop": 0.6477987421383647,
"repo_name": "f5devcentral/f5-cccl",
"id": "f8e07b98c63b3b49e0c6a1322fa190c0a5eeaeb7",
"size": ... |
"""Test a tflite model using random input data."""
from __future__ import print_function
from absl import flags
import numpy as np
import tensorflow as tf
flags.DEFINE_string('model_path', None, 'Path to model.')
FLAGS = flags.FLAGS
def main(_):
flags.mark_flag_as_required('model_path')
# Load TFLite model an... | {
"content_hash": "b144546d77c2c5e2b17c0be5baaacca0",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 79,
"avg_line_length": 28.86842105263158,
"alnum_prop": 0.7192342752962625,
"repo_name": "alexgorban/models",
"id": "9725541f0f951c85a5d716f911514f31bcf1ea42",
"size": "178... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Link',
fields=[
('id', models.AutoField(auto_create... | {
"content_hash": "246527df30e84d0b0910a73b9e14f2e0",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 161,
"avg_line_length": 40.46875,
"alnum_prop": 0.5606177606177606,
"repo_name": "MeirKriheli/debian.org.il",
"id": "3e362439c8cf3c479d533911d2312910934e4bfc",
"size": "136... |
import unittest
from mock import patch, Mock
from the_ark import picard_client
picard_client_obj = None
class UtilsTestCase(unittest.TestCase):
def setUp(self):
self.picard_client_obj = picard_client.PicardClient()
@patch('requests.post')
def test_send_to_picard(self, requests_post):
r... | {
"content_hash": "b2249ebe47b6b221615863d651125ae3",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 113,
"avg_line_length": 33.44736842105263,
"alnum_prop": 0.5790715971675846,
"repo_name": "meltmedia/the-ark",
"id": "282d3083b7721737ad60092ff741a68dc07b9557",
"size": "12... |
""" CDP tests """
from scapy.packet import Packet
from scapy.all import ShortField, StrField
from scapy.layers.l2 import Dot3, LLC, SNAP
from scapy.contrib.cdp import CDPMsgDeviceID, CDPMsgSoftwareVersion, \
CDPMsgPlatform, CDPMsgPortID, CDPv2_HDR
from framework import VppTestCase
from scapy.all import raw
fr... | {
"content_hash": "ceb42765eada31c98dacfb30f2e874d4",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 77,
"avg_line_length": 28.8953488372093,
"alnum_prop": 0.5637826961770623,
"repo_name": "vpp-dev/vpp",
"id": "1bc67c45c3e3dae89bc28d0a57c79bb15c6436b5",
"size": "4993",
... |
VERSION='1.00'
import os,sys,time
import optparse
from RecoLuminosity.LumiDB import pileupParser
from RecoLuminosity.LumiDB import selectionParser
from RecoLuminosity.LumiDB import csvLumibyLSParser
from math import exp
from math import sqrt
def parseInputFile(inputfilename):
'''
output ({run:[ls:[inlumi, mean... | {
"content_hash": "365ebe72f8444d03f31e093e34ed367a",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 201,
"avg_line_length": 37.01136363636363,
"alnum_prop": 0.553269880257906,
"repo_name": "iamjakob/lumiCalc",
"id": "f6ac3951d98daff181dff50263a01a609de42180",
"size": "65... |
import sys
import os
workload_dir = "/Users/Anderson/GoogleDrive/NOCulator/hring/src/bin/workload_list/"
workload = "homo_8x8"
out_dir = "./results/homo/8x8/design/"
if not os.path.exists(out_dir):
os.makedirs(out_dir)
for sim_index in range(1,31, 1):
out_file = "sim_" + str(sim_index) + ".out"
c... | {
"content_hash": "168b8e3d8758211b94c24693a232a460",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 153,
"avg_line_length": 33.333333333333336,
"alnum_prop": 0.65,
"repo_name": "anderson1008/NOCulator",
"id": "7152ca8824de2d1950b3c066dae22d5cd6d30e69",
"size": "519",
"b... |
"""
Django settings for project project.
Generated by 'django-admin startproject' using Django 1.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
... | {
"content_hash": "dc9ef0c5bc5e6d6900b8d66fe965d80b",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 91,
"avg_line_length": 25.191176470588236,
"alnum_prop": 0.6652072387624052,
"repo_name": "BOOLRon/lovelypic",
"id": "965ef84ab06e70260f27983099c4bbef8c73065f",
"size": "3... |
import xyz
class Ncurses(xyz.Package):
pkg_name = 'ncurses'
def configure(self):
self.host_lib_configure('--with-shared', '--without-cxx-binding', enable_shared=True)
def install(self):
super().install()
self.rmtree('{prefix_dir}', 'man')
self.rmtree('{prefix_dir}', 'share... | {
"content_hash": "32ffbf8d84ecfebdff4618e1c9466ba5",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 93,
"avg_line_length": 26.58823529411765,
"alnum_prop": 0.5951327433628318,
"repo_name": "BreakawayConsulting/xyz",
"id": "eaceed119b871cbddc5fb59bf59e44041ffddbe7",
"size"... |
from collections import OrderedDict
import functools
import re
from typing import (
Dict,
Mapping,
MutableMapping,
MutableSequence,
Optional,
Sequence,
Tuple,
Type,
Union,
)
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.ap... | {
"content_hash": "7a2a5a98ca4c8218cc8ebf40bdd74e76",
"timestamp": "",
"source": "github",
"line_count": 1033,
"max_line_length": 144,
"avg_line_length": 40.43756050338819,
"alnum_prop": 0.607057358996457,
"repo_name": "googleapis/python-bigquery-migration",
"id": "88a4858ddb8f190b60441b16158a18cb4ad8... |
from typing import Dict
from pandas import DataFrame, concat
from lib.data_source import DataSource
from lib.utils import table_rename
from lib.cast import safe_int_cast, numeric_code_as_string
from lib.time import datetime_isoformat
class CataloniaMunicipalitiesDataSource(DataSource):
def parse_dataframes(
... | {
"content_hash": "ae621a30366c3d888d8e0b90d3a72693",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 98,
"avg_line_length": 36.24731182795699,
"alnum_prop": 0.5585879560961139,
"repo_name": "GoogleCloudPlatform/covid-19-open-data",
"id": "9d2059c1ec0b535c75d5dbba961c1359797f... |
"""
CheckiOReferee is a base referee for checking you code.
arguments:
tests -- the dict contains tests in the specific structure.
You can find an example in tests.py.
cover_code -- is a wrapper for the user function and additional operations before give data
in the user func... | {
"content_hash": "0832ca933bcf8bdb22eda84dfa083636",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 102,
"avg_line_length": 46.659574468085104,
"alnum_prop": 0.6999544003647971,
"repo_name": "Bryukh-Checkio-Tasks/checkio-mission-achilles-tortoise",
"id": "3b6b9b2dcaaa71bb87... |
import requests
from django.core.management.base import BaseCommand
from census.models import APISetting
from census.models import CensusInfo
import json
class Command(BaseCommand):
help = 'Imports data from API if not done before'
def handle(self, *args, **options):
calls = APISetting.objects.exclu... | {
"content_hash": "ea8cb3434322b7fa4f9f178554d4f36e",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 111,
"avg_line_length": 37.38095238095238,
"alnum_prop": 0.5929936305732484,
"repo_name": "escobar022/cens_django",
"id": "fe454db88b3553f96d386c0d60ea42bbd047dd6e",
"size"... |
"""mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | {
"content_hash": "4d1451b731b1ef0f5a1988b5dc0a29fe",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 127,
"avg_line_length": 66.87912087912088,
"alnum_prop": 0.6628327308577062,
"repo_name": "rajeshgupta14/pathend",
"id": "2faf59679af175d36c0529fd1ae4df2470a26189",
"size":... |
def abspath(path):
"""Return a normalized absolutized version of the pathname *path*. On most
platforms, this is equivalent to ``normpath(join(os.getcwd(), path))``."""
return ''
altsep = None
def basename(path):
"""Return the base name of pathname *path*. This is the second half of the pair
... | {
"content_hash": "2eeda537f86aa3901958b531726cb8a1",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 89,
"avg_line_length": 44.17307692307692,
"alnum_prop": 0.6579233783195473,
"repo_name": "kmod/icbd",
"id": "09ba102e3b7fdb80a3b36a1b5530d816dfcf1191",
"size": "9219",
"... |
"""Tests that non-HD wallets that are upgraded are able to receive via MWEB"""
import os
import shutil
from test_framework.test_framework import BitcoinTestFramework
from test_framework.ltc_util import create_non_hd_wallet, setup_mweb_chain
from test_framework.util import assert_equal
class MWEBWalletUpgradeTest(Bit... | {
"content_hash": "8c8407a86f61c30f7a051157b030423f",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 104,
"avg_line_length": 34.365591397849464,
"alnum_prop": 0.619837296620776,
"repo_name": "litecoin-project/litecoin",
"id": "2efdadd4cde577e82d86762b9ec91bf750095489",
"si... |
from openerp.tests.common import TransactionCase
class TestUom(TransactionCase):
"""Tests for unit of measure conversion"""
def setUp(self):
super(TestUom, self).setUp()
self.product = self.registry('product.product')
self.uom = self.registry('product.uom')
self.imd = self.regi... | {
"content_hash": "20b5c8c90fe44accce9013c0ef20fc8b",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 102,
"avg_line_length": 41.7027027027027,
"alnum_prop": 0.6079066753078418,
"repo_name": "diogocs1/comps",
"id": "3d3ba04b689a735b401e71c57b265caa44ce2dac",
"size": "1543",... |
"""FMOD python bindings."""
from .fmodex import (get_disk_busy, get_memory_stats, initialize_debugging,
initialize_memory, set_disk_busy)
# Avoid recursive import hell
from . import (channel, channel_group, dsp, dsp_connection, geometry,
globalvars, reverb, sound, sound_group, syst... | {
"content_hash": "863d71c8d4de7c14c2b63e794d978b6a",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 75,
"avg_line_length": 29.363636363636363,
"alnum_prop": 0.7192982456140351,
"repo_name": "tyrylu/pyfmodex",
"id": "4eb62ab6497ad1e893cd06da8d36a8ec79592c8e",
"size": "969"... |
from django.views.generic import TemplateView
from gn_django import utils
from .models import ExampleModel
from gn_django.url import utils as url_utils
from gn_django.video import youtube
class Home(TemplateView):
template_name = "home.j2"
def get_context_data(self):
return {'msg': utils.super_helpe... | {
"content_hash": "21dacee840ed246391a9701ec41cd867",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 62,
"avg_line_length": 26.71698113207547,
"alnum_prop": 0.605225988700565,
"repo_name": "gamernetwork/gn-django",
"id": "f439a74fae51779bfee8b21dfcbdae29ab9e04c1",
"size": ... |
from enum import Enum
from . import general
# Export public API
__all__ = (
'AllenRelation',
'Interval',
)
class AllenRelation(Enum):
"""
The relations of Allen's interval algebra.
https://en.wikipedia.org/wiki/Allen%27s_interval_algebra
"""
# Inverse relations have constants that are... | {
"content_hash": "bbf1578e8cea28133fa1c635ca1bea02",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 97,
"avg_line_length": 31.16417910447761,
"alnum_prop": 0.5254629629629629,
"repo_name": "afbarnard/esal",
"id": "0155a596647ef010e97640179379e6f821e2b2d3",
"size": "12728... |
import Gaffer
import GafferImage
Gaffer.Metadata.registerNode(
GafferImage.ImageContextVariables,
"description",
"""
Defines variables which can be referenced by upstream expressions.
""",
plugs = {
"variables" : [
"description",
"""
The variables to be defined - arbitrary numbers of variables
... | {
"content_hash": "39a51932e337ab921144b381b88c84af",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 67,
"avg_line_length": 13.37037037037037,
"alnum_prop": 0.6759002770083102,
"repo_name": "goddardl/gaffer",
"id": "739c67fe5b9c0ce15f67a95c3725b9faec194c5d",
"size": "2164"... |
import copy
import datetime
import httplib
import eventlet
from oslo.config import cfg
from neutron import context as ctx
from neutron.extensions import portbindings
from neutron.openstack.common import excutils
from neutron.openstack.common import log
from neutron.openstack.common import timeutils
from neutron.plugi... | {
"content_hash": "565c322f81068f78ce19771c6c4715f5",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 78,
"avg_line_length": 41.69109947643979,
"alnum_prop": 0.5970111766922014,
"repo_name": "jumpstarter-io/neutron",
"id": "dc8c12c33974e233d3e9d84386539cf4bf474ec8",
"size"... |
import inspect
import importlib
from os import path, walk
__all__ = ["ALL_AGENTS"]
#
# All Agents TABLE
ALL_AGENTS = {}
MODULES = {}
for root, dirs, files in walk("agents_dir"):
for file_ in files:
name, ext = path.splitext(file_)
if ext == ".py" and name != "agents":
MODULES[name] =... | {
"content_hash": "710dc60f7d0efe7edd1eff992fc4a92d",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 75,
"avg_line_length": 29.217391304347824,
"alnum_prop": 0.5565476190476191,
"repo_name": "valefranz/AI-Project-VacuumEnvironment",
"id": "5862fe8d15b2c49bc075411d84b292b0cd2... |
"""
Check sum
"""
# Standard library modules.
from collections import namedtuple
import hashlib
# Third party modules.
# Local modules.
# Globals and constants variables.
CHECKSUM_ALGORITHM_SHA1 = 'SHA-1'
CHECKSUM_ALGORITHM_SUM32 = 'SUM32'
class Checksum(namedtuple('Checksum', ['value', 'algorithm'])):
def _... | {
"content_hash": "fa98b0648ee30d7a76ab52b084bf2eb5",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 75,
"avg_line_length": 27.755102040816325,
"alnum_prop": 0.6720588235294118,
"repo_name": "pyhmsa/pyhmsa",
"id": "e5e3e9832d184a6f1bd17a2cc6b6e06f2bbb54d2",
"size": "1360",... |
from .request import make_request
from flask_paginate import Pagination
PER_PAGE = 9
def paginate(arr, page, offset):
if page < 0:
page = 1
start = (page - 1) * offset
end = start + offset
if len(arr) < end:
end = len(arr) - 1
return arr[start:end]
def paginate_data(req_type, or... | {
"content_hash": "8a2485160c0414541d9a6d6b4e996069",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 55,
"avg_line_length": 23.444444444444443,
"alnum_prop": 0.5260663507109005,
"repo_name": "alexraileanu/worldcup",
"id": "2460de0c970e9bfefb5e8156da178f86d432a01d",
"size":... |
from functools import partial
import inspect
class KVNest(str):
"""A subclass of str that allows namespacing keys for use in redis as well as provide partial methods into redis."""
def __new__(cls,*args,**kwargs):
"""Override's str's __new__ so we can store the redis connection if one is provided"""
if 'connect... | {
"content_hash": "f66ae9de089b62eab7a1bce9dc65a258",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 117,
"avg_line_length": 34.206896551724135,
"alnum_prop": 0.7006048387096774,
"repo_name": "anateus/kvnest",
"id": "4bbad6e9561d14be18c4e0a0e7f849fca29f5d17",
"size": "992"... |
import sys
import os
import re
import time
import threading
from Xlib import X, XK, display, error
from Xlib.ext import record
from Xlib.protocol import rq
from Xlib.protocol.event import KeyPress
from Xlib.protocol.event import KeyRelease
#######################################################################
######... | {
"content_hash": "3d7e7f6d335202d936c05d871d1fe5b5",
"timestamp": "",
"source": "github",
"line_count": 439,
"max_line_length": 346,
"avg_line_length": 41.489749430523915,
"alnum_prop": 0.5561106840891622,
"repo_name": "AoiKuiyuyou/AoikHotkey",
"id": "9ec65e0a63f716e3177927b5b7abf453bd38a738",
"siz... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 7, transform = "Difference", sigma = 0.0, exog_count = 20, ar_order = 12); | {
"content_hash": "2ba6c71f122c78669190cd3524395ca8",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 170,
"avg_line_length": 38.57142857142857,
"alnum_prop": 0.7111111111111111,
"repo_name": "antoinecarme/pyaf",
"id": "040690de2bffb7a1dae352ec784af887814a6cd1",
"size": "270... |
import bst
def size(node):
if node is None:
return 0
else:
return node.size
def update_size(node):
node.size = size(node.left) + size(node.right) + 1
class BST(bst.BST):
"""
Simple binary search tree implementation, augmented with subtree sizes.
This BST supports insert, find, and del... | {
"content_hash": "3cef5c4daf6fd1f38a97396632121e72",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 77,
"avg_line_length": 26.404761904761905,
"alnum_prop": 0.6095581605049594,
"repo_name": "luoshao23/ML_algorithm",
"id": "7f40f1799a8b87cd64aa031801855967db2e6f0b",
"size"... |
class Queue:
def __init__(self):
self._items = []
self._index = -1
def enqueue(self, element):
if element is None:
raise TypeError("Element cannot be of type None")
self._items.append(element)
def dequeue(self):
if self.is_empty():
raise Emp... | {
"content_hash": "b2c6a4f8f9ee2eaaec29b8eb198c0b07",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 65,
"avg_line_length": 23,
"alnum_prop": 0.5621840242669363,
"repo_name": "vilisimo/ads",
"id": "421a5724c2c24e15f0c171e9b0904e441e275878",
"size": "989",
"binary": false... |
from mrjob.job import MRJob
from mrjob.step import MRStep
# Task, list all the bigrams in the shakespeare.txt
# file, and the number of occurences
# This could be done without overriding "steps"
class MRmulti(MRJob):
def mapper_get_bigrams(self, key, line):
n = 0
for word in line.split():
... | {
"content_hash": "deddaea227f5874268f69786447ee8c2",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 56,
"avg_line_length": 25.133333333333333,
"alnum_prop": 0.5888594164456233,
"repo_name": "North-Guard/BigToolsComplicatedData",
"id": "789287c2fd609dbedb5f80fb2eef1dc6c4aa1b... |
from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import (ascii, bytes, chr, dict, filter, hex, input, int, map, next, oct, open, pow, range, round, str,
super, zip)
# standard lib imports
try:
from collections.abc import Sequence
except Import... | {
"content_hash": "ff5daef603110a04282b0b3a60550520",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 117,
"avg_line_length": 30.742857142857144,
"alnum_prop": 0.6933085501858736,
"repo_name": "DavidWhittingham/agsadmin",
"id": "0773e04534f82f7ad0f061b4df768f771a685563",
"s... |
"""
Take an output file from the Cannon, and produce a scatter plot of coloured points, with label values on the two axes
and the colour of the points representing the SNR needed to attain some required level of accuracy in a third label.
"""
import argparse
import gzip
import json
import os
import re
import sys
impo... | {
"content_hash": "2ee0035eeb9238320bc5b763670b11dd",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 117,
"avg_line_length": 45.85279187817259,
"alnum_prop": 0.6321266467397321,
"repo_name": "dcf21/4most-4gp-scripts",
"id": "5429fb56608c9c26ae0c0309fef89957b2ad47c1",
"siz... |
import re
import unicodedata
def load_yaml(filename):
"""
Reads any yaml file and returns it as object.
"""
import yaml
stream = file(filename)
return yaml.load(stream)
debug=False
def compare_rules(x,y):
"""
Compares parser rules and sees which has more tokens or conditions (prev, ne... | {
"content_hash": "5af1829c0667b9d14a561a00b1b07dc3",
"timestamp": "",
"source": "github",
"line_count": 327,
"max_line_length": 121,
"avg_line_length": 38.26299694189603,
"alnum_prop": 0.4824968030690537,
"repo_name": "seanpue/graphparser",
"id": "9b4a30e787042467e6d5f0efbca0afb0d5a4ed58",
"size": ... |
import boto3.session
from tests import unittest
class TestSession(unittest.TestCase):
def setUp(self):
self.session = boto3.session.Session(region_name='us-west-2')
def test_events_attribute(self):
# Create some function to register.
def my_handler(my_list, **kwargs):
retu... | {
"content_hash": "4d52170b79b36a9051bc3ad2273a012e",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 69,
"avg_line_length": 34.285714285714285,
"alnum_prop": 0.6575,
"repo_name": "boto/boto3",
"id": "65c28b174305b4d3b4039da7e3f2e57252d70c58",
"size": "1762",
"binary": fa... |
from __future__ import unicode_literals, absolute_import
import os
import os.path
from django.utils import six
from whoosh import filedb
from whoosh.qparser import MultifieldParser
from whoosh.writing import AsyncWriter
from .. import base
from .. import utils
from .. import exceptions
from .. import connections
fr... | {
"content_hash": "6e41a4a3b331143c2e16758a0a1251ff",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 83,
"avg_line_length": 33.01123595505618,
"alnum_prop": 0.6310415248468346,
"repo_name": "niwinz/needlestack",
"id": "d25e8c2f08f11ee0a855f55706d35a6a174c601d",
"size": "29... |
"""Create Common Workflow Language (CWL) runnable files and tools from a world object.
"""
import copy
import json
import operator
import os
import toolz as tz
import yaml
from bcbio import utils
def from_world(world, run_info_file):
base = utils.splitext_plus(os.path.basename(run_info_file))[0]
out_dir = ut... | {
"content_hash": "e1f209dfad0d867c7f7683e04f487e26",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 111,
"avg_line_length": 41.564245810055866,
"alnum_prop": 0.5701612903225807,
"repo_name": "lpantano/bcbio-nextgen",
"id": "f457423a3c35adf6b91a31f8375459381a6089d4",
"siz... |
#
# Copyright 2009 Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | {
"content_hash": "1d23f31036bef4ff16d115bc2830e02b",
"timestamp": "",
"source": "github",
"line_count": 3394,
"max_line_length": 119,
"avg_line_length": 39.35209192692987,
"alnum_prop": 0.6040835273770038,
"repo_name": "hhru/tornado",
"id": "6760b0b9a166c79ccbbbf9abe1c0c7994bdd4384",
"size": "13356... |
from PyQt5 import QtCore, QtGui, QtWidgets
import sys
class window(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
self.dirModel = QtWidgets.QFileSystemModel(self)
self.dirModel.setRootPath('/home/urban/Muzyka')
self.folderTreeView = QtWidgets.QTreeView()
se... | {
"content_hash": "b39743a5947d7fb47883f94e8bf71600",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 56,
"avg_line_length": 30.857142857142858,
"alnum_prop": 0.6805555555555556,
"repo_name": "urbansan/mediaFolderGrabber",
"id": "ac9b5b2264891cf1928562212b2e56ad77430cbc",
"... |
print("Hello world")
print("Hello Again")
print("I like type this.")
print("This is fun")
print('Yay! Printing')
print("I'd much rather you 'not'.")
print('I "said" do not touch this')
print('妳好,我是Python!')
print('這是我的練習題')
print('下面要加上#的註釋')
# This is pound
# This is hash
# This is mesh
| {
"content_hash": "28bafe9bc201abfa681f8b94e9bdaaf9",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 35,
"avg_line_length": 22.23076923076923,
"alnum_prop": 0.6782006920415224,
"repo_name": "wangzongyuan/LPTHW",
"id": "60946a90992556421c4aa0883078cef955f483ce",
"size": "34... |
'''Simple decorator for dealing with typed query parameters.'''
from __future__ import (absolute_import, division, print_function,
with_statement)
from schematics.exceptions import ConversionError, ValidationError
import supercell.api as s
class QueryParams(s.Middleware):
"""Simple middl... | {
"content_hash": "199a6cea883cdee97619681fb92a3bed",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 76,
"avg_line_length": 31.45205479452055,
"alnum_prop": 0.5405052264808362,
"repo_name": "tobigue/supercell",
"id": "c45029e1a82b9dfa752b5347ff81dd71e34f145e",
"size": "294... |
import arcpy
import os
import sys
import traceback
import TestUtilities
def RunTest():
try:
arcpy.AddMessage("Starting Test: CreateCIBMosaicDataset")
toolbox = TestUtilities.toolbox
arcpy.ImportToolbox(toolbox, "DefenseImagery")
arcpy.env.overwriteOutput = True
#... | {
"content_hash": "afc8488627f124e3bbb9752b1a2ac15e",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 105,
"avg_line_length": 33.5921052631579,
"alnum_prop": 0.5808852330591461,
"repo_name": "JudTown17/solutions-geoprocessing-toolbox",
"id": "83e04574ae16ff7bdafc5a99696d555f1... |
from capabilities.capability import capability
import subprocess # used for bash commands (when required), unix-only
from pipes import quote # used to sanitize bash input when complex commands are required, unix-only
class tasks(capability):
# goes to the folder, gets the first commit, and filters out the date
... | {
"content_hash": "16b7afd128e8163bb5fda8f8fa25e4e0",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 104,
"avg_line_length": 44.714285714285715,
"alnum_prop": 0.6509584664536742,
"repo_name": "Nateowami/flex-languagedepot-metadata",
"id": "acccf71dbbfc8fa9dcc34ab765525edde9c... |
import sure
from django.test import TestCase
from tasks.const import STATUS_SUCCESS, STATUS_FAILED
from ..jslint import jslint_violation
from .base import get_content
class JSlintViolationCase(TestCase):
"""JSlint violation case"""
def test_success(self):
"""Test success result"""
data = {'ra... | {
"content_hash": "edd72293c5f27c8cc23c48596a67b3a3",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 56,
"avg_line_length": 30.76,
"alnum_prop": 0.6254876462938882,
"repo_name": "nvbn/coviolations_web",
"id": "7a91e464db6093152eb678925a42e98242173602",
"size": "769",
"bi... |
import logging
import json
from unittest import mock
from django.test import TestCase, tag
from django.contrib.auth.models import User
from django.urls import reverse
from django.conf import settings
from rest_framework import status
from uploadedfiles.models import UploadedFile
from users.serializers import SwiftMa... | {
"content_hash": "6b94b42fad8a6b875e32cf9aabbf9e3e",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 85,
"avg_line_length": 43.792857142857144,
"alnum_prop": 0.6059370412656989,
"repo_name": "FNNDSC/ChRIS_ultron_backEnd",
"id": "57338cca7d6e015945d1c6eec3fc2f52aaea7263",
... |
import random
from rally.common import logging
from rally import consts
from rally import exceptions
from rally.plugins.openstack import scenario
from rally.plugins.openstack.scenarios.cinder import utils as cinder_utils
from rally.plugins.openstack.scenarios.glance import utils as glance_utils
from rally.plugins.open... | {
"content_hash": "2eb4bedc8d3a77062ff9423d4f3ea94d",
"timestamp": "",
"source": "github",
"line_count": 569,
"max_line_length": 79,
"avg_line_length": 45.63444639718805,
"alnum_prop": 0.6007471308634368,
"repo_name": "eayunstack/rally",
"id": "8c5cec5df1132aa2a84f261b1b840686d0cee737",
"size": "266... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: bigip_profile_udp
short_description: Manage UDP profiles on a BIG-IP
description:
- Manage UDP profiles on a BIG-IP system. There are many UDP profiles, each with their
own adjustments to the st... | {
"content_hash": "47de8ea99c8a813c6239849117b4c56f",
"timestamp": "",
"source": "github",
"line_count": 457,
"max_line_length": 94,
"avg_line_length": 30.317286652078774,
"alnum_prop": 0.592638036809816,
"repo_name": "F5Networks/f5-ansible-modules",
"id": "f9388364e19946671c96440919c07edcc4868fb8",
... |
class AngrError(Exception):
pass
class AngrValueError(AngrError, ValueError):
pass
class AngrLifterError(AngrError):
pass
class AngrExitError(AngrError):
pass
class AngrPathError(AngrError):
pass
class AngrVaultError(AngrError):
pass
class PathUnreachableError(AngrPathError):
pass
cla... | {
"content_hash": "68121cea94d08b5774e1e5e3e87f02d4",
"timestamp": "",
"source": "github",
"line_count": 443,
"max_line_length": 114,
"avg_line_length": 17.002257336343114,
"alnum_prop": 0.7404407859798194,
"repo_name": "schieb/angr",
"id": "cf8c2c3d1dc06296be1b808cae46b1d261199d82",
"size": "7532",... |
import math
class ClickerState:
'''
simple class to keep track of the game state
'''
def __init__(self):
self._current_amount_of_cookies = 0.0
self._current_time = 0.0
self._current_cps = 2.0
def get_cps(self):
'''
get current CPS, returns it as a float... | {
"content_hash": "4d9d9917c6096171e9be06b207794feb",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 96,
"avg_line_length": 33.72666666666667,
"alnum_prop": 0.5680964617513342,
"repo_name": "chubbypanda/google-code-jam",
"id": "cdfece76098a79b46f0a99f0aaf8c3ad36efbcc8",
"... |
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at you... | {
"content_hash": "257cd2656dc91f4f7dc15202fecad708",
"timestamp": "",
"source": "github",
"line_count": 601,
"max_line_length": 147,
"avg_line_length": 36.63394342762063,
"alnum_prop": 0.44483807966571287,
"repo_name": "thaim/ansible",
"id": "2273abb8c1cf76cd80f08f590ddeac72273e33bc",
"size": "2203... |
import pytest
from django.test import TestCase, RequestFactory
from django.core.urlresolvers import reverse
from django.conf import settings
from wagtail.wagtailcore.models import Site
from molo.core.models import (
SiteLanguageRelation, Main, Languages, SiteSettings)
from molo.core.tests.base import MoloTestCase... | {
"content_hash": "36be245fa5ef4ec84b135a347ad513f8",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 79,
"avg_line_length": 42.175925925925924,
"alnum_prop": 0.5835345773874863,
"repo_name": "Mitso/springstertestapp",
"id": "bf3ae6e7039172d98855eb7cacd45b7bcbb41c0c",
"siz... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("users", "0051_userprofile_proxy_notification_sent")]
operations = [
migrations.AddField(
model_name="editor",
name="ignore_wp_blocks",
... | {
"content_hash": "c0d30e15025fd17771428729be8c5222",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 127,
"avg_line_length": 34.17094017094017,
"alnum_prop": 0.5027513756878439,
"repo_name": "WikipediaLibrary/TWLight",
"id": "491b1b3b177a539a44201308c4603bc0b7bfdc66",
"si... |
from pprint import pprint
import urllib
import urllib2
import xml.etree.cElementTree as ElementTree
import xmldict
import ApplicationHelper
import plot
import numpy as np
#Zillow API Functions & URLs
zillow_zws_id = 'X1-ZWz1b9iilf4xe3_90hcq'
zillow_api = {'CalculateAdjustableMortgage': 'http://www.zillow.com/webservice... | {
"content_hash": "4135c21b719941d3d2673faf272c6c2d",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 152,
"avg_line_length": 56.04761904761905,
"alnum_prop": 0.7563296516567545,
"repo_name": "tspires/personal",
"id": "383b83cd576f596bf2e87e7d8db9f3b04ee4595c",
"size": "59... |
"""Security_Label TQL Filter"""
# standard library
from enum import Enum
# first-party
from tcex.api.tc.v3.api_endpoints import ApiEndpoints
from tcex.api.tc.v3.filter_abc import FilterABC
from tcex.api.tc.v3.tql.tql import Tql
from tcex.api.tc.v3.tql.tql_operator import TqlOperator
from tcex.api.tc.v3.tql.tql_type im... | {
"content_hash": "55869a2d3c33700f24478912272ab913",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 99,
"avg_line_length": 37.55625,
"alnum_prop": 0.6343817606922949,
"repo_name": "ThreatConnect-Inc/tcex",
"id": "f97018f4da57340b507cd48654955f48a0cd79f9",
"size": "6009",... |
import tensorflow as tf
import numpy as np
print "Simple TensorFlow example }:->"
print ""
matrix1 = tf.constant([[3., 3.]])
matrix2 = tf.constant([[2.], [2.]])
matrixProduct = tf.matmul(matrix1, matrix2)
# y = x^2 + 2x + 1
x = tf.placeholder(tf.float32, shape=[1])
formulaProduct = tf.Variable(x*x + x*2 + 1)
with t... | {
"content_hash": "092572436099cb609a02eca5ed87be1d",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 72,
"avg_line_length": 27.884615384615383,
"alnum_prop": 0.6386206896551724,
"repo_name": "chupakabr/lottery-guesser",
"id": "fe53bb879167e3a5ba1f1bf0bf7ac20c46f02437",
"si... |
"""
django-colortools
~~~~~~
`django-colortools <http://www.github.com/neubloc/django-colortools>`
:copyright: 2010 by David Cramer, 2011 by Neubloc, LLC.
"""
__all__ = ('__version__', '__build__', '__docformat__', 'get_revision')
__version__ = (0, 3, 3)
__docformat__ = 'restructuredtext en'
import os
def _get_git... | {
"content_hash": "9c7b2896e14f7c433dc9909f3e2eb7fd",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 72,
"avg_line_length": 25.681818181818183,
"alnum_prop": 0.6053097345132743,
"repo_name": "neubloc/django-colortools",
"id": "29abca37d60c7eb8b4ce884a58b6b1d1f5417a40",
"si... |
import sys
import json
import bm_json
import tabulate
import argparse
from scipy import stats
import subprocess
import multiprocessing
import collections
import pipes
import os
sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '..', '..', 'run_tests', 'python_utils'))
import comment_on_pr
import jobset
import ... | {
"content_hash": "feb0eea834d90c1997e6c9a158438565",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 105,
"avg_line_length": 30.80365296803653,
"alnum_prop": 0.597687518529499,
"repo_name": "philcleveland/grpc",
"id": "09b62ae1c9067d9b40a933269af3f04d82c846ee",
"size": "8... |
import pytest
from funcy import merge
from firebase import firebase as f
from django.conf import settings
from firestone import fb_url, get_job as fjob, merge_ids, patch_job as pj, put_job
from firestone.models import apply_for_job
@pytest.fixture
def fire_app(test_firebase):
fauth = f.FirebaseAuthentication(setti... | {
"content_hash": "ad6b8037ee9ac79b4bbf41879e247332",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 110,
"avg_line_length": 23.042857142857144,
"alnum_prop": 0.6553006819590824,
"repo_name": "popara/jonny-api",
"id": "94cc84ce17f57ce636ded42651a6eb5d2dcfbfa3",
"size": "16... |
import scrapy
class WebcrawlerItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
| {
"content_hash": "5cec24e139ea0a7ebc5af5254b84162c",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 48,
"avg_line_length": 19.571428571428573,
"alnum_prop": 0.6861313868613139,
"repo_name": "NeX-Studio/DFB-Data-Mining",
"id": "8bd86d11ca9f044e6792ec22dbe0e82f64b5c4b0",
"si... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
# -- General configuration... | {
"content_hash": "0f60c73797427296c9f7e6fc32bca207",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 80,
"avg_line_length": 32.425414364640886,
"alnum_prop": 0.7093201567558357,
"repo_name": "unbracketed/pymetro",
"id": "cacba6a3621453c3f08635f041aaf0e1bb8648c1",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.