text stringlengths 4 1.02M | meta dict |
|---|---|
import logging
import server.util.tags as tag_utl
from server.cache import cache
from server.auth import user_admin_mediacloud_client
import server.views.sources.apicache as apicache
from server.views.stories import QUERY_LAST_MONTH, QUERY_ENGLISH_LANGUAGE
logger = logging.getLogger(__name__)
@cache.cache_on_argume... | {
"content_hash": "4fb5c1cca7a0652877b557da96fc4624",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 115,
"avg_line_length": 36.65,
"alnum_prop": 0.7216916780354706,
"repo_name": "mitmedialab/MediaCloud-Web-Tools",
"id": "6a67085b1372805e56d3dd6a6541cde42fbd2fdd",
"size": ... |
"""
=======================================
Receiver Operating Characteristic (ROC)
=======================================
Example of Receiver Operating Characteristic (ROC) metric to evaluate
classifier output quality.
ROC curves typically feature true positive rate on the Y axis, and false
positive rate on the X a... | {
"content_hash": "4da432e2276cc591500173a9abb1085b",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 140,
"avg_line_length": 36,
"alnum_prop": 0.6255144032921811,
"repo_name": "deepakrana47/DT-RAE",
"id": "0707c79ab9da39e7f81d4f0b8b7b82c42b0cb9cd",
"size": "4860",
"bina... |
from qingcloud.cli.misc.utils import explode_array
from qingcloud.cli.iaas_client.actions.base import BaseAction
class JoinInstanceGroupAction(BaseAction):
action = 'JoinInstanceGroup'
command = 'join-instance-group'
usage = '%(prog)s -i "instance_id,..." -g <group_id> [-f <conf_file>]'
@classmethod... | {
"content_hash": "05c39a223bf67a9c73e0bb63051b903a",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 101,
"avg_line_length": 33.88095238095238,
"alnum_prop": 0.5790583274771609,
"repo_name": "yunify/qingcloud-cli",
"id": "c31b917488e3bba484496c51347b579e5c1db6be",
"size": ... |
import unittest
import json
import msgpack
from cellardoor.views import MinimalView
class TestMinimalView(unittest.TestCase):
def test_list_response(self):
"""
Should return a simple list for list get methods
"""
view = MinimalView()
objs = [{'foo':123}, {'foo':456}]
content_type, result = view.get_... | {
"content_hash": "8424d9be585027a1d4029e64e1987a52",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 83,
"avg_line_length": 31.07894736842105,
"alnum_prop": 0.7298899237933955,
"repo_name": "cooper-software/cellardoor",
"id": "b609000e0610a8ba02da01c869c380e602cc9854",
"si... |
import sys, os
try:
from Queue import Queue
except ImportError:
from queue import Queue
import tempfile
from datetime import datetime
class MemorySubscriber:
def __init__(self):
''' Initializes the empty queue for a particular subscriber. '''
self.messages = Queue()
de... | {
"content_hash": "6c4e4c9a21a389cb57b6734cc88c67d9",
"timestamp": "",
"source": "github",
"line_count": 311,
"max_line_length": 225,
"avg_line_length": 38.29903536977492,
"alnum_prop": 0.5922256737469566,
"repo_name": "jyotiska/minpubsub",
"id": "8e8e6d4e2d2b99fbb5c8c339674869716ab55d31",
"size": "... |
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from pytest import raises
from tambo import dispatcher
class MySubCommand(object):
def __init__(self, argv):
self.argv = argv
def parse_args(self):
return self.argv
class MyNewSubCommand(object):
de... | {
"content_hash": "0f65b5022a035b8fcbd94cf717b8349e",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 74,
"avg_line_length": 31.693548387096776,
"alnum_prop": 0.6371501272264631,
"repo_name": "alfredodeza/tambo",
"id": "6ba3f955de5d6fafe5b6e7f17cdd7df8e9465b53",
"size": "19... |
from sqlalchemy.testing import fixtures
from sqlalchemy.testing import assert_raises_message, eq_
class _BooleanProcessorTest(fixtures.TestBase):
def test_int_to_bool_none(self):
eq_(
self.module.int_to_boolean(None),
None
)
def test_int_to_bool_zero(self):
eq_... | {
"content_hash": "e5eab634efdefe8de0000bc2c8e9dec4",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 76,
"avg_line_length": 26.944,
"alnum_prop": 0.5216745843230404,
"repo_name": "robin900/sqlalchemy",
"id": "47302af979fafa12eccc513f4fcffbdc4cecf7d9",
"size": "6736",
"b... |
import os
import shutil
import sys
import datetime
from invoke import task
from invoke.util import cd
from pelican.server import ComplexHTTPRequestHandler, RootedHTTPServer
CONFIG = {
# Local path configuration (can be absolute or relative to tasks.py)
'deploy_path': 'output',
# Port for `serve`
'port... | {
"content_hash": "ff0f9943dc1ba6921b9c49f9e925f641",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 72,
"avg_line_length": 22.973333333333333,
"alnum_prop": 0.6302959953569356,
"repo_name": "minhhh/pelican_git",
"id": "6a6ca239a3289cd665e1054ea85cb27da42cdd75",
"size": "1... |
"""Wordcount exercise
Google's Python class
The main() below is already defined and complete. It calls print_words()
and print_top() functions which you write.
1. For the --count flag, implement a print_words(filename) function that counts
how often each word appears in the text and prints:
word1 count1
word2 count2
... | {
"content_hash": "ad31d23f9fdbfc92983e4c05e438af6d",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 79,
"avg_line_length": 29.094117647058823,
"alnum_prop": 0.7027901334411646,
"repo_name": "nikraina/google-python-exercises",
"id": "9b6bcdfae29fe24f6acce47a06339affcd378ef0"... |
import argparse
import glob
import json
import os
import sys
from typing import List
import inspect_compute_results
def exact_match(reference_result: str, variant_result: str) -> bool:
result, _ = inspect_compute_results.exactdiff_ssbos(reference_result, variant_result)
return result
def fuzzy_match(refere... | {
"content_hash": "9eae791007fefdd2fe0942b921fdc318",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 100,
"avg_line_length": 35.764044943820224,
"alnum_prop": 0.6415331448319196,
"repo_name": "google/graphicsfuzz",
"id": "eb181c9adf8361e51b1a51b63d5d55dbc951444d",
"size": ... |
import dataclasses
from typing import ClassVar, List, Set, Tuple, Type
@dataclasses.dataclass
class A:
a: List[int] = <error descr="mutable default 'list' is not allowed">[]</error>
b: List[int] = <error descr="mutable default 'list' is not allowed">list()</error>
c: Set[int] = <error descr="mutable defau... | {
"content_hash": "323ef84cf6fd2750de2fb0dbcccc4961",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 94,
"avg_line_length": 45.64705882352941,
"alnum_prop": 0.6314432989690721,
"repo_name": "mglukhikh/intellij-community",
"id": "447d948ebbb304e02c538036f4da132930af0dc7",
"... |
'''
Created on Mar 18, 2014
Copyright (c) 2014-2015 Dario Bonino
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law... | {
"content_hash": "25e46cc1739cb14f76c73f88c0d1b150",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 72,
"avg_line_length": 29.70689655172414,
"alnum_prop": 0.6198491004062682,
"repo_name": "AmI-2015/python-lab1",
"id": "c0dac302d6e67b44af267f99971be4e520f8ce24",
"size": "... |
import re
import os
import glob
import argparse
import sys
def create_parser():
"""Return the argument parser"""
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', dest='input_path', required=True,
help='''The input folder path, containing the data. ''')
re... | {
"content_hash": "a38f9b25c78267d1165eca3b6b9a43dc",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 91,
"avg_line_length": 26.333333333333332,
"alnum_prop": 0.5509342977697408,
"repo_name": "Joannacodes/RNA-Seq-pipeline-SGE-cluster",
"id": "169fa208b53fcea53289416028db6f6aa... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.sql import SqlManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-sql
# USAGE
python get_a_hub_database_schema..py
Before run the sample, please set the values of the client ID, tenant ID and client se... | {
"content_hash": "63bdc85ef40060a5b0ca86cd52c675f4",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 133,
"avg_line_length": 33.888888888888886,
"alnum_prop": 0.719672131147541,
"repo_name": "Azure/azure-sdk-for-python",
"id": "85716fad4a252ef5090ab4739c06314b83f5b809",
"s... |
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": "1a1e487b4c7d9bd98ce6d84c268e1a72",
"timestamp": "",
"source": "github",
"line_count": 353,
"max_line_length": 225,
"avg_line_length": 46.04532577903683,
"alnum_prop": 0.6651285837332349,
"repo_name": "Azure/azure-sdk-for-python",
"id": "286ef9889935cb8bf5a753e1e3cd24bcc78e9d9a",
"... |
"""Implementation of Nash Conv metric for a policy.
In the context of mean field games, the Nash Conv is the difference between:
- the value of a policy against the distribution of that policy,
- and the best response against the distribution of the policy.
"""
from open_spiel.python import policy as policy_std
from ... | {
"content_hash": "e9048d5cab9f9ade65a02b2839056c47",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 78,
"avg_line_length": 32.18840579710145,
"alnum_prop": 0.6771724448446645,
"repo_name": "deepmind/open_spiel",
"id": "d1eed724828419aa911d7727ee42277094cf5ddc",
"size": "2... |
import mparser
import environment
import coredata
import dependencies
import mlog
import build
import optinterpreter
import wrap
import mesonlib
import os, sys, platform, subprocess, shutil, uuid, re
from functools import wraps
import importlib
class InterpreterException(coredata.MesonException):
pass
class Inva... | {
"content_hash": "63e49f0e669bf91d8b08b6cc50514151",
"timestamp": "",
"source": "github",
"line_count": 2039,
"max_line_length": 183,
"avg_line_length": 42.41441883276116,
"alnum_prop": 0.5987766381832268,
"repo_name": "yuhangwang/meson",
"id": "5da6d8b352adf6c1640da15f236a6b1aea5a90cb",
"size": "8... |
import quex.engine.state_machine.algorithm.beautifier as beautifier
import quex.engine.state_machine.algorithm.acceptance_pruning as acceptance_pruning
from quex.blackboard import E_PreContextIDs, setup as Setup
def do(the_state_machine, pre_context_sm, BeginOfLinePreCo... | {
"content_hash": "a228595b4821fd208cb11398c5dd43cd",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 114,
"avg_line_length": 50.25,
"alnum_prop": 0.6324626865671642,
"repo_name": "coderjames/pascal",
"id": "3fa1bcd532f046a386bf78cc0f9d6cc4c9a927a7",
"size": "3271",
"bina... |
"""Find out how to 'clear the board' in Pyramid Solitaire.
The design is meant to be simple to understand so it is less likely to have
bugs, but to make Pyramid Solitaire solvable for the worst case scenarios, we
must do a bit of optimization work on the state representation.
This implementation skips all of the prec... | {
"content_hash": "33c8771188a6f1e0a26800271c1e0efb",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 80,
"avg_line_length": 40.92673992673993,
"alnum_prop": 0.6359974939586504,
"repo_name": "mchung94/solitaire-player",
"id": "5457bf2716e1fb28051408674f4fcfb33fdb558f",
"si... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
# -- General conf... | {
"content_hash": "74e1496e7e987ac946730341a4a3adcb",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 84,
"avg_line_length": 31.677419354838708,
"alnum_prop": 0.7048116089613035,
"repo_name": "I-Valchev/UrPas",
"id": "8d8ce45c7510fb690c61ca5b087630066f0afa8d",
"size": "827... |
from telemetry import multi_page_benchmark
from telemetry import util
class Dromaeo(multi_page_benchmark.MultiPageBenchmark):
def MeasurePage(self, page, tab, results):
js_is_done = 'window.document.cookie.indexOf("__done=1") >= 0'
def _IsDone():
return bool(tab.EvaluateJavaScript(js_is_done))
util... | {
"content_hash": "39803f2f24caf83b0736382ef71156d1",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 69,
"avg_line_length": 34.333333333333336,
"alnum_prop": 0.6148867313915858,
"repo_name": "nacl-webkit/chrome_deps",
"id": "d10f429cbf79a212c1b063b97f124ef10e945c8d",
"size... |
import os
import re
import sys
def get_list_includes():
return "src/cpu/kernels/assembly " \
"src/core/NEON/kernels/assembly " \
"src/core/NEON/kernels/convolution/winograd " \
"include/linux include " \
". ".split()
def get_list_flags( filename, arch):
assert arch ... | {
"content_hash": "50dc4098afaa15b3be8e59303cea7395",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 206,
"avg_line_length": 57.917159763313606,
"alnum_prop": 0.5959337964854925,
"repo_name": "ARM-software/ComputeLibrary",
"id": "0a0de84bab15b7b63ba5cbfb5d9ffa840331ddbc",
... |
import argparse
from azure.mgmt.signalr.models import UpstreamTemplate
from knack.log import get_logger
from knack.util import CLIError
logger = get_logger(__name__)
# pylint: disable=protected-access, too-few-public-methods
class UpstreamTemplateAddAction(argparse._AppendAction):
def __call__(self, parser, name... | {
"content_hash": "8c89e5123f2b40000290054efcc85259",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 97,
"avg_line_length": 38.05,
"alnum_prop": 0.6360052562417872,
"repo_name": "yugangw-msft/azure-cli",
"id": "9208a7dd254ed1a702d61bf88e1f2f381379679e",
"size": "1139",
"... |
import math
import numpy as np
from numba import cuda, float32
from numba.cuda.testing import unittest
import numba.cuda.random
from numba.cuda.testing import skip_on_cudasim, CUDATestCase
from numba.cuda.random import \
xoroshiro128p_uniform_float32, xoroshiro128p_normal_float32, \
xoroshiro128p_uniform_flo... | {
"content_hash": "f019e0ba68f01f2e6fcfd54646e8d4ce",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 89,
"avg_line_length": 34.22,
"alnum_prop": 0.6598480420806546,
"repo_name": "sklam/numba",
"id": "7673a924d37892716bfea072dd29ec7597bd35da",
"size": "3422",
"binary": f... |
import setuptools
setuptools.setup(
name="avro_codec",
version="2.0.0",
author="Data and Analytics",
author_email="[email protected]",
description="An avro codec which exposes an API similar to the standard library's marshal, pickle and json modules",
license="MIT",
keywords="avro encode decode ... | {
"content_hash": "c7edf0ca78b18637cc26b33c19c06691",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 120,
"avg_line_length": 30.647058823529413,
"alnum_prop": 0.6660268714011516,
"repo_name": "gamechanger/avro_codec",
"id": "fab7241afea17c632de14768a7cd77b5d9b0e751",
"size... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 30, transform = "RelativeDifference", sigma = 0.0, exog_count = 20, ar_order = 0); | {
"content_hash": "cb77ad2b6a53ba3a2f639490b5f956dd",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 175,
"avg_line_length": 39.285714285714285,
"alnum_prop": 0.7163636363636363,
"repo_name": "antoinecarme/pyaf",
"id": "fc7a0be87214f18a6389e88e6e3d714c1a2d00be",
"size": "27... |
"""
Given a list of words, we may encode it by writing a reference string S and a
list of indexes A.
For example, if the list of words is ["time", "me", "bell"], we can write it as
S = "time#bell#" and indexes = [0, 2, 5].
Then for each index, we will recover the word by reading from the reference
string from that in... | {
"content_hash": "8c96cc4c013b6cad18c17740686fcb07",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 79,
"avg_line_length": 24.267857142857142,
"alnum_prop": 0.5614422369389257,
"repo_name": "algorhythms/LeetCode",
"id": "3f9affa6610b425235ebaff302de5b1c4a757b97",
"size": ... |
from .base_test import BaseTest
| {
"content_hash": "bdd332d64e136c31e483f3ce1b0daea4",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 31,
"avg_line_length": 32,
"alnum_prop": 0.8125,
"repo_name": "VirgilSecurity/virgil-sdk-python",
"id": "df77b31f7b89f6755ae580fdcf0557ddcd36e36c",
"size": "1642",
"binary... |
import urllib2
import httplib
import socket
import json
import re
import sys
from telemetry.core import util
from telemetry.core import exceptions
from telemetry.core import user_agent
from telemetry.core import wpr_modes
from telemetry.core import wpr_server
from telemetry.core.chrome import extension_dict_backend
fr... | {
"content_hash": "2174225affb8d5f9eeb4bdc2be3e6b3b",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 80,
"avg_line_length": 33.60576923076923,
"alnum_prop": 0.6835479256080115,
"repo_name": "timopulkkinen/BubbleFish",
"id": "dce70e69423bfa50b1e6ef7b85bf4775e79becf8",
"siz... |
from testtools import skipIf
from heat.engine import clients
from heat.engine import environment
from heat.tests.v1_1 import fakes
from heat.common import exception
from heat.common import template_format
from heat.engine import resources
from heat.engine.resources import instance as instances
from heat.engine import ... | {
"content_hash": "575118b1e573b35e75cb1b309572afae",
"timestamp": "",
"source": "github",
"line_count": 805,
"max_line_length": 76,
"avg_line_length": 29.40248447204969,
"alnum_prop": 0.5369048122016139,
"repo_name": "savi-dev/heat",
"id": "edf8d43b1b24157b405800ae039df60caed9395e",
"size": "24288"... |
import io
import os
import socket
import requests
from loguru import logger
from flexget import plugin
from flexget.event import event
try:
import mechanicalsoup
except ImportError:
mechanicalsoup = None
logger = logger.bind(name='formlogin')
class FormLogin:
"""
Login on form
"""
schema... | {
"content_hash": "627b71eda4148cad857d270fe0362687",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 100,
"avg_line_length": 32.80808080808081,
"alnum_prop": 0.5689655172413793,
"repo_name": "malkavi/Flexget",
"id": "2fb88063480916238987e0e6af8a420a472f599c",
"size": "3248... |
import os
import sys
import subprocess
# resolve cython executable
cython = None
def resolve_cython():
global cython
for executable in ('cython', 'cython-2.7'):
for path in os.environ['PATH'].split(':'):
if not os.path.exists(path):
continue
if executable in os.... | {
"content_hash": "af1dfc11a7f0b26786a75d8c4e9b891a",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 79,
"avg_line_length": 28.641509433962263,
"alnum_prop": 0.5118577075098815,
"repo_name": "rnixx/kivy-ios",
"id": "c73dd6416a71aa99d0c21e8e0e94d8304745d3fc",
"size": "1541"... |
import requests
import os
# For this to work, the digitalocean DO_API_KEY, DO_CLIENT_KEY and DO_DEFAULT_SSH_KEY
# should be set as environmental variables
# linux examples in ~./bashrc
# export DO_API_KEY=###########################
# export DO_CLIENT_KEY=#########################
# export DO_DEFAULT_SSH_KEY=#########... | {
"content_hash": "63fafc19026d08dce9d570ea77730ab4",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 203,
"avg_line_length": 33.401408450704224,
"alnum_prop": 0.6316677208517816,
"repo_name": "alexkyllo/school-manager",
"id": "8ba26064a39a53f9097ef391a91420989d5a3214",
"s... |
import can
bus = can.Bus("can0", bustype="socketcan")
axisID = 0x1
print("Requesting AXIS_STATE_FULL_CALIBRATION_SEQUENCE (0x03) on axisID: " + str(axisID))
msg = can.Message(arbitration_id=axisID << 5 | 0x07, data=[3, 0, 0, 0, 0, 0, 0, 0], dlc=8, is_extended_id=False)
print(msg)
try:
bus.send(msg)
print("Me... | {
"content_hash": "8098cb16ca4423f5b700dea4e45ae365",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 112,
"avg_line_length": 34.64150943396226,
"alnum_prop": 0.6089324618736384,
"repo_name": "madcowswe/ODrive",
"id": "f6ce94f275b84c062fd6812cbfce6027d1af3998",
"size": "183... |
import os
import io
import sys
import time
import glob
import threading
from Queue import Queue
import cv2
from PIL import Image
import numpy as np
from stir.exception import *
from stir.cmd import run
from magnolia.utility import *
from magnolia.utility import LOG as L
class PatternMatchObject(object):
def __... | {
"content_hash": "439cc57eb68245974b009d5a2f8263b4",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 91,
"avg_line_length": 32.77165354330709,
"alnum_prop": 0.5679961556943777,
"repo_name": "setsulla/stir",
"id": "b09dab7bf9eb5c907e04b011987e291cef240cd7",
"size": "4162",... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('articles', '0002_auto_20171113_1527'),
]
operations = [
migrations.AddField(
model_name='category',
name='order',
... | {
"content_hash": "145272e75fa202a45914a3dbdf727108",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 83,
"avg_line_length": 22.833333333333332,
"alnum_prop": 0.6034063260340633,
"repo_name": "sanoma/django-arctic",
"id": "26fcce6c303ab9762d88568ca8dd97ced4ce837d",
"size": ... |
import unittest
from streamlink import Streamlink
from streamlink.plugins.stream import StreamURL
from streamlink.plugin.plugin import stream_weight
from streamlink.stream import *
class TestPluginStream(unittest.TestCase):
def setUp(self):
self.session = Streamlink()
def assertDictHas(self, a, b):
... | {
"content_hash": "f65d02ad75fa8ef696669207b7ece3ef",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 116,
"avg_line_length": 37.21739130434783,
"alnum_prop": 0.5697040498442367,
"repo_name": "mmetak/streamlink",
"id": "a2e3770584564c2bb19e03a56f0029b1285ab7d6",
"size": "5... |
"""Batch Fetch Claims Messages.
Synopsis
========
:samp:`fetch.py {description.csv}...`
Description
===========
Reads the CSV-format descriptions, either from stdin or files supplied as command-line
arguments. Each file contains rows which provide the claim identifiers. Other
attributes are silently ignored.
Thi... | {
"content_hash": "fba28a494843efd42a6ca45cb93fbefa",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 102,
"avg_line_length": 32.023529411764706,
"alnum_prop": 0.6429096252755327,
"repo_name": "jdavisp3/TigerShark",
"id": "74e4425ae52859a17b20a202727e702a1a7de60c",
"size": ... |
from utils import Utils
from controller import homeController, imgController, grafoController, feedController
# Frameworks
from flask import Flask, render_template, request, redirect, url_for, make_response, jsonify, Response
from functools import wraps
import facebook
# Bibliotecas padrão
#
app = Flask(__name__)
# U... | {
"content_hash": "eb8bce89ca313c0c87161a4a21c6e0da",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 173,
"avg_line_length": 29.781690140845072,
"alnum_prop": 0.7143532750059116,
"repo_name": "diogocs1/facebookexplorer",
"id": "cff6d276669aa8536af8fd2bee8826fa40e7f559",
"... |
import settings
import shutil
import os.path
import os
import sys
from tqdm import tqdm
import common.database as db
from sqlalchemy_continuum_vendored.utils import version_table
class Spinner(object):
def __init__(self):
# outStr = "-\\|/"
self.outStr = "|-"
self.outStar = "*x"
self.outMatch = r"\/"
se... | {
"content_hash": "2f4c825c5c1b00eaad83f858ba934d79",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 114,
"avg_line_length": 24.649425287356323,
"alnum_prop": 0.6374446257868968,
"repo_name": "fake-name/ReadableWebProxy",
"id": "c8108cc7d05e7f1f6c11bf3588848d69b8602cc6",
... |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def binaryTreePaths(self, root: TreeNode) -> List[str]:
result = []
path = []
def dfs(root):
if root is None:
return
pat... | {
"content_hash": "cff5c7d6a3bf4efcbcfe1d5ba4b6b1fe",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 59,
"avg_line_length": 26.26086956521739,
"alnum_prop": 0.4586092715231788,
"repo_name": "jiadaizhao/LeetCode",
"id": "a5a819a2965192f5249b2e39943176db8ff1d904",
"size": "6... |
import numpy as np
from scipy import sparse as sp
import tensorflow as tf
from .session_management import get_session
def create_tensorrec_iterator(name):
"""
Creates a TensorFlow Iterator that is ready for the standard TensorRec data format.
:param name: str
The name for this Iterator.
:return: ... | {
"content_hash": "565e7693eb1b18e60353c9f009c33071",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 113,
"avg_line_length": 37.47244094488189,
"alnum_prop": 0.6656860685017861,
"repo_name": "jfkirk/tensorrec",
"id": "405a648d06ff97c705768fd2939aecb13f9aa9a9",
"size": "47... |
"""Base class for sparse matrix formats using compressed storage
"""
__all__ = []
from warnings import warn
import numpy as np
from base import spmatrix, isspmatrix, SparseEfficiencyWarning
from data import _data_matrix
import sparsetools
from sputils import upcast, upcast_char, to_native, isdense, isshape, \
... | {
"content_hash": "69d9f94a8192aca5f42902953dcc25c7",
"timestamp": "",
"source": "github",
"line_count": 691,
"max_line_length": 108,
"avg_line_length": 35.26049204052099,
"alnum_prop": 0.5228401395444284,
"repo_name": "teoliphant/scipy",
"id": "fd891654962e614cecf00d8e122c52de3452dfb6",
"size": "24... |
"""Some generic utilities for dealing with classes, urls, and serialization."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import logging
import os
import re
import stat
import socket
import sys
import warnings
from signal import signal, SIGINT, SIGABRT, SIGTE... | {
"content_hash": "d76cecd3757e98557a0f7855a87370ce",
"timestamp": "",
"source": "github",
"line_count": 410,
"max_line_length": 90,
"avg_line_length": 30.75609756097561,
"alnum_prop": 0.5762093576526566,
"repo_name": "fzheng/codejam",
"id": "5dfb213ebfbb311c572232ad837024ed2c1ef5bd",
"size": "12610... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tempfile
import numpy as np
import tensorflow as tf
from tensorflow import flags
from tensorflow.examples.tutorials.mnist import input_data
from tensorflow.lite.experimental.examples.lstm.tflite_rnn imp... | {
"content_hash": "46eec977fdad84e4d2bb6ee8f432af3f",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 80,
"avg_line_length": 36.85549132947977,
"alnum_prop": 0.6863237139272271,
"repo_name": "jendap/tensorflow",
"id": "7a937ce47f7fb049f50307c049f33f8e0060b986",
"size": "70... |
import json
path = 'data/usagov_bitly_data2012-05-21-1337634399.txt'
records = [json.loads(line) for line in open(path)]
# <codecell>
# Display a couple of records
records[0:2]
# <codecell>
# Display the user agent from the first record
records[0]["a"]
# <codecell>
# Utility function: get counts for each element ... | {
"content_hash": "16ac33da4aaeffcdf2990f1cbc75cb56",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 71,
"avg_line_length": 19,
"alnum_prop": 0.7014354066985646,
"repo_name": "traims/nasa-mars-curiosity",
"id": "0373c7e15b7e88eaba70b5e1f9a90b244aebe584",
"size": "1111",
... |
from datetime import date
from time import strptime
from django.db import models
from ..magic import MisencodedCharField, MisencodedTextField
MARKET_SECTION_CHOICES = (
("nabizim", "Nabízím"),
("shanim", "Sháním"),
("vymenim", "Vyměním"),
("daruji", "Daruji"),
)
class Dating(models.Model):
name... | {
"content_hash": "0227cf0bd4e0eec0406eb53b29f03ef3",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 91,
"avg_line_length": 31.528301886792452,
"alnum_prop": 0.6205864751645721,
"repo_name": "dracidoupe/graveyard",
"id": "d82c46a0eb5abae3c6a6691c873a0844d3a504a7",
"size":... |
import pickle
import os
import numpy as np
from binary import *
from sklearn import svm
from sklearn.calibration import CalibratedClassifierCV
class BinaryComputerVisionPredictor(object):
def __init__(self, feature_extractor, num_splits=4, computer_vision_cache=None):
self.feature_extractor = feature_extractor
... | {
"content_hash": "f0b8a5a54f51700033ab6ffa77739261",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 267,
"avg_line_length": 52.845238095238095,
"alnum_prop": 0.6186077945483217,
"repo_name": "sbranson/online_crowdsourcing",
"id": "3b21d00da04dc38e8d876eb37473713d20bbf7b7",
... |
from lasagne.layers import Conv2DLayer, MaxPool2DLayer
from lasagne.layers import InputLayer, DenseLayer, batch_norm
from lasagne.layers import SpatialPyramidPoolingLayer
import lasagne
def build_architecture(input_shape, trained_weights=None):
net = {}
net['input'] = InputLayer((None,1,None,None))
net['... | {
"content_hash": "8dda1683e8d52877928105506373b5e4",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 131,
"avg_line_length": 51.43333333333333,
"alnum_prop": 0.7064160725858717,
"repo_name": "luizgh/sigver_wiwd",
"id": "66ad9ec1ba5cc4d036becb7e40f10fab3f2a6762",
"size": "1... |
"""
Reads a list of intervals and a maf. Produces a new maf containing the
blocks or parts of blocks in the original that overlapped the intervals.
It is assumed that each file `maf_fname` has a corresponding `maf_fname`.index
file.
NOTE: If two intervals overlap the same block it will be written twice. With
n... | {
"content_hash": "c765d13839c23ca4646bc89086fc0a67",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 181,
"avg_line_length": 41.5,
"alnum_prop": 0.5772375215146299,
"repo_name": "bxlab/HiFive_Paper",
"id": "fcfbe98ffb4ae54b545c710abec2247233a0e3bc",
"size": "4690",
"bin... |
import json
import re
import unittest
from collections import namedtuple
from unittest import mock
import sqlalchemy
from cryptography.fernet import Fernet
from parameterized import parameterized
from airflow import AirflowException
from airflow.hooks.base import BaseHook
from airflow.models import Connection, crypto... | {
"content_hash": "b6106e63a44d73ec34917ccdb7ce3369",
"timestamp": "",
"source": "github",
"line_count": 532,
"max_line_length": 110,
"avg_line_length": 39.721804511278194,
"alnum_prop": 0.5549403747870528,
"repo_name": "DinoCow/airflow",
"id": "2723c3fc0846b2cf749ecba413eb674d8141bafd",
"size": "21... |
from mnist import *
import deepstacks
from deepstacks.macros import *
from deepstacks.lasagne import curr_layer,curr_stacks,curr_flags,curr_model
def dropout(p):
return ((0,0,0,0,0,0,{'layer':(lasagne.layers.DropoutLayer,curr_layer,{'p':p})}),)
def build_cnn(input_var=None):
network = lasagne.layers.InputLay... | {
"content_hash": "409c85225bb5b32821aadf11008154d0",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 92,
"avg_line_length": 43.08163265306123,
"alnum_prop": 0.6049265750828992,
"repo_name": "guoxuesong/deepstacks",
"id": "6008e622455fdc6bf550ecb1f89e8ab40b3da1cf",
"size":... |
from __future__ import print_function
# the following is a hack to get the baseclient to import whether we're in a
# package or not. This makes pep8 unhappy hence the annotations.
try:
# baseclient and this client are in a package
from .baseclient import BaseClient as _BaseClient # @UnusedImport
except ImportE... | {
"content_hash": "571b00b0a1d2e9608b1c306598cb6fb3",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 90,
"avg_line_length": 49.93103448275862,
"alnum_prop": 0.6153314917127072,
"repo_name": "dcchivian/kb_gblocks",
"id": "af1686669a5d2c2cf27eed0ab7e755237d88f253",
"size": "... |
from setuptools import find_packages, setup
setup(
name='ci',
version='0.0.1',
url='https://github.com/hail-is/hail.git',
author='Hail Team',
author_email='[email protected]',
description='Hail CI/CD System',
packages=find_packages(),
include_package_data=True,
)
| {
"content_hash": "35955e81a9b99893c2bfc9ec8c13b8cc",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 46,
"avg_line_length": 25.25,
"alnum_prop": 0.6633663366336634,
"repo_name": "hail-is/hail",
"id": "721339c91bd155af5503ff4c2937a8857ca80e7c",
"size": "303",
"binary": fa... |
'''
Test metadata functions
'''
from nose.tools import assert_equals, with_setup
from tests.util import setup, teardown, session_scope, EMPTY_RASTER, FakeTask
from tasks.meta import (OBSColumnTable, OBSColumn, OBSTable, OBSColumnTableTile,
OBSTag, OBSColumnTag)
from tasks.targets import TagT... | {
"content_hash": "39d3c3dc3047d49f5c1941b755b2a15d",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 93,
"avg_line_length": 40.84699453551912,
"alnum_prop": 0.5961204013377926,
"repo_name": "CartoDB/bigmetadata",
"id": "ba366b55352a973dfa75816d344c6b5e4b9de4f0",
"size": "... |
"""Standard text cleaning for pandas, used by many other functions, for more granularity use the composite
functions separately"""
from usherwood_ds.nlp.processing.stopwords import stopword_removal
from usherwood_ds.nlp.preprocessing.cleaning import clean_text
from usherwood_ds.nlp.preprocessing.stemming import Stemme... | {
"content_hash": "62af4e0672e4f4ec77c0f3184e21b15f",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 114,
"avg_line_length": 51.89820359281437,
"alnum_prop": 0.4878273912541825,
"repo_name": "Usherwood/usherwood_ds",
"id": "295878c30e234f202818f0b0d7b23efac130308f",
"size... |
import unittest
from wikipedia_searcher.wikipedia_searcher import WikipediaSearcher
class TestWikipediaSearcher(unittest.TestCase):
def setUp(self):
self.searcher = WikipediaSearcher()
def test_full_text_english(self):
result = self.searcher.simple_entry_search('kusareru', action='full')
... | {
"content_hash": "3afa1e8c9ff8e7a2ce6d0da51764adb3",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 97,
"avg_line_length": 42.45,
"alnum_prop": 0.6450726344719278,
"repo_name": "yustoris/wikipedia_searcher",
"id": "82e23247c245c9f80951ba5a675c0b67d5fab4d9",
"size": "2636"... |
"""
Write a program to check whether a given number is an ugly number.
Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7.
Note that 1 is typically treated as an ugly number.
"""
class Solution(object):
... | {
"content_hash": "923bb8b4bdcbe2e503c7392ee1aaf96f",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 165,
"avg_line_length": 25.655172413793103,
"alnum_prop": 0.5255376344086021,
"repo_name": "yingcuhk/LeetCode",
"id": "80941aea8356e48d9380606fc82581eedcbcfdac",
"size": "7... |
"""Generates a sequence of operations in Reverse Polish Notation.
Runs the verilog through yosys and nexpnr to get the delay estimate.
"""
import argparse
import csv
import enum
import multiprocessing as mp
import os
import random
import re
import subprocess
import tempfile
import time
from typing import Tuple, Type
... | {
"content_hash": "8b7a6e05ef72e7d505d365e2b4e74274",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 77,
"avg_line_length": 26.941798941798943,
"alnum_prop": 0.5760015710919089,
"repo_name": "google/xls",
"id": "bd8eea84333db416cbb40d36bfd8bf08d4f31cf4",
"size": "5674",
... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('benchmarks', '0009_auto_20150724_1438'),
]
operations = [
migrations.RemoveField(
model_name='benchmark',
name='name',
... | {
"content_hash": "8a45e26e7c7807b9291c887e93094456",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 58,
"avg_line_length": 22.90909090909091,
"alnum_prop": 0.5773809523809523,
"repo_name": "jayfk/cloudbench.io",
"id": "b07cb303442a654cb54be2185c9e423ca3f1fa6e",
"size": "5... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('crowdsourcing', '0119_auto_20160714_0423'),
]
operations = [
migrations.RemoveField(
model_name='rating... | {
"content_hash": "a1838cf198a59f4018f9cd60a03c7080",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 117,
"avg_line_length": 25.391304347826086,
"alnum_prop": 0.6061643835616438,
"repo_name": "shirishgoyal/crowdsource-platform",
"id": "c51d165ae32a05100365ef83d1a5e384bd1d62a... |
import unittest, os, json
from subprocess import PIPE, Popen, STDOUT
from system_test import TestCase, Qdrouterd, main_module, DIR, TIMEOUT, Process
from qpid_dispatch.management.client import Node
from proton import SASL
class RouterTestPlainSaslCommon(TestCase):
@classmethod
def router(cls, name, connection... | {
"content_hash": "5e5162ecf906bb266d3fba2099cab64c",
"timestamp": "",
"source": "github",
"line_count": 552,
"max_line_length": 149,
"avg_line_length": 45.93297101449275,
"alnum_prop": 0.5357128771445474,
"repo_name": "lulf/qpid-dispatch",
"id": "05e591f18f6c4a411d6264c590b77d7ebefed0ae",
"size": "... |
import sys
def formatFloat(flt):
# Remove any trailing 0's. If that leaves just a period, remove it too. We
# can't strip both at once otherwise '0.000' becomes '' and we want '0'
return str(flt).rstrip('0').rstrip('.')
class Node(object):
def __init__(self):
self._id = 0
self._idSet = False
self._name = ""... | {
"content_hash": "9df4d89fcd20543de63d64bce8747092",
"timestamp": "",
"source": "github",
"line_count": 675,
"max_line_length": 100,
"avg_line_length": 27.554074074074073,
"alnum_prop": 0.6534759933329749,
"repo_name": "redpawfx/massiveImporter",
"id": "88ebef2acebd73212e13185c5210cd00c5f63c73",
"s... |
import numpy as np
from scipy import sparse as sp
__author__ = "Irshad Ahmad Bhat"
__version__ = "1.0"
__email__ = "[email protected]"
class OneHotEncoder():
"""Transforms categorical features to continuous numeric features"""
def __init__(self,sparse=True):
self.sparse = sparse
def... | {
"content_hash": "64ec0f57a05a16a51b5019b7b5075f51",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 93,
"avg_line_length": 34.054054054054056,
"alnum_prop": 0.5634920634920635,
"repo_name": "irshadbhat/python-irtrans",
"id": "d65e3638a797f9128f0c783e20b490cc0b1ee54a",
"si... |
import sys
import os.path
# Ensure that we can import the "steve" package.
THIS_DIR = os.path.realpath(os.path.dirname(__file__))
sys.path.insert(0, os.path.dirname(THIS_DIR))
import steve.vtypes.stv
# The stv module loads the stv_tool module. Tweak it.
stv_tool = steve.vtypes.stv.stv_tool
stv_tool.VERBOSE = True
d... | {
"content_hash": "2ec6810430921da95a5043db367c8a8c",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 64,
"avg_line_length": 26.738095238095237,
"alnum_prop": 0.6642920747996438,
"repo_name": "apache/steve",
"id": "c9b2b282e8ee2937b8e9609623883fa692012511",
"size": "2006",
... |
import json
import logging
import datetime
from octopus import constant
from octopus import err
log = logging.getLogger(constant.LOGGER_NAME)
_SERVICE_STR_FORMATTER = '{name}: {addr}'
class Service(object):
def __init__(self, service_name, name, service_info):
"""
:param service_name:
... | {
"content_hash": "ab0c10f64fe85ec955ee943bc01fb7c8",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 117,
"avg_line_length": 25.883116883116884,
"alnum_prop": 0.5584545910687406,
"repo_name": "ideascf/octopus",
"id": "1b32775615ddd0f2c768affa02ba8a5828d3b971",
"size": "209... |
import requests
URL_COIN = 'https://www.cryptocompare.com/api/data/coinlist/'
URL_EXCHANGES = 'https://min-api.cryptocompare.com/data/all/exchanges'
URL_PRICE = 'https://min-api.cryptocompare.com/data/'
URL_SNAPSHOT = 'https://www.cryptocompare.com/api/data/'
class CryptoCompareAPI:
def __init__(self):
p... | {
"content_hash": "e6c042ced597a8331b7c549d7e3e06e1",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 84,
"avg_line_length": 31.352941176470587,
"alnum_prop": 0.5884928080050031,
"repo_name": "meister245/CryptoLunch",
"id": "f8b07243c2f7bbeea122b63bf54ce486907c7160",
"size"... |
from django import forms
from django.forms import CharField
from mybitbank.libs.connections import connector
from mybitbank.apps.transfer.forms import CoinAddress, CoinProviderId
from mybitbank.libs import misc
class CoinAccountName(CharField):
def validate(self, value):
super(CharField, self).validate(va... | {
"content_hash": "b1ad5e61cbc58f1ecb20172f7a42718f",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 93,
"avg_line_length": 36,
"alnum_prop": 0.71875,
"repo_name": "ychaim/mybitbank",
"id": "ac4c69f53ba6c324cffcef497cbf354357a911a2",
"size": "1152",
"binary": false,
"c... |
"""This module is deprecated. Please use :mod:`airflow.providers.google.suite.transfers.gcs_to_gdrive`."""
import warnings
# pylint: disable=unused-import
from airflow.providers.google.suite.transfers.gcs_to_gdrive import GCSToGoogleDriveOperator # noqa
warnings.warn(
"This module is deprecated. Please use `air... | {
"content_hash": "2a0aba76cfe5ac050feb4df762f7f188",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 106,
"avg_line_length": 34.916666666666664,
"alnum_prop": 0.7732696897374701,
"repo_name": "sekikn/incubator-airflow",
"id": "72627ce4b57e6d57687f7002d2a5f4cdee3be572",
"si... |
import sys
from types import GeneratorType
from libcloud.test import MockHttp, unittest
from libcloud.utils.py3 import ET, httplib
from libcloud.utils.xml import findall, findtext, fixxpath
from libcloud.common.types import InvalidCredsError
from libcloud.compute.base import Node, NodeLocation, NodeAuthPassword
from l... | {
"content_hash": "af6527facc7a4e9a45c9c61ce55acfeb",
"timestamp": "",
"source": "github",
"line_count": 3524,
"max_line_length": 125,
"avg_line_length": 43.4199772985244,
"alnum_prop": 0.6300486236373618,
"repo_name": "apache/libcloud",
"id": "c0befbeb1603b0176405eb16296a56c29e3c0160",
"size": "153... |
import sys
import os
import codecs
incode="utf-8"
outcode="utf-8"
outfile=None
if len(sys.argv) > 3:
outfile=sys.argv[3]
if len(sys.argv) > 2:
incode=sys.argv[2]
if len(sys.argv) > 4:
outcode=sys.argv[4]
if len(sys.argv) < 2:
raise Exception("usage: convertToUtf8.py infile [incode] [outfile] [outcode]")
f = co... | {
"content_hash": "8994231cddb020128343bdace758755c",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 80,
"avg_line_length": 19.51851851851852,
"alnum_prop": 0.6907020872865275,
"repo_name": "wellenvogel/avnav",
"id": "cb583335406a62fe780620d8c4137743ae554053",
"size": "551... |
import threading
import os
from enum import Enum
from PyQt5.Qt import QApplication, QSettings
from .fslogger import FSLogger
class FSExtensionType(Enum):
TYPE_EXT = 0
TYPE_FILE = 1
TYPE_MOVIE = 2
TYPE_MUSIC = 3
TYPE_IMAGE = 4
class FSApp(object):
_INST_LOCK = threading.Lock()
_INSTANCE ... | {
"content_hash": "7c19489a15208e46bb672d367c3f6f04",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 73,
"avg_line_length": 31.80327868852459,
"alnum_prop": 0.6118556701030928,
"repo_name": "gnyiri/filesystem-analyzer",
"id": "2b91eb0ae5d5119359a1b8cbcdacddfcc9aa0b64",
"si... |
from __future__ import absolute_import, division, print_function, unicode_literals
from collections import OrderedDict
from grako.util import simplify_list, eval_escapes, warning
from grako.util import re, RE_FLAGS
from grako import grammars
from grako.exceptions import FailedSemantics
from grako.model import ModelBu... | {
"content_hash": "ab6756e1d49ba4fc9e0a8b4e927ec475",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 105,
"avg_line_length": 29.386363636363637,
"alnum_prop": 0.6004124774426398,
"repo_name": "vmuriart/grako",
"id": "2fec3a280cbd0b9d0615276e92971bec27809be4",
"size": "387... |
from models import *
from django.contrib import admin
admin.site.register(Package)
| {
"content_hash": "601df521ad9cc1adbb3bccab60ebf7e7",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 32,
"avg_line_length": 21,
"alnum_prop": 0.8095238095238095,
"repo_name": "proffalken/edison",
"id": "e238ffa7789150f10faac4e571440d91505cd14e",
"size": "314",
"binary": f... |
num = int(input("Give me a number: "))
listNum = range(1, num + 1)
divisorNum = []
for number in listNum:
if num % number == 0:
divisorNum.append(number)
print(divisorNum) | {
"content_hash": "0994f7cd05d3e41c34fce49c13ba549f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 38,
"avg_line_length": 20.555555555555557,
"alnum_prop": 0.6378378378378379,
"repo_name": "marcmaceira/Python-Exercises",
"id": "c1e57266ca9c3170b1f12307856e7d7a546f3389",
"... |
import unittest
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from git import GitTestCase
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(GitTestCase))
os.popen(os.path.join(os.path.dirname(__file__), "createrepo.sh"))
os.chdir(os.path.join(os.path.dirname(__file__... | {
"content_hash": "14bc9d6f31bf37afb455eae30e9771d8",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 67,
"avg_line_length": 31.214285714285715,
"alnum_prop": 0.7276887871853547,
"repo_name": "georgebrock/git-browse",
"id": "2f657d46a41c600d5f7201d098ef4b0ceeafa7b4",
"size"... |
from django.conf.urls import url
from djview import views
urlpatterns = [
url(r'^$', views.djview_index, name='djview_index'),
url(r'^about/', views.djview_about, name='djview_about'),
url(r'^add_category/', views.add_category, name='add_category'),
url(r'^category/(?P<category_name_slug>[\w\-]+)/$', v... | {
"content_hash": "88b352c30f685bc6d1d86923416f5912",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 71,
"avg_line_length": 42.705882352941174,
"alnum_prop": 0.6198347107438017,
"repo_name": "rklabs/djaaks",
"id": "f74c9c9983e5d07467273f00e60a4689ab4f99c6",
"size": "726",
... |
import six
import io
import unittest
import tempfile
import os
import sys
import fileinput
from six import StringIO
import tse.main
class _TestBase(unittest.TestCase):
def _getParser(self):
return tse.main.getargparser()
def setUp(self):
self.testfile = None
self.testfilename = None
... | {
"content_hash": "7605d4c40be005c3e94eae9371a2fd0d",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 102,
"avg_line_length": 32.888888888888886,
"alnum_prop": 0.5010484622553588,
"repo_name": "atsuoishimoto/tse",
"id": "5e4422ac1214825b4dff5d35eb19fadb4200311a",
"size": "... |
from ..Helpers.types import Types
from ..Helpers.base import dbstore, dbload
from ..Helpers.loop import Loop
from ..Helpers.commands import Dup, Store, Push, Mul, DMalloc, Load, Compare, DBStore, Add, DBLoad, Jnz, Label, Jump, Jz, Sub
class StringCompiler:
@staticmethod
def store(commands, data):
""" ... | {
"content_hash": "212c1ae5de2a9a1ca8dd990bb60ba557",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 125,
"avg_line_length": 40.421487603305785,
"alnum_prop": 0.6476180740134941,
"repo_name": "PetukhovVictor/compiler",
"id": "650dee845c8675974a97cb9055511b1c720a0a43",
"si... |
import urllib2
import xml.etree.ElementTree
from optparse import OptionParser
from subprocess import Popen, PIPE
from sys import stdout, exit
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-H", "--host", action="store", type="string", dest="host", default="xp1app", help="The address of th... | {
"content_hash": "e66ff0db7040a66a3c69f39c47f30f5d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 202,
"avg_line_length": 42.22222222222222,
"alnum_prop": 0.7243421052631579,
"repo_name": "herself/Hscripts",
"id": "eadcb67cbd6190297f49d26d18c928f402069573",
"size": "172... |
def verbing(s):
if len(s) < 3:
r = s
else:
if s[-3:] == 'ing':
r = s + 'ly'
else:
r = s + 'ing'
return r
# E. not_bad
# Given a string, find the first appearance of the
# substring 'not' and 'bad'. If the 'bad' follows
# the 'not', replace the whole 'not'...'bad' substring
# with 'good'.
... | {
"content_hash": "ce8b5b3945dbb76c106c3595101489cc",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 77,
"avg_line_length": 28.158536585365855,
"alnum_prop": 0.5941966219142486,
"repo_name": "agcalero/pyquick",
"id": "dba3d1f01cdaaedf7f215eada7c4cc66c5c659f0",
"size": "282... |
from django.urls import re_path
from openstack_dashboard.dashboards.project.containers import views
urlpatterns = [
re_path(r'^container/((?P<container_name>.+?)/)?'
'(?P<subfolder_path>.+)?$',
views.NgIndexView.as_view(), name='index'),
re_path(r'^$',
views.NgIndexView.as_... | {
"content_hash": "a70830a29000fa249703e4da505180bf",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 67,
"avg_line_length": 31.272727272727273,
"alnum_prop": 0.6104651162790697,
"repo_name": "openstack/horizon",
"id": "260f7e3b229249b92a58fe25149409e57fea334f",
"size": "11... |
"""rptk module.format.yamlf module."""
from __future__ import print_function
from __future__ import unicode_literals
import logging
from rptk.format import BaseFormat
import yaml
try:
from yaml import CDumper as Dumper
except ImportError as e: # pragma: no cover
logging.getLogger(__name__).warning("%s: fa... | {
"content_hash": "fa9ebc352d800c96ae98a50dea8ec934",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 79,
"avg_line_length": 30.92105263157895,
"alnum_prop": 0.6331914893617021,
"repo_name": "wolcomm/rptk",
"id": "d01200b5e37f3f3aa27dc7353eab5c3b6b4c398b",
"size": "1738",
... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0007_auto_20160920_0147'),
]
operations = [
migrations.RemoveField(
model_name='profile',
name='second_candidate',
... | {
"content_hash": "1a0736fe38ab674b7dddcc6a23a757ed",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 120,
"avg_line_length": 26.09090909090909,
"alnum_prop": 0.5818815331010453,
"repo_name": "sbuss/voteswap",
"id": "f93f79864ffdc4be64b90d9fdf287d481b2b4e97",
"size": "646",... |
from django.core.management.base import BaseCommand
from django.core.management.color import no_style
from optparse import make_option
import sys
import os
try:
set
except NameError:
from sets import Set as set # Python 2.3 fallback
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
... | {
"content_hash": "a000b6a071efbbd1fab0e8dd12a0b69a",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 113,
"avg_line_length": 43.91463414634146,
"alnum_prop": 0.4850041655095807,
"repo_name": "paulsmith/geodjango",
"id": "688cd58e2c21d2dbfbad2a14f713f7d5b91102bc",
"size": ... |
import commands
from os import remove
from shutil import move
# This program must be called from the folder that contains the files to be
# updated. THE FOLDER SHOULD ONLY CONTAIN DHDL FILES TO BE UPDATED!
# Get all filenames for files to be updated
filenames = commands.getoutput('ls' %vars()).split()
n_files = len(... | {
"content_hash": "4a5114f8523b42d6626b19ca4fa1aaab",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 85,
"avg_line_length": 32.16279069767442,
"alnum_prop": 0.7006507592190889,
"repo_name": "MobleyLab/alchemical-analysis",
"id": "987d7e4b13ed06dce156ad2bf6383e717d58fa30",
... |
import json
import logging
import re
import time
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from desktop.lib.i18n import smart_str
from desktop.lib.view_util import format_duration_in_millis
from jobbrowser.views import job_single_logs
from jobbrowser.models import... | {
"content_hash": "6b0643ea667814fa320f0960b9f7cf5d",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 183,
"avg_line_length": 36.639405204460964,
"alnum_prop": 0.6336241883116883,
"repo_name": "MobinRanjbar/hue",
"id": "6440d30a51bad64ede0cca16081a27e48324dd04",
"size": "1... |
"""
Django settings for sample project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | {
"content_hash": "5bf63317cdf99696a62579f848cfb109",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 71,
"avg_line_length": 23.662921348314608,
"alnum_prop": 0.7160493827160493,
"repo_name": "ntk1000/S.W.A.P.D.",
"id": "6872f95174086544be6cf3322d8dd3de58e409c3",
"size": "2... |
"""Legacy serialization logic for Keras models."""
import threading
import warnings
import weakref
import tensorflow.compat.v2 as tf
from keras.utils import tf_contextlib
from keras.utils import tf_inspect
# isort: off
from tensorflow.python.util.tf_export import keras_export
# Flag that determines whether to skip... | {
"content_hash": "86791ee857eb3c081b4bfdec3c8f1472",
"timestamp": "",
"source": "github",
"line_count": 576,
"max_line_length": 80,
"avg_line_length": 38.57465277777778,
"alnum_prop": 0.6451235429137225,
"repo_name": "keras-team/keras",
"id": "1ebb2e4bc24ee5f42a2d8e821c235d7a795399fe",
"size": "229... |
from __future__ import unicode_literals
import pytest
from ejdb import c
def test_bsonoid():
oid = c.BSONOID.from_string('0123456789abcdef01234567')
assert str(oid) == '0123456789abcdef01234567'
def test_bsonoid_too_short():
with pytest.raises(ValueError) as ctx:
c.BSONOID.from_string('1234567... | {
"content_hash": "dc14e40d3c4efa511e5b3b640c604369",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 76,
"avg_line_length": 29.785714285714285,
"alnum_prop": 0.7122302158273381,
"repo_name": "uranusjr/ctypes-ejdb",
"id": "32d195ca14cbae45dd5a8612ea13ee8c407aeca7",
"size": ... |
"""daily schedule updates
Revision ID: 2df9ce70bad
Revises: 376804c871b4
Create Date: 2018-03-14 12:30:40.844228
"""
# revision identifiers, used by Alembic.
revision = '2df9ce70bad'
down_revision = '376804c871b4'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade... | {
"content_hash": "b9244cb3fd2b4c99dcdd24a44322fbc5",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 136,
"avg_line_length": 47.220338983050844,
"alnum_prop": 0.6848528356066045,
"repo_name": "Code4SA/pmg-cms-2",
"id": "3438d314636e317dec6a074b2cc031659c889847",
"size": "2... |
"""This is the slimmed ResNet as used by Lopez et al. in the GEM paper."""
import torch.nn as nn
from torch.nn.functional import relu, avg_pool2d
from avalanche.models import MultiHeadClassifier, MultiTaskModule, DynamicModule
class MLP(nn.Module):
def __init__(self, sizes):
super(MLP, self).__init__()
... | {
"content_hash": "98cb489929bd8b44429a964032ee5ef8",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 80,
"avg_line_length": 33.64748201438849,
"alnum_prop": 0.5582638443446654,
"repo_name": "ContinualAI/avalanche",
"id": "29727c31b99f1b1e5d38df632dc7d6334d6b8eea",
"size":... |
from .response import text
from traceback import format_exc
#########################################
# 项目自定义异常类
#
# 说明:
# - 框架异常的基类
#
#
#########################################
class SanicException(Exception):
def __init__(self, message, status_code=None):
super().__init__(message)
... | {
"content_hash": "7f2347ac3caf3a2b1ded124b81822c19",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 79,
"avg_line_length": 23.448979591836736,
"alnum_prop": 0.5483028720626631,
"repo_name": "hhstore/flask-annotated",
"id": "7a4847fcac19b9191bd4f49a9817d7592abfe47a",
"size... |
from .base import BasePlaylist
from kivy.logger import Logger
from utils import get_unicode
from copy import deepcopy
class FileLoaderPlaylist(BasePlaylist):
'''Playlist that can add all files from a path and it's sub-paths,
files can also later be removed.
Useful when a playlist has to have specific file... | {
"content_hash": "af25ece442e21dfb71b9f62ebd6a4a90",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 79,
"avg_line_length": 31.636363636363637,
"alnum_prop": 0.5784072249589491,
"repo_name": "Bakterija/mmplayer",
"id": "f8d81e1c2b0d0ea9e642f3359d19c1c62326902f",
"size": "2... |
from django.contrib.auth.models import User
from django import forms
from apps.books.models import *
class UserProfileBookForm(forms.ModelForm):
"""docstring for LoginForm"""
class Meta:
model = UserProfileBook
fields = ['user_profile', 'book', 'status'] | {
"content_hash": "0f6cf1c7e5efd078fa9b964625f19fa4",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 51,
"avg_line_length": 28,
"alnum_prop": 0.7071428571428572,
"repo_name": "vuonghv/brs",
"id": "f2ea79850d3b5d369d304b0da6ce61da9cace77b",
"size": "280",
"binary": false,... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dojo', '0116_test_type_active'),
]
operations = [
migrations.AddField(
model_name='usercontactinfo',
name='force_password_reset',
field=models.BooleanFie... | {
"content_hash": "91e9369f63a703ac73e3337135ced3e6",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 122,
"avg_line_length": 26.5625,
"alnum_prop": 0.6188235294117647,
"repo_name": "rackerlabs/django-DefectDojo",
"id": "82d4c3ed341e2a8fec17da722654fd235f0c20d2",
"size": "4... |
import sys
import argparse
import os
import getpass
import time
import pprint
sys.path.append("./library")
from na_funcs import *
from cisco_funcs import *
debug = False
# parse command line arguments and optional environment variables
arguments = argparse.ArgumentParser(
description='Provide an igroup and filer ... | {
"content_hash": "d8d7a342d0d7a9a99b4949b8f78a33a4",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 171,
"avg_line_length": 32.83471074380165,
"alnum_prop": 0.7125597785049081,
"repo_name": "scottharney/python-mdszoning",
"id": "428307fea6dbd90ce01807482c653cb8e1ac63b8",
... |
from celery import Task
# django-haystack indexing automatically
from haystack.management.commands import update_index
class UpdateIndexTask(Task):
def run(self):
update_index.Command().handle()
| {
"content_hash": "2cbb32e8e98ffde3cbf3ead9431f2f55",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 53,
"avg_line_length": 21.1,
"alnum_prop": 0.7582938388625592,
"repo_name": "deadlylaid/book_connect",
"id": "5c3dab532748eadd4926a0acf169b018143eb20f",
"size": "211",
"b... |
'''
test for changing vm password
@author: SyZhao
'''
import apibinding.inventory as inventory
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.vm_operations as vm_ops
import zstackl... | {
"content_hash": "3c769b6f999ff0099f0058df9193be5b",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 208,
"avg_line_length": 31.138613861386137,
"alnum_prop": 0.6120826709062003,
"repo_name": "zstackorg/zstack-woodpecker",
"id": "7422b964301bc8034cabc3ea9a4bfcde79ef961e",
... |
import json #required to read and parse json files
import os #required for file path function
import psycopg2 #required for postgres
import sys #also required for postgres?
##########################################################################
## Module Variables/Constants
########################################... | {
"content_hash": "f62c5376c519f309e48d788880978335",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 220,
"avg_line_length": 46.166666666666664,
"alnum_prop": 0.5886482150020056,
"repo_name": "georgetown-analytics/triptomizer",
"id": "20fe8612c5b16bb526b0d763c1174f10b31f938... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.