text stringlengths 4 1.02M | meta dict |
|---|---|
import pulsar
from pulsar.schema import *
import sys
class ReceiveExample(Record):
x = Integer()
y = Long()
service_url = sys.argv[1]
topic = sys.argv[2]
client = pulsar.Client(service_url)
consumer = client.subscribe(
topic=topic,
subscription_name="my-subscription... | {
"content_hash": "a18b3fc80610bb087eb771c8b7f94f62",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 56,
"avg_line_length": 17,
"alnum_prop": 0.5983772819472617,
"repo_name": "nkurihar/pulsar",
"id": "64efcbecead7366f93390f46b2efffc10127075a",
"size": "1305",
"binary": f... |
from Child import Child
from Node import Node # noqa: I201
ATTRIBUTE_NODES = [
# token-list -> token? token-list?
Node('TokenList', kind='SyntaxCollection',
element='Token'),
# token-list -> token token-list?
Node('NonEmptyTokenList', kind='SyntaxCollection',
element='Token', omit_w... | {
"content_hash": "594ebff073509fe16c2559846c672c67",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 79,
"avg_line_length": 44.47767857142857,
"alnum_prop": 0.5250426578339857,
"repo_name": "sschiau/swift",
"id": "750810beb10efc6b3e15bb27a23513e19a5de3a9",
"size": "9963",... |
"""Pytest plugins globally available.
`conftest.py` file is automatically detected by Pytest and register
plugins (hooks and fixtures) common to all tests.
See: https://docs.pytest.org/en/latest/writing_plugins.html
"""
from typing import Iterator, Type
import pytest
from tensorflow_datasets import testing
from ten... | {
"content_hash": "5728e79d1661b550902c12af1f1c0595",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 136,
"avg_line_length": 34.05813953488372,
"alnum_prop": 0.7603277569136224,
"repo_name": "tensorflow/datasets",
"id": "46cb05e06eeb2793b5dbc85747200cc134cc2791",
"size": "... |
from tspapi import API
from tspapi import Source
from tspapi import Sender
from tspapi import Measurement
import tspapi.event
from unittest import TestCase
from tspapi import RawEvent
from datetime import datetime
import random
import os
import sys
import json
_path = os.path.dirname(__file__)
sys.path.append(_path)
f... | {
"content_hash": "2f748c122284ec2143e7c521003cf498",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 136,
"avg_line_length": 38.943396226415096,
"alnum_prop": 0.6107073643410853,
"repo_name": "jdgwartney/pulse-api-python",
"id": "3f369fa54fcef8683878ea8dc2d39e1e4b2913e5",
... |
import greenlet
from .hub import get_hub
from ..timeout import Timeout
__all__ = ['gyield', 'trampoline']
def gyield(switch_back=True):
"""Yield to other greenlets
This is a cooperative yield which suspends the current greenlet and allows other greenlets to
run by switching to the hub.
- If `switc... | {
"content_hash": "0fdedc9964379d8ef89c398d784df682",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 100,
"avg_line_length": 37.775,
"alnum_prop": 0.6813368630046327,
"repo_name": "veegee/guv",
"id": "fa741912753bb7dd6041bbbcb5ecb9ea8af84ee9",
"size": "3022",
"binary": f... |
from sklearn.grid_search import GridSearchCV
from sklearn.linear_model import SGDClassifier
from sklearn.cross_validation import KFold
import numpy as np
import cPickle
import logging
logger = logging.getLogger('train')
handler = logging.FileHandler('train.log')
formatter = logging.Formatter("%(asctime)s %(levelname)... | {
"content_hash": "4bbfe3cbc1f4df6085c6ef066dbe3481",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 89,
"avg_line_length": 37.43181818181818,
"alnum_prop": 0.7043108682452944,
"repo_name": "alexrkopp/weather-severity-model",
"id": "48fec81dd7e1f497b230e2c382cf11b0d0a2d9e7",... |
import json
import requests
import time
class APIProblem(Exception):
pass
api_key = "19c03581-6d29-43ff-8390-a99ef89132ac"
base_url = "https://na.api.pvp.net"
region = "na"
accounts = [{"real_name": "Jesse", "name": "iRemyxed"},
{"real_name": "Mike", "name": "Shichao"},
{"real_name": ... | {
"content_hash": "56bd610b7338083e47fe09638eb1aaf6",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 120,
"avg_line_length": 31.27310924369748,
"alnum_prop": 0.5857853016256885,
"repo_name": "rkgibson2/hackfest-project",
"id": "9b95a06d9ce7e29d9736f1b49545c5048aa8a461",
"... |
import paramiko
from select import select
import re
import datetime
_JUNOS_PROMPT = '> '
_SHELL_PROMPT = '(%|#)\s'
_SELECT_WAIT = 0.1
_RECVSZ = 1024
class StartShell(object):
"""
Junos shell execution utility. This utility is written to
support the "context manager" design pattern. For example::
... | {
"content_hash": "4c2d6e3b7b3851aafca3e7cc1ccb0fbe",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 79,
"avg_line_length": 32.928104575163395,
"alnum_prop": 0.5398967844382692,
"repo_name": "spidercensus/py-junos-eznc",
"id": "07956c0ee06f68aadbaf4c05f1558c2004e1e5f0",
"... |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('foundation', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='CoreAwardCohort',
fields=[
('id', model... | {
"content_hash": "22f7d2a48e5a6ea79372b09af21cf059",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 152,
"avg_line_length": 46.44117647058823,
"alnum_prop": 0.5953134895503484,
"repo_name": "django/djangoproject.com",
"id": "8f28a285fd6b584de1de613c1cab915971508d2f",
"siz... |
import math
import random
import numpy as np
import tensorflow as tf
from tensorforce import TensorforceError, util
from tensorforce.core import parameter_modules, TensorSpec, tf_function, tf_util
from tensorforce.core.layers import Layer, NondeterministicLayer
class Activation(Layer):
"""
Activation layer ... | {
"content_hash": "720c266f296a8d4e52c9695fb4d9988f",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 99,
"avg_line_length": 33.604651162790695,
"alnum_prop": 0.5815916955017301,
"repo_name": "reinforceio/tensorforce",
"id": "25a98b645110f4647fbe38b794816c2e5da221c1",
"siz... |
DEPENDS = [ 'base', 'dialog' ]
import television
def get_data(k):
television.get_data(k)
| {
"content_hash": "5438f7abeb226059381a85ca0247e252",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 33,
"avg_line_length": 14.142857142857142,
"alnum_prop": 0.6262626262626263,
"repo_name": "gooofy/zamia-ai",
"id": "f085b4df4a9dd82ab9e209b8c8f31e4d143b3437",
"size": "743",... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '0010_migrate_use_structure'),
]
operations = [
migrations.CreateModel(
name='RawHtmlPlugin',
fields=[
... | {
"content_hash": "a159f71e728a7b6354f9e7a4dd7dceb8",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 148,
"avg_line_length": 27.541666666666668,
"alnum_prop": 0.5491679273827534,
"repo_name": "makukha/cmsplugin-raw-html",
"id": "548994faa7bdf2ccedc7ecc3d1da81d3238e70cf",
"... |
import _plotly_utils.basevalidators
class OutlinecolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="outlinecolor", parent_name="choropleth.colorbar", **kwargs
):
super(OutlinecolorValidator, self).__init__(
plotly_name=plotly_name,
... | {
"content_hash": "c988cd9d9aec5200747c2c5b979ba65b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 85,
"avg_line_length": 34,
"alnum_prop": 0.6266968325791855,
"repo_name": "plotly/plotly.py",
"id": "c3820715c1558f0ff4c70c5dc426f970f7d39e84",
"size": "442",
"binary": f... |
import logging
import multiprocessing
import os
import random
import subprocess
import time
import math
from threading import Thread
from threading import Semaphore, Lock, Condition
from Queue import Queue, Empty
from toil.batchSystems.abstractBatchSystem import AbstractBatchSystem
logger = logging.getLogger(__name__... | {
"content_hash": "fc0e79bd532174561224d87f8ba11578",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 133,
"avg_line_length": 46.94795539033457,
"alnum_prop": 0.5819146409058517,
"repo_name": "BD2KGenomics/toil-old",
"id": "ce012ab4531d14f7a4e012c35fe8d52fbd4d5c57",
"size"... |
from django.conf import settings
from django.utils.module_loading import import_string
DJANGO_TRANSLATOR_MODELS = getattr(settings, 'DJANGO_TRANSLATOR_MODELS', {})
class Translator(object):
def __init__(self, request, model_class=None):
from translator.models import Translation
self.request = r... | {
"content_hash": "3293f981c735eb3e58a6a2d429df38ba",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 79,
"avg_line_length": 32.65384615384615,
"alnum_prop": 0.7126030624263839,
"repo_name": "dreipol/django-translator",
"id": "23a0977f8de9af9ceb738e9278d6501162f335cf",
"siz... |
"""
A connection to the VMware vCenter platform.
"""
import re
from oslo.config import cfg
from oslo.vmware import api
from oslo.vmware import vim
import suds
from nova import exception
from nova.i18n import _, _LW
from nova.openstack.common import jsonutils
from nova.openstack.common import log as logging
from nova... | {
"content_hash": "2a5499d94f1f72daac20d317d1b20376",
"timestamp": "",
"source": "github",
"line_count": 647,
"max_line_length": 79,
"avg_line_length": 42.244204018547144,
"alnum_prop": 0.5870774184106542,
"repo_name": "vmthunder/nova",
"id": "74dbcb789ef7ddf3889a806b7a27a713ef7e4858",
"size": "2808... |
"""Handle parsing of the 2 different config files."""
import yaml
import pprint
import os
from .model import Rule, CommandSet
from . import DEFAULTS_PATH, USER_PATH
def import_default(path):
with open(path) as f:
structure = yaml.load(f)
defaults = structure.pop("all")
for k, v in structur... | {
"content_hash": "34d7626d0a19b385c782fedce591e5d5",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 72,
"avg_line_length": 26.941176470588236,
"alnum_prop": 0.6004366812227074,
"repo_name": "ssherar/hook",
"id": "316fd369fc30753a35bc88ea85d49b3091dde786",
"size": "916",
... |
import numpy as np
import matplotlib.pyplot as plt
"""
Classes used to simulate different data sets
"""
class Simulate(object):
"A class to simulate multiple types of data"
def __init__(self,seed=101):
"""
Constructor
"""
self.seed = seed
def set_rseed(self,seed=None... | {
"content_hash": "63b53c4278fdb70ef128bcc2ccb40525",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 71,
"avg_line_length": 24.496296296296297,
"alnum_prop": 0.530692470517085,
"repo_name": "ajrichards/htsint",
"id": "1f117fe41531ca3bfdcca0dfac0ea3e3ea28ec0d",
"size": "33... |
"""Tests for Keras Premade WideNDeep models."""
import numpy as np
import tensorflow.compat.v2 as tf
from keras.engine import input_layer
from keras.engine import sequential
from keras.engine import training
from keras.feature_column import dense_features_v2
from keras.layers import core
from keras.optimizers.optimiz... | {
"content_hash": "57753112d2b506a380bfd9cca2c4b36b",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 80,
"avg_line_length": 44.25874125874126,
"alnum_prop": 0.5946437035866645,
"repo_name": "keras-team/keras",
"id": "570a073650ac62cd7bc3d2016446b48afd3843a4",
"size": "133... |
from __future__ import unicode_literals
import os
import hashlib
import json
class FilePathInfo(object):
"""Give additional info around file path:
>>> f = FilePathInfo('/path/to/my_file.txt')
>>> f.file_name
'my_file.txt'
>>> f.file_extension
'txt'
>>> f.file_name_without_extension
'... | {
"content_hash": "c68d26933746e54ce07ed050acec3044",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 78,
"avg_line_length": 27.567010309278352,
"alnum_prop": 0.5695587135377711,
"repo_name": "InfoAgeTech/django-core",
"id": "eee4b692ced5c8469b108686e2fe492a12906d35",
"size... |
import re
from tests.helpers import BaseApplicationTest
def load_prometheus_metrics(response_bytes):
return dict(re.findall(rb"(\w+{.+?}) (\d+)", response_bytes))
class TestMetricsPage(BaseApplicationTest):
def test_metrics_page_accessible(self):
metrics_response = self.client.get('/_metrics')
... | {
"content_hash": "097709e543ee793c9f2cd498a44bed1f",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 100,
"avg_line_length": 35.03508771929825,
"alnum_prop": 0.6529794692038057,
"repo_name": "alphagov/digitalmarketplace-buyer-frontend",
"id": "527c84aee27422ed7071e7ae82a9e7f... |
default_app_config = 'home.apps.HomeConfig' | {
"content_hash": "37970b0b9cbcf68f6e077cc9988f6740",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 43,
"avg_line_length": 43,
"alnum_prop": 0.7906976744186046,
"repo_name": "sakset/getyourdata",
"id": "33cabb65b533968ac570d8fd873071b15f0a9e5e",
"size": "43",
"binary": f... |
import os, sys
import mercadopago
import json
def index(req, **kwargs):
mp = mercadopago.MP("CLIENT_ID", "CLIENT_SECRET")
filters = {
"status": "approved",
"offset": 0,
"limit": 10
}
searchResult = mp.search_payment(filters)
return json.dumps(searchResult, indent=4) | {
"content_hash": "375581b56b932e5c22d66d676df40d3b",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 53,
"avg_line_length": 18.764705882352942,
"alnum_prop": 0.6050156739811913,
"repo_name": "matikbird/matikbird.github.io",
"id": "eff71d00216507e8776c43b47e9780f7f3db049d",
... |
try:
import pymysql
pymysql.install_as_MySQLdb()
except ImportError:
pass
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ironninja5.settings")
from django.core.management import execute_from_command_line
execute_from_com... | {
"content_hash": "688027eb04e491e3ab145db02e63b1c9",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 21.25,
"alnum_prop": 0.7058823529411765,
"repo_name": "colinvandermeer/ironninja5",
"id": "77863db71e5f65445d2a5dd0042d95028f3272a6",
"size": "340",
... |
"""Tests for monascastatsd.py."""
import collections
import socket
import time
import unittest
import monascastatsd as mstatsd
from unittest import mock
import six
from six.moves import range
class FakeSocket(object):
"""A fake socket for testing."""
def __init__(self):
self.payloads = collection... | {
"content_hash": "f340dfd51c26f3b7f3ffcd69d0ea4a4f",
"timestamp": "",
"source": "github",
"line_count": 272,
"max_line_length": 99,
"avg_line_length": 34.8639705882353,
"alnum_prop": 0.5443425076452599,
"repo_name": "stackforge/monasca-statsd",
"id": "d8692c8915ea7ef3a06e6a8cfb7ec836a608e023",
"siz... |
header_top = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>
"""
header_bottom= """
</title>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.mi... | {
"content_hash": "b3f56531ee8cc9bbe2423184ad552718",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 292,
"avg_line_length": 46.51851851851852,
"alnum_prop": 0.5931528662420382,
"repo_name": "tiagolb/CSF",
"id": "10e74d751bdfe54cd96a152bb5a3c09ec4ee52e3",
"size": "2536",
... |
from __future__ import print_function
from golfr.find_grid_points.filter_points import group_points
from os import listdir
from os.path import abspath, basename, join, dirname
import sys, traceback
import pandas as pd
import cv2
def test_filter_points():
data_dir = abspath(join(dirname(__file__),'filter_pnts_dat... | {
"content_hash": "c2f52ad8cf15429283e56bae78722723",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 76,
"avg_line_length": 29.5,
"alnum_prop": 0.6514830508474576,
"repo_name": "joshshep/golfr",
"id": "50a6ad2c0506aedce7a31f8bc959b72bb4c8fcb7",
"size": "967",
"binary": f... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
__author__ = "William Dabney"
from rlpy.Domains import GridWorld
from rlpy.Agents import LSPI
from ... | {
"content_hash": "add38f1c2c0cf1f9e309bd963aabfb36",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 80,
"avg_line_length": 30.714285714285715,
"alnum_prop": 0.6728682170542636,
"repo_name": "rlpy/rlpy",
"id": "c7073ea93361d3f3ca0d50f1996b5fa9e31b7107",
"size": "1958",
"... |
# -*- coding: utf-8 -*-
# Copyright 2011 Google Inc. All Rights Reserved.
# Copyright 2011, Nexenta Systems Inc.
#
# 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/... | {
"content_hash": "2914a5a20f82e319a6e66ad630af0d6f",
"timestamp": "",
"source": "github",
"line_count": 4335,
"max_line_length": 130,
"avg_line_length": 42.09711649365629,
"alnum_prop": 0.6492703749773961,
"repo_name": "endlessm/chromium-browser",
"id": "97a13962c21a908fa9034c6c8cf9aec02e99fad1",
"... |
from zerver.lib.test_classes import WebhookTestCase
from zerver.models import get_realm, get_user
class WordPressHookTests(WebhookTestCase):
STREAM_NAME = 'wordpress'
URL_TEMPLATE = "/api/v1/external/wordpress?api_key={api_key}"
FIXTURE_DIR_NAME = 'wordpress'
def test_publish_post(self) -> None:
... | {
"content_hash": "e329315869a3bc9d29efd59ef7316ac1",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 102,
"avg_line_length": 47.02197802197802,
"alnum_prop": 0.6326244449637766,
"repo_name": "mahim97/zulip",
"id": "85927876837bf75b6a0648015d424c9fa0e20fe0",
"size": "4303",... |
import torch
from torch.utils.data import Dataset
class MimicDatasetSynthetic(Dataset):
def __init__(self, doc_length=512, num_vocab=1_000, num_docs=100, num_classes=10):
self.doc_length = doc_length
self.num_vocab = num_vocab
self.num_docs = num_docs
self.num_classes = num_classe... | {
"content_hash": "dcba3391550724d9685dbb6f1a165369",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 86,
"avg_line_length": 34.57142857142857,
"alnum_prop": 0.6129476584022039,
"repo_name": "ECP-CANDLE/Benchmarks",
"id": "bba8890548da1c4c5910b247ecfb8c6f878d5c2b",
"size": ... |
"""
A model for testing
"""
from django.db import models
from fields import MACAddressField
class NetworkThingy(models.Model):
mac = MACAddressField()
def __unicode__(self):
return "%s" % self.mac
| {
"content_hash": "631a56ae3f8439eae9274542869011e6",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 34,
"avg_line_length": 19.545454545454547,
"alnum_prop": 0.6790697674418604,
"repo_name": "jimfunk/django-macaddress",
"id": "06a95e9d1b558361861c7c32432c2d442ef9dde3",
"si... |
from django.test import RequestFactory
from django_th.tests.test_main import MainTest
import requests
from th_wallabag.models import Wallabag
from th_wallabag.forms import WallabagProviderForm, WallabagConsumerForm
from th_wallabag.my_wallabag import ServiceWallabag
from unittest.mock import patch
class WallabagT... | {
"content_hash": "e223474281bc1bdf1f3541efc38d5bbd",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 78,
"avg_line_length": 32.52554744525548,
"alnum_prop": 0.5536355475763016,
"repo_name": "foxmask/django-th",
"id": "c60f75275152eaa7022803f897099e5fd1befbf5",
"size": "44... |
"""
Created on Wed Nov 9 10:40:36 2016
@authors: Danny Neil, iulialexandra
@contact: [email protected]
Utility file used to transform a series of AVI files into an LMDB for
training in Caffe.
Uses categories {paper, rock, scissors, background} for classification.
"""
import os
import os.path
import image... | {
"content_hash": "847b1b0295114711178a86be7af1acdf",
"timestamp": "",
"source": "github",
"line_count": 409,
"max_line_length": 81,
"avg_line_length": 41.75305623471883,
"alnum_prop": 0.5322948995725244,
"repo_name": "NeuromorphicProcessorProject/snn_toolbox",
"id": "271beea3644aea3b579dc1e75ac49b81b... |
from sqlalchemy.sql import func as fn
from sqlalchemy import sql
from ..translate import (
# data types
SqlColumn, SqlColumnAgg,
AggOver,
# transformations
wrap_annotate,
sql_agg,
win_agg,
win_cumul,
sql_not_impl,
# wiring up translator
extend_base,
SqlTranslator
)
from... | {
"content_hash": "4ba8d01565b5c998091724a3dba62b38",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 89,
"avg_line_length": 25.84259259259259,
"alnum_prop": 0.6005016123253314,
"repo_name": "machow/siuba",
"id": "aa132b10e1131a3b118271c909635d90ed41c69d",
"size": "2791",
... |
import wx
from cairis.core.armid import *
from cairis.core.ARM import *
from cairis.core.Borg import Borg
from WeaknessTreatmentDialog import WeaknessTreatmentDialog
__author__ = 'Shamal Faily'
class WeaknessTargetListCtrl(wx.ListCtrl):
def __init__(self,parent,winId,cvName):
wx.ListCtrl.__init__(self,parent,wi... | {
"content_hash": "84769f333751eb8379b05e6123de62c6",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 130,
"avg_line_length": 34.85454545454545,
"alnum_prop": 0.7104851330203443,
"repo_name": "nathanbjenx/cairis",
"id": "0fdeca18b543e240947669ee15f1f7964a00b692",
"size": "2... |
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
# Choose .FITS file
filename = '...'
hdu = fits.open(filename)
data = hdu[0].data
# display histogram
plt.figure()
plt.hist(np.asarray(data).flatten(), 500)
plt.yscale('Log')
# display image
plt.figure()
plt.imshow(data,... | {
"content_hash": "15612a66334cc75c45aaff00ecac41c2",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 79,
"avg_line_length": 19.636363636363637,
"alnum_prop": 0.6759259259259259,
"repo_name": "CalebHarada/DCT-photometry",
"id": "1de5c6222f541706f9ee22f0729d9c08c952d4e7",
"s... |
"""Very basic example of a simulation without a resampler or boundary
conditions"""
from copy import copy
import sys
## Logging
import sys
from eliot import start_action, to_file
to_file(open("_output/file_log.eliot.json", 'ab'))
### Setup Junk
with start_action(action_type="Setup") as setup_cx:
## Applicatio... | {
"content_hash": "295fbc3875ca5920b8a13f30f52ab139",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 89,
"avg_line_length": 30.738095238095237,
"alnum_prop": 0.65143299767622,
"repo_name": "ADicksonLab/wepy",
"id": "347f01d393f25f93bb8b33c65a0c396fac7963b3",
"size": "2582"... |
from __future__ import unicode_literals
from django.apps import AppConfig
class SpiritGroupConfig(AppConfig):
name = 'spirit.group'
verbose_name = "Spirit Group"
label = 'spirit_group'
| {
"content_hash": "1292637431313c8f93f5ffb1ff2b3cc7",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 39,
"avg_line_length": 20.1,
"alnum_prop": 0.7164179104477612,
"repo_name": "alesdotio/Spirit",
"id": "94eb887e3e8a8872cb50c6de6bf76622486bc361",
"size": "226",
"binary":... |
from django import template
register = template.Library()
@register.filter(name='index_at')
def list_value_at_index(list_from_html, index):
return list_from_html[index]
@register.filter(name='add')
def add(value_from_html, value_need_add):
return value_from_html + value_need_add
@register.filter(name='fo... | {
"content_hash": "80185b02bf8f7908c1822364fed1b9c5",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 47,
"avg_line_length": 20.473684210526315,
"alnum_prop": 0.7146529562982005,
"repo_name": "Guiders/CoreIce",
"id": "a118bd9d9327687a18d6bee69cfdadd793256e3b",
"size": "716"... |
import logging
import numpy as np
from lsanomaly import LSAnomaly
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
def test_example_code(mc_model, example_arrays, check_ndarray, check_ps):
x_train, x_test, expected_predict, expected_prob = example_arrays
mc_model.fit(x_train)
... | {
"content_hash": "aab02aeb2192a8b91ab5ffe2efae4272",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 73,
"avg_line_length": 24.951219512195124,
"alnum_prop": 0.6627565982404692,
"repo_name": "lsanomaly/lsanomaly",
"id": "1ecbfda0ce513fd54b31a7d22bee5fe1193c6fb4",
"size": "... |
from mysite import db
class Notebook(db.Model):
__tablename__ = 'Notebook'
id = db.Column(db.Integer, primary_key=True)
nid = db.Column(db.String(32), default='')
name = db.Column(db.String(32), default='')
price = db.Column(db.Int, default=0)
state = db.Column(db.Boolean, default=True)
status_id = db.... | {
"content_hash": "0e8ce6a2e8d596093c8fccbecb234bfe",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 62,
"avg_line_length": 35.22222222222222,
"alnum_prop": 0.6656151419558359,
"repo_name": "liyigerry/caixiang",
"id": "d49dd882c744f5296466ab2c683c1238663049d4",
"size": "63... |
from courses.models import Course, FilenameExtension, DefaultTeacher, MarkField, CourseMarkSystem, StudentCourseMark
from django.contrib import admin
class CourseAdmin(admin.ModelAdmin):
list_display = ('name', 'year',)
list_filter = ('year__start_year', 'is_active')
filter_horizontal = ('filename_extensi... | {
"content_hash": "1691939a1619a2241426c038ec04a067",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 116,
"avg_line_length": 34.2972972972973,
"alnum_prop": 0.7344365642237982,
"repo_name": "znick/anytask",
"id": "29f533ae9bb3e5e4621537733fddb4398a3154c9",
"size": "1269",
... |
import copy
import csv
import logging
import os
import uuid
from django.shortcuts import render
from django.http import HttpResponse
from amas import AMAS
from .forms import GeneTableForm
from core.utils import get_context, get_voucher_codes, get_gene_codes
from create_dataset.utils import CreateDataset
from public_i... | {
"content_hash": "79c6f61abd23628d63558b4b4110ab46",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 92,
"avg_line_length": 36,
"alnum_prop": 0.5859433258762118,
"repo_name": "carlosp420/VoSeq",
"id": "e4905d107b3d3f79b39c373c0d997e95e86ca49d",
"size": "5364",
"binary":... |
from collections import namedtuple
from scopus.classes import Retrieval
from scopus.utils import chained_get, get_id, detect_id_type, get_link,\
listify
class AbstractRetrieval(Retrieval):
@property
def abstract(self):
"""The abstract of a document.
Note: If this is empty, try property de... | {
"content_hash": "49f6f6402479889f862bf005c0252035",
"timestamp": "",
"source": "github",
"line_count": 805,
"max_line_length": 88,
"avg_line_length": 40.53416149068323,
"alnum_prop": 0.5520073551946062,
"repo_name": "scopus-api/scopus",
"id": "990598a649e354d8594867471a9e95cd9916518a",
"size": "32... |
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.append(os.path.abspath('.'))
# -- General conf... | {
"content_hash": "1e9b5e3a63317478222c17d39b1cb889",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 80,
"avg_line_length": 33.2967032967033,
"alnum_prop": 0.6881188118811881,
"repo_name": "zoni/Rocket",
"id": "5aac74b9f7fd23b8f9a8e4ba30d4a554e26f7c8d",
"size": "6488",
... |
from __future__ import absolute_import
from django import forms
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from cobra.core.loading import get_model, get_class
from cobra.forms.fields import UserField
DailyDeadline = get_model('workreport', 'DailyDeadline')
# class Dail... | {
"content_hash": "8dbaf079c4f4c2b4bbb45b69897b61dc",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 95,
"avg_line_length": 34.833333333333336,
"alnum_prop": 0.6641148325358852,
"repo_name": "lyoniionly/django-cobra",
"id": "99d413bb77bd2860365c6f864bc1a93c852cc436",
"size... |
"""
RenderPipeline
Copyright (c) 2014-2016 tobspr <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use... | {
"content_hash": "741db9e12806f2b2492f67b1bf2407c8",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 99,
"avg_line_length": 40.064625850340136,
"alnum_prop": 0.6265387554121742,
"repo_name": "eswartz/RenderPipeline",
"id": "91ba33401edc40647f6e48515d6fd59c56db0b99",
"size... |
from google.appengine.api import taskqueue
from google.appengine.ext import ndb
import deferred2 as deferred
from deferred2 import defer, defer_multi, task
import pytest
uses = pytest.mark.usefixtures
BigPayloadEntity = deferred.ext.big_payloads.BigPayload
def ResolvedFuture(val):
fut = ndb.Future()
fut.s... | {
"content_hash": "287d876b457c7daa34cf45086a7192ed",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 79,
"avg_line_length": 26.794117647058822,
"alnum_prop": 0.597755823880961,
"repo_name": "kaste/deferred2",
"id": "07b35d2c28a10549675947b84b7a484efe1ae82f",
"size": "8200... |
class PID:
"""
Discrete PID control
"""
def __init__(self, P=2.0, I=0.0, D=1.0, Derivator=0, Integrator=0, Integrator_max=500, Integrator_min=-500):
self.Kp=P
self.Ki=I
self.Kd=D
self.Derivator=Derivator
self.Integrator=Integrator
self.Integrator_max=Integrator_max
self.Integrator_min=Integrator_min... | {
"content_hash": "7fbaefe90614819751aa240e899d9d5d",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 109,
"avg_line_length": 19.75581395348837,
"alnum_prop": 0.6957033549146556,
"repo_name": "Miceuz/pidgenetics",
"id": "54bb2a2699d48d58483c3da62afdb7ef2500b568",
"size": "2... |
import minisolvers
import time
'''
Function : parse_SAT(stream)
Function to parse and forumlate a SAT Instance object that has methods such
as .solve and .get_model to solve the sat instance. Parses the SAT problem
from the standard DIMACS format for SAT Benchmarks
'''
def parse_SAT(stream):
lines... | {
"content_hash": "88e2886f6f54990e35cbafdfd2408af4",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 80,
"avg_line_length": 33.4453125,
"alnum_prop": 0.6101378182667601,
"repo_name": "tejasnikumbh/AllSAT",
"id": "5c7fcf1cc4a2a00aaba358c0b05825ac29f2e46f",
"size": "8597",
... |
from django import forms
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import FormView
from trix.widgets import TrixEditor
class EditorForm(forms.Form):
content = forms.CharField(widget=TrixEditor)
class EditorView(FormView):
form_class = EditorForm
... | {
"content_hash": "848f171d3c6028db3a7d95b5eb6024fa",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 48,
"avg_line_length": 22.636363636363637,
"alnum_prop": 0.7168674698795181,
"repo_name": "istrategylabs/django-trix",
"id": "057ea16750cab4cd286e21f1351be3e4df53893c",
"si... |
'''
A list of exceptions that may be raised.
'''
class InvalidCharacterTypeError(Exception):
'''
A character can only be a consonant-vowel pair or a vowel.
'''
pass
class UnexpectedCharacterError(Exception):
'''
Found a character in the string that we can't deal with.
'''
pass
| {
"content_hash": "9313fb92ed5bc2539afedc567c273dfc",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 62,
"avg_line_length": 18.470588235294116,
"alnum_prop": 0.6592356687898089,
"repo_name": "msikma/kanaconv",
"id": "ac38f07c03cd4047c9df55814e236f343dadea78",
"size": "360"... |
import allure
@allure.step('step in __init__.py')
def init_step():
pass
| {
"content_hash": "ce4bb6efb508004a19078b0a7df543c1",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 35,
"avg_line_length": 13,
"alnum_prop": 0.6282051282051282,
"repo_name": "igogorek/allure-python",
"id": "cfd8b09bd3ce2eec238109721c727ecc1911b03f",
"size": "78",
"binary... |
from seabreeze.pyseabreeze.features._base import SeaBreezeFeature
# Definition
# ==========
#
# TODO: This feature needs to be implemented for pyseabreeze
#
class SeaBreezeDataBufferFeature(SeaBreezeFeature):
identifier = "data_buffer"
def clear(self) -> None:
raise NotImplementedError("implement in ... | {
"content_hash": "cb91341b34da162de5a393e3d13443eb",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 68,
"avg_line_length": 33.54838709677419,
"alnum_prop": 0.7115384615384616,
"repo_name": "ap--/python-seabreeze",
"id": "42fbc76e1d6280aab0965172a68f9b871d7ac8cb",
"size": ... |
"""The following routines are specific to queries to
www.dictionary.com (as of 2003-07-23)"""
def get_def_page(word):
"""Retrieve the definition page for the word of interest.
... | {
"content_hash": "9f42ee2011bae90fcf2e69bddacb8f95",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 132,
"avg_line_length": 47.375,
"alnum_prop": 0.34074632491519036,
"repo_name": "ActiveState/code",
"id": "5f435117ad419b9cc9136ac964607ce069d5b4a8",
"size": "2653",
"bin... |
from __future__ import with_statement
import sys
from nose.tools import assert_raises
import textwrap
from StringIO import StringIO
from webassets.bundle import Bundle
from webassets.loaders import PythonLoader, YAMLLoader, LoaderError
from webassets.exceptions import ImminentDeprecationWarning
from nose import SkipTes... | {
"content_hash": "593b975b0ff95daa2c15ff846d5c2e98",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 88,
"avg_line_length": 32.47976878612717,
"alnum_prop": 0.5662929346858872,
"repo_name": "torchbox/webassets",
"id": "892e21e3aa98ce979c1684d5e2510aaf07b850f5",
"size": "5... |
from setuptools import setup, find_packages
if __name__ == '__main__':
packages = find_packages(exclude=['*tests*'])
setup(
name="pyrelic",
license="GPL",
version='0.8.0',
description=u'Python API Wrapper for NewRelic API',
author=u'Andrew Gross',
author_email=... | {
"content_hash": "dbe20baff0f7a580d36735bf821c1861",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 89,
"avg_line_length": 33.17142857142857,
"alnum_prop": 0.5193798449612403,
"repo_name": "andrewgross/pyrelic",
"id": "8a0219ee16ba2ce0df78d0fb5c811c3ec1ef3fd1",
"size": "1... |
def extractWwwLiteroticaCom(item):
'''
Parser for 'www.literotica.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
if "WATTT" in item['tags']:
return buildReleaseMessageWithType(item, "WATTT", vol, chp, ... | {
"content_hash": "fdf319e667f2a8ecbc0da981329f8d51",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 89,
"avg_line_length": 26,
"alnum_prop": 0.7115384615384616,
"repo_name": "fake-name/ReadableWebProxy",
"id": "5153aa6ebad32a94909ef2a6751a0d17dfce9ccf",
"size": "365",
"... |
"""Create a JACK client that copies input audio directly to the outputs.
This is somewhat modeled after the "thru_client.c" example of JACK 2:
http://github.com/jackaudio/jack2/blob/master/example-clients/thru_client.c
If you have a microphone and loudspeakers connected, this might cause an
acoustical feedback!
"""
... | {
"content_hash": "0f454a28efa0ba79e87dbeb737c50385",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 75,
"avg_line_length": 31.511627906976745,
"alnum_prop": 0.7140221402214022,
"repo_name": "spatialaudio/jackclient-python",
"id": "657d7ae052deac94a3108c3b390222e082aadec9",
... |
"""Support for running subprocess commands."""
import io
import datetime
import logging
import os
import shlex
import subprocess
import time
from buildtool import (
ensure_dir_exists,
log_embedded_output,
log_timestring,
raise_and_log_error,
timedelta_string,
ExecutionError)
from buildtool.ba... | {
"content_hash": "e88104e05b62e540f333f878ddb106c9",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 81,
"avg_line_length": 32.917808219178085,
"alnum_prop": 0.6736024413927035,
"repo_name": "ewiseblatt/spinnaker",
"id": "0d74f74a8d72de588be8a7174b28462a508e0b39",
"size":... |
"""Test evaluation of pulses entries.
"""
import pytest
import numpy as np
from numpy.testing import assert_array_equal
from exopy_pulses.pulses.pulse import Pulse
from exopy_pulses.pulses.sequences.base_sequences import RootSequence
from exopy_pulses.pulses.shapes.square_shape import SquareShape
from exopy_pulses.te... | {
"content_hash": "ab7de12a8252b76ad4ec570803003557",
"timestamp": "",
"source": "github",
"line_count": 718,
"max_line_length": 75,
"avg_line_length": 28.040389972144848,
"alnum_prop": 0.5983211642576863,
"repo_name": "Ecpy/ecpy_pulses",
"id": "34d7b7c9351850e1d50f656eda320153ffaaf69e",
"size": "20... |
""" Plateau Scheduler
Adapts PyTorch plateau scheduler and allows application of noise, warmup.
Hacked together by / Copyright 2020 Ross Wightman
"""
import torch
from .scheduler import Scheduler
class PlateauLRScheduler(Scheduler):
"""Decay the LR by a factor every time the validation loss plateaus."""
d... | {
"content_hash": "7f5fd8464e5abafe31593ac3d6875ba0",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 97,
"avg_line_length": 32.481818181818184,
"alnum_prop": 0.5549958018471872,
"repo_name": "rwightman/pytorch-image-models",
"id": "9f8271579bbefaf3e9d0322cbe233af638a7433a",... |
""" An ICAP response copy service using a gevent StreamServer. """
import logging
from respmod_copy import Copy
def main():
import gevent.server
logging.basicConfig(level=logging.INFO)
Copy().icap_handler_class().server(gevent.server.StreamServer).serve_forever()
if __name__ == '__main__':
main()
| {
"content_hash": "474efa0baaf59bc75636bdd0d3ee7815",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 82,
"avg_line_length": 22.785714285714285,
"alnum_prop": 0.6959247648902821,
"repo_name": "gilesbrown/python-icapservice",
"id": "c4d83f6497fb06f581105990aefedac2f621c48d",
... |
import os
import logging
import unittest
from simple.bulk import SimpleBulkTest
N = 100000
COUNT = 5
log = logging.getLogger('test.auto')
class CompactionTest(SimpleBulkTest):
"Start a clean accumulo, bulk import a lot of map files, read while a multi-pass compaction is happening"
order = 26
tableSett... | {
"content_hash": "2850ccb3f9a4a15388e1895e4a205a8e",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 109,
"avg_line_length": 30.904109589041095,
"alnum_prop": 0.6112588652482269,
"repo_name": "phrocker/accumulo",
"id": "bd39d62e1bfd5cd2fa14be65819045a65ae621e1",
"size": "3... |
"""Module for the custom Django create_cards command."""
import os
from django.core import management
from django.conf import settings
from django.template.loader import render_to_string
from django.contrib.staticfiles import finders
from learning_area_cards.models import (
AchievementObjective,
ProgressOutcom... | {
"content_hash": "f00c567616089ce6696c73dee1c24366",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 103,
"avg_line_length": 39.133720930232556,
"alnum_prop": 0.5080968652503343,
"repo_name": "uccser/cs4teachers",
"id": "4fd88f4674d4bb5ebbb9facad597d0255b70189f",
"size": ... |
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
import uuid
class HeadExceptionOperations(object):
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deseri... | {
"content_hash": "ea5a8e07653701e1c07af7234db82d99",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 140,
"avg_line_length": 38.33587786259542,
"alnum_prop": 0.6326164874551972,
"repo_name": "vulcansteel/autorest",
"id": "66757ed881bc6c4e537a6a61afd8d50332d32dea",
"size":... |
def hyper_descriptive(data, tiers, metric, mode='median', ascending=False):
'''
data = the datafile with the results from hyperscan()
tiers = a string or a list where first tier is first and so
metric = the metric that will be measured against
mode = 'mean', 'median', 'std', 'min', or 'max'
... | {
"content_hash": "8ebbafb6e672d112818c70badfc34274",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 75,
"avg_line_length": 23.871794871794872,
"alnum_prop": 0.5767991407089151,
"repo_name": "botlabio/autonomio",
"id": "41f496760a456f27e22f8ce42b26dd45ba2d887d",
"size": "9... |
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from openstack_dashboard.api import keystone
def set_tenant_name_to_objects(request, objects):
try:
tenants, has_more = keystone.tenant_list(request)
except Exception:
tenants = []
msg = _('Unable to... | {
"content_hash": "b5b51a508edee0e71d4d72117d73dcbd",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 64,
"avg_line_length": 35.333333333333336,
"alnum_prop": 0.6682389937106918,
"repo_name": "jcsp/manila-ui",
"id": "e73583e27a17d63b32dd6d4149c99fd3f48187f3",
"size": "1241"... |
"""CodeContext - Extension to display the block context above the edit window
Once code has scrolled off the top of a window, it can be difficult to
determine which block you are in. This extension implements a pane at the top
of each IDLE edit window which provides block structure hints. These hints are
the li... | {
"content_hash": "91061a6f3a9074925147181cdb8ecc4d",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 80,
"avg_line_length": 48.39772727272727,
"alnum_prop": 0.5635125616341864,
"repo_name": "Jeff-Tian/mybnb",
"id": "add89b88a6ade6760cf39acef0400b7d42c9cc37",
"size": "8518... |
"""Tests for the create_future() function."""
import asyncio
from launch.utilities import create_future
def test_create_future():
"""Test the create_future() function."""
future_none_result = create_future(None)
assert isinstance(future_none_result, asyncio.Future)
future_event_loop_result = create_... | {
"content_hash": "528a0863b1d177e3d5e197f2b5855f74",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 70,
"avg_line_length": 32.07692307692308,
"alnum_prop": 0.7338129496402878,
"repo_name": "ros2/launch",
"id": "57131b13f2f312a650b5919d5a1f30368ec90475",
"size": "1019",
... |
from django import forms
from django.conf import settings
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from django.utils.encoding import force_unicode
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
from django.core.urlre... | {
"content_hash": "d4b6d46f970018ce42bf8e813cf4fb86",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 77,
"avg_line_length": 33.06349206349206,
"alnum_prop": 0.6524243879020644,
"repo_name": "20tab/twentytab-tcked",
"id": "10d5c108ac620c86a8290a237f736e01508f099a",
"size": ... |
"""
Code PyQt4
"""
import sys, os
from PyQt4 import QtGui, QtCore
class Button(QtGui.QToolButton):
def __init__(self, text, parent=None):
super(Button, self).__init__(parent)
self.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Preferred)
self.setText(text)
... | {
"content_hash": "68b5fbfe860e433c83d8a8afb06fc91f",
"timestamp": "",
"source": "github",
"line_count": 221,
"max_line_length": 79,
"avg_line_length": 30.497737556561084,
"alnum_prop": 0.6093471810089021,
"repo_name": "janusnic/21v-pyqt",
"id": "1819d019694443f2d4e300d6266606c6f8d05f5b",
"size": "6... |
__author__ = "Nils Tobias Schmidt"
__email__ = "schmidt89 at informatik.uni-marburg.de"
from androlyze.log.Log import * | {
"content_hash": "86b1eb0ca561068cae162780355f232a",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 52,
"avg_line_length": 30,
"alnum_prop": 0.7166666666666667,
"repo_name": "nachtmaar/androlyze",
"id": "24be761f943fcf8bb76bde182486110666bc7046",
"size": "140",
"binary":... |
"""
WSGI config for arena project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "arena.settings")
from django.core.wsgi ... | {
"content_hash": "415247817b29cea554e96e8f956f4de6",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 78,
"avg_line_length": 27.5,
"alnum_prop": 0.7714285714285715,
"repo_name": "abhishek97/arena",
"id": "4c205806922f9dd47b04ff126c7f6ee3bf1b2fac",
"size": "385",
"binary":... |
import logging
import medianrunner
import wordcount
logging.basicConfig(level=logging.INFO)
t = wordcount.WordCounter('wc_input', 'wc_output/wc_result.txt')
t.run()
t = medianrunner.MedianRunner('wc_input', 'wc_output/med_result.txt')
t.run()
| {
"content_hash": "c11b82da98b99e345fe58f12eda6916f",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 69,
"avg_line_length": 20.583333333333332,
"alnum_prop": 0.757085020242915,
"repo_name": "vsharma1/InsightDataScience",
"id": "3d033d34b1a8cc2a4b5e1ea37a18a233733058e9",
"s... |
"""Basic Image Process."""
from absl import logging
import numpy as np
import tensorflow as tf
from data.augment import apply_augment
from data.augment import compose_augment_seq
class BasicImageProcess():
"""Basic Image Process."""
def __init__(self, data, input_shape=(256, 256, 3)):
self.input_shape = inp... | {
"content_hash": "19c0ba7a96320575c48f6d1c9b3dc64b",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 80,
"avg_line_length": 36.8051948051948,
"alnum_prop": 0.6152081863091038,
"repo_name": "google-research/deep_representation_one_class",
"id": "2575382bff16d698f7832c971be2b... |
"""string processing utilities for extracting strings with various kinds of delimiters"""
import logging
import htmlentitydefs
def find_all(searchin, substr):
"""returns a list of locations where substr occurs in searchin
locations are not allowed to overlap"""
location = 0
locations = []
while lo... | {
"content_hash": "59f8b955149582f6c02cbf04d850b912",
"timestamp": "",
"source": "github",
"line_count": 412,
"max_line_length": 129,
"avg_line_length": 38.24757281553398,
"alnum_prop": 0.5830689173753014,
"repo_name": "dbbhattacharya/kitsune",
"id": "0e917bf3a5e9bea3625d3c789302f2e94a6cbc45",
"size... |
"""Unit tests for the "create_udm_events" function."""
import json
import unittest
from unittest import mock
from google.auth.transport import requests
from . import create_udm_events
_test_event = json.dumps([{
"metadata": {
"eventTimestamp": "2021-07-01T19:39:08.304950563Z",
"eventType": "SCA... | {
"content_hash": "fe8bc78e87222b769f98838afae5d37e",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 76,
"avg_line_length": 30.705128205128204,
"alnum_prop": 0.631732776617954,
"repo_name": "chronicle/api-samples-python",
"id": "0b0ff55f4a6e58eef6191864e3642a9f208a1193",
"... |
"""Atom classes for describing dataset contents."""
# Imports
# =======
import re
import sys
import inspect
import cPickle
import numpy
from tables.utils import SizeType
from tables.misc.enum import Enum
import warnings
from tables.exceptions import FlavorWarning
# Public variables
# ================
__docformat_... | {
"content_hash": "7a5e86ea87be9beb4b828fe2e04be2c3",
"timestamp": "",
"source": "github",
"line_count": 1170,
"max_line_length": 96,
"avg_line_length": 35.212820512820514,
"alnum_prop": 0.6071992038641715,
"repo_name": "joonro/PyTables",
"id": "d9acdd845684381d5bcdc48531b3c88f4ac7df3f",
"size": "41... |
import sys
import os
import os.path
import subprocess
import JTutils
import os
dataset = CURDATA()
N = str(int(GETPARSTAT("L 22")) - 1)
LB = GETPAR("LB")
GB = GETPAR("USERP1")
s = GETPAR("USERP2")
cycle = float(GETPARSTAT("P 60"))
if (cycle < 1): # P60 is not likely to have stored the cycle time then uses historic ca... | {
"content_hash": "d2e97ab908b222ffe5bb8273e4d5df17",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 96,
"avg_line_length": 30.18421052631579,
"alnum_prop": 0.6573670444638187,
"repo_name": "jtrebosc/JTutils",
"id": "e3eaa660a53c345087d2f8196078d89b35a38f7e",
"size": "1228... |
"""
Pushover platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.pushover/
"""
import logging
import voluptuous as vol
from homeassistant.components.notify import (
ATTR_TITLE, ATTR_TITLE_DEFAULT, ATTR_TARGET, ATTR_... | {
"content_hash": "e11c7943398d7da1816a10343be14c24",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 74,
"avg_line_length": 30.47945205479452,
"alnum_prop": 0.6570786516853933,
"repo_name": "leoc/home-assistant",
"id": "c0a067fe918645018c2e253f937ee4c12cc7c94d",
"size": "2... |
from unittest import TestCase
from src.markdown.images import MarkdownImages
class TestMarkdownImages(TestCase):
def setUp(self):
self.converter = MarkdownImages()
def test_simple_image_embed(self):
src = "{{img.png}}"
expected = "<img style='' src='/img/img.png'>"
self.asser... | {
"content_hash": "cd5857e576b51c1dad9fa31be23942c9",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 112,
"avg_line_length": 40.833333333333336,
"alnum_prop": 0.6301020408163265,
"repo_name": "wgroeneveld/dokuwiki-to-hugo",
"id": "ee53c50b557e00eaa77dfd4140a424b9d73431c8",
... |
from __future__ import print_function, unicode_literals, division, absolute_import
import unittest
import panphon
from panphon import distance
feature_model = 'segment'
dim = 24
class TestLevenshtein(unittest.TestCase):
def setUp(self):
self.dist = distance.Distance(feature_model=feature_model)
def... | {
"content_hash": "3dae33e168c2e4aff2265880dd52625d",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 124,
"avg_line_length": 38.77857142857143,
"alnum_prop": 0.6682630318659053,
"repo_name": "dmort27/panphon",
"id": "6a3009a265d4b8e068d0a3e86e7608ad6f7020ac",
"size": "546... |
"""
Generic discrete convolution
Description
-----------
This is a manual (not optimized!) implementation of discrete 1D
convolution intended for spectroscopy analysis. The difference with
commonly used methods is the possibility to adapt the convolution
kernel for each convolution point, e.g. change the FWHM of ... | {
"content_hash": "d61e3852c4afb667f85a6d325919649a",
"timestamp": "",
"source": "github",
"line_count": 392,
"max_line_length": 100,
"avg_line_length": 31.880102040816325,
"alnum_prop": 0.5258061934864368,
"repo_name": "maurov/xraysloth",
"id": "cf90c05f04b8b8d2072324f7719cb20d4db3c242",
"size": "1... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('tasks', '0007_auto_20151023_2311'),
]
operations = [
migrations.AlterField(
model_name='task',
name='task_type',
... | {
"content_hash": "ba5ecfaf5b30f0590cccd6d1ac07d204",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 98,
"avg_line_length": 23.61111111111111,
"alnum_prop": 0.6023529411764705,
"repo_name": "SamuelDauzon/Improllow-up",
"id": "2d8b3c1922a0ef2e3f0b66f71861222714753885",
"siz... |
import datetime
import decimal
import itertools
import re
import time
import uuid
import warnings
from operator import itemgetter
from bson import Binary, DBRef, ObjectId, SON
import gridfs
import pymongo
import six
try:
import dateutil
except ImportError:
dateutil = None
else:
import dateutil.parser
try... | {
"content_hash": "7df04e64e757044aacc39714b97f8379",
"timestamp": "",
"source": "github",
"line_count": 2055,
"max_line_length": 138,
"avg_line_length": 34.372262773722625,
"alnum_prop": 0.5806045161747009,
"repo_name": "ConsumerPhysics/mongoengine",
"id": "3991ef5c04afd8a71a7ba41338c11a1f16340580",
... |
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from azure.core import AsyncPipelineClient
from azure.core.rest import AsyncHttpResponse, HttpRequest
from .. import models
from ..._serialization import Deserializer, Serializer
from ._configuration import TextAnalyticsClientConfiguration
fro... | {
"content_hash": "4340d81822f55835d1bf40f7f5aa0bed",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 174,
"avg_line_length": 46.056179775280896,
"alnum_prop": 0.7021224688948524,
"repo_name": "Azure/azure-sdk-for-python",
"id": "da09436932599da50bbe9fe15b804d6fdea7ec5c",
"... |
import copy
import datetime
import json
import uuid
import pymongo
import db_driver
import stream as pstream
# Collections:
# ["events"] = event docs
#
# ["trigger_defs"] = { 'trigger_name',
# 'stream_id',
# 'identifying_traits': {trait: value, ...},
# ... | {
"content_hash": "f43cb0a07babf8d1161993f5e2309880",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 80,
"avg_line_length": 36.72318339100346,
"alnum_prop": 0.4976915104117592,
"repo_name": "StackTach/oahu",
"id": "9bc107192850f2a7fe5a5115c2f2716a9010aa4d",
"size": "11208... |
"""Data pipelines to parse benchmark YAML for charts.
Extracts benchmark YAML and combines with template chart YAML for Vega
charts. Run `python _data/charts.py` to build the charts.
"""
# pylint: disable=no-value-for-parameter
import glob
import os
import json
import re
from dateutil.parser import parse
import jinj... | {
"content_hash": "f87a7b56aea5e535464e97c5d5844ee8",
"timestamp": "",
"source": "github",
"line_count": 445,
"max_line_length": 79,
"avg_line_length": 25.159550561797754,
"alnum_prop": 0.5291175419792783,
"repo_name": "usnistgov/chimad-phase-field",
"id": "522556748bd074dbad68627d5ed135c042f362ff",
... |
"""
Support for Loop Energy sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.loop_energy/
"""
import logging
from homeassistant.helpers.entity import Entity
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.util i... | {
"content_hash": "faca66bef4bae501aa9159634330c352",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 74,
"avg_line_length": 29.29078014184397,
"alnum_prop": 0.6409200968523002,
"repo_name": "Zyell/home-assistant",
"id": "31b957192d9f65c8753a962490513eb09a2b20a7",
"size": ... |
import logging
__author__ = 'Apollo'
class BaseInitializer(object):
def __init__(self, count, logger, options, result_backend=None, *args, **kwargs):
self.count = count
self.result_backend = result_backend
self.logger = logger
self.options = options
def start(self, no_runner=... | {
"content_hash": "b20919e82716881bff013c16cc341cee",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 85,
"avg_line_length": 26.37142857142857,
"alnum_prop": 0.5742145178764897,
"repo_name": "inb-co/easy-job",
"id": "5a4ef84b30ae1bf0d2e3cda979854fb50d950ef4",
"size": "923",... |
from catdtree import BaseDecisionTree
from scipy import stats
class C45(BaseDecisionTree):
"""C4.5 decision tree for classification.
This class implements a decision tree using the C4.5 algorithm for
building it.
References:
* Quinlan, J. R. C4.5: Programs for Machine Learning. Morgan Kaufma... | {
"content_hash": "d193f6753a8692364e4f407e27045efa",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 104,
"avg_line_length": 46.6015037593985,
"alnum_prop": 0.5175863181671507,
"repo_name": "idanivanov/catdtree",
"id": "69c4f017149daa7eca8b9571a542a48cbd5a009a",
"size": "... |
"""
Healthcare API client.
"""
from __future__ import unicode_literals
import operator
from django.conf import settings
from .backends import comparisons
from .backends.base import get_backend
from .exceptions import PatientDoesNotExist, ProviderDoesNotExist
class CategoryWrapper(object):
"Simple wrapper to t... | {
"content_hash": "fef6fdfc5ecd21926e18bb0dbcc6751c",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 111,
"avg_line_length": 32.61344537815126,
"alnum_prop": 0.6413295542385983,
"repo_name": "caktus/rapidsms-healthcare",
"id": "853fff049072543d995fd8def72c484711cfd239",
"... |
import unittest
from test import support
import collections, random, string
import collections.abc
import gc, weakref
import pickle
class DictTest(unittest.TestCase):
def test_invalid_keyword_arguments(self):
class Custom(dict):
pass
for invalid in {1 : 2}, Custom({1 : 2}):
... | {
"content_hash": "36563bec0e8bb96a10707a074f4fcc66",
"timestamp": "",
"source": "github",
"line_count": 929,
"max_line_length": 79,
"avg_line_length": 31.332615715823465,
"alnum_prop": 0.4971485502267418,
"repo_name": "timm/timmnix",
"id": "6e4cab6f158f5a4171c24ce510eda6b60fc4805a",
"size": "29108"... |
"""Utilities for using reinforcement learning algorithms."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import os
import re
import ruamel.yaml as yaml
import tensorflow as tf
from agents import tools
def define_simulation_graph(batch... | {
"content_hash": "fad297c1820efaa46f3a492bfe24420a",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 79,
"avg_line_length": 32.90395480225989,
"alnum_prop": 0.7153159340659341,
"repo_name": "google-research/batch-ppo",
"id": "61aad0da5614bdc326b40009501282669182645e",
"si... |
def extractFreezingslowlyWordpressCom(item):
'''
Parser for 'freezingslowly.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
... | {
"content_hash": "5e1dc1c660cfc84652440f756a4ad090",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 104,
"avg_line_length": 27,
"alnum_prop": 0.6402116402116402,
"repo_name": "fake-name/ReadableWebProxy",
"id": "b77c77d4dee0210090ef3d2c2e4ccbf951186b6e",
"size": "568",
... |
import numpy
def rcosFn(*args):
''' [X, Y] = rcosFn(WIDTH, POSITION, VALUES)
Return a lookup table (suitable for use by INTERP1)
containing a "raised cosine" soft threshold function:
Y = VALUES(1) + (VALUES(2)-VALUES(1)) *
cos^2( PI/2 * (X - POSITION + WIDTH)/WIDTH )
... | {
"content_hash": "d303c22055a04d8568ad45d667eed934",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 73,
"avg_line_length": 26.19148936170213,
"alnum_prop": 0.5190901705930138,
"repo_name": "tochikuji/pyPyrTools",
"id": "21c52b510afa495718c22210b44545361d138cfb",
"size": "... |
"""
Helpers for abstracting high-level network concepts. Different from 'models.py' which deals
with IO abstraction.
"""
import string
from typing import Dict, Union, Tuple
from collections import namedtuple, OrderedDict
# externals
# None. Should not have any external dependencies.
FILENAME_VALID_CHARS = "-~_.() {... | {
"content_hash": "7e737c33c44fae764688ec34e4c253f5",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 130,
"avg_line_length": 33.21634615384615,
"alnum_prop": 0.6290345925604284,
"repo_name": "NVIDIA/TensorRT",
"id": "33e8aba151de012a8c535eb9e5518a0b7b95d37a",
"size": "759... |
"""
Django settings for django_example project.
Generated by 'django-admin startproject' using Django 3.2.12.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from... | {
"content_hash": "ffac40752273296a33f85062db0e3020",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 91,
"avg_line_length": 26.54032258064516,
"alnum_prop": 0.6940139775144333,
"repo_name": "asphalt-framework/asphalt-web",
"id": "56c76fb3be0bbb2b87ed02d82853c533a4107a15",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.