text stringlengths 4 1.02M | meta dict |
|---|---|
import fnmatch
import os
import sys
import argparse
import networkx
import yaml
class IO(object):
@classmethod
def debug(cls, msg):
if not cls.args.debug:
return
if not msg.endswith("\n"):
msg += "\n"
sys.stdout.write(msg)
@classmethod
def output(cls, l... | {
"content_hash": "a7444fc688f3eab1c7e3dd3d1c0fa0f7",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 75,
"avg_line_length": 34.06825938566553,
"alnum_prop": 0.48126627930274496,
"repo_name": "zhaochao/fuel-library",
"id": "057c23f77e06b22e2de1e932e262eae27b626d89",
"size"... |
from __future__ import absolute_import
from .functions import UserDefinedJythonFunction
from pyspark.sql.catalog import Catalog
from pyspark.sql.types import DataType, StringType
def registerJythonFunction(self, name, fn, returnType=StringType()):
"""
Register a function to be executed using Jython ... | {
"content_hash": "133c4fb8914d390e7ff3e5a30b805a43",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 92,
"avg_line_length": 40.94444444444444,
"alnum_prop": 0.7367706919945726,
"repo_name": "mariusvniekerk/spark-jython-udf",
"id": "5bbbd638f8ab4459f8ba2d75d99eaf8293d79e24",
... |
def f5(a, b, c):
pass
arg = [1, 2, 3]
kwarg = {'c':3}
f5(*arg, **kwarg) # ok
f5(1,2, **kwarg) # ok
f5<warning descr="Unexpected argument(s)">(1, 2, 3, <warning descr="Unexpected argument">**kwarg</warning>)</warning> # fail
f5<warning descr="Unexpected argument(s)">(1, 2, 3, <warning descr="Unexpected argument">*a... | {
"content_hash": "1034bbee4a773167c986161eeec79a98",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 124,
"avg_line_length": 39,
"alnum_prop": 0.6381766381766382,
"repo_name": "apixandru/intellij-community",
"id": "c285a60cf4231cb4c44d983798c1e33cad4cb316",
"size": "351",
... |
'''
Main runner entry point for Gooey.
'''
import wx
import os
import sys
import json
import argparse
from functools import partial
from gooey.gui.lang import i18n
from gooey.gui.windows.base_window import BaseWindow
from gooey.gui.windows.advanced_config import ConfigPanel
from gooey.python_binding... | {
"content_hash": "d3312d65d33c920e977baf738037d45a",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 92,
"avg_line_length": 24.466666666666665,
"alnum_prop": 0.6625794732061762,
"repo_name": "s4n7h0/Gooey",
"id": "4508d88506e2b292e2885a4039eddf737ea23630",
"size": "2202",
... |
import asyncio
import websockets
import urllib.request
import urllib.parse
import json
import socket
import importlib
import sys
import traceback
import argparse
import threading
import time
API_ROOT = "https://slack.com/api/"
def start_from_config(conf):
try:
slackbot = SlackBotFramework(conf["token"])
... | {
"content_hash": "8067b15307c0b32f2f67dc8eb8f27425",
"timestamp": "",
"source": "github",
"line_count": 330,
"max_line_length": 151,
"avg_line_length": 36.42424242424242,
"alnum_prop": 0.5112312811980033,
"repo_name": "KTOmega/SlackBotFramework",
"id": "431aa68886bf2420a9cc0c6730603cc687cbe28e",
"s... |
from msrest.serialization import Model
class VirtualMachineScaleSetSkuCapacity(Model):
"""Describes scaling information of a sku.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar minimum: The minimum capacity.
:vartype minimum: long
:ivar maximum:... | {
"content_hash": "5b22994efb25007789eb1f03bd4a5ab7",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 96,
"avg_line_length": 35.2,
"alnum_prop": 0.6427556818181818,
"repo_name": "v-iam/azure-sdk-for-python",
"id": "a0d3c2ffaf89f26028b35b91f6db8917cd93849c",
"size": "1882",
... |
import Tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.grid()
self.createWidgets()
def createWidgets(self):
self.quitButton = tk.Button(self, text='Quit',
command=self.quit)
self.quitButton.gri... | {
"content_hash": "b9032a35ab44c4cd2da5792adb6c0603",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 54,
"avg_line_length": 24.875,
"alnum_prop": 0.628140703517588,
"repo_name": "cipcosma/sudoku",
"id": "c3c580246948380ae583fd33d3840a507c746df4",
"size": "398",
"binary":... |
"""Control Flow Operations.
See the @{$python/control_flow_ops} guide.
@@identity
@@identity_n
@@tuple
@@group
@@no_op
@@count_up_to
@@cond
@@case
@@while_loop
@@logical_and
@@logical_not
@@logical_or
@@logical_xor
@@equal
@@not_equal
@@less
@@less_equal
@@greater
@@greater_equal
@@where
@@is_finite
@@is_inf
@@is_nan... | {
"content_hash": "671800d4467033f27b305d36e3862056",
"timestamp": "",
"source": "github",
"line_count": 3644,
"max_line_length": 113,
"avg_line_length": 38.47338090010977,
"alnum_prop": 0.6637588536131301,
"repo_name": "nolanliou/tensorflow",
"id": "3a6fdaafb97e606fac629565015b1b3152496742",
"size"... |
import __builtin__
import datetime
import hashlib
import os
import os.path
import StringIO
import tempfile
import mox
import cinder
from cinder import exception
from cinder import flags
from cinder.openstack.common import timeutils
from cinder import test
from cinder import utils
FLAGS = flags.FLAGS
class Execute... | {
"content_hash": "4f87a5aa3571f1271a3577045d262f5f",
"timestamp": "",
"source": "github",
"line_count": 653,
"max_line_length": 78,
"avg_line_length": 40.2802450229709,
"alnum_prop": 0.4862943390487777,
"repo_name": "freedomhui/cinder",
"id": "92be797b8fcfe5b76e335c4325ae697372230cf6",
"size": "269... |
from django.contrib import admin
from django.contrib.admin.options import TabularInline, ModelAdmin
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.db import models
from django.utils.translation import ugettext_lazy as _
from shop_optiongroups.models import Option, OptionGroup
class Option... | {
"content_hash": "af6af2e5066eaf6b113f0a970c75c085",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 66,
"avg_line_length": 31.17391304347826,
"alnum_prop": 0.7377963737796374,
"repo_name": "jrief/django-shop-productvariations",
"id": "1d3131b0afc8dcb40dc9e4af219407955f8e048... |
import ctypes
from ctypes import windll
from ctypes import wintypes
from cloudbaseinit import exception
kernel32 = windll.kernel32
# VirtDisk.dll is available starting from Windows Server 2008 R2 / Windows7
virtdisk = None
class Win32_GUID(ctypes.Structure):
_fields_ = [("Data1", wintypes.DWORD),
... | {
"content_hash": "7e07ad13ce75269a625754643e4f1b39",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 79,
"avg_line_length": 34.55474452554745,
"alnum_prop": 0.5595690747782003,
"repo_name": "CropCircleSys/bsd-cloudinit",
"id": "df64333d3932da0dfbb04d22c7be15b116aebdfc",
"... |
from oslo_log import log as logging
from vitrage.common.constants import DatasourceProperties as DSProps
from vitrage.common.constants import EdgeLabel
from vitrage.common.constants import EntityCategory
from vitrage.common.constants import VertexProperties as VProps
from vitrage.datasources.alarm_transformer_base imp... | {
"content_hash": "d80821baf5edeb9b1499c4f797428e26",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 74,
"avg_line_length": 39.16304347826087,
"alnum_prop": 0.6636136552872606,
"repo_name": "openstack/vitrage",
"id": "50b3fae058de83a093783162702d8927c6e99a07",
"size": "417... |
#!/usr/bin/env python
#
# 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 "Li... | {
"content_hash": "4e674cb95e01d29d2d9eb84be24c6fe7",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 100,
"avg_line_length": 42.160493827160494,
"alnum_prop": 0.6296730112249878,
"repo_name": "facaiy/spark",
"id": "7da67a4109ed1fc2d9ef5ddbccdc3a04840fe702",
"size": "10245... |
import datetime
import os
#from django.utils import timezone
from django.conf import settings
from django.utils import unittest
from django.test.client import Client
from .tests_data import TESTS_DATA
from .utils import get_filebrowser_vo, get_filebrowser_directory, \
get_fullpath_filebrowser_directory, get_rucio_acc... | {
"content_hash": "7b43fe20b433408e214963a5f48f0026",
"timestamp": "",
"source": "github",
"line_count": 361,
"max_line_length": 95,
"avg_line_length": 42.24930747922438,
"alnum_prop": 0.5829399423026488,
"repo_name": "jschovan/filebrowser",
"id": "37fa494f1ad7151341e555cc698d3367f3c55f5d",
"size": ... |
"""
WSGI middleware for OpenStack API controllers.
"""
import routes
from cinder.api.openstack import wsgi
from cinder.i18n import _, _LW
from cinder.openstack.common import log as logging
from cinder import wsgi as base_wsgi
LOG = logging.getLogger(__name__)
class APIMapper(routes.Mapper):
def routematch(sel... | {
"content_hash": "4179eeb8adcf274f25c8f345d4b9d254",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 78,
"avg_line_length": 37.421052631578945,
"alnum_prop": 0.573370839193624,
"repo_name": "hguemar/cinder",
"id": "057e38eb481104cb0a0178a968f48b1f3cfb8221",
"size": "4908"... |
import ConfigParser
import cStringIO
import subprocess
import os
import time
import urllib2
from exceptions import RuntimeError
from supervisor.datatypes import DEFAULT_EXPECTED_EXIT_CODE
from supervisor.http import NOT_DONE_YET
from supervisor.options import ClientOptions
from supervisor.rpcinterface import Superviso... | {
"content_hash": "7fb77b8d854f0a073c9add4673a670a5",
"timestamp": "",
"source": "github",
"line_count": 710,
"max_line_length": 93,
"avg_line_length": 37.416901408450705,
"alnum_prop": 0.6516223744636,
"repo_name": "cherrydocker/minos",
"id": "18e86bb8f627f0c9e00b6847f3fff1adc80e2a4e",
"size": "266... |
class A(object):
a = 10
def bow(self):
print 'bow'
def __getattr__(self, name):
print 'getattr', name
def __getattribute__(self, name):
print 'attribute', name
class B(object):
def __getattr__(self, name):
print name
class Bar(object):
def __in... | {
"content_hash": "2f8803e24a4f4aefcbcd6e74db515e68",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 37,
"avg_line_length": 17.05263157894737,
"alnum_prop": 0.5262345679012346,
"repo_name": "Veek/Python",
"id": "78785b51511366442f7cb60e0d97c119c6080b7e",
"size": "648",
"... |
from streamlink.plugins.bloomberg import Bloomberg
from tests.plugins import PluginCanHandleUrl
class TestPluginCanHandleUrlBloomberg(PluginCanHandleUrl):
__plugin__ = Bloomberg
should_match_groups = [
("https://www.bloomberg.com/live", {"live": "live"}),
("https://www.bloomberg.com/live/", {... | {
"content_hash": "90793d6238d8244ca00923ded0a672c5",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 128,
"avg_line_length": 44.666666666666664,
"alnum_prop": 0.6567164179104478,
"repo_name": "amurzeau/streamlink-debian",
"id": "5c113ccf078093e4063db9937564e25bdf033179",
"... |
"""This module exports the JSHint plugin linter class."""
import re
from SublimeLinter.lint import Linter
class JSHint(Linter):
"""Provides an interface to the jshint executable."""
syntax = ('javascript', 'html', 'javascriptnext')
executable = 'jshint'
version_args = '--version'
version_re = r... | {
"content_hash": "003bf9f0ab5c9be8015fb32fe124afcb",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 80,
"avg_line_length": 36.60629921259842,
"alnum_prop": 0.48806194880619486,
"repo_name": "tylertebbs20/Practice-SublimeLinter-jshint",
"id": "e26050ade19a61eebda791e5cfdc61... |
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from .. import models
from ..._serialization import Deserializer, Serializer
from ._configuration import NetworkManagementClientConfi... | {
"content_hash": "9492546d26051f984c8b2fb44e0c9ce9",
"timestamp": "",
"source": "github",
"line_count": 609,
"max_line_length": 120,
"avg_line_length": 57.19704433497537,
"alnum_prop": 0.7600264117359975,
"repo_name": "Azure/azure-sdk-for-python",
"id": "c8750ea7b0519d3a60dd12b12153e71d548c7b34",
"... |
import unittest
from Perceptron import Perceptron
class TestPerceptron(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.perceptron = Perceptron()
def test_AND(self):
self.assertEqual(0, self.perceptron.AND(0, 0))
self.assertEqual(0, self.perceptron.AND(0, 1))
self... | {
"content_hash": "0f2519000aeaaf153757db3708b0e7b8",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 55,
"avg_line_length": 34.285714285714285,
"alnum_prop": 0.6391666666666667,
"repo_name": "Arahabica/NNTrain",
"id": "ac17691d55517b637f51e04346e6c992085fd642",
"size": "12... |
"""
MoinMoin - XMLRPC CLI Scripts
@copyright: 2006 MoinMoin:AlexanderSchremmer
@license: GNU GPL, see COPYING for details.
"""
from MoinMoin.util import pysupport
# create a list of extension scripts from the subpackage directory
modules = pysupport.getPackageModules(__file__)
| {
"content_hash": "5a4ed50f67b918939da25f5c7c6ae1e0",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 66,
"avg_line_length": 24.5,
"alnum_prop": 0.7448979591836735,
"repo_name": "RealTimeWeb/wikisite",
"id": "2f1a2fe993f4025432bd37ad2c1d4f8c5107ed6d",
"size": "323",
"bina... |
from oslo_config import cfg
from oslo_log import log
from ceilometer.agent import plugin_base as plugin
LOG = log.getLogger(__name__)
cfg.CONF.import_group('service_credentials', 'ceilometer.service')
class TenantDiscovery(plugin.DiscoveryBase):
"""Discovery that supplies keystone tenants.
This discovery ... | {
"content_hash": "53e416cf36e6dabea960fd69841c6402",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 75,
"avg_line_length": 30.761904761904763,
"alnum_prop": 0.7321981424148607,
"repo_name": "fabian4/ceilometer",
"id": "4351dda958584d6baf6c5bc231a979dd89ed6209",
"size": "1... |
"""Serialization Registration for SavedModel.
revived_types registration will be migrated to this infrastructure.
See the Advanced saving section in go/savedmodel-configurability.
This API is approved for TF internal use only.
"""
import collections
import re
from tensorflow.python.util import tf_inspect
# Only al... | {
"content_hash": "2d312c6aa495e77e801c34b7dd25c942",
"timestamp": "",
"source": "github",
"line_count": 368,
"max_line_length": 106,
"avg_line_length": 39.828804347826086,
"alnum_prop": 0.715698983420891,
"repo_name": "yongtang/tensorflow",
"id": "f519c0981cc289ecacfe9dd1341c42b8d90ff46a",
"size": ... |
'''
Documentation Builder Environments
'''
import os
import json
import logging
import subprocess
import traceback
from django.utils.text import slugify
from django.conf import settings
from rest_framework.renderers import JSONRenderer
from projects.utils import run
from restapi.serializers import VersionFullSeriali... | {
"content_hash": "775e2e2705764f55a45f51a59feaf1cc",
"timestamp": "",
"source": "github",
"line_count": 310,
"max_line_length": 81,
"avg_line_length": 35.81935483870968,
"alnum_prop": 0.5964517291066282,
"repo_name": "adrianmugnoz/Documentacion-Divulgame",
"id": "aee2ecffe1a1b2bc315e3d8d0cac5aa3aa955... |
import os
from django.conf import settings
from django.db import models
from django.utils import timezone
from siteuser.settings import (
MAX_EMAIL_LENGTH,
MAX_USERNAME_LENGTH,
AVATAR_URL_PREFIX,
DEFAULT_AVATAR,
AVATAR_DIR,
)
from siteuser.upload_avatar.signals import avatar_crop_done
"""
siteus... | {
"content_hash": "1911f7b602907dfbb141fd29c49535e3",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 97,
"avg_line_length": 29.42763157894737,
"alnum_prop": 0.6561591772859379,
"repo_name": "yueyoum/django-siteuser",
"id": "414d8ff65bb7c2e23b911d80a83f3c1f7d894d5a",
"size... |
"""
__ __ _____ _____ _____
\ \ / // ____/ ____| / ____|
\ V /| (___| (___ | (___ ___ __ _ _ __ _ __ ___ _ __
> < \___ \\___ \ \___ \ / __/ _` | '_ \| '_ \ / _ \ '__|
/ . \ ____) |___) | ____) | (_| (_| | | | | | | | __/ |
/_/ \_\_____/_____/ |_____/ \___\__,_|_| |_|_| |_|\___|_|
T... | {
"content_hash": "da085b4dd42f15b1313f1d4dd31bb2f5",
"timestamp": "",
"source": "github",
"line_count": 412,
"max_line_length": 132,
"avg_line_length": 47.31310679611651,
"alnum_prop": 0.5936490022059201,
"repo_name": "StevenVanAcker/mitmproxy",
"id": "4b35c6c11a22538131f54e2b99a8e64e986b269e",
"si... |
import pandas as pd
import matplotlib.dates as md
import os
from django.db import connection
from core.common.models import JediTasks
import StringIO
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
class TaskProgressPlot:
def __init__(self):
pass
def get_task_start(self,taski... | {
"content_hash": "5846d01d1064556a235b95656b56730b",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 239,
"avg_line_length": 41.870466321243526,
"alnum_prop": 0.6212102462566514,
"repo_name": "Foorth/panda-bigmon-core",
"id": "1c7c98b85af74458666226ceab0f3cd76ae4dffd",
"s... |
import sys
import csv
from trigger.cmds import ReactorlessCommando
from twisted.python import log
from twisted.internet import reactor
from Router import Router
import jsonpickle
class getRouterDetails(ReactorlessCommando):
"""
Collection device information
"""
commands = Router.showCommands
def... | {
"content_hash": "2fde119fb4aae86879bc52e82cf08da1",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 79,
"avg_line_length": 28.804232804232804,
"alnum_prop": 0.6032329169728141,
"repo_name": "chepazzo/trigger",
"id": "d60bd50f4d16e01b28497d0bf0336aebb7714150",
"size": "54... |
"""Helper functions used in many modules
"""
from __future__ import print_function
from matplotlib import pyplot as plt
from numpy.linalg import svd
from numpy import *
def xy2ij(shp, ni):
out = zeros(shp.shape)
out[:, 1] = shp[:, 0]
out[:, 0] = ni - shp[:, 1]
return out
def pca(data, frac=1):
""... | {
"content_hash": "c7f6d2cff9bd2659970503e8949dd055",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 80,
"avg_line_length": 26.823529411764707,
"alnum_prop": 0.5760233918128655,
"repo_name": "dfdx/masque",
"id": "8633e6781a1f22716ea70bfa37b294f6601627e9",
"size": "1368",
... |
import os.path
import xml.etree.cElementTree as ET
import bacon
class SpriterFolder(object):
def __init__(self):
self.files = []
class SpriterFile(object):
def __init__(self, name, pivot_x, pivot_y):
self.name = name
self.pivot_x = pivot_x
self.pivot_y = pivot_y
class Spriter... | {
"content_hash": "fc013b671aff954efb4118cccb727af8",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 93,
"avg_line_length": 26.083333333333332,
"alnum_prop": 0.6062300319488818,
"repo_name": "aholkner/MonthlyVisitor",
"id": "3c1f9b92e9c4d8edde24f77019458b7fa4d68373",
"size... |
import os
from subprocess import check_call
build = os.environ['BUILD']
config = os.environ['CONFIGURATION']
platform = os.environ['PLATFORM']
path = os.environ['PATH']
image = os.environ['APPVEYOR_BUILD_WORKER_IMAGE']
jobid = os.environ['APPVEYOR_JOB_ID']
cmake_command = ['cmake', '-DFMT_PEDANTIC=ON', '-DCMAKE_BUILD_... | {
"content_hash": "3e40c6592185f263f8237b1fdc478701",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 84,
"avg_line_length": 39.4,
"alnum_prop": 0.6230964467005076,
"repo_name": "smacdo/Shiny",
"id": "6544610326739f279947fc2b2a4309a742f23743",
"size": "1632",
"binary": fa... |
import textwrap
from dataclasses import dataclass
from io import StringIO
from test.testutils import assert_help_output_equals
import pytest
import simple_parsing
from simple_parsing.wrappers.field_wrapper import ArgumentGenerationMode
@dataclass
class JBuildRelease:
id: int
url: str
docker_image: str
... | {
"content_hash": "bc4cfec3b706c2592164ca899a1c8475",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 96,
"avg_line_length": 29.223776223776223,
"alnum_prop": 0.5951184493898062,
"repo_name": "lebrice/SimpleParsing",
"id": "834cfbeb4478168573dec07f76d74fff6196d780",
"size"... |
import datetime
import httplib2
import re
import time
from urllib import urlencode
try:
import Image
except ImportError:
from PIL import Image
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.conf import settings
from django.contrib.sites.models import ... | {
"content_hash": "9389cd1117a1319a8a6407b6010df480",
"timestamp": "",
"source": "github",
"line_count": 640,
"max_line_length": 152,
"avg_line_length": 35.6921875,
"alnum_prop": 0.5681828131156152,
"repo_name": "worldcompany/djangoembed",
"id": "455bc6d19f7066cf60698a3c67cb633f744fed5f",
"size": "2... |
def contextSettingsInTemplate(request):
from django.conf import settings
from os.path import dirname, join
#vf = open('../../../../../.currentVersion','r')
vf = open(join(dirname(__file__), '../../../../../.currentVersion'),'r')
softwareVersion = vf.read()
extraSettings = {'islandName':settings.ISLAND_NAME,
... | {
"content_hash": "ea1b56121bb13d3215173820fb752ce7",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 73,
"avg_line_length": 32.5,
"alnum_prop": 0.6615384615384615,
"repo_name": "avlach/univbris-ocf",
"id": "954a4137d95965e139394fa95cd1e1639e84e3f6",
"size": "390",
"binar... |
""" Define classes specifying the conductor-tutor-student simulation. """
import numpy as np
import simulation
def int_r(f):
""" Convert to nearest integer. """
return int(np.round(f))
class TableSpikers(object):
""" A layer of neurons that spike at times indicated by a boolean array.
Set `spike_table... | {
"content_hash": "ac5b0d77aac4254692df2190539f1108",
"timestamp": "",
"source": "github",
"line_count": 1780,
"max_line_length": 95,
"avg_line_length": 36.698876404494385,
"alnum_prop": 0.6345906558079726,
"repo_name": "ttesileanu/twostagelearning",
"id": "5266afbbf2c40f2aa69d62865bbab15b470f708d",
... |
class Solution(object):
def isPalindrome(self, head):
"""
:type head: ListNode
:rtype: bool
"""
if ( head == None ):
return True
fast = head
slow = head
while ( fast != None and fast.next != None ):
fast = fast.next.next
slow = slow.next
if ( fast != None ):
... | {
"content_hash": "7d4a1381f2e58fa642407acd7755fa6b",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 49,
"avg_line_length": 17.57894736842105,
"alnum_prop": 0.5224550898203593,
"repo_name": "hawkphantomnet/leetcode",
"id": "1af3cb5d0fca2dc6a47970f8bf696c8cbe7e0be1",
"size"... |
import tempfile
from contextlib import contextmanager
from typing import Iterator
from git import Repo
@contextmanager
def git_repo(uri: str) -> Iterator[Repo]:
"""Check out a git repository to a temporary directory
for example to add a file, commit and push it, it can be used as so:
```python
impo... | {
"content_hash": "44f4bfc929c8daad49ea58beab3f9d36",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 72,
"avg_line_length": 25.742857142857144,
"alnum_prop": 0.6670366259711432,
"repo_name": "lyft/envoy",
"id": "3ad1834192ff127ed3522bd8934ddff092a668cd",
"size": "901",
"... |
from django.conf.urls import patterns
urlpatterns = patterns('crits.signatures.views',
(r'^details/(?P<_id>\w+)/$', 'signature_detail'),
(r'^details_by_link/(?P<link>.+)/$', 'details_by_link'),
(r'^get_versions/(?P<_id>\w+)/$', 'get_signature_versions'),
(r'^set_signature_type/(?P<id_>\w+)/$', 'set_sig... | {
"content_hash": "a210012c79ecba06609b00aff1e5076c",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 73,
"avg_line_length": 52.80952380952381,
"alnum_prop": 0.6131650135256989,
"repo_name": "ckane/crits",
"id": "cf518e74b3146b910e7b82023760d61c97b44d3c",
"size": "1109",
... |
import time
import collections
from django.core.exceptions import ImproperlyConfigured
from rest_framework.parsers import JSONParser
from rest_framework.exceptions import ParseError, NotAuthenticated
from framework.auth import signing
from api.base.utils import is_bulk_request
from api.base.renderers import JSONAPIRen... | {
"content_hash": "5987ee1c46bd655599768b47ce42a175",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 131,
"avg_line_length": 38.44303797468354,
"alnum_prop": 0.6150806717155087,
"repo_name": "erinspace/osf.io",
"id": "7511cebd2bb22aafa2bfd67cc6633fc29478c939",
"size": "12... |
"""Tests for wemo_device.py."""
import asyncio
from datetime import timedelta
from unittest.mock import call, patch
import async_timeout
import pytest
from pywemo.exceptions import ActionException, PyWeMoException
from pywemo.subscribe import EVENT_TYPE_LONG_PRESS
from homeassistant import runner
from homeassistant.c... | {
"content_hash": "b29cb48fe2f6af472b2b08788201fedf",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 86,
"avg_line_length": 34.06880733944954,
"alnum_prop": 0.6702571697859162,
"repo_name": "home-assistant/home-assistant",
"id": "9bd3367aeeeb8a3b524e263ac60a595cf206cf1f",
... |
import argparse
import logging
import traceback
from neutronclient.neutron import v2_0 as neutronV20
from neutronclient.openstack.common.gettextutils import _
"""
'lb-sslcert-create': lbssl.CreateLbSSLCert,
'lb-sslcert-list': lbssl.ListLbSSLCert,
'lb-sslcert-show': lbssl.ShowLbSSLCert,
'lb-sslcert-del... | {
"content_hash": "fe4dd562161a4ece9110ffd0e58f3857",
"timestamp": "",
"source": "github",
"line_count": 604,
"max_line_length": 99,
"avg_line_length": 33.08443708609271,
"alnum_prop": 0.586198268528249,
"repo_name": "vijayendrabvs/ssl-python-neutronclient",
"id": "46f7f0e23fb301e504207d5b15fc71334aa4... |
from flask import Flask
from flask import request
from flask import render_template
from flask import jsonify
import time
import requests
import base64
import hashlib
from Crypto.Cipher import AES
unpad = lambda s : s[:-ord(s[len(s)-1:])]
app = Flask(__name__)
#Load config module containing YLE API credentials
app.co... | {
"content_hash": "3c8d992087e0f1b9d975d9cfb309ab03",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 161,
"avg_line_length": 31.486301369863014,
"alnum_prop": 0.701979551881662,
"repo_name": "svihila/o-areena",
"id": "0d8fb9f52e6dd03a9343b3f69a5df8f2085100cd",
"size": "45... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_tailor_trainer_03.iff"
result.attribute_template_id = 9
result.stfName("npc_name","twilek_base_male")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "4935b1877d07a0b24a9211a3c15fea2c",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 71,
"avg_line_length": 23.53846153846154,
"alnum_prop": 0.696078431372549,
"repo_name": "obi-two/Rebelion",
"id": "6a4003dc96a50b53b3bd7ef5c59645811631fbff",
"size": "451",... |
from __future__ import unicode_literals, print_function
import os
import six
import sys
__all__ = (
'has_command_handler',
'call_command_handler',
)
COMMANDS_TO_HANDLERS = {} # Global mapping Vi commands to their handler.
COMMANDS_TAKING_LOCATIONS = set() # Name of commands that accept locations.
SET_COMMA... | {
"content_hash": "bbe878d813c645c202f8e4e72ad80dd2",
"timestamp": "",
"source": "github",
"line_count": 569,
"max_line_length": 95,
"avg_line_length": 23.54305799648506,
"alnum_prop": 0.6260824126604957,
"repo_name": "tianzhihen/pyvim",
"id": "073606517e04778f2251760a066f91e11b19a3de",
"size": "133... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import *
import logging
import emission.core.get_database as edb
if __name__ == '__ma... | {
"content_hash": "2cd5a297beaf9f0ce0091e33f72b6e82",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 151,
"avg_line_length": 37.64102564102564,
"alnum_prop": 0.5613079019073569,
"repo_name": "e-mission/e-mission-server",
"id": "555ef03edb48bd1285dab83e1c1820e4a648ff0f",
"s... |
import subprocess
from subprocess import CalledProcessError
from six import raise_from
class Config:
"""Config class to configure wkhtmltoimage, xvfb-run and meta tag prefix"""
def __init__(self, wkhtmltoimage="", xvfb="", meta_tag_prefix="imgkit-"):
"""
Configure wkhtmltoimage, xvfb, meta_... | {
"content_hash": "1f866f7e60b07b34d72eaa158a5e1e3c",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 105,
"avg_line_length": 34.319148936170215,
"alnum_prop": 0.5334779913205208,
"repo_name": "jarrekk/imgkit",
"id": "cb5566a7285733c9bd9843a98ef6495788b3fcbf",
"size": "3250... |
"""Defines various classes and definitions that provide assistance for
unit testing Actors in an ActorSystem."""
import unittest
import pytest
import logging
import time
from thespian.actors import ActorSystem
def simpleActorTestLogging():
"""This function returns a logging dictionary that can be passed as
... | {
"content_hash": "81a91c9106e01afde4db48eb0ee0ecd8",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 133,
"avg_line_length": 39.48708487084871,
"alnum_prop": 0.6342397906737688,
"repo_name": "godaddy/Thespian",
"id": "f4f17423287631eb13689d4e83bc57690e8204bf",
"size": "10... |
import os
import pickle
import random
import subprocess
import sys
import textwrap
import time
import unittest
from test import support
from test.support import MISSING_C_DOCSTRINGS
from test.support.script_helper import assert_python_failure
try:
import _posixsubprocess
except ImportError:
_posixsubprocess = N... | {
"content_hash": "f3d79d9a7ec616f2a88b6cf3c5406148",
"timestamp": "",
"source": "github",
"line_count": 553,
"max_line_length": 103,
"avg_line_length": 40.3254972875226,
"alnum_prop": 0.5599551569506727,
"repo_name": "munyirik/python",
"id": "eae3addcb182a4a4445b9a018fdff9deb7ba486d",
"size": "2245... |
"""
Models and functions for tracking XBlog Objects:
- Post
- Author
- Blog
- Category
- Tag
"""
import logging
import os
import string
import bs4
import markdown2
import django.utils.timezone
import random
try:
from urllib.parse import urlparse, urljoin
except ImportError:
from urlparse import urlparse, url... | {
"content_hash": "d627457174bd1c398e19ce4d574108b5",
"timestamp": "",
"source": "github",
"line_count": 738,
"max_line_length": 103,
"avg_line_length": 35.78590785907859,
"alnum_prop": 0.5780007572889058,
"repo_name": "rubeon/django-xblog",
"id": "6fef70b384dfafb4344865f682c357ef2f41b007",
"size": ... |
from __future__ import unicode_literals
from functools import wraps
import string, re, unicodedata
from rply import ParserGenerator
from hy._compat import PY3, str_type, isidentifier, UCS4
from hy.models import (HyBytes, HyComplex, HyDict, HyExpression, HyFloat,
HyInteger, HyKeyword, HyList, H... | {
"content_hash": "4f3e1a0b2ab6d65b8973454f43c01b8d",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 100,
"avg_line_length": 26.5327868852459,
"alnum_prop": 0.6072495108639687,
"repo_name": "kartikm/hy",
"id": "fac2577f9acbf144deaa28d731d2ce84edb53ff0",
"size": "9871",
... |
import sys
__author__ = "Allan Bunch"
__copyright__ = "Copyright (C) 2010 Webframeworks LLC"
__license__ = """Copyright 2010 Webframeworks LLC Licensed under the Apache
License, Version 2.0 (the "License"); you may not use this
file except in compliance with the License. You may obtai... | {
"content_hash": "0a02ea12258198b0df744647909c7188",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 78,
"avg_line_length": 49.523809523809526,
"alnum_prop": 0.6288461538461538,
"repo_name": "lxming/python-groupon",
"id": "acd1c274a27624cd5bd4b16b2dbb2e7517ac0eac",
"size":... |
import os
import unittest
from idl_lexer import IDLLexer
#
# FileToTokens
#
# From a source file generate a list of tokens.
#
def FileToTokens(lexer, filename):
with open(filename, 'r') as srcfile:
lexer.Tokenize(srcfile.read(), filename)
return lexer.GetTokens()
#
# TextToTokens
#
# From a source file g... | {
"content_hash": "3c3f3d3f590cfedb0aa6fb44499ebf03",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 78,
"avg_line_length": 28.114942528735632,
"alnum_prop": 0.6492232215862633,
"repo_name": "nwjs/chromium.src",
"id": "e98d5d9e39c9be2dafa86ddaed01b7e815f05184",
"size": "26... |
r"""Provide support for tracking of in-place changes to scalar values,
which are propagated into ORM change events on owning parent objects.
.. _mutable_scalars:
Establishing Mutability on Scalar Column Values
===============================================
A typical example of a "mutable" structure is a Python dict... | {
"content_hash": "e157ea3d9d63426f0865efd32f94aa9d",
"timestamp": "",
"source": "github",
"line_count": 951,
"max_line_length": 79,
"avg_line_length": 33.74553101997897,
"alnum_prop": 0.6355789604885953,
"repo_name": "j5int/sqlalchemy",
"id": "cbec06a31fec353cf9d8386903c3dce2a9d00e40",
"size": "323... |
"""
Django settings for xin_mysite project.
Generated by 'django-admin startproject' using Django 1.8.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build p... | {
"content_hash": "a75a548c8349fbdef4c4f84e02e04622",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 71,
"avg_line_length": 25.878504672897197,
"alnum_prop": 0.6767786204405922,
"repo_name": "jayzane/sources-of-Xin.com",
"id": "740fd4a0647769ac27c0a304f8b4f7f66275bab9",
"... |
from decimal import Decimal, ROUND_HALF_UP
import plata
from plata.discount.models import DiscountBase
class ProcessorBase(object):
"""
Order processor class base. Offers helper methods for order total
aggregation and tax calculation.
"""
def __init__(self, shared_state):
self.shared_sta... | {
"content_hash": "0e23fbfdbc516354b8ce9482daf44e17",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 78,
"avg_line_length": 31.823529411764707,
"alnum_prop": 0.6067775723967961,
"repo_name": "armicron/plata",
"id": "163a0ec4bb0227f9327d4890a1572b311fdb7a00",
"size": "8115... |
"""Contains the :class:`UsersController` and its auxiliary functions.
.. module:: users
:synopsis: Contains the users controller and its auxiliary functions.
"""
import logging
import datetime
import simplejson as json
from pylons import request, response, session, config
from formencode.validators import Invalid... | {
"content_hash": "b740cfebd71af4432c0fa3bf31f9e41a",
"timestamp": "",
"source": "github",
"line_count": 362,
"max_line_length": 111,
"avg_line_length": 36.870165745856355,
"alnum_prop": 0.6020828650633101,
"repo_name": "jrwdunham/old",
"id": "9db9e2d821fc9737f4a2989d48e869df9ec90d64",
"size": "1393... |
import datetime
import joblib
import numpy as np
import pandas as pd
import platform
from sklearn.decomposition import PCA, KernelPCA
from sklearn.metrics import accuracy_score, precision_score, recall_score
from sklearn.neighbors import KNeighborsClassifier
from sklearn.neural_network import MLPClassifier
from sklear... | {
"content_hash": "114e3a297803393e5ca0b8b0bf76976b",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 149,
"avg_line_length": 40.67372881355932,
"alnum_prop": 0.5227627877903949,
"repo_name": "buckbaskin/stopsign",
"id": "468f6effb0a371f8ad8d845170bea152eb1a636b",
"size": ... |
"""
Decorators for views based on HTTP headers.
"""
import datetime
from functools import wraps
from django.http import HttpResponseNotAllowed
from django.middleware.http import ConditionalGetMiddleware
from django.utils import timezone
from django.utils.cache import get_conditional_response
from django.utils.decorato... | {
"content_hash": "900bfc08177fe461efd1d988138da8e0",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 87,
"avg_line_length": 37.35606060606061,
"alnum_prop": 0.6406408436422633,
"repo_name": "apollo13/django",
"id": "6d88a633eb10d848f7b842244364a58d35791ebf",
"size": "4931... |
from oslo_log import log as logging
from oslo_messaging import RemoteError
from nca47.api.controllers.v1 import base
from nca47.api.controllers.v1 import tools
from nca47.common.exception import ParamFormatError
from nca47.common.exception import ParamNull
from nca47.common.exception import ParamValueError
from ... | {
"content_hash": "0ebfc4573826b0ac66a0e7a71f36cb9a",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 79,
"avg_line_length": 36.38345864661654,
"alnum_prop": 0.5340979541227526,
"repo_name": "WosunOO/nca_xianshu",
"id": "b1a77c6a047acb38d3ddd241a2d002ce0724a5f0",
"size": "... |
import datetime
import re
def parse_rfc3339_partial_time(value):
matches = re.match(r"^(\d\d):(\d\d):(\d\d)(\.(\d+))?$", value)
if not matches:
return None
fractions = int(matches.group(5)) if matches.group(4) else 0
return datetime.time(
int(matches.group(1)),
int(matches.grou... | {
"content_hash": "0aff74915122b0fe041134132c3264f2",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 66,
"avg_line_length": 25.533333333333335,
"alnum_prop": 0.5796344647519582,
"repo_name": "srittau/python-htmlgen",
"id": "3da717ad326804f6f84b3162294f06beb880e62a",
"size"... |
"""
General tests for all estimators in sklearn.
"""
# Authors: Andreas Mueller <amueller@ais.uni-bonn.de>
# Gael Varoquaux gael.varoquaux@normalesup.org
# License: BSD 3 clause
import os
import warnings
import sys
import re
import pkgutil
import functools
import pytest
from sklearn.utils.testing import al... | {
"content_hash": "ecd0a1b6329ef26aa521c3ee3fbb6c9a",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 79,
"avg_line_length": 38.96265560165975,
"alnum_prop": 0.5972310969116081,
"repo_name": "chrsrds/scikit-learn",
"id": "51f71f2f7919bdd7103cad5f3125446a74038edb",
"size": ... |
from __future__ import print_function
import difflib
import os
import re
import subprocess
import sys
from yuno import core
from yuno.core import errors, util
from yuno.core.config import config
_read_input = raw_input if sys.version_info[0] == 2 else input
def _prompt(message):
answer = _read_input(message)
... | {
"content_hash": "fe71c25b2d64dd3271537ccbe3623dc8",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 80,
"avg_line_length": 30.74125874125874,
"alnum_prop": 0.5621019108280255,
"repo_name": "bulatb/yuno",
"id": "d5664a7003deb4c4bfaa1a16eeb4ec4c6e5412f0",
"size": "4396",
... |
from __future__ import unicode_literals
import json
from ajax_cbv.mixins import (
AjaxResponseAction, AjaxResponseMixin, AjaxResponseStatus, FormAjaxMixin,
PartialAjaxMixin)
from django.forms import Form
from django.http import Http404
from django.test import SimpleTestCase
from django.views.generic import Te... | {
"content_hash": "c9a8d7bb1dccbb7eb4d4e9f20a24198c",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 78,
"avg_line_length": 36.60227272727273,
"alnum_prop": 0.6597330021732382,
"repo_name": "dipcode-software/django-ajax-views",
"id": "5a35385fbfc52311e539bb518e9db6bc2250699... |
from msrest.serialization import Model
class Usage(Model):
"""Describes network resource usage.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar unit: Required. An enum describing t... | {
"content_hash": "2ffc19c550bfe6aa4e9859ce04587e58",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 82,
"avg_line_length": 32.30232558139535,
"alnum_prop": 0.5989920806335494,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "4011c94043793f548a3733e0c53a386aa11b4d1a",
"... |
"""Circuitous LLC -
An advanced circle analytics company.
"""
import math
class Circle(object):
"""An advanced circle analytic toolkit"""
version = "0.1"
spam = 0.5
def __init__(self, radius):
self.radius = radius
def area(self):
"Perform quadrature on this circ... | {
"content_hash": "b1ecd36d57a0328aa47ce1775ab1ad97",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 45,
"avg_line_length": 19.36842105263158,
"alnum_prop": 0.5815217391304348,
"repo_name": "PythonBootCampIAG-USP/NASA_PBC2015",
"id": "4bfd8e338c0f6aecf8971b93aa3080aec7fdbbef... |
import os
import subprocess
import sys
fullname = sys.argv[1]
path, name = os.path.split(fullname)
subprocess.check_call([os.path.join("bin", "neonc"), "-q", fullname])
subprocess.check_call(["exec/rsnex/rsnex", fullname + "x"] + sys.argv[2:])
| {
"content_hash": "1e65746372835a1e76c78a85abbcd88d",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 74,
"avg_line_length": 27.333333333333332,
"alnum_prop": 0.6991869918699187,
"repo_name": "gitlarryf/neon-lang",
"id": "17c97576b9e83739e337c8f3c4b5326efcb2ab7e",
"size": "2... |
import datetime
import hashlib
import random
import re
from django.utils import timezone
from django.conf import settings
from django.db import models
from django.db import transaction
from django.core.mail import send_mail
from django.template.loader import render_to_string
from django.utils.translation import ugette... | {
"content_hash": "6000ede5e47a73f248ad478b32152e88",
"timestamp": "",
"source": "github",
"line_count": 329,
"max_line_length": 90,
"avg_line_length": 38.90881458966565,
"alnum_prop": 0.6249511756893993,
"repo_name": "remarkablerocket/django-mailinglist-registration",
"id": "0b3e65d2810fe4f99c965bae5... |
"""feelings URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | {
"content_hash": "efa1484fecfb0fcdefbae0e7ae698822",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 83,
"avg_line_length": 36.345454545454544,
"alnum_prop": 0.7033516758379189,
"repo_name": "treehouse/livestream-django-feelings",
"id": "ab90772027e86ef06e6be334f05590e8eff97... |
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
api.version_control(SQLALCHEMY_DA... | {
"content_hash": "4f827d6e9ac342b27655e5460fbf10a2",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 74,
"avg_line_length": 37.23076923076923,
"alnum_prop": 0.7871900826446281,
"repo_name": "Kortaggio/movie-info",
"id": "bb8833efc3677b2c7122d9823991bbe896ebe1b2",
"size": "... |
from __future__ import print_function
from dark.reads import addFASTACommandLineOptions, parseFASTACommandLineOptions
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(
description=('Given FASTA on stdin, write the sequences '
'to stdout.'))
addFAS... | {
"content_hash": "ee010f41bc14ab30f3eb02c00b059d66",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 79,
"avg_line_length": 26.666666666666668,
"alnum_prop": 0.6791666666666667,
"repo_name": "bamueh/dark-matter",
"id": "7371f1082560652493d4d3090e230d60512c9781",
"size": "5... |
import struct
from builtins import bytes
import infinispan as ispn
from infinispan import error
class Encoder(object):
def __init__(self, byte_array=bytes()):
self._byte_array = byte_array
def encode(self, message):
"""Encodes a message (request or a response).
:param message: Mes... | {
"content_hash": "a1df790f59acd5c643640eed379f54f7",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 78,
"avg_line_length": 28.004347826086956,
"alnum_prop": 0.5183977643223102,
"repo_name": "VaclavDedik/infinispan-py",
"id": "eee3268ff9abd4066f4f8222489bc3b63d6f945c",
"s... |
"""
Controll VKBot
"""
import re
from random import getrandbits
from vk_api.exceptions import ApiError
from main.providers.wit_ai import speech
from settings_local import VK_GROUP_ID
class BotAction(object):
"""
Bot actions
"""
def __init__(self, msg_object):
"""
Constructor
""... | {
"content_hash": "2a7dd0a96984a6f3fbc2932af3881447",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 107,
"avg_line_length": 36.678899082568805,
"alnum_prop": 0.5770385192596298,
"repo_name": "Ridys/ribot",
"id": "35297ccedc29222310b13bd3af412b78154c5eb5",
"size": "4334",... |
import os
from ..utils import in_temporary_directory
from ..utils import assert_cmd_success
from ..workspace_assertions import assert_workspace_initialized
from ..workspace_assertions import assert_warning_message
from ..workspace_assertions import assert_no_warnings
@in_temporary_directory
def test_init_local_no_s... | {
"content_hash": "5328ede545e0874c122924a4e77eb12a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 69,
"avg_line_length": 29.916666666666668,
"alnum_prop": 0.724233983286908,
"repo_name": "k-okada/catkin_tools",
"id": "75b61f5f28ee8e740f4a82e27c7e9d24eb766bb9",
"size": "... |
import os
from flask import Flask, redirect, render_template, request
from google.cloud import storage
from google.cloud import speech
from google.cloud.speech import enums
from google.cloud.speech import types
app = Flask(__name__)
@app.route('/')
def homepage():
# Return a Jinja2 HTML template and pass in i... | {
"content_hash": "54dd8a308c69060b3a842408c11a85f0",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 120,
"avg_line_length": 33.985915492957744,
"alnum_prop": 0.7078325735598839,
"repo_name": "GoogleCloudPlatform/hackathon-toolkit",
"id": "1dbf74b498546b937a09bc8761038316fff... |
import tensorflow as tf
from luminoth.datasets.object_detection_dataset import ObjectDetectionDataset
DATASETS = {
'tfrecord': ObjectDetectionDataset,
'object_detection': ObjectDetectionDataset,
}
def get_dataset(dataset_type):
dataset_type = dataset_type.lower()
if dataset_type not in DATASETS:
... | {
"content_hash": "d1af4bbaa97a58b0c2adc5aa0a5db813",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 79,
"avg_line_length": 27.90909090909091,
"alnum_prop": 0.6677524429967426,
"repo_name": "tryolabs/luminoth",
"id": "90445417afc92825d80645b3cb96aabe16a6a15c",
"size": "614... |
import json
import logging
from kubeflow.testing import ks_util, test_util, util
from kubeflow.tf_operator import test_runner, tf_job_client
from kubeflow.tf_operator import util as tf_operator_util
from kubernetes import client as k8s_client
REPLICA_RESTART_POLICY_ALWAYS_COMPONENT_NAME = "replica_restart_policy_alwa... | {
"content_hash": "143ee449cfd6a4daa89d058435c05b31",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 84,
"avg_line_length": 43.6375,
"alnum_prop": 0.6849040389573188,
"repo_name": "kubeflow/training-operator",
"id": "c5d9678a6843a89c371054dbfe1992b6ecb47057",
"size": "698... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_lost_aqualish_scout_female_01.iff"
result.attribute_template_id = 9
result.stfName("npc_name","aqualish_base_female")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return resu... | {
"content_hash": "19a5a96428af90d24bd7e1141858e3ad",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 83,
"avg_line_length": 24.76923076923077,
"alnum_prop": 0.7049689440993789,
"repo_name": "anhstudios/swganh",
"id": "7d557c19f98b318d3914486d378476da20282cea",
"size": "467... |
import base64
import json
import unittest
import zlib
from c7n_azure.storage_utils import StorageUtilities
from c7n_mailer.azure_mailer import deploy
from c7n_mailer.azure_mailer.azure_queue_processor import MailerAzureQueueProcessor
from c7n_mailer.azure_mailer.sendgrid_delivery import SendGridDelivery
from common im... | {
"content_hash": "232d5aba791f3fe1429ead9cf532daba",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 98,
"avg_line_length": 44.698113207547166,
"alnum_prop": 0.6820036583649922,
"repo_name": "ocampocj/cloud-custodian",
"id": "b007fd02dbd3f63c4d17990fb7c0ca189774ed7e",
"si... |
import numpy as np
import thread
class RetinaView(object):
def __init__(self, bot):
self.bot = bot
thread.start_new_thread(self.update_loop, ())
def get_image(self):
img = self.bot.image
self.bot.clear_image()
return img
def get_image_range(self):
return -1,... | {
"content_hash": "085130243ff9eaccf825e5779a40fab4",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 69,
"avg_line_length": 27.92,
"alnum_prop": 0.5444126074498568,
"repo_name": "ctn-waterloo/nengo_pushbot",
"id": "ff236cc08b95729a7a59bf6bf15ffdec4d66e6f1",
"size": "698",
... |
'''This is an implementation of Net2Net experiment with MNIST in
'Net2Net: Accelerating Learning via Knowledge Transfer'
by Tianqi Chen, Ian Goodfellow, and Jonathon Shlens
arXiv:1511.05641v4 [cs.LG] 23 Apr 2016
http://arxiv.org/abs/1511.05641
Notes
- What:
+ Net2Net is a group of methods to transfer knowledge from... | {
"content_hash": "cf52a99d4ba1a19fdcd66bab1b816c1c",
"timestamp": "",
"source": "github",
"line_count": 384,
"max_line_length": 77,
"avg_line_length": 42.541666666666664,
"alnum_prop": 0.6388344760039177,
"repo_name": "dolaameng/keras",
"id": "07a0fe5d6920e98447de25090e4647d43afebab9",
"size": "163... |
"""Weak reference support for Python.
This module is an implementation of PEP 205:
http://www.python.org/dev/peps/pep-0205/
"""
# Naming convention: Variables named "wr" are weak reference objects;
# they are called this instead of "ref" to avoid name collisions with
# the module-global ref() function impor... | {
"content_hash": "a059952d7bf1659f5f6a594d3a8c0352",
"timestamp": "",
"source": "github",
"line_count": 603,
"max_line_length": 80,
"avg_line_length": 33.185737976782754,
"alnum_prop": 0.5314576982659537,
"repo_name": "grupoprog3/proyecto_final",
"id": "54becf25fc938796e9d1dd335a54f61697affb50",
"s... |
from south.db import db
from django.db import models
from cms.plugins.flash.models import *
class Migration:
def forwards(self, orm):
# Deleting field 'Flash.public'
db.delete_column('cmsplugin_flash', 'public_id')
# Deleting model 'flashpublic'
db.delete_tabl... | {
"content_hash": "c7f3700875384677bee25c3458496ac4",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 164,
"avg_line_length": 68.42335766423358,
"alnum_prop": 0.51781523362492,
"repo_name": "driesdesmet/django-cms",
"id": "f4e5f17538550f9662a7a269f9568220d1976995",
"size":... |
"""The tests for the Home Assistant API component."""
# pylint: disable=protected-access
import asyncio
import json
from unittest.mock import patch
from aiohttp import web
import pytest
import voluptuous as vol
from homeassistant import const
from homeassistant.bootstrap import DATA_LOGGING
import homeassistant.core ... | {
"content_hash": "8720292399ba221e680905d21c8bc484",
"timestamp": "",
"source": "github",
"line_count": 607,
"max_line_length": 79,
"avg_line_length": 31.16144975288303,
"alnum_prop": 0.6418186624372192,
"repo_name": "tinloaf/home-assistant",
"id": "a88c828efe8ecd364881aed103a8695696a95887",
"size"... |
"""
Given a list accounts, each element accounts[i] is a list of strings, where the
first element accounts[i][0] is a name, and the rest of the elements are emails
representing emails of the account.
Now, we would like to merge these accounts. Two accounts definitely belong to
the same person if there is some email th... | {
"content_hash": "ed9c2ffc31fdac9c1e47c2c1a0bd387b",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 80,
"avg_line_length": 36.82692307692308,
"alnum_prop": 0.6096605744125326,
"repo_name": "algorhythms/LeetCode",
"id": "e4c833e32039e920084fe1ca6235d1294bb0b74d",
"size": ... |
import random
import time
from neutron_lib.db import api as db_api
from neutron_lib.services import base as service_base
from oslo_db import exception as db_exc
from oslo_log import log as logging
from sqlalchemy.orm import session as se
LOG = logging.getLogger(__name__)
class LokiPlugin(service_base.ServicePluginB... | {
"content_hash": "e6a0d3460edfbd7e2202bb767c6b4827",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 76,
"avg_line_length": 34.285714285714285,
"alnum_prop": 0.6691666666666667,
"repo_name": "mahak/neutron",
"id": "491f914b863c633a75a77645b5fe62cf1f9276f9",
"size": "1775",... |
from __future__ import absolute_import
import numpy as np
from scipy.signal import fftconvolve
from ._utils import _maybe_get_pandas_wrapper
def bkfilter(X, low=6, high=32, K=12):
"""
Baxter-King bandpass filter
Parameters
----------
X : array-like
A 1 or 2d ndarray. If 2d, variables are ... | {
"content_hash": "9127b862d2dadc87114e87c063d1739d",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 77,
"avg_line_length": 34.14736842105263,
"alnum_prop": 0.6066584463625154,
"repo_name": "bert9bert/statsmodels",
"id": "c387054a896f1bcf828765907da60e4e7a3fbb41",
"size": ... |
from __future__ import unicode_literals
from datetime import datetime, timedelta
from io import BytesIO
from itertools import chain
import time
from unittest import skipIf
import warnings
from django.db import connection, connections, DEFAULT_DB_ALIAS
from django.core import signals
from django.core.exceptions import... | {
"content_hash": "428aede85d0cab084f00daf5f4ceba64",
"timestamp": "",
"source": "github",
"line_count": 736,
"max_line_length": 261,
"avg_line_length": 43.43342391304348,
"alnum_prop": 0.5775956455094317,
"repo_name": "tastynoodle/django",
"id": "b5edc09deb6d24aa72d7b25a9c04a9888d3226ff",
"size": "... |
import os
import sys
import warnings
from pkg_resources import resource_filename
import numpy as np
import pandas
import wqio
__all__ = ['NSQData']
class NSQData(object):
""" Class representing the National Stormwater Quality Dataset.
Parameters
----------
datapath : string, optional.
Opt... | {
"content_hash": "8eb5d3a956306976a12d2593d12a32c4",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 97,
"avg_line_length": 30.816326530612244,
"alnum_prop": 0.5487858719646799,
"repo_name": "Geosyntec/pynsqd",
"id": "7edc229443a9ca1e7762f75b02e330835ce848c3",
"size": "45... |
from PIL import Image, ImageFilter, ImageChops
from sorl.thumbnail import utils
import re
def dynamic_import(names):
imported = []
for name in names:
# Use rfind rather than rsplit for Python 2.3 compatibility.
lastdot = name.rfind('.')
modname, attrname = name[:lastdot], name[lastdot ... | {
"content_hash": "92c184d4cc596a1b98a1a8e368b1fb00",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 78,
"avg_line_length": 35.40769230769231,
"alnum_prop": 0.47360417119270043,
"repo_name": "cuker/sorl-thumbnail-legacy",
"id": "a6c1741623a30c8ebc9e52ac6d3ad2283ceae595",
... |
from django.conf.urls import patterns
from django.conf.urls import url
from openstack_dashboard.dashboards.admin.volumes.snapshots import views
urlpatterns = patterns('',
url(r'^(?P<snapshot_id>[^/]+)$',
views.DetailView.as_view(),
name='detail'),
url(r'^(?P<snapshot_id>[^/]+)/update_status/$... | {
"content_hash": "1d54ebc642ac03d3ea4654a080cd753b",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 72,
"avg_line_length": 28.428571428571427,
"alnum_prop": 0.6482412060301508,
"repo_name": "zouyapeng/horizon",
"id": "f696bfbd3595ff18dddeee2ff62a95e409144e51",
"size": "94... |
'''
This file defines a variety of preferences that must be set in the DB,
but can be changed dynamically.
'''
from django.utils.translation import gettext_lazy as _
from django.db import connection
from django.template.loader import get_template
from dynamic_preferences.types import (
BooleanPreference, StringPr... | {
"content_hash": "13ee86d992052af1a09044f5fc2bea09",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 113,
"avg_line_length": 35.528,
"alnum_prop": 0.6850934474217518,
"repo_name": "django-danceschool/django-danceschool",
"id": "4f950ee0530707b2d932164e9de264f2e0e84263",
"... |
"""Model architecture factory."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
from absl import logging
# pylint: disable=g-bad-import-order
from projects.vild.modeling import vild_head
from modeling.architecture import efficientnet
from mod... | {
"content_hash": "5ab532bad2755464961e9266a7d8afcf",
"timestamp": "",
"source": "github",
"line_count": 290,
"max_line_length": 80,
"avg_line_length": 40.19655172413793,
"alnum_prop": 0.7231706270910183,
"repo_name": "tensorflow/tpu",
"id": "e11061312a962df541d620912136c4f75ed93203",
"size": "12346... |
import math
import random
from collections.abc import Sequence
import heapq
from parlai.core.agents import Agent
from parlai.core.params import ParlaiParser
from parlai.core.dict import DictionaryAgent
class MaxPriorityQueue(Sequence):
def __init__(self, max_size):
self.capacity = max_size
self.ls... | {
"content_hash": "3e1bdebda541ae0144e4f188d1dc5e67",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 80,
"avg_line_length": 32.36363636363637,
"alnum_prop": 0.5233362143474503,
"repo_name": "calee88/ParlAI",
"id": "760b3caba7142ffb01f35a14c1000441318ffd9e",
"size": "5486"... |
"""
Tests that exercise the LLDB backend directly by loading an inferior and then
poking at it with the LLDBAdaptor class.
Tests:
LLDBAdaptor
"""
import tempfile
import sys
import json
import time
import logging
import subprocess
import threading
from mock import Mock
from nose.tools import *
import voltron
from vo... | {
"content_hash": "19620cc41861ee6214d76c546683c4de",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 104,
"avg_line_length": 29.21212121212121,
"alnum_prop": 0.6109958506224067,
"repo_name": "snare/voltron",
"id": "f08bcf35e7443a0e743faf8b728c2df08b162f52",
"size": "4820"... |
"""
Template bild.py file that has the two key elements:
1. bootstrapping code to download bilder.py lib
2. processargs(globals()) call to allow target names as args to python process
"""
# bootstrap by downloading bilder.py if not found
import urllib
import os
if not os.path.exists("bilder.py"):
print "bo... | {
"content_hash": "dabb1013d3eef3453e75d5fa5c8ec1d5",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 83,
"avg_line_length": 30.36,
"alnum_prop": 0.7140974967061924,
"repo_name": "ericvergnaud/bild",
"id": "e323e4e9a4d6e44df05d4bbd33c12e9a0cf088bb",
"size": "782",
"binary... |
from .AutoExpireMiddleware import AutoExpireMiddleware
from .SetRemoteAddrFromHeader import SetRemoteAddrFromHeader
| {
"content_hash": "5b5632eb1907b77480d15f28cc45aa37",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 60,
"avg_line_length": 58,
"alnum_prop": 0.9137931034482759,
"repo_name": "lingxiaoyang/N2O",
"id": "1f1709b516d11c7c814275251f80a686c58810bf",
"size": "116",
"binary": fa... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('inception', '0003_sqlworkflowstatus_status_code'),
]
operations = [
migrations.AlterField(
model_name='sqlworkflowstatus',
n... | {
"content_hash": "ee75a391c48c57967a233a091ff56917",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 73,
"avg_line_length": 23.88888888888889,
"alnum_prop": 0.6232558139534884,
"repo_name": "mingziV5/opsweb_test",
"id": "aa92c3eced722c7e4058985a1949f2a93f3b724d",
"size": "... |
"""Tests for grudger strategies."""
import random
import axelrod
from .test_player import TestPlayer
C, D = axelrod.Actions.C, axelrod.Actions.D
class TestGrudger(TestPlayer):
name = "Grudger"
player = axelrod.Grudger
expected_classifier = {
'memory_depth': float('inf'), # Long memory
... | {
"content_hash": "7b953026795b2a16ad165f094083deaa",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 76,
"avg_line_length": 27.422360248447205,
"alnum_prop": 0.5778029445073612,
"repo_name": "uglyfruitcake/Axelrod",
"id": "5c2e4aea7a2d14e94d8b31ef13589e7041f171f0",
"size"... |
import time
import traceback
from unittest import TestCase
from unittest.mock import Mock
import opentracing
from opentelemetry import trace
from opentelemetry.propagate import get_global_textmap, set_global_textmap
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.shim.opentracing_shim import (
... | {
"content_hash": "1fcd5331e5c9ee2189edd6140bbc76c0",
"timestamp": "",
"source": "github",
"line_count": 657,
"max_line_length": 111,
"avg_line_length": 36.15372907153729,
"alnum_prop": 0.5937776280890835,
"repo_name": "open-telemetry/opentelemetry-python",
"id": "99394ad2169026bf077cdd936d77b1fbf4dc5... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.