text stringlengths 4 1.02M | meta dict |
|---|---|
import operator
import re
## We throw this if we encounter an operator that we don't know what to do with:
class unknownOperatorException(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return repr(self.msg)
############################################################... | {
"content_hash": "8749a35960634be529bc9b16061d74d8",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 106,
"avg_line_length": 27.23076923076923,
"alnum_prop": 0.49887005649717514,
"repo_name": "rotten/hue-multicorn-postgresql-fdw",
"id": "4ff57da5f6936d2b22ac8958b8f1467e1aac... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from ..util import resource_path
from . import bottle
_WEBROOT = resource_path('webfront')
_JSROOT = os.path.join(_WEBROOT, 'js')
@bottle.route('/')
@bottle.route('/index.html')
def serve_home():
return bottle.static_f... | {
"content_hash": "371a27d86e9ec4f7b4fbb424ad32dd61",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 82,
"avg_line_length": 22.807692307692307,
"alnum_prop": 0.715008431703204,
"repo_name": "nickchen-mitac/fork",
"id": "52abaa6ee3bf59933cc1c6074955849ea659336f",
"size": "6... |
from test_fena.test_common import test_cmd
def test_simple_cmds():
test_cmd("tag @s + _lol", "tag @s add fena.lol")
test_cmd("tag @s - _lol", "tag @s remove fena.lol")
test_cmd(r"tag @s + _lol {Invulnerable:1b}", expect_error=True)
test_cmd(r"tag @s - _lol {Invulne... | {
"content_hash": "51dd6e3a39500115c6eda341b6eab7b4",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 97,
"avg_line_length": 52.35294117647059,
"alnum_prop": 0.5988764044943821,
"repo_name": "Aquafina-water-bottle/Command-Compiler-Unlimited",
"id": "0577359a4f28415df85f9b7c3b... |
from __future__ import division, print_function, unicode_literals
__doc__="""
Reduplicates your edit text across masters, will add one line per master. Careful, ignores everything after the first newline.
"""
from Foundation import NSMutableAttributedString, NSAttributedString
glyphs3 = Glyphs.versionNumber >= 3
cuto... | {
"content_hash": "5db4c5a92d02651de545ae605a65e8b2",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 130,
"avg_line_length": 33.12,
"alnum_prop": 0.7379227053140096,
"repo_name": "mekkablue/Glyphs-Scripts",
"id": "7448bdd3acf0dade21a647f93373cbef0d50dbf7",
"size": "1708",
... |
"""Module containing classes related to Azure VM networking.
The Firewall class provides a way of opening VM ports. The Network class allows
VMs to communicate via internal ips and isolates PerfKitBenchmarker VMs from
others in
the same project. See http://msdn.microsoft.com/library/azure/jj156007.aspx
for more inform... | {
"content_hash": "cc186c5850ae7bebd705363849d4e56d",
"timestamp": "",
"source": "github",
"line_count": 674,
"max_line_length": 170,
"avg_line_length": 34.862017804154306,
"alnum_prop": 0.6522960377920586,
"repo_name": "GoogleCloudPlatform/PerfKitBenchmarker",
"id": "f768ae441676cb70f7cee27f43e229963... |
from .. import tutils, mastertest
from mitmproxy.builtins import replace
from mitmproxy.flow import master
from mitmproxy.flow import state
from mitmproxy import options
class TestReplace(mastertest.MasterTest):
def test_configure(self):
r = replace.Replace()
updated = set(["replacements"])
... | {
"content_hash": "5236a93d436136d961129f3f623cbc80",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 53,
"avg_line_length": 28.153846153846153,
"alnum_prop": 0.5075136612021858,
"repo_name": "dufferzafar/mitmproxy",
"id": "5e70ce56100c970e0ed3d3d5320c3098ebb1a7bd",
"size":... |
"""
SlipStream
----------
.. autoclass:: SlipStream(stream, [chunk_size])
:show-inheritance:
A :class:`SlipStream` instance has the following attributes in addition to the attributes
offered by its base class :class:`SlipWrapper`:
.. autoattribute:: readable
.. autoattribute:: writable
"""
import io
... | {
"content_hash": "7cb7d14c979c85683994ab544ef1c4c6",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 116,
"avg_line_length": 41.28767123287671,
"alnum_prop": 0.6368613138686131,
"repo_name": "rhjdjong/SlipLib",
"id": "6c25ab258f53fc182d24e7a24b3b020a3f0d7cf0",
"size": "62... |
"""WSGI middleware initialization for the allura application."""
import mimetypes
import pylons.middleware
import tg
import tg.error
import pkg_resources
from tg import config
from paste.deploy.converters import asbool, aslist, asint
from paste.registry import RegistryManager
from routes.middleware import RoutesMiddle... | {
"content_hash": "4702705766b2ba91912d43633dc5042d",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 87,
"avg_line_length": 38.205882352941174,
"alnum_prop": 0.6895047472414678,
"repo_name": "lym/allura-git",
"id": "fd137c2760c4f185c815cb7215b5fa1d7ab3e6cc",
"size": "8689... |
"""
XBMCLocalProxy 0.1
Copyright 2011 Torben Gerkensmeyer
Modified for F4M format by Shani
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your opt... | {
"content_hash": "2cc48d60c9b552b9574ec06cbe2de22c",
"timestamp": "",
"source": "github",
"line_count": 531,
"max_line_length": 269,
"avg_line_length": 42.96421845574388,
"alnum_prop": 0.5622424826860699,
"repo_name": "dbiesecke/dbiesecke.github.io",
"id": "d2b2214c2b6386a9a25c1995583deba5d3b4534b",
... |
from __future__ import unicode_literals
import time
from django.contrib.auth.models import User
from django.db import models
from django.template.defaultfilters import slugify
from django.utils.encoding import smart_unicode
def upload_to_artist(instance, filename):
return 'artits/%s/%s' % (instance.username, file... | {
"content_hash": "9f8bfe0578a35b3a685589aca679734b",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 106,
"avg_line_length": 31.193548387096776,
"alnum_prop": 0.6546018614270941,
"repo_name": "CarlosMart626/umusicfy",
"id": "b7c26546022263bb0a0287b3169f8e551f41598f",
"size... |
import json
from django.core import serializers
from django.db.models import F
from django.test import SimpleTestCase, TestCase
from tests.testapp.models import Bit1Model, NullBit1Model
class TestSaveLoad(TestCase):
def test_basic(self):
m = Bit1Model()
m.flag_a = False
m.flag_b = True
... | {
"content_hash": "9ec57b20bba97a599d81d16dc07f9657",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 73,
"avg_line_length": 32.47953216374269,
"alnum_prop": 0.6047893410154843,
"repo_name": "arnau126/django-mysql",
"id": "a472dcb1d09b72bd30fe578418728a68cf503542",
"size":... |
"""
===============================================
Feature transformations with ensembles of trees
===============================================
Transform your features into a higher dimensional, sparse space. Then
train a linear model on these features.
First fit an ensemble of trees (totally random trees, a rand... | {
"content_hash": "d9ed2acfb7704f32b2e481cc9a51545e",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 77,
"avg_line_length": 36.36363636363637,
"alnum_prop": 0.6906818181818182,
"repo_name": "massmutual/scikit-learn",
"id": "7b6941846ab5436828464750f191a459231cfa15",
"size... |
import numpy as np
from menpo.feature import ndfeature
from menpofit.math.correlationfilter import mccf, imccf
@ndfeature
def probability_map(x, axes=(-2, -1)):
r"""
Generates the probability MAP of the image.
Parameters
----------
x : `menpo.image.Image` or subclass or `ndarray`
The inp... | {
"content_hash": "ddb48bea9bcebc3407ff6d336b429bcd",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 80,
"avg_line_length": 38.29457364341085,
"alnum_prop": 0.5180161943319838,
"repo_name": "grigorisg9gr/menpofit",
"id": "a4deef97f8def49e34ee6f07fdba2006f74d0855",
"size":... |
import click
from commands.load_metadata.continents import continents
from commands.load_metadata.countries import countries
from commands.load_metadata.economic_blocs import economic_blocs
from commands.load_metadata.establishments import establishments
from commands.load_metadata.hedu_course import hedu_course
from c... | {
"content_hash": "26de282156d42fa33af9375be83c49c1",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 119,
"avg_line_length": 48.55813953488372,
"alnum_prop": 0.7935823754789272,
"repo_name": "DataViva/dataviva-scripts",
"id": "accad000c38389b5652221e3f82780fee4942142",
"si... |
import logging
import sys
import os
import socket
import re
import xmlrpclib
import httplib
from time import sleep
from urlparse import urlparse
from flexget.utils.template import RenderError
from flexget.utils.pathscrub import pathscrub
from flexget import plugin
from flexget.event import event
from flexget.entry im... | {
"content_hash": "4fe8c45a868a9602a0d8995e6e80ed94",
"timestamp": "",
"source": "github",
"line_count": 642,
"max_line_length": 117,
"avg_line_length": 35.546728971962615,
"alnum_prop": 0.5589588536873932,
"repo_name": "xfouloux/Flexget",
"id": "1b7bdef806012a4873db8b7195d333ef4e626431",
"size": "2... |
HEADER_PEPTIDE = 'Peptide sequence'
HEADER_NO_PSM = 'PSM count'
HEADER_AREA = 'MS1 area (highest of all PSMs)'
HEADER_QVAL = 'q-value'
HEADER_PEP = 'PEP'
HEADER_QVAL_MODELED = 'q-value (linear modeled)'
HEADER_FALSE_LOC_RATE = 'PTM FLR'
HEADER_LINKED_PSMS = 'Files/scans for peptide'
HEADER_PROTEINS = 'Protein(s)'
HEADE... | {
"content_hash": "ebcc39bc385e8d02e8765e9cef387a2d",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 60,
"avg_line_length": 37.3125,
"alnum_prop": 0.7336683417085427,
"repo_name": "glormph/msstitch",
"id": "3cc5c9954c2933b908c82393dab4522c847cfef9",
"size": "597",
"binar... |
def form():
""" a simple entry form with various types of objects """
form = FORM(TABLE(
TR('Your name:', INPUT(_type='text', _name='name',
requires=IS_NOT_EMPTY())),
TR('Your email:', INPUT(_type='text', _name='email',
requires=IS_EMAIL())),
TR('Admin', INPUT(_typ... | {
"content_hash": "162b68671fe50d041d513e281e9b817a",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 61,
"avg_line_length": 38.45454545454545,
"alnum_prop": 0.549645390070922,
"repo_name": "andersonsilvade/python_C",
"id": "944aa08f752791c221267ff1132d2d887267213f",
"size"... |
import flask
import auth
import config
import model
import util
from main import app
linkedin_config = dict(
access_token_method='POST',
access_token_url='https://www.linkedin.com/uas/oauth2/accessToken',
authorize_url='https://www.linkedin.com/uas/oauth2/authorization',
base_url='https://api.linked... | {
"content_hash": "c0d891e7804f1624432999d0352086dc",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 73,
"avg_line_length": 27.205479452054796,
"alnum_prop": 0.6686807653575025,
"repo_name": "sidharta/hansel-app",
"id": "9d15286d43e353205ff695694dceb297d84dd84b",
"size": "... |
"""config/ presubmit script for Blink.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into gcl.
"""
USE_PYTHON3 = True
PRESUBMIT_VERSION = '2.0.0'
def CheckEnsureSpecifier(input_api, output_api):
"""Ensure the first specifiers for the bu... | {
"content_hash": "3d528242858fc2a1538adb8a250d9c2f",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 81,
"avg_line_length": 43.8,
"alnum_prop": 0.5636007827788649,
"repo_name": "chromium/chromium",
"id": "8def37ac5881ef085f7abcb1389ab3d31dbe8cc2",
"size": "1674",
"binary... |
from django.db import migrations
# Generated by Django 2.2.18 on 2021-03-30 20:09
from django.db import migrations
"""
JIRA WATER-1545, version 2
Modify column names for a few columns that were missing units
This only impacts the new export interface
"""
"""
Well V2
"""
CREATE_EXPORT_WELL_VIEW_S... | {
"content_hash": "80b4ffca6c5d45c2e5a2e164f2c6738a",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 103,
"avg_line_length": 44.742138364779876,
"alnum_prop": 0.7323587292662356,
"repo_name": "bcgov/gwells",
"id": "2e70c53ce63c0e42ff03e6de366f4926c2509250",
"size": "7164"... |
from django.forms import modelform_factory
def model_resource_form(resource):
return modelform_factory(resource.model)
def mongo_resource_form(resource):
pass
#
#
# class ResourceFormMetaclass(type):
# def __new__(cls, name, bases, attrs):
# formfield_callback = attrs.pop('for... | {
"content_hash": "b6149eb3679adb56b8a271f9525cb8b5",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 97,
"avg_line_length": 46.833333333333336,
"alnum_prop": 0.47813929842399594,
"repo_name": "uptown/django-town",
"id": "c7f72d96dd01cd10d0722100913515193cc737d3",
"size": "... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reviewers', '0014_auto_20210120_1232'),
]
operations = [
migrations.AlterField(
model_name='autoapprovalsummary',
name='confirmed',
field=models.BooleanF... | {
"content_hash": "1ab0b27bfc27351f9cc5188fd5448f6e",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 63,
"avg_line_length": 23,
"alnum_prop": 0.6005434782608695,
"repo_name": "mozilla/addons-server",
"id": "16601d227f2ed99110d12c81fa25557f4eaec951",
"size": "418",
"binar... |
from django.utils import timezone
from bulbs.content.models import Content, Tag
from bulbs.sections.models import Section
from bulbs.utils.test import BaseIndexableTestCase, make_content
class BaseCustomSearchFilterTests(BaseIndexableTestCase):
def setUp(self):
super(BaseCustomSearchFilterTests, self).se... | {
"content_hash": "e28ee1dd1f0a7f305ff822f6328a37cc",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 80,
"avg_line_length": 30.995049504950494,
"alnum_prop": 0.4465740297077144,
"repo_name": "theonion/django-bulbs",
"id": "86f29edee3ce71d01cf53185d4f2ba7f60339334",
"size"... |
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from moderator.constants import DEFAULT_CONFIG
from secretballot.models import Vote
from moderator.models import ClassifiedComment
from celery.task import task
@task(ignore_result=True)
def flag_reported_comments_task(comment)... | {
"content_hash": "17a0926edcc7c97c9c2e22ded3d2d312",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 74,
"avg_line_length": 36.416666666666664,
"alnum_prop": 0.7288329519450801,
"repo_name": "praekelt/django-moderator",
"id": "44bcad1369223bd2a01e22963d882d928567bc64",
"si... |
from __future__ import division
from . import *
from tomcrypt import cipher
from tomcrypt.cipher import *
def load_tests(loader, tests, ignore):
tests.addTests(get_doctests(cipher))
return tests
class CipherAPITests(TestCase):
def test_convience_args(self):
# Args should be: key, iv, mode.
... | {
"content_hash": "9d8382e850634b36b6c90b89076492b9",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 135,
"avg_line_length": 36.839416058394164,
"alnum_prop": 0.5411135327917574,
"repo_name": "mikeboers/PyTomCrypt",
"id": "b42236d72659d68cf88008b9c80717532a9f8405",
"size"... |
"""
unixccompiler - can handle very long argument lists for ar.
"""
from __future__ import division, absolute_import, print_function
import os
from distutils.errors import DistutilsExecError, CompileError
from distutils.unixccompiler import *
from numpy.distutils.ccompiler import replace_method
from numpy.distutils.... | {
"content_hash": "6b68e4eb749c9db138a4dfbe583a82bb",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 82,
"avg_line_length": 37.24460431654676,
"alnum_prop": 0.59860923314661,
"repo_name": "Eric89GXL/numpy",
"id": "11b2cce529af56d81809db9dcb11941bece4cde3",
"size": "5177",... |
from django import template
from django.template.base import TemplateSyntaxError
from django.utils.encoding import force_str
from django.template.loader import render_to_string
from tinycontent.models import TinyContent
register = template.Library()
class TinyContentNode(template.Node):
def __init__(self, args,... | {
"content_hash": "b03495e96c0266b55cac4fa3e703a233",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 72,
"avg_line_length": 30.16883116883117,
"alnum_prop": 0.5643564356435643,
"repo_name": "dominicrodger/django-tinycontent",
"id": "f02a9637842c8c15bb2068faa68d0a653f0b5569",... |
import argparse
import os
import subprocess
import sys
def setup():
global args, workdir
programs = ['ruby', 'git', 'apt-cacher-ng', 'make', 'wget']
if args.kvm:
programs += ['python-vm-builder', 'qemu-kvm', 'qemu-utils']
elif args.docker:
dockers = ['docker.io', 'docker-ce']
fo... | {
"content_hash": "69a7d50036f56446dc7bb6d92cd603bf",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 231,
"avg_line_length": 58.751091703056765,
"alnum_prop": 0.6419652148060057,
"repo_name": "Christewart/bitcoin",
"id": "faf8b014aa6df40f9675c659351e8b4f14bf7d90",
"size":... |
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Ecs20130110DescribeZonesRequest(RestApi):
def __init__(self,domain='ecs.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.RegionId = None
def getapiname(self):
return 'ecs.aliyuncs.com.DescribeZones.2013-01-10'
| {
"content_hash": "429bdeda2264efe909149dcb05cf1f3a",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 54,
"avg_line_length": 29,
"alnum_prop": 0.7366771159874608,
"repo_name": "francisar/rds_manager",
"id": "5ad0e774391cc2f849da0d1d2cdbe33fab717191",
"size": "319",
"binar... |
from libsaas import http, parsers
from libsaas.services import base
from .resource import NewRelicResource
class Components(NewRelicResource):
path = 'components'
def update(self, *args, **kwargs):
raise base.MethodNotSupported()
def delete(self, *args, **kwargs):
raise base.MethodNotS... | {
"content_hash": "05afc832cc4afc2ab76e8b7040b48f78",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 75,
"avg_line_length": 27.87735849056604,
"alnum_prop": 0.6030456852791878,
"repo_name": "80vs90/libsaas",
"id": "42321f9ab20ca6d3818f28de698ad08dd5f6f1e4",
"size": "2955"... |
import cufflinks as cf
import pandas as pd
import numpy as np
import unittest
from nose.tools import assert_equals
##
## nosetests -xv tests.py --with-coverage --cover-package=cufflinks
##
class TestIPlot(unittest.TestCase):
def setUp(self):
self.df = pd.DataFrame(dict(x=[1, 2, 3], y=[4, 2, 1], c=[3, 1, 5]))
... | {
"content_hash": "ef6ccbeb69b36e358a885eee92fe5eb5",
"timestamp": "",
"source": "github",
"line_count": 290,
"max_line_length": 71,
"avg_line_length": 23.33103448275862,
"alnum_prop": 0.6268105232042566,
"repo_name": "santosjorge/cufflinks",
"id": "52514df00ceb669f0e06080c58892296d090ffc7",
"size":... |
import windows
print("Computer is a <{0}>".format(windows.system.version_name))
cp = windows.current_process
apism = cp.peb.apisetmap
print("ApiSetMap: {0} (version = {1})".format(apism, apism.version))
dll_demos_fullname = 'api-ms-win-core-processthreads-l1-1-3'
dll_demos_utilname = 'api-ms-win-core-processthreads... | {
"content_hash": "5df4b9ea0b4190f015b99462245260ee",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 121,
"avg_line_length": 44.44444444444444,
"alnum_prop": 0.7,
"repo_name": "hakril/PythonForWindows",
"id": "897a51588f6ca510591ff79480ef0807e91347ad",
"size": "1200",
"b... |
from __future__ import annotations
# stdlib
import json
import os
import re
import time
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
from typing import Tuple
from typing import Union
# third party
from nacl.signing import VerifyKey
import requests
from typing_exte... | {
"content_hash": "89ba0f3ca2efc74ff0d99714086db9dc",
"timestamp": "",
"source": "github",
"line_count": 505,
"max_line_length": 103,
"avg_line_length": 33.32079207920792,
"alnum_prop": 0.579307066024841,
"repo_name": "OpenMined/PySyft",
"id": "848b50d1ae4cd57ab43570445ea2303a3f2e261d",
"size": "168... |
from __future__ import unicode_literals
from django.test import TestCase
from rest_framework.status import (
is_informational, is_success, is_redirect, is_client_error, is_server_error
)
class TestStatus(TestCase):
def test_status_categories(self):
self.assertFalse(is_informational(99))
... | {
"content_hash": "72eb4766d543cb203042c3223dc096d9",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 79,
"avg_line_length": 36.09090909090909,
"alnum_prop": 0.6607892527287993,
"repo_name": "hfercc/mese2014",
"id": "19962ccafd177cc5055e6978662901ba3f934d5a",
"size": "1191"... |
from msrest.serialization import Model
class PacketCaptureParameters(Model):
"""Parameters that define the create packet capture operation.
:param target: The ID of the targeted resource, only VM is currently
supported.
:type target: str
:param bytes_to_capture_per_packet: Number of bytes captur... | {
"content_hash": "303b30984dfa3e016aad278a25eac361",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 159,
"avg_line_length": 44.020833333333336,
"alnum_prop": 0.6691907240889731,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "cfd2ced1aeb6a72a27de3696f4ad8a47faff5ca4"... |
import RPi.GPIO as GPIO
from time import gmtime, strftime, time, localtime, mktime, strptime
import json
import urllib2
import base64
from math import fabs
import os
config = {
'user': 'spsensors',
'password': 'BuCSlvWpl8reZP3R',
'server': 'livinglab.powerprojects.se:6984'
}
#Functions
#Time... | {
"content_hash": "ce62556f6e619fe36702d5a72f5ad84a",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 88,
"avg_line_length": 23.659574468085108,
"alnum_prop": 0.6857014388489209,
"repo_name": "Anton04/GhostHunt",
"id": "6a735834d35f083fafc0cd7941fbf9783ebd8759",
"size": "23... |
import mitmproxy.tools.console.palettes as palettes
from .. import tutils
@tutils.skip_appveyor
class TestPalette:
def test_helptext(self):
for i in palettes.palettes.values():
assert i.palette(False)
for i in palettes.palettes.values():
assert i.palette(True)
| {
"content_hash": "190b73ca244dd3c92d24d376d180ff1c",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 51,
"avg_line_length": 25.666666666666668,
"alnum_prop": 0.672077922077922,
"repo_name": "dwfreed/mitmproxy",
"id": "7490bae08ebc474529b4076394b7b46e2fc7b618",
"size": "308... |
import asyncio
from ..python import Lexer, basic_parse, items, parse
from .data import *
from .server import with_reader
@with_reader(RAW_DATA)
async def test_lexer(stream):
lex = Lexer(stream, buf_size=10)
tokens = []
async for chunk in lex:
tokens.append(chunk)
assert len(tokens) == len(RA... | {
"content_hash": "afbb2b514a3a2a73473eb97ed8281333",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 63,
"avg_line_length": 25.395604395604394,
"alnum_prop": 0.6473388143660753,
"repo_name": "ethanfrey/aiojson",
"id": "d2c0f37e4f772a3b37caeed96d5b2a21159667f0",
"size": "23... |
"""
The :mod:`sklearn.pipeline` module implements utilities to build a composite
estimator, as a chain of transforms and estimators.
"""
# Author: Edouard Duchesnay
# Gael Varoquaux
# Virgile Fritsch
# Alexandre Gramfort
# Lars Buitinck
# License: BSD
from collections import defaultdict... | {
"content_hash": "1755c26d4c837eafcf316e2cf84f1213",
"timestamp": "",
"source": "github",
"line_count": 810,
"max_line_length": 79,
"avg_line_length": 34.77654320987654,
"alnum_prop": 0.5806027903013952,
"repo_name": "alexsavio/scikit-learn",
"id": "df2664f213bfbb04276c4bb22e4fa20ffa17ba06",
"size"... |
"""
A simple modem implementation that supports caller ID.
For more details about this platform, please refer to the documentation at
https://github.com/vroomfonde1/basicmodem
"""
import logging
import serial
_LOGGER = logging.getLogger(__name__)
DEFAULT_PORT = '/dev/ttyACM0'
DEFAULT_CMD_CALLERID = 'AT+VCID=1'
READ_... | {
"content_hash": "9c92116e6e5e88c978452c9752cd00f4",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 78,
"avg_line_length": 32.3287037037037,
"alnum_prop": 0.5380209079192324,
"repo_name": "vroomfonde1/basicmodem",
"id": "1983ee8a1d68e29e4103d7605b65e16db1eeb6fe",
"size":... |
"""
synaptiks.kde.widgets.touchpad
==============================
Widgets for touchpad information and configuration
.. moduleauthor:: Sebastian Wiesner <lunaryorn@googlemail.com>
"""
from __future__ import (print_function, division, unicode_literals,
absolute_import)
from... | {
"content_hash": "acbe8098cc618635fa4f8ac62cf12f69",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 79,
"avg_line_length": 35.19711538461539,
"alnum_prop": 0.6490916541456085,
"repo_name": "sibskull/synaptiks",
"id": "9dea1c251da41ce92b13c501050cc7a507abb7da",
"size": "8... |
"""Test GitHub webhooks."""
import frost.hooks
import flask
import json
import pytest
@pytest.fixture
def client():
app = flask.Flask(__name__)
frost.hooks.hooks.init_app(app)
app.config['DEBUG'] = True
app.config['VALIDATE_IP'] = False
app.config['VALIDATE_SIGNATURE'] = False
return app.test... | {
"content_hash": "430bd3191c5f98e63a919b96b3d47c03",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 65,
"avg_line_length": 23,
"alnum_prop": 0.6157461809635723,
"repo_name": "nickfrostatx/frost",
"id": "f5da6aefea38751afe78a6c5b22888fee83aeb69",
"size": "875",
"binary":... |
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QTextEdit, QPushButton, QVBoxLayout
class Window(QWidget):
def __init__(self):
super().__init__()
# Make widgets #################
self.edit = QTextEdit()
self.btn = QPushButton("Print")
self.edit.setPlacehol... | {
"content_hash": "cfe4b79c136550af37ae8269a6d7a06c",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 123,
"avg_line_length": 25.804347826086957,
"alnum_prop": 0.6107834877843302,
"repo_name": "jeremiedecock/snippets",
"id": "2a922ce3bb2114251aef6ef14ddf02c8b3739aa7",
"size... |
import sys
import requests
import re
from collections import Counter
def main(url):
webpage = requests.get(url).text
domains = re.findall(r'src="https?://[\w.]*\.(\w*\.\w*)/', webpage)
results = Counter()
for domain in domains:
results[domain] += 1
for result in results.most_common():
... | {
"content_hash": "8a86071ab5e8c9e3d65d3cf5aa1200d5",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 71,
"avg_line_length": 24.904761904761905,
"alnum_prop": 0.5736137667304015,
"repo_name": "logonmy/mono_pac",
"id": "02ba60b7198f02dcd42e8889b15a6b8b949902d3",
"size": "523... |
"""Tests for tf.training.evaluation."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import... | {
"content_hash": "c6ae4ab6fd156d6e4f76605f14a3faef",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 80,
"avg_line_length": 35.55329949238579,
"alnum_prop": 0.6960308395202741,
"repo_name": "with-git/tensorflow",
"id": "78efaa8439b7b79c1c396b656141d09244f3a10f",
"size": "... |
import re
from enum import Enum
from warnings import warn
from . import MFIO
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
_re_conv = re.compile(r'^([sifb])(\d*)$')
_re_conv_fmt = {}
def _proc_fmt(fmt):
"""Process fmt code and optional width
Para... | {
"content_hash": "b5a20abe3a6c1dfa953d7c007f54c797",
"timestamp": "",
"source": "github",
"line_count": 405,
"max_line_length": 78,
"avg_line_length": 34.0641975308642,
"alnum_prop": 0.49644824586836767,
"repo_name": "mwtoews/moflow",
"id": "08bc6abd5f68e496e7c327f8237124b9b66ae4b1",
"size": "13820... |
import rospy
import rostopic
from strands_emails.msg import SendEmailAction, SendEmailGoal
from actionlib import SimpleActionClient
import time
class CheckScheduler(object):
def __init__(self, name):
rospy.loginfo("Starting %s ..." % name)
self.topic = rospy.get_param("~topic")
rospy.login... | {
"content_hash": "dd074c510368a12cecb4d08ecb0110fd",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 98,
"avg_line_length": 37.53191489361702,
"alnum_prop": 0.5856009070294784,
"repo_name": "strands-project/aaf_deployment",
"id": "8a30dad65e1af853438341d38cc8fc118b89e89a",
... |
import sys
import warnings
if sys.version >= '3':
basestring = unicode = str
xrange = range
else:
from itertools import izip as zip
from collections import Counter
from pyspark import since
from pyspark.rdd import _load_from_socket
from pyspark.sql.pandas.serializers import ArrowCollectSerializer
from pysp... | {
"content_hash": "2b18609dd5cfcb70195ac2e893db4626",
"timestamp": "",
"source": "github",
"line_count": 441,
"max_line_length": 100,
"avg_line_length": 44.89342403628118,
"alnum_prop": 0.5855136882513385,
"repo_name": "skonto/spark",
"id": "47cf8bbc5b688e2de401862c2ad7e041b0b87633",
"size": "20582"... |
def calc_inst_hr(time, voltage):
""" calculate instantaneous HR from ECG data input
:param time: numpy array, seconds
:param voltage: numpy array, mV
:return: numpy array, heart rate between beats in bpm
"""
import numpy as np
# import scipy.signal
# import matplotlib.pyplot as plt
... | {
"content_hash": "f353cf288891f21967236a0077058176",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 71,
"avg_line_length": 29.869565217391305,
"alnum_prop": 0.5793304221251819,
"repo_name": "MounikaVanka/bme590hrm",
"id": "ac90706f191151267cef5f9fa1cd68c16e89f3cc",
"size"... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
print("Required modules imported.")
# Now you can setup your root folder for Caffe below if you put it somewhere else. You should only be changing the path th... | {
"content_hash": "70653fe0aa131a7e5baf4f1d833d05d1",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 438,
"avg_line_length": 45.275,
"alnum_prop": 0.7110252162709368,
"repo_name": "Yangqing/caffe2",
"id": "b9c7f0ba9b24572f93b0373031cddd727ff0e884",
"size": "6074",
"bina... |
'''
This module runs tests against Cisco IOS devices.
setup_module: setup variables for later use.
test_init_method: verify attributes get set properly in init
test_session_preparation: verify session_preparation method
test_establish_connection: verify SSH connection gets established
test_disable_paging: disable pag... | {
"content_hash": "146d70fb6b4619938b4e2fc4d0624c4b",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 87,
"avg_line_length": 35.63316582914573,
"alnum_prop": 0.7158369764490199,
"repo_name": "enzzzy/netmiko",
"id": "03c81dc281959bf266887523c968e1a4bc178ca8",
"size": "7113"... |
import zmq
from logentries import LogentriesHandler
from selfdrive.services import service_list
import selfdrive.messaging as messaging
def main(gctx):
# setup logentries. we forward log messages to it
le_token = "e8549616-0798-4d7e-a2ca-2513ae81fa17"
le_handler = LogentriesHandler(le_token, use_tls=False, verbo... | {
"content_hash": "bd64920bbaa9462cfad9b4abcc08da36",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 72,
"avg_line_length": 24.44736842105263,
"alnum_prop": 0.6727664155005382,
"repo_name": "klaus385/openpilot",
"id": "971db829335242b67d06a0e1b9d2ddc2ab8bff22",
"size": "95... |
from google.cloud import logging_v2
def sample_delete_exclusion():
# Create a client
client = logging_v2.ConfigServiceV2Client()
# Initialize request argument(s)
request = logging_v2.DeleteExclusionRequest(
name="name_value",
)
# Make the request
client.delete_exclusion(request=r... | {
"content_hash": "d4b9983a27934c9f42626b58bf7c998d",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 65,
"avg_line_length": 23.294117647058822,
"alnum_prop": 0.7171717171717171,
"repo_name": "googleapis/gapic-generator-python",
"id": "bc051e4e025ec182272d2fc5edc2c5b9f981eca9... |
import operator
from django import template
from django.template.defaultfilters import stringfilter
from django.template.loader import get_template
from django.utils import six
register = template.Library()
@register.filter
@stringfilter
def trim(value, num):
return value[:num]
@register.simple_tag
def no_param... | {
"content_hash": "a0a582fb55efc2c2b70cc5992e0f06bf",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 156,
"avg_line_length": 50.87908496732026,
"alnum_prop": 0.7148821375810906,
"repo_name": "paulproteus/django",
"id": "95fcd551de38e75d3c61ca26897e23bf120911d0",
"size": "... |
import re
def parse_uptime(time_str):
'''
Extract the uptime string from the given device.
Supports:
Cisco IOS
Arista (very limited testing)
Return the uptime in second; else null string
'''
DEBUG = False
years = weeks = days = hours = minutes = 0
uptime_sec = 0
... | {
"content_hash": "3c03de011bb5c68c4bbdb5efc06e79a9",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 92,
"avg_line_length": 26.919540229885058,
"alnum_prop": 0.5324508966695133,
"repo_name": "cb1234/pynet-test",
"id": "970a27a387658ca1b6a79204189e617d27aa20ca",
"size": "23... |
import unittest
from craft_ai import Client, errors as craft_err
from . import settings
from .utils import generate_entity_id
from .data import valid_data, invalid_data
NB_AGENTS_TO_DELETE = 200
class TestDeleteAgentsBulkSuccess(unittest.TestCase):
"""Checks that the client succeeds when deleting
an/multip... | {
"content_hash": "7230354153181438da4ac980d637fdcd",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 86,
"avg_line_length": 35.532934131736525,
"alnum_prop": 0.661948095719582,
"repo_name": "craft-ai/craft-ai-client-python",
"id": "74fb98235a394b11f99c5684a9e32f3166ff843b",... |
'''
- Leetcode problem: 90
- Difficulty: Medium
- Brief problem description:
Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set).
Note: The solution set must not contain duplicate subsets.
Example:
Input: [1,2,2]
Output:
[
[2],
[1],
[1,2,2],
[2,2... | {
"content_hash": "b16dafceb48c1ceafa901cf574e6f5dc",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 112,
"avg_line_length": 20.29787234042553,
"alnum_prop": 0.5932914046121593,
"repo_name": "bzhou26/leetcode_sol",
"id": "1972a0f2a890c9a0f7ce8860083e2b70d1be0d19",
"size": ... |
"""Generate usb file."""
from __future__ import annotations
import json
from .model import Config, Integration
BASE = """
\"\"\"Automatically generated by hassfest.
To update, run python3 -m script.hassfest
\"\"\"
# fmt: off
USB = {}
""".strip()
def generate_and_validate(integrations: list[dict[str, str]]) -> s... | {
"content_hash": "c2e221eab8d650b9268532500864dea6",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 80,
"avg_line_length": 26.18840579710145,
"alnum_prop": 0.5810736026563365,
"repo_name": "Danielhiversen/home-assistant",
"id": "6377fdcb8af3309a4981008a3cb35d70adbe5c91",
... |
"""Constants for the Apple TV integration."""
DOMAIN = "apple_tv"
CONF_CREDENTIALS = "credentials"
CONF_IDENTIFIERS = "identifiers"
CONF_START_OFF = "start_off"
| {
"content_hash": "be8c420c001fdb7f40561996dd8c4dc0",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 45,
"avg_line_length": 20.5,
"alnum_prop": 0.7195121951219512,
"repo_name": "rohitranjan1991/home-assistant",
"id": "5fb169ec25976eeafe67bee6aa3c96b0a7f4ca9e",
"size": "164"... |
from collections import OrderedDict
from copy import copy
from agate.rows import Row
def compute(self, computations, replace=False):
"""
Create a new table by applying one or more :class:`.Computation` instances
to each row.
:param computations:
A sequence of pairs of new column names and :c... | {
"content_hash": "b76623b3416fa1724187f55f2ac94488",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 110,
"avg_line_length": 32.109375,
"alnum_prop": 0.6087591240875913,
"repo_name": "onyxfish/journalism",
"id": "6260ecf5bb8e2a36b464a5913c06fc97a4ab1638",
"size": "2102",
... |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... | {
"content_hash": "27f59ba30e534498269a75cc9f838a48",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 90,
"avg_line_length": 40.13483146067416,
"alnum_prop": 0.7200447928331467,
"repo_name": "jkonecki/autorest",
"id": "c976b74e71e41da0219ea79dcac1ce9f964c6ae9",
"size": "357... |
import json
import mock
import unittest
import MySQLdb.cursors
from airflow.hooks.mysql_hook import MySqlHook
from airflow.models.connection import Connection
SSL_DICT = {
'cert': '/tmp/client-cert.pem',
'ca': '/tmp/server-ca.pem',
'key': '/tmp/client-key.pem'
}
class TestMySqlHookConn(unittest.TestCas... | {
"content_hash": "3be9caa7537401516bbea0528e9f6e2d",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 74,
"avg_line_length": 36.16129032258065,
"alnum_prop": 0.6272673208444841,
"repo_name": "adamhaney/airflow",
"id": "ed7855959fd88b79fb740f84c417b6452acd77ed",
"size": "75... |
"""The processing engine."""
import logging
from dfvfs.helpers import file_system_searcher
from dfvfs.lib import definitions as dfvfs_definitions
from dfvfs.resolver import resolver as path_spec_resolver
from plaso.artifacts import knowledge_base
from plaso.engine import collector
from plaso.engine import worker
fro... | {
"content_hash": "5f047873c1487de9999560f39e798564",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 79,
"avg_line_length": 37.38325991189427,
"alnum_prop": 0.6821824181004007,
"repo_name": "cvandeplas/plaso",
"id": "8a93942bba3029676c75b8a2f8c6f8052e8e10ac",
"size": "918... |
import sys
sys.path.insert(1,"../../../")
import h2o
def deep_learning_metrics_test(ip, port):
# connect to existing cluster
df = h2o.import_file(path=h2o.locate("smalldata/logreg/prostate.csv"))
df.drop("ID") # remove ID
df['CAPSULE'] = df['CAPSULE'].asfa... | {
"content_hash": "4b86e9b68978c17cfad97c4bcf17916a",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 74,
"avg_line_length": 28.714285714285715,
"alnum_prop": 0.49917081260364843,
"repo_name": "mrgloom/h2o-3",
"id": "4f2c7e2aaa0b77fa007f5aad51edf93c102cdac7",
"size": "1206"... |
from litex.soc.integration.soc_core import mem_decoder
from litex.soc.integration.soc_sdram import *
from liteeth.core.mac import LiteEthMAC
from liteeth.phy.s7rgmii import LiteEthPHYRGMII
from targets.utils import csr_map_update
from targets.nexys_video.base import SoC as BaseSoC
class NetSoC(BaseSoC):
csr_per... | {
"content_hash": "f11cdc479375827c423522ddb960c9be",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 79,
"avg_line_length": 33.43939393939394,
"alnum_prop": 0.6139555958314454,
"repo_name": "cr1901/HDMI2USB-litex-firmware",
"id": "07dd2c1f9751c50a3763956aaf2f1e2c765bd81a",
... |
from __future__ import absolute_import, print_function, unicode_literals
import argparse
import os
import re
import sys
from xml.dom import minidom
import appdirs
import multimap
try:
from configparser import ConfigParser
except:
from ConfigParser import SafeConfigParser as ConfigParser
class TagExpression... | {
"content_hash": "894a2c53206503c0286e88e394942c4b",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 79,
"avg_line_length": 30.512738853503183,
"alnum_prop": 0.5692516438785096,
"repo_name": "secwall/fixpp",
"id": "a5b6f9d4d078e0b7c9b17f4573d0ee0d7344d733",
"size": "9604"... |
import re
import glob
import os
import sys
import urllib.request
from urllib.error import HTTPError
from urllib.error import URLError
root_dir="docs"
readme="README.md"
def request(url):
try:
print("requesting... ---" + url + "--- ")
response = urllib.request.urlopen(url)
if(response):
... | {
"content_hash": "f1bd917df0d81db41d9984ab8a1dca20",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 67,
"avg_line_length": 25.984848484848484,
"alnum_prop": 0.6174927113702624,
"repo_name": "stripe/stripe-android",
"id": "083351fc27f9729c81341da3120041da9cdec002",
"size":... |
from __future__ import print_function
import os
from subprocess import CalledProcessError
import sys
from mock import patch
from djangocms_installer import main, config, install
from .base import unittest, IsolatedTestClass
class TestMain(IsolatedTestClass):
def test_requirements_invocation(self):
with... | {
"content_hash": "1470dd3f09ccf9dad8c5879c04488828",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 165,
"avg_line_length": 53.992063492063494,
"alnum_prop": 0.5030133764515655,
"repo_name": "macs03/demo-cms",
"id": "115e476848d7e6166ed7fc07743ff8a0981e8fa1",
"size": "68... |
"""
__graph_MT_post__MetaModelElement_S.py___________________________________________________________
Automatically generated graphical appearance ---> MODIFY DIRECTLY WITH CAUTION
________________________________________________________________________________________
"""
import tkFont
from graphEntity import *
... | {
"content_hash": "ec6bc79f4bc42c9a2452a4aea603765e",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 160,
"avg_line_length": 39.228070175438596,
"alnum_prop": 0.5697674418604651,
"repo_name": "levilucio/SyVOLT",
"id": "1521d883f14d62b6cb7f35dae6448a8453f8ecf8",
"size": "22... |
import numpy as np
import os
import h5py
import sys
from PIL import Image
def get_dataset(dataset_name):
directory = os.path.dirname(os.path.realpath(__file__))
files_in_current_folder = os.listdir( directory )
for item in files_in_current_folder:
if item == dataset_name:
try:
... | {
"content_hash": "24bf56ff67e690f1f7c90f0e9ccc2f61",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 109,
"avg_line_length": 36.03174603174603,
"alnum_prop": 0.4977973568281938,
"repo_name": "Spookz0r/Temporal_Insanity",
"id": "1f980140d705614e9b073ce8cb409bcca6292dde",
"s... |
""" unit tests for the model and descriptor packager """
from rdkit import RDConfig
from rdkit.ML.Data import DataUtils
import unittest,os,cPickle,sys
from rdkit.ML.ModelPackage import Packager
from rdkit import Chem
import random
def feq(a,b,tol=1e-4):
return abs(a-b)<=tol
class TestCase(unittest.TestCase):
def... | {
"content_hash": "21441a9d43b30dfcd36db5b7d614890d",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 87,
"avg_line_length": 35.58181818181818,
"alnum_prop": 0.5848237097598364,
"repo_name": "rdkit/rdkit-orig",
"id": "8845114df86c43b19dab7e900027f97a6952fe00",
"size": "405... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.nn as nn
from ray.rllib.models.modelv2 import ModelV2
from ray.rllib.utils.annotations import PublicAPI
@PublicAPI
class TorchModelV2(ModelV2):
"""Torch version of ModelV2.
Note that th... | {
"content_hash": "ec1946a113d425d7a6dd42c39c3fbc13",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 79,
"avg_line_length": 36.01086956521739,
"alnum_prop": 0.602173256866888,
"repo_name": "ujvl/ray-ng",
"id": "933e59917aa0d89e1220c6af242a385755269c76",
"size": "3313",
"... |
"""
Projected Langevin sampler of `http://arxiv.org/abs/1507.02564`_
"""
from __future__ import print_function
import numpy as np
from scipy.stats import norm as ndist
class projected_langevin(object):
def __init__(self,
initial_condition,
gradient_map,
project... | {
"content_hash": "f44ddfde78213227a8faffe65852a5fe",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 77,
"avg_line_length": 31.574468085106382,
"alnum_prop": 0.49663072776280326,
"repo_name": "selective-inference/selective-inference",
"id": "2f787d0274db0db4ff79aa313fcfc30cd... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from contextlib import contextmanager
from mock import MagicMock
from psutil.tests import safe_remove
from pants.backend.jvm.subsystems.jar_dependency_mana... | {
"content_hash": "cdf72bce0fd4696f5589ee596d1e4362",
"timestamp": "",
"source": "github",
"line_count": 407,
"max_line_length": 148,
"avg_line_length": 42.60687960687961,
"alnum_prop": 0.6735482382792226,
"repo_name": "baroquebobcat/pants",
"id": "35bb0cc85fa8ad1eda0a144593c33b68beb3c05b",
"size": ... |
"""Testing for Discrete Fourier Transform."""
# Author: Johann Faouzi <johann.faouzi@gmail.com>
# License: BSD-3-Clause
import numpy as np
import pytest
import re
from sklearn.feature_selection import f_classif
from pyts.approximation import DiscreteFourierTransform
rng = np.random.RandomState(42)
n_samples, n_time... | {
"content_hash": "f756dccf6f55268d17414384fdc612d9",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 79,
"avg_line_length": 35.167883211678834,
"alnum_prop": 0.5892486508924865,
"repo_name": "johannfaouzi/pyts",
"id": "a75cc58494b2dc342f5e5bd01f77d2ccbc5872a3",
"size": "4... |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from django.test.client import RequestFactory
from tests.apidocs.util import APIDocsTestCase
class ReleaseFileDetailsDocsTest(APIDocsTestCase):
def setUp(self):
self.login_as(user=self.user)
project = self.creat... | {
"content_hash": "443e27072fa28fc0d88c3fcf7a009ee6",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 74,
"avg_line_length": 31.956521739130434,
"alnum_prop": 0.6108843537414966,
"repo_name": "beeftornado/sentry",
"id": "ae66e8481f8b4e76ba9cff185c49462c756fd957",
"size": "1... |
import bot_header
from vk_api.set_online import OnlineThread
def main(cmd):
print("Stopping thread...")
bot_header.SET_ONLINE_THREAD_INSTANCE.stop() | {
"content_hash": "9851da858eed4872ed31b152f9d30891",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 48,
"avg_line_length": 26.166666666666668,
"alnum_prop": 0.7388535031847133,
"repo_name": "ihydrogen/hydrogen-chat-bot-py",
"id": "bd676e7869b8eda0bed205a50cedce171c82760f",
... |
from sklearn.datasets import fetch_20newsgroups
import indicoio
print "Downloading data set"
posts = fetch_20newsgroups().data
joblib.dump(posts, "data/posts.jl")
print "Tagging %d posts" % len(posts)
post_tags = indicoio.batch_text_tags(posts)
joblib.dump(post_tags, "data/post_tags.jl")
| {
"content_hash": "5cb75b1198cbbd7b25ecdad8f9ff61a5",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 47,
"avg_line_length": 29.1,
"alnum_prop": 0.7663230240549829,
"repo_name": "IndicoDataSolutions/ContentRecommendation",
"id": "180f3a38103d97f533889c109e32727cce4a5126",
"... |
import logging
from typing import Any, Callable, Dict, Union
import stripe
from django.conf import settings
from corporate.lib.stripe import (
BillingError,
UpgradeWithExistingPlanError,
ensure_realm_does_not_have_active_plan,
process_initial_upgrade,
update_or_create_stripe_customer,
)
from corpo... | {
"content_hash": "dfff69b9b376a853bd9e4f6a30b9f723",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 104,
"avg_line_length": 37.322404371584696,
"alnum_prop": 0.6472913616398243,
"repo_name": "rht/zulip",
"id": "9ca2453d994d201132c8b9475ed8663d4762ae58",
"size": "6830",
... |
print "hello world"
print "Something Else"
for i in range(10):
print i
| {
"content_hash": "c4de36326f3996bc5d595c71102093cf",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 22,
"avg_line_length": 14.6,
"alnum_prop": 0.7123287671232876,
"repo_name": "karimjamali/first_repository",
"id": "a148dba35e83cef5121f86b718a51df43e71d057",
"size": "74",
... |
import requests
import json
import random
a = ["abs", "xyz", "vrt", "alpha", "beta"]
b = {"abs":"as01hu@gmail.com","xyz":"xyz@outlook.com","vrt": "alpha@yahoomail.com", "alpha":"xwe@yahoo.in", "beta":"ade@gmail.com"}
for i in range(5):
username = random.choice(a)
name = random.choice(["Ashu", "pp"])
email... | {
"content_hash": "8da423662d0d7b16be0c692d27aed0e2",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 131,
"avg_line_length": 29.96551724137931,
"alnum_prop": 0.6018411967779056,
"repo_name": "apratheek/simulate-requests",
"id": "7aa5dcaedb0e9dff4d6ffac8fe63ee4a1590ea92",
"... |
"""
Dynamic configuration system for pwndbg, using GDB's built-in Parameter
mechanism.
To create a new pwndbg configuration point, create an instance of
``pwndbg.config.Parameter``.
Parameters should be declared in the module in which they are primarily
used, or in this module for general-purpose parameters.
All pwn... | {
"content_hash": "be1af049ec1d339660411ee8da29ea16",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 111,
"avg_line_length": 29.840304182509506,
"alnum_prop": 0.6283129459734964,
"repo_name": "cebrusfs/217gdb",
"id": "85bf88ceb9835485bc938e7e9f94d81778eeecae",
"size": "79... |
import sys
from unittest import TestCase
from StringIO import StringIO
from mock import Mock
from describe.utils import Replace
class TestReplace(TestCase):
def test_is_a_decorator(self):
instance = Mock()
state = {'count': 0}
def foo(obj):
"DocString"
self.assert... | {
"content_hash": "79773f3fd388208414c603eca1ed07a2",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 55,
"avg_line_length": 28.84090909090909,
"alnum_prop": 0.6004728132387707,
"repo_name": "jeffh/describe",
"id": "386b766c9532c92ea228bfff4d686ffef8f395b4",
"size": "1269",... |
import numpy
import pandas as pd
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dropout
from keras.layers import Flatten
from keras.layers.convolutional import Conv2D
from keras.layers.convolutional import MaxPooling2D
from keras.utils import... | {
"content_hash": "4e14bf629afea8dd9ae2cbc334abc8df",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 88,
"avg_line_length": 31.56923076923077,
"alnum_prop": 0.7105263157894737,
"repo_name": "jmanday/Master",
"id": "493ce097dbaaf2eb0a9b4d28bbdd3f85b40ccd36",
"size": "2052",... |
"""Forms for Zinnia admin"""
from django import forms
from django.contrib.admin.widgets import RelatedFieldWidgetWrapper
from django.utils.translation import gettext_lazy as _
from mptt.forms import TreeNodeChoiceField
from zinnia.admin.fields import MPTTModelMultipleChoiceField
from zinnia.admin.widgets import MPTTF... | {
"content_hash": "254829af295ee4d609845baa4a1d0453",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 69,
"avg_line_length": 31.21518987341772,
"alnum_prop": 0.6269261962692619,
"repo_name": "Fantomas42/django-blog-zinnia",
"id": "49784d14aa25ddb29cd2232c0aa51e2fdf0fd7a6",
... |
from __future__ import absolute_import
from pandasticsearch.dataframe import DataFrame, Column
from pandasticsearch.client import RestClient
from pandasticsearch.queries import Select, Agg
from pandasticsearch.types import Row
col = Column
| {
"content_hash": "db5997836a5aa7676a06627921fa1dd2",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 55,
"avg_line_length": 30.25,
"alnum_prop": 0.8388429752066116,
"repo_name": "onesuper/pandasticsearch",
"id": "b984d5d8ea52157902b8950dedf0fd7e65f41c92",
"size": "242",
"... |
from unittest import mock
from oslo_config import cfg
import testtools
from tempest.common import credentials_factory as cf
from tempest import config
from tempest.lib.common import dynamic_creds
from tempest.lib.common import preprov_creds
from tempest.lib import exceptions
from tempest.tests import base
from tempes... | {
"content_hash": "223fa5aa660b3a8cf87fbe3b5c4d62de",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 79,
"avg_line_length": 48.91438356164384,
"alnum_prop": 0.6368409997899601,
"repo_name": "openstack/tempest",
"id": "374474d89869de43d07098668f9ce8ecd399b2dd",
"size": "14... |
# Form implementation generated from reading ui file 'main.ui'
#
# Created: Thu Jan 22 10:43:02 2015
# by: PyQt4 UI code generator 4.10.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
... | {
"content_hash": "3c95631a98750dc43360fa70bee0634c",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 79,
"avg_line_length": 36.4,
"alnum_prop": 0.6910866910866911,
"repo_name": "snydergd/pydocsearch",
"id": "5e43f6182ba7479fbfe60f00fc339271ee08178f",
"size": "1663",
"bin... |
from __future__ import print_function
import os
import argparse
import sys
import subprocess
import glob
# make sure scripts/internal is on the pythonpath.
sys.path = [os.path.abspath(os.path.dirname(sys.argv[0])) + "/internal"] + sys.path
# for ExitProgram
from pocolm_common import ExitProgram
parser = argparse.Arg... | {
"content_hash": "4c6ca75b1a5d9d28cb244788588de7ba",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 110,
"avg_line_length": 43.325581395348834,
"alnum_prop": 0.5739398819108964,
"repo_name": "wantee/pocolm",
"id": "6ec80e485f333f84b299dbf37c797cd4c5bac3c3",
"size": "7547... |
from django.utils.translation import ungettext, ugettext as _
from django.utils.encoding import force_unicode
from django import template
from django.template import defaultfilters
from datetime import date
import re
register = template.Library()
def ordinal(value):
"""
Converts an integer to its o... | {
"content_hash": "6fc36835d9911ec8ff73eced9bf5b1f1",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 119,
"avg_line_length": 34.464646464646464,
"alnum_prop": 0.6022860492379836,
"repo_name": "egenerat/gae-django",
"id": "8ca18e45a61a3eb4b6a4842db4e066b9cb6c7777",
"size": ... |
"""Locks on Zigbee Home Automation networks."""
import functools
import logging
from zigpy.zcl.foundation import Status
from homeassistant.components.lock import (
DOMAIN,
STATE_LOCKED,
STATE_UNLOCKED,
LockDevice,
)
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import a... | {
"content_hash": "39e86c1b4010e28ed462d35a47ca5912",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 80,
"avg_line_length": 32.820689655172416,
"alnum_prop": 0.643622609791973,
"repo_name": "Teagan42/home-assistant",
"id": "b173c166a77d5be30e0737169c2821177060eda6",
"size... |
import os
class BaseConfig:
"""Base configuration"""
DEBUG = False
TESTING = False
SQLALCHEMY_TRACK_MODIFICATIONS = False
SECRET_KEY = 'my_precious'
class DevelopmentConfig(BaseConfig):
"""Development configuration"""
DEBUG = True
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_UR... | {
"content_hash": "2e832af94271c7a16f03c83197119582",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 65,
"avg_line_length": 23.035714285714285,
"alnum_prop": 0.6930232558139535,
"repo_name": "tnolan8/flask-mircoservices-users",
"id": "5ee5c5884811ef8f70acaf0bf800cba623780b71... |
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run() | {
"content_hash": "72f3ce66fe00b01227f31d10ffc87c7f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 26,
"avg_line_length": 16.555555555555557,
"alnum_prop": 0.5704697986577181,
"repo_name": "Saberlion/python_docker",
"id": "aec1b5ccf5f2e263024caf48daba57995a38fd75",
"size"... |
import json
import logging
import os
import sys
import uuid
from pika import spec
from tornado import concurrent, locks, testing, web
from sprockets.mixins import amqp
from tests import base
LOGGER = logging.getLogger(__name__)
def setUpModule():
try:
with open('build/test-environment') as f:
... | {
"content_hash": "2009a37301e5ba2de4b0fd329c27e2a3",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 77,
"avg_line_length": 37.25766871165644,
"alnum_prop": 0.6186398814424502,
"repo_name": "sprockets/sprockets.mixins.amqp",
"id": "8be36ffacde67deff4f8fc895039a06d7c56ac18",... |
"""Tests for cell_img. Verifies cell_img can be imported.
"""
import unittest
import cell_img
from cell_img import data_utils
class CellImgTest(unittest.TestCase):
def test_import(self):
self.assertTrue(cell_img)
self.assertTrue(data_utils)
if __name__ == '__main__':
unittest.main()
| {
"content_hash": "6378e605023b71c13bf21c11b14cd012",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 57,
"avg_line_length": 17.764705882352942,
"alnum_prop": 0.6986754966887417,
"repo_name": "google/cell_img",
"id": "d8c75685766fd9675d65224e95759bd7f869b1fa",
"size": "873"... |
"""
Test compiling and executing using the gdc tool.
"""
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to... | {
"content_hash": "5db9f7de1e1939d0b181490f0441a426",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 73,
"avg_line_length": 37.729729729729726,
"alnum_prop": 0.7600286532951289,
"repo_name": "timj/scons",
"id": "d65495ad2f9f2caf004edb898a8bb82ca26dd70b",
"size": "1396",
... |
"""fill_sinks_barnes.py.
Fill sinks in a landscape to the brim, following the Barnes et al.
(2014) algorithms.
"""
import numpy as np
from landlab.components import LakeMapperBarnes
from landlab.utils.return_array import return_array_at_node
class SinkFillerBarnes(LakeMapperBarnes):
"""Uses the Barnes et al (... | {
"content_hash": "d0e3a6c0a812ef489decef95689de576",
"timestamp": "",
"source": "github",
"line_count": 327,
"max_line_length": 126,
"avg_line_length": 38.66360856269113,
"alnum_prop": 0.5301748002847425,
"repo_name": "cmshobe/landlab",
"id": "a2056564dc6aef9cbdd8b1e91a571e6216662380",
"size": "126... |
from openerp import models, fields
class LibraryBook(models.Model):
_name = 'library.book'
name = fields.Char('Title', required=True)
date_release = fields.Date('Release Date')
author_ids = fields.Many2many('res.partner', string='Authors')
currency_id = fields.Many2one(
'res.currency', st... | {
"content_hash": "1f1d7fceeed81ceae1282a529fadea91",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 66,
"avg_line_length": 30.466666666666665,
"alnum_prop": 0.649890590809628,
"repo_name": "vileopratama/vitech",
"id": "decc37a78394e3bfd22fce5cdeba26af3cb37292",
"size": "4... |
import argparse
from requestbuilder import Arg
from requestbuilder.exceptions import ArgumentError
from euca2ools.commands.ec2 import EC2Request
class CreateSubnet(EC2Request):
DESCRIPTION = 'Create a new VPC subnet'
# We also accept CidrBlock positionally because forgetting -i is common.
# https://euca... | {
"content_hash": "71430a5885f33058341077e325a54e02",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 77,
"avg_line_length": 43.74285714285714,
"alnum_prop": 0.6270411495754409,
"repo_name": "nagyistoce/euca2ools",
"id": "3505caeb94f9b6b5d759a6bd6893f9aed5a1a3b9",
"size": "... |
import tornado.web
class BaseHandler(tornado.web.RequestHandler):
@property
def db(self):
return self.application.db
def get_current_user(self):
return self.get_secure_cookie("user")
# CORS enabled
def set_default_headers(self):
self.set_header("Access-Control-Allow-Origi... | {
"content_hash": "fd55929bf72d11b346f533350885c3e9",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 77,
"avg_line_length": 26.12,
"alnum_prop": 0.6462480857580398,
"repo_name": "freundallein/marynado",
"id": "3efcc4d60b1ac7aff6bf0c2877a853c3f877f93c",
"size": "677",
"bi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.