text stringlengths 4 1.02M | meta dict |
|---|---|
import itertools
class Timestepper(object):
"""Calculate the time-tendencies and timestepping of the equation
dstate/dt = _dstate()
"""
t = 0.0
tc = 0
def step(self):
self.state[:] = self.state + self.dstate()
self._incr_timestep()
def _incr_timestep(self):
sel... | {
"content_hash": "7ba44acdc9b153135557bfc3c7965f5b",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 81,
"avg_line_length": 26.046875,
"alnum_prop": 0.5704859028194361,
"repo_name": "jamesp/shallowwater",
"id": "3784f579c08fe5358e218c605d4e41e99a77156e",
"size": "1667",
... |
import _plotly_utils.basevalidators
class ColorsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="colorsrc", parent_name="area.hoverlabel.font", **kwargs
):
super(ColorsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_n... | {
"content_hash": "79e9ffc11aa3f189bc6fe5ac970ea458",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 82,
"avg_line_length": 33.42857142857143,
"alnum_prop": 0.5961538461538461,
"repo_name": "plotly/python-api",
"id": "e821aa72d7c14d74456eebbe801d70620e5141f8",
"size": "468... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.cosmosdb import CosmosDBManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-cosmosdb
# USAGE
python cosmos_db_notebook_workspace_regenerate_auth_token.py
Before run the sample, please set the values of... | {
"content_hash": "540ee95431663f95ba985091cdcc06f7",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 169,
"avg_line_length": 35.14705882352941,
"alnum_prop": 0.7380753138075313,
"repo_name": "Azure/azure-sdk-for-python",
"id": "46037ff47d46ab6549d0e981d3ac2520e175f304",
"s... |
from __future__ import print_function
from os import environ
from twisted.internet.defer import inlineCallbacks
from autobahn.wamp.types import PublishOptions
from autobahn.twisted.util import sleep
from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner
class Component(ApplicationSession):
"""
... | {
"content_hash": "fb7d817e5e206a9bdeaf45e1d478d26e",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 76,
"avg_line_length": 28.17391304347826,
"alnum_prop": 0.6080246913580247,
"repo_name": "Jenselme/AutobahnPython",
"id": "94a97201ee4645f2ad5f490c514dedbef9b8665f",
"size"... |
"""
Logging package for Python. Based on PEP 282 and comments thereto in
comp.lang.python.
Copyright (C) 2001-2014 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
"""
import sys, os, time, cStringIO, traceback, warnings, weakref, collections
__all__ = ['BASIC_FORMAT', 'BufferingForma... | {
"content_hash": "9297ffb7f3616ce21b8b03fbb11a1bbe",
"timestamp": "",
"source": "github",
"line_count": 1734,
"max_line_length": 93,
"avg_line_length": 34.825836216839676,
"alnum_prop": 0.5804630058952109,
"repo_name": "andela-earinde/bellatrix-py",
"id": "f6498d24440ed8fe6d42e42ac50666005340380d",
... |
try:
import utime as time
except ImportError:
import time
import _thread
# function to check the interned string
def check(s, val):
assert type(s) == str
assert int(s) == val
# main thread function
def th(base, n):
for i in range(n):
# this will intern the string and check it
exec... | {
"content_hash": "6f2eed40c8855ecc919cb74ba6fb12df",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 79,
"avg_line_length": 21.135135135135137,
"alnum_prop": 0.6368286445012787,
"repo_name": "adafruit/circuitpython",
"id": "2099f94bdbf5c78dce8db9cc81951c88d4d31a3a",
"size"... |
"""passlib.handlers.digests - plain hash digests
"""
#=============================================================================
# imports
#=============================================================================
# core
from base64 import b64encode, b64decode
from hashlib import md5, sha1
import logging; log = ... | {
"content_hash": "e6e23c22fccd2dfc1b12914ecc10428a",
"timestamp": "",
"source": "github",
"line_count": 272,
"max_line_length": 159,
"avg_line_length": 37.16544117647059,
"alnum_prop": 0.6006528835690969,
"repo_name": "williamfeng323/py-web",
"id": "4356f071e83fb4e56254d0208fc207f73a3de852",
"size"... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.appcomplianceautomation import AppComplianceAutomationToolForMicrosoft365
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-appcomplianceautomation
# USAGE
python snapshot_download_compliance_detailed_pdf_report.py
B... | {
"content_hash": "02f3fe0bc914faa0ab6a23b0bb5c18a8",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 197,
"avg_line_length": 38.810810810810814,
"alnum_prop": 0.7423398328690808,
"repo_name": "Azure/azure-sdk-for-python",
"id": "1570d71f23b2cf16d4dd5a6e7f426bc79835ce7e",
"... |
import asyncio
import iterm2
async def update(connection, theme):
# Themes have space-delimited attributes, one of which will be light or dark.
parts = theme.split(" ")
if "dark" in parts:
preset = await iterm2.ColorPreset.async_get(connection, "base16-summerfruit-dark-256")
else:
prese... | {
"content_hash": "f156f6525d359fa89928d3f22b4d1441",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 108,
"avg_line_length": 41.964285714285715,
"alnum_prop": 0.7038297872340425,
"repo_name": "timriley/dotfiles",
"id": "f71d54b96a3930c6779dc4acaf02a9055a09e4e1",
"size": "1... |
from neon import NervanaObject
from neon.transforms import CrossEntropyBinary, Logistic
from neon.util.persist import load_obj
from neon.layers import Merge, Activation
class Model(NervanaObject):
"""
Basic model class which stores a list of layers describing the model. Can train the layer
weights on a da... | {
"content_hash": "314bdb2f53971dd24bbe7fb2b3f155c0",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 94,
"avg_line_length": 37.24786324786325,
"alnum_prop": 0.604290959155576,
"repo_name": "zolegus/neon",
"id": "d8f5e579aca19f96b0a21ef8b94854143715bb6e",
"size": "9458",
... |
"""
EasyBuild support for GCC compiler toolchain.
@author: Kenneth Hoste (Ghent University)
"""
from easybuild.toolchains.compiler.gcc import Gcc
class GccToolchain(Gcc):
"""Simple toolchain with just the GCC compilers."""
NAME = 'GCC'
| {
"content_hash": "da2774a814fe917117fcb5e8e1a4b00f",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 55,
"avg_line_length": 20.666666666666668,
"alnum_prop": 0.7258064516129032,
"repo_name": "ULHPC/modules",
"id": "60115094d76b9d21caca81e0758c48d2787a5492",
"size": "1306",... |
from faps.genotypeArray import genotypeArray
from faps.alogsumexp import alogsumexp
import numpy as np
from warnings import warn
class paternityArray(object):
"""
Likelihoods of that any of a set of candidate males is the true father of
each offspring individual, assuming the mother is known. Call the wrap... | {
"content_hash": "3f22156475bf71dad667df945170eaba",
"timestamp": "",
"source": "github",
"line_count": 392,
"max_line_length": 196,
"avg_line_length": 45.380102040816325,
"alnum_prop": 0.6116701332283996,
"repo_name": "ellisztamas/faps",
"id": "9ad808f06882e4b4daa88f4beddfe87b720388c5",
"size": "1... |
'''
program a script that prints the name of your current working directory,
makes a new file in it and then put some arbitrary text in that new file
'''
| {
"content_hash": "47151d6104b435b24bac07e5cbd01794",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 73,
"avg_line_length": 38.75,
"alnum_prop": 0.7548387096774194,
"repo_name": "noisebridge/PythonClass",
"id": "39181593754106a0373ea2ea75238a6b1565029d",
"size": "155",
"b... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 0, transform = "Fisher", sigma = 0.0, exog_count = 0, ar_order = 12); | {
"content_hash": "d6c7e267d079e29b0a154ecc1532088a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 162,
"avg_line_length": 37.42857142857143,
"alnum_prop": 0.7022900763358778,
"repo_name": "antoinecarme/pyaf",
"id": "0ecbf43c5c7be1c0ef88e01996df3edf686468fc",
"size": "262... |
from boto.dynamodb2.table import Table
from contextlib import contextmanager
import pytest
from mycroft.models.redshift_clusters import RedshiftClusters
from tests.data.mock_config import MOCK_CONFIG
from tests.data.redshift_cluster import SAMPLE_REDSHIFT_ID
from tests.data.redshift_cluster import SAMPLE_CLUSTER_ITEMS... | {
"content_hash": "791aad97145f06cb63284a82bf9ccc85",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 97,
"avg_line_length": 38.7752808988764,
"alnum_prop": 0.6638655462184874,
"repo_name": "Yelp/mycroft",
"id": "8d6eb1a0cabed50c252ed76199c55461fec6cb09",
"size": "3475",
... |
from django.contrib import admin
# from tcc.models import MyModel
# admin.site.register(MyModel, MyModelAdmin)
| {
"content_hash": "90c69cabe9cbdae459e63856c558dd87",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 44,
"avg_line_length": 28,
"alnum_prop": 0.8035714285714286,
"repo_name": "pterk/django-tcc-tmp",
"id": "60a67e2708106b167a1a09b0c2da3cf2fc2bbdec",
"size": "112",
"binary"... |
import os
import unittest
from telemetry import page as page_module
from telemetry import value
from telemetry.page import page_set
from telemetry.value import none_values
from telemetry.value import scalar
class TestBase(unittest.TestCase):
def setUp(self):
ps = page_set.PageSet(file_path=os.path.dirname(__fi... | {
"content_hash": "3981cbbc73ad262e24c14f43fc711c0f",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 78,
"avg_line_length": 31.615384615384617,
"alnum_prop": 0.64145100641451,
"repo_name": "mohamed--abdel-maksoud/chromium.src",
"id": "14abd21818e742020bdae11b7b2ce3a98d72ae5... |
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestRegressor, BaggingRegressor
from nltk.stem.snowball import SnowballStemmer
stemmer = SnowballStemmer('english')
df_train = pd.read_csv('C:/Git/Kaggle.HomeDepot/ProjectSearchRelevance.Python/ProductSearchRelevance/input/train.csv', encodin... | {
"content_hash": "ff60300153e9a2a8edcc06119628bd56",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 141,
"avg_line_length": 41.35294117647059,
"alnum_prop": 0.7272403982930299,
"repo_name": "jamessdixon/Kaggle.HomeDepot",
"id": "7e133122586fa8abea379c825901e325a97df9a7",
... |
"""
AWS SNS platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.aws_sns/
"""
import logging
import json
import voluptuous as vol
from homeassistant.const import (
CONF_PLATFORM, CONF_NAME)
from homeassistant.compone... | {
"content_hash": "df8aefa58770a51ce17651276d4cf24d",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 74,
"avg_line_length": 32.0253164556962,
"alnum_prop": 0.6486166007905139,
"repo_name": "stefan-jonasson/home-assistant",
"id": "c94e3abaa96fcab02537ffc86886ea06da8e83c2",
... |
"""Test OKID"""
import os
from os.path import join
import unittest
import numpy as np
from modred import OKID, parallel, util
from modred.py2to3 import range
# Useful for debugging, makes plots
plot = False
if plot:
try:
import matplotlib.pyplot as plt
except:
plot = False
def diff(arr_mea... | {
"content_hash": "9a00685c99f903e3ff43df41806f5d99",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 78,
"avg_line_length": 33.57281553398058,
"alnum_prop": 0.5101214574898786,
"repo_name": "belson17/modred",
"id": "d7fcbb73118b5910dfb9852e3e86de9e63e3d592",
"size": "3480... |
"""
Covariance metric (baseline method)
This method does not "learn" anything, rather it calculates
the covariance matrix of the input data.
This is a simple baseline method first introduced in
On the Generalized Distance in Statistics, P.C.Mahalanobis, 1936
"""
from __future__ import absolute_import
import numpy as... | {
"content_hash": "de926397b14a941180126592f3fd8538",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 74,
"avg_line_length": 26.666666666666668,
"alnum_prop": 0.6875,
"repo_name": "all-umass/metric-learn",
"id": "7a04923da78c8477eba9109791888ca266611c59",
"size": "1200",
... |
from shrubbery.conf import Settings, Setting
class settings(Settings):
OBJECT_IDENTITY_DB_TABLE = Setting(default=None)
OBJECT_IDENTITY_DB_COLUMN = Setting(default='identity_id') | {
"content_hash": "e56096f8e9bdbf97089b2e62b3d41e23",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 62,
"avg_line_length": 37.4,
"alnum_prop": 0.7700534759358288,
"repo_name": "emulbreh/shrubbery",
"id": "250d78a9f29eff286d80175432f44b5b232ca6ac",
"size": "187",
"binary"... |
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest ; pytest
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
from os.path imp... | {
"content_hash": "67afb691bd3f42d82f99047c74e71705",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 85,
"avg_line_length": 36.490196078431374,
"alnum_prop": 0.6413218699623858,
"repo_name": "mindriot101/bokeh",
"id": "6d5c9f6308600690575b1a7555e7004b397995e0",
"size": "4... |
import numpy as np
import pytest
from pandas import CategoricalIndex
import pandas._testing as tm
class TestFillNA:
def test_fillna_categorical(self):
# GH#11343
idx = CategoricalIndex([1.0, np.nan, 3.0, 1.0], name="x")
# fill by value in categories
exp = CategoricalIndex([1.0, 1.... | {
"content_hash": "f4253bcd25c66d4108375afc56b68f3b",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 78,
"avg_line_length": 34.25925925925926,
"alnum_prop": 0.6183783783783784,
"repo_name": "datapythonista/pandas",
"id": "09de578f3c649e5a90278f11b1e3cd5b1d0646d5",
"size": ... |
"""This modules generates a string from a CFG"""
import re
import string
import six
class CNFGenerator(object):
"""Use Chomsky to transform to CNF"""
def __init__(self, grammar_rules):
"""Parse input grammar rules"""
parsed_grammar = []
for grammar_rule in grammar_rules:
i... | {
"content_hash": "531e4f9223d44b1369a72fb237e1aef1",
"timestamp": "",
"source": "github",
"line_count": 425,
"max_line_length": 130,
"avg_line_length": 47.265882352941176,
"alnum_prop": 0.5025388291517324,
"repo_name": "GeorgeArgyros/symautomata",
"id": "60fecad8ca551ce3b471f060c16d7f0cee388fe5",
"... |
'''
Tools for making nice plots
Uses matplotlib backend (currently wx or gtk) to provide tools for editing
matplotlib plots after they have been created
NOTE: I have imported all of pyplot into this module, so you may call it
as though you were calling pyplot directly. The difference is that with
some of the function... | {
"content_hash": "05a11c99a499d33026ce4a252386b50b",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 110,
"avg_line_length": 30.410958904109588,
"alnum_prop": 0.6792792792792792,
"repo_name": "bthcode/cmake_scipy_ctypes_example",
"id": "bb59d04ba5a0f94e5eae38fb5221a690a7b04c... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from dreamer import control
def random_episodes(
env_ctor, num_episodes, num_steps, outdir=None, isolate_envs='none'):
# If using environment processes or threads, we should also use them here to
# av... | {
"content_hash": "61b15a29726e773e788476e6b883d803",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 79,
"avg_line_length": 34.84375,
"alnum_prop": 0.6977578475336322,
"repo_name": "google-research/dreamer",
"id": "5c6507b3035338b49af50f3925db3e2f560c6b3e",
"size": "1722",... |
import copy
from airflow.contrib.hooks.gcp_dataflow_hook import DataFlowHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class DataFlowJavaOperator(BaseOperator):
"""
Start a Java Cloud DataFlow batch job. The parameters of the operation
will be passed to t... | {
"content_hash": "37a05fea8db7769ca1ca7a009e5a5439",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 90,
"avg_line_length": 34.20879120879121,
"alnum_prop": 0.6190170253774494,
"repo_name": "ty707/airflow",
"id": "8f61e18ab5d6a61a18b1dfc296650253e833f727",
"size": "3680",
... |
from __future__ import print_function
from os.path import *
import re
# from parseBrackets import parseBrackets
from parseDirectiveArgs import parseDirectiveArguments
class MyError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
assertV... | {
"content_hash": "11cac19123bca6d0c1177098fccc582f",
"timestamp": "",
"source": "github",
"line_count": 894,
"max_line_length": 122,
"avg_line_length": 38.45973154362416,
"alnum_prop": 0.5648721752028619,
"repo_name": "LungNoodle/lungsim",
"id": "65e858adebeb4a8c9f7d03eef2b4f65180383969",
"size": "... |
import flickrapi
import json
import time
import os
#Flickrapi documentation: https://stuvel.eu/flickrapi-doc/2-calling.html
#FIRST: get your own API-keys!
api_key = u"YOUR_API_KEY_HERE" #Request your own key and place the key inside the quotes.
api_secret = u"YOUR_API_SECRET_HERE" ... | {
"content_hash": "e8e53d10f57d38eb967bcc668186bdbc",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 220,
"avg_line_length": 33.782051282051285,
"alnum_prop": 0.5707779886148008,
"repo_name": "Frederic-P/flickr-API-Scraper",
"id": "1f0d9ace21d8c5cc0ed39eb199c3684d89245a35",
... |
'''
evaluate result
'''
from keras.models import load_model
from keras.utils import np_utils
import numpy as np
import os
import sys
# add path
sys.path.append('../')
sys.path.append('../tools')
from tools import conf
from tools import load_data
from tools import prepare
# input sentence dimensions
step_length =... | {
"content_hash": "377d3673f9e82954fe4d8e57b48daecf",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 161,
"avg_line_length": 32.11578947368421,
"alnum_prop": 0.6224188790560472,
"repo_name": "danche354/Sequence-Labeling",
"id": "91e7d60b99146c08069b815781230bcac5a92706",
"... |
from collections import OrderedDict, namedtuple
import json
import os
from perf_analysis import PerfAnalysis
from wlgen import RTA, Periodic, Ramp
from test_wlgen import WlgenSelfBase
class RTABase(WlgenSelfBase):
"""
Common functionality for testing RTA
Doesn't have "Test" in the name so that nosetests... | {
"content_hash": "3f4c92857c537a1896b9e0ef4ded8cb7",
"timestamp": "",
"source": "github",
"line_count": 304,
"max_line_length": 80,
"avg_line_length": 33.75328947368421,
"alnum_prop": 0.5300652957801384,
"repo_name": "arnoldlu/lisa",
"id": "12aa21a4e8a07fd13d38cd3245667c941031fc48",
"size": "10898"... |
from __future__ import unicode_literals
from moto.core.exceptions import RESTError
class ELBClientError(RESTError):
code = 400
class DuplicateTagKeysError(ELBClientError):
def __init__(self, cidr):
super(DuplicateTagKeysError, self).__init__(
"DuplicateTagKeys",
"Tag key was... | {
"content_hash": "60bac2abaaa71ec9c58561844284d579",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 104,
"avg_line_length": 29.20408163265306,
"alnum_prop": 0.6457023060796646,
"repo_name": "heddle317/moto",
"id": "897bd6dd1dccdb0aa40dd72e4a8775e23ff598f2",
"size": "1431"... |
"""
Management command to update all snippet cached values.
"""
from django.core.management.base import BaseCommand
from ...models import set_cached_snippet, Snippet
class Command(BaseCommand):
help = "Updates the cache values for all snippets"
def handle(self, *args, **kwargs):
# Already iterating... | {
"content_hash": "15a0cdc91f91eef7ecb050df0cf25503",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 70,
"avg_line_length": 28.9,
"alnum_prop": 0.6505190311418685,
"repo_name": "adw0rd/django-addendum-inline",
"id": "36d45965e9bcc6ae1e265fb1603bfdf1e927ee7e",
"size": "578"... |
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('note', '0002_myuser'),
]
operations = [
migrations.AlterModelOptions(
name='myuser',
options={'... | {
"content_hash": "093bf8e068d349f6ea68ae2b7ce88303",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 190,
"avg_line_length": 37.766666666666666,
"alnum_prop": 0.5856134157105031,
"repo_name": "LeMeteore/boomer2",
"id": "9dca92fa3d6e92cd41282d3bd384329f49bca787",
"size": "2... |
"""Implementation of tf.metrics module."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.distribute import distribution_strategy_context
from tensorflow.python.eager import context
from tensorflow.python.framework import dtypes
from... | {
"content_hash": "9b6bd0bb640215455eee9de8c18d186e",
"timestamp": "",
"source": "github",
"line_count": 3653,
"max_line_length": 88,
"avg_line_length": 44.11716397481522,
"alnum_prop": 0.658866964507322,
"repo_name": "asimshankar/tensorflow",
"id": "ec39b1790e340a0d194dea8ab3419ca78fc9d126",
"size"... |
from sys import platform
from functools import wraps, partial
from itertools import count
from weakref import WeakValueDictionary
from errno import errorcode
from six import text_type as _text_type
from six import integer_types as integer_types
from OpenSSL._util import (
ffi as _ffi,
lib as _lib,
excepti... | {
"content_hash": "c9593f75786d7bd1428302f0cf94f948",
"timestamp": "",
"source": "github",
"line_count": 1423,
"max_line_length": 93,
"avg_line_length": 30.403373155305694,
"alnum_prop": 0.5890347633136095,
"repo_name": "deandunbar/html2bwml",
"id": "a257f160f0911cc45110e44884e9b7995f4fa64c",
"size"... |
"""
Copyright (c) 2014, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
from setuptools import setup
setup(... | {
"content_hash": "cf6e888739d68eed837b89b4eb164114",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 90,
"avg_line_length": 34.48780487804878,
"alnum_prop": 0.6414427157001414,
"repo_name": "linearregression/fbpca",
"id": "f10573b606034e708fcce0bfffa6492d62a9bee4",
"size":... |
import time, uuid
import threading
import traceback
import sys
import os
import socket
import collections
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
try:
from gi.repository import GObject
except ImportError:
import gobject as GObject
scriptDir = os.path.dirname(os.path.realpath(__file__... | {
"content_hash": "c4f57f4462f403a1cabb3d638443a0f2",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 131,
"avg_line_length": 40.986363636363635,
"alnum_prop": 0.7362759232560718,
"repo_name": "devicehive/IoT-framework",
"id": "abbaf2f70133bd31b521f02f7b83260439e3a288",
"s... |
import unittest
from mock import patch, mock_open, mock, Mock
import requests
from DataGeneration.MapboxAPIWrapper import MapboxAPIWrapper
from DataGeneration.MapLocation import MapLocation
from DataGeneration.MapboxAPIWrapper import MapboxAPIError
from sys import version_info
if version_info.major == 2:
import _... | {
"content_hash": "09d0c2af7daf2b05105a5b5c6556d991",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 80,
"avg_line_length": 42.18855218855219,
"alnum_prop": 0.613487629688747,
"repo_name": "skorasaurus/RTAHeatMap",
"id": "07f9def9c39aab6458e52598feae4f0f21a9e597",
"size":... |
"""Configuration file for sniffer."""
# pylint: disable=superfluous-parens,bad-continuation
import time
import subprocess
from sniffer.api import select_runnable, file_validator, runnable
try:
from pync import Notifier
except ImportError:
notify = None
else:
notify = Notifier.notify
watch_paths = ["park... | {
"content_hash": "7656c49f9d80486989ab3dea1810e550",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 78,
"avg_line_length": 23.770833333333332,
"alnum_prop": 0.6301489921121823,
"repo_name": "friendlycode/gr-parks",
"id": "773b7a3c023b398df5167563f0a8316f6e98590b",
"size":... |
import json
import os.path
import numpy as np
p = os.path.dirname(os.path.realpath(__file__))
def sse_indices():
with open(os.path.join(p, '../data/sse_50.json')) as f:
sse_indices = json.load(f)
return np.asarray(sse_indices)
def get_merged(index, *fields):
with open(os.path.join(p,
'../... | {
"content_hash": "99d65f692b26bac7813584457bae2b27",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 70,
"avg_line_length": 31.636363636363637,
"alnum_prop": 0.625,
"repo_name": "hotpxl/nebuchadnezzar",
"id": "1cd069e42bc2db6506fb90ab90c6364878de4d83",
"size": "696",
"bi... |
import os
import time
import unittest
from time import sleep
from selenium import webdriver
from device_finder import DeviceFinder
def log(msg):
print (time.strftime("%H:%M:%S") + ": " + msg)
class TestdroidAndroid(unittest.TestCase):
def screenshot(self, name):
self.screenShotCount = 1
scree... | {
"content_hash": "f7853e1946346456852df7251147804e",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 109,
"avg_line_length": 41.26605504587156,
"alnum_prop": 0.6438417074255225,
"repo_name": "teppomalinen/testdroid-samples",
"id": "751042718aa6ac07d473a2548efe5555654eb4b4",... |
"""
Implicit differentiation of ridge regression.
=============================================
"""
from absl import app
import jax
import jax.numpy as jnp
from jaxopt import implicit_diff
from jaxopt import linear_solve
from jaxopt import OptaxSolver
import optax
from sklearn import datasets
from sklearn import model... | {
"content_hash": "ea9333a24074341f38fbf67a30a018ee",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 79,
"avg_line_length": 32.175,
"alnum_prop": 0.635975135975136,
"repo_name": "google/jaxopt",
"id": "36ae112f70ce6db64cdd03b7f77a618e365430a1",
"size": "3150",
"binary": ... |
import shlex
import subprocess
def main():
args = shlex.split('git log --pretty=format:"%an <%ae>"')
p = subprocess.Popen(args, stdout=subprocess.PIPE)
out = p.communicate()[0].split('\n')
done = set()
unique = []
counts = {}
for line in reversed(out):
line = line.strip()
i... | {
"content_hash": "7efea9acf9c090b467a7f7d92eea3822",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 69,
"avg_line_length": 25.13157894736842,
"alnum_prop": 0.5361256544502618,
"repo_name": "RexFuzzle/sfepy",
"id": "41a7461ea7ae3e2c3e1a870ecef56441ab8f5b38",
"size": "977",... |
"""Ops for boosted_trees."""
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import gen_boosted_trees_ops
from tensorflow.python.ops import resources
# Re-exporting ops used by other modules.
# pylint: disable=unused-import
from tensorflow.python.ops.g... | {
"content_hash": "04f852351cfb7861cc59197c15846684",
"timestamp": "",
"source": "github",
"line_count": 295,
"max_line_length": 145,
"avg_line_length": 44.23050847457627,
"alnum_prop": 0.6861587982832618,
"repo_name": "tensorflow/tensorflow-pywrap_saved_model",
"id": "74f529a8dec1aaffc96761b7f50009a7... |
"""
A Shell Script
"""
__version__ = '0.0.0'
#=============================================================================
def main( argv ):
"""
Script execution entry point
@param argv Arguments passed to the script
@return Exit code (0 = success)
"""
# imports when us... | {
"content_hash": "b6f24077cc19c19b3e3c05474c91e7c4",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 78,
"avg_line_length": 22.152173913043477,
"alnum_prop": 0.4661432777232581,
"repo_name": "zhester/hzpy",
"id": "5a8a7b36f0c35af951b2457491c179bb09d0a5b3",
"size": "1043",
... |
import subprocess
import os
import threading
import time
import pytest
from ffmpy import FFmpeg, FFRuntimeError, FFExecutableNotFoundError
def test_invalid_executable_path():
ff = FFmpeg(executable='/tmp/foo/bar/ffmpeg')
with pytest.raises(FFExecutableNotFoundError) as exc_info:
ff.run()
assert ... | {
"content_hash": "20734ada6ab70f2ea45f31cc82b13a36",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 88,
"avg_line_length": 33.43016759776536,
"alnum_prop": 0.6457219251336899,
"repo_name": "wchill/ffmpy3",
"id": "f155495347a40177b312b6626575c147c791bd11",
"size": "5984",... |
import horizon
from horizon.dashboards.nova import dashboard
class Images(horizon.Panel):
name = "Images"
slug = 'images'
dashboard.Nova.register(Images)
| {
"content_hash": "a7d18c947a80a5abb5a4e6ce9ad5b67d",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 45,
"avg_line_length": 16.6,
"alnum_prop": 0.7409638554216867,
"repo_name": "asomya/test",
"id": "13302efc6745d56028120bf7001a979744ea17aa",
"size": "975",
"binary": fals... |
import pika
import time
connection = pika.BlockingConnection(
pika.ConnectionParameters(
"localhost"))
channel = connection.channel()
channel.queue_declare(queue="hello", durable=True)
print(" [*] Waiting for messages. To exit press CTRL+C")
def callback(ch, method, properties, body):
print(... | {
"content_hash": "62d63dd20ca30e7811b9cac87aaf91d5",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 56,
"avg_line_length": 25.17391304347826,
"alnum_prop": 0.6787564766839378,
"repo_name": "tongxindao/shiyanlou",
"id": "ddb26cb072d921a903d06f580fd1a0dc9d0db5c1",
"size": "... |
"""The tests for the automation component."""
import asyncio
import logging
from unittest.mock import Mock, patch
import pytest
from homeassistant.components import logbook
import homeassistant.components.automation as automation
from homeassistant.components.automation import (
ATTR_SOURCE,
DOMAIN,
EVENT... | {
"content_hash": "fa87024a7a6329a04f23f65c9eaa555b",
"timestamp": "",
"source": "github",
"line_count": 1544,
"max_line_length": 110,
"avg_line_length": 32.729922279792746,
"alnum_prop": 0.5140991392104483,
"repo_name": "FreekingDean/home-assistant",
"id": "214b2ea20e8a0d2fef0a1363397a20a81078493e",
... |
"""Test exporting functions."""
# Authors: MNE Developers
#
# License: BSD-3-Clause
from datetime import datetime, timezone
from mne.io import RawArray
from mne.io.meas_info import create_info
from pathlib import Path
import os.path as op
import pytest
import numpy as np
from numpy.testing import (assert_allclose, as... | {
"content_hash": "f8b10a843fcd4ca5f3c097175a4f66db",
"timestamp": "",
"source": "github",
"line_count": 426,
"max_line_length": 79,
"avg_line_length": 40.83098591549296,
"alnum_prop": 0.6381510865815798,
"repo_name": "Eric89GXL/mne-python",
"id": "2cca928914030c91bf5e59f8894052eda4859177",
"size": ... |
"""
jenkins-hash lookup3 algorithm implementation
"""
from asyncio import Lock
from ..._buffered_producer._partition_resolver import (
generate_hash_code,
) # pylint: disable=protected-access
class PartitionResolver:
def __init__(self, partitions):
self._idx = -1
self._partitions = partition... | {
"content_hash": "9f192fefb9c52a73f9b13d1a6f22aef5",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 70,
"avg_line_length": 29.620689655172413,
"alnum_prop": 0.629802095459837,
"repo_name": "Azure/azure-sdk-for-python",
"id": "b741029e9bcb44918e061780165fce94c79cb9fb",
"si... |
from sparse.core import GaussSeidel
from sparse.util import parse_information
from time import time
#URL = "http://profs.info.uaic.ro/~ancai/CN/lab/4/m_rar_2014_1.txt"
URL = "http://profs.info.uaic.ro/~ancai/CN/lab/4/m_rar_2014_2.txt"
def main():
"""Test sparse module"""
matrix, values = parse_information(UR... | {
"content_hash": "6d96a76cdeb2420c52c73a7c218609e1",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 70,
"avg_line_length": 30.40740740740741,
"alnum_prop": 0.6431181485992692,
"repo_name": "c-square/homework",
"id": "b74c609b94067b28d281dcf34c7c14e327751292",
"size": "844... |
"""Sentry Integration"""
import logging
from functools import wraps
from airflow.configuration import conf
from airflow.utils.session import find_session_idx, provide_session
from airflow.utils.state import State
log = logging.getLogger(__name__)
class DummySentry:
"""Blank class for Sentry."""
@classmetho... | {
"content_hash": "d941bbb9758caad9017c55cce3cce5a6",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 109,
"avg_line_length": 37.80813953488372,
"alnum_prop": 0.5571274796247886,
"repo_name": "bolkedebruin/airflow",
"id": "948ecb86292b78e15ed18067f5c74ef1b267afd1",
"size":... |
"""Test that FakeFilesystem calls work identically to a real filesystem."""
import os
import os.path
import shutil
import sys
import tempfile
import time
import unittest
import fake_filesystem
class FakeFilesystemVsRealTest(unittest.TestCase):
_FAKE_FS_BASE = '/fakefs'
def _Paths(self, path):
"""For a give... | {
"content_hash": "ff411bd7cb82761048bdf4981cd538d1",
"timestamp": "",
"source": "github",
"line_count": 538,
"max_line_length": 80,
"avg_line_length": 38.888475836431226,
"alnum_prop": 0.646257527960998,
"repo_name": "rec/echomesh",
"id": "993e0d3ae1486a5eac90e16c069fc26b056c14b3",
"size": "21543",... |
"""The volume type access extension."""
from oslo_utils import uuidutils
import six
import webob
from cinder.api import extensions
from cinder.api.openstack import wsgi
from cinder.api import xmlutil
from cinder import exception
from cinder.i18n import _
from cinder.volume import volume_types
soft_authorize = exten... | {
"content_hash": "444d1e5cdfa9361400e0af7928a193c2",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 77,
"avg_line_length": 38.49753694581281,
"alnum_prop": 0.6381317978246961,
"repo_name": "abusse/cinder",
"id": "b91672f396a22d86b5e301b544fa9ea27c986783",
"size": "8390",... |
import enum
import logging
import phonenumbers
from flask_wtf import FlaskForm
from phonenumbers.phonenumberutil import NumberParseException
from structlog import wrap_logger
from wtforms import (
HiddenField,
PasswordField,
RadioField,
StringField,
SubmitField,
TextAreaField,
)
from wtforms.va... | {
"content_hash": "1b919cd326d49a41a30e110a15869a01",
"timestamp": "",
"source": "github",
"line_count": 456,
"max_line_length": 120,
"avg_line_length": 33.19298245614035,
"alnum_prop": 0.5985068710359408,
"repo_name": "ONSdigital/ras-frontstage",
"id": "bbbf255d9bd23778a2c8d1a238ff24e793b83779",
"s... |
import re
import subprocess
from setup_product.setup_cleanup import (
create_bq_dataset,
create_bq_table,
delete_bq_table,
upload_data_to_bq_table,
)
def test_import_products_bq(table_id_prefix):
dataset = "products"
valid_products_table = f"{table_id_prefix}products"
product_schema = "..... | {
"content_hash": "083560afbebe4b34aabad2afd580b422",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 106,
"avg_line_length": 32.170731707317074,
"alnum_prop": 0.6747536012130402,
"repo_name": "googleapis/python-retail",
"id": "a388365be30c8b189eeea68e72d5d938a59b0f23",
"si... |
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('wishlist_app', '0022... | {
"content_hash": "69e36a9aa37a5930518b8d60f947212b",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 103,
"avg_line_length": 30.232558139534884,
"alnum_prop": 0.5953846153846154,
"repo_name": "pclements12/PyWishlist",
"id": "220ea56be29da0ca6f2f837de0cad595cb1dc36d",
"size... |
from nose.tools import * # flake8: noqa
from urlparse import urlparse
from api.base.settings.defaults import API_BASE
from tests.base import ApiTestCase
from tests.factories import (
ProjectFactory,
RegistrationFactory,
AuthUserFactory
)
node_url_for = lambda n_id: '/{}nodes/{}/'.format(API_BASE, n_id)
... | {
"content_hash": "71392b3df8ffbcc9714812b92923d39f",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 110,
"avg_line_length": 48.955882352941174,
"alnum_prop": 0.6683688795434064,
"repo_name": "haoyuchen1992/osf.io",
"id": "13ea69097cd3e4f62a365e3fc3f038908d67a219",
"size":... |
""" Turn a catalog of photometry from PS1 into an HDF5 file """
from __future__ import division, print_function
__author__ = "adrn <[email protected]>"
# Third-party
from astropy import log as logger
from astropy.io import ascii
import h5py
import numpy.lib.recfunctions as nprf
# Project
from globber.core imp... | {
"content_hash": "ce7346d8a6b823d397df25708361d490",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 104,
"avg_line_length": 35.037974683544306,
"alnum_prop": 0.6296965317919075,
"repo_name": "adrn/globber",
"id": "970ae8728ededadfc543da62158478a5106a726a",
"size": "2768",... |
from fake_switches.command_processing.base_command_processor import BaseCommandProcessor
class ConfigVrfCommandProcessor(BaseCommandProcessor):
def init(self, switch_configuration, terminal_controller, logger, piping_processor, *args):
super(ConfigVrfCommandProcessor, self).init(switch_configuration, term... | {
"content_hash": "b0e6a6b3bc55f14a66551d2440553b8b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 120,
"avg_line_length": 43,
"alnum_prop": 0.7352415026833632,
"repo_name": "internaphosting/fake-switches",
"id": "a156f92c15fec395f2d9596e62dc9631ad41036a",
"size": "1133"... |
"""depotexample URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/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')
Cla... | {
"content_hash": "984abbc1c1c1360a181e2051a98127dd",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 79,
"avg_line_length": 33.791666666666664,
"alnum_prop": 0.6966707768187423,
"repo_name": "amol-/depot",
"id": "043de6bb2e78afa32c9765d2aba7577464b56c24",
"size": "811",
... |
import sys
sys.path.append('.')
sys.path.append('..')
from tasks import execute_comment_task
if __name__ == '__main__':
execute_comment_task() | {
"content_hash": "8d35babf84adc98c3d0d08bd7d402571",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 38,
"avg_line_length": 15,
"alnum_prop": 0.64,
"repo_name": "ResolveWang/WeiboSpider",
"id": "9d51df8e38565afd5ed3cbbb99d88eeb7d87d9c8",
"size": "150",
"binary": false,
... |
import demistomock as demisto
from CommonServerPython import *
from JSONFeedApiModule import * # noqa: E402
def main():
params = {k: v for k, v in demisto.params().items() if v is not None}
params['feed_name_to_config'] = {
'CIDR': {
'url': 'https://api.fastly.com/public-ip-list',
... | {
"content_hash": "7cbf11703c26aef0909a8f5279fb3ccb",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 73,
"avg_line_length": 27.2,
"alnum_prop": 0.5367647058823529,
"repo_name": "demisto/content",
"id": "00c2b3d1d6ed51aa9cf6e526db59088e6254ee39",
"size": "816",
"binary": ... |
"""Git implementation of _version.py."""
import errno
import os
import re
import subprocess
import sys
def get_keywords():
"""Get the keywords needed to look up the version information."""
# these strings will be replaced by git during git-archive.
# setup.py/versioneer.py will grep for the variable name... | {
"content_hash": "e4b02b74bb21f976a418584a76d5ab63",
"timestamp": "",
"source": "github",
"line_count": 547,
"max_line_length": 87,
"avg_line_length": 32.80438756855576,
"alnum_prop": 0.5701627284886313,
"repo_name": "great-expectations/great_expectations",
"id": "330c3b32c15e08f092c687cdb550cfbe2e01... |
from object_recognition_msgs.msg import ObjectRecognitionAction, ObjectRecognitionGoal
import actionlib
import rospy
import unittest
def on_result(status, result):
rospy.loginfo('Received result from ORK.')
class TestActionlib(unittest.TestCase):
def test_actionlib(self):
rospy.init_node('ork_client... | {
"content_hash": "06d31f087bfeb5d192eff694252419b1",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 91,
"avg_line_length": 32.73529411764706,
"alnum_prop": 0.6738544474393531,
"repo_name": "WalkingMachine/sara_commun",
"id": "97077d25b91a8943ea8ce8cb6779e3d9962125a3",
"si... |
from __future__ import absolute_import
import os
from launchpad import settings
import tornado.web
class MainHandler(tornado.web.RequestHandler):
""" Return files from app and node_modules otherwise return index.html"""
def initialize(self):
self.mimetypes = settings.CONF_OPTIONS["mimetypes"]
... | {
"content_hash": "568bf5b691f58c2f7c40738ca852cce9",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 94,
"avg_line_length": 34.68292682926829,
"alnum_prop": 0.6047819971870605,
"repo_name": "totalknowledge/angular2-launchpad",
"id": "16c46e2cd0cea13c0dcef640ee9793da784a82e8"... |
import argparse
import os
import sys
from osa_toolkit import tools
def args(arg_list):
parser = argparse.ArgumentParser(
usage='%(prog)s',
description='OpenStack Ansible Configuration Generator',
epilog='Licensed "Apache2.0"',
)
parser.add_argument(
'--base',
'-b'... | {
"content_hash": "469599b30050f3d0159b19117a8a9b83",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 70,
"avg_line_length": 24.2,
"alnum_prop": 0.5775941230486685,
"repo_name": "yanyao/openstack-ansible",
"id": "64f47dbce2c522f67a83d825c3d666ab40153f53",
"size": "1756",
... |
import os
DEBUG = True
TEMPLATE_DEBUG = True
TEMPLATE_DIRS = (os.getcwd(),)
SECRET_KEY = "not-so-secret"
STATIC_URL = "/static/"
INSTALLED_APPS = ('django.contrib.staticfiles',)
| {
"content_hash": "19edb2ab0033b74c8b433e792b39740a",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 48,
"avg_line_length": 20,
"alnum_prop": 0.7,
"repo_name": "pcx/shoot",
"id": "e7cc6bf9d6bd7f592af92ee204c841a1d1997664",
"size": "180",
"binary": false,
"copies": "1",
... |
import sys
import os
if __name__ == '__main__':
bp_ = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
if bp_ not in [os.path.abspath(x) for x in sys.path]:
sys.path.insert(0, bp_)
pref = "../../../../../../src"
sys.path.insert(0, pref)
sys.path.insert(0, pref + "/... | {
"content_hash": "c9dc6a3e0c7c8cc033d09543a03e2ef2",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 72,
"avg_line_length": 27.65714285714286,
"alnum_prop": 0.6115702479338843,
"repo_name": "ict-felix/stack",
"id": "31bc939e3e29a9acc9371f8b02d72ff2bd7fe7aa",
"size": "1055"... |
def max_cropping(width, height, image_width, image_height, free_crop=False):
if free_crop:
return [0, 0, image_width, image_height]
ratio = width / float(height)
if image_width < image_height * ratio:
# width fits fully, height needs to be cropped
offset = int(round((image_height - ... | {
"content_hash": "7d425918ac7ea9a40134a7b996f9babf",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 76,
"avg_line_length": 45.46153846153846,
"alnum_prop": 0.6446700507614214,
"repo_name": "pgferretti/wable_test",
"id": "e06f58723b09f98d64fd1e779c774b695b84a73e",
"size": ... |
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import os
class TestTargetSourceMap(TestBase):
mydir = TestBase.compute_mydir(__file__)
@no_debug_info_test
def test_source_map(self):
"""Test target.source-map' functionality."""
def assertBreakpo... | {
"content_hash": "394786060f68dad5ba84c5705dfb5193",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 110,
"avg_line_length": 39.507462686567166,
"alnum_prop": 0.5345674348318852,
"repo_name": "endlessm/chromium-browser",
"id": "6457c766813eb7b4520ea862205bc850d77a7510",
"... |
"""Utilities for the reinforcement trainer."""
import sys
sys.path.insert(0, '.') # nopep8
import asyncio
import logging
import os
import multiprocessing
import subprocess
import fcntl
from absl import flags
from utils import *
def expand_cmd_str(cmd):
result = ' '.join(flags.FlagValues().read_flags_from_files(... | {
"content_hash": "aa144cb931311a28d06c4a82825088e4",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 107,
"avg_line_length": 32.270042194092824,
"alnum_prop": 0.5954497907949791,
"repo_name": "mlperf/training_results_v0.6",
"id": "bf30f7528969a52978354e850c63ffac85906840",
... |
"""A collection of sphinx docstrings from the wild."""
import ast
FunctionDef = ast.FunctionDef
if hasattr(ast, 'AsyncFunctionDef'):
FunctionDef = (ast.FunctionDef, ast.AsyncFunctionDef)
def publish_msgstr(app, source, source_path, source_line, config, settings):
# From https://github.com/sphinx-doc/sphinx
... | {
"content_hash": "afc99115f17a0aae7cb8245638530197",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 91,
"avg_line_length": 33.26538461538462,
"alnum_prop": 0.6762631518094577,
"repo_name": "terrencepreilly/darglint",
"id": "e16b22526ed8f9c784b3998ceae3e9b559452e77",
"siz... |
import diventi.accounts.models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0146_auto_20190516_0901'),
]
operations = [
migrations.AlterModelManagers(
name='diventiuser',
managers=[
('object... | {
"content_hash": "1624b64da535c266ed1dd955921de969",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 74,
"avg_line_length": 22.38888888888889,
"alnum_prop": 0.5831265508684863,
"repo_name": "flavoi/diventi",
"id": "747eb84cda00f23b3e6582757d7c5850de64c7dd",
"size": "452",
... |
import json
import awsiot
import logging
import Adafruit_DHT
DHT11 = 11
DHT22 = 22
AM2302 = 22
SENSORS = [DHT11, DHT22, AM2302]
def pub(temp, humid):
if args.topic is not None and len(args.topic) > 0:
for t in args.topic:
publisher.publish(t,
json.dumps({"tempera... | {
"content_hash": "4d7529b51314e080f92d78a4ef0e594a",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 118,
"avg_line_length": 39.68421052631579,
"alnum_prop": 0.6412466843501327,
"repo_name": "stevewoolley/IoT",
"id": "50f13ba00a29797d092d66eb82fba94831baeed6",
"size": "153... |
from django import template
from django.conf import settings
from django.db import models
from news.models import Article, Section
import re
register = template.Library()
@register.inclusion_tag('news/tags/section_snippet.html')
def render_section_list():
return {'section_list': Section.objects.all()}
@regist... | {
"content_hash": "669d8c9aa4c2ee8cd6669bf52631467a",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 68,
"avg_line_length": 24.761061946902654,
"alnum_prop": 0.6411722659042173,
"repo_name": "ilendl2/chrisdev-cookiecutter",
"id": "4ca20092342b2349b9f30c460667ccf490a1a30a",
... |
def nn( ns = None , name = None ) :
""" generate name-space ware entity name """
# namespace + name given
if ( ns is not None ) and ( name is not None ) :
return "{%s}%s"%(ns,name)
# single parameter input -> assuming a name without namespace
if ( ns is not None ) and ( name is None )... | {
"content_hash": "a7d2730df3a08eb1c75fef63e84b01c1",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 66,
"avg_line_length": 29.36842105263158,
"alnum_prop": 0.5519713261648745,
"repo_name": "DREAM-ODA-OS/tools",
"id": "e8aa2f38fbf9ac0beefc79460ba41f37365f387a",
"size": "20... |
try:
from numbers import Integral
except ImportError:
Integral = (int, long)
import os
import re
import subprocess
import sys
from collections import defaultdict
if not hasattr(__builtins__, 'any'):
def any(genexpr):
for expr in genexpr:
if expr:
return True
return False
ID_PY = b"""
im... | {
"content_hash": "209a57e35a59cdf0ed6e54ffeea04a76",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 100,
"avg_line_length": 28.556818181818183,
"alnum_prop": 0.6508157580580979,
"repo_name": "foursquare/commons-old",
"id": "5433bc09cfe00bbbd02703f46955039f77ca63c6",
"siz... |
""" P1 tests for Account
"""
# Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.utils import (random_gen,
cleanup_resources)
from marvin.lib.base import (Domain,
Account,
ServiceOffering,... | {
"content_hash": "eb8640db6caad1eec19f816467e63eb7",
"timestamp": "",
"source": "github",
"line_count": 2052,
"max_line_length": 90,
"avg_line_length": 31.341130604288498,
"alnum_prop": 0.5401946759547207,
"repo_name": "resmo/cloudstack",
"id": "60421d9eab7b929e68d771e14dfe3ea7b5652336",
"size": "6... |
from recipe_engine import recipe_api
from recipe_engine import config_types
class CheckoutApi(recipe_api.RecipeApi):
@property
def default_checkout_root(self):
"""The default location for cached persistent checkouts."""
return self.m.vars.cache_dir.join('work')
def assert_git_is_from_cipd(self):
"... | {
"content_hash": "0b90ad8bb6183e338bc44463eaf20803",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 80,
"avg_line_length": 38.70253164556962,
"alnum_prop": 0.6454619787408014,
"repo_name": "aosp-mirror/platform_external_skia",
"id": "5822642681eaf9761a37464c2c97a6127219226... |
"""Command-line flag library.
Emulates gflags by wrapping cfg.ConfigOpts.
The idea is to move fully to cfg eventually, and this wrapper is a
stepping stone.
"""
import os
import socket
import sys
import gflags
from nova.common import cfg
class FlagValues(object):
class Flag:
def __init__(self, name,... | {
"content_hash": "bd0e4f09d218286c91d2102029163648",
"timestamp": "",
"source": "github",
"line_count": 461,
"max_line_length": 79,
"avg_line_length": 37.668112798264644,
"alnum_prop": 0.6400230348401958,
"repo_name": "KarimAllah/nova",
"id": "d535f783f92a78adc22a5b707bd926eedcaf3d61",
"size": "181... |
from __future__ import with_statement
import os
import time
import traceback
from datetime import datetime
from gettext import gettext as _
from xml.etree.cElementTree import Element, SubElement, tostring
from eventlet import Timeout
import swift.common.db
from swift.common.db import ContainerBroker
from swift.commo... | {
"content_hash": "390806025efa8fc295d9aaac07ae5ae1",
"timestamp": "",
"source": "github",
"line_count": 544,
"max_line_length": 79,
"avg_line_length": 46.59742647058823,
"alnum_prop": 0.5524083790287585,
"repo_name": "orion/swift-config",
"id": "0da4a0c4d3ee73edc7b4be2fdbdfa2e935b76877",
"size": "2... |
"""Base class for all storage backends"""
import logging
from oslo_config import cfg
from oslo_utils import importutils
from oslo_utils import units
from glance_store import capabilities
from glance_store.common import utils
from glance_store import exceptions
from glance_store import i18n
_ = i18n._
LOG = logging.... | {
"content_hash": "8284118b48d3a08fa723f90a75302cc3",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 78,
"avg_line_length": 36.546583850931675,
"alnum_prop": 0.6227056424201224,
"repo_name": "cpallares/glance_store",
"id": "c55848f900c9c5da8be383baaf0d9aa4017e55ac",
"size... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.pa... | {
"content_hash": "c21092e1cd07d890bcfdc36950e0d1be",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 80,
"avg_line_length": 32.227467811158796,
"alnum_prop": 0.7026235184445332,
"repo_name": "crask/redisproxy",
"id": "0c22d5f6ffb529fc9eef5ae5810d86fc441fdc8c",
"size": "79... |
from nose import tools as nose
import unittest
from shiva import exceptions as exc
class ExceptionsTestCase(unittest.TestCase):
def test_invalid_mimetype_error(self):
error = exc.InvalidMimeTypeError('audio/mp3')
nose.eq_(error.__str__(), "Invalid mimetype 'audio/mp3'")
def test_no_config_f... | {
"content_hash": "113afe16ef532c0c609ac0a9ad765ae7",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 65,
"avg_line_length": 28.666666666666668,
"alnum_prop": 0.6813953488372093,
"repo_name": "maurodelazeri/shiva-server",
"id": "741adb5b684a5f4b2b8567a73038eeabbc1680c5",
"s... |
import os
import datetime
from app import app, db
class Hint(db.Model):
__tablename__ = 'hints'
id = db.Column(db.Integer, primary_key=True)
description = db.Column(db.Text)
is_open = db.Column(db.Boolean)
problem_id = db.Column(db.Integer, db.ForeignKey('problems.id'))
def __repr__(self):
... | {
"content_hash": "abdad13f932b5a13d49b25fe08bb0807",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 68,
"avg_line_length": 26.85,
"alnum_prop": 0.633147113594041,
"repo_name": "vigov5/oshougatsu2015",
"id": "f41a1ce9bbfb9a3f65c33e9986100ab487ba7015",
"size": "537",
"bin... |
import os
from datetime import datetime
from django.db import models
from django.core.management import call_command
from djapian import Indexer, Field, space
from djapian.tests.utils import BaseTestCase, BaseIndexerTest, Entry, Person, MultipleIndexerEntry
class IndexerUpdateTest(BaseIndexerTest, BaseTestCase):
... | {
"content_hash": "9c9f372df0b442467717c7761fb4af96",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 98,
"avg_line_length": 33.92857142857143,
"alnum_prop": 0.6656842105263158,
"repo_name": "adalekin/djapian",
"id": "279cc31f45458ed3ae0b917208ebe8992a51bf78",
"size": "2375... |
import unittest
import requests_mock
from frontstage import app
from tests.integration.mocked_services import url_banner_api
class TestSignOutHelp(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
self.app.set_cookie("localhost", "authorization", "session_key")
@requests_moc... | {
"content_hash": "d8ccaea09968c1e8b69b997b7a1f2fd3",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 116,
"avg_line_length": 53.88505747126437,
"alnum_prop": 0.6697952218430034,
"repo_name": "ONSdigital/ras-frontstage",
"id": "82429f9db98f6c0c8d09dcb581552c7f03aae88d",
"s... |
from setuptools import setup, Extension, Command, find_packages
import sys,os,platform
osname=platform.uname()[0].lower()
VERSION = '0.1'
DESCRIPTION = "It is a console based client written in python to access content of https://geekli.st website."
LONG_DESCRIPTION = """
It is a console based client written in python... | {
"content_hash": "caa12ab00b9df3f264d0a55b33132eca",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 151,
"avg_line_length": 29.27906976744186,
"alnum_prop": 0.7029388403494837,
"repo_name": "bhavyanshu/Geeklist_console",
"id": "31303c56e1c36dabf25b149101119d86de395e03",
"... |
"""Python bindings generation for HCTSA."""
from itertools import chain
from whatami import whatable
from pyopy.hctsa.hctsa_config import HCTSA_BINDINGS_FILE, HCTSA_BINDINGS_DIR
from pyopy.hctsa.hctsa_catalog import HCTSACatalog
from pyopy.hctsa.hctsa_data import hctsa_sine
from pyopy.base import PyopyEngines
from py... | {
"content_hash": "27d5069dbf85f67094a570663d7b37c9",
"timestamp": "",
"source": "github",
"line_count": 331,
"max_line_length": 117,
"avg_line_length": 43.17522658610272,
"alnum_prop": 0.5504863200615772,
"repo_name": "strawlab/pyopy",
"id": "0cf38255c3b54dba564e38f993bde74069f51fd0",
"size": "1430... |
class Client(object):
def __init__(self, **kwargs):
self.driver = self.Driver(**kwargs)
| {
"content_hash": "048792c4b26e31512e8a0a5862ea6e4c",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 43,
"avg_line_length": 25.25,
"alnum_prop": 0.594059405940594,
"repo_name": "Jc2k/libcloudcore",
"id": "98f4d6062a998f303f520118af41a04ed9afdf38",
"size": "884",
"binary":... |
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tabs
from gbpui import client
from gbpui import column_filters as gfilters
from gbpui.panels.network_policy import tables
class L3PolicyDetailsTab(tabs.Tab):
name = _(... | {
"content_hash": "fff4bb3902f9b99ddf6b663f162c8ca4",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 79,
"avg_line_length": 34.3771186440678,
"alnum_prop": 0.629976580796253,
"repo_name": "noironetworks/group-based-policy-ui",
"id": "ee960890aeb9df639a610a7a7eb086473dff14b1... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "madapp.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "531c40bad52364eb58a30997c3ac90bf",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 70,
"avg_line_length": 25.22222222222222,
"alnum_prop": 0.7092511013215859,
"repo_name": "gilneidp/FinalProject",
"id": "8d4ee19f8c7d80bd60da8e1208af2610416f17d9",
"size": "... |
from __future__ import absolute_import, division, print_function
import unittest
import dreal
import dreal._odr_test_module_py as odr_test_module
class TestODR(unittest.TestCase):
def test_variable(self):
x1 = dreal.Variable('x')
x2 = odr_test_module.new_variable('x')
self.assertNotEqual... | {
"content_hash": "0ef2c3628aad519b6cc0c61f062195a9",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 64,
"avg_line_length": 23.941176470588236,
"alnum_prop": 0.6658476658476659,
"repo_name": "soonho-tri/dreal4",
"id": "372115a9889690bd3180bdf913bab25dfd4ad68c",
"size": "40... |
"""Simple script to read from serial ports for the purpose of logging timestamped data from serial-based sensors.
Current implementation reads from three serial ports hard-coded into the open_serial() function, which must be
enabled/disabled based on setting the port_flags as arguments. IMUs were Sparkfun Razor IMUs an... | {
"content_hash": "21f1fe764c16c6106260308270db7984",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 119,
"avg_line_length": 31.333333333333332,
"alnum_prop": 0.5786196159833938,
"repo_name": "awerries/lowcost-sensors",
"id": "d1b5d31636659dcb5dd449715abb86d3bfe53d71",
"s... |
import os
class LocalPathInfo(object):
def __init__(self, path_priority_groups):
self._path_priority_groups = self._ParseLocalPaths(path_priority_groups)
def GetLocalPath(self):
for priority_group in self._path_priority_groups:
priority_group = filter(os.path.exists, priority_group)
if not p... | {
"content_hash": "5321ca360f9369151b775f146e11b662",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 80,
"avg_line_length": 30.583333333333332,
"alnum_prop": 0.6793823796548593,
"repo_name": "XiaosongWei/chromium-crosswalk",
"id": "0103e8f7590c313491a3f3d8ef1d276134e91d39",
... |
from setuptools import setup, find_packages
f = open('README.rst')
readme = f.read()
f.close()
setup(
name='django-taggit',
version='0.12',
description='django-taggit is a reusable Django application for simple tagging.',
long_description=readme,
author='Alex Gaynor',
author_email='alex.gayno... | {
"content_hash": "c972f1fe2aad19723ca6619cc305ed05",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 85,
"avg_line_length": 30.358974358974358,
"alnum_prop": 0.597972972972973,
"repo_name": "laborautonomo/django-taggit",
"id": "8f301dcb7c2bb7e1e793cac4de706f368c954e1c",
"s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.