text stringlengths 4 1.02M | meta dict |
|---|---|
from google.cloud import dialogflow_v2
def sample_get_entity_type():
# Create a client
client = dialogflow_v2.EntityTypesClient()
# Initialize request argument(s)
request = dialogflow_v2.GetEntityTypeRequest(
name="name_value",
)
# Make the request
response = client.get_entity_ty... | {
"content_hash": "6ffa3002a8f29ffe08bb664928736514",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 62,
"avg_line_length": 23.736842105263158,
"alnum_prop": 0.70509977827051,
"repo_name": "googleapis/python-dialogflow",
"id": "ba8abfec23f02c37d808347a0f755f09b1bf17f8",
"s... |
'''
## License
The MIT License (MIT)
GrovePi for the Raspberry Pi: an open source platform for connecting Grove Sensors to the Raspberry Pi.
Copyright (C) 2015 Dexter Industries
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Sof... | {
"content_hash": "539c479f5fce2c14dcc1b5f8a9aa2bc2",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 103,
"avg_line_length": 37.71052631578947,
"alnum_prop": 0.7794836008374041,
"repo_name": "karan259/GrovePi",
"id": "3caa1e8346bf0e678f2ef28e20c4308dec226f87",
"size": "182... |
from django.conf import settings
from ionyweb.website.rendering.utils import render_view
def index_view(request, plugin):
separator = plugin.get_separator()
links = plugin.links_enabled
pages = []
# Ancestors
if plugin.ancestors_displayed:
pages = list(request.page.get_ancestors())
... | {
"content_hash": "e55cfeec084923af9e02c16a09968876",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 97,
"avg_line_length": 34.857142857142854,
"alnum_prop": 0.6180327868852459,
"repo_name": "makinacorpus/ionyweb",
"id": "f9bbdd925a7bd8f93e2bc6557813e63bec63d4f5",
"size": ... |
"""Common exceptions for ADB and Fastboot."""
class CommonUsbError(Exception):
"""Base class for usb communication errors."""
class FormatMessageWithArgumentsException(CommonUsbError):
"""Exception that both looks good and is functional.
Okay, not that kind of functional, it's still a class.
This ... | {
"content_hash": "ad2fe95a033130433bddf33d822d4f10",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 81,
"avg_line_length": 28.666666666666668,
"alnum_prop": 0.7098560354374308,
"repo_name": "google/python-adb",
"id": "54f7e0b4b7afd41f09215e0de3ca6a5280718ed6",
"size": "24... |
import os
import shutil
from collections import defaultdict
import cv2
import numpy as np
import yaml
from cv_helpers import show, get_classifier_directories, ls
from sides.serial_number_cv import SERIAL_IS_ZERO_CLASSIFIER_DIR
from modules.password_cv import PASSWORD_LETTER_CLASSIFIER_DIR
NUM_MODULE_POSITIONS = 6
M... | {
"content_hash": "b9bf761557d96e7b8f5a4ffb3da4735f",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 117,
"avg_line_length": 37.61538461538461,
"alnum_prop": 0.6255112474437627,
"repo_name": "FuegoFro/KeepTalkingBot",
"id": "d7f249d38f980344db6cb96e89fc5bb02d7f1f7c",
"siz... |
from owslib.waterml.wml import SitesResponse, TimeSeriesResponse, VariablesResponse, namespaces
from owslib.etree import etree, ElementType
def ns(namespace):
return namespaces.get(namespace)
class WaterML_1_1(object):
def __init__(self, element):
if isinstance(element, ElementType):
se... | {
"content_hash": "e3b880d2626ea4b27f966cf137e3700d",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 95,
"avg_line_length": 32.35294117647059,
"alnum_prop": 0.6063636363636363,
"repo_name": "ocefpaf/OWSLib",
"id": "a963ac8cc08fe01e87928b6522ef6e627733b469",
"size": "1100",... |
"""
Different kinds of sliding windows
"""
from __future__ import absolute_import, division, print_function
from .base_sliding_window import BaseSlidingWindow
from .delayed_sliding_window import DelayedSlidingWindow
from .repeated_sliding_window import RepeatedSlidingWindow
from .sliding_window import SlidingWind... | {
"content_hash": "18a6a007e01d4efca79dfee98310991d",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 64,
"avg_line_length": 32.3,
"alnum_prop": 0.8142414860681114,
"repo_name": "w495/python-video-shot-detector",
"id": "dbbbfbf2e08e76dc001cf31e3d17b64c790ba048",
"size": "34... |
from PyQt5 import Qt
class ColorDelegate(Qt.QStyledItemDelegate):
def createEditor(self, parent, option, midx):
if midx.isValid():
e = Qt.QColorDialog(parent)
e.setOption(Qt.QColorDialog.ShowAlphaChannel)
e.setOption(Qt.QColorDialog.DontUseNativeDialog)
# Due... | {
"content_hash": "77a721895df3a0142669592623d1b714",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 138,
"avg_line_length": 46.67272727272727,
"alnum_prop": 0.6244643552785353,
"repo_name": "erikhvatum/RisWidget",
"id": "9ccec5dff81b4590ff36ccf1eeaa6c62718a2463",
"size": ... |
"""UK Environment Agency Flood Monitoring Integration."""
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from .const import DOMAIN
PLATFORMS = [Platform.SENSOR]
async def async_setup_entry(hass: HomeAssistant, entry: ConfigE... | {
"content_hash": "dcf9433b94250ee5f05271b99b5f8b71",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 78,
"avg_line_length": 35.95,
"alnum_prop": 0.7677329624478443,
"repo_name": "rohitranjan1991/home-assistant",
"id": "e7b6cd88092478122aec32d4e1a96a9503fd470e",
"size": "71... |
import os
from pprint import pformat
from django import http
from django.core import signals
from django.core.handlers.base import BaseHandler
from django.core.urlresolvers import set_script_prefix
from django.utils import datastructures
from django.utils.encoding import force_unicode, smart_str
# NOTE: do *not* impo... | {
"content_hash": "2c4f53907b29f922568ed0c1d1a05258",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 130,
"avg_line_length": 39.54761904761905,
"alnum_prop": 0.5794099939795304,
"repo_name": "Shrews/PyGerrit",
"id": "aa3fb23e39c32156258066470299d6bb00d8c2fc",
"size": "830... |
import os
import inspect
import datetime
import sys
import shutil
from knitter.configure import General
from knitter import logger
def get_sub_folder_names(full_path):
return [ name for name in os.listdir(full_path) if os.path.isdir(os.path.join(full_path, name)) ]
def get_value_from_conf(conf_file, key):
... | {
"content_hash": "2d8a77ba7cb53ca20d8a627043a2766b",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 118,
"avg_line_length": 26.694915254237287,
"alnum_prop": 0.5146031746031746,
"repo_name": "hww712/knitter",
"id": "c8cbe34361ba83f8fb741c4081c968e07c971355",
"size": "315... |
from binascii import hexlify, unhexlify
import traceback
import sys
from electrum.util import bfh, bh2u, versiontuple, UserCancelled, UserFacingException
from electrum.bitcoin import TYPE_ADDRESS, TYPE_SCRIPT
from electrum.bip32 import BIP32Node
from electrum import constants
from electrum.i18n import _
from electrum.... | {
"content_hash": "9d23e0e5357eb8826c9c16adf1d48d89",
"timestamp": "",
"source": "github",
"line_count": 489,
"max_line_length": 127,
"avg_line_length": 43.513292433537835,
"alnum_prop": 0.5719052542532193,
"repo_name": "fujicoin/electrum-fjc",
"id": "c71523eb0bbc2a75b39eb669f91e77f361888fc5",
"size... |
USE_PYTHON3 = True
def _RunBindingsTests(input_api, output_api):
pardir = input_api.os_path.pardir
cmd_name = 'run_bindings_tests.py'
run_bindings_tests_path = input_api.os_path.join(
input_api.PresubmitLocalPath(), *([pardir] * 4 + ['tools', cmd_name]))
cmd = [input_api.python3_executable, ru... | {
"content_hash": "0e082bf8afc6397dd0d4c24a4cbee3dd",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 78,
"avg_line_length": 34.72727272727273,
"alnum_prop": 0.6910994764397905,
"repo_name": "nwjs/chromium.src",
"id": "7b2498bc0add74d3a9d95408444b587283741dc6",
"size": "927... |
__all__ = [
'map_readers', 'buffered', 'compose', 'chain', 'shuffle',
'ComposeNotAligned', 'firstn', 'xmap_readers', 'PipeReader'
]
from threading import Thread
import subprocess
from Queue import Queue
import itertools
import random
import zlib
def map_readers(func, *readers):
"""
Creates a data re... | {
"content_hash": "7ff605c5a8671bd49fdae3e53b0d2c0b",
"timestamp": "",
"source": "github",
"line_count": 391,
"max_line_length": 79,
"avg_line_length": 28.67774936061381,
"alnum_prop": 0.5624721305627397,
"repo_name": "pkuyym/Paddle",
"id": "44a6e344630bb35d28ee29078bf8727053a24bef",
"size": "11823"... |
"""
chart.py
chart.py Module Docstring
"""
__all__ = ["ChartTypes", "Chart"]
__version__ = 0.1
__author__ = "Fin"
# Stdlib Imports
import string
import os
import tempfile
import webbrowser
import copy
# Third Party Imports
# pyhighcharts Imports
from .util import safe_update, format_script_tag, \
format_option... | {
"content_hash": "bb36a8804720c4763c6030730c5ddf38",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 88,
"avg_line_length": 30.863636363636363,
"alnum_prop": 0.5739209244363883,
"repo_name": "BennettRand/Solar-Circuit",
"id": "b52b3cff5e531d9abe9cd3cae727c83eb6f51658",
"s... |
'''
Quality Metrics:
- Top 3 colors across active scenes
- These probably need to be binned
- Avg_sat across active scenes
- Avg_val across active scenes
Longest scene:
- All metadata
Most active scene:
- All metadata
Scenes:
- Number of total scenes
- Number of static scenes
- Number of action scenes
- Average du... | {
"content_hash": "7082fea86e2d1b73b3203722f60d07b3",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 139,
"avg_line_length": 36.015686274509804,
"alnum_prop": 0.5918989547038328,
"repo_name": "pdxcycling/carv.io",
"id": "0769df189a05586a2bcbc5a998da0057f0f098f6",
"size": ... |
from django.template import Library, Node, TemplateSyntaxError
register = Library()
class SetVariable(Node):
def __init__(self, varname, nodelist):
self.varname = varname
self.nodelist = nodelist
def render(self,context):
context[self.varname] = self.nodelist.render(context)... | {
"content_hash": "ec38ed2c801829ef13b72d6ce208ed18",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 116,
"avg_line_length": 30.466666666666665,
"alnum_prop": 0.6312910284463895,
"repo_name": "Kami/munin_exchange",
"id": "8097d7d6213e6b397169192f5c832961b64bfbab",
"size": ... |
import serial
import time
import openanything
import xml.etree.ElementTree as ETree
useragent = 'pyFrenchToastArduino/1.0'
xml_source = 'http://www.universalhub.com/toast.xml'
server_response = { 'etag' : None, 'lastmodified' : None, 'data': None }
def processXML(xml):
tree = ETree.fromstring(xml)
status = tree.... | {
"content_hash": "9a933ff50162582b43db31ac71195452",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 98,
"avg_line_length": 28.73076923076923,
"alnum_prop": 0.6983489513609995,
"repo_name": "IvanGirderboot/frenchtoastino",
"id": "ee264769851218674673d1f9eb9b06477c30e986",
... |
"""Build a project using PEP 517 hooks.
"""
import argparse
import logging
import os
import shutil
import tempfile
from ._compat import tomllib
from .envbuild import BuildEnvironment
from .wrappers import Pep517HookCaller
log = logging.getLogger(__name__)
def validate_system(system):
"""
Ensure build system... | {
"content_hash": "3a0ff357f154eb8dfac6e941643a58f6",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 75,
"avg_line_length": 27.325396825396826,
"alnum_prop": 0.6430438571013651,
"repo_name": "pradyunsg/pip",
"id": "b30909c8704a5954ef5250ef890ed4cb1d50cf07",
"size": "3443"... |
import time
import warnings
try:
import requests
REQUESTS_AVAILABLE = True
except ImportError:
REQUESTS_AVAILABLE = False
from .base import Connection
from ..exceptions import ConnectionError, ImproperlyConfigured, ConnectionTimeout, SSLError
from ..compat import urlencode, string_types
class RequestsHttp... | {
"content_hash": "020fdf9b5db7d2c89763eff33af0017c",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 120,
"avg_line_length": 44.6219512195122,
"alnum_prop": 0.6354195135282864,
"repo_name": "prinsherbert/elasticsearch-py",
"id": "6aee2dba026ee7888da38c74463109a6d7584ae2",
... |
import unittest
from HelloWorld.challenge import HelloWorldChallenge
class HelloWorldTest(unittest.TestCase):
def setUp(self):
self.challenge = HelloWorldChallenge()
def test__init__(self):
self.assertIsInstance(self.challenge, HelloWorldChallenge)
self.assertIn('WorldHello', self.c... | {
"content_hash": "5a7b6b11e506a5252ac50c9cd631e77c",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 77,
"avg_line_length": 34.08108108108108,
"alnum_prop": 0.6851704996034893,
"repo_name": "elmar-hinz/Python.Challenges",
"id": "8aa73722ec1520469d1ef91967861c49d3df2a4e",
"... |
"""Long tests for Multinomial."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import random_seed
from... | {
"content_hash": "eaa2ed89af74c2301d347e6d06db1fdb",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 70,
"avg_line_length": 35.1125,
"alnum_prop": 0.6472054111783553,
"repo_name": "annarev/tensorflow",
"id": "2bf15db188544f373c3a41d17ecae50d86aa54db",
"size": "3498",
"bi... |
from optparse import OptionParser
from PIL import Image
import os
import random
from decimal import Decimal
import glob
import ast
import itertools
from collections import namedtuple
INPUTDIR = "data"
OUTPUTDIR = "current"
ScreenProperties = namedtuple("ScreenProperties", "width height voffset id")
# compute total v... | {
"content_hash": "77e98d0cb12b70400398327164262526",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 231,
"avg_line_length": 35.54014598540146,
"alnum_prop": 0.7169850071883344,
"repo_name": "esabouraud/mmwall",
"id": "7c688ace51d372ecd1e3a98abca16098caf91347",
"size": "5... |
"""
WSGI config for my1 project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` sett... | {
"content_hash": "d2fe6bbfcbcd77588186a55b249a4da3",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 79,
"avg_line_length": 44.0625,
"alnum_prop": 0.7914893617021277,
"repo_name": "praveenskumar/djangoapp",
"id": "786841a988adf3bc227547a004bc976fb0a3cca0",
"size": "1410",
... |
from django.views.decorators.csrf import csrf_exempt
from orchestra.project_api.auth import IsSignedUser
from orchestra.project_api.auth import OrchestraProjectAPIAuthentication
from jsonview.decorators import json_view
from rest_framework.decorators import api_view
from rest_framework.decorators import authentication_... | {
"content_hash": "3a318aa962392a2c05cf07356c98b880",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 72,
"avg_line_length": 33.029411764705884,
"alnum_prop": 0.7061442564559216,
"repo_name": "Sonblind/orchestra",
"id": "7a3ef47e0410b4f391a32ae100e1ed4a3d220e45",
"size": "1... |
from __future__ import unicode_literals
from django.db import models
from core.models import State, Platform, Module
from image.models import Image, Imagerevision, Imagetype
from provisioning.models import Provisioning
from authentication.models import User, Usergroup
from managementnode.models import Managementnode
f... | {
"content_hash": "5d7fca256cccebe2174dfaab8753bfb7",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 137,
"avg_line_length": 46.732484076433124,
"alnum_prop": 0.7252282949434373,
"repo_name": "luisza/vcl_django",
"id": "60bb4ed6968bf95575fbb32a70e42654cde33a34",
"size": "... |
"""
Enumeration of valid variable types for binary quadratic models.
Examples:
This example shows easy access to different Vartypes, which are in the main
namespace.
>>> vartype = dimod.SPIN
>>> print(vartype)
Vartype.SPIN
>>> vartype = dimod.BINARY
>>> print(vartype)
Vartype.BINARY
... | {
"content_hash": "f89ce185ae0af17b651e60b8d93a6255",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 92,
"avg_line_length": 24.672727272727272,
"alnum_prop": 0.6271186440677966,
"repo_name": "oneklc/dimod",
"id": "af482d97770059ba412b6f7e741ffe0786666f05",
"size": "2068",
... |
"""octopus URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | {
"content_hash": "f32b10e4767ce5c658e9c4a6109c8699",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 77,
"avg_line_length": 36.67857142857143,
"alnum_prop": 0.7069133398247323,
"repo_name": "gregorianzhang/octopus",
"id": "35a9993c6a48d139de7a2d72af6da9e6a79e041c",
"size":... |
from zope.interface import implements
from twisted.internet import defer
from twisted.python import log
from nevow import inevow, rend, loaders, static, url, tags, util
from nevow.flat import flatten
from nevow.stan import Proto, Tag
from itertools import count
cn = count().next
cookie = lambda: str(cn())
_hookup =... | {
"content_hash": "0910e43890dcbb6871e0cc73b49fb1dc",
"timestamp": "",
"source": "github",
"line_count": 471,
"max_line_length": 114,
"avg_line_length": 32.74946921443737,
"alnum_prop": 0.59935170178282,
"repo_name": "perkinslr/pypyjs",
"id": "2d32e0edc4ffb913fa8e78c615b8966077a7745a",
"size": "1548... |
import pytest
from notifiers.exceptions import BadArguments
provider = "simplepush"
class TestSimplePush:
"""SimplePush notifier tests
Note: These tests assume correct environs set for NOTIFIERS_SIMPLEPUSH_KEY
"""
def test_simplepush_metadata(self, provider):
assert provider.metadata == {
... | {
"content_hash": "9114a0f1ebb4a024bf586e403ed90891",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 78,
"avg_line_length": 31.02857142857143,
"alnum_prop": 0.6206261510128913,
"repo_name": "liiight/notifiers",
"id": "733772a17d210e89f23fd73cc0a410399e500af7",
"size": "108... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0056_auto_20220116_0236'),
]
operations = [
migrations.AddField(
model_name='registration',
name='payment_type',
field=models.PositiveSmallIntege... | {
"content_hash": "39f5c6a7cf6c6c86e673eba5a15dc64d",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 99,
"avg_line_length": 24.5625,
"alnum_prop": 0.5826972010178118,
"repo_name": "bmun/huxley",
"id": "3e1227a7a663a6fa501320a4657c724d81fc49b3",
"size": "442",
"binary": f... |
import _plotly_utils.basevalidators
class TextValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="text", parent_name="table.legendgrouptitle", **kwargs
):
super(TextValidator, self).__init__(
plotly_name=plotly_name,
parent_name=par... | {
"content_hash": "5df1234897f017a960ee9a88546510c5",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 80,
"avg_line_length": 32.15384615384615,
"alnum_prop": 0.6052631578947368,
"repo_name": "plotly/plotly.py",
"id": "438b6def34e6b0c7b78132236a0be5668f7ddf2e",
"size": "418"... |
"""
XMPP publish-subscribe protocol.
This protocol is specified in
U{XEP-0060<http://www.xmpp.org/extensions/xep-0060.html>}.
"""
from zope.interface import implements
from twisted.internet import defer
from twisted.python import log
from twisted.words.protocols.jabber import jid, error
from twisted.words.xish impor... | {
"content_hash": "d5954b749c5ab5edf22f80ae205ababe",
"timestamp": "",
"source": "github",
"line_count": 1376,
"max_line_length": 81,
"avg_line_length": 32.22892441860465,
"alnum_prop": 0.5956208988206643,
"repo_name": "dustin/wokkel",
"id": "ed60238bbccb625ae752facbd81254ce585d1604",
"size": "44466... |
import logging
import json
from django.conf import settings
import traceback
from datetime import datetime
from django.template.loader import render_to_string
from django.db.models.aggregates import Sum
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
... | {
"content_hash": "a79762b1bad2564be3332ac03f88c52c",
"timestamp": "",
"source": "github",
"line_count": 1154,
"max_line_length": 135,
"avg_line_length": 44.418544194107454,
"alnum_prop": 0.6015138804892799,
"repo_name": "annttu/sikteeri",
"id": "f4cc2b68cd9809bc0bbcb70b496fc3d651e5c2ec",
"size": "5... |
"""Receives documents from the oplog worker threads and indexes them
into the backend.
This file is a document manager for the Solr search engine, but the intent
is that this file can be used as an example to add on different backends.
To extend this to other systems, simply implement the exact same class and
replace ... | {
"content_hash": "e8316f1d3cfaff83c5b05f5ce6dd1c05",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 80,
"avg_line_length": 38.051162790697674,
"alnum_prop": 0.5649676078718983,
"repo_name": "gazimahmud/mongo-connector",
"id": "f03912fe3c0cac48ece8cef83dfb085d0c75ed58",
"... |
from __future__ import unicode_literals
# Ensure 'assert_raises' context manager support for Python 2.6
import tests.backport_assert_raises
from nose.tools import assert_raises
import boto
from boto.exception import EC2ResponseError
import sure # noqa
from moto import mock_ec2
from tests.helpers import requires_bot... | {
"content_hash": "cabb1d84149c681e7d2da4ec6b5f1646",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 123,
"avg_line_length": 40.68910256410256,
"alnum_prop": 0.663410791650256,
"repo_name": "DataDog/moto",
"id": "3bdf6dac7a9553a7d983147496fba15e5491a7cc",
"size": "12695",... |
from __future__ import unicode_literals
import datetime
import pytest
import pypuppetdb
class TestUTC(object):
"""Test the UTC class."""
def test_utc_offset(self, utc):
assert datetime.timedelta(0) == utc.utcoffset(300)
def test_tzname(self, utc):
assert str('UTC') == utc.tzname(300)
... | {
"content_hash": "852489a1ea70ba1213436196d66e487d",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 74,
"avg_line_length": 36.76470588235294,
"alnum_prop": 0.6228,
"repo_name": "puppet-community/pypuppetdb",
"id": "f455a14417d4415e575ad490ece9f4cd8aa2a7de",
"size": "2500"... |
from tempest.api.baremetal.admin import base
from tempest import test
class TestApiDiscovery(base.BaseBaremetalTest):
"""Tests for API discovery features."""
@test.attr(type='smoke')
def test_api_versions(self):
resp, descr = self.client.get_api_description()
self.assertEqual('200', resp[... | {
"content_hash": "73f010ad7bc3c226a4a896638888a8af",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 71,
"avg_line_length": 33.4,
"alnum_prop": 0.6184773310521814,
"repo_name": "Mirantis/tempest",
"id": "7368b3e8103fba764b327f80a463657ecbcc97a9",
"size": "1742",
"binary"... |
"""Utility class for producing a scansion pattern for a Latin hexameter.
Given a line of hexameter, the scan method performs a series of transformation and checks
are performed and for each one performed successfully, a note is added to the scansion_notes
list so that end users may view the provenance of a scansion.
... | {
"content_hash": "fa5f5417779a6205be0a30db0eb90a7c",
"timestamp": "",
"source": "github",
"line_count": 490,
"max_line_length": 395,
"avg_line_length": 47.553061224489795,
"alnum_prop": 0.5745676151238144,
"repo_name": "D-K-E/cltk",
"id": "2e0a26cd26b24b8e58809fbd2dd515d756e691b8",
"size": "23332",... |
import sys
import os
#import sphinx_bootstrap_theme
if sys.version_info.major == 2:
import mock
from mock import Mock as MagicMock
else:
from unittest import mock
from unittest.mock import Mock as MagicMock
class Mock(MagicMock):
@classmethod
def __getattr__(cls, name):
return Mock()
... | {
"content_hash": "bdbe85fbb155b76b3e702c2982b3bc9c",
"timestamp": "",
"source": "github",
"line_count": 336,
"max_line_length": 81,
"avg_line_length": 32.416666666666664,
"alnum_prop": 0.6939955930958501,
"repo_name": "fermiPy/fermipy",
"id": "71a1f479fa1c00fc128e1b0634d0e1f7bd6eac72",
"size": "113... |
"""Test reproduce state for select entities."""
import pytest
from homeassistant.components.select.const import (
ATTR_OPTION,
ATTR_OPTIONS,
DOMAIN,
SERVICE_SELECT_OPTION,
)
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import HomeAssistant, State
from homeassistant.helpers.sta... | {
"content_hash": "738280a69f7166ce6bd4cf921eaf42d3",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 86,
"avg_line_length": 29.892857142857142,
"alnum_prop": 0.6589008363201911,
"repo_name": "mezz64/home-assistant",
"id": "bbd1ae17a7b381674eb41367be6250059c18c6da",
"size":... |
"""Module for number conversions
.. module:: lib.number.conversion
:platform: Unix
:synopsis: Module for number conversions
.. moduleauthor:: Petr Czaderna <pc@hydratk.org>
"""
def int2bool(intvar):
"""Method converts number to bool
Args:
intvar (int): number
Returns:
bool: res... | {
"content_hash": "23665a81aee340b469dad40e40b30443",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 48,
"avg_line_length": 16.807692307692307,
"alnum_prop": 0.6155606407322655,
"repo_name": "hydratk/hydratk",
"id": "83da73062a2e4346c9132c13ae48977b4ec52854",
"size": "461"... |
"""Covertype model taxi model features."""
NUMERIC_FEATURE_KEYS = [
'Elevation', 'Aspect', 'Slope', 'Horizontal_Distance_To_Hydrology',
'Vertical_Distance_To_Hydrology', 'Horizontal_Distance_To_Roadways',
'Hillshade_9am', 'Hillshade_Noon', 'Hillshade_3pm',
'Horizontal_Distance_To_Fire_Points'
]
CATEG... | {
"content_hash": "be4442c474df473e618cdb50632086e9",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 72,
"avg_line_length": 29.944444444444443,
"alnum_prop": 0.6938775510204082,
"repo_name": "GoogleCloudPlatform/mlops-on-gcp",
"id": "434d6d6ac2549230f499f86981c31f44c63a1ea6"... |
"""This example retrieves available creative fields for a given string and
displays the name, ID, advertiser ID, and number of values. Results are
limited to the first 10.
Tags: creativefield.getCreativeFields
"""
__author__ = 'api.jdilallo@gmail.com (Joseph DiLallo)'
import os
import sys
sys.path.insert(0, os.path.... | {
"content_hash": "6a2f182ce325ac43a688b95a59f63c89",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 80,
"avg_line_length": 32.35294117647059,
"alnum_prop": 0.6715151515151515,
"repo_name": "caioserra/apiAdwords",
"id": "359875e4619dc14304b29b1f0f34fa42b7087850",
"size": "... |
"""
This application populates the Personal Archive web application, to facilitate
evaluation of the application for Udacity reviewers.
"""
## IMPORTS
from sqlalchemy import create_engine, asc, desc
from sqlalchemy.orm import sessionmaker
import datetime
## IMPORT DATABASE CLASSES FOR THIS PROJECT
from database_setup... | {
"content_hash": "be8746edd6c3ca85f1b8e15f9b7e725f",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 96,
"avg_line_length": 42.07017543859649,
"alnum_prop": 0.6388657214345288,
"repo_name": "AbigailMathews/catalog_archive",
"id": "47b93d3ce5242a369e81e565cac40bee9613ae08",
... |
import uuid
import svc_monitor.services.loadbalancer.drivers.abstract_driver as abstract_driver
from vnc_api.vnc_api import InstanceIp
from vnc_api.vnc_api import FloatingIp
from vnc_api.vnc_api import PortMap, PortMappings
from vnc_api.vnc_api import ServiceHealthCheck, ServiceHealthCheckType
from vnc_api.vnc_api im... | {
"content_hash": "0315046797de6536e60770c787842aea",
"timestamp": "",
"source": "github",
"line_count": 676,
"max_line_length": 90,
"avg_line_length": 39.28550295857988,
"alnum_prop": 0.548593591143578,
"repo_name": "nischalsheth/contrail-controller",
"id": "890c709be77430a444cbe9480309e030f66d33f3",... |
"""ScienceCruiseDataManagement URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, n... | {
"content_hash": "4b7a337d564d749193b10b4fff82ff9c",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 119,
"avg_line_length": 52.207317073170735,
"alnum_prop": 0.7210932025227751,
"repo_name": "cpina/science-cruise-data-management",
"id": "a46d1d1be0cc115f5a59655c7af44ecfc42d... |
"""diffren API."""
# A new PyPI release will be pushed everytime `__version__` is increased
# When changing this, also update the CHANGELOG.md
__version__ = '0.1.0'
| {
"content_hash": "cdf3d664899dfbfa6cf93037516debb1",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 72,
"avg_line_length": 33.2,
"alnum_prop": 0.6867469879518072,
"repo_name": "google-research/diffren",
"id": "b490bb7486b9b9f666e285adda317e23f109a93c",
"size": "751",
"bi... |
import httplib, urllib2, time, calendar
from datetime import datetime
from decimal import Decimal
from xml.etree.ElementTree import fromstring
from xml.etree import ElementTree as ET
from base64 import b64encode
API_VERSION = 'v4'
def utc_to_local(dt):
''' Converts utc datetime to local'''
secs = calendar.tim... | {
"content_hash": "dea7f16a60ce101ac089670ab8f407e1",
"timestamp": "",
"source": "github",
"line_count": 291,
"max_line_length": 122,
"avg_line_length": 41.580756013745706,
"alnum_prop": 0.525206611570248,
"repo_name": "shelfworthy/python-spreedly",
"id": "cadcf7887b87ff26a78f72d768636417d07e65be",
... |
"""Utilities for making requests using a given client and handling errors.
"""
import io
import json
from apitools.base.py import exceptions as apitools_exceptions
from googlecloudsdk.api_lib.app import exceptions as api_lib_exceptions
from googlecloudsdk.calliope import exceptions
from googlecloudsdk.core import log... | {
"content_hash": "d9abc2f690b4d104a097ec799575c5c4",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 80,
"avg_line_length": 36.93150684931507,
"alnum_prop": 0.7166172106824926,
"repo_name": "KaranToor/MA450",
"id": "f7aa69b5dd8b8dffbfcf8bdb079fde2e0f956a0e",
"size": "3292"... |
from __future__ import with_statement
from fabric.api import cd
from fabric.api import env
from fabric.api import local
from fabric.api import run
from fabric.api import sudo
def server():
env.use_ssh_config = True
env.forward_agent = True
env.port = '22222'
env.user = 'root'
env.hosts = ['zope8']... | {
"content_hash": "e09fe19e98960e889c7476ebb9e51ce9",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 73,
"avg_line_length": 20.025641025641026,
"alnum_prop": 0.6116090482287665,
"repo_name": "potzenheimer/buildout.jms",
"id": "cb384b4c93c763294872e38604716b647ea7f22c",
"s... |
def extractUltimaguilBase(item):
"""
Parser for 'Ultimaguil Base'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'WATTT' in item['tags']:
return buildReleaseMessageWithType(item, 'WATTT', vol, chp, frag=fr... | {
"content_hash": "265ad0f9242fcfe5455d06973e1cd04c",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 89,
"avg_line_length": 35.5,
"alnum_prop": 0.7183098591549296,
"repo_name": "fake-name/ReadableWebProxy",
"id": "23fbfd1709a15651027523e08eba791165a6f738",
"size": "355",
... |
"""A module for representing universal morphosyntactic feature bundles."""
from typing import Dict, List, Optional, Tuple, Type, Union
from cltk.core.exceptions import CLTKException
from cltk.morphology.universal_dependencies_features import *
__author__ = ["John Stewart <free-variation>"]
class Morphosy... | {
"content_hash": "38038ce608f01f213732f13e8cde6620",
"timestamp": "",
"source": "github",
"line_count": 480,
"max_line_length": 136,
"avg_line_length": 33.15,
"alnum_prop": 0.5437405731523378,
"repo_name": "cltk/cltk",
"id": "16fed53cdacf1130c956cf0dfbf1a02b7a6af909",
"size": "15912",
"binary": f... |
from datetime import datetime
from itertools import imap
from bson import ObjectId
from django.core.urlresolvers import reverse
from django.utils.http import urlencode
from django.views.generic import TemplateView, FormView, ListView, RedirectView, View
from django.conf import settings
from django import http
from t... | {
"content_hash": "2a4cc3ff6cd4f7fb194402786658c0c8",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 85,
"avg_line_length": 32.81730769230769,
"alnum_prop": 0.6183221017677507,
"repo_name": "fatiherikli/dbpatterns",
"id": "6ec0ed5bf7c4cbaa319952c9896a82878a3c16a4",
"size"... |
"""Tests for DNNEstimators."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import tempfile
import numpy as np
import tensorflow as tf
from tensorflow.contrib.learn.python.learn.estimators import _sklearn
from tensorflow.contrib.learn.... | {
"content_hash": "eda4d80451d2c7d8727e268d13366c2e",
"timestamp": "",
"source": "github",
"line_count": 1004,
"max_line_length": 81,
"avg_line_length": 38.67131474103586,
"alnum_prop": 0.6177561427909133,
"repo_name": "nanditav/15712-TensorFlow",
"id": "1781d85b6415e1bda27400fe7168efb23261e34d",
"s... |
from __future__ import (absolute_import, division, print_function)
from __future__ import unicode_literals
# this example reads today's numerical weather forecasts
# from the NOAA OpenDAP servers and makes a multi-panel plot.
# This version demonstrates the use of the AxesGrid toolkit.
import numpy as np
import matplo... | {
"content_hash": "db2f519348e97f080360bc8383372816",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 74,
"avg_line_length": 30,
"alnum_prop": 0.6958730158730159,
"repo_name": "guziy/basemap",
"id": "d4d3d44dfc55d31d8fa9c193b30e8bcb6cc61f46",
"size": "3150",
"binary": fa... |
import _plotly_utils.basevalidators
class XanchorValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="xanchor", parent_name="scattergl.marker.colorbar", **kwargs
):
super(XanchorValidator, self).__init__(
plotly_name=plotly_name,
... | {
"content_hash": "4ee0d162877eb844bab21444eb607518",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 86,
"avg_line_length": 35.92857142857143,
"alnum_prop": 0.6023856858846919,
"repo_name": "plotly/plotly.py",
"id": "bbad4b4804fc4f8d7e7f88c44df9eda8840a6fec",
"size": "503"... |
"""\
=======================
Simple Button component
=======================
A simple cuboid shaped button without caption. Implements responsive
button behavoir.
Could be used to subclass differently shaped buttons from. The colours
of the front/back and the side faces can be specified.
Example Usage
-------------
... | {
"content_hash": "1679c2565b145eae86ea9de46fb477a9",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 118,
"avg_line_length": 32.93167701863354,
"alnum_prop": 0.569407770652584,
"repo_name": "sparkslabs/kamaelia_",
"id": "3e1db4f7ccca6394253e32dca9c296ba913700fb",
"size": ... |
"""Test controller."""
from deluca.lung.core import BreathWaveform
from deluca.lung.utils.data.analyzer import Analyzer
from deluca.lung.utils.scripts.run_controller import run_controller_scan
import jax
import jax.numpy as jnp
@jax.jit
def test_controller(controller, sim, pips, peep):
"""Test controller."""
# ne... | {
"content_hash": "e7b35dffb4737a2093d000030a4f1222",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 72,
"avg_line_length": 30.1875,
"alnum_prop": 0.6656314699792961,
"repo_name": "google/deluca",
"id": "972fcd9036ee8467f640692da993cfb5728af8bf",
"size": "1550",
"binary"... |
import hashlib
import logging
import uuid
from tower import ugettext as _
import paypal
log = logging.getLogger('z.paypal')
class Check(object):
"""
Run a series of tests on PayPal for either an addon or a paypal_id.
The add-on is not required, but we'll do another check or two if the
add-on is th... | {
"content_hash": "f727ebd45fda0aaec0ab6c38156d3a8c",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 77,
"avg_line_length": 30.463636363636365,
"alnum_prop": 0.5556550283497463,
"repo_name": "robhudson/zamboni",
"id": "6963cbb93a95cf6564f1c95ff63175e55a3dd44b",
"size": "3... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('service', '0007_auto_20161126_2013'),
]
operations = [
migrations.AlterField(
model_name='post',
name='contentType',
... | {
"content_hash": "6ca48d67008ca5994ef8298ea4b8e553",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 154,
"avg_line_length": 26.944444444444443,
"alnum_prop": 0.6123711340206186,
"repo_name": "CMPUT404Team/CMPUT404-project-socialdistribution",
"id": "a813763e187fa05e691d186b... |
"""
This file registers pre-defined datasets at hard-coded paths, and their metadata.
We hard-code metadata for common datasets. This will enable:
1. Consistency check when loading the datasets
2. Use models on these standard datasets directly and run demos,
without having to download the dataset annotations
We ha... | {
"content_hash": "f71c3d1e4347d2c81055233c288b4087",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 98,
"avg_line_length": 39.59607843137255,
"alnum_prop": 0.6274140833911063,
"repo_name": "facebookresearch/detectron2",
"id": "c3a68aa833f12f0fa324a269c36190f21b8a75bd",
"... |
from i3pystatus.file import File
from i3pystatus import Module
from i3pystatus.core.command import run_through_shell
import shutil
class Backlight(File):
"""
Screen backlight info
- (Optional) requires `xbacklight` to change the backlight brightness with the scollwheel.
.. rubric:: Available formatt... | {
"content_hash": "9d5666c46ccb192f065b9f631bef46ac",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 97,
"avg_line_length": 29.78846153846154,
"alnum_prop": 0.6294383473208521,
"repo_name": "plumps/i3pystatus",
"id": "dd50b483a28d62a8bbd2adac2b8958f886abb0a8",
"size": "155... |
try:
from Tkinter import *
except ImportError:
# for Python3
from tkinter import *
import math
import threading
import time
try:
from exceptions import *
except:
pass
class WindowGone(Exception):
def __init__(self, args=[]):
self.args = args
# These are all the inner Glasgow Canva... | {
"content_hash": "db05c1f0a13cf7ac600330db38b3f919",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 122,
"avg_line_length": 38.727598566308245,
"alnum_prop": 0.5708468301712171,
"repo_name": "RossMeikleham/Connect4",
"id": "ef4a455a83f5b776bccbe1d91539965267fba429",
"siz... |
import os
import shutil
import tempfile
import time
from xml.dom.minidom import Document
import mock
import six
from cinder import exception
from cinder.openstack.common import log as logging
from cinder.openstack.common import loopingcall
from cinder import test
from cinder.volume.drivers.emc.emc_vmax_common import ... | {
"content_hash": "31fca3ea78643a99fc7161caf23164e8",
"timestamp": "",
"source": "github",
"line_count": 3312,
"max_line_length": 79,
"avg_line_length": 38.98913043478261,
"alnum_prop": 0.6120481367902612,
"repo_name": "hguemar/cinder",
"id": "b4c3cb08fb9872b3580a93a5b2845428a89b01aa",
"size": "1297... |
from __future__ import unicode_literals
import os
from .. import helper
from .. import template_helper
class NetsecHandler(helper.RequestHandlerWithAuth):
def render(self, template, data):
TEMPLATE_PATH = os.path.join(self.application.config.module_path, "templates")
data['template_helper'] = te... | {
"content_hash": "2adc0dee223e584c19c0d2798a5fc394",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 86,
"avg_line_length": 29.928571428571427,
"alnum_prop": 0.649164677804296,
"repo_name": "hhucn/netsec-uebungssystem",
"id": "2c9949d6fd5dba4fb2e0f57f87c184a2f01671a7",
"si... |
"""Implements `!p ` interpolation."""
import os
from collections import namedtuple
from UltiSnips import _vim
from UltiSnips.compatibility import as_unicode
from UltiSnips.indent_util import IndentUtil
from UltiSnips.text_objects._base import NoneditableTextObject
from UltiSnips.vim_state import _Placeholder
import U... | {
"content_hash": "e08b88f107d02284ff5faf2926217a4d",
"timestamp": "",
"source": "github",
"line_count": 318,
"max_line_length": 86,
"avg_line_length": 27.358490566037737,
"alnum_prop": 0.5486206896551724,
"repo_name": "NcLang/vimrc",
"id": "5404dca56a744ed147c0edf124552de711fb9958",
"size": "8741",... |
from setuptools import setup, find_packages
install_requires = [
'pyyaml',
'python-keystoneclient',
'kazoo',
]
setup(
name='contrail-db-loader',
version='0.1b1',
description="Script to load data in Contrail database for scaling tests",
long_description=open('README.md').read(),
author... | {
"content_hash": "ac5f4c3cd8cbe3aa92875d27a02a2fae",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 77,
"avg_line_length": 28.058823529411764,
"alnum_prop": 0.6257861635220126,
"repo_name": "eonpatapon/contrail-controller",
"id": "8bfafd436db67ec30d8d017c9a9855de12cca3c1",
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('firecares_core', '0003_contactrequest_created_at'),
]
operations = [
migrations.AlterField(
model_name='address',
name='addr... | {
"content_hash": "15dfcf9b3a5b3ffa829f64529bff9020",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 106,
"avg_line_length": 25.333333333333332,
"alnum_prop": 0.625,
"repo_name": "HunterConnelly/firecares",
"id": "c93b959fd5092307d344192d4aeddeb58635f48b",
"size": "480",
... |
from google.analytics import admin_v1beta
def sample_delete_account():
# Create a client
client = admin_v1beta.AnalyticsAdminServiceClient()
# Initialize request argument(s)
request = admin_v1beta.DeleteAccountRequest(
name="name_value",
)
# Make the request
client.delete_account... | {
"content_hash": "9212fc1a88a119ab8e8b76fd2181a8c9",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 80,
"avg_line_length": 24.764705882352942,
"alnum_prop": 0.7339667458432304,
"repo_name": "googleapis/python-analytics-admin",
"id": "622afcf59249fcb1fd5322dc58aa5058184a3f72... |
import fnmatch
import os
from urllib.parse import urlsplit, urlparse
def save_python_script(script_folder, script_url):
import requests
if not os.path.exists(script_folder):
os.makedirs(script_folder)
script_name = get_filename(script_url)
script_data = requests.get(script_url).text
scr... | {
"content_hash": "93c8348587346ddcb04f6180f45c1fc5",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 100,
"avg_line_length": 26.008695652173913,
"alnum_prop": 0.5894349715814109,
"repo_name": "TechnicalBro/CraftBuildTools",
"id": "a98af0bcc778f6b1e5ef106abd527b95770146af",
... |
import socket
import sys
import time
from pathlib import Path
import pytest
from xprocess import ProcessStarter
server_path = Path(__file__).parent.joinpath("server.py").absolute()
def cleanup_server_instance(tcp_port):
sock = socket.socket()
sock.connect(("localhost", tcp_port))
try:
for _ in ... | {
"content_hash": "6c001403126e3a7ac780b8e88000d44e",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 73,
"avg_line_length": 25.675,
"alnum_prop": 0.6368062317429406,
"repo_name": "pytest-dev/pytest-xprocess",
"id": "9eb2a343649883f7007c98b3160aadf68974078b",
"size": "1027"... |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import io
import os
import re
import shutil
import sys
import time
from unittest import SkipTest, skipUnless
import warnings
from django.conf import settings
from django.core import management
from django.core.management import execute_from_command_lin... | {
"content_hash": "6e9c6305563c360bdbc5da239e6402b5",
"timestamp": "",
"source": "github",
"line_count": 681,
"max_line_length": 194,
"avg_line_length": 46.198237885462554,
"alnum_prop": 0.6354216331330854,
"repo_name": "andersonresende/django",
"id": "c0c03ee50698be2d1a525d53b5ccd408bac0bd56",
"siz... |
from __future__ import absolute_import
from django.db import IntegrityError
from django.db.models.signals import post_save
from django.utils import timezone
from sentry.models import User, UserEmail
from sentry.signals import email_verified
def create_user_email(instance, created, **kwargs):
if created:
... | {
"content_hash": "0281dbd2abd2f625fc64c3dcceb60c21",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 95,
"avg_line_length": 24.88888888888889,
"alnum_prop": 0.7042410714285714,
"repo_name": "jean/sentry",
"id": "88228f2d8506b144a2b20cd4a4f315c1bbf50a1f",
"size": "896",
"... |
from lino.projects.std.settings import *
SITE = Site(globals(), 'lino_book.projects.combo')
SITE.demo_fixtures = ['demo']
DEBUG = True
| {
"content_hash": "f382b660733408054e61822f023abfdc",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 50,
"avg_line_length": 27.2,
"alnum_prop": 0.7205882352941176,
"repo_name": "lino-framework/book",
"id": "4418e4c780dbca4ce22643e75c75845f23e71365",
"size": "136",
"binary... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# Techniques for outlier detection of speeds. Each of these returns a speed threshold that
# can be used with outlier detection techniques.
# Standard imports
from futur... | {
"content_hash": "0b9241d5b0ccbc3b91fb7f8cb8cfd893",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 91,
"avg_line_length": 35.38636363636363,
"alnum_prop": 0.6634553628773282,
"repo_name": "sunil07t/e-mission-server",
"id": "3085c3c14e0c451556824c127caec8d989981fd0",
"siz... |
from typing import Type
from dependency_injector import providers
class Animal:
...
class Cat(Animal):
def __init__(self, *_, **__): ...
# Test 1: to check the return type
provider1 = providers.Dependency(instance_of=Animal)
provider1.override(providers.Factory(Cat))
var1: Animal = provider1()
# Test 2... | {
"content_hash": "ab1c383cc2598e44b641896105d48fa5",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 52,
"avg_line_length": 23.892857142857142,
"alnum_prop": 0.7144992526158446,
"repo_name": "ets-labs/python-dependency-injector",
"id": "a699e4c2026a990e23ec34ea97c5bf4af507fb... |
from __future__ import print_function
import gdbremote_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestGdbRemote_QPassSignals(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
def expect_si... | {
"content_hash": "052d8479cfa67e0e516bf01c9e296ba2",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 94,
"avg_line_length": 38.309734513274336,
"alnum_prop": 0.5768075768075768,
"repo_name": "youtube/cobalt_sandbox",
"id": "7105bcb078bc6b61112dcefd6e6d0e2187a8421d",
"size... |
"""
Automated processing of associated exposures
"""
def fetch_from_AWS_bucket(root='j022644-044142', id=1161, product='.beams.fits', bucket_name='aws-grivam', verbose=True, dryrun=False, output_path='./', get_fit_args=False, skip_existing=True):
"""
Fetch products from the Grizli AWS bucket.
Boto3 will ... | {
"content_hash": "97c5dd90bebb8ee910376d2f944c2f08",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 193,
"avg_line_length": 31.86111111111111,
"alnum_prop": 0.6129032258064516,
"repo_name": "gbrammer/grizli",
"id": "efef84a732db75bd973915c8e412547e4b8c269c",
"size": "1147... |
import json
import math
from dojo.models import Finding
class PhpSecurityAuditV2Parser(object):
def get_scan_types(self):
return ["PHP Security Audit v2"]
def get_label_for_scan_types(self, scan_type):
return scan_type
def get_description_for_scan_types(self, scan_type):
return... | {
"content_hash": "6e0df9829f7a4f2f506edaaf0f58a619",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 91,
"avg_line_length": 32.68,
"alnum_prop": 0.46266829865361075,
"repo_name": "rackerlabs/django-DefectDojo",
"id": "4df82d3de560cdb9fce4071e80618f73001ef424",
"size": "245... |
import os
import platform
import sys
import pytest
from _pytest.doctest import DoctestItem
from sklearn.utils import _IS_32BIT
from sklearn.externals import _pilutil
from sklearn._min_dependencies import PYTEST_MIN_VERSION
from sklearn.utils.fixes import np_version, parse_version
if parse_version(pytest.__version__... | {
"content_hash": "a55a1785be1f0cb2e9c3bb52b6615177",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 87,
"avg_line_length": 36.33,
"alnum_prop": 0.6077621800165153,
"repo_name": "ndingwall/scikit-learn",
"id": "5c48de4ac36a35d75104f82b7e07a6d4f84dcfa9",
"size": "4011",
... |
from telegram.ext import CommandHandler, MessageHandler, Filters
from . import (start, auth, debug,
get_top, homeworks, mojno,
style, group_summary, cites)
METHODS = [
CommandHandler('start', start.on_start),
CommandHandler('raise', debug.on_raise),
MessageHandler(Filters.tex... | {
"content_hash": "4208449e2949afb45de40ea2c63bdccc",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 65,
"avg_line_length": 36.8421052631579,
"alnum_prop": 0.6914285714285714,
"repo_name": "mesenev/top_bot_lyceum",
"id": "8057d55d4f43db5c32386a447cd1b14d8de1470b",
"size": ... |
import pylzma
class SerializerLZMA(object):
def dumps(self,obj):
return pylzma.compress(obj)
def loads(self,s):
return pylzma.decompress(s) | {
"content_hash": "928f01eddfb63ee80a0570eb5820f67f",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 35,
"avg_line_length": 23.428571428571427,
"alnum_prop": 0.676829268292683,
"repo_name": "Jumpscale/jumpscale6_core",
"id": "a0861aaddcca8feb7ea10989329a5f9c617fb636",
"size... |
import random
game_num = raw_input('How many game you want play? ')
sign = 1
win = 0
lose = 0
l = ["jiandao", "shitou", "bu"]
while sign:
if (int(game_num) % 2 != 1):
game_num = raw_input('Please input a singluar number : ')
for i in range(int(game_num)):
computer_num = random.randint(0, 2)
player_num = int(r... | {
"content_hash": "8595d15b288ad743c0f98de9d205e594",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 133,
"avg_line_length": 30.783783783783782,
"alnum_prop": 0.6224758560140474,
"repo_name": "51reboot/actual_13_homework",
"id": "d4aaf81daf546dc3c40c189c9368aacd7f8b1536",
... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Tagline'
db.create_table(u'pleiapp_tagline', (
(u'id', self.gf('django.db.models.fields.AutoField')(prim... | {
"content_hash": "b19e3f22d749c94e4f4cb40d546df85c",
"timestamp": "",
"source": "github",
"line_count": 240,
"max_line_length": 191,
"avg_line_length": 82.16666666666667,
"alnum_prop": 0.5629817444219067,
"repo_name": "orlenko/plei",
"id": "6026287de30ae6a121386a5feda4accd7ea2d382",
"size": "19744"... |
import os
from urllib.parse import quote_plus
import pytest
from parameterized import parameterized
from airflow import DAG
from airflow.api_connexion.exceptions import EXCEPTIONS_LINK_MAP
from airflow.models.baseoperator import BaseOperatorLink
from airflow.models.dagbag import DagBag
from airflow.models.dagrun impo... | {
"content_hash": "6b5a072c3a1dd851c227957977cd3c5b",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 106,
"avg_line_length": 36.45652173913044,
"alnum_prop": 0.5901013714967204,
"repo_name": "dhuang/incubator-airflow",
"id": "bec2ed8ebc409715288af32feae14fb34e3d2865",
"si... |
import sys
from pathlib import Path # if you haven't already done so
root = str(Path(__file__).resolve().parents[1])
sys.path.append(root)
from classificator.predictor import Predictor as ClassificatorPredictor
import numpy as np
classificator = ClassificatorPredictor('second_model')
def getNameByPred(pred):
lab... | {
"content_hash": "64b3e177e40f74a1ff296b404dd5fd52",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 71,
"avg_line_length": 26.566666666666666,
"alnum_prop": 0.6411543287327478,
"repo_name": "Goodluckhf/chatbot",
"id": "67d94a9f930bd166eb7e67ddeedcfc8cb98bc077",
"size": "8... |
''''
Run the first exploratory data analysis in order to underdand better the data available and plan the next steps.
'''
# Load libraries
import os
import time
import pandas
import numpy
import matplotlib.pyplot as plt
from pandas.tools.plotting import scatter_matrix
from pandas import DataFrame
from sklearn.preproce... | {
"content_hash": "d2fdb798269e6d1b709c29abe146139e",
"timestamp": "",
"source": "github",
"line_count": 462,
"max_line_length": 168,
"avg_line_length": 34.34848484848485,
"alnum_prop": 0.6447161131766337,
"repo_name": "FabricioMatos/ifes-dropout-machine-learning",
"id": "21afc8d88e59cc80df885c008e967... |
import pyramid_handlers
from nflpool.controllers.base_controller import BaseController
from nflpool.services.playerpicks_service import PlayerPicksService
from nflpool.viewmodels.playerpicks_viewmodel import PlayerPicksViewModel
from nflpool.data.dbsession import DbSessionFactory
from nflpool.data.player_picks import P... | {
"content_hash": "12228790061f5fd684c399719aa3c12f",
"timestamp": "",
"source": "github",
"line_count": 512,
"max_line_length": 96,
"avg_line_length": 37.509765625,
"alnum_prop": 0.5200208279093986,
"repo_name": "prcutler/nflpool",
"id": "15965f4e06b1e1e57a6ca0d41f0acf634adf73aa",
"size": "19205",
... |
"""Data and Channel Location Equivalence Tests"""
from __future__ import print_function
# Author: Teon Brooks <teon.brooks@gmail.com>
#
# License: BSD (3-clause)
import os.path as op
import inspect
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
from nose.tools import assert... | {
"content_hash": "52362d2cc9c6b7e28a9f1a3a2ded8d2d",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 79,
"avg_line_length": 39.47260273972603,
"alnum_prop": 0.6113135519694604,
"repo_name": "ARudiuk/mne-python",
"id": "2e171a59e8254dde2ace5311311e7503aee80e26",
"size": "5... |
"""Base shape-related objects such as BaseShape."""
from __future__ import absolute_import, division, print_function, unicode_literals
from pptx.action import ActionSetting
from pptx.dml.effect import ShadowFormat
from pptx.shared import ElementProxy
from pptx.util import lazyproperty
class BaseShape(object):
"... | {
"content_hash": "f875d28d0dafba1f699d11e10808faba",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 82,
"avg_line_length": 30.22,
"alnum_prop": 0.6173395102581072,
"repo_name": "scanny/python-pptx",
"id": "c9472434dba57b2917a76e855baef48fd9e7155a",
"size": "7574",
"bin... |
from django.db import models
from activatable_model.models import BaseActivatableModel
class ActivatableModel(BaseActivatableModel):
is_active = models.BooleanField(default=False)
char_field = models.CharField(max_length=64)
class Rel(models.Model):
is_active = models.BooleanField(default=False)
ch... | {
"content_hash": "a6220da70ed5c1ff12d40a3ce2d25ed4",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 64,
"avg_line_length": 31.333333333333332,
"alnum_prop": 0.776595744680851,
"repo_name": "ambitioninc/django-activatable-model",
"id": "2918dc53abb9b6a82e28909b92f70444d2a013... |
import glob
import dicom
from django.db import models
from django.utils._os import safe_join
from rest_framework import serializers
class ImageSeries(models.Model):
"""
Model representing a certain image series
"""
patient_id = models.CharField(max_length=64)
series_instance_uid = models.CharFie... | {
"content_hash": "4445d214cea1137706852b01957c8b52",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 119,
"avg_line_length": 33.01538461538462,
"alnum_prop": 0.6784715750232991,
"repo_name": "antonow/concept-to-clinic",
"id": "395cbe2f0849f5763491c418860ef1f46b8dd54c",
"si... |
#!/usr/bin/env python
"""
"""
from cortical.models import retina
class RetinasApi(object):
def __init__(self, apiClient):
self.apiClient = apiClient
def getRetinas(self, retina_name=None):
"""Information about retinas
Args:
retina_name, str: The retina name (option... | {
"content_hash": "989d4f09dd615212ed1aa449934ce5df",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 101,
"avg_line_length": 23.41176470588235,
"alnum_prop": 0.6042713567839196,
"repo_name": "cortical-io/python-client-sdk",
"id": "d60b132b68801fc118527ff048f69637d415ff70",
... |
"""Implements experimental logic."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from dl_bounds.src.data import LocalDatasetProvider
from dl_bounds.src.experiments.exp_base import Experiment
from dl_bounds.src.hessian_top_sv import HessianTopSV
import nu... | {
"content_hash": "8ca669f069b5b9f2c94f574db10493fb",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 75,
"avg_line_length": 33.91919191919192,
"alnum_prop": 0.6360929124478857,
"repo_name": "google/dl_bounds",
"id": "27f2e77a65e8de98b419f50d51acc5a968bbdd46",
"size": "3948... |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import json
from oslo_log import log as logging
from congress.api import api_utils
from congress.api import base
from congress.api import error_codes
from congress.api import webservice
from congress import e... | {
"content_hash": "1df9993246d5c54aa7d2a77c28182d60",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 76,
"avg_line_length": 40.26573426573427,
"alnum_prop": 0.5923931920805835,
"repo_name": "ramineni/my_congress",
"id": "5cd79bebdd3031f42e07e93de255734015bf886b",
"size": ... |
import sys # Wee trick when running in same directory as module
sys.path.append('..')
import pylcs
import matplotlib.pyplot as plt
from random import randint
# Define muliplexer 'fitness' function
def multiplex(bits,addrlen=2):
return bits[int(reduce(lambda x,y: str(y)+str(x),bits[0:addrlen]),base=2)]
# Create cla... | {
"content_hash": "25f8d6b79f75ba849c524b6d9c20527f",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 76,
"avg_line_length": 27.886363636363637,
"alnum_prop": 0.687041564792176,
"repo_name": "timlukins/pylcs",
"id": "62bf6185beeea539bfd17e5e87bc41ae7f26f957",
"size": "1227"... |
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
from django.contrib.auth.models import User
from django.db.models import Q
from django.db import models
from register.models import AgencyList
from register.models import Petitions
import json
... | {
"content_hash": "234c56e78554af51b387debf6000b94c",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 124,
"avg_line_length": 36.35294117647059,
"alnum_prop": 0.7536407766990292,
"repo_name": "Nikolas1814/Code4Bulgaria",
"id": "e15340ef369e783d02fe49be682414612c0c4a6f",
"si... |
import numpy
import pytest
import chainerx
import chainerx.testing
from chainerx_tests import array_utils
@chainerx.testing.numpy_chainerx_array_equal()
@pytest.mark.parametrize_device(['native:0', 'cuda:0'])
def test_relu(xp, device, shape, dtype):
if dtype == 'bool_':
return chainerx.testing.ignore()
... | {
"content_hash": "5077c66f9d1dfb0e6ab7bd978af9cb83",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 64,
"avg_line_length": 29.266666666666666,
"alnum_prop": 0.6902050113895216,
"repo_name": "jnishi/chainer",
"id": "c9dffdf7247ccea138e26014e4c1ad1daacecd6d",
"size": "878",... |
import os
import sys
from distutils.core import setup
def publish():
"""Publish to PyPi"""
os.system("python setup.py sdist upload")
if sys.argv[-1] == "publish":
publish()
sys.exit()
required = ['requests']
if sys.version_info[:2] < (2,6):
required.append('simplejson')
setup(
nam... | {
"content_hash": "0dc414cc5810b5d1a138f85813a3bdf3",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 85,
"avg_line_length": 23.046511627906977,
"alnum_prop": 0.6054490413723511,
"repo_name": "kennethreitz/gistapi.py",
"id": "9a8ca8ac6ed3fcefde4728e17c822fdd66c257de",
"size... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.