text stringlengths 4 1.02M | meta dict |
|---|---|
import logging
import numpy as np
import time
from ray.rllib.models.jax.jax_modelv2 import JAXModelV2
from ray.rllib.models.jax.misc import SlimFC
from ray.rllib.utils.annotations import override
from ray.rllib.utils.framework import try_import_jax
jax, flax = try_import_jax()
logger = logging.getLogger(__name__)
... | {
"content_hash": "2f7598bdf6d7cf0c47aac9add27be7b1",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 76,
"avg_line_length": 38.168,
"alnum_prop": 0.5535527143156571,
"repo_name": "pcmoritz/ray-1",
"id": "1cec5eb5e8a665b1dcab83bd061a9aa84d82f17e",
"size": "4771",
"binary... |
from __future__ import absolute_import
from unittest import main, TestCase
from tempfile import mkdtemp
from os.path import join, exists, dirname, isdir, abspath, realpath
from urllib import quote
from os import environ
from shutil import rmtree, copytree
from uuid import uuid4
import sys
from chime.repo_functions im... | {
"content_hash": "461419ab8f1cbd653370c8a696506cce",
"timestamp": "",
"source": "github",
"line_count": 1506,
"max_line_length": 578,
"avg_line_length": 50.76892430278885,
"alnum_prop": 0.660074812315258,
"repo_name": "yudiutomo/chime",
"id": "be0391e586b74c9caee4499fbe17c9969b47c914",
"size": "765... |
"""Module with common classes for the controller."""
from enum import Enum
from kytos.core.config import KytosConfig
__all__ = ('GenericEntity',)
class EntityStatus(Enum):
"""Enumeration of possible statuses for GenericEntity instances."""
UP = 1 # pylint: disable=invalid-name
DISABLED = 2
DOWN = ... | {
"content_hash": "6546c930e6866f880c1d4dc29fc4c75e",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 78,
"avg_line_length": 28.927083333333332,
"alnum_prop": 0.6157724162765574,
"repo_name": "renanrodrigo/kytos",
"id": "6fa0c37aad44e12ee453fd9add6f55b77ab93622",
"size": "2... |
import sqlalchemy.types as saTypes
# Local imports
from gp10.util import to_ord, from_ord
__all__ = [
'StripString',
'Ordinal',
]
class StripString(saTypes.TypeDecorator):
impl = saTypes.String
def process_result_value(self, value, dialect):
return value.strip()
def copy(self):
... | {
"content_hash": "7b010ea56716e6baf7bc40ca0b0a8616",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 51,
"avg_line_length": 21,
"alnum_prop": 0.6751700680272109,
"repo_name": "pacopablo/gp10",
"id": "8dc29bad03eb17d93745bfc74e9cd08b0c62b811",
"size": "926",
"binary": fal... |
""" Messaging API
API to send & receive messages:
- currently SMS, Email, RSS & Twitter
Messages get sent to the Outbox (& Log)
From there, the Scheduler tasks collect them & send them
@copyright: 2009-2014 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free o... | {
"content_hash": "aa112ea4e9ce81306998d2c30e44ddf8",
"timestamp": "",
"source": "github",
"line_count": 2585,
"max_line_length": 142,
"avg_line_length": 39.26266924564797,
"alnum_prop": 0.452194218377441,
"repo_name": "gnarula/eden_deployment",
"id": "e980a6331500914c7a947c3fff604dc9edb32380",
"siz... |
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.views.decorators.cache import never_cache
from advisers.admin import admin_site
from moj_irat.views import HealthcheckView
urlpatterns = [
url(r"^healthcheck.json$", never_cache(Health... | {
"content_hash": "c1c65f835f65f06eedada30569d836e0",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 96,
"avg_line_length": 39.61538461538461,
"alnum_prop": 0.7592233009708738,
"repo_name": "ministryofjustice/laa-legal-adviser-api",
"id": "b3bbf162623c4411bfa043dbf3096aa1453... |
"""Estimator classes for BoostedTrees."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import abc
import collections
import functools
from tensorflow.python.estimator import estimator
from tensorflow.python.estimator import model_fn as model_fn_lib
from ... | {
"content_hash": "9598b27617f2160aca660d0d32835618",
"timestamp": "",
"source": "github",
"line_count": 1423,
"max_line_length": 115,
"avg_line_length": 42.53548840477864,
"alnum_prop": 0.66298242135871,
"repo_name": "xodus7/tensorflow",
"id": "756d32d03fe52ad265420ffd6e9b921934976498",
"size": "61... |
from typing import NoReturn, TypeVar
from nacl import exceptions as exc
from nacl._sodium import ffi, lib
from nacl.exceptions import ensure
crypto_generichash_BYTES: int = lib.crypto_generichash_blake2b_bytes()
crypto_generichash_BYTES_MIN: int = lib.crypto_generichash_blake2b_bytes_min()
crypto_generichash_BYTES_M... | {
"content_hash": "5d83f7cd113f9bf9eebe3f32a6e3fb65",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 78,
"avg_line_length": 30.76865671641791,
"alnum_prop": 0.6293960708222168,
"repo_name": "pyca/pynacl",
"id": "6ab385a59718221f54738f1727c757447427b04d",
"size": "8852",
... |
import sys
from vpnporthole.session import Session
from vpnporthole.settings import Settings
from vpnporthole.argparsetree import ArgParseTree
class Main(ArgParseTree):
"""
"""
def args(self, parser):
pass
class Action(ArgParseTree):
settings = None
def args(self, parser):
par... | {
"content_hash": "1718ed4cef31dca6752f6b0b4783fc79",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 116,
"avg_line_length": 22.18705035971223,
"alnum_prop": 0.5643644617380026,
"repo_name": "sourcesimian/vpn-porthole",
"id": "49eec758495bfc50f78e745fc23ef966aedc4a9c",
"s... |
import math
import re
from wtforms import fields, widgets
from flask import request, url_for, redirect, flash, abort
from flask_superadmin.babel import gettext
from flask_superadmin.base import BaseView, expose
from flask_superadmin.form import (BaseForm, ChosenSelectWidget, FileField,
... | {
"content_hash": "0c9bd7bfa2dbc525fdae8acf9ad4335e",
"timestamp": "",
"source": "github",
"line_count": 376,
"max_line_length": 85,
"avg_line_length": 33.172872340425535,
"alnum_prop": 0.5504690130682274,
"repo_name": "0x1997/Flask-SuperAdmin",
"id": "6644cab2436793a55df866be6227489f53022fbc",
"siz... |
import sys
import os
import unittest
import pkgutil
import webbrowser
import coverage
import optparse
from utrunner import jsontestrunner, wrappers
def discover_and_run_tests(test_dir, timer=False, debug=False, json_file_path=None):
# Separate output from the invoking command
print("=" * 70)
# use the de... | {
"content_hash": "376f3a4157f50d77cfc7773a09b47a36",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 187,
"avg_line_length": 44.57017543859649,
"alnum_prop": 0.6181853965754772,
"repo_name": "kevwo/utrunner",
"id": "f9202d880a9fc7f09d4c17d99914bcbb58a0ca8b",
"size": "5081... |
from lxml import etree
from io import StringIO
from lxml import html
def parse_html_to_tree(html_string):
"""
Takes in an HTML string from a request such as request.text, and parses it with etree and returns an ElementTree
object from lxml
:param html_string: String of html.
:return: ElementTree... | {
"content_hash": "0125dbc2a0bbd1d084e9651c7ca38860",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 116,
"avg_line_length": 28.944444444444443,
"alnum_prop": 0.7024952015355086,
"repo_name": "arthurtyukayev/python-safer",
"id": "df5947331a49923f861c871d75ffc44ab19e56f3",
... |
import os
import tarfile
from bento.core.package import \
PackageDescription, file_list
from bento.commands.errors \
import \
UsageException
from bento.commands.core \
import \
Command, Option
from bento.core.utils \
import \
ensure_dir
from bento._config import \
BENTO... | {
"content_hash": "592834fcbe318e30b057a5a882cd1b75",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 75,
"avg_line_length": 29.830985915492956,
"alnum_prop": 0.5906515580736544,
"repo_name": "abadger/Bento",
"id": "b318343f8bb639a4f24d12f37547abd9c7191d14",
"size": "2118",... |
"""Templates for generating event classes for structured metrics."""
import codegen
########
# HEADER
########
HEADER_FILE_TEMPLATE = """\
// Generated from gen_events.py. DO NOT EDIT!
// source: structured.xml
#ifndef {file.guard_path}
#define {file.guard_path}
#include <cstdint>
#include <string>
#include "comp... | {
"content_hash": "b1cca8bb0469bb123ebea40e89d4e462",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 84,
"avg_line_length": 22.259615384615383,
"alnum_prop": 0.6950323974082073,
"repo_name": "endlessm/chromium-browser",
"id": "4ead3094891fd763d1a6f817f0e5b19c8702362c",
"s... |
from setuptools import setup, find_packages
from sftpcloudfs.constants import version, project_url
def readme():
try:
return open('README.md').read()
except:
return ""
setup(name='sftp-cloudfs',
version=version,
description='SFTP interface to OpenStack Object Storage (Swift)',
... | {
"content_hash": "fb7d8c6509006ce79f10eae26f0b3a05",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 93,
"avg_line_length": 34.22857142857143,
"alnum_prop": 0.6010016694490818,
"repo_name": "Memset/sftpcloudfs",
"id": "afea04ecb7322cc7cc3d9456893ca6f56c08407f",
"size": "12... |
import urllib
import json
import os
from flask import Flask
from flask import request
from flask import make_response
# Flask app should start in global layout
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook():
req = request.get_json(silent=True, force=True)
print("Request:")
... | {
"content_hash": "40917824af9d1132e8e5455b34ff25eb",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 93,
"avg_line_length": 23.383333333333333,
"alnum_prop": 0.6022808267997148,
"repo_name": "happyeye01/api-ai",
"id": "ba158730182564fea2973238dec7e8e18599f39b",
"size": "14... |
'''maintain a pickled cache file on disk'''
import cPickle as pickle
import os
import pdb
import time
import unittest
if False:
# example
class Cache(object):
pass
def read_data(dictionary):
'return the data; it will be pickled and written to the file at path_to_cache'
return None
... | {
"content_hash": "e62b42cf04c9a2cb92de252fd7229a18",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 95,
"avg_line_length": 31.71875,
"alnum_prop": 0.5924466338259442,
"repo_name": "rlowrance/re-avm",
"id": "d9b27617baaff7d2a46089f3f49e14f7f144a03d",
"size": "3045",
"bin... |
from __future__ import unicode_literals
from django.db import migrations, connection
from bluebottle.clients import properties
class Migration(migrations.Migration):
dependencies = [
('funding', '0025_auto_20190904_1154'),
]
operations = [
]
| {
"content_hash": "10756fc102a024fe2234f510b3f3fe90",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 47,
"avg_line_length": 17.0625,
"alnum_prop": 0.6886446886446886,
"repo_name": "onepercentclub/bluebottle",
"id": "715476341e5f5bdac3699cb4ce168c45d01fbb44",
"size": "347",... |
'''
Get system os language, region, support win, osx
'''
import sys
import locale
import subprocess
def osx_read_language():
ret = ''
try:
cmd = 'defaults read -g AppleLanguages'
arglist = cmd.split(' ')
ret = subprocess.Popen(arglist,
stdout=subprocess.... | {
"content_hash": "c320180e5f7ed41be59c6aedb6616a8a",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 107,
"avg_line_length": 27.183333333333334,
"alnum_prop": 0.5321888412017167,
"repo_name": "tcp813/mouTools",
"id": "bd3f3b297d72aa73b871ce03197c5e4ea951cb66",
"size": "163... |
from django.db import models
class News(models.Model):
id = models.AutoField(primary_key = True)
title = models.CharField(max_length = 255)
summary = models.CharField(max_length = 300)
content = models.CharField(max_length = 9000)
author = models.CharField(max_length = 255)
category = models.Ch... | {
"content_hash": "7c3b3b3e1d7a33f1d4e5fa6dca93c677",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 55,
"avg_line_length": 34.5625,
"alnum_prop": 0.6636528028933092,
"repo_name": "huaiping/pandora",
"id": "d0b6ef729f9cbb6226cb1cb7def3ebfe0af62682",
"size": "1106",
"bina... |
from office365.runtime.client_value import ClientValue
from office365.runtime.client_value_collection import ClientValueCollection
class TaxonomyFieldValue(ClientValue):
def __init__(self, label=None, term_guid=None, wss_id=-1):
"""
Represents a single value held in a TaxonomyField (section 3.1.5... | {
"content_hash": "7d47425e9bff9179222de99362c36b44",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 111,
"avg_line_length": 39.30555555555556,
"alnum_prop": 0.6798586572438162,
"repo_name": "vgrem/Office365-REST-Python-Client",
"id": "b00990aeb4cc0cd47c357a66a32af889799ef2b... |
from . import Pointer, Structure, Reference, Index, const_index, is_aggregate
from .. import llvm
import ctypes
try:
import numpy as np
except ImportError:
np = None
__all__ = ["Any", "Array", "FastSlice", "Slice"]
class _AnyClass(object):
def __repr__(self):
return "Any"
#: Used in in slice... | {
"content_hash": "bf283a23edfdfeb2fe0d128bb621aadf",
"timestamp": "",
"source": "github",
"line_count": 392,
"max_line_length": 100,
"avg_line_length": 36.18622448979592,
"alnum_prop": 0.5897779344377864,
"repo_name": "dtcaciuc/nitrous",
"id": "1069ce5b03ef2f767c670259293a90e63c9e2885",
"size": "14... |
from django.apps import AppConfig
class ApiConfig(AppConfig):
name = 'api'
| {
"content_hash": "888bdb25c4b155e6d1f6168cfdb45d2c",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 33,
"avg_line_length": 16.2,
"alnum_prop": 0.7283950617283951,
"repo_name": "jminuscula/dixit-online",
"id": "90fb1640d1421c2653d5854a5f2d1248c35091dc",
"size": "82",
"bin... |
"""XLA backend that runs XRT operators via TensorFlow remote eager.
This module implements the Python XLA client's `Backend` abstraction using XRT
, which embeds XLA's compiler/runtime operations as TensorFlow
operations. The module uses TensorFlow's remote eager RPC API to invoke XRT
operations.
"""
from __future__ ... | {
"content_hash": "357cae160661b8cfc19f2030d084c7bb",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 80,
"avg_line_length": 34.784946236559136,
"alnum_prop": 0.7075734157650696,
"repo_name": "kevin-coder/tensorflow-fork",
"id": "ccf574f6842aef00dbc0e31cf1ae9086df4ca497",
"... |
"""
dicom2nifti
@author: abrys
"""
import os
import traceback
import logging
import nibabel
import numpy
import pydicom.config as pydicom_config
from pydicom.tag import Tag
import dicom2nifti.common as common
import dicom2nifti.settings as settings
import dicom2nifti.convert_generic as convert_generic
from dicom2ni... | {
"content_hash": "65f6efc4a884aca4ba569a6c531e8f81",
"timestamp": "",
"source": "github",
"line_count": 500,
"max_line_length": 118,
"avg_line_length": 37.002,
"alnum_prop": 0.6319658396843414,
"repo_name": "icometrix/dicom2nifti",
"id": "b1494c81f55a36caf1ea1a1eb5703d281dd78ae4",
"size": "18525",
... |
import unittest
import pytest
from django.db import models
from dirtyfields import DirtyFieldsMixin
JSON_FIELD_AVAILABLE = False
try:
from jsonfield import JSONField
JSON_FIELD_AVAILABLE = True
except ImportError:
pass
if JSON_FIELD_AVAILABLE:
class JSONFieldModel(DirtyFieldsMixin, models.Model):
... | {
"content_hash": "89ec80edd1b03fd9add8f99c51225f82",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 79,
"avg_line_length": 23.75862068965517,
"alnum_prop": 0.6966618287373004,
"repo_name": "jdotjdot/django-dirtyfields",
"id": "34db1aeeef809ffc630d347ad4b73827d88fc151",
"s... |
try:
integer_types = (int, long)
range = xrange
except NameError: # Python 3
integer_types = (int,)
import random
from graphtheory.structures.edges import Edge
from graphtheory.structures.graphs import Graph
def swap(L, i, j):
"""Swap items on the list."""
L[i], L[j] = L[j], L[i]
def make_rando... | {
"content_hash": "fa8725f1fb57631c1b17106e4c79c2c1",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 76,
"avg_line_length": 36.995049504950494,
"alnum_prop": 0.5660377358490566,
"repo_name": "ufkapano/graphs-dict",
"id": "1e552863946f633178b301536dd52d498d66aa37",
"size":... |
'''Regenerates the strong name verification scripts based on the list of
assemblies stored in this file.
The generated files should be checked in.
'''
ASSEMBLIES = sorted([
"AnalysisTest",
"AnalysisTests",
"AzurePublishingUITests",
"DebuggerTests",
"DebuggerUITests",
"DjangoTests",
"Django... | {
"content_hash": "571bc2e509476a1d13b6b44afdb3d30c",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 125,
"avg_line_length": 34.775510204081634,
"alnum_prop": 0.7153755868544601,
"repo_name": "alanch-ms/PTVS",
"id": "2594426aede680df7b3ebca09f1e4bb5bae224d5",
"size": "3432... |
import math
import hashlib
def sxor(s1, s2):
"""
XOR strings
"""
return ''.join(chr(ord(a) ^ ord(b)) for a, b in zip(s1, s2))
__b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
__b58base = len(__b58chars)
def b58encode(v):
""" encode v, which is a string of bytes, to bas... | {
"content_hash": "48bdf1eabe80a06ae73a810f5d2af1cb",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 75,
"avg_line_length": 23.12621359223301,
"alnum_prop": 0.593198992443325,
"repo_name": "inuitwallet/bippy",
"id": "b3ea522562b02b3cc949941f6668ef6ad3084265",
"size": "238... |
"""Testing the linked_list class - CF 401 Python Week 2 Assignment."""
import pytest
@pytest.fixture
def new_empty_stack():
"""Create an empty object of type Stack to be used in test functions."""
from stack import Stack
this_stack = Stack()
return this_stack
@pytest.fixture
def stack_123():
"""R... | {
"content_hash": "0914d0192df991d042ccd6756a777829",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 81,
"avg_line_length": 30.61904761904762,
"alnum_prop": 0.6819595645412131,
"repo_name": "CCallahanIV/data-structures",
"id": "cffc2ecc01382ae503dfab4f2f1b4eb3bec0c56e",
"s... |
import json
import logging
import unittest
from mixbox.binding_utils import ExternalEncoding
from mixbox.entities import Entity
from mixbox.vendor import six
import cybox.utils
from cybox.compat import MutableSequence
logger = logging.getLogger(__name__)
def assert_equal_ignore(item1, item2, ignore_keys=None):
... | {
"content_hash": "c7c3837b38bb9b15f841e9777c753edd",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 87,
"avg_line_length": 30.87958115183246,
"alnum_prop": 0.6256358087487284,
"repo_name": "CybOXProject/python-cybox",
"id": "60c27a36dcb55f0182496940b88ca67ac1424e60",
"si... |
import telnetlib
from pprint import pprint as pp
import time
TELNET_PORT = 23
TELNET_TIMEOUT = 6
def login(remote_conn, username, password):
output = remote_conn.read_until("sername:", TELNET_TIMEOUT)
remote_conn.write(username + '\n')
output += remote_conn.read_until("assword:", TELNET_TIMEOUT)
remo... | {
"content_hash": "43c8f9c556f1da14b0063e184e896743",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 72,
"avg_line_length": 20.915254237288135,
"alnum_prop": 0.6426256077795786,
"repo_name": "sgreen1/pynet",
"id": "e079c7273b03cfdab709ff44d5fec375ed93e373",
"size": "1257",... |
"""
Add color cycling fun to your i3bar.
This is the most pointless yet most exciting module you can imagine.
It allows color cycling of modules. Imagine the joy of having the current time
change through the colors of the rainbow.
If you were completely insane you could also use it to implement the i3bar
equivalent ... | {
"content_hash": "6812e909b96b0a2170c833422840a0bb",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 80,
"avg_line_length": 28.385650224215247,
"alnum_prop": 0.5298578199052133,
"repo_name": "docwalter/py3status",
"id": "62096c8972e10178862f1566a783dced9888d3c8",
"size": ... |
import argparse
import csv
#parse args
parser = argparse.ArgumentParser(
description='collect running time of workers of a query')
parser.add_argument("-o", "--output", type=str, help="input file")
parser.add_argument("-i", "--input", type=str, help="output file")
parser.add_argument("-s", "--shuffle",
... | {
"content_hash": "41d05ea9dc2a6a344050d65c8ffd04b4",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 68,
"avg_line_length": 27.37837837837838,
"alnum_prop": 0.6199407699901284,
"repo_name": "stechu/QuerySimulator",
"id": "46a577538df5e1a249aa9e990c6d7454ce98bdf7",
"size": ... |
from unittest import mock
from django.db import connection, transaction
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import CaptureQueriesContext
from .models import (
Article, InheritedArticleA, InheritedArticleB, NullablePublicationThrough,
NullableTargetArticle, Publication,... | {
"content_hash": "a0e44784dd50a806379c8d329a9b3ce2",
"timestamp": "",
"source": "github",
"line_count": 596,
"max_line_length": 113,
"avg_line_length": 42.93456375838926,
"alnum_prop": 0.5938098401656962,
"repo_name": "timgraham/django",
"id": "933eb23a7a67cd346ee36595e45c6446dc8f648d",
"size": "25... |
def crypt(word, salt): # real signature unknown; restored from __doc__
"""
crypt(word, salt) -> string
word will usually be a user's password. salt is a 2-character string
which will be used to select one of 4096 variations of DES. The characters
in salt must be either ".", "/", or an alphanumeric c... | {
"content_hash": "0d785adac71351e8b2b676f07bb4a53e",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 78,
"avg_line_length": 40.666666666666664,
"alnum_prop": 0.6844262295081968,
"repo_name": "akiokio/centralfitestoque",
"id": "c12387758a62767573f9555faad5596e53f700f9",
"si... |
import nltk as nltk
from collections import Counter
import itertools
# TODO: this part is language-specific
sentence_tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
def separate_sentences(text):
return sentence_tokenizer.tokenize(text)
| {
"content_hash": "f50e59eb057418ffea359c0bc3c14bd4",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 70,
"avg_line_length": 28.444444444444443,
"alnum_prop": 0.80078125,
"repo_name": "chrishokamp/maxent-decoder",
"id": "acc6bdea7e9ce6889df6bc3a6702fd3f0137593c",
"size": "30... |
"""
=========================================================
Feature agglomeration
=========================================================
These images how similar features are merged together using
feature agglomeration.
"""
print(__doc__)
# Code source: Gaël Varoquaux
# Modified for documentation by Jaques Grobl... | {
"content_hash": "09112f52a60798d5eb9f15a1ac690b62",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 77,
"avg_line_length": 28.92982456140351,
"alnum_prop": 0.6258338386901152,
"repo_name": "DailyActie/Surrogate-Model",
"id": "cc0640e4bec119a937e366a4e5ee845ba447c861",
"si... |
"""
Authors: Porebski Elvis C00170343
Tyrakowski Bartosz C00155128
Date: February, 2016
"""
import json
from os.path import exists
from flask import Flask
from flask_socketio import SocketIO, emit
from drs.drs import Drs
from drs.partition.ntfspartition import NtfsPartition
from drs.partiti... | {
"content_hash": "7d2747933ad24191f42cc4b9da3818fe",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 107,
"avg_line_length": 29.632653061224488,
"alnum_prop": 0.609504132231405,
"repo_name": "eepDev/DRS",
"id": "5b422a469f3a0143ba59e3002ccd855747964fea",
"size": "2904",
... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^signin/$', 'ale.views.sign_in', name='sign in'),
url(r'^signup/$', 'ale.views.sign_up', name='si... | {
"content_hash": "43906726efeac60c95d022e69c54659f",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 119,
"avg_line_length": 60.43181818181818,
"alnum_prop": 0.48251222264009025,
"repo_name": "stermedia/AndroidLanguageEditor",
"id": "ed99b66b9311e45e76d9bcba43ce0406e213c062"... |
'''
Created on 1.12.2016
@author: Darren
'''
'''
There is a fence with n posts, each post can be painted with one of the k colors.
You have to paint all the posts such that no more than two adjacent fence posts have the same color.
Return the total number of ways you can paint the fence.
Note:
n and k are non-negat... | {
"content_hash": "54ac212ffcb6b64469dfa501a8be3344",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 100,
"avg_line_length": 22.466666666666665,
"alnum_prop": 0.7299703264094956,
"repo_name": "darrencheng0817/AlgorithmLearning",
"id": "11140c8b3cd1d80a0e7bbcff4de93996ca798dc... |
__author__ = 'Rohan'
from Tkinter import *
from tkFileDialog import *
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
import vgprice
def getelements(vglist, type):
tmplist = []
for i in vglist:
tmplist.append(getattr(i, type))
return tmplist
def createstructarray(lo... | {
"content_hash": "405e32225b3198b994b10240148d0567",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 213,
"avg_line_length": 41.11721611721612,
"alnum_prop": 0.6212026726057907,
"repo_name": "rohanfray/IS602-Final",
"id": "80cc907284a8fda37472f28a87ecb1d66731759e",
"size"... |
from __future__ import absolute_import
from django.db import IntegrityError, transaction
from rest_framework.response import Response
from sentry import features
from sentry.api.bases import GroupEndpoint
from sentry.api.serializers import serialize
from sentry.api.serializers.models.integration import IntegrationIs... | {
"content_hash": "0522803198b8d48512450d8e1bb095b0",
"timestamp": "",
"source": "github",
"line_count": 291,
"max_line_length": 100,
"avg_line_length": 40.83848797250859,
"alnum_prop": 0.6168798384382362,
"repo_name": "mvaled/sentry",
"id": "643a3d95f8b11bb714c9c217e07b8a37d3f224ff",
"size": "11884... |
import json
import csv
import re
name_pattern = re.compile("^[a-zA-Z ]+$")
def name_valid(name):
return re.match(name_pattern, name) is not None
def hex_to_rgb(hex):
i = int(hex, 16)
r = (i >> 16) & 0xFF
g = (i >> 8) & 0xFF
b = i & 0xFF
return (r, g, b)
colors = {}
with open("./colors.json", "r") as colorfile:... | {
"content_hash": "f2db22eb1419b22161ab74ac8caef02a",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 48,
"avg_line_length": 20.513513513513512,
"alnum_prop": 0.6100131752305665,
"repo_name": "andrewortman/colorbot",
"id": "b904575653247810d12454818473cacf3e54c610",
"size":... |
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/")
def index():
p = {}
return render_template("index.html", p=p)
@app.route('/pjax/<query>')
def pjax_index(query):
p = {}
if "X-PJAX" in request.headers and query:
content = "you requested '%s' in pjax" % query
p['pl... | {
"content_hash": "434ea83e5b1fad01a15da2073235d42e",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 72,
"avg_line_length": 26.176470588235293,
"alnum_prop": 0.6303370786516854,
"repo_name": "ymotongpoo/restroom",
"id": "b9eb753cd3e179177e7eeaf54b02c3d0412a40a5",
"size": "... |
"""
Generate prefix list from file
"""
import sys
import fileinput
import getopt
from ipv4seq import numipv4
from ipv4holes import getholes
from prefixin import *
USAGE_MSG = """
Get IPv4 prefixes from a list
(c) POWERNET ISP 2016
Usage:
ipv4full.py [-a|l|s] [-g] [-p] [-n] [-d] <file>
Option... | {
"content_hash": "9819ed161b89203f2fef8958abe06751",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 136,
"avg_line_length": 29.324137931034482,
"alnum_prop": 0.49106302916274697,
"repo_name": "Urlandi/bgptablehole",
"id": "5bc3a8aba17980ad71cd9d4dfbca415a5a8655d5",
"size... |
import hashlib
import mimetypes
import os
import os.path
import re
import shutil
import time
from datetime import datetime
class connector():
"""Connector for elFinder"""
_options = {
'root': '/afs/',
'URL': '',
'rootAlias': 'Home',
'dotFiles': False,
'dirSize': True,
'fileMode': 0644,
'dirMode': 0755... | {
"content_hash": "3bbabbbe1765653840f18180cba55802",
"timestamp": "",
"source": "github",
"line_count": 1497,
"max_line_length": 113,
"avg_line_length": 26.828991315965265,
"alnum_prop": 0.6111097278589747,
"repo_name": "bfaviero/ok",
"id": "879b73193e47744306b8d599b3cfa87ffff8e92f",
"size": "40274... |
import boto3
import sure # noqa # pylint: disable=unused-import
from moto import mock_ec2, settings
from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID
from unittest import SkipTest
@mock_ec2
def test_describe_transit_gateway_peering_attachment_empty():
if settings.TEST_SERVER_MODE:
raise SkipTest("Se... | {
"content_hash": "c8a6b58ac9d4664d2dcfe6e2251ed351",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 88,
"avg_line_length": 39.95073891625616,
"alnum_prop": 0.7135635018495684,
"repo_name": "spulec/moto",
"id": "a61cd5f914397dbd211f8d4d8cae0bb3f86f010c",
"size": "8110",
... |
"""
WSGI config for Dota2Stats project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION... | {
"content_hash": "d1c42f32c1723a4a30e7ca48ffec1c30",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 79,
"avg_line_length": 44.71875,
"alnum_prop": 0.7945492662473794,
"repo_name": "mmbob/Dota2Stats",
"id": "f33a4381a846a97b69887244624af90ae04092b9",
"size": "1431",
"bin... |
import pyexcel as pe
import os
from base import clean_up_files
from nose.tools import raises
class TestSpliting:
def setUp(self):
self.testfile4 = "multiple_sheets.xls"
self.content4 = {
"Sheet1": [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3]],
"Sheet2": [[4, 4, 4, 4], [5, 5, 5... | {
"content_hash": "7fe92ba30a23a06fa41a4648e82270a0",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 90,
"avg_line_length": 37.01655629139073,
"alnum_prop": 0.5636461221933984,
"repo_name": "lordakshaya/pyexcel",
"id": "58b07204fc842f501fa0915fa11b4a2e24ef05e1",
"size": "... |
import abc
import imghdr
import os
import re
import sys
import semantic_version
import six
from murano.packages import exceptions
from murano.packages import package
class PackageBase(package.Package):
def __init__(self, format_name, runtime_version,
source_directory, manifest):
super(P... | {
"content_hash": "fd56eefd93d4c99911688610e5517387",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 78,
"avg_line_length": 29.768115942028984,
"alnum_prop": 0.5971275559883155,
"repo_name": "satish-avninetworks/murano",
"id": "40598c63f5931915f403d91ff83801797560a076",
"... |
from django.contrib.auth.decorators import login_required
class DisableCacheProtectAdminPages(object):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
response = self.get_response(request)
if '/grapher/admin' in request.path and 'Cach... | {
"content_hash": "9d785aacbc236a37cdc1a83f959a4bba",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 110,
"avg_line_length": 33,
"alnum_prop": 0.6561264822134387,
"repo_name": "aaldaber/owid-grapher",
"id": "e9b63d9c41b45f6191a05ba7e0239ec260f4784f",
"size": "759",
"bina... |
from django.test import TestCase
from smartfields.processors import ImageProcessor, ImageFormat
class ImageProcessorsTestCase(TestCase):
def test_dimensions_scaling(self):
p = ImageProcessor()
# scaling up: hard set dims
self.assertEqual(p.get_dimensions(200, 100, width=100), (100, 50))
... | {
"content_hash": "088d08eb180fd70d13fa96b14390bd47",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 96,
"avg_line_length": 59.31764705882353,
"alnum_prop": 0.6493454978183261,
"repo_name": "lehins/django-smartfields",
"id": "ad3369a7b37e8c7a78386d43acf8070f14fa6ed6",
"siz... |
import unittest, sys, os
from stripe import Stripe
class TestStripe(unittest.TestCase):
"""
A test class for the stripe module
"""
def setUp(self):
pass
def testSanity(self):
self.assertEqual(0, 0)
| {
"content_hash": "d1d1f5c1cb756af98c99e9b431dd199e",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 38,
"avg_line_length": 15.933333333333334,
"alnum_prop": 0.6276150627615062,
"repo_name": "DisorderlyZen/python-stripe",
"id": "7e74a654209c1fda9e6eee05739c591b36fa8ddd",
"... |
""" P1 tests for networks in advanced zone with security groups
"""
#Import Local Modules
import marvin
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin.integration.lib.utils import *
from marvin.integration.lib.base import *
from marvin.integration.lib.common import *
import netad... | {
"content_hash": "eab5b411dbfdacb2349d9361ed2ce5a8",
"timestamp": "",
"source": "github",
"line_count": 739,
"max_line_length": 155,
"avg_line_length": 46.39918809201624,
"alnum_prop": 0.45206917670389923,
"repo_name": "mufaddalq/cloudstack-datera-driver",
"id": "483435188ca6005859541de9f9b40da2f2035... |
'''
@author: Dallas Fraser
@date: 2019-03-25
@organization: MLSB API
@summary: Test suite that runs all importing classes
'''
from unittest import TestLoader, TextTestRunner
from api.test.importer import testAdvancedImportLeague
from api.test.importer import testAdvancedImportTeam
if __name__ == "__main__":
# run ... | {
"content_hash": "9bb44fd66199f2086a777b6de9f40ff9",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 35.375,
"alnum_prop": 0.7014134275618374,
"repo_name": "fras2560/mlsb-platform",
"id": "c8245fbacb6e738c4007ce7bd692611e9e1e072c",
"size": "566",
"... |
import sys
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import Pipeline... | {
"content_hash": "6053aa1735d65e0a3f0f88939c9f1ca6",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 114,
"avg_line_length": 43.56923076923077,
"alnum_prop": 0.6790254237288136,
"repo_name": "Azure/azure-sdk-for-python",
"id": "7f6f179cbd35dd9fc01505d764013442f31a5b5b",
"... |
import sys
import json
import datetime
from socket import*
from socket import error
from time import sleep
import struct
from ctypes import *
import paho.mqtt.client as mqtt
#------------------------------------------------------------#
ID_STRING = "V0.1"
#----------------------------------------------------------... | {
"content_hash": "bc6828facdd1ee0e561351fd13273425",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 91,
"avg_line_length": 31.91891891891892,
"alnum_prop": 0.4575783234546994,
"repo_name": "miarcompanies/sdn-wise-contiki",
"id": "4c9492f84769daeed9ae03f7f979eb2bddd0697d",
... |
import numpy as np
from keras.layers import Dense, Activation
from keras.models import Sequential
from keras.optimizers import SGD
np.random.seed(0)
# XOR
X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
Y = np.array([[0], [1], [1], [0]])
model = Sequential([Dense(input_dim=2, units=1),
Activation(... | {
"content_hash": "3966c24b22bad63a4bd7737457b68fa0",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 64,
"avg_line_length": 27.341463414634145,
"alnum_prop": 0.6467439785905441,
"repo_name": "hide-tono/python-training",
"id": "9034a709369fe1ec495ca98ef13ff8f663ac9be3",
"si... |
from openerp import fields, models
class SomeObj(models.Model):
_name = 'test_access_right.some_obj'
val = fields.Integer()
| {
"content_hash": "088633abd148e7c721642e2f7b6ef333",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 40,
"avg_line_length": 22.333333333333332,
"alnum_prop": 0.7014925373134329,
"repo_name": "diogocs1/comps",
"id": "b7752cb3665b94d153e532593fa0b6b521806483",
"size": "134",
... |
"""Tests for Grappler LayoutOptimizer."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.core.protobuf import config_pb2
from tensorflow.core.protobuf import device_properties_pb2
from tensorflow.core.protobuf import rew... | {
"content_hash": "eab741cc0135dd1ff2c83455a279355d",
"timestamp": "",
"source": "github",
"line_count": 1472,
"max_line_length": 80,
"avg_line_length": 38.72214673913044,
"alnum_prop": 0.6521693363041456,
"repo_name": "eaplatanios/tensorflow",
"id": "e3dd4b0bdfbb28480c78b0add5947c79852fb44d",
"size... |
import os
try:
__IPYTHON__
import sys
del sys.argv[1:]
except:
pass
import srwl_bl
import srwlib
import srwlpy
import math
import srwl_uti_smp
def set_optics(v=None):
el = []
pp = []
names = ['VFM', 'VFM_HFM', 'HFM', 'HFM_Watchpoint', 'Watchpoint', 'Watchpoint_Mask', 'Mask', 'Watchpoint2']... | {
"content_hash": "a1593a3613a04c41e5b416144d9515b0",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 440,
"avg_line_length": 70.12605042016807,
"alnum_prop": 0.6359097263830638,
"repo_name": "mkeilman/sirepo",
"id": "9ddba14cbf8e9a71389dc61c0101c875f30c4ccd",
"size": "250... |
from django.contrib import admin
from category.models import Category
class CategoryAdmin(admin.ModelAdmin):
list_display = ('id', 'name')
admin.site.register(Category, CategoryAdmin)
| {
"content_hash": "52980f72f827e81b7aa583fb729a6da4",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 44,
"avg_line_length": 21.333333333333332,
"alnum_prop": 0.7708333333333334,
"repo_name": "c-rhodes/hack2014",
"id": "78f4c710e4fb633bd2dae75fb254678db80ebd93",
"size": "192... |
from django.contrib import admin
from .models import Location
from .models import Event
from .models import Resource
from .models import Discipline
class EventAdmin(admin.ModelAdmin):
list_display = ['event_name', 'setup_start', 'teardown_end']
admin.site.register(Location)
admin.site.register(Event, EventAdmi... | {
"content_hash": "ef248e45fbb1021327f89ccd06fcc0a1",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 64,
"avg_line_length": 24.0625,
"alnum_prop": 0.787012987012987,
"repo_name": "bable5/schdlr",
"id": "e4c78922f0b852b988ab99a703c3780ea78e0b55",
"size": "385",
"binary": ... |
import argparse
from google.cloud import firestore
def seed_approver(email):
client = firestore.Client()
print("Seeding data into Google Cloud Project '{}'.".format(client.project))
approver = {
"kind": "approvers",
"email": email,
"active": True,
"name": "Seeded test user... | {
"content_hash": "89d9830f96b7b13c5e9f4a453c7d83e0",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 80,
"avg_line_length": 24.678571428571427,
"alnum_prop": 0.6743849493487699,
"repo_name": "GoogleCloudPlatform/emblem",
"id": "8b6ffadb9eb915a6f4f54b986d243a42dcd27b0b",
"s... |
import os
import sys
import json
import copy
import psutil
import threading
import netifaces
import socket
import time
import signal
import Tkinter as tk
from macdivert import MacDivert
from tkMessageBox import showerror, showwarning
from enum import Defaults
from tkFileDialog import askopenfilename, askdirectory
from ... | {
"content_hash": "bcdb6db9c66196d2ca0a2b2d3dac199d",
"timestamp": "",
"source": "github",
"line_count": 784,
"max_line_length": 100,
"avg_line_length": 41.732142857142854,
"alnum_prop": 0.5647350082523381,
"repo_name": "FinalTheory/wireless-network-reproduction",
"id": "f2093ecaa82c98d615aacd5695ef1c... |
from .core import PanState
| {
"content_hash": "78fbd5ad0fd2d282329f2da7a6d16354",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 26,
"avg_line_length": 27,
"alnum_prop": 0.8148148148148148,
"repo_name": "fmin2958/POCS",
"id": "d8c6e12c30ee02289f3b7fda5da845b26c2e3e05",
"size": "27",
"binary": false,... |
from .basededatos import BaseDeDatos
class PerDocumento(BaseDeDatos):
def obtener_uno(self, id_):
"""
Obtiene y retorna un objeto según el id dado.
:param id_: int >= 0
:return: tuple
"""
if id_ >= 0:
id_ = (id_,)
sql = 'SELECT * FROM docume... | {
"content_hash": "9c733bb95ab89e2ccc8f0b39b7ecf147",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 78,
"avg_line_length": 30.43859649122807,
"alnum_prop": 0.5400576368876081,
"repo_name": "gabofer82/taller_programacion_2017",
"id": "1313df4c7a823b24de35b9ac32f48791176d7f95... |
"""Test for general configuration"""
def tests_config():
"""Test CONFIG"""
from collections.abc import Mapping
from compilertools._config import CONFIG
# Check sections presence and type
assert isinstance(CONFIG.get("architectures"), Mapping)
assert isinstance(CONFIG.get("compilers"), Mapping... | {
"content_hash": "4c46ca50c972664ec9e7c3680416b29b",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 59,
"avg_line_length": 29.272727272727273,
"alnum_prop": 0.717391304347826,
"repo_name": "JGoutin/compilertools",
"id": "50d9acabb759ae64362068940204cae3b75399df",
"size": ... |
import sys, os, datetime
sys.path.append(os.path.abspath('utils'))
import sbt_versions
highlight_language = 'scala'
extensions = ['sphinx.ext.extlinks']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
sys.path.append(os.path.abspath('_themes'))
html_theme_path = ['_themes']
html_theme = ... | {
"content_hash": "7c39a81b057ab94d956a8de4aa498dba",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 89,
"avg_line_length": 28.5625,
"alnum_prop": 0.675419401896426,
"repo_name": "twitter/util",
"id": "65dc7b6c358876fe36f4c1b1db50ec9411c5440e",
"size": "1423",
"binary": ... |
from __future__ import unicode_literals
from django.db import migrations, models
import ehs_esports.users.models
class Migration(migrations.Migration):
dependencies = [
('teams', '0001_initial'),
('users', '0014_auto_20160913_2319'),
]
operations = [
migrations.AddField(
... | {
"content_hash": "a2040bc04f5f52f8efcbf00c1c0be628",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 273,
"avg_line_length": 39.03333333333333,
"alnum_prop": 0.6362083689154568,
"repo_name": "ReilySiegel/ehs_esports",
"id": "e30ad08ea5001264d3fe15a91794765b2cacd985",
"size... |
from random import randrange
# usar configuracoes globais?
tabuleiro = [
["", "", ""],
["", "", ""],
["", "", ""]
]
def tabuleiro_cheio():
for linha in tabuleiro:
for posicao in linha:
if posicao == "":
return False
return True
# poderia ser com um tuplo ou ... | {
"content_hash": "5871a37a7564cb61d3a756a8c4f69037",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 70,
"avg_line_length": 24.3781512605042,
"alnum_prop": 0.5249913822819717,
"repo_name": "Painatalman/python101",
"id": "5997630e8a82a8ec598794fc68a828e2da2049b2",
"size": ... |
"""This module contains a helper function for Telegram's ReplyMarkups
.. versionchanged:: 20.0
Previously, the contents of this module were available through the (no longer existing)
class ``telegram.ReplyMarkup``.
Warning:
Contents of this module are intended to be used internally by the library and *not* ... | {
"content_hash": "4aeb5964e88d740456e06b6c5efa2ce2",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 97,
"avg_line_length": 36.04347826086956,
"alnum_prop": 0.7080820265379976,
"repo_name": "tzpBingo/github-trending",
"id": "888937ba60158f157a7e603916c498e544fbfa46",
"size... |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.auth.tokens import default_token_generator
from django.utils import translation
from emailing.emails import HtmlEmail
def send_confirmation_mail(user, template, extra_context, subject):
translation.activate(settings.LANG... | {
"content_hash": "a0c6124c6a1b833835c706284795ea85",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 113,
"avg_line_length": 30.170731707317074,
"alnum_prop": 0.677445432497979,
"repo_name": "tonimichel/djpl-users",
"id": "031969547083b46f126c16180f94d70c56e1d953",
"size":... |
from .base import Template, dump, dumps
from .compute import VirtualMachine
from .storage import StorageAccount
from .network import VirtualNetwork, PublicIPAddress, NetworkInterface
| {
"content_hash": "e5ae1277466bcf388479f0c745f23737",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 70,
"avg_line_length": 30.833333333333332,
"alnum_prop": 0.8378378378378378,
"repo_name": "hoffmann/tropo",
"id": "d343ead9e93f236330c3f9a06861a7e2dd8400f0",
"size": "185",
... |
import unittest
# set the library path, otherwise upscaledb.so/.dll is not found
import os
import sys
import distutils.util
p = distutils.util.get_platform()
ps = ".%s-%s" % (p, sys.version[0:3])
sys.path.insert(0, os.path.join('build', 'lib' + ps))
sys.path.insert(1, os.path.join('..', 'build', 'lib' + ps))
impo... | {
"content_hash": "9f21367ea0ff252f54ca1424fafeb907",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 64,
"avg_line_length": 27.49206349206349,
"alnum_prop": 0.6287528868360277,
"repo_name": "yorickdewid/Mavicona",
"id": "730cee53b8c80df6bdbba6631efa6a12602b7727",
"size": "... |
"""Tests for the Question Editor controller."""
from __future__ import annotations
import os
from core import feconf
from core import utils
from core.constants import constants
from core.domain import question_fetchers
from core.domain import question_services
from core.domain import skill_services
from core.domain ... | {
"content_hash": "d0df896422887fd55b511af8d0e18615",
"timestamp": "",
"source": "github",
"line_count": 842,
"max_line_length": 102,
"avg_line_length": 41.28978622327791,
"alnum_prop": 0.5756486222171087,
"repo_name": "oppia/oppia",
"id": "e266ff10b36d241ff3741c056b57211063e6e0ec",
"size": "35371",... |
import pandas as pd
import numpy as np
import random
from sklearn.model_selection import train_test_split
from sklearn import preprocessing
from sklearn.externals import joblib
from sklearn.decomposition import PCA
import random
class Standardiser:
def __init__(self):
pass
def initialise(self):
... | {
"content_hash": "2b6531aa7b179dc3f91b26ec55c7d997",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 124,
"avg_line_length": 30.13821138211382,
"alnum_prop": 0.5848394928513623,
"repo_name": "TheProgrammingDuck/Europa-Challenge",
"id": "6e27b8c8e8a92d147842bed25f18fa52340a3... |
doc="Exception not in block"
err=ZeroDivisionError()
1/0
err=None
doc="finished"
| {
"content_hash": "4305834ab376a94807b034c49af30b8e",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 28,
"avg_line_length": 13.666666666666666,
"alnum_prop": 0.7560975609756098,
"repo_name": "go-python/gpython",
"id": "26f7a7e6adc257e5d90c383878c71c8a650d88ac",
"size": "247... |
from __future__ import absolute_import
import unittest
import mock
import pytest
from artman.tasks import protoc_tasks, package_metadata_tasks
from artman.pipelines import code_generation
from artman.pipelines import batch_generation
from artman.pipelines import grpc_generation
class GrpcClientPipelineTests(unitte... | {
"content_hash": "aab95193bf3a41a37a11e88a5372810d",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 82,
"avg_line_length": 38.367924528301884,
"alnum_prop": 0.6960904843865257,
"repo_name": "ethanbao/artman",
"id": "a3538e7e4115faa9fb54e7dc411ebe3c252188ab",
"size": "463... |
import numpy as np
import random
import json
import cma
from es import SimpleGA, CMAES, PEPG, OpenES
from env import make_env
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def relu(x):
return np.maximum(x, 0)
def passthru(x):
return x
# useful for discrete actions
def softmax(x):
e_x = np.exp(x - np.max(x))
... | {
"content_hash": "abc698a6b8afd6ce23a07d4f4d21cbe8",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 95,
"avg_line_length": 27.37908496732026,
"alnum_prop": 0.6268799236094533,
"repo_name": "google/brain-tokyo-workshop",
"id": "e729e78cbbf98432eb4fe42e17e0e8c3c1a64290",
"... |
import autograd.numpy as np
from numpy import testing as np_testing
from pymanopt.manifolds import Euclidean
from ._manifold_tests import ManifoldTestCase
class TestEuclideanManifold(ManifoldTestCase):
def setUp(self):
self.m = m = 10
self.n = n = 5
self.manifold = Euclidean(m, n)
... | {
"content_hash": "6a7f7b01f8505d0b5ccbf56471586df3",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 79,
"avg_line_length": 31.872881355932204,
"alnum_prop": 0.5865461313480458,
"repo_name": "pymanopt/pymanopt",
"id": "5f273298ea1aa9dd5f4d8199312d166a3b65a4d2",
"size": "3... |
"""
Task
You are given an HTML code snippet of N lines.
Your task is to print start tags, end tags and empty tags separately.
Format for printing the result is:
Start : Tag1
End : Tag1
Start : Tag2
-> Attribute2[0] > Attribute_value2[0]
-> Attribute2[1] > Attribute_value2[1]
-> Attribute2[2] > Attribute_value2[2]
... | {
"content_hash": "567154e2655c88b62683359165ef6d54",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 145,
"avg_line_length": 26.32608695652174,
"alnum_prop": 0.6581337737407101,
"repo_name": "spradeepv/dive-into-python",
"id": "c270c4f80c5327287a890c6a1214e697ecaf375f",
"s... |
from . import perma_base
| {
"content_hash": "8309fc1862594cb3914d38154b60d375",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 24,
"avg_line_length": 25,
"alnum_prop": 0.76,
"repo_name": "permamodel/permamodel",
"id": "45984ddfe4d122e78d176c1538db7773807e558f",
"size": "25",
"binary": false,
"co... |
from __future__ import absolute_import
from etsdevtools.developer.helper.fbibp import *
| {
"content_hash": "c0e20030e62b320632a9c8dd63958157",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 48,
"avg_line_length": 44,
"alnum_prop": 0.8068181818181818,
"repo_name": "enthought/etsproxy",
"id": "445c02b4011a7056a8efba7bea4dc73ff0a1de7e",
"size": "103",
"binary": ... |
import os
import ctypes
from ctypes.util import find_library
lib = find_library('ssl')
if not lib:
AES = None
else:
""" <aes.h>
# define AES_ENCRYPT 1
# define AES_DECRYPT 0
# define AES_MAXNR 14
struct aes_key_st {
# ifdef AES_LONG
unsigned long rd_key[4 * (AES_MAXNR + 1)];... | {
"content_hash": "c467e919445ef630ab6f8d47c1773974",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 76,
"avg_line_length": 33.02197802197802,
"alnum_prop": 0.5104825291181364,
"repo_name": "andr-04/Telethon",
"id": "f9917d71319a891da78fabe105f53da31fea5837",
"size": "3005... |
import sys
import os
import random
import unittest
DIRNAME_MODULE = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(sys.argv[0])))) + os.sep
sys.path.append(DIRNAME_MODULE)
sys.path.append(DIRNAME_MODULE + "pyss" + os.sep)
from pyss import pyssobject
from pyss.pyss_model import PyssModel
from pyss.se... | {
"content_hash": "6e91583840bb3cc876280460537deb62",
"timestamp": "",
"source": "github",
"line_count": 334,
"max_line_length": 147,
"avg_line_length": 34.40119760479042,
"alnum_prop": 0.5378590078328982,
"repo_name": "vpv11110000/pyss",
"id": "4c79647ed360906584940289089db5bf8b2f7f3d",
"size": "12... |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""code generator for GLES2 command buffers."""
import itertools
import os
import os.path
import sys
import re
from optparse impor... | {
"content_hash": "6a261b73a8bf89366626c55b340f5a8b",
"timestamp": "",
"source": "github",
"line_count": 7576,
"max_line_length": 81,
"avg_line_length": 31.80464625131996,
"alnum_prop": 0.5984220923669444,
"repo_name": "zcbenz/cefode-chromium",
"id": "f2cf609484bdcf8bf744e208782da6f41e03ecb8",
"size... |
import os
import time
| {
"content_hash": "6f202ca6d658e45b414c6af6591504de",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 11,
"avg_line_length": 11,
"alnum_prop": 0.8181818181818182,
"repo_name": "au-chrismor/internetoffish",
"id": "59a3204a18beb15f000e8e2dc4c88299c5af12b0",
"size": "22",
"bi... |
from threading import Thread, Timer
import websocket
import logging
import time
try:
import simplejson as json
except ImportError:
import json
class Connection(Thread):
def __init__(self, event_handler, url, log_level=logging.INFO, daemon=True, reconnect_interval=10):
self.event_handler = event_h... | {
"content_hash": "22957dfcb790f22385a9075cf83cbac8",
"timestamp": "",
"source": "github",
"line_count": 279,
"max_line_length": 113,
"avg_line_length": 34.03942652329749,
"alnum_prop": 0.5777613983363167,
"repo_name": "ekulyk/PythonPusherClient",
"id": "75fe53fd2d56b93efda68fa86299c9e323e4b3ec",
"s... |
from django.http import HttpResponseNotFound, HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response
from django.template import RequestContext
from remindme.forms import ReminderForm
from remindme.models import Reminder
import parsedatetime
import... | {
"content_hash": "74006088b3fc15fda2f1c6dc43d9f684",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 99,
"avg_line_length": 34.86842105263158,
"alnum_prop": 0.670188679245283,
"repo_name": "hitchtest/django-remindme",
"id": "f8ff1cf7a79fc8c0a20f0e93c37decf1334d8bde",
"size... |
from __future__ import print_function
from aquilon.exceptions_ import InternalError
class ConsistencyChecker(object):
"""Consistency Checker Base Class"""
def __init__(self, config, session, logger):
self.session = session
self.config = config
self.logger = logger
self._failur... | {
"content_hash": "8f13fd4e9d3be7be652782ed71f5c0e4",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 77,
"avg_line_length": 33.08695652173913,
"alnum_prop": 0.5893561103810775,
"repo_name": "guillaume-philippon/aquilon",
"id": "2638002d8391b470b9d1af4ab6ce39760c02e8e5",
"s... |
from __future__ import print_function
import argparse
import json
import sys
import repositorytools
from repositorytools.cli.common import CLI
from repositorytools.lib.repository import logger
__all__ = ['ArtifactCLI', 'artifact_cli']
class ArtifactCLI(CLI):
def _get_parser(self):
parser = argparse.Arg... | {
"content_hash": "e4257522de7370b5ff82c0e707c57292",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 226,
"avg_line_length": 53.48717948717949,
"alnum_prop": 0.62320230105465,
"repo_name": "packagemgmt/repositorytools",
"id": "0e54458f17170a84c96ff02497904d01a6b61995",
"s... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "deployment.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "fac7753e7e774bfdf0656013aa762494",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 74,
"avg_line_length": 25.666666666666668,
"alnum_prop": 0.7142857142857143,
"repo_name": "strets123/chembiohub_ws",
"id": "442caf703ba649f0a9e22dea44302f986803e0ea",
"size"... |
from sklearn import svm, datasets as ds, metrics
from sklearn.model_selection import train_test_split as splitter
#Load dataset
cancer = ds.load_breast_cancer()
print('sample # = {}'.format(len(cancer.data)))
print('target # = {}'.format(len(cancer.target)))
print('shape = {}'.format(cancer.data.shape))
#print("Feat... | {
"content_hash": "5ca537fc5673a34abbd6a82642886795",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 108,
"avg_line_length": 29.263157894736842,
"alnum_prop": 0.6942446043165468,
"repo_name": "hiryou/MLPractice",
"id": "a4af7c1f6c39dd13d4850c3c57d6f9f7bf5de902",
"size": "1... |
import numpy as np
import warnings
warnings.simplefilter("ignore", DeprecationWarning)
# --------------------------------------------------------------
class SklNMF:
"""
Wrapper class backed by the scikit-learn package NMF implementation.
"""
def __init__( self, max_iters = 100, init_strategy = "random" ):
sel... | {
"content_hash": "a10a6dd9fa93d6db6c12d49b23818e74",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 180,
"avg_line_length": 29.07766990291262,
"alnum_prop": 0.6510851419031719,
"repo_name": "akiratu/topic-stability",
"id": "61238dada553226aa90c78a6cabd0cc1476b035f",
"siz... |
"""Константы для работы JIM протокола"""
# Возможные ключи в сообщениях от клиентов
PRESENCE = 'presence'
MSG = 'msg'
QUIT = 'quit'
# Кортеж возможных действий (будет дополняться)
ACTIONS = (PRESENCE, MSG, QUIT)
# Обязательные ключи в сообщениях от клиента
ACTION = 'action'
TIME = 'time'
# Кортеж из обя... | {
"content_hash": "14b211964c3ad12089a4058e44da7b29",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 74,
"avg_line_length": 25.023809523809526,
"alnum_prop": 0.7117031398667936,
"repo_name": "OOPSA45/Python-learn-",
"id": "a3c056d32e7b313e3d1d863044a8b62e8f62cc88",
"size":... |
from __future__ import division
import os, sys, re
from solid import *
from math import *
RIGHT, TOP, LEFT, BOTTOM = range(4)
EPSILON = 0.01
TAU = 2*pi
X, Y, Z = range(3)
ORIGIN = ( 0, 0, 0)
UP_VEC = ( 0, 0, 1)
RIGHT_VEC = ( 1, 0, 0)
FORWARD_VEC = ( 0, 1, 0)
DOWN_VEC = ( 0, 0,-1)
LEFT_VEC = (-1, 0,... | {
"content_hash": "d85a1f05278d9378fbb069d774b0c495",
"timestamp": "",
"source": "github",
"line_count": 1123,
"max_line_length": 156,
"avg_line_length": 37.82546749777382,
"alnum_prop": 0.5495079806017232,
"repo_name": "vishnubob/rockit",
"id": "74f5c14b284b7d4a8b2386c105c11266f4c849f0",
"size": "4... |
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('paloma', '0005_auto_20150418_1524'),
]
operations = [
migrations.AlterField(
... | {
"content_hash": "6f4a50eade211fdff0c7f84a9777a4ee",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 162,
"avg_line_length": 37.1578947368421,
"alnum_prop": 0.5878186968838527,
"repo_name": "hdknr/paloma",
"id": "427d3bdd5457abc5f0ca24a17e892d18a16da9e2",
"size": "2142",
... |
from redberry.tests import RedTestCase
from redberry.models import RedPost, RedCategory
class FrontendRoutesTest(RedTestCase):
def test_home(self):
url = '/%s/' % self.url_prefix
response = self.test_client.get(url)
# Shows published
post = RedPost.query.first()
assert po... | {
"content_hash": "c1c80041a5aca6e96656b05d16e9d6ef",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 76,
"avg_line_length": 33.892857142857146,
"alnum_prop": 0.631190727081138,
"repo_name": "michaelcho/redberry",
"id": "c4f8edb7140a01c09212572f8c6aee99654409c2",
"size": "1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.