text stringlengths 4 1.02M | meta dict |
|---|---|
"""
sentry.web.frontend.generic
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import os
import posixpath
from django.conf import settings
from django.http import HttpRespo... | {
"content_hash": "d75fb4fbeb5c64d0aed40ebfb7723596",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 91,
"avg_line_length": 34.339622641509436,
"alnum_prop": 0.6478021978021978,
"repo_name": "ifduyue/sentry",
"id": "097895ee80a78902ebe7b67789ed2b11701361f1",
"size": "3640... |
import json
import os
import urllib
from pureelk.arraycontext import ArrayContext
STATE_FILE = ".pureelk.arrays.state"
class Store(object):
def __init__(self, path, logger):
"""
Store class for saving and loading of states
The current implementation is file-based since the data set is ti... | {
"content_hash": "f24f2f15c791d6c8ef8a4554cb4da8d6",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 96,
"avg_line_length": 38.275862068965516,
"alnum_prop": 0.5798798798798799,
"repo_name": "pureelk/pureelk",
"id": "0900ac99a5cc87b8caf6f29b9e5069734a77d0e8",
"size": "3330... |
__author__ = 'farooq.sheikh'
from setuptools import setup, find_packages
setup(
name = 'asposepdfexamples',
packages = find_packages(),
version = '1.0.1',
description = 'Aspose.Pdf Cloud SDK for Python allows you to use Aspose.Pdf APIs in your Python applications',
author='Farooq Sheikh',
auth... | {
"content_hash": "6440e98811a8e3c288db101ce8922839",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 114,
"avg_line_length": 31.772727272727273,
"alnum_prop": 0.6409155937052933,
"repo_name": "asposepdf/Aspose_Pdf_Cloud",
"id": "fea654a976774c9ea1af019a59dcfa978cbd7f0a",
"... |
import json
import math
from flask import Flask, request
from flask import render_template
from flask.json import jsonify
app = Flask(__name__, static_url_path='/static')
_file = open("data.csv")
data = map(lambda x: x[:-1].replace("'","").split(","), _file.readlines())
order = [0, 2, 5, 14, 3, 16, 13, 6, 11]
#orde... | {
"content_hash": "8d2f36f59a2b804d84f49cf5c647f62c",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 112,
"avg_line_length": 26.68141592920354,
"alnum_prop": 0.6006633499170813,
"repo_name": "alseambusher/viza",
"id": "7037158ea38ea937e89d2a2d28debb2a94e631af",
"size": "3... |
"""
===========================================
Sparse coding with a precomputed dictionary
===========================================
Transform a signal as a sparse combination of Ricker wavelets. This example
visually compares different sparse coding methods using the
:class:`sklearn.decomposition.SparseCoder` esti... | {
"content_hash": "85b63097d50263036e6d84084663d79f",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 78,
"avg_line_length": 39.649484536082475,
"alnum_prop": 0.6266250650026001,
"repo_name": "mrshu/scikit-learn",
"id": "844eb552fb99148c08f9011236ed222271bc67f7",
"size": "3... |
default_app_config = 'student.apps.apps.AppConfig' | {
"content_hash": "5fcd8124d68a4aec989af06a22e1725f",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 50,
"avg_line_length": 50,
"alnum_prop": 0.8,
"repo_name": "houssemFat/MeeM-Dev",
"id": "c95453cc97878d0a132e616f2dc1f97d142cb054",
"size": "50",
"binary": false,
"copie... |
import time, datetime, os
from pyvcloud.vcloudair import VCA
def print_vca(vca):
if vca:
print 'vca token: ', vca.token
if vca.vcloud_session:
print 'vcloud session token: ', vca.vcloud_session.token
print 'org name: ', vca.vcloud_session.org
... | {
"content_hash": "e295be38e37b9aafdc7a9129a3fb21e6",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 132,
"avg_line_length": 33.76056338028169,
"alnum_prop": 0.6620775969962454,
"repo_name": "cloudify-cosmo/pyvcloud",
"id": "c46e1b5996f8cb2a9504cf8874827121afb693fc",
"size... |
import nCore
import sqlite3
from os.path import exists
__author__ = 'pioo'
# TODO find dbfile's place
_dbfile = "ncore.db"
_memdb = ":memory:"
if not exists(_dbfile):
_needs_init = True
else:
_needs_init = False
_conn = sqlite3.connect(_memdb)
_cur = _conn.cursor()
def insert_into_db(torrent):
sqlstate... | {
"content_hash": "1e9b324ec37c7717960b17b402b70190",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 76,
"avg_line_length": 27.141304347826086,
"alnum_prop": 0.5802963556267521,
"repo_name": "piooca/libncore",
"id": "41df9480efbd1d4cfe0fd48751db3f026762fc02",
"size": "2544... |
"""
Copyright (C) 2014, Michael Trunner
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and th... | {
"content_hash": "8779a0ea9a7da08d9ffdb37c6fc86328",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 80,
"avg_line_length": 32.16019417475728,
"alnum_prop": 0.586566037735849,
"repo_name": "trunneml/tevionPi",
"id": "3d584a60beef361d082d6b1dc69ed51d8cde1ede",
"size": "664... |
import autosar
def create_platform_types(ws):
ws.pushRoles()
package = ws.createPackage('AUTOSAR_Platform')
baseTypes = package.createSubPackage('BaseTypes', role = 'DataType')
package.createSubPackage('CompuMethods', role = 'CompuMethod')
package.createSubPackage('DataConstrs', role = 'Data... | {
"content_hash": "69bca9c906c2bc70fdc33354db043e5e",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 125,
"avg_line_length": 55.97435897435897,
"alnum_prop": 0.7084287677508017,
"repo_name": "cogu/autosar",
"id": "4fa985a11c67bece28bbc9de1f1d8073a84e77bc",
"size": "4366",
... |
"""ResNet model for TF2."""
import functools
from typing import Optional, Sequence, Text, Union
from class_balanced_distillation import resnet_helpers
import tensorflow.compat.v2 as tf
class CosineLayer(tf.keras.Model):
"""Cosine Layer."""
def __init__(self, in_features, num_classes, name=None):
super(Cosi... | {
"content_hash": "cb8339f3d8ce854fca0496fbb688e0c2",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 80,
"avg_line_length": 29.017316017316016,
"alnum_prop": 0.5785469192898702,
"repo_name": "google-research/google-research",
"id": "f9c963d85531a6da04c07bb3cb5cd04bd729e125"... |
import os
import numpy as np
from skimage import img_as_ubyte
from plantcv.plantcv import fatal_error
from plantcv.plantcv import Spectral_data
from plantcv.plantcv import params
from plantcv.plantcv.hyperspectral.read_data import _make_pseudo_rgb
from plantcv.plantcv._debug import _debug
def image_fusion(img1, img2,... | {
"content_hash": "052236f0235b41c6ec7d24c098c099e6",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 119,
"avg_line_length": 35.64646464646464,
"alnum_prop": 0.6344573533578918,
"repo_name": "stiphyMT/plantcv",
"id": "9747be17c767aa252c64988433a4fdaf1793d1a4",
"size": "354... |
import pytest
def reverse_string_recursively(data: str) -> str:
if data == "" or data == None or len(data) == 1:
return data
return data[len(data) - 1] + reverse_string_recursively(data[0 : len(data) - 1])
@pytest.mark.parametrize(("data", "res"), [("anu", "una"), ("karthik", "kihtrak")])
def test_r... | {
"content_hash": "8b57cf83fba6e1b829dd3dba2d928e8f",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 84,
"avg_line_length": 35.583333333333336,
"alnum_prop": 0.639344262295082,
"repo_name": "anu-ka/coding-problems",
"id": "8832320d573d318b2f539b957321950bc23ac544",
"size":... |
class Code(object):
"""A convenience object for constructing code.
Logically each object should be a block of code. All methods except |Render|
and |IsEmpty| return self.
"""
def __init__(self, indent_size=2, comment_length=80):
self._code = []
self._indent_size = indent_size
self._comment_length... | {
"content_hash": "f30fd10a8fff60f990144c8f02c01807",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 80,
"avg_line_length": 33.8586387434555,
"alnum_prop": 0.6352249884026596,
"repo_name": "joone/chromium-crosswalk",
"id": "d637026d6d0db88aaf950ac5d0dc9c673fbc4929",
"size... |
"""
Posterior Predictive Check Plot
===============================
"""
import arviz as az
data = az.load_arviz_data("non_centered_eight")
ax = az.plot_ppc(data, alpha=0.03, figsize=(12, 6), backend="bokeh")
| {
"content_hash": "52efa94beb1bed172ba3b4cab5906188",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 68,
"avg_line_length": 26.125,
"alnum_prop": 0.5885167464114832,
"repo_name": "arviz-devs/arviz",
"id": "42cc9824a4f08ec2f744a814481a0a8e357f52e5",
"size": "209",
"binary"... |
import sys
if sys.version_info.major == 3:
from .config import Config
else:
from config import Config | {
"content_hash": "8a548f238f2d9f9c014c839198e1cd0b",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 31,
"avg_line_length": 21.2,
"alnum_prop": 0.7452830188679245,
"repo_name": "MatteusDeloge/opengrid",
"id": "b01d011987675d9b98845cd43854662f51ccf705",
"size": "130",
"bin... |
"""Tests for the Android contacts2.db database event formatter."""
import unittest
from plaso.formatters import android_calls
from tests.formatters import test_lib
class AndroidCallFormatterTest(test_lib.EventFormatterTestCase):
"""Tests for the Android call history event formatter."""
def testInitialization(... | {
"content_hash": "0dfcdd831ea29c1ca1114885db7d50c6",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 66,
"avg_line_length": 28.15625,
"alnum_prop": 0.7369589345172031,
"repo_name": "dc3-plaso/plaso",
"id": "982a87f1a1c6e4860caa83c039088a4741fcb2fb",
"size": "943",
"binar... |
"""
Django settings for fightit project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | {
"content_hash": "441eefc88f760821a90e2f79d4f02606",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 71,
"avg_line_length": 24.099009900990097,
"alnum_prop": 0.7025472473294988,
"repo_name": "miwoow/fight-heros",
"id": "eb7df6bab535001faa5ff794ed7702f3e3dfabd2",
"size": "... |
"""Module/script to "compile" all .py files to .pyc (or .pyo) file.
When called as a script with arguments, this compiles the directories
given as arguments recursively; the -l option prevents it from
recursing into directories.
Without arguments, if compiles all modules on sys.path, without
recursing into subdirecto... | {
"content_hash": "4d38baf0cd2da8f5fe0d2810cd180fb9",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 78,
"avg_line_length": 33.484375,
"alnum_prop": 0.5685954269715352,
"repo_name": "MalloyPower/parsing-python",
"id": "e56c8b284e835c72417fe5579820242fefc08d5a",
"size": "4... |
import os
import imp
import inspect
from pact_test.either import *
from pact_test.constants import *
from pact_test.utils.logger import *
from pact_test.utils.pact_utils import get_pact
from pact_test.utils.pact_helper_utils import load_pact_helper
from pact_test.runners.service_consumers.state_test import verify_state... | {
"content_hash": "470210d4cb41a3d98eb3815ed654f9c6",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 94,
"avg_line_length": 38.98765432098765,
"alnum_prop": 0.5880303989867004,
"repo_name": "Kalimaha/pact-test",
"id": "9abe39ddf9991a4d4c3a430986e1dbdffa84d1e6",
"size": "31... |
from PIL import Image
import numpy as np
from cps2zmq.process import Tile, ColorTile
from cps2zmq.process import GraphicAsset
class Sprite(GraphicAsset):
"""
A Sprite is a grouping of :py:mod:`~cps2zmq.gather.Tile.Tile` that use the same palette.
Attributes:
base_tile (str): the memory address of... | {
"content_hash": "f0dd3c4cc04ae99f963bdf9253c12bf4",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 100,
"avg_line_length": 33.94396551724138,
"alnum_prop": 0.5481904761904762,
"repo_name": "goosechooser/cps2-zmq",
"id": "6c6bdbfc700f7146accca0d9a07824a17d0bd48d",
"size"... |
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name=... | {
"content_hash": "24d744b90a677ca4f115f666d08138af",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 114,
"avg_line_length": 48.83076923076923,
"alnum_prop": 0.5639571518588532,
"repo_name": "CicloviaTeam/CicloviaProgram",
"id": "76131ba9aef14245592cebe47f18986f5926cc9c",
... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class PendingFriendRequests(Choreography):
def __init__(self, temboo_session):
"""
... | {
"content_hash": "be053cc2175e7fe8d9058e5a1ebf499b",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 171,
"avg_line_length": 41.80327868852459,
"alnum_prop": 0.7247058823529412,
"repo_name": "jordanemedlock/psychtruths",
"id": "7004f39384b7b7e17a0b07f04699e17d3c3dbe33",
"s... |
from unittest import TestCase
from chatterbot.adapters.logic import EvaluateMathematically
from chatterbot.conversation import Statement
class EvaluateMathematicallyTests(TestCase):
def setUp(self):
self.adapter = EvaluateMathematically()
def test_can_process(self):
statement = Statement("Wh... | {
"content_hash": "35dd81d83f73d3cb3998607b4a14454a",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 94,
"avg_line_length": 38.056,
"alnum_prop": 0.6361151986546143,
"repo_name": "DarkmatterVale/ChatterBot",
"id": "6cc7e4c716aa37aba646e519db5e9ca053c39a87",
"size": "4757"... |
import os
import random
import signal
import subprocess
from ...guestutils import get_container_name, get_service_name, get_node_list
def run_service(cmd, logtype='log', logbase=None, logtarget=None):
"""Wrap the execution of a service with the necessary logging nets.
If logbase is provided (it is by defaul... | {
"content_hash": "7587ac2dbb2987a2f2ffcc122edde56e",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 78,
"avg_line_length": 38.37179487179487,
"alnum_prop": 0.637821583695289,
"repo_name": "signalfx/maestro-ng",
"id": "3c74ecfe4a8981ccd1a96270601807c4a22cd6ca",
"size": "33... |
"""
This script is responsible for changing the desktop background.
Commands used:
- /usr/bin/osascript /usr/local/zetta/mac_os_scripts/external/change_background.scpt (path)
Scripts referenced:
- osascript change_background.scpt
on run argv
tell application "System Events"
set monitors to a reference to ... | {
"content_hash": "779e142ddbc417b7b0c36375f3dda93c",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 114,
"avg_line_length": 28.333333333333332,
"alnum_prop": 0.6216318785578747,
"repo_name": "initialed85/mac_os_scripts",
"id": "6cb2d942f4c7a0c16c8298dd501fa9682a841af7",
"... |
import re
import sys
import json
import types
import shlex
import datetime
import ProcessGroups
import EventServiceUtils
from threading import Lock
from DBProxyPool import DBProxyPool
from brokerage.SiteMapper import SiteMapper
from dataservice.Setupper import Setupper
from dataservice.Closer import Closer
from dataser... | {
"content_hash": "a368c2cff610966f86c975f1086bfad6",
"timestamp": "",
"source": "github",
"line_count": 2784,
"max_line_length": 137,
"avg_line_length": 33.26867816091954,
"alnum_prop": 0.561088317857914,
"repo_name": "fbarreir/panda-server",
"id": "a871829151643d2af74a655306e4c5f017e95eb6",
"size"... |
import django
from django.contrib import admin
from .models import EmailConfirmation, EmailAddress
from .adapter import get_adapter
class EmailAddressAdmin(admin.ModelAdmin):
list_display = ('email', 'user', 'primary', 'verified')
list_filter = ('primary', 'verified')
search_fields = []
raw_id_fields... | {
"content_hash": "2617b8baa2f81ec55892e28aa4621f87",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 73,
"avg_line_length": 33.935483870967744,
"alnum_prop": 0.6739543726235742,
"repo_name": "wli/django-allauth",
"id": "9c2c8a2fd20358b104b6b389b93352e0cc9dace3",
"size": "1... |
from collections import defaultdict
# Create a defaultdict {entity:[entity, entity]}
class TripleReaderItems:
def __init__(self, triples_file):
self.baseuri = "http://www.wikidata.org/entity/"
self.d = defaultdict(list)
with open(triples_file) as f:
for l in f:
... | {
"content_hash": "bc96246bb261d16cedd1483e7b2e5898",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 79,
"avg_line_length": 38.32142857142857,
"alnum_prop": 0.5293569431500466,
"repo_name": "hadyelsahar/RE-NLG-Dataset",
"id": "7e2143eb47197120edb65a09e0715d99f4e7a4d5",
"si... |
import numpy as np
import cv2
import glob
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
"""Transformation Pipeline"""
calibration_image_src = 'camera_cal/calibration*.jpg'
FONT_SIZE = 200
def calibrate_camera(calibration_image_src = calibration_image_src, ):
# prepare object ... | {
"content_hash": "351bcdad49a0f3f64622c694ed22572e",
"timestamp": "",
"source": "github",
"line_count": 291,
"max_line_length": 127,
"avg_line_length": 40.18556701030928,
"alnum_prop": 0.6674362921156148,
"repo_name": "dzorlu/sdc",
"id": "560ef18b8eca8341a1c56f24883af1946c09cd96",
"size": "11694",
... |
import sys
from pyasn1.codec.der import decoder as der_decoder
from pyasn1.codec.der import encoder as der_encoder
from pyasn1_modules import pem
from pyasn1_modules import rfc2511
try:
import unittest2 as unittest
except ImportError:
import unittest
class CertificateReqTestCase(unittest.TestCase):
pe... | {
"content_hash": "ee1b64fa2db734b9f8cc15c5ca7a0c89",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 80,
"avg_line_length": 30.571428571428573,
"alnum_prop": 0.8044058744993324,
"repo_name": "cloudera/hue",
"id": "494d0172e67cf619cbeffa2c5c489a9f8dc82d0a",
"size": "1663",
... |
from QUANTAXIS.QAFetch.QAQuery import (QA_fetch_future_day,
QA_fetch_future_min,
QA_fetch_future_tick,
QA_fetch_index_day, QA_fetch_index_min,
QA_fetch_stock_day, Q... | {
"content_hash": "ebf06861dd3429edd5518fe45972bfdb",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 129,
"avg_line_length": 38.831932773109244,
"alnum_prop": 0.5027050421986583,
"repo_name": "EmmaIshta/QUANTAXIS",
"id": "01b5d6b365d374aa51d048e24980c4728b038d84",
"size":... |
from sentry_sdk.hub import Hub, init
from sentry_sdk.scope import Scope
from sentry_sdk.transport import Transport, HttpTransport
from sentry_sdk.client import Client
from sentry_sdk.api import * # noqa
from sentry_sdk.api import __all__ as api_all
from sentry_sdk.consts import VERSION # noqa
__all__ = api_all + [... | {
"content_hash": "62c601bb8d97a6b6a702342195ef1ca1",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 57,
"avg_line_length": 23.64,
"alnum_prop": 0.7140439932318104,
"repo_name": "liszd/whyliam.workflows.youdao",
"id": "b211a6c754ace40753aea57491cbd38a98f674ff",
"size": "59... |
"""Views for Zinnia archives"""
import datetime
from django.utils import timezone
from django.views.generic.dates import BaseArchiveIndexView
from django.views.generic.dates import BaseYearArchiveView
from django.views.generic.dates import BaseMonthArchiveView
from django.views.generic.dates import BaseWeekArchiveView... | {
"content_hash": "32b2272ed91dd416c64036371813248a",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 79,
"avg_line_length": 34.96491228070175,
"alnum_prop": 0.706472654290015,
"repo_name": "pczhaoyun/obtainfo",
"id": "7f4e637598b43105cea43867472fd890ae526f82",
"size": "39... |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Nuno Barreto', 'nbarreto@gmail.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'frozenflower' # Or path to database file if using sqlite3.
DATABASE_U... | {
"content_hash": "c34e370fc7da4a3018be12dc9404e917",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 106,
"avg_line_length": 36.207317073170735,
"alnum_prop": 0.7096665543954194,
"repo_name": "washimimizuku/frozen-flower",
"id": "279669954a1ef1deee5675eebd4de59a108241e3",
... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "e90d1b41f01988235726b99d2de48a07",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 77,
"avg_line_length": 31.806896551724137,
"alnum_prop": 0.5277536860364267,
"repo_name": "lathama/Adynaton",
"id": "36037b198584d2563f0b3ced37ec340d3a14c346",
"size": "46... |
import six
import sahara.plugins.mapr.domain.configuration_file as bcf
import sahara.plugins.mapr.domain.node_process as np
import sahara.plugins.mapr.domain.service as s
import sahara.plugins.mapr.util.validation_utils as vu
HBASE_MASTER = np.NodeProcess(
name='hbmaster',
ui_name='HBase-Master',
package... | {
"content_hash": "d3b2f58d6d8c739d245a49b4c815ed25",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 72,
"avg_line_length": 28.120481927710845,
"alnum_prop": 0.6161096829477292,
"repo_name": "zhangjunli177/sahara",
"id": "4f9aaceb1c52d1a60e4ae007c089d52ac6208401",
"size": ... |
from __future__ import print_function
import unittest
import numpy as np
from op_test import OpTest
class TestFlattenOp(OpTest):
def setUp(self):
self.op_type = "flatten2"
self.init_test_case()
self.inputs = {"X": np.random.random(self.in_shape).astype("float32")}
self.init_attrs... | {
"content_hash": "ff09ab597ff94f66322f7d676e492fda",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 78,
"avg_line_length": 24.135593220338983,
"alnum_prop": 0.5723314606741573,
"repo_name": "chengduoZH/Paddle",
"id": "59185855a5f13b82ca26bc26ead73fbe5fb96443",
"size": "20... |
"""
Boolean parameter type testcases.
List of tested functions :
--------------------------
- [setParameter] function
- [getParameter] function
Test cases :
------------
- Testing minimum
- Testing maximum
- Testing negative value
- Testing overflow
"""
from Util.PfwUnitTestLib import PfwTe... | {
"content_hash": "1c14b52c260063ba37d72d147fc5384f",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 117,
"avg_line_length": 40.29007633587786,
"alnum_prop": 0.4990526714664646,
"repo_name": "krocard/parameter-framework",
"id": "9c95692ef498ffa36c2aed36bec0144f687ecf8b",
... |
"""SCons.Tool.packaging.msi
The msi packager.
"""
#
# Copyright (c) 2001 - 2014 The SCons Foundation
#
# 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
# with... | {
"content_hash": "385bf4f00ee38eb344141774e10e5212",
"timestamp": "",
"source": "github",
"line_count": 527,
"max_line_length": 114,
"avg_line_length": 38.34914611005693,
"alnum_prop": 0.6368134586838199,
"repo_name": "engineer0x47/SCONS",
"id": "5aee71be187624ab5dd11ff0013a5b8303cb117d",
"size": "... |
import requests
import datetime
import re
import unicodedata # for solution that did not work and is commeted out
class event(object):
def __init__(self, title, time, location):
self.title = title
self.time = time
self.location = location
def day(self):
try:
da... | {
"content_hash": "235f419f6a322b351b1a8d294f4eb68f",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 116,
"avg_line_length": 42.27777777777778,
"alnum_prop": 0.5711782742006132,
"repo_name": "TheMitchWorksPro/DataTech_Playground",
"id": "5f3c78afca3dc36fcf482038ee81b24203f4... |
""" Sahana Eden Synchronization
@copyright: 2009-2014 (c) Sahana Software Foundation
@license: MIT
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, inc... | {
"content_hash": "a9d3c3d87bcd70254a67141bae76fb33",
"timestamp": "",
"source": "github",
"line_count": 855,
"max_line_length": 259,
"avg_line_length": 42.31345029239766,
"alnum_prop": 0.4148930289125988,
"repo_name": "gnarula/eden_deployment",
"id": "0053e071044c20683588756357e162452a5a4639",
"siz... |
from copy import copy
from corehq.util.couch_helpers import paginate_view, MultiKeyViewArgsProvider
from corehq.util.pagination import paginate_function
from pillowtop.dao.couch import CouchDocumentStore
from pillowtop.feed.interface import Change
from pillowtop.reindexer.change_providers.interface import ChangeProvide... | {
"content_hash": "eebd8346f8b70a5d05348c9e3a1aa3a7",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 101,
"avg_line_length": 42.07462686567164,
"alnum_prop": 0.6520042568286627,
"repo_name": "qedsoftware/commcare-hq",
"id": "398a24e6ae3fecb1719be5df28bf0107d9b39647",
"size... |
import ansiblelint.utils
from ansiblelint import AnsibleLintRule
class TaskHasTag(AnsibleLintRule):
id = 'AERISCLOUD0002'
shortdesc = 'Tasks must have tag'
description = 'Tasks must have tag'
tags = ['productivity']
def matchtask(self, file, task):
# The meta files don't have tags
... | {
"content_hash": "548f0f21b01c2542fdd10e1aeea3aa2b",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 88,
"avg_line_length": 34.42253521126761,
"alnum_prop": 0.5376432078559739,
"repo_name": "AerisCloud/AerisCloud",
"id": "47a2552b5ed5690c90ad3d04804ef6e23db22c12",
"size": ... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '0015_add_home_page_and_email_to_program_page'),
]
operations = [
migrations.RemoveField(
model_name='programpage',
name='cont... | {
"content_hash": "611a77d5488f87bd9144ae0aeb6ab341",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 64,
"avg_line_length": 20.352941176470587,
"alnum_prop": 0.5982658959537572,
"repo_name": "mitodl/micromasters",
"id": "7334330bc26f231210849f4683aedf534fb7d88b",
"size": "... |
import abc
from typing import Awaitable, Callable, Optional, Sequence, Union
import pkg_resources
import google.auth # type: ignore
import google.api_core # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core... | {
"content_hash": "201914661aee857cbed6176b5344e547",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 101,
"avg_line_length": 38.801418439716315,
"alnum_prop": 0.6251142387132151,
"repo_name": "googleads/google-ads-python",
"id": "d4257c763baebe9631f024ce96f42adb58a5f038",
... |
""" this module handles the rest calls to the roxen server """
def request():
pass
def response():
return "ok" | {
"content_hash": "c166afe8488affc64973b1d9674c7f3b",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 62,
"avg_line_length": 17.142857142857142,
"alnum_prop": 0.65,
"repo_name": "whojarr/roxentools",
"id": "be13f73ebbcd5ce5f6b1121809cfa073588ddc4f",
"size": "120",
"binary"... |
import abc
import json
from datetime import datetime, timedelta
from bs4 import BeautifulSoup
from pygce.models.garmin import utils
class GCDaySection:
"""
Standard section in the Garmin Connect timeline of day.
"""
def __init__(self, raw_html, tag=""):
"""
:param raw_html: str
... | {
"content_hash": "dc62310058d20018ad97a6a8cd1de4d5",
"timestamp": "",
"source": "github",
"line_count": 649,
"max_line_length": 121,
"avg_line_length": 29.106317411402156,
"alnum_prop": 0.5344097406034939,
"repo_name": "sirfoga/pygce",
"id": "53debd8adfa3dd9eaefbfc53864c19c1a1469341",
"size": "1894... |
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from django.template import RequestContext
from django_socketio import events
def home(request, template='index.html'):
context = {"room": "ping",}
return re... | {
"content_hash": "51863350f65ea1852da355e44474df9e",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 73,
"avg_line_length": 31.227272727272727,
"alnum_prop": 0.61863173216885,
"repo_name": "ajfisher/sketching-conf-demo",
"id": "fe6a66ca7a21db787c175ff73bcb0522586c5d20",
"s... |
from django.contrib import admin
# lfs imports
from lfs.supplier.models import Supplier
class SupplierAdmin(admin.ModelAdmin):
"""
"""
admin.site.register(Supplier, SupplierAdmin)
| {
"content_hash": "1da601baa4a49db9b6285d3e12513b2b",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 44,
"avg_line_length": 19.1,
"alnum_prop": 0.7539267015706806,
"repo_name": "baffolobill/django-lfs",
"id": "6546d438fd6798225cc21c096332db28c03567fe",
"size": "208",
"bi... |
import re
#apetools
from apetools.commons import errors
from basewificommand import BaseWifiCommand
MAC_UNAVAILABLE = "MAC Unavailable (use `netcfg`)"
CommandError = errors.CommandError
class WifiCommandError(CommandError):
"""
An error to raise if the Wifi Command fails
"""
# end class WifiCommandError... | {
"content_hash": "b815283659698c80b1fbe94b6fbd7806",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 83,
"avg_line_length": 27.294117647058822,
"alnum_prop": 0.5538793103448276,
"repo_name": "rsnakamura/oldape",
"id": "022af6d414683eab98e07b0614a8fd32b5c41373",
"size": "4... |
import os
import sys
import shutil
from setuptools import setup
#------------------------------------------------------------------------
# Optional building with MAVEN
#------------------------------------------------------------------------
JAVA_SRC = "knit_jvm"
jar_file = os.path.join(JAVA_SRC, "target", "knit-1.0... | {
"content_hash": "af641712ba36722c187ff1f49f6d4747",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 73,
"avg_line_length": 30.476190476190474,
"alnum_prop": 0.553125,
"repo_name": "blaze/knit",
"id": "3ace583c6eaae183d28532c79d67f29aa2ba0563",
"size": "1303",
"binary": ... |
from winrm.protocol import Protocol
from st2actions.runners.pythonrunner import Action
__all__ = [
'TryWinRMAction'
]
class TryWinRMAction(Action):
def run(self, host, password, username='Administrator',
port=5732, secure=True):
proto = 'https' if secure else 'http'
... | {
"content_hash": "5ae35ef287848e7b5fd9fd9781ec2f31",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 75,
"avg_line_length": 36.11538461538461,
"alnum_prop": 0.5431309904153354,
"repo_name": "tonybaloney/st2contrib",
"id": "9f3f40561ece95a594e7858fce9fb74d3fcd5155",
"size":... |
import sys
import logging
import warnings
import click
import fiona
import rasterio
from shapely.geometry import mapping
import drapery
"""
See
https://github.com/mapbox/rasterio/blob/master/rasterio/rio/sample.py
"""
@click.command(options_metavar='<options>')
@click.argument('source_f', nargs=1, type=click.Path(ex... | {
"content_hash": "3dc7569db1aa7cda192a08c1c8ab6841",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 121,
"avg_line_length": 37.82857142857143,
"alnum_prop": 0.574773413897281,
"repo_name": "mrahnis/drapery",
"id": "51aadbf5a985e0eaa7442defdfea7f7e1f6cc431",
"size": "2648"... |
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest ; pytest
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Standard library imports
# External impo... | {
"content_hash": "70bfb0f1968d453365a2991524ed2ceb",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 86,
"avg_line_length": 32.07843137254902,
"alnum_prop": 0.30378973105134477,
"repo_name": "timsnyder/bokeh",
"id": "c4872a1852dc8f8eecd38bf80e1487c52033b08d",
"size": "2140... |
from impacket.dcerpc.v5 import ndr
from impacket.dcerpc.v5.ndr import NDRCALL, NDR, NDRSTRUCT, NDRENUM, NDRUNION, NDRPOINTER, NDRUniConformantArray, NDRUniFixedArray, NDRUniConformantVaryingArray
from impacket.dcerpc.v5.dtypes import *
from impacket import system_errors, nt_errors
from impacket.uuid import uuidtup_to_b... | {
"content_hash": "a9becbd825a168ff685a987500d64a76",
"timestamp": "",
"source": "github",
"line_count": 2806,
"max_line_length": 160,
"avg_line_length": 32.23699215965787,
"alnum_prop": 0.6373304442995015,
"repo_name": "hecchi777/S3-SlaacSecuritySolution",
"id": "df7aba1b95be0a6766e349b84b2515aeb979d... |
from openprocurement.api.traversal import Root as BaseRoot
from pyramid.security import ALL_PERMISSIONS, Allow # , Everyone
class Root(BaseRoot):
__acl__ = [
# (Allow, Everyone, 'view_transfer'),
(Allow, 'g:brokers', 'view_transfer'),
(Allow, 'g:brokers', 'create_transfer'),
(Al... | {
"content_hash": "c690e43dce935b45ebe7192614f1196c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 73,
"avg_line_length": 30.68,
"alnum_prop": 0.6597131681877445,
"repo_name": "Leits/openprocurement.relocation.api",
"id": "4fa2a2626645200b3c038a4f60688b91258f6995",
"size... |
import os
from collections import OrderedDict
import numpy as np
from bokeh.embed import components
from bokeh.io import output_notebook
from bokeh.plotting import show
from pandas import DataFrame
from cave.analyzer.base_analyzer import BaseAnalyzer
from cave.utils.bokeh_routines import array_to_bokeh_table
from cav... | {
"content_hash": "83a0beb043ba61daa2b565883356b4ef",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 118,
"avg_line_length": 43.17857142857143,
"alnum_prop": 0.544251447477254,
"repo_name": "automl/SpySMAC",
"id": "d6c8ad45d5bd3c2326b87fa937fa16326f396321",
"size": "6045"... |
if __name__ == "__main__":
import sys
import csv
idx = sys.argv[1]
reader = csv.reader(sys.stdin)
rows = []
for row in reader:
row[int(idx)] = row[int(idx)].replace('X', '0')
rows.append(row)
writer = csv.writer(sys.stdout)
writer.writerows(rows)
| {
"content_hash": "69caed533ff0afd4d57a7ff03533464c",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 55,
"avg_line_length": 26.818181818181817,
"alnum_prop": 0.5525423728813559,
"repo_name": "math4youbyusgroupillinois/large-lots",
"id": "a277c023abf091a275bd40b7681f6cf69057b... |
from __future__ import print_function
import sys
if sys.version_info[0] > 2:
import tkinter
else:
import Tkinter as tkinter
from PIL import Image, ImageTk
# --------------------------------------------------------------------
# an image animation player
class UI(tkinter.Label):
def __init__(self, mas... | {
"content_hash": "842151ab397d99aceb9ea296b184557d",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 80,
"avg_line_length": 22.24175824175824,
"alnum_prop": 0.4743083003952569,
"repo_name": "Grantern73/AiSopp",
"id": "9d302c70e9e732d9bc7e01e3d64252dc1dfdee5b",
"size": "213... |
def whileLoop(start):
a = start
while a < 1.0:
a = a+0.3
return a
class LL(object):
__slots__ = 'next'
def __init__(self, next=None):
self.next = next
# HACK, inheritance should automatically find this.
def __bool__(self):
return True
class Pair(object):
__slots__ = 'a', 'b'
def __init__(self, a, b)... | {
"content_hash": "70587360c9e07f4b6f14613222ba85bf",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 52,
"avg_line_length": 15.382022471910112,
"alnum_prop": 0.6121256391526662,
"repo_name": "ncbray/pystream",
"id": "4e9591c10f3da9abc1fd6ca09bcc48bafb34aa21",
"size": "1973... |
import ast
import eventlet
import json
import re
import requests
from oslo_config import cfg
from mistralclient.api import client as mistral
from mistralclient.api.v2 import action_executions
from st2common.constants import action as action_constants
from st2common import log as logging
from st2actions import handler... | {
"content_hash": "cc63ff74d4d5571514bf6ea4423ff6f3",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 94,
"avg_line_length": 36.2,
"alnum_prop": 0.6256906077348067,
"repo_name": "alfasin/st2",
"id": "ce2b41e1a9268a8f34d0fc68c7663c435e6ce9bd",
"size": "3676",
"binary": fal... |
import pytest
from flask import request
from werkzeug.exceptions import Forbidden
from app.utils.user import user_has_permissions
@pytest.mark.parametrize(
"permissions",
(
pytest.param(
[
# Route has a permission which the user doesn’t have
"send_messages"... | {
"content_hash": "85a68d54d2cf05cb936bd779f29a2b4a",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 101,
"avg_line_length": 22.52173913043478,
"alnum_prop": 0.6064533921676779,
"repo_name": "alphagov/notifications-admin",
"id": "37f085c58206b0724fded701fab646d3f73f459e",
... |
"""
originally from http://www.djangosnippets.org/snippets/828/ by dnordberg
"""
from django.conf import settings
from django.core.management.base import CommandError, BaseCommand
from django.db import connection
import django
import logging
from optparse import make_option
class Command(BaseCommand):
option_lis... | {
"content_hash": "fe10e2f0ac73053b14084773e08c495b",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 128,
"avg_line_length": 41.73381294964029,
"alnum_prop": 0.5699017410791243,
"repo_name": "2013Commons/HUE-SHARK",
"id": "768f6dc841ec339c9c9a881111705c8aaadac5a7",
"size"... |
import time
import sys
import numpy as np
# Encapsulate our neural network in a class
class SentimentNetwork:
def __init__(self, reviews,labels,hidden_nodes = 10, learning_rate = 0.1):
"""Create a SentimenNetwork with the given settings
Args:
reviews(list) - List of reviews used for tra... | {
"content_hash": "6e0f836948fdce7a1cb65178d4c8b482",
"timestamp": "",
"source": "github",
"line_count": 226,
"max_line_length": 151,
"avg_line_length": 42.81858407079646,
"alnum_prop": 0.580241810478454,
"repo_name": "oscarmore2/deep-learning-study",
"id": "5cf84354afa5425877e2e31f663c5ef00395d0e6",
... |
name = 'Zed A. Shaw'
age = 35 # not a lie
height = 74 # inches
weight = 180 # lbs
eyes = 'Blue'
teeth = 'White'
hair = 'Brown'
print "Let's talk about %s." % name
print "He's %d inches tall." % height
print "He's %d pounds heavy." % weight
print "Actually that's not too heavy."
print "He's got %s eyes and %s hair." % ... | {
"content_hash": "3ae0ec7bdef6fbb0587c85b1392104b5",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 65,
"avg_line_length": 30.27777777777778,
"alnum_prop": 0.6440366972477064,
"repo_name": "Doujins/LPTHW-Notes",
"id": "8377d07a95d66003b7b3881e3b620ec3a1190e71",
"size": "5... |
"""
# Licensed to the Apache Software Foundation (ASF) under one *
# or more contributor license agreements. See the NOTICE file *
# distributed with this work for additional information *
# regarding copyright ownership. The ASF licenses this file *
# to you under the Apache License, Version 2.0 (the... | {
"content_hash": "d33e3689d087f7130123ee60170eb24d",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 74,
"avg_line_length": 30.803418803418804,
"alnum_prop": 0.5566037735849056,
"repo_name": "OBIGOGIT/etch",
"id": "2792bcce27240b9ace9d15a37267138ec489e81f",
"size": "3604"... |
import os
import platform
import sys
from os.path import join
from numpy.distutils.system_info import platform_bits
is_msvc = (platform.platform().startswith('Windows') and
platform.python_compiler().startswith('MS'))
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util... | {
"content_hash": "56ed3a64c4bcef925db714bb378adb48",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 80,
"avg_line_length": 41.62068965517241,
"alnum_prop": 0.48666114333057164,
"repo_name": "WarrenWeckesser/numpy",
"id": "5d6ff2c8bdf557de85ced311b0cbaa002d946450",
"size"... |
import sys
import gzip
import matplotlib.pyplot as plt
x = []
y = []
line_count = 0
try:
for line in gzip.open(sys.argv[1]):
try:
tweet = eval(line.strip())
line_count += 1
if "coordinates" in tweet and tweet["coordinates"] is not None:
x.append(tweet[... | {
"content_hash": "bf90e285a62f3f0cc5b1d606dc332d9b",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 84,
"avg_line_length": 22.3,
"alnum_prop": 0.57847533632287,
"repo_name": "bmtgoncalves/TorinoCourse",
"id": "241c5489cb0d6f109f29da1be0dfd0b0717ef233",
"size": "693",
"b... |
from pyramid.httpexceptions import HTTPFound
from pyramid.security import remember
from pyramid.security import forget
from pyramid.security import authenticated_userid
from pyramid.url import route_url
from pyramid.view import view_config
from pyramid.exceptions import Forbidden
import transaction
import formencode
fr... | {
"content_hash": "334d08ff80d9311ac86a007f0874aa73",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 76,
"avg_line_length": 35.48314606741573,
"alnum_prop": 0.6719442685243825,
"repo_name": "sh-ft/mudwyrm",
"id": "06e98abca8235a19da475870de2b6c4ea7e655d2",
"size": "3158",
... |
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
import alembic_autogenerate_enums
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# ... | {
"content_hash": "31f0413dba46eba8be59393269bf7591",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 85,
"avg_line_length": 27,
"alnum_prop": 0.7019607843137254,
"repo_name": "Netflix/lemur",
"id": "91fa5fcbb6cfb91561de35be5931443329efe8f8",
"size": "2295",
"binary": fal... |
from __future__ import absolute_import
from rest_framework.response import Response
from sentry.plugins import plugins
from sentry.api.bases.organization import OrganizationEndpoint
from sentry.api.serializers import serialize
from sentry.api.serializers.models.organization_plugin import OrganizationPluginSerializer
... | {
"content_hash": "7a5c8628cefcb6cde7b306c5b51a4aa8",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 90,
"avg_line_length": 34.88461538461539,
"alnum_prop": 0.6637265711135611,
"repo_name": "ifduyue/sentry",
"id": "57ef60bd565ce22c8464c571126408855750a95a",
"size": "907",
... |
from ...Core.types import Types
from ...Core.commands import Commands
from ...Core.registers import Registers
""" Map: logic operator in programming language = the corresponding jump instruction in ASM """
relop_compare_map = {
'==': Commands.JE,
'!=': Commands.JNE,
'<': Commands.JG,
'<=': Com... | {
"content_hash": "8622b7e27980adcbdfbb4268a4bea327",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 99,
"avg_line_length": 34.43835616438356,
"alnum_prop": 0.6758154335719968,
"repo_name": "PetukhovVictor/compiler",
"id": "d0263201ca2c8da2927ff7ba347fb49a78f33687",
"size... |
"""Module to split file into multiple segments."""
import argparse
import itertools
HEADER_TEMPLATE = '''
#ifndef ICACHE_BUSTER_H
#define ICACHE_BUSTER_H
#include <vector>
class ICacheBuster {{
public:
ICacheBuster(size_t num_methods);
void RunNextMethod();
private:
std::vector<void (*)()> methods_;
size_t ... | {
"content_hash": "c6f9ff2a07eb1b005893ae80eacebc0b",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 83,
"avg_line_length": 31.727272727272727,
"alnum_prop": 0.6238603803073717,
"repo_name": "mbrukman/oldisim",
"id": "8ee2fa5072955ac85f850fd26e1615a586861c5e",
"size": "44... |
from importlib import import_module
# For update times
from time import time as unix_timestamp
# Enable custom node function import
import sys, os
dup = os.path.dirname
env_root = dup(dup(dup(__file__)))
sys.path.append(os.path.join(env_root, 'data'))
import get_node
class InvalidNodeError(Exception):
pass
cla... | {
"content_hash": "5faeb55929a293ab08721e1bd60cd723",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 86,
"avg_line_length": 35.616,
"alnum_prop": 0.6343216531895777,
"repo_name": "axelpale/gazelledb",
"id": "12e9fa2324f99793c9cf0eb737410312a6492131",
"size": "4452",
"bi... |
from google.cloud import aiplatform_v1beta1
async def sample_list_models():
# Create a client
client = aiplatform_v1beta1.ModelServiceAsyncClient()
# Initialize request argument(s)
request = aiplatform_v1beta1.ListModelsRequest(
parent="parent_value",
)
# Make the request
page_re... | {
"content_hash": "08336541ce0533931732934ca6a5c5d2",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 66,
"avg_line_length": 26.05,
"alnum_prop": 0.7159309021113244,
"repo_name": "googleapis/python-aiplatform",
"id": "9c4eacdd0ad56ac994d320f57772a7cdd587c61d",
"size": "1911... |
import httplib
import json
import logging
from webob import Response
from ryu.app.wsgi import ControllerBase
from ryu.base import app_manager
from ryu.controller import conf_switch
from ryu.lib import dpid as dpid_lib
# REST API for switch configuration
#
# get all the switches
# GET /v1.0/conf/switches
#
# get all ... | {
"content_hash": "7cb519d88bbe2b8116bbc8d279a42f2e",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 78,
"avg_line_length": 31.81168831168831,
"alnum_prop": 0.5797101449275363,
"repo_name": "citrix-openstack-build/ryu",
"id": "57e23474df3f8a982a0bcb3869e3142106e8c0b9",
"s... |
""" jabber bot definition """
## jsb imports
from jsb.lib.errors import CannotAuth, CantLogon, NoUserProvided
from jsb.lib.users import users
from jsb.utils.exception import handle_exception
from jsb.utils.trace import whichmodule
from jsb.utils.locking import lockdec
from jsb.utils.pdod import Pdod
from jsb.utils.do... | {
"content_hash": "fb3d62ddff0adbd9c9ad2474f4637db6",
"timestamp": "",
"source": "github",
"line_count": 545,
"max_line_length": 205,
"avg_line_length": 37.51009174311927,
"alnum_prop": 0.5488431247859903,
"repo_name": "Petraea/jsonbot",
"id": "9df1e83ae0c3888e78888d1f3dde4e250917333e",
"size": "204... |
import datetime as dt
import logging
import re
from future.moves.urllib.parse import urljoin, urlencode
import uuid
from copy import deepcopy
from flask import Request as FlaskRequest
from framework import analytics
from guardian.shortcuts import get_perms
from past.builtins import basestring
# OSF imports
import its... | {
"content_hash": "94910db601753ca5e1ad8f4056d11278",
"timestamp": "",
"source": "github",
"line_count": 1926,
"max_line_length": 174,
"avg_line_length": 40.83644859813084,
"alnum_prop": 0.6253703067983878,
"repo_name": "CenterForOpenScience/osf.io",
"id": "bdf015b17806018b6b47328ee55ba4844f8a15df",
... |
import redis
import pickle
try:
import json
except :
import simplejson as json
import UserDict, UserList
ConnectionError = redis.exceptions.ConnectionError
ResponseError = redis.exceptions.ResponseError
DEFAULT_ENCODING = 'UTF-8' # sys.getdefaultencoding()
#--- System related -----------------... | {
"content_hash": "e5b73f76e1a084d34720f3c80e61db38",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 89,
"avg_line_length": 31.07311320754717,
"alnum_prop": 0.5547628083491462,
"repo_name": "audoe/ztq",
"id": "3a0cfbae7e68724e2c2fc06e15948e9f427142e9",
"size": "13586",
... |
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
def get_title():
title = []
with open('/Users/jingyuanli/Desktop/DL/Project/data/classification_data/title.txt', 'r') as f:
lines = f.readlines()
print len(lines)
for line in lines:
title.append(line.strip())
return title
get_title()
| {
"content_hash": "389c1ec7279437f4098f9ee4313c479c",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 96,
"avg_line_length": 21.642857142857142,
"alnum_prop": 0.7029702970297029,
"repo_name": "hbtech-ai/ARPS",
"id": "a041d578707af87e413a245aa609a1e728b6cd61",
"size": "327",... |
"""Creates a cache for the specified dataset by executing the gold queries."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import json
import os
import sqlite3
def main(dataset_name, cache_path, errors_filepath, splits):
if dataset_na... | {
"content_hash": "7cd0de329866b9a521b384e06cbd9f97",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 80,
"avg_line_length": 34.68674698795181,
"alnum_prop": 0.5314345258770407,
"repo_name": "google-research/language",
"id": "69d2a11e2e62d314ef59610ddade0eb77c7f2a03",
"siz... |
import random
from django.contrib.auth.models import User
from django.db import models
def generate_stat():
"""Roll 3D6 to make a stat!"""
return roll_dice(3, 6)
def roll_dice(times, sides, modifier=0):
"""
Simulate a dice roll of XdY + Z.
"Rolls" a die of Y sides X times, gets the sum, and ad... | {
"content_hash": "0d9caf8f7c614c48f81121a3f86d31b4",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 79,
"avg_line_length": 25.448529411764707,
"alnum_prop": 0.6431667148223057,
"repo_name": "mpirnat/django-tutorial-v2",
"id": "a78a68316a704850f56b7fb6ec1efc821e70f8c5",
"... |
import sys, csv, json, argparse
sys.path.append("../../")
from model import GeoMF_D, GeoMF_O, HeSig, Distance
settings = json.loads(open("../../../SETTINGS.json").read())
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-m', type=int, action='store', dest='model_id',
help='choo... | {
"content_hash": "a017c62559f1cfd7c1d119d048080ea9",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 311,
"avg_line_length": 43.644067796610166,
"alnum_prop": 0.6353398058252427,
"repo_name": "anthonylife/EventRecommendation",
"id": "00899265146a411fb6b2acd4d39c362891f8b21c"... |
from django.conf.urls import url
from django.contrib import admin
from actors.views import ActorsView
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', ActorsView.as_view(), name="actors"),
]
| {
"content_hash": "5a627a295ffab4acf54716ee7d36d1a4",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 51,
"avg_line_length": 26.375,
"alnum_prop": 0.7061611374407583,
"repo_name": "bianchimro/django-search-views",
"id": "0d84e25ec28e7f3a146f0f10495e85ed34e9aaad",
"size": "21... |
class Animal:
def __init__(self, name): # Constructor of the class
self.name = name
def talk(self): # Abstract method, defined by convention only
raise NotImplementedError("Subclass must implement abstract method")
class Cat(Animal):
def talk(self):
return 'Meow!'
class Dog(An... | {
"content_hash": "dfc369fdc2c6b2c6d33fb2ec6d2c7650",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 76,
"avg_line_length": 22.291666666666668,
"alnum_prop": 0.6056074766355141,
"repo_name": "TeamLab/Gachon_CS50_Python_KMOOC",
"id": "3346c1aecb68997324e2abb3cdbab8e242b9b26a"... |
"""
For basic applications, MPI is as easy to use as any other
message-passing system. The sample code below contains the complete
communications skeleton for a dynamically load balanced master/slave
application. Following the code is a description of the few functions
necessary to write typical parallel applicatio... | {
"content_hash": "9cea4643e091a4aca7ac0d4ad64a1f44",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 81,
"avg_line_length": 26.639705882352942,
"alnum_prop": 0.6075075903947005,
"repo_name": "fspaolo/mpisubmit",
"id": "1d8ce4d958e4602b068f163390772a70dd0069ee",
"size": "3... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Contract.budget'
db.alter_column(u'build_contract', 'budget', self.gf('django.db.models.fields.SmallIntegerField'... | {
"content_hash": "9d8f48db3098496d091abdfd24d81190",
"timestamp": "",
"source": "github",
"line_count": 450,
"max_line_length": 174,
"avg_line_length": 95.79333333333334,
"alnum_prop": 0.5573340756721646,
"repo_name": "zionist/mon",
"id": "f41724921a033e091a75c582c2b88d5790ad5851",
"size": "43131",... |
SLEEP = 900 # 15 min
import spasm.data.sources as _data
import spasm.web.sources as _web
import time
Data = _data.MySpace()
Web = _web.MySpace()
def run(artist):
if artist['myspace_url']:
# Update stats, shows, news
web2data = (
(Web.get_stats, Data.add_stats),
(Web.... | {
"content_hash": "d8306e54139ae6ed92967cb1bc5d266c",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 46,
"avg_line_length": 23.066666666666666,
"alnum_prop": 0.5202312138728323,
"repo_name": "msmathers/SpasmDB",
"id": "2f65004fa62676af28a3ba3a5ba8605f1bcbea1e",
"size": "69... |
import unittest
from Kamaelia.Sketch.TagFilterComponent import TagFilter
class TestSubtitleFilter(unittest.TestCase):
def setUp(self):
self.sf = TagFilter()
def test_BasicStringPasses(self):
"""Tests that a tag free short string passes through unchanged."""
teststring = "This is a normal... | {
"content_hash": "ce2e4cfe67f3846358882868a693827b",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 894,
"avg_line_length": 68.6,
"alnum_prop": 0.6787172011661807,
"repo_name": "bbc/kamaelia",
"id": "5dd38ea05402cbfe17dce06585bbd43c1281b227",
"size": "4332",
"binary": f... |
"""
Yet Another S3-backed File System, or yas3fs
is a FUSE file system that is designed for speed
caching data locally and using SNS to notify
other nodes for changes that need cache invalidation.
"""
import urllib
import argparse
import errno
import stat
import time
import os
import os.path
import mimetypes
import sy... | {
"content_hash": "0a2be20fd8639087821c2f5ae40be02a",
"timestamp": "",
"source": "github",
"line_count": 3397,
"max_line_length": 242,
"avg_line_length": 45.226964969090375,
"alnum_prop": 0.5354018589393111,
"repo_name": "danilop/yas3fs",
"id": "9aee26d71d0ffd4a07576a19ac21d46420a3e04e",
"size": "15... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('superlachaise_api', '0005_auto_20150622_1855'),
]
operations = [
migrations.CreateModel(
name='DeletedObject',
fields=[
... | {
"content_hash": "e4626c112c78d11d97e803aa259bd21d",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 369,
"avg_line_length": 47.121212121212125,
"alnum_prop": 0.6064308681672026,
"repo_name": "MaximeLM/superlachaise_api",
"id": "973d0596628344187f0c259b78015f36dbffe441",
"... |
"""The tests device sun light trigger component."""
# pylint: disable=too-many-public-methods,protected-access
import os
import unittest
import blumate.loader as loader
from blumate.const import CONF_PLATFORM, STATE_HOME, STATE_NOT_HOME
from blumate.components import (
device_tracker, light, sun, device_sun_light_... | {
"content_hash": "111143a867c05c6f9f0bb48e33ca79e2",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 76,
"avg_line_length": 33.577586206896555,
"alnum_prop": 0.6354300385109114,
"repo_name": "bdfoster/blumate",
"id": "f712f2808cc1f02b75bdc48bc70fd5b6e98890de",
"size": "38... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ cookiecutter.package_name }}.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "506d3957630d52c0e64e1126a8d0fdfb",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 95,
"avg_line_length": 28,
"alnum_prop": 0.7063492063492064,
"repo_name": "istrategylabs/mo-django",
"id": "aa64e972f3d0845d8f67529a47fbd24a03d9f751",
"size": "274",
"bina... |
from django.db import models
class Platform(models.Model):
name = models.CharField(max_length=200)
class Meta:
ordering = ['name']
def __str__(self):
return '{}'.format(self.name)
@staticmethod
def autocomplete_search_fields():
return ('name__exact', 'name__icontains')
... | {
"content_hash": "ab932c4e98f452f8221b98552e967be9",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 90,
"avg_line_length": 32.15,
"alnum_prop": 0.6516329704510109,
"repo_name": "bryanveloso/avalonstar-tv",
"id": "56e57a16954bf0e1fb8314590417ffa5ebaf19f9",
"size": "1310",
... |
import eventlet
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
import six
from cinder import exception
from cinder.i18n import _, _LE, _LI, _LW
from cinder.objects import fields
from cinder.volume import driver
from cinder.volume.drivers.dell import dell_storagecenter_a... | {
"content_hash": "9150accc13a24d759f2800e3b661ba19",
"timestamp": "",
"source": "github",
"line_count": 1524,
"max_line_length": 79,
"avg_line_length": 46.02165354330709,
"alnum_prop": 0.5278098578496372,
"repo_name": "bswartz/cinder",
"id": "0997a5cdb6502373b521d23a603fd8a6af339b0c",
"size": "7074... |
from __future__ import with_statement
import doctest
import os
import unittest
import sys
try:
from babel import Locale
locale_en = Locale.parse('en_US')
except ImportError:
locale_en = None
from trac.config import Configuration
from trac.core import Component, ComponentManager
from trac.env import Envir... | {
"content_hash": "1fbcfe54416e109536c95028fc948b05",
"timestamp": "",
"source": "github",
"line_count": 436,
"max_line_length": 80,
"avg_line_length": 35.81651376146789,
"alnum_prop": 0.5830558401639344,
"repo_name": "dafrito/trac-mirror",
"id": "93bd8f55f2e31f307ee6d3c002fa7d080dbc648b",
"size": "... |
import numpy as np
from onnx import numpy_helper
def get_node_index(model, node):
i = 0
while i < len(model.graph.node):
if model.graph.node[i] == node:
break
i += 1
return i if i < len(model.graph.node) else None
def add_const(model, name, output, t_value=None, f_value=None)... | {
"content_hash": "dc6dcf30ba9d6c8894324b4877b1f054",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 75,
"avg_line_length": 31.178571428571427,
"alnum_prop": 0.5664375715922108,
"repo_name": "microsoft/onnxruntime",
"id": "3d3feca06a99bd6495b9d3efbc5b6062301e4bc3",
"size":... |
"""Functions for discovering and clearing the build directory."""
import os
import sys
def IsFileNewerThanFile(file_a, file_b):
"""Returns True if file_a's mtime is newer than file_b's."""
def getmtime(f):
try:
return os.path.getmtime(f)
except os.error:
return 0
return getmtime(file_a) >= ... | {
"content_hash": "918c5e833ce9eb00d22483d35e637e88",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 80,
"avg_line_length": 33.629629629629626,
"alnum_prop": 0.6850220264317181,
"repo_name": "chromium/chromium",
"id": "172109f21dd298772509d8e793ea546dc3191c11",
"size": "19... |
from bokeh.core.properties import Any, Dict, Instance, String
from bokeh.models import ColumnDataSource, LayoutDOM
# This defines some default options for the Graph3d feature of vis.js
# See: http://visjs.org/graph3d_examples.html for more details. Note
# that we are fixing the size of this component, in ``options``, ... | {
"content_hash": "1730e9314a81480c2f381b027c09ae8c",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 90,
"avg_line_length": 39.42372881355932,
"alnum_prop": 0.6831470335339639,
"repo_name": "stonebig/bokeh",
"id": "b5856aade99303cf76303cbf9ec1b8aa9ad00a85",
"size": "2326",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.