text
stringlengths
4
1.02M
meta
dict
from pyramid.path import ( DottedNameResolver ) from zope.interface import Interface from pyramid_urireferencer import protected_resources from .referencer import Referencer from .renderers import json_renderer class IReferencer(Interface): pass def includeme(config): """this function adds some configu...
{ "content_hash": "ffb80f1cc93b6d9c47277079f80f4339", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 67, "avg_line_length": 28.541666666666668, "alnum_prop": 0.7277372262773723, "repo_name": "OnroerendErfgoed/pyramid_urireferencer", "id": "ec682373d98d35939612e33b7d0cf6b93e2...
def extractRealmOfChaos(item): """ #'Realm of Chaos' """ vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol or frag) or 'preview' in item['title'].lower(): return None if 'Myriad of Shades' in item['tags']: names = [tmp for tmp in item['tags'] if tmp in ['Celest Ambro...
{ "content_hash": "9b1c378c0801d5487732e89456166eee", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 145, "avg_line_length": 44.142857142857146, "alnum_prop": 0.6763754045307443, "repo_name": "fake-name/ReadableWebProxy", "id": "8640f47271121baaf1025afbcf1bd0a0f36774be", "...
import copy import datetime import math import uuid import iso8601 import mock import netaddr from oslo_config import cfg import webob from nova.api.openstack.compute.contrib import networks_associate from nova.api.openstack.compute.contrib import os_networks as networks from nova.api.openstack.compute.plugins.v3 imp...
{ "content_hash": "92bdcbf8f77431c9204c85239200f1ff", "timestamp": "", "source": "github", "line_count": 635, "max_line_length": 79, "avg_line_length": 42.188976377952756, "alnum_prop": 0.5911160880925719, "repo_name": "orbitfp7/nova", "id": "2d9a7fe3f4f6ca773f8c2784bb6faac6edd83204", "size": "27457...
"""The Dune HD component.""" import asyncio from pdunehd import DuneHDPlayer from homeassistant.const import CONF_HOST from .const import DOMAIN PLATFORMS = ["media_player"] async def async_setup_entry(hass, config_entry): """Set up a config entry.""" host = config_entry.data[CONF_HOST] player = Dune...
{ "content_hash": "3a21cb07e144d289667ddacc42326282", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 86, "avg_line_length": 22.818181818181817, "alnum_prop": 0.6354581673306773, "repo_name": "adrienbrault/home-assistant", "id": "10c66c3bfb06f8fe03bf9589f38996eeed09229c", "...
import sys from antlr3 import * from antlr3.compat import set, frozenset from antlr3.tree import * HIDDEN = BaseRecognizer.HIDDEN UNDERSCORE=53 GEOPOINT=33 UNICODE_ESC=56 LT=11 TEXT=27 HTML=28 MINUS=18 RSQUARE=25 SNIPPET=44 PHRASE=35 T__58=58 INDEX=5 OCTAL_ESC=57 NUMBER=31 DISTANCE=39 LOG=40 LPAREN=21 RPAREN=2...
{ "content_hash": "1cbeda49dfb8048eb78de871ab6f5eda", "timestamp": "", "source": "github", "line_count": 2287, "max_line_length": 182, "avg_line_length": 23.838216003498033, "alnum_prop": 0.5048240947943798, "repo_name": "Suwmlee/XX-Net", "id": "96f67fe8693040f31d70b743da64f9eb81cb3197", "size": "55...
from clif_aux.python import lib_hello import unittest class LibHello(unittest.TestCase): def testHello(self): res = lib_hello.hello('world') self.assertEqual(res, 'Hello, world!') def testHelloAndBye(self): res = lib_hello.hello_and_bye('world') self.assertEqual(res, 'Hello, world! Bye, world!')...
{ "content_hash": "4bf2f3014e3aaf142e10135727b477ea", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 54, "avg_line_length": 22.9375, "alnum_prop": 0.670299727520436, "repo_name": "google/clif", "id": "fae4d3213e0fdebfde3fdabf68330669edada864", "size": "943", "binary": fa...
import sys import logging import numpy as np from sklearn.cross_validation import ShuffleSplit # from sklearn.cross_validation import StratifiedShuffleSplit from sklearn.cross_validation import StratifiedKFold class TrainSplit(object): def __init__(self, eval_size, stratify=True, random_state=None): sel...
{ "content_hash": "a2e54a481bc105b7a14e5e97a47a6b0f", "timestamp": "", "source": "github", "line_count": 98, "max_line_length": 115, "avg_line_length": 32.51020408163265, "alnum_prop": 0.5662272441933459, "repo_name": "felixlaumon/kaggle-right-whale", "id": "ff64de4bd8572647e8067dd213ad37719839c54b", ...
from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Switch', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=...
{ "content_hash": "9d1881713ea5f5e8230550598d3301e4", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 121, "avg_line_length": 30.32, "alnum_prop": 0.5303430079155673, "repo_name": "BCGamer/CheckIn-Server", "id": "4cb9969a0944fe079b9f8682f95945015a846afd", "size": "782", "...
import os from m2x.client import M2XClient # Instantiate a client client = M2XClient(key=os.environ['API_KEY']) # Delete the device device try: device = client.device(os.environ['DEVICE_ID']) print "Deleting device with ID {id}".format(id=device.id) device.remove() except Exception: pass if client.last_resp...
{ "content_hash": "e7386d5fc07ae3aaca8fe5f8dc58a65d", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 73, "avg_line_length": 24.6, "alnum_prop": 0.7439024390243902, "repo_name": "attm2x/m2x-python", "id": "fb4bec675b14e6b7133a8a465b6f3889ad1cf2fb", "size": "715", "binary"...
"""'Abstract' Tab Handler class that groups several Handlers together. """ from itertools import izip from taba.handlers.tab_handler import TabHandler class CounterGroup(TabHandler): """'Abstract' Tab Handler class that groups several Handlers together. Sub-classes should at least implement wrap NewState(), and...
{ "content_hash": "e6267dd7753cf692b2467bc6b49a90c2", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 78, "avg_line_length": 33.214285714285715, "alnum_prop": 0.6831541218637993, "repo_name": "tellapart/taba", "id": "c5c1c6ea4c27ab0186d41159c9699c5fc9959727", "size": "3370"...
class Affliction(): """ Defines a member of the travelling party. """ def __init__(self, affliciton_def=None): assert affliciton_def is not None, 'ERROR - you need to provide an affliction definition dictionary.' try: self.name = affliciton_def['name'] self.sever...
{ "content_hash": "e287b9b0d2728fe12ebe2440097bfd4b", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 109, "avg_line_length": 36.07142857142857, "alnum_prop": 0.6099009900990099, "repo_name": "rwsharp/TORT", "id": "07316020f2ab1e53574de3328e247516d55a3644", "size": "505", ...
from peer import * class Stack(Peer): ShowLayer = Pillow.In HideLayer = Pillow.In EnableLayer = Pillow.In DisableLayer = Pillow.In def __init__(self, room, controller): Peer.__init__(self, room) self._controller = controller self._catch(Stack.In.ShowLayer, self._showLayer) ...
{ "content_hash": "0f56971ae94638c98b12b442ed68eabf", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 62, "avg_line_length": 31.074074074074073, "alnum_prop": 0.6555423122765197, "repo_name": "FreshXOpenSource/wallaby-base", "id": "c4a3d797c1a8f0069841addc5954c4d2c93902af", ...
"""Wordcount exercise Google's Python class The main() below is already defined and complete. It calls print_words() and print_top() functions which you write. 1. For the --count flag, implement a print_words(filename) function that counts how often each word appears in the text and prints: word1 count1 word2 count2 ...
{ "content_hash": "52538086702f7fadf45e912ff36e04d2", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 79, "avg_line_length": 31.193548387096776, "alnum_prop": 0.704756980351603, "repo_name": "wltrimbl/google-python-exercises3", "id": "8108bfbd36d095e9333fcfea02746c33a3a3f27b"...
import os import time from StringIO import StringIO from PIL import Image from django.conf import settings from sorl.thumbnail.base import Thumbnail from sorl.thumbnail.main import DjangoThumbnail, get_thumbnail_setting from sorl.thumbnail.processors import dynamic_import, get_valid_options from sorl.thumbnail.tests....
{ "content_hash": "4331ae3f57fe8f5be90bba3d2623f997", "timestamp": "", "source": "github", "line_count": 174, "max_line_length": 79, "avg_line_length": 45.81609195402299, "alnum_prop": 0.6078775715002509, "repo_name": "dantium/sorl-thumbnail", "id": "d15dd1937a90fe47031b7e4ffd8553d352454764", "size"...
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import csv import os import tempfile from django.core.management import call_command from django.core.management.base import CommandError from django.test import TestCase from ..csv_utils import infer...
{ "content_hash": "73ebc429f43beded5776e7de0fc985f2", "timestamp": "", "source": "github", "line_count": 339, "max_line_length": 88, "avg_line_length": 37.74631268436578, "alnum_prop": 0.6203501094091903, "repo_name": "mrpau/kolibri", "id": "8f9b27c83ef0a32d45e2a262a87dab1735182384", "size": "12796"...
import binascii # Searching short title from readability implementation import re def normalize_entities(cur_title): entities = { '—': '-', '–': '-', '—': '-', '–': '-', ' ': ' ', '«': '"', '»': '"', '"': '"', '\xa0': ' ', ...
{ "content_hash": "0be5f630d11deda53af6fbd3455d8471", "timestamp": "", "source": "github", "line_count": 143, "max_line_length": 102, "avg_line_length": 28.937062937062937, "alnum_prop": 0.5495408409859835, "repo_name": "reefeed/wanish", "id": "7b270bd3055b98562d45defad3bc9c70d5613011", "size": "414...
from __future__ import print_function import sys import os import argparse from px4params import srcscanner, srcparser, xmlout, dokuwikiout, dokuwikirpc def main(): # Parse command line arguments parser = argparse.ArgumentParser(description="Process parameter documentation.") parser.add_argument("-s", "--s...
{ "content_hash": "f9b4e1174a5c03cfb7264355c8463d6c", "timestamp": "", "source": "github", "line_count": 107, "max_line_length": 102, "avg_line_length": 43.85981308411215, "alnum_prop": 0.5197102066908161, "repo_name": "darknight-007/Firmware", "id": "7bac8834d3cfec311b4535dde94c9510b9ecdc01", "size...
from django.test import TestCase from django.test.client import Client from django.conf import settings from importlib import import_module from waffle.models import Switch class TestAccessibilitySwitcher(TestCase): def setUp(self): self.client = Client() # http://code.djangoproject.com/ticket/1...
{ "content_hash": "4e639b2a7329028e53f55ea5a7b65d07", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 85, "avg_line_length": 37.96551724137931, "alnum_prop": 0.6907356948228883, "repo_name": "ministryofjustice/manchester_traffic_offences_pleas", "id": "b4ac9cb6ff29370e8ad7597...
from six import ensure_text from .node import NodeVisitor, ValueNode, ListNode, BinaryExpressionNode from .parser import atoms, precedence atom_names = {v: "@%s" % k for (k,v) in atoms.items()} named_escapes = {"\a", "\b", "\f", "\n", "\r", "\t", "\v"} def escape(string, extras=""): # Assumes input bytes are ei...
{ "content_hash": "2b31d7e279a5bc74eec22f1643cc0c7e", "timestamp": "", "source": "github", "line_count": 145, "max_line_length": 96, "avg_line_length": 30.910344827586208, "alnum_prop": 0.5258813029897367, "repo_name": "scheib/chromium", "id": "e31a60791ea78f362f1ef27c621b6f4f2eaa230e", "size": "448...
from twisted.words.protocols import irc from txircd.modbase import Mode class NoExternalMessagesMode(Mode): def checkPermission(self, user, cmd, data): if cmd not in ["PRIVMSG", "NOTICE"]: return data targetChannels = data["targetchan"] chanModList = data["chanmod"] ...
{ "content_hash": "4cbe78769795f9af61bddb41c582bb01", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 122, "avg_line_length": 31.135135135135137, "alnum_prop": 0.5711805555555556, "repo_name": "DesertBus/txircd", "id": "998490647a5eaf61c6db2a204475381423316455", "size": "11...
def merge_sort(m): """Sort list m, using merge sort""" return m.sort() # TODO: Replace with actual implementation
{ "content_hash": "70bb10af3d3520f4b928e0a78b1186d3", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 59, "avg_line_length": 38.666666666666664, "alnum_prop": 0.7068965517241379, "repo_name": "praqma-training/gitkatas", "id": "e4faf9ddaa3bd5fc261e3d3d147f477e634edb32", "size...
""" Provides numerous filters, and a command (outfilter) to set them as filters on the output of the bot. """ import supybot import supybot.world as world # Use this for the version of this plugin. You may wish to put a CVS keyword # in here if you\'re keeping the plugin in CVS or some similar system. __version__ = ...
{ "content_hash": "97576a5d4354b919151bb647468c4eb4", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 78, "avg_line_length": 24.322580645161292, "alnum_prop": 0.7347480106100795, "repo_name": "Ban3/Limnoria", "id": "cf46f1d713947ace40796228444ce7f116fdc32f", "size": "2338",...
import warnings from tencentcloud.common.abstract_model import AbstractModel class Acl(AbstractModel): """ACL对象实体 """ def __init__(self): r""" :param ResourceType: Acl资源类型,(0:UNKNOWN,1:ANY,2:TOPIC,3:GROUP,4:CLUSTER,5:TRANSACTIONAL_ID)当前只有TOPIC, :type ResourceType: int :p...
{ "content_hash": "c9c35ca71435a42f79e5b4ce10f803e4", "timestamp": "", "source": "github", "line_count": 11034, "max_line_length": 211, "avg_line_length": 32.07775965198478, "alnum_prop": 0.6067337955507337, "repo_name": "tzpBingo/github-trending", "id": "d20ea696644822019040916cd90d96d639eb121b", "...
"""Run Google Data Loss Prevention API DeID. All input/output files should be on Google Cloud Storage. Requires Apache Beam client and Google Python API Client: pip install --upgrade apache_beam pip install --upgrade google-api-python-client """ from __future__ import absolute_import import collections import copy ...
{ "content_hash": "e2047039a51d50ac3a9551a2a6a1af3b", "timestamp": "", "source": "github", "line_count": 1005, "max_line_length": 83, "avg_line_length": 39.41691542288557, "alnum_prop": 0.6396728429343161, "repo_name": "GoogleCloudPlatform/healthcare-deid", "id": "afb8bef1b307caa6a63d7dc06d0fee52805c0...
import math import numpy as np import matplotlib.pyplot as plt from network import Network def normalize(v): s = 0 for x in v: if math.fabs(x) > s: s = math.fabs(x) if s == 0: return v else: return v/s dt = 0.0001 totalTime = 0.3 numIterations = int(totalTime/dt) m...
{ "content_hash": "22559de91eed6b9bb05f26a6b18ba306", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 44, "avg_line_length": 18.727272727272727, "alnum_prop": 0.6225728155339806, "repo_name": "nspotrepka/neuron-inference", "id": "2d64c16bc8b093ed40ae810c71958053fc9c62fb", "...
import base64 import winrm class PyinfraWinrmSession(winrm.Session): """This is our subclassed Session that allows for env setting""" def run_cmd(self, command, args=(), env=None): shell_id = self.protocol.open_shell(env_vars=env) command_id = self.protocol.run_command(shell_id, command, arg...
{ "content_hash": "e62f5410a49d8a519cf7748e3023f62f", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 87, "avg_line_length": 39.75, "alnum_prop": 0.6460017969451932, "repo_name": "Fizzadar/pyinfra", "id": "a0905b5477d75c94879bdec41bfe0950bea993ac", "size": "1113", "binary...
from __future__ import print_function def foo_function(debugger, args, result, dict): print("foobar says " + args, file=result) return None
{ "content_hash": "39a9a15f5550a8bd677b2a56d1395b61", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 47, "avg_line_length": 25, "alnum_prop": 0.6933333333333334, "repo_name": "youtube/cobalt", "id": "6ef71064c9a9dbfc6cf38f40c3bcfd859b331810", "size": "150", "binary": fals...
if __name__ == '__main__': import validator as v first_name = input("Enter the first name: ") last_name = input("Enter the last name: ") zip_code = input("Enter the ZIP code: ") employee_id = input("Enter an employee ID: ") success, err = v.validate_input( first_name, last_name, zip_cod...
{ "content_hash": "6b1259143bd16ef62f4838617d0ab142", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 54, "avg_line_length": 34.15384615384615, "alnum_prop": 0.5855855855855856, "repo_name": "yamanobori-old/LanguageExercises", "id": "08cae28a2ff79df49c5aa77fdf19161c78c1cef6",...
from flask import Flask, render_template, request, session import pkg_resources import sys import os import logging import matplotlib matplotlib.use('TkAgg') # Changes the matplotlib framework import utils.dave_endpoint as DaveEndpoint import utils.dataset_cache as DsCache import utils.gevent_helper as GeHelper imp...
{ "content_hash": "cf9cfaa378528369153c6261a843b335", "timestamp": "", "source": "github", "line_count": 359, "max_line_length": 145, "avg_line_length": 41.618384401114206, "alnum_prop": 0.6655511679271803, "repo_name": "StingraySoftware/dave", "id": "3b5903f1f0f2364bd51d2b878e4b0265ff579dd7", "size...
""" Plot autocorrelation for toy model. """ import os import sys sys.path.append('./code') from models import ISA, GSM, Distribution from numpy import * from numpy import max from numpy.random import * from numpy.linalg import pinv from tools import contours, mapp from pgf import * from pdb import set_trace from tim...
{ "content_hash": "ea52d99ce9b684eb4408938f39710d89", "timestamp": "", "source": "github", "line_count": 175, "max_line_length": 101, "avg_line_length": 24.411428571428573, "alnum_prop": 0.6732209737827716, "repo_name": "lucastheis/isa", "id": "ba1aa0735b179d30186e51e906bbc519ff268067", "size": "427...
import json import socket import sys import asfgit.cfg as cfg import asfgit.git as git import asfgit.log as log import subprocess, os, time def main(): ghurl = "git@github:apache/%s.git" % cfg.repo_name os.chdir("/x1/git/repos/asf/%s.git" % cfg.repo_name) try: subprocess.check_call(["git", "push", ...
{ "content_hash": "9a9791f44077d13a90396579779ff27b", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 77, "avg_line_length": 27.708333333333332, "alnum_prop": 0.5954887218045113, "repo_name": "chtyim/infrastructure-puppet", "id": "47e67f27063e7dd0080d0611bf621aca7b43770e", ...
from codecs import open from setuptools import setup from libmt94x import __version__ def read_file(filepath): with open(filepath, 'rb+', 'utf-8') as f: content = f.read() return content.strip() CLASSIFIERS = [ 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', ...
{ "content_hash": "2957e554880e9a1d624aca7b5dc94ba3", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 79, "avg_line_length": 26.854166666666668, "alnum_prop": 0.6322730799069046, "repo_name": "gingerpayments/python-libmt94x", "id": "abdc395918aa3987cb16d7f09e423080391b71ff", ...
from __future__ import unicode_literals from bottle import HTTPError, ServerAdapter from functools import partial, wraps from threading import Thread RETRY_AFTER_HEADER = str('Retry-After') def abort(code, message=None, headers=None): """ Abort a request and send a response with the given code, and optional...
{ "content_hash": "71d78674802b516e03fb6b1b04226512", "timestamp": "", "source": "github", "line_count": 114, "max_line_length": 111, "avg_line_length": 32.25438596491228, "alnum_prop": 0.642099537666576, "repo_name": "Tusky/box-python-sdk", "id": "19dc15681cb749aec02c6e4d12a03ffda1ccf747", "size": ...
import sqlite3 from airflow.hooks.dbapi_hook import DbApiHook class SqliteHook(DbApiHook): """ Interact with SQLite. """ conn_name_attr = 'sqlite_conn_id' default_conn_name = 'sqlite_default' supports_autocommit = False def get_conn(self): """ Returns a sqlite connectio...
{ "content_hash": "b9613d6d6a3793d1853c231c3e9b29fa", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 55, "avg_line_length": 20.863636363636363, "alnum_prop": 0.6252723311546841, "repo_name": "mtagle/airflow", "id": "2af589c524e51e93f07f9840901dd05c75168646", "size": "1247"...
from django.apps import AppConfig class JDPagesConfig(AppConfig): name = 'website.jdpages' label = 'jdpages' verbose_name = "JD Pages" class CoreConfig(AppConfig): name = 'website.core' label = 'jdcore' # prevent name collision with mezzanine.core verbose_name = "Website Core" class Event...
{ "content_hash": "c600e2fe5574284867a95f119d4daf89", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 66, "avg_line_length": 21.68421052631579, "alnum_prop": 0.6796116504854369, "repo_name": "jonge-democraten/website", "id": "9170d104f82c88cc6fa745e639f8245c4accd7ae", "size...
"""Support for Somfy Smart Thermostat.""" from __future__ import annotations from typing import Any, cast from pyoverkiz.enums import OverkizCommand, OverkizCommandParam, OverkizState from homeassistant.components.climate import ( PRESET_AWAY, PRESET_HOME, PRESET_NONE, ClimateEntity, ClimateEntit...
{ "content_hash": "e1f58db3b425dfd6e3e6044897b36fdf", "timestamp": "", "source": "github", "line_count": 162, "max_line_length": 88, "avg_line_length": 37.098765432098766, "alnum_prop": 0.6623960066555741, "repo_name": "w1ll1am23/home-assistant", "id": "608b26b8c9d6486aa24c495aeacf56a38c74b0f8", "si...
from troveclient import exceptions from nose.plugins.skip import SkipTest from proboscis import after_class from proboscis import before_class from proboscis import test from proboscis.asserts import * from proboscis.decorators import time_out from trove import tests from trove.tests.api.instances import instance_in...
{ "content_hash": "e7c6df57a51db5131f0b5817dd7162d7", "timestamp": "", "source": "github", "line_count": 212, "max_line_length": 78, "avg_line_length": 38.783018867924525, "alnum_prop": 0.6425443930917052, "repo_name": "citrix-openstack-build/trove", "id": "cceed886917b111875b1518db74f8b92cc3cfba5", ...
"""Translate the raw json files into python specific descriptions.""" import os import re from copy import deepcopy import jmespath from botocore_eb.compat import OrderedDict, json from botocore_eb.utils import merge_dicts from botocore_eb import xform_name class ModelFiles(object): """Container object to hold ...
{ "content_hash": "813d1634a48f47ed16f6120abcb36485", "timestamp": "", "source": "github", "line_count": 510, "max_line_length": 78, "avg_line_length": 41.90196078431372, "alnum_prop": 0.62817033224146, "repo_name": "ianblenke/awsebcli", "id": "5385329311fc9c9873f359697d4280c14de41406", "size": "219...
""" Error messages, data and custom validation code used in django-registration's various user-registration form classes. """ import re from django.conf import settings from django.core.exceptions import ValidationError from django.core.validators import RegexValidator from django.utils import six from django.utils.tr...
{ "content_hash": "c5982f1f1f3f8ed56a4c062701f9ac2e", "timestamp": "", "source": "github", "line_count": 248, "max_line_length": 79, "avg_line_length": 26.45967741935484, "alnum_prop": 0.6405059433099665, "repo_name": "memodir/cv", "id": "e70b31b7a24854ade776c9020ce7f2440f09be78", "size": "6664", ...
import os try: from setuptools import setup except ImportError: from distutils.core import setup # Get version and release info, which is all stored in LUH2/version.py ver_file = os.path.join('LUH2', 'version.py') with open(ver_file) as f: exec(f.read()) opts = dict(name=NAME, maintainer=M...
{ "content_hash": "7123dca01c9a5ad28a3de55a01e84648", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 70, "avg_line_length": 27.870967741935484, "alnum_prop": 0.5949074074074074, "repo_name": "ritviksahajpal/LUH2", "id": "0fc9a61ae250809868c76b4b03c432d3715a8471", "size": "...
from qiime2.plugin import SemanticType from ..plugin_setup import plugin from ..sample_data import SampleData from . import (QIIME1DemuxDirFmt, SingleLanePerSampleSingleEndFastqDirFmt, SingleLanePerSamplePairedEndFastqDirFmt) Sequences = SemanticType('Sequences', variant_of=SampleData.field['type']) S...
{ "content_hash": "50305a3a28dc0f4d307c9a062e24d6e1", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 78, "avg_line_length": 44.04347826086956, "alnum_prop": 0.736426456071076, "repo_name": "qiime2/q2-types", "id": "1297b6619b7cdb4c37a09e6446f54827737ed4a3", "size": "2376",...
"""TensorFlow Lite Python Interface: Sanity check.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.lite.python import convert from tensorflow.lite.python import lite_constants from tensorflow.lite.python import op_hint ...
{ "content_hash": "aaf2c569404c7b5a675ae98641e30f4b", "timestamp": "", "source": "github", "line_count": 320, "max_line_length": 80, "avg_line_length": 40.28125, "alnum_prop": 0.6409619860356865, "repo_name": "seanli9jan/tensorflow", "id": "7a0bce921b599f0dad9012c3148abd7a86496594", "size": "13579",...
import sys import os import struct import binascii from time import sleep from ctypes import (CDLL, get_errno) from ctypes.util import find_library from socket import (socket, AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI, SOL_HCI, HCI_FILTER,) os.system("hciconfig hci0 down") os.system("hciconfig hci0 up") if not os.geteuid()...
{ "content_hash": "8bf9f81eabe23d696a5e88fcf7edbd0c", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 86, "avg_line_length": 26.075757575757574, "alnum_prop": 0.6676350958744915, "repo_name": "jsantoso91/smartlighting", "id": "22cb086fbb9e77e3b70d9d7d970047c565c16d3e", "siz...
""" Contains the unittests for genomes """ # Internal modules # from genomes import Assembly # Unittesting module # try: import unittest2 as unittest except ImportError: import unittest # Nosetest flag # __test__ = True ################################################################################### clas...
{ "content_hash": "ff83b81b09ba2caa52cd4f97b87215e8", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 83, "avg_line_length": 27.580645161290324, "alnum_prop": 0.5368421052631579, "repo_name": "xapple/genomes", "id": "f2eb80ab1e84f9f74f87f3ee84305350c0c21741", "size": "855",...
import datetime import time import boto import redis import requests import random import zlib import re from django.shortcuts import get_object_or_404 from django.shortcuts import render from django.contrib.auth.decorators import login_required from django.template.loader import render_to_string from django.db import ...
{ "content_hash": "4df63582333b36fa5a1b8cd58e2cfb65", "timestamp": "", "source": "github", "line_count": 2624, "max_line_length": 163, "avg_line_length": 43.9828506097561, "alnum_prop": 0.5980885704135654, "repo_name": "AlphaCluster/NewsBlur", "id": "eb4afe4ed0fa0b12b8eb88639351b42a85d41bcc", "size"...
from channels import Group from channels.sessions import channel_session from django.contrib.auth.models import User from authentification.models import Document, Sentence, Word, Locuteur from backend.models import Historique import json, re, math user_room_dict = {} # Connected to websocket.connect @channel_sessi...
{ "content_hash": "56eced715a010941b897bd1cbee93ee3", "timestamp": "", "source": "github", "line_count": 256, "max_line_length": 149, "avg_line_length": 38.53515625, "alnum_prop": 0.6359858084135834, "repo_name": "rachidoulasri/django_projectwebpage", "id": "cc8ccb9cc58c6fcdab1babaf8b04a5701c7c661c", ...
def get_message_from_world(): from rez.config import config message = config.plugins.command.world.message return message
{ "content_hash": "571c1092543dae2527cb141666803276", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 50, "avg_line_length": 33.5, "alnum_prop": 0.7388059701492538, "repo_name": "instinct-vfx/rez", "id": "a703c053ca1924eb04b50f16f9ed562c12821dcd", "size": "218", "binary": ...
import pytest from django.http import HttpResponse from urlparse import urlparse import mock from nose.tools import * # flake8: noqa from rest_framework.test import APIRequestFactory from django.test.utils import override_settings from website.util import api_v2_url from api.base import settings from api.base.middl...
{ "content_hash": "feb96e73b5a336e400a5e502458fb97e", "timestamp": "", "source": "github", "line_count": 116, "max_line_length": 97, "avg_line_length": 41.37068965517241, "alnum_prop": 0.6699312356740987, "repo_name": "erinspace/osf.io", "id": "57dba001b1ca4ca1558b99cbe7c67d5e76e67108", "size": "482...
import collections from ..error import Error from ..language import ast def is_input_type(type): named_type = get_named_type(type) return isinstance(named_type, ( GraphQLScalarType, GraphQLEnumType, GraphQLInputObjectType, )) def is_composite_type(type): named_type = get_name...
{ "content_hash": "ea6b7740fd90e89f3333313d51d6b269", "timestamp": "", "source": "github", "line_count": 451, "max_line_length": 142, "avg_line_length": 30.827050997782706, "alnum_prop": 0.6008775084514134, "repo_name": "rawls238/graphql-py", "id": "408eb7a880ff809c9de449067ca9223ca2281d57", "size":...
from os.path import abspath, dirname, normpath, join import os import sys BASEDIR = dirname(abspath(__file__)) LOG = normpath(join(BASEDIR, '..', 'log.html')) TESTDATA = join(BASEDIR, 'dir.suite') OUTPUT = join(BASEDIR, 'output.xml') TARGET = join(BASEDIR, 'data.js') SRC = normpath(join(BASEDIR, '..', '..', '..')) sy...
{ "content_hash": "8a60c53a4758ba37375c0ac3facf955d", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 78, "avg_line_length": 37.20967741935484, "alnum_prop": 0.5483311660164716, "repo_name": "alexandrul-ci/robotframework", "id": "7868fcaed37727e4f5007fb071f946cc8ade8ed9", "...
""" Talon.One API Use the Talon.One API to integrate with your application and to manage applications and campaigns: - Use the operations in the [Integration API section](#integration-api) are used to integrate with our platform - Use the operation in the [Management API section](#management-api) to manage ap...
{ "content_hash": "ebbca951e31678c3a7495715659105b6", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 732, "avg_line_length": 38.22641509433962, "alnum_prop": 0.6618953603158934, "repo_name": "talon-one/talon_one.py", "id": "c16569866123a0c42880c33789589f7537fcfb56", "size"...
import urllib.parse import pkg_resources import tempfile from netforce import database import os import random import string import json import hmac import hashlib import base64 import time import sys from struct import Struct from operator import xor from itertools import starmap import binascii import signal import p...
{ "content_hash": "8681d38c81912d6202a6cf63b7b5d94d", "timestamp": "", "source": "github", "line_count": 555, "max_line_length": 151, "avg_line_length": 30.717117117117116, "alnum_prop": 0.5580713280150165, "repo_name": "nfco/netforce", "id": "a3030b85e0cc513f6838673cd4eb1af0b4c19f60", "size": "1815...
from __future__ import print_function import numpy as np import argparse import os import sys import signal import time import socket from contextlib import closing from six import string_types import math import paddle import paddle.fluid as fluid import paddle.fluid.profiler as profiler import paddle.fluid.unique_na...
{ "content_hash": "81616bc440c27556ff2a99ef0036cdb4", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 71, "avg_line_length": 31.553571428571427, "alnum_prop": 0.6151669496321449, "repo_name": "tensor-tang/Paddle", "id": "18f0485f923e4f72f76be3b0b34ebeb1d89c926c", "size": "2...
import sys import unittest from test import support import socket import select import time import datetime import gc import os import errno import pprint import tempfile import urllib.request import traceback import asyncore import weakref import platform import functools from unittest import mock ssl = support.impor...
{ "content_hash": "54d0e1e5e9b1e365a6cf638b84c47551", "timestamp": "", "source": "github", "line_count": 2937, "max_line_length": 117, "avg_line_length": 44.84984678243105, "alnum_prop": 0.5332285688257266, "repo_name": "samuelhavron/heroku-buildpack-python", "id": "dc82475a9d02a2ebf6c3779c2f9598f12a0...
from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import from __future__ import print_function import re from subprocess import PIPE from system_test import TestCase, Qdrouterd, TIMEOUT, main_module from system_test import unittest from proton.handlers import Messa...
{ "content_hash": "5731ad6677bf3590f9a80fd51edc2f69", "timestamp": "", "source": "github", "line_count": 177, "max_line_length": 106, "avg_line_length": 38.0225988700565, "alnum_prop": 0.6141158989598812, "repo_name": "irinabov/debian-qpid-dispatch", "id": "de81e2f1b2e4fa0dc9166ffbe38bafd43bd802d5", ...
import logging import sys import numpy as np import pytest import rasterio from rasterio.enums import MaskFlags from rasterio.warnings import NodataShadowWarning logging.basicConfig(stream=sys.stderr, level=logging.DEBUG) @pytest.fixture(scope='function') def tiffs(tmpdir): with rasterio.open('tests/data/RG...
{ "content_hash": "ff5f6beacab7ec1b92f3f5b8aa1d7ccd", "timestamp": "", "source": "github", "line_count": 164, "max_line_length": 70, "avg_line_length": 31.49390243902439, "alnum_prop": 0.5969022265246854, "repo_name": "njwilson23/rasterio", "id": "0624b10b993ef36035dec2c67456fc555a33b885", "size": "...
""" Client for Swift Copyright 2012-2013 Gregory Holt Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to...
{ "content_hash": "fe026862d36a4cda4aad3b0b857a2969", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 72, "avg_line_length": 32.375, "alnum_prop": 0.7619047619047619, "repo_name": "dpgoetz/swiftly", "id": "e5ccdad6b7a573e94ec0e620a6310b7dc5e6b2c8", "size": "777", "binary"...
import base64 from openid.store.interface import OpenIDStore as OIDStore from openid.association import Association as OIDAssociation from models import OpenIDStore, OpenIDNonce class DBOpenIDStore(OIDStore): max_nonce_age = 6 * 60 * 60 def storeAssociation(self, server_url, assoc=None): OpenIDStor...
{ "content_hash": "b57497fe92d97d3d9ece785d8d236bcf", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 83, "avg_line_length": 28.89189189189189, "alnum_prop": 0.5757717492984097, "repo_name": "Suite5/DataColibri", "id": "802f99374c846e15cf96b7d4c2198c374f593e21", "size": "21...
import unittest from covered_lib_coveragerc import mod1 class TestLib(unittest.TestCase): def test1(self): self.assertEqual(mod1.covered_func(), 9)
{ "content_hash": "28565fd547d92198d327bd1d0cf81b58", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 48, "avg_line_length": 20.375, "alnum_prop": 0.7300613496932515, "repo_name": "ptthiem/nose2", "id": "55821cc4f00bdc3752144575d55890e35ea7fbdd", "size": "163", "binary": f...
def triangle(index): triangle = (index * (index + 1)) / 2 return triangle def factors(n): count=0 divisors = 0; if n%2 == 0: n=n/2 while n%2 == 0: count+=1 n = n/2 divisors = count +1 div=3 # at this point, n is no even while n!=1: count = 0 while n%div == 0: count+=1 n = n/div # a ...
{ "content_hash": "fcf94526b973b24870f27918657cf646", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 86, "avg_line_length": 19.931818181818183, "alnum_prop": 0.6180159635119726, "repo_name": "luiscarlin/project-euler", "id": "f5e25977141ba4534723347aa3fb7ab3117c7b80", "siz...
from trac.util import create_file from trac.web.main import get_environments import tempfile import unittest import os.path class EnvironmentsTestCase(unittest.TestCase): dirs = ('mydir1', 'mydir2', '.hidden_dir') files = ('myfile1', 'myfile2', '.dot_file') def setUp(self): self.parent_dir = te...
{ "content_hash": "e53060c184a92e850a545ed03eb329b8", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 78, "avg_line_length": 34.605633802816904, "alnum_prop": 0.5991045991045991, "repo_name": "apache/bloodhound", "id": "a335b77996dd4d464d823048573ffa55579e80c3", "size": "29...
import re from pathlib import Path from .base import Media from .types import Types class Animes(Media): _rRule = re.compile(r'\[.+\] ([\w\.\-\ ]+?)(?: S(\d))? - (\d{2,})') def __init__(self, path: Path) -> None: super().__init__(Types.ANIMES, path) @classmethod def match(cls, filename: str...
{ "content_hash": "3e6d8f761ccb901d77111a5ea87f2df8", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 71, "avg_line_length": 24.583333333333332, "alnum_prop": 0.5412429378531074, "repo_name": "caedus75/Renamer", "id": "2fe00a1e64976a53a132c34e5131cdeb70d8a3e6", "size": "108...
"""Test for the tit for tat strategies.""" import axelrod from .test_player import TestPlayer from .test_player import TestHeadsUp C, D = axelrod.Actions.C, axelrod.Actions.D class TestTitForTat(TestPlayer): """ Note that this test is referred to in the documentation as an example on writing tests. If ...
{ "content_hash": "6700c09ce0bd74a287ed5fc8bdc9ea6f", "timestamp": "", "source": "github", "line_count": 263, "max_line_length": 91, "avg_line_length": 29.897338403041825, "alnum_prop": 0.5712832252320997, "repo_name": "mojones/Axelrod", "id": "ad0f66fd7aeeff8f3b466ad48baca352f874567d", "size": "786...
""" The module's functions operate on message bodies trying to extract original messages (without quoted messages) from html """ import regex as re import html2text from lxml import html, etree from copy import deepcopy RE_FWD = re.compile("(([-]+[ ]*Forwarded message[ ]*[-]+)|(Begin forwarded message:))", re.I | re...
{ "content_hash": "34b0aad773c32e9da2410088862ebe50", "timestamp": "", "source": "github", "line_count": 211, "max_line_length": 113, "avg_line_length": 36.644549763033176, "alnum_prop": 0.5955768235902742, "repo_name": "mgontav/talon", "id": "1b927ff81aa91f447d2a6a9cadda427a1385ff3f", "size": "7732...
from django.test import TestCase from django.contrib.auth.models import User FIXTURES = ["test_data"] class BaseTest(TestCase): fixtures = FIXTURES def setUp(self): for user in User.objects.all(): user.set_password(user.password) user.save() # from : # http://s...
{ "content_hash": "0910af281825da6dd45f9de392cc0da7", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 82, "avg_line_length": 27.5, "alnum_prop": 0.6571428571428571, "repo_name": "echodelt/django-auth-skel-project", "id": "653bddfb3a12cbddf9694f33ba128e31c65142eb", "size": "...
def test_metrics(client): resp = client.get("/metrics") assert 200 == resp.status_code assert b"auth_server_error_total" in resp.data
{ "content_hash": "8295a74258ac73badb239029cec8dac9", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 50, "avg_line_length": 29.4, "alnum_prop": 0.6802721088435374, "repo_name": "adamcik/oauthclientbridge", "id": "2996be6933bd3660ded8fd508cf822546fcac39f", "size": "147", "...
"""Tests suite for MaskedArray & subclassing. :author: Pierre Gerard-Marchant :contact: pierregm_at_uga_dot_edu :version: $Id: test_subclassing.py 3473 2007-10-29 15:18:13Z jarrod.millman $ """ __author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)" __version__ = '1.0' __revision__ = "$Revision: 3473 $" _...
{ "content_hash": "13e7964228ea08d7899f241dda43e15d", "timestamp": "", "source": "github", "line_count": 154, "max_line_length": 80, "avg_line_length": 35.214285714285715, "alnum_prop": 0.5935828877005348, "repo_name": "qpython-android/QPypi-numpy", "id": "5943ad6c1daab51c88fa1c14c5089b9299c4a9ee", ...
from flask_restful.fields import Raw, MarshallingException class Dict(Raw): def __init__(self, cls_or_instance, **kwargs): super(Dict, self).__init__(**kwargs) error_msg = ("The type of the dict elements must be a subclass of " "flask_restful.fields.Raw") if isinstanc...
{ "content_hash": "35ff195f8ac2aebfa35955c6c6ebce9d", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 75, "avg_line_length": 34.5, "alnum_prop": 0.5833333333333334, "repo_name": "hackerspace-silesia/cebulany-manager", "id": "2e5cc5cbdbcb44000f3e17e465510701e25a6b4f", "size"...
from __future__ import unicode_literals from django.apps import AppConfig class AgentesConfig(AppConfig): name = 'agentes'
{ "content_hash": "bc9146d2c54641d9d48031f4f8eb2290", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 39, "avg_line_length": 18.571428571428573, "alnum_prop": 0.7538461538461538, "repo_name": "fcopantoja/sips", "id": "787fd321fcbada74d5c662ae0f3e457de661cd38", "size": "130",...
import base64 import tensorflow_data_validation as tfdv from IPython.display import display from IPython.display import HTML from tensorflow_metadata.proto.v0 import statistics_pb2 from typing import Text # The following variables are provided through dependency injection. These # variables come from the specified inp...
{ "content_hash": "868079707d2bcaab31f06c008587cd11", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 306, "avg_line_length": 40.34615384615385, "alnum_prop": 0.7235462345090562, "repo_name": "kubeflow/kfp-tekton-backend", "id": "ac3e303b60de1af4c3c2428444d3b2119cd79d5c", "...
from collections import defaultdict import math from recommends.similarities import sim_distance from recommends.converters import convert_vote_list_to_userprefs, convert_vote_list_to_itemprefs from .base import BaseAlgorithm class NaiveAlgorithm(BaseAlgorithm): """ """ similarity = sim_distance def ...
{ "content_hash": "984909cbf9a4fffd85012247399d958c", "timestamp": "", "source": "github", "line_count": 83, "max_line_length": 114, "avg_line_length": 37.68674698795181, "alnum_prop": 0.5664961636828645, "repo_name": "python-recsys/django-recommends", "id": "63a0ade22c9418483f951a7aa6624170f24cd19b",...
def request_method_decorator(f): """Wraps methods returned from a resource to capture HttpRequests. When a method which returns HttpRequests is called, it will pass the method and arguments off to the transport to be executed. This wrapping allows the transport to skim arguments off the top of the...
{ "content_hash": "16db53c43ec3376e5469c55f174a9471", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 74, "avg_line_length": 42.96551724137931, "alnum_prop": 0.637239165329053, "repo_name": "brettdh/rbtools", "id": "48a14da52e564072ccbe50c1e7a843e2b534b024", "size": "1246",...
import nc import iso_modal import math ################################################################################ class Creator(iso_modal.Creator): def __init__(self): iso_modal.Creator.__init__(self) self.output_tool_definitions = False #########################################...
{ "content_hash": "bcae1043ad1af32cc14b041661954133", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 80, "avg_line_length": 27.428571428571427, "alnum_prop": 0.3619791666666667, "repo_name": "JohnyEngine/CNC", "id": "c6b86a471a34605fdf31730a2b849ab29f5dee34", "size": "625"...
import json import random import time import unittest from collections import defaultdict from operator import itemgetter import gevent from unittest import mock import requests from gevent import sleep from gevent.pool import Group from gevent.queue import Queue import locust from locust import ( LoadTestShape, ...
{ "content_hash": "ebdf71a4418a04464adfc6ba0c93f556", "timestamp": "", "source": "github", "line_count": 3806, "max_line_length": 167, "avg_line_length": 37.48003152916448, "alnum_prop": 0.5385877223114077, "repo_name": "mbeacom/locust", "id": "204726c86f311efc700ebfe6e6b323d72272fdbe", "size": "142...
import xml.etree.ElementTree as ET import requests from requests.exceptions import ConnectionError from xml.dom import minidom from . import get_resources_dir, get_user_dir import os from glob import glob from tqdm import tqdm import logging CHUNK_SIZE = 1 * 1024 * 1024 # 5 MB backend_name = "GMQL-PythonAPI" BACKEND_...
{ "content_hash": "e742b7f5df6649a9bf8c17a493818dfb", "timestamp": "", "source": "github", "line_count": 248, "max_line_length": 131, "avg_line_length": 43.04435483870968, "alnum_prop": 0.5613114754098361, "repo_name": "DEIB-GECO/PyGMQL", "id": "66614daa84459e58ad021a1033a567366eb452af", "size": "10...
from test_support import verify, vereq, verbose, TestFailed from types import ModuleType as module # An uninitialized module has no __dict__ or __name__, and __doc__ is None foo = module.__new__(module) verify(foo.__dict__ is None) try: s = foo.__name__ except AttributeError: pass else: raise TestFailed, "...
{ "content_hash": "9f6e47d466e73493d58fd849bb743eb5", "timestamp": "", "source": "github", "line_count": 75, "max_line_length": 74, "avg_line_length": 23.786666666666665, "alnum_prop": 0.6104260089686099, "repo_name": "mariaantoanelam/Licenta", "id": "8a86ffb542a7d2594544d5e5a3d82bd4a51fdb6b", "size...
from functools import partial from Util.constant import KickForce from Util.role import Role from ai.STA.Strategy.strategy import Strategy from ai.STA.Tactic.go_kick import GoKick from ai.STA.Tactic.goalkeeper import GoalKeeper from ai.STA.Tactic.stop import Stop from ai.STA.Tactic.tactic_constants import Flags # ...
{ "content_hash": "9cc58498f03e446bac59a71aca9cf022", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 119, "avg_line_length": 41.23529411764706, "alnum_prop": 0.6153114598193058, "repo_name": "RoboCupULaval/StrategyIA", "id": "3cb7eac907a999e932c54f37a27c866f5965d537", "siz...
""" Copyright 2013 Steven Diamond Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
{ "content_hash": "85f3834a9ebb887b646b3dca1b86ae54", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 77, "avg_line_length": 41.26086956521739, "alnum_prop": 0.8124341412012644, "repo_name": "merraksh/cvxpy", "id": "7fb86b5170565991c5b1b6a46caf06502408c6a1", "size": "949", ...
import functools import hashlib import logging import os import subprocess import requests from toolbox.config import CRP_DEPLOY_HOOK, CRP_DEPLOY_TOKEN, DOWNLOADABLE_FILES_BUCKET, REPO_OWNER from .utils import fatal_error, run_cmd def _hash_directory(path): digest = hashlib.sha1() for root, _, files in os....
{ "content_hash": "a038a2cd581b49d02eb5c954ffe38b87", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 115, "avg_line_length": 37.83168316831683, "alnum_prop": 0.6241821512693012, "repo_name": "avatao-content/challenge-toolbox", "id": "a0c71b5cc1ca728700f010006c0479e2336c75bc...
import numpy as np import operator import matplotlib import matplotlib.pyplot as plt from dircache import listdir def createDataSet(): """ create test case """ group = np.array([[1.0, 1.1], [1.0, 1.0], [0, 0], [0, 0.1]]) labels = ['A', 'B', 'A', 'B'] return group, labels def classify0(inX, d...
{ "content_hash": "389756b0015a09472d31a1f5cb86ddc7", "timestamp": "", "source": "github", "line_count": 168, "max_line_length": 111, "avg_line_length": 31.68452380952381, "alnum_prop": 0.6210783392823596, "repo_name": "qiyuangong/Machine_Learning_in_Action_QYG", "id": "38d4827d6dbd11097fa1e19f52b5613...
from django.conf.urls import patterns, url urlpatterns = patterns('mysite.apps.base.views', (r'^/?$', 'homepage'), )
{ "content_hash": "d38fe50dabba756d6bf9f091bac04152", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 48, "avg_line_length": 28.4, "alnum_prop": 0.5774647887323944, "repo_name": "trueship/oauth2app", "id": "48ac82400ccd41d0ac031c5f21899d35380d5685", "size": "165", "binary"...
from collections import defaultdict import logging from multiprocessing import Manager, Lock, Process, Queue import signal import time class Machine(object): """ Implements a state machine The life cycle of a machine can be described as follows:: 1. A machine instance is created and configured:: ...
{ "content_hash": "a3cf959aa84f2a8e0e62933754f90709", "timestamp": "", "source": "github", "line_count": 749, "max_line_length": 79, "avg_line_length": 29.85580774365821, "alnum_prop": 0.547893748323048, "repo_name": "bernard357/shellbot", "id": "65a3d7a222ef2d79df2069838f446fb130682932", "size": "2...
COMMAND = "0" SYSTEM = "1" PEER = "2" CLIENT = "4" # Command based messages. COMMAND_SHUT_DOWN_REQUEST = "001" COMMAND_SET_MASTER_REQUEST = "002" COMMAND_REMOTE_CONNECT_REQUEST = "010" COMMAND_REMOTE_DISCONNECT_REQUEST = "011" COMMAND_REMOTE_CONNECT_PIKA_REQUEST = "012" COMMAND_REMOTE_DISCONNECT_PIKA_REQUEST = "013" C...
{ "content_hash": "6f75ac258802cf5a9153203b9730b7e2", "timestamp": "", "source": "github", "line_count": 95, "max_line_length": 53, "avg_line_length": 34.63157894736842, "alnum_prop": 0.743161094224924, "repo_name": "appfirst/distributed_queue_manager", "id": "c375b48ce27eb5d70b6552db66de199d2174097a"...
from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpR...
{ "content_hash": "5f885c6925193b3f83e665f55dbe2486", "timestamp": "", "source": "github", "line_count": 108, "max_line_length": 133, "avg_line_length": 43.342592592592595, "alnum_prop": 0.651997436445204, "repo_name": "Azure/azure-sdk-for-python", "id": "01d14b89253e663ccb080839eaad1faf48152add", "...
"""SCons.Platform.os2 Platform-specific initialization for OS/2 systems. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, ...
{ "content_hash": "d6eb8a578a5f6fb4e56ab8c0659bdfae", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 107, "avg_line_length": 38.91379310344828, "alnum_prop": 0.689853788214444, "repo_name": "angad/libjingle-mac", "id": "0576abdd65a45161009dbbfa755e5226734bee3c", "size": "2...
import re from PIL import Image, ImageOps import urllib2 import oembed from recaptcha.client import captcha from akismet import Akismet import pifilter import logging import time import uuid from time import gmtime, strftime import random from datetime import datetime import urllib import simplejson as json from math i...
{ "content_hash": "bb5744660511a1ec5525bc5f8cf2dc40", "timestamp": "", "source": "github", "line_count": 471, "max_line_length": 180, "avg_line_length": 43.81528662420382, "alnum_prop": 0.5662644764258371, "repo_name": "mikemaccana/imeveryone", "id": "ca4d64adedd9157d01e58d2d7199452483a84e88", "size...
data_dir = '/home/cn/data/sample_tick/' import os import shutil # higher level file operations - more choices for error handling os.path.join('usr', 'bin', 'spam') # join path cur_dir = os.getcwd() # current working dir os.chdir('/tmp'); os.getcwd() # move around os.chdir('/home/cn/program/python/sandbox'); os.ge...
{ "content_hash": "21eacadcca1fcddf83ec9408a1961a73", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 115, "avg_line_length": 39.985074626865675, "alnum_prop": 0.6655468458379993, "repo_name": "nguyentu1602/pyexp", "id": "79ca99ec9c38c330f283c775275d974d28ec8439", "size": "...
import numpy as np import scipy import h5py from pprint import pprint import os import util from util import pad_axis_toN_with_constant import scipy.io as sio def get_mask_value(config): if config['transform_x']=='mag': return -1. elif config['transform_y']=='logmag': return -1. else: ...
{ "content_hash": "b19067d0154a56114687498d1e352e5b", "timestamp": "", "source": "github", "line_count": 435, "max_line_length": 265, "avg_line_length": 45.08505747126437, "alnum_prop": 0.5782684070976953, "repo_name": "stwisdom/dr-nmf", "id": "5c519714862082235aafd7f4d131e6ffeeb68e6f", "size": "196...
"""Unit tests for artifact conversion to and from Tensorflow SavedModel v2.""" import base64 import glob import json import os import shutil import tempfile import unittest import numpy as np import tensorflow.compat.v2 as tf from tensorflow_decision_forests.keras import GradientBoostedTreesModel from tensorflow.pyth...
{ "content_hash": "ad6e0070de230a025391e979ad256801", "timestamp": "", "source": "github", "line_count": 1283, "max_line_length": 103, "avg_line_length": 38.34294621979735, "alnum_prop": 0.6386144651786804, "repo_name": "tensorflow/tfjs", "id": "ab96e9ac893abb7453b7c7a191a3efaa98d9eb65", "size": "49...
import pytest import numpy as np import sklearn.datasets as datasets import sklearn.manifold as manifold import pandas_ml as pdml import pandas_ml.util.testing as tm class TestManifold(tm.TestCase): def test_objectmapper(self): df = pdml.ModelFrame([]) self.assertIs(df.manifold.Lo...
{ "content_hash": "a2393c9b77287abb6531dbcdf9cbf873", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 89, "avg_line_length": 36.94059405940594, "alnum_prop": 0.6330742428303404, "repo_name": "pandas-ml/pandas-ml", "id": "e846dac0a8b09051532a0ef1c07d4fabe836305e", "size": "...
from django.db import models class Praise(models.Model): to = models.CharField(max_length=500, blank=False, null=False) by = models.CharField(max_length=500, blank=False, null=False) description = models.TextField(blank=False, null=False) number_of_hearts = models.IntegerField(default=0) created =...
{ "content_hash": "70968a587f0940ef002b2a2e6211d15d", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 66, "avg_line_length": 40.111111111111114, "alnum_prop": 0.739612188365651, "repo_name": "prontotools/pronto-praise", "id": "1147e8f7259fe8e1e672168c9d4e9c65fb98c757", "size...
""" Test functions for the sparse.linalg._eigen.lobpcg module """ import itertools import platform import sys import numpy as np from numpy.testing import (assert_almost_equal, assert_equal, assert_allclose, assert_array_less, suppress_warnings) import pytest fro...
{ "content_hash": "b78e395691d4521bc7f9c819f61ac35d", "timestamp": "", "source": "github", "line_count": 441, "max_line_length": 82, "avg_line_length": 34.3469387755102, "alnum_prop": 0.5941110450914372, "repo_name": "zerothi/scipy", "id": "bc513803aab1ff7e2bb2067246fa828723fb946c", "size": "15147",...
""" stratus // db.py Author: Alex Kalicki (https://github.com/akalicki) """ import pymongo import dbox, navigate client = pymongo.MongoClient() db = client.stratus def directory_exists(parent, name): """Returns whether the given directory already exists""" return db.dirs.find({'parent': parent, 'name...
{ "content_hash": "a2b5fbccf1cc1fcdc4e9009ef73d1651", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 77, "avg_line_length": 39.04950495049505, "alnum_prop": 0.6222109533468559, "repo_name": "akalicki/stratus", "id": "ae79e0d1d6d2b1116cfb739d4ba00e568ed81142", "size": "394...
import xbmc, xbmcaddon, xbmcgui, xbmcplugin, os, sys, xbmcvfs, glob import shutil import urllib2,urllib import re import uservar import time try: from sqlite3 import dbapi2 as database except: from pysqlite2 import dbapi2 as database from datetime import date, datetime, timedelta from resources.libs import wizard as...
{ "content_hash": "b4c9468976f8d59709669a811f9366fe", "timestamp": "", "source": "github", "line_count": 229, "max_line_length": 425, "avg_line_length": 42.633187772925766, "alnum_prop": 0.6163064631773021, "repo_name": "TheWardoctor/Wardoctors-repo", "id": "f90fc3e4d9ef664003787d906ded52249d0fa966", ...
import logging from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import forms from horizon import messages from openstack_dashboard import api from openstack_dashboard.dashboards.project.networks.ports \ import forms a...
{ "content_hash": "6c153ba216fba589a428b96af5e99407", "timestamp": "", "source": "github", "line_count": 103, "max_line_length": 78, "avg_line_length": 45.883495145631066, "alnum_prop": 0.5135421074904782, "repo_name": "jumpstarter-io/horizon", "id": "cc2755e7847ff8a0d63902c1fa4cc9e30e06e770", "size...
from __future__ import absolute_import import warnings """M2Crypto support for Python's httplib. Copyright (c) 1999-2004 Ng Pheng Siong. All rights reserved.""" import base64 import socket from M2Crypto import SSL, py27plus, six from M2Crypto.six.moves.urllib_parse import urlsplit, urlunsplit from M2Crypto.six.mov...
{ "content_hash": "83a1a57f56e3c77b1d2c592311f6f2f9", "timestamp": "", "source": "github", "line_count": 269, "max_line_length": 103, "avg_line_length": 38.25278810408922, "alnum_prop": 0.5724003887269193, "repo_name": "Edzvu/Edzvu.github.io", "id": "f62486569d3a1c39763997474a709183b2c61626", "size"...
import sys # pylint: skip-file if sys.version_info[0] == 2: import ipaddr as ipaddress # pylint:disable=F0401 ipaddress.ip_address = ipaddress.IPAddress int_from_byte = ord FileNotFoundError = IOError def int_from_bytes(b): if b: return int(b.encode("hex"), 16) retu...
{ "content_hash": "39dec10c71bb95af6b0c199eaa8ded86", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 55, "avg_line_length": 20.571428571428573, "alnum_prop": 0.6354166666666666, "repo_name": "kustomzone/Fuzium", "id": "14c988324e6f470dd360490106b2118403b958b3", "size": "57...
""" [2016-06-27] Challenge #273 [Easy] Getting a degree https://www.reddit.com/r/dailyprogrammer/comments/4q35ip/20160627_challenge_273_easy_getting_a_degree/ # Description Welcome to DailyProgrammer University. Today you will be earning a degree in converting degrees. This includes Fahrenheit, Celsius, Kelvin, Degre...
{ "content_hash": "f2c1c28c84b3b473edd7706baeeb3772", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 102, "avg_line_length": 28.216666666666665, "alnum_prop": 0.7389249852333136, "repo_name": "DayGitH/Python-Challenges", "id": "e527188b94a1a883d96180e8bbdd87074b648641", "s...
""" slick.py is a library for talking to slick (http://code.google.com/p/slickqa). Copyright 2013 AccessData Group, LLC. 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....
{ "content_hash": "059384ebed91a68cccba53ce2680093e", "timestamp": "", "source": "github", "line_count": 444, "max_line_length": 164, "avg_line_length": 41.164414414414416, "alnum_prop": 0.6107676314493626, "repo_name": "slickqa/python-client", "id": "1b81f515cfabd825e1dd374e4d5e2aa7c11f0421", "size...
import wikipedia as wiki import json MAX_CATEGORY_DEPTH = 3 def is_algorithm_page(page): category_match = False for category in page.categories: if 'Algorithm' in category or 'algorithm' in category: category_match = True # summary_match = ('algorithm' in page.summary # or 'Al...
{ "content_hash": "e0981d0703273e3ecad49e456b91742e", "timestamp": "", "source": "github", "line_count": 107, "max_line_length": 72, "avg_line_length": 31.074766355140188, "alnum_prop": 0.5750375939849625, "repo_name": "xkxx/algodb", "id": "3aae3f9831c28e7015120917441b62109730cf07", "size": "3352", ...