text
stringlengths
4
1.02M
meta
dict
''' Created on Aug, 5 2015 @author: mlaptev ''' def escape_unicode(fn): def wrapped(): print "String to convert '{}'".format(fn()) return "".join([i if ord(i) < 128 else "\\" + str(hex(ord(i))) for i in fn()]) return wrapped @escape_unicode def some_non_latin_string(): return "This i...
{ "content_hash": "c70f2eada898e996cbe3616452b936ec", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 86, "avg_line_length": 21, "alnum_prop": 0.5789473684210527, "repo_name": "MikeLaptev/sandbox_python", "id": "0f95ee380a480356d455daf3e8a42549a213b639", "size": "420", "b...
import httplib2 import Queue import re import socket import sys import threading import time from django.conf import settings from django.core.urlresolvers import reverse from django.db import models from spider.utils import SpiderThread, fetch_url class SpiderProfile(models.Model): title = models.CharField(max...
{ "content_hash": "17eb3b0caf98d75fda2c0381c2926f3f", "timestamp": "", "source": "github", "line_count": 260, "max_line_length": 91, "avg_line_length": 33.13846153846154, "alnum_prop": 0.5892525533890436, "repo_name": "georgedorn/django-spider", "id": "b13c287df75c72492eef889d0dccb995be36db0b", "siz...
"""add task fails journal table Revision ID: 64de9cddf6c9 Revises: 211e584da130 Create Date: 2016-08-03 14:02:59.203021 """ import sqlalchemy as sa from alembic import op from airflow.models.base import COLLATION_ARGS # revision identifiers, used by Alembic. revision = '64de9cddf6c9' down_revision = '211e584da130' ...
{ "content_hash": "171619505d5b4493728b32df4b145b54", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 86, "avg_line_length": 28.37142857142857, "alnum_prop": 0.6717019133937563, "repo_name": "apache/incubator-airflow", "id": "4243e3a3b40fd82e7df9483646304084fba00609", "size...
from crowdsourcing.serializers.template import * from rest_framework import viewsets class TemplateViewSet(viewsets.ModelViewSet): from crowdsourcing.models import Template queryset = Template.objects.all() serializer_class = TemplateSerializer class TemplateItemViewSet(viewsets.ModelViewSet): from...
{ "content_hash": "237a5ae37e175f6483fc609e1068e7d6", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 59, "avg_line_length": 29.652173913043477, "alnum_prop": 0.8108504398826979, "repo_name": "rakshit-agrawal/crowdsource-platform", "id": "d647db7f3f590e260b1ec829600ac37f6b471...
''' This module was generated automatically. Do not edit directly. ''' import collections from SmartMeshSDK import ApiException from IpMgrConnectorMuxInternal import IpMgrConnectorMuxInternal ## # \addtogroup IpMgrConnectorMux # \{ # class IpMgrConnectorMux(IpMgrConnectorMuxInternal): ''' \brief Public ...
{ "content_hash": "1f97d9e83598ec3d012d33ee17b2f731", "timestamp": "", "source": "github", "line_count": 2394, "max_line_length": 772, "avg_line_length": 50.225563909774436, "alnum_prop": 0.6329258150365935, "repo_name": "realms-team/basestation-fw", "id": "111d5d973df233dc555e30ed60836edad12e26a9", ...
from __future__ import unicode_literals from django.db import migrations, models import uuid def gen_uuid(apps, schema_editor): MyModel = apps.get_model('aggregator', 'Layer') for row in MyModel.objects.all(): row.uuid = uuid.uuid4() row.save() MyModel = apps.get_model('aggregator', 'Servi...
{ "content_hash": "cf20ed09bc17fe0c4075690c4c0d15ee", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 79, "avg_line_length": 26.333333333333332, "alnum_prop": 0.6424050632911392, "repo_name": "cga-harvard/hypermap", "id": "78fee73cc5c5093ac0d1e3267806694f9d7ac6a6", "size": ...
"""Test the ref_resolver module.""" from __future__ import absolute_import import shutil import tempfile import pytest # type: ignore @pytest.fixture def tmp_dir_fixture(request): d = tempfile.mkdtemp() @request.addfinalizer def teardown(): shutil.rmtree(d) return d def test_Loader_initial...
{ "content_hash": "81838f8c2ae69e652cee8f4d5cf225ac", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 74, "avg_line_length": 25.418181818181818, "alnum_prop": 0.6831187410586552, "repo_name": "mr-c/common-workflow-language", "id": "fdb5e61a7220e993d57c8667559de75b72ad5b73", ...
import logging import random import time from urllib import quote_plus import uuid from openerp import SUPERUSER_ID import simplejson from openerp import tools from openerp.osv import fields, osv from openerp.osv import expression from openerp.tools.translate import _ from openerp.tools.safe_eval import safe_eval imp...
{ "content_hash": "b311d34e703217a96bf742f84ccc9f9c", "timestamp": "", "source": "github", "line_count": 915, "max_line_length": 171, "avg_line_length": 55.83169398907104, "alnum_prop": 0.5739928747602083, "repo_name": "ntiufalara/openerp7", "id": "e9d83be85cba014758ddf950123e0f6e77525834", "size": ...
import logging import urllib2 import re import pickle # http://www.crummy.com/software/BeautifulSoup/ from bs4 import BeautifulSoup # https://code.google.com/p/prettytable/ from prettytable import PrettyTable class Impactor(object): BASE_URL_PREFIX=r'http://www.citefactor.org/journal-impact-factor-list-' BAS...
{ "content_hash": "67ffb64cfccb0dbfe38bebe040c5470e", "timestamp": "", "source": "github", "line_count": 148, "max_line_length": 131, "avg_line_length": 38.108108108108105, "alnum_prop": 0.5930851063829787, "repo_name": "andrew-hill/impactor", "id": "d3566d168b366447820048a177c6ee92c5329066", "size"...
from google.cloud import aiplatform_v1beta1 async def sample_list_batch_prediction_jobs(): # Create a client client = aiplatform_v1beta1.JobServiceAsyncClient() # Initialize request argument(s) request = aiplatform_v1beta1.ListBatchPredictionJobsRequest( parent="parent_value", ) # Ma...
{ "content_hash": "6d1ee1f9552a07086a9ea2793a2b8e08", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 77, "avg_line_length": 28.65, "alnum_prop": 0.7347294938917975, "repo_name": "googleapis/python-aiplatform", "id": "09302aa8328f7baafce502b236114efc459860f4", "size": "1987...
from django.conf.urls import url from .views import Renders, Initializer urlpatterns = [ url(r'^search/', Initializer.init), url(r'^references', Renders.references_render), url(r'^help', Renders.help_render), url(r'^', Renders.index), ]
{ "content_hash": "233be1d8064db670284d11e64bdccd3a", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 51, "avg_line_length": 28.22222222222222, "alnum_prop": 0.6850393700787402, "repo_name": "nlx-group/LX-WordNetBrowser", "id": "d9335e05f96155e7cecb95b4ac64ee65d5dfd6e2", "si...
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): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('manager', '0005_add_fields_and_s...
{ "content_hash": "d585f0b8330ea13d56cf45d64f8780f1", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 150, "avg_line_length": 40.74074074074074, "alnum_prop": 0.63, "repo_name": "EndyKaufman/django-postgres-angularjs-blog", "id": "eae7acdb8dfb8f630b658a56cd5b658161d5637a", ...
import urllib import urllib2 import xml.etree.ElementTree as ET from urlutils import urlencode_no_plus class Game(object): def __init__(self, id, title, release_date=None, platform=None, overview=None, esrb_rating=None, genres=None, players=None, coop=None, youtube_url=None, publisher=None, devel...
{ "content_hash": "c7873699a517fa9becc90eeb9231fb7a", "timestamp": "", "source": "github", "line_count": 283, "max_line_length": 124, "avg_line_length": 46.07420494699647, "alnum_prop": 0.5684485006518905, "repo_name": "jameserrico/python-gamesdb", "id": "b4bb10c67173407f00cc993cdda02953a01bb1a0", "...
import os from setuptools import find_packages, setup package_name = "culqi" package_path = os.path.abspath(os.path.dirname(__file__)) repositorty_url = "https://github.com/culqi/culqi" long_description_file_path = os.path.join(package_path, "README.md") long_description = "" try: with open(long_description_file...
{ "content_hash": "059b3c0cf23776827262561702b3c482", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 85, "avg_line_length": 35.06, "alnum_prop": 0.6274957216200798, "repo_name": "culqi/culqi-python", "id": "f2895adb1bb80717f13608a90d6fce29da52aa45", "size": "1800", "bina...
import scrapy class VReviewsItem(scrapy.Item): # define the fields for your item here like: # name = scrapy.Field() username = scrapy.Field() date = scrapy.Field() rate = scrapy.Field() content = scrapy.Field() link = scrapy.Field() museum = scrapy.Field()
{ "content_hash": "8925268ab66737c83081bf3ee2f612af", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 48, "avg_line_length": 26.363636363636363, "alnum_prop": 0.6448275862068965, "repo_name": "dollymsq/SI_Review_Scrapy", "id": "8331d292fe064bd4f7070c57161f1e812e292b3d", "si...
from .datalog2sql.datalog2sqlconverter import Datalog2SqlConverter from .sql_engine.query_evaluator import QueryEvaluator from .sql_engine.db_state_tracker import DBStateTracker from colorama import * from .interpreter.interpreter_parse import * from .interpreter.syntax_highlighter import SyntaxHighlight import sys imp...
{ "content_hash": "d83fdd641b6ff66e82aa98d163769484", "timestamp": "", "source": "github", "line_count": 196, "max_line_length": 112, "avg_line_length": 31.642857142857142, "alnum_prop": 0.5428893905191874, "repo_name": "saltzm/yadi", "id": "a5cc523c041f8938d3661a38f96740e76b24a69e", "size": "6202",...
from .TupleBanditsPureExploration import * from .Info import *
{ "content_hash": "1949e4272b04626f35d6fd684c2a104b", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 42, "avg_line_length": 31.5, "alnum_prop": 0.8095238095238095, "repo_name": "kgjamieson/NEXT-psych", "id": "14a6b7291507998dd873eb437718ad4ff20f3a10", "size": "63", "binar...
from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.test import TestCase, Client from reddit.forms import SubmissionForm from reddit.models import Submission from users.models import RedditUser class TestSubmissionForm(TestCase): def test_full_valid_submission(self)...
{ "content_hash": "c472e50f960c98f84319b08ea1fb4593", "timestamp": "", "source": "github", "line_count": 82, "max_line_length": 111, "avg_line_length": 35.146341463414636, "alnum_prop": 0.5919500346981263, "repo_name": "Nikola-K/django_reddit", "id": "50e36fe769217ec9d11a693db74e906df3636aaa", "size...
import json import os import requests import sys REST_API="http://alpha.opencloud.us:8000/xos/" NODES_API = REST_API + "nodes/" SLICES_API = REST_API + "slices/" SLIVERS_API = REST_API + "slivers/" opencloud_auth=("demo@onlab.us", "demo") def get_slice_id(slice_name): r = requests.get(SLICES_API + "?name=%s" % ...
{ "content_hash": "ac68b643aa5fa4e0cef413e50bc78da2", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 106, "avg_line_length": 25.58823529411765, "alnum_prop": 0.6068965517241379, "repo_name": "wathsalav/xos", "id": "3450df59a241496b3062f8f611172705dc84f176", "size": "1764",...
from flask import Flask from graphql_server.flask import GraphQLView from tests.flask.schema import Schema def create_app(path="/graphql", **kwargs): server = Flask(__name__) server.debug = True server.add_url_rule( path, view_func=GraphQLView.as_view("graphql", schema=Schema, **kwargs) ) ...
{ "content_hash": "3bb83726e7721ade1cd66abc30bfa97c", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 79, "avg_line_length": 23, "alnum_prop": 0.6570048309178744, "repo_name": "graphql-python/graphql-server-core", "id": "ec9e9d0661c2d6d7b1d1dd0b1fca0c5b63c09cae", "size": "4...
import hashlib from io import BytesIO import logging import socket import pycurl from common import DCOSAuth from lrucache import LRUCache logger = logging.getLogger('utils') # The maximum number of clashes to allow when assigning a port. MAX_CLASHES = 50 class ServicePortAssigner(object): """ Helper clas...
{ "content_hash": "7d5532b4a8f99cd5e1077dcc6b98a449", "timestamp": "", "source": "github", "line_count": 441, "max_line_length": 79, "avg_line_length": 32.91156462585034, "alnum_prop": 0.5789582472095908, "repo_name": "mesosphere/marathon-lb", "id": "e75c75f3b76a04c72488beceaeff944fd930d9f5", "size"...
"""Tests for Konnected Alarm Panel config flow.""" from asynctest import patch import pytest from homeassistant.components import konnected from homeassistant.components.konnected import config_flow from tests.common import MockConfigEntry @pytest.fixture(name="mock_panel") async def mock_panel_fixture(): """Mo...
{ "content_hash": "11d7018f18c99dff67aabfbb9fbccf31", "timestamp": "", "source": "github", "line_count": 1052, "max_line_length": 93, "avg_line_length": 32.599809885931556, "alnum_prop": 0.47662924624580844, "repo_name": "postlund/home-assistant", "id": "9b7a498731d0932d17da982a5a2eac4216e213ff", "s...
import pytest from flask_appbuilder.security.sqla.models import Role from parameterized import parameterized from airflow.api_connexion.exceptions import EXCEPTIONS_LINK_MAP from airflow.security import permissions from airflow.www.security import EXISTING_ROLES from tests.test_utils.api_connexion_utils import ( a...
{ "content_hash": "4564ba8dc99b0f9e4dc99cefa5027a4e", "timestamp": "", "source": "github", "line_count": 467, "max_line_length": 110, "avg_line_length": 38.143468950749465, "alnum_prop": 0.5104137427721327, "repo_name": "sekikn/incubator-airflow", "id": "0d41c927ac69e8e7faabe0876ef17dfbf69c6f33", "s...
import sys import numpy as np from scipy.linalg import norm, solve, inv, qr, svd, LinAlgError from numpy import asarray, dot, vdot import scipy.sparse.linalg import scipy.sparse from scipy.linalg import get_blas_funcs import inspect from scipy._lib._util import getfullargspec_no_self as _getfullargspec from ._linesearc...
{ "content_hash": "0afd6c22b29dff648ee790f42673daeb", "timestamp": "", "source": "github", "line_count": 1562, "max_line_length": 104, "avg_line_length": 31.303457106274006, "alnum_prop": 0.5429073952879581, "repo_name": "perimosocordiae/scipy", "id": "c334f81f2e32408fccb639f710c6d2a39f71d049", "siz...
def func(): """Test that a variable defined in a finally clause does not trigger a false positive""" try: variable = 1 yield variable finally: variable = 2 yield variable
{ "content_hash": "e51cab2887c067439072df2096af044c", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 92, "avg_line_length": 26.875, "alnum_prop": 0.6, "repo_name": "arju88nair/projectCulminate", "id": "efc133c2b0171e502c2e3ebdd7aa6a4057955f97", "size": "251", "binary": fa...
from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import lowfat.validator class Migration(migrations.Migration): dependencies = [ ('lowfat', '0096_auto_20170316_1015'), ] operations = [ migr...
{ "content_hash": "e9a399fa5416477b5c935c8e9b1cccf4", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 121, "avg_line_length": 31, "alnum_prop": 0.6326742976066597, "repo_name": "softwaresaved/fat", "id": "dbc42c58ee4cdaa1639a455585b32895d1912dcb", "size": "1034", "binary"...
import time class ZmqTimerManager(object): def __init__(self): self.timers = [] self.next_call = 0 def add_timer(self, timer): self.timers.append(timer) def check(self): if time.time() > self.next_call: for timer in self.timers: timer.check() ...
{ "content_hash": "645f17a61088cc76ad66df627c00f928", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 59, "avg_line_length": 26.695652173913043, "alnum_prop": 0.5171009771986971, "repo_name": "kootenpv/brightml", "id": "2d0a555abd4747eb5a9d448aa3ff285addb701f6", "size": "12...
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(24,GPIO.OUT) GPIO.output(24,GPIO.HIGH)
{ "content_hash": "89db6f2988d7b6d97c71e9400aa264ae", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 25, "avg_line_length": 24.2, "alnum_prop": 0.7851239669421488, "repo_name": "goatgoose1142/MorseCodeTransmitter", "id": "230a7d930ca9f9b4ead31f3ce731fb89c35cce16", "size": "...
import unittest from auto_tagify2 import AutoTagify class AutoTagifyTestCase(unittest.TestCase): def testTextNotEmptyStrict(self): """Verify strict text returns content, if text is provided and not null. """ a = AutoTagify() a.text = 'This is a test' a.css = 'taggab...
{ "content_hash": "6a7a5c365bf6a4026ddcbccf8ecc274c", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 121, "avg_line_length": 35.075, "alnum_prop": 0.5801853171774768, "repo_name": "ednapiranha/auto-tagify", "id": "c6462b80121490271dd92f05ae373c287286c349", "size": "1403", ...
import posixpath import traceback from future import Gettable, Future from path_util import ( AssertIsDirectory, AssertIsValid, IsDirectory, IsValid, SplitParent, ToDirectory) class _BaseFileSystemException(Exception): def __init__(self, message): Exception.__init__(self, message) @classmethod def...
{ "content_hash": "a4aa0584d061c9705c39fdd54782efab", "timestamp": "", "source": "github", "line_count": 174, "max_line_length": 80, "avg_line_length": 32.310344827586206, "alnum_prop": 0.6700462468872287, "repo_name": "ChromiumWebApps/chromium", "id": "c2da419e9ed2e40c31d10cf54ff36e9db6892faf", "si...
"""This example gets custom targeting values for the given predefined custom targeting key. The statement retrieves up to the maximum page size limit of 500. To create custom targeting values, run create_custom_targeting_keys_and_values.py. To determine which custom targeting keys exist, run get_all_custom_targeting_ke...
{ "content_hash": "cc0aa7eddff57add92bcf6c7cb77ee08", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 80, "avg_line_length": 32.68627450980392, "alnum_prop": 0.6838632273545291, "repo_name": "caioserra/apiAdwords", "id": "58f74efb5011372cfd52786f9b8d7cf835ebed12", "size": "...
"""installs a WSGI application in place of a real URI for testing. Introduction ============ Testing a WSGI application normally involves starting a server at a local host and port, then pointing your test code to that address. Instead, this library lets you intercept calls to any specific host/port combination and r...
{ "content_hash": "6ced28822c6b4b5b8cb10e838234dd47", "timestamp": "", "source": "github", "line_count": 588, "max_line_length": 109, "avg_line_length": 31.906462585034014, "alnum_prop": 0.5914929907787432, "repo_name": "sileht/python3-wsgi-intercept", "id": "37728427ccdfc7aa4e0502f307c83cec6d35459e",...
from noodles import (schedule, quote, unquote) def find_first(pred, lst): """Find the first result of a list of promises `lst` that satisfies a predicate `pred`. :param pred: a function of one argument returning `True` or `False`. :param lst: a list of promises or values. :return: a promise of a ...
{ "content_hash": "f9c6a1ad9d2781c30cf9690fc2bc9b2a", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 79, "avg_line_length": 33.810810810810814, "alnum_prop": 0.657074340527578, "repo_name": "NLeSC/noodles", "id": "2ba7c0a1384277f6dc38963d55581ca4411638ba", "size": "1251", ...
""" Monkey patches for changes to classes and functions in Eppy. These include fixes which have not yet made it to the released version of Eppy. These will be removed if/when they are added to Eppy. """ import copy import warnings from typing import Any, Dict, List, Optional, Tuple, Union # noqa from eppy import bun...
{ "content_hash": "f99292a45e6277e6d949abd169b3cc90", "timestamp": "", "source": "github", "line_count": 301, "max_line_length": 118, "avg_line_length": 36.737541528239205, "alnum_prop": 0.6504792910110327, "repo_name": "jamiebull1/geomeppy", "id": "72253dd9c133caf866af3a8dc28d1cd748ec44c5", "size":...
from importlib import import_module import sys __version__ = '0.1' class Subcommand: def __init__(self, name, entry_point, description=None): self.name = name self.entry_point = entry_point self.description = description class Commander: def __init__(self, description=None, subcmds=No...
{ "content_hash": "5790bedd3a8a1348bbfd5486c4c5fcf6", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 76, "avg_line_length": 30.94, "alnum_prop": 0.5669036845507434, "repo_name": "takluyver/vclurk", "id": "bb0cab906ca0fa2cfeae2b19cc5d015ede7e4543", "size": "1547", "binary...
""" Generic python script. """ __author__ = "Alex Drlica-Wagner" import unittest # Execute tests in order: https://stackoverflow.com/a/22317851/4075339 unittest.TestLoader.sortTestMethodsUsing = None import numpy as np import fitsio import ugali.analysis.loglike from ugali.utils.logger import logger logger.setLevel(l...
{ "content_hash": "afa3f0be3552b8a323d4ef20fda3021c", "timestamp": "", "source": "github", "line_count": 86, "max_line_length": 88, "avg_line_length": 39.906976744186046, "alnum_prop": 0.6386946386946387, "repo_name": "kadrlica/ugali", "id": "1ab46b118d386da160916888a13d7b7b93cac5b0", "size": "3454"...
from __future__ import unicode_literals import os.path from taggit.managers import TaggableManager from django.db import models from django.db.models.signals import pre_delete from django.dispatch.dispatcher import receiver from django.dispatch import Signal from django.core.urlresolvers import reverse from django.c...
{ "content_hash": "2c2e13acfdfd125d303b99adfe194513", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 141, "avg_line_length": 33.01176470588236, "alnum_prop": 0.7127583749109052, "repo_name": "hanpama/wagtail", "id": "56264b6937dd97f354264faa529a9e6733524eb7", "size": "2806...
import sys, math, os # Panda imports from panda3d.core import * from pandac.PandaModules import * from direct.actor.Actor import Actor from direct.interval.IntervalGlobal import * from direct.task import Task from direct.showbase.DirectObject import DirectObject from panda3d.core import BitMask32 from panda3d.bullet i...
{ "content_hash": "9efbf59c3732d0a30485370dd876577e", "timestamp": "", "source": "github", "line_count": 312, "max_line_length": 101, "avg_line_length": 32.90064102564103, "alnum_prop": 0.5584023380418899, "repo_name": "MJ-meo-dmt/Ecliptic", "id": "2c9981cbe31994c120bf55b101dd6c478d083ce4", "size": ...
from xml.dom import minidom, Node def disable_urllib3_warning(): """ https://urllib3.readthedocs.org/en/latest/security.html#insecurerequestwarning InsecurePlatformWarning 警告的临时解决方案 """ try: import requests.packages.urllib3 requests.packages.urllib3.disable_warnings() except Ex...
{ "content_hash": "48b7fff94b8fcbf2d9ebe188ea96cdb5", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 136, "avg_line_length": 28.103092783505154, "alnum_prop": 0.5561261922230374, "repo_name": "kaizengliu/wechat-python-sdk", "id": "0b111f04921759623f63c5b8b93007cb23d3429b", ...
import ddt import mock from manilaclient import api_versions from manilaclient import extension from manilaclient.tests.unit import utils from manilaclient.tests.unit.v2 import fakes from manilaclient.v2 import share_export_locations extensions = [ extension.Extension('share_export_locations', share_export_locat...
{ "content_hash": "38e498ea88ad8040c81bf034c9533b4f", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 74, "avg_line_length": 30.547619047619047, "alnum_prop": 0.6508183943881528, "repo_name": "sniperganso/python-manilaclient", "id": "614d693ef41e9c0edd579d111d5d997a7ca7a2ab",...
import Image import ImageDraw import time from rgbmatrix import Adafruit_RGBmatrix # Rows and chain length are both required parameters: matrix = Adafruit_RGBmatrix(32,2,3) # Bitmap example w/graphics prims image = Image.new("1", (32, 32)) # Can be larger than matrix if wanted!! draw = ImageDraw.Draw(image) # Dec...
{ "content_hash": "5b28dfcea793567dc06abbc235d489f6", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 72, "avg_line_length": 33.2962962962963, "alnum_prop": 0.7235817575083426, "repo_name": "atmega168/skeeball-pi", "id": "2ed4e6d4893a9c1a1f4f155169c77c1542156f2f", "size": "...
import six import os from st2actions.runners.pythonrunner import Action from st2client.client import Client from st2common.util import jinja as jinja_utils class FormatResultAction(Action): def __init__(self, config=None, action_service=None): super(FormatResultAction, self).__init__(config=config, actio...
{ "content_hash": "d487c03f22b16f9b45bb98b0a7494c00", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 95, "avg_line_length": 39.152542372881356, "alnum_prop": 0.6060606060606061, "repo_name": "emedvedev/st2", "id": "26462d7687897ed85f625b05756c6b4b0472c91b", "size": "2310",...
""" Music package @author: Ronny Andersson (ronny@andersson.tk) @copyright: (c) 2016 Ronny Andersson @license: MIT """ # Local folders from . import scales, spn __all__ = [ 'scales', 'spn', ]
{ "content_hash": "863408414523148492df70d929201920", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 45, "avg_line_length": 13.8, "alnum_prop": 0.6231884057971014, "repo_name": "ronnyandersson/zignal", "id": "98cfcd2eb9e41044b5b8ee16f9f955e488ce0310", "size": "207", "bin...
import roslib; roslib.load_manifest('hrl_pr2_lib') import rospy import kinematics_msgs.srv as ks import hrl_lib.tf_utils as tfu import tf import numpy as np import pdb class PR2ArmKinematics: def __init__(self, arm, listener): self.tflistener = listener rospy.loginfo('PR2ArmKinematics: waiting for...
{ "content_hash": "74a7c04a452885efb3713f28977a49f7", "timestamp": "", "source": "github", "line_count": 158, "max_line_length": 130, "avg_line_length": 45.24683544303797, "alnum_prop": 0.6219051615610575, "repo_name": "gt-ros-pkg/hrl-pr2", "id": "b36f21e682dae7aae3def2af920e2976e68dad71", "size": "...
""" Helper functions to verify `JWT`_ (JSON Web Token) objects. Some are specific to Mozilla Marketplace payments, others are more generic. .. _`JWT`: http://openid.net/specs/draft-jones-json-web-token-07.html """ import calendar from datetime import datetime import json import sys import time import jwt from .exc i...
{ "content_hash": "9ab1e40f2ec2376276b3be32da8a3dbc", "timestamp": "", "source": "github", "line_count": 252, "max_line_length": 78, "avg_line_length": 32.49603174603175, "alnum_prop": 0.5733300769324704, "repo_name": "kumar303/moz_inapp_pay", "id": "773b81d30fd8fdf83cf03b3200f7eaf1ebf888d7", "size"...
"""Replay a log file with multiprocessing.""" from __future__ import with_statement import logging from multiprocessing.dummy import Pool import threading from replay import mapc_time from apache_replay import generate, request POOL = Pool(10) if __name__ == '__main__': logging.basicConfig(level=logging.DEBUG)...
{ "content_hash": "767044d7b8316908d0d6582a585ec440", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 60, "avg_line_length": 24.210526315789473, "alnum_prop": 0.7021739130434783, "repo_name": "ieure/Replay", "id": "40613ce627fc8ccdd3e100f94081cc7f7afc18b0", "size": "560", ...
import logging import os.path from importlib.machinery import ModuleSpec from importlib.util import module_from_spec from urllib.parse import urlunparse from django.conf import settings from django.conf.urls.static import static from django.contrib.sitemaps.views import sitemap from django.contrib.staticfiles.urls imp...
{ "content_hash": "f16ff888f90506963ee3e60af4207b55", "timestamp": "", "source": "github", "line_count": 257, "max_line_length": 89, "avg_line_length": 40.17120622568093, "alnum_prop": 0.519953506392871, "repo_name": "goodtune/vitriolic", "id": "5fe17665799aba3383fd47a83985a499813a474e", "size": "10...
from __future__ import absolute_import import collections import logging from django.conf import settings from django.utils.translation import ugettext_lazy as _ from novaclient import api_versions from novaclient import client as nova_client from novaclient import exceptions as nova_exceptions from novaclient.v2 im...
{ "content_hash": "32ccc06d4ccfebdf3e617a1bddecd9c0", "timestamp": "", "source": "github", "line_count": 1018, "max_line_length": 79, "avg_line_length": 32.445972495088405, "alnum_prop": 0.6448985770511656, "repo_name": "yeming233/horizon", "id": "d6658e21a51884d162c3e5f3b23dec612240c5a8", "size": "...
from setuptools import setup, find_packages long_desc = """ Usage ----- :: rst2db <filename> [-e root_element] [-o output_file] Only the filename to process is required. All other settings are optional. Settings: -e root_element set the root element of the resulting docbook file. If this i...
{ "content_hash": "e78418d4a3d4dac7858956d4ef96c944", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 78, "avg_line_length": 30.07894736842105, "alnum_prop": 0.5783027121609798, "repo_name": "Aleksei-Badyaev/rst2db", "id": "9166a4aa6b4411c677012ee1e8077e7d1505e6dc", "size":...
import configparser Config = configparser.ConfigParser() Config.read("config.ini") print(Config.sections()) def ConfigSectionMap(section): dict1 = {} options = Config.options(section) for option in options: try: dict1[option] = Config.get(section, option) if dict1[option] == -1: DebugPrint("skip: %s"...
{ "content_hash": "bb95e7dbae3c67148096bfc5d38ef7a7", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 55, "avg_line_length": 22.77777777777778, "alnum_prop": 0.6845528455284553, "repo_name": "enorenio/test", "id": "69f44bfcd45807a0257a81f8c5dfba6576ea47cb", "size": "615", ...
import socket import sys import uuid import mock import unittest2 as unittest from quantum.agent.common import config from quantum.agent.linux import interface from quantum.agent.linux import utils from quantum.common import exceptions from quantum.debug import commands from quantum.debug.debug_agent import DEVICE_OW...
{ "content_hash": "e437a94d2184d5bee3b1c653f70e5830", "timestamp": "", "source": "github", "line_count": 326, "max_line_length": 79, "avg_line_length": 49.18098159509202, "alnum_prop": 0.4826919478575438, "repo_name": "aristanetworks/arista-ovs-quantum", "id": "1a8fe9295e1f76bf031ba7d2b369a005151d46f0...
""" rot.progress ~~~~~~~~~~~~ Progress indicators. :Copyright: © 2013, Kwpolska. :License: BSD (see /LICENSE). """ import sys import time from rot import throbber __all__ = ['FrontProgress', 'FrontProgressThrobber'] class FrontProgress(object): """A static progress indicator with numbers. ...
{ "content_hash": "47e7a1c2d0a1138da651fbdd62d85ba6", "timestamp": "", "source": "github", "line_count": 130, "max_line_length": 79, "avg_line_length": 27.7, "alnum_prop": 0.4645931685642877, "repo_name": "Kwpolska/rot", "id": "850578dff3373ac6c728cd2d2a13bed3be85a130", "size": "3748", "binary": f...
''' Created on Apr 9, 2014 @author: Simon ''' import matplotlib from utils import logging # !important: tell matplotlib not to try rendering to a window matplotlib.use('Agg') import io import struct from skimage import io as skio import base64 class NImageInputProtocol(object): ''' MrJob input protocol that ...
{ "content_hash": "e2a71215b1776aeed3aa93a8f4ab026b", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 85, "avg_line_length": 35.39393939393939, "alnum_prop": 0.5856164383561644, "repo_name": "xapharius/HadoopML", "id": "4d76b502d61da1457a2bee004272be0c7f1b7402", "size": "23...
"""Example of ConfigDict usage of lock. This example shows the roles and scopes of ConfigDict's lock(). """ from absl import app from ml_collections import config_dict def main(_): cfg = config_dict.ConfigDict() cfg.integer_field = 123 # Locking prohibits the addition and deletion of new fields but allows ...
{ "content_hash": "49347021d12133e642a150aa7f3a0d1a", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 78, "avg_line_length": 23.548387096774192, "alnum_prop": 0.7, "repo_name": "google/ml_collections", "id": "fe411932cd92f2400c660021e373f9172b35944e", "size": "1322", "bin...
import time import atexit import heapq from subprocess import Popen from threading import Thread from plumbum.lib import IS_WIN32, six try: from queue import Queue, Empty as QueueEmpty except ImportError: from Queue import Queue, Empty as QueueEmpty # type: ignore try: from io import StringIO except Impo...
{ "content_hash": "1fe96f48466e18ec260147ef8ab2ec88", "timestamp": "", "source": "github", "line_count": 318, "max_line_length": 136, "avg_line_length": 36.9559748427673, "alnum_prop": 0.5445881552076243, "repo_name": "AndydeCleyre/plumbum", "id": "c5ab2573c8f37cc0eb60701c5d3e123e32258c5d", "size": ...
DOCUMENTATION = '''This module will add user principals to kerberos if it doesn't exists. It wont change password if user already exist in kerberos.''' EXAMPLES = ''' - name: add user kadduser: name='root' password='kerberos_password' ''' from ansible.module_utils.basic import * from subprocess import PIPE, Popen #...
{ "content_hash": "ee1daf9426b2209267a5f1ca498f2d76", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 151, "avg_line_length": 33.836363636363636, "alnum_prop": 0.6415905427189683, "repo_name": "trustedanalytics/platform-ansible", "id": "c570847043df51f5876fc87c4d0576683490cef...
import numpy as np import matplotlib.pyplot as plt from scipy.optimize import minimize import copy import matplotlib.cm as cm # Make sure that caffe is on the python path: caffe_root = '../' # this file is expected to be in {caffe_root}/examples import sys sys.path.insert(0, caffe_root + 'python') import caffe # Se...
{ "content_hash": "b0554f2679c4268652e9fd72abc955ae", "timestamp": "", "source": "github", "line_count": 76, "max_line_length": 111, "avg_line_length": 33.171052631578945, "alnum_prop": 0.6648155493851646, "repo_name": "smajida/Deep_Inside_Convolutional_Networks", "id": "fd8e90272a392f3d121e94f6d501b2...
""" Filter the event file and the exposure map, divide by CCD, then run xtdac on each CCD """ import argparse import glob import os import sys import astropy.io.fits as pyfits from chandra_suli import find_files from chandra_suli import logging_system from chandra_suli.data_package import DataPackage from chandra_su...
{ "content_hash": "fe4244a188dcfc64b6cf7455056f43f8", "timestamp": "", "source": "github", "line_count": 297, "max_line_length": 120, "avg_line_length": 39.245791245791246, "alnum_prop": 0.5307995881949211, "repo_name": "nitikayad96/chandra_suli", "id": "20dc7d3c726892985429751dedb0b50ffa0b9518", "s...
from typing import List from test_framework import generic_test def buy_and_sell_stock_once(prices: List[float]) -> float: # TODO - you fill in here. return 0.0 if __name__ == '__main__': exit( generic_test.generic_test_main('buy_and_sell_stock.py', 'buy_a...
{ "content_hash": "0bdaeab1af0b6d33e50951b6325054a1", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 64, "avg_line_length": 27, "alnum_prop": 0.5308641975308642, "repo_name": "shobhitmishra/CodingProblems", "id": "9f093fd01a931416d94b4649aab753669e224603", "size": "405", ...
import getpass import sys if sys.stdin.isatty(): p = getpass.getpass('Using getpass:') else: print('Using readline') p = sys.stdin.readline().rstrip() print('Read', p)
{ "content_hash": "a8108d90213a89e6d2eb193fc8bfd8ac", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 41, "avg_line_length": 22.5, "alnum_prop": 0.6666666666666666, "repo_name": "gaufung/PythonStandardLibrary", "id": "84a97cff1808af227e90924ecda1f78bc4376b1b", "size": "180",...
import unittest from contextlib import contextmanager from llvmlite import ir from numba.core import types, typing, callconv, cpu, cgutils from numba.core.registry import cpu_target class TestCompileCache(unittest.TestCase): ''' Tests that the caching in BaseContext.compile_internal() works correctly by ...
{ "content_hash": "814351d08dc5438d37ab46c4f41cfa49", "timestamp": "", "source": "github", "line_count": 153, "max_line_length": 83, "avg_line_length": 42.19607843137255, "alnum_prop": 0.5707868649318464, "repo_name": "IntelLabs/numba", "id": "edeab592d3e69b190fd40515b0aaf5167c2fd4a7", "size": "6456...
from datetime import datetime from HTMLParser import HTMLParser import argparse import json import os import sys import urllib2 ############################################################################### # Options ############################################################################### MAGIC_URL = 'http://...
{ "content_hash": "87910dea3b7305f4c3f20c4e48765dec", "timestamp": "", "source": "github", "line_count": 188, "max_line_length": 82, "avg_line_length": 33.579787234042556, "alnum_prop": 0.5705686678282909, "repo_name": "dhstack/gae-init", "id": "4e23b04e4d928e987e8556c26b1ac870ef33de44", "size": "63...
""" Simple Connect Four game. Author: Chris Lyon Contact: chris@cplyon.ca Date: 2015-09-19 """ import sys from dataclasses import dataclass from enum import IntEnum class Colour(IntEnum): """ Enum of possible cell values on the game board. """ NONE = 0 PLAYER_1 = 1 PLAYER_2 = 2 @dataclass ...
{ "content_hash": "56d058467b09ffaa1b271e13a4a7c3fd", "timestamp": "", "source": "github", "line_count": 287, "max_line_length": 80, "avg_line_length": 29.825783972125436, "alnum_prop": 0.5503504672897196, "repo_name": "cplyon/c4", "id": "fc946d632fdbad14142eaede35717af6e938bcee", "size": "8584", ...
""" Implements a directory-backed addressbook hierarchy. """ __all__ = [ "DirectoryAddressBookHomeProvisioningResource", "DirectoryAddressBookHomeTypeProvisioningResource", "DirectoryAddressBookHomeUIDProvisioningResource", "DirectoryAddressBookHomeResource", ] from twext.python.log import Logger from...
{ "content_hash": "e3e3bd7157b7709076a4996c2dee67be", "timestamp": "", "source": "github", "line_count": 262, "max_line_length": 94, "avg_line_length": 27.106870229007633, "alnum_prop": 0.6775556181357364, "repo_name": "red-hood/calendarserver", "id": "5bddcf64e2fa1a9ec23d3a62cf481b018e1a11c1", "siz...
import logging import os import re import subprocess from telemetry.core.platform import device from telemetry.core.platform.profiler import monsoon from telemetry.core import util util.AddDirToPythonPath(util.GetChromiumSrcDir(), 'build', 'android') from pylib import constants # pylint: disable=import-error from pyl...
{ "content_hash": "3910200ca67467f14899d490a294976c", "timestamp": "", "source": "github", "line_count": 155, "max_line_length": 80, "avg_line_length": 33.193548387096776, "alnum_prop": 0.7049562682215743, "repo_name": "chuan9/chromium-crosswalk", "id": "105700f48cfe7be5d2f995603de8dc0041d75f97", "s...
from ataddrcompare.ataddrcompare import main if __name__ == '__main__': main()
{ "content_hash": "38f5ff2c5fb0afcd853f8b093b4fe928", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 44, "avg_line_length": 21, "alnum_prop": 0.6428571428571429, "repo_name": "gmgeo/at-address-compare", "id": "7ce236700818ff82f70f91b2bab63ba69bbb9e7a", "size": "107", "bin...
import argparse import json import struct import socket import os import sys np = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) print np if np not in sys.path: sys.path.append(np) from time import sleep, time, strptime, mktime from threading import Thread from Queue import Queue, Empty from multiproc...
{ "content_hash": "7ae3d776ac822171d77e5b6b4d9c7b3e", "timestamp": "", "source": "github", "line_count": 397, "max_line_length": 254, "avg_line_length": 43.80856423173803, "alnum_prop": 0.4972401103955842, "repo_name": "huxh10/iSDX", "id": "e768ea7085241073fc4e779c863b07b207e9b8b1", "size": "17457",...
import subprocess import sys import netaddr from oslo_config import cfg import six from rally.common.i18n import _ from rally.common import logging from rally.common import sshutils from rally.plugins.openstack.scenarios.cinder import utils as cinder_utils from rally.plugins.openstack.scenarios.nova import utils as n...
{ "content_hash": "921328235ac971dd7eb5a4b501cf9824", "timestamp": "", "source": "github", "line_count": 219, "max_line_length": 78, "avg_line_length": 38.529680365296805, "alnum_prop": 0.6038160701588055, "repo_name": "eayunstack/rally", "id": "f6e0c43ad4af6f38ecc0f53c535aa448a317df56", "size": "90...
""" The script operates on such directories and files |-- core | `-- deps | |-- emscripten | `-- wasi-sdk | `-- src | |-- llvm-project | `-- wasi-libc `-- test-tools |-- build-wasi-sdk | |-- build_wasi_sdk.py | |-- include | `-- patches `-- w...
{ "content_hash": "7194c346b2d05e4ca96bafdd073e1e4e", "timestamp": "", "source": "github", "line_count": 312, "max_line_length": 126, "avg_line_length": 33.53525641025641, "alnum_prop": 0.6069960814298002, "repo_name": "bytecodealliance/wasm-micro-runtime", "id": "a87cdef69e1a6432131644593ec332ea91257...
__author__ = 'lauft' import os from stat import * class CheckPath(object): """ check whether a path meets certain requirements """ def __init__(self, path): self.path = path def does_exist(self): """ :rtype : bool """ return os.path.exists(self.path) ...
{ "content_hash": "4408a0de80c4b75441245069252438da", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 62, "avg_line_length": 22.49019607843137, "alnum_prop": 0.5797733217088056, "repo_name": "lauft/pyCheck", "id": "23803eb70bb9628c3ab0479254c5ebfa3d06b61c", "size": "1147", ...
import socketserver class TCPHandler(socketserver.StreamRequestHandler): BASE_PATH = "/Users/aria/temp/tcp/" def handle(self): data = self.request.recv(1024).strip() file_name = data.decode("utf-8") print("file_name: %s" % file_name) print("{} wrote:".format(self.client_addre...
{ "content_hash": "d085adc358949a570c9e8477ce418516", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 68, "avg_line_length": 26.26923076923077, "alnum_prop": 0.5592972181551976, "repo_name": "AriaLyy/Aria", "id": "41bb5549d6f65b85ab462898a87a61cd5c092c18", "size": "691", ...
import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError from msrest.exceptions import DeserializationError from msrestazure.azure_operation import AzureOperationPoller from .. import models class SnapshotsOperations(object): """SnapshotsOperations operations....
{ "content_hash": "2de406b4fd76da53a860cdccc45229dc", "timestamp": "", "source": "github", "line_count": 811, "max_line_length": 150, "avg_line_length": 43.57829839704069, "alnum_prop": 0.6344575858751627, "repo_name": "AutorestCI/azure-sdk-for-python", "id": "ad0291d164ff626d5f5ac6f3af6cc67a85d53235"...
from neutron.api.v2 import attributes as attr from neutron.db import allowedaddresspairs_db as addr_pair_db from neutron.db import db_base_plugin_v2 from neutron.db import portsecurity_db from neutron.extensions import allowedaddresspairs as addr_pair from neutron.extensions import portsecurity as psec from neutron imp...
{ "content_hash": "2bb6ee397979279908e0aed07f968687", "timestamp": "", "source": "github", "line_count": 230, "max_line_length": 79, "avg_line_length": 48.60434782608696, "alnum_prop": 0.5414616692011808, "repo_name": "SnabbCo/neutron", "id": "850ebc43a5256edb88f8df4f065bafe829391825", "size": "1177...
"""Unit test for eventmgr - processing Zookeeper events. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import glob import io import os import shutil import tempfile import unittest import kazoo import mock imp...
{ "content_hash": "6359e03314f34a65f869e218cbf847f4", "timestamp": "", "source": "github", "line_count": 350, "max_line_length": 79, "avg_line_length": 34.01714285714286, "alnum_prop": 0.604821098605745, "repo_name": "ceache/treadmill", "id": "62ffd18ffd4f8cf5d0a82cb3960cc9dca2dd63f0", "size": "1190...
import distutils.spawn import traceback import os import shutil import subprocess import re import sys from ansible import errors from ansible.callbacks import vvv import ansible.constants as C from ansible.runner.connection_plugins.ssh import Connection as SSHConn class Connection(object): ''' jail-over-ssh based...
{ "content_hash": "198c3f84c34513bc2a877e3d4047bea6", "timestamp": "", "source": "github", "line_count": 126, "max_line_length": 118, "avg_line_length": 37.88095238095238, "alnum_prop": 0.57950974230044, "repo_name": "nkiraly/ansible-sshjail", "id": "81b1c1470993da7fdb41a7d751a978995823d82f", "size"...
import copy import random from core import actor, bullet, particle from core.actor import * from ui import text, infobubble from utils import utility def load_data(): Player.master_animation_list.build_animation('Idle', ['kuunIdle']) Player.master_animation_list.build_animation('Fire', ['kuunShoot']) Pla...
{ "content_hash": "45a4965a4536df643be5afbdc2d82639", "timestamp": "", "source": "github", "line_count": 315, "max_line_length": 121, "avg_line_length": 38.46984126984127, "alnum_prop": 0.5593332233041756, "repo_name": "JSkelly/TroubleInCloudLand", "id": "4a0bb7e9be01bbacf756d56caa45d02afb03c8ea", "...
import sys from maya import OpenMaya, OpenMayaMPx from murl import MURL _CACHE = {} class MUrlResolver(OpenMayaMPx.MPxFileResolver): fileResolverName = "astipsFileResolver" uriSchemeName = "astips" def decode(self, uriValue): url_string = uriValue.asString() if url_string not in _CACHE:...
{ "content_hash": "a8b7fe04db9b8fbfce5d2f0c39b85f22", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 92, "avg_line_length": 26.864406779661017, "alnum_prop": 0.632807570977918, "repo_name": "astips/tk-astips-app-url-resolver", "id": "9e7f400a6a49811287b548f975cd9d5aecd08365"...
from __future__ import absolute_import import ujson from typing import Any, Dict, List from six import string_types from zerver.lib.test_helpers import tornado_redirected_to_list, get_display_recipient from zerver.lib.test_classes import ZulipTestCase from zerver.models import get_user_profile_by_email class Reactio...
{ "content_hash": "f9f02645e153d730eb7008a3e87ce13a", "timestamp": "", "source": "github", "line_count": 257, "max_line_length": 114, "avg_line_length": 42.96498054474708, "alnum_prop": 0.5134939322586488, "repo_name": "peguin40/zulip", "id": "9213ede384ff04c79d23f89c2b9286bc84e64288", "size": "1106...
from flask import Blueprint api = Blueprint('api', __name__) ################################### # Add api views here: ################################### import auth import users import organizations import jobs import timesheets import export
{ "content_hash": "558039625ebc5176b65282ccb2df27e6", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 35, "avg_line_length": 16.533333333333335, "alnum_prop": 0.5483870967741935, "repo_name": "krrg/gnomon", "id": "fe67c761bfb9e109bc6f8458c78350a38bf53321", "size": "248", ...
from ..api import narrow_buttons, wide_buttons from django import template register = template.Library() @register.simple_tag def wide_social_buttons(request, title, url): return wide_buttons(request, title, url) @register.simple_tag def narrow_social_buttons(request, title, url): return narrow_buttons(reque...
{ "content_hash": "eef2fcfe9a8f2d43f03e2b55f67c8ca6", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 47, "avg_line_length": 28, "alnum_prop": 0.7619047619047619, "repo_name": "umitproject/tease-o-matic", "id": "b2bcfc50256a8feb211b2ef19b04acdb07816829", "size": "336", "b...
from neuralyzer.io.loader import LoaderTemplate FILE_EXTENSIONS = ('txt', ) class Loader(LoaderTemplate): @staticmethod def get_data(filepath,): try: return get_txt_data(filepath) except: raise # reading files # --------------------------------------------------...
{ "content_hash": "569f79c4728a121184869f934d0dad10", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 79, "avg_line_length": 25.636363636363637, "alnum_prop": 0.5425531914893617, "repo_name": "michigraber/neuralyzer", "id": "a98d36a55c43117f95197c9e426be9f293b8c420", "size"...
import logging _logger = logging.getLogger(__name__) class VulnerabilitiesRiskAssessor(object): def __init__(self, whitelist, vulnerabilities): object.__init__(self) self.whitelist = whitelist self.vulnerabilities = vulnerabilities def assess(self): """Returns ```True``` i...
{ "content_hash": "d8663cc4501195a92ea3a96acb72ea2f", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 102, "avg_line_length": 36, "alnum_prop": 0.6013888888888889, "repo_name": "simonsdave/clair-cicd", "id": "cb8fdfdd12fe08f7c2bcda50248a45c2382073ea", "size": "2160", "bin...
"""Script for verifying Syscoin Core release binaries This script attempts to download the signature file SHA256SUMS.asc from syscoincore.org and syscoin.org and compares them. It first checks if the signature passes, and then downloads the files specified in the file, and checks if the hashes of these files match tho...
{ "content_hash": "c3ddc56fc729b12f1939c289ff37248d", "timestamp": "", "source": "github", "line_count": 179, "max_line_length": 80, "avg_line_length": 35.14525139664804, "alnum_prop": 0.6442536957558417, "repo_name": "syscoin/syscoin", "id": "9e24f337abbd12ae203b13ac93c70ed761f3184b", "size": "6500...
"""Tests for the Device Registry.""" import asyncio from unittest.mock import patch import asynctest import pytest from homeassistant.core import callback from homeassistant.helpers import device_registry from tests.common import flush_store, mock_device_registry @pytest.fixture def registry(hass): """Return a...
{ "content_hash": "8f3f1cf68e0bb5787e2ddeee8f21e0cd", "timestamp": "", "source": "github", "line_count": 482, "max_line_length": 87, "avg_line_length": 33.69917012448133, "alnum_prop": 0.6102320999815305, "repo_name": "Teagan42/home-assistant", "id": "7f31c32cde3dee3d91ab5107c4769b5b53ec9629", "size...
from typing import Dict, List, Optional import demistomock as demisto # noqa: F401 import urllib3 from CommonServerPython import * # noqa: F401 # disable insecure warnings urllib3.disable_warnings() class Client(BaseClient): """Client class to interact with the service API This Client implements API call...
{ "content_hash": "75cb205c0bb7e21f86618757523a44f9", "timestamp": "", "source": "github", "line_count": 217, "max_line_length": 124, "avg_line_length": 35.22119815668203, "alnum_prop": 0.598586942300144, "repo_name": "VirusTotal/content", "id": "307716e62085e8c2379ee8ff8dc20dce0a87fc44", "size": "7...
from django.conf import settings from django.conf.urls import url, include from django.conf.urls.static import static from django.contrib import admin from rest_framework.documentation import include_docs_urls from apps.common.index import index urlpatterns = \ [ url(r'^$', index), url(r'^admin/',...
{ "content_hash": "2f3a4a4b299929ae0e062a4ccbd45377", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 108, "avg_line_length": 39.3, "alnum_prop": 0.7175572519083969, "repo_name": "kamilgregorczyk/instalike", "id": "532d738a184a79499c0a97f7bb23dc776c96e665", "size": "786", ...
from setuptools import setup from setuptools import find_packages classifiers = [ 'Development Status :: 3 - Alpha', 'Environment :: Web Environment', 'Intended Audience :: Developers', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2...
{ "content_hash": "48364a78efebe67db218c8b7281f9233", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 67, "avg_line_length": 29.59375, "alnum_prop": 0.6399155227032735, "repo_name": "lqez/flasky", "id": "9a0c14f3cef06cb443428a957b3c787ecabb88a8", "size": "969", "binary": ...
from __future__ import print_function import daemon import logging import netifaces import time import redislite LOG = logging.getLogger('cloudmanager_server') RDB_FILE = '/var/tmp/cloudmanager.rdb' STATUS_KEY = 'cloudmanager_server:status' def get_service_addresses(): listen_addresses = [] for interface in...
{ "content_hash": "ccfc47e2cdc0bcf8e3ed06c538041dc1", "timestamp": "", "source": "github", "line_count": 112, "max_line_length": 126, "avg_line_length": 29.839285714285715, "alnum_prop": 0.6271693596648713, "repo_name": "dwighthubbard/micropython-cloudmanager", "id": "ffed2471c7108f1449afed9e880a427aa...
class MapQuery(object): """Query to retrieve complete ways and relations in an area.""" _QUERY_TEMPLATE = "(node({south},{west},{north},{east});<;);" def __init__(self, south, west, north, east): """ Initialize query with given bounding box. :param bbox Bounding box with limit valu...
{ "content_hash": "068bf41fda3ce492ffe217272ad3ce31", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 80, "avg_line_length": 30.024390243902438, "alnum_prop": 0.5922014622258327, "repo_name": "willemarcel/overpass-api-python-wrapper", "id": "58d71fc94572172ecff437403a9e10f316...
import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'OEmbedVideoPlugin' db.create_table('cmsplugin_oembedvideoplugin', ( ('cmsplugin_ptr', self.gf('django.db...
{ "content_hash": "376610b2d07f4f039e343312916ac29e", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 156, "avg_line_length": 61.950819672131146, "alnum_prop": 0.5885154802857899, "repo_name": "aldryn/aldryn-video", "id": "b6cfe79ff17b522c0ac54df660fbe70220983a35", "size": ...
import unittest, types from pyvisdk import Vim from tests.common import get_options from pyvisdk.facade.task import TaskManager def nothing(): pass def random_string(n): import random import string return ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(n)) TASKS = ['hello...
{ "content_hash": "ebbde5f8a081e9386582d15f2faed7e4", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 91, "avg_line_length": 28.602941176470587, "alnum_prop": 0.6082262210796915, "repo_name": "xuru/pyvisdk", "id": "fec6bba9e3063f400cf2468084195dba76bc8a9c", "size": "1945", ...
"""Tensorflow implementation of LogME for classification. You, Kaichao, et al. "Logme: Practical assessment of pre-trained models for transfer learning." International Conference on Machine Learning. PMLR, 2021. http://proceedings.mlr.press/v139/you21b/you21b.pdf We base our code on the Optimized Fixed Point Iteratio...
{ "content_hash": "e2c5110dc1e7ffef11149e20fe19332f", "timestamp": "", "source": "github", "line_count": 103, "max_line_length": 80, "avg_line_length": 35.1747572815534, "alnum_prop": 0.6740270494065691, "repo_name": "google-research/google-research", "id": "5d05973924effc1cc51a319b21743f8171cd9328", ...
"""Simple text browser for IDLE """ from tkinter import Toplevel, Text, TclError,\ HORIZONTAL, VERTICAL, NS, EW, NSEW, NONE, WORD, SUNKEN from tkinter.ttk import Frame, Scrollbar, Button from tkinter.messagebox import showerror from functools import update_wrapper from idlelib.colorizer import color_config clas...
{ "content_hash": "729b33045b3f757d83183bb240aa5c39", "timestamp": "", "source": "github", "line_count": 194, "max_line_length": 79, "avg_line_length": 35.30927835051546, "alnum_prop": 0.5963503649635037, "repo_name": "batermj/algorithm-challenger", "id": "808a2aefab4f71a3306413cad3abb024a85900fd", ...
from __future__ import absolute_import, division, print_function, unicode_literals import re from abc import abstractmethod, abstractproperty from builtins import zip from future.utils import binary_type, text_type from twitter.common.collections import OrderedSet from pants.util.collections_abc_backport import Iter...
{ "content_hash": "eb21e046d59e83393e91c135e40e3334", "timestamp": "", "source": "github", "line_count": 628, "max_line_length": 100, "avg_line_length": 38.802547770700635, "alnum_prop": 0.6721930400525279, "repo_name": "twitter/pants", "id": "52ebfa3f5edf4e0f74d6e2a34d9d17161711b4f3", "size": "2451...
import logging import time from threading import get_ident as get_thread_ident from typing import Any, Callable, Dict, Tuple, TypeVar, Union import cothread from malcolm.compat import get_stack_size from .errors import TimeoutError T = TypeVar("T") # Make a module level logger log = logging.getLogger(__name__) #...
{ "content_hash": "c76593ff2500b9adcb12aa4a1c127b30", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 84, "avg_line_length": 31.75257731958763, "alnum_prop": 0.5941558441558441, "repo_name": "dls-controls/pymalcolm", "id": "621becca925b5561305509530301bb39773b085b", "size":...
from tacker.sol_refactored.api import api_version from tacker.sol_refactored.common import exceptions as sol_ex from tacker.tests import base class TestAPIVersion(base.BaseTestCase): def test_init_null(self): vers = api_version.APIVersion() self.assertTrue(vers.is_null()) def test_init(self)...
{ "content_hash": "eab695879ba4f42454fb8858ca67028a", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 78, "avg_line_length": 40.725806451612904, "alnum_prop": 0.5552475247524753, "repo_name": "openstack/tacker", "id": "3a96e869fdc7f696610e8b18dc75f34dfb6546d6", "size": "318...
from __future__ import unicode_literals import random import string from unittest import TestCase from mock import patch from datetime import datetime from elasticsearch import Elasticsearch from elasticdata.manager import ( without, group, PersistedEntity, EntityManager, UPDATE, REMOVE, A...
{ "content_hash": "5742cc07bbba930b71f142d1c95d0515", "timestamp": "", "source": "github", "line_count": 412, "max_line_length": 122, "avg_line_length": 35.567961165048544, "alnum_prop": 0.5350757472362495, "repo_name": "sicarrots/elasticdata", "id": "82ba623a4ca8d41bad66c6e8db6627fb300c0354", "size...
fileList = open("fileList.txt", "r") fileName = fileList.readlines() fileList.close() startyear = 1900 endyear = 2017 outfile = open("year.txt", "w") for i in range(len(fileName)): oneFile = open(fileName[i].rstrip(), "r") oneFileContent = oneFile.readlines() oneFile.close() for j in range(len(oneFi...
{ "content_hash": "6ff069c1b43b0f8fc1329ba71f33b281", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 84, "avg_line_length": 30.838709677419356, "alnum_prop": 0.5366108786610879, "repo_name": "BIDS-collaborative/cega-trace", "id": "ac9e6453120f0620416aa039185b6e543ca37e90", ...
from random import shuffle from deck import Deck from copy import copy from events import raise_strategy_card_events, raise_strategy_deck_events from card_decoder.cards import Acquirable from src.strategies.strategy import Strategy # Number of apprentices and militia in each player's starting deck NUM_APPRENTICE = 8 N...
{ "content_hash": "81898b21312fcebb382a04c3c4dc14ea", "timestamp": "", "source": "github", "line_count": 222, "max_line_length": 94, "avg_line_length": 34.527027027027025, "alnum_prop": 0.6919765166340509, "repo_name": "obi1kenobi/ascension-bot", "id": "78eeb8df84ad5c42930b5d1a2e0bd3c9f87cbf82", "si...
try: # Python 2.7 from collections import OrderedDict except: # Python 2.6 from gluon.contrib.simplejson.ordered_dict import OrderedDict from gluon import current from gluon.html import * from gluon.storage import Storage from s3.s3utils import s3_fullname T = current.T settings = current.deployment_...
{ "content_hash": "dc16cb2b19710f9985c28abeffe9ff8b", "timestamp": "", "source": "github", "line_count": 1716, "max_line_length": 187, "avg_line_length": 39.273310023310025, "alnum_prop": 0.4643212203047794, "repo_name": "code-for-india/sahana_shelter_worldbank", "id": "9cdc05d9974ce5283dc74f6beef3f01...