text stringlengths 4 1.02M | meta dict |
|---|---|
import logging
import unittest
from nose.plugins.attrib import attr
from tests.cook import cli, util
@attr(cli=True)
@unittest.skipUnless(util.multi_cluster_tests_enabled(),
'Requires setting the COOK_MULTI_CLUSTER environment variable')
class MultiCookCliTest(unittest.TestCase):
_multiproc... | {
"content_hash": "ad3e5ef246e63db99ff9cbe002ae979c",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 98,
"avg_line_length": 40.630434782608695,
"alnum_prop": 0.599250936329588,
"repo_name": "m4ce/Cook",
"id": "d389c95c8036836394a5b243b68a0f4e7eb561af",
"size": "1869",
"b... |
from __future__ import absolute_import
from sentry.api.bases.avatar import AvatarMixin
from sentry.api.bases.organization import OrganizationEndpoint
from sentry.models import OrganizationAvatar
class OrganizationAvatarEndpoint(AvatarMixin, OrganizationEndpoint):
object_type = "organization"
model = Organiza... | {
"content_hash": "ee2097682b4dd47f5240d9b04bccde58",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 68,
"avg_line_length": 33.92857142857143,
"alnum_prop": 0.7768421052631579,
"repo_name": "mvaled/sentry",
"id": "2114eb459d196bdd07fc1d4438babc58668fb9c6",
"size": "475",
... |
from __future__ import unicode_literals
import os.path
import sys
import tempfile
import types
import unittest
from contextlib import contextmanager
from django.template import Context, TemplateDoesNotExist
from django.template.engine import Engine
from django.test import SimpleTestCase, ignore_warnings, override_set... | {
"content_hash": "179063ea53a9448a197053d73c8c3924",
"timestamp": "",
"source": "github",
"line_count": 387,
"max_line_length": 98,
"avg_line_length": 37.917312661498705,
"alnum_prop": 0.6332969878697016,
"repo_name": "rynomster/django",
"id": "11f20c6debffd098311ecefe18885fff1ef04d3f",
"size": "14... |
import os
def _get_cache_dir_path():
return os.path.join(os.path.expanduser('~/.local/share'), 'atcoder-tools')
def get_cache_file_path(filename: str):
return os.path.join(_get_cache_dir_path(), filename)
| {
"content_hash": "31529f4de921e0bb536da085185d76b6",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 78,
"avg_line_length": 24.11111111111111,
"alnum_prop": 0.6866359447004609,
"repo_name": "kyuridenamida/atcoder-tools",
"id": "5222f6e99f08b87739e3450139424954dbca207f",
"si... |
import json
from pants.backend.experimental.java.register import rules as java_rules
from pants.backend.java.dependency_inference.types import JavaSourceDependencyAnalysis
from pants.backend.java.target_types import JavaFieldSet
from pants.core.util_rules.source_files import SourceFilesRequest
from pants.engine.consol... | {
"content_hash": "6412ccb1a4a884218e755d75c4c50617",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 98,
"avg_line_length": 37.02127659574468,
"alnum_prop": 0.7477011494252873,
"repo_name": "pantsbuild/pants",
"id": "f1f5493588472a5c693f94deebd26a4c8616a404",
"size": "1874... |
"""
Given an integer, write a function to determine if it is a power of two.
"""
__author__ = 'Daniel'
class Solution:
def isPowerOfTwo(self, n):
"""
Bit manipulation
:type n: int
:rtype: bool
"""
if n <= 0:
return False
return n & (n-1) == 0 | {
"content_hash": "2a513e52197c448f54daab721ad6f29c",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 72,
"avg_line_length": 18.647058823529413,
"alnum_prop": 0.49842271293375395,
"repo_name": "ee08b397/LeetCode-4",
"id": "88c22349a06b5b0740f437d1595aca73001d23e0",
"size": ... |
from typing import Tuple, Callable, Optional, cast
from ..model import Model
from ..config import registry
from ..types import Floats1d, Floats2d
from ..initializers import glorot_uniform_init, zero_init
from ..util import get_width, partial
InT = Floats2d
OutT = Floats2d
@registry.layers("Linear.v1")
def Linear(
... | {
"content_hash": "650cce39013e749b8a6c8f6e201ab5bf",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 87,
"avg_line_length": 27.775862068965516,
"alnum_prop": 0.6039726877715704,
"repo_name": "explosion/thinc",
"id": "c6dc1b350b15f457f534aa21129604b58d8b5dbf",
"size": "1611... |
import requests
import ConfigParser
from getpass import getpass
class Setup:
URLS = {
"1": "https://www.fireservicerota.co.uk",
"2": "https://www.brandweerrooster.nl"
}
CONFIG_FILE = '.local_settings.ini'
domain = None
api_key = None
def __init__(self):
pass
def get_settings(self):
se... | {
"content_hash": "67edf8ddf3592ccc10ce4651433df890",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 93,
"avg_line_length": 24.83157894736842,
"alnum_prop": 0.6299279355659178,
"repo_name": "rhomeister/firepi",
"id": "5b229462fa8c147896abfdf6592cf246b8ca0220",
"size": "237... |
import unittest
import os
import imath
import IECore
import Gaffer
import GafferTest
class MetadataAlgoTest( GafferTest.TestCase ) :
def testReadOnly( self ) :
n = GafferTest.AddNode()
self.assertEqual( Gaffer.MetadataAlgo.getReadOnly( n ), False )
self.assertEqual( Gaffer.MetadataAlgo.getReadOnly( n["op1... | {
"content_hash": "881957d2d5c33bfdc68af52af36b4ea1",
"timestamp": "",
"source": "github",
"line_count": 756,
"max_line_length": 143,
"avg_line_length": 41.72486772486773,
"alnum_prop": 0.704349480091301,
"repo_name": "GafferHQ/gaffer",
"id": "ead9a77675e5c70bb5db07b9a3f60a839bcce5f5",
"size": "3334... |
import pytest
from mitmproxy.utils import data
def test_pkg_data():
assert data.pkg_data.path("tools/console")
with pytest.raises(ValueError):
data.pkg_data.path("nonexistent")
| {
"content_hash": "6cf258f78e1368c7e6950831c46b0650",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 46,
"avg_line_length": 24.375,
"alnum_prop": 0.7128205128205128,
"repo_name": "StevenVanAcker/mitmproxy",
"id": "f40fc86657127ed60f5084884502a6bd52c17eca",
"size": "195",
... |
import os
import sys
import uuid
from scrapy.command import ScrapyCommand
from scrapy.utils.conf import arglist_to_dict
from scrapy.exceptions import UsageError
from collections import defaultdict
import json
from scrapy_sci.status import Status, Reader
from scrapy_sci.classifier import ClassifierFactory
class Command... | {
"content_hash": "e0e04152f923616491fa2ff03499efcd",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 122,
"avg_line_length": 46.80530973451327,
"alnum_prop": 0.5354509359047079,
"repo_name": "dangra/scrapy-sci",
"id": "ce71d5152d88cef2c54194589d8f0f01bb381c72",
"size": "5... |
"""Internal implementation for declarative."""
from ...schema import Table, Column
from ...orm import mapper, class_mapper, synonym
from ...orm.interfaces import MapperProperty
from ...orm.properties import ColumnProperty, CompositeProperty
from ...orm.attributes import QueryableAttribute
from ...orm.base import _is_m... | {
"content_hash": "f375da1d4ef5765bb2bc41c1287f6051",
"timestamp": "",
"source": "github",
"line_count": 651,
"max_line_length": 79,
"avg_line_length": 38.384024577572966,
"alnum_prop": 0.5178885865215304,
"repo_name": "jburger424/MediaQueueHCI",
"id": "59ebe3722a570b96504c6d55b580615164520389",
"si... |
"""SQL connections, SQL execution and high-level DB-API interface.
The engine package defines the basic components used to interface
DB-API modules with higher-level statement construction,
connection-management, execution and result contexts. The primary
"entry point" class into this package is the Engine and it's p... | {
"content_hash": "9b896b61a41721345281c45ff0e8df93",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 103,
"avg_line_length": 42.83879781420765,
"alnum_prop": 0.6869698322597104,
"repo_name": "jessekl/flixr",
"id": "99251f63039bd6328313f2ff943cd0a20d0c4503",
"size": "15916... |
import logging
from django.utils.encoding import smart_text
logger = logging.getLogger('rbac_migrations')
def migrate_team(apps, schema_editor):
'''If an orphan team exists that is still active, delete it.'''
Team = apps.get_model('main', 'Team')
for team in Team.objects.iterator():
if team.organi... | {
"content_hash": "f1d549e11ecb63a4cd52f2ba21be5fb9",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 84,
"avg_line_length": 37.25,
"alnum_prop": 0.6756152125279642,
"repo_name": "snahelou/awx",
"id": "7c0db853096bbca1f3d22a8315e1150a465e3ebb",
"size": "456",
"binary": fa... |
"""Save and restore variables."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import os.path
import re
import time
from google.protobuf import text_format
from tensorflow.core.protobuf import saver_pb2
from tensorflow.python.eager im... | {
"content_hash": "a1d75fda56d04c98d926616c36739650",
"timestamp": "",
"source": "github",
"line_count": 688,
"max_line_length": 80,
"avg_line_length": 41.93313953488372,
"alnum_prop": 0.6894974003466204,
"repo_name": "kevin-coder/tensorflow-fork",
"id": "131ecf71ba56c4c683bf1748c4681dc28507d829",
"... |
r"""
=====================================================================
The Johnson-Lindenstrauss bound for embedding with random projections
=====================================================================
The `Johnson-Lindenstrauss lemma`_ states that any high dimensional
dataset can be randomly projected i... | {
"content_hash": "c88e85db167b74ee80d35c7e0d9f687b",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 88,
"avg_line_length": 36.15348837209302,
"alnum_prop": 0.7016595908915476,
"repo_name": "sergeyf/scikit-learn",
"id": "c92920ffb7280ef3d78f41f98ad0cba73ffab990",
"size": ... |
from django.contrib import admin
from .models import Coach, Participant, Sport, Team, Discipline, Performance
from import_export import resources
from import_export.admin import ImportExportModelAdmin
class ParticipantResource(resources.ModelResource):
"""
Class used for the export of a list of registered pa... | {
"content_hash": "c61e303d4c1f7c68460228ba12831d18",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 101,
"avg_line_length": 30.26086956521739,
"alnum_prop": 0.6719348659003831,
"repo_name": "wearespindle/subscriptionform",
"id": "a3c56da466a851272b732f70e5c7c04f362a22af",
... |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
class DirtyInstance(models.Model):
"""
Holds a reference to a model instance that may contain inconsistent data
that needs to be recalculated.
DirtyI... | {
"content_hash": "7c82c0c93480192188b64429746a4396",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 77,
"avg_line_length": 35.5,
"alnum_prop": 0.715962441314554,
"repo_name": "initcrash/django-denorm",
"id": "a2f50dd8c41e7d712f4f2e83cee21b90cf0767ce",
"size": "876",
"bi... |
from distutils.core import setup
setup(
name='SQLiteMaker',
author='calebhailey',
url='https://github.com/calebhailey/sqlitemaker',
packages=['main'],
py_modules=['sqlitemaker'],
data_files=[('', ['settings.json',]),],
requires=['SQLAlchemy'],
)
| {
"content_hash": "fc020d5ade49884d0620c4048d0cea90",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 55,
"avg_line_length": 26.818181818181817,
"alnum_prop": 0.5932203389830508,
"repo_name": "calebhailey/sqlitemaker",
"id": "adb67d4816dd209f48fbf2c66f304a0d648db58a",
"size... |
__all__ = ["bls_fast", "bls_slow"]
from functools import partial
import numpy as np
from ._impl import bls_impl
def bls_slow(t, y, ivar, period, duration, oversample, use_likelihood):
"""Compute the periodogram using a brute force reference method
t : array-like
Sequence of observation times.
... | {
"content_hash": "8a02a9aaf773164a07c0bbc735ee9728",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 80,
"avg_line_length": 35.45945945945946,
"alnum_prop": 0.5889862804878049,
"repo_name": "pllim/astropy",
"id": "9686999e735be406b58390b159451c896d250bd0",
"size": "5313",... |
'''
Created on 28 janv. 2014
@author: Alexandre Bonhomme
'''
from core.agents.AgentMovable import AgentMovable
class PacmanAgent(AgentMovable):
def __init__(self, x, y, sma):
AgentMovable.__init__(self, x, y, sma)
def action(self):
self.randomMoveInNeighborhood()
self.sma._computeDij... | {
"content_hash": "1bd2a135ad3bf94c47deedec3936f42f",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 53,
"avg_line_length": 23.066666666666666,
"alnum_prop": 0.6705202312138728,
"repo_name": "blckshrk/DummySMA",
"id": "80ab76811242eb5fb7f1f6011827ecaa7693fd17",
"size": "34... |
from flask_wtf import FlaskForm
from wtforms import StringField, BooleanField, PasswordField, TextAreaField
from wtforms.validators import DataRequired, EqualTo, Length
class LoginForm(FlaskForm):
username = StringField('Username', validators=[DataRequired()])
password = PasswordField('Password', validators=[D... | {
"content_hash": "97423f13ee45afa49f92e71bfd1583bf",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 113,
"avg_line_length": 46.27777777777778,
"alnum_prop": 0.7430972388955582,
"repo_name": "thebigbadlonewolf/friendconnect",
"id": "070ed6033be5a2ff7b357cab84ee0bb91f1a0dd9",... |
from __future__ import annotations
import subprocess
from typing import TYPE_CHECKING, Any
from airflow.exceptions import AirflowException, AirflowNotFoundException
from airflow.hooks.base import BaseHook
if TYPE_CHECKING:
from airflow.models.connection import Connection
class SparkSqlHook(BaseHook):
"""
... | {
"content_hash": "5888fd69349a58da3799c568a36af1e6",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 110,
"avg_line_length": 36.00574712643678,
"alnum_prop": 0.5771747805267359,
"repo_name": "nathanielvarona/airflow",
"id": "d6f8f56c277321f776ebc36715c9636632fc3e0d",
"siz... |
from pprint import pprint
from diffengine.difference import hierarchical_matcher
from diffengine.tokenization import wikitext_split
tokens1 = wikitext_split.tokenize("Foo bar derp.")
print(tokens1)
for i, op in enumerate(hierarchical_matcher.diff([], tokens1)):
print("#{0}: {1}".format(i+1, repr(op)))
print("---... | {
"content_hash": "856943e9041363f65c6666cb9ce9844a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 74,
"avg_line_length": 32.416666666666664,
"alnum_prop": 0.6696658097686375,
"repo_name": "halfak/Difference-Engine",
"id": "77491ef51101e6b62653946807c3e44388f15a25",
"siz... |
from __future__ import absolute_import
__doc__ = """
Binary Tree Package
===================
Python Trees
------------
Balanced and unbalanced binary trees written in pure Python with a dict-like API.
Classes
~~~~~~~
* BinaryTree -- unbalanced binary tree
* AVLTree -- balanced AVL-Tree
* RBTree -- ... | {
"content_hash": "2fe348d5a2fd88e1be9c39711baf3adf",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 127,
"avg_line_length": 36.68518518518518,
"alnum_prop": 0.6168601716304897,
"repo_name": "emptyewer/DEEPN",
"id": "07a68c04bfff264d1d4580c4a584cfa09cc60424",
"size": "612... |
"""
Tests remarks elements parsing
"""
# pylint: disable=protected-access
# library
import unittest
# module
from avwx import static, structs
from avwx.parsing import core, remarks
class TestRemarks(unittest.TestCase):
"""
Tests remarks elements parsing
"""
def test_tdec(self):
"""
... | {
"content_hash": "44fc4e142e2570ae10cccb3d16032b2b",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 96,
"avg_line_length": 35.943548387096776,
"alnum_prop": 0.5054969710567646,
"repo_name": "flyinactor91/AVWX-Engine",
"id": "bbfcd53c85ffa826ee49157c2e34e83a8e5fb925",
"si... |
from application import application as app
import settings
import request
import database
if __name__ == "__main__":
database.init_db()
app.run()
| {
"content_hash": "9854b3d52837a5b1e787c549f99816fa",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 42,
"avg_line_length": 19.375,
"alnum_prop": 0.6967741935483871,
"repo_name": "peixinchen/TravisCITest",
"id": "5d5da0500230fe95d6b72b6e5ac9fa9caf8330c6",
"size": "155",
"... |
import hashlib
import importlib
import os
import requests
GRAMMAR_FILE_NAME = "__init__.py"
GRAMMAR_FOLDER_NAME = "gen"
GRAMMAR_ID = "5a0bc90e734d1d08bf70e0ff"
GRAMMAR_URL = "http://localhost:2666/grammar/{}".format(GRAMMAR_ID)
class GrammarRule:
def __init__(self, text, data_hash):
self.text = text
... | {
"content_hash": "9d760e67f29befef4d3d24a54974759a",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 126,
"avg_line_length": 31.896551724137932,
"alnum_prop": 0.6040540540540541,
"repo_name": "Zubdano/zql",
"id": "a8ee5d32c2c70e06fe3de0c42022348f4c5af8c0",
"size": "3700",... |
"""
Demonstration of the asyncio module in Python 3.5
This simulation is composed of three layers, each of which will split up the
data into some different subsets, pass the subsets off to the next layer, wait
for results, and then do some non-trivial processing to return to the previous
layer (in this case, sleeping ... | {
"content_hash": "3506e5f89d26e4adaffc7b3618f52b36",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 88,
"avg_line_length": 39.72222222222222,
"alnum_prop": 0.7115384615384616,
"repo_name": "dmeklund/asyncdemo",
"id": "6831711c626bab222298b8b4c9f5c2d8b098409b",
"size": "28... |
def foo():
return
| {
"content_hash": "654ff048c99c42003de447473d81bee5",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 10,
"avg_line_length": 11,
"alnum_prop": 0.5454545454545454,
"repo_name": "doboy/Underscore",
"id": "a4a7def833c4da7503c1f61d81ec3c632f21efe1",
"size": "22",
"binary": fal... |
try:
import gdb
except ImportError as e:
raise ImportError("This script must be run in GDB: ", str(e))
import sys
import os
sys.path.append(os.getcwd())
import stl_containers
import simple_class_obj
SIZE_OF_INT = 4
SIZE_OF_BOOL = 1
SIZE_OF_INT64 = 8
SIZE_OF_UINT256 = 32
def get_special_type_obj(gobj):
ob... | {
"content_hash": "bbbce8e580b2f007b754fe90c47f2cbf",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 65,
"avg_line_length": 30.166666666666668,
"alnum_prop": 0.6899938612645795,
"repo_name": "ivansib/sibcoin",
"id": "7dcc6c021db60e95e5f0b8416a21ad3958676f90",
"size": "1650... |
"""
dotfiles
~~~~~~~~
Dotfiles is a tool to make managing your dotfile symlinks in $HOME easy,
allowing you to keep all your dotfiles in a single directory. Hosting is
up to you. You can use a VCS like git, Dropbox, or even rsync to distribute
your dotfiles repository across multiple hosts.
... | {
"content_hash": "1f71d3ed003867d76c7df00e08e1aafa",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 79,
"avg_line_length": 31.785714285714285,
"alnum_prop": 0.6741573033707865,
"repo_name": "jawilson/dotfiles",
"id": "226c06e2586bf2f5ec1e16f28f1c84cfb7561c91",
"size": "44... |
""" Cisco_IOS_XR_aaa_protocol_radius_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR aaa\-protocol\-radius package operational data.
This module contains definitions
for the following management objects\:
radius\: RADIUS operational data
This YANG module augments the
Cisco\-IOS\-XR\... | {
"content_hash": "807e093ce49248a8e468b7eaff86dfd1",
"timestamp": "",
"source": "github",
"line_count": 2190,
"max_line_length": 269,
"avg_line_length": 41.546118721461184,
"alnum_prop": 0.3778493394588178,
"repo_name": "111pontes/ydk-py",
"id": "2975497caad225bb3f147381a6321ddfebbe4ea2",
"size": "... |
"""Context manager for Cloud Spanner batched writes."""
from google.cloud.spanner_v1.proto.mutation_pb2 import Mutation
from google.cloud.spanner_v1.proto.transaction_pb2 import TransactionOptions
# pylint: disable=ungrouped-imports
from google.cloud._helpers import _pb_timestamp_to_datetime
from google.cloud.spanner... | {
"content_hash": "1408c02824a74669655d236dee986f0b",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 88,
"avg_line_length": 31.632183908045977,
"alnum_prop": 0.6320857558139535,
"repo_name": "tswast/google-cloud-python",
"id": "e62763d7fd7c965fabe531ddbe60ed4f5a5bd0e4",
"... |
import paddle.static as static
from .meta_optimizer_base import MetaOptimizerBase
from .common import (
CollectiveHelper,
OP_ROLE_KEY,
OP_ROLE_VAR_KEY,
OpRole,
is_backward_op,
is_loss_grad_op,
is_optimizer_op,
)
__all__ = []
class TensorParallelOptimizer(MetaOptimizerBase):
def __init... | {
"content_hash": "03666e5c211379fd48152ef3e12bf752",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 79,
"avg_line_length": 33.77734375,
"alnum_prop": 0.5039898230600208,
"repo_name": "PaddlePaddle/Paddle",
"id": "41ef5f6190ebf9d36616e55132110355137c046b",
"size": "9227",... |
import pandas as pd
from itertools import islice
import pickle
import re
from time import time
t0 = time()
df = pd.read_csv('metadata.csv')
print('columns',list(df))
selected = df[['cord_uid','sha','publish_time','journal','url','title']].where(df['sha'].notna())
meta_by_sha = {}
rows = selected.iterrows()
for _,r i... | {
"content_hash": "0e8bf0168b06c88db1b3cf1d7cdacf69",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 97,
"avg_line_length": 26.692307692307693,
"alnum_prop": 0.638328530259366,
"repo_name": "mobarski/sandbox",
"id": "ef9fdddd93593ac9d4aae92fcc03acdebf268a50",
"size": "694"... |
import ntpath
import sys
from unittest import TestCase
from exifread import IfdTag
from mock import mock
from pictures.rename import rename
from tests import helpers
def ifd_tag_from(date_time_original):
return IfdTag(None, None, None, date_time_original, None, None)
class MockFile(object):
def __init__(s... | {
"content_hash": "efa2fc4b9447b9b175f0111a5f7b7cd6",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 129,
"avg_line_length": 38.52307692307692,
"alnum_prop": 0.6553514376996805,
"repo_name": "mina-asham/pictures-dedupe-and-rename",
"id": "fe6295126fdb425934c20d5aaf75706fdea9... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
from mock import ANY
from ansible.module_utils.network.fortios.fortios import FortiOSHandler
try:
from ansible.modules.network.fortios import fortios_user_device_group
except ImportError:
... | {
"content_hash": "65c589f78cf64cc46338af3fc10d3078",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 142,
"avg_line_length": 34.02463054187192,
"alnum_prop": 0.6525264224699581,
"repo_name": "thaim/ansible",
"id": "c5f79f6c4c98633e5472e6f21dead9a8f0399c97",
"size": "7603"... |
"""Tests for Kaleidescape config flow."""
import dataclasses
from unittest.mock import AsyncMock
from homeassistant.components.kaleidescape.const import DOMAIN
from homeassistant.config_entries import SOURCE_SSDP, SOURCE_USER
from homeassistant.const import CONF_HOST
from homeassistant.core import HomeAssistant
from ... | {
"content_hash": "9de7319e2de7d256f5f4d2a3616045f1",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 82,
"avg_line_length": 34.30952380952381,
"alnum_prop": 0.6985889428637521,
"repo_name": "w1ll1am23/home-assistant",
"id": "8171ed0955bb47a829fdd227153fe2db48fc75cd",
"siz... |
import copy
from . wrapper import Wrapper
from .. util import color_list
class Feedback(Wrapper):
def __init__(self, *args, animation,
master=1, inputs=None, outputs=None, **kwds):
super().__init__(*args, animation=animation, **kwds)
self.master = master
inputs = inputs o... | {
"content_hash": "ca2e87a46660a952a661d86d9aa1b7b1",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 78,
"avg_line_length": 29.08695652173913,
"alnum_prop": 0.5866965620328849,
"repo_name": "rec/BiblioPixel",
"id": "d78a71ef5fd1d9f16be29a9d9868726b46cda8f5",
"size": "1338"... |
"""
WSGI config for {{ project_name }} project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/{{ docs_version }}/howto/deployment/wsgi/
"""
from __future__ import absolute_import, unicode_literals
import os
fr... | {
"content_hash": "82be1ebd3861d6689feab0b85eed4697",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 82,
"avg_line_length": 27.22222222222222,
"alnum_prop": 0.746938775510204,
"repo_name": "nilnvoid/wagtail",
"id": "f58f6b154cd83f53b14b37d743094191dec4e768",
"size": "490",... |
from tempest.api.network import base
from tempest import test
class DHCPAgentSchedulersTestJSON(base.BaseAdminNetworkTest):
_interface = 'json'
@classmethod
@test.safe_setup
def setUpClass(cls):
super(DHCPAgentSchedulersTestJSON, cls).setUpClass()
if not test.is_extension_enabled('dhc... | {
"content_hash": "0304044a7fbda7546fde02c01ec6f2c8",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 79,
"avg_line_length": 40.46511627906977,
"alnum_prop": 0.603448275862069,
"repo_name": "cloudbase/lis-tempest",
"id": "c84d1a7c36f73ed78d1b5dd674df3ede1312e199",
"size": "... |
__author__ = 'Ahmad Syarif'
import pika
import json
class CommandHandler(object):
avatarKey = 'avatar.NAO.command'
def __init__(self):
credential = pika.PlainCredentials('lumen', 'lumen')
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost', 5672, '/', credential))
... | {
"content_hash": "bc1185d9d7dbacf1bf2d8df4bbecd0c6",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 117,
"avg_line_length": 39.67741935483871,
"alnum_prop": 0.6317073170731707,
"repo_name": "ahmadsyarif/Python-AgentIntelligent",
"id": "355866df24e63e98aeaccb91f7515367689c94... |
from hypr import Provider, request, filter
import json
class BaseProvider(Provider):
def get(self):
return request.m_filters
class Provider0(BaseProvider):
propagation_rules = {
'rule0': (BaseProvider, '/bar')
}
@filter
def my_filter(self):
return 'ok'
class TestFilt... | {
"content_hash": "d98121e5de458678cb5fa01c8da31097",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 63,
"avg_line_length": 21.157894736842106,
"alnum_prop": 0.5671641791044776,
"repo_name": "project-hypr/hypr",
"id": "2e3c7cd3e88353ac73a3793a88b1537cccf41a8b",
"size": "80... |
"""Behaviors for servicing RPCs."""
# base_interfaces and interfaces are referenced from specification in this
# module.
from grpc.framework.base import interfaces as base_interfaces # pylint: disable=unused-import
from grpc.framework.face import _control
from grpc.framework.face import exceptions
from grpc.framework... | {
"content_hash": "f8287d8dfc0cf9cd5d5718111882f2e3",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 94,
"avg_line_length": 35.875,
"alnum_prop": 0.7381533101045297,
"repo_name": "nmittler/grpc",
"id": "26bde129687a5b48b6bb7ad849665b10ab19e722",
"size": "7269",
"binary"... |
import os
import socket
import SocketServer
import sys
import threading
import time
from subprocess import Popen, PIPE
PLUGIN_PATH = "/etc/munin/plugins"
def parse_args():
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-p", "--pluginpath", dest="plugin_path",
... | {
"content_hash": "a05165fd4d136057fedf84deba29a83c",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 104,
"avg_line_length": 34.12837837837838,
"alnum_prop": 0.5394971292813304,
"repo_name": "Mitali-Sodhi/CodeLingo",
"id": "34efcd2fa0d9b2972a31242888b341e72c732be2",
"size... |
'''
Convert a music21 object into JSON and send it to the browser for music21j to use.
'''
import unittest
from music21.exceptions21 import Music21Exception
from music21 import freezeThaw
from music21 import stream
supportedDisplayModes = [
'html',
'jsbody',
'jsbodyScript',
'json'
]
def fromObject(t... | {
"content_hash": "d66fb678feec8f03c19f3a93e35d5e22",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 154,
"avg_line_length": 39.67003367003367,
"alnum_prop": 0.5576302834832796,
"repo_name": "arnavd96/Cinemiezer",
"id": "6384f3ce95c6ca623403d707e0ffb7f38c308093",
"size": ... |
from twisted.internet.defer import Deferred
def send_poem(d):
print('Sending poem')
d.callback('Once upon a midnight dreary')
def get_poem():
"""Return a poem 5 seconds later."""
def canceler(d):
# They don't want the poem anymore, so cancel the delayed call
delayed_call.cancel()
... | {
"content_hash": "26ac964d2123dc2f5867612d4d284931",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 72,
"avg_line_length": 25.044444444444444,
"alnum_prop": 0.6512866015971606,
"repo_name": "jdavisp3/twisted-intro",
"id": "7e88e54cd1f6c8698f6dba58ae2ea668c96716e2",
"size"... |
from .entity_health_state import EntityHealthState
class ReplicaHealthState(EntityHealthState):
"""Represents a base class for stateful service replica or stateless service
instance health state.
You probably want to use the sub-classes and not this class directly. Known
sub-classes are: StatefulServ... | {
"content_hash": "4ec35d4a64f6cb541618cfea89fd32f5",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 125,
"avg_line_length": 38.7906976744186,
"alnum_prop": 0.684052757793765,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "894b4bc3c12de48a13694ae68d608b8744df4ea1",
"s... |
"""
SoftLayer.tests.CLI.modules.config_tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:license: MIT, see LICENSE for more details.
"""
import json
import tempfile
import mock
import SoftLayer
from SoftLayer import auth
from SoftLayer.CLI.config import setup as config
from SoftLayer.CLI import exceptions
... | {
"content_hash": "294f7950df4602db0cc45f052c704a67",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 76,
"avg_line_length": 39.33606557377049,
"alnum_prop": 0.6217962075432382,
"repo_name": "iftekeriba/softlayer-python",
"id": "db0ed6b8a58668d1dace482d5688d9eda292ec56",
"... |
"""
Some handy utility functions used by several classes.
"""
import re
import urllib
import urllib2
import subprocess
import StringIO
import time
import logging.handlers
import boto
import tempfile
import smtplib
import datetime
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from em... | {
"content_hash": "3aeb59d987f21da05e53231f94a1323f",
"timestamp": "",
"source": "github",
"line_count": 527,
"max_line_length": 105,
"avg_line_length": 31.874762808349146,
"alnum_prop": 0.5601857363971902,
"repo_name": "sorenh/cc",
"id": "255d42f6419b509881026ee7275bd346a318179b",
"size": "18545",
... |
from .random_article import *
| {
"content_hash": "244e0d34c4dca3823be76a359265952b",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 29,
"avg_line_length": 30,
"alnum_prop": 0.7666666666666667,
"repo_name": "Naereen/cuisine",
"id": "b59a6a03a193acf519225f4f9771ddd002d994fb",
"size": "30",
"binary": fals... |
"""
Very basic functionality for a Reactor implementation.
"""
from __future__ import division, absolute_import
import socket # needed only for sync-dns
from zope.interface import implementer, classImplements
import sys
import warnings
from heapq import heappush, heappop, heapify
import traceback
from twisted.inte... | {
"content_hash": "4aab653bd536e2f6fad2765a25a342b4",
"timestamp": "",
"source": "github",
"line_count": 1260,
"max_line_length": 117,
"avg_line_length": 34.467460317460315,
"alnum_prop": 0.5992769808192683,
"repo_name": "EricMuller/mynotes-backend",
"id": "3e1c63cbf61fde8ff756daf70f946921ac3ccd35",
... |
from __future__ import division, print_function, absolute_import
import sys
import numpy as np
from heapq import heappush, heappop
import scipy.sparse
__all__ = ['minkowski_distance_p', 'minkowski_distance',
'distance_matrix',
'Rectangle', 'KDTree']
def minkowski_distance_p(x, y, p=2):
"""... | {
"content_hash": "97379c164c244fb6a2d145ef7432eeae",
"timestamp": "",
"source": "github",
"line_count": 994,
"max_line_length": 137,
"avg_line_length": 38.627766599597585,
"alnum_prop": 0.5262787790394833,
"repo_name": "jor-/scipy",
"id": "239438686bdc20778e9811db48cdb8ada57652b6",
"size": "38466",... |
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'libs'))
import logging
import datetime
import json
from functools import partial
from operator import itemgetter
from decimal import Decimal as D, InvalidOperation
from collections import defaultdict, namedtuple
import jinja2
import weba... | {
"content_hash": "a2f378410302d9b2e43f2b5028e5dd11",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 128,
"avg_line_length": 30.11764705882353,
"alnum_prop": 0.6078559027777778,
"repo_name": "gledi/amortsched",
"id": "7a070016c5520bef3b08d1a392437f654be24012",
"size": "46... |
"""
Some fancy helper functions.
"""
import os
import ctypes
from ctypes import POINTER
import operator
import numpy
from numpy import linalg
import logging;logger = logging.getLogger("pyassimp")
from .errors import AssimpError
additional_dirs, ext_whitelist = [],[]
# populate search directories and lists of allow... | {
"content_hash": "7d8f27a979955fe4688c2c08aa62b011",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 111,
"avg_line_length": 30.729411764705883,
"alnum_prop": 0.6196401225114855,
"repo_name": "ivansoban/ILEngine",
"id": "4e9f8ec69d909f115702da7ea86bebcf78a00cd6",
"size": ... |
import json
import os
from .. import base
from girder.api.rest import endpoint
from girder.utility import config
def setUpModule():
pluginRoot = os.path.join(os.path.dirname(os.path.dirname(__file__)),
'test_plugins')
conf = config.getConfig()
conf['plugins'] = {'plugin_dire... | {
"content_hash": "6d296e3dcc1fbd49161915c3e1f106a4",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 76,
"avg_line_length": 31.58108108108108,
"alnum_prop": 0.6469833119383825,
"repo_name": "msmolens/girder",
"id": "78fcd6d0585ee7103297f822d1418179ae0803b3",
"size": "3126"... |
from datetime import datetime
from tracker import db
from tracker.util import issue_to_numeric
from .enum import Remote
from .enum import Severity
cve_id_regex = r'^(CVE\-\d{4}\-\d{4,})$'
issue_types = [
'unknown',
'access restriction bypass',
'arbitrary code execution',
'arbitrary command execution'... | {
"content_hash": "64dd8a937f911aae8a88ecf6b651283e",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 89,
"avg_line_length": 29.36470588235294,
"alnum_prop": 0.6394230769230769,
"repo_name": "jelly/arch-security-tracker",
"id": "0adcdbed434ec385adc7940709d7330d60c2e821",
"s... |
from django.test import TestCase
from django.test.utils import override_settings
from rapidsms.contrib.echo.handlers.echo import EchoHandler
from rapidsms.contrib.echo.handlers.ping import PingHandler
from rapidsms.contrib.handlers.utils import get_handlers
import mock
__all__ = ['TestGetHandlers']
class TestGetH... | {
"content_hash": "2ab0e233217fbef09f8c1cbba5f76437",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 79,
"avg_line_length": 42.16101694915254,
"alnum_prop": 0.652462311557789,
"repo_name": "eHealthAfrica/rapidsms",
"id": "d9c1d2666b2beebb1ed3c1d64e8c3b8a411362d9",
"size":... |
from django.core.management.base import BaseCommand, CommandError
from stalku.core.management.commands._lectures import crawl_institutes, \
crawl_lectures_grad, crawl_lecture_grad
from stalku.core.models import Lecture, LectureInstance, Institute
class Command(BaseCommand):
help = 'Crawls DAC website'
de... | {
"content_hash": "68632e58de4585e9e1a0239376395150",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 96,
"avg_line_length": 43.77777777777778,
"alnum_prop": 0.5516074450084603,
"repo_name": "henriquenogueira/stalku",
"id": "46cfc128388cc7bff839d3e37ecf3d36614721cd",
"size"... |
from azure.cli.core.help_files import helps
# pylint: disable=line-too-long, too-many-lines
helps['storage entity insert'] = """
type: command
short-summary: Insert an entity into a table.
parameters:
- name: --table-name -t
type: string
short-summary: The name of the table to ... | {
"content_hash": "189e18ed49587989933b5245d65e182f",
"timestamp": "",
"source": "github",
"line_count": 584,
"max_line_length": 172,
"avg_line_length": 36.08390410958904,
"alnum_prop": 0.6585678356190385,
"repo_name": "QingChenmsft/azure-cli",
"id": "7b560c4d4ad18c0a5cc51a8a504eb8797084b008",
"size... |
from direct.directnotify import DirectNotifyGlobal
from toontown.parties.DistributedPartyJukeboxActivityBaseAI import DistributedPartyJukeboxActivityBaseAI
class DistributedPartyJukebox40ActivityAI(DistributedPartyJukeboxActivityBaseAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedPartyJukebox... | {
"content_hash": "e2b801d2deeafa9da9888df5158c6f06",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 104,
"avg_line_length": 56,
"alnum_prop": 0.9047619047619048,
"repo_name": "Spiderlover/Toontown",
"id": "d392b804b548c6ae9d6e24d1e111df3a2dd4cb57",
"size": "336",
"binary... |
"""Utilities for fast persistence of big data, with optional compression."""
# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# Copyright (c) 2009 Gael Varoquaux
# License: BSD Style, 3 clauses.
import pickle
import io
import warnings
import contextlib
from contextlib import closing
from ._compat ... | {
"content_hash": "92013c3c3e5dff5a9f1eb7820e09602c",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 79,
"avg_line_length": 34.43265306122449,
"alnum_prop": 0.621977240398293,
"repo_name": "vortex-ape/scikit-learn",
"id": "1ebf1aa61bb44e345a09c6ce01b8242a0aefda51",
"size"... |
# Copyright (c) 2014 VMware, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | {
"content_hash": "8e61045ba7259ed1d2b011febc02b0ab",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 78,
"avg_line_length": 38.29666666666667,
"alnum_prop": 0.5434763687004961,
"repo_name": "citrix-openstack-build/oslo.vmware",
"id": "a27f70dcb9c68fb9e84ff924554042cf5198d15... |
"""web URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based v... | {
"content_hash": "35d366c1b4e8fa7d2f68c731ca788efa",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 79,
"avg_line_length": 37,
"alnum_prop": 0.6953316953316954,
"repo_name": "SnailTowardThesun/blog_django",
"id": "2990a15e263f8e733efd9cfecd2973079c3b8118",
"size": "814",
... |
from flask import render_template, request
from standup.utils import json_requested, jsonify
def register_error_handlers(app):
app.register_error_handler(403, forbidden)
app.register_error_handler(404, page_not_found)
app.register_error_handler(500, something_broke)
def api_error(code, message):
er... | {
"content_hash": "d92d267e45ecbbec148b97af17b76508",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 77,
"avg_line_length": 28.357142857142858,
"alnum_prop": 0.6943744752308985,
"repo_name": "rlr/standup",
"id": "97c1cf5ca07a2f21dfaf5dcf2f69c05d1ad1eb87",
"size": "1191",
... |
import sys
from redisattacks import redis_conn,redis_enum
from couchattacks import couch_conn
from termcolor import colored
#def post_couch():
def post_redis():
target=raw_input("Enter target\n")
r_server=redis_conn(target,6379)
try:
shit=r_server.keys()
except:
print colored("[+] Authentication Required \n... | {
"content_hash": "12ffc79261fec1acf747b20e67041462",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 175,
"avg_line_length": 36.355932203389834,
"alnum_prop": 0.6564102564102564,
"repo_name": "ajinabraham/Nosql-Exploitation-Framework",
"id": "976ba1f68e7e55a79a69c4354f0a9bde... |
from msrest.exceptions import (
ClientException,
SerializationError,
DeserializationError,
TokenExpiredError,
ClientRequestError,
AuthenticationError,
HttpOperationError,
)
from .api_client import AutoRestLongRunningOperationTestService, AutoRestLongRunningOperationTestServiceConfiguration
... | {
"content_hash": "ace0796cb775a2ae05955f1fbff08f95",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 117,
"avg_line_length": 27.043478260869566,
"alnum_prop": 0.7717041800643086,
"repo_name": "vulcansteel/autorest",
"id": "ea1145bcb5d0b5cfa7dab0f0dc81a233fd6aab4f",
"size":... |
"""
Time zone utilities.
"""
from datetime import datetime, timedelta, tzinfo
__all__ = [
"FixedOffsetTimeZone",
"UTC",
]
class FixedOffsetTimeZone(tzinfo):
"""
Represents a fixed timezone offset (without daylight saving time).
@ivar name: A L{str} giving the name of this timezone; the name ju... | {
"content_hash": "35bbf76c441d9c2822f3658ce58cf453",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 79,
"avg_line_length": 26.63478260869565,
"alnum_prop": 0.5902709761671564,
"repo_name": "mollstam/UnrealPy",
"id": "614f62bf6b170623abe36b4cdbc3cb11dac5f34b",
"size": "31... |
import array
import struct
import io
import warnings
from struct import unpack_from
from PIL import Image, ImageFile, TiffImagePlugin, _binary
from PIL.JpegPresets import presets
from PIL._util import isStringType
i8 = _binary.i8
o8 = _binary.o8
i16 = _binary.i16be
i32 = _binary.i32be
__version__ = "0.6"
#
# Parser... | {
"content_hash": "3f69d50b742c8e21da15c2c58af1a675",
"timestamp": "",
"source": "github",
"line_count": 736,
"max_line_length": 79,
"avg_line_length": 34.08423913043478,
"alnum_prop": 0.555608706051184,
"repo_name": "Ali-aqrabawi/ezclinic",
"id": "ef229e61157cc2a03c538b9d4d72beb35507674a",
"size": ... |
import io
import json
import os
import unittest
from . import conformance
from .fhirdate import FHIRDate
class ConformanceTests(unittest.TestCase):
def instantiate_from(self, filename):
datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or ''
with io.open(os.path.join(datadir, filename), 'r', enco... | {
"content_hash": "d2586fa386e08b38a5377f3861f15ccb",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 275,
"avg_line_length": 69.87116564417178,
"alnum_prop": 0.6986565984722101,
"repo_name": "all-of-us/raw-data-repository",
"id": "37abfd901e6bbe39e28c186044988a703d537219",
... |
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import pandas as pd
np.random.seed(1337) # for reproducibility
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation
from keras.layers.normalization import BatchNormalization
from ke... | {
"content_hash": "2e43eaa32554f3b23344cada07d50580",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 98,
"avg_line_length": 32.44,
"alnum_prop": 0.6789971228935471,
"repo_name": "puyokw/kaggle_Otto",
"id": "8902b1c965397ea2c03526ac1fdcedf15814dcb9",
"size": "4866",
"bin... |
class Animal(object):
def run(self):
print('Animal is Running...')
class Dog(Animal):
def run(self):
print('Dog is Running...')
class Cat(Animal):
pass
def run_twice(animal):
animal.run()
animal.run()
run_twice(Dog())
dog = Dog()
dog.run()
print(isinstance(dog, Dog))
print(isin... | {
"content_hash": "9ddc84e40d624f0ea0f3f8c563da05c1",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 37,
"avg_line_length": 15.5,
"alnum_prop": 0.6129032258064516,
"repo_name": "KrisCheng/HackerPractice",
"id": "d9e2b2e887f133510965c8ae2e05c0876063ac63",
"size": "368",
"... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"... | {
"content_hash": "336c91965ad6c2be41b9a3551fb0da13",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 114,
"avg_line_length": 35.4,
"alnum_prop": 0.6180163214061519,
"repo_name": "cloudControl/s3-image-load",
"id": "d60bcb09a195e49c81900fc677cd740b53d04953",
"size": "3210",... |
from __future__ import annotations # isort:skip
import pytest ; pytest
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
from time import sleep
# External imports
from sel... | {
"content_hash": "236fcc16a84280c84bb08fd04cc37dc2",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 100,
"avg_line_length": 33.98529411764706,
"alnum_prop": 0.572263089571614,
"repo_name": "bokeh/bokeh",
"id": "40ba07e2112d8b8346c2edf6d5ba2f822aa902f9",
"size": "5142",
... |
"""Python interface to GenoLogics LIMS via its REST API.
Usage example: Get some projects.
Per Kraulis, Science for Life Laboratory, Stockholm, Sweden.
"""
import codecs
from genologics.lims import *
# Login parameters for connecting to a LIMS instance.
from genologics.config import BASEURI, USERNAME, PASSWORD
... | {
"content_hash": "8780f0db7a50c8e6703bc7801037e32c",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 75,
"avg_line_length": 27.333333333333332,
"alnum_prop": 0.7116212338593975,
"repo_name": "jwhite007/genologics",
"id": "47c102e795458d376f9db5bdab7079ea5fd2cbe4",
"size": ... |
"""
DeepFool tutorial on mnist using advbox tool.
Deepfool is a simple and accurate adversarial attack method.
It supports both targeted attack and non-targeted attack.
"""
import sys
sys.path.append("..")
import matplotlib.pyplot as plt
import paddle.fluid as fluid
import paddle.v2 as paddle
from advbox.adversary im... | {
"content_hash": "5b0ece1e4e0c9232484bf8404999d9dc",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 84,
"avg_line_length": 32.175182481751825,
"alnum_prop": 0.5905172413793104,
"repo_name": "qingqing01/models",
"id": "2b12c81945859b42809e33ccd74ead53f4d4eb05",
"size": "4... |
import mysql.connector
import send_to_db
from os.path import join, dirname
import json
def main(config):
output = []
db = mysql.connector.Connect(**config)
cursor = db.cursor()
stmts = ["SELECT * FROM top_cities(cities)"]
with open ('top_cities.txt','w') as file:
for item in suggestion_list:
f... | {
"content_hash": "358de27d6a75497f58042177753760ca",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 48,
"avg_line_length": 21.303030303030305,
"alnum_prop": 0.5533428165007113,
"repo_name": "jpmunic/udest",
"id": "1adc6b101bcdea07ecaf652931c0c717ec2d01c4",
"size": "703",
... |
"""Config flow to configure demo component."""
from homeassistant import config_entries
# pylint: disable=unused-import
from . import DOMAIN
class DemoConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Demo configuration flow."""
VERSION = 1
async def async_step_import(self, import_info):
... | {
"content_hash": "7eb34d19c05959ac0d84fc173367cef5",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 63,
"avg_line_length": 26.5625,
"alnum_prop": 0.6988235294117647,
"repo_name": "Teagan42/home-assistant",
"id": "e6b275920c8c16ea0f4dd2d3ddeadaf3fb35ce34",
"size": "425",
... |
""" A fantastic python code to determine the quenched SFH parameters of galaxies using emcee (http://dan.iel.fm/emcee/current/). This file contains all the functions needed to determine the mean SFH parameters of a population.
N.B. The data files .ised_ASCII contain the extracted bc03 models and have a 0 in th... | {
"content_hash": "e22c884bb96703493e97894ad851a4cd",
"timestamp": "",
"source": "github",
"line_count": 555,
"max_line_length": 411,
"avg_line_length": 46.38558558558559,
"alnum_prop": 0.6239123679303915,
"repo_name": "zooniverse/starpy",
"id": "090b00647e1c412e963c9b3ffaa70f92e1ae0e3b",
"size": "2... |
import asyncio
import logging
import regex
import synapse.common as s_common
import synapse.lib.scrape as s_scrape
import synapse.lib.spooled as s_spooled
import synapse.lib.stormtypes as s_stormtypes
logger = logging.getLogger(__name__)
@s_stormtypes.registry.registerLib
class LibScrape(s_stormtypes.Lib):
'''... | {
"content_hash": "d88791ce5cbb8101f9ec3fca8873d6e4",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 119,
"avg_line_length": 40.263803680981596,
"alnum_prop": 0.5125704708212707,
"repo_name": "vertexproject/synapse",
"id": "86fe9e1b7917a808e5a9f1f55efe55fa2b627b25",
"size... |
'''
Created on Oct 24, 2014
This is to split a csv dataset into fixed number of rows and then splitting that into training and testing
@author: wahib
'''
from __future__ import print_function
from sklearn import datasets
from sklearn.cross_validation import train_test_split
from sklearn.grid_search import GridSearch... | {
"content_hash": "94238c57bbf57ff48996981873c5d814",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 106,
"avg_line_length": 29.184466019417474,
"alnum_prop": 0.7082501663339986,
"repo_name": "wahibhaq/android-speaker-audioanalysis",
"id": "3fa8b0d5d544ec66e51799e441c1ad628... |
import os
from typet import Object
from typet import String
class EnvironmentVariable(Object):
name: String[1:]
@property
def value(self):
return os.environ.get(self.name)
| {
"content_hash": "d4a1477b4a51142559f70d5f818d12d0",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 40,
"avg_line_length": 16.333333333333332,
"alnum_prop": 0.6989795918367347,
"repo_name": "zancas/containenv",
"id": "75c937670cc1b6845e7348e88fb3ab86c2d3247c",
"size": "22... |
from __future__ import absolute_import
try:
from urllib.request import urlopen
import urllib.parse as urlparse
from urllib.parse import urlencode
except ImportError:
import urlparse
from urllib2 import urlopen
from urllib import urlencode
| {
"content_hash": "f7196fb5dd870a79774d465e064ac6d0",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 38,
"avg_line_length": 26.4,
"alnum_prop": 0.7575757575757576,
"repo_name": "kmike/imobis",
"id": "9e4a850f337696c677aec7bc0094cbb9cdc05e4a",
"size": "288",
"binary": fal... |
from typing import List, Union
from azure.ai.ml._restclient.v2022_10_01_preview.models import (
AutoForecastHorizon,
AutoSeasonality,
AutoTargetLags,
AutoTargetRollingWindowSize,
CustomForecastHorizon,
CustomSeasonality,
CustomTargetLags,
CustomTargetRollingWindowSize,
ForecastHoriz... | {
"content_hash": "ebddfecf28c9b38f23ac17a2b74e1772",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 118,
"avg_line_length": 48.125,
"alnum_prop": 0.6742857142857143,
"repo_name": "Azure/azure-sdk-for-python",
"id": "24303737461dc9e580c6f37af96b3b2f1bb5819d",
"size": "987... |
import os
from setuptools import find_packages
from setuptools import setup
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(PACKAGE_ROOT, 'README.rst')) as file_obj:
README = file_obj.read()
# NOTE: This is duplicated throughout and we should try to
# consolidate.
SETUP_B... | {
"content_hash": "5d59984a84982fe58e440b4f7c6ebc85",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 72,
"avg_line_length": 28.181818181818183,
"alnum_prop": 0.6161290322580645,
"repo_name": "quom/google-cloud-python",
"id": "08cd2eb7d6b46754e8e9c16d05fd43e061b47980",
"siz... |
import socket
import threading
import Queue
import collections
import SocketServer
import struct
import os
import sys
import time
import traceback
import uuid
import subprocess
import StringIO
import imp
import hashlib
import base64
import logging
import re
import ssl
import tempfile
import string
import datetime
impor... | {
"content_hash": "c83cac0a4283e1300ac580fe6d99d6cc",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 22,
"avg_line_length": 14.590909090909092,
"alnum_prop": 0.8582554517133957,
"repo_name": "xeddmc/pupy",
"id": "6cbd4d3d628f110e8944ff000e44e9a6822ed37f",
"size": "642",
... |
import spur
__all__ = ["run", "RunProcessError"]
local_shell = spur.LocalShell()
run = local_shell.run
RunProcessError = spur.RunProcessError
| {
"content_hash": "df6a01410590071b99fda18ec875e001",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 38,
"avg_line_length": 13.454545454545455,
"alnum_prop": 0.7094594594594594,
"repo_name": "mwilliamson/whack",
"id": "98205c3aff7ca04b804436fbde5222f9023b8101",
"size": "14... |
"""Initialize and launch the onramp REST server."""
import logging
import os
import signal
import socket
import sys
import cherrypy
from cherrypy.process.plugins import Daemonizer, PIDFile
from configobj import ConfigObj
from validate import Validator
from PCE.dispatchers import APIMap, ClusterInfo, ClusterPing, Fil... | {
"content_hash": "3d2c4c2f09c7c28741cf59ed5485745c",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 79,
"avg_line_length": 35.66417910447761,
"alnum_prop": 0.6179116970077422,
"repo_name": "koepked/onramp",
"id": "b38d36dc17cf71900d09b272d29a14604fdc008b",
"size": "4805"... |
from zipfile import ZipFile, ZIP_DEFLATED
from optparse import OptionParser
parser = OptionParser()
## Make options for commandline available through -h
## -f/--files takes a commaseparated list of filenames _without_ paths
parser.add_option("-f", "--files", dest="filename",
help="List of files to ... | {
"content_hash": "85224165bf46f2f5ee4587968bab3b6e",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 71,
"avg_line_length": 38.89655172413793,
"alnum_prop": 0.6578014184397163,
"repo_name": "foag/pyzippr",
"id": "9db8c54505abd1c90b95cb4ba6c9d53c65ef57d0",
"size": "1261",
... |
import copy
import datetime
from django.conf import settings
from django.core.exceptions import FieldError
from django.db.backends import utils as backend_utils
from django.db.models import fields
from django.db.models.constants import LOOKUP_SEP
from django.db.models.query_utils import refs_aggregate
from django.util... | {
"content_hash": "244007c0a21722f97baa5220f4de37d5",
"timestamp": "",
"source": "github",
"line_count": 636,
"max_line_length": 102,
"avg_line_length": 33.611635220125784,
"alnum_prop": 0.6109369883519671,
"repo_name": "edevil/django",
"id": "ac69307edc50010dea00f99b9feebe6820af57dd",
"size": "2137... |
get_ipython().magic('matplotlib inline')
import theano
floatX = theano.config.floatX
import pymc3 as pm
import theano.tensor as T
import sklearn
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('white')
from sklearn import datasets
from sklearn.preprocessing import scale
from sklea... | {
"content_hash": "05d9f72da8e78c938cdc078481811959",
"timestamp": "",
"source": "github",
"line_count": 276,
"max_line_length": 367,
"avg_line_length": 37.75,
"alnum_prop": 0.6990114214415971,
"repo_name": "balarsen/pymc_learning",
"id": "ae7bbae0260554fa6379ee5151fc387029011dea",
"size": "10717",
... |
"""
api_model.py
The meta-model of the generated API.
Translation process converts the YANG model to classes defined in this module.
"""
from __future__ import absolute_import
from pyang.statements import TypeStatement
from pyang.types import UnionTypeSpec, PathTypeSpec
class Element(object):
"""
T... | {
"content_hash": "3e89b4b8c25fd841d2bbec271b2a03ac",
"timestamp": "",
"source": "github",
"line_count": 990,
"max_line_length": 113,
"avg_line_length": 30.830303030303032,
"alnum_prop": 0.5555664766398009,
"repo_name": "CiscoDevNet/ydk-gen",
"id": "6677891749f668d2eb0ec5edd8850630cccc5a6a",
"size":... |
import urllib
from time import time
from unittest import main, TestCase
from test.unit import FakeLogger
from copy import deepcopy
import mock
from swift.common import internal_client
from swift.obj import expirer
def not_random():
return 0.5
last_not_sleep = 0
def not_sleep(seconds):
global last_not_sl... | {
"content_hash": "0c9b4d9c8ed9e1371bde23a596e68b65",
"timestamp": "",
"source": "github",
"line_count": 686,
"max_line_length": 79,
"avg_line_length": 34.72886297376093,
"alnum_prop": 0.5393720617864338,
"repo_name": "lielongxingkong/windchimes",
"id": "493de0ff2455e2944f449080b9d3425311670475",
"s... |
from django.conf.urls import include, url
from django.conf import settings
from django.contrib import admin
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtaildocs import urls as wagtaildocs_urls
from wagtail.wagtailcore import urls as wagtail_urls
urlpatterns = [
url(r'^django-admin/... | {
"content_hash": "e99bb67ef170abe541d1847fbc84aa80",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 89,
"avg_line_length": 31.025641025641026,
"alnum_prop": 0.7206611570247934,
"repo_name": "RocketPod/wagtail-cookiecutter",
"id": "2c5850b2b058ad04f53e509a6f4f8f62d6093719",
... |
"""backend URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | {
"content_hash": "2c4d23afa08dd19fb872d2d54ae24033",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 79,
"avg_line_length": 34.65384615384615,
"alnum_prop": 0.7114317425083241,
"repo_name": "stphivos/django-angular2-fullstack-devops",
"id": "8b58d4bf4069ce4dfab3bf5882e0904d2... |
from gerencianet import Gerencianet
from ...credentials import credentials
gn = Gerencianet(credentials.CREDENTIALS)
body = {
'items': [{
'name': "Product 1",
'value': 1100,
'amount': 2
}],
'shippings': [{
'name': "Default Shipping Cost",
'value': 100
}]
}
res... | {
"content_hash": "f70cac1c786bfb27b4d6160c6b2af2f4",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 41,
"avg_line_length": 18.65,
"alnum_prop": 0.5871313672922251,
"repo_name": "gerencianet/gn-api-sdk-python",
"id": "53b40aed4d829a9a24224d0b5f3e430655b90f44",
"size": "392... |
import sys
from eventlet import event
from eventlet import greenthread
from dragon.openstack.common.gettextutils import _ # noqa
from dragon.openstack.common import log as logging
from dragon.openstack.common import timeutils
LOG = logging.getLogger(__name__)
class LoopingCallDone(Exception):
"""Exception to ... | {
"content_hash": "42fe69d369b83ec709abdc23d877f8da",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 78,
"avg_line_length": 30.140625,
"alnum_prop": 0.5544323483670296,
"repo_name": "os-cloud-storage/openstack-workload-disaster-recovery",
"id": "9c51513246b8179fb4332d3a8676... |
from __future__ import unicode_literals
from builtins import str
import datetime, json, logging, os
from jsonpath_rw import jsonpath, parse
from jsonpath_rw.lexer import JsonPathLexerError
from scrapy import signals
from scrapy.exceptions import CloseSpider
from scrapy.http import Request
from pydispatch import dispa... | {
"content_hash": "84cf62b267962fd57d228f649a21f91a",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 156,
"avg_line_length": 45.03603603603604,
"alnum_prop": 0.5524104820964193,
"repo_name": "holgerd77/django-dynamic-scraper",
"id": "f86de816984df8ef01b153d4020d9ce3092c40f6... |
from ibis.common import RelationError, ExpressionError
from ibis.expr.window import window
import ibis.expr.types as ir
import ibis.expr.operations as ops
import ibis.util as util
# ---------------------------------------------------------------------
# Some expression metaprogramming / graph transformations to suppor... | {
"content_hash": "f76ef3d9442f123bb3e364ae296ed8a0",
"timestamp": "",
"source": "github",
"line_count": 781,
"max_line_length": 79,
"avg_line_length": 30.52368758002561,
"alnum_prop": 0.5653341163639415,
"repo_name": "shaunstanislaus/ibis",
"id": "d7471e2dfd17fd4baf948af0087d84a635dfd3cb",
"size": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.