text stringlengths 4 1.02M | meta dict |
|---|---|
"""RL advantage estimators."""
import gin
import numpy as np
from trax import fastmath
common_args = ['gamma', 'margin']
def mask_discount(discount, discount_mask):
"""Computes a discount to apply at a given timestep, based on the mask."""
return fastmath.numpy.where(discount_mask, discount, 1.0)
def discoun... | {
"content_hash": "baa678503037197b99aad49ffb914f81",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 78,
"avg_line_length": 33.67701863354037,
"alnum_prop": 0.6575064551825894,
"repo_name": "google/trax",
"id": "3825a856a902d8abc6a297d4c3507acc658f7252",
"size": "6019",
... |
import importlib
from selenium import webdriver
from SeleniumLibrary import BrowserManagementKeywords
from SeleniumLibrary.utils import is_truthy, is_falsy
from SeleniumLibrary.keywords.webdrivertools import WebDriverCreator, SeleniumOptions
from msedge.selenium_tools import Edge as EdgePluginDriver
class EdgePlugin(... | {
"content_hash": "bb523cead90537d9d5f759cfd4ec5638",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 96,
"avg_line_length": 45.666666666666664,
"alnum_prop": 0.6884124087591241,
"repo_name": "Accruent/zoomba",
"id": "ee2ca5e12d07f7b9d04c5527b6f491ca0e51f25c",
"size": "2192... |
import _plotly_utils.basevalidators
class OpacityValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="opacity", parent_name="isosurface", **kwargs):
super(OpacityValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "b9d583c444da07b413f2debfb5df2a52",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 82,
"avg_line_length": 36.61538461538461,
"alnum_prop": 0.592436974789916,
"repo_name": "plotly/plotly.py",
"id": "a3357c3ab92e77d2c7b98d8e2f6d7ac18d4eaa28",
"size": "476",... |
"""Utilities for testing `LinearOperator` and sub-classes."""
import abc
import itertools
import numpy as np
from tensorflow.python.eager import backprop
from tensorflow.python.eager import context
from tensorflow.python.eager import def_function
from tensorflow.python.framework import composite_tensor
from tensorfl... | {
"content_hash": "fc645627594966d198df5b8488052058",
"timestamp": "",
"source": "github",
"line_count": 1367,
"max_line_length": 106,
"avg_line_length": 35.72640819312363,
"alnum_prop": 0.6507637495392932,
"repo_name": "paolodedios/tensorflow",
"id": "bb6fce07f3244fa49f8ce9d546bf49aca6babfe4",
"siz... |
from django import template
from teme.constants import MAX_RATING_STAR_VALUE
register = template.Library()
@register.simple_tag
def get_stars(stars):
full_star = '<span class="glyphicon glyphicon-star"></span>'
empty_star = '<span class="glyphicon glyphicon-star-empty"></span>'
return stars * full_star... | {
"content_hash": "e8c4cfe44f171e438ed88ae62c49113b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 75,
"avg_line_length": 28.307692307692307,
"alnum_prop": 0.717391304347826,
"repo_name": "palcu/mds",
"id": "c90f71be2b5506eee71f92576a2f9abed1d3bcd2",
"size": "368",
"bi... |
try:
import uio
print("uio")
except ImportError:
print("no")
| {
"content_hash": "4656a50cad62744811c397efeab64bef",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 19,
"avg_line_length": 14.6,
"alnum_prop": 0.6027397260273972,
"repo_name": "pozetroninc/micropython",
"id": "1031cba90914c243214043a5ff013bd146c3da48",
"size": "73",
"bin... |
import angr
from . import io_file_data_for_arch
######################################
# fwrite
######################################
class fwrite(angr.SimProcedure):
#pylint:disable=arguments-differ
def run(self, src, size, nmemb, file_ptr):
# TODO handle errors
data = self.state.memory.lo... | {
"content_hash": "39fb62d977d504790a6a585cedd87e37",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 75,
"avg_line_length": 30.789473684210527,
"alnum_prop": 0.5692307692307692,
"repo_name": "Ruide/angr-dev",
"id": "db9b14241ad165fb81e546c5bbf40d969e023764",
"size": "585",... |
from camog._csv import load, loads
| {
"content_hash": "5e409ff78823cfe3b687c532d886be96",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 34,
"avg_line_length": 35,
"alnum_prop": 0.7714285714285715,
"repo_name": "walshb/camog",
"id": "22810dbc6cbbf3cf8e7ef6987d3334ad69ef507a",
"size": "609",
"binary": false,... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: hpilo_facts
version_added: "2.3"
author: Dag Wieers (@dagw... | {
"content_hash": "07d247f1e47582913ec2ba68e9a1eacd",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 118,
"avg_line_length": 31.653225806451612,
"alnum_prop": 0.5937579617834395,
"repo_name": "SergeyCherepanov/ansible",
"id": "cbc520ebb706fe925783a9b75b50c71994c9c1d7",
"s... |
"""
Given a non-empty array of integers, return the k most frequent elements.
For example,
Given [1,1,1,2,2,3] and k = 2, return [1,2].
"""
class Solution(object):
def topKFrequent(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: List[int]
"""
keys = l... | {
"content_hash": "ad602ffdc2ee96787573c53d18b4777d",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 87,
"avg_line_length": 26.391304347826086,
"alnum_prop": 0.5354200988467874,
"repo_name": "yingcuhk/LeetCode",
"id": "540bdf9e4e25b1ef9fb8e1978bb828f18f006ac2",
"size": "60... |
from __future__ import print_function
import json
import matplotlib.pyplot as plt
import numpy as np
with open("../data/results/scores.json", 'r') as f:
scores = json.load(f)
with open("../data/results/distances.json", 'r') as f:
distances = json.load(f)
with open("../data/results/times.json", 'r') as f:
t... | {
"content_hash": "3f9b1023498813e22d9d84f3b6ef9127",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 79,
"avg_line_length": 35.36220472440945,
"alnum_prop": 0.5838343353373413,
"repo_name": "yarbroughw/JMDE",
"id": "8d08503bce8a8b4fccea8eb270d7880af0dae710",
"size": "4491... |
import unittest
import random
from scapy.packet import Raw
from scapy.layers.l2 import Ether, Dot1Q
from scapy.layers.inet import IP, UDP
from framework import VppTestCase, VppTestRunner
from util import Host, ppp
from vpp_sub_interface import VppDot1QSubint, VppDot1ADSubint
class TestL2bd(VppTestCase):
""" L2B... | {
"content_hash": "e7b3a3535d061add5d00a08937280a82",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 79,
"avg_line_length": 39.517605633802816,
"alnum_prop": 0.5553773500846476,
"repo_name": "licko/vpp-1701-licko",
"id": "50720e64cd8dd25e44b9aa86e3e840b8f02547a0",
"size":... |
import json
from django.contrib.postgres import lookups
from django.contrib.postgres.forms import SimpleArrayField
from django.contrib.postgres.validators import ArrayMaxLengthValidator
from django.core import checks, exceptions
from django.db.models import Field, IntegerField, Transform
from django.db.models.lookups ... | {
"content_hash": "6ccb5d294e226f822af9e6b597dbb4bf",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 100,
"avg_line_length": 33.398648648648646,
"alnum_prop": 0.5751567873760874,
"repo_name": "auready/django",
"id": "15cbf5e45e8be050ee6baaee6cc3f0bfa09457db",
"size": "988... |
from celery import shared_task
from django.contrib.contenttypes.models import ContentType
from matches.models import Squad, MatchPilot, MatchUpgrade, Match
from xwing_data.models import Pilot, Upgrade, StatisticSet, Ship, Faction
@shared_task(bind=True, max_retries=3)
def delete_all_data(self):
Squad.objects.all... | {
"content_hash": "a20eeac1041b84cb005db738cc085031",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 118,
"avg_line_length": 34.66265060240964,
"alnum_prop": 0.5074730622175878,
"repo_name": "sheepeatingtaz/xwingoverlayer",
"id": "0088a7a07d53a5621da7e34af27643fb9e926027",
... |
import time
import numpy as np
from scipy.linalg import eigh
from scipy.sparse.linalg import LinearOperator, eigsh
# correlation kernel/function parameters
sigma = 0.8 # variance or sill
L = 5000 # correlation length
# grid parameters
nrow = 19
ncol = 63
Lx = 1000.
Ly = 900.
num_eig = 10
# initialise swig wrapped c... | {
"content_hash": "66412b4b670f19722ab7b707e99b2bef",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 118,
"avg_line_length": 24.493333333333332,
"alnum_prop": 0.5993467610234078,
"repo_name": "mjasher/computation",
"id": "0436ccd43c5f8ed1f0f68b845c0f59ff83d6bb60",
"size": ... |
from pprint import pprint
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db import connection
from django.db.models import Sum, Value
from django.db.models.functions import Coalesce
from django.shortcuts import render
from django.urls import reverse
from django.views import View
from geral.func... | {
"content_hash": "74d25b6b12375ac31aed1b4ee6c54a01",
"timestamp": "",
"source": "github",
"line_count": 383,
"max_line_length": 79,
"avg_line_length": 36.64751958224543,
"alnum_prop": 0.4791963522371046,
"repo_name": "anselmobd/fo2",
"id": "a22354fb8634cdbc22963eedf5a900c7ac9d1051",
"size": "14069"... |
from __future__ import annotations
import json
import re
import shutil
from datetime import datetime
from pathlib import Path
from string import capwords
from typing import (Callable, Iterable, NamedTuple, Optional, TypedDict, Union,
cast)
from libsyntyche import terminal
from libsyntyche.cli impo... | {
"content_hash": "5ba89462888d5b33e92fcf3386e0bf32",
"timestamp": "",
"source": "github",
"line_count": 683,
"max_line_length": 96,
"avg_line_length": 38.69106881405564,
"alnum_prop": 0.5545674714296526,
"repo_name": "nycz/sapfo",
"id": "3ea166909f68bb876f221df8372479bbc0a0a829",
"size": "26426",
... |
"""Definition of grr_export plugin."""
import threading
import time
import logging
from grr.lib import data_store
from grr.lib import export
from grr.lib import output_plugin as output_plugin_lib
from grr.lib import rdfvalue
from grr.lib import registry
from grr.lib import threadpool
from grr.lib import utils
cl... | {
"content_hash": "86a278d3df8e4285700c15f28be2a4f8",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 80,
"avg_line_length": 34.46788990825688,
"alnum_prop": 0.7017567207878627,
"repo_name": "destijl/grr",
"id": "ba827642ec3e4a1542b3f3c8696813037ec5d77d",
"size": "7536",
... |
from __future__ import print_function
from benchpress.benchmarks import util
# if Bohrium is installed we use its convolve else we use the convolve from SciPy
try:
raise ImportError
import bohrium as bh
convolveNd = bh.convolve_scipy
except ImportError:
import scipy
from scipy import signal
con... | {
"content_hash": "9cbaa0c024da73e72fe3105498b7c3ec",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 109,
"avg_line_length": 29.94736842105263,
"alnum_prop": 0.655536028119508,
"repo_name": "bh107/benchpress",
"id": "9bb97aae19ca49d3a9d221789585d340e8fd5175",
"size": "1138... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from tensorflow.python.platform import tf_logging as logging
class SamplingOpsTest(tf.test.TestCase):
def testGraphBuildAssertionFailures(self):
val = [tf.zer... | {
"content_hash": "fd1c4e3cf143f5d78d02646fb651d891",
"timestamp": "",
"source": "github",
"line_count": 371,
"max_line_length": 123,
"avg_line_length": 37.57142857142857,
"alnum_prop": 0.6354831766984719,
"repo_name": "Lab603/PicEncyclopedias",
"id": "35b56bdfa1a0c8871344627df9be12759a0a3fe5",
"siz... |
import uuid
from keystone.common import sql
from keystone.contrib import revoke
from keystone.contrib.revoke import model
class RevocationEvent(sql.ModelBase, sql.ModelDictMixin):
__tablename__ = 'revocation_event'
attributes = model.REVOKE_KEYS
# The id field is not going to be exposed to the outside w... | {
"content_hash": "1321e808ef82949463c23d565228f3dd",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 73,
"avg_line_length": 38.619565217391305,
"alnum_prop": 0.6234168308471714,
"repo_name": "UTSA-ICS/keystone-kerberos",
"id": "8d50ac6cc0be0dc29695b97b5e04e6e27af9a00a",
"s... |
""" support for providing temporary directories to test functions. """
import pytest, py
from _pytest.monkeypatch import monkeypatch
class TempdirHandler:
def __init__(self, config):
self.config = config
self.trace = config.trace.get("tmpdir")
def ensuretemp(self, string, dir=1):
""" ... | {
"content_hash": "75384fad77edb1e134f04f995077f1bb",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 76,
"avg_line_length": 35.64705882352941,
"alnum_prop": 0.6117986798679867,
"repo_name": "ktan2020/legacy-automation",
"id": "3907c92b73f489b07e5c0cb811fe4663fc0f311f",
"si... |
from myclasses import Logger
import unittest
__author__ = 'kinpa200296'
test_res = '''say_hello() = Hello, world!
say_hello(name=Bob) = Hello, Bob!
calc_sum(10, 20) = 30
calc_sum(3, 4) = 7
say_age(18) = John is 18.
say_age(18, name=Bob) = Bob is 18.'''
class Dummy(Logger):
@staticmethod
def say_hello(name=N... | {
"content_hash": "f9fbea5911a9609f9f88f2d6fbaef2f3",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 63,
"avg_line_length": 23.67241379310345,
"alnum_prop": 0.5957756737072105,
"repo_name": "kinpa200296/python_labs",
"id": "b3f229c2413953409c380445f612a92576fff5e3",
"size"... |
""":mod:`robot.api` package exposes the public APIs of Robot Framework.
Unless stated otherwise, the APIs exposed in this package are considered
stable, and thus safe to use when building external tools on top of
Robot Framework. Notice that all parsing APIs were rewritten in Robot
Framework 3.2.
Currently exposed AP... | {
"content_hash": "71397acb95ab01e9626b56a7a2e0338f",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 85,
"avg_line_length": 46.046875,
"alnum_prop": 0.7675602307431286,
"repo_name": "HelioGuilherme66/robotframework",
"id": "7c2eb459ec39c1bbb09ae52eb07a6bbef89bd2f5",
"size"... |
from __future__ import unicode_literals
from __future__ import print_function
import sys
import os
import re
from argparse import ArgumentParser
try:
# Python 3
from io import StringIO
except ImportError:
# Python 2
from cStringIO import StringIO
def getType(v):
if hasattr(v, "decl_type"):
... | {
"content_hash": "b057a4116df1a332858b7cbe69a4a1ac",
"timestamp": "",
"source": "github",
"line_count": 999,
"max_line_length": 90,
"avg_line_length": 38.905905905905904,
"alnum_prop": 0.5414876373272957,
"repo_name": "PlutoniumHeart/ITK",
"id": "f41e99d7129a1d8c92acd81f310309f0fa22440c",
"size": "... |
"""
@authors: Sergei Garbuzov
@status: Development
@version: 1.1.0
notification.py: Parser for notification events received from Controller
"""
import os
import re
import xmltodict
from pybvc.common.utils import dbg_print
yang_namespace_to_prefix_map = {
'urn:opendaylight:inventory': 'inv',
'urn:opendayli... | {
"content_hash": "1ccd899083d4d8dd0606004101e7afd4",
"timestamp": "",
"source": "github",
"line_count": 528,
"max_line_length": 77,
"avg_line_length": 30.09090909090909,
"alnum_prop": 0.47878902316213495,
"repo_name": "jebpublic/pybvc",
"id": "5c25e16b84a72770d11bf8b5345663afd373d484",
"size": "174... |
import logging
import os.path
import sys
import time
import tempfile
mm_start = time.clock()
logging.raiseExceptions = False
logging.basicConfig(level=logging.INFO)
logging_handler = logging.FileHandler(tempfile.gettempdir()+"/mm.log")
#suds log setup
suds_logger = logging.getLogger('suds.client')
suds_logger.setLe... | {
"content_hash": "f77e72c71eb16b0664e6ad1d6a7febca",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 70,
"avg_line_length": 22.34090909090909,
"alnum_prop": 0.7232960325534079,
"repo_name": "bfagundez/apex_paperboy",
"id": "96a95d9be47cf9189a3d92ac0666b189cb5347f2",
"size"... |
import datetime
import hashlib
import itertools
import os
import json
import random
import tempfile
from zipfile import ZipFile, ZIP_DEFLATED
from django.conf import settings
import pydenticon
import requests
from lib.video.tasks import resize_video
import mkt
from mkt.constants.applications import DEVICE_CHOICES_I... | {
"content_hash": "b183c4cff6fa198e4d8af7713bc95760",
"timestamp": "",
"source": "github",
"line_count": 441,
"max_line_length": 79,
"avg_line_length": 39.74149659863946,
"alnum_prop": 0.5487276047015862,
"repo_name": "eviljeff/zamboni",
"id": "b3dc8de0cde870f47c344bca72619cfd093cb4fa",
"size": "175... |
""" CSW request and response processor """
from __future__ import (absolute_import, division, print_function)
import base64
import inspect
import warnings
import StringIO
import random
from urllib import urlencode
from urllib2 import Request, urlopen
from owscapable.util import OrderedDict
from owscapable.etree imp... | {
"content_hash": "f14b296e5ad566d12d00ba1fe1403b36",
"timestamp": "",
"source": "github",
"line_count": 804,
"max_line_length": 268,
"avg_line_length": 43.49626865671642,
"alnum_prop": 0.606731291641646,
"repo_name": "b-cube/OwsCapable",
"id": "f72b66e8e4c78293736c0c00b94f7ce5be92fa9b",
"size": "35... |
"""
Plotting terminal based scatterplots
"""
from __future__ import print_function
import csv
import sys
import optparse
from .utils.helpers import *
from .utils.commandhelp import scatter
def get_scale(series, is_y=False, steps=20):
min_val = min(series)
max_val = max(series)
scaled_series = []
for ... | {
"content_hash": "85853d8a241681d82f5c1d207332d6af",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 98,
"avg_line_length": 31.980582524271846,
"alnum_prop": 0.5440194292653309,
"repo_name": "asbjorn/bashplotlib",
"id": "ddaf3cc323f316425ef8e9fcc4e93fcd2fd04617",
"size": ... |
from OpenGL.arrays import vbo
from OpenGL.GL import *
from OpenGL.GL import shaders
import numpy
from numpy import array
import pyglfw.pyglfw as fw
import sys
def main():
### Initialize
fw.init()
### Hints
# ok, that doesn't work... can't get context for that
# fw.Window.hint(stereo=True)
### M... | {
"content_hash": "b2cf92331d8c4e3311f0b163c1483362",
"timestamp": "",
"source": "github",
"line_count": 304,
"max_line_length": 199,
"avg_line_length": 25.0625,
"alnum_prop": 0.652710329439559,
"repo_name": "lhl/vrdev",
"id": "223603f59d3555cca5555a47567c782db9f422ab",
"size": "7642",
"binary": f... |
from flask_restplus import Namespace, Resource
from willstores.service import ProductService
from willstores.util import Marshalling, Parsing
from willstores.controller import ErrorHandler
kindAPI = Namespace("Kind", description="Product kind related operations.", url_prefix="/kind")
marshalling = Marshalling(kindAP... | {
"content_hash": "504772ab8ee422b2a0cc6a9f4e2ee0d2",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 114,
"avg_line_length": 41.90277777777778,
"alnum_prop": 0.6589327146171694,
"repo_name": "willrogerpereira/willbuyer",
"id": "b640202bace864c8fdbb6ab34110a5ec944a0787",
"s... |
"""
SVDSuperimposer finds the best rotation and translation to put
two point sets on top of each other (minimizing the RMSD). This is
eg. useful to superimpose crystal structures. SVD stands for singular
value decomposition, which is used in the algorithm.
"""
from __future__ import print_function
from numpy import d... | {
"content_hash": "c909190809c058954de5473382ca4078",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 76,
"avg_line_length": 30.55757575757576,
"alnum_prop": 0.6025386751289171,
"repo_name": "poojavade/Genomics_Docker",
"id": "f14c112cd0a972d8fe68c3efe9cc08af2cf72188",
"si... |
"""
XBlock Courseware Components
"""
# For backwards compatability, provide the XBlockMixin in xblock.fields
# without causing a circular import
from __future__ import absolute_import, division, print_function, unicode_literals
import codecs
import os
import warnings
import xblock.core
import xblock.fields
class ... | {
"content_hash": "48e2f7628bcd35f0975901a468a75dd5",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 104,
"avg_line_length": 28.142857142857142,
"alnum_prop": 0.7401015228426396,
"repo_name": "mitodl/XBlock",
"id": "fe100d755859caf5bc42e08edbc73f2716e46b59",
"size": "985",... |
''' Perforce related commands. '''
import abc
import shutil
import nimp.command
import nimp.utils.p4
def _is_p4_available():
if shutil.which('p4') is None:
return False, ('p4 executable was not found on your system, check your'
'installation.')
return True, ''
class P4Command(... | {
"content_hash": "4945ba19161b46e55a9de0cbc783c253",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 113,
"avg_line_length": 32.54054054054054,
"alnum_prop": 0.5674833887043189,
"repo_name": "dontnod/nimp",
"id": "9285b8f28db080373c057db524d7f1b21ab16c3d",
"size": "5949",... |
"""
FILE: chat_thread_client_sample.py
DESCRIPTION:
These samples demonstrate create a chat thread client, to update
chat thread, get chat message, list chat messages, update chat message, send
read receipt, list read receipts, delete chat message, add participants, remove
participants, list participant... | {
"content_hash": "a61f4f85689ab24ad84a6fb61116f766",
"timestamp": "",
"source": "github",
"line_count": 389,
"max_line_length": 126,
"avg_line_length": 41.30848329048843,
"alnum_prop": 0.6631402078536313,
"repo_name": "Azure/azure-sdk-for-python",
"id": "1d082a08426e0d1d4f93c62f4baf8ae7fed5ee04",
"... |
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.5.1-pre.0
Contact: [email protected]
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
import typing # noqa:... | {
"content_hash": "b90d799cafa024142d80f854caceba48",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 85,
"avg_line_length": 26.87421383647799,
"alnum_prop": 0.6288322021998596,
"repo_name": "cliffano/swaggy-jenkins",
"id": "76c3681a9e61fd19bbf0607aabb049d4b6e71b9f",
"size... |
import numpy as np
class TikzGraph():
def __init__(self, i_font_scaler, i_global_scale, i_filename):
self.font_scaler = i_font_scaler
self.global_scale = i_global_scale
self.filename = i_filename
###################################### File/Picture operations
def initPictur... | {
"content_hash": "3687d888c828babc4f9716e43307d49b",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 151,
"avg_line_length": 46.78089887640449,
"alnum_prop": 0.5082862975861655,
"repo_name": "singleswitch/ticker",
"id": "8607367a9529c5aef0288a50929a9beb41b89a1d",
"size": ... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import division
from abc import ABCMeta, abstractmethod
from sqlalchemy import create_engine, exc, event, MetaData
from sqlalchemy.orm import sessionmaker
from sqlalchemy.pool import Po... | {
"content_hash": "1c4dea251fb665d3a3c4ec4fbd82d18d",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 105,
"avg_line_length": 32.34782608695652,
"alnum_prop": 0.667002688172043,
"repo_name": "holycattle/angular-momentum",
"id": "fed2a59c0f682d0fe924c508c538527f8dbfdee4",
"s... |
"""JSON implementations of repository objects."""
# pylint: disable=no-init
# Numerous classes don't require __init__.
# pylint: disable=too-many-public-methods,too-few-public-methods
# Number of methods are defined in specification
# pylint: disable=protected-access
# Access to protected methods allowed i... | {
"content_hash": "617ffb47a8d6c8eb50b688caf942d1c0",
"timestamp": "",
"source": "github",
"line_count": 2319,
"max_line_length": 328,
"avg_line_length": 42.91418714963346,
"alnum_prop": 0.6500030145300347,
"repo_name": "mitsei/dlkit",
"id": "23ff09c667159e2d8dc147ad52e156dfe75a1134",
"size": "99518... |
# pylint: disable=missing-function-docstring
"""Test for diff_cover.diff_quality - main"""
import pytest
from diff_cover.diff_quality_tool import main, parse_quality_args
def test_parse_with_html_report():
argv = ["--violations", "pycodestyle", "--html-report", "diff_cover.html"]
arg_dict = parse_quality_... | {
"content_hash": "004670b9226cf871e8eeb8b1f8014fff",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 83,
"avg_line_length": 27.326666666666668,
"alnum_prop": 0.6103927787265186,
"repo_name": "Bachmann1234/diff-cover",
"id": "a201b9a153c18d2af0e08fa3bb9e0b897b98647e",
"siz... |
import unittest
from oslo.config import cfg
from gate.common import log as logging
from gate.process.pipeline import Pipeline
class FakeModule(object):
def __init__(self, func):
self.func = func
def __call__(self):
pass
def process(self, bundle):
return self.func(bundle)
cla... | {
"content_hash": "14d19a4cc0e8b263afd5c0a27ec5b0ef",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 69,
"avg_line_length": 21.236842105263158,
"alnum_prop": 0.5929368029739777,
"repo_name": "vindeka/gate",
"id": "ac7f108a78606ce27edd63c6883d615ab64e2e07",
"size": "2197",
... |
from beritest_tools import BaseBERITestCase
from nose.plugins.attrib import attr
class test_cp2_x_csetoffset_sealed(BaseBERITestCase):
@attr('capabilities')
def test_cp2_x_csetoffset_sealed_1(self):
'''Test that CSetOffset on a sealed capability does not change the offsrt'''
self.assertRegisterEqual(... | {
"content_hash": "3a51d881c45636ccd4e6e330d9dd3fd9",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 122,
"avg_line_length": 48.73684210526316,
"alnum_prop": 0.7332613390928726,
"repo_name": "8l/beri",
"id": "52a23365f7fcf83a4863e9b7c0c3f29e1a17dc06",
"size": "2058",
"bi... |
from __future__ import absolute_import
from __future__ import unicode_literals
from flask.ext.sqlalchemy import SQLAlchemy
from keg.signals import testing_run_start, db_init_pre, db_init_post, db_clear_pre, db_clear_post
from keg.utils import visit_modules
class KegSQLAlchemy(SQLAlchemy):
def init_app(self, ap... | {
"content_hash": "6f159cbc1f9398c900598111c51b37c9",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 100,
"avg_line_length": 35.48245614035088,
"alnum_prop": 0.657601977750309,
"repo_name": "nZac/keg",
"id": "44e3944d5ab9014b8a8966dbea588da95b2a0226",
"size": "4045",
"b... |
import logging
from datetime import datetime
import click
from loqusdb.utils.migrate import migrate_database
from loqusdb.commands.cli import cli as base_command
LOG = logging.getLogger(__name__)
@base_command.command("migrate", short_help="Migrate an old loqusdb instance")
@click.pass_context
def migrate(
ctx... | {
"content_hash": "dbe0d9a25af4d6ee6cb071b9db3ee05b",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 98,
"avg_line_length": 24.703703703703702,
"alnum_prop": 0.704647676161919,
"repo_name": "moonso/loqusdb",
"id": "8bb9fcf500d8dee2974fe66a4ccdc8922892fa66",
"size": "667",
... |
"""A base class for contents managers."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from fnmatch import fnmatch
import itertools
import json
import os
import re
from tornado.web import HTTPError
from .checkpoints import Checkpoints
from traitlets.config.con... | {
"content_hash": "e5a921fd60110e3264ac7b0c8b77283d",
"timestamp": "",
"source": "github",
"line_count": 471,
"max_line_length": 93,
"avg_line_length": 31.422505307855626,
"alnum_prop": 0.5776351351351351,
"repo_name": "fzheng/codejam",
"id": "76db41c0bfda78d8865403de9f2f7d19132346a3",
"size": "1480... |
"""is64bit.Python() --> boolean value of detected Python word size. is64bit.os() --> os build version"""
import sys
def Python():
if sys.platform == 'cli': #IronPython
import System
return System.IntPtr.Size == 8
else:
try:
return sys.maxsize > 2147483647
except Attr... | {
"content_hash": "39e6b341b525903005b972372deb5304",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 105,
"avg_line_length": 35.15151515151515,
"alnum_prop": 0.5853448275862069,
"repo_name": "ArcherSys/ArcherSys",
"id": "33c3ead6dc2bdb917026aa82a1161d900ccad5d2",
"size": "... |
from modelcluster.fields import ParentalKey
from wagtail.wagtailadmin.edit_handlers import (
FieldPanel, FieldRowPanel,
InlinePanel, MultiFieldPanel
)
from wagtail.wagtailcore.fields import RichTextField
from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField
from wagtail.wagtailforms.edit_... | {
"content_hash": "6ee84dd4252e6f750b11af3dc5c7c788",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 76,
"avg_line_length": 34.588235294117645,
"alnum_prop": 0.689625850340136,
"repo_name": "joecheng511/try-wagtail",
"id": "affec1ad9de7ae67f56cce5e519b72d0e089404e",
"size"... |
import os, time, webapp2, jinja2
import session, logging, json
import settings
from inspect import currentframe, getframeinfo
from google.appengine.api import users
from google.appengine.ext import ndb
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), '... | {
"content_hash": "4ef8957827450768116b3251c5575048",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 126,
"avg_line_length": 40.45614035087719,
"alnum_prop": 0.5900549291702805,
"repo_name": "datasciencedev/locality-sensitive-hashing",
"id": "010199825af6fb757898cf5bec3f8fd... |
"""Flags and helpers for the compute routes commands."""
from googlecloudsdk.command_lib.compute import flags as compute_flags
HOSTS_ARG = compute_flags.ResourceArgument(
resource_name='host',
completion_resource_id='compute.hosts',
plural=True,
zonal_collection='compute.hosts')
| {
"content_hash": "1c87535239affb144edd50e3a838bc1d",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 69,
"avg_line_length": 29.9,
"alnum_prop": 0.745819397993311,
"repo_name": "Sorsly/subtle",
"id": "f8dcaee999ebc8d736500b062da70e905a40d30d",
"size": "894",
"binary": fal... |
from .orion import parse_orion
| {
"content_hash": "3bc1ca3627639a4dba8952916858c555",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 30,
"avg_line_length": 31,
"alnum_prop": 0.8064516129032258,
"repo_name": "astrofrog/hyperion",
"id": "e62a25962c26e93b18a28ed5fccdc965fc0e07e8",
"size": "31",
"binary": f... |
import json
from db_conn import redis_db
class TicTacToe(object):
def __init__(self):
self.winning_combos = []
# Define the winning combinations by row
for row in range(3):
win_set = set()
for col in range(3):
win_set.add(str(row) + "," + str(col))
... | {
"content_hash": "c089a069f02b638b98dec14e1d0b5887",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 87,
"avg_line_length": 39.72282608695652,
"alnum_prop": 0.5386509782459981,
"repo_name": "sampathweb/game-server",
"id": "60cf0d23a7c3bca245830303f160e7e478623eb3",
"size"... |
"""ResNet model for classifying images from Imagenet dataset.
Support single-host training with one or multiple devices.
ResNet as proposed in:
Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun
Deep Residual Learning for Image Recognition. arXiv:1512.03385
"""
from __future__ import division
from __future__ import p... | {
"content_hash": "4d477a42a268c5c70c21f81b71563e0c",
"timestamp": "",
"source": "github",
"line_count": 463,
"max_line_length": 121,
"avg_line_length": 32.55507559395248,
"alnum_prop": 0.637298480727128,
"repo_name": "ucloud/uai-sdk",
"id": "52b59132f6d538d1752cd64dcdec79b587acd3c3",
"size": "15762... |
"""
A UNIX SSH server.
"""
import fcntl
import grp
import os
import pty
import pwd
import socket
import struct
import time
import tty
from zope.interface import implementer
from twisted.conch import ttymodes
from twisted.conch.avatar import ConchUser
from twisted.conch.error import ConchError
from twisted.conch.ls i... | {
"content_hash": "0d421f24399bc1d1c3f0a200e0e48b67",
"timestamp": "",
"source": "github",
"line_count": 530,
"max_line_length": 77,
"avg_line_length": 30.432075471698113,
"alnum_prop": 0.5769111538223076,
"repo_name": "bdh1011/wau",
"id": "58173a76b4a48237244d4daef828eff934f2f33e",
"size": "16202",... |
import socket,select
host="127.0.0.1"
port=9999
sever_address=(host,port)
fd=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
fd.connect(sever_address)
while 1:
cmd=input("client : ").encode("utf-8")
#print(cmd)
if cmd==b'':
print("don't allow empty,please retry!\n")
continue
fd.send(cmd)
#buff=fd.recv(1024).... | {
"content_hash": "853b4a1d63dc2e2aa52620e2e4b5e7ca",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 51,
"avg_line_length": 22.5625,
"alnum_prop": 0.6952908587257618,
"repo_name": "insertion/socks0_python",
"id": "dd2dea8a03457b77d3fbc08ffee6ba440e5eb740",
"size": "380",
... |
import logging
import boto3
logger = logging.getLogger(__name__)
SNS_CLIENT = None
def get_client():
global SNS_CLIENT
if not SNS_CLIENT:
SNS_CLIENT = boto3.client('sns')
return SNS_CLIENT
def send_sns_message(TopicArn=None, Message=None):
sns_client = get_client()
return sns_client.... | {
"content_hash": "86f0a92b0be3d3910ab7007e3a401a8d",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 109,
"avg_line_length": 23.150943396226417,
"alnum_prop": 0.5998370008149959,
"repo_name": "bepress/xavier",
"id": "0807808fe7fe3ed7afbb455fc22b671ca5fce662",
"size": "1227... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from textwrap import dedent
from mock import MagicMock
from pants.backend.codegen.targets.java_thrift_library import JavaThriftLibrary
from pants.backend.jv... | {
"content_hash": "021c2d0f11a41e20bce168ad9031a1a1",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 93,
"avg_line_length": 34.83098591549296,
"alnum_prop": 0.6637687019813991,
"repo_name": "manasapte/pants",
"id": "d73bace5fcbc721be23df8776264c5c53cd173dd",
"size": "5093... |
from testtools import TestCase
from kmip.core.factories.keys import KeyFactory
from kmip.core.factories.secrets import SecretFactory
from kmip.core.factories.attributes import AttributeFactory
from kmip.core import attributes as attr
from kmip.core.attributes import ApplicationData
from kmip.core.attributes import Ap... | {
"content_hash": "a1ce17503c1a3aef68dc0f169b1ab34e",
"timestamp": "",
"source": "github",
"line_count": 1746,
"max_line_length": 79,
"avg_line_length": 53.379152348224515,
"alnum_prop": 0.5499248927038627,
"repo_name": "callidus/PyKMIP",
"id": "514555705e42a930e7be1dddf0cf3c353c13438d",
"size": "93... |
from functools import wraps
from typing import Callable, Optional, Sequence, Tuple, TypeVar, cast
from flask import Response
from airflow.api_connexion.exceptions import PermissionDenied, Unauthenticated
from airflow.utils.airflow_flask_app import get_airflow_app
T = TypeVar("T", bound=Callable)
def check_authenti... | {
"content_hash": "57a025f108bd71cb8c3ab6f689d06e7a",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 100,
"avg_line_length": 37.23684210526316,
"alnum_prop": 0.7053003533568905,
"repo_name": "Acehaidrey/incubator-airflow",
"id": "6c84181f91bd3755a819d752b3a93fa4f1ca1f44",
... |
"""Tests for tensorflow.ops.argmax_op."""
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.python.eager import context
from tensorflow.python.framework import constant_op
from tensorf... | {
"content_hash": "acfb07f38081f066b509f765bce8a58b",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 71,
"avg_line_length": 35.225563909774436,
"alnum_prop": 0.6723585912486659,
"repo_name": "annarev/tensorflow",
"id": "ddbe514fa9d20bbb4fbb00d208cb0cb405944b00",
"size": "... |
from msrest.pipeline import ClientRawResponse
from .. import models
class DictionaryOperations(object):
"""DictionaryOperations operations.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializ... | {
"content_hash": "2cc41af0b5d363456a80efa115b1f0ca",
"timestamp": "",
"source": "github",
"line_count": 2839,
"max_line_length": 84,
"avg_line_length": 36.152518492426914,
"alnum_prop": 0.6227481317653478,
"repo_name": "haocs/autorest",
"id": "3add16550863e9b0af28e7c02d8df344f1f652cc",
"size": "103... |
from __future__ import unicode_literals
from django.db.models import F
from django.db.models import Q
from machina.core.db.models import get_model
from machina.core.loading import get_class
Forum = get_model('forum', 'Forum')
ForumReadTrack = get_model('forum_tracking', 'ForumReadTrack')
TopicReadTrack = get_model(... | {
"content_hash": "0aea88e67d54f64fd6f70ec9b3674798",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 100,
"avg_line_length": 46.12422360248447,
"alnum_prop": 0.6302181524373822,
"repo_name": "franga2000/django-machina",
"id": "105deda598c6a0969f1900295e295a74206ce3b3",
"s... |
import tkinter.tix as tk
from . import Settings
class InputFrame(tk.Frame):
def __init__(self, input_processor, label=None, master=None):
if label:
self.label = tk.Label(self, bg=Settings.bg_color, fg=Settings.text_color, text=label)
self.label.grid(row=0, column=0)
else:
... | {
"content_hash": "da220b6217e97b715a11e0c1a0c33e6b",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 124,
"avg_line_length": 35.12162162162162,
"alnum_prop": 0.5998460946517892,
"repo_name": "hidat/audio_pipeline",
"id": "5e9ad23b49570453b192ceaac99d2c63c9128510",
"size": ... |
"""
Copyright 2013 Rackspace
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... | {
"content_hash": "ada129c5a55bcadc77df33fc63a313ff",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 72,
"avg_line_length": 30.243243243243242,
"alnum_prop": 0.6961572832886506,
"repo_name": "rackerlabs/marconicafe",
"id": "20d1c1e00c9300ac220dc0aff8768864c26e3803",
"size"... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('gallery', '0002_galleryimage'),
]
operations = [
migrations.AlterUniqueTogether(
name='galleryimage',
unique_together=set([('gallery... | {
"content_hash": "0757b97fbc4aa257383faf26a089e8cd",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 55,
"avg_line_length": 20.647058823529413,
"alnum_prop": 0.5982905982905983,
"repo_name": "evanepio/dotmanca",
"id": "9a02df2952f65e414cc4aff7c48df777a797abe0",
"size": "42... |
"""A non-blocking, single-threaded TCP server."""
import errno
import os
import socket
import ssl
from tornado import gen
from tornado.log import app_log
from tornado.ioloop import IOLoop
from tornado.iostream import IOStream, SSLIOStream
from tornado.netutil import bind_sockets, add_accept_handler, ssl_wrap_socket
f... | {
"content_hash": "9a36e144844bcb8cfac9e80134ae6ed5",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 88,
"avg_line_length": 39.708463949843264,
"alnum_prop": 0.6019578432146523,
"repo_name": "bdarnell/tornado",
"id": "476ffc936f731d8c341c5e8c00b55f295ed3db60",
"size": "13... |
from module_base import ModuleBase
from module_mixins import NoConfigModuleMixin
import module_utils
import vtk
class testModule(NoConfigModuleMixin, ModuleBase):
def __init__(self, module_manager):
# initialise our base class
ModuleBase.__init__(self, module_manager)
# we'll be playing ... | {
"content_hash": "207ad1e18f348ac24be26dbff960078f",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 74,
"avg_line_length": 34.095238095238095,
"alnum_prop": 0.6229050279329609,
"repo_name": "nagyistoce/devide",
"id": "4f98b0b514f8f3fb15115649ca8baaa5070ec340",
"size": "21... |
from sklearn2sql_heroku.tests.regression import generic as reg_gen
reg_gen.test_model("SVR_linear" , "freidman3" , "duckdb")
| {
"content_hash": "2413ee0c3081bf2851db0c0f55806df0",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 66,
"avg_line_length": 31.75,
"alnum_prop": 0.7559055118110236,
"repo_name": "antoinecarme/sklearn2sql_heroku",
"id": "04ab2e297c928151c1e24371a6aae5396ab30e77",
"size": "12... |
"""
from "Deep Inside Convolutional Networks: Visualising Image Classification
Models and Saliency Maps"
http://arxiv.org/abs/1312.6034
"""
import theano
import theano.tensor as T
import treeano
import canopy
class SensitivityAnalysisOutput(canopy.handlers.NetworkHandlerImpl):
"""
adds a new input and outpu... | {
"content_hash": "585ab71ae350dbc9509c1a3b3ecfa2ad",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 77,
"avg_line_length": 33.92,
"alnum_prop": 0.592374213836478,
"repo_name": "nsauder/treeano",
"id": "3f6915fcb2daf43f128f5cf72b467cf6d48f17d7",
"size": "2544",
"binary":... |
"""
Quick bot for checking reciprocity of Wikidata-Kulturnav links.
@todo: Add some type of simple html output (e.g. bootstrap from json)
"""
import json
import os
import urllib2
import pywikibot.data.wikidataquery as wdquery
import wikidataStuff.wdqsLookup as wdqsLookup
import wikidataStuff.helpers as helpers
from ku... | {
"content_hash": "5b2a7f7473337e063c4ce4b20ce0f98c",
"timestamp": "",
"source": "github",
"line_count": 319,
"max_line_length": 79,
"avg_line_length": 29.79937304075235,
"alnum_prop": 0.5989901115085209,
"repo_name": "lokal-profil/wikidata_batches",
"id": "a323881e4a03334d366e6a7f9579af12de961fe8",
... |
"""Fichier contenant la classe Condition, détaillée plus bas."""
from .instruction import Instruction
from .parser import expressions
class Condition(Instruction):
"""Classe définissant une condition.
Une condition est une instruction optionnellement suivie d'une suite
de tests.
Par exemple ... | {
"content_hash": "9196a9b9c2e8e99d83d639602cf4e671",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 75,
"avg_line_length": 28.594059405940595,
"alnum_prop": 0.5020775623268698,
"repo_name": "vlegoff/tsunami",
"id": "2c87d72de0747a2295a88a5f30fae399feeb9a3d",
"size": "446... |
import datetime
import random
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import event
from sqlalchemy import ForeignKey
from sqlalchemy import func
from sqlalchemy import Integer
from sqlalchemy import orm
from sqlalchemy import select
from sqlalchemy import sql
from sqlalchemy impor... | {
"content_hash": "57279fe2c9060eafe42a874ab6822643",
"timestamp": "",
"source": "github",
"line_count": 1449,
"max_line_length": 79,
"avg_line_length": 33.32919254658385,
"alnum_prop": 0.5088830910672133,
"repo_name": "monetate/sqlalchemy",
"id": "571d2723200a2e09a4c1a8ba9e85f6ca5e069a6f",
"size": ... |
import warnings
from . import _common
__all__ = [ # noqa: F822
'central_diff_weights', 'derivative', 'ascent', 'face',
'electrocardiogram'
]
def __dir__():
return __all__
def __getattr__(name):
if name not in __all__:
raise AttributeError(
"scipy.misc.common is deprecated and ... | {
"content_hash": "14474f7413e55ea27b833b2746ef35f6",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 74,
"avg_line_length": 25.6,
"alnum_prop": 0.6015625,
"repo_name": "matthew-brett/scipy",
"id": "8e556e2963148a23a2e2b321b150b19b4d08832b",
"size": "797",
"binary": false... |
from __future__ import print_function
import sys
# If elftools is not installed, maybe we're running from the root or examples
# dir of the source distribution
try:
import elftools
except ImportError:
sys.path.extend(['.', '..'])
from elftools.common.py3compat import bytes2str
from elftools.elf.elffile import... | {
"content_hash": "c1cc1babd35bee5c0d134f31d08db640",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 80,
"avg_line_length": 37.91954022988506,
"alnum_prop": 0.6523188845104577,
"repo_name": "windyuuy/opera",
"id": "05d75642ac88fbc51600909441c012a86537ec0b",
"size": "3733",... |
import unittest
from ...compatibility import StringIO
from ...workbook import Workbook
class TestWriteSheet(unittest.TestCase):
"""
Test the Workbook _write_sheet() method.
"""
def setUp(self):
self.fh = StringIO()
self.workbook = Workbook()
self.workbook._set_filehandle(self... | {
"content_hash": "2e26d296a28708ed156dd1d13c014608",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 81,
"avg_line_length": 25.416666666666668,
"alnum_prop": 0.580327868852459,
"repo_name": "jkyeung/XlsxWriter",
"id": "f4c06f159cf9449b3f654e1f9b2b3d4fd7922b52",
"size": "13... |
'''Unit tests for grit.gather.rc'''
from __future__ import print_function
import os
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
import unittest
from six import StringIO
from grit.gather import rc
from grit import util
class RcUnittest(unittest.TestCas... | {
"content_hash": "c60c6e1dfc4dcb3231ebefd23892eea3",
"timestamp": "",
"source": "github",
"line_count": 367,
"max_line_length": 189,
"avg_line_length": 35.23160762942779,
"alnum_prop": 0.6211910286156226,
"repo_name": "scheib/chromium",
"id": "4f53b1269dba3bbf8a2059076c6614575f55c462",
"size": "131... |
from __future__ import absolute_import, unicode_literals
import uuid
from copy import copy
from collections import defaultdict
from django.conf.urls import url
from django.db import connections
from django.utils.translation import ugettext_lazy as _, ungettext_lazy as __
from debug_toolbar.panels import Panel
from d... | {
"content_hash": "af8833ca8dd4a077fff0f62ca5fc6a8e",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 100,
"avg_line_length": 36.93469387755102,
"alnum_prop": 0.5420488451762626,
"repo_name": "looker/sentry",
"id": "8eda4650c2fda2565745276ae6ad3aa1b19ef895",
"size": "9049"... |
"""Provides device automations for Cover."""
from __future__ import annotations
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_ABOVE,
CONF_BELOW,
CONF_CONDITION,
CONF_DEVICE_ID,
CONF_DOMAIN,
CONF_ENTITY_ID,
CONF_TYPE,
STATE_CLOSED,
STATE_CLOSING... | {
"content_hash": "d4a48048967ee5a970b8f2af0dd07767",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 85,
"avg_line_length": 32.71518987341772,
"alnum_prop": 0.628554846198491,
"repo_name": "jawilson/home-assistant",
"id": "cca608187a27ab6ef485609ef6e2bb4e1289cc5d",
"size"... |
from .voxel_dir import task_dir, storage_dir, image_dir, image_sha_dir, get_image_sha_dir, log_dir | {
"content_hash": "2dc0e42fcbd0182413ed44108e989e6a",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 98,
"avg_line_length": 98,
"alnum_prop": 0.7551020408163265,
"repo_name": "VisionSystemsInc/voxel_globe",
"id": "b4adc1a4e66c24e440460c768da7c254ce4a3a84",
"size": "98",
"... |
import abc
import collections
import uuid
class SessionBase(collections.UserDict):
def __init__(self, session_key=None):
super(SessionBase, self).__init__()
self.session_key = session_key
self.modified = False
def is_empty(self):
return not (self.session_key and self.data)
... | {
"content_hash": "f17f8ea4453a037d76354cd32173d623",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 72,
"avg_line_length": 27.772058823529413,
"alnum_prop": 0.5962404024357956,
"repo_name": "mozillazg/bustard",
"id": "1ebd7ee019cf79c890295ee8bc51ac580900fb13",
"size": "3... |
""""
Operators Adventure
Author: Ignacio Avas ([email protected])
"""
import codecs
import io
import sys
import unittest
from story.adventures import AdventureVerificationError, BaseAdventure
from story.translation import gettext as _
import ast
class TestOutput(unittest.TestCase):
"""Variables Adventure test"... | {
"content_hash": "5cff42c0c42ae1d9ad88b17924580f38",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 70,
"avg_line_length": 30.822580645161292,
"alnum_prop": 0.5944531658817374,
"repo_name": "sophilabs/py101",
"id": "615f307e98a418708956d48707aa87b89d148ae3",
"size": "1911... |
"""
Image cache class
Images that are stored in the cache folder will be stored in a folder whose
name is the image ID. In the event that an image is discovered to be no longer
used then a timestamp will be added to the image folder.
The timestamp will be a folder - this is due to the fact that we can use the
VMware A... | {
"content_hash": "4675658574c0c66de23172249463a5ea",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 78,
"avg_line_length": 44.706586826347305,
"alnum_prop": 0.6158585587998928,
"repo_name": "srajag/nova",
"id": "5051c210851071ccaa5d8e0ebb95744a6e53ad40",
"size": "8075",
... |
from __future__ import absolute_import
from __future__ import print_function
import getopt
import sys
import happy.HappyProcessStart
from happy.Utils import *
if __name__ == "__main__":
options = happy.HappyProcessStart.option()
try:
opts, args = getopt.getopt(sys.argv[1:], "hi:qt:se:",
... | {
"content_hash": "da047ddb071e3cb7dd7d9e9cbb2ffc78",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 86,
"avg_line_length": 28.583333333333332,
"alnum_prop": 0.5154518950437318,
"repo_name": "openweave/happy",
"id": "25fabb18f647281feb7c370816c48e6dc516a891",
"size": "2570... |
import unittest
import numpy as np
from pgmpy.factors.discrete import DiscreteFactor
from pgmpy.models import JunctionTree
from pgmpy.tests import help_functions as hf
class TestJunctionTreeCreation(unittest.TestCase):
def setUp(self):
self.graph = JunctionTree()
def test_add_single_node... | {
"content_hash": "a7b9a241c410d00f2ad508eb362dd75c",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 97,
"avg_line_length": 43.24183006535948,
"alnum_prop": 0.5488210399032648,
"repo_name": "kris-singh/pgmpy",
"id": "bb8a4942f95209920f591226b3c531ca40669aff",
"size": "661... |
import json
from datetime import datetime
from time import sleep
import numpy as np
from flask import Flask, Response, make_response, request
from bokeh.models import CustomJS, ServerSentDataSource
from bokeh.plotting import figure, output_file, show
# Bokeh related code
adapter = CustomJS(code="""
const result... | {
"content_hash": "7d8c81c99685f361b8b5b58bfadf09ae",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 84,
"avg_line_length": 29.542857142857144,
"alnum_prop": 0.6088007736943907,
"repo_name": "ericmjl/bokeh",
"id": "3768a0af43fb2e3d356053962d5cad4833df6b03",
"size": "2068",... |
"""Defines built-in ensemble methods and interfaces for custom ensembles."""
# TODO: Add more detailed documentation.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from adanet.ensemble.ensembler import Ensemble
from adanet.ensemble.ensembler import Ensem... | {
"content_hash": "a7f67ca2bd0cd6735ab726d637eb0f44",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 76,
"avg_line_length": 32.46153846153846,
"alnum_prop": 0.792259083728278,
"repo_name": "tensorflow/adanet",
"id": "cfb312cfea232b570e004df32781ae5fb12a3f57",
"size": "1869... |
import os
from setuptools import setup, find_packages
VERSION = '0.1.0'
setup(
namespace_packages = ['tiddlywebplugins'],
name = 'tiddlywebplugins.mongodb',
version = VERSION,
description = 'A ',
long_description=file(os.path.join(os.path.dirname(__file__), 'README')).read(),
author = 'Ben Paddock',
url = 'htt... | {
"content_hash": "6b51f9770c2a589924244c6fe52714e5",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 81,
"avg_line_length": 29.958333333333332,
"alnum_prop": 0.6773296244784422,
"repo_name": "pads/tiddlywebplugins.mongodb",
"id": "67315f73a7008f4fd01ccddace022d8e07556150",
... |
from haystack import indexes
from icekit.utils.search import AbstractLayoutIndex
from . import models
class WorkIndex(AbstractLayoutIndex, indexes.Indexable):
def get_model(self):
return models.WorkBase
class CreatorIndex(AbstractLayoutIndex, indexes.Indexable):
def get_model(self):
return mod... | {
"content_hash": "15d2eedb5c95b95eb389e4fe657dbe75",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 59,
"avg_line_length": 30.545454545454547,
"alnum_prop": 0.7767857142857143,
"repo_name": "ic-labs/glamkit-collections",
"id": "3396f3aec215c3b6f9e89862866a650e4a5a3cf9",
"... |
import json
import logging
import random
import string
from django.http import (
HttpResponseForbidden, HttpResponseNotFound, JsonResponse,
)
from django.views.generic import TemplateView, View
from pretix.base.models import Event, Order, OrderPosition
from pretix.control.permissions import EventPermissionRequire... | {
"content_hash": "5003c62ed378f0a4c10899f81f85199c",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 118,
"avg_line_length": 35.23529411764706,
"alnum_prop": 0.6093489148580968,
"repo_name": "awg24/pretix",
"id": "5df600c50efea46830f7b200fe667f8c440e3303",
"size": "2396",
... |
from sys import version_info
if version_info.major == 2:
from Tkinter import * # noqa
else:
from tkinter import * # noqa
class CollapsiblePane(LabelFrame):
def __init__(self, master, **kwargs):
self.master = master
self.width = kwargs.get('width', 0)
self.height = kwargs.get('he... | {
"content_hash": "a16f6d1656aa73057ac75bf3efaf08f1",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 74,
"avg_line_length": 30.078651685393258,
"alnum_prop": 0.5304445274561076,
"repo_name": "revarbat/belfrywidgets",
"id": "82e6d7011d4e95e214ed5fad9497a16d301384e8",
"size"... |
import json
import couchbase
from couchbase._pyport import basestring
from couchbase.views.iterator import AlreadyQueriedError
from couchbase.exceptions import CouchbaseError, NotSupportedError
class N1QLError(CouchbaseError):
@property
def n1ql_errcode(self):
return self.objextra['code']
CONSISTEN... | {
"content_hash": "e337717a502e91c1716d1b45da4d362b",
"timestamp": "",
"source": "github",
"line_count": 492,
"max_line_length": 79,
"avg_line_length": 31.796747967479675,
"alnum_prop": 0.5865507542827921,
"repo_name": "mnunberg/couchbase-python-client",
"id": "6f2895646c3674fea270bd1e05c242934fdefe06... |
from django.conf import settings
import hashlib
import base64
from typing import Optional
def initial_password(email: str) -> Optional[str]:
"""Given an email address, returns the initial password for that account, as
created by populate_db."""
if settings.INITIAL_PASSWORD_SALT is not None:
... | {
"content_hash": "72ff289188c3f62a7ec183a8cb2c26d8",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 80,
"avg_line_length": 32.473684210526315,
"alnum_prop": 0.6936790923824959,
"repo_name": "tommyip/zulip",
"id": "4e2d5360f90fb3b355e3b3e6797baa7300c99305",
"size": "617",
... |
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import re
from builtins import dict, int, str, super
from collections import namedtuple
import IPython.display as DISP
import matplotlib.pyplot as plt
import nbwavedrom
from future import standard_library
from tabulate impo... | {
"content_hash": "aa4b31994f26d95219024dc86a121e70",
"timestamp": "",
"source": "github",
"line_count": 498,
"max_line_length": 122,
"avg_line_length": 35.65261044176707,
"alnum_prop": 0.59892987890735,
"repo_name": "xesscorp/myhdlpeek",
"id": "32bb8780dcc72817350f75df4178790f4a456e25",
"size": "17... |
import pytest
from github3 import GitHubError
from github3.orgs import Team
from .helper import UnitHelper, UnitIteratorHelper, create_url_helper
url_for = create_url_helper('https://api.github.com/teams/10')
class TestTeam(UnitHelper):
described_class = Team
example_data = {
'url': 'https://api.gi... | {
"content_hash": "8b16abb3bdef5b5450881028275ca42f",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 79,
"avg_line_length": 33.59090909090909,
"alnum_prop": 0.6039693279206134,
"repo_name": "h4ck3rm1k3/github3.py",
"id": "d4f6d027e36269c167076aed6a5c302d84168c41",
"size":... |
from openstack.tests.unit import base
from openstack.network.v2 import service_provider
IDENTIFIER = 'IDENTIFIER'
EXAMPLE = {
'service_type': 'L3_ROUTER_NAT',
'name': '4',
'default': False,
}
class TestServiceProvider(base.TestCase):
def test_basic(self):
sot = service_provider.ServiceProvi... | {
"content_hash": "c9d6b83895a9554b55aade39d8970414",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 67,
"avg_line_length": 31.1,
"alnum_prop": 0.6784565916398714,
"repo_name": "stackforge/python-openstacksdk",
"id": "07cdce7278011971593ac43d66da915cfd025b14",
"size": "147... |
import time
from annotypes import Anno, add_call_types
from malcolm.core import PartRegistrar
from malcolm.modules import builtin
# Pull re-used annotypes into our namespace in case we are subclassed
APartName = builtin.parts.APartName
AMri = builtin.parts.AMri
with Anno("The demand value to move our counter motor ... | {
"content_hash": "b622f0a9edd4d79b6af1dd0a3004d2d0",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 87,
"avg_line_length": 36.84,
"alnum_prop": 0.6769815418023887,
"repo_name": "dls-controls/pymalcolm",
"id": "d68845c7dd41a643b7f3cc7d857ec7ccb51441f2",
"size": "1842",
"... |
import json
from string import Template
from textwrap import dedent
import subprocess
class heat_inventory:
# output keys
hadoop_master_public_key = "hadoop_master_public_ip"
hadoop_master_private_key = "hadoop_master_private_ip"
hadoop_datanode_public_key = "nodes_public_ips"
hadoop_datanode_priv... | {
"content_hash": "ac34326f3bc5542372173ae02fd95a50",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 151,
"avg_line_length": 37.68333333333333,
"alnum_prop": 0.6572313135780629,
"repo_name": "dwatrous/hadoop-multi-server-ansible",
"id": "e19e637fe57e4ae184d1851eabcfbe3b7690... |
from flask import Flask
app = Flask(__name__)
#register to it
import views,main
| {
"content_hash": "442a4287de897d60dd7773b3f4d55b40",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 23,
"avg_line_length": 13.666666666666666,
"alnum_prop": 0.7195121951219512,
"repo_name": "seerjk/reboot06",
"id": "cd542d03e907d7497cf8b381e5a401dd9e25dd15",
"size": "82",
... |
"""
This module is intended to provide compilation support for rst. The intention
is to keep the required libraries all in one place to provide a deployable,
python 2.6 compatible, rst compiler.
"""
import docutils.core
import sys, os.path
def toHtml(text):
return docutils.core.publish_parts(source=text, writer_... | {
"content_hash": "8ebd6fa98d7a4450f8f14fb7b8922708",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 84,
"avg_line_length": 30.294117647058822,
"alnum_prop": 0.6601941747572816,
"repo_name": "fretboardfreak/code",
"id": "fbbebe27d3a32f8248f7eef9946f0f8d213a8301",
"size": "... |
from __future__ import print_function
import argparse
import os
import subprocess
import sys
import tempfile
INFER_IMPORT_DIR = \
os.path.dirname(os.path.realpath(__file__)) + '/sdk-module-lists'
INFER_IMPORT_PATH = INFER_IMPORT_DIR + '/infer-imports.py'
def printerr(message):
print(message, file=sys.stder... | {
"content_hash": "16c5ea1e422763d4554b00824e0c1169",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 79,
"avg_line_length": 35.717213114754095,
"alnum_prop": 0.5567412507171543,
"repo_name": "shahmishal/swift",
"id": "4b6e1fb0b195edce0fd4990ccbc70420b057aabd",
"size": "87... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.