text stringlengths 4 1.02M | meta dict |
|---|---|
from protoExt.utils.utilsBase import getReadableError, traceError
from protoExt.actions.doWikiTempl import doWikiTemplate
def doSetContext(modeladmin, request, queryset, parameters):
"""
find and replace sobre la tabla actual
parameters campo, findText, replaceText
"""
# El QSet viene con la ... | {
"content_hash": "d0b30b5befc3ed3131591524e5645a76",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 92,
"avg_line_length": 25.452830188679247,
"alnum_prop": 0.667531504818384,
"repo_name": "DarioGT/docker-carra",
"id": "4b1864c474640c16f8d308e1503906297fa0b750",
"size": ... |
from google.cloud import dialogflow_v2beta1
def sample_create_knowledge_base():
# Create a client
client = dialogflow_v2beta1.KnowledgeBasesClient()
# Initialize request argument(s)
knowledge_base = dialogflow_v2beta1.KnowledgeBase()
knowledge_base.display_name = "display_name_value"
request... | {
"content_hash": "a80e869c933702899658c7a8e4ba4a5d",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 76,
"avg_line_length": 28.52173913043478,
"alnum_prop": 0.7332317073170732,
"repo_name": "googleapis/python-dialogflow",
"id": "5647847a49a559f3d0ddbebc043f5233a010f846",
"... |
from datetime import datetime, timedelta
from time import sleep
from django.conf import settings
from health_check.backends.base import (
BaseHealthCheckBackend, ServiceUnavailable
)
from health_check.plugins import plugin_dir
from health_check_celery.tasks import add
class CeleryHealthCheck(BaseHealthCheckBack... | {
"content_hash": "fa044b5ff112cee3b326b54a8ecd8324",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 91,
"avg_line_length": 31.655172413793103,
"alnum_prop": 0.6623093681917211,
"repo_name": "mspeedy/django-health-check",
"id": "d1390ac823bbb25fdb1ee49f1b04c18be094bb6a",
"... |
from tornado.web import HTTPError
from .oauth2 import OauthBaseHandler, authenticate_oauth
import qiita_db as qdb
def _get_reference(r_id):
"""Returns the reference with the given id if exists
Parameters
----------
r_id : int
The reference id
Returns
-------
qiita_db.reference.R... | {
"content_hash": "60a5af2f3402f3125ff280f2517c88d6",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 78,
"avg_line_length": 27.227272727272727,
"alnum_prop": 0.5987757373400111,
"repo_name": "squirrelo/qiita",
"id": "e66b54952fe8c6bd91dbb45ed77a96823d5864a4",
"size": "2148... |
"""camera
This file contains a camera class that is used for
games with larger-spanned worlds, such as scrolling
or pseudo-3D.
This is designed to be instantiable, in case the
game calls for more than one camera."""
# Import built-in libraries.
pass
# Import supplementary libraries.
import pygame
fr... | {
"content_hash": "c147a509b9df6a20667d30c480733160",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 91,
"avg_line_length": 30.341463414634145,
"alnum_prop": 0.6535369774919614,
"repo_name": "Tricorne-Games/pyGameFrame",
"id": "54394ba308e5c36921440d2b8b128ebb6bf009f8",
"s... |
"""numpy interface for operators."""
import traceback
import warnings
import collections
from array import array
from threading import Lock
import ctypes
from ctypes import CFUNCTYPE, POINTER, Structure, pointer
from ctypes import c_void_p, c_int, c_char, c_char_p, cast, c_bool
from .base import _LIB, check_call, MX... | {
"content_hash": "30daa0a73bafd59756f5dbccb4c05c3c",
"timestamp": "",
"source": "github",
"line_count": 1160,
"max_line_length": 109,
"avg_line_length": 44.85086206896552,
"alnum_prop": 0.500970649854883,
"repo_name": "larroy/mxnet",
"id": "eff732086247d02efd7d9c29c66a0ba2bbfb7129",
"size": "52976"... |
import _plotly_utils.basevalidators
class AmbientValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="ambient", parent_name="cone.lighting", **kwargs):
super(AmbientValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "bc7b1e88b3d65c8134723f998d3b2468",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 85,
"avg_line_length": 36.84615384615385,
"alnum_prop": 0.592901878914405,
"repo_name": "plotly/plotly.py",
"id": "c653d51a80c4a29c29b191f1122dc7bca99d1343",
"size": "479",... |
"""This module contains a set of exceptions that can be thrown from dcm-agent
extension plugins.
"""
import dcm.agent.exceptions as agent_exceptions
class AgentPluginException(agent_exceptions.AgentBaseException):
"""
The base class for all agent plugin exceptions
"""
pass
class AgentPluginConfigExc... | {
"content_hash": "62928609c08e9883a5ed921d77e97d57",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 77,
"avg_line_length": 33.54,
"alnum_prop": 0.6803816338700059,
"repo_name": "JPWKU/unix-agent",
"id": "08a19ae6a427ea08ded5241dc9343763162d60ea",
"size": "2260",
"binary... |
"""
PureMVC Python Demo - wxPython Employee Admin
By Toby de Havilland <toby.de.havilland@puremvc.org>
Copyright(c) 2007-08 Toby de Havilland, Some rights reserved.
Addapted for pyjamas: Kees Bos
"""
class RoleVO(object):
username = None
roles = []
def __init__(self, username=None,roles=None):
... | {
"content_hash": "a9dfc0cb862f01bef49a5e446177e9b1",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 99,
"avg_line_length": 26.568181818181817,
"alnum_prop": 0.583404619332763,
"repo_name": "anandology/pyjamas",
"id": "ccb76e0921d7c535e0946e0d80e504f8e9ad2be6",
"size": "11... |
from __future__ import absolute_import, division, print_function
# flake8: noqa
from stripe.api_resources.abstract.api_resource import APIResource
from stripe.api_resources.abstract.singleton_api_resource import (
SingletonAPIResource,
)
from stripe.api_resources.abstract.createable_api_resource import (
Cre... | {
"content_hash": "ed22d6b4dca0cad2f7b3820800838cc7",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 73,
"avg_line_length": 30,
"alnum_prop": 0.8009259259259259,
"repo_name": "stripe/stripe-python",
"id": "047694ae18b3279adc703cb2d88cd511add098c1",
"size": "1080",
"binar... |
from vtk import *
source = vtkRandomGraphSource()
source.DirectedOff()
source.SetNumberOfVertices(100)
source.SetEdgeProbability(0.1)
source.SetUseEdgeProbability(True)
source.AllowParallelEdgesOn()
source.AllowSelfLoopsOn()
source.SetStartWithTree(True)
# Connect to the centrality filter.
centrality = vtkBoostBrande... | {
"content_hash": "393ad46f19f03a5c72d0e756e5c6f715",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 95,
"avg_line_length": 31.20689655172414,
"alnum_prop": 0.8349907918968692,
"repo_name": "aashish24/VTK-old",
"id": "296d78e0a6ca6782e2d8f5639a80c41847198276",
"size": "271... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
test = TestSCons.TestSCons()
sconstruct = """
from SCons.exitfuncs import *
def x1():
print "running x1"
def x2(n):
print "running x2(%s)" % repr(n)
def x3(n, kwd=None):
print "running x3(%s, kwd=%s)" % (repr(n), repr(kwd))
... | {
"content_hash": "0f7a82fba13317b8ba337c5d896b188e",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 69,
"avg_line_length": 19.76923076923077,
"alnum_prop": 0.6517509727626459,
"repo_name": "azatoth/scons",
"id": "f64969bb88c3a148c996c7d72fbf739523f47921",
"size": "2130",
... |
import bisect
import os
import sys
import struct
import pprint
from hashlib import sha1
from rangelib import *
class SparseImage(object):
"""Wraps a sparse image file (and optional file map) into an image
object suitable for passing to BlockImageDiff."""
def __init__(self, simg_fn, file_map_fn=None):
self.... | {
"content_hash": "0182623f4877156a123bf13b59df9249",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 80,
"avg_line_length": 33.52261306532663,
"alnum_prop": 0.5957127866886524,
"repo_name": "FlymeOS/tools",
"id": "7574747f5dc66d9ddebbfee607c77e26935bc726",
"size": "7272",... |
from fastapi.testclient import TestClient
from docs_src.sub_applications.tutorial001 import app
client = TestClient(app)
openapi_schema_main = {
"openapi": "3.0.2",
"info": {"title": "FastAPI", "version": "0.1.0"},
"paths": {
"/app": {
"get": {
"responses": {
... | {
"content_hash": "8114678c7a44fd43a6b5cab82edc805b",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 72,
"avg_line_length": 28.65671641791045,
"alnum_prop": 0.49635416666666665,
"repo_name": "tiangolo/fastapi",
"id": "00e9aec577900538c74846d4e28ec5c12d62f3c7",
"size": "192... |
__all__ = ('platform', )
from os import environ
from os import path
from sys import platform as _sys_platform
class Platform(object):
# refactored to class to allow module function to be replaced
# with module variable
def __init__(self):
self._platform_ios = None
self._platform_android ... | {
"content_hash": "25a7c325e7d548f3461832e810f5d512",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 78,
"avg_line_length": 30.56338028169014,
"alnum_prop": 0.5815668202764976,
"repo_name": "brousch/saythis2",
"id": "562dc1f84f8d022c1799b2bbd55f17510859e2c1",
"size": "2192... |
import os
import zope.testrunner
from sparc.testing.fixture import test_suite_mixin
class test_suite(test_suite_mixin):
package = 'sparc.cache.sql'
module = 'sql'
if __name__ == '__main__':
zope.testrunner.run([
'--path', os.path.dirname(__file__),
'--te... | {
"content_hash": "5011699205111b65800139ef4f81bcfd",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 28.625,
"alnum_prop": 0.48253275109170307,
"repo_name": "davisd50/sparc.cache",
"id": "851bf1f9cb7c52c407385f8a40df852b4cdc3954",
"size": "458",
"b... |
"""
Verifies basic OAUTH functionality in AMO.
Sample request_token query:
/en-US/firefox/oauth/request_token/?
oauth_consumer_key=GYKEp7m5fJpj9j8Vjz&
oauth_nonce=A7A79B47-B571-4D70-AA6C-592A0555E94B&
oauth_signature_method=HMAC-SHA1&
oauth_timestamp=1282950712&
oauth_versio... | {
"content_hash": "f1811263cd53b55d2ff61060af6bf974",
"timestamp": "",
"source": "github",
"line_count": 841,
"max_line_length": 79,
"avg_line_length": 37.84423305588585,
"alnum_prop": 0.5821158136173689,
"repo_name": "jpetto/olympia",
"id": "cc6199c1dc282451c6179ceecf0f556fd242076b",
"size": "31827... |
import unittest
from conans.test.utils.tools import TestClient
import os
from conans.model.ref import PackageReference, ConanFileReference
from conans.util.files import load
base_conanfile = '''
from conans import ConanFile
class TestSystemReqs(ConanFile):
name = "Test"
version = "0.1"
options = {"myopt"... | {
"content_hash": "d75ac97a24602b146e9cb270c7784457",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 97,
"avg_line_length": 50.233870967741936,
"alnum_prop": 0.6724995986514689,
"repo_name": "birsoyo/conan",
"id": "5abb73ed774538d9afa3cc07d4e62f8520b048c4",
"size": "6229"... |
import horizon
from horizon.dashboards.settings import dashboard
class UserPanel(horizon.Panel):
name = "User Settings"
slug = 'user'
dashboard.Settings.register(UserPanel)
| {
"content_hash": "828432a3fb3da3922d21efb19848930a",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 49,
"avg_line_length": 18.5,
"alnum_prop": 0.7621621621621621,
"repo_name": "ttrifonov/horizon",
"id": "366efa790e83258b8968f83ebf09820a7fd9875c",
"size": "835",
"binary"... |
import logging
from archvyrt.provisioner import Base
LOG = logging.getLogger('archvyrt')
class PlainProvisioner(Base):
"""
Plain Provisioner
"""
def cleanup(self):
"""
plain provisioner does not need to do any cleanup
"""
pass
| {
"content_hash": "5cc36142a71779c338814e803c2734af",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 57,
"avg_line_length": 16.470588235294116,
"alnum_prop": 0.6178571428571429,
"repo_name": "Bigluu/arch-provision",
"id": "ed7282498f21c620b4d8d3d873ec5cd1e58f932d",
"size":... |
import MySQLdb
import os
import sys
import time
import config
class PyLog:
def __init__(self):
logfile, munber, nsec, db_ip, db_user, db_pass, db_name, db_table = config.readConfig()
self._nsec = nsec
self._ip = db_ip
self._user = db_user
self._pass = db_pass
... | {
"content_hash": "704198ac3b100417a0ba69b5b9c16c6d",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 143,
"avg_line_length": 30.62,
"alnum_prop": 0.5303723056825604,
"repo_name": "selboo/PyCommand",
"id": "7e3ac2035f261427d44417cfdd38a4467aca7214",
"size": "1609",
"binar... |
from django.conf.urls.defaults import *
urlpatterns = patterns('website.views',
url(r'$','index',name='index'),
)
| {
"content_hash": "2546ac90b2aab7f3773650498d60ddec",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 39,
"avg_line_length": 20.166666666666668,
"alnum_prop": 0.6694214876033058,
"repo_name": "tylerlane/tylerlane.net",
"id": "df85ecaf834fff69d9cbe37ea4ef06aa18b7db6e",
"size"... |
import numpy
import six
from chainer import cuda
from chainer import function
from chainer.utils import type_check
class NegativeSamplingFunction(function.Function):
ignore_label = -1
def __init__(self, sampler, sample_size, reduce='sum'):
if reduce not in ('sum', 'no'):
raise ValueErro... | {
"content_hash": "8589f47af7025d915384d392754b3e19",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 79,
"avg_line_length": 32.52734375,
"alnum_prop": 0.48408790680917496,
"repo_name": "kashif/chainer",
"id": "205179f6cb0ebb9cf54e759ec8eaff0d95b470cb",
"size": "8327",
"... |
import json
import tempfile
import shutil
from wmt.flask import create_app
from wmt.flask.settings import WmtDebugSettings
from wmt.flask.core import db
from wmt.flask.models.models import Model
from wmt.flask.users.models import User
from wmt.flask.tags.models import Tag
from wmt.flask.sims.models import Sim
#WMT_D... | {
"content_hash": "29c37a95d73169d21b666d367017cc05",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 77,
"avg_line_length": 26.56923076923077,
"alnum_prop": 0.6276780544296467,
"repo_name": "mcflugen/wmt-rest",
"id": "3ad3dbdcc13bf56ccb3c440e8995b935306e681f",
"size": "172... |
from .sim_state import SimState
from .calling_conventions import DEFAULT_CC, SimRegArg, SimStackArg, PointerWrapper
from .callable import Callable
import logging
l = logging.getLogger("angr.factory")
_deprecation_cache = set()
def deprecate(name, replacement):
def wrapper(func):
def inner(*args, **kwargs)... | {
"content_hash": "dfaf19788dc31e1085af81d81be0f71f",
"timestamp": "",
"source": "github",
"line_count": 369,
"max_line_length": 142,
"avg_line_length": 51.420054200542005,
"alnum_prop": 0.622114472435965,
"repo_name": "axt/angr",
"id": "9c317c0ef3b0fc7a35052af9e1e03233f3f9da9b",
"size": "18974",
... |
import logging
from programy.clients.clients import BotClient
from programy.bot import Bot
from programy.brain import Brain
from programy.config.client.client import ClientConfiguration
class TestClient(BotClient):
def __init__(self, debug=False, level=logging.DEBUG):
if debug is True:
loggin... | {
"content_hash": "ee9a154f0ebf2cb2979df2eb339a1dc5",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 72,
"avg_line_length": 37.63265306122449,
"alnum_prop": 0.7131236442516269,
"repo_name": "CHT5/program-y",
"id": "014d47a279a0fc68c1f3645313b5424871e1621c",
"size": "1844",... |
import json
import pytest
import os.path
import importlib
import jsonpickle
from fixture.application import Application
from fixture.db import DbFixture
fixture = None
target = None
def load_config(file):
global target
if target is None:
config_file = os.path.join(os.path.dirname(os.path.abspath(__fi... | {
"content_hash": "a3c77024751c18406a5bc2062bea0c90",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 129,
"avg_line_length": 30.620253164556964,
"alnum_prop": 0.6796196775527077,
"repo_name": "ble669/python_training",
"id": "0ecd808c3be07c90d8b25b40de1443ca79e73dc8",
"size... |
if __name__ == "__main__":
from docs.examples import simple_usage, styles, table_sheet, customization, table_sheet_elements, \
templated_worksheet
| {
"content_hash": "b93f3e8dc43e59782dd03255d3471111",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 103,
"avg_line_length": 53,
"alnum_prop": 0.6792452830188679,
"repo_name": "SverkerSbrg/openpyxl-templates",
"id": "11c2cb958abbcf59a728c633529751a546f94667",
"size": "160",... |
"""
Tools and utilities for generating database/collection names.
"""
import datetime
import calendar
def monthly_name(prefix, date):
"""
Get a monthly name based on date.
:Parameters:
- `prefix`: prefix of the name.
- `date`: :class:`datetime.date` or :class:`datetime.datetime` instance.
... | {
"content_hash": "984847b775af903052a4cf6e0f2343a1",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 80,
"avg_line_length": 24.229885057471265,
"alnum_prop": 0.5901328273244781,
"repo_name": "tadasv/pytimeline",
"id": "70063983004b25034078ba5594c7e8d6b097f0af",
"size": "4... |
'''
Covenant Add-on
Bubbles Add-on
Copyright (C) 2016 Bubbles
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any late... | {
"content_hash": "b11784cfa4b39593786320bcdb9e04a9",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 183,
"avg_line_length": 39.467065868263475,
"alnum_prop": 0.538916704597178,
"repo_name": "TheWardoctor/Wardoctors-repo",
"id": "3442c116c318d8f74703214d506cb971b8578f21",
... |
"""Webhook tests for mobile_app."""
from unittest.mock import patch
import pytest
from homeassistant.components.camera import SUPPORT_STREAM as CAMERA_SUPPORT_STREAM
from homeassistant.components.mobile_app.const import CONF_SECRET
from homeassistant.components.zone import DOMAIN as ZONE_DOMAIN
from homeassistant.con... | {
"content_hash": "272e2706095b7a4213b7f0e14df933a5",
"timestamp": "",
"source": "github",
"line_count": 516,
"max_line_length": 105,
"avg_line_length": 31.67248062015504,
"alnum_prop": 0.6183687205531421,
"repo_name": "lukas-hetzenecker/home-assistant",
"id": "8dc2086c495604bdfa15d630c014d564dccf6eca... |
"""Provides a list of renames between TensorFlow 1.* and 2.0."""
from tensorflow.tools.compatibility import renames_v2
# pylint: disable=line-too-long
# Add additional renames not in renames_v2.py here.
# IMPORTANT: For the renames in here, if you also need to add to
# function_reorders or function_keyword_renames in... | {
"content_hash": "bc31c14ec1c95072fc58aeabd0ab1c78",
"timestamp": "",
"source": "github",
"line_count": 605,
"max_line_length": 80,
"avg_line_length": 39.66776859504132,
"alnum_prop": 0.6585691070461269,
"repo_name": "tensorflow/tensorflow-pywrap_saved_model",
"id": "f6224810c808ef851bbaed44a61583d2f... |
from bluetooth import *
import time
import os
base_dir = '/home/pi/Dripper/'
server_file = base_dir + 'server.json'
client_file = base_dir + 'client.json'
def read_data():
try:
f = open(server_file, 'r')
lines = f.readlines()
f.close()
except IOError:
print("Error reading file"... | {
"content_hash": "7b81e17197265b6b84bca7f45a15080e",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 65,
"avg_line_length": 25.22,
"alnum_prop": 0.5329103885804917,
"repo_name": "femarchi/FarmingAutomation",
"id": "15531839bdfc0019d16e1d3b06a4ef52073908d3",
"size": "2523"... |
from __future__ import unicode_literals
"""
Example sentences to test spaCy and its language models.
>>> from spacy.lang.nl.examples import sentences
>>> docs = nlp.pipe(sentences)
"""
sentences = [
"Apple overweegt om voor 1 miljard een U.K. startup te kopen",
"Autonome auto's verschuiven de verzekeringve... | {
"content_hash": "00e9610cbb24c9f6028552da653fe7ad",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 86,
"avg_line_length": 28.352941176470587,
"alnum_prop": 0.7385892116182573,
"repo_name": "aikramer2/spaCy",
"id": "903ce32d71ad6f0b1327e50f290000a31e939d7e",
"size": "497"... |
from google.cloud import tasks_v2
def sample_create_task():
# Create a client
client = tasks_v2.CloudTasksClient()
# Initialize request argument(s)
request = tasks_v2.CreateTaskRequest(
parent="parent_value",
)
# Make the request
response = client.create_task(request=request)
... | {
"content_hash": "3c78d7f05d6baa55c9b0d570389bc0a0",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 58,
"avg_line_length": 22.31578947368421,
"alnum_prop": 0.6910377358490566,
"repo_name": "googleapis/python-tasks",
"id": "9eb95cf8f4889634ab27d72e4b944a7c87bfb59c",
"size"... |
'''
Cobra Distributed Event subsystem.
'''
import json
import time
import Queue
import socket
import struct
import itertools
import threading
import collections
import envi.threads as e_threads
class CobraEventCore:
def __init__(self):
self._ce_chanids = itertools.count()
self._ce_fireq = e_threa... | {
"content_hash": "3f547d632880832a47ee990968f00e8c",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 100,
"avg_line_length": 33.090225563909776,
"alnum_prop": 0.5819132015451034,
"repo_name": "HackerTool/vivisect",
"id": "1b72e30bd681912793d9486b1b3c39b3b2e0a7c0",
"size":... |
from __future__ import absolute_import
import json
import logging
import datetime as dt
import calendar
import decimal
import numpy as np
try:
import pandas as pd
is_pandas = True
except ImportError:
is_pandas = False
try:
from dateutil.relativedelta import relativedelta
is_dateutil = True
excep... | {
"content_hash": "f774b1c9dea80303289aae6a09e7f316",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 94,
"avg_line_length": 33.74820143884892,
"alnum_prop": 0.604988275421019,
"repo_name": "canavandl/bokeh",
"id": "8f7ab7bf234da01f28826c3402cc3b99d8d1ad0d",
"size": "4691"... |
import urllib.request
import urllib.parse
import urllib.error
import json
def login (api_url, username, password):
'''This function logs into the ArchivesSpace REST API returning an acccess token'''
data = urllib.parse.urlencode({'password': password}).encode('utf-8')
req = urllib.request.Request(
... | {
"content_hash": "8ab01b9f9fbf2585683eb4e83db256ed",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 87,
"avg_line_length": 32.86486486486486,
"alnum_prop": 0.6332236842105263,
"repo_name": "rsdoiel/archivesspace-api-workshop",
"id": "97151a927fcadcfa359c3cd09181e63fb6f3f6bd... |
from dolt import Dolt
class Disqus(Dolt):
_api_url = "http://disqus.com"
def __init__(self, user_api_key, version="1.1", *args, **kwargs):
super(Disqus, self).__init__(*args, **kwargs)
self._url_template = "%(domain)s/api/%(generated_url)s/?user_api_key=" + user_api_key + "&version=" + ver... | {
"content_hash": "8202dcb2df0b11c0bce85624aa7f9273",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 117,
"avg_line_length": 33.18181818181818,
"alnum_prop": 0.5808219178082191,
"repo_name": "tswicegood/Dolt",
"id": "7d5cffbe72aaef63f859adeca2494a8ec62fc7f4",
"size": "365"... |
"""Matrix equation solver routines"""
# Author: Jeffrey Armstrong <jeff@approximatrix.com>
# February 24, 2012
# Modified: Chad Fulton <ChadFulton@gmail.com>
# June 19, 2014
# Modified: Ilhan Polat <ilhanpolat@gmail.com>
# September 13, 2016
from __future__ import division, print_function, absolute_import
import nu... | {
"content_hash": "df9b2188d32d89f42a38ae3038a6be9f",
"timestamp": "",
"source": "github",
"line_count": 715,
"max_line_length": 79,
"avg_line_length": 34.03776223776224,
"alnum_prop": 0.5838024407281095,
"repo_name": "kalvdans/scipy",
"id": "078d4dc7c7cf27be9683c516767ee8c0daf3a624",
"size": "24337... |
directory = ''
text_file = directory + 'billtext_org.json'
labels_file = directory + 'train.json'
output_dir = '/Users/katya/datasets/congress_bills_2/'
import sys
#pcogennen noah's congress_bills_2 into useable format
#to dict:
def skip_ahead_n_quotes(line, char_counter, maximum):
quote_counter = 0
... | {
"content_hash": "6a3060d9e0de957fe0f9ea266cadac59",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 142,
"avg_line_length": 32.024096385542165,
"alnum_prop": 0.5346124905944319,
"repo_name": "Noahs-ARK/ARKcat",
"id": "fef35f0ea28d236d393330e3df5789d7c0f468d2",
"size": "27... |
'''
Creates an igs file for every part in a model.
For each part in the model, a standard igs file is created.
How to run it from command line:
abaqus cae noGui=igsMaker.py -- filepath(.cae) desDir
'''
import os
import part
import sys
def makeIgs(file_path, igs_dir):
'''
Extracts igs files ou... | {
"content_hash": "235a67f75899a40b982fbf6244481377",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 64,
"avg_line_length": 21.296296296296298,
"alnum_prop": 0.611304347826087,
"repo_name": "SaeidEmami/AbaqusUtils",
"id": "072a5e9d2f5383a4532b2c51ca780746f69da159",
"size":... |
import os
from os import walk
from . import defs
from . import error
from projects.projectfile import parser
def get_walk_data(root):
return walk(root)
def get_node_list(project_root):
result = []
for root, dirs, files in get_walk_data(project_root):
for f in files:
if... | {
"content_hash": "c873f6ad846b87517f3eefef3a7d40e6",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 64,
"avg_line_length": 28.194444444444443,
"alnum_prop": 0.5182266009852217,
"repo_name": "tiborsimon/projects",
"id": "a43778479670d4cd9be8e2628ee0b36dcb255c1b",
"size": "... |
"""
atomicaggregate.py
Created by Thomas Mangin on 2012-07-14.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
from exabgp.bgp.message.update.attribute.attribute import Attribute
from exabgp.bgp.message.notification import Notify
# ========================================================== AtomicAggr... | {
"content_hash": "e6012be3320b48bfce9dff6e47ab3dfe",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 80,
"avg_line_length": 21.44,
"alnum_prop": 0.648320895522388,
"repo_name": "dneiter/exabgp",
"id": "83e81f670c0f0f25d6cab604a96e8704aec69fdc",
"size": "1090",
"binary": ... |
import cv2
import numpy as np
from deepgaze.color_detection import BackProjectionColorDetector
from deepgaze.mask_analysis import BinaryMaskAnalyser
from deepgaze.motion_tracking import ParticleFilter
#Set to true if you want to use the webcam instead of the video.
#In this case you have to provide a valid tamplate, i... | {
"content_hash": "e80c1e4bfce9f7790b311325ec2920e6",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 111,
"avg_line_length": 35.97894736842105,
"alnum_prop": 0.6986541837331773,
"repo_name": "mpatacchiola/deepgaze",
"id": "786f46cd2c5fa91889135b5c1aa6fb74d76b2291",
"size":... |
from hamcrest.core.base_matcher import BaseMatcher
from hamcrest.core.helpers.wrap_matcher import is_matchable_type
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
import types
class IsInstanceOf(BaseMatcher):
def __init__(self, expected_type):
... | {
"content_hash": "75eeb218fc5d1cfc937732ab6b57e533",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 89,
"avg_line_length": 31.441860465116278,
"alnum_prop": 0.6545857988165681,
"repo_name": "axbaretto/beam",
"id": "f8eb4a2fd10cdd82de0bd638a91db1c4b2ca7fee",
"size": "1352"... |
import requests
from jinja2 import Template
import json
from simpleflake import simpleflake
from singletons import rds
import config
def get_mail_body(template_name, *args, **kwargs):
body_html_template = Template(open('mail/' + template_name).read().decode('utf-8'))
body_html = body_html_template.render(*arg... | {
"content_hash": "8b13eed172c79a0fa470ebcfcffc95b6",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 87,
"avg_line_length": 31.160714285714285,
"alnum_prop": 0.5518624641833811,
"repo_name": "zhujiaqi/pycrabapi",
"id": "735eb9665117cbde87dba433ff6d7a0c5fb7087d",
"size": "1... |
import os
import sys
# Add root dir to PATH env var
CWD = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, CWD)
sys.path.insert(0, os.path.normpath(os.path.join(CWD, '..')))
import tests
import shmaplib
shmaplib.setuplog()
if __name__ == '__main__':
tests.main()
| {
"content_hash": "082638ed3c147fca7fa8563a9383179b",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 61,
"avg_line_length": 18.933333333333334,
"alnum_prop": 0.6690140845070423,
"repo_name": "waldobronchart/ShortcutMapper",
"id": "9ee71469b6bbb4287c584b6b575e09912cf11151",
... |
import logging
from rest_framework import decorators, permissions, status
from rest_framework.renderers import JSONRenderer
from rest_framework.response import Response
from readthedocs.builds.constants import LATEST
from readthedocs.builds.models import Version
from readthedocs.projects.models import Project, Projec... | {
"content_hash": "b9f6dcfad6602495196aa663ea1c2176",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 92,
"avg_line_length": 34.391891891891895,
"alnum_prop": 0.6512770137524558,
"repo_name": "tddv/readthedocs.org",
"id": "cef4af957a32ddd2e0d3e4c6dd6ccfcba11d360d",
"size":... |
from datetime import date, datetime, timedelta
from dateutil.relativedelta import relativedelta
import logging
from TWLight.helpers import site_id
from django.dispatch import receiver, Signal
from django.db.models.signals import pre_save, post_save
from django_comments.signals import comment_was_posted
from django_com... | {
"content_hash": "8c0faa24a86f7a81f639b90fac752f74",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 151,
"avg_line_length": 38.483739837398375,
"alnum_prop": 0.6477236717017006,
"repo_name": "WikipediaLibrary/TWLight",
"id": "37791ead5eadd9448aa9f1c93233032b03a45726",
"s... |
import socket
from datetime import datetime, timedelta
from time import sleep
# from eventkit_cloud.celery import app
from celery import task, Task
class TestTask(Task):
def run(self, *args, **kwargs):
super(TestTask, self).run(*args, **kwargs)
def on_success(self, retval, task_id, args, kwargs):
... | {
"content_hash": "bbf1455ed639daab904ef1c5ca779374",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 120,
"avg_line_length": 37.25581395348837,
"alnum_prop": 0.649812734082397,
"repo_name": "venicegeo/eventkit-cloud",
"id": "4f5742965f33c01f2820fec6b550eac7867505a4",
"size... |
import sys
import time
import unittest
from winlogbeat import WriteReadTest
if sys.platform.startswith("win"):
import win32evtlog
import win32security
"""
Contains tests for reading from the Windows Event Log API (MS Vista and newer).
"""
@unittest.skipUnless(sys.platform.startswith("win"), "requires Window... | {
"content_hash": "373ce043d9e6b2f2c45d514db37f814a",
"timestamp": "",
"source": "github",
"line_count": 309,
"max_line_length": 102,
"avg_line_length": 34.80258899676375,
"alnum_prop": 0.5050213873907383,
"repo_name": "christiangalsterer/httpbeat",
"id": "98cb871337e6d9d045adf731a8813dad3effe089",
... |
import requests, json
from requests.exceptions import ConnectionError
from requests.auth import HTTPBasicAuth
class AnalyticApiClient(object):
def __init__(self, cfg):
self.config = cfg
self.client = requests.Session()
self.init_client()
self.base = None
self._uves = None
... | {
"content_hash": "e9f68bb32ea420e2a7cf7fcfd86118a7",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 74,
"avg_line_length": 34.54205607476636,
"alnum_prop": 0.5395021645021645,
"repo_name": "codilime/contrail-controller",
"id": "1555634509f2f17e4bcbd5772c2e5f5d696f50bf",
... |
from django.test import TestCase
from django.contrib.auth.models import User
from .models import (
Project
)
class PostTestCase(TestCase):
def test_create(self):
project = Project()
project.name = 'My first post'
project.description = 'This is my first post'
project.save() | {
"content_hash": "e36245bb16932c2a29cc3c93896b29ce",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 53,
"avg_line_length": 24.23076923076923,
"alnum_prop": 0.6730158730158731,
"repo_name": "patrickporto/soldajustica",
"id": "5c31ea7cbbfe664db1f7abf15589f988b9a04867",
"siz... |
import struct
from array import array
from whoosh.compat import long_type, PY3
from whoosh.support.base85 import to_base85, from_base85
_istruct = struct.Struct(">i")
_qstruct = struct.Struct(">q")
_dstruct = struct.Struct(">d")
_ipack, _iunpack = _istruct.pack, _istruct.unpack
_qpack, _qunpack = _qstruct.pack, _qstr... | {
"content_hash": "eeb0efb48f45954b2f3547309d1ef3c0",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 79,
"avg_line_length": 25.298039215686273,
"alnum_prop": 0.5923112695706092,
"repo_name": "mozilla/popcorn_maker",
"id": "aef0e4b06e1a0b19e67230516c266e76532e6627",
"size"... |
import os
import pyproj
from shapely.geometry import Point, LineString, asShape
from shapely.geometry.polygon import Polygon
from .utils import read_json
def generate_circle(lon, lat, radius_meters):
points = list()
for dir in range(0, 360, 15):
p = offset_point(lon, lat, radius_meters, dir)
p... | {
"content_hash": "a4a12ab03d04f9b5a2b4652f2a044313",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 91,
"avg_line_length": 26.89010989010989,
"alnum_prop": 0.6074785451573355,
"repo_name": "hyperknot/pgairspace",
"id": "f7603449ef71dd9236a2e513adb0e6e4034d9cc2",
"size": ... |
import sys
import esky
if getattr(sys,"frozen",False):
app = esky.Esky(sys.executable,"https://example-app.com/downloads/")
try:
app.auto_update()
except Exception, e:
print "ERROR UPDATING APP:", e
print "HELLO AGAIN WORLD"
| {
"content_hash": "716880c0bac0ff1c624b5d331a789397",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 72,
"avg_line_length": 21.333333333333332,
"alnum_prop": 0.65234375,
"repo_name": "Darkman/esky",
"id": "f65c5dada643e38731d71944530473c75d04ff8a",
"size": "257",
"binary... |
from __future__ import absolute_import, division, print_function, with_statement
import sys
import os
sys.path.insert(0, os.path.split(os.path.split(os.path.realpath(sys.argv[0]))[0])[0])
#from shadowsocks.common import logging
import signal
from shadowsocks import shell, daemon, eventloop, tcprelay, udprelay, async... | {
"content_hash": "1efa99a37a1a7dad681265240ead80cb",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 141,
"avg_line_length": 35.473684210526315,
"alnum_prop": 0.5484668644906033,
"repo_name": "JustAFakeName/ss",
"id": "b228481dd041eb29815c3d2bd3afa8bad4aa505e",
"size": "4... |
'''
Created on 17-12-2013
@author: Jakub Jeleński
'''
import basic
class ObjectTextWriter(basic.SimpleWriter):
'''
Writer writing to object text state not loosing it (appending to existing text)
'''
def __init__(self, writable):
'''
Constructor
Args:
wri... | {
"content_hash": "fda18700714debbdc4444197d23ee404",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 95,
"avg_line_length": 25.28125,
"alnum_prop": 0.5871446229913473,
"repo_name": "Wiceradon/Lodz_University_of_Technology-Mathematical_Linguistics",
"id": "d0ff701cf48f8c0c1ea... |
"""The SkyDrive error log event formatter."""
from plaso.formatters import interface
from plaso.formatters import manager
class SkyDriveLogErrorFormatter(interface.ConditionalEventFormatter):
"""Formatter for a SkyDrive error log file event."""
DATA_TYPE = u'skydrive:error:line'
FORMAT_STRING_PIECES = [
... | {
"content_hash": "3246afff01f83a9be9169664fc2bd21a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 70,
"avg_line_length": 24.333333333333332,
"alnum_prop": 0.7106164383561644,
"repo_name": "8u1a/plaso",
"id": "a6d41b6df53fd4498205c2e4f3cb629e23b16801",
"size": "608",
"... |
from __future__ import absolute_import
from django.core.management.base import BaseCommand, CommandError
from ui.export import create_readme_for_collection
from ui.models import Collection
class Command(BaseCommand):
help = 'Serializes a collection so that it can be moved.'
def add_arguments(self, parser):
... | {
"content_hash": "90775d68936b24ad32c13cba3950cd7d",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 107,
"avg_line_length": 47.05,
"alnum_prop": 0.7013815090329437,
"repo_name": "gwu-libraries/sfm",
"id": "316773350c73158c1c7247c3778e19e130f5d7af",
"size": "941",
"binar... |
"""
eor.py
Created by Thomas Mangin on 2010-01-16.
Copyright (c) 2009-2013 Exa Networks. All rights reserved.
"""
from struct import unpack
from exabgp.bgp.message import Message
from exabgp.bgp.message.direction import IN,OUT
from exabgp.bgp.message.update.nlri.eor import NLRIEOR
from exabgp.bgp.message.update.attr... | {
"content_hash": "04b643058f92788a0e0ead81b57077f1",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 80,
"avg_line_length": 26.05128205128205,
"alnum_prop": 0.6594488188976378,
"repo_name": "mshahbaz/exabgp",
"id": "2e97822f4d751d5876bfbdde0749ccd1fc3626fb",
"size": "1034"... |
"""Main namespace module."""
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| {
"content_hash": "2514ba922b6acc7ba9bfb79ffe82003e",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 75,
"avg_line_length": 34.25,
"alnum_prop": 0.6897810218978102,
"repo_name": "fizyk/pyramid_routing",
"id": "9bd43ed31edfb54b2e5b334b6298bf8dd2347a74",
"size": "494",
"bin... |
"""
Tests related specifically to integration with Morango.
"""
import os
import sys
import unittest
import uuid
import requests
from django.test import TestCase
from morango.controller import MorangoProfileController
from morango.models import InstanceIDModel
from morango.models import Store
from morango.utils.regist... | {
"content_hash": "60b278ed2889ba24d8fe53c7dddb3fef",
"timestamp": "",
"source": "github",
"line_count": 441,
"max_line_length": 103,
"avg_line_length": 34.863945578231295,
"alnum_prop": 0.5630569105691057,
"repo_name": "lyw07/kolibri",
"id": "29089dfd8561ff702832417a072fdde6893e63ba",
"size": "1537... |
import urllib
import json
import os
import requests
from flask import Flask
from flask import request
from flask import make_response
# Flask app should start in global layout
app = Flask(__name__)
class Response:
@classmethod
def doinGetToML(self, uri):
#DoinGet for the list of objects
co... | {
"content_hash": "889321138601831232be93db3fc548e5",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 192,
"avg_line_length": 34.234177215189874,
"alnum_prop": 0.5801442041042707,
"repo_name": "diegobanol/VentasPc",
"id": "4a2e34511c708c85451b974921e124aee31cf8bd",
"size":... |
import argparse
import os
import re
from hparams import hparams, hparams_debug_string
from synthesizer import Synthesizer
sentences = [
# From July 8, 2017 New York Times:
'Scientists at the CERN laboratory say they have discovered a new particle.',
'There’s a way to measure the acute emotional intelligence tha... | {
"content_hash": "a166ae78e06e7ccb8440c309081b2139",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 96,
"avg_line_length": 35.056603773584904,
"alnum_prop": 0.7061356297093649,
"repo_name": "keithito/tacotron",
"id": "8f87aba9917435b620ba360dde86dbc8cd1a37ba",
"size": "18... |
import click
def _normpath(path):
"""
Globus Transfer-specific normalization, based on a careful reading of the stdlib
posixpath implementation:
https://github.com/python/cpython/blob/ea0f7aa47c5d2e58dc99314508172f0523e144c6/Lib/posixpath.py#L338
this must be done without using os.path.normpath... | {
"content_hash": "0fc1c4ed29867917752001f6ec42227b",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 107,
"avg_line_length": 33.256,
"alnum_prop": 0.578301659850854,
"repo_name": "globus/globus-cli",
"id": "91e628138849998cba54f0d4c0d22bbdba273430",
"size": "4157",
"bin... |
"""Utility functions for TPU."""
import contextlib
from tensorflow.python.framework import ops
from tensorflow.python.tpu import tpu
def enclosing_tpu_context():
"""Returns the TPUReplicateContext, which exists inside a tpu.rewrite()."""
return enclosing_tpu_context_and_graph()[0]
def enclosing_tpu_context_an... | {
"content_hash": "57127aa5ecc594a9f8187a1860777779",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 102,
"avg_line_length": 36.64102564102564,
"alnum_prop": 0.7256822953114066,
"repo_name": "frreiss/tensorflow-fred",
"id": "099e2b3ac244ffedd9f5a546b9f2a6529fd4f728",
"size... |
"""Provides thread-pool-like functionality for workers accessing App Engine.
The pool adapts to slow or timing out requests by reducing the number of
active workers, or increasing the number when requests latency reduces.
"""
import logging
import Queue
import sys
import threading
import time
import traceback
from... | {
"content_hash": "a6b520952d8ca0c1c7351a7769a0b224",
"timestamp": "",
"source": "github",
"line_count": 443,
"max_line_length": 80,
"avg_line_length": 30.27313769751693,
"alnum_prop": 0.6352248154500038,
"repo_name": "CollabQ/CollabQ",
"id": "84582895174e442d70b67d8b9ba88d3998d64356",
"size": "1401... |
import h5py
import numpy as np
from krotos.paths import PATHS
from krotos.debug import report
SUMMARY_HANDLE = h5py.File(PATHS['msd_summary_h5'], 'r')
# inds must be sorted for the HDF5 reader
def get_summary(inds):
track_id = SUMMARY_HANDLE['analysis']['songs'][inds]['track_id']
metadata = SUMMARY_HANDLE[... | {
"content_hash": "ced50bfe23daec79d84b8d5747179bdd",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 113,
"avg_line_length": 26.68421052631579,
"alnum_prop": 0.6982248520710059,
"repo_name": "KelvinLu/krotos-convnet",
"id": "9cbf94b2ec5daad7f80191bf38c17c5c4753d13f",
"size... |
import vtk
def main():
origin = [0.0, 0.0, 0.0]
p0 = [1.0, 0.0, 0.0]
p1 = [0.0, 1.0, 0.0]
p2 = [0.0, 1.0, 2.0]
p3 = [1.0, 2.0, 3.0]
# Create a vtkPoints object and store the points in it.
points = vtk.vtkPoints()
points.InsertNextPoint(origin)
points.InsertNextPoint(p0)
points.... | {
"content_hash": "e57ef9c96fffa8f3e4a4ad61a1d499f8",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 85,
"avg_line_length": 29.680851063829788,
"alnum_prop": 0.6293906810035842,
"repo_name": "lorensen/VTKExamples",
"id": "45141b46db57b4f8628071e550670a8adef7751d",
"size": ... |
"""
Parallel clang-tidy runner
==========================
Runs clang-tidy over all files in a compilation database. Requires clang-tidy
and clang-apply-replacements in $PATH.
Example invocations.
- Run clang-tidy on all files in the current working directory with a default
set of checks and show warnings in the cpp... | {
"content_hash": "331a607b3780d9714e2e35e803acaac3",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 80,
"avg_line_length": 35,
"alnum_prop": 0.6204878048780488,
"repo_name": "abeimler/cmdocker-tmpl",
"id": "b45d714e3fd89880bb9dee35d58ab4de4646e4e1",
"size": "7578",
"bi... |
import json
import logging
import sys
from unittest import TestCase
from flask_helpers.build_response import build_response
from flask_helpers.check_kwargs import check_kwargs
from flask_helpers.ErrorHandler import ErrorHandler
from flask_helpers.VersionHelpers import VersionHelpers
from werkzeug.datastructures import ... | {
"content_hash": "a842c59325565a61fead352f3923fe1c",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 86,
"avg_line_length": 30.203821656050955,
"alnum_prop": 0.550189793336145,
"repo_name": "dsandersAzure/python_cowbull_server",
"id": "32328dfa12b92851c0e5c4d51f0446219324f2... |
"""
Testing for the gradient boosting loss functions and initial estimators.
"""
from itertools import product
import numpy as np
from numpy.testing import assert_allclose
import pytest
from pytest import approx
from sklearn.utils import check_random_state
from sklearn.metrics import mean_pinball_loss
from sklearn.ens... | {
"content_hash": "ce833c87873818fccb017d27d8d3dfb9",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 87,
"avg_line_length": 37.29080118694362,
"alnum_prop": 0.6362695949709557,
"repo_name": "sergeyf/scikit-learn",
"id": "121dfdb4c8d474d977f3aa6a5c8842fe115f0ad4",
"size": ... |
"""Tests for the debug events writer Python class."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
import numpy as np
from tensorflow.core.protobuf import debug_event_pb2
from tensorflow.python.debug.lib import deb... | {
"content_hash": "b051a80a861cb37d6b2e27aae34a6977",
"timestamp": "",
"source": "github",
"line_count": 455,
"max_line_length": 80,
"avg_line_length": 43.879120879120876,
"alnum_prop": 0.666816929626847,
"repo_name": "renyi533/tensorflow",
"id": "231a22d0e37d83524a492407882bb8de8deb679d",
"size": "... |
from django.test import TestCase
from portal.forms import ProfileForm
class TestProfileForm(TestCase):
"""ProfileForm test suite"""
def test_profile_form_invalid_with_empty(self):
form = ProfileForm()
self.assertFalse(form.is_valid())
def test_profile_form_invalid_with_partial(self):
... | {
"content_hash": "033eea232fddedca98dd9ca0a42f1a13",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 56,
"avg_line_length": 28.906976744186046,
"alnum_prop": 0.5631536604987932,
"repo_name": "huangsam/chowist",
"id": "0baced1dc261c9ad49b0f9c6e7123fc23b9baede",
"size": "124... |
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "rospy;sensor_msgs;tf;urdfdom_py".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "forward_kinematics"
PROJECT_SPACE_DIR = "/home/vagrant/proj03/c... | {
"content_hash": "e6044eea49e64bb4b53b5928d1a1bcce",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 76,
"avg_line_length": 52,
"alnum_prop": 0.6620879120879121,
"repo_name": "xunilrj/sandbox",
"id": "933187eff4cfe62690eab5ec45ddcb465cfa7265",
"size": "421",
"binary": fal... |
"""Wrapping existing transformations."""
# pylint: disable=invalid-name
from typing import Optional
from . import _ffi_api
from . import function_pass as _fpass
def Apply(ftransform):
"""Apply ftransform to each function in the Module.
This function is a thin wrapper around tvm.tir.transform.prim_func_pass
... | {
"content_hash": "972f9c9e97c33f2c2a5d8ce3ee09a903",
"timestamp": "",
"source": "github",
"line_count": 757,
"max_line_length": 92,
"avg_line_length": 23.966974900924704,
"alnum_prop": 0.625806096014992,
"repo_name": "dmlc/tvm",
"id": "de6c052c26b1d948d8c80707a4aca55125e2a967",
"size": "18928",
"... |
from typing import Any, Callable, Dict, Optional
from airflow.exceptions import AirflowException
from airflow.models import BaseOperator
from airflow.providers.jira.hooks.jira import JIRAError, JiraHook
class JiraOperator(BaseOperator):
"""
JiraOperator to interact and perform action on Jira issue tracking s... | {
"content_hash": "2c53255bac12ba8aeb218397459e25bf",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 95,
"avg_line_length": 45.78378378378378,
"alnum_prop": 0.6443329397874853,
"repo_name": "apache/incubator-airflow",
"id": "1773f64627d2d962d7e6017921959191bb5b4e42",
"size... |
def empty():
pass
module_var = None
def calledRepeatedly():
# We measure making that call or not. Lets get the module
# variable look-up out of the game, by making it a local
# variable
called = empty
# construct_begin
called()
# construct_end
for x in xrange(50000):
calledRepeatedly()
... | {
"content_hash": "fc70c3caa07264d9439965960b960a5b",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 61,
"avg_line_length": 17.526315789473685,
"alnum_prop": 0.6636636636636637,
"repo_name": "wfxiang08/Nuitka",
"id": "b4084819fdda2dd08407b834287c2e13a33c2a87",
"size": "122... |
from unittest import TestCase
from cr2tool.cr2_metadata import Cr2Metadata
from tests.test_utils import TestUtils
class TestCr2Metadata(TestCase):
def test_exposure_bias(self):
md = Cr2Metadata(TestUtils.get_relative_file('./data_files/img_7562.cr2'))
self.assertEquals(md.exposure_bias(), 0)
... | {
"content_hash": "bb09f0126ae58a38d3841a08265b20e3",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 82,
"avg_line_length": 36.4375,
"alnum_prop": 0.7032590051457976,
"repo_name": "jamesridgway/cr2tool",
"id": "1945be153076c4713c3b9b25c231c9c7e85924e5",
"size": "583",
"b... |
import re
from webkitpy.common.memoized import memoized
# In this dictionary, each item stores:
# * port_name -- a fully qualified port name
# * rebaseline_override_dir -- (optional) directory to put baselines in instead of where you would normally put them.
# This is useful when we don't have bots that cover p... | {
"content_hash": "c35b4a301a4d64e97578f65d14692160",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 117,
"avg_line_length": 41.03157894736842,
"alnum_prop": 0.6500769625448948,
"repo_name": "zero-rp/miniblink49",
"id": "8026f118f3e6ed5502b2e72b72e3a10f8b18f46c",
"size": "... |
""" S3 Query Construction
@copyright: 2009-2015 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including... | {
"content_hash": "a2e2024900c62161887b1ec242e044e8",
"timestamp": "",
"source": "github",
"line_count": 2503,
"max_line_length": 92,
"avg_line_length": 32.83180183779464,
"alnum_prop": 0.4440239480152839,
"repo_name": "michaelhowden/eden",
"id": "9b8bacfcac7c96c9375c7b9650f27aa75182290a",
"size": "... |
import random
import unittest
from SDWLE.agents.basic_agents import DoNothingAgent, PredictableAgent
from SDWLE.constants import MINION_TYPE
from testsSDW.agents.testing_agents import CardTestingAgent, OneCardPlayingAgent, WeaponTestingAgent, \
PlayAndAttackAgent, SelfSpellTestingAgent
from testsSDW.testing_utils ... | {
"content_hash": "0e458da89c67d6f0646a2b8dcb4d023c",
"timestamp": "",
"source": "github",
"line_count": 927,
"max_line_length": 117,
"avg_line_length": 43.21467098166127,
"alnum_prop": 0.6527708437343984,
"repo_name": "jomyhuang/sdwle",
"id": "228bb818e624e1de200951873e665f0359e2112a",
"size": "400... |
from ..node import Node
class Apply(Node):
"""Apply an arbitrary function to each pd.Series chunk."""
def __init__(self, upstream=None, generator=None, func=None):
self.func = func
super(Apply, self).__init__(upstream, generator)
def process(self):
self.check_requirements()
... | {
"content_hash": "4c31d59fabc27b3d60ea1c28d26b032c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 65,
"avg_line_length": 31.94736842105263,
"alnum_prop": 0.5881383855024712,
"repo_name": "nilmtk/nilmtk",
"id": "7926db7fa54805f058350e4b5d157ada21171ecf",
"size": "607",
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import numpy as np
from nlpfromscratch.vocab import MultiVocab
from nlpfromscratch.csvreader import CSVReader
import os
curr_path = os.path.dirname(os.path.realpath(__file__))
data_dir... | {
"content_hash": "39d240b7e98353726aefd4aed48fbc20",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 84,
"avg_line_length": 34.271186440677965,
"alnum_prop": 0.6681503461918892,
"repo_name": "nrlewis/nlpfromscratch-tf",
"id": "5e35b0b9261afd04d6831e16a8a0946d264a345c",
"si... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import unittest
import mock
from pants.contrib.node.subsystems.package_managers import (PackageInstallationTypeOption,
... | {
"content_hash": "60b7a92831e73bb43d95c4a77f266249",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 93,
"avg_line_length": 35.3756906077348,
"alnum_prop": 0.638138372637826,
"repo_name": "baroquebobcat/pants",
"id": "e928a7a27f781c55b426adb08a4271d2370488f6",
"size": "65... |
"""Tests for factory_boy/SQLAlchemy interactions."""
import factory
from .compat import mock
import warnings
import unittest
from factory.alchemy import SQLAlchemyModelFactory
from .alchemyapp import models
class StandardFactory(SQLAlchemyModelFactory):
class Meta:
model = models.StandardModel
s... | {
"content_hash": "8ee5d900290db508e38ea3174513c723",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 106,
"avg_line_length": 34.27040816326531,
"alnum_prop": 0.6702396903379485,
"repo_name": "rbarrois/factory_boy",
"id": "edfa110425c0dc2a96a01f397495e7674077aa18",
"size":... |
import unittest
from .context import enhance
from .context import basis
import numpy as np
import numpy.testing as npt
# =========================================================================
#
# Class definitions
#
# =========================================================================
class EnhanceTestCase(... | {
"content_hash": "3b9994ab3b056b926b78eccae045ff11",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 111,
"avg_line_length": 36.1958762886598,
"alnum_prop": 0.4659641127883794,
"repo_name": "marchdf/dg1d",
"id": "9970f272af82ebf34a111551f5f0252161c802c2",
"size": "3677",
... |
from flask_user.forms import RegisterForm
from flask_wtf import Form
from wtforms import StringField, SubmitField, validators, IntegerField, DecimalField, RadioField
from wtforms.validators import Required
from flask import current_app
# Define the User registration form
# It augments the Flask-User RegisterForm with ... | {
"content_hash": "807db25f6612ebd11245713d0684e9cd",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 98,
"avg_line_length": 47.41860465116279,
"alnum_prop": 0.7248651299656694,
"repo_name": "TheRushingWookie/MotivateOpen",
"id": "0c22aadce330d4573806812d86b0df9cb2f10cfb",
... |
import os, re, logging, time, base64, hashlib
import markdown2
from transwarp.web import get, post, ctx, view, interceptor, seeother, notfound
from apis import api, Page, APIError, APIValueError, APIPermissionError, APIResourceNotFoundError
from models import User, Blog, Comment
from config import configs
_COOKIE_NAME... | {
"content_hash": "077b42d8582941741da3c7569c59d00d",
"timestamp": "",
"source": "github",
"line_count": 364,
"max_line_length": 171,
"avg_line_length": 27.37912087912088,
"alnum_prop": 0.609773228978527,
"repo_name": "bupt075225/xilingxue",
"id": "c0098ae09c1c9bf67b2316cd553cfccfd59e2fc8",
"size": ... |
from wtforms.fields import BooleanField, SelectField, StringField
from wtforms.validators import DataRequired, ValidationError
from indico.core.db import db
from indico.modules.groups.models.groups import LocalGroup
from indico.util.i18n import _
from indico.web.forms.base import IndicoForm
from indico.web.forms.field... | {
"content_hash": "ba872990efd5edbdb8f7065c9f1caac4",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 93,
"avg_line_length": 37.833333333333336,
"alnum_prop": 0.6969162995594713,
"repo_name": "DirkHoffmann/indico",
"id": "dbb3dc2fc9af5c29ef370dbaad4dc40df05f6c90",
"size": "... |
from __future__ import annotations
import json
from pathlib import Path
import yaml
from jsonschema import validate
CHART_DIR = Path(__file__).parent / ".." / ".." / "chart"
class TestChartQuality:
def test_values_validate_schema(self):
values = yaml.safe_load((CHART_DIR / "values.yaml").read_text())
... | {
"content_hash": "587fed3dc9461336aab0e6b6b990dc8d",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 75,
"avg_line_length": 31.434782608695652,
"alnum_prop": 0.6625172890733056,
"repo_name": "apache/airflow",
"id": "f18561fe6ff1b2e9e5e4ecc4dfd1d8b5b72efecb",
"size": "1508"... |
"""
Tests for sparked.application.*
Maintainer: Arjan Scherpenisse
"""
import tempfile
import os
from twisted.trial import unittest
from twisted.internet import task
from sparked.events import EventDispatcher
from sparked.monitors import MonitorContainer
from sparked.application import getPath, Options, Application,... | {
"content_hash": "b0e4c0287afa0c621c5e938cc092c8a7",
"timestamp": "",
"source": "github",
"line_count": 419,
"max_line_length": 115,
"avg_line_length": 35.236276849642,
"alnum_prop": 0.5764020590625847,
"repo_name": "arjan/sparked",
"id": "11ebb77e70484af4273fcd60468d1d00b1ec1c59",
"size": "14832",... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class GetDistrictsByCoordinates(Choreography):
def __init__(self, temboo_session):
"""
... | {
"content_hash": "3d80e7a05176bf01ecb877eb341f6997",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 176,
"avg_line_length": 44.54929577464789,
"alnum_prop": 0.7192538729054695,
"repo_name": "jordanemedlock/psychtruths",
"id": "da36fb29a5a78b80dd9e26a45b8795f702de118a",
"s... |
import re
import sys
import yaml
from datetime import datetime
region_codes = {
'China (Beijing)': 'cn-north-1',
'US East (Northern Virginia)': 'us-east-1',
'US West (Oregon)': 'us-west-2',
'US West (Northern California)': 'us-west-1',
'EU (Ireland)': 'eu-west-1',
'EU (Frankfurt)': 'eu-central... | {
"content_hash": "df744e003c961153f8ccf80918a94366",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 80,
"avg_line_length": 26.714285714285715,
"alnum_prop": 0.56951871657754,
"repo_name": "ab/ec2-ip",
"id": "adf538d895dc0d14017a054ab961cc4fe75e4b20",
"size": "2347",
"bi... |
"""Kallithea google authentication plugin."""
import os
import logging
from kallithea.lib import auth_modules
from kallithea.lib.utils2 import safe_unicode
from kallithea.lib.compat import hybrid_property
from kallithea.model.db import Setting, User
from pylons.controllers.util import redirect
import pylons
from req... | {
"content_hash": "47e35d410aae5396fbc9370cf592ee47",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 93,
"avg_line_length": 37.18627450980392,
"alnum_prop": 0.5763248088584234,
"repo_name": "andrewshadura/kallithea-auth-google",
"id": "e9bbcb0744fa53302c7828a30b6b74391a1529... |
from datetime import timedelta, datetime
from optparse import make_option
from django.core.management.base import BaseCommand
from request.models import Request
DURATION_OPTIONS = {
'hours': lambda amount: datetime.now() - timedelta(hours=amount),
'days': lambda amount: datetime.now() - timedelta(days=amount),... | {
"content_hash": "1ba8f628968d6355330c0c1439990055",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 89,
"avg_line_length": 35.114754098360656,
"alnum_prop": 0.599906629318394,
"repo_name": "gnublade/django-request",
"id": "46e6f049370a68c5e32ad100f750ca1b9b386934",
"size"... |
from django.conf.urls import patterns
from django.conf.urls import url
from openstack_dashboard.dashboards.admin.info import views
urlpatterns = patterns('openstack_dashboard.dashboards.admin.info.views',
url(r'^$', views.IndexView.as_view(), name='index'))
| {
"content_hash": "c397f4f34fffa848998f03219415b164",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 73,
"avg_line_length": 33.125,
"alnum_prop": 0.7735849056603774,
"repo_name": "zouyapeng/horizon-newtouch",
"id": "552f23aeae2618f1e6522a7265cf95cead4a0cc7",
"size": "1029",... |
from __future__ import unicode_literals
import os.path
import threading
import ConfigParser
import traceback
from lnc.lib.exceptions import ProgramError
from lnc.lib.plugin import get_plugin
from lnc.lib.options import get_option
PACK = "lnc"
def _is_plugin_load_section(name):
return (len(name) > 4 and name.st... | {
"content_hash": "95a9a672ab2ae3749fbe23ea1c9e0172",
"timestamp": "",
"source": "github",
"line_count": 207,
"max_line_length": 77,
"avg_line_length": 34.99516908212561,
"alnum_prop": 0.5334069574820541,
"repo_name": "atrosinenko/lecture-notes-compiler",
"id": "2562b07928b0495ea91903dacd2c30c6af7eca7... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.