text stringlengths 4 1.02M | meta dict |
|---|---|
from tulip import *
import tulipplugins
try:
import json
json_available = True
except ImportError:
json_available = False
class AddAttribute(tlp.Algorithm):
def __init__(self, context):
tlp.Algorithm.__init__(self, context)
self.addStringParameter("attribute name",
"if this parameter is set,"\
... | {
"content_hash": "a2959cd1dba96a9cc41f1e81552fe9e8",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 190,
"avg_line_length": 30.188235294117646,
"alnum_prop": 0.5656014549233567,
"repo_name": "renoust/TulipPythonPluginFarm",
"id": "6ea94d6aed887786d83447d3e531c8e0c5d3748c",... |
"""
Testing src/utilities.py
"""
import unittest
import ast
import src.utilities as util
class UtilitiesTest(unittest.TestCase):
def test_that_toBytes_converts_unicode_to_bytes(self):
testString = u'This is a string'
newString = util.toBytes(testString)
self.assertNotEqual(testStri... | {
"content_hash": "408aea96a9890bc5cefffb8aed3094d4",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 60,
"avg_line_length": 27.485714285714284,
"alnum_prop": 0.6465696465696466,
"repo_name": "Tehnix/PyIRCb",
"id": "c20fef49d1d15c8bc05f315fece0175cca26cec2",
"size": "962",
... |
"""Handler for producing network counter messages from Neutron notification
events.
"""
from oslo_config import cfg
from oslo_log import log
import oslo_messaging
from ceilometer.agent import plugin_base
from ceilometer import sample
OPTS = [
cfg.StrOpt('neutron_control_exchange',
default='neu... | {
"content_hash": "7cd5d318e723bc24a4bd207efa5b4d31",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 79,
"avg_line_length": 33.678714859437754,
"alnum_prop": 0.6551395182446935,
"repo_name": "maestro-hybrid-cloud/ceilometer",
"id": "9d8d61bc429319a175effc7263dc20ddc6bdc351"... |
from unittest import TestCase, mock
import pytest
from hvac.exceptions import InvalidPath, VaultError
from airflow.providers.hashicorp.secrets.vault import VaultBackend
class TestVaultSecrets(TestCase):
@mock.patch("airflow.providers.hashicorp._internal_client.vault_client.hvac")
def test_get_conn_uri(self,... | {
"content_hash": "89367de1aee304284399906ec8ae9d09",
"timestamp": "",
"source": "github",
"line_count": 395,
"max_line_length": 103,
"avg_line_length": 38.12405063291139,
"alnum_prop": 0.5482435752706023,
"repo_name": "bolkedebruin/airflow",
"id": "dcd585e72dfb5456279cf8136d380830f96038c1",
"size":... |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import io
import os
import re
import shutil
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_line
from djan... | {
"content_hash": "1d7960b9a3cb7dfa2addb013a2a584c0",
"timestamp": "",
"source": "github",
"line_count": 709,
"max_line_length": 194,
"avg_line_length": 45.97884344146686,
"alnum_prop": 0.6329028497806681,
"repo_name": "andyzsf/django",
"id": "705eca431ed32c24931ece16e60d1ab87751ee15",
"size": "3261... |
from pylot_blocking import * | {
"content_hash": "e05b9a6e0f5ba7e928dd5ec56c87ab06",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 28,
"avg_line_length": 28,
"alnum_prop": 0.8214285714285714,
"repo_name": "Ezetowers/AppEngine_EventsManagement",
"id": "22352cbc0ad490b597fa438a0ca65f86e436be64",
"size": "... |
"""
File: temperature.py
Library Call Demonstrated: mcculw.ul.t_in()
Purpose: Reads a temperature input channel.
Demonstration: Displays the temperature input.
Other Library Calls: mcculw.ul.release_daq_device()
Special Requirements: Unless the bo... | {
"content_hash": "2ba4fd199cc9a5397bd31c2412571adb",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 78,
"avg_line_length": 35.80821917808219,
"alnum_prop": 0.6162968630451415,
"repo_name": "mccdaq/mcculw",
"id": "4826457a91019f706ad4be7e8527a1bfe4fd7051",
"size": "2614",
... |
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
from horizon import messages
from openstack_dashboard import api
class CreateRoleForm(forms.SelfHandlingForm):
name = forms.CharField(label=_("Role Name"))
def handle(self, request, data):
... | {
"content_hash": "64ee3b311f7b8cd31c7394e774097cb7",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 71,
"avg_line_length": 33.34375,
"alnum_prop": 0.6579194001874414,
"repo_name": "rd37/horizon",
"id": "9827e01d0e03726208c409978f058fec52acbb97",
"size": "1746",
"binary"... |
import unittest
from fabric.api import local
from lib import base
from lib.gobgp import *
from lib.quagga import *
import sys
import os
import time
import nose
from noseplugin import OptionParser, parser_option
from itertools import combinations
def wait_for(f, timeout=120):
interval = 1
count = 0
while Tr... | {
"content_hash": "70694381864adba2605d9fdf34990ebc",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 80,
"avg_line_length": 33.34513274336283,
"alnum_prop": 0.5448513800424628,
"repo_name": "YujiOshima/gobgp",
"id": "775032cf47aea32ddc811b4436af22e3acdf05e7",
"size": "438... |
import unittest
import os.path
import json
import inspect
import requests
import asposewordscloud
from asposewordscloud.ApiClient import ApiClient
from asposewordscloud.WordsApi import WordsApi
from asposewordscloud.ApiClient import ApiException
from asposewordscloud.models import BookmarksResponse
from asposewordsclo... | {
"content_hash": "ef2bb44b70853fba19dd8d84a2d7bdba",
"timestamp": "",
"source": "github",
"line_count": 996,
"max_line_length": 173,
"avg_line_length": 38.704819277108435,
"alnum_prop": 0.6470557717250325,
"repo_name": "aspose-words/Aspose.Words-for-Cloud",
"id": "016023a4a6506129c4d4f8b06da98e683ed7... |
"""Support for RFXtrx sensors."""
import logging
from RFXtrx import ControlEvent, SensorEvent
from homeassistant.components.sensor import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_SIGNAL_STRENGTH,
DEVICE_CLASS_TEMPERATURE,
)
from homeassistant.const import (
CONF_DEVICES,
DEV... | {
"content_hash": "6abadb920f085adcbea80cad5d9a5420",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 85,
"avg_line_length": 28.62439024390244,
"alnum_prop": 0.5976482617586912,
"repo_name": "balloob/home-assistant",
"id": "81e0c60e05532edbb55e8080638c573ef818bd1e",
"size"... |
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponse, HttpResponseRedirect
from models import ProcessInstance, WorkItem
from django.contrib.auth.decorators import login_required
@login_required
def mywork(request, template='goflow/my... | {
"content_hash": "d67f750410450d8bef515e40af5f414a",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 81,
"avg_line_length": 32.01075268817204,
"alnum_prop": 0.6483036614040981,
"repo_name": "zen4ever/django-goflow",
"id": "7c91a14176006d6adf748e128e7cf5f1f0907326",
"size":... |
"""Provide functionality to TTS."""
import asyncio
import ctypes
import functools as ft
import hashlib
import io
import logging
import mimetypes
import os
import re
from aiohttp import web
import voluptuous as vol
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.media_player.c... | {
"content_hash": "2e81ffa0c35a58b57ed525b43ea8a44f",
"timestamp": "",
"source": "github",
"line_count": 553,
"max_line_length": 79,
"avg_line_length": 33.2622061482821,
"alnum_prop": 0.5897031640752419,
"repo_name": "molobrakos/home-assistant",
"id": "8af22fbb46007fcf80c94228f3980dc71cfc95b9",
"siz... |
from django.contrib.auth.models import User
from rest_framework import viewsets
from happening.serializers import UserSerializer
class Api(object):
"""Create an API entry for a model."""
@classmethod
def as_viewset(api):
"""Convert the Api into a django_rest_framework viewset."""
class V... | {
"content_hash": "49d2d4a146c0ea5db773f28daaea8b2f",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 72,
"avg_line_length": 24.56,
"alnum_prop": 0.6416938110749185,
"repo_name": "jscott1989/happening",
"id": "a400da4d846d97ac25b48359d766262f293de341",
"size": "614",
"bin... |
from . import CommonTestCase
from ..controls import StringControl
class TextareaTestCase(CommonTestCase):
def setUp(self):
super(TextareaTestCase, self).setUp()
self.control = self.builder.controls['textarea']
def test_control(self):
self.assertIsInstance(self.control, StringControl... | {
"content_hash": "e276b9016b5469979a317269709444b1",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 83,
"avg_line_length": 37.95238095238095,
"alnum_prop": 0.6944792973651192,
"repo_name": "bobslee/orbeon-xml-api",
"id": "be8ffa6c28e82f5da0320b3e43608719305f3f4a",
"size":... |
""" Reformulation of with statements.
Consult the developer manual for information. TODO: Add ability to sync
source code comments with developer manual sections.
"""
from nuitka import Options
from nuitka.nodes.AssignNodes import (
ExpressionTargetTempVariableRef,
ExpressionTempVariableRef,
StatementAss... | {
"content_hash": "e5726f047512a8c1a76ace46070a1a23",
"timestamp": "",
"source": "github",
"line_count": 332,
"max_line_length": 80,
"avg_line_length": 37.90060240963855,
"alnum_prop": 0.5209409520782008,
"repo_name": "wfxiang08/Nuitka",
"id": "baf6031fe29b5e2a4685184fc8593c4b9d75035e",
"size": "133... |
from app import app, mongo, redis_client
from app import auth_event, task_event, msg_event, api_event, sse_event
from time import sleep
from utils import randompass
import models
import click
import utils
import re
import pprint
import pytest
import os
import handlers
import api
# Get Blueprint Apps
from view import vi... | {
"content_hash": "063743b65a0b4c7f60953c57ed3265ab",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 143,
"avg_line_length": 25.702247191011235,
"alnum_prop": 0.6281967213114754,
"repo_name": "rtx3/Microburst",
"id": "353dd514ca11d76fb7bcd92831d5e69e5a63b93a",
"size": "46... |
import pyRserve
import sys
host = sys.argv[1:]
conn = pyRserve.connect(host=host, port=80)
x = conn.eval('x<-rnorm(1)')
conn.close()
print x
| {
"content_hash": "a6ece63c0ce8cbb461e61b4dcfbea3e1",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 43,
"avg_line_length": 15.88888888888889,
"alnum_prop": 0.6923076923076923,
"repo_name": "davesteps/heroku-buildpack-r",
"id": "a599cfee70be02affb8ef34da88f9b1d5ba506c1",
"s... |
"""
This file is part of the TheLMA (THe Laboratory Management Application) project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Tube transfer related resources
"""
from everest.resources.base import Member
from everest.resources.descriptors import collection_attribute
from everest.res... | {
"content_hash": "6f0f7a63d082682fdaaa9696b12ef04e",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 80,
"avg_line_length": 33.91304347826087,
"alnum_prop": 0.7423076923076923,
"repo_name": "helixyte/TheLMA",
"id": "363e2144e32dd3a045ba8df8da7ca34589c0611e",
"size": "1560"... |
"""Openstack logging handler.
This module adds to logging functionality by adding the option to specify
a context object when calling the various log methods. If the context object
is not specified, default formatting is used. Additionally, an instance uuid
may be passed as part of the log message, which is intended ... | {
"content_hash": "bf1a8e7aac0a4ad824e198b1b2154b97",
"timestamp": "",
"source": "github",
"line_count": 547,
"max_line_length": 78,
"avg_line_length": 35.10054844606947,
"alnum_prop": 0.5891666666666666,
"repo_name": "hub-cap/lady-rainicorn",
"id": "2da99328abec84bb8a9c88e444306a5e5c9cc742",
"size"... |
from __future__ import print_function
import lintutils
from subprocess import PIPE, STDOUT
import argparse
import multiprocessing as mp
import sys
import platform
from functools import partial
# NOTE(wesm):
#
# * readability/casting is disabled as it aggressively warns about functions
# with names like "int32", so ... | {
"content_hash": "87e23bab5c982e2ae13088f5c54519fc",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 76,
"avg_line_length": 33.51754385964912,
"alnum_prop": 0.6270609788013609,
"repo_name": "cpcloud/arrow",
"id": "6c841fe54b76efa62f35070d28546cc45da99a8c",
"size": "4629",... |
from collections import OrderedDict
from holoviews.core import Dimension
from holoviews.core.ndmapping import MultiDimensionalMapping, NdMapping
from holoviews.element.comparison import ComparisonTestCase
from holoviews import HoloMap, Dataset
import numpy as np
class DimensionTest(ComparisonTestCase):
def test_... | {
"content_hash": "99d501e56edd7c8268186dedb666d628",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 100,
"avg_line_length": 44.44621513944223,
"alnum_prop": 0.590086052348512,
"repo_name": "basnijholt/holoviews",
"id": "182fa3a74a5ba1f8745307301deef11fb9898f20",
"size": ... |
from django.db import models
class Document(models.Model):
slug = models.SlugField()
file = models.FileField(upload_to='object')
another_file = models.FileField(upload_to='object-other')
basename = models.CharField(max_length=100)
| {
"content_hash": "8d0668d3ed0bde577d96bca1af9726c6",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 61,
"avg_line_length": 31.125,
"alnum_prop": 0.7228915662650602,
"repo_name": "thedrow/django-downloadview",
"id": "bd55215c86db48688d1f7e095716eb14a7673950",
"size": "249",... |
'''
Copyright (C) 2016 Turi
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
'''
def connect_odbc(conn_str):
"""
Create a stateful connection with a database.
An ODBC driver manager program (unixODBC) must be installe... | {
"content_hash": "143c912ee5c85012e5c7b4c363950bf0",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 121,
"avg_line_length": 33.59649122807018,
"alnum_prop": 0.6903394255874674,
"repo_name": "hoytak/SFrame",
"id": "4c95052558222e13b3b763b021742affe5499111",
"size": "1915",... |
"""
Builders define actions that the Jenkins job should execute. Examples
include shell scripts or maven targets. The ``builders`` attribute in
the :ref:`Job` definition accepts a list of builders to invoke. They
may be components defined below, locally defined macros (using the top
level definition of ``builder:``,... | {
"content_hash": "f023c453e1e21f0493e319760a8c44d0",
"timestamp": "",
"source": "github",
"line_count": 2129,
"max_line_length": 79,
"avg_line_length": 42.42226397369657,
"alnum_prop": 0.6060653033205265,
"repo_name": "partkyle/jenkins-job-builder",
"id": "c6d02e767ec8e6da0f9b7b0526359d1ffe064a09",
... |
from argparse import ArgumentParser, Namespace
from idb.cli import ClientCommand
from idb.common.types import Client, HIDButtonType
class TapCommand(ClientCommand):
@property
def description(self) -> str:
return "Tap On the Screen"
@property
def name(self) -> str:
return "tap"
d... | {
"content_hash": "7303bf9cb55ce0e237be042eea6b5182",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 81,
"avg_line_length": 31.695945945945947,
"alnum_prop": 0.6173523768919207,
"repo_name": "facebook/FBSimulatorControl",
"id": "743db5b4bed4162586ac74dd97574c027af19ed2",
... |
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('main', '0008_auto_20150523_1053'),
]
operations = [
migrations.RenameField(
model_name='rating',
... | {
"content_hash": "9b685690fb90230c36b0ff9ab71b0e77",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 76,
"avg_line_length": 24.16,
"alnum_prop": 0.5745033112582781,
"repo_name": "FMI-B20/Yarr",
"id": "d10820a690147c00f7050201ecbd70680c1e7834",
"size": "628",
"binary": fa... |
"""
Tally atoms in each given region.
Regions are given by X, Y, or Z coordinates dividing the space up. The number
of atoms will be counted and written to the output.
"""
import argparse
def main():
"""Drive the main functionality."""
# Parse the command line arguments.
parser = argparse.ArgumentPars... | {
"content_hash": "cb2a233fa7be6a81d21baf6a32dc976a",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 78,
"avg_line_length": 27.635036496350367,
"alnum_prop": 0.5559957739038563,
"repo_name": "tschijnmo/lammps_scripts",
"id": "b0689163a4ac102bbd509957c832cd346df52dc0",
"si... |
"""Plain text decoder.
"""
import pyglet
class PlainTextDecoder(pyglet.text.DocumentDecoder):
def decode(self, text, location=None):
document = pyglet.text.document.UnformattedDocument()
document.insert_text(0, text)
return document
| {
"content_hash": "8ca67e50dd0373e97988127f7f8e171e",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 61,
"avg_line_length": 22.083333333333332,
"alnum_prop": 0.6981132075471698,
"repo_name": "bitcraft/pyglet",
"id": "50789fbce8a29459d191c6e249ec2bbcc8f6e0c7",
"size": "1981... |
import os
import argparse
import subprocess
# ---------------------------------------------------------------------------
MEMORY = 20000
CPU = 4
LSF_GROUP = "/rfam_view"
# ---------------------------------------------------------------------------
def run_view_processes(rfam_acc, uuid, log_dir):
cmd = ("bsub ... | {
"content_hash": "fbf429ec37eba588d0caae69d90ee4df",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 77,
"avg_line_length": 21.936507936507937,
"alnum_prop": 0.49782923299565845,
"repo_name": "Rfam/rfam-production",
"id": "9a5f0a8f0bd1e973e1314c78ebeb6e07f8e0ab0e",
"size":... |
"""
Copyright (C) 2017 IBM Corporation
Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwar... | {
"content_hash": "db98da3ccf73bc4f0afc12fd9f47d850",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 90,
"avg_line_length": 32.53846153846154,
"alnum_prop": 0.6472813238770686,
"repo_name": "open-power-sdk/migration-advisor",
"id": "e2da0b79adfde45a1ec8f888630a4a92453750e6",... |
"""
Created on Sun Mar 22 14:57:00 2015
@author: bigiei
"""
# Opening my csv file
dataset = open("Dataset.txt", "w")
# Opening text and isolating every word
text = open("Corpus.txt", "r")
for line in text :
for word in line.split() :
word = (word)
# generating and classificating tokens
... | {
"content_hash": "a5b5492a4470c8eb63d566f7986b00a3",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 51,
"avg_line_length": 25.142857142857142,
"alnum_prop": 0.5331439393939394,
"repo_name": "teaholic/NLP-Scrapbook",
"id": "3e2003265fc65286322b708be8eae017c7e5dc9c",
"size"... |
extensions = ['sphinx.ext.todo',
'sphinx.ext.viewcode',
'oslosphinx']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
# The encoding of source files.
#source_encoding = 'utf-8... | {
"content_hash": "72cd403acde2a9f052707a7754f51ba1",
"timestamp": "",
"source": "github",
"line_count": 301,
"max_line_length": 79,
"avg_line_length": 29.98671096345515,
"alnum_prop": 0.6865721249723022,
"repo_name": "denismakogon/cloudvalidation-dashboard",
"id": "f612e9752e678aae9ba8019ace10f19459d... |
"""Tests for perfkitbenchmarker.providers.gcp.gce_virtual_machine"""
import contextlib
import mock
import re
import unittest
from perfkitbenchmarker import benchmark_spec
from perfkitbenchmarker import context
from perfkitbenchmarker import errors
from perfkitbenchmarker import os_types
from perfkitbenchmarker import... | {
"content_hash": "1dbcc106fc5d97640e23c8f2fceeb4ab",
"timestamp": "",
"source": "github",
"line_count": 303,
"max_line_length": 80,
"avg_line_length": 42.00330033003301,
"alnum_prop": 0.676121631177811,
"repo_name": "meteorfox/PerfKitBenchmarker",
"id": "81ca4232be8818c083ea5f41c22587fd922e851b",
"... |
import os
import signal
from django.core.exceptions import MiddlewareNotUsed
class ColumbusMiddleware(object):
def __init__(self):
current_pid = os.getpid()
print "Checking for an already running supervisor"
if os.path.exists('columbus-supervisor.pid'):
with open('columbus-supe... | {
"content_hash": "9d65be2cf911510aa9f221e378bc5cfa",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 106,
"avg_line_length": 40.793103448275865,
"alnum_prop": 0.5824175824175825,
"repo_name": "jkachika/columbus",
"id": "8647fd1f2abfc0aebf01baf0ddcbf34e4f16cc83",
"size": "1... |
import json, cloudconnect, requests, argparse, datetime, sys, os, collections
from collections import OrderedDict
from operator import itemgetter
try:
from hurry.filesize import size
except(ImportError):
print >> sys.stderr, 'Missing hurry.filesize module, you will not be able to use -H, --human. Fix by running:\n... | {
"content_hash": "b4d285a712b9c2d21534a155dc69f596",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 153,
"avg_line_length": 43.86206896551724,
"alnum_prop": 0.6477987421383647,
"repo_name": "0snug0/pyflare",
"id": "a985ae8ac8068a36810cd56fb9298381b5875e66",
"size": "3816"... |
from __future__ import absolute_import, division, print_function, unicode_literals
import operator
from collections import OrderedDict
from django.utils.six import add_metaclass, text_type
from django.utils.translation import ugettext as _
class EnumMetaClass(type):
@classmethod
def __prepare__(self, name, ... | {
"content_hash": "9058f742effc4cb82c00f20c7b4d25e0",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 84,
"avg_line_length": 28.08092485549133,
"alnum_prop": 0.6132153149444216,
"repo_name": "jameshiew/dj-stripe",
"id": "81df5b7d2826b5158e84e688cda6edea47e87930",
"size": "... |
class QueryParameters:
"""Query parameters"""
def __init__(self,db,queryKey=None,queryMethod=None,queryType=None,wkt=None,columns=None,statistics=None,minx=None,maxx=None,miny=None,maxy=None,cx=None,cy=None,rad=None,minz=None,maxz=None,px=None,py=None,nnnum=None,nnrad=None):
(self.queryKey, self.que... | {
"content_hash": "03bd78c7f1605de480e36472cec18916",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 237,
"avg_line_length": 42.758620689655174,
"alnum_prop": 0.5612903225806452,
"repo_name": "NLeSC/pointcloud-benchmark",
"id": "b4b304db193bc3066f7a55a8fcdc13c0df7aa1aa",
"... |
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
def main():
setup(name='indra',
version='0.0.1',
description='Integrated Network and Dynamical Reasoning Assembler',
long_description='INDRA is a framework '
'for assembling rule-based math... | {
"content_hash": "e0a2556f62ece0b5739eeb2241701a0b",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 82,
"avg_line_length": 44.94285714285714,
"alnum_prop": 0.5645263827082009,
"repo_name": "decarlin/indra",
"id": "8bdea443cd69dc1e69037bb97e9caa1f991a2534",
"size": "1573",... |
"""
Example for using the HDF5 data iterator on a MLP with the MNIST data.
See mnist_mlp.py for more information on the model and data used in this example.
Usage:
python examples/mnist_hdf5.py
"""
from neon.callbacks.callbacks import Callbacks
from neon.data import HDF5IteratorOneHot, MNIST
from neon.initiali... | {
"content_hash": "da8d20a9191f548740888f594e37bbcc",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 84,
"avg_line_length": 32.07865168539326,
"alnum_prop": 0.7197898423817863,
"repo_name": "NervanaSystems/neon",
"id": "48d83bfd76d4e0f0100a154e18df662419a26b5e",
"size": "3... |
from __future__ import absolute_import
import hashlib
import jwt
from sentry.models import Integration
from sentry.utils.http import percent_encode
__all__ = [
'AtlassianConnectValidationError',
'get_query_hash',
'get_integration_from_request',
]
class AtlassianConnectValidationError(Exception):
pa... | {
"content_hash": "245a4c39624334524b915f238dc6dd5a",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 127,
"avg_line_length": 38.082352941176474,
"alnum_prop": 0.6842755637936361,
"repo_name": "ifduyue/sentry",
"id": "882c070a41b7db0310fefcd16779100bc11ba310",
"size": "3237... |
'''
'''
#-----------------------------------------------------------------------------
# Boilerplate
#-----------------------------------------------------------------------------
from __future__ import annotations
import logging # isort:skip
log = logging.getLogger(__name__)
#--------------------------------------... | {
"content_hash": "cf64f690a5b630fd0be10550de8083c5",
"timestamp": "",
"source": "github",
"line_count": 476,
"max_line_length": 148,
"avg_line_length": 31.80672268907563,
"alnum_prop": 0.601783355350066,
"repo_name": "bokeh/bokeh",
"id": "9f4b988e00f7895dcfae04abe43e6046d5e7acbf",
"size": "15471",
... |
"""Helper mocks for tests.
Common apiary mocks used by tests.
"""
from apiclient.errors import HttpError
from mock import Mock
import test_utils
from test_utils import APIARY_ACCESS_ERROR_CONTENT
TEST_USERS_MANAGER = test_utils.TEST_USERS_MANAGER
class MockExecutableRequestUser(object):
"""Request object that r... | {
"content_hash": "b2720431016b580bd332f3906130cfab",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 80,
"avg_line_length": 33.0989010989011,
"alnum_prop": 0.6746347941567065,
"repo_name": "google/gfw-toolkit",
"id": "5caa4d5c7ac099847069728b1739c0e38ca64b6c",
"size": "361... |
"""
IDLNamespace for PPAPI
This file defines the behavior of the AST namespace which allows for resolving
a symbol as one or more AST nodes given a release or range of releases.
"""
from __future__ import print_function
import sys
from idl_option import GetOption, Option, ParseOptions
from idl_log import ErrOut, In... | {
"content_hash": "16467714e1dd43d5df6c7c5426012062",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 79,
"avg_line_length": 29.528688524590162,
"alnum_prop": 0.6616238723108953,
"repo_name": "nwjs/chromium.src",
"id": "5eae4315fcd438fdca09414250df391d2ab436a3",
"size": "7... |
from datetime import datetime
class Notification(object):
def __init__(self, text, link, date, keyword):
self.text = text
self.link = link
self.date = date
self.keyword = keyword
self.status_date = datetime.now()
self.status = 'W'
def __str__(self):
ret... | {
"content_hash": "15fabde6343435308bc75e05bf4bf66c",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 50,
"avg_line_length": 23.958333333333332,
"alnum_prop": 0.5721739130434783,
"repo_name": "alex-pole/newsscrapperbot",
"id": "5e36ae31408bbf567de6522f5c2d930b24d6d223",
"si... |
import pytest
from mitmproxy.proxy import config
def test_parse_server_spec():
with pytest.raises(Exception, match="Invalid server specification"):
config.parse_server_spec("")
assert config.parse_server_spec("http://foo.com:88") == (
"http", ("foo.com", 88)
)
assert config.parse_serve... | {
"content_hash": "c10c860f6d40a8da6f4a18b5e3a68ef6",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 72,
"avg_line_length": 36.1,
"alnum_prop": 0.6329639889196675,
"repo_name": "laurmurclar/mitmproxy",
"id": "4272d952795853f64cbbd4b1f48db928ac9b2f8d",
"size": "722",
"bin... |
from __future__ import division, absolute_import, print_function
import sys
from distutils.log import *
from distutils.log import Log as old_Log
from distutils.log import _global_log
if sys.version_info[0] < 3:
from .misc_util import (red_text, default_text, cyan_text, green_text,
is_sequence, is_stri... | {
"content_hash": "090462e5b65512f21e7c1f2cd7f969bd",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 78,
"avg_line_length": 29.29787234042553,
"alnum_prop": 0.584241103848947,
"repo_name": "jorisvandenbossche/numpy",
"id": "ff7de86b1147d0096152f2a54a57c7d9140b91e1",
"size"... |
import site
import example_0850
help(example_0850.MyClass)
try:
c = example_0850.MyClass()
except TypeError as ex:
print '***', ex
| {
"content_hash": "108ba2c6485a4af222f48182f96ba105",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 28,
"avg_line_length": 15.222222222222221,
"alnum_prop": 0.708029197080292,
"repo_name": "dyomas/pyhrol",
"id": "81198de68db93d71cb6cf7bdab6d015b129934f1",
"size": "1775",
... |
import sys
import mock
import pytest
from paasta_tools.monitoring.check_synapse_replication import check_replication
from paasta_tools.monitoring.check_synapse_replication import parse_range
from paasta_tools.monitoring.check_synapse_replication import run_synapse_check
def test_check_replication():
"""Codes an... | {
"content_hash": "e5063955c7d75c98c845a3aa16284717",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 90,
"avg_line_length": 34,
"alnum_prop": 0.6373591989987485,
"repo_name": "somic/paasta",
"id": "e37d05f9e62fa34d036acd1362de7da05c489598",
"size": "3774",
"binary": fals... |
from scrapy import signals
class CloudSpiderSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# scrapy acts as if the spider middleware does not modify the
# passed objects.
@classmethod
def from_crawler(cls, crawler):
# This method is used by Scr... | {
"content_hash": "291dfb17abf6eccb163b6e5965b2d407",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 78,
"avg_line_length": 35.48979591836735,
"alnum_prop": 0.6595744680851063,
"repo_name": "yqh231/cloudmusic_api",
"id": "9199595cafedc80635346429a6973a2efbc251ba",
"size": ... |
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
class MessageCodeAuthentication(object):
def execute(self, extra_spec):
# NOTE(wanghao): There need an implement by developers.
pass
| {
"content_hash": "eb7ca5b66cb1d8e8f2d3217e31f40297",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 63,
"avg_line_length": 22.7,
"alnum_prop": 0.6960352422907489,
"repo_name": "openstack/zaqar",
"id": "6f875253f595973566f41c68d5b8f555ea8bd2ba",
"size": "810",
"binary": ... |
'''
Spatial Two Stages Least Squares with Regimes
'''
__author__ = "Luc Anselin luc.anselin@asu.edu, Pedro V. Amaral pedro.amaral@asu.edu, David C. Folch david.folch@asu.edu"
import numpy as np
import pysal
import regimes as REGI
import user_output as USER
import summary_output as SUMMARY
import multiprocessing as mp... | {
"content_hash": "a403856a9ab8135e5139df8aa7df9a8b",
"timestamp": "",
"source": "github",
"line_count": 589,
"max_line_length": 248,
"avg_line_length": 47.230899830220714,
"alnum_prop": 0.5720550702757109,
"repo_name": "AlanZatarain/pysal",
"id": "64ba0f65b306f8f5fe283130f213baf6b2df26db",
"size": ... |
from __future__ import division,print_function
import math, os, json, sys, re
# import cPickle as pickle # Python 2
import pickle # Python3
from glob import glob
import numpy as np
from matplotlib import pyplot as plt
from operator import itemgetter, attrgetter, methodcaller
from collections import OrderedDict
impo... | {
"content_hash": "5b8afc074712590fb825342ccfefab83",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 111,
"avg_line_length": 34.03020134228188,
"alnum_prop": 0.683463169312691,
"repo_name": "fazzolini/fast_ai",
"id": "cebcb803d55063eb322e5eaacb7a3fff84e6b9c7",
"size": "10... |
from multi_armed_bandit import MultiArmedBandit
import numpy as np
import random
def return_rmse(predictions, targets):
"""Return the Root Mean Square error between two arrays
@param predictions an array of prediction values
@param targets an array of target values
@return the RMSE
"""
return ... | {
"content_hash": "7e2c60757a42a54408594da46bad4f66",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 118,
"avg_line_length": 42.309859154929576,
"alnum_prop": 0.6584553928095872,
"repo_name": "mpatacchiola/dissecting-reinforcement-learning",
"id": "0799f22596fec599c574c82614... |
import os
import re
import socket
import string
import sys
import time
import BaseHTTPServer
# async modules
import asyncore
import asynchat
VERSION_STRING = '0.1'
from urllib import unquote, splitquery
# ===========================================================================
# Prod... | {
"content_hash": "a55c43869eec4d75d6e246d2efc7b838",
"timestamp": "",
"source": "github",
"line_count": 754,
"max_line_length": 106,
"avg_line_length": 32.66976127320955,
"alnum_prop": 0.4666910242357813,
"repo_name": "BrotherPhil/brutus",
"id": "9f1ff1b6946977c3c5e807fdea152e266530522c",
"size": "... |
"""
sentry.tasks
~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import sentry.tasks.check_alerts # NOQA
import sentry.tasks.check_update # NOQA
import sentry.tasks.cleanup # NOQA
import sentry.tasks.deletion # NOQA
import s... | {
"content_hash": "c2d50d77a164c1eb007f822fe7daae07",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 75,
"avg_line_length": 29.705882352941178,
"alnum_prop": 0.7386138613861386,
"repo_name": "beni55/sentry",
"id": "49ce5e4b5847a32c297cd046ef0319ac00036677",
"size": "505",
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import numpy as np
from caffe2.python import brew, core, workspace, cnn, optimizer
from caffe2.proto import caffe2_pb2
from caffe2.python.modeling.initial... | {
"content_hash": "2973da471a9c62c2618b25b2be937882",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 87,
"avg_line_length": 39.09704641350211,
"alnum_prop": 0.5974530541765595,
"repo_name": "davinwang/caffe2",
"id": "2b8734344c4137de6b288efaa57e78a5a8debd9a",
"size": "100... |
import random
def a(): return random.random()
def b(rando=random): return rando.random()
def c(rando=random.random): return rando()
| {
"content_hash": "0be06221235e0f3d0187d3debefdab7c",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 42,
"avg_line_length": 19.285714285714285,
"alnum_prop": 0.725925925925926,
"repo_name": "fiddlerwoaroof/sandbox",
"id": "7b2843f804268638453a3a4137953c72780d994a",
"size": ... |
"""nugoo URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | {
"content_hash": "f1221613f8b610fed8583efb18adfd2d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 80,
"avg_line_length": 37.138888888888886,
"alnum_prop": 0.7015706806282722,
"repo_name": "edcwkim/nugoo",
"id": "ba172afdb203b6a4e85ab7de73c8aa4ef39ed0b2",
"size": "1337",... |
from mxnet import gluon, init
from mxnet.gluon import Trainer
from mxnet.gluon.contrib import estimator
from mxnet.gluon.data.vision import datasets, transforms
from mxnet.gluon.loss import SoftmaxCrossEntropyLoss
from mxnet.gluon.nn import HybridSequential, Dense, Flatten, MaxPool2D, Conv2D
from mxnet.metric import Ac... | {
"content_hash": "af08bb3c528abe097a89e05982fe1998",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 99,
"avg_line_length": 30.765625,
"alnum_prop": 0.7323514474352463,
"repo_name": "mlflow/mlflow",
"id": "31cbd485bfa43a739f253d96405df1160a923252",
"size": "1969",
"binar... |
from django.contrib import admin
from vote.models import Question, Answer, MultiQuestion, UserAnswer
admin.site.register(Question)
admin.site.register(Answer)
admin.site.register(MultiQuestion)
admin.site.register(UserAnswer)
| {
"content_hash": "ffc0fa627af11237a23d630cdd45e99a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 67,
"avg_line_length": 32.42857142857143,
"alnum_prop": 0.8370044052863436,
"repo_name": "mingkim/QuesCheetah",
"id": "d58fff2ea2042921f14e18a26ab3675a2845e814",
"size": "22... |
from pleiapp import models
from django.shortcuts import get_object_or_404, render_to_response
from django.template.context import RequestContext
def category(request, slug):
group = get_object_or_404(models.Category, slug=slug)
context = RequestContext(request, locals())
current_item = group.title
ret... | {
"content_hash": "5bafd939c61ff726b47ade207638610e",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 89,
"avg_line_length": 38.2,
"alnum_prop": 0.7340314136125654,
"repo_name": "orlenko/plei",
"id": "fab209b081adcfaf9e0e90fb739dd042087dffaf",
"size": "955",
"binary": fal... |
"""Test replacements for ERFA functions atciqz and aticq."""
import erfa
import pytest
import astropy.units as u
from astropy.coordinates import SphericalRepresentation
from astropy.coordinates.builtin_frames.utils import atciqz, aticq, get_jd12
from astropy.tests.helper import assert_quantity_allclose as assert_allc... | {
"content_hash": "9ded5fb13dba587806f066657e29e17b",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 77,
"avg_line_length": 34.2,
"alnum_prop": 0.7046783625730995,
"repo_name": "astropy/astropy",
"id": "627ca85ada294b0a742df77bd7e454542a8a9c1d",
"size": "1091",
"binary":... |
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
from .._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungro... | {
"content_hash": "7fbc7a61ac69d98026ce4f0524fdf7d8",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 107,
"avg_line_length": 53.12068965517241,
"alnum_prop": 0.7198961376176566,
"repo_name": "Azure/azure-sdk-for-python",
"id": "e91bcebf18a1f388b571503b6f2902222f900760",
"s... |
from setuptools import setup, find_packages
setup(
name='uwiki',
version='0.0.1',
description='A micro wiki.',
url='http://github.com/mikeboers/uWiki',
packages=find_packages(),
author='Mike Boers',
author_email='uwiki@mikeboers.com',
license='BSD-3',
entry_points={
... | {
"content_hash": "9910b275303ad2003aea4bf01fe7c0ce",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 58,
"avg_line_length": 23.47826086956522,
"alnum_prop": 0.5722222222222222,
"repo_name": "mikeboers/uWiki",
"id": "6293f11d00e23cce3c590ac8173ca701c84b60db",
"size": "540",... |
"""Support the sensor of a BloomSky weather station."""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import TEMP_FAHRENHEIT, TEMP_CELSIUS, CONF_MONITORED_CONDITIONS
from homeassistant.helpers.entity import Entity
import homeassistant.help... | {
"content_hash": "bf7d194c5e16fc704639a87b4335969c",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 88,
"avg_line_length": 28.685185185185187,
"alnum_prop": 0.6400903808908973,
"repo_name": "fbradyirl/home-assistant",
"id": "cca57bcae82d700fae3e3562ee35999ecb2aade7",
"si... |
"""
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": "d6d2bc3b1ec4ae126e7783c514965bda",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 72,
"avg_line_length": 35.354838709677416,
"alnum_prop": 0.791058394160584,
"repo_name": "arenadata/ambari",
"id": "aa207979f1c62379d11f562774f9ddf9a72814ab",
"size": "1096... |
"""Tests for config_util.configdict."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import absltest
from tf_util import configdict
class ConfigDictTest(absltest.TestCase):
def setUp(self):
super(ConfigDictTest, self).setUp()
... | {
"content_hash": "abfe9ca596a54cd3e948536bc4034142",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 78,
"avg_line_length": 30.38121546961326,
"alnum_prop": 0.6430260047281324,
"repo_name": "google-research/exoplanet-ml",
"id": "520a8fa04fed1ba1c3a28fa6a972ef1c6498f57f",
... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('activities', '0010_auto_20160223_0637'),
]
operations = [
migrations.AddField(
model_name='activity',
... | {
"content_hash": "5e2bafa25240b9dedabfc5a21b29c74a",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 130,
"avg_line_length": 25.94736842105263,
"alnum_prop": 0.6430020283975659,
"repo_name": "InfoAgeTech/django-activities",
"id": "95f1083166a25258a52afe65c9f2f1e6be713de5",
... |
from __future__ import absolute_import
from mayavi.sources.parametric_surface import *
| {
"content_hash": "441cecd11911fa5b3f21f01f46babe70",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 47,
"avg_line_length": 43.5,
"alnum_prop": 0.8045977011494253,
"repo_name": "enthought/etsproxy",
"id": "050ec937ce97d57e660a0f6b4e7453d0f4c18dfb",
"size": "102",
"binary"... |
"""
Created on Thu Feb 26 10:02:35 2015
@author: awoiz_000
This class will load a shapefile, create
a spatial weights matrix, and run a
geographically weighted regression.
Data should be visualized as a scatterplot
matrix first.
"""
import os
import pysal
import numpy as np
from conf import settings
class Geogr... | {
"content_hash": "7d992658d1cd069229c94273489a08a5",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 163,
"avg_line_length": 35.8,
"alnum_prop": 0.6020288150543958,
"repo_name": "georgetown-analytics/dc-crimebusters",
"id": "e914ef3b916548ed6e66c210ea36c6dd550a402a",
"siz... |
import gc
import tracemalloc
def memorytop(limit=10):
gc.collect()
snapshot = tracemalloc.take_snapshot()
snapshot = snapshot.filter_traces(
(
tracemalloc.Filter(False, "<frozen importlib._bootstrap>"),
tracemalloc.Filter(False, "<frozen importlib._bootstrap_external>"),
... | {
"content_hash": "3ae6e6acd9c9c373ba35e5fd6788a862",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 80,
"avg_line_length": 30.83783783783784,
"alnum_prop": 0.5758106923751095,
"repo_name": "smmribeiro/intellij-community",
"id": "6dc582d207732385700695e3ec0aa9db1d4037c7",
... |
from django.db import models
from django.db.models import Max
class PageManager(models.Manager):
def publish(self, page):
Page.objects.filter(path__exact=page.path).update(published=False)
page.published=True
page.save()
class Page(models.Model):
"""
Both a template and a page.... | {
"content_hash": "efd49e63a417217a79811628e3edf241",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 124,
"avg_line_length": 35.25,
"alnum_prop": 0.6838905775075987,
"repo_name": "sergeystoma/django-micropages-example",
"id": "c25a690d6bb0e15feefa3d9f3ba323841e895acb",
"si... |
import wex.py2compat ; assert wex.py2compat
import json
import codecs
def example(src):
if src.headers.get_content_subtype() != 'json':
return
data = json.load(codecs.getreader('UTF-8')(src))
for item in data.get('args', {}).items():
yield item
def example_with_hostname_suffix(src):
... | {
"content_hash": "87e0013eb8cf0e426f8bbbf41aacf5da",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 65,
"avg_line_length": 20.818181818181817,
"alnum_prop": 0.6473799126637555,
"repo_name": "eBay/wextracto",
"id": "be9e83e74dffefae511b48294cecddd11b466eb1",
"size": "916",... |
from __future__ import absolute_import;
import unittest;
import os;
from pymfony.component.config import FileLocator;
from pymfony.component.system.exception import InvalidArgumentException
"""
"""
__DIR__ = os.path.dirname(os.path.realpath(__file__));
class FileLocatorTest(unittest.TestCase):
def testIsAbsol... | {
"content_hash": "950c4b5e6611b9b094bea2b24f93dfcd",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 139,
"avg_line_length": 30.728813559322035,
"alnum_prop": 0.5667402095973525,
"repo_name": "pymfony/pymfony",
"id": "82f2032cab744df621d99c4c8604ef59ce372942",
"size": "38... |
"""Tests for SavedModel and Checkpoint metrics Python bindings."""
import os
from tensorflow.core.framework import summary_pb2
from tensorflow.python.eager import test
from tensorflow.python.saved_model.pywrap_saved_model import metrics
class MetricsTest(test.TestCase):
def _get_histogram_proto(self, proto_bytes... | {
"content_hash": "0054d150caf05bfec826df56d465d097",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 76,
"avg_line_length": 37.86813186813187,
"alnum_prop": 0.709808473592571,
"repo_name": "gautam1858/tensorflow",
"id": "a2d0b6c2368e62632d35b7a3cc0aafd7d5cb9aca",
"size": "... |
'''Retained-mode object hierarchy based (loosely) on VRML 97 nodes
This package provides "retained-mode" objects which can be
easily rendered within OpenGLContext Contexts.
The implementations of the objects are fairly straightforward
with the idea that users will browse the source of the objects
to see how they can ... | {
"content_hash": "493df6681924f629d73217b97e08764c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 87,
"avg_line_length": 41.89473684210526,
"alnum_prop": 0.8128140703517588,
"repo_name": "alexus37/AugmentedRealityChess",
"id": "c782f2c9503a2bc4bbb196fea56730b520d53a75",
... |
from core.encryption.EncryptionServiceBase import KeyManagementService
class LocalKMS(KeyManagementService):
def configure(self, **kwargs):
self.local_key = kwargs.get('key', None)
self.iv = self.verify_iv(kwargs.get('iv',None))
def get_key(self, **kwargs):
"""Returns Encryption Key"... | {
"content_hash": "7c2345924b29339191ffe46190f9db22",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 90,
"avg_line_length": 33.52173913043478,
"alnum_prop": 0.6173800259403373,
"repo_name": "chop-dbhi/ehb-service",
"id": "c1aad23e01d9db8cffcb3ebe9681a986942ffddd",
"size": ... |
import omniORB
omniORB.updateModule("CosPersistencePID")
# ** 1. Stub files contributing to this module
import CosPersistencePID_idl
# ** 2. Sub-modules
# ** 3. End
| {
"content_hash": "efd44ae059b50aed5b03f5618cc3e8ad",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 46,
"avg_line_length": 18.666666666666668,
"alnum_prop": 0.7380952380952381,
"repo_name": "amonmoce/corba_examples",
"id": "120fb9d0683454854e085d8474a584cfcfab1fd7",
"size"... |
from django.http import HttpResponseRedirect
from django.urls import reverse_lazy
from django.utils.decorators import method_decorator
from django.views.generic import (
CreateView,
DeleteView,
TemplateView,
UpdateView
)
from .forms import MessageReplyForm, NewMessageForm, NewMessageFormMultiple
from .... | {
"content_hash": "6a96cb4bfc16a365018f1c90d6d2a290",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 85,
"avg_line_length": 31.646153846153847,
"alnum_prop": 0.6385512882839086,
"repo_name": "eldarion/user_messages",
"id": "13d7c295d076a4e1eed47736540ce5c968397b42",
"size... |
from bot_tests import BotTests
class InvalidRequestTests(BotTests):
def test_post_not_json(self):
resp = self.app.post('/', {"foo": "bar"}, expect_errors=True)
self.assertEqual(resp.status_int, 400)
self.assertIn('You must post with a Content-Type of application/json.', resp)
def tes... | {
"content_hash": "39f7550e9accb9a9f6913421b7f2de59",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 85,
"avg_line_length": 31.727272727272727,
"alnum_prop": 0.6404011461318052,
"repo_name": "skoczen/correlationbot",
"id": "b279d533d5750e1534cfbb0cbd074db5d90cb1d5",
"size"... |
from decimal import Decimal
from datetime import datetime
#from django.conf import settings
#settings.DEBUG = True
from testcases import (
TestServerTestCase,
get_client
)
from django.core.management import call_command
from .utils import id_generator
def _getDateTimeField(klass):
call_command('loaddata',... | {
"content_hash": "338a5fc632ca8732bc84659ce27198db",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 78,
"avg_line_length": 25.079268292682926,
"alnum_prop": 0.675419401896426,
"repo_name": "ocadotechnology/tastypie-client",
"id": "cd4b98f7f696ba29cf9bb7e973f07af27b6d99ea",... |
"""Schedule for binary dense operator."""
from tvm import te
from .. import tag
def schedule_binary_dense(outs):
"""Schedule for binary_dense.
Parameters
----------
outs: Array of Tensor
The computation graph description of binary_dense
in the format of an array of tensors.
Retur... | {
"content_hash": "79566ffef4b89fe69dd5195a15d17d9f",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 97,
"avg_line_length": 30.545454545454547,
"alnum_prop": 0.5666666666666667,
"repo_name": "dmlc/tvm",
"id": "be02cb9bce9d37f2d159c7117b760aaeb6dbdd3f",
"size": "2530",
"b... |
import json
import logging
from datetime import datetime, timedelta
from email.utils import parsedate
from django.conf import settings
from django.http import (HttpResponse, HttpResponseBadRequest,
HttpResponseNotFound, HttpResponseServerError)
from django.shortcuts import render
from django.u... | {
"content_hash": "5cc50e7960865240e28cc77439619d1b",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 79,
"avg_line_length": 34.151898734177216,
"alnum_prop": 0.6258339510748703,
"repo_name": "dbbhattacharya/kitsune",
"id": "64b34da90d0f734cc9188babe2aac6b42fe9545d",
"size... |
from . import printer as pr
from . import importAnalysis as ia
import ast, copy
''' known bugs:
imp_mods[scanner\scanner.py] contains elements even though
scanner\scanner.py imports no modules (only from style imports)
AND
import bpl.scanner.token in \compiler.py isn't showing up in
imp_mods[\co... | {
"content_hash": "8aa368906dfe6cd48a94c1a215a7100d",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 80,
"avg_line_length": 36.75874125874126,
"alnum_prop": 0.5389517739941025,
"repo_name": "brmscheiner/ideogram",
"id": "2bfe4892abec48ecacf21e8a2efbb6f972ad910a",
"size": ... |
"""
Haplotype phasing using an assembly graph
=========================================
This module contains the algorithm to phase a haplograph to a set of linear DNA
strings, each representing a chromosome copy.
"""
import sys
import math
import random
import logging
from itertools import combinations_with_replacem... | {
"content_hash": "dbb854dfdba2a7d291467e342e0dc50a",
"timestamp": "",
"source": "github",
"line_count": 685,
"max_line_length": 79,
"avg_line_length": 41.573722627737226,
"alnum_prop": 0.564611278881944,
"repo_name": "AbeelLab/phasm",
"id": "67256c124cfb154f37a804f5f57c3b69b6cd6196",
"size": "28478... |
"""Support for MyQ gateways."""
import logging
from pymyq.const import (
DEVICE_FAMILY as MYQ_DEVICE_FAMILY,
DEVICE_FAMILY_GATEWAY as MYQ_DEVICE_FAMILY_GATEWAY,
DEVICE_STATE as MYQ_DEVICE_STATE,
DEVICE_STATE_ONLINE as MYQ_DEVICE_STATE_ONLINE,
KNOWN_MODELS,
MANUFACTURER,
)
from homeassistant.co... | {
"content_hash": "de3ebf4dc5b5567225dd59ef4b5a2d12",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 82,
"avg_line_length": 29.48,
"alnum_prop": 0.635685210312076,
"repo_name": "titilambert/home-assistant",
"id": "aa6c886286cf67c0b637254d8f92cd7a216c4562",
"size": "2948",... |
import argparse
import logging
import os
from collections import defaultdict
import click
import pandas
def main(args):
results100 = pandas.read_csv(os.sep.join(['..', 'backtest-results-100.csv']))
results200 = pandas.read_csv(os.sep.join(['..', 'backtest-results-200.csv']))
results300 = pandas.read_csv(... | {
"content_hash": "a1d782c6efc52bb9b345592c07c3862e",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 147,
"avg_line_length": 42.61904761904762,
"alnum_prop": 0.6242085661080075,
"repo_name": "chris-ch/omarket",
"id": "f6aa66443c3c1901850f82a7fd171a920441103b",
"size": "268... |
from sasila.system_normal.spider.spider_core import SpiderCore
from sasila.system_normal.processor.base_processor import BaseProcessor
from sasila.system_normal.downloader.http.spider_request import Request
from sasila.system_normal.utils.decorator import checkResponse
from sasila.system_normal.pipeline.console_pipelin... | {
"content_hash": "fcb2b40e57473b4a67caa648c88b18f6",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 139,
"avg_line_length": 37.883720930232556,
"alnum_prop": 0.6393492940454266,
"repo_name": "DarkSand/Sasila",
"id": "a6aa2affa113310308c863a82dea9fa4d41fdbe1",
"size": "331... |
"""Unit tests for crowd_report_tasks.py."""
import datetime
import crowd_report_tasks
import model
import test_utils
import utils
class CleanupTests(test_utils.BaseTest):
"""Tests the Cleanup class."""
def testGet(self):
"""Tests CrowdReport.GetWithoutLocation."""
now = datetime.datetime.utcnow()
de... | {
"content_hash": "0841a78510a62f46bc37c4f32ec09fb6",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 74,
"avg_line_length": 31.596153846153847,
"alnum_prop": 0.6731588557516738,
"repo_name": "googlearchive/googlecrisismap",
"id": "a8b994898fe78a93c7f67214caad2b4da10f01ab",
... |
the_count = [1,2,3,4,5]
fruits = ['apples','oranges','pears','apricots']
change = [1,'pennies',2,'dimes',3,'quarters']
# this firs kind of for-loop goes through a list
for number in the_count:
print "this count is conut %d" % number
#same as above
for fruit in fruits:
print "A fruit of type: %s" % f... | {
"content_hash": "831018a0fa3b98845d7c2df0ee4cac0a",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 59,
"avg_line_length": 27.266666666666666,
"alnum_prop": 0.6515892420537898,
"repo_name": "Jumpers/MysoftAutoTest",
"id": "ec96cabd837184cf4fa92c26388ef3e88a761a98",
"size"... |
"""
cpu.py: test iperf bandwidth for varying cpu limits
"""
from mininet.net import Mininet
from mininet.node import CPULimitedHost
from mininet.topolib import TreeTopo
from mininet.util import custom
from mininet.log import setLogLevel, output
from time import sleep
def waitListening(client, server, port):
"Wai... | {
"content_hash": "04d951d1fd4303c69a19b0ba4b4e9982",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 68,
"avg_line_length": 29.82278481012658,
"alnum_prop": 0.5382003395585738,
"repo_name": "5GExchange/escape",
"id": "6dfc936901f681199e1688894ca6553a23a8ba0e",
"size": "237... |
import h2.exceptions
import time
import enum
from mitmproxy import connections # noqa
from mitmproxy import exceptions
from mitmproxy import http
from mitmproxy import flow
from mitmproxy.proxy.protocol import base
from mitmproxy.proxy.protocol.websocket import WebSocketLayer
from mitmproxy.net import tcp
from mitmpr... | {
"content_hash": "e81683cba166c01ac76c5eb725ed6f69",
"timestamp": "",
"source": "github",
"line_count": 457,
"max_line_length": 112,
"avg_line_length": 37.881838074398246,
"alnum_prop": 0.5743992606284658,
"repo_name": "dwfreed/mitmproxy",
"id": "59de070f6f809bc68e1d713df1b12e6d7e7089a9",
"size": "... |
"""Class Property tests.
"""
from unittest import TestCase
from classproperty import classproperty
class MyClass(object):
"""A Test Class that cdefines a classproperty"""
@classproperty
@classmethod
def foo(self):
"""Return Foo."""
return "Foo"
class Test_classproperty(TestCase):
... | {
"content_hash": "f39439e04fcce16a55c00d761f2d9ed6",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 72,
"avg_line_length": 22.347826086956523,
"alnum_prop": 0.6614785992217899,
"repo_name": "caryt/utensils",
"id": "9c85c917133cd1bf6362808da6e127f5c710374a",
"size": "514",... |
import re
from typing import Any, List, Match, Optional
from markdown import Markdown
from markdown.extensions import Extension
from markdown.preprocessors import Preprocessor
from zerver.lib.markdown.preprocessor_priorities import PREPROCESSOR_PRIORITES
# There is a lot of duplicated code between this file and
# he... | {
"content_hash": "09d5ba3d2bee13d9a3352bcc3435c7c9",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 100,
"avg_line_length": 36.96319018404908,
"alnum_prop": 0.6202489626556017,
"repo_name": "kou/zulip",
"id": "768f96919154408305149fbd7257bf89588634f7",
"size": "6025",
... |
from googleapiclient.discovery import build
import httplib2
from six.moves import input
from oauth2client.client import OAuth2WebServerFlow
CLIENT_ID = "some+client+id"
CLIENT_SECRET = "some+client+secret"
SCOPES = ("https://www.googleapis.com/auth/youtube",)
flow = OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, " ".... | {
"content_hash": "554035c0db7cb9cf1a3789bc19d3d3a6",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 79,
"avg_line_length": 40.206896551724135,
"alnum_prop": 0.741852487135506,
"repo_name": "endlessm/chromium-browser",
"id": "6e70ff17bf9e112073bd9379e930fdd2c59eacec",
"siz... |
import corebuild.path
import os
import os.path
import fnmatch
import zipfile
import shutil
love_path = corebuild.path.get_love_executable()
folder = os.path.dirname(__file__)
if folder == '':
folder = '.'
file_formats = ['*.lua', '*.png', '*.ogg', '*.ttf']
matches = []
for root, dirs, files in os.walk(folder):
for... | {
"content_hash": "a883492fba9f819c01bcd184c1a486a6",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 79,
"avg_line_length": 32.357142857142854,
"alnum_prop": 0.7196467991169978,
"repo_name": "NamefulTeam/PortoGameJam2015",
"id": "d5ba987a84a9956a51d5ffa7365d119c049f6b0f",
... |
"""
Factory implementation for the standard file system implementation.
"""
from datafinder.persistence.adapters.filesystem.configuration import Configuration
from datafinder.persistence.adapters.filesystem.data.adapter import DataFileSystemAdapter
from datafinder.persistence.adapters.filesystem.metadata.... | {
"content_hash": "4d342fb01131cd310f25f3d8779291b5",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 121,
"avg_line_length": 38.43421052631579,
"alnum_prop": 0.6775077028414926,
"repo_name": "DLR-SC/DataFinder",
"id": "b398f54df167d00e3a7b2101a4804523bf331df7",
"size": "46... |
import os
import shutil
import tempfile
import unittest
from telemetry import page as page_module
from telemetry.page import page_set
from telemetry.timeline import trace_data
from telemetry.unittest_util import system_stub
from telemetry.util import file_handle
from telemetry.value import trace
class TestBase(unitt... | {
"content_hash": "02cc2ffbd498b38b7cb73a2807f8653c",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 77,
"avg_line_length": 29.872881355932204,
"alnum_prop": 0.6958865248226951,
"repo_name": "mou4e/zirconium",
"id": "d02b2a40728e87dfa77601a5750b9f9ac3260c19",
"size": "368... |
from argparse import ArgumentParser
from datetime import datetime
from json import JSONEncoder, dumps
from pymysql import connect
from pymysql.cursors import SSDictCursor
# Define a class to encode values to a json representation
class CustomEncoder(JSONEncoder):
def default(self, obj):
if isinstance(obj, se... | {
"content_hash": "ecf8d8c8cb902264c3e6391727770ece",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 106,
"avg_line_length": 29.7972972972973,
"alnum_prop": 0.710204081632653,
"repo_name": "arturom/mysql2json",
"id": "04ec0d198d0e17d33f743e5889284b437a118b73",
"size": "222... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.