text stringlengths 4 1.02M | meta dict |
|---|---|
import json
import os
import glob
import re
import uuid
import logging
from placebo.serializer import serialize, deserialize
LOG = logging.getLogger(__name__)
DebugFmtString = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
class FakeHttpResponse(object):
def __init__(self, status_code):
self.st... | {
"content_hash": "47791bdce3afc3644911c58351cca0c4",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 77,
"avg_line_length": 38.69322709163347,
"alnum_prop": 0.5647652388797364,
"repo_name": "HesselTjeerdsma/Cyber-Physical-Pacman-Game",
"id": "1589da5b49c418680f38d355b3c18d0... |
"""
This file contains the class definitions for various priors.
"""
__author__ = 'Brandon C. Kelly'
import numpy as np
from scipy import stats
class Prior(object):
"""
Base class for prior distribution objects. The two main methods of the prior class are Draw() and
LogDensity(), both of which must be o... | {
"content_hash": "ae35a1ca5e0d483e7ded12987f25a242",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 105,
"avg_line_length": 30.556603773584907,
"alnum_prop": 0.6214881136153134,
"repo_name": "acbecker/BART",
"id": "60f996f021b8d2e3b900c0aeb011346d260c5607",
"size": "3239... |
import re
from datetime import datetime
from typing import Any, Dict, List
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.lib.actions import check_send_stream_message
from zerver.lib.exceptions import JsonableError
from zerver.lib.response import json_s... | {
"content_hash": "ae73e76c40f0d20df7190d2728617dd2",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 83,
"avg_line_length": 39.3780487804878,
"alnum_prop": 0.6577887890987922,
"repo_name": "brockwhittaker/zulip",
"id": "db7048492dfa3c3c45f1debd75931f09a1a7a4fb",
"size": "3... |
from __future__ import absolute_import
from zope.interface import implementer
from twisted.protocols.policies import ProtocolWrapper
try:
# noinspection PyUnresolvedReferences
from twisted.web.error import NoResource
except ImportError:
# starting from Twisted 12.2, NoResource has moved
from twisted.w... | {
"content_hash": "20fea201b2749a609b66180eec947d16",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 157,
"avg_line_length": 35.28888888888889,
"alnum_prop": 0.6446263643996641,
"repo_name": "RyanHope/AutobahnPython",
"id": "79d979f49a325a4e01c4ab8b621a296dc24900da",
"siz... |
from __future__ import unicode_literals
from django.contrib import admin
from ModelTest_app.models import Contact
# Register your models here.
admin.site.register(Contact)
| {
"content_hash": "d2dd6546c98539830f5b9eb505cb444b",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 40,
"avg_line_length": 21.875,
"alnum_prop": 0.8,
"repo_name": "GunnerJnr/_CodeInstitute",
"id": "817ec6028675edb4cb41e85b5d843db631eb8277",
"size": "199",
"binary": false... |
import os
from os.path import join
from settings import *
from common import delete
def cleanall(projecthome, verbose=False):
"""
Delete all BLCI configurations and metadata files
**Positional Arguments:**
projecthome:
- The path to the root of the project
**Optional Arguments:**
ve... | {
"content_hash": "4b8b09bde64a0ca1448ef5751c6c423c",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 60,
"avg_line_length": 21.60919540229885,
"alnum_prop": 0.6595744680851063,
"repo_name": "neurodata/blci",
"id": "5a2d07b006ea71a75e21d0d07f367dca01e764e6",
"size": "2578",... |
from constants import EOW, EOS, SOS
def w2tok(word, maxlen, pad=None):
if len(word) >= maxlen - 1:
word = word[0: maxlen - 1]
word += EOW
if pad is not None and len(word) < maxlen:
word += pad * (maxlen - len(word))
assert len(word) == maxlen
return word
def w2str(word):
if word == SOS:
re... | {
"content_hash": "dd6c58b40e22aee4793f3132ca7a44fc",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 44,
"avg_line_length": 20.157894736842106,
"alnum_prop": 0.5926892950391645,
"repo_name": "milankinen/c2w2c",
"id": "ca593cf728142d48e6485dc5474a455867dd86a7",
"size": "383... |
from os.path import dirname
from ipkg.build import Formula, File
class foo(Formula):
name = 'foo'
version = '1.0'
sources = File(dirname(__file__) + '/../../sources/foo-1.0.tar.gz')
platform = 'any'
def install(self):
self.run_cp(['README', self.environment.prefix + '/foo.README'])
| {
"content_hash": "59f7611efea5a2063715ad116c6a6f7c",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 72,
"avg_line_length": 22.571428571428573,
"alnum_prop": 0.6107594936708861,
"repo_name": "pmuller/ipkg",
"id": "1a4f1c919b299942a82c6932d7f00aabeb8479d0",
"size": "316",
... |
"""
Created on Tue May 30 16:55:32 2017
@author: azkei
The operations of permutation(random reordering) of a Series or the rows
of a DataFrame are easy to do using the numpy.random.permutation() function
"""
# For this example, we create a DataFrame containing integers in ascending order
nframe = pd.DataFrame(np.arang... | {
"content_hash": "444f8eedec784ee311400dd0c4466e79",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 85,
"avg_line_length": 41.1764705882353,
"alnum_prop": 0.7585714285714286,
"repo_name": "jjsalomon/python-analytics",
"id": "c926f7922fd099e947f0e73f997bba5871df5785",
"siz... |
import os
import subprocess
from pathlib import Path
import typing as T
def ls_as_bytestream() -> bytes:
if os.path.exists('.git'):
return subprocess.run(['git', 'ls-tree', '-r', '--name-only', 'HEAD'],
stdout=subprocess.PIPE).stdout
files = [str(p) for p in Path('.').glo... | {
"content_hash": "93b8c94ded50dd947c7dc86040394226",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 78,
"avg_line_length": 28.71794871794872,
"alnum_prop": 0.5705357142857143,
"repo_name": "QuLogic/meson",
"id": "9098efb395c582350660415c6a55fb392808b69d",
"size": "1708",
... |
'''
Classes:
Dataset - Container for a dataset's attributes and data.
Bounds - Container for holding spatial and temporal bounds information
for operations on a Dataset.
'''
import os
import numpy
import logging
import datetime as dt
from mpl_toolkits.basemap import Basemap
import netCDF4
i... | {
"content_hash": "7d93b508f2818aeeea309a866ffb1065",
"timestamp": "",
"source": "github",
"line_count": 361,
"max_line_length": 108,
"avg_line_length": 36.67313019390582,
"alnum_prop": 0.5679431981267468,
"repo_name": "jarifibrahim/climate",
"id": "196913a13445b888a154559020342465db388438",
"size":... |
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from .. import models
from ..._serialization import Deserializer, Serializer
from ._configuration import ComputeManagementClientConfi... | {
"content_hash": "fe492fd2d91529f5142a7577b4119933",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 115,
"avg_line_length": 48.989583333333336,
"alnum_prop": 0.7161386349138847,
"repo_name": "Azure/azure-sdk-for-python",
"id": "dd9494935b7b95690939c8808eef0c80679c02c2",
"... |
"""
DEPRECATED functions that implement the same command line interface as the
legacy glance client.
"""
import argparse
import sys
import urlparse
from glanceclient.common import utils
SUCCESS = 0
FAILURE = 1
def get_image_fields_from_args(args):
"""
Validate the set of arguments passed as field name/val... | {
"content_hash": "d93285ef1b7a3d43dafee1e7834b5c43",
"timestamp": "",
"source": "github",
"line_count": 493,
"max_line_length": 79,
"avg_line_length": 33.25557809330629,
"alnum_prop": 0.5841415065568771,
"repo_name": "neumerance/deploy",
"id": "c9da52cbe66c2c700a64e53ec39d77384caa1627",
"size": "17... |
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),
('catalogue', '0002_topicarea'),
]
operations = [
... | {
"content_hash": "2ea8fd6a738ec9578500a223ff5200da",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 114,
"avg_line_length": 33.32,
"alnum_prop": 0.6002400960384153,
"repo_name": "arjweb/openeye",
"id": "352e98edb90c6430643b66785687254c2074f736",
"size": "857",
"binary":... |
from .login import LoginResource
from .users import UsersResource, UsersListResource
| {
"content_hash": "673209f070f352c4e7941f599d516f00",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 51,
"avg_line_length": 42.5,
"alnum_prop": 0.8588235294117647,
"repo_name": "cloughrm/Flask-Angular-Template",
"id": "48740ee645219ea7d93d5fd53d7957170dd1830d",
"size": "85"... |
"""
A palindromic number reads the same both ways.
The largest palindrome made from the product of two 2-digit numbers is
9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
"""
def is_palindrome(string):
if string[::-1] == string:
return True
else:
r... | {
"content_hash": "11154ff1844d7b153299b8dde3447a1a",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 73,
"avg_line_length": 25.307692307692307,
"alnum_prop": 0.60790273556231,
"repo_name": "jjangsangy/Project-Euler",
"id": "bad4dfdffdc2d56447be64de1fce2377bb415928",
"size"... |
from flask import Flask, request, session, send_from_directory, render_template
from flask import Blueprint
import json
import api
from api.common import WebSuccess, WebError
from api.annotations import api_wrapper, require_login, require_teacher, require_admin, check_csrf
from api.annotations import block_before_com... | {
"content_hash": "ad7c601857177f9f22c8cbd36015bf5d",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 98,
"avg_line_length": 33.02,
"alnum_prop": 0.6862507571168989,
"repo_name": "stuyCTF/stuyCTF-Platform",
"id": "a22a29cd82b426a2083325ceec4290f5aaf08a23",
"size": "3302",
... |
from vitrage.datasources.driver_base import DriverBase
from vitrage import os_clients
class NovaDriverBase(DriverBase):
def __init__(self):
super(NovaDriverBase, self).__init__()
self._client = None
@property
def client(self):
if not self._client:
self._client = os_cli... | {
"content_hash": "5c9bed8f82ea78a9fae217796a1da9ae",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 54,
"avg_line_length": 26.214285714285715,
"alnum_prop": 0.6430517711171662,
"repo_name": "openstack/vitrage",
"id": "9c2045e409dca61b8951e516cc309f22559cb5fa",
"size": "95... |
"""
Definition of App class and the app manager.
"""
import os
import time
import inspect
import logging
import tornado.ioloop
import tornado.web
from ..util.icon import Icon
from ..webruntime import launch
from .clientcode import clientCode, Exporter # global client code
from .serialize import serializer
from .pai... | {
"content_hash": "dfe4a588b8718325b74dd4ba3afbe9f6",
"timestamp": "",
"source": "github",
"line_count": 571,
"max_line_length": 102,
"avg_line_length": 35.25919439579685,
"alnum_prop": 0.5727909402473551,
"repo_name": "almarklein/flexx",
"id": "e8302d8ac448508f499cb5d041e6f2e2a56757d0",
"size": "20... |
"""Generate .gclient file for Angle.
Because gclient won't accept "--name ." use a different name then edit.
"""
import subprocess
import sys
def main():
gclient_cmd = ('gclient config --name change2dot --unmanaged '
'https://chromium.googlesource.com/angle/angle.git')
try:
rc = s... | {
"content_hash": "52d3f41a44c28d62263b895b090078ed",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 71,
"avg_line_length": 24.424242424242426,
"alnum_prop": 0.6029776674937966,
"repo_name": "youtube/cobalt",
"id": "e039007714a24c913d12de70f4040dd3caccda4a",
"size": "979",... |
"""
This module contains the Location class.
"""
# Will Holmgren, University of Arizona, 2014-2016.
import datetime
import pandas as pd
import pytz
from pvlib import solarposition
from pvlib import clearsky
from pvlib import atmosphere
class Location(object):
"""
Location objects are convenient containers... | {
"content_hash": "b658a7ec1bc0dd14e3f57ad7ca24369d",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 78,
"avg_line_length": 31.857707509881422,
"alnum_prop": 0.5450372208436725,
"repo_name": "ianctse/pvlib-python",
"id": "1b0b9db23ef76bec4b7b991623116be8b9d51a65",
"size":... |
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtUiTools import *
from sendMessageForm import sendMessageUI
from addUser import addUserUI
from findUser import findUserUI
from searchProfByCourseID import findProfByCourseIDUI
from addCourseToProfForm import addCourseToProfUI
from searchProfByCourseID ... | {
"content_hash": "728a7f6a69c9fe705172aea72d16b079",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 139,
"avg_line_length": 36.86486486486486,
"alnum_prop": 0.6986803519061584,
"repo_name": "Poom1997/GMan",
"id": "d38181414fcabb3471d0596f563a2b6606818d9e",
"size": "5456"... |
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.a... | {
"content_hash": "598dbea368dc2ae14d67b97a4212ab37",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 76,
"avg_line_length": 24.215686274509803,
"alnum_prop": 0.6898785425101215,
"repo_name": "detiber/lib_openshift",
"id": "fab1882c1d0921927e3a2a5f6d953119301eeccb",
"size":... |
from typing import Callable, List, Optional
class FormattedException(Exception):
pass
class TemplateParserException(Exception):
def __init__(self, message: str) -> None:
self.message = message
def __str__(self) -> str:
return self.message
class TokenizationException(Exception):
de... | {
"content_hash": "6028af7765c81a36480938c48d09d2cb",
"timestamp": "",
"source": "github",
"line_count": 458,
"max_line_length": 101,
"avg_line_length": 30.30131004366812,
"alnum_prop": 0.4909929384637556,
"repo_name": "hackerkid/zulip",
"id": "cf558d7f9df29ef8662255a1dd5a24336e7ebdc9",
"size": "138... |
__author__ = 'sergey'
"""
Class for LZ4 compression helper High Level
"""
import sys
from dedupsqlfs.compression import BaseCompression
class Lz4hCompression(BaseCompression):
_method_name = "lz4"
_minimal_size = 15
_has_comp_level_options = False
def _init_module(self):
if not self._modu... | {
"content_hash": "02c87898205a7104353d55c893bcfb18",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 67,
"avg_line_length": 24.25,
"alnum_prop": 0.6005154639175257,
"repo_name": "sergey-dryabzhinsky/dedupsqlfs",
"id": "6030b27d32e73d1d9d3cdfff3f22335786fa6c6a",
"size": "80... |
"""
almost
~~~~~~
A helper for approximate comparison.
::
from almost import almost
def test_repeating_decimal():
assert almost(1 / 3.) == 0.333
assert almost(1 / 6.) == 0.167
assert almost(3227 / 555., prec=6) == 5.814414
def test... | {
"content_hash": "4628ae3c0dde9f31742036a35e6bffe6",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 74,
"avg_line_length": 31.3855421686747,
"alnum_prop": 0.5552783109404991,
"repo_name": "sublee/almost",
"id": "c347006711c3f1f4dd04ff0c0678a63740c89cef",
"size": "5234",
... |
"""
A UE4 specific PySide based UI Widget for Fast-Fetch functionality.
This Widget will be integrated into the m2uMainWindow by the common UI.
"""
import os
from PySide import QtGui
from m2u.ue4 import assets
thispath = os.path.dirname(os.path.realpath(__file__))
icoFetch = QtGui.QIcon(os.path.join(thispath, "ic... | {
"content_hash": "b5fc2cbd828014fd0bb2ee564db28602",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 78,
"avg_line_length": 29.238095238095237,
"alnum_prop": 0.6815960912052117,
"repo_name": "m2u/m2u",
"id": "d6e336dd26af955ff20c82dd918f06fa91959d6d",
"size": "1228",
"bi... |
from __future__ import absolute_import
from storages.backends.s3boto import S3BotoStorage
MediaS3BotoStorage = lambda: S3BotoStorage(bucket='halalar-media')
StaticS3BotoStorage = lambda: S3BotoStorage(bucket='halalar') | {
"content_hash": "dbc89f66b14989dd51a60938e3e4999f",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 66,
"avg_line_length": 36.833333333333336,
"alnum_prop": 0.8190045248868778,
"repo_name": "jawaidss/halalar-web",
"id": "6b70cb77ceb4f41ab10f624a091bdc7c815205b2",
"size": "... |
import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", "..")))
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make ... | {
"content_hash": "f26964fe2b1ad44f02f3d0956592220c",
"timestamp": "",
"source": "github",
"line_count": 234,
"max_line_length": 94,
"avg_line_length": 32.11538461538461,
"alnum_prop": 0.6991350632069195,
"repo_name": "krisb78/py-couchdb",
"id": "ef33f16cc8eee40bec0bad3264e702c2638422cc",
"size": "7... |
import contextlib
import sys
import os
import itertools
import hashlib
import queue
import random
import select
import time
import OpenSSL.crypto
import logging
from mitmproxy import certs
from mitmproxy import exceptions
from mitmproxy.net import tcp
from mitmproxy.net import websockets
from mitmproxy.net import soc... | {
"content_hash": "d27a2b3f4af568511d737ab41408c83a",
"timestamp": "",
"source": "github",
"line_count": 589,
"max_line_length": 131,
"avg_line_length": 33.835314091680814,
"alnum_prop": 0.4910432033719705,
"repo_name": "mosajjal/mitmproxy",
"id": "4a61334999f37e83ca3996c3c6122e99d6be7c93",
"size": ... |
"""Class for screen sizes and orientation."""
import objc_util
import ui
app = objc_util.UIApplication.sharedApplication()
UIScreen = objc_util.ObjCClass("UIScreen")
orientation_codes = {
1: "bottom",
2: "top",
3: "left",
4: "right"
}
class _ScreenOrientation(object):
"""Represents a device ori... | {
"content_hash": "c8b985c396a66e10f89affdfb99d2dc7",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 74,
"avg_line_length": 23.164948453608247,
"alnum_prop": 0.5990209167779261,
"repo_name": "controversial/ui2",
"id": "15ef5cde3ba8b8f4c84042d49efaaf5d1e034e70",
"size": "22... |
from klein import Klein
app = Klein()
@app.route('/user/<username>')
def pg_user(request, username):
return 'Hi %s!' % (username,)
app.run("localhost", 8080)
| {
"content_hash": "e2f21a770ebb9a579e726560ce6410f5",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 33,
"avg_line_length": 20.5,
"alnum_prop": 0.6585365853658537,
"repo_name": "brighid/klein",
"id": "d72776eb61d69de04d6271bab3adb6d612bdd097",
"size": "164",
"binary": fal... |
import sqlalchemy as sql
def upgrade(migrate_engine):
meta = sql.MetaData()
meta.bind = migrate_engine
request_token_table = sql.Table('request_token', meta, autoload=True)
request_token_table.c.requested_roles.alter(name="role_ids", nullable=True)
access_token_table = sql.Table('access_token', me... | {
"content_hash": "8de18410426a63add03ae17d28601d82",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 79,
"avg_line_length": 41.25,
"alnum_prop": 0.6836363636363636,
"repo_name": "cloudbau/keystone",
"id": "aec13b8d1f51ac1996d9c99fbf547f99d26cd0de",
"size": "1456",
"binar... |
import kfp
from kfp import components
from kfp import dsl
robomaker_sim_job_op = components.load_component_from_file(
"../../simulation_job/component.yaml"
)
@dsl.pipeline(
name="Run RoboMaker Simulation Job",
description="RoboMaker Simulation Job test pipeline",
)
def robomaker_simulation_job_test(
... | {
"content_hash": "7e6211c737cd6f6072d422023b5b0d92",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 86,
"avg_line_length": 24.833333333333332,
"alnum_prop": 0.6289549376797698,
"repo_name": "kubeflow/pipelines",
"id": "34fcea30fb327a9f172933d2468a561562406b9c",
"size": "1... |
wide_columns = [
gender, native_country, education, occupation, workclass, relationship, age_buckets,
tf.contrib.layers.crossed_column([education, occupation], hash_bucket_size=int(1e4)),
tf.contrib.layers.crossed_column([native_country, occupation], hash_bucket_size=int(1e4)),
tf.contrib.layers.crossed_column(... | {
"content_hash": "c71e0242182225caeeff77b471fd4779",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 109,
"avg_line_length": 39.354166666666664,
"alnum_prop": 0.7112228692429857,
"repo_name": "zlpmichelle/crackingtensorflow",
"id": "2f2d0ce4133be259b29968afeb39a1297827334b",... |
from __future__ import absolute_import, unicode_literals
import mock
from django import test
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponse
from braces.views import AjaxResponseMixin
from .compat import force_text
from .factories import ArticleFactory, UserFactory
from ... | {
"content_hash": "f9aeab80a54501811f6538df46294ea2",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 80,
"avg_line_length": 36,
"alnum_prop": 0.6091763405196241,
"repo_name": "hochanh/django-braces",
"id": "b5e95dad2ec439d8a1aee2c121c21ffb9b175f8d",
"size": "7236",
"bin... |
from .base import logmmse, logmmse_from_file
| {
"content_hash": "2ef64b9c78851316362fc0b8c9ed97ed",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 44,
"avg_line_length": 45,
"alnum_prop": 0.8,
"repo_name": "braindead/logmmse",
"id": "1569462445a69c905ae057e22de367a116dda67e",
"size": "45",
"binary": false,
"copies"... |
import logging
class Singleton:
"""
A non-thread-safe helper class to ease implementing singletons.
This should be used as a decorator -- not a metaclass -- to the
class that should be a singleton.
The decorated class can define one `__init__` function that
takes only the `self` argument. Other than that,... | {
"content_hash": "7cf337ea106b110e19ca27b94d688092",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 72,
"avg_line_length": 29.976744186046513,
"alnum_prop": 0.6974398758727696,
"repo_name": "eusyar/4fun",
"id": "6dd3d2ec2aa6ea2084acc949d7b35f1b5ee73c07",
"size": "1289",
... |
"""
=========================================================
Pipelining: chaining a PCA and a logistic regression
=========================================================
The PCA does an unsupervised dimensionality reduction, while the logistic
regression does the prediction.
We use a GridSearchCV to set the dimens... | {
"content_hash": "bdd1770f90e6e22b43602d09ccab098a",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 79,
"avg_line_length": 26.676923076923078,
"alnum_prop": 0.5951557093425606,
"repo_name": "lucidfrontier45/scikit-learn",
"id": "8c9f061720122a67b9233538a3cbc06d10d19aa0",
... |
"""
Django settings for cs490 project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impo... | {
"content_hash": "9cf939b097782ca86f44fe86887a743b",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 121,
"avg_line_length": 22.801242236024844,
"alnum_prop": 0.705802233723781,
"repo_name": "thebenwaters/openclickio",
"id": "edf1e533465ea8e6b4eb5cb659ea88080d170003",
"si... |
import awscli.clidriver
import sys
import logging
import copy
LOG = logging.getLogger(__name__)
class Completer(object):
def __init__(self):
self.driver = awscli.clidriver.create_clidriver()
self.main_hc = self.driver.create_help_command()
self.main_options = self._documented(self.main_h... | {
"content_hash": "f09908fdff763864a5f92de7cac9393c",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 89,
"avg_line_length": 37.98809523809524,
"alnum_prop": 0.55531181447822,
"repo_name": "LockScreen/Backend",
"id": "e457260277c889097049d7d5a86db88868ca9a26",
"size": "694... |
from setuptools import setup
setup(name='nyan_logger',
version='0.2',
description='A nyan cat log formatter for the python logging module.',
url='https://github.com/tomhennigan/nyan_logger',
author='Tom Hennigan, Louise Deason',
author_email='tomhennigan@gmail.com',
license='MIT',
... | {
"content_hash": "d04664739418afb96067bf05e43265c3",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 77,
"avg_line_length": 37.375,
"alnum_prop": 0.6147157190635452,
"repo_name": "0x90/nyan_logger",
"id": "c69813fdc86ad67b6f6bc8485d7377ce659fa402",
"size": "1495",
"binar... |
import wx
import generic_class
from .constants import control, dtype, substitution_map
import os
import yaml
import modelDesign_window
ID_RUN = 11
class ModelConfig(wx.Frame):
# this creates the wx.Frame mentioned above in the class declaration
def __init__(self, parent, gpa_settings=None):
wx.Fr... | {
"content_hash": "aab519d9d8efa60f4898375521dd19dd",
"timestamp": "",
"source": "github",
"line_count": 1502,
"max_line_length": 568,
"avg_line_length": 39.826897470039945,
"alnum_prop": 0.5083584085590104,
"repo_name": "erramuzpe/C-PAC",
"id": "66a5e9d86e835936b55df5b31b6c86883318ce97",
"size": "5... |
import abc
import functools
import os
from oslo.utils import importutils
import six
import webob.dec
import webob.exc
import nova.api.openstack
from nova.api.openstack import wsgi
from nova.api.openstack import xmlutil
from nova import exception
from nova.i18n import _
from nova.i18n import _LW
from nova.openstack.co... | {
"content_hash": "91fe0d2b7eb80a981feb575d3183c4df",
"timestamp": "",
"source": "github",
"line_count": 493,
"max_line_length": 79,
"avg_line_length": 32.66125760649087,
"alnum_prop": 0.5945845236616569,
"repo_name": "vmthunder/nova",
"id": "8bb8d38befd5c73f6da1c6e542de66fe25ec3ba0",
"size": "16776... |
import unittest
import imath
import IECore
import Gaffer
import GafferTest
import GafferScene
import GafferSceneTest
class ParentConstraintTest( GafferSceneTest.SceneTestCase ) :
def test( self ) :
plane1 = GafferScene.Plane()
plane1["transform"]["translate"].setValue( imath.V3f( 1, 2, 3 ) )
plane1["transfo... | {
"content_hash": "fbebd521c37a82ae6c4ee8a313297910",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 173,
"avg_line_length": 32.03649635036496,
"alnum_prop": 0.6746411483253588,
"repo_name": "boberfly/gaffer",
"id": "277192b58c2138c001e7515e3dfb5aa28476bdbe",
"size": "619... |
from __future__ import absolute_import
import urwid
import urwid.util
import os
from netlib.http import CONTENT_MISSING
import netlib.utils
from .. import utils
from ..models import decoded
from . import signals
try:
import pyperclip
except:
pyperclip = False
VIEW_FLOW_REQUEST = 0
VIEW_FLOW_RESPONSE = 1
... | {
"content_hash": "0a6a523bf732f4fe5c11aa9fa529392a",
"timestamp": "",
"source": "github",
"line_count": 430,
"max_line_length": 89,
"avg_line_length": 27.490697674418605,
"alnum_prop": 0.5048642246848828,
"repo_name": "dweinstein/mitmproxy",
"id": "12fdfe27ec2dac0745abfccb661a23bdba1d0161",
"size":... |
from __future__ import unicode_literals
import base64
import json
import logging
import mimetools
import re
from django.conf.urls import include, patterns, url
from django.dispatch import receiver
from django.utils import six
from django.utils.six.moves.urllib.parse import urlparse
from django.utils.six.moves.urllib.... | {
"content_hash": "e7aefcc9758163dfd2ffdeecaaf19d5f",
"timestamp": "",
"source": "github",
"line_count": 630,
"max_line_length": 79,
"avg_line_length": 35.63333333333333,
"alnum_prop": 0.6100939908236447,
"repo_name": "sgallagher/reviewboard",
"id": "2eb1efcc6eae71fd99ee4efcc819ae19e81017f9",
"size"... |
"""xla is an experimental library that provides XLA support APIs."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import contextlib
from six.moves import xrange # pylint: disable=redefined-builtin
from tensorflow.compiler.jit.ops imp... | {
"content_hash": "211bfada010909138cc1e4027bc39fb7",
"timestamp": "",
"source": "github",
"line_count": 603,
"max_line_length": 85,
"avg_line_length": 35.966832504145934,
"alnum_prop": 0.6984046477314644,
"repo_name": "chemelnucfin/tensorflow",
"id": "55bfaeb39312c950d4adbaa5f3cf0ecddb4faca6",
"siz... |
""" ChassisSlot sets up a structure for tracking position within a chassis. """
from sqlalchemy import Column, Integer, ForeignKey, PrimaryKeyConstraint
from sqlalchemy.orm import relation, backref
from aquilon.aqdb.model import Base, Machine, Chassis
_TN = 'chassis_slot'
class ChassisSlot(Base):
""" ChassisSl... | {
"content_hash": "bf972b09c52441721238680fd8ad26f4",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 80,
"avg_line_length": 40.23076923076923,
"alnum_prop": 0.5927342256214149,
"repo_name": "stdweird/aquilon",
"id": "d1c7e3e30c022fcbb7664fafd495f999aacb469a",
"size": "2277... |
"""Common utilities for the tests
"""
import time
import unittest
import random
random.seed()
from antevents.base import IterableAsPublisher, DefaultSubscriber, FatalError,\
SensorEvent
class RandomSensor:
def __init__(self, sensor_id, mean=100.0, stddev=20.0, stop_after_events=None):
self.sensor_id ... | {
"content_hash": "8ad852a79c9242f2b8832ecee6bad72a",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 102,
"avg_line_length": 37.79,
"alnum_prop": 0.5903678221751786,
"repo_name": "mpi-sws-rse/antevents-python",
"id": "bf2a7fc17edf725d9591443a41905a92f4d9eb54",
"size": "76... |
import os
from functions_framework import _function_registry
def test_get_function_signature():
test_cases = [
{
"name": "get decorator type",
"function": "my_func",
"registered_type": "http",
"flag_type": "event",
"env_type": "event",
... | {
"content_hash": "3d0d7446d7ca3f164368465782054105",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 83,
"avg_line_length": 31.612244897959183,
"alnum_prop": 0.5326016785022595,
"repo_name": "GoogleCloudPlatform/functions-framework-python",
"id": "e3ae3c7eea9427a0cd7152cc35b... |
"""
Support for functionality to interact with FireTV devices.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.firetv/
"""
| {
"content_hash": "484e186da5c8d74380b16f6d3fa3390d",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 74,
"avg_line_length": 33.5,
"alnum_prop": 0.7910447761194029,
"repo_name": "HydrelioxGitHub/home-assistant",
"id": "68f556313328dee9dfaa86c3e50eba4c20d660ec",
"size": "201"... |
import queue
import threading
from .http_common import *
import simple_http_client
import utils
def pack_headers(headers):
out_list = []
for k, v in headers.items():
if isinstance(v, int):
out_list.append(b'%s: %d\r\n' % (utils.to_bytes(k), v))
else:
out_list.append(b'... | {
"content_hash": "ff2d234b5005972ebd89562f4b8b9de0",
"timestamp": "",
"source": "github",
"line_count": 287,
"max_line_length": 111,
"avg_line_length": 35.76655052264808,
"alnum_prop": 0.5379444715051145,
"repo_name": "xyuanmu/XX-Net",
"id": "d68ca6c8bd096ab6e207d569f2e7d65e851f3954",
"size": "1026... |
from flask import request
from netman.api.api_utils import BadRequest, to_response
from netman.api.objects import bond, interface, vlan
from netman.api.switch_api_base import SwitchApiBase
from netman.api.validators import Switch, is_boolean, is_vlan_number, Interface, Vlan, resource, content, is_ip_network, \
IPN... | {
"content_hash": "6cb11afb80b65372a9b2f853b438d420",
"timestamp": "",
"source": "github",
"line_count": 1177,
"max_line_length": 174,
"avg_line_length": 36.714528462192014,
"alnum_prop": 0.6286302732973874,
"repo_name": "internaphosting/netman",
"id": "364ed37e9acc22b0a46a20dcd8896b9958abab6b",
"si... |
"""
This module is used to load configurations.
"""
import json
import os
class ConfigurationManager(object):
"""
A class that will be used to setup the configuration.
Available configurations:
- Parameters:
- number_of_topics: int
- number_of_peers: int
- min_similarity_thresh... | {
"content_hash": "be0a05318913cca41fef429299407cd5",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 101,
"avg_line_length": 28.919540229885058,
"alnum_prop": 0.6255961844197139,
"repo_name": "anasalzogbi/SciPRec",
"id": "1649bfe7f5f8fce45fd304e108c7b485e1204eb4",
"size": ... |
class Region(object):
"""Region corresponds to a Digital Ocean data center"""
def __init__(self, identifier, name):
self.id = identifier
self.name = name
def __repr__(self):
return "<%s: %s>" % (self.id, self.name)
def __str__(self):
return "%s: %s" % (self.id, self.na... | {
"content_hash": "5955f9fc35df2bab9f100f23e02b535a",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 74,
"avg_line_length": 28.754716981132077,
"alnum_prop": 0.5656167979002624,
"repo_name": "pirate42/docc",
"id": "be99cbcb1d2a90b20c075633ca5c215803f6f2ff",
"size": "1541",... |
import os
import warnings
import sys
import pandas as pd
import numpy as np
from itertools import cycle
import matplotlib.pyplot as plt
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
from sklearn.model_selection import train_test_split
from sklearn.linear_model import ElasticNet
from skl... | {
"content_hash": "8094290cbb87662bed5adf7dc3490b4e",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 122,
"avg_line_length": 30.33653846153846,
"alnum_prop": 0.6694136291600634,
"repo_name": "mlflow/mlflow",
"id": "d94880053bc096cc854872d1825a15057d4f0c2d",
"size": "3960"... |
from django.utils.timezone import now as timezone_now
from zerver.lib.actions import do_change_stream_invite_only
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Message, UserMessage, get_client, get_realm, get_stream
class TopicHistoryTest(ZulipTestCase):
def test_topics_history_zeph... | {
"content_hash": "d87c070fbe8417db0b3e268349cb6888",
"timestamp": "",
"source": "github",
"line_count": 287,
"max_line_length": 100,
"avg_line_length": 36.47038327526133,
"alnum_prop": 0.5819241425432311,
"repo_name": "hackerkid/zulip",
"id": "737ec4a0cdf14732dd66d95ad8d1f2e8c0171cb0",
"size": "104... |
"""
Initialization file for extract library directory.
This library handles extracting data from the Twitter API and outputting
to a staging area as a CSV, so that it can be transformed and then loaded into
the DB later.
If extract and load steps happened in one command, then an error on writing
to the db would mean ... | {
"content_hash": "c5cfde12452bc699ff0b046c34d9d614",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 78,
"avg_line_length": 46.15384615384615,
"alnum_prop": 0.79,
"repo_name": "MichaelCurrin/twitterverse",
"id": "2b000f5e89f4974255bab7f2b01af5079bf5777e",
"size": "600",
... |
def packBounds(xMin, xMax, yMin, yMax):
return [[xMin, xMax], [yMin, yMax]]
def unpackBounds(bounds):
xMin, xMax = bounds[0]
yMin, yMax = bounds[1]
return [xMin, xMax, yMin, yMax]
def nextMove(width, height, x, y, direction, bounds):
xMin, xMax, yMin, yMax = unpackBounds(bounds)
if direction == "U":
yMax = y... | {
"content_hash": "41d9054e0772373609c67cfdc55bc340",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 91,
"avg_line_length": 23.620689655172413,
"alnum_prop": 0.6248175182481752,
"repo_name": "AntoineAugusti/katas",
"id": "6f9e049732895a3808215a8c50b4dcf332f0fff8",
"size": ... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('EOSS', '0009_auto_20210401_1737'),
]
operations = [
migrations.AddField(
model_name='eosscontext',
name='vassar_ready',
field=models.BooleanField(default... | {
"content_hash": "ae72555f7af1d2225f0155ae236184c9",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 53,
"avg_line_length": 21.625,
"alnum_prop": 0.5809248554913294,
"repo_name": "seakers/daphne_brain",
"id": "41c872e3148b73106d15f045b9eddb7ae347a5d7",
"size": "395",
"bi... |
"""
Support for controlling GPIO pins of a Raspberry Pi.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/rpi_gpio/
"""
# pylint: disable=import-error
import logging
from homeassistant.const import (
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STO... | {
"content_hash": "dfb780cac94dcbb54e16bdd148619b0c",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 75,
"avg_line_length": 24.28985507246377,
"alnum_prop": 0.6610978520286396,
"repo_name": "persandstrom/home-assistant",
"id": "824ec46d636d3ceb5a6e725aab7db7dedc21aaa1",
"s... |
import collections
import importlib
import sys
import os
import os.path
import tempfile
import subprocess
import py_compile
import contextlib
import shutil
import zipfile
from importlib.util import source_from_cache
from test.support import make_legacy_pyc, strip_python_stderr
# Cached result of the expensive test p... | {
"content_hash": "240643f2fff3664ed301ae31df77125d",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 112,
"avg_line_length": 39.66122448979592,
"alnum_prop": 0.61912112792014,
"repo_name": "MalloyPower/parsing-python",
"id": "80889b17f3f376d875cc57d1a41d4f0c1653843a",
"si... |
from distutils.core import setup
setup(
name = 'posical',
py_modules = ['posical'],
version = '0.1.4',
description = 'Calendar reform for Python',
author = 'Z. D. Smith',
author_email = 'zd@zdsmith.com',
url = 'https://github.com/subsetpark/posical',
download_url = 'https://github.com/subsetpark/posical... | {
"content_hash": "8f193dfd1618a93fba52c159c05e1783",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 74,
"avg_line_length": 32.07142857142857,
"alnum_prop": 0.6570155902004454,
"repo_name": "subsetpark/posical",
"id": "b6713da95555b6349b7b1979fc8b24e7f411ea24",
"size": "44... |
"""Functions to plot epochs data
"""
# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Denis Engemann <denis.engemann@gmail.com>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Eric Larson <larson.eric.d@gmail.com>
# Jaakko Leppakangas <jaeilepp@student.jyu.f... | {
"content_hash": "5650341d03ce3fe62f4895d03941c3fe",
"timestamp": "",
"source": "github",
"line_count": 1529,
"max_line_length": 79,
"avg_line_length": 41.00327011118378,
"alnum_prop": 0.5463840239895364,
"repo_name": "cmoutard/mne-python",
"id": "3f5d6511cf31443388bac9bdfafaee8b0836dbb5",
"size": ... |
"""
Adds support for heat control units.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/thermostat.heat_control/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components import switch... | {
"content_hash": "342f1e7045a901f1a4bb192ca3f9caf1",
"timestamp": "",
"source": "github",
"line_count": 215,
"max_line_length": 79,
"avg_line_length": 35.16744186046512,
"alnum_prop": 0.6101044835339241,
"repo_name": "varunr047/homefile",
"id": "faf4059f891917a1e78363c97ae049695c046807",
"size": "7... |
"""Tests for dm_control.composer.props.primitive."""
from absl.testing import absltest
from absl.testing import parameterized
from dm_control import composer
from dm_control import mjcf
from dm_control.entities.props import primitive
import numpy as np
class PrimitiveTest(parameterized.TestCase):
def _make_free_... | {
"content_hash": "c57cd776ac95023c7e923f8db1c71201",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 72,
"avg_line_length": 36.548780487804876,
"alnum_prop": 0.6770103436770103,
"repo_name": "deepmind/dm_control",
"id": "ae8f3265ccaa798bea5c59871fb765277c83d16f",
"size": "... |
"""
Test for: command line arguments
"""
from nose.tools import eq_, assert_raises
from m2bk import app, config, const
import os
def _get_arg_cfg_file_name(arg, filename):
try:
app.init_parsecmdline([arg, filename])
except FileNotFoundError:
pass
return config.get_config_file_name()
def... | {
"content_hash": "eb698ca410d1c2ff17e6edc60cc3a4fe",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 123,
"avg_line_length": 31.962962962962962,
"alnum_prop": 0.6251448435689455,
"repo_name": "axltxl/m2bk",
"id": "7c4ff567e605de02cd9160bd6a2e993763c590d4",
"size": "1751",
... |
import importlib
import logging
import pkg_resources
from datetime import datetime, timedelta, time
import requests
DT_FORMAT = '%Y-%m-%dT%H:%M:%SZ'
LOG = logging.getLogger(__name__)
def parse_timedelta(delta):
hours, minutes, seconds = map(int, delta.split(':'))
return timedelta(hours=hours, minutes=minute... | {
"content_hash": "41c5a155c5ffac000a639060ba238844",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 72,
"avg_line_length": 26.75862068965517,
"alnum_prop": 0.618127147766323,
"repo_name": "yoshrote/boss",
"id": "b7d5d4ec69e77b9d3f24becb3d1cb78ec3f15d4b",
"size": "2328",
... |
"""Satori main module."""
__all__ = ('__version__')
try:
import eventlet
eventlet.monkey_patch()
except ImportError:
pass
import pbr.version
from satori import shell
version_info = pbr.version.VersionInfo('satori')
try:
__version__ = version_info.version_string()
except AttributeError:
__versi... | {
"content_hash": "de65c253159e560bef52319fed572506",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 52,
"avg_line_length": 17.93103448275862,
"alnum_prop": 0.6442307692307693,
"repo_name": "lil-cain/satori",
"id": "989ced303607671dbb0575fd7fa26fb95b7e20ab",
"size": "1084"... |
import unittest
import os
import test.functional as tf
from swift.common.middleware.s3api.etree import fromstring
from test.functional.s3api import S3ApiBase
from test.functional.s3api.s3_test_client import Connection
from test.functional.s3api.utils import get_error_code
def setUpModule():
tf.setup_package()
... | {
"content_hash": "4c8731b758ed9e80aa032ee384c33ae2",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 75,
"avg_line_length": 33.94186046511628,
"alnum_prop": 0.6546762589928058,
"repo_name": "swiftstack/swift",
"id": "77779cba078113e92bcf83e548919517096bae03",
"size": "3509... |
from __future__ import print_function
import sys
from pdc_client.plugin_helpers import PDCClientPlugin, add_parser_arguments, extract_arguments
class BuildImagePlugin(PDCClientPlugin):
command = 'build-image'
def register(self):
self.set_command()
list_parser = self.add_action('list', help... | {
"content_hash": "d5507972381e3e06281e46adc5f0e2d9",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 94,
"avg_line_length": 39.264367816091955,
"alnum_prop": 0.4970725995316159,
"repo_name": "product-definition-center/pdc-client",
"id": "8e5b6f4c534e53d7368c4b00ac7fcad6d2fbf... |
"""Tests decision_mapper"""
import ast
import unittest
from collections import OrderedDict
from xml.etree import ElementTree as ET
from o2a.converter.task import Task
from o2a.mappers import decision_mapper
class TestDecisionMapper(unittest.TestCase):
def setUp(self):
# language=XML
decision_nod... | {
"content_hash": "849c1d812b3d32e20988fc8753acee8c",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 110,
"avg_line_length": 32.03030303030303,
"alnum_prop": 0.554872280037843,
"repo_name": "GoogleCloudPlatform/oozie-to-airflow",
"id": "f9143166f471c4e144ad370af1843aa662d1f4... |
"""
This file is a palceholder for if new clustering algorithms come into
nussl at some point and need to be tested.
"""
from sklearn import datasets
from sklearn.metrics import adjusted_mutual_info_score
from sklearn.preprocessing import StandardScaler
import sklearn
import numpy as np
import pytest
from nussl.ml im... | {
"content_hash": "422a7c475742ac5d67493a07a5bf70a0",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 92,
"avg_line_length": 37.671875,
"alnum_prop": 0.5350476980506014,
"repo_name": "interactiveaudiolab/nussl",
"id": "dfb8fd5b6ddf3fafed74f46b9789af3b1101315e",
"size": "241... |
import string
filename = open('D:\Code\Python4test\sampleFile.txt')
filelines = filename.readlines()
filename.close()
word_cnt = {}
for line in filelines:
line = line.rstrip()
identity = line.maketrans(' ', ' ')
pun_num = string.punctuation + string.digits
line = line.translate(identity)
line = l... | {
"content_hash": "1fc6e838c01b08e9b14dd86bd9df3d8a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 67,
"avg_line_length": 24.833333333333332,
"alnum_prop": 0.6241610738255033,
"repo_name": "ismethr/Code",
"id": "e4467dc84df80bfb594bf4203e98110dd8348223",
"size": "620",
... |
def combination_util(arr, n, r, index, data, i):
"""
Current combination is ready to be printed, print it
arr[] ---> Input Array
data[] ---> Temporary array to store current combination
start & end ---> Staring and Ending indexes in arr[]
index ---> Current index in data[]
r ---> Size of a... | {
"content_hash": "59d286d13538efa438ed37dc7db417f4",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 60,
"avg_line_length": 34.21951219512195,
"alnum_prop": 0.6058446186742694,
"repo_name": "TheAlgorithms/Python",
"id": "819fd8106def1f371e5431e9c0944eb1528305fd",
"size": "... |
from troposphere import Parameter, Ref, Template, Tags, If, Equals, Not, Join
from troposphere.constants import KEY_PAIR_NAME, SUBNET_ID, M4_LARGE, NUMBER
import troposphere.emr as emr
import troposphere.iam as iam
scaling_policy = emr.SimpleScalingPolicyConfiguration(
AdjustmentType="EXACT_CAPACI... | {
"content_hash": "df80eee257e88e2f09ebe7461624376c",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 79,
"avg_line_length": 30.974729241877256,
"alnum_prop": 0.5503496503496503,
"repo_name": "7digital/troposphere",
"id": "add86d953594bd4e5b7abdf8f2708754c5e63955",
"size":... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Summary'
db.create_table(u'liberia_summary', (
(u'id', self.gf('djang... | {
"content_hash": "6bd0f9fe3b5a5d81aa0b4a177227072e",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 148,
"avg_line_length": 95.16265060240964,
"alnum_prop": 0.5719440400075964,
"repo_name": "caseymm/django-ebola",
"id": "48710c982842608678acac8949eaab06e4953abb",
"size":... |
"""
Class for VM tasks like spawn, snapshot, suspend, resume etc.
"""
import base64
import os
import time
import urllib
import urllib2
import uuid
from nova.compute import power_state
from nova import exception
from nova.openstack.common import cfg
from nova.openstack.common import importutils
from nova.openstack.com... | {
"content_hash": "f3da318ddd09b72f6a447508afc1ae6d",
"timestamp": "",
"source": "github",
"line_count": 815,
"max_line_length": 79,
"avg_line_length": 46.011042944785274,
"alnum_prop": 0.5252140057068189,
"repo_name": "aristanetworks/arista-ovs-nova",
"id": "97270fc063020393aa81b1ca3a68d3983185bffa",... |
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
from urllib.parse import parse_qs, urljoin, urlparse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsEr... | {
"content_hash": "f446deb73c2e6c1a0d64fd0343b96004",
"timestamp": "",
"source": "github",
"line_count": 500,
"max_line_length": 199,
"avg_line_length": 43.752,
"alnum_prop": 0.6398793198025233,
"repo_name": "Azure/azure-sdk-for-python",
"id": "fb4ecedabbb2c0150d6f272415af9595f2c43ead",
"size": "223... |
import os
import json
from calvin.utilities.calvinlogger import get_logger
_log = get_logger(__name__)
_config = None
class CalvinConfig(object):
"""
Handle configuration of Calvin, works similiarly to python's ConfigParser
Looks for calvin.conf or .calvin.conf files in:
1. Built-ins
2. Calvin'... | {
"content_hash": "38dcd021a896c468105826546f252bad",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 126,
"avg_line_length": 37.83955223880597,
"alnum_prop": 0.5765703579528646,
"repo_name": "KaptenJon/calvin-base",
"id": "a8f0cc0497c50085b968da9d1be00e056a3887a1",
"size"... |
'''
Run nagios plugins/checks from salt and get the return as data.
'''
# Import python libs
from __future__ import absolute_import
import os
import stat
import logging
# Import 3rd-party libs
import salt.ext.six as six
log = logging.getLogger(__name__)
PLUGINDIR = '/usr/lib/nagios/plugins/'
def __virtual__():
... | {
"content_hash": "2b73971c005b60e788738b0e5619115b",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 90,
"avg_line_length": 24.560439560439562,
"alnum_prop": 0.5522744220730798,
"repo_name": "smallyear/linuxLearn",
"id": "db937f066ef4dde8cc68640076738d37aa76700b",
"size":... |
import numpy as np
from numpy import (dot, eye, diag_indices, zeros, column_stack, ones, diag,
asarray, r_)
from numpy.linalg import inv, solve
#from scipy.linalg import block_diag
from scipy import linalg
#def denton(indicator, benchmark, freq="aq", **kwarg):
# """
# Denton's method to convert low-frequ... | {
"content_hash": "dacb5132510ae9dae97762d2323da436",
"timestamp": "",
"source": "github",
"line_count": 308,
"max_line_length": 80,
"avg_line_length": 34.94805194805195,
"alnum_prop": 0.6069305091044221,
"repo_name": "ChadFulton/statsmodels",
"id": "ae305e87679b3f7e15f9159cf7bc055d5b2842a8",
"size"... |
from __future__ import absolute_import, print_function
import os
import unittest2 as unittest
if os.environ.get('USE_TWISTED', False):
from mock import patch
from zope.interface import implementer
from twisted.internet.interfaces import IReactorTime
@implementer(IReactorTime)
class FakeReactor(ob... | {
"content_hash": "9a1bcdc1ffea824d0a594af9cd321c75",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 90,
"avg_line_length": 44.21637426900585,
"alnum_prop": 0.5599788387779394,
"repo_name": "hzruandd/AutobahnPython",
"id": "31b2e3e076e546ffcba2d75db19993c1f31662ea",
"size... |
from django.apps import AppConfig
class CoreConfig(AppConfig):
name = 'apps.core'
| {
"content_hash": "8b8acd14921a9072e37d3e226fc72158",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 33,
"avg_line_length": 17.6,
"alnum_prop": 0.7386363636363636,
"repo_name": "klashxx/PyConES2017",
"id": "0fc76c70ec1c3a4d3329297503062d4400fdcefd",
"size": "88",
"binary"... |
from django.conf.urls import patterns, include, url
from django.core.urlresolvers import reverse_lazy
urlpatterns = patterns('frontend.views',
# Examples:
# url(r'^$', 'django_xrm.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', 'person_list', name='person_list'),
)
# Url... | {
"content_hash": "bd452aa5b105b469eba75a4ff1e97293",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 80,
"avg_line_length": 38.370370370370374,
"alnum_prop": 0.6196911196911197,
"repo_name": "acruxsa/django-xrm",
"id": "0e9026090993cdc0a556a4c219a5091ca2b3c07c",
"size": "2... |
import ast
import yaml
class DefinitionVisitor(ast.NodeVisitor):
def __init__(self):
super(DefinitionVisitor, self).__init__()
self.functions = {}
self.classes = {}
self.names = {}
self.attrs = set()
self.definitions = {
'def': self.functions,
... | {
"content_hash": "9f7b42a7db75580f829a4052caa157df",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 85,
"avg_line_length": 33.31958762886598,
"alnum_prop": 0.5798267326732673,
"repo_name": "TribeMedia/synapse",
"id": "47dac7772de0e0a9ab2f2c718688535f4494583e",
"size": "6... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '0012_auto_20150607_2207'),
('pages', '0012_benefitsitemplugin_benefitsplugin'),
]
operations = [
migrations.CreateModel(
... | {
"content_hash": "dfe22ddad85164702e6bb58ccb20cfa9",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 148,
"avg_line_length": 31.192307692307693,
"alnum_prop": 0.5647348951911221,
"repo_name": "raccoongang/socraticqs2",
"id": "114be6b6a78c613b73bfa4b40b1f61c38e2d4744",
"siz... |
import os
# django imports
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
# settings for django-tinymce
try:
import tinymce.settings
DEFAULT_URL_TINYMCE = tinymce.settings.JS_BASE_URL + '/'
DEFAULT_PATH_TINYMCE = tinymce.settings.JS_ROOT + '/'
except ImportError:
... | {
"content_hash": "9e065bfcd67aa810f7f567b37d96c954",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 132,
"avg_line_length": 49.483333333333334,
"alnum_prop": 0.7054563826204109,
"repo_name": "dwaiter/django-filebrowser-old",
"id": "9586cc42dbf7a1fda7d6835a43ed13a4c79d2d51"... |
from .mnemon import mnemon as mnc
from .dec import mnemon as mnd
__all__ = ["mnc", "mnd"]
| {
"content_hash": "f5ef4b52343f720e000837b3be5d116e",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 33,
"avg_line_length": 22.75,
"alnum_prop": 0.6593406593406593,
"repo_name": "myyc/mnemon",
"id": "4c7ee786984e28e05ba8c3a0111b387a6704af6c",
"size": "91",
"binary": false... |
from ament_pep257.main import main
def test_pep257():
rc = main(argv=[])
assert rc == 0, 'Found code style errors / warnings'
| {
"content_hash": "03d2a7a9cb96660549ce95a96d67e323",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 56,
"avg_line_length": 22.666666666666668,
"alnum_prop": 0.6544117647058824,
"repo_name": "dhood/launch",
"id": "dd3ea28ee3bd12759a9decb53480853d63ca372b",
"size": "738",
... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
from flexget import plugin
from flexget.event import event
from flexget.utils.log import log_once
log = logging.getLogger('imdb')
class FilterImdb(object... | {
"content_hash": "b2a9bce849fda918100fb26a74b144e0",
"timestamp": "",
"source": "github",
"line_count": 272,
"max_line_length": 113,
"avg_line_length": 39.8235294117647,
"alnum_prop": 0.5033234859675036,
"repo_name": "gazpachoking/Flexget",
"id": "458de4b110386a5cc205938a2cdb931d15ad06f4",
"size": ... |
"""Module for constructing RNN Cells."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import math
from tensorflow.contrib.compiler import jit
from tensorflow.contrib.layers.python.layers import layers
from tensorflow.contrib.rnn.python... | {
"content_hash": "d5eb93f4f0446ba9c3ded337e9e8f4ef",
"timestamp": "",
"source": "github",
"line_count": 2605,
"max_line_length": 82,
"avg_line_length": 39.20921305182342,
"alnum_prop": 0.6250342666927746,
"repo_name": "horance-liu/tensorflow",
"id": "5e85c125df8ca0d632fa9b0db86d942bb354631e",
"size... |
'''
Name: Problem 36: Double-base palindromes (45171)
The decimal number, 585 = 1001001001subscript(2) (binary), is palindromic in both bases.
Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.
(Please note that the palindromic number, in either base, may not include le... | {
"content_hash": "84c608c9a1599de517e2eb9ed79554ff",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 96,
"avg_line_length": 28.46875,
"alnum_prop": 0.677277716794731,
"repo_name": "gregljohnson/ProjectEuler",
"id": "37f5e9b1fcaa886780c13d55fea64464ce219e1b",
"size": "911",... |
import SimpleHTTPServer
import SocketServer
PORT = 8000
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print("serving at port", PORT)
httpd.serve_forever()
| {
"content_hash": "26ecd0a0a89f0e9774e0934813cd0ac7",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 51,
"avg_line_length": 19.727272727272727,
"alnum_prop": 0.7880184331797235,
"repo_name": "shuangliu12/cocoon",
"id": "8591b6cef346e4692d2f7fbf67ebc6b68af6dfaa",
"size": "2... |
# missing parameter, ignored because a SQLAlchemy function is wrapped.
# it's a documented issue with that team.
# pylint: disable-msg=E1120
# Used * or ** magic, we're not getting rid of this, it's imperative to Trump.
# pylint: disable-msg=W0142
# Too many/few arguments, ignored, because... | {
"content_hash": "7af362a69f9af9bf9e23c44650da5930",
"timestamp": "",
"source": "github",
"line_count": 2368,
"max_line_length": 124,
"avg_line_length": 34.77787162162162,
"alnum_prop": 0.5366102435825825,
"repo_name": "jnmclarty/trump",
"id": "dbdb74aa65aea89dbcdaf26c0984bafda12f1246",
"size": "82... |
from time import sleep
from unittest.mock import MagicMock
from wdom.document import get_document
from wdom.server import _tornado
from wdom.server.handler import event_handler
from wdom.window import customElements
from .base import TestCase
class TestWindow(TestCase):
def setUp(self):
super().setUp()
... | {
"content_hash": "869d17cd0ba07f3c52363e7f64ee51c1",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 77,
"avg_line_length": 30.946428571428573,
"alnum_prop": 0.6191575302942873,
"repo_name": "miyakogi/wdom",
"id": "aa2117d8d83cf44f6f2d889a1fd6277fb2d1a958",
"size": "1781",... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "atmosphere.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "8585577f140404ee3a210642b957cc39",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 74,
"avg_line_length": 28.75,
"alnum_prop": 0.717391304347826,
"repo_name": "CCI-MOC/GUI-Backend",
"id": "9d87e2a1763bf04ee13f60d39ddd91cd784b86e3",
"size": "252",
"binary... |
import unittest
import dedupe
from dedupe.variables.price import PriceType
class TestPrice(unittest.TestCase):
def test_comparator(self) :
assert PriceType.comparator(1, 10) == 1
assert PriceType.comparator(10, 1) == 1
| {
"content_hash": "02151bc90f3da95b49dad73c6b4fdba7",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 47,
"avg_line_length": 24.2,
"alnum_prop": 0.71900826446281,
"repo_name": "davidkunio/dedupe",
"id": "24e75369393519ddd6a5973e15d167d46cf1a7d4",
"size": "242",
"binary": ... |
'''
Created on Oct 20, 2015
@author: ahmadjaved.se@gmail.com
'''
class InvalidPage(Exception):
pass
class PageNotAnInteger(InvalidPage):
pass
class EmptyPage(InvalidPage):
pass | {
"content_hash": "8e203d3d22cfee20aafa084e4ee16f7e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 36,
"avg_line_length": 13.714285714285714,
"alnum_prop": 0.71875,
"repo_name": "prikevs/pagination-sqlalchemy",
"id": "123661519d28b5bb6e05aa73c9c155b89a46d5c2",
"size": "1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.