text stringlengths 4 1.02M | meta dict |
|---|---|
from __future__ import unicode_literals
"""Use blog post test to test user permissions logic"""
import frappe
import frappe.defaults
import unittest
import json
import frappe.model.meta
from frappe.core.page.user_permissions.user_permissions import add, remove, get_permissions
from frappe.permissions import clear_use... | {
"content_hash": "47facef448ada5ea67ee75576c00ab74",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 196,
"avg_line_length": 34.46296296296296,
"alnum_prop": 0.7190578542002508,
"repo_name": "bcornwellmott/frappe",
"id": "6ad0e84f079193d940426764b13258e9ca349ee2",
"size":... |
import icgauge
from icgauge import experiment_frameworks
print "Toy framework:"
print " Data: toy.json"
print " Features: transitinal phrases"
print " Labels: original 7-point scale"
print " Model: logistic regression (classification)"
print
experiment_frameworks.experiment_features(
train_reade... | {
"content_hash": "a14827d9ed09483379980af9833599f9",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 74,
"avg_line_length": 33.05,
"alnum_prop": 0.7473524962178517,
"repo_name": "ptoman/icgauge",
"id": "bc5dcb5c6ebca57f984c0331864075f8b3b0363d",
"size": "1090",
"binary":... |
import argparse
from googleapiclient import discovery
import httplib2
import json
import uuid
from oauth2client.client import GoogleCredentials
import csv
from optparse import OptionParser
DISCOVERY_URL = ('https://{api}.googleapis.com/'
'$discovery/rest?version={apiVersion}')
def main(filename):
'... | {
"content_hash": "40e52c7aced56b453df62356a431ff00",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 74,
"avg_line_length": 29.918032786885245,
"alnum_prop": 0.6586301369863014,
"repo_name": "phughk/GDC-KAH-Hackathon-AUG",
"id": "ea6a34cbf585ddcd392169eb75826beaaac3f707",
... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 12, transform = "Quantization", sigma = 0.0, exog_count = 100, ar_order = 0); | {
"content_hash": "77756b8b8e7008a42b33216d9c8b019e",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 168,
"avg_line_length": 38.285714285714285,
"alnum_prop": 0.7089552238805971,
"repo_name": "antoinecarme/pyaf",
"id": "5d0383ea0e5a3ed8d429bc16ad035a0459ad2431",
"size": "26... |
import subprocess
import sys
if __name__ == '__main__':
ref_name = sys.argv[1]
old_commit = sys.argv[2]
new_commit = sys.argv[3]
# check 1: allow branches other than master
if ref_name != 'refs/heads/master':
sys.exit()
# no need to check at this point if old_commit or new_commit are 0... | {
"content_hash": "077fe3abc7b124989a56e982f6f96819",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 112,
"avg_line_length": 42.111111111111114,
"alnum_prop": 0.6319261213720316,
"repo_name": "benjaminvialle/Markus",
"id": "521fe151795f77ac5e36a17596563d2d031ac0cb",
"size"... |
from __future__ import absolute_import, division, print_function
import getpass
import os
import time
import invoke
import requests
JENKINS_URL = "https://jenkins.cryptography.io/job/cryptography-wheel-builder"
def wait_for_build_completed(session):
# Wait 20 seconds before actually checking if the build is ... | {
"content_hash": "993071f97f30fdb66251bd301c5742b5",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 79,
"avg_line_length": 29.220183486238533,
"alnum_prop": 0.5795918367346938,
"repo_name": "bwhmather/cryptography",
"id": "74ff6b192cf1c1ca3b91e655171ddd4d8ebb5d4c",
"size... |
import yaml
import importlib
from functools import partial
from models.guassian_vae import VAE
from models.two_stage_vae import Stage2VAE
from models.vq_vae import VQVAE
from models.pixel_cnn import PixelCNN
from experiment import VAEModule, VAE2stageModule, VQVAEModule, PixelCNNModule
def get_config(fpath):
with... | {
"content_hash": "571d2d25a9cefba0d8534440928fd37f",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 104,
"avg_line_length": 32.57142857142857,
"alnum_prop": 0.6351909184726522,
"repo_name": "probml/pyprobml",
"id": "b45f07ddf56bfcbaa475b50aebc3ec75e88cfcbe",
"size": "387... |
from openstack_dashboard.utils import settings
import test.enabled
from tuskar_ui.test.settings import * # noqa
INSTALLED_APPS = list(INSTALLED_APPS) # Make sure it's mutable
settings.update_dashboards([test.enabled], HORIZON_CONFIG, INSTALLED_APPS)
| {
"content_hash": "16aaf89f6bea346af432234bd1be403b",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 74,
"avg_line_length": 36.285714285714285,
"alnum_prop": 0.7913385826771654,
"repo_name": "rdo-management/tuskar-ui-extras",
"id": "5c465be91b5e602d2aebd25f9195c20a0d9d85a4",
... |
"""
Model for quadrature amplitude modulation (QAM); contains `MQAM` class.
Revision Info
=============
* $LastChangedBy: mandke $
* $LastChangedDate: 2010-10-19 16:34:02 -0500 (Tue, 19 Oct 2010) $
* $LastChangedRevision: 4811 $
:author: Ketan Mandke <kmandke@mail.utexas.edu>
:copyright:
Copyright 2009 The Unive... | {
"content_hash": "4d3d5da0472d9de2af8b89fbae8d23a6",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 119,
"avg_line_length": 38.26938775510204,
"alnum_prop": 0.579244880546075,
"repo_name": "reidlindsay/wins",
"id": "ec429896958e207eb1ebbc3534d6d154b3671cff",
"size": "940... |
import os
from flask_script import Manager
from expert_tourist import create_app
app = create_app(os.environ.get('FLASK_CONFIG', 'config.DevConfig'))
manager = Manager(app)
@manager.command
def load_data():
from expert_tourist.models import PlaceLoader
loader = PlaceLoader()
loader.to_db()
if __name__ ... | {
"content_hash": "fd41c44ef4a424cf8a651158d86314a9",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 68,
"avg_line_length": 20.764705882352942,
"alnum_prop": 0.6997167138810199,
"repo_name": "richin13/expert-tourist",
"id": "cde7a1c79c354f79c818bda2894cc399ac7ff48b",
"size... |
from __future__ import absolute_import, unicode_literals
from wechatpy.client.api.base import BaseWeChatAPI
class MerchantExpress(BaseWeChatAPI):
def add(self, delivery_template):
return self._post(
'merchant/express/add',
data={
'delivery_template': delivery_templ... | {
"content_hash": "277d94c7943a9c57dbc733386ed35c6b",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 56,
"avg_line_length": 26.232558139534884,
"alnum_prop": 0.5212765957446809,
"repo_name": "EaseCloud/wechatpy",
"id": "9b43f105ee2e0ca17d0bce4f5d08d2fa5863efd1",
"size": "1... |
from sympy.parsing.sympy_parser import (
parse_expr,
standard_transformations,
convert_xor,
implicit_multiplication_application,
implicit_multiplication,
implicit_application,
function_exponentiation,
split_symbols,
split_symbols_custom,
_token_splittable
)
from sympy.utilities.p... | {
"content_hash": "6962a592c7f56748ca058ce01077eaf9",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 79,
"avg_line_length": 38.166666666666664,
"alnum_prop": 0.5563006862133499,
"repo_name": "lidavidm/sympy",
"id": "e7dbd265438431c0e11c3b5342de9111c4b1f1ef",
"size": "6412... |
from django.conf import settings
from keystoneclient.v2_0 import users, tenants, tokens, roles, ec2
from .utils import TestDataContainer
# Dummy service catalog with all service.
# All endpoint URLs should point to example.com.
# Try to keep them as accurate to real data as possible (ports, URIs, etc.)
SERVICE_CATAL... | {
"content_hash": "abbfaa4cba19d5359b2a81b4ce229fda",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 76,
"avg_line_length": 42.70289855072464,
"alnum_prop": 0.5277447819446801,
"repo_name": "asomya/test",
"id": "c2f6507d364ccb1137d29374b34333ffca8a63ba",
"size": "6498",
... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or path to database file if... | {
"content_hash": "43ef424e5ced9f42339855816a63fa93",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 127,
"avg_line_length": 34.33552631578947,
"alnum_prop": 0.68288944242192,
"repo_name": "Numerical-Brass/sensu-configs",
"id": "efcce9de473388ae3b95d1994b41ea043652be15",
... |
import os
import re
class Lean(object):
preferred_mappings = {}
template_mappings = {}
@staticmethod
def register(template_class,*extensions):
''' Register a template for a given extension or range of extensions '''
for ext in extensions:
ext = normalize(ext)
if not Lean.template_mappings.has_key(e... | {
"content_hash": "501eb4bf14f49884f1cb18ccf44e3aab",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 108,
"avg_line_length": 29.78048780487805,
"alnum_prop": 0.6828419328419328,
"repo_name": "OiNutter/lean",
"id": "2ae7c19ef53ca20e3a4c951624f8321fe841b61c",
"size": "4884"... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import unittest
from pants.base.validation import assert_list
class ParseValidation(unittest.TestCase):
def test_valid_inputs(self):
list_result0 = assert_lis... | {
"content_hash": "a0c4068bc9383ba38c4f48148f01be1a",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 115,
"avg_line_length": 50.03125,
"alnum_prop": 0.6914428482198626,
"repo_name": "digwanderlust/pants",
"id": "eec1c029df43ff1501b7c0ae0285b628ddba4129",
"size": "1748",
... |
import json
import requests
import six
import sys
import platform
from .version import __version__
class SlackRequest(object):
def __init__(self, proxies=None):
# __name__ returns 'slackclient.slackrequest', we only want 'slackclient'
client_name = __name__.split('.')[0]
client_version ... | {
"content_hash": "83155034174c1533f705fec967ded8d4",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 95,
"avg_line_length": 39.49411764705882,
"alnum_prop": 0.5793863568662496,
"repo_name": "skarlekar/chehara",
"id": "a7ac4adb0c94acd41e2f0f7ea0e46a28fe0f5876",
"size": "335... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('integration', '0002_dialersettings'),
]
operations = [
migrations.CreateModel(
name='HmacCalloutSettings',
fields=[
('id', models.AutoField(auto_crea... | {
"content_hash": "df09f59652bdd461e711d5f943dfb3bd",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 114,
"avg_line_length": 33.4,
"alnum_prop": 0.5389221556886228,
"repo_name": "dimagi/commcare-hq",
"id": "859d2acee21e4572b0c059cbf9748e21db13065a",
"size": "885",
"binar... |
from flask import Blueprint, redirect, render_template, request, url_for, session
from storage_functions import is_valid_user, add_pic_to_db, get_pics, delete_pic, get_text, getImage
import ipdb
from gcloud import storage
import six
from werkzeug import secure_filename
import datetime
picbook = Blueprint('picbook', __... | {
"content_hash": "8310de8d86a9d7b41f2b60f674cbb6fa",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 100,
"avg_line_length": 29.772727272727273,
"alnum_prop": 0.649236641221374,
"repo_name": "sanikasudhalkar/Projects",
"id": "153349334ff0d7326d37b2cef03167766dd56d13",
"siz... |
from __future__ import unicode_literals
from django.db import migrations
from dateutil.parser import parse as dt_parse
def pull_date_of_submission(apps, schema_editor):
Declaration = apps.get_model('core.Declaration')
for d in Declaration.objects.filter(nacp_declaration=True):
if d.source["intro"].g... | {
"content_hash": "a02a926266e09a3daac5f9b7e9b0b45a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 68,
"avg_line_length": 25.791666666666668,
"alnum_prop": 0.6591276252019386,
"repo_name": "dchaplinsky/pep.org.ua",
"id": "7248b31553481af4490cce0dde64c56ebf96c938",
"size"... |
from flask import render_template
# from flask_login import login_required, current_user
from . import doc
@doc.route('/')
def index():
return render_template('doc/index.html') | {
"content_hash": "4d5cb1778271df6a5584276b69fcad9c",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 54,
"avg_line_length": 25.857142857142858,
"alnum_prop": 0.7403314917127072,
"repo_name": "cmacro/mogufsite",
"id": "3084df0c061b025c049b4b96f7ebc094b0e3c626",
"size": "181"... |
import unittest
from .. import AuthProxy
from .. import HelpScout
from ..apis import __all__ as all_apis
class TestHelpScout(unittest.TestCase):
API_KEY = 'test key'
def setUp(self):
super(TestHelpScout, self).setUp()
self.hs = HelpScout(self.API_KEY)
def test_init_session(self):
... | {
"content_hash": "1c796a6c8053e3dcc2c7b2e6453ee756",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 72,
"avg_line_length": 31.9375,
"alnum_prop": 0.6389432485322897,
"repo_name": "LasLabs/python-helpscout",
"id": "4af0b69f48b9eef8afa8188bee514c68c1ecd340",
"size": "1136",... |
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import print_function
__author__ = "czerwin@scalyr.com"
import os
import copy
import io
if False:
from typing import TextIO
from typing import List
from typing import Optional
from typing import Generator
... | {
"content_hash": "47afebfef8eb2ba50c6e18585816f66f",
"timestamp": "",
"source": "github",
"line_count": 1101,
"max_line_length": 120,
"avg_line_length": 41.02724795640327,
"alnum_prop": 0.5900024351907197,
"repo_name": "scalyr/scalyr-agent-2",
"id": "8cb9f28becf0c8e2255cba96eea7463bf44799c5",
"size... |
"""The SRP Energy integration."""
import logging
from srpenergy.client import SrpEnergyClient
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ID, CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady... | {
"content_hash": "e38f1d0cfe720fbc61ebf47a73263bfe",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 78,
"avg_line_length": 32.18604651162791,
"alnum_prop": 0.713150289017341,
"repo_name": "lukas-hetzenecker/home-assistant",
"id": "76d344415d6302df501d8e19fd5c86d70a4af8f6",
... |
import os
import sys
import unittest
from shared import StreamCapture, TemporaryDirectory
class TestSharedTestModule(unittest.TestCase):
"""
Tests the test.shared methods.
"""
def test_stream_capture(self):
# Tests the StreamCapture class.
# Test stdout capture
t1 = 'Hello e... | {
"content_hash": "20de61c76f75759705fac4b18ff0e447",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 67,
"avg_line_length": 28.943661971830984,
"alnum_prop": 0.5625304136253041,
"repo_name": "martinjrobins/hobo",
"id": "21b2961141858e79a06c6d377a237191122280f3",
"size": "2... |
import logging
from gym.envs.doom import doom_env
logger = logging.getLogger(__name__)
class DoomDefendLineEnv(doom_env.DoomEnv):
"""
------------ Training Mission 4 - Defend the Line ------------
This map is designed to teach you how to kill and how to stay alive.
Your ammo will automatically replen... | {
"content_hash": "5359d55e8c09874e63ce9c6d77da642e",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 91,
"avg_line_length": 36.12244897959184,
"alnum_prop": 0.5576271186440678,
"repo_name": "d1hotpep/openai_gym",
"id": "9c3250c5010f5ea9b42c4087f333e2e3c28c56b3",
"size": "1... |
'''
#####################################################################
MIT License
Copyright (c) 2016 SevData
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including wit... | {
"content_hash": "0437a07ff4946e739ebe2f1a1a02241a",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 78,
"avg_line_length": 30.328125,
"alnum_prop": 0.6805770221535291,
"repo_name": "SevData/fast_kmeans",
"id": "1bb2a5059ff1d25534503d80c2db2fa95716d953",
"size": "1941",
... |
import re, inspect, textwrap, pydoc
import sphinx
from docscrape import NumpyDocString, FunctionDoc, ClassDoc
class SphinxDocString(NumpyDocString):
def __init__(self, docstring, config={}):
self.use_plots = config.get('use_plots', False)
NumpyDocString.__init__(self, docstring, config=config)
... | {
"content_hash": "6bc8182e4bb6667255929c2acce5d68a",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 78,
"avg_line_length": 33.92070484581498,
"alnum_prop": 0.47493506493506493,
"repo_name": "chintak/scikit-image",
"id": "9e66c4be8f186e214e945854bfe39269d44ed5dd",
"size":... |
import logging
from logging.handlers import RotatingFileHandler, HTTPHandler
from kokemomo.settings import SETTINGS
__author__ = 'hiroki'
class KMLoggingHandlerList(object):
__instance = None
handlers = {}
def __new__(cls, *args, **keys):
if cls.__instance is None:
cls.__instance = ob... | {
"content_hash": "9f5bf3a98ad25e6357c86a2f483016c8",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 92,
"avg_line_length": 38.20987654320987,
"alnum_prop": 0.6426494345718902,
"repo_name": "Kokemomo/Kokemomo",
"id": "d6983132289c3283d979782b9398118b7073e5c6",
"size": "314... |
print(__doc__)
from time import time
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.decomposition import PCA
from sklearn import metrics
from sklearn.cluster import KMeans
from sklearn.datasets import load_digits
from sklearn.decomposition import PCA
from sklearn.preprocessing impo... | {
"content_hash": "0c8667475135f6cbc0611327eba71dc5",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 419,
"avg_line_length": 35.51648351648352,
"alnum_prop": 0.7306621287128713,
"repo_name": "georgetown-analytics/skidmarks",
"id": "59510ffecfbcb566fb48b3a89630cd8b7eed0bcb",... |
import pystache
from pystache.locator import Locator
import os
from pystache.loader import Loader
from pystache.renderer import Renderer
# from pystache.tests.examples.readme import SayHello
TEMPLATE_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)) + os.sep, "htmlsrc/_templates/")
CLASS_TEMPLATE_DIR = os... | {
"content_hash": "8ec8a278118039a48bc71141ed8820d9",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 104,
"avg_line_length": 31.297520661157026,
"alnum_prop": 0.5444943226828625,
"repo_name": "sosolimited/Cinder",
"id": "529de8fbe2ae81fad2d8271c3e7de542b5d125e8",
"size": ... |
from utils.munin.base import MuninGraph
class NBMuninGraph(MuninGraph):
@property
def graph_config(self):
graph = {
'graph_category' : 'NewsBlur',
'graph_title' : 'NewsBlur App Server Times',
'graph_vlabel' : 'Page load time / server',
'graph_args' : '-l... | {
"content_hash": "cf4af492f2cea34a8455e508a8eddb18",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 83,
"avg_line_length": 28.4375,
"alnum_prop": 0.4747252747252747,
"repo_name": "dosiecki/NewsBlur",
"id": "86c092c36032b5bd790bbfaf4f029c72e30847cc",
"size": "1406",
"bin... |
from __future__ import absolute_import, division, print_function
from ibeis_cnn import utils, draw_net
import utool as ut
import numpy as np
import lasagne
from lasagne import objectives
import theano.tensor as T
from lasagne import layers
import warnings
import theano
print, rrr, profile = ut.inject2(__name__, '[ibeis... | {
"content_hash": "2b0718627e91deda53caa9df730d94e1",
"timestamp": "",
"source": "github",
"line_count": 521,
"max_line_length": 125,
"avg_line_length": 36.783109404990405,
"alnum_prop": 0.6212690461281569,
"repo_name": "bluemellophone/ibeis_cnn",
"id": "2ae9c862e1147464b282c987d7bee29e4acbe0e2",
"s... |
from asyncio import coroutine
from http.cookies import SimpleCookie
from isperdal.utils import mount
def cookie(this, req, res):
"""
>>> from isperdal.request import Request
>>> from isperdal.response import Response
>>> from isperdal import Node as u
>>> from asyncio import coroutine, get_event... | {
"content_hash": "6cc3fb5aa6f0a607d9d92358ed2597e2",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 77,
"avg_line_length": 27.5,
"alnum_prop": 0.5125307125307126,
"repo_name": "quininer/isperdal",
"id": "0ac5dc9429a95e1e9b8493d0447a6cd11c52dfe7",
"size": "2035",
"binary... |
import random
def getList(nameOfFile):
'''
Input the text file's name of the form 'nameOfFile.txt'.
Give a name of a file that links to a .txt file. The name should be >= 4 in length.
Outputs a list where each element is a line from the text file.
This is an auxiliary function.
'''
#if they... | {
"content_hash": "e60e8797c87b1fbd7e6a868a1bd114b2",
"timestamp": "",
"source": "github",
"line_count": 1177,
"max_line_length": 130,
"avg_line_length": 44.12659303313509,
"alnum_prop": 0.6076592795117162,
"repo_name": "AimeeHendrycks/PAAIST",
"id": "7aabedd0c13ff7a0bf31b32030f7ca07d7ff97d9",
"size... |
from __future__ import print_function
import getpass
import os
import string
import sys
from catkin_pkg.cmake import configure_file
from catkin_pkg.cmake import get_metapackage_cmake_template_path
from catkin_pkg.package import Dependency
from catkin_pkg.package import Package
from catkin_pkg.package import PACKAGE_M... | {
"content_hash": "e1a25b49d1bd6885009fa20c18d4be9b",
"timestamp": "",
"source": "github",
"line_count": 407,
"max_line_length": 156,
"avg_line_length": 40.54299754299754,
"alnum_prop": 0.5739652142294407,
"repo_name": "ipa-mdl/catkin_pkg",
"id": "4ac5c8ee90d8a75ce3313a45acff2b16c83c11b3",
"size": "... |
from enum import Enum
class UpgradeMode(Enum):
manual = "Manual"
automatic = "Automatic"
class RetentionPeriod(Enum):
session = "Session"
persistent = "Persistent"
class CredentialDataFormat(Enum):
rsa_encrypted = "RsaEncrypted"
class PromptFieldType(Enum):
string = "String"
secu... | {
"content_hash": "35120c5b948bbddb47717f6bc86c2579",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 35,
"avg_line_length": 14.5,
"alnum_prop": 0.685823754789272,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "625d99532693612bead31bfe58e62dd53cdcd7a1",
"size": "996... |
"""Module that contains supplementary functions that are needed to run drop."""
import os
import json
def load_JSON(filename):
"""Return data from json-format file."""
with open(filename) as data_file:
data = json.load(data_file)
return data
def write_fancy_JSON(filename, data):
"""Write js... | {
"content_hash": "8ef5ec04d855a179c4b66b6eec14b81f",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 79,
"avg_line_length": 29.217054263565892,
"alnum_prop": 0.6367736800212258,
"repo_name": "infant-cognition-tampere/drop",
"id": "ea463e2d90647844e3b34ae3d845ae5f7a55adef",
... |
import logging
try:
from urlparse import urlparse
except ImportError:
# python 3
from urllib.parse import urlparse
from django.conf import settings
from django.views.decorators.cache import never_cache
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_protect... | {
"content_hash": "a7e39318df593aae2dda3da7014810da",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 102,
"avg_line_length": 38.29608938547486,
"alnum_prop": 0.6851932895696572,
"repo_name": "skolsuper/django-rest-social-auth",
"id": "54b3bb9226f724ae25d5637e5b3b647597ca158... |
from helene.app import app
app.debug = True
app.run('0.0.0.0', 5010, threaded = True, use_reloader = True, use_debugger = True) | {
"content_hash": "c58d30614b1105d5c3fdfd5f998e979b",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 83,
"avg_line_length": 25.8,
"alnum_prop": 0.6976744186046512,
"repo_name": "voidpp/Helene",
"id": "70989fb3f380a8009e181f8a766bda656b9cc5c4",
"size": "130",
"binary": fal... |
"""
Remove all weights from an FST.
"""
import argparse
import fst
def main(args):
L = fst.read(args.fst_file)
for state in L:
for arc in state:
arc.weight = L.SEMIRING(0.0)
L.write(args.fst_file, keep_isyms=True, keep_osyms=True)
if __name__ == '__main__':
parser = argparse.A... | {
"content_hash": "fb133a255e5ec16ccb0218bc4252b0fc",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 68,
"avg_line_length": 21.25,
"alnum_prop": 0.615686274509804,
"repo_name": "rizar/attention-lvcsr",
"id": "993bf9b871545140d362f35205988ab32df40a8a",
"size": "533",
"bin... |
"""
laser_scan
==========
Class for controlling the Pharos setup. Everything revolves around triggering the scan of a laser and acquiring
signals of different devices via an NI-DAQ card.
Ultimately it should also be able to change values of serial devices.
"""
import numpy as np
import logging
fro... | {
"content_hash": "4b2126633cd3092667844aeaa5090909",
"timestamp": "",
"source": "github",
"line_count": 324,
"max_line_length": 129,
"avg_line_length": 42.25925925925926,
"alnum_prop": 0.5801928133216476,
"repo_name": "uetke/experimentor",
"id": "7a2068c7ece8a8c093e6bf24b14407b002674e45",
"size": "... |
import logging
import itertools
import mimetools
import mimetypes
from cStringIO import StringIO
import urllib2
logger = logging.getLogger(__name__)
class MultiPartForm(object):
"""Accumulate the data to be used when posting a form."""
def __init__(self):
self.form_fields = []
self.files = ... | {
"content_hash": "622bfb6abf3f207f1b4fc326819228d0",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 74,
"avg_line_length": 30.375,
"alnum_prop": 0.5796138018360241,
"repo_name": "aaryani/CoreTardisTemp",
"id": "967002194460ccbc4513b85db1147230e3680a31",
"size": "3206",
... |
"""
pytorch
Python SDK for PyTorch-Operator # noqa: E501
OpenAPI spec version: v0.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
from kubeflow import pytorchjob
from kubeflow.pytorchjob.models.v1_replica_status im... | {
"content_hash": "fd069438473085a4c7095fc9b131abcd",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 86,
"avg_line_length": 22.81578947368421,
"alnum_prop": 0.6874279123414071,
"repo_name": "kubeflow/pytorch-operator",
"id": "ea75c5d378318a4dbff7e7f66de90d6c5a9cc05e",
"siz... |
__author__ = 'Kevin Wurster'
__version__ = '0.1'
__copyright__ = 'Copyright SkyTruth 2014'
__license__ = 'New BSD (See LICENSE.txt)'
import os
import sys
import json
from os.path import isfile
def print_usage():
print("")
print("Usage: task.json task_run.json outfile.txt [options]")
print("")
print(... | {
"content_hash": "15a8e15fc88349f26f6f79586f92d5d2",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 120,
"avg_line_length": 34.344339622641506,
"alnum_prop": 0.5675044636725725,
"repo_name": "SkyTruth/CrowdProjects",
"id": "3460a2b2e7abcbfd081f9cd36b35bcbbaa9d698a",
"siz... |
from django.db import models
from event import models as event_models
from asset import models as asset_models
# Create your models here.
class UserProfile(models.Model):
name = models.CharField(u'名字', max_length=32)
email = models.EmailField(u'邮箱')
mobile = models.CharField(u'手机', max_length=32)
wec... | {
"content_hash": "e7cdce5e64f45be80196a0d57513a2ed",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 69,
"avg_line_length": 28.975,
"alnum_prop": 0.6885245901639344,
"repo_name": "zhaogaolong/oneFinger",
"id": "ef4518af5c22446ab6417c549c1f506620899a08",
"size": "1283",
"... |
"""
//******************************************************************************************
// SGDI, Práctica 1, Apartado 2: TEMPERATURA
// Dan Cristian Rotaru y Gorka Suárez García
//******************************************************************************************
Ahora vamos a utilizar el fichero JCMB_... | {
"content_hash": "98dc3a8497c860198c28ab2f6f64eb13",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 92,
"avg_line_length": 33.05084745762712,
"alnum_prop": 0.6210256410256411,
"repo_name": "gorkinovich/SGDI",
"id": "bdecd260deada54387219969c56c565a8f4571cd",
"size": "2007... |
"""
Missing batteries from Python
"""
from datetime import datetime
import inspect
import os
import random
from builtins import object
from past.builtins import basestring
from mock import Mock
from dateutil import parser
from pytz import utc
if hasattr(inspect, 'getfullargspec'): # pragma: nocover
getargspec... | {
"content_hash": "c0796684bf3b11e3dc0ad8f9fb016f3e",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 98,
"avg_line_length": 29.564853556485357,
"alnum_prop": 0.6309085762807812,
"repo_name": "corydodt/Codado",
"id": "bf1e62a16f161b8ecd4e57a2ce6d5b97ecfc1243",
"size": "716... |
import atheris
import sys
from confluent_kafka import Consumer, KafkaException, TopicPartition
def TestInput(data):
fdp = atheris.FuzzedDataProvider(data)
def dummy_callback(err, partitions):
pass
try:
c = Consumer({
'group.id': fdp.ConsumeConsumeUnicodeNoSurrogates(10),
... | {
"content_hash": "4b373a282d641d65c2a0af3a39e92806",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 106,
"avg_line_length": 25.555555555555557,
"alnum_prop": 0.5838509316770186,
"repo_name": "skia-dev/oss-fuzz",
"id": "a94daad3f926531f76a47caa3de216088b63ea32",
"size": "2... |
from django.conf.urls import include, url
# from django.conf.urls import include #non utilise actuellement
from . import views, outils
from .io import import_csv, export_csv, lecture_plist
from .io import import_titre_csv as import_titres
from django.conf import settings
from django.contrib.staticfiles.urls import stat... | {
"content_hash": "f2603bf96ac26baa16c01fc5a5a7011a",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 124,
"avg_line_length": 58.76767676767677,
"alnum_prop": 0.559126847713991,
"repo_name": "pfrancois/grisbi_django",
"id": "426fe651e23d53ba164735574e6e5078f3d62500",
"size"... |
import logging
import sys
from telemetry import benchmark
from telemetry.core import browser_options
from telemetry.core import discover
from telemetry.core import util
from telemetry.core import wpr_modes
from telemetry.page import page_runner
from telemetry.page import page_set
from telemetry.page import page_test
f... | {
"content_hash": "0a5e390696337ca4ef64ad3bb01165a6",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 80,
"avg_line_length": 35.09090909090909,
"alnum_prop": 0.7040536421822615,
"repo_name": "littlstar/chromium.src",
"id": "7d67d68455f816eec26d59df5cb0b6f549613e9b",
"size"... |
"""
DTB merge : merge dtb2 into db1, replace properties of dtb1 with properties of dtb2
@author: Neil 'superna' Armstrong <superna9999@gmail.com>
"""
import argparse
from pyfdt.pyfdt import FdtBlobParse, FdtJsonParse, FdtFsParse
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Device Tree... | {
"content_hash": "c7ec4fc6ed5bf78f3e4a9d2912dea384",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 132,
"avg_line_length": 40.07272727272727,
"alnum_prop": 0.6234119782214156,
"repo_name": "superna9999/pyfdt",
"id": "a97c3bf15d946816dcccfcecf8a0441f9c2f1d5b",
"size": "22... |
import argparse
import asyncio
import aiohttp
async def curl(url: str) -> None:
async with aiohttp.ClientSession() as session:
async with session.request("GET", url) as response:
print(repr(response))
chunk = await response.content.read()
print("Downloaded: %s" % len(c... | {
"content_hash": "3385dc649b8c1f8fa1373f45429e5cf7",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 76,
"avg_line_length": 27.939393939393938,
"alnum_prop": 0.6268980477223427,
"repo_name": "KeepSafe/aiohttp",
"id": "c3b54da6af2ecf662c001a244522ffa77b4d83b3",
"size": "946... |
import os
import sys
import math
from operator import itemgetter
from collections import OrderedDict
#==============================================================================|
#@name: get_filenames_from_dir(corpus_dir) |
#@input: Path to directory where corpus files are present. |
#@output: L... | {
"content_hash": "7a9d056883a79015caa4a631e85a8549",
"timestamp": "",
"source": "github",
"line_count": 181,
"max_line_length": 84,
"avg_line_length": 36.828729281767956,
"alnum_prop": 0.5414041404140414,
"repo_name": "inutan/MiniSearchEngine",
"id": "1f4146fd8c48fa279c3135780b28d922cd809b58",
"siz... |
import re
import csv
import json
import logging
import collections
from StringIO import StringIO
log = logging.getLogger(__name__)
import requests
from bs4 import BeautifulSoup
_default_api = None
BASE = 'https://client.schwab.com'
DEFAULT_SESSION_PATH = "./session.json"
MAX_REAUTH_ATTEMPTS = 1
class AuthError(Ke... | {
"content_hash": "075491571a536a7122ad9929011757f9",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 78,
"avg_line_length": 30.572,
"alnum_prop": 0.5300274761219417,
"repo_name": "gnrhxni/schwab",
"id": "583a9c46c582a718d17a00705e8db410fe0ebca4",
"size": "7644",
"binary... |
from django.db import models
from django.contrib import admin
class Blog(models.Model):
title = models.CharField(max_length=100)
body = models.TextField()
created = models.DateTimeField(auto_now_add = True)
updated = models.DateTimeField(auto_now = True)
def __unicode__(self):
return str(s... | {
"content_hash": "527ccca256e9564806b18305b551fd10",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 72,
"avg_line_length": 29.073170731707318,
"alnum_prop": 0.6862416107382551,
"repo_name": "theicfire/djangofun",
"id": "ab43e8fd8bafafc5fe46e61231361876d73654c6",
"size": "... |
from django.conf.urls import *
from django.contrib import admin
from rest_framework_jwt.views import obtain_jwt_token
from apps.api import urls as api_urls
from apps.web import urls as web_urls
urlpatterns = (
url(r'', include(web_urls)),
url(r'^api/', include(api_urls)),
url(r'^api-auth/', include('rest_f... | {
"content_hash": "613ebaa1660deddba032f44c6bd8a45d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 83,
"avg_line_length": 35.23076923076923,
"alnum_prop": 0.6986899563318777,
"repo_name": "dejwoo/xp_project",
"id": "4eb54efa529128498fd8fdd000736401c27a7d7f",
"size": "458... |
import six
import unittest
from airflow import configuration, AirflowException
from airflow.models.connection import Connection
from airflow.utils import db
from mock import patch, call
from airflow.contrib.hooks.spark_submit_hook import SparkSubmitHook
class TestSparkSubmitHook(unittest.TestCase):
_spark_job_... | {
"content_hash": "73143be21a03a523637e50b523d38cfb",
"timestamp": "",
"source": "github",
"line_count": 598,
"max_line_length": 90,
"avg_line_length": 41.94314381270903,
"alnum_prop": 0.5500358823060362,
"repo_name": "adamhaney/airflow",
"id": "a31e79cdcc3b2f7c598c1da6d35033dc76a3bbaf",
"size": "25... |
from vectortween.Animation import Animation
class PauseAnimation(Animation):
"""
class that keeps returning the same values over and over again
"""
def __init__(self, frm):
super().__init__(frm, frm)
def make_frame(self, frame, birthframe, startframe, stopframe, deathframe, noiseframe=No... | {
"content_hash": "213531167e71cf117ae1463e102439e4",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 96,
"avg_line_length": 26.846153846153847,
"alnum_prop": 0.673352435530086,
"repo_name": "shimpe/pyvectortween",
"id": "ff8d0892a7ca35fd080381214129f95906fd807c",
"size": "... |
from msrest.paging import Paged
class GeoBackupPolicyPaged(Paged):
"""
A paging container for iterating over a list of :class:`GeoBackupPolicy <azure.mgmt.sql.models.GeoBackupPolicy>` object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key'... | {
"content_hash": "e807c09a92f0c2fb6019f4fa4e377506",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 123,
"avg_line_length": 29.8125,
"alnum_prop": 0.6184486373165619,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "7a207daa100e2f4a49343f1529bb91198c843f3b",
"size": "9... |
"""Test apple core correction"""
import multiprocessing as mp
import sys
import numpy as np
import odtbrain
from common_methods import create_test_sino_3d, cutout, \
get_test_parameter_set, write_results, get_results
WRITE_RES = False
def test_apple_core_3d_values():
try:
odtbrain.apple.apple_cor... | {
"content_hash": "0bd30afa3eb6de6ca54f759623f2a303",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 79,
"avg_line_length": 31.485714285714284,
"alnum_prop": 0.49758015728977617,
"repo_name": "RI-imaging/ODTbrain",
"id": "6defd9f81da9b9c1e5b3f744b37961b5eb45de5f",
"size":... |
"""
Ignore the unused imports, this file's purpose is to make visible
anything which a user might need to import from newspaper.
View newspaper/__init__.py for its usage.
"""
__title__ = 'newspaper'
__author__ = 'Lucas Ou-Yang'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014, Lucas Ou-Yang'
import feedparser
from... | {
"content_hash": "07e74adc1f073f35bab44f5cbbde154a",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 65,
"avg_line_length": 26.58823529411765,
"alnum_prop": 0.6598451327433629,
"repo_name": "curita/newspaper",
"id": "c308d1f4bf549eaa5079c0daa5e6d8ff2297ca87",
"size": "1832... |
""" Base class for Nikola test cases """
__all__ = ["BaseTestCase", "cd", "LocaleSupportInTesting"]
import os
import sys
from contextlib import contextmanager
import locale
import unittest
import logbook
import nikola.utils
import nikola.shortcodes
nikola.utils.LOGGER.handlers.append(logbook.TestHandler())
fro... | {
"content_hash": "0cb63b0bcc58c8cf9c7f8a43d2820045",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 105,
"avg_line_length": 35.27312775330397,
"alnum_prop": 0.585487698264019,
"repo_name": "wcmckee/nikola",
"id": "2322c157aa566a2cf665d25dea91615345be2131",
"size": "8067"... |
from __future__ import unicode_literals
from allauth.socialaccount.providers import registry
from allauth.socialaccount.tests import create_oauth2_tests
from allauth.tests import MockedResponse
from .provider import FeishuProvider
class FeishuTests(create_oauth2_tests(registry.by_id(FeishuProvider.id))):
def ge... | {
"content_hash": "b2718860566a5854e51eab461dc8b354",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 81,
"avg_line_length": 37.2,
"alnum_prop": 0.46774193548387094,
"repo_name": "pennersr/django-allauth",
"id": "57582a2ea70f0ea1327791a1a8fd27b0a2c33064",
"size": "1699",
... |
from __future__ import division, absolute_import, print_function
import re
import os
import sys
import warnings
import platform
import tempfile
import hashlib
import base64
from subprocess import Popen, PIPE, STDOUT
from copy import copy
from numpy.distutils.fcompiler import FCompiler
from numpy.distutils.exec_command... | {
"content_hash": "236d275e18bf66fb339d33d346562ab4",
"timestamp": "",
"source": "github",
"line_count": 539,
"max_line_length": 80,
"avg_line_length": 36.66604823747681,
"alnum_prop": 0.5278550827303548,
"repo_name": "ryfeus/lambda-packs",
"id": "0ebbe79dc293b356b31e47969ae904c3d6315b8b",
"size": "... |
from abstract_classes import MultipleWinnerVotingSystem
from common_functions import matching_keys
import types
import copy
class PluralityAtLarge(MultipleWinnerVotingSystem):
def __init__(self, ballots, tie_breaker=None, required_winners=1):
super(PluralityAtLarge, self).__init__(ballots, tie_breaker=ti... | {
"content_hash": "20f439c8e664166a8e57cf38d256cce0",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 115,
"avg_line_length": 39.71666666666667,
"alnum_prop": 0.6382710868652959,
"repo_name": "hasadna/OpenCommunity",
"id": "2954476c056a41d0a2117c38e8b9347b942857d4",
"size":... |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
Remove built image (this only makes sense if you store the image in some registry first)
"""
from atomic_reactor.plugin import PostBuildPlugin
f... | {
"content_hash": "eec2b5978210efb69885944103e49c8d",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 98,
"avg_line_length": 38.77049180327869,
"alnum_prop": 0.5873150105708245,
"repo_name": "TomasTomecek/atomic-reactor",
"id": "b0923cc6ffe87cb55a3138a07e90647f4054746e",
"s... |
import unittest
import numpy as np
import scipy.stats
import paddle
import config
import parameterize
from paddle.distribution.gumbel import Gumbel
paddle.enable_static()
@parameterize.place(config.DEVICES)
@parameterize.parameterize_cls(
(parameterize.TEST_CASE_NAME, 'loc', 'scale'),
[
('one-dim'... | {
"content_hash": "386c6aaf56ae20aca2ae0a3f023c8c87",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 80,
"avg_line_length": 32.569148936170215,
"alnum_prop": 0.5577331373509717,
"repo_name": "luotao1/Paddle",
"id": "7e0176dee561ced3def871d4f2ab92eb00a61a7f",
"size": "6734... |
from BeautifulSoup import BeautifulSoup
import urllib2
import re
import urllib
import os
# TODO: take into account relative URLS.
# ==============================================================================
# DOWNLOAD_LINKS_FROM_PAGE
# ========================... | {
"content_hash": "4566e8541478c230ed78e13c02827aa1",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 84,
"avg_line_length": 42.27450980392157,
"alnum_prop": 0.4928107606679035,
"repo_name": "ronrest/convenience_py",
"id": "0b75656bbe65284548a927cf7f339173827836f3",
"size"... |
'''
Support for Apache
Please note: The functions in here are Debian-specific. Placing them in this
separate file will allow them to load only on Debian-based systems, while still
loading under the ``apache`` namespace.
'''
from __future__ import absolute_import
# Import python libs
import os
import logging
# Import... | {
"content_hash": "4f9e6811711dbc6cb82ffb3ee1a499b0",
"timestamp": "",
"source": "github",
"line_count": 326,
"max_line_length": 80,
"avg_line_length": 22.819018404907975,
"alnum_prop": 0.5943003091813416,
"repo_name": "stephane-martin/salt-debian-packaging",
"id": "191d8e408074e94152a507c130003f25bf2... |
import pymic as mic
import numpy as np
# load the library with the kernel function (on the target)
device = mic.devices[0]
library = device.load_library('libdouble_it_lowlevel.so')
stream = device.get_default_stream()
na = np.arange(1, 33)
# allocate memory on the device and get real device pointer of it
a = stream.... | {
"content_hash": "993f6ee93de79a0c3d6ffd7d67b52fb6",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 65,
"avg_line_length": 27.37037037037037,
"alnum_prop": 0.7631935047361299,
"repo_name": "01org/pyMIC",
"id": "98b82b394ec37008b35ef6c10e4fba54b1516edd",
"size": "2303",
... |
from federatedml.framework.homo.blocks.base import HomoTransferBase
from federatedml.util import consts
class HasConvergedTransVar(HomoTransferBase):
def __init__(self, server=(consts.ARBITER,), clients=(consts.GUEST, consts.HOST), prefix=None):
super().__init__(server=server, clients=clients, prefix=pref... | {
"content_hash": "cb7421181e3ae592fc7437f6dd9cc2b3",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 102,
"avg_line_length": 40.71875,
"alnum_prop": 0.6976208749040675,
"repo_name": "FederatedAI/FATE",
"id": "c131087fb6bdbde468399e1751e1004f432344e6",
"size": "1919",
"bi... |
import json
from datetime import datetime
from sdcclient._common import _SdcCommon
class EventsClientV2(_SdcCommon):
def __init__(self, token="", sdc_url='https://app.sysdigcloud.com', ssl_verify=True, custom_headers=None):
super().__init__(token, sdc_url, ssl_verify, custom_headers)
self.product... | {
"content_hash": "e9763090222b240419669ae7ec928014",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 172,
"avg_line_length": 43.63461538461539,
"alnum_prop": 0.5760246804759807,
"repo_name": "draios/python-sdc-client",
"id": "ecc27fa98035e6f3285aca2a28e4a9ea20b7d620",
"si... |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.test import APITestCase
class CreateThreadsTest(APITestCase):
fixtures = ['test_data/users.json', 'test_data/convo_threads.json', 'test_data/convo_messages.json']
def ... | {
"content_hash": "7452fad71fd75a40f235ca038572ddcc",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 104,
"avg_line_length": 36.34065934065934,
"alnum_prop": 0.5198064711218627,
"repo_name": "jessehon/etsy-convos",
"id": "ef4832c3bb553a4e461aca27a1a4f662e29d82a5",
"size": ... |
from .shortcuts import (
define_relationship,
get_relationship,
get_connection,
create_connection,
connection_exists,
connections_from_object,
connections_to_object,
connected_objects,
connected_to_objects,
)
VERSION = (0, 2, 0, 'final', 1)
default_app_config = 'connections.apps.Co... | {
"content_hash": "333f9a1610d9d4276d83f18247448288",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 57,
"avg_line_length": 22.466666666666665,
"alnum_prop": 0.6973293768545994,
"repo_name": "dfunckt/django-connections",
"id": "28365d2aae662be76b04eb7db02455bb75529a3f",
"s... |
"""
hyper/http20/window
~~~~~~~~~~~~~~~~~~~
Objects that understand flow control in hyper.
HTTP/2 implements connection- and stream-level flow control. This flow
control is mandatory. Unfortunately, it's difficult for hyper to be
all that intelligent about how it manages flow control in a general case.
This module d... | {
"content_hash": "aa349f5a9d2288a948e912a53a788050",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 79,
"avg_line_length": 40.071895424836605,
"alnum_prop": 0.6812917957918774,
"repo_name": "fredthomsen/hyper",
"id": "a4e13c3c1509fc3077cad18831c6bcf96c6f79aa",
"size": "6... |
from django.db import models
# Response Codes
# APPROVED, DECLINED, ERROR, FRAUD_REVIEW = 1, 2, 3, 4
class AuthorizeAIMResponse(models.Model):
RESPONSE_CODES = [
(1, 'Approved'),
(2, 'Declined'),
(3, 'Error'),
(4, 'Held for Review'),
]
ADDRESS_VERIFICATION_RESPONSE = [
... | {
"content_hash": "01802972a079598bd8d5d457a7573fe3",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 132,
"avg_line_length": 45.311688311688314,
"alnum_prop": 0.6572083691602179,
"repo_name": "mjrulesamrat/merchant",
"id": "c3a60c4c149d25e9d94c002ec1aadb60257df1d6",
"size"... |
default_app_config = 'volunteers.apps.VolunteersConfig'
| {
"content_hash": "f6d01426d8e7abc5d331cf4a833f9278",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 55,
"avg_line_length": 56,
"alnum_prop": 0.8214285714285714,
"repo_name": "mrts/foodbank-campaign",
"id": "4c0e3287af6729f8954ccb850c537d5070cc0592",
"size": "56",
"binary... |
'''
py-translate
============
A Translation Tool for Humans
'''
from .translator import *
from .languages import *
from .coroutines import *
from .tests import TestTranslator, TestLanguages
from .__version__ import __version__
from .__version__ import __build__
__title__ = 'py-translate'
__author__ = 'Sang Ha... | {
"content_hash": "dc9c7d04808cef017730439045285faf",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 53,
"avg_line_length": 22.944444444444443,
"alnum_prop": 0.6537530266343826,
"repo_name": "jjangsangy/py-translate",
"id": "24d7bd75cbbdb1df433dec774b7cffea5e03cb34",
"size... |
from __future__ import absolute_import, unicode_literals
from optionaldict import optionaldict
from teambition.api.base import TeambitionAPI
class Collections(TeambitionAPI):
def get(self, id=None, parent_id=None):
"""
获取文件集
详情请参考
http://docs.teambition.com/wiki/collections#coll... | {
"content_hash": "f84d094fa8f672678a26f2f002b6a974",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 73,
"avg_line_length": 25.149253731343283,
"alnum_prop": 0.5347181008902078,
"repo_name": "messense/teambition-api",
"id": "aed736c1d2bbad4931dd8ac11f0a9d98f10aa47f",
"siz... |
from django.utils.encoding import force_unicode
from django.utils.functional import allow_lazy
def truncate_letters(s, num):
""" truncates a string to a number of letters, similar to truncate_words """
s = force_unicode(s)
length = int(num)
if len(s)>length:
s = s[:length]
if not s.endswith('...'):
... | {
"content_hash": "5bf960b03bb661adcb80f677e00a29ab",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 80,
"avg_line_length": 31.153846153846153,
"alnum_prop": 0.674074074074074,
"repo_name": "indro/t2c",
"id": "f0f6429d3ca2d1134d40774db752581fc357e8e6",
"size": "405",
"bi... |
"""collections.deque"""
from collections import deque
queue = deque(["Lily", "JB", "Leia", "Hachi"])
queue.append("Luke")
first = queue.popleft()
print("First : " + first)
first = queue.popleft()
print("First : " + first)
for value in queue:
print("Name : " + value)
print("Value in loop still exists as "+ valu... | {
"content_hash": "43f721e79c1ea04f315bb36b455b54f2",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 46,
"avg_line_length": 20.1875,
"alnum_prop": 0.6470588235294118,
"repo_name": "KarateJB/Python.Practice",
"id": "09d37a013a0b729027d13b3d08541279310cb4b6",
"size": "323",
... |
import array as pyarray
import unittest
from numpy import array
from pyspark.mllib.linalg import Vectors, Matrices
from pyspark.mllib.random import RandomRDDs
from pyspark.mllib.regression import LabeledPoint
from pyspark.mllib.stat import Statistics
from pyspark.sql.utils import IllegalArgumentException
from pyspark... | {
"content_hash": "7cba845af8868c4f0abe64179f4161fe",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 93,
"avg_line_length": 42.06470588235294,
"alnum_prop": 0.6422877919172144,
"repo_name": "milliman/spark",
"id": "414106fe51cc86acbc0c4a6ecf159d841ab00ac9",
"size": "7936"... |
class Dictionary():
def __init__(self):
self.counter = 1
self.forward = {}
self.backward = ["[OOV]"]
self.freq = [0]
def insert(self, token):
if not token in self.forward:
self.forward[token] = self.counter
self.backward.append(token)
self.freq.append(1)
self.counter += ... | {
"content_hash": "fa4394b086f0d282098ba8418622bf75",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 73,
"avg_line_length": 23.988888888888887,
"alnum_prop": 0.5641500694766095,
"repo_name": "jgasthaus/antaresia",
"id": "f892602780dd9377a3ba2fbfba0d005eaceb4303",
"size": "... |
from django.contrib import admin
from flag.models import FlaggedContent, FlagInstance
class InlineFlagInstance(admin.TabularInline):
model = FlagInstance
extra = 0
class FlaggedContentAdmin(admin.ModelAdmin):
inlines = [InlineFlagInstance]
admin.site.register(FlaggedContent, FlaggedContentAdmin... | {
"content_hash": "2cae1eef20d501dffa7e370f876bdd08",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 56,
"avg_line_length": 29.363636363636363,
"alnum_prop": 0.7801857585139319,
"repo_name": "caseywstark/colab",
"id": "c95db4c67661b9441b58fd065f030e07e022a3c2",
"size": "32... |
"""
**Factory** provides convenient way to train several classifiers on the same dataset.
These classifiers can be trained one-by-one in a single thread, or simultaneously
with IPython cluster or in several threads.
Also `Factory` allows comparison of several classifiers (predictions of which can be used in parallel)... | {
"content_hash": "e5e2043bd93afc6c6faee6645ae0143d",
"timestamp": "",
"source": "github",
"line_count": 371,
"max_line_length": 119,
"avg_line_length": 39.22371967654986,
"alnum_prop": 0.6381253435953821,
"repo_name": "scr4t/rep",
"id": "18604d2573443e8ac077a0ab2b08c33d9bff4dde",
"size": "14552",
... |
from django.conf import settings
from django.utils.html import format_html
class Icon(object):
def __init__(self, id):
self.id = id
def as_html(self):
if not self.id:
return ''
prefix = getattr(settings, 'FONTAWESOME_PREFIX', 'fa')
return format_html('<i class="{0... | {
"content_hash": "f298aec0413fc543b9fa7c09636b2391",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 74,
"avg_line_length": 22.7,
"alnum_prop": 0.5638766519823789,
"repo_name": "redouane/django-fontawesome",
"id": "ec93f84944bac9f29b3954473d4992c8654f36b9",
"size": "454",
... |
from deployer.inspection.inspector import Inspector
from deployer.node import ParallelNode, Node
import termcolor
class AnalyseHost(ParallelNode):
"""
Analyze a host and find out what it's used for.
"""
def analyise(self):
"""
Discover what a host is used for, which role mappings it h... | {
"content_hash": "2e92f7baefe1485f0df0dd451bf9f673",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 144,
"avg_line_length": 31.40963855421687,
"alnum_prop": 0.5209052550824703,
"repo_name": "jonathanslenders/python-deployer",
"id": "b8b8dbd2d0cc3500f51760a2e9c4b6d718ab91eb"... |
import pwnlib.tubes
def handle_pow(r):
print(r.recvuntil(b'python3 '))
print(r.recvuntil(b' solve '))
challenge = r.recvline().decode('ascii').strip()
p = pwnlib.tubes.process.process(['kctf_bypass_pow', challenge])
solution = p.readall().strip()
r.sendline(solution)
print(r.recvuntil(b'Cor... | {
"content_hash": "405f82fd8e8736b45da315506c12faa9",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 68,
"avg_line_length": 27.52173913043478,
"alnum_prop": 0.6619273301737757,
"repo_name": "google/google-ctf",
"id": "a3b6d2e0261ede941a429da3aea9569a3dfdca90",
"size": "125... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import with_statement
import functools
import json
import os
import platform
import sys
from re import sub
from .const import PLUGIN_NAME
from .const import PRETTIER_CONFIG_FILES
from .const import PRETTIER_IGNORE_FILE
IS_... | {
"content_hash": "bd1934b2c3c5c728826f574f4512d880",
"timestamp": "",
"source": "github",
"line_count": 381,
"max_line_length": 114,
"avg_line_length": 29.37795275590551,
"alnum_prop": 0.6198516930224247,
"repo_name": "Jackysonglanlan/devops",
"id": "c06f4b1e42f384697a15c685acdf45af916e558f",
"size... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('linked_domain', '0020_auto_20211102_1501'),
]
operations = [
migrations.AlterField(
model_name='domainlinkhistory',
name='model',
field=models.CharField(... | {
"content_hash": "fa223a244cdc2ebfa88e363aeecf118c",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 805,
"avg_line_length": 69.25,
"alnum_prop": 0.6597472924187726,
"repo_name": "dimagi/commcare-hq",
"id": "e5f3cc820f73a04ff09f3a304107225aca074482",
"size": "1158",
"bin... |
"""Class OneDeviceStrategy implementing DistributionStrategy."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.distribute import device_util
from tensorflow.python.distribute import distribute_lib
from tensorflow.python.distribute i... | {
"content_hash": "fc97350ce140e6dd26095e5806d56516",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 97,
"avg_line_length": 37.00487804878049,
"alnum_prop": 0.7074874769311891,
"repo_name": "kevin-coder/tensorflow-fork",
"id": "576db795a0b5385b06573976d9f435e305e72919",
"... |
from oslo_utils import importutils
import testtools
from oslo_messaging.tests import utils as test_utils
# NOTE(jamespage) matchmaker tied directly to eventlet
# which is not yet py3 compatible - skip if import fails
matchmaker_ring = (
importutils.try_import('oslo_messaging._drivers.matchmaker_ring'))
@testtoo... | {
"content_hash": "150fec47d339d91b803a60d96ebddb28",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 73,
"avg_line_length": 38,
"alnum_prop": 0.5958965209634255,
"repo_name": "stevei101/oslo.messaging",
"id": "5f156007abd58a4403ef8444532f6d2cd8ef2a5c",
"size": "2850",
"b... |
import unittest
from unittest.mock import patch, MagicMock
from credstash import get_session, reset_sessions
class TestGetSession(unittest.TestCase):
def setUp(self):
reset_sessions()
@patch('boto3.Session')
def test_get_session_initial_session(self, mock_session):
mock_session.return_valu... | {
"content_hash": "607eedf21e2c67d845aae02e4f9329be",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 79,
"avg_line_length": 34.743589743589745,
"alnum_prop": 0.5996309963099631,
"repo_name": "fugue/credstash",
"id": "983eb14e826deaff590c8b79c228e5215f12d8e1",
"size": "2710... |
import logging
import asyncio
import discord
client = discord.Client()
| {
"content_hash": "de3412c143bc66f20808db83da2f54af",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 25,
"avg_line_length": 14.4,
"alnum_prop": 0.8055555555555556,
"repo_name": "eric-saindon/revered-bot",
"id": "07f200c86f32f32e083c0c534b006286e41aaff7",
"size": "72",
"bi... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
from math import ceil
from flask import jsonify, request
from flask_restplus import inputs
from flexget.plugin import get_plugins, get_plugin_by_name, Depe... | {
"content_hash": "b350ca4a1adb057261cb6c8fe34f5f39",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 114,
"avg_line_length": 33.62676056338028,
"alnum_prop": 0.6117277486910995,
"repo_name": "jawilson/Flexget",
"id": "d8ca63ddc6ef8ce1a053a095a4c0f32613ac7087",
"size": "47... |
from pearce.emulator import OriginalRecipe, ExtraCrispy, SpicyBuffalo
from pearce.mocks.customHODModels import *
from pearce.mocks import cat_dict
from pearce.inference import run_mcmc_iterator
from astropy.table import Table
from scipy.optimize import minimize_scalar
from halotools.mock_observables import wp
import nu... | {
"content_hash": "6ece09e7a51e44d46d0b4111b6d7b9ff",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 171,
"avg_line_length": 33.80555555555556,
"alnum_prop": 0.678992056970693,
"repo_name": "mclaughlin6464/pearce",
"id": "e98e3e8cd961262603c8c0787cf13f50a1efae76",
"size":... |
import unittest
from test_helper import test_is_not_empty, get_file_output
class TestCase(unittest.TestCase):
def test_not_empty(self):
self.assertTrue(test_is_not_empty(), 'The output is empty')
def test_output(self):
output = get_file_output(path='task.py')
answers = ['2', '4', '6... | {
"content_hash": "2be0673d5a19b9c4b184c877d8662e78",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 87,
"avg_line_length": 28.1875,
"alnum_prop": 0.6319290465631929,
"repo_name": "apache/beam",
"id": "032df7a96fd98562a6326d66454a061b1e816aac",
"size": "1240",
"binary": ... |
from allauth.socialaccount import providers
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth.provider import OAuthProvider
class TwitterAccount(ProviderAccount):
def get_screen_name(self):
return self.account.extra_data.get('screen_name')
def... | {
"content_hash": "14d9c9477a9d561016f7509491ab3395",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 76,
"avg_line_length": 32.55263157894737,
"alnum_prop": 0.65642683912692,
"repo_name": "Suite5/DataColibri",
"id": "76dd958ce3c6c27f91590c1fc5e4201b2e0ed125",
"size": "1237... |
import errno
import functools
import os
import stat
import subprocess
import typing
from collections import namedtuple
from contextlib import contextmanager
from cached_property import cached_property
from frozendict import frozendict
from .daemontools import svc
from .daemontools import SvStat
from .daemontools impo... | {
"content_hash": "00274785dd319f018cd5fce8419ddd83",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 114,
"avg_line_length": 35.368852459016395,
"alnum_prop": 0.5811510235612205,
"repo_name": "Yelp/pgctl",
"id": "82f00b83bc9cee52ee794723d8fd6832fc511dd0",
"size": "12945",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.