text stringlengths 4 1.02M | meta dict |
|---|---|
"""A helper, CLI tool for working with py_func's defining E2E tests.
This CLI provides methods for printing and submitting Argo workflows defined
by py_funcs.
"""
import fire
import logging
from kubernetes import client as k8s_client
import retrying
import yaml
from kubeflow.testing import argo_build_util
from kubefl... | {
"content_hash": "ce4136bf1c2a75aaa819f938f8f3919b",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 90,
"avg_line_length": 33.34415584415584,
"alnum_prop": 0.6311587147030185,
"repo_name": "kubeflow/testing",
"id": "671d50e7a12e1252b0f719e31b6c4a4e4df1e939",
"size": "513... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'dbname', # Or path to dat... | {
"content_hash": "9d238a3aa5e5d8fdf4d0776d1ccdc4f7",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 127,
"avg_line_length": 34.061349693251536,
"alnum_prop": 0.6867795389048992,
"repo_name": "laginha/django-key-auth",
"id": "896888d7f62048717e1d22c6e2f9bcaa2fddf8f1",
"si... |
"""
eve.methods.put
~~~~~~~~~~~~~~~
This module imlements the PUT method.
:copyright: (c) 2015 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
from datetime import datetime
from flask import current_app as app, abort
from werkzeug import exceptions
from eve.auth import requir... | {
"content_hash": "09d203aef46d1b78f82e49ffd123c977",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 79,
"avg_line_length": 40.60606060606061,
"alnum_prop": 0.644456289978678,
"repo_name": "kalbasit/eve",
"id": "39128ad093bff1d7ff2aa60a120fbccb215def64",
"size": "9405",
... |
"""
This module helps you with handling and generating collections of items.
"""
from __future__ import absolute_import
import collections
from numbers import Integral
from itertools import chain, islice
from functools import partial
import inspect
import random
from .predicates import make_predicate
from .tokens imp... | {
"content_hash": "196c827181bb8550baf6fcbf9b135748",
"timestamp": "",
"source": "github",
"line_count": 1028,
"max_line_length": 136,
"avg_line_length": 30.429961089494164,
"alnum_prop": 0.5702001150821558,
"repo_name": "weka-io/easypy",
"id": "7ba3e08e8f557f1f1ee7a824e2fd7dabc6a571b7",
"size": "31... |
import time
import jsonschema
try:
import simplejson as json
except ImportError:
import json
try:
from http import HTTPStatus
except ImportError:
import httplib as HTTPStatus
from flask import Flask
from flask import jsonify
from flask import request
from flasgger import Swagger
def drop_id_validate(d... | {
"content_hash": "5f1064e177907a46a733d561e13fa2a8",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 87,
"avg_line_length": 27.026515151515152,
"alnum_prop": 0.601541695865452,
"repo_name": "pcu4dros/pandora-core",
"id": "fb9cd86000c1b797e3de97e3d24b931c906508b9",
"size":... |
"""Auto-generated file, do not edit by hand. LY metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_LY = PhoneMetadata(id='LY', country_code=218, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[25679]\\d{8}', possible_number_pattern=... | {
"content_hash": "25c125d4926b4f4ff094effe33eca227",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 161,
"avg_line_length": 86.42105263157895,
"alnum_prop": 0.7350791717417783,
"repo_name": "titansgroup/python-phonenumbers",
"id": "8eaa0dc5d95b5c03402c6270551b6936f20a4d82",... |
"""Collection of exceptions and warnings for `plasmapy.particles`."""
__all__ = [
"ParticleError",
"ParticleWarning",
"ChargeError",
"InvalidElementError",
"InvalidIonError",
"InvalidIsotopeError",
"InvalidParticleError",
"MissingParticleDataError",
"MissingParticleDataWarning",
... | {
"content_hash": "fb993a64683988ddb1d0cb30a8eae7c2",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 76,
"avg_line_length": 20.545454545454547,
"alnum_prop": 0.7040929203539823,
"repo_name": "StanczakDominik/PlasmaPy",
"id": "56acbe4a39aa8488ffde51f14d325c02b633232a",
"siz... |
"""
Test class for iRMC Power Driver
"""
import mock
from oslo_config import cfg
from ironic.common import boot_devices
from ironic.common import exception
from ironic.common import states
from ironic.conductor import task_manager
from ironic.conductor import utils as manager_utils
from ironic.drivers.modules.irmc im... | {
"content_hash": "e7f4bdf6ec103830a33fc16628a7fa26",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 78,
"avg_line_length": 46.52857142857143,
"alnum_prop": 0.5925698495548051,
"repo_name": "redhat-openstack/ironic",
"id": "a3d3a5e4bc2c9d00b44acb163038dab164613fa4",
"size... |
from __future__ import print_function
import argparse
from collections import defaultdict
from ConfigParser import SafeConfigParser
from cPickle import (
dump as pdump,
loads as ploads,
Pickler,
Unpickler,
)
from datetime import datetime
import hashlib
from itertools import chain
from json import loads... | {
"content_hash": "a926221966da67c0cb987060fcb302a6",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 145,
"avg_line_length": 31.514792899408285,
"alnum_prop": 0.643447239954938,
"repo_name": "mattpatey/news-to-epub",
"id": "9087bd8706be0a832858e8d767c07b6c0df3dc0d",
"size... |
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Image pipeline
createReader = vtk.vtkImageReader2Factory()
reader = createReader.CreateImageReader2("" + str(VTK_DATA_ROOT) + "/Data/beach.tif")
reader.SetFileName("" + str(VTK_DATA_ROOT) + "/Dat... | {
"content_hash": "3e9f315b4718569672a145023706daf6",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 85,
"avg_line_length": 41.041666666666664,
"alnum_prop": 0.7563451776649747,
"repo_name": "hlzz/dotfiles",
"id": "514af4dd7f800ee4e54f574a7fab2a5538108a25",
"size": "1008",... |
import math
import shutil
import numpy as np
import pandas as pd
import tensorflow as tf
print(tf.__version__)
tf.logging.set_verbosity(tf.logging.INFO)
pd.options.display.max_rows = 10
pd.options.display.float_format = '{:.1f}'.format
df = pd.read_csv("https://storage.googleapis.com/ml_universities/california_housin... | {
"content_hash": "095f6d9b33a255e15a36f788a7a1949a",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 356,
"avg_line_length": 52.62921348314607,
"alnum_prop": 0.6673783091374893,
"repo_name": "hiraditya/fool",
"id": "edb44825b04a9412e1ec085908f71110aaa01009",
"size": "4807"... |
from __future__ import print_function
import subprocess
import sys
import argparse
import threading
import time
import os
import signal
KARMA_PORT = 9876
JUPYTER_PORT = 9999
argparser = argparse.ArgumentParser(
description='Run KBase Narrative unit tests'
)
argparser.add_argument('-b', '--browsers', defa... | {
"content_hash": "cbd22ba6421a48db630a915ae73c4331",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 116,
"avg_line_length": 28.213333333333335,
"alnum_prop": 0.6658790170132325,
"repo_name": "msneddon/narrative",
"id": "d2c2afd75508dea2744e31a9a2c34bbd73a21e4a",
"size": "... |
"""Implementations of resource abstract base class searches."""
# pylint: disable=invalid-name
# Method names comply with OSID specification.
# pylint: disable=no-init
# Abstract classes do not define __init__.
# pylint: disable=too-few-public-methods
# Some interfaces are specified as 'markers' and include... | {
"content_hash": "a6e55f9b6e5d85854adc2b3a3710b99e",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 136,
"avg_line_length": 38.667655786350146,
"alnum_prop": 0.674084874529967,
"repo_name": "mitsei/dlkit",
"id": "6583c4e7be4b01c36ea5e0770cdfd5cb446b14da",
"size": "13031"... |
from django_downloadview.apache.response import XSendfileResponse
from django_downloadview.middlewares import (ProxiedDownloadMiddleware,
NoRedirectionMatch)
class XSendfileMiddleware(ProxiedDownloadMiddleware):
"""Configurable middleware, for use in decorators or in g... | {
"content_hash": "a3cb1117c6a1ad2dff0bf9fbc334be99",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 79,
"avg_line_length": 47.8,
"alnum_prop": 0.6178521617852162,
"repo_name": "thedrow/django-downloadview",
"id": "ee854b36ed4470d13feda80b9015f6fe17a428bf",
"size": "1434",... |
SHORTEN_URL_MIN_LENGTH = 5
| {
"content_hash": "7d9108342101b908e9354bbd4c1f0e9f",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 26,
"avg_line_length": 27,
"alnum_prop": 0.7407407407407407,
"repo_name": "Cannymax/shortenurl",
"id": "a162a1c02a377598d709e8591a4ec7485bc560ce",
"size": "44",
"binary": ... |
from django.db import models, migrations
from django.conf import settings
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Job',
... | {
"content_hash": "eed297048306b4f5c9df86b18a45ae2c",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 130,
"avg_line_length": 37.75,
"alnum_prop": 0.5733207190160833,
"repo_name": "WikiWatershed/model-my-watershed",
"id": "dac56e73f3c1c7b167b38ebb5ff4a75b92dcaf59",
"size": ... |
import pytest
import libqtile.widget
from test.widgets.test_crypto_ticker import RESPONSE
@pytest.fixture
def widget():
ticker = libqtile.widget.CryptoTicker
ticker.RESPONSE = RESPONSE
yield ticker
@pytest.mark.parametrize(
"screenshot_manager", [{}, {"format": "{crypto}:{amount:,.2f}"}], indirect=... | {
"content_hash": "339daa18ac33abc9f1f5e5b319f14b26",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 94,
"avg_line_length": 26.57894736842105,
"alnum_prop": 0.7326732673267327,
"repo_name": "ramnes/qtile",
"id": "afc61d542f504f0468ea922e4a3ca330c650e2e4",
"size": "1595",
... |
"""Add Tags and Social Profiles
Revision ID: 578ce9f8d1
Revises: 29ef29bfbe43
Create Date: 2017-12-07 19:34:45.949358
"""
# revision identifiers, used by Alembic.
revision = '578ce9f8d1'
down_revision = '29ef29bfbe43'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from sql... | {
"content_hash": "09b6383c98dd22ded871af86f788d40f",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 116,
"avg_line_length": 30.862068965517242,
"alnum_prop": 0.7184357541899441,
"repo_name": "codeforamerica/cfapi",
"id": "12cd8ff7414a0d2612a204c601f199510099ea1b",
"size":... |
from Exscript.util import ipv4
from Exscript.stdlib.util import secure_function
@secure_function
def in_network(scope, prefixes, destination, default_pfxlen=[24]):
"""
Returns True if the given destination is in the network range that is
defined by the given prefix (e.g. 10.0.0.1/22). If the given prefix
... | {
"content_hash": "2649774f503bc46f8eea0fd075d2f6c6",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 78,
"avg_line_length": 31.15671641791045,
"alnum_prop": 0.6720958083832336,
"repo_name": "maximumG/exscript",
"id": "9590a6917378c979a9d51a913ebf18d4a5c9b1b8",
"size": "52... |
"""An Application for launching a kernel"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
import atexit
import os
import sys
import signal
import traceback
import logging
from tornado import ioloop
import zmq
from zmq.event... | {
"content_hash": "bcb64f02c62b22555bde9bf7c07b4276",
"timestamp": "",
"source": "github",
"line_count": 491,
"max_line_length": 101,
"avg_line_length": 39.79226069246436,
"alnum_prop": 0.6176681338929266,
"repo_name": "ammarkhann/FinalSeniorCode",
"id": "59190c019923eec57769fa1738526cf141af3dd8",
"... |
from django import dispatch
# This signal is sent before a release_component object is updated. The argument contains
# the original value.
releasecomponent_pre_update = dispatch.Signal(providing_args=['request', 'release_component'])
# This signal is sent after a release_component object is updated in the database.... | {
"content_hash": "12f61092dd2040a479256dd8a7673e0c",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 95,
"avg_line_length": 54.56521739130435,
"alnum_prop": 0.7944223107569721,
"repo_name": "puiterwijk/product-definition-center",
"id": "1fd4cd5205bab582041d6a4b3fb19a854dc5d3... |
"""Support for recording details."""
import asyncio
from collections import namedtuple
import concurrent.futures
from datetime import datetime, timedelta
import logging
import queue
import threading
import time
from typing import Any, Dict, Optional # noqa: F401
import voluptuous as vol
from homeassistant.const impo... | {
"content_hash": "38100998fddfdf390e3991f5180f26c2",
"timestamp": "",
"source": "github",
"line_count": 411,
"max_line_length": 79,
"avg_line_length": 35.89051094890511,
"alnum_prop": 0.5697918785167108,
"repo_name": "jamespcole/home-assistant",
"id": "0df1fa42ad4913baf3edf842c65e92c7bd5cb067",
"si... |
"""Configuration loading and objects."""
import sys
import pathlib
import threading
import configparser
import collections.abc
from jacquard.storage import open_engine
from jacquard.directory import open_directory
class Config(collections.abc.Mapping):
"""
System configuration.
Users should not instant... | {
"content_hash": "6429b37d978cb5cecb40d1faf424cf35",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 78,
"avg_line_length": 28.128440366972477,
"alnum_prop": 0.6190476190476191,
"repo_name": "prophile/jacquard",
"id": "9cdb17b779847c288d4a4ecc0a855288b10649fb",
"size": "3... |
"""
celery.app.utils
~~~~~~~~~~~~~~~~
App utilities: Compat settings, bugreport tool, pickling apps.
"""
from __future__ import absolute_import
import os
import platform as _platform
import re
from collections import Mapping
from celery.datastructures import ConfigurationView
from celery.five import it... | {
"content_hash": "3d620a7559f7f07fd46abb3e45dad569",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 77,
"avg_line_length": 31.314285714285713,
"alnum_prop": 0.6122262773722628,
"repo_name": "sivaprakashniet/push_pull",
"id": "5a982cb26d0dcce364b7c60fc26fa9d7dc4fd88a",
"s... |
from __future__ import division
import os
import ply.lex as lex
import ply.yacc as yacc
import re
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
lexer = None
scope_lineno = 0
identifier_lineno = {}
_parse_info=None
_parsedata=None
noExceptionLogic = True
def ... | {
"content_hash": "bf1a12b8200a491b1d3ec90df4c8112d",
"timestamp": "",
"source": "github",
"line_count": 2140,
"max_line_length": 487,
"avg_line_length": 32.97663551401869,
"alnum_prop": 0.4710358509281564,
"repo_name": "ghost-kit/archive",
"id": "616dcda0407f9eba049197a1c95916807fdcaa34",
"size": "... |
from connector import channel
from google3.cloud.graphite.mmv2.services.google.container_azure import node_pool_pb2
from google3.cloud.graphite.mmv2.services.google.container_azure import (
node_pool_pb2_grpc,
)
from typing import List
class NodePool(object):
def __init__(
self,
name: str = N... | {
"content_hash": "f6f66ef3a8c20378128603e048e0a875",
"timestamp": "",
"source": "github",
"line_count": 514,
"max_line_length": 85,
"avg_line_length": 35.5136186770428,
"alnum_prop": 0.645338008107812,
"repo_name": "GoogleCloudPlatform/declarative-resource-client-library",
"id": "c788daff71f60417c374... |
from ElementBase import ElementBase
from ElementParameter import ElementParameter
from ElementValue import ElementValue
class Nothing(ElementBase):
def __init__(self):
self.status = 'running'
self.output = None
self.params = None
self.type = 'Standard'
self.setup_params()
def can_handle_list(self):
re... | {
"content_hash": "0f29d06d123d0b6deea49a1f91529887",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 79,
"avg_line_length": 19,
"alnum_prop": 0.6920077972709552,
"repo_name": "shaun-h/istaflow",
"id": "601d96255f8611f78953b00294a175402692865c",
"size": "1042",
"binary": ... |
import os
import sys
import time
from atve.log import LOG as L
from atve.script import AtveTestCase
class TestCase(AtveTestCase):
def __init__(self, *args, **kwargs):
super(TestCase, self).__init__(*args, **kwargs)
@classmethod
def setUpClass(cls):
L.info("*** Start TestCase : %s *** "... | {
"content_hash": "f7af6dc971cad5c0bc8da11802702be5",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 74,
"avg_line_length": 29.129032258064516,
"alnum_prop": 0.5891472868217055,
"repo_name": "TE-ToshiakiTanaka/atve",
"id": "1ee6832e90bf4b443e77cc73e847ba242391ff42",
"size"... |
from asserts import ok, equal, notEqual, getResults
from helper import doCssCheck, doCssTextCheck
from ckstyle.reporter.helper import fill
def doTest():
logs, warns, errors = doCssTextCheck('/* @author: zhifu.wang**/ /* .test {width: 100px;}*/', 'test.css')
equal(len(errors), 1, 'one error occur')
equal(fi... | {
"content_hash": "0cf9f8f931dbc7ab8e10ae41050ad3a9",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 134,
"avg_line_length": 49.27272727272727,
"alnum_prop": 0.6623616236162362,
"repo_name": "wangjeaf/CSSCheckStyle",
"id": "8f0811a058bcfc2692151bc204430cb1312d6fdf",
"size"... |
from django.shortcuts import render, redirect
from django.conf import settings
import foursquare
from .forms import LocationForm
from .models import Place
from django.db.models import QuerySet
def home(request, tmpl='places/home.html'):
data = {}
place_list = Place.objects.all()
data['place_list'] = plac... | {
"content_hash": "740dd040542595e32e107f70a58be918",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 138,
"avg_line_length": 30.721649484536083,
"alnum_prop": 0.5890939597315437,
"repo_name": "CzechHackathon2014/juice-my-device",
"id": "3ba996c6e7b893c2cacb9e7a92d37847361c2... |
import sys
import time
import subprocess
import json
import os
import signal
import shutil
from collections import defaultdict
from ipaddress import IPv4Network
from mininet.net import Mininet
from mininet.node import Node
from mininet.log import lg, info, error
from mininet.util import quietRun
from mininet.term impo... | {
"content_hash": "f6f2ad98b9d12644c6175d5b7d3d0f1f",
"timestamp": "",
"source": "github",
"line_count": 992,
"max_line_length": 148,
"avg_line_length": 38.221774193548384,
"alnum_prop": 0.5601065513239794,
"repo_name": "netgroup/Dreamer-Mininet-Extensions",
"id": "e449898cc099e6c24016eaae539b4b3e30b8... |
class Solution:
# @param head, a ListNode
# @return a ListNode
def deleteDuplicates(self, head):
if head is None:
return None
if head.next is None:
return head
last = head
current = head.next
while current is not None:
next_node = c... | {
"content_hash": "9913258415c2350d27aef24d626af4cd",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 39,
"avg_line_length": 28.94736842105263,
"alnum_prop": 0.49818181818181817,
"repo_name": "jamesblunt/leetcode-python",
"id": "252de545368dca8ea240b13e6ecd73d948fb25c5",
"s... |
import threading
import json
class NodeCommunicator:
def __init__(self, server, node_id, address, socket):
self.server = server
self.address = address
self.socket = socket
self.node_id = node_id
threading.Thread(target=self.run).start()
def run(self):
while... | {
"content_hash": "bf2ce76a4f844e5bd85d6c434d8630ac",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 57,
"avg_line_length": 25.035714285714285,
"alnum_prop": 0.5534950071326676,
"repo_name": "MohamedBassem/dTests",
"id": "04df5144a1a2b63eab7b1d761c3373a1e44db54a",
"size": ... |
'''
Copyright (C) 2012 Diego Torres Milano
Created on Apr 30, 2013
@author: diego
'''
from com.dtmilano.android.viewclient import ViewClient
ViewClient(*ViewClient.connectToDeviceOrExit()).traverse(transform=ViewClient.TRAVERSE_CIT)
| {
"content_hash": "54650d6ea69ff3cb6a9383409569980f",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 91,
"avg_line_length": 23.7,
"alnum_prop": 0.7890295358649789,
"repo_name": "akimo12345/AndroidViewClient",
"id": "66eef29f865f167f49806d9ebf6bdfc7021c85f2",
"size": "688",... |
import copy
import inspect
import warnings
from functools import partialmethod
from itertools import chain
import django
from django.apps import apps
from django.conf import settings
from django.core import checks
from django.core.exceptions import (
NON_FIELD_ERRORS,
FieldDoesNotExist,
FieldError,
Mul... | {
"content_hash": "d3e9393c9330448f5d1f789be274c2ba",
"timestamp": "",
"source": "github",
"line_count": 2474,
"max_line_length": 88,
"avg_line_length": 39.774858528698466,
"alnum_prop": 0.5068443035273315,
"repo_name": "pauloxnet/django",
"id": "584db319da6830468e27637420df54e34133246f",
"size": "9... |
'''
'''
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License");... | {
"content_hash": "e90715b20643f93f33fb615cc2158cf5",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 114,
"avg_line_length": 35.88108108108108,
"alnum_prop": 0.7255197348598975,
"repo_name": "dyrock/trafficserver",
"id": "cec66ed4ff6bb63143fd7c23ae7c38ac29e8b717",
"size":... |
'''
Created on 20 Jan 2017
@author: John Ngok CHao Ho
'''
def p2f(x):
return float(x.strip('%'))/100
def ratings(Product_ID):
import requests
import re
page_param=''.join(("contextId=dpx&asin=",Product_ID))
page=requests.get("https://www.amazon.com/gp/customer-reviews/widgets/average-customer-revi... | {
"content_hash": "bb02825500411ed92c496f5bc5fd60c1",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 142,
"avg_line_length": 33.80555555555556,
"alnum_prop": 0.6499589153656532,
"repo_name": "ngokchaoho/Amazon-Ratings-and-Reviews",
"id": "e45d7e519c36bc5c792bf5c96b6e7cca566d... |
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from .. import models
class Operations(object):
"""Operations operations.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An ob... | {
"content_hash": "0d80dc5d46f243c22bc7b746d00530fd",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 144,
"avg_line_length": 38.08139534883721,
"alnum_prop": 0.6256488549618321,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "5b97678d90f7d8f4482107a5f68379b820e9b405",... |
"""
main.py -- Udacity conference server-side Python App Engine
HTTP controller handlers for memcache & task queue access
$Id$
created by wesc on 2014 may 24
modified by Jack Chang on 2015 nov 11
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
import webapp2
from google.appengine.api import app_identity
from... | {
"content_hash": "5671f2839b96ccf030ec3fdf4ae76aef",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 74,
"avg_line_length": 36.3125,
"alnum_prop": 0.6660929432013769,
"repo_name": "wei0831/SimpleConferenceCentral",
"id": "248249a5439be199f79447e23e3272a398d26df5",
"size": ... |
"""models.py
Udacity conference server-side Python App Engine data & ProtoRPC models
$Id: models.py,v 1.1 2014/05/24 22:01:10 wesc Exp $
created/forked from conferences.py by wesc on 2014 may 24
"""
__authors__ = 'wesc+api@google.com (Wesley Chun) and Landon Bennett'
import httplib
import endpoints
from protorpc impo... | {
"content_hash": "7f52f60af99586eb0e68ecd6917188be",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 77,
"avg_line_length": 32.21264367816092,
"alnum_prop": 0.6990187332738627,
"repo_name": "WebDesigner32/ConferenceCentralApp",
"id": "ff3c6574fa657c354c8fdd33b034bce27b4bfbc... |
import os
from test_pants_plugin.pants_testutil_tests import PantsTestutilTests
from test_pants_plugin.subsystems.pants_testutil_subsystem import PantsTestutilSubsystem
from test_pants_plugin.tasks.deprecation_warning_task import DeprecationWarningTask
from test_pants_plugin.tasks.lifecycle_stub_task import LifecycleS... | {
"content_hash": "288c6d26df48754aacc8d74b2d4cabe6",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 93,
"avg_line_length": 35.25,
"alnum_prop": 0.7963525835866262,
"repo_name": "wisechengyi/pants",
"id": "4a7775a5a4217eb2f87e2eed10cc2d5b58f13cc6",
"size": "1119",
"binar... |
import pymel.core
class NodeWrapper(object):
def __init__(self, node):
self.node = pymel.core.PyNode(node)
def __getattr__(self, attr):
return self.node.getAttr(attr)
def __setattr__(self, attr, value):
super(NodeWrapper, self).__setattr__(attr, value) | {
"content_hash": "d9b28a6de4f3f65a1a8d0787958ed4c8",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 57,
"avg_line_length": 24.333333333333332,
"alnum_prop": 0.6198630136986302,
"repo_name": "danielforgacs/MayaTools",
"id": "9fbfb65ec0a6caee1a484519118c7be9967aed8c",
"size... |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("SVR_rbf" , "freidman2" , "hive")
| {
"content_hash": "f792d67e4c2ad1d461fcbb93f5e1c767",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 66,
"avg_line_length": 30.5,
"alnum_prop": 0.7459016393442623,
"repo_name": "antoinecarme/sklearn2sql_heroku",
"id": "9ef4c85d1de42420b55d6d3a29f9b9335f53a83b",
"size": "122... |
import httplib, json, requests
class Connection:
def __init__( self, host, port, api_version ):
self.host = host
self.port = port
self.api_version = api_version
self.printer = None
def api_get( self, path ):
try:
addr = 'http://' + self.host + ':' + self.po... | {
"content_hash": "03ba497d64819cf3fc323c652327015a",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 94,
"avg_line_length": 30.615384615384617,
"alnum_prop": 0.4917770671539516,
"repo_name": "socialdevices/manager",
"id": "a99398de1988ea3fb13d67c6a62b1ecb3fefcb16",
"size"... |
t_channel = '@reddit_food'
subreddit = 'food'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| {
"content_hash": "300d213ec1cc658bf0ec7ebd0b7f91c0",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 38,
"avg_line_length": 19.833333333333332,
"alnum_prop": 0.7058823529411765,
"repo_name": "nsiregar/reddit2telegram",
"id": "7f184420f5a50305561aa1d7f3db3cebad1d01bb",
"size... |
from setuptools import setup
import os
import sys
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
setup(
name='drax',
version='0.3.0',
author='tax',
author_email='paultax@gmail.com',
include_package_data=True,
description='Dashboard inspired by dash... | {
"content_hash": "22577e8bba055377da10e88b6427d88b",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 76,
"avg_line_length": 22.821428571428573,
"alnum_prop": 0.6197183098591549,
"repo_name": "tax/drax",
"id": "3aeda98284db122bb5243bec9fceba159f6c43c0",
"size": "663",
"bi... |
"""
Die Modelle der Scholien-Artikel und Büchlein
"""
from django.db import models
from django.core.files import File
from urllib.request import urlopen
import os
import io
from django.urls import reverse
from django.core.exceptions import ValidationError
from seite.models import Grundklasse
from Produkte.models impo... | {
"content_hash": "b62f9ce1c801d5d8e2edd77f6cc7a65f",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 152,
"avg_line_length": 36.28,
"alnum_prop": 0.6551819184123484,
"repo_name": "valuehack/scholarium.at",
"id": "ee3bd291f1618df788ad4bfe13ffc6de42cd7105",
"size": "3631",
... |
from collections import deque
import unittest
from test import support, seq_tests
import gc
import weakref
import copy
import pickle
from io import StringIO
import random
import struct
BIG = 100000
def fail():
raise SyntaxError
yield 1
class BadCmp:
def __eq__(self, other):
raise RuntimeError
cl... | {
"content_hash": "eea5021048fc69f8f9c7a78964805d6b",
"timestamp": "",
"source": "github",
"line_count": 820,
"max_line_length": 85,
"avg_line_length": 31.54390243902439,
"alnum_prop": 0.5121781489213639,
"repo_name": "samuelhavron/heroku-buildpack-python",
"id": "5ecbc73c99df4a8adfe8691811cf18ee4d7e4... |
import coloredlogs
import logging
import sys
coloredlogs.install(fmt='%(message)s')
def create_logger():
#logging.basicConfig(format='%(levelname)s - %(message)s')
logging.basicConfig(format='%(message)s')
root = logging.getLogger()
root.setLevel(logging.getLevelName('INFO'))
#Add handler for st... | {
"content_hash": "6c49e84feb29db2d2a779dd6a2299bd5",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 62,
"avg_line_length": 29.08695652173913,
"alnum_prop": 0.70254110612855,
"repo_name": "ericforbes/post-review",
"id": "9974c6e1c245b6d357a3a34809e92c6b35fc5548",
"size": "... |
from case import Case
class Case3_6(Case):
DESCRIPTION = """Send Ping with <b>RSV = 6</b>."""
EXPECTATION = """The connection is failed immediately, since RSV must be 0."""
def onOpen(self):
payload = "Hello, world!"
self.expected[Case.OK] = []
self.expectedClose = {"closedBy... | {
"content_hash": "76353f6c37e2655cbed84ed6da51e91a",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 122,
"avg_line_length": 33.2,
"alnum_prop": 0.6285140562248996,
"repo_name": "tavendo/AutobahnTestSuite",
"id": "5ce72e2ddb4a0d2e1ae500b7af4b380f04914dc5",
"size": "1296",
... |
"""Implementation of various cryptographic types."""
import hashlib
import struct
from M2Crypto import BIO
from M2Crypto import EVP
from M2Crypto import RSA
from M2Crypto import util
from M2Crypto import X509
import logging
from grr.lib import rdfvalue
from grr.lib import type_info
from grr.lib import utils
from g... | {
"content_hash": "04312d15a798b9cf52b002c79af4566b",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 76,
"avg_line_length": 25.868525896414344,
"alnum_prop": 0.6640997997843832,
"repo_name": "bgalehouse/grr",
"id": "ff3716fc96ca9f78a95f407ad0095da5670c46eb",
"size": "6515... |
from core.himesis import Himesis
import uuid
class Hlayer3rule1(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule layer3rule1.
"""
# Flag this instance as compiled now
self.is_compiled = True
super(Hlayer3rule1, self).__init__(name='Hlayer3rule1', num_nodes=0, edg... | {
"content_hash": "8c6de966298f688b40c4ee16e0ac075b",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 137,
"avg_line_length": 41.2,
"alnum_prop": 0.6980071538068472,
"repo_name": "levilucio/SyVOLT",
"id": "ae0578bf27102fcbdd108d75dc26a8238f8c7703",
"size": "3914",
"binary... |
import puremvc.interfaces
import puremvc.patterns.mediator
from ApplicationConstants import Notification
from pyjamas.Window import alert
class DialogMediator(puremvc.patterns.mediator.Mediator, puremvc.interfaces.IMediator):
NAME = 'DialogMediator'
def __init__(self, viewComponent):
super(DialogMe... | {
"content_hash": "34dd2e704d7c3abda1127dab74dd0b3d",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 87,
"avg_line_length": 27.64516129032258,
"alnum_prop": 0.6511085180863477,
"repo_name": "lovelysystems/pyjamas",
"id": "2624768310cc07dea3c44ad2b1169b8f47a03087",
"size": ... |
from marvinbot.cache_impl import configure_cache
from marvinbot.utils import get_config
cache = configure_cache(get_config())
| {
"content_hash": "4f339c73973c08d0b066a4dc7e309049",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 48,
"avg_line_length": 25.6,
"alnum_prop": 0.8046875,
"repo_name": "BotDevGroup/marvin",
"id": "fa435ab497bf3654ec904581c60ed738707afaa9",
"size": "128",
"binary": false,
... |
"""
Copyright (c) 2015, Jairus Martin.
Distributed under the terms of the MIT License.
The full license is in the file COPYING.txt, distributed with this software.
Created on Aug 28, 2015
"""
from atom.api import Int, Typed
from enaml.application import timed_call
from qtpy.QtCore import QAbstractTableModel
from qtpy.Q... | {
"content_hash": "8e984c00bd03a92a2022a285c17e8c2f",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 86,
"avg_line_length": 33.556650246305416,
"alnum_prop": 0.6190546095126248,
"repo_name": "frmdstryr/enamlx",
"id": "a36c9bae6e9a2076a3db428d1d88efae5d15db13",
"size": "68... |
def get_drop_dates_and_len(df, allow_missing_num=3):
"""
Find missing values and get records to drop
"""
missing_num = df.total.isnull().astype(int)\
.groupby(df.total.notnull().astype(int).cumsum()).sum()
drop_missing_num = missing_num[missing_num > allow_missing_num]
drop_datetimes = d... | {
"content_hash": "a3c2a14c2ff3e55a97637f4da8488c22",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 97,
"avg_line_length": 38.98863636363637,
"alnum_prop": 0.5756339259691052,
"repo_name": "intel-analytics/analytics-zoo",
"id": "e2d8f4abf53e9390f18e17a421ad99de68bbafd2",
... |
"""Support for Nexia switches."""
from __future__ import annotations
from typing import Any
from nexia.const import OPERATION_MODE_OFF
from nexia.home import NexiaHome
from nexia.thermostat import NexiaThermostat
from nexia.zone import NexiaThermostatZone
from homeassistant.components.switch import SwitchEntity
from... | {
"content_hash": "6cec805175f98fe76988dd565ac37fad",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 86,
"avg_line_length": 36.436619718309856,
"alnum_prop": 0.6930807885581755,
"repo_name": "nkgilley/home-assistant",
"id": "e242032c94782ceba47c8064f9821145b41b9e07",
"size... |
try:
from .pyolite import Pyolite
except ImportError as exp:
# need this in order to make versioneer work
pass
| {
"content_hash": "5aae548e8dbfae4b196032366f860658",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 48,
"avg_line_length": 24.6,
"alnum_prop": 0.7154471544715447,
"repo_name": "PressLabs/pyolite",
"id": "3f9f124d21f37be7bf1ec8abb39969d7b64ce9aa",
"size": "123",
"binary":... |
from mlp import MLP
| {
"content_hash": "fc76c71639d2a095d046a3d71985c6a2",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 19,
"avg_line_length": 20,
"alnum_prop": 0.8,
"repo_name": "fberanizo/neural_network",
"id": "ab80b69b70999f2d329db8424b3e3644a8ca2e26",
"size": "20",
"binary": false,
"... |
"""A fast but lossy, totally generic object formatter."""
import os
import types
from google.net.proto import ProtocolBuffer
EASY_TYPES = (type(None), int, long, float, bool)
META_TYPES = (type, types.ClassType)
STRING_TYPES = (str, unicode)
CONTAINER_TYPES = {tuple: ('(', ')'),
list: ('[', ']')... | {
"content_hash": "ee4aa8185950a9075209c18f4fabdc5c",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 76,
"avg_line_length": 25.484848484848484,
"alnum_prop": 0.5249702734839476,
"repo_name": "undoware/neutron-drive",
"id": "348bca4fac3fa276314f3984a407d737431182e8",
"size... |
from keystone.common import sql
from keystone import exception
from keystone.i18n import _
class ProjectEndpoint(sql.ModelBase, sql.DictBase):
"""project-endpoint relationship table."""
__tablename__ = 'project_endpoint'
attributes = ['endpoint_id', 'project_id']
endpoint_id = sql.Column(sql.String(64... | {
"content_hash": "69cd0b812c88a9ee91ff9831f5d2503b",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 74,
"avg_line_length": 40.704918032786885,
"alnum_prop": 0.6069271043093033,
"repo_name": "reeshupatel/demo",
"id": "25c4d5b683179f98bb800aceef2a9ff0a4f9a642",
"size": "306... |
"""Manage network settings."""
# :license: MIT, see LICENSE for more details.
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import helpers
import click
@click.command()
@click.argument('identifier')
@click.argument('network-type', type=click.Choice(['public', 'private']))
@click.option('... | {
"content_hash": "10a6f38643c910d09b88a065ae34e16c",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 73,
"avg_line_length": 29.14814814814815,
"alnum_prop": 0.6632782719186785,
"repo_name": "briancline/softlayer-python",
"id": "7ef27a4ab7cbb126b2f0eed94a9c69cfbce201d5",
"s... |
"""
Copyright (c) 2021 Project CHIP Authors
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, so... | {
"content_hash": "05f70f03eacb311dba71d22692e00582",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 129,
"avg_line_length": 33.53,
"alnum_prop": 0.6188487921264539,
"repo_name": "nestlabs/connectedhomeip",
"id": "fb1b8d275444e47fe8382fed0d84e3cfbca001e2",
"size": "3376",... |
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
from msrest import Serializer
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineRespon... | {
"content_hash": "2a2cfeb9ded7b20fedbc1b4871375866",
"timestamp": "",
"source": "github",
"line_count": 648,
"max_line_length": 249,
"avg_line_length": 44.385802469135804,
"alnum_prop": 0.6501286419581392,
"repo_name": "Azure/azure-sdk-for-python",
"id": "deaaac119daa8b1845258b0a8901ce9a0c1a6c35",
... |
"""normalizer
Revision ID: a6b3c5df78e8
Revises: a4c87d04f18e
"""
from alembic import context
from alembic import op
from sqlalchemy import Integer, String, Text, Boolean, UnicodeText
from sqlalchemy.orm import sessionmaker
from sqlalchemy.sql import table, column
# revision identifiers, used by Alembic.
revision = ... | {
"content_hash": "8140594d9593e4cb13d97d9e082eff2e",
"timestamp": "",
"source": "github",
"line_count": 480,
"max_line_length": 178,
"avg_line_length": 37.87916666666667,
"alnum_prop": 0.5827191728082719,
"repo_name": "eubr-bigsea/tahiti",
"id": "9fb522ee6a2a948f91f874708ca373f30330010b",
"size": "... |
"""Parser for Mozilla Firefox3 3 History files."""
__program__ = "firefox3_history.py"
import datetime
import glob
import locale
import sys
import urlparse
from grr.lib import parsers
from grr.lib.rdfvalues import webhistory as rdf_webhistory
from grr.parsers import sqlite_file
class FirefoxHistoryParser(parsers... | {
"content_hash": "e7abcdae9a0345e5f86fb96be2b8b5cd",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 80,
"avg_line_length": 29.377551020408163,
"alnum_prop": 0.6523098298020146,
"repo_name": "destijl/grr",
"id": "70990187408954aee97768108b536c450339b295",
"size": "2951",
... |
"""Code to work with Medline from the NCBI.
Classes:
- Record A dictionary holding Medline data.
Functions:
- read Reads one Medline record
- parse Allows you to iterate over a bunch of Medline records
"""
class Record(dict):
"""A dictionary holding information from a Medline... | {
"content_hash": "1164a98576fbb58a883438f0d001eaf9",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 77,
"avg_line_length": 31.03030303030303,
"alnum_prop": 0.534765625,
"repo_name": "zjuchenyuan/BioWeb",
"id": "25b5ae0a7e13f1445817837d03138e1c19b61bdd",
"size": "5346",
... |
"""
Decorators that check a User a verified email address.
"""
import urlparse
from functools import wraps
from django.contrib import messages
from django.contrib.auth import REDIRECT_FIELD_NAME, logout as auth_logout
from django.contrib.sites.models import RequestSite, Site
from django.utils.decorators import availa... | {
"content_hash": "cbd02d58d160d7b203c069f970005929",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 80,
"avg_line_length": 38.25,
"alnum_prop": 0.6356814330670539,
"repo_name": "smirolo/djaodjin-signup",
"id": "0c489406f7bebab3618ff466b444739e56feff2b",
"size": "5475",
... |
import os
import unittest
import sys
import inmembrane
import inmembrane.tests
from inmembrane import helpers
from inmembrane.plugins import lipop1
from inmembrane.tests.PluginTestBase import PluginTestBase
class TestLipoP(PluginTestBase):
_plugin_name = "lipop1"
def test_lipop1(self):
if not self.... | {
"content_hash": "fbd7630778d7ba500e9791abb02a3b49",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 79,
"avg_line_length": 27.45,
"alnum_prop": 0.6147540983606558,
"repo_name": "boscoh/inmembrane",
"id": "3cb848b1a1a588f6c2c35fb09e4d7a8ae59f020f",
"size": "1098",
"binar... |
from msrest.serialization import Model
class ComputeNodeEndpointConfiguration(Model):
"""The endpoint configuration for the compute node.
:param inbound_endpoints: The list of inbound endpoints that are
accessible on the compute node.
:type inbound_endpoints: list[~azure.batch.models.InboundEndpoint... | {
"content_hash": "5943bcab8c607351dc3c78a5f358d268",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 86,
"avg_line_length": 31.045454545454547,
"alnum_prop": 0.677891654465593,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "96231abc759f19f7fc8e707af9d5d8afd81f3a26",
"... |
traindat = '../data/fm_train_real.dat'
testdat = '../data/fm_test_real.dat'
parameter_list=[[traindat,testdat, 1.0],[traindat,testdat, 5.0]]
def kernel_exponential_modular (train_fname=traindat,test_fname=testdat, tau_coef=1.0):
from modshogun import RealFeatures, ExponentialKernel, EuclideanDistance, CSVFile
feat... | {
"content_hash": "dbebd6c74fdb736d0226b0dba71ffd32",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 87,
"avg_line_length": 34.04347826086956,
"alnum_prop": 0.7573435504469987,
"repo_name": "Saurabh7/shogun",
"id": "41aa3e8f74129f4f41a6cbf38549b20cf463a90e",
"size": "805",... |
import time
import copy
import io
import base64
import math
import md5
import re
import traceback
import xml.etree.ElementTree as ET
import xml.dom.minidom as minidom
from PIL import Image
try:
import jcconv
except ImportError:
jcconv = None
try:
import qrcode
except ImportError:
qrcode = None
from... | {
"content_hash": "637b65edebfdcc151e28698d8419b5cf",
"timestamp": "",
"source": "github",
"line_count": 917,
"max_line_length": 146,
"avg_line_length": 34.56052344601963,
"alnum_prop": 0.4735264420042913,
"repo_name": "cristianquaglio/odoo",
"id": "4051e65066c1489a309a111d64bc143dd98b8f5d",
"size":... |
from django.shortcuts import render
from django.views.generic import CreateView, TemplateView, DetailView
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from django.core.mail import send_mail
from django.conf import settings
from . import default_email_content_template, def... | {
"content_hash": "fbac75d125e7091863d8827315b1be9b",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 103,
"avg_line_length": 32.05681818181818,
"alnum_prop": 0.6770648706132577,
"repo_name": "TheUKDave/secret_santa",
"id": "487925ef980339caeb2a007d4a5c8c0662cc6f5a",
"size"... |
import cPickle
_end = '_end_'
# Implementation of Trie using Dictionaries in python
def make_trie(words):
root=dict()
for i in words :
cd=root
for letter in i:
cd=cd.setdefault(letter,{})
cd=cd.setdefault(_end,_end)
return root
def in_trie(trie,word):
cd=trie
for letter in word:
if letter in cd:
c... | {
"content_hash": "c1d673843cae30ca0ab66555b93b7e68",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 78,
"avg_line_length": 19.436363636363637,
"alnum_prop": 0.6669784845650141,
"repo_name": "tusharmakkar08/TRIE_Data_Structure",
"id": "9cfbca5e8f694041fe84f92fb41ba3736bbfff2... |
full_group = set(["1", "2", "3", "4", "5", "6", "7", "8", "9"])
class Group(object):
def __init__(self, cells):
self.cells = set(cells)
def __len__(self):
return len(self.cells)
@property
def full(self):
return len(self.cells) == 9
@property
def empty(self):
... | {
"content_hash": "5e831a70e2831f046dccab7325350d87",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 63,
"avg_line_length": 21.40740740740741,
"alnum_prop": 0.5294117647058824,
"repo_name": "hockeybuggy/sudoku_solver",
"id": "acf1e6ea5647430dce86171a5fe872d83efa907b",
"siz... |
"""Tests for binary operators on subtypes of built-in types."""
import unittest
from test import test_support
def gcd(a, b):
"""Greatest common divisor using Euclid's algorithm."""
while a:
a, b = b%a, a
return b
def isint(x):
"""Test whether an object is an instance of int or long."""
re... | {
"content_hash": "16fa930bc0ca13764e5c8bc7b0d1c5da",
"timestamp": "",
"source": "github",
"line_count": 328,
"max_line_length": 78,
"avg_line_length": 32.5640243902439,
"alnum_prop": 0.5298193053084918,
"repo_name": "MalloyPower/parsing-python",
"id": "1a4228928b1d3bd00005cc2cd1f78dc5705f8ec8",
"si... |
import os
import unittest
import numpy as np
import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import *
from tensorlayer.models import *
from tests.utils import CustomTestCase
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
def basic_static_model():
ni = Input((None, 24, 24, 3))
nn = Conv2d... | {
"content_hash": "5991512b060a01895af9e6e039f5d2f3",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 109,
"avg_line_length": 40.62280701754386,
"alnum_prop": 0.6294536817102138,
"repo_name": "zsdonghao/tensorlayer",
"id": "ea51b0ff452086d5add7617c991fb9b11cd92b4e",
"size"... |
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1beta1Ce... | {
"content_hash": "52f07f907c54de334ee1278bf05f23b6",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 197,
"avg_line_length": 30.684426229508198,
"alnum_prop": 0.5920929611326299,
"repo_name": "skuda/client-python",
"id": "23b45043112e28854070b8cb6020757b180bd985",
"size":... |
import argparse
import os
import subprocess
import sys
def setup():
global args, workdir
programs = ['ruby', 'git', 'apt-cacher-ng', 'make', 'wget']
if args.kvm:
programs += ['python-vm-builder', 'qemu-kvm', 'qemu-utils']
elif args.docker:
dockers = ['docker.io', 'docker-ce']
fo... | {
"content_hash": "8ca0a22644d38ec1d4a2eca911dd5470",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 231,
"avg_line_length": 56.53658536585366,
"alnum_prop": 0.6318665516249641,
"repo_name": "benzmuircroft/REWIRE.io",
"id": "9604d89269879522050b1f806030c7aa1f2f963b",
"siz... |
import codecs
import json
import logging
import os
import re
from subprocess import Popen, PIPE
import coverage
import requests
from .reporter import CoverallReporter
log = logging.getLogger('coveralls')
class CoverallsException(Exception):
pass
class Coveralls(object):
config_filename = '.coveralls.yml... | {
"content_hash": "0b92c756118b551f29097cdf94e08ac2",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 128,
"avg_line_length": 37.33905579399141,
"alnum_prop": 0.5245977011494253,
"repo_name": "manish211/coveralls-python",
"id": "7cd7209eb18404b2f1178bc36e072076665fd614",
"... |
from django.contrib import admin
from django.contrib.contenttypes.models import ContentType
class GenericCollectionInlineModelAdmin(admin.options.InlineModelAdmin):
ct_field = "content_type"
ct_fk_field = "object_id"
def __init__(self, parent_model, admin_site):
super(GenericCollectionInlineMo... | {
"content_hash": "aa8303bee2b345849938cf4f27da26d8",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 97,
"avg_line_length": 44.68,
"alnum_prop": 0.7045658012533572,
"repo_name": "indexofire/gravoicy",
"id": "872a09832c1dd6b53383fe7ab8508b7acfca5f5c",
"size": "1117",
"bin... |
r"""
Check Python source code formatting, according to PEP 8.
For usage and a list of options, try this:
$ python pep8.py -h
This program and its regression test suite live here:
https://github.com/pycqa/pep8
Groups of errors and warnings:
E errors
W warnings
100 indentation
200 whitespace
300 blank lines
400 import... | {
"content_hash": "654d8ecbb28081b76efef5fbd624e822",
"timestamp": "",
"source": "github",
"line_count": 2125,
"max_line_length": 79,
"avg_line_length": 38.18164705882353,
"alnum_prop": 0.5591476040228752,
"repo_name": "Tokyo-Buffalo/tokyosouth",
"id": "3c950d499ee3ca97714e8fe8cf0b6b28e30f36ae",
"si... |
"""
Vectorize to a simple format for testing an LSTM script
"""
import sys
import argparse
from itertools import chain
import cPickle as pickle
from sklearn.cross_validation import train_test_split
from pymaptools.vectorize import enumerator
from pymaptools.io import GzipFileType, read_json_lines
from flaubert.conf im... | {
"content_hash": "7a8c523d17c9986f9b87ba0002d422b2",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 88,
"avg_line_length": 31.047619047619047,
"alnum_prop": 0.656441717791411,
"repo_name": "escherba/flaubert",
"id": "39efce1d11bacbff37b7775563930a245f5b9eed",
"size": "130... |
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.5.1-pre.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
"""
import unittest
import openapi_client
from openapi_client.model.free_s... | {
"content_hash": "f9a04934eff61eb6b3b712391d46492e",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 85,
"avg_line_length": 23.205882352941178,
"alnum_prop": 0.6755386565272496,
"repo_name": "cliffano/swaggy-jenkins",
"id": "a637bd24427d0d4bdfa0b31db80cf837b65204a8",
"size... |
"""
@package mi.instrument.star_asimet.bulkmet.metbk_a.driver
@file marine-integrations/mi/instrument/star_aismet/bulkmet/metbk_a/driver.py
@author Bill Bollenbacher
@brief Driver for the metbk_a
Release notes:
initial version
"""
__author__ = 'Bill Bollenbacher'
__license__ = 'Apache 2.0'
import re
import time
impo... | {
"content_hash": "277f0d2fa41fdc7477009e3590079d57",
"timestamp": "",
"source": "github",
"line_count": 1054,
"max_line_length": 141,
"avg_line_length": 42.645161290322584,
"alnum_prop": 0.596244549256919,
"repo_name": "rmanoni/mi-instrument",
"id": "4d17bcfe71aa5d93f129ab421905485e05ef8a38",
"size... |
#!/usr/bin/env python3
import configparser
import os
import os.path
import subprocess
import nose.tools as nose
import swb.local as swb
from time import strftime
from mock import ANY, call, patch
def test_parse_config():
"""should correctly parse the supplied configuration file"""
config_path = 'tests/files/... | {
"content_hash": "d786b38a6e089c7ce0ec794facc844df",
"timestamp": "",
"source": "github",
"line_count": 403,
"max_line_length": 79,
"avg_line_length": 37.67493796526055,
"alnum_prop": 0.6431535269709544,
"repo_name": "caleb531/ssh-wp-backup",
"id": "5cdffa91c3c03e5b2b228e7f36461554f15e0f62",
"size"... |
"""Deferred initialization of tf.Modules (distributions, bijectors, etc.)."""
import tensorflow.compat.v2 as tf
from tensorflow_probability.python.experimental.util import special_methods
class DeferredModule(tf.Module, special_methods.SpecialMethods):
"""Wrapper to defer initialization of a `tf.Module` instance.... | {
"content_hash": "3aea2ee641e608fc223fb8c95550f620",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 80,
"avg_line_length": 41.12751677852349,
"alnum_prop": 0.7030026109660574,
"repo_name": "tensorflow/probability",
"id": "1a4303d00d17573c5e1afcbfe763902d17153727",
"size"... |
"""
Testing the http sink
"""
import json
from mock import patch
from sinks.http import StatsiteHttp
@patch('requests.post')
def test_http(req):
metrics = [
"foo|123|1500000000",
"bar|456|1500000001",
]
expected = [
{"key": "foo", "value": "123", "timestamp": "1500000000"},
... | {
"content_hash": "b71ae9fa5e9d65b726eed9297e002520",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 71,
"avg_line_length": 22.233333333333334,
"alnum_prop": 0.5832083958020989,
"repo_name": "sleepybishop/statsite",
"id": "c11493319c580dcf1a8b4e15449349cc3052f9dd",
"size":... |
"""
calico.etcddriver.driver
~~~~~~~~~~~~~~~~~~~~~~~~
Contains the logic for the etcd driver process, which monitors etcd for
changes and sends them to Felix over a unix socket.
The driver is responsible for
* loading the configuration from etcd at start-of-day (Felix needs this before
it can receive further updat... | {
"content_hash": "5c645f45c90e4f821c9ebcfff36500dd",
"timestamp": "",
"source": "github",
"line_count": 996,
"max_line_length": 79,
"avg_line_length": 42.84839357429719,
"alnum_prop": 0.5430794104552804,
"repo_name": "TrimBiggs/calico",
"id": "676c418926fa45463513e35b6b141fd2a84d08f8",
"size": "432... |
from struct import unpack,pack
#Exclusive or each byte of a string with a number
#Returns the modified string
def xor(in_str,num):
output = []
for i in in_str:
#This doesn't work in python3 :(
output.append(chr(ord(i) ^ num))
#convert output to a string
output = ''.join(output)
retu... | {
"content_hash": "791a42fe66f97024e33c87320d5d1603",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 89,
"avg_line_length": 34.25301204819277,
"alnum_prop": 0.6739359831164263,
"repo_name": "EmperorArthur/FFXIV_Settings",
"id": "76c764a07899b4e001cfc8eae34a1d679fbfb39c",
"... |
import pickle
import libertyparse
import sys
library_file = sys.argv[1]
pickle_file = sys.argv[2]
with open(library_file, "r") as f:
lib = f.read()
print "Parsing {0} ...".format(library_file)
l = libertyparse.parse(lib)
print "Dump library into {0} ...".format(pickle_file)
pickle.dump(l, open(pic... | {
"content_hash": "3d8e3d4a1eb897ebf0dc48ae95a6c633",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 57,
"avg_line_length": 24,
"alnum_prop": 0.6416666666666667,
"repo_name": "christophmuellerorg/libertyparse",
"id": "3170783602ea8127104b780bdb491d716325a23f",
"size": "382... |
from __future__ import absolute_import
__all__ = ("utcnow",
"parseutc",
"utcstr",
"id",
"newid",
"rtime",
"Stopwatch",
"Tracker",
"EqualityMixin")
import time
import random
import sys
from datetime import dateti... | {
"content_hash": "95bd960075c9e6021ebcdc50bd1a0e48",
"timestamp": "",
"source": "github",
"line_count": 347,
"max_line_length": 123,
"avg_line_length": 26.507204610951007,
"alnum_prop": 0.5744727114590128,
"repo_name": "timkrentz/SunTracker",
"id": "c042f3d49082b1fa2338839fedc24794fff55fc4",
"size"... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "2d04fd2a249b0b820a6f2450384ac82d",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 116,
"avg_line_length": 33.645833333333336,
"alnum_prop": 0.7560371517027864,
"repo_name": "alexryndin/ambari",
"id": "4ae8082585d7dc79254ff010decad5504b43c393",
"size": "1... |
## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more informations
## Copyright (C) Philippe Biondi <phil@secdev.org>
## This program is published under a GPLv2 license
"""
Packet class. Binding mechanism. fuzz() method.
"""
import time,itertools,os
import copy
from fields import StrField... | {
"content_hash": "b34eea0945167cb8e27a8710e7c9ded2",
"timestamp": "",
"source": "github",
"line_count": 1250,
"max_line_length": 137,
"avg_line_length": 35.3992,
"alnum_prop": 0.4947682433501322,
"repo_name": "halitalptekin/isip",
"id": "55710abb1b6cf49abe49ba72cea43572d213084f",
"size": "44249",
... |
from webassets import script
import sys
from oncall.ui import assets_env
def main():
script.main(sys.argv[1:], env=assets_env)
if __name__ == '__main__':
main()
| {
"content_hash": "2ee9c71f8ec67fefd9cbd48733ace1eb",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 45,
"avg_line_length": 14.5,
"alnum_prop": 0.6436781609195402,
"repo_name": "dwang159/oncall",
"id": "693c4262e2d95a97110c5066d68f37681f92a3db",
"size": "334",
"binary": ... |
"""ACME protocol messages."""
import collections
from acme import challenges
from acme import fields
from acme import jose
from acme import util
class Error(jose.JSONObjectWithFields, Exception):
"""ACME error.
https://tools.ietf.org/html/draft-ietf-appsawg-http-problem-00
:ivar unicode typ:
:ivar ... | {
"content_hash": "a71c493f69dd2317323cfaee5bbe7d2b",
"timestamp": "",
"source": "github",
"line_count": 441,
"max_line_length": 82,
"avg_line_length": 31.782312925170068,
"alnum_prop": 0.6577482876712328,
"repo_name": "g1franc/lets-encrypt-preview",
"id": "9d4dcbf30b9c07975cc0357c9b3f5710a95641cf",
... |
from .cli import *
| {
"content_hash": "42afb495d025df2c3e8b96bf958557e2",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 18,
"avg_line_length": 19,
"alnum_prop": 0.6842105263157895,
"repo_name": "husk/husk",
"id": "a5bd848cfab11a6a17842f008af4bfad5e9bc0aa",
"size": "19",
"binary": false,
"... |
from __future__ import unicode_literals
import datetime
from django import VERSION
try:
from django.contrib.auth import get_user_model # Django 1.5
except ImportError:
from postman.future_1_5 import get_user_model
from django.http import QueryDict
from django.template import Node
from django.template import T... | {
"content_hash": "f74d48d54e0847b845b212da2137905e",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 110,
"avg_line_length": 30.859756097560975,
"alnum_prop": 0.6143054732266351,
"repo_name": "dobrych/django-postman",
"id": "7ca48ebac1a17f5c79d1e52475efbbc4b1643e8a",
"siz... |
"""
Core module views
"""
from anaf.core.rendering import render_to_response
from django.template import RequestContext
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from forms import AccountForm, AccountPasswordForm, SettingsForm, MassActionForm
from anaf.core.decorators im... | {
"content_hash": "e2cbb369df10fd48d7ede664f9cf0e98",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 104,
"avg_line_length": 34.07906976744186,
"alnum_prop": 0.6070697420499522,
"repo_name": "tovmeod/anaf",
"id": "9f112801bfa55752f696f3b3224d77d004d3095b",
"size": "7327",... |
import repack.filters
import repack.flows
from repack.common import FilterFunc
__all_filters__ = None
__all_flows__ = None
__autocomplete__ = None
__ignore_flag__ = 'ignore'
__initialized__ = 0
if not __initialized__:
'''Filter out everything but functions from filters/flows.'''
def filter_mo... | {
"content_hash": "270541461e5934a8f19ce0a094281add",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 76,
"avg_line_length": 29.793650793650794,
"alnum_prop": 0.5269046350559403,
"repo_name": "AlexPereverzyev/repack",
"id": "181a00d6b33309e57c51f3a51305c0396e13afa6",
"size"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.