text stringlengths 4 1.02M | meta dict |
|---|---|
"""Test case for the create volume function."""
import mock
from cinder import exception
from cinder.tests.unit.volume.drivers import disco
class CreateVolumeTestCase(disco.TestDISCODriver):
"""Test cases for DISCO connector."""
def setUp(self):
"""Prepare variables and mock functions."""
s... | {
"content_hash": "f011fe723ab148bf0c4eb8e61f594711",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 65,
"avg_line_length": 32.69230769230769,
"alnum_prop": 0.6258823529411764,
"repo_name": "phenoxim/cinder",
"id": "d4006d28998f0737934da69dab6eb18eff4797e9",
"size": "1913"... |
"""Utilities for loading data."""
import pickle
import typing
import numpy as np
import tensorflow as tf
def augment_data(dataset,
noise_scale):
"""Augments the data.
Args:
dataset: Dictionary with data.
noise_scale: Scale of noise to apply.
Returns:
Augmented data.
"""
noise... | {
"content_hash": "7db48626cb461c8fc3c533e27da6fcf3",
"timestamp": "",
"source": "github",
"line_count": 321,
"max_line_length": 119,
"avg_line_length": 35.426791277258566,
"alnum_prop": 0.6180091452690819,
"repo_name": "google-research/google-research",
"id": "2480e378dc655f4c13680da01a5bf78568839611... |
def unpacked_pdu_opts(unpacked_pdu):
pdu_opts = {}
for opt in unpacked_pdu['body'].get('optional_parameters', []):
pdu_opts[opt['tag']] = opt['value']
return pdu_opts
def detect_ussd(pdu_opts):
# TODO: Push this back to python-smpp?
return ('ussd_service_op' in pdu_opts)
def update_ussd_... | {
"content_hash": "83e1320642594ad2fc5826642dd14173",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 79,
"avg_line_length": 34.421052631578945,
"alnum_prop": 0.6529051987767585,
"repo_name": "vishwaprakashmishra/xmatrix",
"id": "e9203b91e908245a9358ef402457d363343b6289",
"... |
from argparse import ArgumentParser
from typing import Any, List
from django.conf import settings
from django.core.management.base import CommandError
from zerver.lib.management import ZulipBaseCommand
from zerver.lib.send_email import send_custom_email
from zerver.models import Realm, UserProfile
class Command(Zul... | {
"content_hash": "c080717399daeff4ad83d228fd2de29f",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 107,
"avg_line_length": 40.80714285714286,
"alnum_prop": 0.5739541396814283,
"repo_name": "eeshangarg/zulip",
"id": "af5131dfd7d13e3c1eff0583e3b3b47a1ff7c328",
"size": "57... |
'''
Copyright (C) Yadu Nand B <yadudoc1729@gmail.com> - All Rights Reserved
Unauthorized copying of this file, via any medium is strictly prohibited
Proprietary and confidential
Written by Yadu Nand B <yadudoc1729@gmail.com>, September 2015
'''
import os
import logging
import bottle
import requests
import time
fro... | {
"content_hash": "91cab4a2208bbb3a1b5de1430345fa1a",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 118,
"avg_line_length": 38.6796875,
"alnum_prop": 0.5362553019592001,
"repo_name": "yadudoc/cloud_kotta",
"id": "82ad78e346ad254a19954676f7b68d6a41c868cd",
"size": "9924",... |
import os
import time
from telemetry import wait_action
from telemetry import tab_test_case
class WaitActionTest(tab_test_case.TabTestCase):
def testWaitAction(self):
unittest_data_dir = os.path.join(os.path.dirname(__file__),
'..', 'unittest_data')
self._browser.SetHTTP... | {
"content_hash": "2060106a4f9d8d944d41a884413192bb",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 68,
"avg_line_length": 33.91304347826087,
"alnum_prop": 0.6653846153846154,
"repo_name": "nacl-webkit/chrome_deps",
"id": "ce00d7976b0cb0ee811f0fe89e15b862aa5c4363",
"size"... |
import random
import eventlet
import mock
from neutron_lib import constants as n_const
from neutron_lib.utils import net
from oslo_config import cfg
from oslo_utils import uuidutils
from neutron.agent.common import ovs_lib
from neutron.agent.common import polling
from neutron.agent.l2 import l2_agent_extensions_manag... | {
"content_hash": "e8a90e63efcf2f99d791fe40381e4b89",
"timestamp": "",
"source": "github",
"line_count": 391,
"max_line_length": 79,
"avg_line_length": 44.34271099744245,
"alnum_prop": 0.578844157342254,
"repo_name": "noironetworks/neutron",
"id": "827a516a8168261d6c8808dbea2bba3fa71810fc",
"size": ... |
"""Base Model definition."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import functools
import os
import re
import six
from six.moves import zip
import tensorflow.compat.v1 as tf
from tensorflow.compat.v1 import estimator as tf_estimator
im... | {
"content_hash": "c2bdbc6e1517a40d9f54447dc4b89238",
"timestamp": "",
"source": "github",
"line_count": 441,
"max_line_length": 80,
"avg_line_length": 34.00453514739229,
"alnum_prop": 0.6701787143238197,
"repo_name": "tensorflow/tpu",
"id": "0e90996daf19173f73c3469da6cd849e06adc918",
"size": "15685... |
from django.core.urlresolvers import reverse
from django.db import models
from us_ignite.common.fields import URL_HELP_TEXT
from us_ignite.testbeds import managers
from geoposition.fields import GeopositionField
from django_extensions.db.fields import (
AutoSlugField, CreationDateTimeField, ModificationDateTimeFi... | {
"content_hash": "6b3a51b911f241a5765252856fa0d5a2",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 78,
"avg_line_length": 35.301886792452834,
"alnum_prop": 0.6795831106360235,
"repo_name": "us-ignite/us_ignite",
"id": "f090c500c90ad93b0ce4a77592f14c0740eb0ae1",
"size": ... |
import functools
import itertools
import contextlib
import weakref
import logging
l = logging.getLogger("simuvex.s_state")
import claripy
import ana
from archinfo import arch_from_id
def arch_overrideable(f):
@functools.wraps(f)
def wrapped_f(self, *args, **kwargs):
if hasattr(self.arch, f.__name__):... | {
"content_hash": "50ea30e6e0fe1aee20e75f7543c3189f",
"timestamp": "",
"source": "github",
"line_count": 684,
"max_line_length": 150,
"avg_line_length": 35.61695906432749,
"alnum_prop": 0.5722847056891881,
"repo_name": "chubbymaggie/simuvex",
"id": "9cf5454085cf15bd51193e6f5b44f1e9d0b75952",
"size":... |
from zope import component
from sparc import configuration
from sparc.configuration import container
import mellon
from sparc.logging import logging
logger = logging.getLogger(__name__)
@component.adapter(mellon.IMellonApplication, configuration.ISparcApplicationConfiguredEvent)
def initialize_spiders(app, event):
... | {
"content_hash": "396e243674227ad79ad1dcb076518494",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 93,
"avg_line_length": 42.357142857142854,
"alnum_prop": 0.7571669477234402,
"repo_name": "CrowdStrike/mellon",
"id": "9dde0bfa742b26b98e7c1272d2a74be050deee5a",
"size": "5... |
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('analytics', '0014_auto_20150206_2232'),
]
operations = [
migrations.AlterField(
mo... | {
"content_hash": "eb9a8461c645ec7925439a520045afb9",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 109,
"avg_line_length": 25.38095238095238,
"alnum_prop": 0.6322701688555347,
"repo_name": "codingforentrepreneurs/srvup-rest-framework",
"id": "2ed72e1b66733732e867d6e6d3beff... |
import numpy as np
import pandas as pd
import matplotlib as mat
import matplotlib.pyplot as plt
import caffe
import cv2
import json
import math
# MODEL = 'ILSVRC' # ImageNet, don't use ImageNet, it wasn't trained on all categories
MODEL = 'coco' # MS-Coco
MODEL = 'ours'
IMAGE_SIZE = 300 # 300x300 trained on coco or I... | {
"content_hash": "89425b72d132808e3c69fde5ed738940",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 236,
"avg_line_length": 46.95384615384615,
"alnum_prop": 0.4741153342070773,
"repo_name": "IsThatYourBag/IsThatYourBag",
"id": "df2b7321ea51c74c2748425e70a08325abbaf49a",
... |
"""Indicators for network status."""
from makani.avionics.common import cvt
from makani.avionics.common import pack_avionics_messages
from makani.gs.monitor2.apps.layout import indicator
from makani.gs.monitor2.apps.layout import stoplights
from makani.gs.monitor2.apps.plugins import common
from makani.lib.python impo... | {
"content_hash": "131c5b4b1ae410d4f742994a42b6a22b",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 79,
"avg_line_length": 35.23,
"alnum_prop": 0.6663828176743306,
"repo_name": "google/makani",
"id": "207293f2bcf281886a52ef35e4220ced5065635c",
"size": "11158",
"binary"... |
"""Wrappers for datasets in tfds."""
from typing import Any, Callable, Dict, Optional, Union
from robustness_metrics.common import ops
from robustness_metrics.common import pipeline_builder
from robustness_metrics.common import types
from robustness_metrics.datasets import base
import tensorflow as tf
import tensorflo... | {
"content_hash": "c63e2f8d5ac166e8849758eefb52fae9",
"timestamp": "",
"source": "github",
"line_count": 410,
"max_line_length": 80,
"avg_line_length": 36.47560975609756,
"alnum_prop": 0.649214309595453,
"repo_name": "google-research/robustness_metrics",
"id": "7b3acff5969e6ce32609134703872c0cec750994... |
from webiopi.utils.types import toint
from webiopi.devices.spi import SPI
from webiopi.devices.digital import GPIOPort
from webiopi.decorators.rest import request, response, api
from webiopi.utils.logger import debug
class TLE7238SL(GPIOPort, SPI):
#---------- Class initialisation ----------
COUNT = 8
... | {
"content_hash": "a3d914d400b07f9724f80997542df499",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 107,
"avg_line_length": 36.129533678756474,
"alnum_prop": 0.5967302452316077,
"repo_name": "ariegg/webiopi-drivers",
"id": "e5d56fc02cc917927be8c7bb744338c9a963b8ff",
"siz... |
'''
xbmcswift2.request
------------------
This module contains the Request class. This class represents an incoming
request from XBMC.
:copyright: (c) 2012 by Jonathan Beluch
:license: GPLv3, see LICENSE for more details.
'''
from xbmcswift2.common import unpickle_args
import urlparse
try:
... | {
"content_hash": "c81374a902b4e4bf851607a5ec3bb0ea",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 79,
"avg_line_length": 33.325581395348834,
"alnum_prop": 0.6454989532449407,
"repo_name": "neno1978/xbmctorrent",
"id": "2a8a7c39586fdfaf6b471f734bbec680ecb176e1",
"size": ... |
"""
The MIT License (MIT)
Copyright (c) 2014 - 2015 Jos "Zarthus" Ahrens and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rig... | {
"content_hash": "19cba2fc8d2a8eede3811d93b1958dd9",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 117,
"avg_line_length": 43.111111111111114,
"alnum_prop": 0.5405211912943871,
"repo_name": "Zarthus/Reconcile",
"id": "de718b769f8844cac4148e4dc35e3d4414d6f1b7",
"size": "... |
"""
Class for running task-oriented dialogue chats.
Specifically this class handles:
1. Setting up and running the different conversational agents to fit the TOD Conversational structure (see `tod_core.py`; also retiterated in TodWorld below)
2. Handle logic for batching when running dialogues
3. Recording various met... | {
"content_hash": "574a579c24d77e6571c3d9699bcc75d9",
"timestamp": "",
"source": "github",
"line_count": 308,
"max_line_length": 284,
"avg_line_length": 42.172077922077925,
"alnum_prop": 0.5759488798213873,
"repo_name": "facebookresearch/ParlAI",
"id": "32ff7072889333cbc9007f9c0df3feb4ea31e1b6",
"si... |
"""This code example gets all creative templates.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentication information"
section of our README.
Tags: CreativeTemplateSe... | {
"content_hash": "5a0dc66a1c670256942be6d0a6064467",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 80,
"avg_line_length": 32.41304347826087,
"alnum_prop": 0.6733735747820255,
"repo_name": "dietrichc/streamline-ppc-reports",
"id": "ece79ea8079e7172159e80e79084861892b92a02",... |
import os
from distutils.core import setup
from ccfiletypes import VERSION
root_dir = os.path.dirname(__file__)
if root_dir != '':
os.chdir(root_dir)
setup(
name='django-ccfiletypes',
version=VERSION,
license = 'BSD 3 Clause',
description='Django templatefilters for displaying info about files.',... | {
"content_hash": "0c3a59c6418c260c26ee99b6005ca3cb",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 74,
"avg_line_length": 27.870967741935484,
"alnum_prop": 0.6111111111111112,
"repo_name": "designcc/django-ccfiletypes",
"id": "575e7b17ba518c38bf2a0f3a08a9a272aea417fb",
"... |
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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.... | {
"content_hash": "8c78846d1282223a8c6ef25610f3e490",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 88,
"avg_line_length": 38.06521739130435,
"alnum_prop": 0.7155910908052542,
"repo_name": "edespino/gpdb",
"id": "0a689d925150460ba0cad12475feb312ed781acc",
"size": "1751",
... |
"""
Sales Cron jobs
"""
from treeio.sales.models import Subscription
def subscription_check():
"Automatically depreciate assets as per their depreciation rate"
subscriptions = Subscription.objects.all()
for subscription in subscriptions:
subscription.check_status()
| {
"content_hash": "2902f8dc8c7130b53bd0881aa9ae0986",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 68,
"avg_line_length": 26.636363636363637,
"alnum_prop": 0.7337883959044369,
"repo_name": "rogeriofalcone/treeio",
"id": "41c487f4f1e0e3e8c011ff3f977e69389b1ed799",
"size":... |
import os
import ycm_core
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-Wno-long-long',
'-Wno-variadic-macros',
'-fexceptions',
'-DNDEBUG',
'-std=c++11',
'-x',
'c++',
'-I',
'.',
'-isystem',
'/usr/include',
'-isystem',
'/usr/local/include',
'-I',
'./include',
'-I',
'./lib/include',
'-I',
'/home/grads/njcz19/include'
]
co... | {
"content_hash": "eb6d6317438d0d01e518966362ff5a1a",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 72,
"avg_line_length": 23.710280373831775,
"alnum_prop": 0.6491919590067008,
"repo_name": "jwlawson/qvtrim",
"id": "100b0e52acf2197588ee8afe05c1bce1577ef858",
"size": "253... |
from django import forms
from django.contrib.comments.forms import CommentForm
class pCMSCommentForm(CommentForm):
name = forms.CharField(label=u"Όνομα", max_length=50)
email = forms.EmailField(label=u"Email",required=False)
| {
"content_hash": "257bc04f9fa63349576b479868620d8f",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 59,
"avg_line_length": 39,
"alnum_prop": 0.782051282051282,
"repo_name": "sv1jsb/pCMS",
"id": "2fa2ee8424a445c64213975497a84db911dd774d",
"size": "264",
"binary": false,
... |
"""Tests for Conv2D via the XLA JIT.
The canned results in these tests are created by running each test using the
Tensorflow CPU device and saving the output.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
import... | {
"content_hash": "8d58b825cd71ec2d72b96cd175ff1b63",
"timestamp": "",
"source": "github",
"line_count": 841,
"max_line_length": 80,
"avg_line_length": 35.14387633769322,
"alnum_prop": 0.5872919204222493,
"repo_name": "gojira/tensorflow",
"id": "d12e1ff1e8f4564f39642bd0b64fc40d8dca8ef0",
"size": "30... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'QuestionSet.heading'
db.alter_column(u'questionnaire_questionset', 'heading', ... | {
"content_hash": "3409c1e68c5b26290d47d497610ed30a",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 156,
"avg_line_length": 70.98113207547169,
"alnum_prop": 0.5538277511961722,
"repo_name": "affan2/ed-questionnaire",
"id": "981511862a690dddfada0e3a65c0e91efecb9900",
"siz... |
from distutils.core import setup
setup(name='Cards',
version='0.1.1',
description='Cards and poker backend',
author='Allen Majewski',
author_email='altoidnerd.btc@gmail.com',
url='',
packages=['cards'],
)
| {
"content_hash": "d0a7d979e36a1850f3a770a83eef2ec7",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 44,
"avg_line_length": 23.4,
"alnum_prop": 0.6410256410256411,
"repo_name": "Altoidnerd/cards",
"id": "957fd082bccf7478aa0015005b576f4a9a292ec0",
"size": "257",
"binary":... |
import os, os.path, sys
import json
import optparse
import random
import subprocess
import tempfile
import time
class ScalingTester:
def __init__(self, url, object_file, user_file,
match_field, filter_fields, method, client_location):
self._url = url
self._method = method
... | {
"content_hash": "65e2483b2a75e7803a65840ceba92f69",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 80,
"avg_line_length": 37.986111111111114,
"alnum_prop": 0.5661791590493601,
"repo_name": "ahelsing/geni-ch",
"id": "93f3221fff000a090aea165e737a8a4e03e1ded5",
"size": "66... |
from google.appengine.ext import db
class Config(db.Model):
name = db.StringProperty(required=True)
num_shards = db.IntegerProperty(required=True, default=20)
class Shard(db.Model):
name = db.StringProperty(required=True)
count = db.IntegerProperty(required=True, default=0)
| {
"content_hash": "2d507dc807f8f135bbab983f14f4cb52",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 62,
"avg_line_length": 26.818181818181817,
"alnum_prop": 0.7389830508474576,
"repo_name": "jcrocholl/nxdom",
"id": "935b9cd856e29290ae467e79fd0132ed57e29c1d",
"size": "295"... |
"""Example of using Python 3 function annotations to define
request arguments and output schemas.
Run the app:
$ python examples/annotations_example.py
Try the following with httpie (a cURL-like utility, http://httpie.org):
$ pip install httpie
$ http GET :5001/
$ http GET :5001/ name==Ada
$ htt... | {
"content_hash": "6edebed401c3fe97e5c8bce7c01b727f",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 85,
"avg_line_length": 26.95035460992908,
"alnum_prop": 0.5955263157894737,
"repo_name": "sloria/webargs",
"id": "134b29e15121a543586c01bdbdc2a26f9f2c4459",
"size": "3800"... |
from multiverse.mars.plugins import GroupPlugin
##
# Group Configuration File
##
# Register stats for group object to track and send to each client
GroupPlugin.RegisterStat("health")
GroupPlugin.RegisterStat("health-max")
# Set maximum group size
GroupPlugin.SetMaxGroupSize(8)
| {
"content_hash": "9d939d2e9a28a9cc0410947e85147f6d",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 66,
"avg_line_length": 23.416666666666668,
"alnum_prop": 0.797153024911032,
"repo_name": "longde123/MultiversePlatform",
"id": "f424dacd58a971950c8ccfcee370b4837a2cfce4",
"... |
"""
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": "97d8ac74b9df28fffc3d5d8b4d82c3c5",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 72,
"avg_line_length": 25.189655172413794,
"alnum_prop": 0.728952772073922,
"repo_name": "keedio/keedio-stacks",
"id": "165d9cd19311b2dcc73760737f9cf6238a129d97",
"size": "... |
from __future__ import annotations
import copy
import shlex
import unittest
from typing import Any
from unittest import mock
from unittest.mock import MagicMock
from uuid import UUID
import pytest
from parameterized import parameterized
from airflow.exceptions import AirflowException
from airflow.providers.apache.be... | {
"content_hash": "89a956409fefe88192b15a6144a0c56d",
"timestamp": "",
"source": "github",
"line_count": 1853,
"max_line_length": 110,
"avg_line_length": 41.99082568807339,
"alnum_prop": 0.6220745672094488,
"repo_name": "cfei18/incubator-airflow",
"id": "0076c3f879d56d5e79badf18b035ad9edffbba42",
"s... |
"""Library containing special bots."""
#
# (C) Rob W.W. Hooft, Andre Engels 2003-2004
# (C) Pywikibot team, 2003-2017
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
import os
import tempfile
import time
import pywikibot
import pywikibot.data.api
from py... | {
"content_hash": "c7f57cb67d74ad81682e269a2a60b804",
"timestamp": "",
"source": "github",
"line_count": 552,
"max_line_length": 79,
"avg_line_length": 39.643115942028984,
"alnum_prop": 0.5439382168806837,
"repo_name": "magul/pywikibot-core",
"id": "0818e72799607e912e6afb681a927d4612fed533",
"size":... |
import logging
from django.db import migrations
logger = logging.getLogger()
def update_bearing_manufacturer(apps, schema_editor):
Bearing = apps.get_model('bearing', 'Bearing')
BearingManufacturer = apps.get_model('bearing', 'BearingManufacturer')
for item in Bearing.objects.all():
try:
... | {
"content_hash": "cb2d7eedc0ca612df3674c4d5ef9dd72",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 81,
"avg_line_length": 27.40740740740741,
"alnum_prop": 0.6756756756756757,
"repo_name": "manti-by/POD",
"id": "2f6ee589de45c59de2e161fd5c0b8af5b63a80c5",
"size": "740",
... |
from ..utils import Scraper
from .utsg import UTSGExams
from .utm import UTMExams
from .utsc import UTSCExams
from bs4 import BeautifulSoup
from collections import OrderedDict
import json
import os
import requests
class Exams:
host = 'http://www.artsandscience.utoronto.ca/ofr/calendar/'
@staticmethod
de... | {
"content_hash": "6a525f701506dd24c6775fab1273cd74",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 64,
"avg_line_length": 24.818181818181817,
"alnum_prop": 0.7252747252747253,
"repo_name": "g3wanghc/uoft-scrapers",
"id": "0efce98d1119feea351e08cfd205d04039b6b514",
"size"... |
import gettext
gettext.install('heat', unicode=1)
from heat.api.middleware.version_negotiation import VersionNegotiationFilter
from heat.api.cfn import versions
def version_negotiation_filter(app, conf, **local_conf):
return VersionNegotiationFilter(versions.Controller, app,
... | {
"content_hash": "2c7ecbd429bbc07c04b87164ab415cdd",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 76,
"avg_line_length": 30.90909090909091,
"alnum_prop": 0.7147058823529412,
"repo_name": "Triv90/Heat",
"id": "b39691f4a0836d7a57caf765f15f904f85f6f844",
"size": "960",
"... |
"""
Tests for unknown directives.
"""
from __init__ import DocutilsTestSupport
def suite():
s = DocutilsTestSupport.ParserTestSuite()
s.generateTests(totest)
return s
totest = {}
totest['unknown'] = [
["""\
.. reStructuredText-unknown-directive::
.. reStructuredText-unknown-directive:: argument
.. reS... | {
"content_hash": "0b2902c984450eb121f9ec078c5a9a62",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 118,
"avg_line_length": 37.28813559322034,
"alnum_prop": 0.6645454545454546,
"repo_name": "cloudera/hue",
"id": "69e2c01c98ef885ce8bcfeb52734693609cdc157",
"size": "2392",
... |
import datetime
import webapp2
from testing_utils import testing
from handlers import list_analyses
from model.wf_analysis import WfAnalysis
from model import wf_analysis_status
from model import wf_analysis_result_status
from waterfall import identify_culprit_pipeline
class ListAnalysesTest(testing.AppengineTestC... | {
"content_hash": "9b0af4413037cb292c6dc49d10d3c151",
"timestamp": "",
"source": "github",
"line_count": 580,
"max_line_length": 80,
"avg_line_length": 33.296551724137935,
"alnum_prop": 0.40902029826014913,
"repo_name": "nicko96/Chrome-Infra",
"id": "875d9040e94240b8e132de3800d61dcd0a85e58c",
"size"... |
import tempfile
try:
from unittest.runner import TextTestResult
except ImportError:
# Support Python 2.6.
from unittest import _TextTestResult as TextTestResult
from tap.directive import Directive
from tap.line import Bail, Plan, Result
class Factory(object):
"""A factory to produce commonly needed o... | {
"content_hash": "2ecd7e622096bc70dbd536bd7e063c9f",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 74,
"avg_line_length": 30.903225806451612,
"alnum_prop": 0.6774530271398748,
"repo_name": "Mark-E-Hamilton/tappy",
"id": "b8597c9c9cc3a0b6bd0dba7d7a7fbc90aa6bb452",
"size":... |
from ..factory.config import ConfigFactory
from ..exceptions import DuplicateDocument
from urllib.parse import quote_plus
import arrow
import pymongo
class PostSaver:
def save(self, post=None):
""" Exceptions:
- AssertionError
"""
assert post is not None, "post is not defined."
post._insert_time = ar... | {
"content_hash": "b6c1e60c83d0d2e1e0f85addad89df4a",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 71,
"avg_line_length": 32.08,
"alnum_prop": 0.7231920199501247,
"repo_name": "arsystem/ardegra",
"id": "6598bd73ba5d81312585bc27d7083ec15075560f",
"size": "802",
"binary"... |
import sys
import threading
import typing as tp # NOQA
from chainer import types # NOQA
if types.TYPE_CHECKING:
import numpy # NOQA
from chainer.graph_optimizations import static_graph # NOQA
class GlobalConfig(object):
debug = None # type: bool
cudnn_deterministic = None # type: bool
w... | {
"content_hash": "e40400cbaf89180a69abd14fa5129a49",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 89,
"avg_line_length": 28.53529411764706,
"alnum_prop": 0.6237889095031952,
"repo_name": "tkerola/chainer",
"id": "b5e160acfc4fbc23587cce119f6b99abd7f45d80",
"size": "4851... |
"""Line-like geometrical entities.
Contains
========
LinearEntity
Line
Ray
Segment
"""
from __future__ import print_function, division
from sympy.core import S, C, sympify, Dummy
from sympy.core.logic import fuzzy_and
from sympy.core.exprtools import factor_terms
from sympy.core.relational import Eq
from sympy.funct... | {
"content_hash": "50602985fcd2c0eb49b6981072f7db39",
"timestamp": "",
"source": "github",
"line_count": 1733,
"max_line_length": 116,
"avg_line_length": 26.8401615695326,
"alnum_prop": 0.4739648277937825,
"repo_name": "dqnykamp/sympy",
"id": "d6c643005534350b24a05d0a3d8958014c556179",
"size": "4651... |
import os
import re
import time
import urllib.request as urllib2
import yaml
from kubernetes import client
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import uuidutils
from toscaparser import tosca_template
from tacker._i18n import _
from ta... | {
"content_hash": "8f787038c8dfede1473c25ea9574164c",
"timestamp": "",
"source": "github",
"line_count": 2504,
"max_line_length": 79,
"avg_line_length": 47.028354632587856,
"alnum_prop": 0.5125637955485356,
"repo_name": "stackforge/tacker",
"id": "844f409b8aae3b59957eddbbc374fd12bdf4f14a",
"size": "... |
import functools
# Cache execution
# Pay attention do not use this decorator into functions with multiple argments which may cause large variability.
def memoize(func):
"""
Cache the results of the function
"""
cache = {}
@functools.wraps(func)
def wrapper(*args):
if args in cache:
... | {
"content_hash": "057bd0d4f4e1e8e5b860cb5a7ee20746",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 114,
"avg_line_length": 24.060606060606062,
"alnum_prop": 0.5894206549118388,
"repo_name": "helloTC/LearnPython",
"id": "035c4ec35204141bf7ad20cc79efee18d3f85cb6",
"size": ... |
from formcreator import Form, markdown
from forms import *
import communicate_server
from utils import pformat
@pformat
def train_func(transform_id, data_namespace):
request = dict(
TransformId=transform_id,
DataNamespace=data_namespace,
)
return communicate_server.post("train", request)
... | {
"content_hash": "b7257940e5c83c81a4da52db1aa95e66",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 177,
"avg_line_length": 28.681818181818183,
"alnum_prop": 0.7242472266244057,
"repo_name": "diogo149/ProtoML-clojure",
"id": "dfada7b3ebfc78e4454401cff6c5b88002589b91",
"si... |
from typing import Optional, Union
import re
def decamelize(name: str) -> str:
"""Decamelize `name`. Convert `CamelCase` into `Camel Case`."""
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1 \2', name)
return re.sub('([a-z0-9])([A-Z])', r'\1 \2', s1)
def to_identifier(name: str) -> str:
"""Replace spaces with u... | {
"content_hash": "8f67a64157d5d61757af1c706a6c7587",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 79,
"avg_line_length": 30.885714285714286,
"alnum_prop": 0.5596669750231268,
"repo_name": "Stiivi/entigen",
"id": "fa406b772ba8a560d1d9d8413d25cd16c268dfcc",
"size": "1081"... |
from sklearn import datasets
from sklearn.model_selection import train_test_split
from ray.util.xgboost import RayDMatrix, RayParams, train
# __train_begin__
num_cpus_per_actor = 1
num_actors = 1
def train_model(config):
# Load dataset
data, labels = datasets.load_breast_cancer(return_X_y=True)
# Split ... | {
"content_hash": "fcb82b78fead860adadfefed96321312",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 73,
"avg_line_length": 26.072164948453608,
"alnum_prop": 0.6010280743376829,
"repo_name": "pcmoritz/ray-1",
"id": "395cea50a1a0a52ab3b8d26ee27f3810c209dc37",
"size": "2529"... |
from time import clock
def timing(func):
"""Decorator for timing
Calculates how long does the function takes to execute
and prints some useful information
"""
def wrapper(*arg):
t1 = clock()
result = func(*arg)
t2 = clock()
f_name = func.__name__
print("Exc... | {
"content_hash": "09c0b66b63c6686cf5a7d05d8b2c4a52",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 65,
"avg_line_length": 21.63157894736842,
"alnum_prop": 0.583941605839416,
"repo_name": "pabloriutort/Aula",
"id": "5cae87a475896fd221a454f88feb219772b5f094",
"size": "433"... |
"""
All the reusable scripts are kept in this file
"""
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
def get_object_or_none(model, **kwargs):
try:
return model.objects.get(**kwargs)
except model.DoesNotExist:
return None
class S... | {
"content_hash": "ad0154396656e1d2a1d662ef2416368e",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 78,
"avg_line_length": 27,
"alnum_prop": 0.6763285024154589,
"repo_name": "chhantyal/referly",
"id": "a5589cb2376734ba00e4e3b39eafb65690a6d945",
"size": "621",
"binary": ... |
"""Tests for tensorflow.ops.reshape_op."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
class ReshapeTest(tf.test.TestCase):
def _testReshape(self, x, y, use_gpu=False):
with self.test_session(use_gpu=us... | {
"content_hash": "d2b911dd56973de1e1f6f69548f4233d",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 79,
"avg_line_length": 35.44094488188976,
"alnum_prop": 0.5978671406354144,
"repo_name": "tongwang01/tensorflow",
"id": "8e62be107be3544f5e848c88ca4778f14477381a",
"size":... |
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
import uuid
from .. import models
class VpnConnectionOperations(object):
"""VpnConnectionOperations operations.
:param client: Client for service req... | {
"content_hash": "3bbed54ef5dbff7a3923d7c4764045df",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 431,
"avg_line_length": 47.758620689655174,
"alnum_prop": 0.6681588447653429,
"repo_name": "BurtBiel/azure-cli",
"id": "fcdaedd048307f7f009055e187ccd9322f769f85",
"size": ... |
from __future__ import division, print_function, unicode_literals
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "s, t 1.5, s, t 3.1, s, q"
tags = "Draw, parameter"
import cocos
from cocos.di... | {
"content_hash": "67d83317a897f2e824fec25c3d14a0cc",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 72,
"avg_line_length": 26.728813559322035,
"alnum_prop": 0.5662650602409639,
"repo_name": "shujunqiao/cocos2d-python",
"id": "e9e3b2226b8c7e818bc67e2c8599f7339d62f29d",
"si... |
"""Remove Blink references from the gclient DEPS file contents."""
import ast
import re
import sys
def CleanupDeps(deps):
assert ast.parse(deps), 'DEPS (original) smoke test (AST parsing) failed'
# remove webkit_* vars
deps = re.sub(r"['\"]webkit_\w+['\"]:[^,]+,(?:\s*\#.*)?\s*", '', deps, re.MULTILINE)
# r... | {
"content_hash": "d586d2cfce1dcd9e9b9399a73e70073b",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 86,
"avg_line_length": 29.307692307692307,
"alnum_prop": 0.6185476815398075,
"repo_name": "primiano/chrome-blink-automerger",
"id": "1b3336331eddafd2cdebeb5521b81c805b6b3b11"... |
"""
Manage SNS Topics
=================
Create and destroy SNS topics. Be aware that this interacts with Amazon's
services, and so may incur charges.
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit AWS credentials but can also utilize
IAM roles assigned to the inst... | {
"content_hash": "2173763e0b0608736d71284100a818eb",
"timestamp": "",
"source": "github",
"line_count": 392,
"max_line_length": 99,
"avg_line_length": 33.1530612244898,
"alnum_prop": 0.5407048322560788,
"repo_name": "saltstack/salt",
"id": "30509176e702fa18cf3b2641b5a96f03c807ab96",
"size": "12996"... |
from __future__ import unicode_literals
from datetime import datetime, timedelta
import unittest
from werkzeug.wrappers import Response
from flask_webcache.modifiers import cache_for, cache_control
from testutils import compare_datetimes
class ModifiersTestCase(unittest.TestCase):
def test_cache_for(self):
... | {
"content_hash": "eee28cf214d570d4151db3d72dc9902c",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 95,
"avg_line_length": 32.142857142857146,
"alnum_prop": 0.6552380952380953,
"repo_name": "fusic-com/flask-webcache",
"id": "0b5c63309475a97b7eb8f4f157c4fdaf00a7dbae",
"siz... |
from .harp import HarpMainSource
| {
"content_hash": "21a3c0fc027bf9b64bb3a35a023687a4",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 32,
"avg_line_length": 33,
"alnum_prop": 0.8484848484848485,
"repo_name": "macbre/mobify",
"id": "ea2557b9ecd3db55f79158d55a2ff85c42a38c01",
"size": "33",
"binary": false,... |
"""
measure with libgtop2 but not CPU affinity
"""
__author__ = 'Isaac Gouy'
from domain import Record
import os, sys, cPickle, time, threading, signal, gtop
from errno import ENOENT
from subprocess import Popen
def measure(arg,commandline,delay,maxtime,
outFile=None,errFile=None,inFile=None,logger=None,aff... | {
"content_hash": "3461cec42532867a1fce66efa64a4e46",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 89,
"avg_line_length": 30.124087591240876,
"alnum_prop": 0.521686455052096,
"repo_name": "kragen/shootout",
"id": "72256657344fb90ea08463451c3fbd0cf20dc569",
"size": "4228... |
"""Healthz server invoked from startup script invoked on GCE instance."""
import BaseHTTPServer
import getopt
import logging
import ssl
import sys
import urlparse
class HealthzHandler(BaseHTTPServer.BaseHTTPRequestHandler):
"""Handler for HTTP requests."""
health_status = 'HEALTHY'
def do_GET(self): # pylin... | {
"content_hash": "092f6a4c8da128c5863cc568edda7d39",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 73,
"avg_line_length": 27.267605633802816,
"alnum_prop": 0.637396694214876,
"repo_name": "aljim/deploymentmanager-samples",
"id": "9b10983fc6f68eb4463a61cd1170fe954a277b61",
... |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:8332")
else:
access = Ser... | {
"content_hash": "c675fdbf68fffd616af6988a0cea54c2",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 79,
"avg_line_length": 24.188271604938272,
"alnum_prop": 0.661860405767513,
"repo_name": "kingcoin/kingcoin",
"id": "b0f703a713288b98574ceead7745c1d06ab16b40",
"size": "78... |
import reversion
from datetime import datetime
from hashlib import sha256
from django.contrib.gis.db import models
from django.db.models.signals import post_save
from django.db.models.signals import post_delete
from django.contrib.auth.models import User
from django.contrib.gis.geos import GeometryCollection, Point
f... | {
"content_hash": "1292902e8ea641e5405ca557bc1ffb2d",
"timestamp": "",
"source": "github",
"line_count": 327,
"max_line_length": 95,
"avg_line_length": 32.40978593272171,
"alnum_prop": 0.6184185695414229,
"repo_name": "awemulya/fieldsight-kobocat",
"id": "2260b27598260778f121b271eccc443235d383c2",
"... |
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Create the RenderWindow, Renderer and interactive renderer
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
# make sure to have the same regression image on all platfor... | {
"content_hash": "8b4b23de0895db71b11f6539748bb43f",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 63,
"avg_line_length": 22.106666666666666,
"alnum_prop": 0.7876960193003619,
"repo_name": "collects/VTK",
"id": "f35093e6109db5dad2f36041f3a9d8aca48e74e9",
"size": "1680",
... |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
_reqs = ('django.contrib.auth', 'django.contrib.sessions')
if getattr(settings, 'NEXUS_SKIP_INSTALLED_APPS_REQUIREMENTS', False):
_reqs = ()
for r in _reqs:
if r not in settings.INSTALLED_APPS:
raise ImproperlyConf... | {
"content_hash": "e733d66559cc60f66468bb5b7cbaa766",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 80,
"avg_line_length": 39,
"alnum_prop": 0.7132867132867133,
"repo_name": "disqus/nexus",
"id": "d6ad4c286f67c20f181618b411fdab66a04bacfd",
"size": "429",
"binary": false... |
'''test pysftp.Connection compression param - uses py.test'''
from __future__ import print_function
# pylint: disable = W0142
from common import *
def test_security_options(psftp):
'''test the security_options property has expected attributes and that
they are tuples'''
secopts = psftp.security_options
... | {
"content_hash": "4ddf7f14caa5db7c53dcd8cfc8ef5cbe",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 74,
"avg_line_length": 34.92857142857143,
"alnum_prop": 0.6993865030674846,
"repo_name": "Clean-Cole/pysftp",
"id": "2c505d84eda9e6e3a4cb6de525c1e066d5454352",
"size": "489... |
'''Unit tests for models and their factories.'''
import unittest
from nose.tools import * # PEP8 asserts
from framework.forms.utils import process_payload
from modularodm.exceptions import ValidationError
from modularodm import Q
from website.project.model import MetaSchema
from website.project.model import ensure_s... | {
"content_hash": "1a7d54b9856a53993b8c952f37c78cbe",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 105,
"avg_line_length": 32.945454545454545,
"alnum_prop": 0.6512141280353201,
"repo_name": "Nesiehr/osf.io",
"id": "20d533018769dbe7469229a2dd730741e3810992",
"size": "1836... |
import pprint
#again idiom for reading in a file, relative path given
with open('../pres_on_trade.txt', 'r') as fp:
all_text = fp.read()
#str.split() will split groups of characters on any white space, easy... nice
#sorted built-in function will only sort alphbetically here
all_words = sorted(all_text.split())... | {
"content_hash": "81b519733673ed732527c331b212a1f5",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 88,
"avg_line_length": 28.617977528089888,
"alnum_prop": 0.6972909305064782,
"repo_name": "noisebridge/PythonClass",
"id": "73fc55554d03855a25852ef208233705e5a20b67",
"size... |
__version__=''' $Id: widgets.py 3086 2007-05-22 13:10:34Z rgbecker $ '''
__all__= (
'BarcodeI2of5',
'BarcodeCode128',
'BarcodeStandard93',
'BarcodeExtended93',
'BarcodeStandard39',
'BarcodeExtended39',
'BarcodeMSI',
'BarcodeCodabar',
'Bar... | {
"content_hash": "597bab730eef733a9656d5867ce1991e",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 290,
"avg_line_length": 45.25,
"alnum_prop": 0.6277198008321397,
"repo_name": "jwheare/digest",
"id": "09d2ca0c73c16b942e3db9bbeb69d1e574ff88de",
"size": "14747",
"binar... |
"""ProceSeq_16S setup"""
import codecs
import os
import re
import sys
NAME = "ProceSeq_16S"
def parse_requirements(filename):
""" load requirements from a pip requirements file """
lineiter = (line.strip() for line in open(filename))
return tuple(line for line in lineiter if line and not line.startswith... | {
"content_hash": "7fcfcbf3081518d109a7634934eadc3a",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 80,
"avg_line_length": 32.604395604395606,
"alnum_prop": 0.6059993259184361,
"repo_name": "vrbacky/proceseq_16s",
"id": "f13b302f8e66c68209b00de26b5a7a853129b5d6",
"size": ... |
"""Show the default configuration."""
import sys
import nikola.plugins.command.init
from nikola.plugin_categories import Command
from nikola.utils import get_logger
LOGGER = get_logger('default_config')
class CommandShowConfig(Command):
"""Show the default configuration."""
name = "default_config"
d... | {
"content_hash": "2bc9f2b5c7447ee5b5e5d391bf920775",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 125,
"avg_line_length": 28.321428571428573,
"alnum_prop": 0.694829760403531,
"repo_name": "getnikola/nikola",
"id": "fddda26bd872bff7ee27fe0465fd4eb6ad555558",
"size": "193... |
"""Additional help about types of credentials and authentication."""
from __future__ import absolute_import
from gslib.help_provider import HelpProvider
_DETAILED_HELP_TEXT = ("""
<B>OVERVIEW</B>
gsutil currently supports several types of credentials/authentication, as
well as the ability to access public data a... | {
"content_hash": "2f9100dade737508c631b0e2ae932f11",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 84,
"avg_line_length": 50.79054054054054,
"alnum_prop": 0.756950911267793,
"repo_name": "dimfeld/gsutil",
"id": "f7ac5fc1f764d04bbcdaa6c4b62e98040d353f05",
"size": "8137",... |
import mock
from oslo_concurrency import processutils as putils
from cinder import context
from cinder import exception
from cinder.tests.unit.targets import targets_fixture as tf
from cinder import utils
from cinder.volume.targets import lio
class TestLioAdmDriver(tf.TargetDriverFixture):
def setUp(self):
... | {
"content_hash": "b811a621103c1ab7a7ec13003384944b",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 79,
"avg_line_length": 43.52923076923077,
"alnum_prop": 0.5719940623453735,
"repo_name": "Nexenta/cinder",
"id": "f582efae4a2ac67088c224f385228974908b3695",
"size": "14720... |
from __future__ import print_function
from future.standard_library import install_aliases
install_aliases()
from urllib.parse import urlparse, urlencode
from urllib.request import urlopen, Request
from urllib.error import HTTPError
import json
import os
from flask import Flask
from flask import request
from flask im... | {
"content_hash": "2f0c294b4f34810523c7e881a887504e",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 165,
"avg_line_length": 26.16788321167883,
"alnum_prop": 0.6041841004184101,
"repo_name": "mailmevj/apiai-flightassistant-webhook-sample",
"id": "dc19325e7ab00bc953f845983eb... |
"""``clicmd_ons.py``
`Module for CLI specific functionality`
"""
import re
import os
import traceback
import time
import pytest
from . import clissh
from . import loggers
from .custom_exceptions import CLICMDException
def get_table_title(line):
"""Get table name.
Args:
line(str): output
""... | {
"content_hash": "cd6cad75506f620420a39f24166ffe11",
"timestamp": "",
"source": "github",
"line_count": 595,
"max_line_length": 153,
"avg_line_length": 38.90084033613445,
"alnum_prop": 0.49477231487082,
"repo_name": "orestkreminskyi/taf",
"id": "47f43e024f3c8b50fabc67d0e29259e4270c5c2f",
"size": "2... |
"""
Command line interface module for OpenTMI client
License: MIT
"""
from __future__ import print_function
import sys
import json
import argparse
import logging
import pkg_resources # part of setuptools
from opentmi_client.api import OpenTmiClient
from opentmi_client.utils.exceptions import OpentmiException
EXIT_CO... | {
"content_hash": "c0bdfbe063786b250339f295e2a2bad8",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 82,
"avg_line_length": 33.701183431952664,
"alnum_prop": 0.4737951013958388,
"repo_name": "OpenTMI/opentmi-client-python",
"id": "dfe9bcf01f421644e5e626eb303b65082c16f663",
... |
"""A helper function for parsing and executing Dialogflow skills."""
import os
import logging
from voluptuous import Required
from opsdroid.const import DEFAULT_LANGUAGE
_LOGGER = logging.getLogger(__name__)
CONFIG_SCHEMA = {Required("project-id"): str, "min-score": float}
async def call_dialogflow(text, opsdroid,... | {
"content_hash": "f299bfb11aca0e04479d52bdecf4fd57",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 153,
"avg_line_length": 37.70992366412214,
"alnum_prop": 0.573076923076923,
"repo_name": "jacobtomlinson/opsdroid",
"id": "3889f0aa248c2637867bce2fea5c33e605b89c63",
"size... |
"""The Python implementation of the GRPC helloworld.Greeter server."""
from concurrent import futures
import logging
import grpc
import helloworld_pb2
import helloworld_pb2_grpc
class Greeter(helloworld_pb2_grpc.GreeterServicer):
def SayHello(self, request, context):
return helloworld_pb2.HelloReply(me... | {
"content_hash": "9a34224e8d2b87dfbe61a194e54be206",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 77,
"avg_line_length": 25,
"alnum_prop": 0.717037037037037,
"repo_name": "ejona86/grpc",
"id": "acc5adbfe1553b1f6c58b327cc4fce710bba863c",
"size": "1252",
"binary": false... |
import asyncio
import aiohttp
from aiohttp import web
import zmq
from zmq.asyncio import Context, ZMQEventLoop
from rpc import WSRPCHandler
class RPC(WSRPCHandler):
"""Application RPC. RPC methods should start with the `rpc_` prefix"""
def __init__(self, loop=None):
if loop is None:
lo... | {
"content_hash": "8a2f8320376c13ca7454ccd632bc748c",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 74,
"avg_line_length": 28.70149253731343,
"alnum_prop": 0.6229849193967759,
"repo_name": "davebshow/aiogoblin",
"id": "f453d01210c792fb53bbb0b693663d811aaff5c4",
"size": "1... |
""" Entry point for the different contexts supported by the application: customer (general customer configurations),
user (user specific data, always associated to a customer context) and session (request information, can be
associated to a customer context for general environment batch calls or to a user conte... | {
"content_hash": "892f47cfafd217ba1d9a60768401cc57",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 116,
"avg_line_length": 40.11764705882353,
"alnum_prop": 0.680218608371101,
"repo_name": "hypermindr/barbante",
"id": "ac3600206c54e093cbf7952677aa2205d2212381",
"size": "... |
import opentuner
from opentuner import ConfigurationManipulator
from opentuner import IntegerParameter
from opentuner import MeasurementInterface
from opentuner import Result
import json
import time
import sys
import re
class TransposeTune(MeasurementInterface):
def manipulator(self):
"""
Define t... | {
"content_hash": "c7d872b03c58a2d49d38d5e06c1e998a",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 77,
"avg_line_length": 38.4051724137931,
"alnum_prop": 0.567003367003367,
"repo_name": "hfp/libxsmm",
"id": "1200e9bf62b85086f127ed1e7334d0c02fe5fcc1",
"size": "5321",
"... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0021_auto_20151223_1756'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='avatar',
... | {
"content_hash": "247a1756bad7ef57dbba9b6284638a78",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 124,
"avg_line_length": 25.22222222222222,
"alnum_prop": 0.6277533039647577,
"repo_name": "tfiers/arenberg-online",
"id": "17697d52b64f71ec558bb88edeb0181a49de8e38",
"size"... |
from django.contrib import admin
from .models import Location
admin.site.register(Location)
| {
"content_hash": "f3fba3f1f2149a5562552ae60b5c6e62",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 32,
"avg_line_length": 18.8,
"alnum_prop": 0.8191489361702128,
"repo_name": "pugpe/pugpe",
"id": "144f963dd3940c981dd88137eea7ff4a427a0d34",
"size": "118",
"binary": false... |
from cogbot.cogs.robo_mod.robo_mod_action import RoboModAction
from cogbot.cogs.robo_mod.robo_mod_trigger import RoboModTrigger
class ReplyToAuthorAction(RoboModAction):
def __init__(self):
self.content: str = None
async def update(self, state: "RoboModServerState", data: dict):
self.content ... | {
"content_hash": "b2b92f38f79f595cf719437ac89f8393",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 72,
"avg_line_length": 37.5,
"alnum_prop": 0.7161904761904762,
"repo_name": "Arcensoth/cogbot",
"id": "b9002db3b994d82f288f5515ee0b8da84cc3655c",
"size": "525",
"binary":... |
import logging
# From http://stackoverflow.com/questions/384076/how-can-i-color-python-logging-output
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
#The background is set with 40 plus the number of the color, and the foreground with 30
#These are the sequences need to get colored ouput
RESET_SEQ ... | {
"content_hash": "5c4036d55bc81452825fe1983786c9a2",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 123,
"avg_line_length": 30.220338983050848,
"alnum_prop": 0.6561974200785193,
"repo_name": "huqa/pyfibot",
"id": "e219cb7a9aceb563b3314a6a734b5b81e0542ac2",
"size": "1783",... |
__usage__ = \
"""A simple script to automatically produce sitemaps for a webserver,
in the Google Sitemap Protocol (GSP).
Usage: python sitemap_gen.py --config=config.xml [--help] [--testing]
--config=config.xml, specifies config file location
--help, displays usage message
--testin... | {
"content_hash": "dac65af163854ceeedc833fe3263e09a",
"timestamp": "",
"source": "github",
"line_count": 2052,
"max_line_length": 81,
"avg_line_length": 31.841130604288498,
"alnum_prop": 0.6016560041629679,
"repo_name": "openprocurement/restkit",
"id": "e270a39d9cc75b78b6404dcba57f9e6bccd3d0b7",
"si... |
"""Test various command line arguments and configuration file parameters."""
import os
from test_framework.test_framework import BitcoinTestFramework
class ConfArgsTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 1
self.supports_cli = ... | {
"content_hash": "3cf489b376b723a040ccf61e9d78f5f0",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 207,
"avg_line_length": 50.99382716049383,
"alnum_prop": 0.6140903038373078,
"repo_name": "dashpay/dash",
"id": "aea8a81e92c2864c3bd32bb15c0254cbd238d4b0",
"size": "8470",... |
from traits.api import HasTraits, File
from traitsui.api import FileEditor, Item, View
class FileEditorTest(HasTraits):
filename_simple = File
filename_custom = File
filename_filtered = File
view = View( Item('filename_simple', style='simple'),
Item('filename_custom', style='custom')... | {
"content_hash": "4a9475ec8315cbfb62ef58752ef3f6dd",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 92,
"avg_line_length": 33.6875,
"alnum_prop": 0.5825602968460112,
"repo_name": "marshallmcdonnell/interactive_plotting",
"id": "b43cbbf10255266370ebfc0b0ea0df75693ba9ca",
"... |
import pyaf.Bench.YahooStocks as ys
import pyaf.Bench.TS_datasets as tsds
tester7 = ys.cYahoo_Tester(tsds.load_yahoo_stock_prices("my_test") , "YAHOO_my_test");
tester7.testAllSignals(12);
# tester7.run_multiprocessed(18);
| {
"content_hash": "f11ab669fdfb2ab611240f1a7da08671",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 86,
"avg_line_length": 37.333333333333336,
"alnum_prop": 0.7678571428571429,
"repo_name": "antoinecarme/pyaf",
"id": "6d2e79f1eb7561ff7e49408c4ac643c8b2f173ae",
"size": "224... |
import re
from validators import KeywordValidator, Validator
# Arrary of validator actions
validators = []
########################################
# Define Validators
########################################
#############
stop_validator = KeywordValidator('stop')
validators.append(stop_validator)
@stop_validator.s... | {
"content_hash": "20f5cc323997ca9168732f1c5eb8c221",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 109,
"avg_line_length": 32.42028985507246,
"alnum_prop": 0.6548949485918641,
"repo_name": "I-TECH-UW/mwachx",
"id": "20bf81f5e9d745590a2714ad0d612164ab2fbe67",
"size": "223... |
from contextlib import contextmanager
@contextmanager
def multi_file_manager(files, mode, newline, encoding):
# https://stackoverflow.com/a/21683192
files = [open(file, mode, newline, encoding) for file in files]
yield files
for file in files:
file.close()
| {
"content_hash": "8956c2f2d5ae10e57083fd204c65e4c9",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 67,
"avg_line_length": 23.75,
"alnum_prop": 0.7017543859649122,
"repo_name": "Holovin/D_GrabDemo",
"id": "e260ed745e02586ca37d2c367a23657adc29d3c3",
"size": "285",
"binar... |
from django.conf import settings
from cms.models import Title
from minitrue.base import replacer
from minitrue.contrib.django_cms.utils import plugin_get_url
def title_get_url(obj):
return obj.page.get_absolute_url()
replacer.register(Title, fields=['title', 'page_title', 'menu_title', 'redirect', 'meta_descrip... | {
"content_hash": "940540122991e911fb33374ded117a6a",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 119,
"avg_line_length": 36.76271186440678,
"alnum_prop": 0.7076994006454588,
"repo_name": "piquadrat/django-minitrue",
"id": "a7c37104f5cb40cbfe45de7795d9b25be901cade",
"si... |
import asyncio
import logging
import os
import ssl
import threading
import traceback
from urllib.parse import urlparse
from typing import Any, Dict, List, Optional, Tuple
# TODO(bashi): Remove import check suppressions once aioquic dependency is resolved.
from aioquic.buffer import Buffer # type: ignore
from aioquic.... | {
"content_hash": "8716dc8b1a3bc4a8df1498313f7c8e50",
"timestamp": "",
"source": "github",
"line_count": 543,
"max_line_length": 135,
"avg_line_length": 40.58195211786372,
"alnum_prop": 0.6056906879651479,
"repo_name": "nwjs/chromium.src",
"id": "d3031b4c0c2f531f97720249a0596f04c8c63d75",
"size": "2... |
"""Main script to run video classification."""
import argparse
import sys
import time
import cv2
from video_classifier import VideoClassifier
from video_classifier import VideoClassifierOptions
# Visualization parameters
_ROW_SIZE = 20 # pixels
_LEFT_MARGIN = 24 # pixels
_TEXT_COLOR = (0, 0, 255) # red
_FONT_SIZ... | {
"content_hash": "600b2594236b5ebf220cd6466d167973",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 82,
"avg_line_length": 34.36477987421384,
"alnum_prop": 0.66599560761347,
"repo_name": "tensorflow/examples",
"id": "9a53748ca5bcf28b685463db56e33318a641a265",
"size": "60... |
import os
PROJECT_DIR = os.path.dirname(__file__)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
)
CACHE_BACKEND = 'locmem:///'
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = 'cms.sqlite'
TEST_DATABASE_CHARSET = "utf8"
TEST_DATABASE_COLLATION = "utf8_general_ci"
DATABASE_SUPPORTS_TRANSACTIONS = Tr... | {
"content_hash": "1f736f6e0a213fdc813c31388b50a33d",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 130,
"avg_line_length": 23.879518072289155,
"alnum_prop": 0.6458123107971746,
"repo_name": "dibaunaumh/tikal-corp-website",
"id": "ddb48f7cb2f24ccb5042ba048ca6eb2953a4f3af",... |
from pyramid.renderers import render_to_response
from groupdocs.ApiClient import ApiClient
from groupdocs.AntApi import AntApi
from groupdocs.GroupDocsRequestSigner import GroupDocsRequestSigner
# Checking value on null
def IsNotNull(value):
return value is not None and len(value) > 0
# Set variables and get POS... | {
"content_hash": "68530e5b4c9be14a8827b85d3c93f403",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 131,
"avg_line_length": 35,
"alnum_prop": 0.656547619047619,
"repo_name": "liosha2007/temporary-groupdocs-python-sdk",
"id": "c3cd4312179c8d4305d79a10898dfb4350c85ab9",
"si... |
from __future__ import print_function
import argparse
import datetime
import httplib
import glob
import imp
import json
import os
import re
import shutil
import subprocess
import sys
import textwrap
import time
import urllib
import urllib2
from git_recipes import GitRecipesMixin
from git_recipes import GitFailedExcep... | {
"content_hash": "6efeacdccea2d350db8a7ab572de7b56",
"timestamp": "",
"source": "github",
"line_count": 788,
"max_line_length": 79,
"avg_line_length": 32.60279187817259,
"alnum_prop": 0.6366431824374295,
"repo_name": "youtube/cobalt_sandbox",
"id": "fd69075872f9a3887d196ccc3c2001fb7bd9b5c6",
"size"... |
"""
Created on Fri Mar 9 14:22:28 2012
@author: eba
"""
def plotLines():
class line_entry():
def __init__(self,startx, starty, endx, endy):
self.startx=startx;
self.starty=starty;
self.endx=endx;
self.endy=endy;
def __repr__(self):
return "... | {
"content_hash": "1c193b99f4b2cdce95ad1c5183e4f44a",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 103,
"avg_line_length": 34.28125,
"alnum_prop": 0.5542388331814039,
"repo_name": "enobayram/MHFlib",
"id": "ebe6f5a7eb8ab6aa5003d31c6281f9d0f14b2427",
"size": "1121",
"bi... |
"""Solum Deployer Heat handler."""
# import json
import logging
import socket
import time
from heatclient import exc
import httplib2
# from keystoneclient.v2_0 import client as ksclient
from oslo_config import cfg
from oslo_log import log as os_logging
from sqlalchemy import exc as sqla_exc
from swiftclient import ex... | {
"content_hash": "40167598449381e0fdf8321fb7b896e4",
"timestamp": "",
"source": "github",
"line_count": 789,
"max_line_length": 79,
"avg_line_length": 41.02027883396705,
"alnum_prop": 0.5404603738606519,
"repo_name": "stackforge/solum",
"id": "3c20d6e658f9854bf739b49713b4f0109474bf2e",
"size": "329... |
"""Test the listsincelast RPC."""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal, assert_array_result, assert_raises_rpc_error
class ListSinceBlockTest (BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 4
self.setup_clea... | {
"content_hash": "7bc8a7941d28df270151c508e78ed329",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 106,
"avg_line_length": 34.11469534050179,
"alnum_prop": 0.5685017860895146,
"repo_name": "merelcoin/merelcoin",
"id": "53e671cd3b0ac1172a3b5eaba8511ba04e4606d8",
"size": ... |
from __future__ import division, print_function, absolute_import
import os
# Fix the multiprocessing issue with NumPy compiled against OPENBLAS
if 'OPENBLAS_MAIN_FREE' not in os.environ:
os.environ['OPENBLAS_MAIN_FREE'] = '1'
# automatically set number of threads used by MKL and openblas to 1
# prevents errors when... | {
"content_hash": "b6e3af707450c4dcc002024343d4c231",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 79,
"avg_line_length": 29.628691983122362,
"alnum_prop": 0.621048134434634,
"repo_name": "zasdfgbnm/qutip",
"id": "7dbb98d4f3fcb20401200f3d15c8ef640840d35d",
"size": "8837... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.