text
stringlengths
4
1.02M
meta
dict
""" from: https://adventofcode.com/2021/day/1 --- Day 1: Sonar Sweep --- You're minding your own business on a ship at sea when the overboard alarm goes off! You rush to see if you can help. Apparently, one of the Elves tripped and accidentally sent the sleigh keys flying into the ocean! Before you know it, you're in...
{ "content_hash": "638b087dc6ba36cf862aea0dfbdeae08", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 99, "avg_line_length": 34.275, "alnum_prop": 0.7458059810357404, "repo_name": "kmcginn/advent-of-code", "id": "ad197208030bef518081a89e818844e04b0109af", "size": "2753", ...
TASK_QUEUE_NAME = 'act_tasks' FAILURE_QUEUE_NAME = 'failed' # rq default queue name for failures
{ "content_hash": "ad7fa8866d4fe9f4656a030bada7573f", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 67, "avg_line_length": 49, "alnum_prop": 0.7346938775510204, "repo_name": "shakhat/act", "id": "c460c5c7d4307ee0c59441c451b5a4d01d1dd06a", "size": "643", "binary": false, ...
"""Config flow for FAA Delays integration.""" import logging from aiohttp import ClientConnectionError import faadelays import voluptuous as vol from homeassistant import config_entries from homeassistant.const import CONF_ID from homeassistant.helpers import aiohttp_client from .const import DOMAIN # pylint:disabl...
{ "content_hash": "42e7454b507447867dd00dec81af7ee4", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 80, "avg_line_length": 32.32258064516129, "alnum_prop": 0.6092814371257484, "repo_name": "partofthething/home-assistant", "id": "46d917cc92f667fec32aa9288f91be6cbadb9c37", ...
from helpers import * def C_HELP(S, DB, sender, args): if len(args) == 0: # List commands. body = "Commands: " for n, h in enumerate(help_entries): if n < len(help_entries) - 1: body += h[0] + ", " else: body += h[0] send(S, sender, body) else: # Look for this command. body = "" for h in hel...
{ "content_hash": "c2739ea6fd431f2a467a92b389d32799", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 116, "avg_line_length": 47.01960784313726, "alnum_prop": 0.6213511259382819, "repo_name": "pariahsoft/Dennis", "id": "a75386a24e0ed59fbf20628b05450d8cf9e37ce3", "size": "37...
from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Batch.feeder' db.add_column('feeders_batch', 'feeder', self...
{ "content_hash": "adffbfda8c65dc95932eb426718a9d8d", "timestamp": "", "source": "github", "line_count": 156, "max_line_length": 201, "avg_line_length": 75.34615384615384, "alnum_prop": 0.5462821167262208, "repo_name": "archen/mantistrack", "id": "216b79704e066d5ee43732096f4042394f793724", "size": "...
import logging import wsgiref.handlers from pyamf.remoting.gateway.wsgi import WSGIGateway from pyamf.amf3 import ByteArray from google.appengine.api.images import Image def fiximage(data): """Take an uploaded image, call I'm feeling lucky and put it back out to the user. """ logging.info("Transforming i...
{ "content_hash": "e9c0357c195dc3d5389bf0ebd0ae0d37", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 55, "avg_line_length": 23.37142857142857, "alnum_prop": 0.687041564792176, "repo_name": "jamesward-demo/air-quick-fix", "id": "afe35316b9414349e3dec2a5e611880923595ab0", "s...
from __future__ import print_function import getpass import os import sys import six import pyrax pyrax.set_setting("identity_type", "rackspace") creds_file = os.path.expanduser("~/.rackspace_cloud_credentials") pyrax.set_credential_file(creds_file) cdb = pyrax.cloud_databases instances = cdb.list() if not instance...
{ "content_hash": "2fb2cf03b68e8e4d12d742eb30553256", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 79, "avg_line_length": 27.508196721311474, "alnum_prop": 0.6728247914183552, "repo_name": "rackspace/pyrax", "id": "9b40fc110b6edeee491b1b05b66bd13e9de2480f", "size": "2362...
""" Created on Fri Jun 05 09:36:14 2015 @author: LLP-admin """ import pandas as pd #import extract_filter #########HELPER FUNCTIONS############## def extract_filter(filter_path): """Given a path to the weka's filter file, return a list of selected features.""" with open(filter_path) as f: lnum = 0...
{ "content_hash": "d002e139ccc530bf615c9902156981c2", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 99, "avg_line_length": 34.25806451612903, "alnum_prop": 0.5574387947269304, "repo_name": "cocoaaa/ml_gesture", "id": "b9c2feb005d16abfb197834b72d9ae50bd709873", "size": "21...
__all__ = ( 'Mock', 'MagicMock', 'mocksignature', 'patch', 'sentinel', 'DEFAULT', 'ANY', 'call', 'create_autospec', 'FILTER_DIR', 'NonCallableMock', 'NonCallableMagicMock', ) __version__ = '0.8.0beta4' import pprint import sys try: import inspect except ImportErr...
{ "content_hash": "3c09110e1507cabe517d1b86ffff07c7", "timestamp": "", "source": "github", "line_count": 2206, "max_line_length": 83, "avg_line_length": 31.731187669990934, "alnum_prop": 0.5805368648123544, "repo_name": "rgalanakis/practicalmayapython", "id": "b9c60506e99a6053705b66a773314f189b2d3bb4"...
from test.assert_json import assert_json from topcoder.tournament_judging import solution def test_tournament_judging (): assert_json('tournament_judging', solution)
{ "content_hash": "5c7f2ac49f5c1b4bed2b2d5eb6f7cb63", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 51, "avg_line_length": 36.4, "alnum_prop": 0.7472527472527473, "repo_name": "erichaase/topcoder-python", "id": "ca41b8c6be7eca2bf755e269e5585ca32235142a", "size": "182", "...
from marshmallow import Schema, fields, ValidationError def not_blank(data): if not data: raise ValidationError('Data not provided') class UserSchema(Schema): id = fields.Int(dump_only=True) full_name = fields.Str(required=True) email = fields.Email(required=True, load_only=True) passwor...
{ "content_hash": "4c2f5a547a53ac2b14e221b683b30fca", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 56, "avg_line_length": 29.071428571428573, "alnum_prop": 0.7100737100737101, "repo_name": "andela-jkamau/blapi", "id": "793cac2f506a301a2589c78fd8cb8175d2f651b7", "size": "...
""" mackerel.tests.test_client ~~~~~~~~~~~~~~~~~~~~~~~~~~ Mackerel client tests. :copyright: (c) 2015 Shinya Ohyanagi, All rights reserved. :license: BSD, see LICENSE for more details. """ import os from unittest import TestCase import requests from mackerel.client import ( Client, Macke...
{ "content_hash": "c33ab46c5404df41bcacb5baf1d68019", "timestamp": "", "source": "github", "line_count": 197, "max_line_length": 93, "avg_line_length": 37.91878172588832, "alnum_prop": 0.5997322623828648, "repo_name": "heavenshell/py-mackerel-client", "id": "5cd8e07d372bf616b93e5b44e135af93703b3d84", ...
from datetime import datetime as dt import os import random import traceback import sha from tg import config from tg import request from tg import session from tribal.util.common import * from tribal.util.excel_helper import * def create_token(): token = request.identity["user"].user_name + dt.now().strftime("%y...
{ "content_hash": "9ddb378d60522daa43d85a0d49118b13", "timestamp": "", "source": "github", "line_count": 94, "max_line_length": 147, "avg_line_length": 44.92553191489362, "alnum_prop": 0.6159128581577078, "repo_name": "LamCiuLoeng/internal", "id": "1ba6ff18abe9d9996fb21addfc241cd794f8d5f6", "size": ...
""" Convert numbers from base 10 integers to base X strings and back again. Original: http://www.djangosnippets.org/snippets/1431/ Sample usage: >>> base20 = BaseConverter('0123456789abcdefghij') >>> base20.from_decimal(1234) '31e' >>> base20.to_decimal('31e') 1234 """ class BaseConverter(object): decimal_digit...
{ "content_hash": "de555fdec71caff41b40b4d2ddf381f5", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 71, "avg_line_length": 27.06896551724138, "alnum_prop": 0.5738853503184713, "repo_name": "EinsamHauer/graphite-web-iow", "id": "5496d19503d6551fbb8952ed84bed22fbdb5e56d", "...
import smtplib import email import email.encoders import email.mime.text import email.mime.base import base64 import sys import re hostname = sys.argv[1] #path = '/root/certificates/' path = '/tmp/' filename = '%s-csr-request.csr' % hostname senderName = 'IdP in the cloud service <idpcloud-service@garr.it>' receiverNa...
{ "content_hash": "3f42a39118b052bb77fe7b2ea34a6722", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 121, "avg_line_length": 33.09803921568628, "alnum_prop": 0.7233412322274881, "repo_name": "malavolti/Puppet-GARRShibbolethIdP", "id": "4df80ab9ed1996c40c103381f2b8b997e85190b...
import MySQLdb import datetime # connect to db db = MySQLdb.connect(host="localhost", user="root", passwd="root", db="siera_final") # create cursor cursor = db.cursor() #get latest attack interval cursor.execute("SELECT r.timestamp, ap.timestamp, TIMEDIFF(r.timestamp, ap.timestamp) as time from response r, attack_pe...
{ "content_hash": "6e3e22467f906163ae9d40148b38dc6b", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 175, "avg_line_length": 31.047619047619047, "alnum_prop": 0.75920245398773, "repo_name": "ataichi/Thesis-SIERA", "id": "b337d252b8adeeab1aef937d300785625bba973c", "size": "...
from collections import OrderedDict def config(vars): # IF YOU ARE MAKING A CUSTOM SKIN, PLEASE INCLUDE WHAT VERSION OF ALP IT # WAS MADE FOR. # ie: this custom skin was made for ALP 0.97.2d # colors (can also accept standard html name colors such as pink or green) colors = {} colors['backgro...
{ "content_hash": "dc6b92bef1e8ca6032bee30b434df37a", "timestamp": "", "source": "github", "line_count": 100, "max_line_length": 78, "avg_line_length": 34.1, "alnum_prop": 0.6202346041055719, "repo_name": "Mause/pyalp", "id": "780f25ca23980e2cdcde695a26389bc12edc812e", "size": "3410", "binary": fa...
""" SQL-style merge routines """ import copy import warnings import string import numpy as np from pandas.compat import range, lzip, zip, map, filter import pandas.compat as compat from pandas import (Categorical, Series, DataFrame, Index, MultiIndex, Timedelta) from pandas.core.frame import _mer...
{ "content_hash": "bdd8df056c53a987831e3dfcc856e503", "timestamp": "", "source": "github", "line_count": 1553, "max_line_length": 79, "avg_line_length": 36.81519639407598, "alnum_prop": 0.5345086927624445, "repo_name": "jmmease/pandas", "id": "6bb6988a7442a132821e5a7563890fe3658da45b", "size": "5717...
"""Tests for grr.lib.aff4_objects.standard.""" import StringIO from grr.lib import aff4 from grr.lib import test_lib class BlobImageTest(test_lib.GRRBaseTest): """Tests for cron functionality.""" def testAppendContentError(self): src_content = "ABCD" * 10 src_fd = StringIO.StringIO(src_content) d...
{ "content_hash": "249bdd88ec25e61e64f80a647c6a821c", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 80, "avg_line_length": 38.540983606557376, "alnum_prop": 0.6337728626116547, "repo_name": "spnow/grr", "id": "7d4b1308f891f65a2a6e44e13bd978ef32970541", "size": "4724", ...
from datetime import datetime, timedelta from zerver.models import UserActivityInterval, UserProfile # Return the amount of Zulip usage for this user between the two # given dates def seconds_usage_between(user_profile: UserProfile, begin: datetime, end: datetime) -> timedelta: intervals = UserActivityInterval.o...
{ "content_hash": "2e21618ccdcc7745ad2f5a9fe19de13b", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 98, "avg_line_length": 35.529411764705884, "alnum_prop": 0.7185430463576159, "repo_name": "hackerkid/zulip", "id": "533c4eceaf4199f96f29086d91449ecbd0a1c63a", "size": "604"...
import random def Roll(randlow, randhigh): #A simpler way to do random.randint return random.randint(randlow, randhigh) def AdvantageRoll(AdvantageNumber, randlow, randhigh): #This modual is a die roller that rolls with advantage/ disadvantage #Positive AdvantageNumber means advantage,...
{ "content_hash": "78a556a7acc8fbd8f90dba16fc6f964d", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 96, "avg_line_length": 33.2, "alnum_prop": 0.6014056224899599, "repo_name": "TheMuffinMan5930/NarutoBattle", "id": "a5c6fd37180b2139b210b7107fd8fc643d71e440", "size": "2071...
from os import stat from sys import stdout, stderr import envoy def run(cmd, *args, **kwargs): if 'quiet' in kwargs: del kwargs['quiet'] else: print cmd out = envoy.run(cmd, *args, **kwargs) if out.status_code > 0: stdout.write("error running command: %s\n" % cmd) stdou...
{ "content_hash": "6b4c4503e2addfe29d44376e38e8011c", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 75, "avg_line_length": 27.870967741935484, "alnum_prop": 0.6180555555555556, "repo_name": "llimllib/pub", "id": "a15db08cb09e3b740832a9d1a8e7957868059471", "size": "864", ...
from selenium.webdriver.firefox.webdriver import WebDriver import unittest def is_alert_present(wd): try: wd.switch_to_alert().text return True except: return False class test(unittest.TestCase): def setUp(self): self.wd = WebDriver() self.wd.implicitly_wait(60) ...
{ "content_hash": "27b8a1fc83c527c1ed4a59b33371e9e9", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 76, "avg_line_length": 32.79710144927536, "alnum_prop": 0.6049491825011047, "repo_name": "eexyy/python_training", "id": "a69fbebd57a6e8b0cda9fbe5ce7dfc05eef0a42a", "size": ...
import re from airflow.hooks.hive_hooks import HiveCliHook from airflow import configuration from airflow.models import BaseOperator from airflow.utils.decorators import apply_defaults from airflow.utils.operator_helpers import context_to_airflow_vars class HiveOperator(BaseOperator): """ Executes hql code o...
{ "content_hash": "6c49bbb324600b0215fa13a76ec965b4", "timestamp": "", "source": "github", "line_count": 125, "max_line_length": 90, "avg_line_length": 41.32, "alnum_prop": 0.6193610842207163, "repo_name": "r39132/airflow", "id": "87942c7ea4a79fb4653ea7ebeb598370c0bb70d3", "size": "5977", "binary"...
""" Support function for python profilling """ import time import logging from functools import wraps LOGGER = logging.getLogger(__name__) def func_profiling(func): @wraps(func) def wrapped(*args, **kwargs): start_time = time.time() result = func(*args, **kwargs) time_spent = time.ti...
{ "content_hash": "18b47bbf1eee872f639ee648a3502592", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 86, "avg_line_length": 25.928571428571427, "alnum_prop": 0.5922865013774105, "repo_name": "afunTW/moth-graphcut", "id": "38072ccd4cbcd1b5ff7aabd3bf841f9fece49c37", "size": ...
from Render import render from Simplify import simplify
{ "content_hash": "ce9bac8b96d66578ee916707df050302", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 29, "avg_line_length": 28, "alnum_prop": 0.8571428571428571, "repo_name": "smaccm/camkes-tool", "id": "8bc1a8ef389f60c7a1097c814fe518ffc5342ae2", "size": "282", "binary": ...
from setuptools import setup, find_packages setup( name="mtgssi", version="0.0.1", packages=find_packages(), scripts=['mtgssi.py'], # project uses reStructuredText, so ensure that the docutils get # installed or upgraded on the target machine install_requires=[ 'docopt' ], )...
{ "content_hash": "73dd907589f68ed8999415385b7d076c", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 68, "avg_line_length": 24.692307692307693, "alnum_prop": 0.6479750778816199, "repo_name": "celestian/mtgssi", "id": "d2ca9448fb8b55e616bc4026b967c06dae283443", "size": "628...
import time, argparse, sys, json from sklearn.datasets import fetch_20newsgroups import numpy as np import scipy.stats from datasketch import MinHashLSH, MinHash from lshforest_benchmark import bootstrap_data, _compute_jaccard def benchmark_lsh(num_perm, threshold, index_data, query_data): print("Building LSH ind...
{ "content_hash": "2adcbaec49555a07092cb1b01a151ef4", "timestamp": "", "source": "github", "line_count": 99, "max_line_length": 112, "avg_line_length": 38.333333333333336, "alnum_prop": 0.6060606060606061, "repo_name": "chubbymaggie/datasketch", "id": "3c7498ff00402c8c167f1fbecf3c82982dba12e3", "siz...
import concurrent.futures import threading import mock from six.moves import queue from google.cloud.pubsub_v1.subscriber import scheduler def test_constructor_defaults(): scheduler_ = scheduler.ThreadScheduler() assert isinstance(scheduler_.queue, queue.Queue) assert isinstance(scheduler_._executor, c...
{ "content_hash": "9c7ec92356c5aff6d03d051161e7dcc0", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 75, "avg_line_length": 23.736842105263158, "alnum_prop": 0.7039911308203991, "repo_name": "dhermes/google-cloud-python", "id": "2e1561db022ed80eda3e8bc2add249d3f18161a3", "...
import sqlite3 #Lookup for mapping party names to twitter ID's - makes the database table a bit nicer to read (i.e. column names are party abbreviations as opposed to twitter ids.) # I'm on it for testing purposes ;) party_id_lookup = {'21856384' : 'me', '14281853' : 'con', '14291684': 'lab', '5680622' : 'lbd', '1552...
{ "content_hash": "d96e73490b1407d5653edd26f9b361cd", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 242, "avg_line_length": 61.30434782608695, "alnum_prop": 0.6964539007092199, "repo_name": "AliBarber/TweetCloud", "id": "3ce7c846aad46ac488e5a9edc30b16f3ac3517f8", "size": ...
"""opsweb URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-bas...
{ "content_hash": "09e75c32ce212eac1f595f352eb7b459", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 79, "avg_line_length": 36.56521739130435, "alnum_prop": 0.6967895362663495, "repo_name": "1032231418/python", "id": "c8a13f07c08ca86a13e8e767632610cd4a3b179c", "size": "841...
""" ====================================================== Permutation t-test on toy data with spatial clustering ====================================================== Following the illustrative example of Ridgway et al. 2012, this demonstrates some basic ideas behind both the "hat" variance adjustment method, as wel...
{ "content_hash": "8181dadbf418c29a5eeecf073b1ecec1", "timestamp": "", "source": "github", "line_count": 196, "max_line_length": 79, "avg_line_length": 42.13775510204081, "alnum_prop": 0.6446301004964281, "repo_name": "agramfort/mne-python", "id": "e4a6dac55dd7be0e0e665f290334295d97eae88c", "size": ...
r"""TELNET client class. Based on RFC 854: TELNET Protocol Specification, by J. Postel and J. Reynolds Example: >>> from telnetlib import Telnet >>> tn = Telnet('www.python.org', 79) # connect to finger port >>> tn.write('guido\r\n') >>> print tn.read_all() Login Name TTY Idl...
{ "content_hash": "906efeb526b90bb221a2d9c334a8b5cc", "timestamp": "", "source": "github", "line_count": 657, "max_line_length": 87, "avg_line_length": 34.19330289193303, "alnum_prop": 0.5412864455820164, "repo_name": "google/google-ctf", "id": "593418c3f15ab1d90cdaf1ac7774e64d8b687b34", "size": "22...
from django.db.backends import BaseDatabaseIntrospection import cx_Oracle import re foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)") class DatabaseIntrospection(BaseDatabaseIntrospection): # Maps type objects to Django Field types. data_types_re...
{ "content_hash": "bf3c91a07ae23bdc91a8c7963d78bfe8", "timestamp": "", "source": "github", "line_count": 103, "max_line_length": 113, "avg_line_length": 45.51456310679612, "alnum_prop": 0.6348122866894198, "repo_name": "AloneRoad/Inforlearn", "id": "890e30a69494e83f1aac663259b790a9a860a074", "size":...
from .mp import Modpath from .mpbas import ModpathBas from .mpsim import ModpathSim
{ "content_hash": "f22b055ecbdcdfa16f654fe32f9347a5", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 29, "avg_line_length": 28.333333333333332, "alnum_prop": 0.8117647058823529, "repo_name": "bdestombe/flopy-1", "id": "ed2e48c85e983c7607b494d44d38a42fa4d18ad2", "size": "85"...
from fastapi import FastAPI app = FastAPI() @app.get("/") async def root(): return {"message": "Tomato"}
{ "content_hash": "27b6e1e36ed35025b20f4a2767085cf2", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 32, "avg_line_length": 14, "alnum_prop": 0.6339285714285714, "repo_name": "tiangolo/fastapi", "id": "9594f859c7171aa7676890420d49150d7b816320", "size": "112", "binary": fa...
from . import base_jde_tracker from . import base_sde_tracker from . import jde_tracker from . import deepsort_tracker from . import ocsort_tracker from .base_jde_tracker import * from .base_sde_tracker import * from .jde_tracker import * from .deepsort_tracker import * from .ocsort_tracker import *
{ "content_hash": "d0ade5dfcaa6000bb2cb04643c459eed", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 31, "avg_line_length": 27.454545454545453, "alnum_prop": 0.7682119205298014, "repo_name": "PaddlePaddle/models", "id": "03a5dd0a169203b86edbc6c81a44a095ebe9b3cc", "size": "...
import sys sys.path.insert(0, "..") from betools import CmdLine, visitDir # Is there a way to verify we're getting the local version? # How does py.test validate output? # CmdLine appears to be global for all tests, # so you can't use the same letter flag throughout # the test suite (is this a py.test bug?) @CmdLine(...
{ "content_hash": "66891d72273fba8ffa45021cdbd9a7aa", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 59, "avg_line_length": 22.26086956521739, "alnum_prop": 0.64453125, "repo_name": "BruceEckel/betools", "id": "6e50a6276fbc38f62849c8284744ca060373fc14", "size": "557", "b...
"""Fetch Transitland Feed Registry feeds.""" import argparse import registry import util def run(): parser = argparse.ArgumentParser(description='Fetch Transitland Feeds') parser.add_argument('feedids', nargs='*', help='Feed IDs') parser.add_argument('--registry', help='Feed Registry Path') parser.add_argumen...
{ "content_hash": "060fff8fc9ffb3b66f6bbab7869bbf0d", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 76, "avg_line_length": 31.379310344827587, "alnum_prop": 0.6780219780219781, "repo_name": "transitland/transitland-python-client", "id": "9ce4b75051d75cd2752287e9557bba878507...
import json import click from tqdm import tqdm import numpy as np from PIL import Image from skimage.exposure import rescale_intensity from . import extraction, pipeline np.seterr(all='raise') @click.command() @click.argument('pipeline_manifest', required=True) @click.argument('files', nargs=-1, required=True) # un...
{ "content_hash": "fecc23b1135e228195ffbf6d7091ebb5", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 106, "avg_line_length": 33.4390243902439, "alnum_prop": 0.7308533916849015, "repo_name": "widoptimization-willett/feature-extraction", "id": "ddefc795048cf6d437ec89f16bc74867...
import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError from .. import models class ProvidersOperations(object): """ProvidersOperations operations. :param client: Client for service requests. :param config: Configuration of service client. :param...
{ "content_hash": "1226e6a5216cb17cb2c6472ac5cb4f1a", "timestamp": "", "source": "github", "line_count": 285, "max_line_length": 144, "avg_line_length": 45.09122807017544, "alnum_prop": 0.6460975799548673, "repo_name": "AutorestCI/azure-sdk-for-python", "id": "0c156906a95f7a5318779c97600822c00bd9897e"...
from rest_framework.views import APIView from rest_framework.exceptions import APIException, NotFound from rest_framework.response import Response from rest_framework.authentication import TokenAuthentication from rest_framework.permissions import IsAuthenticated from clinic.models import * from datetime import * from ...
{ "content_hash": "d8619f79c00b0462162949762fd24b08", "timestamp": "", "source": "github", "line_count": 166, "max_line_length": 130, "avg_line_length": 31.759036144578314, "alnum_prop": 0.45295902883156297, "repo_name": "slogan621/tscharts", "id": "50119ed4736484f990cd00bcf0bef83985f482a9", "size":...
__version__ = "2.39.0" import os import sys import timeit from knack.cli import CLI from knack.commands import CLICommandsLoader from knack.completion import ARGCOMPLETE_ENV_NAME from knack.introspection import extract_args_from_signature, extract_full_summary_from_signature from knack.log import get_logger from knac...
{ "content_hash": "2d527c782193e8125680f90b1f978dcb", "timestamp": "", "source": "github", "line_count": 912, "max_line_length": 120, "avg_line_length": 50.2828947368421, "alnum_prop": 0.5996336517074448, "repo_name": "yugangw-msft/azure-cli", "id": "f30cbe8859bf41768115d83110f2f47226626290", "size"...
import logging from datetime import datetime import numpy as np class Preprocessing: def __init__(self): self.dist = np.load('dist.npy') self.m = len(self.dist) self.config_logger() def find_elites(self, n): group = np.random.choice(list(range(self.m)), n, replace=False) ...
{ "content_hash": "169849bdfe839f13eedd99ca9bf5d6cb", "timestamp": "", "source": "github", "line_count": 86, "max_line_length": 75, "avg_line_length": 34.54651162790697, "alnum_prop": 0.5287781891618983, "repo_name": "lonelyandrew/TSP", "id": "e7848106500b5ad1ee00be479cbc6e21cb99612e", "size": "2995...
from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('gold', '0005_last_4_digits_null'), ] operations = [ migrations.RemoveField( model_name='golduser', name='business_vat_id', ), migrations.RemoveField( ...
{ "content_hash": "2ac82bf1a8a3e5b18b7bb26a2e693ec2", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 44, "avg_line_length": 21.263157894736842, "alnum_prop": 0.5396039603960396, "repo_name": "rtfd/readthedocs.org", "id": "71f05257086ec89a80b64d2a471e5db2c432e88a", "size": ...
from builtins import object import logging import os import sys from collections import deque from django.urls import reverse from mako.lookup import TemplateLookup from desktop.models import Document2 from notebook.connectors.base import get_api from notebook.models import Notebook, make_notebook from useradmin.mod...
{ "content_hash": "76a1bbc74b5316a9ba510ea5c8eaaa8a", "timestamp": "", "source": "github", "line_count": 238, "max_line_length": 125, "avg_line_length": 35.2563025210084, "alnum_prop": 0.6686926468835658, "repo_name": "kawamon/hue", "id": "560f2636bb5d6c756b5c0ea4013b9e4a2a1ad5e7", "size": "9175", ...
"""Update a ProgressText in a thread while doing work in the main thread.""" from __future__ import print_function import time import random import threading import progress def updater(event, progresstext): """Updater function to be called by threads.""" while True: event.wait(0.5) if eve...
{ "content_hash": "c6339b786260d2aa2bdbb527b886da2e", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 79, "avg_line_length": 26.195652173913043, "alnum_prop": 0.6448132780082988, "repo_name": "MisanthropicBit/progress", "id": "cd70db41f0084030f463a5ca07ad91a7d2f95cc4", "siz...
import sys import unittest from unittest import mock from airflow.utils.python_virtualenv import prepare_virtualenv, remove_task_decorator class TestPrepareVirtualenv(unittest.TestCase): @mock.patch('airflow.utils.python_virtualenv.execute_in_subprocess') def test_should_create_virtualenv(self, mock_execute_...
{ "content_hash": "3512e589ffb993d50b9ddf029670b19a", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 105, "avg_line_length": 45.20238095238095, "alnum_prop": 0.6447195154069002, "repo_name": "Acehaidrey/incubator-airflow", "id": "ed332e1dd7e3625fd0d7f23b2d23e9b110484795", ...
from flask import Flask, Blueprint, render_template from .flass import Flass from .flex import Flex from .flinf import Flinf from .flab import Flab from .flap import Flap from .signals import app_created_successfully class FlailsError(Exception): pass class Flails(object): registration_manager_cls = Flap ...
{ "content_hash": "d9a42ce2cf330984ef9014630da46616", "timestamp": "", "source": "github", "line_count": 135, "max_line_length": 121, "avg_line_length": 40.02962962962963, "alnum_prop": 0.5632864544781643, "repo_name": "thrisp/flails", "id": "8eda8b47f4f7662d7545a3839f6669ea2b276e32", "size": "5404"...
from unittest import TestCase from nba_data.data.position import Position, abbreviation_to_position_map, name_to_position_map class TestPosition(TestCase): def test_get_position_from_abbreviation(self): guard = Position.get_position_from_abbreviation("g") self.assertEqual(guard, Position.guard) ...
{ "content_hash": "838cd32278e6020fcac7f1918fb11d87", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 95, "avg_line_length": 41.25581395348837, "alnum_prop": 0.5388951521984217, "repo_name": "jaebradley/nba_data", "id": "69c68f03080f6d216ad7d48efc841b3bbcdb08c1", "size": "1...
from __future__ import absolute_import, unicode_literals from .run import cli_run, session_via_cli from .version import __version__ __all__ = ( "__version__", "cli_run", "session_via_cli", )
{ "content_hash": "d9c21766860721b880c5c821091b3edd", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 56, "avg_line_length": 20.5, "alnum_prop": 0.6341463414634146, "repo_name": "TeamSPoon/logicmoo_workspace", "id": "5f74e3ef215f1a04ca2bb385aa45caf909eed9f5", "size": "205",...
import sys def readFirst(line, out): if line[0:2] != "# ": raise ValueError("Expected first line to start with '# '") # skip the first line out.write("[TOC]\n\n") readCounter = 0 def readMore(line, out): global readCounter if line[0:2] == "##": out.write(line[1:] + " {{#qtjsonserializer_readme_label_{}}}\n"....
{ "content_hash": "5cef7b17778d88a50c9b04e55d27910c", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 86, "avg_line_length": 19.794117647058822, "alnum_prop": 0.6448736998514116, "repo_name": "Skycoder42/QJsonSerializer", "id": "ddd3030c8f5ac0c28918e8fc0277ff2b7d810fc8", "s...
"""Support module for CGI (Common Gateway Interface) scripts. This module defines a number of utilities for use by CGI scripts written in Python. """ # XXX Perhaps there should be a slimmed version that doesn't contain # all those backwards compatible and debugging classes and functions? # History # ------- # # Mich...
{ "content_hash": "e8e1622e609c2bf3f4f43e3bad426867", "timestamp": "", "source": "github", "line_count": 1044, "max_line_length": 78, "avg_line_length": 32.32567049808429, "alnum_prop": 0.5685670261941448, "repo_name": "MalloyPower/parsing-python", "id": "fb40ed36a3c11d5aee7229a8801fda3d1b034c41", "...
""" HeaderID Extension for Python-Markdown ====================================== Auto-generate id attributes for HTML headers. See <https://Python-Markdown.github.io/extensions/header_id> for documentation. Original code Copyright 2007-2011 [Waylan Limberg](http://achinghead.com/). All changes Copyright 2011-2014 ...
{ "content_hash": "1bf4463afcc17613aeeeb3706c32138a", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 92, "avg_line_length": 34.18556701030928, "alnum_prop": 0.5738841978287093, "repo_name": "ryfeus/lambda-packs", "id": "fdcc8f20654c88c1a9c8b49e17762b627d732bfc", "size": "3...
__title__ = "sense2vec" __version__ = "1.0.0a1" __summary__ = "Use NLP to go beyond vanilla word2vec" __uri__ = "https://github.com/explosion/sense2vec" __author__ = "Explosion AI" __email__ = "contact@explosion.ai" __license__ = "MIT" __release__ = True
{ "content_hash": "1c61be32a3d2984d8bc1fde62f95244b", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 53, "avg_line_length": 31.875, "alnum_prop": 0.6274509803921569, "repo_name": "spacy-io/sense2vec", "id": "c1171b5da98e6fbda7288405dd9c1c5bcb52d460", "size": "255", "binar...
import os from signal import SIGUSR1 import diesel from diesel.util.event import Signal log = diesel.log.name('signal-example') def main(): usr1 = Signal(SIGUSR1) ticks = 0 log.fields(pid=os.getpid()).info('started') while True: evt, _ = diesel.first(sleep=1, waits=[usr1]) if evt =...
{ "content_hash": "1724c4b9417027006521790c4472c2b7", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 52, "avg_line_length": 20.76, "alnum_prop": 0.5857418111753372, "repo_name": "dieseldev/diesel", "id": "ba025a56752a99810d1f02710cbeb44310c6474f", "size": "519", "binary"...
"""Base classes.""" # pylint: disable=too-few-public-methods import re from selenium import webdriver from selenium.common import exceptions from selenium.webdriver.common import keys from selenium.webdriver.common.by import By from lib import constants, exception, mixin from lib.constants.test import batch from lib...
{ "content_hash": "ef80cd7418852e69638924c0869d3943", "timestamp": "", "source": "github", "line_count": 597, "max_line_length": 79, "avg_line_length": 32.006700167504185, "alnum_prop": 0.6817039983253088, "repo_name": "plamut/ggrc-core", "id": "d1e31e9f83a5902ac8b8e7549ce4c2f53fab4b0d", "size": "19...
""" Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) BSD License """ import numpy as np import time # data I/O data = open('../data/input.txt', 'r').read() # should be simple plain text file chars = list(set(data)) data_size, vocab_size = len(data), len(chars) print 'data has %d charac...
{ "content_hash": "775c126e45074163c4e3d80afec4979e", "timestamp": "", "source": "github", "line_count": 119, "max_line_length": 120, "avg_line_length": 39.109243697478995, "alnum_prop": 0.6302105715513536, "repo_name": "owulveryck/min-char-rnn", "id": "a443eaeecc0d3639477ada912ab7d6b2b692b56b", "si...
__author__ = 'Hunter Cameron' class Alignment(object): def __init__(self, args): self.name = "{}_{}".format(args["subject"], args["query"]) self.subject = args["subject"] self.query = args["query"] self.length = args["length"] self.qry_start = args["qry_start"] sel...
{ "content_hash": "9230ef8143a9210afab92964f1883f22", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 100, "avg_line_length": 31.142857142857142, "alnum_prop": 0.569954128440367, "repo_name": "hunter-cameron/Bioinformatics", "id": "d2dd074672f9ee71f1deb193cd6fead36ba93978", ...
import C; LINK_CLSID = '{00021401-0000-0000-C000-000000000046}'; VALID_SHOW_COMMAND_VALUES = { 1: 'SW_SHOWNORMAL', 3: 'SW_SHOWMAXIMIZED', 7: 'SW_SHOWMINNOACTIVE', }; VALID_HOTKEY_LOWBYTE_VALUES = { 0x90: 'NumLock', 0x91: 'ScrollLock', }; for i in range(0x30, 0x3A): VALID_HOTKEY_LOWBYTE_VAL...
{ "content_hash": "2852ca1871ad6c3427670394ea6151d2", "timestamp": "", "source": "github", "line_count": 153, "max_line_length": 104, "avg_line_length": 42.4640522875817, "alnum_prop": 0.4974603663229183, "repo_name": "SkyLined/headsup", "id": "cf2379dd894ec7f6bc3bedd837488a23edd199be", "size": "708...
from collections import deque import tokenizer class RqlSyntaxError(Exception): pass class RqlLexer(object): __slots__ = ('tokens', 'next_tokens', '_rep_dict') def __init__(self, blob): self.tokens = iter(tokenizer.tokenize(blob)) self.next_tokens = deque() self._rep_dict = {} self._fetch_tok...
{ "content_hash": "c165771e9ebd5d6d7966dd481f11abc8", "timestamp": "", "source": "github", "line_count": 136, "max_line_length": 74, "avg_line_length": 26.095588235294116, "alnum_prop": 0.6277824739363201, "repo_name": "matteobertozzi/RaleighSL", "id": "5f8652e638a8f9b7e2c670f0da07f6cc662478cf", "si...
"""The share snapshots api.""" from oslo_log import log import webob from webob import exc from manila.api import common from manila.api.openstack import wsgi from manila.api.views import share_snapshots as snapshot_views from manila import db from manila import exception from manila.i18n import _, _LI from manila im...
{ "content_hash": "d10c1c4fcc448ab446035aee9ce2dbe1", "timestamp": "", "source": "github", "line_count": 201, "max_line_length": 75, "avg_line_length": 33.91044776119403, "alnum_prop": 0.5980046948356808, "repo_name": "NetApp/manila", "id": "abcda09889922a5ead59372c67e91c1003580ff8", "size": "7438",...
""" Support for the OpenWeatherMap (OWM) service. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.openweathermap/ """ from datetime import timedelta import logging import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHE...
{ "content_hash": "f34c7c8e9ec413cf6abc6e4a915b4672", "timestamp": "", "source": "github", "line_count": 227, "max_line_length": 79, "avg_line_length": 34.08810572687225, "alnum_prop": 0.5816748513827863, "repo_name": "PetePriority/home-assistant", "id": "b6a4ff0860eb2003abfad59f80f58618c0bdc44e", "...
import mock from os_brick.initiator import connector from oslo_config import cfg from oslo_utils import units from nova import exception from nova import test from nova.tests.unit import fake_block_device from nova.tests.unit.virt.hyperv import test_base from nova.virt.hyperv import constants from nova.virt.hyperv imp...
{ "content_hash": "659b0e9434b1a5d1cd395f2cc63c1456", "timestamp": "", "source": "github", "line_count": 585, "max_line_length": 79, "avg_line_length": 41.174358974358974, "alnum_prop": 0.6244447212189148, "repo_name": "mikalstill/nova", "id": "630ee2d600b45b31363a8abedae70a776ead9f42", "size": "247...
from django.db import models from datetime import datetime, timedelta from django.conf import settings from django.contrib.auth.models import User from django.utils.translation import ugettext_lazy as _ from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic from d...
{ "content_hash": "25533e850799cf96096f620d13493ecc", "timestamp": "", "source": "github", "line_count": 179, "max_line_length": 99, "avg_line_length": 37.100558659217874, "alnum_prop": 0.6494503839783166, "repo_name": "philippWassibauer/django-activity-stream", "id": "3a70a3dcea7774e4152592eb7568699f...
import ast import Tkinter import sys from settings import settings BLOCKSIZE = 20 PADDING = 4 color_mapping = { 'a': ('black', 'obstacle'), 's': ('#ddd', None), 'g': ('darkgreen', 'spawn'), 't': ('pink', 'start1'), 'h': ('lightgreen', 'start2'), 'r': ('darkred', None), } def print_instruction...
{ "content_hash": "5e0b33c63232d95215a123341e57465d", "timestamp": "", "source": "github", "line_count": 191, "max_line_length": 139, "avg_line_length": 30.93717277486911, "alnum_prop": 0.5677779658148587, "repo_name": "boztalay/RobotGameRobots", "id": "6d0d5582f5b71701b156d2b7930c1303d877ee6d", "si...
''' Orchestrate multiple processes ''' import argparse from collections import OrderedDict import os import shlex import signal import subprocess import sys import time from typing import Any, Dict, List, Optional, Tuple def args_parse() -> argparse.Namespace: ''' Parse arguments ''' parser = argparse.Argume...
{ "content_hash": "bf011c1032167e1e95d9033ee11c3738", "timestamp": "", "source": "github", "line_count": 213, "max_line_length": 94, "avg_line_length": 32.07981220657277, "alnum_prop": 0.5891994731450315, "repo_name": "nfnty/dockerfiles", "id": "3b47411c28a8bdf0202827003f5b013e3f6663e4", "size": "68...
""" A simple discretionary locking system for /dev/nvidia devices. Iain Murray, November 2009, January 2010, January 2011. """ import os, os.path _dev_prefix = '/dev/nvidia' #URL = 'http://www.cs.toronto.edu/~murray/code/gpu_monitoring/' URL = 'http://homepages.inf.ed.ac.uk/imurray2/code/gpu_monitoring/' # Get ID'...
{ "content_hash": "75a0e5c3c9509d005c263b374213ad6b", "timestamp": "", "source": "github", "line_count": 157, "max_line_length": 80, "avg_line_length": 31.496815286624205, "alnum_prop": 0.5583417593528817, "repo_name": "ashmanmode/TTSDNNRepo", "id": "28cccc1e319a4ec4ed135670556de6562c092839", "size"...
import json import os from colorama import init, deinit, Fore, Style import math import numpy as np from fate_test._io import echo from prettytable import PrettyTable, ORGMODE SCRIPT_METRICS = "script_metrics" DISTRIBUTION_METRICS = "distribution_metrics" ALL = "all" RELATIVE = "relative" ABSOLUTE = "absolute" clas...
{ "content_hash": "3c2bdef2b4e3e78db55fe0803651414f", "timestamp": "", "source": "github", "line_count": 333, "max_line_length": 120, "avg_line_length": 43.27927927927928, "alnum_prop": 0.6389814043852345, "repo_name": "FederatedAI/FATE", "id": "de33f91bf747eda6db4873f56c7dec8fe83e9ba9", "size": "15...
from django.db import models from denorm import denorms from django.conf import settings def denormalized(DBField,*args,**kwargs): """ Turns a callable into model field, analogous to python's ``@property`` decorator. The callable will be used to compute the value of the field every time the model gets ...
{ "content_hash": "192c5c938265e1c3faf59300581ad916", "timestamp": "", "source": "github", "line_count": 195, "max_line_length": 121, "avg_line_length": 36.55897435897436, "alnum_prop": 0.6027493337073924, "repo_name": "larsbijl/django-denorm", "id": "5d597c44cad87d3ac2934f41ef47a661f45b8f68", "size...
import csv from BeautifulSoup import * import requests import json import sys reload(sys) sys.setdefaultencoding('utf8') sys.stdout = codecs.getwriter('utf8')(sys.stdout) def loadNodesCSV(nodes_file): ''' Loads a dictionary of nodes from the backup file Returns: dictionary where key is name and value is string ...
{ "content_hash": "35101b55cda19bcc23c489e4e8f99cee", "timestamp": "", "source": "github", "line_count": 196, "max_line_length": 137, "avg_line_length": 32.44897959183673, "alnum_prop": 0.6457547169811321, "repo_name": "TheBrane/sodi-data-acquisition", "id": "d1d018d7b293d86056982173d8a4534cd08515f9",...
""" Assumes fabric environment already set up """ import subprocess import tempfile import time import os from os.path import dirname import requests import fabric.api import fabric.context_managers from path import path from nose.tools import nottest from cosmo_tester.framework.testenv import TestCase from cosmo_te...
{ "content_hash": "689c42b0a5e3c5d603e751c234de2573", "timestamp": "", "source": "github", "line_count": 308, "max_line_length": 89, "avg_line_length": 38.107142857142854, "alnum_prop": 0.5652210956803272, "repo_name": "cloudify-cosmo/cloudify-puppet-plugin", "id": "8a92cd11c3cf4b18df16dddd5603437988a...
r"""Example using PyCoral to classify a given image using an Edge TPU. To run this code, you must attach an Edge TPU attached to the host and install the Edge TPU runtime (`libedgetpu.so`) and `tflite_runtime`. For device setup instructions, see coral.ai/docs/setup. Example usage: ``` bash examples/install_requiremen...
{ "content_hash": "5c3cbb53af98d2ee9db0c5f4396758e3", "timestamp": "", "source": "github", "line_count": 107, "max_line_length": 79, "avg_line_length": 37.271028037383175, "alnum_prop": 0.6875626880641926, "repo_name": "google-coral/pycoral", "id": "a67acd09482f5c539324997e5bea79072054270b", "size":...
from .config import Config from .services import * from .database import db from .auth.decorators import auth_criteria
{ "content_hash": "fde682897f2d528265d61d66fdc00804", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 42, "avg_line_length": 29.75, "alnum_prop": 0.8067226890756303, "repo_name": "aaivazis/nautilus", "id": "feda582187f203fbb858854949508ba61f061715", "size": "119", "binary"...
from django.core.files.storage import FileSystemStorage class FileStorageCHMOD600(FileSystemStorage): def __init__(self, location=None, base_url=None, file_permissions_mode=None, directory_permissions_mode=None): return super(FileStorageCHMOD600, self).__init__(location=location, base_url=base_url, ...
{ "content_hash": "31cd642b363d83ecf560bde1a84c04f5", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 114, "avg_line_length": 45.888888888888886, "alnum_prop": 0.7627118644067796, "repo_name": "worthwhile/fabric-bolt", "id": "42d76c24a07591ba821341b7830cfc1636e7a0e1", "size"...
""" Usage: gn_to_cmake.py <json_file_name> gn gen out/config --ide=json --json-ide-script=../../gn/gn_to_cmake.py or gn gen out/config --ide=json python gn/gn_to_cmake.py out/config/project.json The first is recommended, as it will auto-update. """ import itertools import functools import json import posixpath im...
{ "content_hash": "8a69beee1a1a5ef0dd368f5d28773e3f", "timestamp": "", "source": "github", "line_count": 728, "max_line_length": 89, "avg_line_length": 35.292582417582416, "alnum_prop": 0.6681197213248745, "repo_name": "youtube/cobalt_sandbox", "id": "7dbf82c14e46df83261b502b7a8a9c26259964a3", "size...
from .manager import ProviderManager from .pipeline import PipelineProvider from .shell import ShellProvider manager = ProviderManager() manager.add("pipeline", PipelineProvider) manager.add("shell", ShellProvider) get = manager.get
{ "content_hash": "5e034f1f6ec6f9bde810ee36ee89c631", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 41, "avg_line_length": 26.11111111111111, "alnum_prop": 0.8127659574468085, "repo_name": "getsentry/freight", "id": "663f91ab7081c66f8b05f406f47f0eb395218f6b", "size": "235"...
import argparse import collections import copy import datetime import itertools import logging import subprocess import tempfile import time import unittest import urllib2 import dateutil from testing_support import auto_stub from infra.tools.cq_stats import cq_stats class Args(object): def __init__(self, **kwar...
{ "content_hash": "ec45a2732aa12153353e261a88a89629", "timestamp": "", "source": "github", "line_count": 807, "max_line_length": 79, "avg_line_length": 35.27137546468401, "alnum_prop": 0.5879005059021922, "repo_name": "nicko96/Chrome-Infra", "id": "b4f875efa47067f8cc0da40581006c9e2d85529c", "size": ...
import re import argparse def generate(payload, target, dest, param=None) -> str: ''' generates and returns single payload ''' payload = payload.rstrip() payload = re.sub("TARGET", target, payload) payload = re.sub("DEST", dest, payload) if param: payload = re.sub("PARAM", para...
{ "content_hash": "5902246d759bfcddd631a4a9bcd0e54f", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 107, "avg_line_length": 29.176470588235293, "alnum_prop": 0.6243279569892473, "repo_name": "bl4de/security-tools", "id": "7f4d6432a43d2b3451daf6f9135d4ddb243467b8", "size":...
""" Routes and views for the flask application. """ from datetime import datetime import flask import flask.ext.login as flask_login from puccidog import app, lm from puccidog.models import User from puccidog.forms import LoginForm import os, os.path from twilio.twiml.messaging_response import Body, Message, Redirect,...
{ "content_hash": "48427f46bdafc63c6b972dc48bec65d5", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 98, "avg_line_length": 28.804123711340207, "alnum_prop": 0.670722977809592, "repo_name": "lbearl/puccithe.dog", "id": "150128991458cc7933dbfdc041b620ba88df341a", "size": "2...
"""Make Cog runnable directly from the module.""" import sys from .cogapp import Cog sys.exit(Cog().main(sys.argv))
{ "content_hash": "e3834e68c05b3d4cca70a78cd1f219af", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 49, "avg_line_length": 17, "alnum_prop": 0.7142857142857143, "repo_name": "osblinnikov/gernet", "id": "2805696b90aa62fc2dc9ef5ea5ec4e299987e725", "size": "119", "binary": ...
from pprint import pprint from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver import libcloud.security # Get nttcis driver libcloud.security.VERIFY_SSL_CERT = True cls = get_driver(Provider.NTTCIS) driver = cls('myusername', 'mypassword', region='eu') # Get location location ...
{ "content_hash": "3b8422d0f922ddb1c36733336afa3d38", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 71, "avg_line_length": 28.964912280701753, "alnum_prop": 0.7225923682616596, "repo_name": "andrewsomething/libcloud", "id": "252369ffe1b57f5aecdad810ac2bc5958d1bb954", "siz...
from __future__ import with_statement import sys import struct import json import ssl import pytest import gevent import six from six.moves import range from itertools import product from gnsq import NsqdTCPClient, Message, states, errors from gnsq import protocol as nsq from gnsq.stream.stream import SSLSocket, Defa...
{ "content_hash": "fd8d3c13791a94d2bf82424b670f29b4", "timestamp": "", "source": "github", "line_count": 481, "max_line_length": 80, "avg_line_length": 30.496881496881496, "alnum_prop": 0.5954052764332947, "repo_name": "wtolson/gnsq", "id": "b4e4bea6fb8c2cbb6078b4958cc554b22064c64c", "size": "14669"...
input = input().split(' ') output = [] for word in input: if word: output.append(word[0].upper() + word[1:].lower()) else: output.append('') print (' '.join(output))
{ "content_hash": "8cbf4c0ec0a8e60ff704cd603ae89372", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 57, "avg_line_length": 19.1, "alnum_prop": 0.5445026178010471, "repo_name": "vipmunot/HackerRank", "id": "f48f3307e9987b98ec5ac470e7c481411cd0165a", "size": "191", "binar...
""" The RatingRequestServer handles incoming rating requests. """ """ ################################################################################ Messages: Client -> RatingRequestServer: "request": { "rating": { "domain": "example.com" } } Rating...
{ "content_hash": "d0dcb15fbdc7bd2e8c35d7182f2f5740", "timestamp": "", "source": "github", "line_count": 266, "max_line_length": 82, "avg_line_length": 29.718045112781954, "alnum_prop": 0.41796331435800127, "repo_name": "andreas-kowasch/DomainSearch", "id": "e8732a44c152c265aa8d637e3455f48185c6068f", ...
import mock from six.moves import http_client from webob import exc from ironic.api.controllers import base as cbase from ironic.tests.unit.api import base class TestBase(base.BaseApiTest): def test_api_setup(self): pass def test_bad_uri(self): response = self.get_json('/bad/path', ...
{ "content_hash": "f0c015bff9db53bb46d53738265e8bbb", "timestamp": "", "source": "github", "line_count": 124, "max_line_length": 77, "avg_line_length": 37.36290322580645, "alnum_prop": 0.5834232678609972, "repo_name": "pshchelo/ironic", "id": "f15f4724cf5ce53ce14cea5504760dac4803019d", "size": "5290...
''' Created on 20 Oct 2014 @author: davidgee This Python function takes in XML and irrelevant of namespaces returns children of elements based on entry key and row match. Acknowledge this routine is for gathering children from an element. If all of the data you require is in this: <data>blah</data> format, then this ...
{ "content_hash": "591f89aa36430c315fff9475b1003749", "timestamp": "", "source": "github", "line_count": 284, "max_line_length": 374, "avg_line_length": 50.25, "alnum_prop": 0.4312942330600519, "repo_name": "DavidJohnGee/ipngxr2d", "id": "c52dc6d5795a463e9e454f7ea7e29f2ebee4214d", "size": "14271", ...
""" LICENCE ------- Copyright 2013 by Kitware, Inc. All Rights Reserved. Please refer to KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. """ import abc import logging import multiprocessing import uuid class ControllerProcessInfo ...
{ "content_hash": "91da429c9664f8b04b9807d8eae1701f", "timestamp": "", "source": "github", "line_count": 115, "max_line_length": 80, "avg_line_length": 29.617391304347827, "alnum_prop": 0.5945390487375221, "repo_name": "anguoyang/SMQTK", "id": "81098df74420a9760bfeaaf9d69c74e4300ffd0a", "size": "340...
from logs import sonarlog import conf_domains import conf_domainsize import configuration import sys # Setup logging logger = sonarlog.getLogger('controller') class Provisioning(object): ''' Allocates and deallocates domains in the model only. ''' def __init__(self, model, pump, placement_strateg...
{ "content_hash": "74bc10a2bdae5299e6a2369eb067d748", "timestamp": "", "source": "github", "line_count": 153, "max_line_length": 99, "avg_line_length": 32.490196078431374, "alnum_prop": 0.5908267954133977, "repo_name": "jacksonicson/paper.IS2015", "id": "f39b8fee25db21d7d42d6ae2a43f6c47fe565380", "s...
from __future__ import print_function import itk import sys import itkTemplate itk.auto_progress(2) # must force the load to return all the names with dir(itk) itk.force_load() wrongAPI = 0 totalAPI = 0 # a list of classes to exclude. Typically, the classes with a custom New() # method, which return a subclass of t...
{ "content_hash": "0ddc5f446bf2bfb68e497063dba69163", "timestamp": "", "source": "github", "line_count": 87, "max_line_length": 161, "avg_line_length": 34.86206896551724, "alnum_prop": 0.653478404220244, "repo_name": "fbudin69500/ITK", "id": "e117be1098f4932150c7176d327a5a1c03d3cc10", "size": "3882"...
import os import sys import argparse import logging SECTION_TITLES = { 'examples':'EXAMPLES', } class ArgumentParser(argparse.ArgumentParser): """argument parser with better defaults""" def __init__(self,*args,**kwargs): """ the following kwargs are modified as follows: - epil...
{ "content_hash": "4db970db1c71af0954c0c2e145c53516", "timestamp": "", "source": "github", "line_count": 354, "max_line_length": 182, "avg_line_length": 27.610169491525422, "alnum_prop": 0.5010231225700839, "repo_name": "cirosantilli/python-utils", "id": "93cd478618c435f1e7544fca683f765646c4e44d", "...
import numpy as np import pandas as pd import datetime import matplotlib.pyplot as plt import scipy.stats as stats import config import preprocessing as pp import re import statsmodels.api as sm datafolder = config.datafolder class ConfidenceIndexer(object): def __init__(self, inpath, testfile, outpath): ...
{ "content_hash": "6f2daa6be331d20367f32861ef45f058", "timestamp": "", "source": "github", "line_count": 256, "max_line_length": 126, "avg_line_length": 37.9296875, "alnum_prop": 0.6225540679711637, "repo_name": "chreman/output_BA", "id": "6f696fc434ec718a4c4f7b520517032266db5c87", "size": "9764", ...
from habiter.tui.deferred_widgets import DueDeferredWidget, DoneDeferredWidget from habiter.tui.list_views import AbstractListView class DueDeferredListView(AbstractListView): list_title = 'Deferred API calls' widget_cls = DueDeferredWidget class DoneDeferredListView(AbstractListView): list_title = 'API...
{ "content_hash": "eda44873f498a047e5472be2c7cf8537", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 78, "avg_line_length": 30.583333333333332, "alnum_prop": 0.7983651226158038, "repo_name": "moskupols/habiter", "id": "6aac9059ee98668766bbbb761208957d3c11e1b8", "size": "36...
GRAPHITE_SERVER = 'graphite' # http return code in the event of a error/critical ERROR_HTTP_RC = 506 # http return code in the event of a warning WARNING_HTTP_RC = 200 try: from local_settings import * except ImportError: pass
{ "content_hash": "ae8daa9dccdd1f26f3226fd34717bf68", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 51, "avg_line_length": 19.833333333333332, "alnum_prop": 0.726890756302521, "repo_name": "daniellawrence/graphite-ok", "id": "dffd2196a495ca3c1054af0f841a3a51d42cc9ed", "si...
''' Script to generate list of seed nodes for chainparams.cpp. This script expects two text files in the directory that is passed as an argument: nodes_main.txt nodes_test.txt These files must consist of lines in the format <ip> <ip>:<port> [<ipv6>] [<ipv6>]:<port> <onion>.onion 0xDD...
{ "content_hash": "e9f5291517cd46c9fc60841fea5e431b", "timestamp": "", "source": "github", "line_count": 127, "max_line_length": 98, "avg_line_length": 31.362204724409448, "alnum_prop": 0.5699221692191815, "repo_name": "zeded/bitcurrency", "id": "718b8b95bd9fe1334ecb51e5b1afdacb6ed83d47", "size": "4...
''' Problem ======= The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? Latest Run Stats ====== === ===== ''' from math import sqrt from math import ceil startingValue = 600851475143 #startingValue = 13195 def primeSieve(num): noprimes = {j for i in ran...
{ "content_hash": "bd2a54b904c2ab6d475155965bae6b15", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 86, "avg_line_length": 23.625, "alnum_prop": 0.6772486772486772, "repo_name": "ryanbmilbourne/euler", "id": "bb0bde8aef1add645bbff861e12eac96cc8253ff", "size": "591", "bi...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from keras.optimizers import SGD from keras.optimizers import Adam from keras.optimizers import adadelta from keras.optimizers import rmsprop import socket import os # -----------------------------------------...
{ "content_hash": "c9770865fae0cb079600dd78193ff000", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 64, "avg_line_length": 25.857142857142858, "alnum_prop": 0.6343545956805625, "repo_name": "pratikgujjar/DeepIntent", "id": "e0000b42b59e59902802d9c0d4f96c1f79f319be", "size...
""" Generate a large batch of image samples from a model and save them as a large numpy array. This can be used to produce samples for FID evaluation. """ import argparse import os import numpy as np import torch as th import torch.distributed as dist from guided_diffusion import dist_util, logger from guided_diffus...
{ "content_hash": "af9d5ad5593b82c50c2bb0cb8ea9b7b1", "timestamp": "", "source": "github", "line_count": 108, "max_line_length": 88, "avg_line_length": 31.462962962962962, "alnum_prop": 0.6062389640965273, "repo_name": "google/referring-manipulation", "id": "8bcfd463dcbe86ce42e6708892d81e24d549583d", ...
import six import unittest from random import shuffle, choice, randrange from framework import VppTestCase, VppTestRunner import scapy.compat from scapy.packet import Raw from scapy.layers.l2 import Ether, GRE from scapy.layers.inet import IP, UDP, ICMP from scapy.layers.inet6 import HBHOptUnknown, ICMPv6ParamProblem...
{ "content_hash": "2fa4d67c435e7fd4ead54cc952d09249", "timestamp": "", "source": "github", "line_count": 2009, "max_line_length": 79, "avg_line_length": 39.430064708810356, "alnum_prop": 0.565625197247996, "repo_name": "vpp-dev/vpp", "id": "e9a3af3a0ffed5110326c4e51e92e5b8b89c08f2", "size": "79239",...
""" This module implements the telnet protocol. This depends on a generic session module that implements the actual login procedure of the game, tracks sessions etc. """ import re from twisted.internet.task import LoopingCall from twisted.conch.telnet import Telnet, StatefulTelnetProtocol, IAC, LINEMODE, GA, WILL, W...
{ "content_hash": "8512135e39e3811d55b1271e1d0c9a31", "timestamp": "", "source": "github", "line_count": 291, "max_line_length": 146, "avg_line_length": 40.16838487972509, "alnum_prop": 0.5828556762768414, "repo_name": "mrkulk/text-world", "id": "b16f82a107c92d45e6610ae32b46df146700878f", "size": "1...