text stringlengths 4 1.02M | meta dict |
|---|---|
import unittest
from whitepy.stack import Stack
class TestStack(unittest.TestCase):
def test_isempty(self):
stack = Stack()
assert stack.isempty() is True
def test_push(self):
stack = Stack()
stack.push(True)
assert stack[-1]
def test_duplicate_empty(self):
... | {
"content_hash": "a0a4ae58710874fd475f8c774ffc2bb1",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 52,
"avg_line_length": 25.43243243243243,
"alnum_prop": 0.5520722635494155,
"repo_name": "yasn77/whitepy",
"id": "04f5de5a7172600d8c944e88e73d2f1294619c12",
"size": "1882",... |
from google.cloud import translate_v3
def sample_get_supported_languages():
# Create a client
client = translate_v3.TranslationServiceClient()
# Initialize request argument(s)
request = translate_v3.GetSupportedLanguagesRequest(
parent="parent_value",
)
# Make the request
respons... | {
"content_hash": "0510bd88a821280e2c137472190b1c8f",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 76,
"avg_line_length": 26.157894736842106,
"alnum_prop": 0.7323943661971831,
"repo_name": "googleapis/python-translate",
"id": "f3bd0209d301eb46898c70e67ead1167a83946a2",
"... |
"""Reads iPhoto library info, and exports photos and movies."""
# Copyright 2010 Google Inc.
#
# 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/LI... | {
"content_hash": "05e8a3fbe94a47a7a704d70278d530e9",
"timestamp": "",
"source": "github",
"line_count": 990,
"max_line_length": 99,
"avg_line_length": 44.481818181818184,
"alnum_prop": 0.555237641074551,
"repo_name": "benwaa/iPhotoCloudSync",
"id": "2f4a6ada30d291ffd614f93e1dad084429690be2",
"size"... |
"""MetricWriter for Pytorch summary files.
Use this writer for the Pytorch-based code.
"""
from typing import Any, Mapping, Optional
from absl import logging
from clu.metric_writers import interface
from torch.utils import tensorboard
Array = interface.Array
Scalar = interface.Scalar
class TorchTensorboardWrite... | {
"content_hash": "c4b566181b70be44cb67058445bb54f0",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 77,
"avg_line_length": 31.410958904109588,
"alnum_prop": 0.6589620584387266,
"repo_name": "google/CommonLoopUtils",
"id": "74c02c501b351f7ba6212a07fdf68a5c4a2ea396",
"size"... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import re
from collections import OrderedDict
from pants.build_graph.address import BuildFileAddress
from pants.engine.objects import Serializable
from pants.util.mem... | {
"content_hash": "f73e9cd4f7d28f6709d1c50ffc00e5bc",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 106,
"avg_line_length": 40.19512195121951,
"alnum_prop": 0.6605582524271845,
"repo_name": "UnrememberMe/pants",
"id": "f5c406a3fcc3dc296c7b44504f561366e76cce89",
"size": "... |
import shutil
import tempfile
import unittest
from unittest import mock
from mobly import signals
from mobly.base_instrumentation_test import _InstrumentationBlock
from mobly.base_instrumentation_test import _InstrumentationKnownStatusKeys
from mobly.base_instrumentation_test import _InstrumentationStructurePrefixes
f... | {
"content_hash": "1c7442e55db57306a2357cc5c4a70767",
"timestamp": "",
"source": "github",
"line_count": 1046,
"max_line_length": 141,
"avg_line_length": 49.68642447418738,
"alnum_prop": 0.7684522435157393,
"repo_name": "google/mobly",
"id": "c336b90d7b2a0bed1ffa2fd45ddd7ad069a267f4",
"size": "52548... |
"""
WSGI config for airquality project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "airquality.settings")
from django.... | {
"content_hash": "ed3af4168f554a3705176ec9f41671b5",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 78,
"avg_line_length": 28.214285714285715,
"alnum_prop": 0.7772151898734178,
"repo_name": "clairityproject/backend",
"id": "1b9853314b309b9526c143044a1343c84000f9ba",
"size... |
""":mod:`dodotable.helper` --- helper
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from .condition import SelectFilter
from .schema import Queryable, Renderable, Schema
from .util import camel_to_underscore
__all__ = '_Helper', 'Limit', 'Category',
class _Helper(Schema):
pass
class Limit(_Helper, Renderable, Qu... | {
"content_hash": "9833f9d2674821541adafbb015ede216",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 75,
"avg_line_length": 25.089285714285715,
"alnum_prop": 0.5893238434163701,
"repo_name": "spoqa/dodotable",
"id": "750a3d5617164c3a7a801a62c71e911d6bc74f98",
"size": "1537... |
import os
import logging
import sys
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
def auth_with... | {
"content_hash": "aa36a30e33c95df0b820216b5b6a84c0",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 104,
"avg_line_length": 38.734693877551024,
"alnum_prop": 0.6538461538461539,
"repo_name": "andrewramsay/ical_to_gcal_sync",
"id": "b15ddb11d104e90a02830c5bb4e59c2feb584303",... |
from pythonwrap import logger as clog
from pythonwrap import log_level
TRACE = 0
DEBUG = 1
INFO = 2
WARNING = 3
ERROR = 4
CRITICAL = 5
class Logging(object):
def __init__(self, section):
self.section = section;
def log(self, level, fmt, *args):
if (level < log_level()):
return
msg = fmt
if... | {
"content_hash": "44fe5e929bac835d3c45d14523ece61b",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 39,
"avg_line_length": 19.372093023255815,
"alnum_prop": 0.6218487394957983,
"repo_name": "oftc/oftc-ircd",
"id": "5962cabbfee48d410595ce19bf85d9f1ddffba7a",
"size": "833",... |
from __future__ import annotations
import datetime
from functools import partial
from textwrap import dedent
from typing import TYPE_CHECKING
import warnings
import numpy as np
from pandas._libs.tslibs import Timedelta
import pandas._libs.window.aggregations as window_aggregations
from pandas._typing import (
Ax... | {
"content_hash": "6f5deb342a9562f798ccd158dbedeee8",
"timestamp": "",
"source": "github",
"line_count": 905,
"max_line_length": 88,
"avg_line_length": 33.92707182320442,
"alnum_prop": 0.5495375195414278,
"repo_name": "rs2/pandas",
"id": "79102c2bc82ee8de6791feaff1cb7d769cd3d47a",
"size": "30704",
... |
import io
import unittest
from unittest.mock import patch
from kattis import k_pseudoprime
###############################################################################
class SampleInput(unittest.TestCase):
'''Problem statement sample inputs and outputs'''
def test_sample_input(self):
'''Run and as... | {
"content_hash": "0eed29356216c59990333dae1155f48f",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 79,
"avg_line_length": 31.48780487804878,
"alnum_prop": 0.5042602633617351,
"repo_name": "ivanlyon/exercises",
"id": "806f743f8df9bf3f31037d491da8da7abb7ef3a3",
"size": "12... |
import os, sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "drftest.settings")
# Add the lib/ directory to the system path
sys.path.append("lib")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "d4f914c54c3f8e367f963be2056875f7",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 71,
"avg_line_length": 29.7,
"alnum_prop": 0.6902356902356902,
"repo_name": "jinto/drftest",
"id": "ee12edaa9590983bb5883fef5102cfbb44272228",
"size": "319",
"binary": fa... |
import sys, argparse, re
connection_time_regex = re.compile(r"^DATM\t.*sender\t(\d+)\tconnection_time_(\d+)_(\d+)\t\d+\t\d+\t(\d+)")
bytes_sent_regex = re.compile(r"^DATM\t.*sender\t(\d+)\ttotal_bytes_sent_(\d+)_(\d+)\t(\d+)")
def build_nested_dict(data_dict, sender, flow):
if sender not in data_dict:
dat... | {
"content_hash": "0c0435e0794811cf6cc23d667a97c425",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 107,
"avg_line_length": 36.14655172413793,
"alnum_prop": 0.5401860243262581,
"repo_name": "TritonNetworking/themis_tritonsort",
"id": "43169417026304c6ab79617ebd0f7bcce464c7... |
import os
import ast
import logging
try:
from django.core.exceptions import ImproperlyConfigured
except ImportError:
class ImproperlyConfigured(Exception):
pass
def envar(key, ktype, default=None, verbose=False):
"""Looks for ENVIRONMENT VARIABLE named `key`;
returns the value after coercing ... | {
"content_hash": "9d9d78f8c5c9db6231e1690ebdc0faaa",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 126,
"avg_line_length": 32.74193548387097,
"alnum_prop": 0.6320197044334975,
"repo_name": "hiway/envar",
"id": "f86a86d2e1bda339ae28298a0437a1c282ead883",
"size": "2030",
... |
"""
Functions for dealing with markup text
"""
import re
import six
from six import moves
from w3lib.util import str_to_unicode, unicode_to_str
from w3lib.url import safe_url_string
_ent_re = re.compile(r'&(#?(x?))([^&;\s]+);')
_tag_re = re.compile(r'<[a-zA-Z\/!].*?>', re.DOTALL)
_baseurl_re = re.compile(six.u(r'<ba... | {
"content_hash": "0dd28f002caa541ce262b215e20679e8",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 188,
"avg_line_length": 37.50239234449761,
"alnum_prop": 0.6074253636131666,
"repo_name": "nzavagli/UnrealPy",
"id": "f347b4be90c217d5d65b89be5d5c151fc9bd725f",
"size": "7... |
"""Synthesize a federated dataset from MNIST-like datasets."""
import functools
from typing import Mapping, Optional, Tuple
import tensorflow as tf
import tensorflow_datasets as tfds
import tensorflow_federated as tff
from generalization.synthesization import dirichlet
from generalization.synthesization import gmm_e... | {
"content_hash": "43c0d1b56f3dda498b4ac631ffb1ed6b",
"timestamp": "",
"source": "github",
"line_count": 209,
"max_line_length": 88,
"avg_line_length": 42.856459330143544,
"alnum_prop": 0.6976666294518253,
"repo_name": "google-research/federated",
"id": "af65a2b5b78a882700964123964b2219ae82cc38",
"s... |
from autobahn.twisted import wamp
class IVRouterSession(wamp.RouterSession):
pass
| {
"content_hash": "55c48c8a6fa0b8dd3a031eac74ee01d4",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 42,
"avg_line_length": 21.5,
"alnum_prop": 0.813953488372093,
"repo_name": "donghaoren/iVisDesigner",
"id": "bdacc34cb1a34633ddfad5a6146e793e953fc118",
"size": "86",
"bina... |
""" Test the drop_from_u_dir functionality. """
import os
import sys
import time
import unittest
from binascii import hexlify
import hashlib
from rnglib import SimpleRNG
from nlhtree import NLHTree, NLHLeaf
from xlattice import HashTypes
from xlu import UDir, DirStruc
if sys.version_info < (3, 6):
# pylint: disa... | {
"content_hash": "b1c75322dfeecef5d966e5b2067b4059",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 79,
"avg_line_length": 34.340425531914896,
"alnum_prop": 0.5548946716232962,
"repo_name": "jddixon/nlhtree_py",
"id": "3325725d74ad1761653e25183d4c8f505eab7ea1",
"size": "... |
"""
Created on Dec 24, 2016
@author: john papa
Copyright 2016 John Papa. All rights reserved.
This work is licensed under the MIT License.
"""
import logging
from .hand import Hand
from .bet import Bet
class BjHand(Hand):
""" This is a class for Hands used in the game of Blackjack.
Hands from this class ... | {
"content_hash": "27acdcb62c169e7dfdab7853f190185b",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 87,
"avg_line_length": 27.92753623188406,
"alnum_prop": 0.5526725480020758,
"repo_name": "johnpapa2/twenty-one",
"id": "c458cf44c64dcd057c56532eec102c4207d33e11",
"size": "... |
import argparse
def common_parser(description='untitled'):
parser = argparse.ArgumentParser(
description=description,
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
'-a',
'--auto',
help='auto-detect',
action='store_t... | {
"content_hash": "df71c04deba792a3b966fc2e039546c5",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 77,
"avg_line_length": 24.387755102040817,
"alnum_prop": 0.5882845188284519,
"repo_name": "WrathOfChris/elb-rotate-certs",
"id": "2f645725990dbd2a5e84c999b64444326ae68931",
... |
from .checksum import Checksum
__all__ = ["Checksum"]
| {
"content_hash": "80cd2dd32a6328543dc722d5bf890a0f",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 30,
"avg_line_length": 18.333333333333332,
"alnum_prop": 0.6727272727272727,
"repo_name": "blockbuster/mpxapi",
"id": "dcbc0d1e20ace76c6878493ddafdf03775a3a756",
"size": "55... |
"""
IO utilities for the files associated with the BPA co-funded project:
TIP 304: Predicting the Hydrologic Response of the Columbia River System to
Climate Change
Import and export file formats as required by the project. Provide the data to
the rest of bmorph as pandas.Series.
"""
import pandas as pd
impo... | {
"content_hash": "9abc5f62ccf5d205d55512837145e33c",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 166,
"avg_line_length": 32.57222222222222,
"alnum_prop": 0.6135084427767354,
"repo_name": "UW-Hydro/bmorph",
"id": "300a42076416eff1cdd0bde29faa2b5cfeb6e81e",
"size": "586... |
# match.py - filename matching
#
# Copyright 2008, 2009 Olivia Mackall <olivia@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import, print_function
import bisect
import c... | {
"content_hash": "b3beabd9a306d285bff6cef91e0f44ef",
"timestamp": "",
"source": "github",
"line_count": 1659,
"max_line_length": 106,
"avg_line_length": 32.13562386980109,
"alnum_prop": 0.5584003901487442,
"repo_name": "ingokegel/intellij-community",
"id": "66fc95381ef314d3e49ca566bbaa90ec28b85bd9",
... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ui', '0018_auto_20171005_1213'),
]
operations = [
migrations.AlterField(
model_name='export',
name='export_format',
... | {
"content_hash": "4baf5ef108e0c8a929d2648a4ba09217",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 314,
"avg_line_length": 41.91304347826087,
"alnum_prop": 0.6047717842323651,
"repo_name": "gwu-libraries/sfm-ui",
"id": "8ebec60e99251af3b9fa81181e34c74651dde6e9",
"size": ... |
"""
The :mod:`sklearn.pls` module implements Partial Least Squares (PLS).
"""
# Author: Edouard Duchesnay <edouard.duchesnay@cea.fr>
# License: BSD 3 clause
from ..base import BaseEstimator, RegressorMixin, TransformerMixin
from ..utils import check_array, check_consistent_length
from ..externals import six
import w... | {
"content_hash": "02fa3d095d9213841403217363836c8b",
"timestamp": "",
"source": "github",
"line_count": 801,
"max_line_length": 79,
"avg_line_length": 35.96629213483146,
"alnum_prop": 0.5836023464889444,
"repo_name": "ankurankan/scikit-learn",
"id": "34859d666bb40806cedd2c942bc1bb02903919cb",
"size... |
import os.path
import sys
from requestbuilder import Arg
from requestbuilder.command import BaseCommand
from requestbuilder.mixins import (FileTransferProgressBarMixin,
RegionConfigurableMixin)
from euca2ools.bundle.pipes.core import (create_unbundle_pipeline,
... | {
"content_hash": "44fe9bc4dbb4ab23e86405b0a76f9984",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 79,
"avg_line_length": 50.2,
"alnum_prop": 0.5819076634637919,
"repo_name": "vasiliykochergin/euca2ools",
"id": "7481bc849fef93e7665d25a2b1ddfb9a1e3ba095",
"size": "5614",
... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('profiles', '0002_profile_location'),
]
operations = [
migrations.AddField(
model_name='profile',
name='surf_level',
... | {
"content_hash": "9938cf851f4ed08d4c718c82e411f117",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 133,
"avg_line_length": 25.72222222222222,
"alnum_prop": 0.5896328293736501,
"repo_name": "Dude1983/surfapp",
"id": "265d005813fd3f67aedd5fd45e40a73479474415",
"size": "535... |
import sys
import 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.insert(0, os.path.abspath('.'))
# -- General conf... | {
"content_hash": "4fa52117320d86557e823eeaec47fb32",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 94,
"avg_line_length": 32.03875968992248,
"alnum_prop": 0.7113476893297846,
"repo_name": "Melrok/energistream-py",
"id": "fd5865a5bbba4396f8f00181ed73ddf611452c7a",
"size"... |
default_app_config = 'customers.apps.CustomersConfig'
| {
"content_hash": "3e2381c08c595d9a304d69e2a8839166",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 53,
"avg_line_length": 54,
"alnum_prop": 0.8148148148148148,
"repo_name": "tomturner/django-tenants",
"id": "3417f161cc5adbd457def57525e3beb4bf403a77",
"size": "54",
"bina... |
import os
def write_to_config(username, host):
with open(os.path.join(os.path.expanduser("~"), '.my.conf'), 'w') as cfg:
config = '[DEFAULT]\nusername=%s\nhost=%s\n'
cfg.write(config % (username, host))
| {
"content_hash": "45edde2777e9ab663d6437fa822a2b78",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 77,
"avg_line_length": 32.142857142857146,
"alnum_prop": 0.6133333333333333,
"repo_name": "esikachev/my-dev-client",
"id": "2202452ec14e8b0d1f0de667f8db6b43093c10db",
"size"... |
"""
"""
from .basic import BASIC
class ULONG(BASIC): pass
def template():
return ULONG('GPLong') | {
"content_hash": "027b1294ffb573ad96f8c35025d4b1f4",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 26,
"avg_line_length": 9.545454545454545,
"alnum_prop": 0.638095238095238,
"repo_name": "geospatial-services-framework/gsfpyarc",
"id": "4de9dea0cdc064c1686bfe4bf8b797a8ae070... |
from base import *
from rekening import Rekening
from rekening_hukum import DasarHukum
from urusan import Urusan
from fungsi import Fungsi
from fungsi_urusan import FungsiUrusan
from unit import Unit
from program import Program
from kegiatan import Kegiatan
if __name__ == '__main__':
Rekening.import_data(... | {
"content_hash": "2f2036edb96705cd7f44500c54d88f5a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 38,
"avg_line_length": 25.2,
"alnum_prop": 0.7341269841269841,
"repo_name": "aagusti/o-sipkd",
"id": "8d12431347f75074ef2a428649a8ba4c549a5f4c",
"size": "504",
"binary": ... |
class TestWsgiApp(object):
def __init__(self, environment):
self.environment = environment
def __call__(self, env, start_response):
lines = [
"""<!DOCTYPE html>
<html>
<head><title>Openshift WSGI Info</title></head>
</html>
<body>
<table style="width:100%">
<thead>... | {
"content_hash": "12b806402ef4483f664a51b9d880be13",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 75,
"avg_line_length": 28.625,
"alnum_prop": 0.5213973799126638,
"repo_name": "pduval/wsgitestoshift",
"id": "f4eff16b8b39d3475c4465c3d7ac8be0af75c8f9",
"size": "1245",
"... |
import hashlib
import logging
import os
import codecs
from shutil import copyfileobj
import simplejson as json
from time import sleep
from nose.tools import nottest
from onlinelinguisticdatabase.tests import TestController, url
import onlinelinguisticdatabase.model as model
from onlinelinguisticdatabase.model.meta impo... | {
"content_hash": "84f5a9aebc3e942674dcc59fef277a1a",
"timestamp": "",
"source": "github",
"line_count": 1736,
"max_line_length": 193,
"avg_line_length": 55.84101382488479,
"alnum_prop": 0.6129770992366412,
"repo_name": "jrwdunham/old",
"id": "2f5bcf82c14ce00b6094cc73912896a0d9bcbc12",
"size": "9752... |
from sqlalchemy.dialects import sqlite
from nova import context
from nova import db
from nova.db.sqlalchemy import api as sqlalchemy_api
from nova.tests.functional import test_servers
from nova.tests.unit import fake_network
class TestDatabaseArchive(test_servers.ServersTestBase):
"""Tests DB API for archiving (... | {
"content_hash": "85eaa8973b3e6d88d32f623d35f1385f",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 79,
"avg_line_length": 45.94444444444444,
"alnum_prop": 0.6435308343409916,
"repo_name": "bigswitch/nova",
"id": "8d482c42b7c25070577529e7c82ff1c812cf1684",
"size": "4737",... |
"""Unittest for ipaddress module."""
from __future__ import unicode_literals
import contextlib
import operator
import pickle
import re
import sys
import unittest
import weakref
import ipaddress
# Compatibility function
import binascii
try:
_compat_bytes_fromhex = bytes.fromhex
except AttributeError:
def _co... | {
"content_hash": "29239dd5f3883e04cd1dce7ad1464c85",
"timestamp": "",
"source": "github",
"line_count": 2219,
"max_line_length": 79,
"avg_line_length": 42.765660207300584,
"alnum_prop": 0.5839699885138624,
"repo_name": "cloudera/hue",
"id": "145dc1a922b52a3587024cf9c612317b7811bf9d",
"size": "94977... |
"""Tests for Adam."""
import numpy as np
from tensorflow.python.client import session
from tensorflow.python.compiler.xla.experimental import xla_sharding
from tensorflow.python.eager import context
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.pyth... | {
"content_hash": "e9d89a4e8deb77c0c72e562f7c8026cd",
"timestamp": "",
"source": "github",
"line_count": 405,
"max_line_length": 80,
"avg_line_length": 43.34320987654321,
"alnum_prop": 0.607838669249174,
"repo_name": "tensorflow/tensorflow",
"id": "0f570888d499b80821ba79e5c3f9b8801df54c56",
"size": ... |
from django.template import Context
from django.template.loader import get_template
from django import template
register = template.Library()
@register.filter
def as_bootstrap(form):
template = get_template('bootstrap/form.html')
ctx = Context({'form': form})
return template.render(ctx)
@register.filt... | {
"content_hash": "812284dddec85dd93ae4c6c27221255d",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 51,
"avg_line_length": 23.7,
"alnum_prop": 0.729957805907173,
"repo_name": "furious-luke/django-bootstrap-theme",
"id": "a1a238473138a3611a646f9860bf79c7d469f8d0",
"size": ... |
"""Various tools fpr surface detection"""
import numpy as np
import pandas as pd
import scipy.signal
from . import utils
import copy
def detector(rdg, y0=[], winsize=100, method='grima2012', axis=0, **kwargs):
"""Surface detection with the choosen method
Input
-----
rdg: 2d-array
radargram.
... | {
"content_hash": "043805df42850154ed19722a7e53adc5",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 110,
"avg_line_length": 25.65991902834008,
"alnum_prop": 0.5590091511517828,
"repo_name": "cgrima/subradar",
"id": "b677a5ed0aaced9de4187bc4f7922d04a21b27b5",
"size": "633... |
"""Generator for C++ features from json files.
Usage example:
features_compiler.py --destdir gen --root /home/Work/src _permissions.json
"""
from __future__ import print_function
import optparse
import os
from schema_loader import SchemaLoader
from features_cc_generator import CCGenerator
from features_h_generato... | {
"content_hash": "1bc690ab9e6266c550034231d498eab0",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 78,
"avg_line_length": 35.25,
"alnum_prop": 0.6606942889137738,
"repo_name": "nwjs/chromium.src",
"id": "14bcd65fd19df293665bf8bfb24f5049a117515d",
"size": "2842",
"binar... |
from abc import abstractmethod
from enum import Enum
import collections
class Action(Enum):
OFF = 0,
ON = 1,
def __str__(self):
return "on" if self == Action.ON else "off" if self == Action.OFF else None
def opposite(self):
return Action.OFF if self == Action.ON else Action.ON
def ... | {
"content_hash": "692ae84d15471877a8e985f8a880bd16",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 100,
"avg_line_length": 25.345991561181435,
"alnum_prop": 0.5954719493923756,
"repo_name": "ammannbros/garden-lighting",
"id": "4649898926749bbe2fe5aa106286ed626b4b85c3",
... |
import unittest
from unittest.mock import patch
from google.datacatalog_connectors.sqlserver import datacatalog_cli
@patch('google.datacatalog_connectors.rdbms.sync.'
'datacatalog_synchronizer.DataCatalogSynchronizer.__init__',
lambda self, **kargs: None)
class DatacatalogCLITestCase(unittest.TestCase)... | {
"content_hash": "6aa5eaa974a5c4e75e60c35bf8850acc",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 77,
"avg_line_length": 40,
"alnum_prop": 0.621268656716418,
"repo_name": "GoogleCloudPlatform/datacatalog-connectors-rdbms",
"id": "f211bfd8fb3ece13c61bc5109faa911600b9a488",... |
from functools import wraps
# third party packages
from flask import Flask, jsonify, abort, request, Response
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.debug = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db'
app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
db = SQLAlchemy... | {
"content_hash": "fdc46df277ab4d195e2c23acc95fac29",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 68,
"avg_line_length": 24.495049504950494,
"alnum_prop": 0.6050929668552951,
"repo_name": "gardyna/WalkerAppGame",
"id": "a54db175c8f14ba5485490e5f148d870f96705a3",
"size"... |
get_ipython().run_cell_magic('capture', '', '%matplotlib inline\nimport numpy as np\nimport sympy as sp\nimport matplotlib.pyplot as plt\n\n# To get equations the look like, well, equations, use the following.\nfrom sympy.interactive import printing\nprinting.init_printing(use_latex=True)\nfrom IPython.display import d... | {
"content_hash": "9d8b5e3722f6605334f84bb73758c537",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 624,
"avg_line_length": 43.502262443438916,
"alnum_prop": 0.6953401289785729,
"repo_name": "dougsweetser/ipq",
"id": "f0695da76ac8c5c1acc91dfd7d4c1041692de0bb",
"size": "1... |
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import unittest
# pylint: disable=W0403,W0212,W0612
from weatheralerts import WeatherAlerts
class Test_WeatherAlerts(unittest.TestCase):
def setUp(self):
self.nws = WeatherAlerts()
def test_almost_everything(self):
print("Alerts ... | {
"content_hash": "a5112be2e4a4522945cd55fa5d5ade1c",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 91,
"avg_line_length": 30.353535353535353,
"alnum_prop": 0.5507487520798668,
"repo_name": "zebpalmer/WeatherAlerts",
"id": "3117cc7594306a1a8cd7f8ed55e8a58f1984fd0f",
"size... |
import xml.etree.ElementTree as ET
# NLP data analysis
import nltk
nltk.download()
from nltk.corpus import stopwords
# Interact with user machine
from enum import Enum
import re
import sys
from sys import argv
import os
# INCLUDE HOW MANY WISHES WERE MADE
# INCLUDE LONGEST STREAK OF TEXT MESSAGES
# Time In Millisec... | {
"content_hash": "22605339134d2973c2d0b93a4dbd8e12",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 84,
"avg_line_length": 26.783898305084747,
"alnum_prop": 0.6568580920740389,
"repo_name": "2nd47/info-txt",
"id": "b25a89c14a925ce94e15802e7772bc49ae9e0bb9",
"size": "6335... |
import unittest
import config
import thread_cert
from pktverify.consts import MLE_CHILD_ID_REQUEST, MLE_CHILD_ID_RESPONSE, MLE_CHILD_UPDATE_REQUEST, MLE_CHILD_UPDATE_RESPONSE, MODE_TLV
from pktverify.packet_verifier import PacketVerifier
LEADER = 1
ED = 2
class Cert_6_5_3_ChildResetSynchronize(thread_cert.TestCase)... | {
"content_hash": "b7f20ecd2222ae439896c5d53ff52605",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 135,
"avg_line_length": 32.548780487804876,
"alnum_prop": 0.5878606219557887,
"repo_name": "bukepo/openthread",
"id": "203d2018178ee79aec0246c443f33f4837292131",
"size": "4... |
from plotly.basedatatypes import BaseTraceType as _BaseTraceType
import copy as _copy
class Scattersmith(_BaseTraceType):
# class properties
# --------------------
_parent_path_str = ""
_path_str = "scattersmith"
_valid_props = {
"cliponaxis",
"connectgaps",
"customdata",
... | {
"content_hash": "a0005e00d2330ef829979420d172d4fb",
"timestamp": "",
"source": "github",
"line_count": 2319,
"max_line_length": 90,
"avg_line_length": 36.58171625700733,
"alnum_prop": 0.5603361899260901,
"repo_name": "plotly/plotly.py",
"id": "45e6c96eb20c831bd5ea7ab215b8a88ee82e287a",
"size": "84... |
__doc__="""
Runs the preflightg - G for Glyphs - shell script from your chosen project folder
"""
__copyright__ = 'Copyright (c) 2018, SIL International (http://www.sil.org)'
__license__ = 'Released under the MIT License (http://opensource.org/licenses/MIT)'
__author__ = 'Nicolas Spalinger'
import GlyphsApp
from sub... | {
"content_hash": "4f15fa3b10db1a8fba1903c5e6fecc19",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 171,
"avg_line_length": 22.272727272727273,
"alnum_prop": 0.7183673469387755,
"repo_name": "n7s/scripts-for-glyphs",
"id": "dfe4cbd1f623948b40e586374ae6a3f440db50c6",
"size... |
import asyncio
import binascii
import cgi
import collections
import datetime
import http.cookies
import io
import json
import math
import time
import warnings
import enum
from email.utils import parsedate
from types import MappingProxyType
from urllib.parse import urlsplit, parse_qsl, unquote
from . import hdrs
from... | {
"content_hash": "f587949631e8ded7c9b09db6183ec177",
"timestamp": "",
"source": "github",
"line_count": 778,
"max_line_length": 91,
"avg_line_length": 31.318766066838045,
"alnum_prop": 0.5570056636296479,
"repo_name": "vedun/aiohttp",
"id": "120a312e02a002b4d0ddf606824824e4b0130e37",
"size": "24366... |
"""Produce MQM scores from MQM ratings tsv file."""
import collections
import csv
import json
from absl import app
from absl import flags
import glob
flags.DEFINE_string('input', '/dev/stdin', 'Input MQM ratings tsv file.')
flags.DEFINE_string('output', '/dev/stdout', 'Output MQM score file.')
flags.DEFINE_string(
... | {
"content_hash": "c0f9822dec68ba807ed4e9141ffcb2cd",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 79,
"avg_line_length": 35.82022471910113,
"alnum_prop": 0.6264115432873275,
"repo_name": "google-research/mt-metrics-eval",
"id": "d442bcb417dd8ac3c1031218ec25d681a0228d9e",
... |
import shutil
import tempfile
import pytest
@pytest.fixture(scope='session')
def clean_jedi_cache(request):
"""
Set `jedi.settings.cache_directory` to a temporary directory during test.
Note that you can't use built-in `tmpdir` and `monkeypatch`
fixture here because their scope is 'function', which ... | {
"content_hash": "4b8543bda617db7049455db2e7451f1e",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 77,
"avg_line_length": 25.555555555555557,
"alnum_prop": 0.6898550724637681,
"repo_name": "danrharms/harmsway",
"id": "9e631922196ffc8308db7bf7e04246c2ea9aa14f",
"size": "6... |
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names her... | {
"content_hash": "7f6f5b44a34c17e855284306d58bbab5",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 79,
"avg_line_length": 29.231292517006803,
"alnum_prop": 0.6572026995578311,
"repo_name": "Nicals/pblog",
"id": "aee850eac0113dd0eae37679ac8362a01945dc23",
"size": "4979",... |
from groupModule.models import Group
from django import forms
from django.contrib.admin import widgets
from django.db import connection
class GroupCreateForm(forms.ModelForm):
class Meta:
model = Group
fields = ['groupName' , 'groupType' , 'description']
#class ViewAllGroups():
clas... | {
"content_hash": "9a9d2a734640fb691290cdea98cded2f",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 162,
"avg_line_length": 44.766666666666666,
"alnum_prop": 0.6392405063291139,
"repo_name": "dipkakwani/wee_app",
"id": "020c628eb5358aacd4705ce4d4c85d17cc241c93",
"size": "... |
from __future__ import annotations
from typing import *
from edb import errors
from edb.common import verutils
from edb import edgeql
from edb.edgeql import ast as qlast
from edb.edgeql import compiler as qlcompiler
from edb.edgeql import qltypes as ft
from edb.edgeql import parser as qlparser
from edb.edgeql import ... | {
"content_hash": "a12378a9301c7d54a855f97b93c0e9d7",
"timestamp": "",
"source": "github",
"line_count": 1562,
"max_line_length": 79,
"avg_line_length": 34.58066581306018,
"alnum_prop": 0.5611959640840507,
"repo_name": "edgedb/edgedb",
"id": "5f7716acfc1b7920af5d5f1d1bc19970fdf61679",
"size": "54696... |
"""
Common declarations.
"""
from contextlib import contextmanager
import os
import socket
import subprocess
import tempfile
import time
import psutil
def free_port():
"""
Find a free TCP port.
"""
with socket.socket() as sock:
sock.bind(('', 0))
return sock.getsockname()[1]
def w... | {
"content_hash": "246e3d464f0e965c79d914e77052de9b",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 77,
"avg_line_length": 23.84070796460177,
"alnum_prop": 0.607275426874536,
"repo_name": "infoxchange/docker-forklift",
"id": "b211418847bc196f24ffc5fd70ba360c7b8bf100",
"s... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/medicine/crafted/shared_medpack_disease_area_stamina_a.iff"
result.attribute_template_id = 7
result.stfName("medicine_name","medic_disease_area_stamina_a")
#### BEGIN MODIFICATIONS ####
#### END MODIFICAT... | {
"content_hash": "f03c1577d9114df16c2144c8e80c8579",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 95,
"avg_line_length": 26.692307692307693,
"alnum_prop": 0.7175792507204611,
"repo_name": "obi-two/Rebelion",
"id": "acb0529cb8b6736ce275448343fbaa914c265586",
"size": "492... |
__author__="UShareSoft"
from ussclicore.argumentParser import ArgumentParser, ArgumentParserError
from ussclicore.cmd import Cmd, CoreGlobal
from texttable import Texttable
from uforgecli.utils.org_utils import org_get
from ussclicore.utils import generics_utils, printer
from ussclicore.utils.generics_utils import ord... | {
"content_hash": "bbdc6a5ef6aed03057946dc95fbe2766",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 264,
"avg_line_length": 52.94285714285714,
"alnum_prop": 0.46753013131858245,
"repo_name": "pedrolegold/uforge-cli",
"id": "815c9396e5ebd866d166fa9c0e4c3480fce9d585",
"siz... |
import angr
from angr.sim_type import SimTypeString, SimTypeInt
######################################
# puts
######################################
class puts(angr.SimProcedure):
#pylint:disable=arguments-differ
def run(self, string):
self.argument_types = {0: self.ty_ptr(SimTypeString())}
s... | {
"content_hash": "4a18884fe507bddc7c50c3a220b5dba0",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 93,
"avg_line_length": 36.375,
"alnum_prop": 0.5967926689576174,
"repo_name": "f-prettyland/angr",
"id": "e24c3ef7eb61a8a63a9bf055d586dbb0c9293acf",
"size": "873",
"binar... |
"""Tools used tool work with Avro files in the context of BigQuery.
Classes, constants and functions in this file are experimental and have no
backwards compatibility guarantees.
NOTHING IN THIS FILE HAS BACKWARDS COMPATIBILITY GUARANTEES.
"""
# BigQuery types as listed in
# https://cloud.google.com/bigquery/docs/re... | {
"content_hash": "a7a535e4ced2a6989e983c8ba2ec259b",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 180,
"avg_line_length": 30.025,
"alnum_prop": 0.6341937274493478,
"repo_name": "robertwb/incubator-beam",
"id": "85f600459056641bc43acec11667699151245d23",
"size": "4388",... |
"""Test suite for the deepreload module."""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import os
import nose.tools as nt
from IPython.testing import decorators as dec
from IPython.utils.syspa... | {
"content_hash": "17b1115949d44af557dbea876b5e2234",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 78,
"avg_line_length": 33.90196078431372,
"alnum_prop": 0.4933487565066512,
"repo_name": "noslenfa/tdjangorest",
"id": "aa28dbfb0006069088de011a15e62a53bec2f768",
"size": "... |
"""
Base URL Configuration for the food-doctor project
"""
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.auth import views as auth_views
from config import views
from food.urls import urlpatterns as food_urls
urlpatterns = [
url(
r'^login/$',
auth_v... | {
"content_hash": "6d24fb6e7e3c722bc761750cb31dda9a",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 57,
"avg_line_length": 20.24390243902439,
"alnum_prop": 0.5421686746987951,
"repo_name": "savijoki/food-doctor",
"id": "db78362572669fd250ef662e0dfece67f19f7be7",
"size": "... |
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_rollsum', [dirname(__file__)])
except ImportError:
import _rollsum
... | {
"content_hash": "be48bd963fc7b0865bab0db7da9bc516",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 98,
"avg_line_length": 38.177083333333336,
"alnum_prop": 0.6311050477489768,
"repo_name": "lowks/camlipy",
"id": "0f20cd4adbbeec74cde298a848075b90da128e40",
"size": "3870",... |
import ConfigParser
DEFAULT_CONFIG = "default.conf"
CONFIG_NAME = ".scrappyrc"
import logging
import os, os.path
import ssl
import sys
import thread, threading
import time
from irclib import client as ircclient
# Logging guidelines and levels
# DEBUG - Python debugging (e.g., printing list of connected servers on s... | {
"content_hash": "247213b0dad48a290432ba0eb51299ec",
"timestamp": "",
"source": "github",
"line_count": 410,
"max_line_length": 126,
"avg_line_length": 34.65609756097561,
"alnum_prop": 0.5559856429023858,
"repo_name": "tcoppi/scrappy",
"id": "7d113dc9b6c6f681dd0a902433d2f4255bcf2183",
"size": "1443... |
"""" GAEO view helper module """ | {
"content_hash": "b645532ff9db398a33c777ab64e7466e",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 32,
"avg_line_length": 32,
"alnum_prop": 0.625,
"repo_name": "naokits/adminkun_viewer_old",
"id": "764cf3098b2f6cb78225f9f0e428c2b3fe9244fe",
"size": "633",
"binary": fals... |
import collections
import datetime
import enum
import hashlib
import logging
import re
import time
import uuid
from concurrent.futures import as_completed
import six
from azure.graphrbac.models import DirectoryObject, GetObjectsParameters
from azure.keyvault import KeyVaultAuthentication, AccessToken
from azure.keyvau... | {
"content_hash": "3bbda470890493dac7d0ff48e96e88aa",
"timestamp": "",
"source": "github",
"line_count": 519,
"max_line_length": 100,
"avg_line_length": 36.04816955684008,
"alnum_prop": 0.6030787321609921,
"repo_name": "ewbankkit/cloud-custodian",
"id": "6904f2a57549d11096675043c79d16314856cac5",
"s... |
from __main__ import run
| {
"content_hash": "918b344d9389db7a5a4b57da38762c42",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 24,
"avg_line_length": 25,
"alnum_prop": 0.68,
"repo_name": "ibressler/pyqtgraph",
"id": "23b7cd58ffc3d09e1b17a076c639a49d945e1d45",
"size": "25",
"binary": false,
"copi... |
from libcloud.common.base import ConnectionKey, BaseDriver
from libcloud.common.types import LibcloudError
__all__ = [
'Member',
'LoadBalancer',
'Algorithm',
'Driver',
'DEFAULT_ALGORITHM'
]
class Member(object):
"""
Represents a load balancer member.
"""
def __init__(self, id, ip... | {
"content_hash": "f488edbbd66428a56e46cd1ef4d8ff43",
"timestamp": "",
"source": "github",
"line_count": 331,
"max_line_length": 79,
"avg_line_length": 28.981873111782477,
"alnum_prop": 0.576566246221203,
"repo_name": "poojavade/Genomics_Docker",
"id": "b785af023239efd94361289d005ceb848b0c8319",
"si... |
from sys import exit, stdout, argv
from os import environ, system, path
environ['KERAS_BACKEND'] = 'tensorflow'
# environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
# environ["CUDA_VISIBLE_DEVICES"] = ""
import numpy as np
import signal
from keras.models import Model, load_model
from keras.optimizers import Adam
from kera... | {
"content_hash": "3f27aeee83e950332aec4be7b5e58b5c",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 109,
"avg_line_length": 38.605555555555554,
"alnum_prop": 0.5957691754209239,
"repo_name": "sidnarayanan/BAdNet",
"id": "656f39709b4b8a2d38c6c630cf56426b9a307492",
"size":... |
"""
This example shows how to graft a WSGI app onto mitmproxy. In this
instance, we're using the Flask framework (http://flask.pocoo.org/) to expose
a single simplest-possible page.
"""
from flask import Flask
app = Flask("proxapp")
@app.route('/')
def hello_world():
return 'Hello World!'
# Register the app us... | {
"content_hash": "052f67c418e735341092f326ca865044",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 118,
"avg_line_length": 34.916666666666664,
"alnum_prop": 0.7255369928400954,
"repo_name": "tdickers/mitmproxy",
"id": "613d3f8b066c8c9dd84c22288b1a77df336d10e0",
"size": "... |
__author__ = 'f1ashhimself@gmail.com'
import re
from .. import TooSaltyUISoupException
class _Utils(object):
@classmethod
def convert_wildcard_to_regex(cls, wildcard):
"""
Converts wildcard to regex.
Arguments:
- wildcard: string, wildcard.
Returns:
... | {
"content_hash": "a6f130acfcea862f12d13a6c20063623",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 76,
"avg_line_length": 25.14457831325301,
"alnum_prop": 0.5404887398179204,
"repo_name": "terkira/UISoup",
"id": "a874caf8eafea467a12b030a15d7721eec6644e3",
"size": "2727",... |
from test_framework.test_framework import VeriCoinTestFramework
from test_framework.util import *
import os
import shutil
class BIP65Test(VeriCoinTestFramework):
def setup_network(self):
self.nodes = []
self.nodes.append(start_node(0, self.options.tmpdir, []))
self.nodes.append(start_node(... | {
"content_hash": "1af5b4bdbb9026b34a9733d3ecc3b65e",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 98,
"avg_line_length": 36.625,
"alnum_prop": 0.60580204778157,
"repo_name": "vericoin/vericoin-core",
"id": "f65609505fc052b2012e7c435452e37b70ee84e0",
"size": "3201",
"b... |
"""Job submission script"""
from __future__ import absolute_import
import logging
from . import opts
from . import local
from . import mpi
from . import sge
from . import yarn
from . import mesos
def config_logger(args):
"""Configure the logger according to the arguments
Parameters
----------
args: a... | {
"content_hash": "1b349eb3b1284e681f7a0df401afd397",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 79,
"avg_line_length": 27.9811320754717,
"alnum_prop": 0.6331759946055293,
"repo_name": "yhpeng-git/mxnet",
"id": "6e32403820e75089f01c0a06d0d0b814146756cb",
"size": "1483"... |
"""URL endpoint to allow Buildbot slaves to post data to the dashboard."""
import copy
import json
import logging
import math
import re
from google.appengine.api import datastore_errors
from google.appengine.api import taskqueue
from google.appengine.ext import ndb
from dashboard import math_utils
from dashboard imp... | {
"content_hash": "48644d101b65edb90c7f2a85951191f1",
"timestamp": "",
"source": "github",
"line_count": 828,
"max_line_length": 80,
"avg_line_length": 34.33695652173913,
"alnum_prop": 0.6759171327072562,
"repo_name": "benschmaus/catapult",
"id": "117611f8860efe6afaa189a5e7de2839954f65e3",
"size": "... |
import contextlib
import sys
import mock
from oslo.config import cfg
import testtools
from neutron.agent.linux import ip_lib
from neutron.agent.linux import ovs_lib
from neutron.agent.linux import utils
from neutron.common import constants as n_const
from neutron.plugins.common import constants as p_const
from neutro... | {
"content_hash": "741615918a155582d29cdd9f14bd4c82",
"timestamp": "",
"source": "github",
"line_count": 832,
"max_line_length": 79,
"avg_line_length": 47.55288461538461,
"alnum_prop": 0.5553028005257304,
"repo_name": "vijayendrabvs/hap",
"id": "13464ca547b17ed4ae8b5bd6bf601cfb0605ed43",
"size": "40... |
"""
My App 2: Hello with Bokeh plot, Jinja2 template, and Bootstrap
"""
from bokeh.plotting import figure
from bokeh.embed import components
from flask import (
Flask, request, render_template, abort, Response, redirect, url_for
)
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
@app.route('/<xdata... | {
"content_hash": "c5f1ba9b3730ae153ed1ebd753cbc1f7",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 73,
"avg_line_length": 32.6,
"alnum_prop": 0.5774539877300614,
"repo_name": "thehackerwithin/berkeley",
"id": "674837423c867ca7af106d5a18b1c4907023d696",
"size": "1304",
... |
from ..distributions import MultivariateNormal
from ..likelihoods import _GaussianLikelihoodBase
from .marginal_log_likelihood import MarginalLogLikelihood
class ExactMarginalLogLikelihood(MarginalLogLikelihood):
"""
The exact marginal log likelihood (MLL) for an exact Gaussian process with a
Gaussian lik... | {
"content_hash": "ea50baf5e2918c54aee4c23b6401d3aa",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 108,
"avg_line_length": 42.220588235294116,
"alnum_prop": 0.667014977359805,
"repo_name": "jrg365/gpytorch",
"id": "f8444a55cd9f226fc505869bbe4d4f4bb533451d",
"size": "2895... |
from corehq.apps.sms.api import incoming as incoming_sms
from corehq.apps.twilio.models import TwilioBackend
from django.http import HttpResponse, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
EMPTY_RESPONSE = """<?xml version="1.0" encoding="UTF-8" ?>
<Response></Response>"""
@csrf_exem... | {
"content_hash": "b1a9b829754a7835041b82cd8431ea36",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 60,
"avg_line_length": 33.15384615384615,
"alnum_prop": 0.648491879350348,
"repo_name": "puttarajubr/commcare-hq",
"id": "eeb2cb5adc462afec7644340ce5b030ca447a5c8",
"size":... |
"""
iSCSI Cinder Volume driver for Hitachi Unified Storage (HUS-HNAS) platform.
"""
import os
import six
from xml.etree import ElementTree as ETree
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from oslo_utils import units
fr... | {
"content_hash": "ef24e58134c1c9dc918a73e5ddc72bbf",
"timestamp": "",
"source": "github",
"line_count": 967,
"max_line_length": 79,
"avg_line_length": 38.820062047569806,
"alnum_prop": 0.5123737979168331,
"repo_name": "scottdangelo/RemoveVolumeMangerLocks",
"id": "158b87c787782aacd9cf251555a3d8daf41f... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
class ReindexTest(BitcoinTestFramework):
def setup_chain(self):
print("Initializing test directory "+self.options.tmpdir)
initialize_chain_clean(self.options.tmpdir, 1)
def setup_network(self):
... | {
"content_hash": "f9c00c2ec3531c2a10c2fc8620f2abae",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 102,
"avg_line_length": 33.208333333333336,
"alnum_prop": 0.6474278544542033,
"repo_name": "marlengit/hardfork_prototype_1_mvf-bu",
"id": "52534ca89e7cfb2765ce84cdd7b00bffaef... |
import psycopg2
from psycopg2.extensions import AsIs
from osgeo import ogr
from xml.etree import ElementTree as ETree
import math
import random
import simplejson as json
from cStringIO import StringIO
import struct
import binascii
from pgpointcloud_utils import PcRunTimeException, PcInvalidArgException
# mapping b... | {
"content_hash": "a7ff3e0fd13b8a21cacf17b682efc028",
"timestamp": "",
"source": "github",
"line_count": 566,
"max_line_length": 105,
"avg_line_length": 24.171378091872793,
"alnum_prop": 0.5580732402602149,
"repo_name": "dustymugs/pgpointcloud_utils",
"id": "de0709f836ace6d7bcf05f573e7594a88ae02d4b",
... |
import unittest
import numpy as np
from pydl.models.pipeline import PCA
class PCATestCase(unittest.TestCase):
def test_get_config(self):
s = PCA(n_components=5)
config = s.get_config()
expected_config = dict(
n_components=5,
whiten=False,
name='pca'
... | {
"content_hash": "89475b8c76c39f62184db1b178f51a23",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 113,
"avg_line_length": 26.46067415730337,
"alnum_prop": 0.5545647558386412,
"repo_name": "rafaeltg/pydl",
"id": "a424012594ffb99b3b7d25b918082545900e9a48",
"size": "2355",... |
import testtools
from tempest.test import attr
from tempest_lib import exceptions
from murano.tests.functional.api import base
class TestServices(base.TestCase):
@attr(type='smoke')
def test_get_services_list(self):
env = self.create_environment('test')
sess = self.client.create_session(en... | {
"content_hash": "e98572db9b5dd93562d7849a8439c15f",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 79,
"avg_line_length": 34.702127659574465,
"alnum_prop": 0.5234825260576333,
"repo_name": "telefonicaid/murano",
"id": "e252114726fe8eb6158a569542f547190525e770",
"size": ... |
from __future__ import unicode_literals
from flask import request
from indico.modules.admin.views import WPAdmin
from indico.modules.users import User
from indico.util.i18n import _
from indico.web.breadcrumbs import render_breadcrumbs
from indico.web.views import WPDecorated, WPJinjaMixin
class WPUser(WPJinjaMixin... | {
"content_hash": "6b05608047f77b3a2ae332a56979b957",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 83,
"avg_line_length": 33.21951219512195,
"alnum_prop": 0.6806167400881057,
"repo_name": "mvidalgarcia/indico",
"id": "d86f2c7bcf14b659c313f4a2dbb71d7fad98811e",
"size": "1... |
from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('parsing')
PARSER_TYPES = ['movie', 'series', 'music']
# Mapping of parser type to (mapping of parser name to plugin instance)
parsers = {}
# Mapping fr... | {
"content_hash": "5ca4e7eabc8a646eb64c3d686585b707",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 118,
"avg_line_length": 39.52577319587629,
"alnum_prop": 0.6517996870109546,
"repo_name": "lildadou/Flexget",
"id": "a695ca32988d9c85de44682962986af6ef382978",
"size": "383... |
from jug import TaskGenerator
from jug.tests.jugfiles.exceptions import FailingTask
@TaskGenerator
def some_fail(x):
if x in (2, 5, 8):
raise FailingTask
return x
@TaskGenerator
def plus1(x):
return x + 1
vals = list(map(some_fail, list(range(10))))
vals = list(map(plus1, vals))
# This jugfile ... | {
"content_hash": "667fe5e8c1954cc0acb2c522aac58492",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 85,
"avg_line_length": 24.9,
"alnum_prop": 0.714859437751004,
"repo_name": "luispedro/jug",
"id": "b64f21892faf5fa89e1fd8ffe83682d5ed348456",
"size": "498",
"binary": fal... |
import numpy as np
from numpy import ma
from .qctests import QCCheckVar
def constant_cluster_size(x, tol=0):
"""Estimate the cluster size with (nearly) constant value
Returns how many consecutive neighbor values are within a given
tolerance range. Note that invalid values, like NaN, are ignored.... | {
"content_hash": "e0e7a20711c626cca997171c945603ce",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 84,
"avg_line_length": 35.39705882352941,
"alnum_prop": 0.5961778147071043,
"repo_name": "castelao/CoTeDe",
"id": "739fde6ef8daaf219f295f8b2cc40aff85f16334",
"size": "2496"... |
import time
import sys
import RPi.GPIO as GPIO
SIGNAL_CONFIG = {
"signal_patterns": {
"outlet_a": {
"on": "1001010000001010000010000",
"off": "1001010000001010000001100"
}
},
"signal_long_secs": 0.0008,
"signal_short_secs": 0.0003,
"signal_spacing_decs": 0.008
}
DATA_PIN = 11
class IREm... | {
"content_hash": "61cccaaacd1013486946065e3980c013",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 75,
"avg_line_length": 26.318840579710145,
"alnum_prop": 0.6029735682819384,
"repo_name": "initialxy/initialxy-irswitch",
"id": "51ae4f277a96f3b5143fb45781706d048edbc48d",
... |
from string import maketrans
ori = 'Of zit kggd zitkt qkt ygxk ortfzoeqs wqlatzwqssl qfr zvg ortfzoeqs yggzwqssl. Fgv oy ngx vqfz zg hxz zitd of gft soft, piv dgfn lgsxzogfl qkt zitkt? Zohl: hstqlt eiqfut zit ygkd gy zit fxdwtk ngx utz. Zit Hkgukqddtkl!'
def ali_decode(letter):
t=maketrans("qwertyuiopasdfghjklzxc... | {
"content_hash": "ce7933ea7ded1aee84b6f002f8f901b6",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 225,
"avg_line_length": 45.55555555555556,
"alnum_prop": 0.7804878048780488,
"repo_name": "Akagi201/learning-python",
"id": "6d61db0d1c17b50c17bf0096ceb86c0ae0811343",
"size... |
from setuptools import setup, find_packages
import sys
import os.path
import numpy as np
# Must be one line or PyPI will cut it off
DESC = ("Compute perceptual similarity between sRGB colors according to the "
"CAM02-UCS formula given by Luo et al (2006)")
LONG_DESC = open("README.rst").read()
# defines __v... | {
"content_hash": "70927f340ed3ed7c66622549d562850e",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 77,
"avg_line_length": 28.916666666666668,
"alnum_prop": 0.6426512968299711,
"repo_name": "njsmith/pycam02ucs",
"id": "77b7ce6639045c2c1dae10a89cca3f799aa9ed6e",
"size": "1... |
import matplotlib.pyplot as plt
import sys
import hist
import numpy
from scipy.io import loadmat
def main(session_path, scores_path, output_path, title):
"""Make scatter plot of MATLAB vs Java neighborhood scores.
"""
root = loadmat(session_path, struct_as_record=False, squeeze_me=True)
layout = roo... | {
"content_hash": "8ce16cb189869ed9c229babac0d8d74e",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 92,
"avg_line_length": 28.527272727272727,
"alnum_prop": 0.6061185468451242,
"repo_name": "baryshnikova-lab/safe-java",
"id": "1b2891d873a0ea552f6b2f237b2a9e55de41639b",
"s... |
import os
import requests
from eve import Eve
from flask import render_template
from flask import redirect
from flask import request
from flask import url_for
from geopy import geocoders
import googlemaps
from polyline import decode_line
import json
from wtforms import Form
from wtforms import TextField
from wtforms im... | {
"content_hash": "b8b9b3e31edcd20319e8425bccc107d5",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 134,
"avg_line_length": 41.61682242990654,
"alnum_prop": 0.6332809342016618,
"repo_name": "ryankanno/hitraffic-alert",
"id": "19ce12deaec064b8c92e1e8e1748b12888babe15",
"s... |
import unittest
import mock
from apache_beam.examples.snippets.util import assert_matches_stdout
from apache_beam.testing.test_pipeline import TestPipeline
from . import cogroupbykey
def check_plants(actual):
expected = '''[START plants]
('Apple', {'icons': ['🍎', '🍏'], 'durations': ['perennial']})
('Carrot', {... | {
"content_hash": "adc266de0c5af3f17fb271a4e979c3d8",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 78,
"avg_line_length": 29.28205128205128,
"alnum_prop": 0.6873905429071804,
"repo_name": "apache/beam",
"id": "ad4ed99a6e2b84d1d1d4d38918f32b6373401681",
"size": "1975",
... |
from mhvdb2.models import Entity
from peewee import DoesNotExist
import re
def get(entity_id):
try:
return Entity.get(Entity.id == entity_id)
except DoesNotExist:
return None
def validate(name, email, phone):
errors = []
if not name:
errors.append("Sorry, you need to provide ... | {
"content_hash": "ba186fd8f3af5edc06d076a5ccc7d863",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 65,
"avg_line_length": 22.525,
"alnum_prop": 0.6392896781354052,
"repo_name": "makehackvoid/mhvdb2",
"id": "6008a4f47cd1cf6c02540386b644e5dfd8283d39",
"size": "901",
"bin... |
import _plotly_utils.basevalidators
class FamilysrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="familysrc", parent_name="sunburst.insidetextfont", **kwargs
):
super(FamilysrcValidator, self).__init__(
plotly_name=plotly_name,
pa... | {
"content_hash": "f5475a6fee5a6b1ae4e863736049e0e5",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 86,
"avg_line_length": 33.07692307692308,
"alnum_prop": 0.6162790697674418,
"repo_name": "plotly/plotly.py",
"id": "429179e06fd54e306f10b4edc426b791b8a822ca",
"size": "430"... |
"""Central place for analysis environment setup
and standard data file locations."""
import os
from os.path import join
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
#from enrico.extern.odict import OrderedDict
#Submission farm name
#Currently supported : LAPP-Annecy, MPIK-H... | {
"content_hash": "377c9eac835db00bd66418859523f461",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 94,
"avg_line_length": 34.765306122448976,
"alnum_prop": 0.6369239800410919,
"repo_name": "dailytimes/enrico",
"id": "3c70bf1a97de93f83814df84601725b5169bca90",
"size": "34... |
"""
profiling.remote
~~~~~~~~~~~~~~~~
Utilities for remote profiling. They help you to implement profiling
server and client.
"""
from __future__ import absolute_import
from errno import EBADF, EPIPE, ECONNRESET
import functools
import io
from logging import getLogger as get_logger
try:
import cP... | {
"content_hash": "ff1b3aebb91a6be04c48959bcd2ba6d2",
"timestamp": "",
"source": "github",
"line_count": 252,
"max_line_length": 79,
"avg_line_length": 30.206349206349206,
"alnum_prop": 0.6078560168155543,
"repo_name": "sublee/profiling",
"id": "3b32f8c947a205a105b2c976bffa307dda455480",
"size": "76... |
"""Test cases for anyconfig.parser.parse_list.
"""
import anyconfig.parser as TT
from . import common
class TestCase(common.TestCase):
kind = 'list'
pattern = '*.*'
def test_parse_list(self):
for data in self.each_data():
self.assertEqual(
TT.parse_list(data.inp, **da... | {
"content_hash": "8c91b763494600917f73b9eb17423575",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 53,
"avg_line_length": 20.6,
"alnum_prop": 0.5412621359223301,
"repo_name": "ssato/python-anyconfig",
"id": "a9313dce1fe2fb013745111cf74822f31a427c21",
"size": "542",
"bi... |
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.urls import reverse
from django.utils import timezone
from django.views import generic
from .apps import PollsConfig
from .models import Choice, Question
class IndexView(generic.ListView):
template_nam... | {
"content_hash": "8bda21678d400fc585b2c058e7083505",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 91,
"avg_line_length": 30.535714285714285,
"alnum_prop": 0.6479532163742691,
"repo_name": "butla/experiments",
"id": "2f684a8e618f700dad65ba5fc986c13381322661",
"size": "17... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.