text stringlengths 4 1.02M | meta dict |
|---|---|
"""
celery.loaders.base
~~~~~~~~~~~~~~~~~~~
Loader base class.
:copyright: (c) 2009 - 2011 by Ask Solem.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import importlib
import os
import re
import warnings
from anyjson import deserialize
from ..datastruc... | {
"content_hash": "7699cd2e8ad982e6885869a148ee84db",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 79,
"avg_line_length": 32.633663366336634,
"alnum_prop": 0.5505157766990292,
"repo_name": "KarimAllah/celery",
"id": "61a0e5dd8096a01d79e23323717099c3c753a8e7",
"size": "6... |
import io
import json
import os
import unittest
from . import specimen
from .fhirdate import FHIRDate
class SpecimenTests(unittest.TestCase):
def instantiate_from(self, filename):
datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or ''
with io.open(os.path.join(datadir, filename), 'r', encoding='... | {
"content_hash": "e67bc24273f53c68d41337e123ab0317",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 121,
"avg_line_length": 57.02054794520548,
"alnum_prop": 0.6923723723723724,
"repo_name": "all-of-us/raw-data-repository",
"id": "e9bafea0156d0d5b7dc0d47447861547e71842b6",
... |
import tweepy
from random import randint
from time import sleep
from API_KEYS import TWITTER_CONSUMER
from API_KEYS import TWITTER_CONSUMER_SECRET
from API_KEYS import TWITTER_ACCESS
from API_KEYS import TWITTER_ACCESS_SECRET
# keys
consumer_key = TWITTER_CONSUMER
consumer_secret = TWITTER_CONSUMER_SECRET
access_token... | {
"content_hash": "05d695421b115cd3d4a309e1fa33b64f",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 57,
"avg_line_length": 27.057142857142857,
"alnum_prop": 0.7275607180570222,
"repo_name": "inflatus/Python",
"id": "2a88c1b16e8a9df1962fce18d329e8aac31a7132",
"size": "1180... |
"""
fs.expose.dokan.libdokan: low-level ctypes interface to Dokan
"""
from ctypes import *
try:
DokanMain = windll.Dokan1.DokanMain
DokanVersion = windll.Dokan1.DokanVersion
except AttributeError:
raise ImportError("Dokan DLL not found")
from ctypes.wintypes import *
ULONG64 = c_ulonglong
PULONGLON... | {
"content_hash": "c8b82d8036bb2117eff8c3443a6799b1",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 104,
"avg_line_length": 31.252669039145907,
"alnum_prop": 0.6246868594853109,
"repo_name": "PyFilesystem/pyfilesystem",
"id": "9d33be44838d7f9a848586bc97108b991e69b030",
"... |
"""Leetcode 1007. Minimum Domino Rotations For Equal Row
Medium
URL: https://leetcode.com/problems/minimum-domino-rotations-for-equal-row/
In a row of dominoes, A[i] and B[i] represent the top and bottom halves of the
i-th domino. (A domino is a tile with two numbers from 1 to 6 - one on each half
of the tile.)
We... | {
"content_hash": "0d317cc89a116d5651db17cd1e1745d2",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 88,
"avg_line_length": 27.859504132231404,
"alnum_prop": 0.5734203500444972,
"repo_name": "bowen0701/algorithms_data_structures",
"id": "f5d57eb1fa4c992d4e41b61aa96ade01a782... |
from datetime import timedelta
from enum import Enum
from typing import (Any,
Dict,
Optional)
class EndpointState(Enum):
Disconnected = "disconnected"
Connecting = "connecting"
Connected = "connected"
Disconnecting = "disconnecting"
class ClusterState(Enum):
... | {
"content_hash": "b6ccbf2a2d60c810515919da14b79a9f",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 78,
"avg_line_length": 24.075342465753426,
"alnum_prop": 0.5812233285917496,
"repo_name": "couchbase/couchbase-python-client",
"id": "7a9dac873326aff41b7082773553a235e9940e1... |
"""Command line manager for opsdroid."""
import click
from opsdroid.cli.config import config
from opsdroid.cli.logs import logs
from opsdroid.cli.start import start
from opsdroid.cli.version import version
@click.group()
@click.pass_context
def cli(ctx):
"""Opsdroid is a chat bot framework written in Python.
... | {
"content_hash": "6fb055b631ceaac26aee752bdc79293f",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 58,
"avg_line_length": 22.458333333333332,
"alnum_prop": 0.7495361781076066,
"repo_name": "opsdroid/opsdroid",
"id": "b4ddcd5869aff871f7a249dbf38cab40df928cc9",
"size": "53... |
def db_inspect(db):
rep = []
for k, v in db.items():
if "id" in v:
rep.append("{}({})".format(k, v["id"]))
else:
rep.append(str(k))
print("DB state: {}".format(', '.join(rep)))
# You don't have to worry about this
class IdGen:
def __init__(self, starting_id):
... | {
"content_hash": "ba40b534fefb71d9c49b96ea02aefb9d",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 79,
"avg_line_length": 19.491666666666667,
"alnum_prop": 0.5391192817443352,
"repo_name": "thoughtarray/IntroToProgramming",
"id": "40336a3b26922a246c2deeba6cdfbd1381ebbf61"... |
"""Custom script to run PyLint on apitools codebase.
"Inspired" by the similar script in gcloud-python.
This runs pylint as a script via subprocess in two different
subprocesses. The first lints the production/library code
using the default rc file (PRODUCTION_RC). The second lints the
demo/test code using an rc file... | {
"content_hash": "8f7a6aca69e7089b4216970c3e216d4d",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 78,
"avg_line_length": 35.25116279069768,
"alnum_prop": 0.6417733210186041,
"repo_name": "KaranToor/MA450",
"id": "3103aa109dd77f2914c9fc724d3c96045472e0c7",
"size": "8157... |
import copy
import os
import re
import shlex
from ..outproc import base as outproc
from ..local import command
from ..local import statusfile
from ..local import utils
from ..local.variants import INCOMPATIBLE_FLAGS_PER_VARIANT
from ..local.variants import INCOMPATIBLE_FLAGS_PER_BUILD_VARIABLE
from ..local.variants im... | {
"content_hash": "59300df1906fae8f257aaa6377662020",
"timestamp": "",
"source": "github",
"line_count": 428,
"max_line_length": 88,
"avg_line_length": 34.31542056074766,
"alnum_prop": 0.662558725403418,
"repo_name": "youtube/cobalt_sandbox",
"id": "e037f996797256eecb8bd91a304d5a3292069d4a",
"size":... |
from django.conf.urls import url
from .views import (
member_form,
member_success,
)
urlpatterns = [
url(r'^$', member_form),
url(r'^success/$', member_success, name="member-success")
]
| {
"content_hash": "daf21853637525932cafb17ec25412c0",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 61,
"avg_line_length": 17.083333333333332,
"alnum_prop": 0.6390243902439025,
"repo_name": "deadbeatfour/reg-form",
"id": "668261dc187ecbc2697055a72cfc779840b1cc8a",
"size":... |
from pykit import awssign
from pykit import http
from pykit import httpmultipart
def send_post_request(host, port, headers, fields):
conn = http.Client(host, port)
multipart_cli = httpmultipart.Multipart()
headers = multipart_cli.make_headers(fields, headers)
body = multipart_cli.make_body_reader(fie... | {
"content_hash": "3eb2a68118631d7fd562388b6f69f385",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 73,
"avg_line_length": 25.85185185185185,
"alnum_prop": 0.5711556829035339,
"repo_name": "sejust/pykit",
"id": "5997e50989efb92b5da0d71973aaddcfc1895988",
"size": "2136",
... |
from pandas import concat
from .read_gmt import read_gmt
def read_gmts(gmt_file_paths, sets=None, drop_description=True, collapse=False):
dfs = []
for gmt_file_path in gmt_file_paths:
dfs.append(read_gmt(gmt_file_path, drop_description=drop_description))
df = concat(dfs, sort=True)
if se... | {
"content_hash": "5ca9dc29fe853df72790559564868fce",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 80,
"avg_line_length": 19.653846153846153,
"alnum_prop": 0.6360078277886497,
"repo_name": "UCSD-CCAL/ccal",
"id": "7199b5e98027aa356bbbcfa4999ac770ec91c213",
"size": "511",... |
import numpy
import os
class CachedDatasets:
"""A convenience class to access cached time series datasets.
Note, that these *cached datasets* are statically included into *tslearn*
and are distinct from the ones in :class:`UCR_UEA_datasets`.
When using the Trace dataset, please cite [1]_.
See Al... | {
"content_hash": "d677849b70a63395c408995aa0f203fc",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 79,
"avg_line_length": 32.67816091954023,
"alnum_prop": 0.5378121702427013,
"repo_name": "rtavenar/tslearn",
"id": "5a60d1415994e60667ed89b0131810579d59be1d",
"size": "2843... |
"""Integer programming examples that show how to use the APIs."""
from ortools.linear_solver import pywraplp
from ortools.init import pywrapinit
def Announce(solver, api_type):
print('---- Integer programming example with ' + solver + ' (' + api_type +
') -----')
def RunIntegerExampleNaturalLanguageA... | {
"content_hash": "6a69cf7ff7a578b33235feb4df3f31e5",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 79,
"avg_line_length": 31.383928571428573,
"alnum_prop": 0.6981507823613087,
"repo_name": "google/or-tools",
"id": "c127031a2e750d2e4a6cf189efc6e7967803d418",
"size": "411... |
#!/usr/bin/env python3
#
# Copyright (c) 2017 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
"""
Script to generate gperf tables of kernel object metadata
User mode threads making system calls reference kernel objects by memory
address, as the kernel/driver APIs in Zephyr are the same for both user
and supe... | {
"content_hash": "2bddf5e98c54c8bdcd73fdaea514ed1f",
"timestamp": "",
"source": "github",
"line_count": 380,
"max_line_length": 116,
"avg_line_length": 32.26315789473684,
"alnum_prop": 0.6212071778140293,
"repo_name": "ldts/zephyr",
"id": "c5559407df47e38c691eb7b5a57cd3e85dd011da",
"size": "12260",... |
from setuptools import setup, find_packages
version = "0.10.0"
setup(name="pypgqueue",
version=version,
description="A job queue based on PostgreSQL's listen/notify features",
author="Trey Cucco",
author_email="fcucco@gmail.com",
url="https://github.com/treycucco/pypgq",
download_u... | {
"content_hash": "4a35af433e0599bb55881011aba94880",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 77,
"avg_line_length": 33.63333333333333,
"alnum_prop": 0.5887016848364718,
"repo_name": "treycucco/pypgqueue",
"id": "429c9a1466aaaf31fbc05129ae893ac34ad2d489",
"size": "1... |
class TweetCriteria:
def __init__(self):
self.maxTweets = 0
self.within = "15mi"
def setUsername(self, username):
self.username = username
return self
def setSince(self, since):
self.since = since
return self
def setUntil(self, until):
self.until = until
return self
def setQuerySearch(... | {
"content_hash": "a6e03fcdb77299cb0df4b6c670b1f599",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 45,
"avg_line_length": 19.714285714285715,
"alnum_prop": 0.7215320910973085,
"repo_name": "phiedulxp/tweet_search",
"id": "335370f75bd231fefcf1b1cc703e4ebda1a481f3",
"size"... |
from math import sqrt
import numpy as np
from scipy.linalg import eig, solve, norm, inv
class StochasticLinearDiff(object):
"""
Represents and computes various things for a model in the form
of the canonical stochastic linear difference equation:
.. math::
x_{t+1} = A x_t + C w_{t+1}
"""... | {
"content_hash": "61b1a51262a78e4a4d568445d461e6bf",
"timestamp": "",
"source": "github",
"line_count": 553,
"max_line_length": 78,
"avg_line_length": 27.44122965641953,
"alnum_prop": 0.54332784184514,
"repo_name": "spencerlyon2/econtools",
"id": "5953e30f5a2925f108a1eb9930fb75860768121e",
"size": ... |
"""SMTP email backend class."""
import smtplib
import ssl
import threading
from django.conf import settings
from django.core.mail.backends.base import BaseEmailBackend
from django.core.mail.utils import DNS_NAME
from django.core.mail.message import sanitize_address
class EmailBackend(BaseEmailBackend):
"""
A... | {
"content_hash": "2f4c935d4fb23750006a92e20fb771c3",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 89,
"avg_line_length": 39.36974789915966,
"alnum_prop": 0.5910352187833511,
"repo_name": "Beeblio/django",
"id": "e72e372ca919be83ee6faca162b13d9137f6b920",
"size": "4685"... |
import time
from threading import Lock
class Buffer(object):
def __init__(self):
self.__list__ = []
self.__lock__ = Lock()
self.__loading__ = False
def consume(self, source, adapter=None, chunked=False):
self.__loading__ = True
try:
for o in source:
... | {
"content_hash": "6013e674a700aa1dbc0860fac561b2f7",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 102,
"avg_line_length": 24.83450704225352,
"alnum_prop": 0.4537076421380973,
"repo_name": "MagicWishMonkey/fuze",
"id": "048959d0583164b2612a8540c55079ee21c33e82",
"size":... |
import argparse
import cgi
import colorsys
import difflib
import random
import os
import re
import subprocess
import sys
import tempfile
import textwrap
import webbrowser
class TokenContext(object):
"""Metadata about a token.
Attributes:
row: Row index of the token in the data file.
column: Column index ... | {
"content_hash": "e053f0d18a9f6d88e412d4757ea7243c",
"timestamp": "",
"source": "github",
"line_count": 722,
"max_line_length": 80,
"avg_line_length": 30.918282548476455,
"alnum_prop": 0.6219594140572504,
"repo_name": "ric2b/Vivaldi-browser",
"id": "89b6d88b333b1b0010a8e04fa205d66b15d9ecee",
"size"... |
"""Regexp-based split and replace using the obsolete regex module.
This module is only for backward compatibility. These operations
are now provided by the new regular expression module, "re".
sub(pat, repl, str): replace first occurrence of pattern in string
gsub(pat, repl, str): replace all occurrence... | {
"content_hash": "87a638acb69f72560601c0a118dc84ae",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 73,
"avg_line_length": 31.328282828282827,
"alnum_prop": 0.60422376269547,
"repo_name": "loongson-community/EFI-MIPS",
"id": "0fc10a5f6838ba605af1d672905e5470f5bd41db",
"s... |
'''
Build a neural machine translation model with soft attention
'''
import theano
import theano.tensor as tensor
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
import cPickle as pkl
import ipdb
import numpy
import copy
import os
import warnings
import sys
import time
from collections import O... | {
"content_hash": "c9461e4b109f424d132dda9509208df4",
"timestamp": "",
"source": "github",
"line_count": 1302,
"max_line_length": 83,
"avg_line_length": 35.704301075268816,
"alnum_prop": 0.5187041538494633,
"repo_name": "vineetm/dl4mt-material",
"id": "e1e9068d6854199e0ffbf00f755fbe14542e4703",
"siz... |
from abc import abstractmethod
import psutil
import time
import threading
import os
class Monitor(object):
def __init__(self):
self.min_usage = 0.0
self.max_usage = 0.0
self.avg_usage = 0.0
self.measured_values = []
self.process = psutil.Process(self.process_id)
se... | {
"content_hash": "9fd73489328057db048c5ede1c5fe876",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 94,
"avg_line_length": 30.527027027027028,
"alnum_prop": 0.5334218680832227,
"repo_name": "docoprusta/process-monitor",
"id": "02d13302b2ec169e1cfcb063b746c15a45999045",
"... |
"""
Copyright (c) 2011, 2012, Regents of the University of California
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this l... | {
"content_hash": "be93ae76b3dc7c24bdd4f2a54b7e142b",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 85,
"avg_line_length": 33.21341463414634,
"alnum_prop": 0.6649531852395815,
"repo_name": "jf87/smap",
"id": "b9c083ab503d08947decdb2d4bb161dc75e2d5ed",
"size": "5447",
"... |
from django.dispatch import receiver
from crudbuilder.signals import post_create_signal, post_update_signal
from crudbuilder.tests.models import TestModel
@receiver(post_create_signal, sender=TestModel)
def post_create_signal_handler(sender, **kwargs):
pass
@receiver(post_update_signal, sender=TestModel)
def p... | {
"content_hash": "f7c6b7f43241dda489d64586f1b09696",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 70,
"avg_line_length": 26.714285714285715,
"alnum_prop": 0.7887700534759359,
"repo_name": "asifpy/django-crudbuilder",
"id": "676832c52b0ee4248df674e2cbc94f0eecca54c0",
"si... |
import tests.exog.test_random_exogenous as testrandexog
testrandexog.test_random_exogenous( 32,20); | {
"content_hash": "34a598fef01feab305cb2c4c636c03db",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 55,
"avg_line_length": 25.25,
"alnum_prop": 0.8217821782178217,
"repo_name": "antoinecarme/pyaf",
"id": "bdb923ca406169959023c0afc8e0faf6f54acc54",
"size": "101",
"binary"... |
import locale
from django.template import Library
register = Library()
def numberformat(value):
if not value:
return "0";
return locale.format("%.2f", value)
register.filter('numberformat', numberformat)
| {
"content_hash": "a94a400097ba7ac0230e8b75de34b12e",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 45,
"avg_line_length": 20.272727272727273,
"alnum_prop": 0.7085201793721974,
"repo_name": "akarambir/shadow",
"id": "935522ea337d2151237f4ac26c11e0f70c95b375",
"size": "223... |
import re
from datetime import timedelta
from django import template
from django.conf import settings
from django.template.defaultfilters import time
from django.template.defaultfilters import date as datefilter
from django.utils.formats import get_format
from django.utils.safestring import mark_safe
from icekit.templa... | {
"content_hash": "035e95014977572e9980ff59e20d53fd",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 91,
"avg_line_length": 36.345029239766085,
"alnum_prop": 0.6466613032984715,
"repo_name": "ic-labs/icekit-events",
"id": "880e85fb170980272906c5c685d80c91461106e2",
"size"... |
"""Offer numeric state listening automation rules."""
import logging
import voluptuous as vol
from homeassistant import exceptions
from homeassistant.components.automation import (
AutomationActionType,
AutomationTriggerInfo,
)
from homeassistant.const import (
CONF_ABOVE,
CONF_ATTRIBUTE,
CONF_BEL... | {
"content_hash": "18e6f2f06b71f28b564af0a269c8225b",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 128,
"avg_line_length": 32.838427947598255,
"alnum_prop": 0.5715425531914894,
"repo_name": "toddeye/home-assistant",
"id": "934cc99993a6bfa32b97d9830efc5bd5fafba3e6",
"siz... |
from parsl.config import Config
from parsl.executors import HighThroughputExecutor
from parsl.launchers import AprunLauncher
from parsl.providers import TorqueProvider
config = Config(
executors=[
HighThroughputExecutor(
label="bw_htex",
cores_per_worker=1,
worker_debug... | {
"content_hash": "eb2925068c45e7bcb5b09c26ff1e4928",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 114,
"avg_line_length": 31.821428571428573,
"alnum_prop": 0.5712682379349046,
"repo_name": "Parsl/parsl",
"id": "38ae9cbad8012d7a5221ea86510f058f3865c65a",
"size": "891",
... |
##
# Import Modules
#
from distutils.core import setup, Extension
import os
if 'BASE_TOOLS_PATH' not in os.environ:
raise "Please define BASE_TOOLS_PATH to the root of base tools tree"
BaseToolsDir = os.environ['BASE_TOOLS_PATH']
setup(
name="PyUtility",
version="0.01",
ext_modules=[
... | {
"content_hash": "44e2e695adfdbaa2906f9fde575b16ae",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 77,
"avg_line_length": 25.517241379310345,
"alnum_prop": 0.5,
"repo_name": "tianocore/buildtools-BaseTools",
"id": "e4d407d84f5e0609be99e0da47c9e497f3f82abc",
"size": "1307... |
from corehq.apps.fixtures.resources.v0_1 import InternalFixtureResource
from corehq.apps.locations.resources.v0_1 import InternalLocationResource
from .utils import APIResourceTest
class InternalTestMixin(object):
def assert_accessible_via_sessions(self, url):
# api auth should succeed
headers = ... | {
"content_hash": "573d68d58675c359ffca9eae3591e1d5",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 88,
"avg_line_length": 36.34375,
"alnum_prop": 0.7403267411865864,
"repo_name": "dimagi/commcare-hq",
"id": "8c06c8f989de1cec4c33e9b06e295404a4b0256c",
"size": "1163",
"b... |
from nrrd import NrrdHeader
from nrrd import NrrdReader
from nrrd import NrrdWriter
from utils import nifti_to_nrrd
from utils import nrrd_to_nifti
| {
"content_hash": "ab4692978f99964b9063d2ca8e0675f0",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 31,
"avg_line_length": 24.833333333333332,
"alnum_prop": 0.8322147651006712,
"repo_name": "sinkpoint/pynrrd",
"id": "24c7e188a7861be555038690a945dc6b1c1f6afd",
"size": "149"... |
"""view for aloha editor"""
from django.shortcuts import render_to_response
from django.template import RequestContext
from djaloha import settings
from djaloha.utils import get_model
def aloha_init(request):
"""
Build the javascript file which is initializing the aloha-editor
Run the javascript code fo... | {
"content_hash": "c45b15221b055efe58c6be27a0d7ed86",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 87,
"avg_line_length": 31.11111111111111,
"alnum_prop": 0.6098214285714286,
"repo_name": "ljean/djaloha",
"id": "cd5907d633d60256191181232582a1e33099ae3e",
"size": "1144",
... |
import eventlet
import errno
import imp
import os
import os.path
import sys
from daemon.daemon import DaemonContext
from daemon.runner import DaemonRunner, make_pidlockfile
from django.conf import settings as django_settings
from django.core.management import call_command
from eventlet import wsgi
from optparse import... | {
"content_hash": "af6a4f68632cb934067fe1a4b241cb49",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 103,
"avg_line_length": 34.38028169014085,
"alnum_prop": 0.6180527106377168,
"repo_name": "WoLpH/django-sentry",
"id": "6eadf7b4ac527f95f0bd78a7f11dc708e04e80d2",
"size": ... |
"""
Settings for testing
"""
NAMESPACE = "percept" | {
"content_hash": "d52b8bea66c040f0139d9e3991285d0f",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 21,
"avg_line_length": 10.2,
"alnum_prop": 0.6666666666666666,
"repo_name": "VikParuchuri/percept",
"id": "3ea69e1e0b5db6f85f5117df298cbccd0db66399",
"size": "51",
"binary... |
'''
Created on August 21, 2017
This file is subject to the terms and conditions defined in the
file 'LICENSE.txt', which is part of this source code package.
@author: David Moss
'''
from devices.light.light import LightDevice
class LevitonDecoraLightswitchDevice(LightDevice):
"""Leviton Decora in-wall switch l... | {
"content_hash": "baae768c6119c9a0c2617aa578fe5405",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 134,
"avg_line_length": 33.28888888888889,
"alnum_prop": 0.5356030262572319,
"repo_name": "peoplepower/composer-sdk-python",
"id": "34295fb2b47f7784285348873f224e5a09f3bb5b"... |
import pkg_resources
import pylab
import numpy as np
import sys
import tables
import motmot.fview_ext_trig.easy_decode as easy_decode
import matplotlib.ticker as mticker
from optparse import OptionParser
import pytz, datetime, time
pacific = pytz.timezone('US/Pacific')
import scipy.io
def doit(fname,options):
... | {
"content_hash": "c90f364831e0b61a0f7c5ef5a9da1f06",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 78,
"avg_line_length": 31.984732824427482,
"alnum_prop": 0.556563245823389,
"repo_name": "motmot/strokelitude",
"id": "5e530708a95b44461caea06b9d3b36300a0b57e9",
"size": "... |
from __future__ import print_function
from PyPDF2 import PdfFileWriter, PdfFileReader
import sys
import shutil
import time
start = time.time()
if len(sys.argv)<2:
print("usage: python xxx.py dir_of_pdf_files")
pdf_dir = sys.argv[1]
import os
def get_pdf_title(pdf_file_path):
# must be open as 'rb',... | {
"content_hash": "40acb684893a791e0f28277d2d816fd1",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 85,
"avg_line_length": 32.97674418604651,
"alnum_prop": 0.5479548660084627,
"repo_name": "wangg12/conference_papers_download_tool",
"id": "505ac99bcac9a2cb97c62248f7b45e14b41... |
# Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.
# This script generates the packer_bbox.c file from gl_header.parsed
import sys
import cPickle
import string
sys.path.append( "../glapi_parser" )
import apiutil
apiutil.Cop... | {
"content_hash": "7d53c1aa36420aaaf43ac4bcf88c9ca2",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 89,
"avg_line_length": 27.18471337579618,
"alnum_prop": 0.6197282099343955,
"repo_name": "boompig/chromium-stream-processing",
"id": "1c9c29ef63f9f82003559d6487e6eb29e31a9fe... |
from flask import render_template, send_from_directory
from passgen import app, static_dir
@app.route('/assets/<path:path>')
def send_assets(path):
return send_from_directory(static_dir, path)
@app.route('/', methods=['GET'])
def index():
return render_template('index.html')
| {
"content_hash": "ed47bfca5c1bc25e01297fdad24c2bac",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 54,
"avg_line_length": 22.23076923076923,
"alnum_prop": 0.7093425605536332,
"repo_name": "odedlaz/passgen",
"id": "170fa9b54eca8f724168c45d79d5e060b0c5ec8d",
"size": "289",... |
import datetime
import os
import time
import torch
import torch.utils.data
from filelock import FileLock
from torch import nn
import torchvision
import ray
from ray.util.sgd.torch.examples.segmentation.coco_utils import get_coco
import ray.util.sgd.torch.examples.segmentation.transforms as T
import ray.util.sgd.torch... | {
"content_hash": "8c1b0e9dca6275639208f4b9e074d1cc",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 79,
"avg_line_length": 32.19548872180451,
"alnum_prop": 0.5959831854273704,
"repo_name": "richardliaw/ray",
"id": "afefdac305f4671cf2f0ca8e7fd658a31f47daee",
"size": "8564... |
"""Script for testing ganeti.hypervisor.hv_xen"""
import string # pylint: disable=W0402
import unittest
import tempfile
import shutil
import random
import os
import mock
from ganeti import constants
from ganeti import objects
from ganeti import pathutils
from ganeti import hypervisor
from ganeti import utils
from gan... | {
"content_hash": "1761bb01de9879cda89acb3d8c217548",
"timestamp": "",
"source": "github",
"line_count": 993,
"max_line_length": 79,
"avg_line_length": 33.09969788519638,
"alnum_prop": 0.6314956796884508,
"repo_name": "apyrgio/ganeti",
"id": "73b40cbf7135cea71c457d43be1e6c2191eb0f1d",
"size": "34232... |
"""
I/O for DOLFIN's XML format, cf.
<https://people.sc.fsu.edu/~jburkardt/data/dolfin_xml/dolfin_xml.html>.
"""
import os
import pathlib
import re
from xml.etree import ElementTree as ET
import numpy as np
from .._common import warn
from .._exceptions import ReadError, WriteError
from .._helpers import register_form... | {
"content_hash": "73604766621ec7af4e0f12ea62ee72f4",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 88,
"avg_line_length": 34.05882352941177,
"alnum_prop": 0.5546508758943992,
"repo_name": "nschloe/meshio",
"id": "b9af204760c39553f52ac8ace32ea9f5d529f07d",
"size": "8106"... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.logz import MicrosoftLogz
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-logz
# USAGE
python monitors_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the A... | {
"content_hash": "241f04b793fb560184010c221de98ef2",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 118,
"avg_line_length": 32.096774193548384,
"alnum_prop": 0.7286432160804021,
"repo_name": "Azure/azure-sdk-for-python",
"id": "c349af7b3659e7ec59a057772845821557d2ad4c",
"... |
import unittest
from webkitpy.common.system.crashlogs import CrashLogs
from webkitpy.common.system.filesystem_mock import MockFileSystem
from webkitpy.common.system.systemhost import SystemHost
from webkitpy.common.system.systemhost_mock import MockSystemHost
def make_mock_crash_report_darwin(process_name, pid):
... | {
"content_hash": "f1275f109dbe1c6bb9690c097af64bbd",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 129,
"avg_line_length": 48.74226804123711,
"alnum_prop": 0.7057952622673435,
"repo_name": "Samsung/ChromiumGStreamerBackend",
"id": "9822340a46e4eef2ba395d05a5ab4d164c8f1b6e"... |
import platform
import subprocess
def clear_screen():
if platform.system() == 'Windows':
subprocess.call('cls')
else:
subprocess.call('clear')
| {
"content_hash": "9575de309792901a7d46700a7e49e7ec",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 38,
"avg_line_length": 21,
"alnum_prop": 0.6369047619047619,
"repo_name": "inglesp/prescons",
"id": "a6a8611ca2e7e91a20f686f6ed190377b8e0da23",
"size": "168",
"binary": fa... |
"""Unit tests for tfdbg v2 dumping callback."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import os
import shutil
import socket
import tempfile
import threading
from absl.testing import parameterized
import numpy as np
from tensor... | {
"content_hash": "47624b882c2da253f654440e92368d48",
"timestamp": "",
"source": "github",
"line_count": 1534,
"max_line_length": 80,
"avg_line_length": 43.59452411994785,
"alnum_prop": 0.6327421718455603,
"repo_name": "xzturn/tensorflow",
"id": "abf919190848411b20a7b0204aebda6bc7090137",
"size": "6... |
"""Reinforcement Learning (Chapter 21)
"""
from utils import *
import agents
class PassiveADPAgent(agents.Agent):
"""Passive (non-learning) agent that uses adaptive dynamic programming
on a given MDP and policy. [Fig. 21.2]"""
NotImplementedError
class PassiveTDAgent(agents.Agent):
"""Passive (non-le... | {
"content_hash": "5bb76dd764f5ae8ea6cad0bf78d64dac",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 75,
"avg_line_length": 29.066666666666666,
"alnum_prop": 0.7293577981651376,
"repo_name": "ken0nek/Software2",
"id": "51e3a5a9c63d039483db37720a08cfb3906183ad",
"size": "43... |
import ldpy
if __name__ == "__main__":
ldpy = ldpy.Client("http://localhost:8080/ldp")
blog = ldpy.create("http://localhost:8080/ldp", open("data/blog.ttl"), "text/turtle", "blog")
print "LDP Blog created at: ", blog
print ldpy.read(blog)
print
post = ldpy.create(blog, open("data/post.ttl"),... | {
"content_hash": "6f651436466ef4dcc179c1fd08c45f96",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 97,
"avg_line_length": 27.941176470588236,
"alnum_prop": 0.6189473684210526,
"repo_name": "wikier/ldpy",
"id": "dddfa215468084d6b4f0f52c4e12933dd8d7f2cb",
"size": "499",
... |
import json
import sys
def main(keys):
with sys.stdin as json_string:
json_dict = json.load(json_string)
for key in keys:
json_dict = json_dict[key]
for key in json_dict:
print key
if __name__ == '__main__':
keys = sys.argv[1:]
main(keys)
| {
"content_hash": "0cf64025febc36e86cf6fb4e011f0267",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 42,
"avg_line_length": 19.066666666666666,
"alnum_prop": 0.5769230769230769,
"repo_name": "scorphus/dotfilesetal",
"id": "38f830e9c1f0e6ec0e361b9a0cfac30bc6e6da7c",
"size":... |
"""Tests for mlp."""
from absl.testing import absltest
import jax
import jax.numpy as jnp
from language.mentionmemory.modules import mlp
class MLPBlockTest(absltest.TestCase):
"""MLP block test."""
input_dim = 16
hidden_dim = 64
dtype = jnp.float32
dropout_rate = 0.1
layer_norm_epsilon = 1e-12
bsz ... | {
"content_hash": "0b70d990f227cc773eec0ab3aa3bc345",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 73,
"avg_line_length": 19.666666666666668,
"alnum_prop": 0.6228813559322034,
"repo_name": "google-research/language",
"id": "810b5a77d9bd6c6b3e9e21d1cd925c449b6c2854",
"siz... |
import argparse
import os
import re
import sys
import traceback
import urlparse
from metatools.imports import load_entrypoint
from . import utils
from . import tickets
def parse_url(url):
# Parse the URL into scheme, path, and query.
m = re.match(r'^(?:(\w+):)?(.*?)(?:/(.*?))?(?:\?(.*))?$', url)
scheme... | {
"content_hash": "089e1de4a349e6dfd76b997618d36dd2",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 159,
"avg_line_length": 28.89814814814815,
"alnum_prop": 0.5523870554309516,
"repo_name": "westernx/sgactions",
"id": "970334b473f6a58e58d7c1a7a60fdc1840962fc4",
"size": "... |
class B(Exception):
pass
class C(B):
pass
class D(C):
pass
for cls in [B, C, D]:
try:
raise cls()
except D: # try to match derived before base class
print("D")
except C: # try to match derived before base class
print("C")
except B: # base class, p... | {
"content_hash": "13cbc6e15e0d9aa24bed7bfa7b431458",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 62,
"avg_line_length": 20.633333333333333,
"alnum_prop": 0.5088852988691438,
"repo_name": "ombt/analytics",
"id": "2b50f4d7f7a6a6a78b1195cea84e559d727e5276",
"size": "639",... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='user',
name='email_address',
field=m... | {
"content_hash": "fb1cdba0918512e09964a5a0b233f229",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 104,
"avg_line_length": 23.5,
"alnum_prop": 0.6028368794326241,
"repo_name": "xn1990/B10",
"id": "96a12e776b5073be278397722a54f66c9c434f1d",
"size": "494",
"binary": fals... |
"""Module used to create a shared/static library from pyJac files.
"""
from __future__ import print_function
import shutil
import re
import os
import subprocess
import sys
import multiprocessing
import platform
from .. import utils
def lib_ext(shared):
"""Returns the appropriate library extension based on the sh... | {
"content_hash": "97ecf608c304947be908b735f9cfe02e",
"timestamp": "",
"source": "github",
"line_count": 411,
"max_line_length": 98,
"avg_line_length": 29.34549878345499,
"alnum_prop": 0.5485448967747285,
"repo_name": "kyleniemeyer/pyJac",
"id": "93402ec4a3d9b85f5e1fc76ee0d8433593445d2f",
"size": "1... |
import socket
import re
import simplejson
import urllib
import urllib2
import urlclean
url = "https://www.virustotal.com/vtapi/v2/url/report"
server = "server"
channel = "#channel"
botnick = "botnick"
ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ircsock.connect((server, 6667)) #connect to server usin... | {
"content_hash": "75338d4f81e392aebeb5450713788b8e",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 67,
"avg_line_length": 23.389830508474578,
"alnum_prop": 0.6746376811594202,
"repo_name": "Z-KO/url-expanderscanner-bot",
"id": "9f5c6e8f0123a1a4708c82019be2cb4a331c0ed3",
... |
import unittest
from MapperSwitch import MapperSwitch
from Wiring import Wiring
class TestMapperSwitch(unittest.TestCase):
def setUp(self):
self.wiringCfg={
"0": [
0
],
"1": [
2,0
],
"2": [
1,0
... | {
"content_hash": "91086feae13d0cb5475dc9bb62107eab",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 56,
"avg_line_length": 25.5,
"alnum_prop": 0.5384615384615384,
"repo_name": "mrfawy/ModernEnigma",
"id": "d6fa7972594aadfd0388b9a0b9bca4f77bf992ce",
"size": "663",
"binar... |
__author__ = 'Amy'
import os,zipfile
from .utils import makeDir
from library.core.utils import compress_dir,unzip
no_zip_res = {
'mongodb-2.4.5':[
"data/",
"logs/",
],
"mysql-5.1":[
'data/',
],
"openssl-1.9.8":[
'certs/',
],
'nginx-1.5.12':[
'conf/... | {
"content_hash": "bb97a15f79d764fe7a3e5d4afa697725",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 90,
"avg_line_length": 25.379746835443036,
"alnum_prop": 0.5845386533665835,
"repo_name": "ptphp/PtServer",
"id": "7923f7d120e8b70b9bd660233f6b178be69bb7d8",
"size": "2005"... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Aisle',
fields=[
(... | {
"content_hash": "031440b022656128efbe87e1607a1c65",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 349,
"avg_line_length": 55.329787234042556,
"alnum_prop": 0.560661411267064,
"repo_name": "brew/fruitynutters",
"id": "3dbc1c9b4e6f9d96b18c5af89ae39aea8496be58",
"size": "5... |
import argparse
import json
import logging
import os
import re
import warnings
from carto.auth import APIKeyAuthClient
from carto.datasets import DatasetManager
warnings.filterwarnings('ignore')
# python import_from_database.py --connection='{ \
# "connector": { \
# "provider": "hive", \
# "connection": { ... | {
"content_hash": "785f200fdfac00b376d46f9965a79c16",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 97,
"avg_line_length": 32.95061728395062,
"alnum_prop": 0.6346946421880855,
"repo_name": "CartoDB/carto-python",
"id": "6a4dcfca3790a59d7c29ba47c514ad1d062f7b56",
"size": "... |
import factory
from factory import fuzzy
from mock import patch
from django.utils.timezone import now
from shopify.product.models import Product
from shopify.product.models import Transaction
from shopify.webhook.models import Webhook
class ProductFactory(factory.django.DjangoModelFactory):
class Meta:
... | {
"content_hash": "11b4d1a1a16b356bfa93e4ed5e8e0ba0",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 84,
"avg_line_length": 32.51063829787234,
"alnum_prop": 0.6976439790575916,
"repo_name": "CorbanU/corban-shopify",
"id": "fc7cbd2900f88739c76bf00a9f4daccbb7f83e4b",
"size":... |
import argparse
from neutronclient._i18n import _
from neutronclient.common import utils
from neutronclient.neutron import v2_0 as neutronv20
from neutronclient.neutron.v2_0.vpn import utils as vpn_utils
def add_common_args(parser, is_create=True):
parser.add_argument(
'--auth-algorithm',
default... | {
"content_hash": "b765a8370372cfa5819a224df88a495d",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 76,
"avg_line_length": 34.48672566371681,
"alnum_prop": 0.6412625096227867,
"repo_name": "openstack/python-neutronclient",
"id": "ea70155b7e3bb1a8b73dd3589ccdc8f64bb2ebc0",
... |
"""Top-level presubmit script for checkxmlstyle.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on the presubmit API built into depot_tools.
"""
USE_PYTHON3 = True
def CheckChangeOnUpload(input_api, output_api):
return _CommonChecks(input_api, output_api)
def Check... | {
"content_hash": "a78a6bfeec817215f891a6fa84fd4217",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 75,
"avg_line_length": 29.88888888888889,
"alnum_prop": 0.5910780669144982,
"repo_name": "nwjs/chromium.src",
"id": "f4c3abaa9238f4bb6cf42616ae71251ffbb4f873",
"size": "948... |
"""Unit tests for gauge"""
from collections import namedtuple
import random
import re
import shutil
import tempfile
import threading
import time
import os
import unittest
from unittest import mock
from http.server import HTTPServer, BaseHTTPRequestHandler
import yaml
import requests
from requests.exceptions import ... | {
"content_hash": "7372835c54b884d1ec497aa3ca39cedf",
"timestamp": "",
"source": "github",
"line_count": 936,
"max_line_length": 99,
"avg_line_length": 37.542735042735046,
"alnum_prop": 0.5710586226522482,
"repo_name": "trentindav/faucet",
"id": "4879c8852e39e00e4d8f0fdc74cbfb2c58235bb8",
"size": "3... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cameras', '0002_auto_20151202_1520'),
]
operations = [
migrations.AlterField(
model_name='camera',
name='network',
... | {
"content_hash": "63073d8427a4e85e13f5a52d02278fa7",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 85,
"avg_line_length": 23,
"alnum_prop": 0.606280193236715,
"repo_name": "theSoloBrewer/Project_Management",
"id": "a583d9846d42b2c0c486790fcdf97abe926339d6",
"size": "438"... |
from typing import Optional
from ray.rllib.utils.annotations import override, PublicAPI
from ray.rllib.utils.framework import try_import_tf
from ray.rllib.utils.schedules.schedule import Schedule
from ray.rllib.utils.typing import TensorType
tf1, tf, tfv = try_import_tf()
@PublicAPI
class ConstantSchedule(Schedule)... | {
"content_hash": "e446654933c49f6c27aa35495d8e5b4d",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 71,
"avg_line_length": 31.1875,
"alnum_prop": 0.6643286573146293,
"repo_name": "ray-project/ray",
"id": "9681c51670404a401150db7cd546e8ca777587d1",
"size": "998",
"binary... |
name = "fortiosapi"
from .fortiosapi import FortiOSAPI
from .exceptions import (InvalidLicense, NotLogged)
| {
"content_hash": "55be4089d810a3569690128f7282b6b5",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 51,
"avg_line_length": 35.666666666666664,
"alnum_prop": 0.8130841121495327,
"repo_name": "thomnico/fortigateconf",
"id": "6f8309a756549d4494c858d920b66c0b5535c671",
"size":... |
from __future__ import unicode_literals
import socket
import json
__all__ = ['Query', 'Socket']
class Query(object):
def __init__(self, conn, resource):
self._conn = conn
self._resource = resource
self._columns = []
self._filters = []
def call(self):
try:
... | {
"content_hash": "9951999b4bc662e33af2b1e75780f4ba",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 69,
"avg_line_length": 26.44776119402985,
"alnum_prop": 0.5208803611738149,
"repo_name": "frjaraur/python-mk-livestatus",
"id": "25ccdf9353d92ccd8003b862e807b23a0f8e2aa1",
... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('service_builder', '0015_auto_20180520_1112'),
]
operations = [
migrations.AddField(
model_name='service',
name='through_livy... | {
"content_hash": "3805b28d74b401910f569ed9a5d30e69",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 55,
"avg_line_length": 21.88888888888889,
"alnum_prop": 0.6040609137055838,
"repo_name": "dipapaspyros/bdo_platform",
"id": "7cc7625d9f1a161eec29bf38b9445e36c93313aa",
"siz... |
import os
import redis
import points_tracker.app
from rq import Worker, Queue, Connection
listen = ['audio_player']
conn = redis.from_url(os.getenv('REDIS_URL', 'redis://192.168.99.100:32770'))
if __name__ == '__main__':
with Connection(conn):
worker = Worker(list(map(Queue, listen)))
worker.wor... | {
"content_hash": "e8e0dad3a3e7c592a3327a3719760e46",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 77,
"avg_line_length": 23.142857142857142,
"alnum_prop": 0.654320987654321,
"repo_name": "paynejacob21/points-tracker",
"id": "0ec16bc8dfcc2a5e7632cb2dafdfee535c09e4ac",
"s... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gk_collections_person', '0002_remove_personcreator_name_full'),
]
operations = [
migrations.RenameField(
model_name='personcreator',
... | {
"content_hash": "c498996a56821bd5df33aefd26805a38",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 73,
"avg_line_length": 29.227272727272727,
"alnum_prop": 0.5590979782270606,
"repo_name": "ic-labs/django-icekit",
"id": "1d591e90ce4e79712ff6bd67875df965954d3f84",
"size":... |
def hello(name):
'this statement is for doc string example'
print "Function body", name
hello.__doc__
hello(name = 'started in Python') | {
"content_hash": "dd663a97cbb10f3c9acb7e48572e25a1",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 43,
"avg_line_length": 23.333333333333332,
"alnum_prop": 0.7071428571428572,
"repo_name": "IPVL/Tanvin-PythonWorks",
"id": "c85944842182af3fb4210c2c39c026beda1b50dc",
"size"... |
"""Forest of trees-based ensemble methods
Those methods include random forests and extremely randomized trees.
The module structure is the following:
- The ``BaseForest`` base class implements a common ``fit`` method for all
the estimators in the module. The ``fit`` method of the base ``Forest``
class calls the ... | {
"content_hash": "0b05970c8c4d21e53d5e165c71a97748",
"timestamp": "",
"source": "github",
"line_count": 1688,
"max_line_length": 105,
"avg_line_length": 39.617298578199055,
"alnum_prop": 0.6050931602715555,
"repo_name": "sonnyhu/scikit-learn",
"id": "731885a1d414e9b3283260601629f6605065ed67",
"size... |
from __future__ import division, unicode_literals, print_function
from django.db import models
class SingletonModel(models.Model):
class Meta:
abstract = True
def save(self, *args, **kwargs):
self.id=1
super(SingletonModel, self).save(*args, **kwargs)
def delete(self, *args, **k... | {
"content_hash": "c23a4f0181aafd2f2f5dbbc84cea7c11",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 65,
"avg_line_length": 22,
"alnum_prop": 0.6339712918660287,
"repo_name": "chenchiyuan/yajiong",
"id": "80f25d29d9261465252b37203802164f21ce0967",
"size": "470",
"binary"... |
"""Tasks related to projects, including fetching repository code, cleaning
``conf.py`` files, and rebuilding documentation.
"""
import fnmatch
import os
import sys
import shutil
import json
import logging
import socket
import requests
import datetime
import hashlib
from collections import defaultdict
from celery impor... | {
"content_hash": "167a6dc34651f00a9fcc1d1ae6990dd3",
"timestamp": "",
"source": "github",
"line_count": 827,
"max_line_length": 126,
"avg_line_length": 36.195888754534465,
"alnum_prop": 0.596311886149529,
"repo_name": "hach-que/readthedocs.org",
"id": "ec397f8d081032bd3039c46e5d5b79bfb39460cf",
"si... |
from pyramid.config import Configurator
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
config = Configurator(settings=settings)
config.include('pyramid_chameleon')
config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('h... | {
"content_hash": "477fa967fccbea782e3b3607d1053394",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 74,
"avg_line_length": 38,
"alnum_prop": 0.7052631578947368,
"repo_name": "T2DREAM/t2dream-portal",
"id": "d3df60049cf2cd5849fafaa1f78d50abb3d0ee83",
"size": "570",
"bina... |
import _plotly_utils.basevalidators
class MarkerValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="marker", parent_name="barpolar", **kwargs):
super(MarkerValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "9124e95634322dd0b83164ad7e91b278",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 79,
"avg_line_length": 48.693693693693696,
"alnum_prop": 0.5469010175763183,
"repo_name": "plotly/python-api",
"id": "3ada20c3c627b484f504b9e933b97c7db6e22dd3",
"size": "5... |
"""
Main plugin file.
"""
from __future__ import absolute_import
import configparser
import requests
import webbrowser
from builtins import object
import os.path
import json
from qgis.PyQt.QtCore import QSettings, QTranslator, qVersion, QCoreApplication
from qgis.PyQt.QtWidgets import QAction
from qgis.PyQt.QtGui im... | {
"content_hash": "d6cc272234fe5da3a93838555a7cc04e",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 254,
"avg_line_length": 36.841059602649004,
"alnum_prop": 0.6474923602372821,
"repo_name": "gena/qgis-earthengine-plugin",
"id": "5fcace398778713b15b869febef3993a87c6e5dd",
... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/lair/sharnaff/shared_lair_sharnaff_grassland.iff"
result.attribute_template_id = -1
result.stfName("lair_n","sharnaff_grassland")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return resul... | {
"content_hash": "ff5a28bfe660c512eae28834f8662caf",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 85,
"avg_line_length": 24.692307692307693,
"alnum_prop": 0.7071651090342679,
"repo_name": "anhstudios/swganh",
"id": "36c7e0751a347e83c35ada891d6886f58d031a22",
"size": "46... |
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('..')) # NOTE(dstanek): ... | {
"content_hash": "69d625d2647d9e059f0b810a8df945f0",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 79,
"avg_line_length": 32.70161290322581,
"alnum_prop": 0.6802712700369914,
"repo_name": "rodrigods/keystone",
"id": "ce4bbd480ed37a773392a61d15299d9203bc6d54",
"size": "9... |
""" defines class _DbConnect_, for abstracting connections to databases
"""
from __future__ import print_function
from rdkit import RDConfig
import sys,types
class DbError(RuntimeError):
pass
from rdkit.Dbase import DbUtils,DbInfo,DbModule
class DbConnect(object):
""" This class is intended to abstract away... | {
"content_hash": "93b65a9f1c807e32f7cb744e94bae52c",
"timestamp": "",
"source": "github",
"line_count": 335,
"max_line_length": 93,
"avg_line_length": 25.45671641791045,
"alnum_prop": 0.5935741088180112,
"repo_name": "AlexanderSavelyev/rdkit",
"id": "8906b15af69e213dd4ccf4a8ae3d3a91714c590d",
"size... |
"""
tests.test_finalizers
~~~~~~~~~~~~~~~~~~~~~
"""
from yaspin import yaspin
def test_freeze(final_text):
sp = yaspin()
sp._freeze(final_text)
assert isinstance(sp._last_frame, str)
assert sp._last_frame[-1] == "\n"
def test_ok(final_text):
sp = yaspin()
sp.ok(final_text)
assert isi... | {
"content_hash": "0381190e90eb0afb2cb60e4e50520cf2",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 42,
"avg_line_length": 16.976744186046513,
"alnum_prop": 0.5821917808219178,
"repo_name": "pavdmyt/yaspin",
"id": "ca6ca2834ee7892c777609d1d6489bc9aedd98a7",
"size": "730",... |
import random
import subprocess
# Which server to use:
serverPath = "http://127.0.0.1:8888"
# Which of the servelets to test:
apiPath = "/signup"
randomRange = 20
mobSize = 100
fd = open("resultsignuptest2.txt", "w+")
for i in range(1, mobSize + 1):
data = "username=user" + str(random.randint(1, randomRange)) ... | {
"content_hash": "e8e4acaf5b420199bf639d3977a80ae6",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 174,
"avg_line_length": 30.235294117647058,
"alnum_prop": 0.6867704280155642,
"repo_name": "witterk/thai-accounting",
"id": "6b0f1035308bd9850e6d6fde91f081cccb5f5471",
"siz... |
import _plotly_utils.basevalidators
class MarkerValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="marker", parent_name="scatterpolargl", **kwargs):
super(MarkerValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "b72e42987daffbd5958421b7a66f74d5",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 85,
"avg_line_length": 48.1,
"alnum_prop": 0.5418770418770419,
"repo_name": "plotly/python-api",
"id": "c04ae34bb415a783153d16e5ae39bf7fe133cf41",
"size": "6734",
"binar... |
from django.contrib.admin.models import LogEntry
from django.contrib.syndication.views import Feed
class AdminLogFeed(Feed):
title = "DnDTools.eu changes"
link = ''
description = "What our great admins are working on right now."
def items(self):
log_list = LogEntry.objects.filter(
... | {
"content_hash": "fdd06ef1c087db5c5e0ad35b1fbf1a79",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 78,
"avg_line_length": 30.098591549295776,
"alnum_prop": 0.5091249415067852,
"repo_name": "gregpechiro/dndtools",
"id": "9cbc958b6b93dddf4c4ed30c8a559045e94fcd38",
"size": ... |
from hazelcast.serialization.bits import *
from hazelcast.protocol.builtin import FixSizedTypesCodec
from hazelcast.protocol.client_message import OutboundMessage, REQUEST_HEADER_SIZE, create_initial_buffer, RESPONSE_HEADER_SIZE, EVENT_HEADER_SIZE
from hazelcast.protocol.builtin import StringCodec
from hazelcast.protoc... | {
"content_hash": "ab191c60baa11cb3de231735b09740c9",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 146,
"avg_line_length": 45.5,
"alnum_prop": 0.7652347652347652,
"repo_name": "hazelcast/hazelcast-python-client",
"id": "987558fdfab00f6ca88d12c599ae493d37b6683b",
"size": ... |
from pyAccess import utils as pAutils
def test1_strip():
for txt in [' test', 'test ', ' test ']:
assert pAutils.strip(txt) == 'test'
def test2_strip():
assert pAutils.strip(list('test')) == list('test')
| {
"content_hash": "6f47ed4458d1ed9829843d8026b9aee3",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 54,
"avg_line_length": 24.77777777777778,
"alnum_prop": 0.6143497757847534,
"repo_name": "AA-ALERT/pyAccess",
"id": "29dbd3353692d0d9c685f561abbfd2eff1020f29",
"size": "223"... |
"""
API for Web Map Service (WMS) methods and metadata.
Currently supports only version 1.1.1 of the WMS protocol.
"""
import cgi
from urllib import urlencode
from etree import etree
from .util import openURL
class ServiceException(Exception):
"""WMS ServiceException
Attributes:
message -- short er... | {
"content_hash": "1f57e899b000550892fd04092c304b97",
"timestamp": "",
"source": "github",
"line_count": 535,
"max_line_length": 156,
"avg_line_length": 36.25607476635514,
"alnum_prop": 0.5604990462442646,
"repo_name": "sabman/OWSLib",
"id": "1d4ee5bac15ee328fb7e762007842f2a8b603032",
"size": "19809... |
from . import validator, prefixlist, dao
from time import sleep
from expandas.loader import RIPERESTLoader
import threading
class UpdaterWorker(threading.Thread):
def __init__(self, validator, rpsl_objects):
threading.Thread.__init__(self)
self.threadId = 1
self.name = "pre-fixlist.UpdaterW... | {
"content_hash": "f25cced8b4cbb84e3c44fb80db888237",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 62,
"avg_line_length": 35.25925925925926,
"alnum_prop": 0.5987394957983193,
"repo_name": "emjemj/pre-fixlist",
"id": "d7c1786556f6bf10dcb042ce69b35bd8ffb58645",
"size": "95... |
"""Update library's tags using MusicBrainz.
"""
from __future__ import (division, absolute_import, print_function,
unicode_literals)
from beets.plugins import BeetsPlugin
from beets import autotag, library, ui, util
from beets.autotag import hooks
from collections import defaultdict
def apply... | {
"content_hash": "0efe510dfec26e295ccfe0fb4e46911a",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 78,
"avg_line_length": 40.13907284768212,
"alnum_prop": 0.5164164329318595,
"repo_name": "LordSputnik/beets",
"id": "00eb966fada2c8a65297bdab20d496ca02d7fb0a",
"size": "67... |
import shutil
import tempfile
import threading
import unittest
import datetime
from dashi import bootstrap
from eeagent import agent
import os
import time
import uuid
from eeagent.agent import EEAgentMain, MainRunnerThread
import simplejson as json
from eeagent.client import EEAgentClient
from eeagent.types import EEAg... | {
"content_hash": "6cb74b138415966b9c7a5e1cef3f2c79",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 108,
"avg_line_length": 28.854545454545455,
"alnum_prop": 0.5482041587901701,
"repo_name": "ooici/eeagent",
"id": "4722c8b151ac6f9c09c15d2d6a5175a7787da5ec",
"size": "4801... |
from enum import IntEnum
__author__ = "Piotr Gawlowicz"
__copyright__ = "Copyright (c) 2015, Technische Universitat Berlin"
__version__ = "0.1.0"
__email__ = "gawlowicz@tkn.tu-berlin.de"
class SerializationType(IntEnum):
NONE = 0
JSON = 1
PICKLE = 2
MSGPACK = 3
PROTOBUF = 4
class MessageDescrip... | {
"content_hash": "6a8830524f9e0227154500a977c5b87c",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 67,
"avg_line_length": 28.88888888888889,
"alnum_prop": 0.6259615384615385,
"repo_name": "uniflex/uniflex",
"id": "faa641b08abd95556652e35b3f0dc49450903409",
"size": "1040"... |
r"""Test code for PlanetPopulation Prototype module within EXOSIMS.
Cate Liu, IPAC, 2016"""
import unittest
from EXOSIMS.Prototypes.PlanetPopulation import PlanetPopulation
import numpy as np
import scipy.stats
class TestPlanetPopulation(unittest.TestCase):
def setUp(self):
self.spec = {"modules": {"Pl... | {
"content_hash": "4498fdb1ec9f1b4512096fe4fa536e73",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 87,
"avg_line_length": 34.46,
"alnum_prop": 0.5596827239311278,
"repo_name": "dsavransky/EXOSIMS",
"id": "8e666b6a7cbbe5713e67fba74c3cc0f63dafffe4",
"size": "5169",
"bin... |
"""Implementation of a thread-pool working with channels"""
from thread import (
WorkerThread,
StopProcessing,
)
from threading import Lock
from util import (
AsyncQueue,
DummyLock
)
from Queue import (
Queue,
Empty
)
from graph import Graph
from channel import (
mkchannel,
ChannelWriter,
Cha... | {
"content_hash": "fcf162262d49b4e1649f3891f87e7949",
"timestamp": "",
"source": "github",
"line_count": 508,
"max_line_length": 112,
"avg_line_length": 35.017716535433074,
"alnum_prop": 0.6929563213221653,
"repo_name": "Conjuro/async",
"id": "01bc30f7728cdf38cfdc4c13c62fd28dca562028",
"size": "1799... |
import sys, os, subprocess, json
import configuration, logtool
from ExifException import ExifException
log = logtool.getLogger("exiftool")
class ExifTool:
""" Wrapper arround Exiftool. Processes an *existing* media file and print information as json
Supports:
1) Reading tags from file
2) Editing + Wr... | {
"content_hash": "7de04c0e2d1a3bceac320af53b2ae2fc",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 141,
"avg_line_length": 36.0625,
"alnum_prop": 0.5924733845011141,
"repo_name": "xmichael/tagger",
"id": "224743d469f5bcf691d42b717a1190e4e2eb1012",
"size": "4039",
"bin... |
import logging
from functools import partial
from netaddr import IPAddress
from exceptions import CommandExecError
from utils import retry_until_success, debug_failures
NET_NONE = "none"
logger = logging.getLogger(__name__)
class Workload(object):
"""
A calico workload.
These are the end-users contai... | {
"content_hash": "bb61d4d26bce700df61e073f5b696852",
"timestamp": "",
"source": "github",
"line_count": 344,
"max_line_length": 79,
"avg_line_length": 31.438953488372093,
"alnum_prop": 0.5662505779010634,
"repo_name": "projectcalico/libcalico",
"id": "ca139b2bdf66f9c7fb0ce6c53e0dde1db9f36832",
"siz... |
import os, sys, getopt, traceback, json, re
from py4j.java_gateway import java_import, JavaGateway, GatewayClient
from py4j.protocol import Py4JJavaError, Py4JNetworkError
import warnings
import ast
import traceback
import warnings
import signal
import base64
from io import BytesIO
try:
from StringIO import Strin... | {
"content_hash": "17e16313d0f30f9986d19911463c0fa5",
"timestamp": "",
"source": "github",
"line_count": 294,
"max_line_length": 107,
"avg_line_length": 30.989795918367346,
"alnum_prop": 0.645483481505872,
"repo_name": "anthonycorbacho/incubator-zeppelin",
"id": "519d1af4557cec2e2bd40a07b86c1b71b618c6... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.