text stringlengths 4 1.02M | meta dict |
|---|---|
__author__ = 'Kamo Petrosyan'
from yml import YML
from offer import Offer
from yml_parser import YmlParser
| {
"content_hash": "7f523754f0f1d0d44730610c54df3974",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 32,
"avg_line_length": 21.6,
"alnum_prop": 0.7685185185185185,
"repo_name": "Haikson/virtenviro",
"id": "c3bd4124df5adc6db66436f7181d29c794abea5e",
"size": "132",
"binary"... |
from __future__ import print_function
from __future__ import absolute_import
from builtins import range
import gevent
import gevent.event
import zerorpc
from .testutils import teardown, random_ipc_endpoint
def test_pushpull_inheritance():
endpoint = random_ipc_endpoint()
pusher = zerorpc.Pusher()
pushe... | {
"content_hash": "4f4bb9f051a83397638b3dd0e01714af",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 79,
"avg_line_length": 25.25438596491228,
"alnum_prop": 0.6259117749218479,
"repo_name": "dotcloud/zerorpc-python",
"id": "a99f9b45090f8b2783a813a4d7818c946633d198",
"size... |
"""Resources to be indexed and searched over by the search module."""
__author__ = 'Ellis Michael (emichael@google.com)'
import collections
import datetime
import gettext
import HTMLParser
import logging
import operator
import os
import Queue
import re
import robotparser
import urllib
import urlparse
from xml.dom imp... | {
"content_hash": "70bc9c1d17a5083a7c7b21465a36958d",
"timestamp": "",
"source": "github",
"line_count": 782,
"max_line_length": 80,
"avg_line_length": 38.148337595907925,
"alnum_prop": 0.5877581120943953,
"repo_name": "danieldanciu/schoggi",
"id": "364e0f405836848aa64593a7ba883c0b331ba3da",
"size":... |
"""Defines a number of errors that can occur."""
class Error(Exception):
"""Base class for exceptions in this module."""
pass
class MissingAuthError(Error):
"""No token was supplied."""
def __init__(self, message='No Recorded Future API key or '
'authentication method was provided... | {
"content_hash": "dbd05d4f2c0f981edd3d581b938fdb7f",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 68,
"avg_line_length": 23.614035087719298,
"alnum_prop": 0.6300148588410104,
"repo_name": "recordedfuture/rfapi-python",
"id": "21fe366d96fcd0bab2a7cd3c4df020b2a455766d",
"... |
import tensorflow as tf
from tensorflow.python.ops import rnn_cell
from tensorflow.python.ops import seq2seq
import utils
import numpy as np
class LSTM_model(object):
def __init__(self, config=None, mode=None):
self.config = config
self.mode = mode
self.build_graph()
self.load_validation()
def lo... | {
"content_hash": "a01b017ab6ed423a0bf0ccb7f3b8a321",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 127,
"avg_line_length": 40.61538461538461,
"alnum_prop": 0.6466450216450217,
"repo_name": "jxwufan/AssociativeRetrieval",
"id": "d58ca31cc95be7c5982f8de12df8e7796ddcf0ac",
... |
import collections.abc
from functools import partial
from urllib.parse import urlencode
from geopy.exc import ConfigurationError, GeocoderQueryError
from geopy.geocoders.base import _DEFAULT_USER_AGENT, DEFAULT_SENTINEL, Geocoder
from geopy.location import Location
from geopy.util import logger
__all__ = ("Nominatim"... | {
"content_hash": "3b8b3f7e3f497829bc6c6914e13f53fb",
"timestamp": "",
"source": "github",
"line_count": 400,
"max_line_length": 89,
"avg_line_length": 35.5825,
"alnum_prop": 0.5783039415442984,
"repo_name": "geopy/geopy",
"id": "9cdb452a9f9f305c5bfc81837a2495d696ab4662",
"size": "14233",
"binary"... |
from django.db.models import Q
from django.db.models import Sum
from rest_framework.serializers import JSONField
from rest_framework.serializers import ModelSerializer
from rest_framework.serializers import SerializerMethodField
from kolibri.auth.models import Classroom
from kolibri.core.exams.models import Exam
from ... | {
"content_hash": "e14239c8e2c1191b44f5eb846cbc949b",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 92,
"avg_line_length": 31.64,
"alnum_prop": 0.5876106194690266,
"repo_name": "christianmemije/kolibri",
"id": "f392f27582a51c8605e6ab391d7f6c41253f941a",
"size": "3955",
... |
from setuptools import setup, find_packages
setup(
name='django-waffle',
version='0.9.1',
description='A feature flipper for Django.',
long_description=open('README.rst').read(),
author='James Socol',
author_email='james.socol@gmail.com',
url='http://github.com/jsocol/django-waffle',
li... | {
"content_hash": "3bc1c09922e3b1723e6dd0e115e9b126",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 71,
"avg_line_length": 33.34615384615385,
"alnum_prop": 0.6205305651672434,
"repo_name": "11craft/django-waffle",
"id": "05c1ee52cde38b5f1186f5965f59ddf1a83d50d5",
"size": ... |
"""This file is free software under the GPLv3 license"""
import sys
import os
import subprocess
import shutil
from urllib2 import urlopen
import json
from cStringIO import StringIO
import zipfile
from collections import namedtuple
import renpy
from renpy.audio.music import stop as _stop_music
import renpy.game
from r... | {
"content_hash": "cac7752f6b606be95f4954ca532c9d9c",
"timestamp": "",
"source": "github",
"line_count": 217,
"max_line_length": 884,
"avg_line_length": 37.72811059907834,
"alnum_prop": 0.6589715402467327,
"repo_name": "AWSW-Modding/AWSW-Modtools",
"id": "8607c41bce7a598c889c1b7c18b0b68196c231ae",
"... |
import argparse
import os
import subprocess
import sys
import tempfile
import zipfile
current_path = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(current_path, "..", "..", "..", "tools"))
# pylint: disable=F0401
import find_depot_tools
if not sys.platform.startswith("linux"):
print "N... | {
"content_hash": "2f52f80e97823cc0f6cdf98a7ee5b39d",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 80,
"avg_line_length": 33.305882352941175,
"alnum_prop": 0.6616036736135641,
"repo_name": "dednal/chromium.src",
"id": "2a0890c5f6d00776dd79ed74498f893db5790eb4",
"size": "... |
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]
o_max = [l for l in output.splitlines() if 'MaxCapacity' in l][0]
o_cur = [l for l in output.splitlines() if 'CurrentCapacity' in l][0]
b_max = float(o_max.rpartition('=')[-1].strip... | {
"content_hash": "bf9b7a75eb3c19996cb4452d292db06e",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 83,
"avg_line_length": 26.166666666666668,
"alnum_prop": 0.6305732484076433,
"repo_name": "tjtrabue/dotfiles",
"id": "545c3670125a2d5cb01a0a8191dab035644a02df",
"size": "99... |
from __future__ import unicode_literals
from django.contrib import admin
from taobao import models
# Register your models here.
#admin.site.register(models.PModel)
#admin.site.register(models.Product)
class ProductAdmin(admin.ModelAdmin):
list_display = ('pmodel', 'nickname', 'price', 'year')
search_fields=(... | {
"content_hash": "17efcac7ea1686b848f99dedc4785225",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 58,
"avg_line_length": 28.25,
"alnum_prop": 0.7190265486725663,
"repo_name": "lichengshuang/python",
"id": "2c4fabbb2f1ddb7461f5ed50db1d55362d3fe593",
"size": "928",
"bin... |
import time
# 3p
import mock
from nose.plugins.attrib import attr
# project
from config import AGENT_VERSION
from tests.checks.common import AgentCheckTest
from util import headers as agent_headers
RESULTS_TIMEOUT = 10
AGENT_CONFIG = {
'version': AGENT_VERSION,
'api_key': 'toto'
}
CONFIG = {
'instances... | {
"content_hash": "ac89628740e6845a9b492c2274f0f1ae",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 100,
"avg_line_length": 33.062271062271066,
"alnum_prop": 0.5932860624861511,
"repo_name": "indeedops/dd-agent",
"id": "8e80febe0e7af814979a42a212f30fa2c5edfdc0",
"size": ... |
import unittest
class TreeOne(unittest.TestCase):
"""Test class for the test_build_simple_tree test.
build_test_tree should build a test tree with these test cases.
"""
def test_one(self) -> None:
self.assertGreater(2, 1)
def test_two(self) -> None:
self.assertNotEqual(2, 1)
| {
"content_hash": "5e1a8912132c246b80b1e7291da1d06f",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 67,
"avg_line_length": 22.642857142857142,
"alnum_prop": 0.6498422712933754,
"repo_name": "DonJayamanne/pythonVSCode",
"id": "6db51a4fd80b8227253b7c7cf5d4533f9d8b3812",
"si... |
import httplib
import re
import random
import string
import time
import websocket
import json
import threading
REST_TIMEOUT = 5
class OrtcError(Exception):
def __init__(self, message):
self.message = message
def __str__(self):
return self.message
class Channel(object):
@property
d... | {
"content_hash": "435632af5f3f429a0c9ff2dd33203180",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 144,
"avg_line_length": 31.124324324324323,
"alnum_prop": 0.5751997221257381,
"repo_name": "realtime-framework/RealtimeMessaging-Python2",
"id": "3094d52560615e511cb03bcbe65... |
from tests.test_helper import *
from braintree.test.nonces import Nonces
import sys
import urllib.parse as urlparse
class TestOAuthGateway(unittest.TestCase):
def setUp(self):
self.gateway = BraintreeGateway(
client_id="client_id$development$integration_client_id",
client_secret="cl... | {
"content_hash": "da867c9433c33cc6e754e868ab06717d",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 94,
"avg_line_length": 38.955555555555556,
"alnum_prop": 0.5825727324586423,
"repo_name": "braintree/braintree_python",
"id": "2d88a52e76a4535657a0812e38c909b27b205175",
"... |
"""Tools for data driven testing"""
import random
from engine.base import suit_list, ranks
suit_list = tuple(suit_list)
class DataList(list):
"""Custom list with __name__ attribute, which is added by
prepare_test_data()
"""
pass
def prepare_test_data(*test_data):
"""Generator to prepare data fo... | {
"content_hash": "55b4c726cd5765cc0d999efddfc7a778",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 79,
"avg_line_length": 22.825581395348838,
"alnum_prop": 0.6148751910341315,
"repo_name": "kolyat/vpoker",
"id": "4d5ba13cbd86397fbf4b9c85acd9289c11366af0",
"size": "2145",... |
"""
URLconf for registration and activation, using django-registration's
default backend.
If the default behavior of these views is acceptable to you, simply
use a line like this in your root URLconf to set up the default URLs
for registration::
(r'^accounts/', include('registration.backends.default.urls')),
Thi... | {
"content_hash": "5196669bbc750ab28cae6f61dde0e9cc",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 104,
"avg_line_length": 46.15686274509804,
"alnum_prop": 0.5802888700084962,
"repo_name": "AlexShik/django-registration-fork",
"id": "fc59feef8658a1421b535476fce64ff95725a2f3... |
ENVIRONMENT = 'DEV'
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '<insert secret key here>'
#ROOT_URLCONF = 'urls'
ROOT_URLCONF = 'django_backend.urls'
WSGI_APPLICATION = 'django_backend.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgres... | {
"content_hash": "a8550c88f323780b691e155b1bd0e741",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 66,
"avg_line_length": 24.055555555555557,
"alnum_prop": 0.6166281755196305,
"repo_name": "vingle1/AfriCuisine",
"id": "95962e5d9e00944903ebdb732882b23c73b73853",
"size": "... |
from yaql.language import exceptions
from yaql.language import specs
from yaql.language import yaqltypes
import yaql.tests
class TestMiscellaneous(yaql.tests.TestCase):
def test_pass_lambda_from_code(self):
self.assertEqual(
[],
list(self.context('where', self.engine, [1, 2, 3])(Fa... | {
"content_hash": "3a8e4f3fb7293967e11fdbe9c381b816",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 70,
"avg_line_length": 32.74025974025974,
"alnum_prop": 0.5799285997619992,
"repo_name": "openstack/yaql",
"id": "26a18e86bcc50637c978e67dcc19e204993eff1f",
"size": "3136",... |
import os
class VerificationError(Exception):
""" An error raised when verification fails
"""
class VerificationMissing(Exception):
""" An error raised when incomplete structures are passed into
cdef, but no verification has been done
"""
def get_extension(srcfilename, modname, sources=(), **kw... | {
"content_hash": "a9116d33da3b31f16867bc4a75ca2aef",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 77,
"avg_line_length": 29.26126126126126,
"alnum_prop": 0.5865147783251231,
"repo_name": "ArneBab/pypyjs",
"id": "460ba901219c585d242bd6cfb76dd3da3d1ec08b",
"size": "3248"... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('common', '0016_auto_20161013_2111'),
('blog', '0006_auto_20161012_1555'),
]
operations =... | {
"content_hash": "deba87472aa0de6383586e1ee8c26317",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 78,
"avg_line_length": 32.755102040816325,
"alnum_prop": 0.49470404984423677,
"repo_name": "baylee-d/cos.io",
"id": "227cbc88b51c897f761b50a3c5cdee792d4c7bca",
"size": "167... |
class Solution(object):
def searchMatrix(self, matrix, target):
"""
:type matrix: List[List[int]]
:type target: int
:rtype: bool
"""
row = 0
column = len(matrix[row]) - 1
while row >= 0 and row < len(matrix) and column >= 0 and column < len(matrix[row... | {
"content_hash": "6de208461f079f6020e224f95b6964f6",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 91,
"avg_line_length": 29.833333333333332,
"alnum_prop": 0.4748603351955307,
"repo_name": "FeiZhan/Algo-Collection",
"id": "2948952fa2836fba3256a747c0e27ac390a81c2a",
"size... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('taxbrain', '0026_auto_20141022_1556'),
]
operations = [
migrations.AddField(
model_name='taxsaveinputs',
name='additional_ch... | {
"content_hash": "2630f0cc2f954d7181f63ae78f9ac1a5",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 73,
"avg_line_length": 27.72,
"alnum_prop": 0.5974025974025974,
"repo_name": "PeterDSteinberg/webapp-public",
"id": "bead44843e1687b9f4e17792a81a4d273899a25b",
"size": "717... |
class PlayerData():
pass
| {
"content_hash": "b3e756e8d4a9b20121f24962bc1e6679",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 19,
"avg_line_length": 9,
"alnum_prop": 0.7037037037037037,
"repo_name": "grimfang/owp_dungeon_crawler",
"id": "b3323b7bebeea84fc5cf2297ba3684b5c4f01acc",
"size": "42",
"b... |
import pyfits
import numpy
import SPARTATools
datapath = '/home/deen/Data/GRAVITY/SPARTA_Data/'
delta = pyfits.getdata(datapath+'delta_junk.fits')
fullNoll = pyfits.getdata(datapath+'ZernikeCovar_Noll.fits')
HOIM = pyfits.getdata(datapath+'HOIM.fits')
TTIM = pyfits.getdata(datapath+'TTIM.fits')
nfilt = 50
nHOAct = 60... | {
"content_hash": "d20a65f51a84507b89454b918a37d216",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 62,
"avg_line_length": 25.045454545454547,
"alnum_prop": 0.7477313974591652,
"repo_name": "soylentdeen/CIAO-commissioning-tools",
"id": "3c1994a5a518c2e1864c4c7f9e0746187db07... |
import random
from typing import List, Optional, Tuple
from shared.insn_yaml import InsnsFile
from .branch import Branch
from .jump import Jump
from .loop import Loop
from ..config import Config
from ..program import ProgInsn, Program
from ..model import Model
from ..snippet_gen import GenCont, GenRet
class BadAtEn... | {
"content_hash": "756b3eabc618526516b9dcca33a0dfc8",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 79,
"avg_line_length": 39.885714285714286,
"alnum_prop": 0.5750358166189111,
"repo_name": "lowRISC/opentitan",
"id": "6ff7e8ff51cf54b86370a687d7269e2d47928b61",
"size": "5... |
'''
author Lama Hamadeh
'''
import numpy as np
import pandas as pd
import scipy.io.wavfile as wavfile
# Good Luck!
#
# INFO:
# Samples = Observations. Each audio file will is a single sample
# in our dataset.
#
# Audio Samples = https://en.wikipedia.org/wiki/Sampling_(signal_processing)
#... | {
"content_hash": "3fa98893b630bd1c9dd30d697172ef01",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 143,
"avg_line_length": 39.22072072072072,
"alnum_prop": 0.7109222464683588,
"repo_name": "LamaHamadeh/Microsoft-DAT210x",
"id": "bdc54806ee6040b39c4380b021941941e76e3cd7",
... |
from distutils.core import setup
setup(name='django-orderedmodel',
version='2014.12.001',
description='Orderable models for Django',
long_description='''
This Django_ app helps you create Django models that can be
moved up/down with respect to each other.
See README_ ... | {
"content_hash": "998c1b598757c2a491a4db136426f2fa",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 92,
"avg_line_length": 33.93023255813954,
"alnum_prop": 0.5455791638108294,
"repo_name": "kirelagin/django-orderedmodel",
"id": "d2d4c11185decc9342c534b5503e003e1534b172",
... |
import json
from pprint import pprint
from collections import OrderedDict
with open('Config.json') as data_file:
data = json.load(data_file, object_pairs_hook=OrderedDict)
print "=========================================================="
print(data)
print "=======================================================... | {
"content_hash": "197ea45ff8e73ea997784d191eb74dce",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 81,
"avg_line_length": 30.866666666666667,
"alnum_prop": 0.5248380129589633,
"repo_name": "HPPTECH/hpp_IOSTressTest",
"id": "f7ef885a1897480b0b007c6c6ebc1c3686339504",
"siz... |
'''
This sample script shows a simple **nested** menu structure.
There are two `group` items: `build_menu` and `test_menu`. These two items
are shown on the main menu. Once selected, thier respective sub-items will
be shown.
`test_menu` has a sub-menu itself, `sub_test_menu`. That item has a single
menu it... | {
"content_hash": "9f3ed2ae9a7f06ea9400675d9a3898f6",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 81,
"avg_line_length": 25.35,
"alnum_prop": 0.5152859960552268,
"repo_name": "mtik00/pyclimenu",
"id": "04e3a7f5f7b3c499a8b7fb94336c858ef03a6734",
"size": "2077",
"binary... |
from __future__ import (unicode_literals, absolute_import)
import re
from django import forms
from django.forms.widgets import HiddenInput
from . import VIES_COUNTRY_CHOICES
EMPTY_VALUES = (None, '')
class VATINWidget(forms.MultiWidget):
"""docstring for VATINWidget"""
def __init__(self, choices=VIES_COU... | {
"content_hash": "97733ab46e73093c85864ce23a7c25ea",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 116,
"avg_line_length": 31.41025641025641,
"alnum_prop": 0.5146938775510204,
"repo_name": "vdboor/django-vies",
"id": "3f26ff06036b6590833666f785af8e60894be1d3",
"size": "2... |
import pendulum
from furl import furl
from share import Harvester
class FigshareHarvester(Harvester):
page_size = 50
url = 'https://api.figshare.com/v2/articles'
def do_harvest(self, start_date, end_date):
return self.fetch_records(furl(self.url).set(query_params={
'order_direction... | {
"content_hash": "2fee9d56deb59adf054d143eaa54a8cb",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 95,
"avg_line_length": 31.041666666666668,
"alnum_prop": 0.525503355704698,
"repo_name": "zamattiac/SHARE",
"id": "f34fc36bc13929a1bbdb07007e1b3fb6c08fe740",
"size": "1490"... |
"""The tests for the StatsD feeder."""
import unittest
try:
from unittest import mock
except ImportError:
import mock
import homeassistant.core as ha
import homeassistant.components.statsd as statsd
from homeassistant.const import STATE_ON, STATE_OFF, EVENT_STATE_CHANGED
class TestStatsd(unittest.TestCase):
... | {
"content_hash": "a77c461b6502115ecd2cdfd57be78de7",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 72,
"avg_line_length": 35.73076923076923,
"alnum_prop": 0.5377825618945102,
"repo_name": "Julian/home-assistant",
"id": "076e41908967a8028a1de83026fdd110bf59be17",
"size":... |
"""
This module contains the main interface to the botocore package, the
Session object.
"""
import copy
import logging
import os
import platform
import shlex
from . import __version__
from . import config as bc_config
from . import credentials as bc_credentials
from . import client as bc_client
from .endpoint import... | {
"content_hash": "1b27191bb4d50623cb6936d48cc40a94",
"timestamp": "",
"source": "github",
"line_count": 856,
"max_line_length": 94,
"avg_line_length": 40.8107476635514,
"alnum_prop": 0.6063433903933131,
"repo_name": "gdm/aws-cfn-resource-bridge",
"id": "8adb78eda6873990fd12175ca08629c81add5e65",
"s... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import pytest
import sys
import os
from jinja2 import Template
# TODO more checks: fail_html, etc.
@pytest.mark.online
@pytest.mark.usefixtures('tmpdir')
class TestDownl... | {
"content_hash": "97795fdc3a50acf9450d32c98afdcae1",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 105,
"avg_line_length": 32.26229508196721,
"alnum_prop": 0.551490514905149,
"repo_name": "JorisDeRieck/Flexget",
"id": "243708bfb3ff51ab16ec632fd2357390f838414c",
"size": ... |
import argparse
import sqlite3
import os
def main():
""" 1) Fill in all null values with 0s
2) Normalize all data
3) Any additional options
"""
parser = argparse.ArgumentParser()
parser.add_argument("--svm", action="store_true", help="output svm file?")
args = parser.pars... | {
"content_hash": "4dd5e286a15dd0df31761cbb0372ffdf",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 125,
"avg_line_length": 33.78888888888889,
"alnum_prop": 0.5406116409075962,
"repo_name": "lattrelr7/cse881-pcap",
"id": "a74c0854e0a4bb7f897c3012c96db2dc3131a1b4",
"size":... |
import abc
from collections import namedtuple
ActionStepWrapper = namedtuple('ActionStepWrapper', ['type', 'params'])
EVALUATOR_EVENT_TYPE = 'type'
class Recipe(object, metaclass=abc.ABCMeta):
@staticmethod
@abc.abstractmethod
def get_do_recipe(action_spec):
"""Execute the action.
:p... | {
"content_hash": "2577ac3aa5b434f8b0d742524c92e1cc",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 72,
"avg_line_length": 28.205128205128204,
"alnum_prop": 0.6245454545454545,
"repo_name": "openstack/vitrage",
"id": "dcc07ef2ae81dd815000ae3c6c45c1d55bcde2f7",
"size": "16... |
import cfscrape, sys
scraper = cfscrape.create_scraper() # returns a CloudflareScraper instance
# Or: scraper = cfscrape.CloudflareScraper() # CloudflareScraper inherits from requests.Session
if (sys.argv[1] == "content"):
print scraper.get(sys.argv[2]).content
if (sys.argv[1] == "header"):
print scraper... | {
"content_hash": "ace97f191b4281ae9fd766bc492954a0",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 96,
"avg_line_length": 34.7,
"alnum_prop": 0.7175792507204611,
"repo_name": "greencardamom/WaybackMedic",
"id": "8f30b3b7f97b65c7deec8372528b61489b88ad0a",
"size": "558",
... |
from openstack import service_filter
class OrchestrationService(service_filter.ServiceFilter):
"""The orchestration service."""
valid_versions = [service_filter.ValidVersion('v1')]
def __init__(self, version=None):
"""Create an orchestration service."""
super(OrchestrationService, self).... | {
"content_hash": "86fab60da3cb486bfc3f6e77b2c498df",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 57,
"avg_line_length": 29.285714285714285,
"alnum_prop": 0.651219512195122,
"repo_name": "dudymas/python-openstacksdk",
"id": "930e5b9ab5a10c76a5dfc9bdc0a5b3476ec4709d",
"s... |
import os
from setuptools import setup
VERSION = "0.0.1"
# Utility function to read the README file.
# Used for the long_description.
# It's nice, because:
# 1) we have a top level README file
# 2) it's easier to type in the README file than to put a raw string
def read(fname):
return open(os.path.join(os.path.... | {
"content_hash": "fa291dc22c88ba0b6c6ac01a11c24984",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 150,
"avg_line_length": 35.4,
"alnum_prop": 0.6559322033898305,
"repo_name": "ziogaschr/bottle-memcache-decorator",
"id": "976e906e3032a1bcc3a601a3d8f4731ee2b592df",
"size"... |
import sys
import os
import json
import tempfile
import uuid
from unittest import TestCase
from flask import Flask, jsonify, request
from flask_orator import Orator, jsonify
from sqlite3 import ProgrammingError
from orator.support.collection import Collection
PY2 = sys.version_info[0] == 2
class FlaskOratorTestCase... | {
"content_hash": "48d03010ce34a9cde23dd28c8dd60b01",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 107,
"avg_line_length": 27.577272727272728,
"alnum_prop": 0.5454095928795121,
"repo_name": "sdispater/flask-orator",
"id": "bcaf588abad09636032fb4fbb494fed3a6a4d8f1",
"siz... |
import sys
from pyspark.sql import SparkSession, functions, types
spark = SparkSession.builder.appName('reddit relative scores').getOrCreate()
assert sys.version_info >= (3, 4) # make sure we have Python 3.4+
assert spark.version >= '2.1' # make sure we have Spark 2.1+
import string, re
wordbreak = r'[%s\s]+' % (re.... | {
"content_hash": "487b2fe9450dac18d31bfd7b6bd163f5",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 120,
"avg_line_length": 37.25925925925926,
"alnum_prop": 0.679920477137177,
"repo_name": "MockyJoke/numbers",
"id": "a978263cfc370c121156273d5ff716fa0757479c",
"size": "100... |
"""
Project-wide application configuration.
DO NOT STORE SECRETS, PASSWORDS, ETC. IN THIS FILE.
They will be exposed to users. Use environment variables instead.
See get_secrets() below for a fast way to access them.
"""
import os
from authomatic.providers import oauth2
from authomatic import Authomatic
"""
NAMES
... | {
"content_hash": "16186b7c9430c796421327119a0a9eb5",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 109,
"avg_line_length": 26.923664122137403,
"alnum_prop": 0.6589169265664871,
"repo_name": "nprapps/commencement",
"id": "5e2db3313451271a1499f9a7397c406e06eba410",
"size"... |
import warnings
warnings.filterwarnings("ignore",
"the rgbimg module is deprecated",
DeprecationWarning,
".*test_rgbimg$")
import rgbimg
import os, uu
from test.test_support import verbose, unlink, findfile
class error(Exception):
pass
prin... | {
"content_hash": "b9cd880e93e734059309a98538b7f35f",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 76,
"avg_line_length": 26.794117647058822,
"alnum_prop": 0.6114160263446762,
"repo_name": "TathagataChakraborti/resource-conflicts",
"id": "650c02aa0f9a6adc32080ee88b3448a590... |
"""Functional tests for fused batch norm operations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
import numpy as np
from tensorflow.compiler.tests import test_utils
from tensorflow.compiler.tests import xla_tes... | {
"content_hash": "f9b8d18bae8d84efbef48a83f5224e4e",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 80,
"avg_line_length": 40.85502958579882,
"alnum_prop": 0.6204649141864002,
"repo_name": "davidzchen/tensorflow",
"id": "a36effe5984eec6477df03d48553ecaf3bbb036e",
"size":... |
import txmongo
from twisted.internet import defer, reactor
@defer.inlineCallbacks
def example():
mongo = yield txmongo.MongoConnection()
foo = mongo.foo # `foo` database
test = foo.test # `test` collection
yield test.insert({"src":"Twitter", "content":"bla bla"}, safe=True)
yield test.insert({"... | {
"content_hash": "7a9f03121272528f53e8cbb31bdb499d",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 81,
"avg_line_length": 35.958333333333336,
"alnum_prop": 0.6488991888760139,
"repo_name": "claytondaley/mongo-async-python-driver",
"id": "3daa2688ff9aab95567de4dc85e08c81da6... |
from core.serializers import TagSerializer
from rest_framework import generics
from core.models import Tag
class TagList(generics.ListCreateAPIView):
queryset = Tag.objects.all()
serializer_class = TagSerializer
class TagDetail(generics.RetrieveUpdateDestroyAPIView):
queryset = Tag.objects.all()
seria... | {
"content_hash": "a868da44227e917770f825a0dd70fa3e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 55,
"avg_line_length": 26.923076923076923,
"alnum_prop": 0.7914285714285715,
"repo_name": "wathsalav/xos",
"id": "ba8a035c7dda6a6ae903074fb11b33fe49b33e91",
"size": "350",
... |
"""Spectral operations (e.g. Short-time Fourier Transform)."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.fram... | {
"content_hash": "f91be1054d4e468f25f46553503f484b",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 80,
"avg_line_length": 43.338181818181816,
"alnum_prop": 0.6788890753482127,
"repo_name": "alsrgv/tensorflow",
"id": "2e46ae50b0a2075edd18caf167def4c859aab920",
"size": "1... |
"""
This is a very simple python starter script to automate a series of PWSCF
calAllations. If you don't know Python, get a quick primer from the official
Python doAlmentation at https://docs.python.org/2.7/. The script is deliberately
simple so that only basic Python syntax is used and you can get comfortable with
mak... | {
"content_hash": "497178f89f4d6c3deedd46460c55d35a",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 96,
"avg_line_length": 36.46808510638298,
"alnum_prop": 0.6948658109684948,
"repo_name": "materialsvirtuallab/nano266",
"id": "a41f2a9e8d1906883262b94a603f27e128eadb6f",
"s... |
'''
~Gros
'''
import sys
from hashlib import sha256
from binascii import hexlify, unhexlify
import random
import argparse
from Crypto.Cipher import AES
from pwn import *
from utils import *
from config import config
def mitm():
print("MITM (key-fixing attack)...")
alice = remote(config["host"], config["ta... | {
"content_hash": "c1fa7edb0a3744baa7085ec2bdca9896",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 65,
"avg_line_length": 25.097826086956523,
"alnum_prop": 0.6119532265049805,
"repo_name": "JustHitTheCore/ctf_workshops",
"id": "2290c82524984c3d50b77aa6331eccc86faaa873",
... |
"""
Find intermediate evalutation results in assert statements through builtin AST.
This should replace oldinterpret.py eventually.
"""
import sys
import ast
import py
from _pytest.assertion import util
from _pytest.assertion.reinterpret import BuiltinAssertionError
if sys.platform.startswith("java"):
# See htt... | {
"content_hash": "cf2133cee07f076c732ddb2bd0dd3ad5",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 85,
"avg_line_length": 36.810810810810814,
"alnum_prop": 0.551558166095611,
"repo_name": "ktan2020/legacy-automation",
"id": "e7e9658d7dbda560940f4b89452cf0169ae2d7a6",
"s... |
from django.db import models
from asynchrormous.query import AsyncQuerySet
class AsyncManager(models.Manager):
""" A model manager which uses the AsyncQuerySet. """
def get_query_set(self):
return AsyncQuerySet(self.model, using=self._db)
| {
"content_hash": "349b2ec57a00136943ffa78e087039f8",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 57,
"avg_line_length": 28.666666666666668,
"alnum_prop": 0.7364341085271318,
"repo_name": "adamalton/asynchrormous",
"id": "658e64db5d48ab663778b09f5477f4ffed825736",
"size"... |
from __future__ import print_function
import rename
print("say_hi_fn():", rename.say_hi_fn())
print("MyStruct().say_something():", rename.MyStruct().say_something())
# Just make sure the symbols exist
rename.auto_renamed_func()
struct = rename.MyStruct()
struct.auto_renamed_meth()
_ = struct.auto_renamed_property
st... | {
"content_hash": "d6d37ea9c7a4e21ce136f691a06db13f",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 103,
"avg_line_length": 30.35,
"alnum_prop": 0.7166392092257001,
"repo_name": "go-python/gopy",
"id": "7e7daca6f14a50099e36e6065106100b260af1eb",
"size": "790",
"binary":... |
import sys
def read_numbers_from_string(string):
accum = ""
numbers = []
for char in string:
if char.isdigit():
accum += char
else:
if len(accum) > 0:
numbers.append(int(accum))
accum = ""
return numbers
class Sudoku(object):
def __init__(self, file):
sizes_str = file.readline()
self.emptie... | {
"content_hash": "d78f28e0ab0774aaeebf654c8cf3ba15",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 88,
"avg_line_length": 23.457142857142856,
"alnum_prop": 0.6228177019894438,
"repo_name": "ltdicai/testing-ground",
"id": "4ba51b635e8a1d4f77f56eb7ecbc764a868874b3",
"size... |
import sys
import os
import juliadoc
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# ... | {
"content_hash": "dccbc4046321fc57cf952c9b44aaae8e",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 79,
"avg_line_length": 32.09055118110236,
"alnum_prop": 0.7067844436265489,
"repo_name": "weijianzhang/EvolvingGraphs.jl",
"id": "20656b53c40cf3877fcb42caebd10f41dd81b5a3",
... |
import re
from elizabeth.intd import CURRENCIES, CURRENCY_SYMBOLS
from ._patterns import STR_REGEX
def test_str(business):
assert re.match(STR_REGEX, str(business))
def test_copyright(business):
result = business.copyright()
assert '©' in result
def test_currency_sio(business):
result = business.... | {
"content_hash": "a1c41669aa6228344437697ac4f693f3",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 71,
"avg_line_length": 27.733333333333334,
"alnum_prop": 0.7115384615384616,
"repo_name": "wikkiewikkie/elizabeth",
"id": "d1a1f1d959c20d857496c499fe3efdb72ab4df72",
"size"... |
from menus.base import Menu
from django.core.exceptions import ValidationError
class CMSAttachMenu(Menu):
cms_enabled = True
name = None
def __init__(self, *args, **kwargs):
super(CMSAttachMenu, self).__init__(*args, **kwargs)
if self.cms_enabled and not self.name:
raise Va... | {
"content_hash": "907fbb9a4667ad485c6da3f3e7c4bec5",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 118,
"avg_line_length": 38.09090909090909,
"alnum_prop": 0.6563245823389021,
"repo_name": "dibaunaumh/tikal-corp-website",
"id": "7ee19f499258f02091edf8426a0be075584fed53",
... |
import time
import socket
import threading
# Package modules.
import socksocket
from constants import *
from constants import _VERSIONS
from _forwarder import Forwarder
from socksocket import SockSocket
from socksexception import SocksException
#Consts
_BUFSIZE = 8192
class SocksClient(object)... | {
"content_hash": "96038df17a8a0fced9dc465ae0c525d9",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 80,
"avg_line_length": 36.596666666666664,
"alnum_prop": 0.5659896165406686,
"repo_name": "NelyusC/SockstPy",
"id": "64ee41ff667ae74489bc6f04ba65745ffb6507ab",
"size": "11... |
from __future__ import absolute_import
from distutils.core import setup
setup(name='autograd',
version='1.0.4',
description='Efficiently computes derivatives of numpy code.',
author='Dougal Maclaurin and David Duvenaud',
author_email="maclaurin@physics.harvard.edu, dduvenaud@seas.harvard.edu",
... | {
"content_hash": "6752a8ae4494a1472956ae023ebbc2d1",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 88,
"avg_line_length": 52.72222222222222,
"alnum_prop": 0.6174920969441517,
"repo_name": "melgor/autograd",
"id": "6175f4f175815195656c6fec63f7969a5edff536",
"size": "949",... |
import vk
import json
from sentiment_classifiers import SentimentClassifier, binary_dict, files
class VkFeatureProvider(object):
def __init__(self):
self._vk_api = vk.API(vk.Session())
self._vk_delay = 0.3
self._clf = SentimentClassifier(files['binary_goods'], binary_dict)
def _vk_grac... | {
"content_hash": "a76270aeea96a894dc4408967d74966e",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 107,
"avg_line_length": 33.35632183908046,
"alnum_prop": 0.5099931082012406,
"repo_name": "ArtemMIPT/sentiment_analysis",
"id": "7a0a7dc06cfe64950c0796cccdb010306e76a8bb",
... |
LOWER_VOWELS = 'aeiou'
# def shortcut(string):
# return filter(lambda a: a not in LOWER_VOWELS, string)
def shortcut(string):
return string.translate(None, LOWER_VOWELS)
| {
"content_hash": "a23b4d28cda0827f5a4f9861a2495fb2",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 60,
"avg_line_length": 20.22222222222222,
"alnum_prop": 0.7032967032967034,
"repo_name": "the-zebulan/CodeWars",
"id": "2286f67c5af14e2cca0f2b6cd5503c97bda23c31",
"size": "1... |
def static_vars(**kwargs):
def decorate(func):
for k in kwargs:
setattr(func, k, kwargs[k])
return func
return decorate
| {
"content_hash": "f363dbeab0e26fe25eadf7789c2bb245",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 39,
"avg_line_length": 26,
"alnum_prop": 0.5705128205128205,
"repo_name": "aholmback/fuse",
"id": "77da2f98a7f693f22e2126b4982796d61bdd08d0",
"size": "157",
"binary": fals... |
import logging
from oslo_config import cfg
import redis
from oslo_messaging._drivers.zmq_driver.matchmaker import base
LOG = logging.getLogger(__name__)
matchmaker_redis_opts = [
cfg.StrOpt('host',
default='127.0.0.1',
help='Host to locate redis.'),
cfg.IntOpt('port',
... | {
"content_hash": "e7c3a002cc8c03c8c9c27b87835f784f",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 77,
"avg_line_length": 30.84375,
"alnum_prop": 0.5901722391084093,
"repo_name": "esse-io/zen-common",
"id": "a2ee9bccfa3aaa1d1c29d0e955d6b6df66e5119b",
"size": "2549",
"b... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from sentry.utils.db import is_mysql
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'DSymSymbol'
db.create_table('sentry_dsymsymb... | {
"content_hash": "51a0a2a41e5b99e40297d135fe952bcf",
"timestamp": "",
"source": "github",
"line_count": 641,
"max_line_length": 217,
"avg_line_length": 84.35101404056162,
"alnum_prop": 0.5758752704877101,
"repo_name": "JamesMura/sentry",
"id": "78ab05e1a5058d480b48f1dcbb3cf5f8a96bdb41",
"size": "54... |
from __future__ import unicode_literals
import time
import json
import uuid
import datetime
import boto3
from moto.core import BaseBackend, BaseModel
from .exceptions import (
ResourceNotFoundException,
InvalidParameterException,
ResourceExistsException,
InvalidRequestException,
ClientError
)
fro... | {
"content_hash": "0ed777a2316862cfd6ee24049cf4f359",
"timestamp": "",
"source": "github",
"line_count": 399,
"max_line_length": 146,
"avg_line_length": 37.471177944862156,
"alnum_prop": 0.57634940806635,
"repo_name": "whummer/moto",
"id": "3e0424b6b043f507ce8e735edcded8d0997d0287",
"size": "14951",... |
from vent.api.menu_helpers import MenuHelper
from vent.api.plugins import Plugin
def test_cores():
""" Test the cores function """
instance = MenuHelper()
cores = instance.cores('install')
assert cores[0] == True
cores = instance.cores('build')
assert cores[0] == True
cores = instance.core... | {
"content_hash": "dbfd6978751ff977abe717cc3d9d9f72",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 77,
"avg_line_length": 30.321428571428573,
"alnum_prop": 0.6513545347467609,
"repo_name": "Jeff-Wang93/vent",
"id": "b7d12cfa1caa69626e38b5a6624ac4f2c6003683",
"size": "169... |
"""
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ \
9 20
/ \
15 7
return its zigzag level order traversal as:
[
[3],
... | {
"content_hash": "0e269474966d1d0117590e77a628a987",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 169,
"avg_line_length": 29.333333333333332,
"alnum_prop": 0.49873737373737376,
"repo_name": "yuzhangcmu/Python-Study",
"id": "0f2edc10aecc977978dcc609b8121040b5c257ad",
"si... |
from google.cloud import domains_v1beta1
def sample_configure_contact_settings():
# Create a client
client = domains_v1beta1.DomainsClient()
# Initialize request argument(s)
request = domains_v1beta1.ConfigureContactSettingsRequest(
registration="registration_value",
)
# Make the req... | {
"content_hash": "e81bc5951c219cea7b7e3a41eb79b5fe",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 71,
"avg_line_length": 26,
"alnum_prop": 0.7290969899665551,
"repo_name": "googleapis/python-domains",
"id": "44fcfa80bd2495cc8a8a7800ffed9c59a96e6b8e",
"size": "2004",
"... |
import sys
import copy
import functools
import datetime
import decimal
from functools import update_wrapper
from inspect import getargspec
from django import forms
from django.utils.encoding import force_unicode
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import get_pe... | {
"content_hash": "61e48d11d1a1ae332244d182907e5ae9",
"timestamp": "",
"source": "github",
"line_count": 585,
"max_line_length": 129,
"avg_line_length": 35.76923076923077,
"alnum_prop": 0.557037037037037,
"repo_name": "wcybxzj/django_xadmin17",
"id": "a63c3adf524a63569dc186a895bda9fbc36f37f7",
"size... |
"""Base Config control class."""
class BaseConfig(object):
"""Base class for identifier based configuration management."""
def __init__(self, config=None):
self._config = config or {}
@staticmethod
def _split_identifier(identifier):
return identifier.split('.')
def export(self):... | {
"content_hash": "8505faeaa45b34d486ea39a35c5ee63e",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 96,
"avg_line_length": 32.66197183098591,
"alnum_prop": 0.6097455799913756,
"repo_name": "grow/pygrow",
"id": "be5dc30e63d8508f3cfe4fa88f622a5d8c8b6688",
"size": "2319",
... |
"""
Test for softmax_regression.ipynb
"""
import os
from pylearn2.testing.skip import skip_if_no_data
from pylearn2.config import yaml_parse
from theano import config
def test():
skip_if_no_data()
dirname = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..')
with open(os.path.join(dirname, ... | {
"content_hash": "4e8d0ce8f6cbad58adaeaf3bfb0339a4",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 76,
"avg_line_length": 25.892857142857142,
"alnum_prop": 0.5772413793103448,
"repo_name": "shiquanwang/pylearn2",
"id": "809533b5189a4a5e24073d5616e8b52adf04d345",
"size": ... |
import sys, os
import argparse
from pynux import utils
import argparse
def main(argv=None):
parser = argparse.ArgumentParser(description='convert an object to jp2')
parser.add_argument('path', help="Nuxeo document path")
utils.get_common_options(parser)
if argv is None:
argv = parser.parse_arg... | {
"content_hash": "55b58fdfd9ee2f6ac5af013cdc7e9998",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 76,
"avg_line_length": 25,
"alnum_prop": 0.674,
"repo_name": "mredar/ucldc-iiif",
"id": "754196e2aa2617d48152dee7741a12b932375a21",
"size": "546",
"binary": false,
"cop... |
from .health_evaluation import HealthEvaluation
class PartitionsHealthEvaluation(HealthEvaluation):
"""Represents health evaluation for the partitions of a service, containing
health evaluations for each unhealthy partition that impacts current
aggregated health state. Can be returned when evaluating serv... | {
"content_hash": "74f130925fea093a3d0fc650456dd366",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 168,
"avg_line_length": 50.905660377358494,
"alnum_prop": 0.7171979243884359,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "ea3006a153bca383d028fda4cc2a41f01916fa78",
... |
import tensorflow as tf
import numpy as np
def linear(input_, output_size, scope=None, stddev=0.02, bias_start=0.0, with_w=False):
shape = input_.get_shape().as_list()
sequential_mode = len(shape) > 2 #need to deal with sequential case that input_ is batch x seq_len x dim
... | {
"content_hash": "b7fc38d50c8a1642b9b9341ea2dbe3cf",
"timestamp": "",
"source": "github",
"line_count": 534,
"max_line_length": 221,
"avg_line_length": 51.234082397003746,
"alnum_prop": 0.5491428780291677,
"repo_name": "navigator8972/vae_dyn",
"id": "f928d3d7c21a58dc1f4d095ae8c7ca8dac99dd4e",
"size... |
"""
desispec.io.skygradpca
===============
IO routines for sky gradient pca.
"""
from __future__ import absolute_import, division
import os
import time
from astropy.io import fits
from desiutil.log import get_logger
from . import iotime
from .util import get_tempfilename
def write_skygradpca(outfile, skygradpca):
... | {
"content_hash": "d9dc654b5037379edb06b46415e38bff",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 77,
"avg_line_length": 26.515625,
"alnum_prop": 0.6700058927519151,
"repo_name": "desihub/desispec",
"id": "5955b2302fd692841ef6c836f3c85272e9fa6fdb",
"size": "1697",
"bi... |
from adapter import NetworkAdapter
import StringIO
class InterfacesReader:
''' Short lived class to read interfaces file '''
def __init__(self, interfaces_path):
self._interfaces_path = interfaces_path
self._reset()
@property
def adapters(self):
return self._adapters
def... | {
"content_hash": "1c2d439c0632850d86461eb0f0dbc175",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 107,
"avg_line_length": 36.716312056737586,
"alnum_prop": 0.5288777284141395,
"repo_name": "dggreenbaum/debinterface",
"id": "f016376a98938323188722da851a07274a0bddb9",
"s... |
"""Scans a source JS file for its provided and required namespaces.
Simple class to scan a JavaScript file and express its dependencies.
"""
import re
_BASE_REGEX_STRING = '^\s*goog\.%s\(\s*[\'"](.+)[\'"]\s*\)'
_PROVIDE_REGEX = re.compile(_BASE_REGEX_STRING % 'provide')
_REQUIRES_REGEX = re.compile(_BASE_REGEX_ST... | {
"content_hash": "fe910f00627d5cd9a63f769aa868bb05",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 75,
"avg_line_length": 22.591549295774648,
"alnum_prop": 0.6408977556109726,
"repo_name": "maxogden/googlyscript",
"id": "4c1418d2c968c150febf586b09546362fb81478e",
"size":... |
import os
import sublime
import sublime_plugin
import platform
import re
import subprocess
import tempfile
from subprocess import Popen, PIPE
settings = None
class Settings:
def __init__(self):
package_settings = sublime.load_settings("RustAutoComplete.sublime-settings")
package_settings.add_on_... | {
"content_hash": "e0c00b89d0b5c1c25eff3b73166e3328",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 163,
"avg_line_length": 33.990990990990994,
"alnum_prop": 0.6015107341637954,
"repo_name": "nickmab/RustAutoComplete",
"id": "b3478f658e6ab19ba2d72a2335dcea734f3e8370",
"s... |
"""This module implements the Sublime Text 3 commands provided by remote."""
import os
import re
import sys
import sublime
import sublime_plugin
import subprocess
import threading
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import remote.sublime_api as sublime_api
import remote.sync_api as sync_api
im... | {
"content_hash": "4739de87ec3fd97d661e798a2b12973e",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 79,
"avg_line_length": 32.733333333333334,
"alnum_prop": 0.5158568519057317,
"repo_name": "devaos/sublime-remote",
"id": "e63ab3a59d370efcbb06433d108e7c3dfebec77b",
"size"... |
from datetime import *
from django.db import models
from django.utils.translation import ugettext as _
from filebrowser.fields import FileBrowseField
from koalixcrm.subscriptions.const.events import *
import koalixcrm.crm.documents
class Subscription(models.Model):
contract = models.ForeignKey('crm.Contract', ver... | {
"content_hash": "24ecf75901eba4728d46d168be94a2f5",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 111,
"avg_line_length": 42.704081632653065,
"alnum_prop": 0.565352449223417,
"repo_name": "scaphilo/koalixcrm",
"id": "c9ba641f24423d5fcfd77421f3df5f0ccc63ce9c",
"size": "4... |
import os
import os.path as pt
from scripttest import TestFileEnvironment
def before_scenario(context, _):
root_dir = pt.abspath(pt.join(pt.dirname(__file__), '..'))
path = ":" + pt.join(root_dir, 'bin')
tmp = pt.join(root_dir, "tmp", "feature")
python_path = pt.join(root_dir, 'vendor',... | {
"content_hash": "94057c33e2407d46188f8c3e7546a8e2",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 92,
"avg_line_length": 37.857142857142854,
"alnum_prop": 0.6132075471698113,
"repo_name": "michaelbarton/command-line-interface",
"id": "8d8b2393e5080bd2430f08447c20eb9e5eeab... |
from __future__ import division, absolute_import, print_function
"""Tests for the general importer functionality.
"""
import os
import re
import shutil
import unicodedata
import sys
import stat
from six import StringIO
from tempfile import mkstemp
from zipfile import ZipFile
from tarfile import TarFile
from mock impor... | {
"content_hash": "f3904a88740a7eff93443749396aad3e",
"timestamp": "",
"source": "github",
"line_count": 1965,
"max_line_length": 80,
"avg_line_length": 35.44885496183206,
"alnum_prop": 0.6032128859985357,
"repo_name": "shamangeorge/beets",
"id": "3418d4628f1c8aadd0bf2dd93eaa1340aafb25f3",
"size": "... |
import requests
import random
from django.conf import settings
from celery.task import Task
from celery.utils.log import get_task_logger
from .models import Account, Recharge
logger = get_task_logger(__name__)
def get_token():
"""
Returns the last token entry
"""
account = Account.objects.order_by('... | {
"content_hash": "74801d85b78699c837e0cfed0d71376e",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 79,
"avg_line_length": 35.60382513661202,
"alnum_prop": 0.5528355460056787,
"repo_name": "westerncapelabs/gopherairtime",
"id": "f26d25d30c978dc504f2ff89f7f0112783909783",
... |
import sys
import unittest2
from mock import MagicMock, Mock, patch
import oriskami
from oriskami.test.helper import OriskamiUnitTestCase
VALID_API_METHODS = ('get', 'post', 'delete')
class HttpClientTests(OriskamiUnitTestCase):
def setUp(self):
super(HttpClientTests, self).setUp()
self.orig... | {
"content_hash": "04e06ebce60e8b4e6168dff72d9abf8c",
"timestamp": "",
"source": "github",
"line_count": 359,
"max_line_length": 77,
"avg_line_length": 33.77715877437326,
"alnum_prop": 0.5929407883885865,
"repo_name": "ubivar/ubivar-python",
"id": "e1f1630bd3121d088cd30317317a5727edfb2964",
"size": ... |
import argparse
from Bio import SeqIO
from Bio import Seq
from Bio import SeqRecord
ap = argparse.ArgumentParser(description="Count masked characters.")
ap.add_argument("fastain", help="Input gap-bed file.")
args = ap.parse_args()
fastaFile = open(args.fastain)
for record in SeqIO.parse(fastaFile, "fasta") :
... | {
"content_hash": "fd68cfbe929710047dbdf232cdfed08c",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 78,
"avg_line_length": 24.59090909090909,
"alnum_prop": 0.6580406654343808,
"repo_name": "yunlongliukm/chm1_scripts",
"id": "3382edaaffa7521f34e8ea0acd1480bf275a0f9b",
"siz... |
"""
Web Scraper Project
Scrape data from a regularly updated website livingsocial.com and
save to a database (postgres).
Scrapy item part - defines container for scraped data.
"""
from scrapy.item import Item, Field
class LivingSocialDeal(Item):
"""Livingsocial container (dictionary-like object) for scraped data... | {
"content_hash": "0aa3074923d5067efd67af24fd9e0e74",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 74,
"avg_line_length": 25.444444444444443,
"alnum_prop": 0.7008733624454149,
"repo_name": "enilsen16/python",
"id": "49ebceae95746472d56ac0720f7bd5f2bdbb418d",
"size": "458... |
import copy
from oslo_log import log as logging
from tempest_lib.services.compute.agents_client import AgentsClient
from tempest_lib.services.compute.aggregates_client import AggregatesClient
from tempest_lib.services.compute.availability_zone_client import \
AvailabilityZoneClient
from tempest_lib.services.comput... | {
"content_hash": "1fca76d7fdc8913ff81fb21b057a97d2",
"timestamp": "",
"source": "github",
"line_count": 476,
"max_line_length": 79,
"avg_line_length": 49.063025210084035,
"alnum_prop": 0.6657960092489509,
"repo_name": "izadorozhna/tempest",
"id": "84e85446ef2522cba83b047ca530472f9d43fdbe",
"size": ... |
from django.conf.urls import include, url
urlpatterns = [
url(r'^school_json/$', 'visit.views.school_json', name='school-json'),
url(r'^school_json/(?P<school_id>\d+)/(?P<staff_id>\d+)/$', 'visit.views.school_json', name='school-json'),
url(r'^school_json/(?P<school_id>\d+)/(?P<staff_id>\d+)/(?P<key>[\w-]+... | {
"content_hash": "36b7a7fdc30dec6fbf39ab78b100703c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 127,
"avg_line_length": 66.56,
"alnum_prop": 0.6195913461538461,
"repo_name": "koebbe/homeworks",
"id": "0c20cdfdce272c54f7e8b284caaae6d1c0ae3706",
"size": "1664",
"binar... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('newsroom', '0008_article_author_feedback'),
]
operations = [
migrations.RenameField(
model_name='article',
old_name='author_feedback',
new_name='editor_feedback'... | {
"content_hash": "6f2ab66e2e5fad4b572efd6f04edb481",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 53,
"avg_line_length": 21.1875,
"alnum_prop": 0.5752212389380531,
"repo_name": "groundupnews/gu",
"id": "e421be6cc7251a2ec0f7355d092d7237bdba750c",
"size": "389",
"binary... |
"""
@package mi.core.instrument.test.test_chunker
@file mi/core/instrument/test/test_chunker.py
@author Steve Foley
@brief Test cases for the base chunker module
"""
__author__ = 'Steve Foley'
__license__ = 'Apache 2.0'
import unittest
import re
from functools import partial
from mi.core.unit_test import MiUnitTest, ... | {
"content_hash": "6d86155a3d2bf50a490dd7d501a63867",
"timestamp": "",
"source": "github",
"line_count": 380,
"max_line_length": 109,
"avg_line_length": 41.04210526315789,
"alnum_prop": 0.5917542959733265,
"repo_name": "mikeh77/mi-instrument",
"id": "39403e0dcb93b329c2ae8b6c8de318d3caa6af50",
"size"... |
import numpy as np
import matplotlib.pyplot as plt
import glob
import re
import sqlite3
import helper
import addline
def plotWeakScaling(allsize=1000000,allgraphtype='SOFTWARE',alladditionalwhere=' AND total_time>0 ',suffix='',basesize=100000, title=''):
fig = plt.figure()
ax = fig.add_subplot(111)
#addline.addWe... | {
"content_hash": "d5aa2032db5cb9a76f8c683c1cd16d0a",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 176,
"avg_line_length": 52.755102040816325,
"alnum_prop": 0.7148936170212766,
"repo_name": "walkevin/ParallelTopologicalSorting",
"id": "e2a18290ab133933a4792874d8e89c8bc1370... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/wearables/base/shared_base_held_both.iff"
result.attribute_template_id = 11
result.stfName("wearables_name","default_held")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "0a94dcf2e605d11567f071c431b08397",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 77,
"avg_line_length": 24.23076923076923,
"alnum_prop": 0.7047619047619048,
"repo_name": "anhstudios/swganh",
"id": "894a1589b450daecf98bec70aa952a4526a5de46",
"size": "460... |
import os
from oslo_config import cfg
from neutron._i18n import _
from neutron.common import config
ROOT_HELPER_OPTS = [
cfg.StrOpt('root_helper', default='sudo',
help=_("Root helper application. "
"Use 'sudo neutron-rootwrap /etc/neutron/rootwrap.conf' "
... | {
"content_hash": "4b59fc6043074132a4b760787d85d48f",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 79,
"avg_line_length": 36.86,
"alnum_prop": 0.5943208536805933,
"repo_name": "bigswitch/neutron",
"id": "b6913d58d614d02ffa78da90727b981d03432dd1",
"size": "6165",
"bina... |
"""Stateful programmatic web browsing.
Stateful programmatic web browsing, after Andy Lester's Perl module
WWW::Mechanize.
mechanize.Browser implements the urllib2.OpenerDirector interface. Browser
objects have state, including navigation history, HTML form state, cookies,
etc. The set of features and URL schemes h... | {
"content_hash": "731e3b99041d184690d0420a2b3b78a1",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 79,
"avg_line_length": 36.15384615384615,
"alnum_prop": 0.6857142857142857,
"repo_name": "jjuanda/mechanize",
"id": "646c69d07edb68c6e1706c625e22c4cc6f1d24d2",
"size": "331... |
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
import google.api_core
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import retry as retries
import google.auth # type: ignore
from google.auth import credentials as... | {
"content_hash": "0e9385e656cc488bb69bb96a35fb8660",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 101,
"avg_line_length": 35.46341463414634,
"alnum_prop": 0.6079779917469051,
"repo_name": "googleapis/python-compute",
"id": "5186d99df1cec62c9b1bab7c0d698087e1563b25",
"s... |
"""
Running or runtime configuration related to bgp peers/neighbors.
"""
from abc import abstractmethod
import logging
from ryu.lib.packet.bgp import RF_IPv4_UC
from ryu.lib.packet.bgp import RF_IPv6_UC
from ryu.lib.packet.bgp import RF_IPv4_VPN
from ryu.lib.packet.bgp import RF_IPv6_VPN
from ryu.lib.packet.bgp impor... | {
"content_hash": "59b628678ad37389d625ae2a9034b556",
"timestamp": "",
"source": "github",
"line_count": 477,
"max_line_length": 79,
"avg_line_length": 36.9538784067086,
"alnum_prop": 0.6280705735519374,
"repo_name": "o3project/ryu-oe",
"id": "8acd62ed918d19ac5d617e429fffea3540707071",
"size": "1824... |
import logging
import logging.handlers
import os
import glob
import sys
from datetime import datetime
import time
import smdpipeline
start_time = time.time()
REPO_PATH = './'
sys.path.append(REPO_PATH)
output_folder = './output'
input_folder = './input'
logs_folder = './logs'
if not os.path.exists(logs_folder):
... | {
"content_hash": "b046148179b56ec8a2716a660c9bb65e",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 89,
"avg_line_length": 35.526315789473685,
"alnum_prop": 0.5311111111111111,
"repo_name": "Bloodrammer/surveygen_smd",
"id": "5bbe632e8ca46d181d7b0d377139bae2f4a1c45b",
"si... |
from datetime import datetime
from .worker import function_test
function_test.delay(0, tuples=(1, 2, 3), lists=[1, 2, 3], dicts={'mess': None, True: 'clearly'})
function_test.delay(0, tuples=(1, True, {'mess': None}),
lists=[(1, 'rogério'), datetime.now()],
sets={1.1, False},
... | {
"content_hash": "b9487c21cd19b491ad4913f36f9e6c8b",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 96,
"avg_line_length": 49,
"alnum_prop": 0.5673469387755102,
"repo_name": "rsalmei/clearly",
"id": "71d069ff637dc03571fafc7961490b0da46703a4",
"size": "491",
"binary": fa... |
import curses
from ...util.Configuration import Configuration
from ..uicomponents.BaseWindow import BaseWindow
from ..uicomponents.MetaButtonBox import MetaButtonBox
from ...util.funcutils import sfill
class ApplicationMenu(BaseWindow):
"""
The menu for login/logout, user account, quit application
"""
... | {
"content_hash": "3763f1629e4d8ca53de6d79669a79890",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 82,
"avg_line_length": 35.50617283950617,
"alnum_prop": 0.5125173852573018,
"repo_name": "thethythy/Mnemopwd",
"id": "774f6b5cb42c90e1c8a7f6883d20d2a31ab45ed3",
"size": "42... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.