text
stringlengths
4
1.02M
meta
dict
from i18n import _ from repo import RepoError import os, sys, atexit, signal, pdb, traceback, socket, errno, shlex, time import util, commands, hg, lock, fancyopts, revlog, version, extensions, hook import cmdutil import ui as _ui class ParseError(Exception): """Exception raised on errors in parsing the command li...
{ "content_hash": "df473ebfd18b5041c5de7f400d95d0f2", "timestamp": "", "source": "github", "line_count": 410, "max_line_length": 80, "avg_line_length": 34.702439024390245, "alnum_prop": 0.5379533314590947, "repo_name": "carlgao/lenga", "id": "c449fe74788e9356cda264fad5398c7527f369df", "size": "14474...
from setuptools import setup from setuptools.extension import Extension setup_requires = [ 'cython>=0.x', 'pytest-runner', ] install_requires = [ 'ujson', ] tests_require = [ 'hypothesis', 'pytest-benchmark', 'pytest', ] extensions = [ Extension( "jsonsubset.deps.xxhash_cython.xx...
{ "content_hash": "0e00b7c105dac612287ba90a6ade0ab0", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 73, "avg_line_length": 25.129411764705882, "alnum_prop": 0.5735018726591761, "repo_name": "kawmarco/jsonsubset", "id": "864117f3ed85ae7e502eb00e771ff7a77f9ba164", "size": "...
import utils import favourite import os import xbmc ROOT = utils.ROOT FILENAME = utils.FILENAME def getDefaultSearch(): file = os.path.join(ROOT, 'S', FILENAME) faves = favourite.getFavourites(file) if len(faves) > 0: return faves[0] return None
{ "content_hash": "4b180d827f328df1e23e8cb11eba4d8f", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 45, "avg_line_length": 16.705882352941178, "alnum_prop": 0.6619718309859155, "repo_name": "TheWardoctor/Wardoctors-repo", "id": "f7ba430009dcb16688d0bbb90aab884b90e2a706", ...
import lief import sys import termcolor as tc import tempfile import subprocess import json import angr from capstone import * is_lesser = lambda addr, sect: addr < sect.virtual_address is_greater = lambda addr, sect: addr > sect.virtual_address + sect.size def get_elf_class_str(identity_class): if identity...
{ "content_hash": "88e35e3f4f556503be52d10d11455b6c", "timestamp": "", "source": "github", "line_count": 279, "max_line_length": 101, "avg_line_length": 33.236559139784944, "alnum_prop": 0.5732772565512779, "repo_name": "ner0x652/RElief", "id": "6854c070086c7b844bd54fdcd06b00fd08d241db", "size": "92...
import typing from .. import client_list_jobs from .. import create_job if typing.TYPE_CHECKING: from google.cloud import bigquery import pytest def test_client_list_jobs( capsys: "pytest.CaptureFixture[str]", client: "bigquery.Client" ) -> None: job = create_job.create_job() client.cancel_job(...
{ "content_hash": "ab2a36821c15e566f455c8863bb72c6c", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 67, "avg_line_length": 27.291666666666668, "alnum_prop": 0.6778625954198473, "repo_name": "googleapis/python-bigquery", "id": "a2845b7ad478842b8bf77b3ce19b98b18ba994d7", "s...
import json from mockito import * import os import shutil import tempfile import unittest from ice.history import ManagedROMArchive class ManagedROMArchiveTests(unittest.TestCase): def setUp(self): self.tempdir = tempfile.mkdtemp() self.temppath = os.path.join(self.tempdir, "tempfile") self.mock_user = ...
{ "content_hash": "164f32f0683672d679152bc78e0023fa", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 96, "avg_line_length": 33.5875, "alnum_prop": 0.7097134350576851, "repo_name": "scottrice/Ice", "id": "3968c38b1495492756061f5192d7eedb97167416", "size": "2688", "binary"...
""" Although it is usually not a good idea to explicitly point to a single ttf file for a font instance, you can do so using the font_manager.FontProperties fname argument (for a more flexible solution, see the font_fmaily_rc.py and fonts_demo.py examples). """ import sys import os import matplotlib.font_manager as fm ...
{ "content_hash": "2d2310d499ae0f416677f86e18ecaa52", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 75, "avg_line_length": 31.16216216216216, "alnum_prop": 0.6903729401561145, "repo_name": "bundgus/python-playground", "id": "9f321afeded4fba4cd86c7e489d6e19889556c60", "siz...
from p2ner.abstract.pipeelement import PipeElement import sys, socket from twisted.internet import reactor, defer from twisted.internet.protocol import DatagramProtocol import time from random import uniform class UDPPortElement(PipeElement, DatagramProtocol): def initElement(self, port=50000, interface='', to='p...
{ "content_hash": "b622a9626c6310735eef7c8722e86d72", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 87, "avg_line_length": 28.329896907216494, "alnum_prop": 0.5931586608442504, "repo_name": "schristakidis/p2ner", "id": "5a195539588cb72f8a8832950e3fdc7a856171ef", "size": "...
from .models import Task, get_repeating_data from django.core import serializers from django.http import HttpResponse from django.shortcuts import get_object_or_404 from django.views.generic import View import datetime import json class GetJson(View): def get(self, request, *args, **kwargs): date = kwarg...
{ "content_hash": "c9707d6eccf86fab38d109c6e627cff8", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 105, "avg_line_length": 29.923076923076923, "alnum_prop": 0.6392459297343616, "repo_name": "ojarva/home-info-display", "id": "895266ade16bef60cef6d604b156143b0e130be2", "si...
from symbol.builder import FasterRcnn as Detector from symbol.builder import add_anchor_to_arg from models.efficientnet.builder import EfficientNetB5FPN as Backbone from models.FPN.builder import FPNNeck as Neck from models.FPN.builder import FPNRpnHead as RpnHead from models.FPN.builder import FPNRoiAlign as RoiExtrac...
{ "content_hash": "43349ca273723b406fd91681cd470345", "timestamp": "", "source": "github", "line_count": 313, "max_line_length": 100, "avg_line_length": 29.706070287539937, "alnum_prop": 0.5458163045816304, "repo_name": "TuSimple/simpledet", "id": "4888e68691587fb5ae97a8719c3bbedb347b6c76", "size": ...
try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: __path__ = __import__('pkgutil').extend_path(__path__, __name__) #------------------------------------------------------------------------------ # end of $Id$ #--------------------------------------------------------------------------...
{ "content_hash": "504bfa290003c0ed6357e845b77df195", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 79, "avg_line_length": 40.625, "alnum_prop": 0.3076923076923077, "repo_name": "cadithealth/templatealchemy", "id": "404640c0bc5ba9c8deb9148266880aeeca93ec1d", "size": "654",...
from django.apps import AppConfig class SpiritUserAuthConfig(AppConfig): name = 'spirit.user.auth' verbose_name = "Spirit User Auth" label = 'spirit_user_auth'
{ "content_hash": "d517579235922982c216f03e456c8fd1", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 38, "avg_line_length": 21.875, "alnum_prop": 0.7142857142857143, "repo_name": "nitely/Spirit", "id": "40ea3c84454a305fd9bd57539b933edc48dc9fd9", "size": "200", "binary": f...
import json import string from django.contrib.contenttypes.fields import GenericRelation from django.core.exceptions import ValidationError from django.core.validators import RegexValidator from django.db import models from django.urls import reverse from django.utils.safestring import mark_safe from django.utils.text...
{ "content_hash": "87c0a029e0ae8540c1ee7508460a64ca", "timestamp": "", "source": "github", "line_count": 862, "max_line_length": 111, "avg_line_length": 41.01276102088167, "alnum_prop": 0.6411902808813962, "repo_name": "Princeton-CDH/derrida-django", "id": "ce4506576cf927b183af4e11dd1b2b024ea7ffcf", ...
import copy import logging import random import time from oslo_config import cfg import six from oslo_service._i18n import _, _LE, _LI periodic_opts = [ cfg.BoolOpt('run_external_periodic_tasks', default=True, help='Some periodic tasks can be run in a separate process. ' ...
{ "content_hash": "082c19088147e3eeef6e9e6c8788fa63", "timestamp": "", "source": "github", "line_count": 219, "max_line_length": 79, "avg_line_length": 35.21917808219178, "alnum_prop": 0.5960067418643848, "repo_name": "eezhova/oslo.service", "id": "d58a8c7440658e0d074c19fc629769d8ec0017b8", "size": ...
from . import domainresource class Specimen(domainresource.DomainResource): """ Sample for analysis. A sample to be used for analysis. """ resource_type = "Specimen" def __init__(self, jsondict=None, strict=True): """ Initialize all valid properties. :raises:...
{ "content_hash": "cb5049ca9db296543c3f5900a22e7344", "timestamp": "", "source": "github", "line_count": 310, "max_line_length": 141, "avg_line_length": 40.851612903225806, "alnum_prop": 0.6174194567277321, "repo_name": "all-of-us/raw-data-repository", "id": "e1dd9b5ba47773b926671f652cef83e26432fcdd",...
import ml_collections class hyper: pass def D(**kwargs): return ml_collections.ConfigDict(initial_dictionary=kwargs) # added, edited end_num_steps = 1 # eventual number of steps in the distilled sampler start_num_steps = 1024 #512 #1024 #1024 #512 #1024 #NOTE: todo change to #1024 # number of steps in base...
{ "content_hash": "6f5ca0c281c7798d40f0743b021425d3", "timestamp": "", "source": "github", "line_count": 160, "max_line_length": 173, "avg_line_length": 38.00625, "alnum_prop": 0.5916790001644466, "repo_name": "google-research/google-research", "id": "9a95ea69769035a7dfc5f7c3510de0785537557e", "size...
from oslo_config import cfg from oslo_log import log as logging from designate.i18n import _LI from designate import coordination from designate import service from designate.central import rpcapi as central_api LOG = logging.getLogger(__name__) CONF = cfg.CONF class Service(coordination.CoordinationMixin, service...
{ "content_hash": "fd2d4d46070a4394f418abd6f9f057f1", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 72, "avg_line_length": 28.945945945945947, "alnum_prop": 0.6834733893557423, "repo_name": "kiall/designate-py3", "id": "699af2fb06c1aaf567904ca7ecfc49c5b9416868", "size": "...
""" A dirty script to send PDFs to my personal Kindle. Credentials (email password, email addresses, etc, should be kept in a `.env` file.) """ import argparse import os import sys from pathlib import Path from dotenv import load_dotenv from halo import Halo from redmail import EmailSender parser = argparse.Argument...
{ "content_hash": "bee299b2945229eb703429d4d6f7c7cb", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 84, "avg_line_length": 26.18032786885246, "alnum_prop": 0.667501565435191, "repo_name": "bblinder/home-brews", "id": "f8add56ae27cf43da6d3650af162febfbbe83570", "size": "16...
""" Using the results of exercises 1.16 and 1.17, devise a procedure that generates an iterative process for multiplying two integers in terms of adding, doubling, and halving and uses a logarithmic number of steps. Note from the book: This algorithm, which is sometimes known as the ``Russian peasant method'' of mult...
{ "content_hash": "7727a8aa1b46e9ee485c0ff081dfb532", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 121, "avg_line_length": 36.391304347826086, "alnum_prop": 0.6242532855436081, "repo_name": "aoyono/sicpy", "id": "6da799c151cae58a9be0006366b21afdf233cd6f", "size": "1698",...
""" Cards recognition software for game of Chinese Poker The game is played by creating a stack of 5,5,3 cards. Each hand must be worth less than the hand below it. The application also compares two players together and calculates the points """ import sys import numpy as np import cv2 as cv import scoreGame as scr ...
{ "content_hash": "07cc92cc0164cf5a40a9d1b2b2075baf", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 101, "avg_line_length": 33.67088607594937, "alnum_prop": 0.6672932330827067, "repo_name": "matteobe/ChinesePoker", "id": "fee5ad5103d13d6ef0cb5251cd359aa0b7b2cfa0", "size":...
from model import Event from google.appengine.ext import db def post(handler, response): key = handler.request.get('key') response.event = event = Event.get(key) if key else Event() event.name = handler.request.get('name') event.link = handler.request.get('link') event.city = handler.request.get('city') ev...
{ "content_hash": "60889d0a6e6b57e664eb8442189e7c19", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 61, "avg_line_length": 33.30434782608695, "alnum_prop": 0.7036553524804178, "repo_name": "globalspin/haemapod", "id": "7c8902928337f4679e0debc536be3b27c8f455be", "size": "7...
from setuptools import setup, find_packages setup( name='data-sync-s3', version='0.0.1', description='Data Sync S3', author='Peter Bull', author_email='[email protected]', url='http://www.drivendata.org/', license='MIT', packages=find_packages(), entry_points={ 'console_scripts'...
{ "content_hash": "02502e99d0daaf79b931f135bf79b7f5", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 43, "avg_line_length": 20.63157894736842, "alnum_prop": 0.6071428571428571, "repo_name": "pjbull/data-sync", "id": "cdb53fe9be6cb14f5d8d528c04974889092f6791", "size": "415"...
try: from setuptools import setup except ImportError: from distutils.core import setup with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read().replace('.. :changelog:', '') requirements = [ # TODO: put package re...
{ "content_hash": "7851aa39ef126e6782d85b43f6e59552", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 63, "avg_line_length": 26.28301886792453, "alnum_prop": 0.6001435750179469, "repo_name": "westurner/pwd", "id": "c39d895300739807182c1651ca42e60e3509a89b", "size": "1441", ...
from __future__ import unicode_literals import errno import socket import unittest import gobject from mock import Mock, patch, sentinel from mopidy.utils import network from tests import any_int class ServerTest(unittest.TestCase): def setUp(self): self.mock = Mock(spec=network.Server) def test...
{ "content_hash": "a71ff000ad214a89fb4768b037020a76", "timestamp": "", "source": "github", "line_count": 198, "max_line_length": 79, "avg_line_length": 40.58080808080808, "alnum_prop": 0.6747977598008712, "repo_name": "woutervanwijk/mopidy", "id": "eebc9ea2319f20ac5684e90984fb2c6bd0dfa3cb", "size": ...
import math import cPickle as pickle class NaiveBayes(): def strip_punctuation(self, text): return "".join(c for c in text if c not in ('!','.',':')) def __init__(self): self.democrats = pickle.load(open('democrats.pickle', 'rb')) self.republicans = pickle.load(open('republicans.pickle', 'rb')) def get_lea...
{ "content_hash": "57c70368df23705759fef43a044c4401", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 66, "avg_line_length": 26.11111111111111, "alnum_prop": 0.6609929078014184, "repo_name": "USA-Hacks/Politik-Back", "id": "a1fee43cea7065f51e5ad250df242a4a325efe43", "size":...
from quickbooks.objects import Ref from huxley.invoice_automation.src.util.query_utils import construct_invoice_query class TestQueryUtils: def test_construct_invoice_query_happyPath(self): # Setup customer_ref = Ref() customer_ref.value = 1 # Act query = construct_invoic...
{ "content_hash": "2259b09e94a9ce76c62be93f8ae8b586", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 117, "avg_line_length": 30.41176470588235, "alnum_prop": 0.6769825918762089, "repo_name": "bmun/huxley", "id": "4bfa29417700c3cef7a710963ede4afad40d3d36", "size": "517", ...
from lxml import html import requests def get_values(response_dict): '''Takes a dictionary created from the json given by evepraisal. Returns a tuple of the form (total_blueloot_value, total_salvage_value).''' # # CONSTANTS: # ec_marketdata_url = 'http://api.eve-central.com/api/marketstat' ...
{ "content_hash": "a683b6576eb6f05eafeba73afe7cc6df", "timestamp": "", "source": "github", "line_count": 103, "max_line_length": 77, "avg_line_length": 30.87378640776699, "alnum_prop": 0.6226415094339622, "repo_name": "all-out/lootparser", "id": "f06dfa2420a0efdf06cf7c18c28054858623cfc3", "size": "3...
from __future__ import absolute_import, unicode_literals from .var_loader import VarLoader class Config(object): """Container for the top-level test configuration. This contains all of the top-level configuration, such as the target host and variables to be used in test cases. """ def __init__...
{ "content_hash": "9546702786edc8ffd4601f0258799b1b", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 75, "avg_line_length": 32.31428571428572, "alnum_prop": 0.6304155614500442, "repo_name": "sjagoe/usagi", "id": "e604327456824220843bd1a53fb94218e148b0ad", "size": "1366", ...
from django.conf import settings from django.shortcuts import redirect import logging, re class NextURLMiddleware(object): ''' The middleware to intercept request when method is "GET" and URL match with NEXT_URL_INTERCEPTION (default is '^/?$'). It will do nothing and return the URL redirect when URL is matc...
{ "content_hash": "f2603a2ba54926b72c91c67a0417f18c", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 124, "avg_line_length": 38.888888888888886, "alnum_prop": 0.6221428571428571, "repo_name": "kensonman/webframe", "id": "340353b1414515f5b36ed59b43b8e7da34cb10e3", "size": "...
import logging import re import socket import binascii import struct import xml.etree.ElementTree as ET from time import sleep from struct import pack from types import MethodType from threading import Thread, Event from socket import AF_INET, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR from os.path import dirname from av...
{ "content_hash": "7984613178c4c1d2c531be5db2a17678", "timestamp": "", "source": "github", "line_count": 371, "max_line_length": 79, "avg_line_length": 31.768194070080863, "alnum_prop": 0.4976243000169693, "repo_name": "avatartwo/avatar2", "id": "19ad3834784658525817d21bcfce76ae773ccd20", "size": "1...
""" A custom manager for working with trees of objects. """ import contextlib from django.db import models, transaction, connections, router from django.db.models import F, Max from django.utils.translation import ugettext as _ from mptt.exceptions import CantDisableUpdates, InvalidMove __all__ = ('TreeManager',) ...
{ "content_hash": "1dd6fe28cfa65d4bbca60f5056dd065d", "timestamp": "", "source": "github", "line_count": 1039, "max_line_length": 119, "avg_line_length": 40.07603464870068, "alnum_prop": 0.5525829150555969, "repo_name": "denys-duchier/django-mptt-py3", "id": "5486e6bbecf15dab404320fe0844d40613c06d30",...
"""Unit tests for Motion JPEG encoder module.""" import encoder import optimizer import unittest import test_tools import mjpeg class TestMotionJpegCodec(test_tools.FileUsingCodecTest): def test_OneBlackFrame(self): codec = mjpeg.MotionJpegCodec() my_optimizer = optimizer.Optimizer(codec) videofile = ...
{ "content_hash": "8b99e45f8aeb9a01bfa5e923bcaac001", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 78, "avg_line_length": 39.76470588235294, "alnum_prop": 0.6923076923076923, "repo_name": "google/compare-codecs", "id": "e039ab232aaae8b590148e9a9d27a6f4df438f7b", "size": ...
"""Tests for research.carls.models.caml.sparse_features lib.""" from absl.testing import parameterized from research.carls.models.caml import sparse_features from research.carls.testing import test_util import numpy as np import tensorflow as tf class FeatureEmbeddingTest(tf.test.TestCase, parameterized.TestCase): ...
{ "content_hash": "1df8aaef210d37590e3a5925f38614f7", "timestamp": "", "source": "github", "line_count": 302, "max_line_length": 82, "avg_line_length": 41.50662251655629, "alnum_prop": 0.5926605504587156, "repo_name": "tensorflow/neural-structured-learning", "id": "a03c37c4ccddcb1800869427d5f37e8ce0ad...
TEST_CONFIG_OVERRIDE = { # You can opt out from the test for specific Python versions. # We only run the cloud run tests in py39 session. "ignored_versions": ["2.7", "3.6", "3.7", "3.8"], "enforce_type_hints": True, # An envvar key for determining the project id to use. Change it # to 'BUILD_SPE...
{ "content_hash": "cc25ec1d6786768173915d9c8cd96fc2", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 70, "avg_line_length": 49.4, "alnum_prop": 0.6747638326585695, "repo_name": "GoogleCloudPlatform/python-docs-samples", "id": "07aae85e9d0b1549ef7b111c2972455ac55e6430", "si...
from django.views.generic.base import View from django.http.response import HttpResponseRedirect from django.urls import reverse from django.utils import translation class ChangeLanguage(View): def get(self, request, code): if translation.check_for_language(code): request.session[translation.L...
{ "content_hash": "99dff0d42060165bfe12b09ae7b7b572", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 68, "avg_line_length": 37.083333333333336, "alnum_prop": 0.7438202247191011, "repo_name": "WebArchivCZ/Seeder", "id": "37446fa54d5b75ff9923d8f21d9801f0730fd87c", "size": "4...
from django.core import validators from django.utils.translation import gettext_lazy as _ no_slash_validator = validators.RegexValidator(r'^(?u)[^/]+$', _("Slash is not an allowed " "character."), ...
{ "content_hash": "2ec8a09342c5e19f6b7c37dc5bcb3254", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 75, "avg_line_length": 44.75, "alnum_prop": 0.43575418994413406, "repo_name": "openstack/horizon", "id": "a3427823de397afabc1bc77f706bf2a5cd08b4c0", "size": "903", "binary...
import unittest from semantic_version import Version, SimpleSpec, NpmSpec from .setup_django import django_loaded if django_loaded: # pragma: no cover from semantic_version import django_fields from .django_test_app import models from django.core import serializers from django.core.management impo...
{ "content_hash": "ea4cff7a9d8a71a8ff945ce40313333a", "timestamp": "", "source": "github", "line_count": 273, "max_line_length": 117, "avg_line_length": 36.89010989010989, "alnum_prop": 0.6349915599245358, "repo_name": "rbarrois/python-semanticversion", "id": "3361a9bf0bd41c2871b3d79a8b14652b198535f7"...
import os import sys import yaml from fabric.api import * class Config(object): def __init__(self, configfile): self._config = self.__set_config(configfile) self._roles = self.__set_roles(configfile) self._servers = self.__set_servers(configfile) self.__prepare() if os.e...
{ "content_hash": "d504e5f1a9a543c2b441bd2b9e651653", "timestamp": "", "source": "github", "line_count": 143, "max_line_length": 137, "avg_line_length": 32.81818181818182, "alnum_prop": 0.5399531216705732, "repo_name": "midonet/senbazuru", "id": "7d5e1845fd334a33bd3f604da5134efea6edd4aa", "size": "5...
""" WSGI config for idneo 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.7/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "idneo.settings") from django.core.wsgi ...
{ "content_hash": "a4a3809e57f232a132ea94069e50d23b", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 78, "avg_line_length": 27.5, "alnum_prop": 0.7714285714285715, "repo_name": "pollitosabroson/idneo", "id": "37eba92157a4264a275efb6bf7bb034bb674d29d", "size": "385", "bin...
__version__=''' $Id$ ''' __doc__='''Classes for ParagraphStyle and similar things. A style is a collection of attributes, but with some extra features to allow 'inheritance' from a parent, and to ensure nobody makes changes after construction. ParagraphStyle shows all the attributes available for formatting paragraph...
{ "content_hash": "4287bc8bcdf6d6ae8fd0727311072289", "timestamp": "", "source": "github", "line_count": 357, "max_line_length": 163, "avg_line_length": 37.07282913165266, "alnum_prop": 0.4989044200982244, "repo_name": "Distrotech/reportlab", "id": "cb16f5531449fc22a1ec3dccd4e7bf93cb8c10e2", "size":...
from corehq.apps.sms.models import MessagingSubEvent, MessagingEvent from corehq.util.metrics import metrics_counter def handle_email_messaging_subevent(message, subevent_id): try: subevent = MessagingSubEvent.objects.get(id=subevent_id) except MessagingSubEvent.DoesNotExist: return event...
{ "content_hash": "d3755c0951d725652cc55a86ea4b8be0", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 97, "avg_line_length": 41.76315789473684, "alnum_prop": 0.632010081915564, "repo_name": "dimagi/commcare-hq", "id": "b8e4b5b036c4a2ca25b9d31f58e6b4bd9507e1c9", "size": "158...
"""Build attributes of every testcase.""" import datetime import sys import six from clusterfuzz._internal.base import utils from clusterfuzz._internal.datastore import data_types from clusterfuzz._internal.datastore import ndb_utils from local.butler.scripts import attribute_builder from local.butler.scripts import...
{ "content_hash": "9acd7cc7a6dc42d67ad59034c22d552f", "timestamp": "", "source": "github", "line_count": 83, "max_line_length": 77, "avg_line_length": 26.253012048192772, "alnum_prop": 0.6181734740706746, "repo_name": "google/clusterfuzz", "id": "bb6cb84a97c582e3744aa82e566cf9122e4c326e", "size": "2...
class IrisettError(Exception): def __str__(self) -> str: if len(self.args) == 1: ret = self.args[0] else: ret = str(self.__class__.__name__) return ret class InvalidArguments(IrisettError): pass
{ "content_hash": "ceef6523397e379215765b18f5c469ac", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 46, "avg_line_length": 23, "alnum_prop": 0.5296442687747036, "repo_name": "beebyte/irisett", "id": "d4cee3c4a8916cdaa807d1eb89d9dc4624ba5f05", "size": "253", "binary": fa...
from mininode import * from blockstore import BlockStore, TxStore from util import p2p_port ''' This is a tool for comparing two or more bitcoinds to each other using a script provided. To use, create a class that implements get_tests(), and pass it in as the test generator to TestManager. get_tests() should be a py...
{ "content_hash": "1062c40e18e30041de739437de1f460a", "timestamp": "", "source": "github", "line_count": 366, "max_line_length": 145, "avg_line_length": 43.99180327868852, "alnum_prop": 0.5887211974411527, "repo_name": "shaulkf/bitcoin", "id": "9444424dcf633e8303e8d1893d92b4f0df26104a", "size": "162...
from django.core.management import BaseCommand __author__ = 'tchen' ### Warning - do not use this script. I changed my mind when generating the stats. This is for real time stats, ### but for the problem we're solving it is not necessary. from pymongo import MongoClient client = MongoClient('localhost', 27017) db = ...
{ "content_hash": "6144b97b2e34d5c1a4ab7d00e9af9693", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 111, "avg_line_length": 34.7027027027027, "alnum_prop": 0.567367601246106, "repo_name": "tyrchen/church", "id": "12c3f65f87654cd22f75bab89439258f11de34e0", "size": "2568", ...
import time import threading import mido import sys import MRQ1 #import duplexPort # globals MIDI_PORT = False MIDI_note_mapping = [None] * 127 MIDI_note_mapping[91] = [MRQ1.droneSnare,16] MIDI_note_mapping[93] = [MRQ1.droneBongo,16] MIDI_note_mapping[95] = [MRQ1.droneBass, 16] MIDI_note_mapping[96] = [MRQ1.droneBrus...
{ "content_hash": "574add8a62809ae24cfded26d76e3d97", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 64, "avg_line_length": 28.870588235294118, "alnum_prop": 0.713121434392828, "repo_name": "andycavatorta/RhythmBoxKing", "id": "961b4432a93a45dc26aa0d78ff5a1306715a3137", "s...
import os import slack import requests import logging from datetime import datetime from get_parent import get_parent from case_not_found import case_not_found from googleapiclient.discovery import build_from_document logger = logging.getLogger(__name__) def support_add_comment(channel_id, case, comment, user_id, us...
{ "content_hash": "97b0e86264e91ad26e7e8bf9c62812a1", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 91, "avg_line_length": 36.901234567901234, "alnum_prop": 0.6283037805286049, "repo_name": "GoogleCloudPlatform/professional-services", "id": "b90b612a5ec369e831d094df227a6aaf...
"""The tests for the Prometheus exporter.""" import asyncio import pytest from homeassistant.setup import async_setup_component import homeassistant.components.prometheus as prometheus @pytest.fixture def prometheus_client(loop, hass, aiohttp_client): """Initialize an aiohttp_client with Prometheus component."""...
{ "content_hash": "00cf3c434ee7f14363e3caead808ee28", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 73, "avg_line_length": 32.25714285714286, "alnum_prop": 0.6767050487156776, "repo_name": "persandstrom/home-assistant", "id": "49744421c726ec15ee328c44ca35b4cb811d4a7c", "s...
import os import sys dir = os.path.split(os.path.split(os.path.realpath(__file__))[0])[0] sys.path.append(os.path.join(dir, 'scripts')) # testing import mock import unittest from mock import patch # program import collect.load as Load class CheckLoadCountryList(unittest.TestCase): '''Unit tests for the loading of...
{ "content_hash": "bbd48466e0fee837eb8b9b04e8e528b2", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 68, "avg_line_length": 23.914285714285715, "alnum_prop": 0.6905615292712067, "repo_name": "luiscape/hdxscraper-reach-resource-center", "id": "222f6209dd93ec8639436ec160fe494f...
import collections, itertools import nltk.classify.util, nltk.metrics from nltk.classify import NaiveBayesClassifier from nltk.corpus import movie_reviews, stopwords from nltk.collocations import BigramCollocationFinder from nltk.metrics import BigramAssocMeasures from nltk.probability import FreqDist, ConditionalFreqD...
{ "content_hash": "73c93d700a2b9f560d9fcade12970fe6", "timestamp": "", "source": "github", "line_count": 90, "max_line_length": 81, "avg_line_length": 35.32222222222222, "alnum_prop": 0.7363950927964769, "repo_name": "Feawel/MachineLearningProject", "id": "58bb844c8ec7992accf62f6aa235eede0a537b9e", ...
from setuptools import setup import stackato requirements = ['setuptools', 'requests>=0.11.2'] version = '0.10.0.1dev' setup( name='PyStackato', version=version, description=stackato.__doc__.strip(), author=stackato.__author__, license=stackato.__license__, packages=['stackato'], install_...
{ "content_hash": "906d9ad8eb5f58a9fe38f6b3af8b9464", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 49, "avg_line_length": 19.22222222222222, "alnum_prop": 0.6734104046242775, "repo_name": "noderabbit-team/PyStackato", "id": "232c03c897e8a0d557cdab6fa0ee06790211e0fb", "si...
#!/usr/bin/env python3 # # Copyright (c) 2018-2019 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Lint format strings: This program checks that the number of arguments passed # to a variadic format ...
{ "content_hash": "89686e08d214e114a0aaf8863effcea3", "timestamp": "", "source": "github", "line_count": 341, "max_line_length": 164, "avg_line_length": 44.16422287390029, "alnum_prop": 0.5710491367861886, "repo_name": "Bitcoin-ABC/bitcoin-abc", "id": "a0919d7fd6540ec2149948c834926b5fb24aa278", "siz...
import re import web import simplejson as json import karesansui from karesansui.lib.rest import Rest, auth from karesansui.db.access.machine import findbyhost1 from karesansui.lib.checker import Checker, \ CHECK_EMPTY, CHECK_VALID, CHECK_LENGTH, \ CHECK_CHAR, CHECK_MIN, CHECK_MAX, CHECK_ONLYSPACE, \ CHE...
{ "content_hash": "8a331ca873932e857c1781691fbfbd39", "timestamp": "", "source": "github", "line_count": 162, "max_line_length": 119, "avg_line_length": 32.46913580246913, "alnum_prop": 0.5406844106463878, "repo_name": "karesansui/karesansui", "id": "63c8195c0d487a4dcedd4bbcb1b4d8750447df41", "size"...
from datetime import timedelta from itertools import izip_longest import pytz from google.appengine.ext import ndb TIMESPAN_LAST_WEEK = 'last_week' TIMESPAN_THIS_WEEK = 'this_week' def chunk(iterable, chunk_size): """Collect data into fixed-length chunks or blocks (http://docs.python.org/2/library/itertools.ht...
{ "content_hash": "7ab6429b22d437b4de069f0da6af191e", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 119, "avg_line_length": 32.375, "alnum_prop": 0.6810810810810811, "repo_name": "Yelp/love", "id": "6672ddfa5e1d349ffdabd8edd4853dc3612bfc70", "size": "1319", "binary": fa...
"""Manifest validation.""" from __future__ import annotations from pathlib import Path from urllib.parse import urlparse from awesomeversion import ( AwesomeVersion, AwesomeVersionException, AwesomeVersionStrategy, ) import voluptuous as vol from voluptuous.humanize import humanize_error from .model impo...
{ "content_hash": "ed18f204a1349b7c3528a580dd09ecb7", "timestamp": "", "source": "github", "line_count": 297, "max_line_length": 88, "avg_line_length": 27.60942760942761, "alnum_prop": 0.5808536585365853, "repo_name": "sander76/home-assistant", "id": "8c9776ed7c9e06007aefe003f6be9184220456f9", "size...
""" Solve day 15 of Advent of Code. http://adventofcode.com/2016/day/15 """ import re from collections import namedtuple Disc = namedtuple('Disc', ['name', 'num_pos', 'start_pos']) def discs_from_input(data): discs = [] for line in data: match = re.match(r'.+ #(?P<name>\d+) .+ (?P<num_pos>\d+) pos...
{ "content_hash": "a0594a059318fdc0c3b08db503b5ec19", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 77, "avg_line_length": 23.89090909090909, "alnum_prop": 0.541095890410959, "repo_name": "mpirnat/aoc2016", "id": "11e6766c9bbc613667a17052d7835ee09a65932d", "size": "1337",...
""" eve.settings ~~~~~~~~~~~~ Default API settings. These can be overridden by editing this file or, more appropriately, by using a custom settings module (see the optional 'settings' argument or the EVE_SETTING environment variable). :copyright: (c) 2016 by Nicola Iarocci. :license: BSD, ...
{ "content_hash": "67e3dabfac0eb90679a3ff0768b83c81", "timestamp": "", "source": "github", "line_count": 247, "max_line_length": 79, "avg_line_length": 36.69635627530364, "alnum_prop": 0.6577669902912622, "repo_name": "mugurrus/eve", "id": "1ac76ef771e78404abe12f613b531c2c50a04cd6", "size": "9089", ...
import argparse class Context(object): def __init__(self, parser=None): self.__parser = parser def abort(self, message): if not self.__parser: return self.__parser.error(message) class Command(object): def __init__(self, args, func): self.arguments = args ...
{ "content_hash": "a3e3c74a922bb3a1f48728e36e30bd74", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 74, "avg_line_length": 26.873417721518987, "alnum_prop": 0.5713612812058408, "repo_name": "eleme/ruskit", "id": "1074d73e63e8184c113f6d35ccfc060126745345", "size": "2123", ...
from flask import request, redirect, current_app YEAR_IN_SECS = 31536000 class SSLify(object): """Secures your Flask App.""" def __init__(self, app=None, age=YEAR_IN_SECS, subdomains=False, permanent=False, skips=None, includes=None): self.app = app or current_app self.hsts_...
{ "content_hash": "44a46d73828f8314ecdbad4e5f6584f8", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 89, "avg_line_length": 35.15909090909091, "alnum_prop": 0.5824175824175825, "repo_name": "David-OConnor/lakenheath", "id": "606294842061d47e8e05b98e9cfa95fac9c3db9b", "size...
import json import logging import os logger = logging.getLogger(__name__) CONFIG_FILE_PATH_ENV_PROPERTY_NAME = "REPOUR_CONFIG_FILE_PATH" _cached_configuration = None async def get_configuration(): return get_configuration_sync() def get_configuration_sync(): global _cached_configuration def get_conf...
{ "content_hash": "ec0bbe364a5a509bcbaa602e1dfb5298", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 81, "avg_line_length": 25.615384615384617, "alnum_prop": 0.5743243243243243, "repo_name": "project-ncl/repour", "id": "02b32fff6553e2d3cd0e674c4c4366501c66f92b", "size": "1...
import random from twisted.internet import task def f(): return "Hopefully this will be called in 3 seconds or less" def main(reactor): delay = random.uniform(1, 5) def called(result): print("{0} seconds later:".format(delay), result) d = task.deferLater(reactor, delay, f) d.addTimeout(3...
{ "content_hash": "62651a9e70139f15715c96856d3bf009", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 69, "avg_line_length": 23.63157894736842, "alnum_prop": 0.6859688195991092, "repo_name": "qrsforever/workspace", "id": "2122871a660370e2d51b118bb7273acce5e93504", "size": "...
""" Django settings for website project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) im...
{ "content_hash": "3bc18a1dfad92d01802ab555144675f7", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 71, "avg_line_length": 24.470588235294116, "alnum_prop": 0.7254807692307692, "repo_name": "paulvstheworld/vs_collisions", "id": "23c30959ae601f157502def8b83f2a1916dfd2dc", ...
""" Classify an image using individual model files Use this script as an example to build your own tool """ import argparse import os import time from google.protobuf import text_format import numpy as np import PIL.Image import scipy.misc os.environ['GLOG_minloglevel'] = '2' # Suppress most caffe output import caff...
{ "content_hash": "8f86bfb0ec3dc6e91b42a4452870ac23", "timestamp": "", "source": "github", "line_count": 252, "max_line_length": 106, "avg_line_length": 31.321428571428573, "alnum_prop": 0.6031927023945268, "repo_name": "PatrickChrist/CDTM-Deep-Learning-Drones", "id": "4a8fe15f05ee2513a05ea5092584aa3b...
def foobar(whop): if whop>"pohrw": return "foox" else: return "barbar" # the equivalent in expression-form: foobar = lambda whop: ("foox", "barbar")[whop<="pohrw"] # in general, we MUST ensure the 'conditional' turns # into a 0 or 1 -- the 'not' operator is handy for that: # not needed in the if-else case: de...
{ "content_hash": "75fa3277a1e33f5911d798f300f4ed23", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 56, "avg_line_length": 33.5, "alnum_prop": 0.6746268656716418, "repo_name": "ActiveState/code", "id": "16c4fc2e3678e54cdd7efe3fc9b58f92ddf57146", "size": "1024", "binary"...
"""Test file for run_python_file. This file is executed two ways:: $ coverage run try_execfile.py and:: $ python try_execfile.py The output is compared to see that the program execution context is the same under coverage and under Python. It is not crucial that the execution be identical, there are some d...
{ "content_hash": "a7f699d868f2ab065960e7acaa3ce7bb", "timestamp": "", "source": "github", "line_count": 109, "max_line_length": 97, "avg_line_length": 29.75229357798165, "alnum_prop": 0.6410730804810361, "repo_name": "hugovk/coveragepy", "id": "48f9d098c8ab587b739ee24e6bf3fd2fd78cc730", "size": "33...
from flask_wtf import FlaskForm from wtforms import StringField, validators, PasswordField, TextAreaField # TODO: RegisterForm class RegisterForm(FlaskForm): name = StringField(label='Name', validators=[validators.Length(min=1, max=80)]) username = StringField(label='Username', validators=[validators.Length(m...
{ "content_hash": "6f609e792da8763a686fb0f37288c629", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 91, "avg_line_length": 42.48, "alnum_prop": 0.660075329566855, "repo_name": "alaturqua/my_flask_app", "id": "6038ff7bf83838c8eaa42f64ba6fd5c158838e84", "size": "1062", "b...
from runner.koan import * class AboutComprehension(Koan): def test_creating_lists_with_list_comprehensions(self): feast = ['lambs', 'sloths', 'orangutans', 'breakfast cereals', 'fruit bats'] comprehension = [delicacy.capitalize() for delicacy in feast] self.assertEqual("Lam...
{ "content_hash": "0c1b795c9d84d9e8ac2eb5c2ab41cb91", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 108, "avg_line_length": 40.410714285714285, "alnum_prop": 0.6363234644277508, "repo_name": "gilhooley/python_koans", "id": "963e6bb6d6a3d223eaa90208720e74991d718abc", "size...
from twisted.internet import defer from synapse.api.constants import ThirdPartyEntityKind from synapse.api.errors import CodeMessageException from synapse.http.client import SimpleHttpClient from synapse.events.utils import serialize_event from synapse.util.caches.response_cache import ResponseCache from synapse.types...
{ "content_hash": "5ad4a0031bce8474d5600e9cafdda163", "timestamp": "", "source": "github", "line_count": 221, "max_line_length": 78, "avg_line_length": 32.39366515837104, "alnum_prop": 0.5335940773851097, "repo_name": "TribeMedia/synapse", "id": "6893610e715b9198f4a79ba7a7bb55f3ff6ec1e0", "size": "7...
import uuid import django.db.models.deletion from django.conf import settings from django.db import migrations, models import authnz.models.permissioned_db_fields class Migration(migrations.Migration): replaces = [ ("cards", "0001_initial"), ("cards", "0002_remove_waiver_combatant_combatant_wai...
{ "content_hash": "d662781458652dc8dfa475de2caa924e", "timestamp": "", "source": "github", "line_count": 452, "max_line_length": 86, "avg_line_length": 33.66150442477876, "alnum_prop": 0.38534341110745973, "repo_name": "lrt512/emol", "id": "a1bde4641b9848c31a39530e6488f1de4f74f281", "size": "15264",...
""" https://confluence.atlassian.com/display/DOC/Confluence+Storage+Format """ from distutils.version import LooseVersion import os from docutils import nodes from docutils.parsers.rst import directives, Directive, roles from docutils.parsers.rst.directives import images from docutils.parsers.rst.roles import set_c...
{ "content_hash": "e7ab933246e0d7a073688a074b3e140f", "timestamp": "", "source": "github", "line_count": 588, "max_line_length": 113, "avg_line_length": 34.197278911564624, "alnum_prop": 0.5830515217823752, "repo_name": "Arello-Mobile/sphinx-confluence", "id": "c7f8f3432d34a1b560dcfcd20f59bbc6a1e1a219...
import os import pytest import subprocess import sys import tempfile TOP_SRC_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) def test_bootstrap_in_source_dir(env): """ Running the bootstrap script from the source directory should fail. """ with pytest.raises(subprocess.CalledProcess...
{ "content_hash": "e168caa4d905f2e7613ae1d70a3d9e7c", "timestamp": "", "source": "github", "line_count": 89, "max_line_length": 74, "avg_line_length": 33.87640449438202, "alnum_prop": 0.6398009950248756, "repo_name": "sbxg/sbxg", "id": "cadf169dec497cf513017829733cee550d42dec4", "size": "4110", "b...
""" ========== Overview ========== Propositions ============ First, let's create some propositions using the :class:`PropLiteral` constructor. All propositions are atomic, that is, either positive or negative literals. >>> kill = PropLiteral('kill') >>> kill.polarity True >>> intent = PropLiteral('intent') >>> murd...
{ "content_hash": "38cd226ad91709056a5ab54d616b8a60", "timestamp": "", "source": "github", "line_count": 827, "max_line_length": 94, "avg_line_length": 33.582829504232166, "alnum_prop": 0.6163180066971519, "repo_name": "ewan-klein/carneades", "id": "98c02b37c921e40aebc6062aa8e4346136f1e4a9", "size":...
import morepath from webtest import TestApp as Client def test_function_extends(): class App(morepath.App): @morepath.dispatch_method('obj') def foo(self, obj): return "default" class Extending(App): pass class Alpha(object): pass @App.method(App.foo, obj...
{ "content_hash": "6443bcc83ddcf575a7a6b197dd99512e", "timestamp": "", "source": "github", "line_count": 121, "max_line_length": 57, "avg_line_length": 24.239669421487605, "alnum_prop": 0.5925673371974088, "repo_name": "faassen/morepath", "id": "1fb3a713a31e2628bfd020ddeeac8a4912995c06", "size": "29...
""" byceps.services.ticketing.models.archived_attendance ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Copyright: 2006-2020 Jochen Kupperschmidt :License: Modified BSD, see LICENSE for details. """ from datetime import datetime from ....database import db from ....typing import PartyID, UserID from ....util....
{ "content_hash": "e2fc8194be6993d507fb1e92b147be1e", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 87, "avg_line_length": 34.73913043478261, "alnum_prop": 0.6645807259073843, "repo_name": "m-ober/byceps", "id": "61255f3d2a36b3b63d1132f315b302efda621623", "size": "1598", ...
DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', '[email protected]'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': '', # Or path to dat...
{ "content_hash": "0077e117097b9ba2f53633c390bb9284", "timestamp": "", "source": "github", "line_count": 92, "max_line_length": 115, "avg_line_length": 35.358695652173914, "alnum_prop": 0.6873655087611436, "repo_name": "fmierlo/django-default-settings", "id": "3ceab4dfc1dae213b82efa3b49755078a639c0ef"...
import test.support, unittest import os import shutil import sys import subprocess import tempfile from test import script_helper from test.script_helper import (spawn_python, kill_python, assert_python_ok, assert_python_failure) # XXX (ncoghlan): Move to script_helper and make consistent with run_python def _kil...
{ "content_hash": "de4c9f631a7936d975c3edee70b071d5", "timestamp": "", "source": "github", "line_count": 475, "max_line_length": 93, "avg_line_length": 41.15578947368421, "alnum_prop": 0.5624840145275973, "repo_name": "chidea/GoPythonDLLWrapper", "id": "cb9bbddc8c62c4d3ddb8aefbb32df421dae2fe81", "si...
import json, gzip, sys for l in sys.stdin: print json.dumps(eval(l))
{ "content_hash": "19b07009b0ab269ba696aef0ef4fe579", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 27, "avg_line_length": 18, "alnum_prop": 0.6944444444444444, "repo_name": "etrain/datascripts", "id": "0a4891454303eb51f0475f7b3d83decc3a0bc731", "size": "72", "binary": f...
import RPi.GPIO as GPIO from wombat import readadc import colorsys # pin assignments adc_chan = 2 # MCP9700 temp sensor on analog input CH2 red = 23 # red LED on GPIO 23 (active high) green = 22 # green LED on GPIO 22 (active high) blue = 27 # blue L...
{ "content_hash": "c6a9f2312c6146ff579c651b0d35f4a6", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 86, "avg_line_length": 28.220338983050848, "alnum_prop": 0.5741741741741742, "repo_name": "gooligumelec/wombat-projects", "id": "28eb82f60b61782d5d1f4651b951cfbdd52f6b01", ...
import shutil from framesource import VideoFrameSource import tempfile import decimal import rateconverter import os """ extractframes package - extract frames from a video. The top level module contains only one function, extract() which is the main way you'd accomplish frame extractions. """ # maybe refactor this...
{ "content_hash": "427a70a1a06d0ac4f698af34cd64e7db", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 92, "avg_line_length": 33.738461538461536, "alnum_prop": 0.6511627906976745, "repo_name": "robmoggach/python-moshion", "id": "dea904ed941f08ba82f3f4aac712c7ac1febe2eb", "si...
"""Fake image input pipeline. Returns the same batch of ones over and over.""" import copy from init2winit.dataset_lib import data_utils import jax import jax.numpy as jnp from ml_collections.config_dict import config_dict import numpy as np TRAIN_IMAGES = 1281167 EVAL_IMAGES = 50000 NUM_CLASSES = 1000 IMAGE_SIZE ...
{ "content_hash": "15dc71a4b03d1b3ea0b085bf5393000a", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 80, "avg_line_length": 26.526881720430108, "alnum_prop": 0.6858532630725578, "repo_name": "google/init2winit", "id": "5a4f06ac9241a8ed91d0a58922b9d7f5843fa374", "size": "30...
import numpy as np import matplotlib.pyplot as plt GRAY_SCALE_RANGE = 255 import pickle data_filename = 'data.pkl' print('Loading data from file \'' + data_filename + '\' ...') with open(data_filename, 'rb') as f: train_labels = pickle.load(f) train_images = pickle.load(f) test_labels = pickle.load(f) ...
{ "content_hash": "8078808008d3dd2ef57849195a8940e8", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 98, "avg_line_length": 33.8, "alnum_prop": 0.6777423759672281, "repo_name": "Evensgn/MNIST-learning", "id": "ed6953722cc49ebe95882f5f5a229b093be0cfb4", "size": "2197", "b...
""" Run three algorithm learning tasks: "repeat copy", "associative recall" and "priority sort" one by one. """ print("Learning algorithm_learning begin:") print("copy:") import learning_repeat_copy_lstm print("recall:") import learning_associative_recall_lstm print("sort:") import learning_priority_sort_lstm print(...
{ "content_hash": "2336b977e5d779d10c611f5d6ba3671d", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 75, "avg_line_length": 17.72972972972973, "alnum_prop": 0.6417682926829268, "repo_name": "SigmaQuan/NTM-Keras", "id": "80a6ba2df376c82a280744fe02556506d9198583", "size": "6...
import smbus import time import math import RPi.GPIO as GPIO import struct rev = GPIO.RPI_REVISION if rev == 2 or rev == 3: bus = smbus.SMBus(1) else: bus = smbus.SMBus(0) # I2C Address of Arduino address = 0x04 # Command Format # digitalRead() command format header dRead_cmd = [1] # digitalWrite...
{ "content_hash": "7d7ab1c4aaaa1b1d173ffb017ab5bee8", "timestamp": "", "source": "github", "line_count": 441, "max_line_length": 129, "avg_line_length": 30.140589569160998, "alnum_prop": 0.6841709298826362, "repo_name": "martinschaef/grovepi", "id": "40ddd5fd7e73b7d8a9d8102a8db3b467aae29988", "size"...
"""empty message Revision ID: 0059 add show_banner_text Revises: 0058 set all has_banner_text Create Date: 2021-10-04 00:10:14.535185 """ # revision identifiers, used by Alembic. revision = '0059 add show_banner_text' down_revision = '0058 set all has_banner_text' from alembic import op import sqlalchemy as sa de...
{ "content_hash": "3686eac18ca8c5bd784315bcaf264feb", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 107, "avg_line_length": 26.314285714285713, "alnum_prop": 0.6482084690553745, "repo_name": "NewAcropolis/api", "id": "f7adc3750332a50ed32b0df1afc7f5cc56b76813", "size": "92...
from django.core.management.base import BaseCommand, CommandError from django.contrib.auth import get_user_model import json from readux.annotations.models import Annotation class Command(BaseCommand): '''Import a JSON file of annotation data in the format provided by the annotator store API (i.e., search res...
{ "content_hash": "1fc68d1a4231c2b360c98364a529858b", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 107, "avg_line_length": 38.704918032786885, "alnum_prop": 0.626853028377806, "repo_name": "emory-libraries/readux", "id": "2076f85f36e48324902c18f6b2a587da1153e28b", "size"...
import os import sys import json import argparse import numpy as np import matplotlib import multiprocessing import logging matplotlib.use('agg') import matplotlib.pyplot as plt from pychemia.code.abinit import AbinitInput, AbinitOutput from pychemia.population.orbitaldftu import dmatpawu2params, params2dmatpawu, Orbi...
{ "content_hash": "5347e61dc7a58622ed05d595dc44fe8c", "timestamp": "", "source": "github", "line_count": 509, "max_line_length": 118, "avg_line_length": 35.577603143418465, "alnum_prop": 0.5584515986526036, "repo_name": "MaterialsDiscovery/PyChemia", "id": "b3d83d5ed9fbc7f28a1807f76ab08294ed0d311c", ...
""" This module contains a class for discrete 1-dimensional exponential families. The main uses for this class are exact (post-selection) hypothesis tests and confidence intervals. """ import numpy as np import warnings from ..truncated.api import find_root def crit_func(test_statistic, left_cut, righ...
{ "content_hash": "4cac0e486555a476bfb0f4c513e7a576", "timestamp": "", "source": "github", "line_count": 806, "max_line_length": 124, "avg_line_length": 30.393300248138956, "alnum_prop": 0.5120627015552924, "repo_name": "selective-inference/selective-inference", "id": "5c6e6fc23df3d182a38d0e4a4de3e539...
from model.group import Group import pytest def test_add_group(app, db, json_groups): group = json_groups with pytest.allure.step('Given a group list'): old_groups = db.get_group_list() with pytest.allure.step('When I add a group %s to the list' % group ): app.group.create(group) with ...
{ "content_hash": "62e82b66757c77b06db2067aa61652ce", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 100, "avg_line_length": 36.625, "alnum_prop": 0.6672354948805461, "repo_name": "PaulRumyantsev/python_QA", "id": "026f0b4523476ea08ebfed656644f15dcf717e9c", "size": "610", ...
from cattle import ApiError from common_fixtures import * # NOQA def _create_virtual_machine(client, context, **kw): args = { 'accountId': context.project.id, 'imageUuid': context.image_uuid, } args.update(kw) return client.create_virtual_machine(**args) @pytest.fixture(scope='mod...
{ "content_hash": "fe56ac0c7c957f1fe4a617ab2ed0cc7c", "timestamp": "", "source": "github", "line_count": 409, "max_line_length": 75, "avg_line_length": 31.149144254278728, "alnum_prop": 0.6010989010989011, "repo_name": "stresler/cattle", "id": "662771752b0a6c8c14b3cc1b602c67baba3510eb", "size": "127...
""" CLI tool for retrieving artifacts from CircleCI Usage: circleci-getter [--debug] --user=USER --project=PROJECT [--branch=BRANCH] [--filter=FILTER] [--out=OUT] [--token=TOKEN] Options: --debug Print debug info --help Print this message --user=USER GitHub organisation name or us...
{ "content_hash": "7163737006f098880142300f2da240e0", "timestamp": "", "source": "github", "line_count": 154, "max_line_length": 120, "avg_line_length": 35.23376623376623, "alnum_prop": 0.6566531514928123, "repo_name": "transisland/circleci-artifact-getter", "id": "57076783c5227aa8984e0e0e5cb41c9a2c26...
"""A module for capturing time-related functions. This makes mocking for time-related functionality easier. """ import calendar import datetime import re import time def CurrentTimeSec(): """Returns a float of the current time in seconds.""" return time.time() def Sleep(duration_sec): """Sleeps for the given...
{ "content_hash": "6a4739e5f5a0c58eaf1f59bcf15d767b", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 78, "avg_line_length": 28.268817204301076, "alnum_prop": 0.6610878661087866, "repo_name": "flgiordano/netcash", "id": "773bc9824a34576cef31a4adf9887eb7cf609a27", "size": "3...
__author__ = 'mario' import SafeBehaviour class BatteryFailsafeBehaviour(SafeBehaviour.SafeBehaviour): """ Defines a battery failsafe behaviour. If the battery is below a certain threshold, the behaviour sends a message requesting to land. """ def __init__(self, battery, minimum_voltage, vehicle...
{ "content_hash": "293ba58bc0267fb41638b9f6bdd17a38", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 98, "avg_line_length": 31.357142857142858, "alnum_prop": 0.6617312072892938, "repo_name": "mhct/droneuaw", "id": "576c6a76a04d30675881074d9e338784c8aaa535", "size": "878", ...
''' Created on 2014-3-27 @author: Hali ''' import sys import os import Image from PlistParser import Frame def printUsage(): print "Usage: ImageUtils.py [-s input=srcImgPath outSize=[(width,heigh)|(x,y,width,heigt)] outPath=outPath]" print " [-c input=srcImgPath srcRect=(x,y,w,h) outPath=...
{ "content_hash": "d8236488ed0ee9d79ca6165cbb98c3ac", "timestamp": "", "source": "github", "line_count": 190, "max_line_length": 132, "avg_line_length": 33.705263157894734, "alnum_prop": 0.5271705184259837, "repo_name": "ywl19891989/PlistParseUtils", "id": "2266751aef2f132dfd969a77b3f0b1c0131b7fad", ...
import json import os import re import sys from pathlib import Path from subprocess import Popen, PIPE from urllib.parse import urlsplit, urlunsplit from testfixtures import LogCapture from twisted.internet import defer from twisted.trial.unittest import TestCase from scrapy.http import Request from scrapy.utils.test ...
{ "content_hash": "7c4980b517c097dc179846937e700027", "timestamp": "", "source": "github", "line_count": 112, "max_line_length": 85, "avg_line_length": 34.794642857142854, "alnum_prop": 0.6138054914036438, "repo_name": "scrapy/scrapy", "id": "ea7701b5d1769e834cc8fa40013844e48caced03", "size": "3897"...
from .utils import Utils import json import socket class SocketException(Exception): pass class SocketUtils: end_delim = b"\r\n\r\n" @staticmethod def send_json(address, port, msg, recv=False): encoded_msg = Utils.safe_enc(json.dumps(Utils.safe_dec(msg))) return SocketUtils.send(addr...
{ "content_hash": "34e182152cf79dfd793d0f441451b10e", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 72, "avg_line_length": 27.857142857142858, "alnum_prop": 0.5393162393162393, "repo_name": "billychasen/billots", "id": "859a64f15e2a7dbe0b27d1edf21319927fff45d2", "size": "...
""" premium question """ # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def __init__(self): self.sums = [] def checkEqualTree(self, root: TreeNode) -> bool: """ To...
{ "content_hash": "df5c99584bf18ac98a70a44d6561d0cf", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 84, "avg_line_length": 22.056338028169016, "alnum_prop": 0.5019157088122606, "repo_name": "algorhythms/LeetCode", "id": "b93549dd17858a35a3f45794079f28ca118bec7f", "size": ...
import requests import sys, argparse import os import hashlib import json YAHOO_API_URL="https://query.yahooapis.com/v1/public/yql" YAHOO_API_PARAMS={"format":"json","env":"store%3A%2F%2Fdatatables.org%2Falltableswithkeys"} def main(args): for yqlquery in args.infile: filename=hashlib.md5(yqlquery.encode('utf-8')...
{ "content_hash": "37cb1a2414a92c2a068a3fb177cff4ae", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 131, "avg_line_length": 46.172413793103445, "alnum_prop": 0.6855862584017924, "repo_name": "lloydroc/stockcrawl", "id": "1775d06a2b6ba448525fc73e60ec65b56886fe97", "size": ...
import os from datadog_checks.dev import get_docker_hostname, get_here HOST = get_docker_hostname() PORT = os.getenv('POWERDNS_HOST_PORT_0', 8082) HERE = get_here() POWERDNS_RECURSOR_VERSION = os.environ['POWERDNS_RECURSOR_VERSION'] CONFIG = {"host": HOST, "port": PORT, "api_key": "pdns_api_key"} CONFIG_V4 = {"hos...
{ "content_hash": "a22e684eb76e2da2939f4d41226da9d9", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 81, "avg_line_length": 28.814814814814813, "alnum_prop": 0.6542416452442159, "repo_name": "DataDog/integrations-core", "id": "c0aa68405633a289e8386ccf101ba80ba6b407d7", "si...
import pywaves import logging class Asset(object): def __init__(self, assetId, pywaves=pywaves): self.pywaves = pywaves self.assetId='' if assetId == pywaves.DEFAULT_CURRENCY else assetId self.issuer = self.name = self.description = '' self.quantity = self.decimals = 0 self....
{ "content_hash": "92484d33314bde7872fbc111f555b239", "timestamp": "", "source": "github", "line_count": 177, "max_line_length": 195, "avg_line_length": 37.31073446327684, "alnum_prop": 0.5557238037552998, "repo_name": "PyWaves/PyWaves", "id": "06ca768767efcc07fc3623d36a0d6ff0fa1c8758", "size": "660...
import mysql.connector from model.Clases import Group from model.Clases import Contact class DbFixture: def __init__(self, host, name, user, password): self.host = host self.name = name self.user = user self.password = password self.connection = mysql.connector.connect(hos...
{ "content_hash": "35ef8556e9d86a24733d8ee85888f165", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 114, "avg_line_length": 44.22, "alnum_prop": 0.5866123925825418, "repo_name": "Bartk0/PythonTraining", "id": "5a2977a5f3fc6e3c410290e448fdd764df2c6aad", "size": "2211", "...