text
stringlengths
4
1.02M
meta
dict
from django.forms import ModelForm, PasswordInput, TextInput, EmailInput, DateInput, Select, NumberInput, Textarea, SelectDateWidget, ValidationError, CharField from django.conf import settings from django.contrib.auth.models import User import datetime from .models import Userprofile class UserForm(ModelForm): ...
{ "content_hash": "f8cde137d4bf4ddfa918836e55361880", "timestamp": "", "source": "github", "line_count": 94, "max_line_length": 163, "avg_line_length": 35.819148936170215, "alnum_prop": 0.5521235521235521, "repo_name": "TalatCikikci/Fall2016Swe573_HealthTracker", "id": "5f4db899df97c0e09b1ec607731e7b8...
from ..config import Config from kao_command.args import Arg class SetDir: """ Command to set the current editor """ description = "Set the path to the devlog parent directory" args = [Arg('path', action='store', help="The Path to the directory where logs will be stored")] def run(self, *,...
{ "content_hash": "ca0725f60238b39fa52dc01e37e5c445", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 100, "avg_line_length": 36.18181818181818, "alnum_prop": 0.6381909547738693, "repo_name": "cloew/DevLog", "id": "059fd7dc5d5fe51d5bacfe04c0ea27b419a3ad0f", "size": "398", ...
print("*************************************\n Machine Learning In Action - Code\n") print(" Part : 1 - Classification") print(" Chapter : 2.3 - Example: a Handwriting Recognition System") print(" Index : 4\n") print(" Page : 28\n") print(" By : Troy Lewis\n************************************...
{ "content_hash": "e3e1a798efaeda2a0f859b14ec780f46", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 92, "avg_line_length": 39.77777777777778, "alnum_prop": 0.5251396648044693, "repo_name": "metesa/MachineLearningInAction-Code", "id": "efd99be21d75152389b81d7198c4559890006fb...
from abc import abstractmethod class ADBService: @abstractmethod def save_user(self, user): pass @abstractmethod def update_user(self, user): pass @abstractmethod def delete_user(self, user): pass @abstractmethod def find_user(self, **kwargs): pass ...
{ "content_hash": "2dee4c001de164546ea4a2e0cbdedf9c", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 34, "avg_line_length": 16.178571428571427, "alnum_prop": 0.6048565121412803, "repo_name": "HSEFamily/komorebi-service", "id": "d1a9e156e66348d8e139865ee280a6446b25f471", "s...
import sys import os import shutil import re import argparse import mimetypes def checkFiles(picList): mimetypes.init() mimetypes.add_type('image/x-nikon-nef', '.NEF') i = 0 while i < len(picList): pic = picList[i] mt = mimetypes.guess_type(pic)[0] if mt == None: pi...
{ "content_hash": "db500d559defd0bc7899eac619ec123e", "timestamp": "", "source": "github", "line_count": 124, "max_line_length": 76, "avg_line_length": 30.862903225806452, "alnum_prop": 0.5079696890514763, "repo_name": "ndhuang/python-lib", "id": "aa28e5dd346e6d73701d2e6ae2fdcbbb1c99ca56", "size": "...
import time # sleep import sys # exit import argparse # argparse __author__ = 'Jack B. Du' __copyright__ = 'Copyright (c) 2017, Jack B. Du' __license__ = 'MIT' __email__ = '[email protected]' # parsing arguments parser = argparse.ArgumentParser() parser.add_argument('filename', metavar='filename', type=str, he...
{ "content_hash": "6f7bd81bb99f7a1f0f1a5861f21776c5", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 97, "avg_line_length": 30.55952380952381, "alnum_prop": 0.6330346708219712, "repo_name": "JackBDu/mandarinizer", "id": "9f9d7c35128b54e4e189c6e070768488e78b4dfe", "size": "...
import signal import time import sys import subprocess import json import ibmiotf.device # device credentials to connect to watson tf_watson_org = 'abcdef' tf_watson_device_type = 'tf-pi' tf_watson_device_id = 'tf-pi-1' tf_watson_auth_token = 'ABCDEFGHIJKLMNOPQR' def wifi_scan(): proc = subprocess.Pope...
{ "content_hash": "a39b45c5cf94227e532d0e59d4e0fa67", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 111, "avg_line_length": 23.09090909090909, "alnum_prop": 0.5866141732283464, "repo_name": "truepositiontruefix/truefix-watson", "id": "8f3b9b14179a6787a73b452a159b638ade91811...
from multiprocessing import Pool import os,time,random def long_time_task(name): print 'Run task %s (%s)...' %(name,os.getpid()) start=time.time() time.sleep(random.random()*3) end=time.time() print 'Task %s runs %0.2f seconds.' %(name,end-start) if __name__=='__main__': print 'Parent process %s.' %os.getpid()...
{ "content_hash": "93922e3c64178639e323241f2f2c724f", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 54, "avg_line_length": 22.525, "alnum_prop": 0.6470588235294118, "repo_name": "zengboming/python", "id": "285784ca2a0b1554efea86f8f1a24e7debdd85fb", "size": "909", "binar...
from django.conf import settings from django.core.mail import EmailMultiAlternatives, EmailMessage from django.template import TemplateDoesNotExist from django.template.loader import render_to_string from app import utils FROM_EMAIL = settings.HACKATHON_NAME + ' Team <' + settings.HACKATHON_CONTACT_EMAIL + '>' def ...
{ "content_hash": "6a59d26055b7666c14771ec17c79d40c", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 89, "avg_line_length": 39.39655172413793, "alnum_prop": 0.5759299781181619, "repo_name": "hackupc/backend", "id": "d3b989c54d02b36160d63ae4162b12055047d5b0", "size": "2285"...
import socket import struct from Trafficker.layer.layer import layer class IEEE802dot3(layer): # 802.3 # Todo etypes = { 'STP': 0x4242 }
{ "content_hash": "f7622ab615192b56408871bf32f0a9de", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 40, "avg_line_length": 12.692307692307692, "alnum_prop": 0.6242424242424243, "repo_name": "LyleMi/Trafficker", "id": "f3c789cc25a62131616687897987fe84e3368f79", "size": "16...
try: import dbm.ndbm except ImportError: import dbm as dbm import logging # Project imports from classified import checksum class Incremental(object): default_algorithm = 'sha1' default_blocksize = 16384 def __init__(self, config): self.config = config # Local cache self...
{ "content_hash": "be5ba7f038c27921a190fa9ff6d751ea", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 75, "avg_line_length": 29.095238095238095, "alnum_prop": 0.574468085106383, "repo_name": "tehmaze/classified", "id": "a0f69356f54aadea15755bcb821cfca7c3ebc305", "size": "18...
from api.models.modelrun import ModelRun from api.models.kubepod import KubePod from api.models.kubemetric import KubeMetric __all__ = ["KubePod", "KubeMetric", "ModelRun"]
{ "content_hash": "62c49a57c751d2dc254088b9eb379074", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 47, "avg_line_length": 34.8, "alnum_prop": 0.7758620689655172, "repo_name": "mlbench/mlbench", "id": "50ca51b23897a28f14c443c19fb71a06d6dc6ed2", "size": "175", "binary": f...
import re import string from collections import namedtuple, Counter from operator import itemgetter from common import BaseInputParser, DataClass class InputParser(BaseInputParser): @property def rooms(self): for line in self.lines: raw_split = re.split("(\[.+\])", line.strip()) ...
{ "content_hash": "48aa54018f9baf1acde37a43beca8684", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 110, "avg_line_length": 28.949367088607595, "alnum_prop": 0.6090948841276782, "repo_name": "zunin/Advent-of-Code-2016", "id": "703ae800104ef69330d048a725fc3fe11e0fc2c7", "s...
""" Kubernetes No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: v1.6.1 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import os import sys import unittest im...
{ "content_hash": "2e723c225f3bdc5017167fc15afa02ae", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 105, "avg_line_length": 22.9, "alnum_prop": 0.7139737991266376, "repo_name": "skuda/client-python", "id": "51a107ff17ea0a5787148284d944ba5e80a740f0", "size": "933", "bina...
import os; import sys; import shutil; import re; """ https://snipplr.com/view/70884/convert-epub-to-pdf-in-linux-command-line Readme: # Requires * https://wkhtmltopdf.org/downloads.html """ class EpubConvertor: source_path = None; target_path = None; def __init__(self): self.source_path = ""; self.target_path...
{ "content_hash": "393a89d764e6b79b1cf36704c63498a0", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 143, "avg_line_length": 36.11764705882353, "alnum_prop": 0.6324647122692725, "repo_name": "agancsos/python", "id": "77bcd9c7f00a0dab075c3f1f2be1d6209af56fb0", "size": "1865...
""" Copyright 2015 Samuel Curley 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 ...
{ "content_hash": "b6778f4ce62d70826a85e2acb514cd5d", "timestamp": "", "source": "github", "line_count": 89, "max_line_length": 150, "avg_line_length": 43.853932584269664, "alnum_prop": 0.7022802972072765, "repo_name": "CurleySamuel/PyBase", "id": "5c396d828dfbd8a96f865a7107ff9e134c5e5f51", "size": ...
__author__ = 'Ge Yang' from instrumenttypes import *
{ "content_hash": "69205f6971e7aa6d38af463e85d663cc", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 29, "avg_line_length": 17.666666666666668, "alnum_prop": 0.6981132075471698, "repo_name": "episodeyang/instruments", "id": "61d94a1ded3bd6a2cb07b861e6e737b081d8e50c", "size"...
from marshmallow import Schema, fields, pre_dump from horse.web.schemas.movie import MovieSchema class UserSchema(Schema): pk = fields.Str(dump_only=True) name = fields.Str(required=True) followed_users = fields.Nested( 'self', only=('pk', 'name'), dump_only=True, many=True ) liked_movies...
{ "content_hash": "78323d84e58177d0ccd9bd08b104ea68", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 72, "avg_line_length": 27.11111111111111, "alnum_prop": 0.6885245901639344, "repo_name": "pragmaticcoders/horse", "id": "dec5a915030adfda34fa2ea24e0f6e88e28ea0d7", "size": ...
""" # @package coursera2012 # @author Rolf Hemmerling <[email protected]> # @version 1.00 # @date 2015-01-01 # @copyright Apache License, Version 2.0 # # Implementation of the game # "Asteroids" # for the Coursera course # "An Introduction to Interactive Programming in Python" # # M...
{ "content_hash": "9dd5e1bfb843d5e8272b41624224b0ab", "timestamp": "", "source": "github", "line_count": 617, "max_line_length": 139, "avg_line_length": 42.705024311183145, "alnum_prop": 0.5925082545827166, "repo_name": "hemmerling/python-coursera2012", "id": "883c08d659efa7d493a2aabf898d0eaddacdec3d"...
import os # Directory for tweet content. content_dir = 'content' # File containing simple tweet content. source_filename = 'simple.txt' # File for already-tweeted content. used_content_filename = 'used.txt' def new_tweet(): """ Returns a new tweet from the simple content source. """ filename = get_filepath...
{ "content_hash": "55aaf8062345ec0ca03eb574a5d02e2f", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 85, "avg_line_length": 31.02127659574468, "alnum_prop": 0.6556927297668038, "repo_name": "SheldonSandbekkhaug/water-bot", "id": "dda856400569cfcf28657b8ebcb075bd8ba54db3", ...
from datetime import datetime from django.conf import settings from django.test import TestCase from package.tests import data, initial_data from searchv2.utils import remove_prefix, clean_title class UtilFunctionTest(TestCase): def setUp(self): self.values = [] for value in ["-me",".me",...
{ "content_hash": "d1be90a66822ccf195d17ea02b65ce61", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 87, "avg_line_length": 31.653846153846153, "alnum_prop": 0.6330498177399757, "repo_name": "benracine/opencomparison", "id": "494e5f6149f601c18978ee533a2033ccb7e411d7", "siz...
import canvas_manager from canvas_manager import CanvasManager import os from PIL import Image, ImageTk from tag_editor_popup import TagEditorPopup from target_pickler import TargetPickler import Tkinter, tkFileDialog, tkMessageBox, ttk CURSOR = 0 IMAGE = 1 RECTANGLE = 2 OVAL = 3 TRIANGLE = 4 FREEFORM_POLYGON = 5 D_SI...
{ "content_hash": "acb16beb39150541bb35aba52028378b", "timestamp": "", "source": "github", "line_count": 633, "max_line_length": 113, "avg_line_length": 42.993680884676145, "alnum_prop": 0.5769979790556679, "repo_name": "phrack/ShootOFF-legacy", "id": "6d85462e3e19ccf05835535fb394d19a3f5b9576", "siz...
"""Util addons functions.""" import hashlib import re RE_SLUGIFY = re.compile(r'[^a-z0-9_]+') RE_SHA1 = re.compile(r"[a-f0-9]{8}") def get_hash_from_repository(name): """Generate a hash from repository.""" key = name.lower().encode() return hashlib.sha1(key).hexdigest()[:8] def extract_hash_from_path(p...
{ "content_hash": "d88bc144f44e8dd2c23f2b112c1c812b", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 49, "avg_line_length": 23.80952380952381, "alnum_prop": 0.642, "repo_name": "pvizeli/hassio", "id": "152c288668439ff9164d79d9ef0bde2175ab075a", "size": "500", "binary": f...
""" Plugin for reactions to specific messages based on combination of network, channel, and specific phrase, when all of them are matched using regular expressions. HexChat Python Interface: http://hexchat.readthedocs.io/en/latest/script_python.html IRC String Formatting: https://github.com/myano/jenni/wiki/IRC-String...
{ "content_hash": "d96a1708e7c607afdde645d3fb6f8d91", "timestamp": "", "source": "github", "line_count": 132, "max_line_length": 100, "avg_line_length": 36.18939393939394, "alnum_prop": 0.6424534226501989, "repo_name": "skontar/hexchat-plugins", "id": "6ad6ccbc13dc66fa23b68b7c65770892502d7370", "siz...
""" Test DualMap ------------ """ from jinja2 import Template import folium import folium.plugins from folium.utilities import normalize def test_dual_map(): m = folium.plugins.DualMap((0, 0)) folium.FeatureGroup(name="both").add_to(m) folium.FeatureGroup(name="left").add_to(m.m1) folium.FeatureGro...
{ "content_hash": "ee98d878611948063fa1553b0ba5e0bd", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 112, "avg_line_length": 24.294117647058822, "alnum_prop": 0.6174334140435835, "repo_name": "python-visualization/folium", "id": "bf15d66c80f67ac1b213301bd684ccc6b5c5adf4", ...
from decimal import * import getpass import math import os import os.path import platform import sys import time from jsonrpc import ServiceProxy, json BASE_FEE=Decimal("0.001") def check_json_precision(): """Make sure json library being used does not lose precision converting BTC values""" n = Decimal("20000...
{ "content_hash": "0086a96355186d4d1ebbd73b79a6937f", "timestamp": "", "source": "github", "line_count": 252, "max_line_length": 111, "avg_line_length": 38.392857142857146, "alnum_prop": 0.6155038759689923, "repo_name": "wayneclancy/creepercoin", "id": "3ec8c8d60e87f47c42f9f30c7aa75d603b366d0f", "si...
import json import os import stat import tarfile import zipfile from datetime import datetime, timedelta from django.conf import settings from django.core.files import temp from django.core.files.storage import default_storage as storage from django.test.utils import override_settings import mock import responses im...
{ "content_hash": "e6237279c126fbfa7765ab9c09e10ce1", "timestamp": "", "source": "github", "line_count": 2540, "max_line_length": 79, "avg_line_length": 43.27165354330709, "alnum_prop": 0.623792193612956, "repo_name": "wagnerand/olympia", "id": "5f5f7297646d037c731a85ce158463687d7d6acb", "size": "10...
""" This module reimplements Python's native threading module using Panda threading constructs. It's designed as a drop-in replacement for the threading module for code that works with Panda; it is necessary because in some compilation models, Panda's threading constructs are incompatible with the OS-provided threads ...
{ "content_hash": "1f0827627302e591544b63f5d4fac098", "timestamp": "", "source": "github", "line_count": 509, "max_line_length": 79, "avg_line_length": 28.204322200392927, "alnum_prop": 0.5668013374198941, "repo_name": "brakhane/panda3d", "id": "4c0ce1e8fbddd06b6b3064cb0044f99de6faaf9f", "size": "14...
import os import sys import pip import shutil import tempfile from cloudify.utils import setup_logger from cloudify.utils import LocalCommandRunner from cloudify_agent.api import utils from cloudify_agent.api import plugins from cloudify_agent.api.utils import get_pip_path from cloudify_agent.api import exceptions ...
{ "content_hash": "7f0947a2353d928298b86cef915f2b1f", "timestamp": "", "source": "github", "line_count": 208, "max_line_length": 79, "avg_line_length": 32.82211538461539, "alnum_prop": 0.5725794638933646, "repo_name": "geokala/cloudify-agent", "id": "9354e16eef4c141d89b634419d8c3139bc85814a", "size"...
""" Django settings for messageboard project. Generated by 'django-admin startproject' using Django 1.9.4. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import ...
{ "content_hash": "fd7257ef43e9d4ed17172d5d320cfae9", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 91, "avg_line_length": 26.237704918032787, "alnum_prop": 0.6891596376132458, "repo_name": "suomiy/message-board", "id": "b3a30b0162aa193e36b5a838a9a1985de61c55b4", "size":...
import ray import pytest from pyspark.sql.types import ArrayType, DoubleType from pyspark.sql import SparkSession @pytest.fixture(autouse=True, scope='package') def orca_context_fixture(): from zoo.orca import init_orca_context, stop_orca_context sc = init_orca_context(cores=8) def to_array_(v): ...
{ "content_hash": "0ffa471e96934f0e806c80ece24de038", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 70, "avg_line_length": 27.6, "alnum_prop": 0.6666666666666666, "repo_name": "intel-analytics/analytics-zoo", "id": "2e9c4d91e45d7b309ff96fc3b5446ecc72203870", "size": "1280...
import unittest import keymanagement import tempfile import os from uuid import UUID def createFakeKey(): f = tempfile.NamedTemporaryFile(delete=False) f.write("just a test") f.close return f def clearFakeKey(f): os.unlink(f.name) os.unlink(f.name+".yaml") class SimplisticTest(unittest.Test...
{ "content_hash": "cd068c89d40012b43ca3fe2a7f01df53", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 188, "avg_line_length": 27.032258064516128, "alnum_prop": 0.6575178997613366, "repo_name": "millaguie/Vernam", "id": "29cd5644b5478f37a720ff1c7fa2167932572cc8", "size": "16...
from __future__ import absolute_import import pytest from sentry.utils.urls import non_standard_url_join @pytest.mark.parametrize( "base,to_join,expected", [ ("http://example.com/foo", "bar", "http://example.com/bar"), ("http://example.com/foo", "/bar", "http://example.com/bar"), ("h...
{ "content_hash": "ecacf6d14548b571e08ebe0665d2c82e", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 81, "avg_line_length": 36.8, "alnum_prop": 0.6127717391304348, "repo_name": "beeftornado/sentry", "id": "f0e9e339794ef58cc84ce6c9604e9930193afc62", "size": "736", "binary...
#numerical operations #numbers 3 + 5 3 * 5 #float - any number with a "." is considered float by python 3.1 + 5.9
{ "content_hash": "f14d888186696bd31410fdbee89c7e26", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 60, "avg_line_length": 10.833333333333334, "alnum_prop": 0.6, "repo_name": "KT26/PythonCourse", "id": "5da9a005e00165a54f5c52c88fd50a30a01565a3", "size": "281", "binary":...
from __future__ import print_function, unicode_literals import re from collections import namedtuple class CqlSplitter(object): """ Makeshift CQL parser that can only split up multiple statements. C* does not accept multiple DDL queries as a single string, as it can with DML queries using batches. H...
{ "content_hash": "eda60bb2418964d010aa9e206685528c", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 78, "avg_line_length": 34.56521739130435, "alnum_prop": 0.5048218029350104, "repo_name": "Cobliteam/cassandra-migrate", "id": "12ae0d04629b2cef7372d38dd48a26ddbbb02fc2", "s...
import sys import argparse import numpy as np def cli(): parser = argparse.ArgumentParser() parser.add_argument('--xaxis', type=str, required=True, help='''specify the endpoint values of the sampling grid along the x-axis and the number of sampling points ...
{ "content_hash": "34de157cc67ce4eef8bfa36c997da3da", "timestamp": "", "source": "github", "line_count": 145, "max_line_length": 83, "avg_line_length": 45.703448275862065, "alnum_prop": 0.4801569337558473, "repo_name": "aaronprunty/starfish", "id": "4bbd496cea2995e8d9e22a026ecfd2bf99aefa0e", "size":...
from __future__ import print_function import os import boto3 import botocore import json import uuid import datetime DDB_TABLE = os.environ['DDB_TABLE'] TABLE_KEY = os.environ['TABLE_KEY'] def respondOK(res=None): return { 'statusCode': '200', 'body': json.dumps(res), 'headers': { ...
{ "content_hash": "583ccaf344a9d5b81f3df04327a95258", "timestamp": "", "source": "github", "line_count": 131, "max_line_length": 96, "avg_line_length": 27.12213740458015, "alnum_prop": 0.537573881227132, "repo_name": "rqlite/rqlite-disco", "id": "5a2512c266e4080a1f768ad52c080292f0c83249", "size": "3...
#!/usr/bin/env python ''' @date 2015-10-07 A script to convert glyphs of characters in *.po to u8glib supported font array and prepare for U8Gettext. It do these things : 1. Extract all characters from inputed po files 2. Find characters' glyphs from inputed font 3. Generate glyphs to u8glib font array to C/C++ sou...
{ "content_hash": "760852079b37e97d86df269ffdf09e5a", "timestamp": "", "source": "github", "line_count": 340, "max_line_length": 145, "avg_line_length": 30.773529411764706, "alnum_prop": 0.6251553091847463, "repo_name": "starofrainnight/u8gettext", "id": "8bee431e51c02d202fce547f90d5201deda1bbc3", "...
import os import sys sys.path.insert(0, os.path.abspath('..')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. # # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions...
{ "content_hash": "7679783f4a94f298af4dfbb5f10cdac9", "timestamp": "", "source": "github", "line_count": 326, "max_line_length": 80, "avg_line_length": 28.466257668711656, "alnum_prop": 0.688146551724138, "repo_name": "csparkresearch/ExpEYES17-Qt", "id": "79f15defa9e7bb23edd10e68e77d881f2a0fe562", "...
import os import tarfile from contextlib import closing from . import helpers def gzip_then_store(filename, archivename): with closing(tarfile.open(archivename, 'w:gz')) as tar: tar.add(filename) helpers.add_checksum(archivename) return archivename def Backup(cfg, rcfiles): backupfiles = [] ...
{ "content_hash": "853d4e450625f12c752dec4b3512b3e6", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 69, "avg_line_length": 33.63636363636363, "alnum_prop": 0.6837837837837838, "repo_name": "fudanchii/archie", "id": "0a0df6c5a2e715551cd154f591094904e0ef5de7", "size": "740"...
from __future__ import unicode_literals import logging import re from streamlink.exceptions import FatalPluginError, NoStreamsError, PluginError from streamlink.plugin import Plugin, PluginArguments, PluginArgument from streamlink.plugin.api import useragents, validate from streamlink.stream import HLSStream from str...
{ "content_hash": "419a1c1c4a29135047f8f5fdd34538b4", "timestamp": "", "source": "github", "line_count": 213, "max_line_length": 86, "avg_line_length": 34.93427230046948, "alnum_prop": 0.5284235989786319, "repo_name": "back-to/streamlink", "id": "c1f836851a998cb904c6714c19c67de4309216bb", "size": "7...
import threading import time def producer_thread(): global exit_event while(True): print 'Waiting for exit event..' exit_event.wait(10) def consumer_thread(): global exit_event while(True): print 'Waiting for exit event..' exit_event.wait(10) def main(): ...
{ "content_hash": "ccc6f8b1c5c27fa8c4e16b88980f77e0", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 40, "avg_line_length": 18.142857142857142, "alnum_prop": 0.5853018372703412, "repo_name": "devvenk/pypractice", "id": "737f12790e6d351b6f3279c02e440e494647ebe2", "size": "3...
""" sphinxcontrib.devhelp ~~~~~~~~~~~~~~~~~~~~~ Build HTML documentation and Devhelp_ support files. .. _Devhelp: https://wiki.gnome.org/Apps/Devhelp :copyright: Copyright 2007-2019 by the Sphinx team, see README. :license: BSD, see LICENSE for details. """ import gzip import re from os impo...
{ "content_hash": "566c60159f6e03898b8b0f0f9946815a", "timestamp": "", "source": "github", "line_count": 156, "max_line_length": 92, "avg_line_length": 32.63461538461539, "alnum_prop": 0.5704183853859752, "repo_name": "lmregus/Portfolio", "id": "6972378702b7e2b4259964a616870471ad5b67b1", "size": "50...
import importlib from .settings import singleton @singleton class LazyLoader: def __init__(self): self.__import_dict = {} @property def import_dict(self): return self.__import_dict @import_dict.setter def import_dict(self, key, value): self.__import_dict[key] = value def import_(self, name,...
{ "content_hash": "ed46b626f663ab60a4d10676fb24df54", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 71, "avg_line_length": 26.696969696969695, "alnum_prop": 0.6299659477866061, "repo_name": "captain-pool/GSOC", "id": "60a5cab4bd7ce53fafddbf4b7f870e2796164ea5", "size": "88...
class RuleFinalNewline(object): NAME = "Final Newline" @staticmethod def get_description(line_numbers): result = "Missing final newline in file" if len(line_numbers)>1: result+="s" return result @staticmethod def rule(path,lines): if len(lines) == 0...
{ "content_hash": "4b74f591ce1c4b980674ff3d3ccac0de", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 100, "avg_line_length": 29.764705882352942, "alnum_prop": 0.5592885375494071, "repo_name": "imallett/QualityCpp", "id": "3406278c5b9b4b3fac444939127d171fe05acdb0", "size": ...
def lint_command(tool_xml, lint_ctx): root = tool_xml.getroot() commands = root.findall("command") if len(commands) > 1: lint_ctx.error("More than one command tag found, behavior undefined.") return if len(commands) == 0: lint_ctx.error("No command tag found, must specify a comm...
{ "content_hash": "f0907ddf551f76de98466e19a46b5540", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 91, "avg_line_length": 35.407407407407405, "alnum_prop": 0.6338912133891214, "repo_name": "ssorgatem/pulsar", "id": "d22a482242ac262701da68b9fc3a0cc6886af732", "size": "958...
from datetime import datetime from instagram_utils import extract_shortcode, get_images_near_some_other_image_via_shortcode from os import environ, makedirs from os.path import join from shutil import copytree import argparse import json DEFAULT_TOKEN = environ['INSTAGRAM_TOKEN'] TOKENHELPMSG = "Default is %s" % DEFAU...
{ "content_hash": "ebcf5d8cd506af430f5ddf0c323537ce", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 142, "avg_line_length": 37.294117647058826, "alnum_prop": 0.6612776025236593, "repo_name": "dannguyen/seeing-is-beliebing", "id": "6898f555298b332408176f9ec2470e18d5fcbf28", ...
"""Tests for views for REST APIs for frontpage""" # pylint: disable=unused-argument import pytest from django.urls import reverse from rest_framework import status from channels.constants import POSTS_SORT_HOT, VALID_POST_SORT_TYPES from channels.views.test_utils import ( default_post_response_data, raise_erro...
{ "content_hash": "5e7b66d1709383da446c7f5497dfe658", "timestamp": "", "source": "github", "line_count": 120, "max_line_length": 99, "avg_line_length": 38.425, "alnum_prop": 0.6484493602255476, "repo_name": "mitodl/open-discussions", "id": "f1fae90c39a7a8fedcbd569167f3d24dcce57cfd", "size": "4611", ...
from abc import ABC, abstractmethod from typing import Dict, List, Optional, Union from great_expectations.rule_based_profiler.domain import SemanticDomainTypes class SemanticTypeFilter(ABC): @abstractmethod def parse_semantic_domain_type_argument( self, semantic_types: Optional[ ...
{ "content_hash": "1d24f85e151431880118f1f303d7076b", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 82, "avg_line_length": 28.40909090909091, "alnum_prop": 0.6864, "repo_name": "great-expectations/great_expectations", "id": "d54e79757d5bc783518dc8378ee310696147a9bf", "siz...
from django.utils.translation import ugettext_lazy as _ from horizon import exceptions from horizon import forms from horizon.utils import validators from horizon import workflows from openstack_dashboard import api from openstack_dashboard.dashboards.project.loadbalancers import utils AVAILABLE_PROTOCOLS = ('HTTP'...
{ "content_hash": "e2d5ec879137c9f03899034d42ab39c7", "timestamp": "", "source": "github", "line_count": 652, "max_line_length": 79, "avg_line_length": 39.605828220858896, "alnum_prop": 0.5554738024241955, "repo_name": "spandanb/horizon", "id": "90cfc88a4b41795594afac8d96867cbb02556c03", "size": "26...
""" Mako based Configuration Generator """ import logging import re from mako.exceptions import CompileException, SyntaxException from mako.template import Template logger = logging.getLogger("confgen") class TemplateSyntaxException(BaseException): """ This exception is raised if the rendering of the mako t...
{ "content_hash": "a2ce984db83621665aa69fcbc96c3225", "timestamp": "", "source": "github", "line_count": 130, "max_line_length": 105, "avg_line_length": 29.6, "alnum_prop": 0.5977130977130977, "repo_name": "tobymccann/flask-base", "id": "190c9721adcb9523d4ccd302ed8b5efcec5952e1", "size": "3848", "...
from flask import Flask from redis import Redis import os import socket app = Flask(__name__) redis = Redis(host=os.environ.get('REDIS_HOST', '127.0.0.1'), port=6379) @app.route('/') def hello(): redis.incr('hits') return 'Hello Container World! I have been seen %s times and my hostname is %s.\n' % (redis.ge...
{ "content_hash": "46074115da93247b1aac2c350b9ec5d2", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 129, "avg_line_length": 25.41176470588235, "alnum_prop": 0.6504629629629629, "repo_name": "xiaopeng163/docker-k8s-lab", "id": "23728cc953a1b8a9081f892fd625b2a2dcdbe402", "s...
from oslo_serialization import jsonutils as json from oslo_versionedobjects import fields class Json(fields.FieldType): def coerce(self, obj, attr, value): if isinstance(value, str): loaded = json.loads(value) return loaded return value def from_primitive(self, obj, at...
{ "content_hash": "60f2221dbf063086ce766f8a5567a3bd", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 48, "avg_line_length": 25.5, "alnum_prop": 0.6748366013071896, "repo_name": "openstack/heat", "id": "19680f6d96b54f09e3faf804b3fd2d13c028c54b", "size": "1185", "binary": ...
from telemetry.page.actions.all_page_actions import * from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module class Typical25Page(page_module.Page): def __init__(self, url, page_set): super(Typical25Page, self).__init__(url=url, page_set=page_set) self.user_age...
{ "content_hash": "57c0795873659b40d114d5999b8d47fc", "timestamp": "", "source": "github", "line_count": 72, "max_line_length": 97, "avg_line_length": 36.40277777777778, "alnum_prop": 0.6409767264402899, "repo_name": "chromium2014/src", "id": "adc55f1feaae870bf0be7d6156a87f3621addad0", "size": "2813...
from tempest_lib import decorators from tempest_lib import exceptions as lib_exc import testtools from tempest.api.compute.security_groups import base from tempest.common.utils import data_utils from tempest import config from tempest import test CONF = config.CONF class SecurityGroupsNegativeTestJSON(base.BaseSecu...
{ "content_hash": "9051903047d918d991509ca89db71c22", "timestamp": "", "source": "github", "line_count": 195, "max_line_length": 79, "avg_line_length": 46.88717948717949, "alnum_prop": 0.6367713004484304, "repo_name": "redhat-cip/tempest", "id": "d8cbe3d17da33b0555f7878d30a489a5f2034593", "size": "9...
"""Authentication module for using Google Compute service accounts.""" import json import urllib2 from boto.auth_handler import AuthHandler from boto.auth_handler import NotReadyToAuthenticate META_DATA_SERVER_BASE_URL=( 'http://169.254.169.254/computeMetadata/v1') SERVICE_ACCOUNT_SCOPES_URL=(META_DATA_SERVER_B...
{ "content_hash": "7fad65ae7fe3d496202bd9a554482889", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 77, "avg_line_length": 33.859154929577464, "alnum_prop": 0.699667221297837, "repo_name": "feoff3/compute-image-packages", "id": "aad5e7560366467885dd497674c2fcbdb3ddd7ce", ...
import os, sys, logging, json, boto3; sys.path.append(os.path.dirname(__file__)); from aws_helpers import aws_session, get_account; from botocore.config import Config logging.basicConfig(format="%(asctime)s %(levelname)s %(message)s", level="INFO"); if __name__ == "__main__": params = dict(); for i in range(0, len(s...
{ "content_hash": "8c39f0d503a900112c119aad9d6f8f5c", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 130, "avg_line_length": 56.43859649122807, "alnum_prop": 0.6011812247435498, "repo_name": "agancsos/python", "id": "ecd3ab0d301b49e9771a6804de66ea0948f9fd7c", "size": "3720...
import pytest import sys from web3.middleware import make_stalecheck_middleware from web3.middleware.stalecheck import ( _isfresh, StaleBlockchain, ) from web3.utils.datastructures import AttributeDict if sys.version_info >= (3, 3): from unittest.mock import Mock, patch pytestmark = pytest.mark.skipif(s...
{ "content_hash": "25dc824a5a566d82c268931e4e8258d6", "timestamp": "", "source": "github", "line_count": 116, "max_line_length": 99, "avg_line_length": 31.646551724137932, "alnum_prop": 0.6774720784527377, "repo_name": "pipermerriam/web3.py", "id": "55af4d8b565d5e3c7546661a7d46a0a6908cd4d2", "size":...
from __future__ import absolute_import, print_function, division import unittest import sys import numpy import scipy.linalg import theano from theano import gof, tensor, scalar from theano.tests import unittest_tools as utt class Solve(gof.Op): """ Find the solution to the linear equation Ax=b. A is ...
{ "content_hash": "92b3da8c5dded0108c8540d28964b541", "timestamp": "", "source": "github", "line_count": 75, "max_line_length": 79, "avg_line_length": 31.346666666666668, "alnum_prop": 0.6201616333475117, "repo_name": "JazzeYoung/VeryDeepAutoEncoder", "id": "d6eafa68b1e64fa82db91e0df49398a034be379b", ...
""" profiling.viewer ~~~~~~~~~~~~~~~~ A text user interface application which inspects statistics. To run it easily do: .. sourcecode:: console $ profiling view SOURCE :: viewer = StatisticsViewer() loop = viewer.loop() loop.run() """ from __future__ import abs...
{ "content_hash": "9f683c551e186a10e089b153565a5f3c", "timestamp": "", "source": "github", "line_count": 790, "max_line_length": 78, "avg_line_length": 28.99367088607595, "alnum_prop": 0.5408862693734993, "repo_name": "sublee/profiling", "id": "19f692e4f1a898d9e753bbf566c64a204f29c14c", "size": "229...
from typing import MutableMapping, MutableSequence from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore from google.cloud.batch_v1.types import job as gcb_job from google.cloud.batch_v1.types import task __protobuf__ = proto.module( package="google.cloud.batch.v1", manifest=...
{ "content_hash": "1d2293972809d10d5f6dece678408a59", "timestamp": "", "source": "github", "line_count": 347, "max_line_length": 89, "avg_line_length": 27.72622478386167, "alnum_prop": 0.582371894813429, "repo_name": "googleapis/python-batch", "id": "a31b3b8c3928cb35d0919270e187a5ee6c252734", "size"...
import os, sys import argparse import gzip try: import cPickle as pickle except: import pickle ##__________________________________________________________________|| parser = argparse.ArgumentParser() parser.add_argument('pickle', help = 'path to a pickle file') args = parser.parse_args() ##__________________...
{ "content_hash": "eba0f28d4cf5f4bc02bc123d5c2be8b3", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 70, "avg_line_length": 28.2972972972973, "alnum_prop": 0.42406876790830944, "repo_name": "alphatwirl/alphatwirl", "id": "3cfe5f91918dec7c8974c5d03da815210a9b4e4d", "size": ...
from core import * from differentiator import runSimulation # 1*101*101 gridblocks # radius 2,500 ft # Firstly, we can specify the dimension of the cartesian grid nz, ny, nx = 1, 151, 151 dims = (nz, ny, nx) g = Grid(dims) # Then, we can specify the whole reservoir dimension Lz, Ly, Lx = 75, 2500, 2500 resDimension ...
{ "content_hash": "9b2ea96d57f312129fafc3023e385126", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 77, "avg_line_length": 24.867924528301888, "alnum_prop": 0.716236722306525, "repo_name": "benjdewantara/fdressim", "id": "b5fde3e63bfb9943c69e5c2183b7ead739acd687", "size":...
import weakref class weakattr(object): """ weakattr - a weakly-referenced attribute. When the attribute is no longer referenced, it 'disappears' from the instance. Great for cyclic references. """ __slots__ = ["dict", "errmsg"] def __init__(self, name = None): self.dict = weakre...
{ "content_hash": "c959b132a0884bc641aa53cbf33b680a", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 79, "avg_line_length": 23.727272727272727, "alnum_prop": 0.518007662835249, "repo_name": "ActiveState/code", "id": "8b5ec7d8da822e962951ec4d2f8afa13e601b09b", "size": "1305...
from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, BooleanField, SubmitField from wtforms.validators import Required, Length, Email, Regexp, EqualTo from wtforms import ValidationError from ..models import User class LoginForm(FlaskForm): email = StringField('Email', validators=[Requi...
{ "content_hash": "b1979bf9d699ccc796acd186db1e68a0", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 120, "avg_line_length": 51.266666666666666, "alnum_prop": 0.6306892067620286, "repo_name": "bluedai180/PythonExercise", "id": "e6af37d02cd15e59d23350f9aabb7981588f16e1", "s...
import os import re import codecs from setuptools import setup directory_name = os.path.dirname(__file__) with codecs.open(os.path.join(directory_name, 'pytest_testbook', '__init__.py'), encoding='utf-8') as fd: VERSION = re.compile(r".*__version__ = '(.*?)'", re.S).match(fd.read()).group(1) def read(fname): ...
{ "content_hash": "2eea5496e199bfb80bc1978c80c5896b", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 105, "avg_line_length": 32.166666666666664, "alnum_prop": 0.6191709844559585, "repo_name": "ldiary/pytest-testbook", "id": "b064086b3ddce3fef43d60c3a077c411fbe8fd17", "size...
from setuptools import setup, find_packages import codecs import tdigest def long_description(): with codecs.open('README.rst', encoding='utf8') as f: return f.read() setup( name='tdigest', version=tdigest.__version__, description=tdigest.__doc__.strip(), long_description=long_descriptio...
{ "content_hash": "e85ae721bd9b2681fec409fd2897dba0", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 66, "avg_line_length": 30.90909090909091, "alnum_prop": 0.5911764705882353, "repo_name": "trademob/t-digest", "id": "f34b76daaf48435b181a69ffa9ab3111a1253219", "size": "136...
import os import sys from setuptools import setup from setuptools.command.test import test as TestCommand import cdj HERE = os.path.abspath(os.path.dirname(__file__)) class PyTest(TestCommand): def finalize_options(self): TestCommand.finalize_options(self) self.test_args = ['tests/'] sel...
{ "content_hash": "e51b6aac017ac2b19899aed26af6d587", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 71, "avg_line_length": 25.56140350877193, "alnum_prop": 0.608098833218943, "repo_name": "Ma233/cdj", "id": "b7502a8cc90c3e70c5fc96fd18e66588caa5be21", "size": "1457", "bi...
""" Classes representing perfetto trace protobuf messages. This module makes use of neither python-protobuf library nor python classes compiled from .proto definitions, because currently there's no way to deploy those to all the places where telemetry is run. TODO(crbug.com/944078): Remove this module after the pytho...
{ "content_hash": "0889f9bb396e6996ed55f47c65858f72", "timestamp": "", "source": "github", "line_count": 327, "max_line_length": 102, "avg_line_length": 31.91131498470948, "alnum_prop": 0.674556780067082, "repo_name": "endlessm/chromium-browser", "id": "5be4a8e1d771ed40398864709c7bf1a6206689b6", "si...
from similarity_analyzer import SimilarityAnalyzer # import datetime for the timestamp in response checked queue from datetime import datetime, timedelta # import time to be able to sleep import time # import twythonaccess to be able to send tweets import twythonaccess # import setup to be able to read the persona impo...
{ "content_hash": "b68638529941154f0f7af998da387514", "timestamp": "", "source": "github", "line_count": 257, "max_line_length": 261, "avg_line_length": 55.719844357976655, "alnum_prop": 0.5839385474860335, "repo_name": "ArVID220u/TheHumanBot", "id": "b40408890548046c865134607eff3304bfff8c33", "size...
from unittest import TestCase class TestStrategy(TestCase): def test_place_order(self): self.fail()
{ "content_hash": "95ef2f15cc3f70c7a6c9ed52a4ff0f7a", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 31, "avg_line_length": 19, "alnum_prop": 0.7017543859649122, "repo_name": "michaelchu/kaleidoscope", "id": "9011cd00a7d9309c20affa5200aa1567da02f7c5", "size": "114", "bina...
"""Sanitizer for body fields sent via GCP API. The sanitizer removes fields specified from the body. Context ------- In some cases where GCP operation requires modification of existing resources (such as instances or instance templates) we need to sanitize body of the resources returned via GCP APIs. This is in the c...
{ "content_hash": "f2993cf42ef4c0df13c7b9bf7a2699af", "timestamp": "", "source": "github", "line_count": 148, "max_line_length": 106, "avg_line_length": 35.317567567567565, "alnum_prop": 0.550411325808303, "repo_name": "r39132/airflow", "id": "a449613174bb8490d09660ea2a411d89e97a104d", "size": "6038...
""" Copyright 2013 Steven Diamond This file is part of CVXPY. CVXPY is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. CVXPY is distributed i...
{ "content_hash": "8e4ddef8e9b0f00b8cd8d9a1dade43e7", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 68, "avg_line_length": 36.064516129032256, "alnum_prop": 0.6457960644007156, "repo_name": "riadnassiffe/Simulator", "id": "63832d7c70fdd9a5b771de1093f250a188c0b507", "size"...
import logging from pajbot.managers.db import DBManager from pajbot.models.command import Command from pajbot.models.command import CommandExample from pajbot.models.user import User from pajbot.modules import BaseModule from pajbot.modules.basic import BasicCommandsModule log = logging.getLogger(__name__) class Po...
{ "content_hash": "0a211e5b49702ab28d3ba159cfde5593", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 119, "avg_line_length": 34.111111111111114, "alnum_prop": 0.5802698929734761, "repo_name": "pajlada/pajbot", "id": "f6abd0315b7336421f2ee0fc29144f21ec9b9c4e", "size": "2149...
"""Test the module cluster centroids.""" from collections import Counter import pytest import numpy as np from scipy import sparse from sklearn.cluster import KMeans from sklearn.datasets import make_classification from imblearn.under_sampling import ClusterCentroids RND_SEED = 0 X = np.array( [ [0.0435...
{ "content_hash": "b160750bd4720aba545292904d3b1b78", "timestamp": "", "source": "github", "line_count": 152, "max_line_length": 86, "avg_line_length": 29.611842105263158, "alnum_prop": 0.6411908464785603, "repo_name": "fmfn/UnbalancedDataset", "id": "8148e2fdb018ba327c78b27fd8a67a834ad7512a", "size...
""" This module contains APIs to facilitate Imc backup and import """ import time from ..imcexception import ImcValidationException def backup_create(handle, remote_host, remote_file, protocol, username, password, passphrase, timeout_in_sec=600, entity="CMC", **kwargs): """ backup_create he...
{ "content_hash": "9403279887b1344a65f8526524de0271", "timestamp": "", "source": "github", "line_count": 191, "max_line_length": 84, "avg_line_length": 41.968586387434556, "alnum_prop": 0.6212574850299402, "repo_name": "ragupta-git/ImcSdk", "id": "8877eefa2755763c33acd3ac18ecec3f841801ca", "size": "...
import functools import getpass import hashlib import inspect import logging import sys import prettytable import six from keystoneclient import exceptions from keystoneclient.openstack.common import strutils logger = logging.getLogger(__name__) # Decorator for cli-args def arg(*args, **kwargs): def _decorato...
{ "content_hash": "021f2e940959c64cc1b28691f7207bf4", "timestamp": "", "source": "github", "line_count": 308, "max_line_length": 79, "avg_line_length": 30.288961038961038, "alnum_prop": 0.5879515489334334, "repo_name": "UTSA-ICS/python-keystoneclient-SID", "id": "a6c03f5e9629832de79f5bd6e821a525b7689b...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from rasa_core.train import train_dialogue_model from rasa_core.training_utils import StoryFileReader from rasa_core.training_utils.visualization import visualize_storie...
{ "content_hash": "0ca09a0e891cd86d6575fb646615bbbe", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 68, "avg_line_length": 34.96296296296296, "alnum_prop": 0.7478813559322034, "repo_name": "deepak02/rasa_core", "id": "e3de020baa94f3c7b7624ebf50c385156e00f577", "size": "94...
from django.db import models from django.utils import timezone class Post(models.Model): author = models.ForeignKey('auth.User') title = models.CharField(max_length=200) text = models.TextField() text2 = models.TextField(blank=True) # image = models.ImageField() created_date = models.DateTime...
{ "content_hash": "3f49c691ef90687b5dc001a0109f8974", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 83, "avg_line_length": 24.697674418604652, "alnum_prop": 0.6384180790960452, "repo_name": "fortunto2/django_hack", "id": "4f235d47c65635700e3bed51c174fa6a2357243d", "size":...
"""Test asmap config argument for ASN-based IP bucketing. Verify node behaviour and debug log when launching bitcoind in these cases: 1. `bitcoind` with no -asmap arg, using /16 prefix for IP bucketing 2. `bitcoind -asmap=<absolute path>`, using the unit test skeleton asmap 3. `bitcoind -asmap=<relative path>`, usi...
{ "content_hash": "6dd43c24b1c3b8aa8461b5eae0e73cde", "timestamp": "", "source": "github", "line_count": 101, "max_line_length": 89, "avg_line_length": 39.37623762376238, "alnum_prop": 0.659039476992708, "repo_name": "yenliangl/bitcoin", "id": "704dd6126b5f76dc754ec2abbbfe945cca4447d2", "size": "418...
from __future__ import with_statement # Portions Copyright Canonical Ltd. 2009 """A LatentSlave that uses EC2 to instantiate the slaves on demand. Tested with Python boto 1.5c """ import os import re import time import boto import boto.ec2 import boto.exception from twisted.internet import defer, threads from twist...
{ "content_hash": "5f8aee540f017726af7426a3c8021aec", "timestamp": "", "source": "github", "line_count": 304, "max_line_length": 91, "avg_line_length": 43.05592105263158, "alnum_prop": 0.5366338146535259, "repo_name": "denny820909/builder", "id": "f144321b190133bbfc15a9189250b7085a331ee0", "size": "...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import os from contextlib import contextmanager from pants.backend.jvm.targets.jvm_binary import JvmBinary from pants.backend.jvm.tasks.jvm_run import JvmRun from pan...
{ "content_hash": "6a0ac08077cb1deed67bf376d3c887bf", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 95, "avg_line_length": 40.83018867924528, "alnum_prop": 0.6866913123844732, "repo_name": "digwanderlust/pants", "id": "c9e6e6a20eea8980e2a21450bfe36aecd3750544", "size": "2...
from __future__ import absolute_import import mock import django_dynamic_fixture as fixture from django.contrib.auth.models import User from django.test import TestCase from django.test.utils import override_settings from readthedocs.projects.forms import ProjectRelationshipForm from readthedocs.projects.models impor...
{ "content_hash": "16a9c9403a43c6105eb72e4d7d9312c4", "timestamp": "", "source": "github", "line_count": 175, "max_line_length": 103, "avg_line_length": 36.48, "alnum_prop": 0.5808270676691729, "repo_name": "pombredanne/readthedocs.org", "id": "d64d3ee3d6ba7598226703e7b1c74aa80e41974f", "size": "638...
import tensorflow as tf v = tf.Variable(0, dtype=tf.float32, name='v3') # 在没有声明滑动平均模型时只有一个变量v,所以下面的语句只会输出v:0 for variables in tf.global_variables(): print(variables.name) ema = tf.train.ExponentialMovingAverage(0.99) # 加入命名空间中 maintain_averages_op = ema.apply(tf.global_variables()) # 在申明滑动平均模型之后,TensorFlow会自动生成一...
{ "content_hash": "d0abcbe5d086992660f77a345ede95f7", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 55, "avg_line_length": 30.807692307692307, "alnum_prop": 0.7365792759051186, "repo_name": "pearpai/TensorFlow-action", "id": "cbe6b0eea93a98eae975c5a09c446c6929e03ea6", "si...
import datetime import os.path import unittest from adjunct import opml HERE = os.path.dirname(__file__) class OPMLTest(unittest.TestCase): def test_parse_file(self): with open(os.path.join(HERE, "sample.opml")) as fh: doc = opml.parse(fh) self.assertTrue(doc.root) self.asse...
{ "content_hash": "f40dfbb6d936bbb068a834fc3da5c0a9", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 76, "avg_line_length": 34.78431372549019, "alnum_prop": 0.59695603156708, "repo_name": "kgaughan/adjunct", "id": "5f079642aabf920bb33d040444ee2353b9e2c531", "size": "1774",...
from nose.tools import raises, eq_, ok_ from mock import patch, Mock from django.contrib.auth.models import User from django.contrib.admin.sites import AdminSite from django.http import Http404 from django.test import client, TestCase from us_ignite.common.tests import utils from us_ignite.hubs.admin import HubReques...
{ "content_hash": "2bf3464ce173b55880ebdfe383129de2", "timestamp": "", "source": "github", "line_count": 94, "max_line_length": 77, "avg_line_length": 36.276595744680854, "alnum_prop": 0.644574780058651, "repo_name": "us-ignite/us_ignite", "id": "29591ce312e64c545497b4cf125bca0a7e75bdc7", "size": "3...
""" Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved. This program and the accompanying materials are made available under the terms of the 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 ...
{ "content_hash": "070d857180fe7e36f07bafdf922426b1", "timestamp": "", "source": "github", "line_count": 1012, "max_line_length": 158, "avg_line_length": 45.70652173913044, "alnum_prop": 0.6021835477245703, "repo_name": "lintzc/gpdb", "id": "47c421e5c3f74ade438bb462747c6b5769a34e34", "size": "46255"...
'''Plist operation''' from __future__ import unicode_literals import re import zipfile import biplist def get_plist_from_ipa(path): '''Get plist file from IPA @param path: IPA file path @return plist bytes ''' plist_file_re = re.compile(r'Payload/.*\.app/Info.plist') try: ipa = zip...
{ "content_hash": "ee655b07036f7cf536fc212b802f0882", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 91, "avg_line_length": 22.933333333333334, "alnum_prop": 0.592296511627907, "repo_name": "zqqf16/wad", "id": "69663cf625ef6e0feca0fe108328e46476a31ff9", "size": "1399", "...
__author__ = 'IRSEN' # -*- coding: utf-8 -*- import mysql.connector from model.group import Group from model.contact import Contact class DbFixture: def __init__(self, host, name, user, password): self.host = host self.name = name self.user = user self.password = password ...
{ "content_hash": "8e2b9202872085f98be50ad546475ddd", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 120, "avg_line_length": 38.97826086956522, "alnum_prop": 0.5883993307306191, "repo_name": "nyblinnn/python_training_for_testers", "id": "62086e3fe403d847ff92d0a0602f58e760f4f...
""".. Ignore pydocstyle D400. ================== Rating API filters ================== """ from django_filters import rest_framework as filters from rolca.rating.models import Rating class RatingFilter(filters.FilterSet): """Filter for Submission API endpoint.""" theme = filters.CharFilter(field_name="sub...
{ "content_hash": "a66e44eee476e1cf33e6b5287f72db7b", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 62, "avg_line_length": 20.136363636363637, "alnum_prop": 0.5959367945823928, "repo_name": "dblenkus/rolca", "id": "129e5369811ef4c120e7fa30f28ec59c61916d9c", "size": "443",...
from collections import Counter, defaultdict from itertools import chain from operator import attrgetter from sqlalchemy import inspect from sqlalchemy.dialects.postgresql import UUID from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.ext.hybrid import hybrid_property from indico.core.db import db f...
{ "content_hash": "7e40ed23c082cd68f809cace3abc0abf", "timestamp": "", "source": "github", "line_count": 676, "max_line_length": 119, "avg_line_length": 37.75443786982248, "alnum_prop": 0.6055559909098033, "repo_name": "DirkHoffmann/indico", "id": "08acc7d3719375d97ea1f7cc226fd6cf1b1b98f9", "size": ...
import os import unittest import IECore import Gaffer import GafferImage import sys class ConstantTest( unittest.TestCase ) : def testDefaultFormatHash( self ) : s = Gaffer.ScriptNode() n = GafferImage.Constant() s.addChild( n ) with s.context(): h = n["out"].image().hash() n["color"][0].setValue...
{ "content_hash": "6252f26b4ef5b967f71e555c345b3451", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 85, "avg_line_length": 28.71590909090909, "alnum_prop": 0.6264345073209339, "repo_name": "davidsminor/gaffer", "id": "cf3e2d1db11db57a4b8a668af5e36cbba630d341", "size": "44...
""" SMA Indicator """ import math import pandas from talib import abstract from analyzers.utils import IndicatorUtils class SMA(IndicatorUtils): def analyze(self, historical_data, period_count=15): """Performs a SMA analysis on the historical data Args: historical_data (list): A ma...
{ "content_hash": "6bd220a4319cb470f880b55add921cde", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 99, "avg_line_length": 29.5, "alnum_prop": 0.6598870056497175, "repo_name": "AbenezerMamo/crypto-signal", "id": "daffd2440350b91ff68f9650e8e347e5fb4a70d4", "size": "885", ...
r"""Model definition.""" import tensorflow as tf def build_model(image_size, bias_last=True, num_classes=1, squeeze=True): """Builds model.""" input_shape = (image_size, image_size, 3) image = tf.keras.Input(shape=input_shape, name='input_image') training = tf.keras.Input(shape=[], name='training') x = t...
{ "content_hash": "b9932811ba3836f84be5af2f2d65aa42", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 73, "avg_line_length": 33.3921568627451, "alnum_prop": 0.6265413975337639, "repo_name": "google-research/google-research", "id": "f626ba54ad484c85c10ca5c09fa09391d676478c", ...
""" Rockuefort reads playlists written in simple plaintext, searches your music library, and outputs the songs matched by the playlist in a few different ways. Usage: rockuefort index [--add DIR|--remove DIR] rockuefort scan rockuefort list [--strip PREFIX] [--prepend PREFIX] [--null] ...
{ "content_hash": "1a8796b3937af587bad9473d32ce12fb", "timestamp": "", "source": "github", "line_count": 479, "max_line_length": 89, "avg_line_length": 32.2901878914405, "alnum_prop": 0.5671429495053986, "repo_name": "kalgynirae/rockuefort", "id": "57ef3bca22f26e81a05dc29a2e94dd5091809df1", "size": ...
from setuptools import setup, find_packages import os version = '1.0' here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.txt')).read() setup(name='lfc_developement_tools', version=version, description='Development tools for LFC', long_description=README, ...
{ "content_hash": "692b3c3807cb33493cf6f7fdd262a8ea", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 54, "avg_line_length": 29.34375, "alnum_prop": 0.597444089456869, "repo_name": "diefenbach/lfc-development-tools", "id": "3516386cd4a875eb6f7585b4935baa0888036a91", "size":...
""" A stylish alternative for caching your map tiles. TileStache is a Python-based server application that can serve up map tiles based on rendered geographic data. You might be familiar with TileCache (http://tilecache.org), the venerable open source WMS server from MetaCarta. TileStache is similar, but we hope simpl...
{ "content_hash": "931edbc1d014dcaa75f09eeeb720b2d1", "timestamp": "", "source": "github", "line_count": 471, "max_line_length": 164, "avg_line_length": 35.78768577494692, "alnum_prop": 0.5932012339819649, "repo_name": "mojodna/TileStache", "id": "038445f5a327c4a1b22ebf2e356af32543e99f9f", "size": "...
import functools import six import imath from collections import namedtuple, OrderedDict import IECore import Gaffer import GafferUI import GafferImage import GafferImageUI ## \todo ## Ideally Catalogue reordering wouldn't just be managed the UI layer, but ## the scope of changing this is somewhat large. When we ne...
{ "content_hash": "35777906496f6ffbcccfe25be9870670", "timestamp": "", "source": "github", "line_count": 1049, "max_line_length": 162, "avg_line_length": 32.30409914204004, "alnum_prop": 0.6923008823442618, "repo_name": "lucienfostier/gaffer", "id": "a52fda3d087bd45c90a7e24b5e6ad2963b37464f", "size"...
import logging from datetime import datetime from django.conf import settings from django.core.serializers.json import DjangoJSONEncoder from django.db import models from django.utils import simplejson from django.utils.encoding import smart_unicode # JSONField forked from djblets project # See LICENSE in c...
{ "content_hash": "32f54abf836ca2e2f4e4150087038a02", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 79, "avg_line_length": 35.333333333333336, "alnum_prop": 0.6095013477088949, "repo_name": "maxcutler/Courant-News", "id": "991c0075ed04c148203f7918fdc16f455e14646f", "size"...
import sys from setuptools import setup, find_packages # Requirements. setup_requirements = ['pytest-runner'] if {'pytest', 'test', 'ptr'}.intersection(sys.argv) else [] install_requirements = ['ipykernel', 'pyreadline; platform_system == "Windows"'] test_requirements = ['pytest', 'pytest-pep8', 'pytest-flakes'] # F...
{ "content_hash": "13cf071556684bde895bad570a054022", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 98, "avg_line_length": 40.390243902439025, "alnum_prop": 0.6056763285024155, "repo_name": "ofir123/PyPrinter", "id": "254fd0c12e3599ecd65265059cc1e552cd593825", "size": "16...