text
stringlengths
4
1.02M
meta
dict
def NumberGameIII(S): flag_max = True min_number = min(S) for elem in S: quotient = float(elem)/float(min_number) flag = quotient - int(quotient) if flag != 0.0: flag_max = False if flag_max: return min_number else: return -1
{ "content_hash": "bee18ecdb1481d056936be3b1fd4e305", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 48, "avg_line_length": 23.923076923076923, "alnum_prop": 0.5144694533762058, "repo_name": "TheSriram/codefightchallenges", "id": "a13d06b688a82c0ea015b72936e8beca106a5392", ...
from utils.splunk_search_util import ( get_search_response, get_session_key, preprocess_search, run_search, ) def test_extend_index(eventgen_test_helper): """Test extendIndexes config""" eventgen_test_helper("eventgen_extend_index.conf").get_events() session_key = get_session_key() se...
{ "content_hash": "9340fc748b242511011b515202bff44f", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 82, "avg_line_length": 32.56521739130435, "alnum_prop": 0.6795727636849133, "repo_name": "splunk/eventgen", "id": "f2eb3a3be6e2b4f45abd0b25bacb6c51c6cb259d", "size": "749",...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import fnmatch import os import re import sys from setuptools import find_packages, setup, Command from setuptools.command.install import install as InstallCommandBase from setuptools.dist import Distribution ...
{ "content_hash": "9ac68eb2609090f7ab2fef1fb6d04b34", "timestamp": "", "source": "github", "line_count": 245, "max_line_length": 83, "avg_line_length": 33.265306122448976, "alnum_prop": 0.6533742331288344, "repo_name": "eaplatanios/tensorflow", "id": "f676f040ad3ebc7f377c7a4c224c5dba95f2f108", "size...
''' Copyright 2015 Ivan Sadikov 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.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software d...
{ "content_hash": "497bfd06ac648365468bbcd14bc83887", "timestamp": "", "source": "github", "line_count": 169, "max_line_length": 88, "avg_line_length": 32.218934911242606, "alnum_prop": 0.6637281910009183, "repo_name": "sadikovi/pulsar", "id": "f639b467eaee974194a0e948b28a135dbed01067", "size": "546...
from ref.demo_items import create_full_test_data from scm.models import LogicalComponentVersion, InstallationMethod, Delivery, \ InstallableItem from ref.models import LogicalComponent, ComponentImplementationClass from django.db.transaction import atomic @atomic def create_test_is(): res = [] create_full_...
{ "content_hash": "8cdc3a6e1e69be07c4969c78d56f2900", "timestamp": "", "source": "github", "line_count": 179, "max_line_length": 195, "avg_line_length": 35.14525139664804, "alnum_prop": 0.6943252265140677, "repo_name": "digitalfox/MAGE", "id": "47fd824deb4827afeb8692d055d9506fba943e98", "size": "630...
from django.contrib.auth.models import User from rest_framework import status from rest_framework.test import APITestCase from cyidentity.cycontacts.models import Contact, Address, EmailAddress, PhoneNumber import json class ContactAPITestCase(APITestCase): def setUp(self): Contact.objects.all().delete()...
{ "content_hash": "42c8df85119564ed8fc61378a9536004", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 86, "avg_line_length": 34.2970297029703, "alnum_prop": 0.5894919168591224, "repo_name": "shawnhermans/cyborgcrm", "id": "81185a1d893d2ac2ab61d1ea7d2027030a4961c7", "size":...
"""Generic Node base class for all workers that run on hosts.""" import inspect import os import random from oslo_concurrency import processutils from oslo_config import cfg from oslo_db import exception as db_exc from oslo_log import log as logging import oslo_messaging as messaging from oslo_utils import importuti...
{ "content_hash": "dd59d7e4564d9e8f5b8bf406331a97d1", "timestamp": "", "source": "github", "line_count": 455, "max_line_length": 79, "avg_line_length": 36.68791208791209, "alnum_prop": 0.5799436889714251, "repo_name": "tmenjo/cinder-2015.1.1", "id": "26403912e729c7c3fd85f4c71c68daee72301679", "size"...
from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.ConfFiles import ConfFile, ConfFiles from PLC.Nodes import Node, Nodes from PLC.Auth import Auth class AddConfFileToNode(Method): """ Adds a configuration file to the specified node. If the node is al...
{ "content_hash": "f333830d678b0ffcbd90c9530417ae2f", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 69, "avg_line_length": 29.96078431372549, "alnum_prop": 0.606020942408377, "repo_name": "dreibh/planetlab-lxc-plcapi", "id": "404b8e215409bc436fcecd8ef32225212b57cbf3", "si...
from __future__ import unicode_literals import json import logging import re import uuid from collections import defaultdict from django import forms from django.conf import settings from django.conf.urls import patterns, url from django.contrib.sites.models import Site from django.core.cache import cache from django...
{ "content_hash": "f89d5377c8ffa5ee45123cf0f56272bd", "timestamp": "", "source": "github", "line_count": 1022, "max_line_length": 80, "avg_line_length": 37.31800391389432, "alnum_prop": 0.5380581556936469, "repo_name": "1tush/reviewboard", "id": "179735f66ca6dfffb8ffa2b9a2b11860e8be0153", "size": "3...
import unittest import sys sys.path.append('..') from bs4 import BeautifulSoup from app import app from app.user import User class TestLoginAndLogout(unittest.TestCase): """ Class to test login and logout of users """ def setUp(self): app.config['TESTING'] = True app.debug = False ...
{ "content_hash": "3fd9e0804d4d741450c0a2b7efaf7fc0", "timestamp": "", "source": "github", "line_count": 156, "max_line_length": 88, "avg_line_length": 32.756410256410255, "alnum_prop": 0.5874755381604697, "repo_name": "PradheepShrinivasan/picourl", "id": "c8adaf34def5338ff2585c9b9cd8779809e0701e", ...
"""A library that uses the recon service to map lat/lng to DC places. See latlng_recon_service_test.py for usage example. """ import requests _RECON_ROOT = 'https://api.datacommons.org/v1/recon/resolve/coordinate' _RECON_COORD_BATCH_SIZE = 50 def _call_resolve_coordinates(id2latlon, filter_fn, verbose): revmap...
{ "content_hash": "21392038e25acb48b8c62183245f35cd", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 80, "avg_line_length": 35.666666666666664, "alnum_prop": 0.6091019910605445, "repo_name": "datacommonsorg/data", "id": "d49f990559d2b88c5c82b3daff5682b53e3731e0", "size": "...
{ 'task': { 'taskid': str, # new, not change 'project': str, # new, not change 'url': str, # new, not change 'status': int, # change 'schedule': { 'priority': int, 'retries': int, 'retried': int, 'exetime': int, 'age': i...
{ "content_hash": "c38f5019cd9ff5f9dccde6af076421af", "timestamp": "", "source": "github", "line_count": 72, "max_line_length": 60, "avg_line_length": 26, "alnum_prop": 0.42735042735042733, "repo_name": "wyrover/pyspider", "id": "89f2e0a9e8c9a65c5b64240675a66df613cfa099", "size": "2071", "binary":...
import web class Index(object): def GET(self): return "home"
{ "content_hash": "021fe56c3008feebc35f87137680ae95", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 20, "avg_line_length": 12.5, "alnum_prop": 0.6, "repo_name": "coupain/cs-s01-e01", "id": "f62124c7b93c9f7331b9f16eb9ba71b5b906a413", "size": "100", "binary": false, "cop...
from copy import deepcopy from math import ceil, floor, log from abc import abstractmethod from numbers import Integral import numpy as np from ._search import _check_param_grid from ._search import BaseSearchCV from . import ParameterGrid, ParameterSampler from ..base import is_classifier from ._split import check_cv...
{ "content_hash": "55f09d71329879d84c68736bab6f0bdf", "timestamp": "", "source": "github", "line_count": 1047, "max_line_length": 88, "avg_line_length": 40.69149952244508, "alnum_prop": 0.6218195474603324, "repo_name": "amueller/scikit-learn", "id": "1271691d05b7ba1f97b3798178df1d985a9ceaa9", "size"...
import csv import os from purchases import Purchase def fibonacci_blocking(limit): nums = [] current, nxt = 0, 1 for _ in range(1, limit): current, nxt = nxt, current + nxt nums.append(current) return nums def fibonacci(): current, nxt = 0, 1 while True: current, nx...
{ "content_hash": "2da135131b9f5beb279551b74e1b5e93", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 71, "avg_line_length": 19.063291139240505, "alnum_prop": 0.5272244355909694, "repo_name": "Wintellect/WintellectWebinars", "id": "a6f540a2b4b02a1e13ec399b8ca55d39e0adf3a7", ...
"""Setup the MySQL-compatible database. If run directly, this module will setup the ClashCallerBot database with tables and display their format and contents. Additionally, this module provides a class with various methods for managing the MySQL-compatible database: * Create database and tables. * View table data and...
{ "content_hash": "4fc8911a926654c2001eaa62aeb10f06", "timestamp": "", "source": "github", "line_count": 487, "max_line_length": 118, "avg_line_length": 33.58316221765914, "alnum_prop": 0.5939468052583308, "repo_name": "JoseALermaIII/clashcallerbot-reddit", "id": "a908d2f81a1ad9b982b337a337d3ef14bb5cb...
def capitalize_first_letter(s): if s and len(s) > 1: capitalized = s[0].upper() + s[1:] return capitalized return ''
{ "content_hash": "50207ef731bd04ee0f0a0aa568db4f25", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 42, "avg_line_length": 28.2, "alnum_prop": 0.5602836879432624, "repo_name": "talbor49/Poet", "id": "cbb8c80cee7a2a03de37f3c023e1c467bdb686f5", "size": "141", "binary": fal...
from framework.models.common import NdbModel from mcfw.rpc import serialize_complex_value, parse_complex_value def convert_to_unicode(v): if v is None: return None if isinstance(v, str): return v.decode('utf-8') return v class TO(object): def __str__(self): # Useful when deb...
{ "content_hash": "20ec3d785409065394e14dd792419a1d", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 99, "avg_line_length": 35.21052631578947, "alnum_prop": 0.5700049825610364, "repo_name": "rogerthat-platform/gae-plugin-framework", "id": "d61f45f9cd85cdd8806e51e33421f9d9573...
from zeit.cms.i18n import MessageFactory as _ import datetime import pytz import re import zope.app.container.interfaces import zope.i18nmessageid import zope.interface import zope.interface.common.sequence import zope.schema import zope.security DOCUMENT_SCHEMA_NS = u"http://namespaces.zeit.de/CMS/document" QPS_SCHE...
{ "content_hash": "2d261a2ba9ffa934668bb05b1abd22bf", "timestamp": "", "source": "github", "line_count": 145, "max_line_length": 77, "avg_line_length": 27.386206896551723, "alnum_prop": 0.6789221858473936, "repo_name": "ZeitOnline/zeit.cms", "id": "df87e292281d391bb01019fa6347c9261ab1b75f", "size": ...
from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Producto', fields=[ ('id', models.AutoField(verbose_name='ID', serializ...
{ "content_hash": "aa25996c47b45052015ffd2a458d3b7d", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 114, "avg_line_length": 25.956521739130434, "alnum_prop": 0.541038525963149, "repo_name": "DJMora/Djember", "id": "f8d2cdbc8815bbb26fc6424215d1cf54f0350e2d", "size": "621",...
import numpy as np import matplotlib.pyplot as plt from pyroomacoustics.directivities import ( DirectivityPattern, DirectionVector, CardioidFamily, ) pattern = DirectivityPattern.HYPERCARDIOID orientation = DirectionVector(azimuth=0, colatitude=45, degrees=True) # create cardioid object dir_obj = Cardio...
{ "content_hash": "b99efa0fd8f4de4c06d195e4d8a93253", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 75, "avg_line_length": 29.09090909090909, "alnum_prop": 0.778125, "repo_name": "LCAV/pyroomacoustics", "id": "fe10bbae8500e5f437097d84861dd3d6653cc386", "size": "640", "b...
import os import re import codecs from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) # Read the version number from a source file. # Why read it, and not import? # see https://groups.google.com/d/topic/pypa-dev/0PkjVpcxTzQ/discussion def find_version(*file_paths): # Op...
{ "content_hash": "6ca2d83131d5c3e813d8341f61644248", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 77, "avg_line_length": 29.402439024390244, "alnum_prop": 0.60348403152219, "repo_name": "sivel/mu", "id": "f259c9e3e51eae3ec164317288387befc95b16cf", "size": "3083", "bin...
r"""Memoizing decorators memoize is for functions with args only (no kw args) Memoize is for instance methods """ from functools import partial def memoize(f): """ Memoization decorator for functions taking one or more arguments. """ class Memodict(dict): r"""Memodict inherits dict to store already...
{ "content_hash": "a2c2880dea8f68eddc84102ff57c58f3", "timestamp": "", "source": "github", "line_count": 70, "max_line_length": 78, "avg_line_length": 28.34285714285714, "alnum_prop": 0.5952620967741935, "repo_name": "fullmar/corelib", "id": "5b86a5c0ebd94a9ac312a64a3d02fafebb3df00a", "size": "2009"...
"""Shared utils for Federated Reconstruction training and evaluation.""" from collections.abc import Callable from typing import Optional import tensorflow as tf from tensorflow_federated.python.learning.models import model_weights from tensorflow_federated.python.learning.reconstruction import model as model_lib #...
{ "content_hash": "bf903cd6e806386c82e564bdadba0be0", "timestamp": "", "source": "github", "line_count": 156, "max_line_length": 82, "avg_line_length": 45.38461538461539, "alnum_prop": 0.7275423728813559, "repo_name": "tensorflow/federated", "id": "d8ae62439bb7fa8dc115843af12a1009523ead52", "size": ...
from __future__ import unicode_literals from gum.indexer import MappingType, indexer from gum.tests.test_app.models import Post, CommentThread, Comment class PostMappingType(MappingType): def document(self, instance): tags_text = " ".join(map(lambda x: x.label, instance.tags.all())) return { ...
{ "content_hash": "f6fd3e6ea352495d0241f33f511fe0d4", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 82, "avg_line_length": 28.09090909090909, "alnum_prop": 0.40722761596548, "repo_name": "marcosgabarda/django-gum", "id": "8be27482869541756afa7b6abc340e9f414a7717", "size":...
import argparse import os import re def basename(path): return os.path.splitext(os.path.basename(path))[0] def char_escape(c): # Escaping suitable for Protobuf text format, which is C-like. if c in "'\"\\": return "\\" + c elif c == "\n": return "\\n" else: return c def...
{ "content_hash": "ef5603dbdff0b4456be0dba7e4a50ae9", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 80, "avg_line_length": 33.3968253968254, "alnum_prop": 0.5850760456273765, "repo_name": "chromium/chromium", "id": "49792626d9efca908e4a6331aab59493919fa47d", "size": "2267...
from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations ...
{ "content_hash": "fa1a15e643b184da2a8a87cfb5ffcd50", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 146, "avg_line_length": 42.81818181818182, "alnum_prop": 0.5910828025477707, "repo_name": "he305/google-analytics-site", "id": "17735d3978cfa07a3f95d07efd849ef7457b3f78", "...
import sys, os, turtle def turtledraw(): turtle.Turtle(); turtle.pendown(); turtle.left(100); def main(): turtledraw(); turtle.done(); main(); print("Hello");
{ "content_hash": "6882ad00c230620dea9c166c5dd4a466", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 22, "avg_line_length": 9.45, "alnum_prop": 0.5767195767195767, "repo_name": "defunSM/code", "id": "7e762533201d6d66376340fdefb64cf46822f7d8", "size": "189", "binary": fal...
from django.contrib import admin from django.contrib.redirects.models import Redirect from django.contrib.sites.shortcuts import get_current_site from django.core.urlresolvers import reverse from django.db.models import QuerySet, F from django.utils.html import format_html from django.utils.translation import ugettext_...
{ "content_hash": "b69d0b2aad7b376a7b83ed711506d27c", "timestamp": "", "source": "github", "line_count": 191, "max_line_length": 94, "avg_line_length": 32.45026178010471, "alnum_prop": 0.5792191029364311, "repo_name": "fidals/refarm-site", "id": "88d628048aa550d946333ac7c13fa997cbe4e526", "size": "6...
import sys import aleph as al try: import numpy as np except ImportError: sys.exit(0) import unittest class TestSimplexMethods(unittest.TestCase): def test_construction(self): pass M = al.SimplicialComplex([[0], [1], [2], [1, 0], [2, 0]]) diagram = al.calculatePersistenceDiagrams(M)[0] numpy_di...
{ "content_hash": "503662228a73d5a86ea2cf7904735a5d", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 57, "avg_line_length": 21.227272727272727, "alnum_prop": 0.6809421841541756, "repo_name": "Submanifold/Aleph", "id": "45f4f5029984ffdc0e9a9d59ee3a19a5cb880909", "size": "49...
import matplotlib.pyplot as plt import numpy as np import wave import sys def plotWaveform(audio): """ Plotting the waveform of a wav file """ spf = wave.open(audio,'r') signal = spf.readframes(-1) signal = np.fromstring(signal, 'Int16') fs = spf.getframerate() if spf.getnchannels() == ...
{ "content_hash": "310ff0ca7896a3fe5830f8e39a72bfee", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 56, "avg_line_length": 25.238095238095237, "alnum_prop": 0.630188679245283, "repo_name": "zzw922cn/Automatic_Speech_Recognition", "id": "aabb3332a1e21581168d5ef30132b73b286ac...
import os import sys from business_theme import __version__ as version try: from setuptools import setup except ImportError: from distutils.core import setup install_requires = [ 'mezzanine >= 3.1', ] if sys.argv[-1] == 'publish': os.system('python setup.py sdist upload') p...
{ "content_hash": "6509c2151e797831458e54d3b7cfb06f", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 65, "avg_line_length": 28.74074074074074, "alnum_prop": 0.601159793814433, "repo_name": "dfalk/mezzanine-business-theme", "id": "1ca9a67a1ce6f9cfb58fc369d13cd28325626a72", ...
import urllib2, json, os, sys HEADER = ''' Redirect = { image: function(board, filename) { switch (board) { ''' POST = ''' } }, post: function(board, postID) { switch (board) { ''' TO = ''' } }, to: function(data) { var board, threadID, url; if (!data.isSearch) { ...
{ "content_hash": "c2ad99911d1be0c9bf128bbef04d42de", "timestamp": "", "source": "github", "line_count": 220, "max_line_length": 97, "avg_line_length": 24.96818181818182, "alnum_prop": 0.5851083196795922, "repo_name": "loadletter/4chan-x", "id": "670c0318dc6d86fd269bad928dc7ecad0cf6902b", "size": "5...
from game_object import GameObject class Trait(GameObject): def __init__(self, name, description): self.name = name self.description = description def __str__(self): return '{}: {}'.format(self.name, self.description)
{ "content_hash": "331ee90fadbba7e5bee85efb83e21b20", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 59, "avg_line_length": 25.3, "alnum_prop": 0.6284584980237155, "repo_name": "chris-statzer/knuckle-python", "id": "39a54146118dc7293f9cc9d3c4d6da0b697f4691", "size": "253",...
"""8-bit string definition for Python 2/3 compatibility""" try: bytes = bytes try: _NULL_8_BYTE = bytes( '\000','latin1' ) except TypeError, err: # 2.6 or 2.7, where bytes is the old str object _NULL_8_BYTE = bytes( '\000' ) def as_8_bit( x, encoding='utf-8' ): if isinsta...
{ "content_hash": "086790896d9a93525f4135b5be6c6ef0", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 58, "avg_line_length": 33.05263157894737, "alnum_prop": 0.5589171974522293, "repo_name": "Universal-Model-Converter/UMC3.0a", "id": "1e29029f9e63c153e4d63f31e035685643056d4d"...
from __future__ import annotations
{ "content_hash": "5de1980dee48c44fc3e850f3a8b673f6", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 34, "avg_line_length": 35, "alnum_prop": 0.7714285714285715, "repo_name": "edgedb/edgedb", "id": "9d48db4f9f85e1752cf424c49ee18a6907c3f160", "size": "35", "binary": false,...
import sys import random from nose.tools import * from mock import patch from docopt import docopt, DocoptExit from schema import Schema, SchemaError, And, Or, Use import randfilter def make_docdict(f, n, p, u, i, h, v): return { '-n':n, '-p':p, '--unorder':u, '--ignore-empty':i, ...
{ "content_hash": "af072910e668dd1b5ed54ea13ce84e55", "timestamp": "", "source": "github", "line_count": 239, "max_line_length": 102, "avg_line_length": 30.347280334728033, "alnum_prop": 0.5683165586653799, "repo_name": "ton1517/randfilter", "id": "20d0029dada9de290eeff34b02ca38f4a381b0fe", "size": ...
from __future__ import absolute_import, unicode_literals from config.template_middleware import TemplateResponse from gaecookie.decorator import no_csrf from gaepermission.decorator import login_not_required @login_not_required @no_csrf def index(nome='paulo',sobrenome='henrique'): dct = {'name':nome,'lastname':so...
{ "content_hash": "80ba0a94658f2c2703f8d113e1672e40", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 103, "avg_line_length": 42.27272727272727, "alnum_prop": 0.7849462365591398, "repo_name": "HenriquePaulo/projeto", "id": "70d9cd7b95dca292d3f7768eabd1379ca58ddeb9", "size":...
class GtkSharp212ReleasePackage (Package): def __init__ (self): Package.__init__ (self, 'gtk-sharp', '2.12.21', sources = ['http://download.mono-project.com/sources/gtk-sharp212/gtk-sharp-2.12.21.tar.gz']) # self.configure = './bootstrap-2.12 --prefix="%{prefix}"' self.make = 'make CSC=gmcs' GtkSharp212ReleaseP...
{ "content_hash": "4e2efd693bd7dd92057d2667aa5b3b91", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 143, "avg_line_length": 47.142857142857146, "alnum_prop": 0.6848484848484848, "repo_name": "BansheeMediaPlayer/bockbuild", "id": "f4c2f9b9433259df7b779fa51f203ace860d0d4d", ...
"""Convert Numbers to Words. This package is mostly meant for financial purposes. Where you need to convert some number into words. For instance : 1. (1001 - One Thousand And One) 2. (2032 - Two Thousand And Thirty Two) 3. (10,001 - Ten Thousand And One) """ import math class NumbersBaseWrapper(object): ...
{ "content_hash": "cbfdf392d07fdcc4a2a5229c48fbb59b", "timestamp": "", "source": "github", "line_count": 145, "max_line_length": 78, "avg_line_length": 30.193103448275863, "alnum_prop": 0.5166742804933759, "repo_name": "yoda-yoda/numbers-to-words", "id": "3071a3369958446bfadaa94ed106cef6d578498b", "...
import time # pylint: disable=unused-import,g-bad-import-order from grr.lib import server_plugins # pylint: enable=unused-import,g-bad-import-order from grr.lib import aff4 from grr.lib import config_lib from grr.lib import flags from grr.lib import flow from grr.lib import rdfvalue from grr.lib import stats from gr...
{ "content_hash": "a34c47e813cc90839d271610919812c7", "timestamp": "", "source": "github", "line_count": 596, "max_line_length": 80, "avg_line_length": 39.46308724832215, "alnum_prop": 0.6507227891156463, "repo_name": "defaultnamehere/grr", "id": "c47f5bd724e9ac89f08032a9d1d6e5f48e02b8d4", "size": "...
""" Copyright (c) 2014,掌阅科技 All rights reserved. 摘 要: agent.py 创 建 者: zhuangshixiong 创建日期: 2015-08-26 """ import urllib import operator import json from difflib import Differ from tornado.web import authenticated from peewee import OperationalError from kazoo.exceptions import NoNodeError from handler.bases import...
{ "content_hash": "0a66402c710eefabb24dde346594279e", "timestamp": "", "source": "github", "line_count": 296, "max_line_length": 91, "avg_line_length": 31.091216216216218, "alnum_prop": 0.5747039009018798, "repo_name": "wolfelee/zkdash", "id": "546ac3b2e5eeefb18738dee46e79f3a1fe88e878", "size": "952...
''' config constants for training neural net ''' # the remainder is allocated as test data PERCENT_FOR_TRAINING_DATA = .90 # the patch size for both the 32 and 64 feature convolutions # used with an NxN tile, where N has usually been 64 CONVOLUTION_PATCH_SIZE = 5 # where training data gets cached from bin/creat...
{ "content_hash": "ee5c65c21aeb736af623bc1f935873ac", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 66, "avg_line_length": 28.307692307692307, "alnum_prop": 0.7391304347826086, "repo_name": "silberman/Deep-OSM", "id": "0a64f846e20f1ffc7fe69b0d1db607074fa9ca13", "size": "3...
from __future__ import unicode_literals from __future__ import absolute_import import uuid __author__ = "[email protected]" import platform import re import socket import sys import time import io import ssl import os import six from six.moves import map from six.moves import range import six.moves.http_client fr...
{ "content_hash": "a8613134e13b66ff386e77227147c90e", "timestamp": "", "source": "github", "line_count": 2195, "max_line_length": 134, "avg_line_length": 43.214578587699314, "alnum_prop": 0.6108416968879143, "repo_name": "imron/scalyr-agent-2", "id": "572ca87c1cf0068bae0889c6bb5faf7ae98bedd4", "size...
"""Module for object related utils.""" #: Supported container types for serialization/de-serialization (must be a #: tuple as it's used as a parameter for C{isinstance}) _SEQUENCE_TYPES = (list, tuple, set, frozenset) class AutoSlots(type): """Meta base class for __slots__ definitions. """ def __new__(mcs, n...
{ "content_hash": "c8075b54356e41b4950866e37093985c", "timestamp": "", "source": "github", "line_count": 130, "max_line_length": 77, "avg_line_length": 28.29230769230769, "alnum_prop": 0.6653072321914084, "repo_name": "apyrgio/snf-ganeti", "id": "d25c06f8df70b9db7a98a7d8654b1154f38b01f6", "size": "5...
import sys, os, time, atexit from signal import SIGTERM import argparse ## Defines the Daemon base class # # \note \par Subclassing # This class should be subclased. The only thing that needs to be overrided is the run function. class Daemon: """ A generic daemon class. Usage: subclass ...
{ "content_hash": "094356f024a29e800425826dca83df52", "timestamp": "", "source": "github", "line_count": 203, "max_line_length": 127, "avg_line_length": 38.13793103448276, "alnum_prop": 0.42495479204339964, "repo_name": "radding/PythonDaemon", "id": "f91c2b79f104188427b0fcac0c1b11b7b16007b4", "size"...
from __future__ import division, print_function import os, json from glob import glob import numpy as np from scipy import misc, ndimage from scipy.ndimage.interpolation import zoom from keras.utils.data_utils import get_file from keras import backend as K from keras.layers.normalization import BatchNormalization fro...
{ "content_hash": "daf36e2e112ae7df69341a07b8c19593", "timestamp": "", "source": "github", "line_count": 152, "max_line_length": 118, "avg_line_length": 34.5, "alnum_prop": 0.6380625476735317, "repo_name": "briandalessandro/courses", "id": "23f33738ade0b45fa92479e9dca7d80b852d8ae6", "size": "5244", ...
from behave import given import os import shlex import shutil import subprocess as sp import sure @given(u'a fresh machine with mkdo installed') def step_impl(context): docker_dir = 'docker' docker_name = 'mkdo/acceptance-test-run' shutil.rmtree(docker_dir, ignore_errors=True) os.mkdir(docker_dir) ...
{ "content_hash": "5d22765de2ab86b7072efc34dbb5d91a", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 84, "avg_line_length": 33.09836065573771, "alnum_prop": 0.6092124814264487, "repo_name": "ben--/mkdo", "id": "32efb133b6fd4bcfcaf3d38753c62b51bc0e4918", "size": "2019", "...
token_query = ''' SELECT T.token, count(*) as C FROM "TokenLinks" TL JOIN "Token" T ON T.tokenid = TL.target WHERE TL.source = (SELECT tokenid FROM "Token" T WHERE T.token = :token) AND TL.distance > -4 AND TL.distance < 28 and T.dateid=:id GROUP BY T.token HAVING count...
{ "content_hash": "4bd998b3c8028da3755d8a48be111b64", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 62, "avg_line_length": 24.485714285714284, "alnum_prop": 0.5822637106184364, "repo_name": "Ropes/PDX-Council-Minutes-Data", "id": "e496ca8cd3c6c8a935e572c85b59ba68ea5883ec", ...
""" Module: mediahandler.types.audiobooks Module contains: - |MHAudiobook| Child class of MHMediaType for the audiobooks media type. - |get_book_info()| Makes API request to Google Books and returns results. """ import os import re from re import search import logging from math import ceil ...
{ "content_hash": "ae629b8c54577534ceec45e5c624c406", "timestamp": "", "source": "github", "line_count": 671, "max_line_length": 78, "avg_line_length": 32.20864381520119, "alnum_prop": 0.5573755321117897, "repo_name": "ErinMorelli/em-media-handler", "id": "290867552a8c42f94571c8486afb87b62b3a8c01", ...
"""Support for displaying persistent notifications.""" from collections import OrderedDict import logging from typing import Any, Mapping, MutableMapping, Optional import voluptuous as vol from homeassistant.components import websocket_api from homeassistant.const import ATTR_FRIENDLY_NAME from homeassistant.core imp...
{ "content_hash": "3266481faeb49f8046a4b200a124192d", "timestamp": "", "source": "github", "line_count": 230, "max_line_length": 87, "avg_line_length": 31.97826086956522, "alnum_prop": 0.6397008837525493, "repo_name": "partofthething/home-assistant", "id": "589cc97baeafd919cd2d4fe54dffdcd612241ffb", ...
from django.shortcuts import render, get_list_or_404, get_object_or_404 from django.contrib.auth.decorators import login_required from django.db import IntegrityError from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect from .models import Todo # Create your views here. @login_req...
{ "content_hash": "e2a24795b855bd40d8144a5119866592", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 105, "avg_line_length": 31.915254237288135, "alnum_prop": 0.6494954859267127, "repo_name": "kodingway/django-teardown-todo", "id": "542d44457cfde21c787ddc24eb11591c2f4a3ad0",...
import concurrent.futures import functools import peewee from feedbuffer import settings, log _database = peewee.SqliteDatabase(settings.DATABASE_PATH) _logger = log.get_logger(__name__) # Easy way to queue function calls and execute them in a single thread, without having to manually write # producer-consumer logi...
{ "content_hash": "9aaea3d9d5c934a6ac3f49c64fe02b72", "timestamp": "", "source": "github", "line_count": 106, "max_line_length": 113, "avg_line_length": 24.38679245283019, "alnum_prop": 0.6707930367504835, "repo_name": "cryzed/Feedbuffer", "id": "f9a6f31c3d029e4cf431a0b19c481311db1f1006", "size": "2...
import pytest from hpe_test_utils import OneViewBaseFactsTest from oneview_module_loader import ApplianceDeviceSnmpV1TrapDestinationsFactsModule ERROR_MSG = 'Fake message error' PARAMS_MANDATORY_MISSING = dict( config='config.json' ) PARAMS_GET_BY_NAME = dict( config='config.json', name='10.0.0.4' ) PA...
{ "content_hash": "9236c51f78f3a658d01b95a93c27aef0", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 120, "avg_line_length": 31.233333333333334, "alnum_prop": 0.7091782283884739, "repo_name": "HewlettPackard/oneview-ansible", "id": "1bdcb2cc4f515fbb8565c6817519588ce57deff4",...
''' Exodus Add-on Copyright (C) 2017 Exodus This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This p...
{ "content_hash": "91f812d8a07a366bb66d87c6600f8b95", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 115, "avg_line_length": 33.47727272727273, "alnum_prop": 0.6279701289884589, "repo_name": "TheWardoctor/Wardoctors-repo", "id": "7223e7bdc6683154ce3e57aca164fc7968877f19", ...
import sys from os import path sys.path.append( path.dirname( path.dirname( path.abspath(__file__) ) ) ) import unittest import logging from testing import integration_test as integration_test # Network used in this test from networks import sample_network as network class TestCmd(integration_test.IntegrationTestC...
{ "content_hash": "5dea267c483ce24678b7e01ce151df03", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 78, "avg_line_length": 26.77777777777778, "alnum_prop": 0.681881051175657, "repo_name": "Nephelo/sdn-test-framework", "id": "d017a1d28e25b33aac6687b1ff7c357dac961e88", "siz...
import logging from hiredis import ReplyError from models.base import db, Base import models.node import models.proxy from models.proxy import TYPE_CORVUS class StatsBase(Base): __abstract__ = True addr = db.Column('addr', db.String(255), unique=True, nullable=False) poll_count = db.Column('poll_count',...
{ "content_hash": "ffd18890288f3f0dfde75fd03f98924d", "timestamp": "", "source": "github", "line_count": 123, "max_line_length": 73, "avg_line_length": 28.341463414634145, "alnum_prop": 0.5699942627653471, "repo_name": "HunanTV/redis-ctl", "id": "d09847017a6f2319f0298936343c4794e888c9bc", "size": "3...
import numpy import six import chainer from chainer.backends import _chainerx from chainer.backends import _cpu from chainer.backends import cuda from chainer.backends import intel64 import chainerx # Aliases from chainer._backend import Device from chainer.backends._chainerx import ChainerxDevice from chainer.backen...
{ "content_hash": "08729c949cbfea46ebbd2d49d7fac284", "timestamp": "", "source": "github", "line_count": 283, "max_line_length": 79, "avg_line_length": 31.724381625441698, "alnum_prop": 0.5970149253731343, "repo_name": "wkentaro/chainer", "id": "a4f835eda07524fc4a473fbd0c8667257483b77c", "size": "89...
import requests import logging from six.moves.urllib.parse import urljoin from torrt.base_rpc import BaseRPC, TorrtRPCException from torrt.utils import RPCClassesRegistry, make_soup LOGGER = logging.getLogger(__name__) class UTorrentRPC(BaseRPC): """See http://www.utorrent.com/community/developers/webapi for p...
{ "content_hash": "c7acf0574628a0647c11a5e895cfd612", "timestamp": "", "source": "github", "line_count": 131, "max_line_length": 103, "avg_line_length": 32.64885496183206, "alnum_prop": 0.5770399812953004, "repo_name": "toshka/torrt", "id": "2a70e16030c9e31385727d869973ba17d1508c35", "size": "4277",...
"""Implements a singleton.""" import contextlib import logging import os import sys if sys.platform == 'win32': import ctypes else: import fcntl class Singleton(object): """Creates an global singleton that can be held by only one process on the host. On Windows, uses a global Mutex. On others, use a flo...
{ "content_hash": "78d10704bb2e1fb8702b3e17393a29f5", "timestamp": "", "source": "github", "line_count": 95, "max_line_length": 79, "avg_line_length": 28.810526315789474, "alnum_prop": 0.628425283156741, "repo_name": "luci/luci-py", "id": "62d26e00bcef3cb0007e3436bfc36d8d3dd2f6c4", "size": "2911", ...
from typing import TYPE_CHECKING import msrest.serialization from ._edm import Collection, ComplexType, String from .._generated.models import ( SearchField as _SearchField, SearchIndex as _SearchIndex, PatternTokenizer as _PatternTokenizer, ) from ._models import ( pack_analyzer, unpack_analyzer, ...
{ "content_hash": "0f7e3af94d0c0a1b9c4be55b9483ab21", "timestamp": "", "source": "github", "line_count": 700, "max_line_length": 118, "avg_line_length": 60.27285714285714, "alnum_prop": 0.6763764783958665, "repo_name": "Azure/azure-sdk-for-python", "id": "d803d85a69cbb6b83b2aee2669cc9f167258c2da", "...
"""Test the Aurora ABB PowerOne Solar PV sensors.""" from datetime import timedelta from unittest.mock import patch from aurorapy.client import AuroraError import pytest from homeassistant.components.aurora_abb_powerone.const import ( ATTR_DEVICE_NAME, ATTR_FIRMWARE, ATTR_MODEL, ATTR_SERIAL_NUMBER, ...
{ "content_hash": "3a88b2a98296f572e8b0822c3061c167", "timestamp": "", "source": "github", "line_count": 185, "max_line_length": 87, "avg_line_length": 34.34054054054054, "alnum_prop": 0.6633086730678419, "repo_name": "aronsky/home-assistant", "id": "26486c6a11666bf63bba9dc7116f06981ccd773f", "size"...
"""Contains routines which will add a backup cron job to prepare Oppia for a deployment push to https://oppia.org/. """ import sys import utils _BACKUP_NAME_PREFIX = 'opbkp' _BACKUP_EVENT_QUEUE_NAME = 'backups' _BACKUP_EVENT_QUEUE_RATE = '5/s' _MAX_BACKUP_URL_LENGTH = 2000 _CRON_YAML_FILE_NAME = 'cron.yaml' _OMITTED_M...
{ "content_hash": "75ca7ab7c6621ad17cdb8594260b4285", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 78, "avg_line_length": 34.01190476190476, "alnum_prop": 0.6387819390969548, "repo_name": "himanshu-dixit/oppia", "id": "be10dfd2fe676cb66dde3de27bd82682a70d5526", "size": "...
from dateutil.relativedelta import relativedelta from django.db.models import Q from django.utils import timezone three_years = relativedelta(years=3) five_years = relativedelta(years=5) one_hundred_years = relativedelta(years=100) one_month = relativedelta(months=1) now = timezone.now() stout = ( (Q(style__nam...
{ "content_hash": "0619428bb4445c7e7a130dabe2372ad4", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 92, "avg_line_length": 30.666666666666668, "alnum_prop": 0.6869565217391305, "repo_name": "djangophx/beer-tracker", "id": "13c3738694ebccfa05434cf3eb7251d699951260", "size"...
"""adodbapi -- a pure Python PEP 249 DB-API package using Microsoft ADO Adodbapi can be run on CPython version 2.7, or IronPython version 2.6 and later, or Python 3.5 and later (after filtering through 2to3.py) """ CLASSIFIERS = """\ Development Status :: 5 - Production/Stable Intended Audience :: Developers License :...
{ "content_hash": "0520d2a49c45602ff45aadd2b5587a2e", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 137, "avg_line_length": 35.523809523809526, "alnum_prop": 0.6400804289544236, "repo_name": "sserrot/champion_relationships", "id": "d0fc6ae8ef6473ab714b939d2e6d09941480f6ce",...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('foos', '0004_auto_20170124_1434'), ] operations = [ migrations.AddField( model_name='singlesgame', name='player1_end_rating'...
{ "content_hash": "d225a99f4005bd76e1096f54c9d78370", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 52, "avg_line_length": 27.454545454545453, "alnum_prop": 0.5695364238410596, "repo_name": "Magicked/tabletracker", "id": "f459a32779eb3dfd223a36924f16fb40a7919502", "size":...
""" Radar chart """ from __future__ import division from pygal.graph.line import Line from pygal.adapters import positive, none_to_zero from pygal.view import PolarView, PolarLogView from pygal.util import deg, cached_property, compute_scale, is_major from math import cos, pi class Radar(Line): """Kiviat graph"...
{ "content_hash": "0b7e2a5b367048b5d54af6c8d474bd71", "timestamp": "", "source": "github", "line_count": 134, "max_line_length": 72, "avg_line_length": 32.75373134328358, "alnum_prop": 0.48712690817953974, "repo_name": "vineethguna/heroku-buildpack-libsandbox", "id": "54b6e63f8ed4b49ec2a5a9039d882412d...
""" A lightweight, pure Python, numpy compliant ndarray class. The documenation in this module is rather compact. For details on each function, see the corresponding documentation at: http://docs.scipy.org/doc/numpy/reference/index.html Be aware that the behavior of tinynumpy may deviate in some ways from numpy, or t...
{ "content_hash": "b77d42582c83357870b1a49c41b19e45", "timestamp": "", "source": "github", "line_count": 991, "max_line_length": 81, "avg_line_length": 32.90817356205853, "alnum_prop": 0.5425916840426837, "repo_name": "almarklein/tinynumpy", "id": "5ff200f5c25f18d464c680d46d4dba50ecff15dc", "size": ...
""" Sahana Eden Common Alerting Protocol (CAP) Model @copyright: 2009-2015 (c) Sahana Software Foundation @license: MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without...
{ "content_hash": "589147eb71f8ec4e2618f4b8dc1f7533", "timestamp": "", "source": "github", "line_count": 1880, "max_line_length": 142, "avg_line_length": 45.99627659574468, "alnum_prop": 0.4463127218900697, "repo_name": "michaelhowden/eden", "id": "9da905e4978170587ccf255d378463fea6d50bc6", "size": ...
""" Script for building the application. Usage: python setup.py py2app -gx -O2 """ import os from distutils.core import setup import py2app appname = "FileMaker Layout Eporter" appnameshort = "FMPLayoutexporter" version = "V0.2.0" copyright = u"Copyright 2009-2015 Karsten Wolf" infostr = appname + u' ' + versi...
{ "content_hash": "c605527ec505b2648bd400f6b7b6fb8f", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 58, "avg_line_length": 23.88888888888889, "alnum_prop": 0.598139534883721, "repo_name": "karstenw/FMPLayoutExporter", "id": "d792955adce3f40f6315bb53772eb528c2f89e42", "siz...
from puzzle.puzzlepedia import puzzle def get(): return puzzle.Puzzle('Puzzle 1.3: The Missing Painting', SOURCE) SOURCE = """ name in {Beth, Charles, David, Frank, Jessica, Karen, Taylor} job in {attorny, banker, composer, decorator, entrepreneur, filmmaker, gerontologist} start in {boathouse, cottage, garden, l...
{ "content_hash": "67aa08c1b2987a86d7de8750cdb9bc2e", "timestamp": "", "source": "github", "line_count": 89, "max_line_length": 85, "avg_line_length": 21.0561797752809, "alnum_prop": 0.695837780149413, "repo_name": "PhilHarnish/forge", "id": "62320c91257ed8fca3c7f0979754616019d8945f", "size": "1874"...
import cv2 import numpy as np class HandJob: def __init__(self): self.cap = cv2.VideoCapture(0) self.samples = [] self.oldPosition = [0,0] self.frame_hsv = 0 # just declare for now cv2.namedWindow("Frame") cv2.setMouseCallback("Frame", self.getSample) def getSample(self, event, x, y, flags, param): ...
{ "content_hash": "6992fcfbb726ed05894aa9238b94745f", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 111, "avg_line_length": 29.024390243902438, "alnum_prop": 0.673109243697479, "repo_name": "WWPOL/CV-Pong", "id": "1b825851c0299bccc1fab8b2e3c668994bafae2b", "size": "2380",...
from cannonball.Actor import Actor from Box2D import * from pyglet.gl import * import random class Smoke(Actor): z = 0.1 def __init__(self, level, position, linear_velocity): super(Smoke, self).__init__(level) self._create_body(position, linear_velocity) @property def progress(s...
{ "content_hash": "1dad2b165513403b603ad0f1442bea35", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 77, "avg_line_length": 31.136363636363637, "alnum_prop": 0.5858880778588808, "repo_name": "elemel/cannonball", "id": "134457784f659748b221e570a6c7d5371e847c75", "size": "20...
import os try: from setuptools import find_packages, setup, Command except ImportError: from distutils.core import find_packages, setup, Command def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() DESCRIPTION = 'A lightweight Python crawler framework' LONG_DESCRIPTION = re...
{ "content_hash": "ac9ab5b0b6b8fb7269ed4d4826b97931", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 70, "avg_line_length": 31.128205128205128, "alnum_prop": 0.5749588138385503, "repo_name": "ymero/PyCrawler", "id": "03358e87288a4fa548dee294dd9b8730b246c260", "size": "1214...
""" Transformer sub-package for the pyRdfa package. It contains modules with transformer functions; each may be invoked by pyRdfa to transform the dom tree before the "real" RDfa processing. @summary: RDFa Transformer package @requires: U{RDFLib package<http://rdflib.net>} @organization: U{World Wide Web Consortium<ht...
{ "content_hash": "8d7077ca2d2af2b55341aefaa7a669a8", "timestamp": "", "source": "github", "line_count": 119, "max_line_length": 210, "avg_line_length": 36.9327731092437, "alnum_prop": 0.697155858930603, "repo_name": "dbs/rdflib", "id": "bfb88224e1b07f9595dab3538a1af24cd6030b63", "size": "4420", "...
import os from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand import sys import uuid from taskwarrior_blocks_capsule import __version__ as version_string requirements_path = os.path.join( os.path.dirname(__file__), 'requirements.txt', ) try: from pip.req im...
{ "content_hash": "6a212758c488db172ed290d2929ee9c3", "timestamp": "", "source": "github", "line_count": 72, "max_line_length": 72, "avg_line_length": 27.76388888888889, "alnum_prop": 0.6213106553276638, "repo_name": "coddingtonbear/taskwarrior-blocks-capsule", "id": "a8f7a34f1e0fc3f2c152d91fa47cc43a2...
from os import environ from fastapi import Depends, FastAPI, HTTPException, Response, status from sqlalchemy.orm import Session from app import crud, schemas from app.database import SessionLocal CLOUD_RUN_SERVICE = environ.get("K_SERVICE", "") CLOUD_RUN_REVISION = environ.get("K_REVISION", "") app = FastAPI(docs_u...
{ "content_hash": "be3115bd49c356f4e25689ce47277b9d", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 105, "avg_line_length": 32.618556701030926, "alnum_prop": 0.6855246523388117, "repo_name": "cloudspannerecosystem/spanner-sqlalchemy-demo", "id": "e61330df484a60580a05b10cf3f...
from __future__ import division, print_function __all__ = ["izip", "imap", "iteritems", "xrange"] try: from itertools import izip, imap except ImportError: izip = zip imap = map def iteritems(d): return d.items() else: def iteritems(d): return d.iteritems() try: xrange = xr...
{ "content_hash": "75fc97fe5b2a97a102008d6d02f4c768", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 49, "avg_line_length": 16.454545454545453, "alnum_prop": 0.6160220994475138, "repo_name": "jellis18/emcee3", "id": "ecb733d3589001fcf45f73bd1442ac5115807238", "size": "387"...
import stun from ethereum import slogging as logging from raiden.exceptions import STUNUnavailableException log = logging.getLogger(__name__) def stun_socket( socket, source_ip='0.0.0.0', source_port=4200, stun_host=None, stun_port=3478 ): timeout = socket.gettimeout() socket.settimeout...
{ "content_hash": "fabf30347a81b0bc6be76f82d98433e0", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 66, "avg_line_length": 26.044444444444444, "alnum_prop": 0.6279863481228669, "repo_name": "tomashaber/raiden", "id": "eefa01e0c3d6818976384830307adbb55c67e772", "size": "11...
from opencivicdata.models import (Jurisdiction, Organization, Person, Bill, VoteEvent, Event, Division ...
{ "content_hash": "ef2e05db7d98909a01eb71323898380e", "timestamp": "", "source": "github", "line_count": 322, "max_line_length": 122, "avg_line_length": 30.854037267080745, "alnum_prop": 0.5753397081026673, "repo_name": "opencivicdata/imago", "id": "8d5ebd8d1bf20a6fb0ad4c1e77d95a7d38081b9c", "size":...
import sys import os import shutil def cleanup_dump(dumpstr): cardfrags = dumpstr.split('\n\n') if len(cardfrags) < 4: return '' else: return '\n\n'.join(cardfrags[2:-1]) + '\n\n' def identify_checkpoints(basedir, ident): cp_infos = [] for path in os.listdir(basedir): fullp...
{ "content_hash": "eaeeee699cd218bb36739bfc1610b787", "timestamp": "", "source": "github", "line_count": 98, "max_line_length": 100, "avg_line_length": 40.19387755102041, "alnum_prop": 0.556994160954557, "repo_name": "billzorn/mtgencode", "id": "95df0f09ffd774a68c925aeb03474a03ba3d0327", "size": "39...
from grab.selector import XpathSelector class Reference(object): def __init__(self, node, query=None, query_args=None): self._node = node self._query = query self._query_args = {} if query_args is None else query_args def __getattr__(self, key): return Reference(self._node, que...
{ "content_hash": "30914784422f3f83f9d3777414f48060", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 68, "avg_line_length": 28, "alnum_prop": 0.5978260869565217, "repo_name": "subeax/grab", "id": "dad4cd49596fb281b8562ba028e947193fd0c753", "size": "644", "binary": false,...
from test_framework.test_framework import NavCoinTestFramework from test_framework.cfund_util import * import time class CommunityFundProposalVoteListTest(NavCoinTestFramework): """Tests the proposalvotelist function of the Community fund.""" def __init__(self): super().__init__() self.setup_...
{ "content_hash": "795c6c3eaa7cedb1facdfa344e88883d", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 86, "avg_line_length": 42.17948717948718, "alnum_prop": 0.6340425531914894, "repo_name": "navcoindev/navcoin-core", "id": "091e9c11f39233352bc1903d3bfdff745b2bb13e", "size"...
import testtools from testtools import matchers from tempest.api.volume import base from tempest.common import utils from tempest.common import waiters from tempest import config from tempest.lib.common.utils import data_utils from tempest.lib import decorators CONF = config.CONF class VolumesBackupsTest(base.BaseV...
{ "content_hash": "c001b2a5dd6a7da57fda22f5403b796f", "timestamp": "", "source": "github", "line_count": 166, "max_line_length": 78, "avg_line_length": 41.03012048192771, "alnum_prop": 0.607693437087065, "repo_name": "Juniper/tempest", "id": "1e240b8ecf694a2b9379292d4dae0e267f2e0224", "size": "7440"...
import unittest from lxml import etree from form import Form class TestEventIsEmpty(unittest.TestCase): def test_is_empty(self): raw_xml = """ <person_form_event> <person> <study_id>60</study_id> <all_form_events> <form> ...
{ "content_hash": "c9b986058a253ae603977e0a5d904166", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 67, "avg_line_length": 29.472727272727273, "alnum_prop": 0.42628007402837753, "repo_name": "indera/redi", "id": "8211a7e940b58993b1602b315ba350c973d8e3a6", "size": "1621", ...
import ConfigParser import csv import glob import MySQLdb import string from bulkinsert import * # Read database configuration from config file config = ConfigParser.ConfigParser() config.read("oa_alpha_etl.cnf") username = config.get('database', 'username') password = config.get('database', 'password') hostname = con...
{ "content_hash": "339d9d694dca6a8f9f4ce7f7b2480297", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 206, "avg_line_length": 34.40350877192982, "alnum_prop": 0.6053034166241713, "repo_name": "OpenAddressesUK/common-ETL", "id": "ab2226af86f8f17966d72b910687a3ddd1fe3408", "s...
from __future__ import absolute_import from django.conf import settings from django.contrib.messages.api import error, MessageFailure from django.shortcuts import redirect from social_auth.exceptions import SocialAuthBaseException from social_auth.utils import backend_setting, get_backend_name class SocialAuthExcep...
{ "content_hash": "97246655fe82edd0a4c080f45faca20a", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 83, "avg_line_length": 39.34920634920635, "alnum_prop": 0.6442113755546591, "repo_name": "fotinakis/sentry", "id": "67052db9ab18407f30ff17bcbe7689b67531ad5f", "size": "2503...
from flask import render_template, session, redirect, url_for, current_app, abort, flash, request, make_response from flask.ext.login import login_user, logout_user, login_required, current_user from .. import db from ..models import User, Role,Post, Permission, Follow, Comment from ..email import send_email from . im...
{ "content_hash": "7b8a94ce9f755542a983a589cc8f8ad7", "timestamp": "", "source": "github", "line_count": 227, "max_line_length": 117, "avg_line_length": 36.418502202643175, "alnum_prop": 0.7228740776581589, "repo_name": "menghao2015/MyBlog", "id": "4af087c6fe07dd9575e5063c981791baabff31fe", "size": ...
import logging import os import configparser config = configparser.RawConfigParser() HERE = os.path.dirname(__file__) configfiles = [ os.path.join(HERE, 'tictactoe.default.cfg'), # default config '/etc/tictactoe.cfg', # staging/live os.path.join(HERE, 'tictactoe.cfg'), ...
{ "content_hash": "469805ef9f993227cafa682930f4b31c", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 74, "avg_line_length": 24.38888888888889, "alnum_prop": 0.6583143507972665, "repo_name": "Motiejus/tictactoe", "id": "85e5a96405d5febd7fda499956e9d0fba3d32a22", "size": "43...
""" Complete the code below with the sklearn Naaive Bayes classifier to classify the terrain data The objective of this exercise is to recreate the decision boundary found in the lesson video, and make a plot that visually shows the decision boundary """ from prep_terrain_data import makeTerrain...
{ "content_hash": "fd9054747225ef3f5e66257ef63b362e", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 99, "avg_line_length": 34.214285714285715, "alnum_prop": 0.7167710508002784, "repo_name": "napjon/moocs_solution", "id": "78c853e30c18f8c852079dec5c59bfb19a7b6d12", "size":...
import os def ck_preprocess(i): def dep_env(dep, var): return i['deps'][dep]['dict']['env'].get(var) LABELS_FILE = 'labels.txt' WEIGHTS_DIR = dep_env('weights', 'CK_ENV_MOBILENET') LIB_DIR = dep_env('library', 'CK_ENV_LIB_ARMCL') LIB_NAME = dep_env('library', 'CK_ENV_LIB_ARMCL_DYNAMIC_CORE_NAME') new_env...
{ "content_hash": "903032061f2bb4335bbf953f563978d3", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 87, "avg_line_length": 41.319148936170215, "alnum_prop": 0.6292481977342945, "repo_name": "ctuning/ck-math", "id": "ec9b4b7d83ed80b28636ab50b9842c8b43c0f868", "size": "2121...
from PyQt5 import QtCore, QtGui, QtWidgets class Ui_FrameSoundsForm(object): def setupUi(self, FrameSoundsForm): FrameSoundsForm.setObjectName("FrameSoundsForm") FrameSoundsForm.resize(311, 161) self.label = QtWidgets.QLabel(FrameSoundsForm) self.label.setGeometry(QtCore.QRect(20, 1...
{ "content_hash": "544e87d698882a1502e349f1b26d4af6", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 88, "avg_line_length": 50.11764705882353, "alnum_prop": 0.6977699530516432, "repo_name": "ASMlover/study", "id": "7ef29b22ba617af8c7c25fa4f266e8827550cf58", "size": "1953",...
import os """ Django settings for thebeau project on Heroku. Fore more info, see: https://github.com/heroku/heroku-django-template For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/re...
{ "content_hash": "6505ae02673b7fc3838cdd2c3caee1f8", "timestamp": "", "source": "github", "line_count": 176, "max_line_length": 104, "avg_line_length": 31.301136363636363, "alnum_prop": 0.7028498820112543, "repo_name": "j-windsor/thebeau", "id": "3d3c1c362f7ff3b8a0f7499cc45579f11dec938b", "size": "...
""" WSGI config for webtox 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.10/howto/deployment/wsgi/ """ import os import sys from django.core.wsgi import get_wsgi_application sys.path.append('/home/s...
{ "content_hash": "1e181d06d632b166b71e7f3b94cb1cea", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 78, "avg_line_length": 25.55, "alnum_prop": 0.7651663405088063, "repo_name": "SHooZ/WebTox", "id": "0a21a757c898f00e91a3e2a647ba0ab03ea63067", "size": "511", "binary": fa...
import os, sys, math, random from collections import defaultdict if sys.version_info[0] >= 3: xrange = range def exit_with_help(argv): print("""\ Usage: {0} [options] dataset subset_size [output1] [output2] This script randomly selects a subset of the dataset. options: -s method : method of selection (defa...
{ "content_hash": "02fb9ef51e704cad96c05564a9e25043", "timestamp": "", "source": "github", "line_count": 124, "max_line_length": 89, "avg_line_length": 28.822580645161292, "alnum_prop": 0.6088416340235031, "repo_name": "kbiscanic/apt_project", "id": "a8ae7d3920818a9221e36be1d5c23e2e756efef1", "size"...
from collections import deque import json import gevent import app as app_module from flask_sockets import Sockets from geventwebsocket.exceptions import WebSocketError message_queue = deque() def handle_socket_push(**kwargs): message_queue.append(kwargs) app_module.socket_push = handle_socket_push sockets = ...
{ "content_hash": "aede2d0d01d9e2e5782e2a623b98b035", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 54, "avg_line_length": 20.59375, "alnum_prop": 0.6631259484066768, "repo_name": "Queens-Hacks/thoughtboard", "id": "9b38c1ba20efe26f630bfd07a8357b5c2441bfb4", "size": "659"...
import errno import os import uuid import exceptions from nose.plugins.attrib import attr from manager_rest.test import base_test from manager_rest import manager_exceptions from manager_rest.constants import DEFAULT_TENANT_NAME from manager_rest.constants import FILE_SERVER_DEPLOYMENTS_FOLDER from cloudify_rest_cli...
{ "content_hash": "b5374da53e850f7b86f8424ac2e8c2f9", "timestamp": "", "source": "github", "line_count": 564, "max_line_length": 79, "avg_line_length": 43.03900709219858, "alnum_prop": 0.6087171459174425, "repo_name": "isaac-s/cloudify-manager", "id": "d096d8871fa697740200c934ba929188cf28f5f7", "siz...
from __future__ import division from PyQt4 import QtCore, QtGui from vistrails.core.modules.vistrails_module import Module from vistrails.core.modules.basic_modules import Constant from vistrails.core.modules.module_registry import get_module_registry from vistrails.core.system import get_elementtree_library from vist...
{ "content_hash": "01cecb83d7e4da5c97bab76f1739cf89", "timestamp": "", "source": "github", "line_count": 739, "max_line_length": 104, "avg_line_length": 37.529093369418135, "alnum_prop": 0.5534722723011466, "repo_name": "hjanime/VisTrails", "id": "f2d86888793796af9782665679ad0273cffe9d6c", "size": "...
"""UniFi Network sensor platform tests.""" from datetime import datetime from unittest.mock import patch from aiounifi.models.message import MessageKey import pytest from homeassistant.components.device_tracker import DOMAIN as TRACKER_DOMAIN from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from h...
{ "content_hash": "fa53b1f3e072a2f5e9db0b1cb6869fdd", "timestamp": "", "source": "github", "line_count": 307, "max_line_length": 88, "avg_line_length": 33.77524429967427, "alnum_prop": 0.6595621564278137, "repo_name": "mezz64/home-assistant", "id": "100918a93dae574f68e38c4f8e3b138b77e49831", "size":...
import re class ToDo(object): todo_label = u"TODO" done_label = u"DONE" boundry = "###" # TODO: If pattern used a backreference the bountry could be randomized pattern = "#{3} (%s|%s):\n(.*?)\n#{3}" % (todo_label, done_label) skeleton = "%s %s:\n%s\n%s\n\n" single_regexp = re.compile(p...
{ "content_hash": "785cad0057a9c352d598fb8b79e20cd7", "timestamp": "", "source": "github", "line_count": 158, "max_line_length": 121, "avg_line_length": 30.943037974683545, "alnum_prop": 0.5412149723869912, "repo_name": "jackjennings/RoboToDo", "id": "dcef3ba136c1f30e28ce4e330b1ed98942747356", "size...