text stringlengths 4 1.02M | meta dict |
|---|---|
from abc import abstractmethod
__author__ = 'Casey Bajema'
class _ProcessingScript():
"""
Abstract processing script that should be sub-classed to provide datasets with custom processing.
"""
@abstractmethod
def process_it(self, data_entry):
"""
Process the data_entry in some way a... | {
"content_hash": "bb65bfc6d128e718f8f7dd00fc759b59",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 114,
"avg_line_length": 32.833333333333336,
"alnum_prop": 0.6578680203045685,
"repo_name": "jcu-eresearch/jcu.dc24.ingesterapi",
"id": "45e67c44d3fd1da6456c886fba5d6dfa617eb2... |
from .timediff import time_slice_diffs
from .tsdiffplot import plot_tsdiffs, plot_tsdiffs_image
from .screens import screen
from ..utils import pca
| {
"content_hash": "ef72b8ef5d3aab847ba725b8054947f4",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 56,
"avg_line_length": 37,
"alnum_prop": 0.8108108108108109,
"repo_name": "arokem/nipy",
"id": "676711ecdd54d904104a05ccb26c91f7252616f4",
"size": "304",
"binary": false,
... |
from __future__ import absolute_import
from traits.api import on_trait_change, Dict
from pychron.pipeline.plot.models.figure_model import FigureModel
# from pychron.processing.plot.panels.series_panel import SeriesPanel, DashboardSeriesPanel
from pychron.pipeline.plot.panels.regression_series_panel import RegressionSe... | {
"content_hash": "81b99bd0157c646d7528cd44c3ea0724",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 101,
"avg_line_length": 36.89655172413793,
"alnum_prop": 0.6635514018691588,
"repo_name": "UManPychron/pychron",
"id": "8abbe975269318e95bbe067668b0577bf3c2a269",
"size": "... |
class Solution(object):
def minTransfers(self, transactions):
"""
:type transactions: List[List[int]]
:rtype: int
"""
table = collections.Counter()
for lender, borrower, amt in transactions:
table[lender] -= amt
table[borrower] += amt
d... | {
"content_hash": "f461c117680cef00a531cc196bb635f6",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 66,
"avg_line_length": 37.541666666666664,
"alnum_prop": 0.5138734739178691,
"repo_name": "Mlieou/lXXtcode",
"id": "64469508f69f9fd5d58ecabe31d4883b9d148d7a",
"size": "901"... |
"""Create a dictionary containing useful information for the ingestion
process.
The ``file_dict`` contains various information that can be used by
``ingest.py`` (e.g. filesystem paths, observational metadata) and can
be used as a data container that can be easily passed around to various
functions.
Authors
-------
... | {
"content_hash": "512f7be36826d125fb1efb150b63c83e",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 136,
"avg_line_length": 31.230366492146597,
"alnum_prop": 0.6233025984911986,
"repo_name": "bourque/acsql",
"id": "4eda3d5e3f1761375bd8ee9b6cb875190896d647",
"size": "5965... |
from .models import FollowOrganization
from rest_framework import serializers
class FollowOrganizationSerializer(serializers.ModelSerializer):
class Meta:
model = FollowOrganization
fields = ('voter_we_vote_id', 'organization_we_vote_id', 'following_status')
| {
"content_hash": "94109665ad0a1cc90f2e0c750d58dec1",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 84,
"avg_line_length": 35.125,
"alnum_prop": 0.7580071174377224,
"repo_name": "wevote/WebAppPublic",
"id": "5acc9ecc15a409ec232c74ed00251dd4867b852c",
"size": "368",
"bina... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import uuid
import pytest
@pytest.fixture
def cochrane_review(conn):
review = {
'id': uuid.uuid1().hex,
'study_type': 'MIX',
'file_name': 'Su... | {
"content_hash": "0f95faf2b097deecf6aaedd5f28dd402",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 137,
"avg_line_length": 35.744680851063826,
"alnum_prop": 0.5047619047619047,
"repo_name": "arthurSena/processors",
"id": "9afeb946ab801365b97b7cd0fc86f8ea23b3f254",
"size"... |
import unittest
from robotide.controller.stepcontrollers import StepController
class FakeStep(StepController):
def __init__(self):
pass
class UpdatingArgumentsTest(unittest.TestCase):
def test_converting_last_empty_cell_without_args(self):
self.assertEqual(FakeStep()._change_last_empty_to_... | {
"content_hash": "79939922bad08dab5daccbd0ae65aaaa",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 91,
"avg_line_length": 31.202380952380953,
"alnum_prop": 0.6344906524227394,
"repo_name": "fingeronthebutton/RIDE",
"id": "28bd3ee424f2c1fc78b127e43290c485847411a3",
"size"... |
from django.conf import settings
from django.db.models.signals import post_save
from toucan.issues.signals import issue_created_signal
from .handlers import issue_created
from .models import Profile
def create_user_profile(**kwargs):
user = kwargs['instance']
Profile.objects.get_or_create(user=user)
post_s... | {
"content_hash": "73beb5ea44e89ce44599335f1eb0d9ca",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 71,
"avg_line_length": 26.875,
"alnum_prop": 0.7906976744186046,
"repo_name": "mcallistersean/b2-issue-tracker",
"id": "f6f32d2bbed37768f0217c601fa4e469aafd2f57",
"size": "... |
from django.conf.urls import url, include
from account.forms import LoginUsernameForm, SignupForm, ChangePasswordForm, SettingsForm, PasswordResetForm, PasswordResetTokenForm
from .base import ViewConfig
patch = "http://pinaxproject.com/pinax-design/patches/django-user-accounts.svg"
label = "dua"
title = "Django Use... | {
"content_hash": "fad1c4a9dec7ef0fed578afca435e8cf",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 256,
"avg_line_length": 79.68,
"alnum_prop": 0.7289156626506024,
"repo_name": "pinax/pinax_theme_tester",
"id": "968158da7515462de94d8a85a894a5f12d91ca40",
"size": "1992",
... |
from deap import base
from deap import tools
from copy import deepcopy
import random
from . .import parameterOperations
from .import Creator
getPromoterFromMap = lambda x: [x[z] for z in list(x.keys())]
def constructPhenotype(stratSettings, chrconf, Individue):
Settings = {}
GeneSize = 2
R = lambda V,... | {
"content_hash": "fff30e7d624b3f8e2b3270d2cb318aad",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 85,
"avg_line_length": 32.4375,
"alnum_prop": 0.6184971098265896,
"repo_name": "Gab0/gekkoJaponicus",
"id": "0ab9b73f3e5d125048f808e1cc7706421eba951b",
"size": "4685",
"... |
import flask
import auth
import config
import model
import util
from main import app
microsoft_config = dict(
access_token_method='POST',
access_token_url='https://login.live.com/oauth20_token.srf',
authorize_url='https://login.live.com/oauth20_authorize.srf',
base_url='https://apis.live.net/v5.0/',
consum... | {
"content_hash": "1a2879713d49c5158a777efff0c8bac4",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 74,
"avg_line_length": 27.693548387096776,
"alnum_prop": 0.6924868957483984,
"repo_name": "lipis/electron-crash-reporter",
"id": "89e16d7a7f130e8a5a0c1720e6590aace47da9b1",
... |
DEBUG = True
SECRET_KEY = 'secret'
SQLALCHEMY_DATABASE_URI = 'sqlite://'
DATABASE_CONNECT_OPTIONS = {}
THREADS_PER_PAGE = 8
WTF_CSRF_ENABLED = False
CSRF_SESSION_KEY = 'secret'
| {
"content_hash": "c92f2ac5aa53a5a85206c0812c9a40b5",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 37,
"avg_line_length": 19.88888888888889,
"alnum_prop": 0.7094972067039106,
"repo_name": "jstutters/flask-application-template",
"id": "c0591070ba1dbeceaa4378d3aa209c950cc1e91... |
import warnings
from django.conf import settings
from django.core import urlresolvers
from django.core.exceptions import ImproperlyConfigured
from django.contrib.comments.models import Comment
from django.contrib.comments.forms import CommentForm
from django.utils.importlib import import_module
warnings.warn("django.c... | {
"content_hash": "a413a409f5f2768510c5ea1ab65a2757",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 113,
"avg_line_length": 37,
"alnum_prop": 0.6503737780333525,
"repo_name": "makinacorpus/django",
"id": "0b3fcebc51f8b592260d4b60857214961945c79c",
"size": "3478",
"binar... |
from amocrm import BaseContact, BaseLead, fields, LeadsManager
class Contact(BaseContact):
position = fields.CustomField(u'Должность')
site = fields.CustomField(u'Сайт')
email = fields.EnumCustomField(u'Email', enum='WORK')
phone = fields.EnumCustomField(u'Телефон', enum='WORK')
class Lead(BaseLead):
... | {
"content_hash": "aba55e9b345f632332514f02d2e59cae",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 62,
"avg_line_length": 39.142857142857146,
"alnum_prop": 0.718978102189781,
"repo_name": "mcmaxwell/idea_digital_agency",
"id": "206757285e9ab68f74d62b19fa9595122a1235aa",
... |
"""Command for adding instances to target pools."""
from googlecloudsdk.calliope import arg_parsers
from googlecloudsdk.calliope import exceptions as calliope_exceptions
from googlecloudsdk.compute.lib import base_classes
from googlecloudsdk.compute.lib import utils
class AddInstances(base_classes.NoOutputAsyncMutato... | {
"content_hash": "d4bb7fc7da65a6c6d39e8ab533b5112d",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 78,
"avg_line_length": 32.17948717948718,
"alnum_prop": 0.6844621513944223,
"repo_name": "wemanuel/smry",
"id": "7c0b33dfab9c7e52fede58d5972bc20b170bf009",
"size": "2560",
... |
import os.path
from setuptools import setup, find_packages
def read_file_contents(pathname):
"""
Reads the contents of a given file relative to the directory
containing this file and returns it.
:param filename:
The file to open and read contents from.
"""
return open(os.p... | {
"content_hash": "523c9647ce4f3b2e0cc41a0645e834db",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 79,
"avg_line_length": 31.24561403508772,
"alnum_prop": 0.5373385738349242,
"repo_name": "mhils/pycco",
"id": "5644552f6a0c4199fcf2a2411f81535cc1846ada",
"size": "1806",
... |
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tables
from openstack_dashboard import api
from openstack_dashboard.dashboards.project.images.images import views
from openstack_dashboard.dashboards.admin.imag... | {
"content_hash": "c45d2cd3bf806c5cead3765e864c213b",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 78,
"avg_line_length": 31.15068493150685,
"alnum_prop": 0.63896218117854,
"repo_name": "aaronorosen/horizon-congress",
"id": "6fdf04f56cb48c586f5c139c116180e4b1272e96",
"si... |
"""
`ftfy.badness` contains a heuristic that detects likely mojibake.
This heuristic signals to ftfy which segments of text need to be fixed, and
also indicates when the text can stop being fixed.
The design of this heuristic is that we categorize the approximately 400
Unicode characters that occur in UTF-8 mojibake,... | {
"content_hash": "f02bc37c7cadf6ef50847482017a4247",
"timestamp": "",
"source": "github",
"line_count": 392,
"max_line_length": 111,
"avg_line_length": 36.505102040816325,
"alnum_prop": 0.6175401816911251,
"repo_name": "rspeer/python-ftfy",
"id": "7b6cce546f1ffd0065321a5efed0226cfc01c41c",
"size": ... |
from h2o import H2OFrame
from tests import pyunit_utils
def pubdev_6393():
locations = [['location'],
['�X県 A市 '], # First observation contains replacement character for unknown char
['X県 B市']]
frame = H2OFrame(locations, header=True, column_types=['enum'])
assert frame.ncols ==... | {
"content_hash": "9578738b64588f622e6f1d0aab392245",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 110,
"avg_line_length": 35.4375,
"alnum_prop": 0.6790123456790124,
"repo_name": "h2oai/h2o-3",
"id": "7c6065eb5e12c8d4dae7cad85bc6a3ccab709bf5",
"size": "1199",
"binary":... |
from django import template
from oscar.core.loading import get_class
get_nodes = get_class('dashboard.menu', 'get_nodes')
register = template.Library()
@register.simple_tag
def dashboard_navigation(user):
return get_nodes(user)
| {
"content_hash": "7741ddf883ce2c36cb6c40da8234eb13",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 52,
"avg_line_length": 21.454545454545453,
"alnum_prop": 0.7584745762711864,
"repo_name": "solarissmoke/django-oscar",
"id": "e7ef3386d7669338e19d1fef1b0580373b3127ee",
"si... |
import sys
import io
from math import ceil
import xdg.BaseDirectory
from .gui_server import start_qml_gui
from mycroft.tts import TTS
import os
import os.path
import time
import curses
import textwrap
import json
import mycroft.version
from threading import Thread, Lock
from mycroft.messagebus.client import MessageB... | {
"content_hash": "12ac80ba76e5c8dcfccc6aa576d5b6d6",
"timestamp": "",
"source": "github",
"line_count": 1551,
"max_line_length": 79,
"avg_line_length": 31.711154094132816,
"alnum_prop": 0.5015045543266102,
"repo_name": "forslund/mycroft-core",
"id": "9b5b263e6637e37c817640439f9fb45591bd93a4",
"size... |
import unittest
import vodka.app
@vodka.app.register("app_a")
class AppA(vodka.app.Application):
pass
@vodka.app.register("app_b")
class AppB(vodka.app.Application):
pass
class TestApp(unittest.TestCase):
def test_register(self):
vodka.app.register(AppA)
assert vodka.app.applications.g... | {
"content_hash": "a14c1f6d89dff9a58020e04972743204",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 58,
"avg_line_length": 24.75862068965517,
"alnum_prop": 0.6392757660167131,
"repo_name": "20c/vodka",
"id": "f00ff8507d1ebe194fe2cc94b4043bd2f31b42a2",
"size": "718",
"bi... |
"""
Filename: lae.py
Authors: Thomas J. Sargent, John Stachurski,
Computes a sequence of marginal densities for a continuous state space
Markov chain :math:`X_t` where the transition probabilities can be represented
as densities. The estimate of the marginal density of :math:`X_t` is
.. math::
\frac{1}{n} \sum_... | {
"content_hash": "e5255cfa635360319961a248fdf6583e",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 78,
"avg_line_length": 24.367816091954023,
"alnum_prop": 0.5712264150943396,
"repo_name": "jviada/QuantEcon.py",
"id": "c8d9204f05bc23565825ea67bbdbb1e11070eea0",
"size": "... |
import numpy as np
from ._base import osd
from skbio.diversity._util import _validate_counts_vector
from skbio.util._decorator import experimental
@experimental(as_of="0.4.0")
def chao1(counts, bias_corrected=True):
r"""Calculate chao1 richness estimator.
Uses the bias-corrected version unless `bias_correct... | {
"content_hash": "6050c2ee5e163e0a89d456dd300328eb",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 79,
"avg_line_length": 28.85308056872038,
"alnum_prop": 0.6125164257555847,
"repo_name": "anderspitman/scikit-bio",
"id": "0df695ea95f5044a165f06c7a9a3981084c47697",
"size... |
import server.dbconnect as dbconnect
import server.dbreader as dbreader
import argparse
import codecs
import random
parser = argparse.ArgumentParser(description="Write a whole shitload of poems")
parser.add_argument('count', type=int, help="number of poems to write")
parser.add_argument('--output', action='store', typ... | {
"content_hash": "9ea88c38f812380b37f6e8c3921f768d",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 122,
"avg_line_length": 39.2,
"alnum_prop": 0.6116071428571429,
"repo_name": "starakaj/wikisonnet",
"id": "3fe85b0a0ad7a5518b66be1f8a6e77b1a972d58f",
"size": "1568",
"bin... |
from django.db import models
from articles.models import Article
class BadPerson(models.Model):
username = models.CharField("IG username", max_length=100, blank=True, null=True)
user_id = models.CharField("IG user ID", max_length=100, blank=True, null=True)
timestamp = models.DateTimeField(auto_now_add=Tru... | {
"content_hash": "b3d39e9ebc88b1c64a906c55d6aee298",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 90,
"avg_line_length": 41.50847457627118,
"alnum_prop": 0.6843609636586362,
"repo_name": "davogler/POSTv3",
"id": "4066eda5f51641456b6cf8cb56cc8cadffb28e5c",
"size": "2449"... |
import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import sessionmaker
engine = create_engine('mysql://root:pass@127.0.0.1/test?charset=utf8', echo=True)
Base = declarative_base()
class User... | {
"content_hash": "d7c0364244a02b0686758debf67435e8",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 82,
"avg_line_length": 27.054054054054053,
"alnum_prop": 0.6873126873126874,
"repo_name": "li-ma/homework",
"id": "f369b931ee74b220d1370532259a61731278bbfb",
"size": "1001"... |
"""A convenience and compatibility wrapper for RawConfigParser."""
import shlex
try:
from configparser import RawConfigParser
except ImportError:
from ConfigParser import RawConfigParser
__all__ = ('ConfigParser',)
class ConfigParser(RawConfigParser):
"""A simple wrapper for RawConfigParser to make opt... | {
"content_hash": "d5fac8963295f30ebb5edc5d4410d3fe",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 79,
"avg_line_length": 32.810810810810814,
"alnum_prop": 0.6227347611202636,
"repo_name": "yloiseau/Watson",
"id": "a72ee9066b8e7149f9ec02d43654b23ec0b7f503",
"size": "366... |
"""This plugin allows rules to contain regular expression tags."""
import re
import oa.errors
import oa.plugins.base
from oa.regex import Regex
# This splits value in the corresponding tags
SPLIT_TAGS = Regex(r"(<[^<>]+>)")
class ReplaceTags(oa.plugins.base.BasePlugin):
"""Replace tags in various rules."""
... | {
"content_hash": "4ce46c1632bd7bc81b5c985a1408539c",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 74,
"avg_line_length": 35.91538461538462,
"alnum_prop": 0.5410152066823731,
"repo_name": "SpamExperts/OrangeAssassin",
"id": "9746ed20188c4fdbbcafdb90acf8ad372f642c45",
"s... |
"""Add ``creating_job_id`` to ``DagRun`` table
Revision ID: 364159666cbd
Revises: 52d53670a240
Create Date: 2020-10-10 09:08:07.332456
"""
from __future__ import annotations
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "364159666cbd"
down_revision = "52d53670a24... | {
"content_hash": "f3f1135acebc0d694d04125bf2bb0c0b",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 70,
"avg_line_length": 23.178571428571427,
"alnum_prop": 0.6933744221879815,
"repo_name": "apache/airflow",
"id": "f0dd1c4d969a3e19fe8660b4422c8926af3c4695",
"size": "1436"... |
class GoalAssociation:
def __init__(self,associationId,envName,goalName,goalDimName,aType,subGoalName,subGoalDimName,alternativeId,rationale):
self.theId = associationId
self.theEnvironmentName = envName
self.theGoal = goalName
self.theGoalDimension = goalDimName
self.theAssociationType = aType
... | {
"content_hash": "698269e83f45d8ce7b6071e1fed4be10",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 239,
"avg_line_length": 50.30434782608695,
"alnum_prop": 0.7536732929991357,
"repo_name": "RobinQuetin/CAIRIS-web",
"id": "a4069f307d2054c8210678de5273de68234066db",
"size"... |
import asyncio
import sys
import warnings
from io import BytesIO
from itertools import islice
from typing import AsyncIterator
from azure.core.exceptions import HttpResponseError, ResourceModifiedError
from .._download import _ChunkDownloader
from .._shared.request_handlers import validate_and_format_range_headers
fro... | {
"content_hash": "e2bcd66580647445a36cde7699df7f3f",
"timestamp": "",
"source": "github",
"line_count": 468,
"max_line_length": 108,
"avg_line_length": 38.574786324786324,
"alnum_prop": 0.5978507727247548,
"repo_name": "Azure/azure-sdk-for-python",
"id": "ffcddb2e78431a46e05eb8c11cfbfdcee6e4f278",
... |
from __future__ import absolute_import
import PIL.Image
from wagtail.wagtailimages.backends.base import BaseImageBackend
class PillowBackend(BaseImageBackend):
def __init__(self, params):
super(PillowBackend, self).__init__(params)
def open_image(self, input_file):
image = PIL.Image.open(in... | {
"content_hash": "8edefeec634c1c77242f0bb4510ddaad",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 123,
"avg_line_length": 31.428571428571427,
"alnum_prop": 0.6309090909090909,
"repo_name": "benemery/wagtail",
"id": "a1963f9317137360c07f724769b36d11e67f24f5",
"size": "11... |
"""
usage: zerows [-h]
"""
__author__ = "Sebastian Łach"
__copyright__ = "Copyright 2015, Sebastian Łach"
__credits__ = ["Sebastian Łach", ]
__license__ = "MIT"
__version__ = "1.0"
__maintainer__ = "Sebastian Łach"
__email__ = "root@slach.eu"
from json import loads
from zmq import Context as ZMQContext, REQ
from zm... | {
"content_hash": "ef63a784ec90ee1d574af3ec281031a4",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 77,
"avg_line_length": 25.116504854368934,
"alnum_prop": 0.6331658291457286,
"repo_name": "sebastianlach/zerows",
"id": "4029f66b9043f776d57b1021e4857d228a6d12f7",
"size":... |
"""User friendly container for Google Cloud Bigtable Column Family."""
import datetime
from google.protobuf import duration_pb2
from gcloud._helpers import _total_seconds
from gcloud.bigtable._generated import bigtable_table_data_pb2 as data_pb2
from gcloud.bigtable._generated import (
bigtable_table_service_me... | {
"content_hash": "f4757ab97cb10dba0f1ca39abcc1ae4f",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 79,
"avg_line_length": 33.25961538461539,
"alnum_prop": 0.6255179724390479,
"repo_name": "huangkuan/hack",
"id": "c0d9060316a40a13d63d6b9fee11b4eaac766662",
"size": "10974... |
from SenseCells.tts import tts
import random
import json, requests
def who_are_you():
messages = ["Hi! I'm Scarlett, your own personal assistant! I'm self learning, and you to-do task list will keep on increasing!",
"Scarlett! Didn't I tell you before?",
"Scarlett! Didn't I tell y... | {
"content_hash": "c85db4e47ef7132422d736039b0b3264",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 148,
"avg_line_length": 28.025974025974026,
"alnum_prop": 0.6195551436515292,
"repo_name": "debasishdebs/Scarlett-PA",
"id": "b88f3ce762988387acd38ce8e8a3e03bed5274dd",
"si... |
"""
Copyright (c) 2014,掌阅科技
All rights reserved.
摘 要: common_base.py
创 建 者: warship
创建日期: 2015-10-09
"""
from handler.bases import RestHandler
class CommonBaseHandler(RestHandler):
"""提供各个模块公用的业务处理逻辑
"""
def parse_query(self, model):
'''解析查询条件
Args:
column: 列名
... | {
"content_hash": "9b7db59c96d8f70d5ed91d171a069632",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 89,
"avg_line_length": 29.536363636363635,
"alnum_prop": 0.47768544167436133,
"repo_name": "yanjf2015/zkdash",
"id": "6e2d84c1915294d4bc4223813e093bea482aebb4",
"size": "3... |
from ducktape.mark import matrix
from ducktape.utils.util import wait_until
from ducktape.mark.resource import cluster
from kafkatest.tests.verifiable_consumer_test import VerifiableConsumerTest
from kafkatest.services.kafka import TopicPartition
import signal
class OffsetValidationTest(VerifiableConsumerTest):
... | {
"content_hash": "778ab060ff2c972cd2f23f8c66adc2cd",
"timestamp": "",
"source": "github",
"line_count": 415,
"max_line_length": 139,
"avg_line_length": 48.70120481927711,
"alnum_prop": 0.6539013408539904,
"repo_name": "noslowerdna/kafka",
"id": "131123f55ff3ce43591daa0e1cd6d95a0e12a30a",
"size": "2... |
"""Logging utilities."""
# pylint: disable=unused-import
# pylint: disable=g-bad-import-order
# pylint: disable=invalid-name
import logging as _logging
import os as _os
import sys as _sys
import _thread
import time as _time
import traceback as _traceback
from logging import DEBUG
from logging import ERROR
from logging ... | {
"content_hash": "0602e7fb4247932a903979bae739c705",
"timestamp": "",
"source": "github",
"line_count": 316,
"max_line_length": 97,
"avg_line_length": 28.21518987341772,
"alnum_prop": 0.6654329295648272,
"repo_name": "yongtang/tensorflow",
"id": "168dd34aa227e31eb5c61e31df866f60ca56d8da",
"size": "... |
__author__ = 'ad'
import os.path
from collections import OrderedDict
from pyapi.libraries.pyraml_parser_master import pyraml
from pyapi.libraries.pyraml_parser_master.pyraml import parser
from pyapi.libraries.pyraml_parser_master.pyraml.entities import RamlResource, RamlMethod, RamlQueryParameter
fixtures_dir = os.... | {
"content_hash": "0dbe41f1f7f04bf3e2053454e7b25788",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 109,
"avg_line_length": 47.95495495495496,
"alnum_prop": 0.742250610557956,
"repo_name": "mpetyx/pyapi",
"id": "c081296dd7fc3ee4d8665f48c7999049123b44a8",
"size": "5323",
... |
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
errc... | {
"content_hash": "dab2d214c425e102f41007af1b6f2370",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 66,
"avg_line_length": 25.35820895522388,
"alnum_prop": 0.6038846380223661,
"repo_name": "giupo/flypwd",
"id": "d389c9ea89fb335331679aaae85b29319e19dfe9",
"size": "1746",
... |
__author__ = 'shelman'
'''
JSON API definition.
'''
import json, logging, inspect, functools
class APIError(Exception):
'''
the base APIError which contains error(required), data(optional) and message(optional).
'''
def __init__(self, error, data='', message=''):
super(APIError, self).__init_... | {
"content_hash": "b5992b0d0d6bb0ed3fb4772ab87bca6e",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 100,
"avg_line_length": 30.973684210526315,
"alnum_prop": 0.6457094307561597,
"repo_name": "Shelmanxie/blogAppWeb",
"id": "211e45c373f64e744047062e97611c58b0feb170",
"size"... |
import threading
from .local import Proxy
__bus = None
__local = threading.local()
def get_current_bus():
"""Gets the current bus."""
return __bus
def set_current_bus(bus):
"""Sets the current bus."""
global __bus
__bus = bus
def get_transport_message():
"""Gets the transport message re... | {
"content_hash": "6594147e0833265dd0b8287f119d62cf",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 48,
"avg_line_length": 18.842105263157894,
"alnum_prop": 0.6522346368715084,
"repo_name": "viniciuschiele/simplebus",
"id": "44b4c06beff05bca2b0aba6bfc9bd744ecbdb96a",
"siz... |
from __future__ import unicode_literals
import unittest
import spotify
import tests
from tests import mock
@mock.patch('spotify.playlist_unseen_tracks.lib', spec=spotify.lib)
class PlaylistUnseenTracksTest(unittest.TestCase):
# TODO Test that the collection releases sp_playlistcontainer and
# sp_playlist ... | {
"content_hash": "e171c218e32a19cd00c5dfb07a613f74",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 77,
"avg_line_length": 38.194117647058825,
"alnum_prop": 0.6396118897273987,
"repo_name": "mopidy/pyspotify",
"id": "0cbd8e5aebcf70d9ece94a7ed03486d65f4f5c66",
"size": "64... |
"""
Classes that generate content for ImgDataset.
These classes deal with the distributin of labour. The work may be done
online, in worker threads or in owrker processes.
"""
__authors__ = "Nicu Tofan"
__copyright__ = "Copyright 2015, Nicu Tofan"
__credits__ = ["Nicu Tofan"]
__license__ = "3-clause BSD"
__maintainer_... | {
"content_hash": "3e94296518c6a9caf7346982c7637e5d",
"timestamp": "",
"source": "github",
"line_count": 1087,
"max_line_length": 120,
"avg_line_length": 34.7442502299908,
"alnum_prop": 0.546747160219239,
"repo_name": "TNick/pyl2extra",
"id": "8643fe0efe6daa6e4aec3de6513be6d0bd2da045",
"size": "3776... |
from decimal import Decimal
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from oscar.core.compat import AUTH_USER_MODEL
from oscar.core.utils import get_default_currency
from oscar.models.fields import AutoSlugField
f... | {
"content_hash": "8c5ef1bb46afacd18151a2a4e250e228",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 79,
"avg_line_length": 35.31987577639752,
"alnum_prop": 0.6316715026817902,
"repo_name": "sonofatailor/django-oscar",
"id": "38d8fef7236b6c5d11d443a25c1a87f11970ff6e",
"si... |
from .. import BITOID, VARBITOID
from ..bitwise import Varbit, Bit
from . import lib
def varbit_pack(x, pack = lib.varbit_pack):
return pack((x.bits, x.data))
def varbit_unpack(x, unpack = lib.varbit_unpack):
return Varbit.from_bits(*unpack(x))
oid_to_io = {
BITOID : (varbit_pack, varbit_unpack, Bit),
VARBITOID ... | {
"content_hash": "92bafd84ccc386ae5dcb89b58be12112",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 50,
"avg_line_length": 21.94736842105263,
"alnum_prop": 0.6882494004796164,
"repo_name": "python-postgres/fe",
"id": "2eb36e965b8a7ef486a2f5e2a0bbcd7b67c1e52c",
"size": "41... |
print 'hello,esc'
| {
"content_hash": "082972cc2ebd4005ea2055b893503777",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 17,
"avg_line_length": 9.5,
"alnum_prop": 0.6842105263157895,
"repo_name": "HW-X/XCopter",
"id": "7501deb5f0e02cd67f7492a4137082a683b81316",
"size": "62",
"binary": false,... |
"""Copyright 2015 Roger R Labbe Jr.
FilterPy library.
http://github.com/rlabbe/filterpy
Documentation at:
https://filterpy.readthedocs.org
Supporting book at:
https://github.com/rlabbe/Kalman-and-Bayesian-Filters-in-Python
This is licensed under an MIT license. See the readme.MD file
for more information.
"""
from ... | {
"content_hash": "88077e988b9eb25eb7d3f02c83e081b1",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 66,
"avg_line_length": 23.238095238095237,
"alnum_prop": 0.7254098360655737,
"repo_name": "barney-NG/pyCAMTracker",
"id": "67fb1c3fdee4c7b0a89bbad2359fccee0cca6e0b",
"size"... |
from __future__ import unicode_literals
from django import forms
from django.db.models.functions import Lower
from django.utils.translation import ugettext_lazy as _
from tracpro.charts import filters
from tracpro.contacts.models import Contact
from tracpro.polls.models import Poll, Question
from .models import Base... | {
"content_hash": "d2bfeb51e84b472036eb449a5dbac6c5",
"timestamp": "",
"source": "github",
"line_count": 182,
"max_line_length": 96,
"avg_line_length": 42.45054945054945,
"alnum_prop": 0.6172663732850117,
"repo_name": "rapidpro/tracpro",
"id": "125d9c84dfd14386ff339c44f20341f4cea23db7",
"size": "772... |
"""Unit test for treadmill.runtime.
"""
import errno
import socket
import unittest
import mock
import treadmill
import treadmill.rulefile
import treadmill.runtime
from treadmill import exc
class RuntimeTest(unittest.TestCase):
"""Tests for treadmill.runtime."""
@mock.patch('socket.socket.bind', mock.Mock... | {
"content_hash": "738d67723a90e2e1f54eab7cccd31958",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 78,
"avg_line_length": 28.255172413793105,
"alnum_prop": 0.48132780082987553,
"repo_name": "ThoughtWorksInc/treadmill",
"id": "dd9af715b1d27f785ce535bb70d2f9ceb53ef4a7",
"... |
from django.db import models
class LocalStorage(models.Model):
name = models.CharField(max_length=50, unique=True, null=False)
path = models.CharField(max_length=255, unique=True, null=False)
def __unicode__(self):
return "%s (%s)" % (self.name, self.path)
class RemoteStorage(models.Model):
... | {
"content_hash": "fbb1e8aae4ab2a5a436f620c64d575f0",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 80,
"avg_line_length": 32.1,
"alnum_prop": 0.6152647975077882,
"repo_name": "ReanGD/web-home-manage",
"id": "248062871329c9b41b8c9a731bbcb9bdb340e159",
"size": "2568",
"b... |
from django.conf.urls import patterns, url
from django.core.urlresolvers import reverse_lazy
from django.contrib.auth.views import *
urlpatterns = patterns('spirit.views.user',
url(r'^login/$', 'custom_login', {'template_name': 'spirit/user/login.html'}, name='user-login'),
url(r'^logout/$', logout, {'next_pa... | {
"content_hash": "23f07b18f374238b5de9fa8ef1866403",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 123,
"avg_line_length": 59.46808510638298,
"alnum_prop": 0.5713774597495528,
"repo_name": "Si-elegans/Web-based_GUI_Tools",
"id": "0ba88595e0d87c43ab3f3dee3c8867c29a50cc95",
... |
import sys
import random
import math
from sets import Set
# adds node attribute of which shard node should be placed on
num_shards = 8
num_runs = 1
capacity = 84000/num_shards
assignments = dict()
shard_sizes = [0] * num_shards
LDG = True
G = {}
def load(argv):
assert(len(argv) == 2)
print 'loading graph from... | {
"content_hash": "5aaa8dd910411fdffcb0a4aaab55373b",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 117,
"avg_line_length": 28.26086956521739,
"alnum_prop": 0.5848717948717949,
"repo_name": "dubey/weaver",
"id": "53d379bf3a79e1557b8982343583203c86dca009",
"size": "3924",... |
"""Test RasterAttributeTables.
Rewrite of
http://trac.osgeo.org/gdal/browser/trunk/autotest/gcore/rat.py
"""
import os
import unittest
from osgeo import gdal
import unittest
from autotest2.gcore import gcore_util
from autotest2.gdrivers import gdrivers_util
class RatTest(unittest.TestCase):
def setUp(self):
... | {
"content_hash": "96a32f3559410039296edd7c05388773",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 68,
"avg_line_length": 28.710526315789473,
"alnum_prop": 0.6828597616865261,
"repo_name": "schwehr/gdal-autotest2",
"id": "40b7351e560ff4bccdc0ec2c6a221969924d8c72",
"size"... |
"""Support for Logi Circle sensors."""
from __future__ import annotations
import logging
from typing import Any
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.const import (
ATTR_ATTRIBUTION,
ATTR_BATTERY_CHARGING,
CONF_MONITORED_CONDITIONS,
CONF_S... | {
"content_hash": "515398e4249e458c5043e8ddd33b28bf",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 88,
"avg_line_length": 37.541666666666664,
"alnum_prop": 0.6275249722530521,
"repo_name": "lukas-hetzenecker/home-assistant",
"id": "506711525879f0d94deff52e36a118b2052972d4... |
'''OpenGL extension HP.image_transform
This module customises the behaviour of the
OpenGL.raw.GL.HP.image_transform to provide a more
Python-friendly API
Overview (from the spec)
This extension provides support for scaling, rotation, and translation
of two-dimensional pixel rectangles at a fixed location in the... | {
"content_hash": "e0e7d9b3de3462d5913714e4e137c8a3",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 76,
"avg_line_length": 42.46153846153846,
"alnum_prop": 0.8152173913043478,
"repo_name": "Universal-Model-Converter/UMC3.0a",
"id": "35bb3647ae100f85d0a037e9e72c6b3de8c307ca"... |
DOCUMENTATION = '''
---
module: panos_lic
short_description: apply authcode to a device/instance
description:
- Apply an authcode to a device.
- The authcode should have been previously registered on the Palo Alto Networks support portal.
- The device should have Internet access.
author: "Luigi Mori (@jtsch... | {
"content_hash": "ea39a6561452211ed9467beca1c432ba",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 99,
"avg_line_length": 26.39072847682119,
"alnum_prop": 0.6220828105395232,
"repo_name": "thaim/ansible",
"id": "c7427f6f7b1a07c5aa68696caebef4da66b3d5a2",
"size": "4794",... |
'''
In this module, we implement binary search in Python both
recrusively and iteratively
Assumption: Array is sorted
Time complexity: O(log n)
'''
def binary_search_recursive(arr, left, right, value):
'''
Recursive implementation of binary search of a sorted array
Return index of the value found else ... | {
"content_hash": "dc20e0e437e370ff37b79be3ca290fe3",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 72,
"avg_line_length": 27.523809523809526,
"alnum_prop": 0.5934256055363322,
"repo_name": "ueg1990/aids",
"id": "5b9c65650a7d03ab53094f02dab6e79bf43127d1",
"size": "1156",
... |
from msrest.serialization import Model
class VirtualMachineIdentity(Model):
"""Identity for the virtual machine.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar principal_id: The principal id of virtual machine identity. This
property will only be p... | {
"content_hash": "d4bd42669ea859bd30d2a2d842e6b714",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 136,
"avg_line_length": 43.319148936170215,
"alnum_prop": 0.6768172888015717,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "52a97e8b7172b68ac11edfa47a71dd0ef79d735b",
... |
"""Test the new API for making and checking interface declarations
"""
import unittest
from zope.interface._compat import _skip_under_py3k, _u
class _Py3ClassAdvice(object):
def _run_generated_code(self, code, globs, locs,
fails_under_py3k=True,
):
... | {
"content_hash": "60239cf6ac30459a4f0b732f2d191580",
"timestamp": "",
"source": "github",
"line_count": 1584,
"max_line_length": 80,
"avg_line_length": 36.19507575757576,
"alnum_prop": 0.6114628573421939,
"repo_name": "nzavagli/UnrealPy",
"id": "1b9533c831e58cadc8741cd861ab88b2d09f3e84",
"size": "5... |
from collections.abc import Iterable
import subprocess
from numbers import Integral
import openmc
from openmc import VolumeCalculation
def _run(args, output, cwd):
# Launch a subprocess
p = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, universal_ne... | {
"content_hash": "cd4e44f2f5c69b37e3a2b49ead48656c",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 80,
"avg_line_length": 31.443396226415093,
"alnum_prop": 0.6299129912991299,
"repo_name": "johnnyliu27/openmc",
"id": "8ad2bd8960a5851403a6e1f35cefa85a506c70fc",
"size": "... |
import time
import datetime
import logging
from . import daemon
from . import db
from . import common as c
from . import strings as s
from zhihu import ZhihuClient
def calc_message(pattern, me, you, new_follower_num):
offset = datetime.timedelta(hours=8)
china_now = datetime.datetime.utcnow() + offset
m... | {
"content_hash": "9ff83fe011df83e7858a726be713fd97",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 78,
"avg_line_length": 32.13907284768212,
"alnum_prop": 0.4609519884607459,
"repo_name": "7sDream/qqqfome",
"id": "baf3f76e149c7ff1ee8fa24cfc1f8844ba271fc2",
"size": "4853... |
def application(environ, start_response):
body = "v1".encode()
start_response('200', [('Content-Length', str(len(body)))])
return [body]
| {
"content_hash": "90773236c7b45537b4b7e22bf1d3c864",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 63,
"avg_line_length": 30,
"alnum_prop": 0.6333333333333333,
"repo_name": "nginx/unit",
"id": "08f7dd64c878616872aa5ecb3a1a0375bad73b92",
"size": "150",
"binary": false,
... |
"""Tests for `tf.data.experimental.prefetch_to_device()`."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
from tensorflow.core.protobuf import config_pb2
from tensorflow.python.data.experimental.ops import prefetchi... | {
"content_hash": "2e341ea9ca0dc5e69f99f9250a57fc2d",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 78,
"avg_line_length": 38.759803921568626,
"alnum_prop": 0.7088655621601113,
"repo_name": "aldian/tensorflow",
"id": "611fbab4b8b14fe2101ddd07529fc1da4f436196",
"size": "8... |
import structlog
from enum import Enum
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks, returnValue, succeed
from voltha.protos.common_pb2 import OperStatus, AdminState
class AdtnPort(object):
"""
A class similar to the 'Port' class in the VOLTHA
"""
class Stat... | {
"content_hash": "e6988ee8b85fc2dafd7f420862924e78",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 95,
"avg_line_length": 30.29957805907173,
"alnum_prop": 0.6004734716613285,
"repo_name": "opencord/voltha",
"id": "5dbb543195c5058a2adee1b3e4130fca2269cad1",
"size": "7762... |
import sys
import itk
itk.auto_progress(2)
inputImage = sys.argv[1]
outputImage = sys.argv[2]
lowerThreshold = int(sys.argv[3])
upperThreshold = int(sys.argv[4])
outsideValue = int(sys.argv[5])
insideValue = int(sys.argv[6])
PixelType = itk.UC
Dimension = 2
ImageType = itk.Image[PixelType, Dimension]
ReaderType = ... | {
"content_hash": "b324b00966cd696f893bb53dddac2ecb",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 65,
"avg_line_length": 24.64864864864865,
"alnum_prop": 0.8103070175438597,
"repo_name": "LucasGandel/ITK",
"id": "d626fa29dbf0cfdbab7c37758cf620a2e1c55635",
"size": "1707"... |
from robot.model import SuiteVisitor
class ResultVisitor(SuiteVisitor):
def visit_result(self, result):
if self.start_result(result) is not False:
result.suite.visit(self)
result.statistics.visit(self)
result.errors.visit(self)
self.end_result(result)
... | {
"content_hash": "4219c17db20f06af2cf48c755482ac9c",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 59,
"avg_line_length": 25.045454545454547,
"alnum_prop": 0.5893829401088929,
"repo_name": "Senseg/robotframework",
"id": "5e0882649653293aa5ec984208321ee5e68a7823",
"size":... |
import collections
import uuid
from oslo_config import cfg
from rally.common import broker
from rally.common.i18n import _
from rally.common import logging
from rally.common import objects
from rally.common import utils as rutils
from rally.common import validation
from rally import consts
from rally import exception... | {
"content_hash": "047130862ac9b3dd6509d8f984786fc8",
"timestamp": "",
"source": "github",
"line_count": 309,
"max_line_length": 79,
"avg_line_length": 40.530744336569576,
"alnum_prop": 0.5606834877036091,
"repo_name": "yeming233/rally",
"id": "0e45cee5972965ec06607d524ab3efb97804a02a",
"size": "131... |
from lxml import etree
from healthvaultlib.utils.xmlutils import XmlUtils
from healthvaultlib.itemtypes.healthrecorditem import HealthRecordItem
class Pregnancy(HealthRecordItem):
def __init__(self, thing_xml=None):
super(Pregnancy, self).__init__()
self.type_id = '46d485cf-2b84-429d-9159-83152b... | {
"content_hash": "b32dcc41c5349a7e075e1555bbc5975d",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 70,
"avg_line_length": 28.566666666666666,
"alnum_prop": 0.6417736289381564,
"repo_name": "rajeevs1992/pyhealthvault",
"id": "ade62a24891ae7c2d883cc714bcc14c5cd540121",
"si... |
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from msrest.exceptions import DeserializationError
from msrestazure.azure_operation import AzureOperationPoller
from .. import models
class NetworkInterfacesOperations(object):
"""NetworkInterfacesOperat... | {
"content_hash": "372a4446205bef4403fd91a0a87fdede",
"timestamp": "",
"source": "github",
"line_count": 901,
"max_line_length": 242,
"avg_line_length": 46.244173140954494,
"alnum_prop": 0.6427542840685451,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "36ff50f1851d0dff257a1989459747137a7ebdb8... |
"""
Manages addition of Amber output information to segments.
"""
################################### MODULES ###################################
from __future__ import absolute_import,division,print_function,unicode_literals
from .TrajOutput import TrajOutput
################################### CLASSES ###############... | {
"content_hash": "793eddce91b9101fb1cd37cf27a59cb9",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 79,
"avg_line_length": 38.4,
"alnum_prop": 0.5751488095238095,
"repo_name": "KarlTDebiec/md_format_converter",
"id": "d48425205e4dfdfa299d71afe10580f63814b9cb",
"size": "29... |
from knesset_data.dataservice.votes import Vote as DataserviceVote, VoteMember as DataserviceVoteMember
from knesset_data.html_scrapers.votes import HtmlVote
from laws.models import Vote, VoteAction
from simple.scrapers import hebrew_strftime
from simple.scrapers.management import BaseKnessetDataserviceCollectionComman... | {
"content_hash": "3a53bd5e5fcc80a819870c9ab4aa4e5b",
"timestamp": "",
"source": "github",
"line_count": 211,
"max_line_length": 182,
"avg_line_length": 54.199052132701425,
"alnum_prop": 0.5926897516614201,
"repo_name": "noamelf/Open-Knesset",
"id": "64f4e4470f6362eb008a97e11eabfdb52ffa43ea",
"size"... |
"""
WSGI config for ask project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_... | {
"content_hash": "82cdce6242a15c64e8a426ff3109dcf6",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 23.9375,
"alnum_prop": 0.7650130548302873,
"repo_name": "bbb1991/stepic_course_web",
"id": "acca1d7ec4c46afd2424533640a4733476bf3c22",
"size": "383",... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Similarity'
db.create_table(u'djangoorm_similarity', (
(u'id', self.g... | {
"content_hash": "0eee8fe5ddb9b9ea50c03ea915b83990",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 221,
"avg_line_length": 62.73076923076923,
"alnum_prop": 0.6249744533006335,
"repo_name": "python-recsys/django-recommends",
"id": "fef860d0d7f0b04581e27dc8053b1f5327e5b68c",... |
import re
def dollars_to_math(source):
r"""
Replace dollar signs with backticks.
More precisely, do a regular expression search. Replace a plain
dollar sign ($) by a backtick (`). Replace an escaped dollar sign
(\$) by a dollar sign ($). Don't change a dollar sign preceded or
followed by a ... | {
"content_hash": "d7faf02a9fb8e14177eccd116adf3b6a",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 74,
"avg_line_length": 32.42857142857143,
"alnum_prop": 0.5952031326480666,
"repo_name": "stefanv/selective-inference",
"id": "c2c055fadb7ca7b14ba67901f4b42ad3c04197b6",
"s... |
import Image
import select
import v4l2capture
import cv2
import numpy
import time
import grip
from flask import Flask, render_template, Response
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
def gen(camera):
while True:
frame = camera.get_frame()
yiel... | {
"content_hash": "d48606547baf7818370c62a6177b3b51",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 76,
"avg_line_length": 25.257142857142856,
"alnum_prop": 0.6838235294117647,
"repo_name": "frc1769/vision2017",
"id": "83ee12b38facbdc0dcf54b3df92a7f4e1379a7f9",
"size": "2... |
import rclpy
from dynamic_stack_decider.abstract_action_element import AbstractActionElement
from bitbots_msgs.action import Dynup
from action_msgs.msg import GoalStatus
class GetWalkready(AbstractActionElement):
def __init__(self, blackboard, dsd, parameters=None):
super().__init__(blackboard, dsd, parame... | {
"content_hash": "237289919f61d6a05791a402d2ea6218",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 138,
"avg_line_length": 43.193548387096776,
"alnum_prop": 0.6086631814787155,
"repo_name": "bit-bots/bitbots_behaviour",
"id": "38989d8512c4335610950199c31b1cb1a74cd22c",
"... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Makey.cover_pic'
db.add_column(u'catalog_makey', 'cover_pic',
... | {
"content_hash": "3cbed7c34ede17679b66283513c9c98a",
"timestamp": "",
"source": "github",
"line_count": 566,
"max_line_length": 224,
"avg_line_length": 79.07773851590106,
"alnum_prop": 0.5429420438804237,
"repo_name": "Makeystreet/makeystreet",
"id": "305a01b476d9745b14ab3c0da04a0da7c4d19d54",
"siz... |
from setuptools import setup
from pip.req import parse_requirements
import uuid
requirements = parse_requirements('requirements.txt', session=uuid.uuid1())
install_requires = [str(r.req) for r in requirements]
setup(
name='mediafire',
version='0.6.0',
author='Roman Yepishev',
author_email='rye@keypres... | {
"content_hash": "c21ef7f7fcfc47f4ed91e10547c5f047",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 75,
"avg_line_length": 35,
"alnum_prop": 0.6630541871921182,
"repo_name": "roman-yepishev/mediafire-python-open-sdk",
"id": "4a246152ef337f7f307cb48d83f8b1f50977e3f5",
"siz... |
import os
import re
import pathFile
class searchFile:
def searchFiles(self, wordList, dirPath):
for dirpath, dirnames, filenames in os.walk(dirPath):
for file in filenames:
fileNameExt = os.path.splitext(file)
fileExt = fileNameExt[-1]
... | {
"content_hash": "1f927a972d8c0720928b12aa1c7e5186",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 72,
"avg_line_length": 31.41269841269841,
"alnum_prop": 0.48155634158665994,
"repo_name": "pearltrees/tree-shape-visualization",
"id": "d17b33c641927c30296988aad20a9796751393... |
""" Main test module for all utils. TODO: Add more tests here"""
from utils import is_playstyle_valid
def test_is_playstyle_valid():
""" Checks that the playstyle passed in is valid"""
result = is_playstyle_valid("awakened")
assert result is False
result = is_playstyle_valid("SUCcesSION")
assert ... | {
"content_hash": "d66fa6a779533c20a0dce63a028a972d",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 64,
"avg_line_length": 26.869565217391305,
"alnum_prop": 0.6925566343042071,
"repo_name": "pachev/gsbot",
"id": "05c36d778fb04435433ecb660fcd75f4bdabac36",
"size": "618",
... |
import datetime
from oslo_utils import timeutils
from tempest.api.identity import base
from tempest import config
from tempest.lib import decorators
CONF = config.CONF
class ApplicationCredentialsV3Test(base.BaseApplicationCredentialsV3Test):
"""Test application credentials"""
def _list_app_creds(self, na... | {
"content_hash": "a1b85ed867dfd8014f109be403c69964",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 79,
"avg_line_length": 39.45054945054945,
"alnum_prop": 0.6523676880222842,
"repo_name": "openstack/tempest",
"id": "06734aa63896b4750642e8c6ca6c932125cf9d6b",
"size": "422... |
import os
import sys
import numpy as np
sys.path.append(os.getcwd())
def noise_sampler(bs):
return np.random.normal(0.0, 1.0, [bs, 25])
if __name__ == '__main__':
from a_nice_mc.objectives.bayes_logistic_regression.german import German
from a_nice_mc.models.discriminator import MLPDiscriminator
fro... | {
"content_hash": "e3ff0564845a5b34f18fe0c9cad70148",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 92,
"avg_line_length": 29,
"alnum_prop": 0.6390086206896551,
"repo_name": "ermongroup/a-nice-mc",
"id": "7c85b0ffa551313478dddaea42de42528b67645e",
"size": "928",
"binary... |
from django.shortcuts import render
from .models import Book, Author, BookInstance, Genre
def index(request):
"""
View function for home page of site
"""
# Generate counts of some of the main objects
num_books = Book.objects.all().count()
num_instances = BookInstance.objects.all().count()
... | {
"content_hash": "6ab3b443f8ebb169eea05c564e8a4029",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 117,
"avg_line_length": 33.753246753246756,
"alnum_prop": 0.6902654867256637,
"repo_name": "CaptainNoble/django_local_library",
"id": "e9bbf7fdcbb9db3d11aeb8a9928b4340365d37... |
import socket
import pygame
from pygame.locals import *
class RCTest(object):
"""
Testing communication from Controller, to RiPi, to Arduino, to Motor
Removing the need when controlling by keyboard to have both Wifi and
Serial connected to Controller
Only required connection is wifi from Controlle... | {
"content_hash": "8f06d7dc62fa96b575aed609f290f8b5",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 76,
"avg_line_length": 36.35820895522388,
"alnum_prop": 0.4852216748768473,
"repo_name": "bmcivor/lego_autono",
"id": "abe267b3a20e40b863550e63c1f22eb6afcbee4b",
"size": "2... |
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.a... | {
"content_hash": "eab6a79deca6e491bec483ddd27757b6",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 107,
"avg_line_length": 27.772727272727273,
"alnum_prop": 0.5826513911620295,
"repo_name": "detiber/lib_openshift",
"id": "acf35f17e5b47eb6c18511b30f63cd60be5b5d67",
"size... |
'''
@summary: Handles all notifications for api, including alerts from metron.
Note: Ensure username and password needs hidden / parsed from encrypted file.
@author: devopsec
'''
import sys
import traceback
from api import app, time_funcs
from api.parse_json import *
from api.decorators import async
from api.sql.model... | {
"content_hash": "86ff3c679d5fb06d2ae2beb434d15a68",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 150,
"avg_line_length": 45.68771929824561,
"alnum_prop": 0.5206205360571384,
"repo_name": "devopsec/threatdetectionservice",
"id": "cbf4af6021bbb775bee88c2d4d0175cfd090348d"... |
import sys
import csv
import re
# Define input template filename to resulting output filename mapping
files = { 'template_sysctl_static' : 'sysctl_static_',
'template_sysctl_runtime' : 'sysctl_runtime_',
'template_sysctl' : 'sysctl_' }
def output_checkfile(serviceinfo):
# get the items out of ... | {
"content_hash": "0b94e06640ebe9f757652a608f997b10",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 71,
"avg_line_length": 36.18604651162791,
"alnum_prop": 0.6041131105398457,
"repo_name": "rprevette/clip",
"id": "fad51423d5ee5f61e86dcdd4ec31958243137ad2",
"size": "1575",... |
"""Test HomematicIP Cloud setup process."""
from asynctest import CoroutineMock, Mock, patch
from homeassistant.components.homematicip_cloud.const import (
CONF_ACCESSPOINT,
CONF_AUTHTOKEN,
DOMAIN as HMIPC_DOMAIN,
HMIPC_AUTHTOKEN,
HMIPC_HAPID,
HMIPC_NAME,
)
from homeassistant.components.homema... | {
"content_hash": "6c02443533eb148c99fff092476f0feb",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 88,
"avg_line_length": 35.883720930232556,
"alnum_prop": 0.6731475480665371,
"repo_name": "Teagan42/home-assistant",
"id": "ee63dba3c97b89cf7c43add542acee7eecf7958b",
"siz... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
# This flag is used to mark that a migration shouldn't be automatically run in
# production. We set this to True for operations that we think are risky and want
# someone from ops to ru... | {
"content_hash": "34982a953d94a2da1c353beffe65b481",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 88,
"avg_line_length": 40.16129032258065,
"alnum_prop": 0.6907630522088354,
"repo_name": "beeftornado/sentry",
"id": "a678cc905e5e33fde68264ba854031ad19695506",
"size": "12... |
from __future__ import division, print_function
import os
import sys
for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]:
try:
i = sys.argv.index("--" + mode)
del sys.argv[i]
break
except ValueError:
pass
os.environ["NO_SCIPY_IMPORT"] = "f2py"
if mode == "g3-numpy"... | {
"content_hash": "c6014f46ff78cea65ad6a65f585ecf1e",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 67,
"avg_line_length": 26.807692307692307,
"alnum_prop": 0.6183644189383071,
"repo_name": "happyx2/asspy",
"id": "03baeaf5583178ff12686af7b72f430d7a8070ff",
"size": "786",
... |
import urlparse,urllib2,urllib,re
import os
from core import scrapertools
from core import logger
from core import config
from core import unpackerjs
def get_video_url( page_url , premium = False , user="" , password="", video_password="" ):
logger.info("[vidbux.py] url="+page_url)
if ".html" not in page_url:... | {
"content_hash": "a6e6e3cea45d377830550a0b7cd960c3",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 200,
"avg_line_length": 35.72380952380952,
"alnum_prop": 0.6070381231671554,
"repo_name": "jose36/plugin.video.Jmdl1",
"id": "573b69f2534099dfa35bf96d1d057c53921d36ea",
"s... |
"""Add annotation queries
Revision ID: 1d808cef0787
Revises: 1c15bafd311a
Create Date: 2015-08-17 14:31:52.751784
"""
# revision identifiers, used by Alembic.
revision = '1d808cef0787'
down_revision = '1c15bafd311a'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by A... | {
"content_hash": "ebec1a0d78d44285ba841468e44f3704",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 133,
"avg_line_length": 38.411764705882355,
"alnum_prop": 0.6860643185298622,
"repo_name": "varda/varda",
"id": "e79d8664eb0e27257fb79e51c2299013e9b02d8a",
"size": "1959",
... |
import os
import subprocess
import sys
if __name__ == "__main__":
os.chdir("builds")
version = sys.argv[1]
with open("vale_{0}_checksums.txt".format(version), "w+") as f:
for asset in [e for e in os.listdir(".") if not e.endswith(".txt")]:
if version in asset:
checksum ... | {
"content_hash": "02a13c403f0e96fc7488f7e72149b5d1",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 76,
"avg_line_length": 29.11111111111111,
"alnum_prop": 0.45229007633587787,
"repo_name": "ValeLint/vale",
"id": "e8d1c04993a02f4235d847128a4a0ac6032bab67",
"size": "524",
... |
poem = '''a narrow fellow in the grass
occasionally rides;
you may have met him, did you not,
his notice sudden is.
the grass divides as with a comb,
a spotted shaft is seen;
and then it closes at your feet
and opens further on.
he likes a boggy acre,
a floor too cool for corn.
yet when a child, and baref... | {
"content_hash": "441887b41bf78780fcec43a776fa44a1",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 45,
"avg_line_length": 20.492537313432837,
"alnum_prop": 0.6227239621267298,
"repo_name": "johnobrien/puzzles.bostonpython.com",
"id": "645712efdd708599e6c54772342496a05abe14... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("elections", "0045_auto_20181001_1437")]
operations = [
# assume all elections that already exist are approved
migrations.RunSQL(
"""
UPDA... | {
"content_hash": "0129ea144c7dde13f9c9ed64966cf458",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 70,
"avg_line_length": 26.15,
"alnum_prop": 0.5984703632887189,
"repo_name": "DemocracyClub/EveryElection",
"id": "6e3f48a0403e64834451cb3bf66f4549d864a02c",
"size": "547",... |
import os, sys, glob
import argparse
import yaml
import multiprocessing as MP
import itertools as IT
import healpy as HP
import numpy as NP
import astropy.cosmology as cosmology
import astropy.constants as FCNST
import progressbar as PGB
import time, warnings
from astroutils import cosmotile
from astroutils import math... | {
"content_hash": "4c4840fe928bc77af976c75531233877",
"timestamp": "",
"source": "github",
"line_count": 309,
"max_line_length": 416,
"avg_line_length": 50.18122977346278,
"alnum_prop": 0.5986069908422547,
"repo_name": "nithyanandan/general",
"id": "9ae38c64e7656ac2387563c09a452623e71cf3b9",
"size":... |
"""Support for Xiaomi Smart WiFi Socket and Smart Power Strip."""
import asyncio
from functools import partial
import logging
import voluptuous as vol
from homeassistant.components.switch import DOMAIN, PLATFORM_SCHEMA, SwitchDevice
from homeassistant.const import ATTR_ENTITY_ID, CONF_HOST, CONF_NAME, CONF_TOKEN
from... | {
"content_hash": "c780b42ae0a22d0559a692582f5ac6d2",
"timestamp": "",
"source": "github",
"line_count": 553,
"max_line_length": 88,
"avg_line_length": 32.63110307414105,
"alnum_prop": 0.5873649210307564,
"repo_name": "fbradyirl/home-assistant",
"id": "8188d7911889ca2a28ccfc64c335c1308a3afad0",
"siz... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.