text
stringlengths
4
1.02M
meta
dict
"""Base class for flat config players.""" from typing import List import abc from mpf.core.config_player import ConfigPlayer class FlatConfigPlayer(ConfigPlayer, metaclass=abc.ABCMeta): """Flat show players.""" __slots__ = [] # type: List[str] def validate_config_entry(self, settings, name): ...
{ "content_hash": "d73f273c513aa028655af30ba6e5ee3d", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 77, "avg_line_length": 31.75438596491228, "alnum_prop": 0.6497237569060773, "repo_name": "missionpinball/mpf", "id": "e665ace6fcb404fc5f6167e715da220ae3e8a303", "size": "18...
import copy from cms.test_utils.project.sampleapp.cms_apps import NamespacedApp, SampleApp, SampleApp2 from django.conf import settings from django.contrib.auth.models import AnonymousUser, Permission, Group from django.contrib.sites.models import Site from django.template import Template, TemplateSyntaxError from dja...
{ "content_hash": "3a40386a41cf6c9e35736319e352fc77", "timestamp": "", "source": "github", "line_count": 2128, "max_line_length": 136, "avg_line_length": 39.55169172932331, "alnum_prop": 0.5738421690468836, "repo_name": "benzkji/django-cms", "id": "7f2a89d4eb0d63e5a8e6b88ea6eef036bbe4bdcb", "size": ...
from TASSELpy.utils.Overloading import javaOverload,javaConstructorOverload from TASSELpy.java.lang.Object import Object from TASSELpy.javaObj import javaObj from TASSELpy.utils.helper import make_sig from abc import ABCMeta import javabridge java_imports = {'Enum':'java/lang/Enum', 'Object':'java/lang...
{ "content_hash": "fffcc1a14347415ccdef7d7a45f0c60d", "timestamp": "", "source": "github", "line_count": 172, "max_line_length": 92, "avg_line_length": 30.872093023255815, "alnum_prop": 0.5790960451977402, "repo_name": "er432/TASSELpy", "id": "e10abc933f58ea3219081206ea9816e1f51cfa88", "size": "5310...
import time from threading import Thread from cassandra import ConsistencyLevel from ccmlib.node import ToolError from dtest import Tester, debug, create_ks, create_cf from tools.data import insert_c1c2, query_c1c2 from tools.decorators import since, no_vnodes class TestRebuild(Tester): ignore_log_patterns = ( ...
{ "content_hash": "f7173ef9cce1bfa8a940df9448d660a0", "timestamp": "", "source": "github", "line_count": 438, "max_line_length": 190, "avg_line_length": 45.05936073059361, "alnum_prop": 0.5863903526550466, "repo_name": "krummas/cassandra-dtest", "id": "13d96bad05e1a18a9a51c03101ef63cb26f0936f", "siz...
import argparse import logging import time from glob import glob from os.path import normpath from .. import cli from .base import raise_parse_exception, suppress_exit, Command def register_commands(commands): commands['run-batch'] = RunBatchCommand() commands['sleep'] = SleepCommand() def register_command...
{ "content_hash": "ba0c89bf53d107e6f2589b402a94aff4", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 119, "avg_line_length": 36.54639175257732, "alnum_prop": 0.6118476727785613, "repo_name": "Keeper-Security/Commander", "id": "63ec3e35cea3da4d8000d218c592bb8a5a64edf3", "si...
import tests.missing_data.test_missing_data_ozone_generic as gen gen.test_ozone_missing_data('DiscardRow', 'Mean')
{ "content_hash": "d78efe69011fc88537701b26dd7feaff", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 64, "avg_line_length": 38.666666666666664, "alnum_prop": 0.7844827586206896, "repo_name": "antoinecarme/pyaf", "id": "e6a6b8ee09fd7a27e808f9159296ff7c3346f083", "size": "116...
from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'User' db.create_table(u'presentationsapp_user', ( (u'id', self.gf('dj...
{ "content_hash": "5e3878883e97f89def856b755dbab0f1", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 144, "avg_line_length": 56.27906976744186, "alnum_prop": 0.5925619834710744, "repo_name": "masonsbro/presentations", "id": "3cfcb1eab024a3dff207e8789515184b04e795d7", "size...
import particleDataStructures as pds from BrickPi import * #import BrickPi.py file to use BrickPi operations from numpy import * import random LEFT_MOTOR = PORT_A RIGHT_MOTOR = PORT_C LEFT_TOUCHSENSOR = PORT_3 RIGHT_TOUCHSENSOR = PORT_1 SONAR_SENSOR = PORT_2 stdDev = 0.05 likeliOffset = 0.2 likeliThreshold = 0...
{ "content_hash": "ce12bcf9030c84cabe6dd1c7b226bb34", "timestamp": "", "source": "github", "line_count": 378, "max_line_length": 133, "avg_line_length": 31.724867724867725, "alnum_prop": 0.608155436957972, "repo_name": "Phoenix1708/Robotics_Imperial", "id": "5854ab77085268fe062cb6a99d8ad455f5253e79", ...
import sys, os from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand import pyflapjackevents from setuptools.command.test import test as TestCommand class PyTest(TestCommand): def finalize_options(self): TestCommand.finalize_options(self) self.test_a...
{ "content_hash": "62f45b29a5ff1043f5521aad691f7321", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 64, "avg_line_length": 27.177777777777777, "alnum_prop": 0.6287816843826656, "repo_name": "tuenti/pyflapjackevents", "id": "89a83d0da3904dc10805c5c716a7bba19255cefd", "size...
from fabric.api import * from fabric.contrib.files import upload_template, append import time import config @task def uname(): """Execute uname""" run("uname -a") @task def upgrade(): """Upgrade a sever""" sudo("DEBIAN_FRONTEND=noninteractive apt-get update -y") sudo("DEBIAN_FRONTEND=noninterac...
{ "content_hash": "db1d2bb92f0fe0e1c19cbea5b7b584fc", "timestamp": "", "source": "github", "line_count": 161, "max_line_length": 110, "avg_line_length": 23.906832298136646, "alnum_prop": 0.606131462717589, "repo_name": "Azimut-Prod/azimut-deploy", "id": "116c56b7b8d744231cdf5250501c94194e96096c", "s...
from __future__ import unicode_literals from django.db import migrations, models def update_slug(apps, schema_editor): Post = apps.get_model('blog', 'Post') for post in Post.objects.all(): post.slug = str(post.id) post.save() class Migration(migrations.Migration): dependencies = [ ...
{ "content_hash": "2e6fc7bdb3720ae1206b11626b90c4e4", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 60, "avg_line_length": 23.903225806451612, "alnum_prop": 0.5695006747638327, "repo_name": "liuenyan/django-blog", "id": "0fa06e14f5d873d0b4d152b3cf1e91422fcb791e", "size": ...
import argparse import json import os import sys # This logic is needed when tool.py is invoked directly by the user # and when the glop directory is neither installed nor automatically # put in the path (i.e., the user isn't in the directory above this file). d = os.path.abspath(os.path.dirname(os.path.dirname(__file...
{ "content_hash": "f79e183d1c5c569b2f36d77684d4f597", "timestamp": "", "source": "github", "line_count": 219, "max_line_length": 79, "avg_line_length": 32.68036529680365, "alnum_prop": 0.5900516976386754, "repo_name": "dpranke/glop", "id": "93705e077d486ee0237764cc865980ed5863920e", "size": "7767", ...
from __future__ import absolute_import, division, print_function, unicode_literals import sys import itertools PYTHON3 = sys.version_info >= (3, 0) zip_longest = itertools.zip_longest if PYTHON3 else itertools.izip_longest unicode_t = str if PYTHON3 else unicode long_t = int if PYTHON3 else long if not PYTHON3: #...
{ "content_hash": "22227b379bec545221a3148b1219c005", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 82, "avg_line_length": 24.8, "alnum_prop": 0.7473118279569892, "repo_name": "kmaehashi/jubakit", "id": "ad5527172254655b30fa0e99e5725880d710f91d", "size": "397", "binary"...
from django.core.management.base import BaseCommand from mainapp.functions.city_to_ags import city_to_ags_all class Command(BaseCommand): help = "Queries wikidata to get the ags of a city" def add_arguments(self, parser): parser.add_argument("city-name", type=str) def handle(self, *args, **opti...
{ "content_hash": "9550bd97aea39fb22aec22ade8b3e29f", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 61, "avg_line_length": 32.588235294117645, "alnum_prop": 0.6425992779783394, "repo_name": "meine-stadt-transparent/meine-stadt-transparent", "id": "6b35814eb8baa0bcd3454be63e...
from core.himesis import Himesis, HimesisPreConditionPatternLHS import uuid class HUnitConnectIEC_CompleteLHS(HimesisPreConditionPatternLHS): def __init__(self): """ Creates the himesis graph representing the AToM3 model HUnitConnectIEC_CompleteLHS """ # Flag this instance as compiled now self.is_compiled =...
{ "content_hash": "1b2a8a3bae783eb469837a981ede29dc", "timestamp": "", "source": "github", "line_count": 91, "max_line_length": 110, "avg_line_length": 31.318681318681318, "alnum_prop": 0.6463157894736842, "repo_name": "levilucio/SyVOLT", "id": "fa1e5e57b0760a142e876f2d2c5ab0db88c72653", "size": "28...
""" partition_suggestion.py purpose: Given Nx, Ny, Nz and a number of processes, suggest a partitioning strategy that would result in more-or-less cube-shaped partitions """ import random from collections import deque def random_partition(factors,n_factors): """ factors = list of prime factors of a number ...
{ "content_hash": "ada8f0178561764b9abf1f788fceb24a", "timestamp": "", "source": "github", "line_count": 204, "max_line_length": 107, "avg_line_length": 26.715686274509803, "alnum_prop": 0.5726605504587156, "repo_name": "stu314159/pyNFC", "id": "6012a851c28f4c8f0b5400d4df17234619c3c584", "size": "54...
""" Classes for generating pillar rooms """ from random import Random from pyherc.aspects import log_debug from pyherc.generators.level.room.squareroom import SquareRoomGenerator from pyherc.generators.level.partitioners import section_floor, section_wall class PillarRoomGenerator(): """ Class for generatin...
{ "content_hash": "2a7090266c3f6e8c9b48ede8d161d30f", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 76, "avg_line_length": 31.25925925925926, "alnum_prop": 0.5363349131121643, "repo_name": "tuturto/pyherc", "id": "2be18107da73f7c926b4a43ff552fcd4744f9bab", "size": "3658",...
import tests.model_control.test_ozone_custom_models_enabled as testmod testmod.build_model( ['None'] , ['MovingMedian'] , ['Seasonal_DayOfMonth'] , ['SVR'] );
{ "content_hash": "616e1281f140de1549fe8cd2a415113b", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 87, "avg_line_length": 40, "alnum_prop": 0.7125, "repo_name": "antoinecarme/pyaf", "id": "618904be77cf0917e25892401398f93b4bf6e91f", "size": "160", "binary": false, "cop...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('person', '0025_auto_20160227_1505'), ] operations = [ migrations.AlterField( model_name='dentist', name='register_number', ...
{ "content_hash": "9da7ae96707924f02d854a90a19b4e7b", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 74, "avg_line_length": 24.347826086956523, "alnum_prop": 0.5767857142857142, "repo_name": "nanomolina/JP", "id": "39bc8903a08fd25a5772e278aa2856177dd94f0e", "size": "632", ...
import cgi print("Content-type: text/html") import sys import os PACKAGE_PARENT = '..' SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__)))) sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT))) from lib import helpers print(helpers.render('hea...
{ "content_hash": "e118305cc1895a876deaa6d692c264b3", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 103, "avg_line_length": 25.235294117647058, "alnum_prop": 0.6923076923076923, "repo_name": "Secretmapper/updevcamp-session-2-dist", "id": "a94280ad126ce2c88ea324ddc182505e768...
from helpers.db import db from uuid import UUID from enum import Enum from datetime import datetime import json def translate_model_data_to_json_safe_data(pg_data): if isinstance(pg_data, datetime): pg_data = pg_data.isoformat() elif isinstance(pg_data, UUID): pg_data = str(pg_data) elif isinstance(pg_data, ...
{ "content_hash": "2624b58fd5a52bf32773a4759bc66666", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 85, "avg_line_length": 22.133333333333333, "alnum_prop": 0.6822289156626506, "repo_name": "davidhariri/api", "id": "f701ec1dc77669123f5a5502f24c68cb534d9b68", "size": "1328...
import os import uuid from google.cloud import firestore import pytest import snippets os.environ['GOOGLE_CLOUD_PROJECT'] = os.environ['FIRESTORE_PROJECT'] UNIQUE_STRING = str(uuid.uuid4()).split("-")[0] class TestFirestoreClient(firestore.Client): def __init__(self, *args, **kwargs): self._UNIQUE_STR...
{ "content_hash": "d0e98ed65fcf21acea7542917fd5a5a9", "timestamp": "", "source": "github", "line_count": 318, "max_line_length": 76, "avg_line_length": 22.5062893081761, "alnum_prop": 0.6861813609054073, "repo_name": "GoogleCloudPlatform/python-docs-samples", "id": "46cfc01e55846f144177e5579813672853a...
from django.contrib import admin from ..models.foo import Foo admin.site.register(Foo)
{ "content_hash": "45a3cacef5538d9d71ba4bebb38a6b3f", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 32, "avg_line_length": 18.8, "alnum_prop": 0.7446808510638298, "repo_name": "yephper/django", "id": "d1a663027a0c932acc4c679366149fa51c589f34", "size": "94", "binary": fal...
""" Holds event definitions to be used by services for generating events """ from .base import EventBase from .types import ( ActivePolicyBundleContentChanged, ActivePolicyBundleIdChanged, FeedGroupSyncCompleted, FeedGroupSyncFailed, FeedGroupSyncStarted, FeedSyncCompleted, FeedSyncFailed, ...
{ "content_hash": "97c5429c5f70cf8bd54bf7d6f96d5816", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 113, "avg_line_length": 26.452380952380953, "alnum_prop": 0.7632763276327633, "repo_name": "anchore/anchore-engine", "id": "f92cdd22cf4844b160d0d875a200886844e27e74", "size...
""" TNC: A Python interface to the TNC non-linear optimizer TNC is a non-linear optimizer. To use it, you must provide a function to minimize. The function must take one argument: the list of coordinates where to evaluate the function; and it must return either a tuple, whose first element is the value of the function...
{ "content_hash": "d9ed8f19b3073892fb388d657486c998", "timestamp": "", "source": "github", "line_count": 422, "max_line_length": 84, "avg_line_length": 37.791469194312796, "alnum_prop": 0.6082894406822172, "repo_name": "arokem/scipy", "id": "3cc9e64429c4a1cf0c4ba7b5e896f5b34fbbeb5b", "size": "17152"...
import logging from typing import Optional import nbformat from great_expectations import DataContext from great_expectations.datasource.types import DatasourceTypes from great_expectations.render.renderer.notebook_renderer import BaseNotebookRenderer try: import black except ImportError: black = None logge...
{ "content_hash": "704047da7d747d29ace1d81aa749e229", "timestamp": "", "source": "github", "line_count": 146, "max_line_length": 558, "avg_line_length": 50.71917808219178, "alnum_prop": 0.7133018230925051, "repo_name": "great-expectations/great_expectations", "id": "ec18709018ae8a7bbab6e929d121aaf9f07...
from django.conf.urls.defaults import * urlpatterns = patterns('populous.inlines.views.admin', url(r'^render/$', 'render', name='inlines-admin-render'), url(r'^(?P<app_label>[-\w]+)/(?P<inline_name>[-\w]+)/form/$', 'form', name='inlines-admin-form'), )
{ "content_hash": "2bd0c66bbf63bc6a54352535813dfa86", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 101, "avg_line_length": 43.666666666666664, "alnum_prop": 0.6412213740458015, "repo_name": "caiges/populous", "id": "24a4c2fe1e9571447b0dc294555843f63b8582a0", "size": "262"...
from functools import wraps import sys import warnings from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured # NOQA from django.db.models.query import Q, QuerySet, Prefetch # NOQA from django.db.models.expressions import ExpressionNode, F, Value, Func, Case, When # NOQA from django.db.models.m...
{ "content_hash": "96fab16d611ae1612928417de2b70d18", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 91, "avg_line_length": 38.75, "alnum_prop": 0.7137096774193549, "repo_name": "runekaagaard/django-contrib-locking", "id": "9348529625441aa4ecb462c3ceef6a9199d7dc6c", "size"...
from . import ping from . import sitemaps
{ "content_hash": "9535efd176117ae1a58adec3f45d6aa6", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 22, "avg_line_length": 20.5, "alnum_prop": 0.7804878048780488, "repo_name": "patrykomiotek/seo-monitor-api", "id": "d4fe734db4835aeab52ec96f2054b6c22f7f74be", "size": "41", ...
from sklearn.neighbors import * from numpy import genfromtxt,zeros,savetxt,tile,where def fileToMat(file,labelsPresent): labels=None fileData = genfromtxt(file,delimiter=',',skip_header=1,dtype="int") if labelsPresent: labels=fileData[:,0] fileData=fileData[:,1:] return fileData,labels ...
{ "content_hash": "b8b064c17dd26618078036737901f3ab", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 105, "avg_line_length": 37.08163265306123, "alnum_prop": 0.6653824986241057, "repo_name": "apatti/apatti_ml", "id": "e7e560c02cab954ea782c45adce96c97c365bcaf", "size": "181...
import sys, os import numpy as np import pandas as pd import scipy.stats as stats from StringIO import StringIO from random import randrange, sample, shuffle import re from functools import partial from itertools import chain from operator import itemgetter from collections import OrderedDict ## 3rd party from configo...
{ "content_hash": "b226e199bff47778d13b473f984bb51a", "timestamp": "", "source": "github", "line_count": 517, "max_line_length": 83, "avg_line_length": 33.20696324951644, "alnum_prop": 0.5240563839701771, "repo_name": "nick-youngblut/SIPSim", "id": "1fddb47c465d64033a48e5d2195ea27183f5c9ab", "size":...
""" This overrides the Category with the class loaded from the PUBLICATION_BACKBONE_CATEGORY_MODEL setting if it exists. """ from django.conf import settings from publication_backbone.utils.loader import load_class #============================================================================== # Extensibility #======...
{ "content_hash": "7009824c96a6af891e734589735cc642", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 79, "avg_line_length": 43.92857142857143, "alnum_prop": 0.5967479674796748, "repo_name": "Excentrics/publication-backbone", "id": "ccb6b115bcc48ef889286e82c2780a7e75445248", ...
from ..dojo_test_case import DojoTestCase, get_unit_tests_path from dojo.tools.solar_appscreener.parser import SolarAppscreenerParser from dojo.models import Test class TestSolarAppscreenerParser(DojoTestCase): def test_solar_appscreener_parser_with_no_vuln_has_no_findings(self): testfile = open( ...
{ "content_hash": "4641af10b49402014d90061c00448630", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 94, "avg_line_length": 48.046875, "alnum_prop": 0.672520325203252, "repo_name": "rackerlabs/django-DefectDojo", "id": "5268b3621e01c2369838e44acd118db7b0de7b3d", "size": "3...
''' Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this ...
{ "content_hash": "2ccc4659e3eee94ddae67772d5d44278", "timestamp": "", "source": "github", "line_count": 124, "max_line_length": 122, "avg_line_length": 32.814516129032256, "alnum_prop": 0.7230277709510936, "repo_name": "telefonicaid/fiware-cosmos-ambari", "id": "4007f8fb2b4ab7248c6261c373b7892b8116f6...
""" Simple demonstration of the plane geometry. """ import sys from vispy import scene, geometry canvas = scene.SceneCanvas(keys='interactive', size=(800, 600), show=True) view = canvas.central_widget.add_view() vertices, faces, outline = geometry.create_plane(width=2, height=4, ...
{ "content_hash": "2d5708a34c01ecd21b2c918772f3985c", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 78, "avg_line_length": 33.82142857142857, "alnum_prop": 0.5248152059134108, "repo_name": "Eric89GXL/vispy", "id": "4e9a3b335e9585b15590aa3e283f745a613fd298", "size": "1107"...
""" Implements visualizers that use the silhouette metric for cluster evaluation. """ ########################################################################## ## Imports ########################################################################## import numpy as np import matplotlib.ticker as ticker from sklearn.met...
{ "content_hash": "a3718f9e7aa3bf4565c2b95193dc1821", "timestamp": "", "source": "github", "line_count": 322, "max_line_length": 85, "avg_line_length": 37.900621118012424, "alnum_prop": 0.6255326122582759, "repo_name": "DistrictDataLabs/yellowbrick", "id": "3af5d337b0811e432df9ca03fdb2b015c0aa01fb", ...
""" Admin views for managing shares. """ from django.urls import reverse from django.urls import reverse_lazy from django.utils.translation import gettext_lazy as _ from horizon import exceptions from horizon import forms from horizon import tables from horizon.utils import memoized from manila_ui.api import manila f...
{ "content_hash": "af7a0394086c42c265cf09cc003c1b91", "timestamp": "", "source": "github", "line_count": 264, "max_line_length": 79, "avg_line_length": 36.246212121212125, "alnum_prop": 0.6307869160831853, "repo_name": "openstack/manila-ui", "id": "7ec5a153bcdb5980ef7dce92d37b1a303d6f542d", "size": ...
import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from tensorflow.python.framework import tensor_shape from tensorflow.python.layers import base from tensorflow.python.layers import utils from tensorflow.python.ops import array_ops from tensorflow.python.op...
{ "content_hash": "ba0d9868059973a565d632318cb28fff", "timestamp": "", "source": "github", "line_count": 1756, "max_line_length": 140, "avg_line_length": 44.4003416856492, "alnum_prop": 0.6188387394666974, "repo_name": "shaform/DeepNetworks", "id": "99da5a26c606e9516940253c7a04391d51ea38a4", "size":...
import pyjd from pyjamas import DOM from __pyjamas__ import JS if not pyjd.is_desktop: JS(""" var focusHandler = null; """) def ensureFocusHandler(): pass def createFocusHandler(): pass def createFocusable0(): pass def blur(elem): elem.blur() def createFocusable(): e = DOM....
{ "content_hash": "60e318078b9da405c3a84688e9dde0fe", "timestamp": "", "source": "github", "line_count": 86, "max_line_length": 77, "avg_line_length": 22.162790697674417, "alnum_prop": 0.6306400839454355, "repo_name": "minghuascode/pyj", "id": "dd456233298aef3aaddde657d41a73bedb51eae1", "size": "256...
factorial = lambda n: reduce(lambda lhs, rhs: lhs * rhs, range(1, n + 1)) def test(condition): if condition(): print('Thumbs up.') else: print('Thumbs down.') def is_equal_to(lhs, rhs): return lambda: lhs == rhs test(is_equal_to(factorial(1), 1)) test(is_equal_to(factorial(2), 2)) test(is_equal_to(factorial...
{ "content_hash": "3d4816936c2b9e337cd4b2cce5191722", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 73, "avg_line_length": 24.4, "alnum_prop": 0.6584699453551912, "repo_name": "regnart-tech-club/programming-concepts", "id": "b90d149725990571779ad7b05c87cf4b0e3bc05b", "siz...
from setuptools import setup from _pysh import __version__ setup( name="py.sh-helpers", version=".".join(map(str, __version__)), license="BSD", description="Helper module for py.sh.", author="Dave Hall", author_email="[email protected]", url="https://github.com/etianen/py.sh", packages=...
{ "content_hash": "34744786120955627ae433629bb30942", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 49, "avg_line_length": 28.636363636363637, "alnum_prop": 0.5968253968253968, "repo_name": "etianen/py.sh", "id": "c9073056f9442074bdcbfedba5d20d8a9a04db8f", "size": "630", ...
import pytest from flask import json from willstores.util.response_schema import GenderSchema def test_gender_default(flask_app_client): response = flask_app_client.get( "/gender/men", headers={"Accept": "application/json"} ) data = json.loads(response.data) GenderSchema(strict=True)....
{ "content_hash": "cf5fae7a8190175edd758123edc47af6", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 56, "avg_line_length": 24.247311827956988, "alnum_prop": 0.6039911308203991, "repo_name": "willrogerpereira/willbuyer", "id": "fbb324e2937b028a1d20cbec95c26f90b3374110", "s...
from pyjamas.ui.Sink import Sink, SinkInfo from pyjamas.ui.Image import Image from pyjamas.ui.HTML import HTML from pyjamas.ui.VerticalPanel import VerticalPanel from pyjamas.ui.HorizontalPanel import HorizontalPanel from pyjamas.ui.AutoComplete import AutoCompleteTextBox class AutoCompleteTab(Sink): def __init__(...
{ "content_hash": "ef96c59547a823e4b926185a7fecb200", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 170, "avg_line_length": 40.45161290322581, "alnum_prop": 0.6794258373205742, "repo_name": "minghuascode/pyj", "id": "e06aca0e004eb4c46ebafdfbbec287ac6eba86db", "size": "125...
r"""HTTP cookie handling for web clients. This module has (now fairly distant) origins in Gisle Aas' Perl module HTTP::Cookies, from the libwww-perl library. Docstrings, comments and debug strings in this code refer to the attributes of the HTTP cookie system as cookie-attributes, to distinguish them clearly from Pyt...
{ "content_hash": "470385b38aca25b663d791dce6c3e724", "timestamp": "", "source": "github", "line_count": 2107, "max_line_length": 83, "avg_line_length": 36.4437588989084, "alnum_prop": 0.5396616614791566, "repo_name": "batermj/algorithm-challenger", "id": "adc7ed62425d06f717deb2d899504b54d69a8285", ...
""" The generator creating the output HTML APACHE LICENSE 2.0 Copyright 2013 Sebastian Dahlgren 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 Unles...
{ "content_hash": "9bf679139958888a630bb44a550a9ae1", "timestamp": "", "source": "github", "line_count": 127, "max_line_length": 83, "avg_line_length": 35.346456692913385, "alnum_prop": 0.6123858320338605, "repo_name": "sebdah/markdown-docs", "id": "b1163245f7c8722d4fcd26319db6d0e1d3aca76f", "size":...
import math import mathutils import struct import bpy import json writePackedBinary = True filepathPRFX = bpy.data.filepath.rsplit('.', 1)[0] meshfile = open(filepathPRFX + ".mesh.bin", "wb") if writePackedBinary else open(filepathPRFX + ".mesh.json", "w") matfile = open(filepathPRFX + ".mat.json", "w") camfile = op...
{ "content_hash": "0df6bfed1f3db904fb47a97d71b2c76b", "timestamp": "", "source": "github", "line_count": 152, "max_line_length": 119, "avg_line_length": 37.60526315789474, "alnum_prop": 0.5844996501049685, "repo_name": "bensteinert/chromarenderer-java", "id": "5230bf2a2f1971de70a91e69cbcc724818bdb513"...
from django import forms import datetime class RecipeForm(forms.Form): name = forms.CharField(label='name') created = forms.DateField(initial=datetime.date.today) servings = forms.IntegerField(label='servings') description = forms.CharField(label='description', widget=forms.Textarea) ingredients =...
{ "content_hash": "52550a517c4afd0a56abd0772242ff28", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 79, "avg_line_length": 41.90909090909091, "alnum_prop": 0.7613882863340564, "repo_name": "sarasafavi/introdjango", "id": "a911ec82fbe1e3ad646f2d33273b1fd1e851ba22", "size":...
""" PyRemote Used by PyRemote files generated by /thrift/compiler/generate/t_py_generator.cc Remote.run is the interface used by the generated code. Based on whether --host or --url is specified as a commandline option, either a RemoteHostClient or RemoteHttpClient is instantiated to handle the request. Additional...
{ "content_hash": "ddea308f11a8779e601a35bda1e16b23", "timestamp": "", "source": "github", "line_count": 836, "max_line_length": 88, "avg_line_length": 33.44976076555024, "alnum_prop": 0.5479902732084108, "repo_name": "facebook/fbthrift", "id": "c1d9d536ce5f042f8f9feae22ede001a5b0f888d", "size": "28...
""" WSGI config for DjangoTest 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.6/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "DjangoTest.settings") from django....
{ "content_hash": "4a599982b94a9f2defac2605295e3e7a", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 78, "avg_line_length": 28.214285714285715, "alnum_prop": 0.7772151898734178, "repo_name": "walkskyer/DjangoTest", "id": "9000219092d63127bebb179204d0c9da2e7ea3de", "size": ...
''' a package of helper methods to tackle common aws client interactions ''' __author__ = 'rcj1492' __created__ = '2017.06' __licence__ = 'MIT' def construct_client_ec2(ec2_cred, region_name=''): if region_name: ec2_cred['region_name'] = region_name from labpack.authentication.aws.iam import AWSCo...
{ "content_hash": "d8f7b23f70356f418a603cc3133dd093", "timestamp": "", "source": "github", "line_count": 296, "max_line_length": 132, "avg_line_length": 37.939189189189186, "alnum_prop": 0.598753339269813, "repo_name": "collectiveacuity/pocketLab", "id": "3f35f07b613008f3e7bad1bb28d5d0bff465ebca", "...
import sys from django.utils import six from django.db.models.query import QuerySet as DjangoQuerySet from mongoengine.errors import NotUniqueError from mongoengine import queryset as qs class QueryWrapper(object): # XXX: copy funcs from django; now it's just wrapper select_related = False order_by = []...
{ "content_hash": "9714d6c0d493a83e551a3725ad499345", "timestamp": "", "source": "github", "line_count": 102, "max_line_length": 90, "avg_line_length": 24.784313725490197, "alnum_prop": 0.6139240506329114, "repo_name": "unixhot/opencmdb", "id": "cff5bda49f9a533d286e33fe8f6d500d9115c586", "size": "25...
"""Defer to run_test_cases.py.""" import os import optparse import sys ROOT_DIR = os.path.dirname( os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) def pop_known_arguments(args): """Extracts known arguments from the args if present.""" rest = [] run_test_cases_extra_args = [] for arg in args...
{ "content_hash": "53a55c2c655546d094f7fd5cf1d1afab", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 77, "avg_line_length": 31.608247422680414, "alnum_prop": 0.642204827136334, "repo_name": "mogoweb/chromium-crosswalk", "id": "99670718a32952849aba9dc97857e8366cdd9852", "si...
""" The manager class for the blog models """ from django.db import models from django.db.models.query import QuerySet from django.db.models.query_utils import Q from django.utils.timezone import now class NewsItemQuerySet(QuerySet): def published(self): """ Return only published entries "...
{ "content_hash": "a175586026f466ea1d2e46475528f70e", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 78, "avg_line_length": 26.473684210526315, "alnum_prop": 0.6312127236580517, "repo_name": "jfterpstra/bluebottle", "id": "9960a399da43773a0827c7c1d9d8614f416ac470", "size":...
import numpy as np from threeML.plugins.XYLike import XYLike from threeML.utils.histogram import Histogram from threeML.plugins.OGIP.likelihood_functions import poisson_log_likelihood_ideal_bkg from threeML.plugins.OGIP.likelihood_functions import half_chi2 __instrument_name = "n.a." class HistLike(XYLike): de...
{ "content_hash": "44bb9ec07cc3c3272ee634bdc762a504", "timestamp": "", "source": "github", "line_count": 106, "max_line_length": 106, "avg_line_length": 32.39622641509434, "alnum_prop": 0.6086196854979615, "repo_name": "volodymyrss/3ML", "id": "884f53f159ef6e1c61c6e007cbeb0b6685461be0", "size": "343...
from __future__ import print_function import sys import string import libxml2 import libxslt import re import math # Some globals pixelsPerInch = 96.0 unitHash = { 'in': pixelsPerInch, 'cm': pixelsPerInch / 2.54, 'mm': pixelsPerInch / 25.4, 'pc': (pixelsPerInch / 72.0) * 12, ...
{ "content_hash": "e0ab8aed95c43c8946f1ec51b5be2f1c", "timestamp": "", "source": "github", "line_count": 238, "max_line_length": 81, "avg_line_length": 30.252100840336134, "alnum_prop": 0.575, "repo_name": "timj/scons", "id": "e7b8cfa9f71c35b217ad495170132f44487b6753", "size": "7282", "binary": fa...
import logging from functools import wraps import numpy as np from matplotlib.figure import Figure from ..external.modest_image import extract_matched_slices from ..core.exceptions import IncompatibleAttribute from ..core.data import Data from ..core.util import lookup_class from ..core.subset import Subset, RoiSubse...
{ "content_hash": "edf8ad4e0fa0d72d330f02b67f2402dc", "timestamp": "", "source": "github", "line_count": 638, "max_line_length": 78, "avg_line_length": 31.365203761755485, "alnum_prop": 0.5567937634301134, "repo_name": "bsipocz/glue", "id": "871400233b51748d931c6493a3d4b373a3738e4a", "size": "20011"...
""" Click Command definition for the subscription command group which includes commands for managing subscriptions to indications on WBEM servers including adding, displaying, and remvoving destinations, filters, and subscriptions from a WBEM server. This command group is based on the pywbem WBEMSubscriptionManager c...
{ "content_hash": "b72338fb53b20a486dad65f82c47f5dc", "timestamp": "", "source": "github", "line_count": 2120, "max_line_length": 124, "avg_line_length": 40.9566037735849, "alnum_prop": 0.6339660017505874, "repo_name": "pywbem/pywbemtools", "id": "cc7dd10bffe270d37010224243e3b5fa772a104d", "size": "...
"""Shared utilities for the build recipe module.""" # This lists the products we want to isolate as outputs for future steps. DEFAULT_BUILD_PRODUCTS = [ 'dm', 'dm.exe', 'dm.app', 'fm', 'fm.exe', 'nanobench.app', 'get_images_from_skps', 'get_images_from_skps.exe', 'nanobench', 'nanobench.exe', 's...
{ "content_hash": "a6eae3cf940bcbac04c43c347acac403", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 74, "avg_line_length": 24.33783783783784, "alnum_prop": 0.6141032759578012, "repo_name": "aosp-mirror/platform_external_skia", "id": "060c711506b6e68bd77e9981fa2d65045663eb89...
from rpython.rlib.objectmodel import specialize, we_are_translated, compute_hash from rpython.tool.pairtype import extendabletype # Union-Object to represent a json structure in a static way class JsonBase(object): __metaclass__ = extendabletype is_string = is_int = is_float = is_bool = is_object = is_array =...
{ "content_hash": "e0b1bbd12492f2085f820d3f59aff5f6", "timestamp": "", "source": "github", "line_count": 285, "max_line_length": 107, "avg_line_length": 23.13684210526316, "alnum_prop": 0.5991810737033667, "repo_name": "samth/pycket", "id": "0bd25f6f85edc9c56d290153b6f4555375a000c5", "size": "6594",...
""" rohmu - azure object store interface Copyright (c) 2016 Ohmu Ltd See LICENSE for details """ import dateutil.parser import time from azure.storage import BlobService # pylint: disable=no-name-in-module, import-error from .base import BaseTransfer class AzureTransfer(BaseTransfer): def __init__(self, account...
{ "content_hash": "ea0578b2e89ca68733107815d80f14f4", "timestamp": "", "source": "github", "line_count": 89, "max_line_length": 119, "avg_line_length": 46.91011235955056, "alnum_prop": 0.6467065868263473, "repo_name": "kri5/pghoard", "id": "bedd19be339d7c825a26b59a2c3ac206f5f57110", "size": "4175", ...
"""Metadata linking semantic meaning of EIA 861 spreadsheet columns across years."""
{ "content_hash": "aca50c5d77bf93ffebaabc674ff6a347", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 84, "avg_line_length": 85, "alnum_prop": 0.788235294117647, "repo_name": "catalyst-cooperative/pudl", "id": "9b9a38a27bdcabd6ffa51a826eadf51f6d0fb5c3", "size": "85", "bina...
import json import matplotlib.pyplot as plt import matplotlib as mpl import os from scipy import stats import numpy import commonfunctions as cf root_directory = os.path.dirname(os.path.abspath(os.curdir)) with open('complexity-time-party.json', 'r') as f: results = json.load(f) r, d = [None] * 2 for party in r...
{ "content_hash": "d7c629027c280cc7d95eebb7f6cb2b56", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 103, "avg_line_length": 30.6, "alnum_prop": 0.6619132501485443, "repo_name": "keelanfh/electionary", "id": "75a1298380708b0fcb7718fec83232002c7f5099", "size": "1683", "bi...
import datetime from haystack import indexes from crowdcop_web.models import Campaign class CampaignIndex(indexes.SearchIndex, indexes.Indexable): text=indexes.CharField(document=True, use_template=True) campaign_description=indexes.CharField(model_attr='campaign_description') def get_model(self): return Campaig...
{ "content_hash": "6134cc6a5f7c7948ac1053067b066eeb", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 74, "avg_line_length": 30.46153846153846, "alnum_prop": 0.8055555555555556, "repo_name": "bocaaust/CrowdCop", "id": "08d46b70bcdff93c1977fe3cef87cb6b426ab9ce", "size": "396...
""" .. moduleauthor:: Gabriel Martin Becedillas Ruiz <[email protected]> """ import sys sys.path.append("../..") import pyalgotrade.logger import lxml.html import symbolsxml logger = pyalgotrade.logger.getLogger("get_merval_symbols") def find_company(htmlTree, ticker): ret = None anchor = htmlTr...
{ "content_hash": "9e6cb0a045be7dd4b8c2ec6d29f1415f", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 79, "avg_line_length": 24.3125, "alnum_prop": 0.5825192802056556, "repo_name": "cgqyh/pyalgotrade-mod", "id": "ef1833e27338d54add85e3079afc1c0f56cb703f", "size": "2559", ...
""" The mixins module is a set of classes that provide action logic re-used by **drf-ember** generic views. """ from rest_framework import mixins from rest_framework import status from rest_framework.response import Response from .exceptions import JsonApiException class ListModelMixin(object): """ List a quer...
{ "content_hash": "44d2651ff5d5e249ee2ab9895fdd984b", "timestamp": "", "source": "github", "line_count": 150, "max_line_length": 95, "avg_line_length": 36.24, "alnum_prop": 0.6287711552612215, "repo_name": "symfonico/drf-ember", "id": "a03077214dfabb68b2cab05e2685af297a163f94", "size": "5436", "bi...
import json import boto3 cfn = boto3.client('cloudformation') paginator = cfn.get_paginator('describe_stacks') pages = paginator.paginate(StackName="antioch-prod") details = {} for page in pages: for stack in page['Stacks']: for output in stack['Outputs']: details[output['OutputKey']] = output[...
{ "content_hash": "2b92d1578a0dbeb684ff15c21b54db8c", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 83, "avg_line_length": 34.86206896551724, "alnum_prop": 0.6913946587537092, "repo_name": "philchristensen/antioch", "id": "5c19b8ea52e9e789ac574c87316ffd6d84bbc0b3", "size"...
"""Gradients for operators defined in nn_ops.py.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.framework import ops from tensorflow.python.ops import array_ops from tensorflow.python.ops import math_ops from tensorflow.python.ops...
{ "content_hash": "1a8d7ca2b60cc2cea323260fccba6046", "timestamp": "", "source": "github", "line_count": 237, "max_line_length": 82, "avg_line_length": 35.08860759493671, "alnum_prop": 0.6225348725348725, "repo_name": "RyanYoung25/tensorflow", "id": "a6f0e66a5f11c6a3b58402a5b3ca2723c888f5cf", "size"...
from django.contrib import admin from django.contrib.gis.admin import OSMGeoAdmin from django.contrib.gis.db import models from hstore_field import fields class Item (models.Model): name = models.CharField(max_length=64) data = fields.HStoreField() admin.site.register(Item) class Related (models.Model): ...
{ "content_hash": "f1ce2e792877c3d5b6b97b98cf161755", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 48, "avg_line_length": 26.304347826086957, "alnum_prop": 0.7520661157024794, "repo_name": "erussell/hstore-field", "id": "15bdd89c1ed99592bde4ca8103d222bb5b9a270d", "size":...
import contextlib import json from django.core.management.base import BaseCommand from lxml import etree import os from corehq.apps.app_manager.models import Application, RemoteApp _parser = etree.XMLParser(remove_blank_text=True) def normalize_xml(xml): xml = etree.fromstring(xml, parser=_parser) return etree...
{ "content_hash": "c66fbc7c1c86f8fd5ee4c1d8728b871e", "timestamp": "", "source": "github", "line_count": 86, "max_line_length": 78, "avg_line_length": 31.906976744186046, "alnum_prop": 0.5379008746355685, "repo_name": "puttarajubr/commcare-hq", "id": "ca35daf7db09c5164963a0caccbb2d4a570c8495", "size...
""" A WSGI application configured by an INI file, which responds to requests according to a Swagger API specification. """ from webob import Request, Response import abc import webob.dec import webob.exc from urlparse import parse_qs from swaggerapp.specification import SwaggerSpecification from swaggerapp.encoder imp...
{ "content_hash": "ae0f636f72542560248a4fab659247a5", "timestamp": "", "source": "github", "line_count": 302, "max_line_length": 82, "avg_line_length": 38.33112582781457, "alnum_prop": 0.5933828610919143, "repo_name": "NCI-Cloud/reporting-api", "id": "9248b17e271a74569d7cefb6b7890c86cf321839", "size...
""" Part of pymzml test cases """ import os from pymzml.file_classes.standardGzip import StandardGzip import unittest import random from pymzml.spec import Spectrum, Chromatogram import re import struct import test_file_paths class StandardGzipTest(unittest.TestCase): """" """ def setUp(self): ""...
{ "content_hash": "9068c780f755ea93ed7bd6914dc6b603", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 57, "avg_line_length": 20.355555555555554, "alnum_prop": 0.5917030567685589, "repo_name": "StSchulze/pymzML", "id": "7593f06cc9b1c45fe4e4bc186067be86fcc1e347", "size": "963...
DATA_TYPE_INT = 0 DATA_TYPE_DOUBLE = 1 class WinPDHCounter(object): def is_single_instance(self): return False def get_single_value(self): return None def get_all_values(self): return {} def _get_counter_dictionary(self): return
{ "content_hash": "2de48df49e3c818c1ffc12267c9d713e", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 38, "avg_line_length": 17.625, "alnum_prop": 0.6170212765957447, "repo_name": "DataDog/integrations-core", "id": "edd3d69b3aa18e8645db7eb1a22619e345c42298", "size": "391", ...
from __future__ import unicode_literals from django.db import models, migrations import django.utils.timezone import cobra.models.fields.gzippeddict class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Node', fields=[ ...
{ "content_hash": "33c7f0b5a26228b76f2cbf278a058575", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 102, "avg_line_length": 29.37037037037037, "alnum_prop": 0.5737704918032787, "repo_name": "lyoniionly/django-cobra", "id": "c19462be0572a1e71b12441e8cb92d865653ef46", "size...
from __future__ import print_function import os try: from SyntaxErroring import x except Exception as e: print("Importing with syntax error gave:", type(e), e) try: from IndentationErroring import x except Exception as e: print("Importing with indentation error gave:", type(e), e) print("Finished.")...
{ "content_hash": "2d7f0b5e3d24c84fae8aa5aab95961fa", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 63, "avg_line_length": 21.4, "alnum_prop": 0.7165109034267912, "repo_name": "tempbottle/Nuitka", "id": "518fea9e4f7db56b6e80872fcaa47037223d88f3", "size": "1090", "binary...
nome = str(input("Digite seu nome completo: ")).strip() nome = nome.lower() #verifica = nome.find('silva') > 0 print("Seu nome tem Silva? ") #print("{}".format(verifica)) print("{}".format("silva" in nome))
{ "content_hash": "7d97bad55e7de479cbc38fd91980194f", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 55, "avg_line_length": 34.5, "alnum_prop": 0.6473429951690821, "repo_name": "AlbertoAlfredo/exercicios-cursos", "id": "6bf71a67f777121fd8706d18d027a39eb556eb7c", "size": "20...
import time import re def getPatternName(): pattern_json_path=os.getcwd()+"/VSP/patterns.json" f = open (pattern_json_path, "r") for line in f: if "name" in line: break print "line:" + line match = re.search(":( *)\"(.*)\",", line) f.close() return match.group(2).strip() ...
{ "content_hash": "6683e7d667278aaf588d4a32b97b0e8a", "timestamp": "", "source": "github", "line_count": 135, "max_line_length": 78, "avg_line_length": 29.288888888888888, "alnum_prop": 0.5220030349013657, "repo_name": "CLMDev/leanJazz", "id": "6cd420d3769ea7c1daaee028de17074ac9dfbeeb", "size": "454...
import os import numpy as np import sys # from PIL import Image def load_data(traindata_file_path, testdata_file_path, one_hot=True, classes=2): traindata, trainlabel = read_file(traindata_file_path) testdata, testlabel = read_file(testdata_file_path) if one_hot: trainlabel = onehot(trainlabel, c...
{ "content_hash": "10b9ee0f3c13f4f8b3e9943303702e7e", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 80, "avg_line_length": 27.895833333333332, "alnum_prop": 0.614637789395071, "repo_name": "gu-yan/mlAlgorithms", "id": "544a4ed05e636d5098df4c7fc80b8da9ad59fbf1", "size": "1...
from __future__ import print_function import os import shutil import subprocess import json import sys from six import unichr from PIL import Image, ImageDraw, ImageFont class MissingGlyphError(Exception): pass def color_font(name, code_point): in_name = 'bitmaps/strike1/uni{}.png'.format(code_point) ou...
{ "content_hash": "5feb2b514343baf504d3fadc53482ba6", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 104, "avg_line_length": 28.531645569620252, "alnum_prop": 0.6708074534161491, "repo_name": "peiwei/zulip", "id": "ef08b5ee304a9b8024c105d26a80c685db8e9908", "size": "2276",...
import json import os import uuid import pytest import sdk_cmd import sdk_hosts import sdk_jobs import sdk_plan import sdk_upgrade from tests import config @pytest.mark.soak_backup def test_backup_and_restore(): plan_parameters = { 'S3_BUCKET_NAME': os.getenv( 'AWS_BUCKET_NAME', 'infinity-fra...
{ "content_hash": "b7b63a6e782bff9f2093bd02ea00e592", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 105, "avg_line_length": 42.8034188034188, "alnum_prop": 0.6715255591054313, "repo_name": "vishnu2kmohan/dcos-commons", "id": "c751f22a88fd5958417d9e0d21a67f0b941cacde", "s...
from django.db import models from django.forms import ModelForm from django import forms from django.conf import settings from django.core.mail import send_mail from datetime import datetime import time import hashlib import logging class Project(models.Model): date_updated = models.DateTimeField(auto_now=True, ...
{ "content_hash": "e5c21850428aac4991ec69cdccfb0aeb", "timestamp": "", "source": "github", "line_count": 140, "max_line_length": 148, "avg_line_length": 36.58571428571429, "alnum_prop": 0.6788363920343615, "repo_name": "flegoff/hcrendu", "id": "cb2ff113fa51007d4788ba8fe1f095c74589b866", "size": "514...
__all__ = ['Source'] class Source(object): __slots__ = ['body', 'name'] def __init__(self, body, name='GraphQL'): self.body = body self.name = name def __eq__(self, other): if isinstance(other, Source): return self.body == other.body and self.name == other.name ...
{ "content_hash": "1d6716f55da3f105eff6f3a8c07a1ce0", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 70, "avg_line_length": 23.928571428571427, "alnum_prop": 0.5373134328358209, "repo_name": "jhgg/graphqllib", "id": "023a20d6d8ae5903c915d088f0677ac8e0965c11", "size": "335"...
from sqlcomplete.prioritization import PrevalenceCounter def test_prevalence_counter(): counter = PrevalenceCounter() sql = """SELECT * FROM foo WHERE bar GROUP BY baz; select * from foo; SELECT * FROM foo WHERE bar GROUP BY baz""" counter.update(sql) keywords =...
{ "content_hash": "155801ba17e3f6519c8952534f537152", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 60, "avg_line_length": 32.7, "alnum_prop": 0.617737003058104, "repo_name": "dbcli/sqlcomplete", "id": "7aa77b8c7aa466983dba94156fb41af34ce99b16", "size": "654", "binary":...
from arcpy import AddMessage import arcpy, csv, os, zipfile, glob, copy from xml.dom.minidom import parse class Export: """ Main class that exports CSV, KMZ, ZIP archive, Markdown metadata file. """ def __init__(self, path, output_name, debug): """ Inits Export instance with necessary ...
{ "content_hash": "10d1c2f77b86c2a6a5f37b550514534b", "timestamp": "", "source": "github", "line_count": 171, "max_line_length": 83, "avg_line_length": 35.801169590643276, "alnum_prop": 0.5039202874877491, "repo_name": "CityOfPhiladelphia/arc-open", "id": "990e0dcbcd002d67991222fb7a2b614464cebacf", ...
class PolicyPrefsTestCases(object): """A list of test cases for policy_prefs_ui.py.""" [BROWSER, SEARCH_ENGINES, PASSWORDS, AUTOFILL, CONTENT, HOMEPAGE, LANGUAGES, ACCOUNTS] = range(8) # Each policy has an entry with a tuple (Pref, Value, Pages, OS) # # |Pref| is the preference key for simple user polici...
{ "content_hash": "37f0ac84c40aabeef15fbdf0200227b1", "timestamp": "", "source": "github", "line_count": 288, "max_line_length": 80, "avg_line_length": 53.107638888888886, "alnum_prop": 0.6301405688133377, "repo_name": "keishi/chromium", "id": "8489ff9699b42ddd19622586fa364a5282953214", "size": "157...
import operator from copy import deepcopy import matplotlib import numpy as np import pytest from astropy import units as u from marvin.core.exceptions import MarvinError from tests import marvin_test_if from marvin.tools.maps import Maps from marvin.tools.quantities import EnhancedMap, Map from marvin.utils.datamode...
{ "content_hash": "2d6a567c3d5013bf1665c9dee17d6a4a", "timestamp": "", "source": "github", "line_count": 623, "max_line_length": 99, "avg_line_length": 41.53611556982344, "alnum_prop": 0.5752598832940449, "repo_name": "sdss/marvin", "id": "de7afc77bc3760211053be8f8667d670d6122d15", "size": "26192", ...
from azure.identity import DefaultAzureCredential from azure.mgmt.logic import LogicManagementClient """ # PREREQUISITES pip install azure-identity pip install azure-mgmt-logic # USAGE python reset_trigger.py Before run the sample, please set the values of the client ID, tenant ID and client secret ...
{ "content_hash": "66d550ceae91a0f88cf97ca9b314f821", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 129, "avg_line_length": 32.94117647058823, "alnum_prop": 0.7285714285714285, "repo_name": "Azure/azure-sdk-for-python", "id": "62c132380526a7fc6da97598a2158c5fdb02c773", "s...
from functools import partial from io import IOBase from numbers import Number from unittest.mock import MagicMock, Mock, PropertyMock, call, patch, ANY import pytest from boxsdk.auth.oauth2 import OAuth2 from boxsdk.config import API, Proxy from boxsdk.exception import BoxAPIException, BoxException from boxsdk.netwo...
{ "content_hash": "3d4124767653a7c69a4e824610ff5c64", "timestamp": "", "source": "github", "line_count": 349, "max_line_length": 150, "avg_line_length": 38.56733524355301, "alnum_prop": 0.7043090638930164, "repo_name": "box/box-python-sdk", "id": "3b36bead2d18ffd97816ad6bbf45d33bbb0b6120", "size": "...
import re from urlparse import urlparse, parse_qs def _get_url_components(the_url): u = urlparse(the_url) names = ['scheme', 'netloc', 'path', 'params', 'query', 'fragment'] return {names[x]:u[x] for x in range(6)} ## weblogic_default extract_rule = re.compile('(?P<ip>\d+\.\d+\.\d+\.\d+) - (?P<user>[^\s]+) \[(?P<...
{ "content_hash": "d716112b7d2ac7452ae1eb9bec7e267c", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 155, "avg_line_length": 40.38709677419355, "alnum_prop": 0.6118210862619808, "repo_name": "P4l1ndr0m/P.P.L.S.", "id": "a416a63ddf0e9b62fc729c3899c54624bc9452ea", "size": "1...
import copy import unittest import mock from .context import pymolprobity import pymolprobity.kinemage as kin class KinemageTests(unittest.TestCase): def setUp(self): self.kw_types = ['viewid', 'group', 'subgroup', 'master', 'pointmaster', 'dotlist', 'vectorlist'] self.kin = kin...
{ "content_hash": "d059360e06825833c1d3d519746dd6ed", "timestamp": "", "source": "github", "line_count": 510, "max_line_length": 80, "avg_line_length": 36.996078431372545, "alnum_prop": 0.6031905872376511, "repo_name": "jaredsampson/pymolprobity", "id": "312eb30ff4ef5ff73b8e82f0b851b3a4f8dc6b5e", "s...
"""Contains optimizer base class.""" def _vectorize(fct): """Vectorize function so that it operates on and returns a list.""" # TODO: parallelize this with multiprocessing (but make that configurable) # also, this (entire concept) doesn't exactly seem pretty # principle of least astonishment and whatn...
{ "content_hash": "41af19259a1b8225f806f3bc0e23a29a", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 85, "avg_line_length": 37.08771929824562, "alnum_prop": 0.6764427625354777, "repo_name": "tjanson/heuristic_optimization", "id": "a476d4350f0f4c7784edd65ae9cfe7e9b7110bfe", ...
from distutils.core import setup # Make sure 'twisted' doesn't appear in top_level.txt try: from setuptools.command import egg_info egg_info.write_toplevel_names except (ImportError, AttributeError): pass else: def _top_level_package(name): return name.split('.', 1)[0] def _hacked_write_...
{ "content_hash": "74ce91b6cb5d7f7e630fd3cd010fa0ef", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 75, "avg_line_length": 30.125, "alnum_prop": 0.6273858921161826, "repo_name": "athyuttamre/accessible-facebook-ui", "id": "34c19d3a0a4696c7e426d762a1491dff9cad688c", "size"...
import hashlib, uuid from pymongo import MongoClient from base64 import b64encode from Utilities import log import os import Config from Memcached import memcached class Database(object): # Name of the algorithm to use for password encryption. ENCRYPT_ALGORITHM = 'sha512' # Constructor. def __init__(self): mo...
{ "content_hash": "81d3a89953f2743d851d0706c02a2a5c", "timestamp": "", "source": "github", "line_count": 125, "max_line_length": 72, "avg_line_length": 35.624, "alnum_prop": 0.7132270379519425, "repo_name": "hoehnp/sirius", "id": "311886bdc96d684913bb13e03bbc35c49884eda0", "size": "4453", "binary"...
import base64 import inspect import os import pickle from tempfile import TemporaryDirectory from textwrap import dedent from typing import TYPE_CHECKING, Callable, Optional, Sequence, TypeVar import dill from airflow.decorators.base import DecoratedOperator, task_decorator_factory from airflow.providers.docker.opera...
{ "content_hash": "315030f145e4d89f5a46e29b47fe7846", "timestamp": "", "source": "github", "line_count": 132, "max_line_length": 107, "avg_line_length": 39.75757575757576, "alnum_prop": 0.6373856707317073, "repo_name": "bolkedebruin/airflow", "id": "ea5c6958b949d29dfcca4855fa5369ee95038111", "size":...
import base64 import os import re import time from common import format COLOR_YELLOW = "#ffff88" COLOR_GREEN = "#aaffaa" COLOR_PINK = "#ffaaaa" COLOR_BLUE = "#ccccff" COLOR_WHITE = "#ffffff" def _get_file_by_name(dir_, name): """Finds the file with given name relative to this module.""" # HACK to fall back on ...
{ "content_hash": "5b2c355fc8d8cf82c9f492f40ed89765", "timestamp": "", "source": "github", "line_count": 273, "max_line_length": 77, "avg_line_length": 29.93040293040293, "alnum_prop": 0.6209766246481458, "repo_name": "danielkitachewsky/reviewder", "id": "10ea4cd86d6af58ee006ba9752e6fc9ac9488b1a", "...
import application import unittest from application import application from flask import Flask, current_app, request, Response """ Main test cases for our application """ class AppTestCase(unittest.TestCase): #application = Flask(__name__) def setUp(self): application.testing = True with ap...
{ "content_hash": "f6c7d50e4461d3d9c0240cbc12d5b071", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 74, "avg_line_length": 23.34090909090909, "alnum_prop": 0.6183057448880234, "repo_name": "BongChan/py-flask-signup", "id": "43418dbaa9e4c74d5bb44c9b83dd761d3826543f", "size...
import re import redis import logging import alias.config logger = logging.getLogger('DB') email_re = re.compile(r'.*@.*\..*') cfg = alias.config.AliasConfig() logger.info('Configuring databases.') user_db = redis.StrictRedis(host='localhost', port=6379, db=cfg.user_db) email_db = redis.StrictRedis(host='localhost',...
{ "content_hash": "f4c75d48d4c77019238cb0187b581de7", "timestamp": "", "source": "github", "line_count": 245, "max_line_length": 78, "avg_line_length": 29.975510204081633, "alnum_prop": 0.6139705882352942, "repo_name": "averagesecurityguy/alias", "id": "5736f8aa5bfb3b43ac7db44a6862c3cfbcfcd473", "si...
from pprint import pformat from django.core.management.base import BaseCommand from django.conf import settings from ..bower import bower_adapter from ..exceptions import BowerNotInstalled class BaseBowerCommand(BaseCommand): """Base management command with bower support""" def handle(self, *args, **options)...
{ "content_hash": "067f3e1e00a5eda67f45ca2fbadf3c67", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 67, "avg_line_length": 31.392857142857142, "alnum_prop": 0.6712172923777019, "repo_name": "ramcn/demo3", "id": "baa925a8df164884cee679951598348829f99d5b", "size": "879", ...
import os import uuid import json import subprocess from insalata.builder.decorator import builderFor from insalata.helper.ansibleWrapper import addToKnownHosts @builderFor(action="configureFirewall", template=["iptables"]) def configureIpTables(logger, host): """ Set iptables firewall rules on this host. ...
{ "content_hash": "019ce1b2e9e26f6e7b6dddd44aa015cd", "timestamp": "", "source": "github", "line_count": 109, "max_line_length": 164, "avg_line_length": 34.57798165137615, "alnum_prop": 0.6662244627222075, "repo_name": "tumi8/INSALATA", "id": "bac28a375ecd0006c296ac974abefa2524169b37", "size": "3769...
import os from enum import Enum, auto from typing import List from dotenv import load_dotenv class VMModelType(Enum): VM = auto() VMSS = auto() class ExtensionMetaData: def __init__(self, publisher: str, ext_type: str, version: str, ext_name: str = ""): self.__publisher = publisher self...
{ "content_hash": "775a5ea1a39cffaee62c79aeaf5459d5", "timestamp": "", "source": "github", "line_count": 137, "max_line_length": 119, "avg_line_length": 27.16788321167883, "alnum_prop": 0.555077915099409, "repo_name": "Azure/WALinuxAgent", "id": "806c830c124b0144b99b9875061daac14ae21450", "size": "3...
"""A module to allow option processing from files or registry.""" import argparse import copy import pdb import sys # A global flags parser class GRRArgParser(argparse.ArgumentParser): pass PARSER = GRRArgParser(description="GRR Rapid Response") FLAGS = None # Helper functions for setting options on the globa...
{ "content_hash": "b16628455e31511a931ecd7c17a29bc5", "timestamp": "", "source": "github", "line_count": 112, "max_line_length": 77, "avg_line_length": 25.125, "alnum_prop": 0.6488983653162758, "repo_name": "MiniSEC/GRR_clone", "id": "0cc5a9488e9ab3d6c7ba577386d8cbdd3f79f1f9", "size": "2836", "bin...