text stringlengths 4 1.02M | meta dict |
|---|---|
"""Util library for saving, copying and moving checkpoints."""
import concurrent.futures
import os
import tensorflow.compat.v1 as tf
# Default target file name to copy the best checkpoint to.
BEST_CHECKPOINT_FILENAME = "best_checkpoint"
# Default file name for storing the best evaluation results.
BEST_EVAL_INFO_FI... | {
"content_hash": "88c6beb677477f6612f08852b68c44c6",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 76,
"avg_line_length": 34.08943089430894,
"alnum_prop": 0.6775578344860482,
"repo_name": "google-research/language",
"id": "14dea8db54a6c9dfb6520d77602dab03d86b7989",
"siz... |
from otp.ai.AIBaseGlobal import *
import DistributedCCharBaseAI
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM, State
from direct.fsm import State
from direct.task import Task
import random
from toontown.toonbase import ToontownGlobals
import CharStateDatasAI
from toontown.toonbase... | {
"content_hash": "d96bb0422a7e8a1912786b3ecb82afd2",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 294,
"avg_line_length": 42.81290322580645,
"alnum_prop": 0.6552139843279083,
"repo_name": "silly-wacky-3-town-toon/SOURCE-COD",
"id": "0c02673248beba45a55509d110a8307e8a91ad... |
from homogeneous_simple_shear import rotate
import numpy as np
import itertools
class TestRotate:
def test_forward_equal_inverse(self):
def check(theta, alpha, phi):
x, y = np.mgrid[:10, :20]
z = np.ones_like(x)
xyz = np.vstack([x.ravel(), y.ravel(), z.ravel()]).T
... | {
"content_hash": "3a8608aaec09c70e29c885678cf06e66",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 73,
"avg_line_length": 34.45454545454545,
"alnum_prop": 0.5606860158311345,
"repo_name": "joferkington/fault_kinematics",
"id": "7eeb07d17f1901a36fef33bac6b959ecf70043d0",
... |
from ...core.utils import snake_to_camel_case
def convert_dict_keys_to_camel_case(d):
"""Changes dict fields from d[field_name] to d[fieldName].
Useful when dealing with dict data such as address that need to be parsed
into graphql input.
"""
data = {}
for k, v in d.items():
new_key =... | {
"content_hash": "cf20e9fd7c45d521ad16fc3b4ef0cc94",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 77,
"avg_line_length": 27.785714285714285,
"alnum_prop": 0.6323907455012854,
"repo_name": "mociepka/saleor",
"id": "a0bb6102142a949aab63754156f78759dce416ae",
"size": "389"... |
"""
Support for WeMo switches.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/switch.wemo/
"""
import logging
from homeassistant.components.switch import SwitchDevice
from homeassistant.const import (
STATE_OFF, STATE_ON, STATE_STANDBY, STATE_UNKNO... | {
"content_hash": "4348b25a33d775e276998b74ce48fcf6",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 77,
"avg_line_length": 31.01156069364162,
"alnum_prop": 0.5955265610438024,
"repo_name": "jaharkes/home-assistant",
"id": "d4f6b721e9d95a069915b7bf9c0293f69b6355cb",
"size... |
import numpy
#punishment for too many components
#BIG_VALUE = 100
#Treshold from which we subtract the weight, to obtain the fitness
#BIGGER_VALUE = 1000
'''
Should work now
'''
def root(father, a):
if father[a] != a:
father[a] = root(father, father[a])
return father[a]
def same(father, a, b):
return root(fat... | {
"content_hash": "25326abfc15cc9765b3b436199bdd345",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 116,
"avg_line_length": 32.05714285714286,
"alnum_prop": 0.6158645276292335,
"repo_name": "au-re/steiner-tree",
"id": "bae88438682e1b69ae2aa3e3e762de5db45c8cf6",
"size": "2... |
"""Copyright 2014 Cyrus Dasadia
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
distr... | {
"content_hash": "7f4e210178cf0ca0a1d31d2703fb2cb9",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 128,
"avg_line_length": 39.37795275590551,
"alnum_prop": 0.6050789842031594,
"repo_name": "CitoEngine/integration_tools",
"id": "39214259628b900ddcdbaea318ac5d16107da0aa",
... |
import logging
import traceback
from google.appengine.ext import webapp
from google.appengine.ext import db
from google.appengine.ext import deferred
from google.appengine.api import taskqueue
import config
from siteinadropbox import models
from siteinadropbox import controller
class FetchWorker(webapp.RequestHandle... | {
"content_hash": "fa5b19acdb2a1f12e456e0a9133afbd9",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 112,
"avg_line_length": 41.886792452830186,
"alnum_prop": 0.6554054054054054,
"repo_name": "Japanuspus/Site-in-a-Dropbox",
"id": "c77f63871d1b3d79fb4237654a9f442878a4b16a",
... |
import numbers
from . import Image, ImageColor
from ._util import isStringType
"""
A simple 2D drawing interface for PIL images.
<p>
Application code should use the <b>Draw</b> factory, instead of
directly.
"""
class ImageDraw(object):
def __init__(self, im, mode=None):
"""
Create a drawing ins... | {
"content_hash": "a4cc4827b42d4396790aad12b556a2fa",
"timestamp": "",
"source": "github",
"line_count": 354,
"max_line_length": 82,
"avg_line_length": 35.112994350282484,
"alnum_prop": 0.5345132743362832,
"repo_name": "isabernardes/Heriga",
"id": "89df2733811f4c0bb9700cba37d5931ebfbd5c85",
"size": ... |
from google.appengine.api import users
import cgi
import os
import urllib
import jinja2
import webapp2
import model
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'])
from google.appengine.ext import ndb
from google.appengin... | {
"content_hash": "67268e00fe63aa0fc2baed7f4a43eb49",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 78,
"avg_line_length": 22.737704918032787,
"alnum_prop": 0.6596971881759193,
"repo_name": "bpreece/thegither",
"id": "ea0fd89fa7e35d565e3706d4d87a56e5fc394b8d",
"size": "13... |
"""
Spanish-specific Form helpers
"""
from __future__ import absolute_import, unicode_literals
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
from .es_provin... | {
"content_hash": "6612333ed17a926f49b8058ea2f4335b",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 160,
"avg_line_length": 39.8041237113402,
"alnum_prop": 0.6108521108521109,
"repo_name": "yakky/django-localflavor",
"id": "ff450cb0339e95e9f1cf8c973c3b505e5c68f53c",
"siz... |
from google.cloud import gke_backup_v1
def sample_list_backup_plans():
# Create a client
client = gke_backup_v1.BackupForGKEClient()
# Initialize request argument(s)
request = gke_backup_v1.ListBackupPlansRequest(
parent="parent_value",
)
# Make the request
page_result = client.l... | {
"content_hash": "741640d97861d44721f369d9bc446d7d",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 64,
"avg_line_length": 25.2,
"alnum_prop": 0.7003968253968254,
"repo_name": "googleapis/python-gke-backup",
"id": "9faa7fbd77e586ba8f33554ca28c5d29328328c5",
"size": "1897"... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../'))
# -- General configura... | {
"content_hash": "a61a793d20b2db3298fc0ed9a4bd83a4",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 80,
"avg_line_length": 31.457337883959045,
"alnum_prop": 0.7008788108929153,
"repo_name": "Nekroze/tyrant",
"id": "ab296cb8f185a3216122a0937ecc55f31ac382ad",
"size": "9657... |
import re
import urlparse
import formencode
from formencode import htmlfill, validators
class BaseForm(formencode.Schema):
allow_extra_fields = True
filter_extra_fields = True
_xsrf = validators.PlainText(not_empty=True, max=32)
def __init__(self, handler):
self._parmas = {}
... | {
"content_hash": "99144914521eb5e387301005a29bec4f",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 104,
"avg_line_length": 31.819277108433734,
"alnum_prop": 0.4804998106777736,
"repo_name": "felinx/poweredsites",
"id": "7279184d64f6ad7688a822b78fcaf33a64dc4fa9",
"size": ... |
"""
A Python package for working with the Human Brain Project Model Validation Framework.
Andrew Davison and Shailesh Appukuttan, CNRS, 2017-2020
License: BSD 3-clause, see LICENSE.txt
"""
import os
import re
import getpass
import json
import platform
import socket
from importlib import import_module
from pathlib ... | {
"content_hash": "63498d6a29d6e95e1beaaf80a9a23e24",
"timestamp": "",
"source": "github",
"line_count": 2408,
"max_line_length": 300,
"avg_line_length": 45.69892026578073,
"alnum_prop": 0.579146333705915,
"repo_name": "apdavison/hbp-validation-client",
"id": "76fc7c276c372571af6a1daf8da6ee5bae3643a1"... |
import argparse
import sys
from sim.load_elf import load_elf
from sim.standalonesim import StandaloneSim
from sim.stats import ExecutionStatAnalyzer
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument('elf')
parser.add_argument('-v', '--verbose', action='store_true')
parser.add_... | {
"content_hash": "fb5f4d454f841c70bb7cbc508cff9696",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 78,
"avg_line_length": 29.26086956521739,
"alnum_prop": 0.5948489351163943,
"repo_name": "lowRISC/opentitan",
"id": "3c14f8d5b730b80a6589c519cbf223aa012b2a67",
"size": "219... |
from vis import label, mag, mag2
from planets import planet_list
from parameters import u, n, f, obj_global, a_global, eps_global, name_global, radius_global
# planet/spaceship label definition:
popup = label(visible=False, box=False, xoffset=-50, yoffset=50, font='sans', opacity=0.4)
def lbl(popup, obj, sw_lbl, dt)... | {
"content_hash": "e287129436713fa4db98b35bc31edd3f",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 118,
"avg_line_length": 41.63513513513514,
"alnum_prop": 0.593638429081467,
"repo_name": "lukekulik/solar-system",
"id": "6cbe292bf176c609ae61c7f7a813a17010690f1f",
"size":... |
import base64
import concurrent.futures
import datetime
import logging
import os
import platform
import portpicker
import psutil
import random
import re
import signal
import string
import subprocess
import time
import traceback
from mobly.controllers.android_device_lib import adb
# File name length is limited to 255 c... | {
"content_hash": "460ed31fcebb8db350c06c883a59874e",
"timestamp": "",
"source": "github",
"line_count": 412,
"max_line_length": 79,
"avg_line_length": 31.429611650485437,
"alnum_prop": 0.6480037068499498,
"repo_name": "l-meng/mobly",
"id": "79bf9e208a046ae43d92e0e8c1e657d472f9d53c",
"size": "13525"... |
"""Test that custom generators can be passed to --format
"""
import TestGyp
test = TestGyp.TestGypCustom(format='mygenerator.py')
test.run_gyp('test.gyp')
# mygenerator.py should generate a file called MyBuildFile containing
# "Testing..." alongside the gyp file.
test.must_match('MyBuildFile', 'Testing..... | {
"content_hash": "02728522cc8c7fb14034af481cbff1a9",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 69,
"avg_line_length": 24.785714285714285,
"alnum_prop": 0.7060518731988472,
"repo_name": "Jet-Streaming/gyp",
"id": "5e7e04f9643a123a6d2ebffdaac241cdc2296828",
"size": "52... |
from unimodalarraymax import unimodalmax
import unittest
class TestUnimodalArrayMaxElement(unittest.TestCase):
def setUp(self):
self.unimodalarray = [1,6,5,4,2]
def test_unimodal_array_max_element_finder(self):
maxElement = unimodalmax(self.unimodalarray)
self.assertEqual(maxElement, 6)
if __name__ ... | {
"content_hash": "2030f3fc25ac2f5d1f15618b521f856b",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 53,
"avg_line_length": 25.214285714285715,
"alnum_prop": 0.7337110481586402,
"repo_name": "mez/algorithms_with_python",
"id": "ac9b578948edb72eb218d74b1e5d9534cf389c5a",
"s... |
import pytest
from azure.core.utils import parse_connection_string
from devtools_testutils import AzureMgmtTestCase
class CoreConnectionStringParserTests(AzureMgmtTestCase):
# cSpell:disable
def test_parsing_with_case_sensitive_keys_for_sensitive_conn_str(self, **kwargs):
conn_str = 'Endpoint=XXXXENDP... | {
"content_hash": "d3f80db2a90db81ce73c5042bfdf39f4",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 168,
"avg_line_length": 61.93893129770992,
"alnum_prop": 0.7335469558787281,
"repo_name": "Azure/azure-sdk-for-python",
"id": "1a3957e5b35dbb1ed118c863893ec6bf7668f424",
"... |
"""Tests transmission of tickets across gRPC-on-the-wire."""
import unittest
from grpc._adapter import _intermediary_low
from grpc._links import invocation
from grpc._links import service
from grpc.framework.interfaces.links import links
from grpc_test import test_common
from grpc_test._links import _proto_scenarios
... | {
"content_hash": "763c49d38e76c27ae33065ecf1e770ab",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 80,
"avg_line_length": 41.320197044334975,
"alnum_prop": 0.7039818788745827,
"repo_name": "gpndata/grpc",
"id": "02ddd512c2260759e763758de17ff5758cae08f9",
"size": "9917",... |
class FrameSeqException(Exception):
def __init__(self, msg):
self.msg = msg
def split_frames_by_missing(frames):
""" Splits frames into an array of frames
sequences where each sequence does NOT
contain any missing frames.
If no frames are missing an array with one
entry (frames) are re... | {
"content_hash": "2d47b41c91fcb291bfb0fd0cafecea30",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 58,
"avg_line_length": 23.20689655172414,
"alnum_prop": 0.5938583457157008,
"repo_name": "2hdddg/pyvidstream",
"id": "e9fad2357c000fabd49e5fccca176ef7c5c475b0",
"size": "20... |
DEFAULT_HOSTS = ['http://gitlab.com']
# GitLab hook domain
HOOK_DOMAIN = None
HOOK_CONTENT_TYPE = 'json'
HOOK_EVENTS = ['push'] # Only log commits
# Max render size in bytes; no max if None
MAX_RENDER_SIZE = None
CACHE = False
| {
"content_hash": "14f84a92469de69569935b8df1835c2a",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 42,
"avg_line_length": 21,
"alnum_prop": 0.6926406926406926,
"repo_name": "sloria/osf.io",
"id": "542fec4644ef10ed73743599d428fd31551e83f5",
"size": "231",
"binary": fals... |
import os
import sys
import djstripe
version = djstripe.__version__
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
print("You probably want to also tag the version now:")
print(" git ... | {
"content_hash": "ec53acb18f491e911696a1efdbdc7745",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 66,
"avg_line_length": 27.88135593220339,
"alnum_prop": 0.5902735562310031,
"repo_name": "rawjam/dj-stripe",
"id": "98b12dd65306ded20a9c945f5fa1ce8059a0fcca",
"size": "1668... |
import sys
import argparse
import struct
class Vertex:
def __init__(self, line):
values = line.split(' ')[1:]
values = [float(v) for v in values]
if len(values) == 3:
self.values = values + [1.0]
elif len(values) == 4:
self.values = values
else:
... | {
"content_hash": "ead8da009bc5228f32f2057c49c1d95d",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 95,
"avg_line_length": 30.936046511627907,
"alnum_prop": 0.5416275136252584,
"repo_name": "stbd/stoolbox",
"id": "1f165e065f822345803339812dd5fa1c661d25e0",
"size": "5321"... |
import functools
import sys
from argparse import ArgumentParser
import tensorflow as tf
from pprint import pformat
from tensorflow.contrib.framework import arg_scope, add_arg_scope
import tfsnippet as spt
from tfsnippet.examples.utils import (MLResults,
save_images_collection,
... | {
"content_hash": "500d0c06d4a963f712bcec74c01e4856",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 80,
"avg_line_length": 34.88317757009346,
"alnum_prop": 0.5828533154722036,
"repo_name": "korepwx/tfsnippet",
"id": "e8a59b945af423d71525e451c835ed3ced4b9e26",
"size": "74... |
from collections import OrderedDict
from typing import Dict, Type
from .base import RecaptchaEnterpriseServiceTransport
from .grpc import RecaptchaEnterpriseServiceGrpcTransport
from .grpc_asyncio import RecaptchaEnterpriseServiceGrpcAsyncIOTransport
# Compile a registry of transports.
_transport_registry = (
Ord... | {
"content_hash": "ea548ec0645d3d45a70a604e7428bb3f",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 84,
"avg_line_length": 37.31578947368421,
"alnum_prop": 0.8293370944992948,
"repo_name": "googleapis/python-recaptcha-enterprise",
"id": "2b433e0cc2236233667c96c464e82af1226c... |
import argparse
import collections
import datetime
import functools
import gc
import inspect
import json
import logging
import operator
import os
import posixpath as webpath
import random
import re
import string
import sys
import threading
from king_phisher import color
from king_phisher import constants
from king_phi... | {
"content_hash": "589516a61852ca687a240f2e1234aae8",
"timestamp": "",
"source": "github",
"line_count": 545,
"max_line_length": 131,
"avg_line_length": 30.396330275229356,
"alnum_prop": 0.7112761076904504,
"repo_name": "securestate/king-phisher",
"id": "30d3229940adf253ee7ec03e8614de25913470bf",
"s... |
"""
differential_evolution: The differential evolution global optimization algorithm
Added by Andrew Nelson 2014
"""
from __future__ import division, print_function, absolute_import
import warnings
import numpy as np
from scipy.optimize import OptimizeResult, minimize
from scipy.optimize.optimize import _status_messag... | {
"content_hash": "fc80af11bc2bc7a0e57167123cf61e46",
"timestamp": "",
"source": "github",
"line_count": 1346,
"max_line_length": 82,
"avg_line_length": 42.54011887072809,
"alnum_prop": 0.5892348801061842,
"repo_name": "jamestwebber/scipy",
"id": "f8ff2bcf900cfe536704a37eb5a5841fc1f5cf55",
"size": "... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
# Copyright 2016-2020 Eotvos Lorand University, Budapest, Hungary
import argparse
from hlir16.hlir import *
from compiler_log_warnings_errors import *
import compiler_log_warnings_errors
from compiler_load_p4 import load_from_p4
fr... | {
"content_hash": "77b0fec7ae4e2d55d5ce795c24bc5bc2",
"timestamp": "",
"source": "github",
"line_count": 581,
"max_line_length": 216,
"avg_line_length": 38.09982788296041,
"alnum_prop": 0.6102276834116371,
"repo_name": "P4ELTE/t4p4s",
"id": "c584452da766d7bca3ab71405b4d8d30e9289657",
"size": "22136"... |
import random
##----------------------------------------------------------------##
from gii.core import app, signals
from gii.qt import QtEditorModule
from gii.qt.IconCache import getIcon
from gii.qt.controls.GenericTreeWidget import GenericTreeWidget
from gii.qt.controls.PropertyEdit... | {
"content_hash": "818caf8d689b41bf3b37f53e619489dd",
"timestamp": "",
"source": "github",
"line_count": 356,
"max_line_length": 99,
"avg_line_length": 30.303370786516854,
"alnum_prop": 0.6546162402669633,
"repo_name": "tommo/gii",
"id": "33c8a985e089e1464153c6573e9364f1b3abbe00",
"size": "10788",
... |
import Gaffer
import GafferUI
from Qt import QtWidgets
## A simple PlugValueWidget which just displays the name of the plug,
# with the popup action menu for the plug.
#
# Supported plug metadata :
#
# - "labelPlugValueWidget:renameable"
class LabelPlugValueWidget( GafferUI.PlugValueWidget ) :
def __init__( self, ... | {
"content_hash": "f52b12e6406d713843a2685fd6975bf2",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 155,
"avg_line_length": 34.756218905472636,
"alnum_prop": 0.7182937303177784,
"repo_name": "ivanimanishi/gaffer",
"id": "0b2c0284c9b95ab90ce4d27569a342acdb6740a8",
"size":... |
__author__ = 'aaronweaver'
from datetime import datetime
import json
from dojo.models import Finding
class BanditParser(object):
def __init__(self, filename, test):
tree = filename.read()
try:
data = json.loads(str(tree, 'utf-8'))
except:
data = json.loads(tree)
... | {
"content_hash": "4167d83c8c6f3a73aafd52e7475bfb80",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 86,
"avg_line_length": 35.3768115942029,
"alnum_prop": 0.4354772634166325,
"repo_name": "OWASP/django-DefectDojo",
"id": "b635a4f3994f34c0d0a30b39a1350eb093574c9c",
"size":... |
"""create database
Revision ID: 166ff2dcc48d
Revises:
Create Date: 2014-10-24 11:43:23.886123
"""
try:
from hashlib import sha1
sha1 # suppress pyflakes warning
except ImportError: # pragma: nocover
from sha import new as sha1
from alembic import op, context
from sqlalchemy import ForeignKey, Column, T... | {
"content_hash": "0a86d82d825b13c0b932c4e8ba85260c",
"timestamp": "",
"source": "github",
"line_count": 315,
"max_line_length": 85,
"avg_line_length": 32.076190476190476,
"alnum_prop": 0.571159936658749,
"repo_name": "geoportallux/geoportailv3-gisgr",
"id": "4c51053c36083282444c3a069285d12b380ba746",... |
"""This module contains different useful functions for manipulating models.
Functions defined here:
get_fields(class) -- return the class's field
get_name(class) -- return the model's name
get_plural_name(class) -- return the plural class name
get_pkey_names -- return a list of primary key fields name
... | {
"content_hash": "f125913f0271e63df72478e5693caf65",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 75,
"avg_line_length": 34.265060240963855,
"alnum_prop": 0.6550632911392406,
"repo_name": "v-legoff/pa-poc1",
"id": "ab08dade9814440c2675ed9fb2ba24b66b8a279d",
"size": "438... |
from bs4 import BeautifulSoup as Soup
import urls
import re
import proxy
from datetime import *
import functions
def subjects ( config ):
teamsList = []
url = urls.teams.replace("{{SCHOOL_ID}}", str(config["school_id"])).replace("{{BRANCH_ID}}", str(config["branch_id"]))
response = proxy.session.get(url)
html = ... | {
"content_hash": "925d4afca81134ddb1b48b93b422b153",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 132,
"avg_line_length": 31.872340425531913,
"alnum_prop": 0.6261682242990654,
"repo_name": "boh1996/LectioAPI",
"id": "5adc68f6a1e8798d2706cc65a003b348a8ac50d1",
"size": "1... |
import os
import re
import homely._vcs
from homely._errors import ConnectionError, RepoError, RepoHasNoCommitsError
from homely._utils import _expandpath, run
from homely.system import execute
class Repo(homely._vcs.Repo):
type = homely._vcs.HANDLER_GIT_v1
pulldesc = 'git pull'
@classmethod
def _fro... | {
"content_hash": "3ead8dce23986df777b6272e00fee246",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 98,
"avg_line_length": 35.82835820895522,
"alnum_prop": 0.5084357425536347,
"repo_name": "phodge/homely",
"id": "f1499238aff51746f65e85c0a0abba61e11960ce",
"size": "4801",... |
from django.test import SimpleTestCase
from unittest import mock
from zeusci.zeus.exceptions import FetcherError
from zeusci.zeus.fetchers import Fetcher
from zeusci.zeus.fetchers import GitFetcher
class TestFetcher(SimpleTestCase):
def setUp(self):
self.fetcher = Fetcher()
@mock.patch('zeusci.zeus.... | {
"content_hash": "0b86c6c561a924e89ff33fe5dfd6afef",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 75,
"avg_line_length": 33.104651162790695,
"alnum_prop": 0.587284861257464,
"repo_name": "lukaszb/zeusci",
"id": "deb40e5e3f9b1f23163b52685d943579037ba61f",
"size": "2847",... |
from django.conf.urls import patterns
from rest_framework import routers
from users.api_views import UserViewSet
from blog.api_views import PostViewSet
router = routers.SimpleRouter()
router.register(r'users', UserViewSet)
router.register(r'posts', PostViewSet)
urlpatterns = patterns('',)
urlpatterns = router.ur... | {
"content_hash": "ece9125f101cfb9cb04308115d5d0cf5",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 39,
"avg_line_length": 20.1875,
"alnum_prop": 0.7925696594427245,
"repo_name": "djangocali/blog-api",
"id": "54e2d2035567161af71b695786f7203e5a058213",
"size": "347",
"bi... |
import boto3
import json
import sure # noqa # pylint: disable=unused-import
from moto import mock_ses, mock_sns, mock_sqs
from moto.ses.models import SESFeedback
from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID
@mock_ses
def test_enable_disable_ses_sns_communication():
conn = boto3.client("ses", region_na... | {
"content_hash": "a8206e8c1d3f807c6c41622860818a60",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 88,
"avg_line_length": 32.657754010695186,
"alnum_prop": 0.6648108727689537,
"repo_name": "spulec/moto",
"id": "3040021b52824c5d8393899d5374e0c61be76dcf",
"size": "6107",
... |
from __future__ import absolute_import, print_function
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
import os
import json
import tweepy
import ConfigParser
import time
import datetime
import threading
import sys
import urllib2
import urllib
import requests
twe... | {
"content_hash": "47d3ea4946bc74a8a44367b6e0041ada",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 124,
"avg_line_length": 34.58988764044944,
"alnum_prop": 0.5570894916355368,
"repo_name": "JeffX89/Twitter-stream-gatherer",
"id": "fb9b895dbfcc02eae15387d87cd4739b30be7a8d"... |
import simplegui
import math
import random
# globals for user interface
WIDTH = 800
HEIGHT = 600
score = 0
lives = 3
time = 0
started = False
rock_set = set()
missile_set = set()
a_explosion = None
explosion_center = 64
class ImageInfo:
def __init__(self, center, size, radius = 0, lifespan = None, animated = Fals... | {
"content_hash": "3583d24f5ec16580368a660d232db5b4",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 548,
"avg_line_length": 35.79545454545455,
"alnum_prop": 0.6197619047619047,
"repo_name": "winlandiano/An-Introduction-to-Interactive-Programming-in-Python",
"id": "b6d14c01... |
from __future__ import print_function
import sys
import os
import re
import calendar
import datetime
import netCDF4 as nc
import numpy as np
from lib_util import create_output_file
"""
What this does:
Calculate monthly means over a number of years from model output.
How to use:
See ./cice_monthly_mean.py or mom_mo... | {
"content_hash": "fddd2bcd07cf31a3855b4d66bef8dfcd",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 86,
"avg_line_length": 30.923076923076923,
"alnum_prop": 0.5696517412935324,
"repo_name": "CWSL/access-cm-tools",
"id": "10f1e408e7f6870db8a2d5b723d7fabf386d1f25",
"size":... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('radio', '0017_auto_20161014_2225'),
]
operations = [
migrations.AlterField(
model_name='agency',
name='short',
f... | {
"content_hash": "7ea47c76138f09481ca83c0c6a096d22",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 62,
"avg_line_length": 21.5,
"alnum_prop": 0.5917312661498708,
"repo_name": "ScanOC/trunk-player",
"id": "ad15e25868f704458e66e5a6618050c698737d9b",
"size": "459",
"binar... |
from sys import exit
from flask import Flask
from feature.config import ConfigManager
from feature.model import db, ProductTypes, Client
class DatabaseInit:
def __init__(self, file='config.json'):
self.app, env_config = Flask(__name__), ConfigManager(file)
env_config.apply_config(self.app... | {
"content_hash": "13aa08bd435e93138379246e61106f50",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 112,
"avg_line_length": 44.82608695652174,
"alnum_prop": 0.5444552214678305,
"repo_name": "parejadan/feature-center",
"id": "fe428ff9691e46f7295152ffce6d418bb65248a5",
"siz... |
import unittest
from hyapi.auth import HYAuthHandler
class HYAuthHandlerTests(unittest.TestCase):
def test_get_code_url(self):
auth = HYAuthHandler('a', 'b', 'c', 'd')
self.assertEqual('https://api.hanyang.ac.kr/oauth/authorize?scope=c&redirect_uri=d&response_type=code&client_id=a', auth.get_cod... | {
"content_hash": "31990993a62ca9d9d00dc6e6b1bed38b",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 152,
"avg_line_length": 33.7,
"alnum_prop": 0.7002967359050445,
"repo_name": "kimtree/hyapi",
"id": "5abd2ed31e0fd366c11a460529a854891e9f1bbc",
"size": "362",
"binary": f... |
import re
from datetime import datetime, timedelta
from time import timezone
from urllib2 import urlopen, quote
from django.db import models
from django.utils.html import urlize
from django.utils.simplejson import loads
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from mezz... | {
"content_hash": "783ea3a6c0649307af84a72878a06b79",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 78,
"avg_line_length": 40.84920634920635,
"alnum_prop": 0.5712065280746066,
"repo_name": "gbosh/mezzanine",
"id": "ce7be6718d41d072c4f0d2c6dd5fb1999f65db45",
"size": "5148... |
from __future__ import absolute_import
import logging
import urlparse
from glance import client as glance_client
from horizon.api.base import APIDictWrapper, url_for
LOG = logging.getLogger(__name__)
class Image(APIDictWrapper):
"""
Wrapper around glance image dictionary to make it object-like and provid... | {
"content_hash": "c5a1867404dfff244c8e70740956d860",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 77,
"avg_line_length": 31.471910112359552,
"alnum_prop": 0.632631203141735,
"repo_name": "developerworks/horizon",
"id": "694705da6e292fe1016db1bca3353f34d1f0a95b",
"size":... |
import lzma
import os
class XZ(object):
"""
Implements decompression of lzma compressed files
"""
LZMA_STREAM_BUFFER_SIZE = 8192
def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb):
self.lzma_stream.close()
def __init__(self, lzma_stream, b... | {
"content_hash": "eb0f413326103df5d4130b1adeae31ee",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 79,
"avg_line_length": 28.346153846153847,
"alnum_prop": 0.6058344640434192,
"repo_name": "SUSE/azurectl",
"id": "aeee2c2b6fe896d3a85fe363d0a52a8078a0e40b",
"size": "2078",... |
import numpy as np
import pandas as pd
import inspect
from numba import jit, vectorize, guvectorize
from functools import wraps
from six import StringIO
import ast
import toolz
class GetReturnNode(ast.NodeVisitor):
"""
A Visitor to get the return tuple names from a calc-style
function
"""
def visi... | {
"content_hash": "e324e00282f74e6571045a1074910df1",
"timestamp": "",
"source": "github",
"line_count": 344,
"max_line_length": 78,
"avg_line_length": 31.997093023255815,
"alnum_prop": 0.5426546742981739,
"repo_name": "xiyuw123/Tax-Calculator",
"id": "f2f8fcda7931c29f5afe1e80c6f0e2dbb754554f",
"siz... |
import threading
import SocketServer
import time
from Tkinter import *
import socket
import sys
import PIL
from io import BytesIO
from cStringIO import StringIO
import base64
import hashlib
import ImageTk
lock = threading.Lock()
waitkey = threading.Event()
sendClick = '0'
sendRightClick = '0'
sendKey = '0'
class pys... | {
"content_hash": "388e98cd3db9c34ece0900958d379bb6",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 78,
"avg_line_length": 31.45774647887324,
"alnum_prop": 0.5556301768524737,
"repo_name": "speknet/pyspy",
"id": "f96d677bd6ccf36684242116f40b69299f630f09",
"size": "4467",... |
from setuptools import find_packages
from setuptools import setup
REQUIRED_PACKAGES = [
'tensorflow>=1.12.1',
]
setup(
name='trainer',
version='0.1',
install_requires=REQUIRED_PACKAGES,
packages=find_packages(),
include_package_data=True,
requires=[]
)
| {
"content_hash": "b16bd2e73890c926eacebc30e64a7403",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 39,
"avg_line_length": 18.733333333333334,
"alnum_prop": 0.6868327402135231,
"repo_name": "GoogleCloudPlatform/cloudml-samples",
"id": "5dac0bf86976c8b198f1e1868a73a46ac6cb94... |
import logging,lasagne
import numpy as np
import theano.tensor as T
logging.basicConfig()
logger= logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
# adapted from https://github.com/nouiz/lisa_emotiw/blob/master/emotiw/wardefar/crf_theano.py
def theano_logsumexp(x, axis=None):
"""
Compute log(sum(exp(... | {
"content_hash": "fdafe31a0791f6a30d1027819f697cf3",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 93,
"avg_line_length": 31.357142857142858,
"alnum_prop": 0.6548974943052391,
"repo_name": "abhyudaynj/LSTM-CRF-models",
"id": "48466f8d2fa346a06539a32c10a9c689cbbe0010",
"s... |
import os
from twisted.trial import unittest
from pyrake.contrib.djangoitem import DjangoItem, Field
from pyrake import optional_features
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.test_djangoitem.settings'
if 'django' in optional_features:
from .models import Person, IdentifiedPerson
class BasePersonIte... | {
"content_hash": "13d30e51d952d85004f1d5bd4eac92e6",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 78,
"avg_line_length": 30.368932038834952,
"alnum_prop": 0.6160485933503836,
"repo_name": "elkingtowa/pyrake",
"id": "bce2ba8b30e5ca887d7e6c169111c1f70b4399b2",
"size": "3... |
from yambopy import *
import numpy as np
import matplotlib.pyplot as plt
# pack files of convergence GW calculations
pack_files_in_folder('gw_conv')
# Start Analyser
ya = YamboAnalyser('gw_conv')
# Plot of all the k-points converging one parameter
ya.plot_gw_all_kpoints_convergence(tag='EXX')
ya.plot_gw_all_kpoints... | {
"content_hash": "449a3d7c6782b28eaebfb14e1976064e",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 51,
"avg_line_length": 24.833333333333332,
"alnum_prop": 0.7651006711409396,
"repo_name": "alexmoratalla/yambopy",
"id": "22807b02a22e8e822205ffcff71628cc6ec88e22",
"size":... |
import os
import sys
import caffe
import numpy as np
from caffe import layers as L
from caffe import params as P
from sklearn.metrics import roc_auc_score
import random
def ribo_cnn_net1(train_size, val_size, test_size, val_file, test_file, solver_file):
#random.seed(1024)
os.chdir('..')
sys.path.insert(0,... | {
"content_hash": "372463275531c1c4f30776ce56cc32bb",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 108,
"avg_line_length": 37.414965986394556,
"alnum_prop": 0.5896363636363636,
"repo_name": "zhangsaithu/rose_demo",
"id": "d2365400eef2d277ad60cc1c2ccc048e1812b5ea",
"size... |
import os
import re
import json
import base64
import logging
import datetime
import time
import copy
import decimal
import cgi
import numpy
import pymongo
from lib import config, util, util_metrocoin
D = decimal.Decimal
def get_market_price(price_data, vol_data):
assert len(price_data) == len(vol_data)
asse... | {
"content_hash": "be1b38afcdf5ccd5b8281f695e6a012f",
"timestamp": "",
"source": "github",
"line_count": 659,
"max_line_length": 179,
"avg_line_length": 56.43854324734446,
"alnum_prop": 0.589922834942059,
"repo_name": "metronotes-beta/metroblockd",
"id": "9bc6119ebac713c3a1830836552bf7a1eb586efc",
"... |
from __future__ import unicode_literals
from datetime import datetime
from django.conf import settings
from django.conf.urls import (
include,
patterns,
url,
)
from django.conf.urls.static import static
from django.contrib import admin
from .views import (
HomeView,
StoryDetailView,
StoryMont... | {
"content_hash": "288379485d9a6e391d7f4a20a9f80e96",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 92,
"avg_line_length": 24.864406779661017,
"alnum_prop": 0.6087252897068848,
"repo_name": "pkimber/hatherleigh_net",
"id": "14e5edc83a74dc9fabac3e726a693b766b6f42b4",
"size... |
from unlock.state.state import UnlockState
class FastPadState(UnlockState):
UP = 1
DOWN = 2
LEFT = 3
RIGHT = 4
SELECT_TIME = 2
def __init__(self):
# Initialize the state
super(FastPadState, self).__init__()
self.previous_mode = "CURSOR"
self.mode = "CURSOR"
... | {
"content_hash": "0a7a3a28a766449b6af93d351a85064f",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 64,
"avg_line_length": 31.649350649350648,
"alnum_prop": 0.48707427164546574,
"repo_name": "NeuralProsthesisLab/unlock",
"id": "6327ab2d3cdeca773dcde0123211638565b07181",
"... |
import pytest
from app.models.organisation import Organisation
from tests import organisation_json
@pytest.mark.parametrize(
"purchase_order_number,expected_result", [[None, None], ["PO1234", [None, None, None, "PO1234"]]]
)
def test_organisation_billing_details(purchase_order_number, expected_result):
organ... | {
"content_hash": "7da65687e8a037c18c1aa8503fea3af5",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 101,
"avg_line_length": 38.833333333333336,
"alnum_prop": 0.776824034334764,
"repo_name": "alphagov/notifications-admin",
"id": "053d9b3104dde1b0e4bb4d61e3a15f47d4f9c753",
... |
from argparse import ArgumentParser
from greengraph import Greengraph
from matplotlib import pyplot as plt
def process():
parser = ArgumentParser(description = "Plot the 'green-ness' of satellite images between two places")
parser.add_argument('--start', help='Choose a start location')
parser.add_argument(... | {
"content_hash": "40bea03bd88ef06867229d32cf649190",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 105,
"avg_line_length": 38.78947368421053,
"alnum_prop": 0.7014925373134329,
"repo_name": "CDTjamie/Greengraph",
"id": "854095abd6b1af20dea388c96ccd5e2c0b940a35",
"size": "... |
from tornado.concurrent import return_future
from thumbor.storages import BaseStorage
from ..aws.storage import AwsStorage
class Storage(AwsStorage, BaseStorage):
"""
S3 Storage
"""
def __init__(self, context):
"""
Constructor
:param Context context: Thumbor's context
... | {
"content_hash": "d8f40bf7f4e78b55f1760ce8c1c6c4f3",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 82,
"avg_line_length": 28.4,
"alnum_prop": 0.5786384976525821,
"repo_name": "abaldwin1/tc_aws",
"id": "5ce31f93415c5abb75ed08771d455a620769b194",
"size": "1864",
"binary"... |
import flask
from flask import request, make_response, current_app
from errorcodes import ErrorCodes
import json
from functools import wraps
def rest_api(f):
"""
A decorator for rest API
:param f:
:return:
"""
@wraps(f)
def decorator(*args, **kwargs):
json_object = None
i... | {
"content_hash": "1c72e5d4f54dc55fc16b0a015165afdf",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 109,
"avg_line_length": 27.375,
"alnum_prop": 0.6080669710806698,
"repo_name": "pureelk/pureelk",
"id": "73bfb5a327909f46039ad5066a57b6c22f8ab5d3",
"size": "1314",
"binar... |
from setuptools import setup
from pympris import __version__, __description__, requires, README
setup(name='pympris',
version=__version__,
description=__description__,
author='Mikhail Mamrouski',
author_email='wst.public.mail@gmail.com',
url="https://github.com/wistful/pympris",
li... | {
"content_hash": "09bcfcdc6268e83ae04c8f09e9a74f19",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 73,
"avg_line_length": 34.370370370370374,
"alnum_prop": 0.5980603448275862,
"repo_name": "wistful/pympris",
"id": "700edef0631355806705d9e3f7989dbd474a6707",
"size": "966"... |
from django.db import models
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from jsonfield import JSONField
#Local Imports
from utils.models import TimeStampedModel,BaseQuerySet
class ForwardMessage(TimeStampedModel):
"""
A ForwardMessage is a message *instance* for inc... | {
"content_hash": "6861cb04a86d75e3e0198e2d80905c4a",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 99,
"avg_line_length": 32.888888888888886,
"alnum_prop": 0.7077702702702703,
"repo_name": "tperrier/mwachx",
"id": "b8f71080d819e40bb7eef6af8d73d0480d3c322a",
"size": "1219... |
"""project 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-ba... | {
"content_hash": "7d14b496cc7672bfb09177ec2fccc16d",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 86,
"avg_line_length": 40.857142857142854,
"alnum_prop": 0.6896853146853147,
"repo_name": "ksamuel/smit",
"id": "16cdc8f3f1ffad95da94732e0424c27fccb8e947",
"size": "1144",
... |
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http, validate
from streamlink.stream import HDSStream, HLSStream, RTMPStream
_url_re = re.compile(r"""http(?:s)?://(?:\w+\.)?rtlxl.nl/#!/(?:.*)/(?P<uuid>.*?)\Z""", re.IGNORECASE)
class rtlxl(Plugin):
@classmethod
de... | {
"content_hash": "1c59861c7f82802d81572d2602eb1827",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 153,
"avg_line_length": 36.083333333333336,
"alnum_prop": 0.6316397228637414,
"repo_name": "mmetak/streamlink",
"id": "11462502a53144ca74d30f48f7302ce5af294893",
"size": "8... |
from keras.layers import Dense, Activation, Conv2D, MaxPool2D, Reshape
model = Sequential()
model.add(Reshape((28, 28, 1), input_shape=(784,) ))
model.add(Conv2D(filters=32, kernel_size=(3,3), padding='same', activation="relu"))
model.add(MaxPool2D())
model.add(Conv2D(filters=64, kernel_size=(3,3), padding='same', acti... | {
"content_hash": "6246bf342c29f984fdc3c139ef3d8a1a",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 100,
"avg_line_length": 50.1764705882353,
"alnum_prop": 0.7045720984759671,
"repo_name": "tjwei/HackNTU_Data_2017",
"id": "80a0c4412420a1c9b00d08217563b54ba38a72e0",
"size"... |
import logging
import time
import unicodedata
from urllib2 import URLError
from apps.cowry.adapters import AbstractPaymentAdapter
from apps.cowry.models import PaymentStatuses, PaymentLogLevels
from django.conf import settings
from django.utils.http import urlencode
from suds.client import Client
from suds.plugin impor... | {
"content_hash": "2c384a10c1d63190201f864cc2c3d1ef",
"timestamp": "",
"source": "github",
"line_count": 674,
"max_line_length": 141,
"avg_line_length": 48.4406528189911,
"alnum_prop": 0.6093601641704187,
"repo_name": "onepercentclub/onepercentclub-site",
"id": "42d1d472e837dd4aa70b72bd70bfbc22f43e28f... |
import os
from setuptools import setup, find_packages
from misc import VERSION, PROJECT
MODULE_NAME = 'django-misc'
PACKAGE_DATA = list()
for directory in [ 'templates', 'static' ]:
for root, dirs, files in os.walk( os.path.join( MODULE_NAME, directory )):
for filename in files:
PACKAGE_DATA... | {
"content_hash": "2230eec12bb7ff4ab1de8502fb71c882",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 82,
"avg_line_length": 23.767441860465116,
"alnum_prop": 0.6135029354207436,
"repo_name": "ilblackdragon/django-misc",
"id": "af24befb77cc0038b54b1c9699d8e655491909e8",
"si... |
"""Sensors for the Elexa Guardian integration."""
from __future__ import annotations
from typing import Callable
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_TEMPERATURE,
P... | {
"content_hash": "d91a5446afc04b85adb135c0977e65d3",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 88,
"avg_line_length": 31.733333333333334,
"alnum_prop": 0.6182472989195679,
"repo_name": "adrienbrault/home-assistant",
"id": "48807c9cfeb78977e2608a359d27b900a5b14460",
... |
import sys
import epyc
if __name__ == "__main__":
if len(sys.argv) > 1:
print(epyc.render(sys.argv[1]))
else:
string = "\n".join(iter(input, ""))
print(epyc._render(string, {"a": [1, 2, 3]}))
# Node Testing
#import render
#print(render.ForNode("a", "[1, 2, 3]", render.GroupNode([render.TextNode("hello, a:")... | {
"content_hash": "d6664ea0b527f2d5398fa5faa5934eb6",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 150,
"avg_line_length": 43.93333333333333,
"alnum_prop": 0.6312594840667678,
"repo_name": "cyphar/epyc",
"id": "fcf8df62d3d11058935d5a5b597702e3bfd86690",
"size": "1834",
... |
import logging
import pickle
from typing import Dict, List, Optional, Tuple, Union
from ray.tune.result import DEFAULT_METRIC
from ray.tune.sample import Categorical, Domain, Float, Integer, Quantized
from ray.tune.suggest.suggestion import UNRESOLVED_SEARCH_SPACE, \
UNDEFINED_METRIC_MODE, UNDEFINED_SEARCH_SPACE
f... | {
"content_hash": "6da07cbfe4f91c67701a20eb73cd7265",
"timestamp": "",
"source": "github",
"line_count": 343,
"max_line_length": 79,
"avg_line_length": 38.86880466472303,
"alnum_prop": 0.5755325532553255,
"repo_name": "richardliaw/ray",
"id": "f8b8d9196ab0e3e487b655016f8a7b92c29122da",
"size": "1333... |
class DummyRPC(object):
def __init__(self):
self._CALL_TIME_MAP = {}
def call_by_id(self, i=0):
check = self._CALL_TIME_MAP.get(i)
assert(check is None)
self._CALL_TIME_MAP[i] = True
return i
def call_by_ids(self, ids=[]):
check = self._CALL_TIME_MAP.get(st... | {
"content_hash": "86d5d9d8a9a6624c0f1e7060bef1663a",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 51,
"avg_line_length": 25.057692307692307,
"alnum_prop": 0.5203376822716808,
"repo_name": "reAsOn2010/webnodeEx",
"id": "1c767152980af86498c32a21e8ee6428bb89809d",
"size": ... |
from rpython.rtyper.lltypesystem import lltype, llmemory
from rpython.rtyper.lltypesystem import rdict
from rpython.rlib.objectmodel import we_are_translated
from rpython.memory.support import mangle_hash
# This is a low-level AddressDict, reusing a lot of the logic from rdict.py.
# xxx this is very dependent on the d... | {
"content_hash": "b9824f3ac740d94e1b3a120b660dc8f2",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 76,
"avg_line_length": 34.23,
"alnum_prop": 0.563248612328367,
"repo_name": "oblique-labs/pyVM",
"id": "56657e6c003de5ff37f1e5bfaf9a2e81daad4faf",
"size": "3423",
"binar... |
"""Train a Fast R-CNN network."""
import caffe
from fast_rcnn.config import cfg
import roi_data_layer.roidb as rdl_roidb
from utils.timer import Timer
import numpy as np
import os
from caffe.proto import caffe_pb2
import google.protobuf as pb2
import google.protobuf.text_format
class SolverWrapper(object):
"""A ... | {
"content_hash": "148017939e90fc297d1a0dc7e1cbc00f",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 79,
"avg_line_length": 37.57692307692308,
"alnum_prop": 0.588877516206073,
"repo_name": "ucloud/uai-sdk",
"id": "4a6d362ecfbba6d0c4920d0b37e5d3418d8eaba7",
"size": "6111",... |
revision = '2a3bf49ef34'
down_revision = '25d765ee53b'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
op.create_table('proposal_activity_item',
sa.Column('id', postgresql.UUID(), nullable=False),
sa.Column('date', sa.Date(), nullable=True)... | {
"content_hash": "48fed51740b94ef018b3756a2c6aaf92",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 68,
"avg_line_length": 31.869565217391305,
"alnum_prop": 0.6562073669849932,
"repo_name": "mgax/mptracker",
"id": "03d5cbd6bb1a70aaca02bb3b948b84625fde1bd5",
"size": "733",... |
"""
Python Quake 3 Library
http://misc.slowchop.com/misc/wiki/pyquake3
Copyright (C) 2006-2007 Gerald Kaszuba
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at y... | {
"content_hash": "e31d39062a27318c911a1674b3a1610c",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 175,
"avg_line_length": 29.668161434977577,
"alnum_prop": 0.5459492140266021,
"repo_name": "SpunkyBot/spunkybot",
"id": "bf509c813a038e88046b512c35ad8bc62ef94b12",
"size":... |
import logging
import os
import re
import pyqtgraph as pg
from .browser import Browser
from .curves import ResultsCurve, Crosshairs
from .inputs import BooleanInput, IntegerInput, ListInput, ScientificInput, StringInput
from .log import LogHandler
from .Qt import QtCore, QtGui
from ..experiment import parameters, Pro... | {
"content_hash": "ed5365fae41dfe912e04e9036cba8151",
"timestamp": "",
"source": "github",
"line_count": 389,
"max_line_length": 99,
"avg_line_length": 35.75064267352185,
"alnum_prop": 0.6019270870784497,
"repo_name": "dvspirito/pymeasure",
"id": "c004ff06f1b2f01f47e5ae645bd0cf792d61808c",
"size": "... |
import random
import sys
import time
import numpy as np
from pybrain.structure import LinearLayer, SigmoidLayer, FeedForwardNetwork, FullConnection
from pybrain.structure.networks import NeuronDecomposableNetwork
import gym
# ---- TASKS
class ClassifyTask(object):
def get_problem_size(self):
"""Returns ... | {
"content_hash": "8ba18e05003278965770635fb1474a40",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 91,
"avg_line_length": 29.893939393939394,
"alnum_prop": 0.5964267612772428,
"repo_name": "A-Malone/coop-neural-nets",
"id": "a73e48f2c02be325b86c4e150f31d02da9ae615a",
"s... |
import unittest
try:
from unittest.mock import Mock, patch, mock_open, MagicMock
except ImportError:
from mock import Mock, patch, mock_open, MagicMock
class TestCase(unittest.TestCase):
def __init__(self, *args, **kwargs):
self.mock_open = mock_open
self.Mock = Mock
self.MagicMoc... | {
"content_hash": "d43738724f8bea824d6f29322a15ceeb",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 63,
"avg_line_length": 30,
"alnum_prop": 0.6304093567251462,
"repo_name": "marcwebbie/mockie",
"id": "6ec780c1624191248e9cb7b52506c85a0f199d63",
"size": "1710",
"binary":... |
import contextlib
import os
import json
import sys
import jsonpickle
import plac
from selenium import webdriver
from huxley.run import TestRun
from huxley.errors import TestError
DRIVERS = {
'firefox': webdriver.Firefox,
'chrome': webdriver.Chrome,
'ie': webdriver.Ie,
'opera': webdriver.Opera
}
CAPA... | {
"content_hash": "9fc6f870e36a85e6a0c17ff46e726e4e",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 128,
"avg_line_length": 36.952,
"alnum_prop": 0.5897380385364798,
"repo_name": "10io/huxley",
"id": "2139379ee242df34903e41b547df14e6e2fb652a",
"size": "5196",
"binary":... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.manager
class Migration(migrations.Migration):
dependencies = [
('books', '0002_auto_20170131_0803'),
]
operations = [
migrations.CreateModel(
name='Person',
... | {
"content_hash": "6c1f4c816390afde24b857d6ee568213",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 114,
"avg_line_length": 32.166666666666664,
"alnum_prop": 0.5397236614853195,
"repo_name": "widodopangestu/mysite",
"id": "8c25fc4061fb8abe3469fdd7d999fc812dc54808",
"size"... |
from data_types.user import User
class DiscussionComment:
"""
GitHub DiscussionComment
https://developer.github.com/v3/discussions/comments/
Attributes:
id: Comment id
node_id: Node id
html_url: Public URL for discussion comment on github.com
body: Discussion comment ... | {
"content_hash": "f6502eab82d57be3f9d4f0b4233b987a",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 65,
"avg_line_length": 24.3,
"alnum_prop": 0.565843621399177,
"repo_name": "codex-bot/github",
"id": "ef1371fd8185ba3a1cebfbb9103a0771028ffdaf",
"size": "972",
"binary": ... |
"""
relshell.columndef
~~~~~~~~~~~~~~~~~~
:synopsis: Provides column definitions.
"""
import re
from relshell.type import Type
class ColumnDef(object):
"""Specifies column's features (name, type, ...)."""
required_fields = [
'name',
]
"""Required fields for column definition.
... | {
"content_hash": "62089dff98f1b236271b77b47e3656e8",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 123,
"avg_line_length": 30.05263157894737,
"alnum_prop": 0.5923817863397548,
"repo_name": "laysakura/relshell",
"id": "796c8efaeb7c79fa6a251adb67d93e9e7defd694",
"size": "2... |
from base import WithDaemonTestCase
from pysource.tests import command
class SourceInlineTest(WithDaemonTestCase):
def test_source_inline(self):
output = self.run_pysource_script([
command.source_inline('name=3'),
command.source_def('function1(): return name'),
command... | {
"content_hash": "0d4741fd5f59b758db78d600075dcfe1",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 63,
"avg_line_length": 30.91304347826087,
"alnum_prop": 0.6118143459915611,
"repo_name": "dankilman/pysource",
"id": "df4977d2ac2c06338d64385485bebeab14478bae",
"size": "12... |
from fitness_evaluator import FitnessEvaluator
from genetic_algorithm import GeneticAlgorithm
from individual import Individual
from individual_factory import IndividualFactory
from termination_criteria import TerminationCriteria
from termination_criteria import ExecutionTimeTerminationCriteria
from termination_criteri... | {
"content_hash": "107ef245140ae4a75ee1028aa8d37c72",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 71,
"avg_line_length": 52.42857142857143,
"alnum_prop": 0.9100817438692098,
"repo_name": "fberanizo/sin5006",
"id": "739617b8f8999a127d38fb90b2a1f1f288e2f3bd",
"size": "367"... |
import plyj.parser as plyj
import pretty_printer
import zipfile
import json
import sys
def package_job(files, location):
parser = plyj.Parser()
printer = pretty_printer.PrettyPretter(2)
with zipfile.ZipFile(location, mode='w') as zip_file:
for f in files:
parsed = parser.parse_file(fi... | {
"content_hash": "4c43667b7b03af512732c8b22b0d0151",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 82,
"avg_line_length": 31.09259259259259,
"alnum_prop": 0.669446098868374,
"repo_name": "AKST/algos",
"id": "9c63c6fb2af6dee7c38d52d9b3147c042057fc05",
"size": "1679",
"b... |
"""
settings.py
Configuration for Flask app
Important: Place your keys in the secret_keys.py module,
which should be kept out of version control.
"""
from secret_keys import *
class Config(object):
# Set secret keys for CSRF protection
SECRET_KEY = CSRF_SECRET_KEY
CSRF_SESSION_KEY = SESSION... | {
"content_hash": "1ab5609db559c06aca2336be6da60d36",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 57,
"avg_line_length": 21.13888888888889,
"alnum_prop": 0.6793692509855453,
"repo_name": "gdbelvin/mail-safe-test",
"id": "3162ef60b03152ddae98a2b14e1342f4e1b6ab7e",
"size"... |
class HostUnavailable(Exception):
pass
class UnknownHost(Exception):
pass
| {
"content_hash": "7d62be334046b7ea01eaee07b35ff632",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 33,
"avg_line_length": 14,
"alnum_prop": 0.7380952380952381,
"repo_name": "ph147/tv",
"id": "7520fad93092591a9ff222be90290998a9d2b5c0",
"size": "104",
"binary": false,
"... |
import json, sys, csv
def convert(path):
keywords = json.load(open('./twows/{}/dict.json'.format(path),'r'))
vote_strings={}
votes = []
final_votes = []
with open('./twows/{}/votes.csv'.format(path),'r') as csvfile:
reader = csv.reader(csvfile)
for row in reader:
try:
vote_strings[row[0]].append(ro... | {
"content_hash": "261b8c616a1982750bd64b8ce2eaf426",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 79,
"avg_line_length": 21.140845070422536,
"alnum_prop": 0.6062624916722186,
"repo_name": "Noahkiq/TWOWBot",
"id": "8da90b3cae6685b8dc9326f15070ccbb7f5754ca",
"size": "1501... |
import numpy as np
import pandas as pd
from bokeh.models import Band, ColumnDataSource
from bokeh.plotting import figure, output_file, show
output_file("band.html", title="band.py example")
# Create some random data
x = np.random.random(2500) * 140 - 20
y = np.random.normal(size=2500) * 2 + 5
df = pd.DataFrame(data... | {
"content_hash": "0da5a065b903c086f72752c75c65b9c2",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 86,
"avg_line_length": 28.875,
"alnum_prop": 0.6744588744588744,
"repo_name": "ericmjl/bokeh",
"id": "413f4e205ecf27590093240c09f1655c5eb04916",
"size": "1155",
"binary":... |
__author__ = "laike9m (laike9m@gmail.com)"
__title__ = 'ezcf'
__version__ = '0.2.0'
__license__ = 'MIT'
__copyright__ = 'Copyright 2015 laike9m'
import sys
from .api import ConfigFinder
sys.meta_path.append(ConfigFinder()) | {
"content_hash": "16c194da69e2a55530b30f63cb19a9f8",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 42,
"avg_line_length": 22.4,
"alnum_prop": 0.6651785714285714,
"repo_name": "hzruandd/ezcf",
"id": "ebf60c5a4041b13c42098e442e19eff19fcf47d9",
"size": "224",
"binary": fa... |
import os
import pygame
from pygame.locals import *
from GIFMode import GIFMode
from GradientMode import GradientMode
from Grid import *
from LEDController import NEOPixel
(width, height) = (640, 480)
class App:
def __init__(self):
self.running = True
self.screen = None
self.fullscreen ... | {
"content_hash": "bf96bb1bc6247eed603332ea7de0f734",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 80,
"avg_line_length": 27.55263157894737,
"alnum_prop": 0.5495065265838904,
"repo_name": "theceremony/pyramids-installation",
"id": "6de024438aee16ee4ad79be0c6aaf7ca476b3096... |
"""Module for testing the deploy domain command."""
import os.path
from shutil import rmtree
import unittest
if __name__ == "__main__":
import utils
utils.import_depends()
from brokertest import TestBrokerCommand
class TestDeployDomain(TestBrokerCommand):
def head_commit(self, sandbox, ref="HEAD"):
... | {
"content_hash": "609dad3a380c961c5ed28cea26aae9bb",
"timestamp": "",
"source": "github",
"line_count": 301,
"max_line_length": 132,
"avg_line_length": 45.39202657807309,
"alnum_prop": 0.5608577911146893,
"repo_name": "guillaume-philippon/aquilon",
"id": "b115a09372e0a6074c5e7d786d6585fda0e5ce8b",
... |
'''
Created on Jul 14, 2012
Copyright © 2013
The Board of Trustees of The Leland Stanford Junior University.
All Rights Reserved
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.apa... | {
"content_hash": "d63b27c25fd82c0dd094a38e0b96b066",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 89,
"avg_line_length": 28.514285714285716,
"alnum_prop": 0.7374749498997996,
"repo_name": "daStrauss/subsurface",
"id": "649c99d311f6de0ede97691e9fa19f8a38972283",
"size": ... |
import pytest
# local imports
from stretch import application
from stretch.triggers import results
from tests.utils import fixture_loader
@pytest.fixture
def configured_app():
app_json = fixture_loader.json_fixture("web-service-configured")
return application.Application(app_json)
@pytest.fixture
def confi... | {
"content_hash": "42bd5ccca22fb5c064b2c8900db53839",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 104,
"avg_line_length": 32.792682926829265,
"alnum_prop": 0.6719970249163257,
"repo_name": "paddycarey/stretch",
"id": "cc7551b00ad1b7d029d7b2a7d4a65b092df011f6",
"size": "... |
from pudzu.charts import *
df = pd.read_csv("datasets/flagsgyw.csv")
groups = list(remove_duplicates(df.group))
array = [[dict(r) for _,r in df.iterrows() if r.group == g] for g in groups]
data = pd.DataFrame(array, index=list(remove_duplicates(df.group)))
FONT = calibri or sans
fg, bg="black", "#EEEEEE"
default_img ... | {
"content_hash": "e28e1c2bec0bc20d2ddfb15050530f28",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 280,
"avg_line_length": 60.06060606060606,
"alnum_prop": 0.6644803229061554,
"repo_name": "Udzu/pudzu",
"id": "218c360ad93cbf0cc96c0a53f1620abd16b04bf5",
"size": "1982",
... |
"""
.. codeauthor:: Cédric Dumay <cedric.dumay@gmail.com>
"""
import logging
from uuid import uuid4
from cdumay_error.types import ValidationError
from cdumay_result import Result, ResultSchema
from kser import KSER_TASK_COUNT, __hostname__, KSER_METRICS_ENABLED, \
KSER_TASKS_STATUS
from kser.schemas import Mess... | {
"content_hash": "9b0387a49b89309ebfbd6fc468c2150c",
"timestamp": "",
"source": "github",
"line_count": 283,
"max_line_length": 79,
"avg_line_length": 29.724381625441698,
"alnum_prop": 0.5349500713266762,
"repo_name": "cdumay/kser",
"id": "07226c213f3607fa27c93cf80e0a0219662c5a27",
"size": "8460",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.