text
stringlengths
4
1.02M
meta
dict
import copy from django.contrib.gis.db.models import GeometryField from django.contrib.gis.db.models.sql import AreaField, DistanceField from django.test import SimpleTestCase class FieldsTests(SimpleTestCase): def test_area_field_deepcopy(self): field = AreaField(None) self.assertEqual(copy.deep...
{ "content_hash": "3eeb28ff817eeaade6778e5ce7445db5", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 69, "avg_line_length": 27.732142857142858, "alnum_prop": 0.49452672247263363, "repo_name": "monetate/django", "id": "933514fee7a2450d84648d3e2572114262a7420e", "size": "155...
from validator.BaseValidator import BaseValidator class ConditionalValidator(BaseValidator): operator = None #should be a lambda expression which return boolean variable message = "This value is not valid" def validate(self, fieldA, fieldB): fieldA = super(ConditionalValidator, self).validate(fi...
{ "content_hash": "124e7203dbfd029521d9b15b49f458eb", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 80, "avg_line_length": 33.689655172413794, "alnum_prop": 0.6550665301944729, "repo_name": "mkesicki/excel_validator", "id": "a50e607ebb361fff54c16acfacb2e6d1ef1ccb0e", "siz...
from .extdocker import * from .helpers import *
{ "content_hash": "46107d47602ea9b94cd123eeba9d29e5", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 24, "avg_line_length": 23.5, "alnum_prop": 0.7659574468085106, "repo_name": "dtwardow/docker-py-helpers", "id": "c61742198690a7b3283c678c68e57b06e9d0271d", "size": "47", "...
if True: print('Hello')
{ "content_hash": "9c30329c0540642ac4c82b6512dfc271", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 18, "avg_line_length": 14, "alnum_prop": 0.5714285714285714, "repo_name": "Evmorov/ruby-coffeescript", "id": "fd509f2656e39aaedbba8bc96c198ee3bf4373f1", "size": "28", "bin...
import logging import sys from ming.orm import ThreadLocalORMSession from pylons import tmpl_context as c, app_globals as g from allura import model as M from allura.lib import helpers as h from allura.lib import utils log = logging.getLogger(__name__) def main(options): log.addHandler(logging.StreamHandler(sy...
{ "content_hash": "6fdfbde6a0f4aeb0a62277b456c7810f", "timestamp": "", "source": "github", "line_count": 75, "max_line_length": 82, "avg_line_length": 36.93333333333333, "alnum_prop": 0.5902527075812274, "repo_name": "heiths/allura", "id": "9cc6494cd3ec1e7da0e6116316f8e2b6763a4034", "size": "3640", ...
""" Goal: Define the routes for general pages @authors: Andrei Sura <[email protected]> Ruchi Vivek Desai <[email protected]> Sanath Pasumarthy <[email protected]> @see https://flask-login.readthedocs.org/en/latest/ @see https://pythonhosted.org/Flask-Principal/ """ import hashlib...
{ "content_hash": "0df268d545460709940f2fa15e205468", "timestamp": "", "source": "github", "line_count": 349, "max_line_length": 94, "avg_line_length": 33.88538681948424, "alnum_prop": 0.6256553357009978, "repo_name": "indera/barebones-flask-app", "id": "c83d20217fb3651450af37e2163f80fefa587505", "s...
import os import tempfile from pyoram.util.virtual_heap import \ SizedVirtualHeap from pyoram.encrypted_storage.encrypted_heap_storage import \ EncryptedHeapStorage def main(): # # get a unique filename in the current directory # fid, tmpname = tempfile.mkstemp(dir=os.getcwd()) os.close(fi...
{ "content_hash": "dd0974769ec3f254e870757c704f96f6", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 73, "avg_line_length": 27.31578947368421, "alnum_prop": 0.588310854206808, "repo_name": "ghackebeil/PyORAM", "id": "3ea59164275c86433f98e90fcdd63b28b3f753af", "size": "1557...
import pytest from virtualenv.run import session_via_cli @pytest.mark.parametrize( ("args", "download"), [([], False), (["--no-download"], False), (["--never-download"], False), (["--download"], True)], ) def test_download_cli_flag(args, download, tmp_path): session = session_via_cli(args + [str(tmp_path...
{ "content_hash": "9d6dbf941382bf6ba57d8d72a75923b8", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 101, "avg_line_length": 30.916666666666668, "alnum_prop": 0.6549865229110512, "repo_name": "pypa/virtualenv", "id": "3344c74384409415815c4b9b1d9948b4aa57c37c", "size": "371...
from django.core.management.base import BaseCommand, CommandError import shortuuid from flowjs.models import FlowFile from shutil import copyfile from cbh_core_ws.parser import get_sheetnames, get_sheet from cbh_datastore_ws.resources import DataPointClassificationResource, AttachmentResource, DataPointProjectFieldReso...
{ "content_hash": "b91debeff01adccf9deeebd261f7fa1c", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 139, "avg_line_length": 41.098765432098766, "alnum_prop": 0.6491438870531692, "repo_name": "thesgc/cbh_datastore_ws", "id": "ecd33fb365e12af5bcdf011e99773d208e23b821", "siz...
import requests from config import PROXY, TG_TOKEN __author__ = 'ihciah' CALLBACK = "https://ihc.im/" + TG_TOKEN # Modify this url to your callback url. url = "https://api.telegram.org/bot%s/setWebhook" % TG_TOKEN res = requests.post(url, {"url": CALLBACK}, proxies=PROXY) print res.content
{ "content_hash": "ebdeb737a0264b41b6b2cabc07202964", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 80, "avg_line_length": 29.5, "alnum_prop": 0.7050847457627119, "repo_name": "ihciah/AndroidSMSRelay", "id": "a3aa1d445db6c69db18b265f49e2d8c2c5660aa0", "size": "354", "bi...
"""Semantic Protobufs are serialization agnostic, rich data types.""" import copy import cStringIO import json import struct from google.protobuf import descriptor_pb2 from google.protobuf import descriptor from google.protobuf import text_format import logging from grr.lib import rdfvalue from grr.lib import regist...
{ "content_hash": "7e86a805a71f2f846a5d458484d932a7", "timestamp": "", "source": "github", "line_count": 2187, "max_line_length": 80, "avg_line_length": 32.19844535893919, "alnum_prop": 0.6687778692947826, "repo_name": "defaultnamehere/grr", "id": "701393754588c7629427cb041f4c42b6fe4597f2", "size": ...
import os from json import dumps from django.conf import settings from django.test import TestCase from django.core.files.storage import default_storage from django.utils.datastructures import MultiValueDict from django.core.files.uploadedfile import InMemoryUploadedFile from django_images.models import Image from dj...
{ "content_hash": "ae40e8d42250baab787c492bb69e4266", "timestamp": "", "source": "github", "line_count": 242, "max_line_length": 72, "avg_line_length": 32.81404958677686, "alnum_prop": 0.4850774461654703, "repo_name": "amirouche/django-images", "id": "cc954d5579e45e84fd0e4bfcebd06e9fb3d91389", "size...
from django.db import models # Create your models here. class Status(models.Model): lastchange= models.CharField(max_length=90, db_column='LastChange',) # Field name made lowercase smbhosts = models.IntegerField(db_column='SMBHosts') # Field name made lowercase. ftphosts = models.IntegerField(db_colu...
{ "content_hash": "74f9229c863bb0180d39da6eda05b9f1", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 109, "avg_line_length": 44.54545454545455, "alnum_prop": 0.6678571428571428, "repo_name": "blampe/M2M", "id": "db0e862b6bf54f1b1ab1ebb75e56671c5a1a3325", "size": "3920", ...
import numpy as np class Node(object): """ Base class for nodes in the network. Arguments: `inbound_nodes`: A list of nodes with edges into this node. """ def __init__(self, inbound_nodes=[]): """ Node's constructor (runs when the object is instantiated). Sets pr...
{ "content_hash": "6dc7bd9109b998d6a16a8e30eb2f76d5", "timestamp": "", "source": "github", "line_count": 284, "max_line_length": 122, "avg_line_length": 31.5, "alnum_prop": 0.5602503912363067, "repo_name": "akshaybabloo/Car-ND", "id": "20af5fc64a04d8565fd2b10af2712846351b9f7e", "size": "8946", "bi...
import unittest, random, sys, time, re sys.path.extend(['.','..','../..','py']) import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_glm def write_syn_dataset(csvPathname, rowCount, colCount, SEED): r1 = random.Random(SEED) # keep a single thread from the original SEED, for repeatability. SEED2 ...
{ "content_hash": "e1ef09a499965795d3a6b683087a72b8", "timestamp": "", "source": "github", "line_count": 138, "max_line_length": 107, "avg_line_length": 35.56521739130435, "alnum_prop": 0.5008149959250203, "repo_name": "eg-zhang/h2o-2", "id": "fed8f9cedfc2e4ffa3cae2b8dbdb16bf1b1ceee8", "size": "4908...
from pbr import version __version__ = version.VersionInfo('python-magnetodbclient').version_string()
{ "content_hash": "690399f8d6cc30720d63f00598f54bf6", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 76, "avg_line_length": 25.75, "alnum_prop": 0.7669902912621359, "repo_name": "aostapenko/python-magnetodbclient", "id": "8043bec97e651c3b6249ed65112d8747c3e3ad1b", "size": "...
from enum import Enum,EnumMeta SymEnum = None # class defined after use class SymEnumValue(object): "Class used to define SymEnum member that have additional attributes." def __init__(self, value, externalName=None): self.value = value self.externalName = externalName class _SysEnumExternalN...
{ "content_hash": "deda80dcd2fd7f73b3ceebc1bbf575cf", "timestamp": "", "source": "github", "line_count": 123, "max_line_length": 95, "avg_line_length": 35.28455284552845, "alnum_prop": 0.6248847926267281, "repo_name": "ifiddes/pycbio", "id": "64336153389808a4879918e7fe01e902e4c15837", "size": "4432"...
import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Award' db.create_table('videos_award', ( ('id', self.gf('django.db.models.fields.AutoField')(primary_key...
{ "content_hash": "1f1357838de428e8e157a2d8085202df", "timestamp": "", "source": "github", "line_count": 90, "max_line_length": 182, "avg_line_length": 69.9, "alnum_prop": 0.5526943252265141, "repo_name": "mozilla/firefox-flicks", "id": "9636fc55bfb6a0ab9a5d27dd978a331e72f0632d", "size": "6315", "...
import logging import string import urllib import urllib2 from command import Command import utils class Request(urllib2.Request): """Extends the urllib2.Request to support all HTTP request types.""" def __init__(self, url, data=None, method=None): """Initialise a new HTTP request. Args: ...
{ "content_hash": "159e5c5ad8e7f8e2ffe23c140aee8a60", "timestamp": "", "source": "github", "line_count": 229, "max_line_length": 87, "avg_line_length": 42.03056768558952, "alnum_prop": 0.5785974025974026, "repo_name": "mfazekas/safaridriver", "id": "84e87049c05a47bf5072c9ed39d70599e1a29645", "size":...
#!/usr/bin/env python3 # Copyright 2021 Google 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
{ "content_hash": "50bb382348c282ba395cd199d2e2b838", "timestamp": "", "source": "github", "line_count": 1071, "max_line_length": 412, "avg_line_length": 43.69094304388422, "alnum_prop": 0.6051332464257474, "repo_name": "GoogleCloudPlatform/rad-lab", "id": "a3996b1267cdc597f465899676f6a067161ab95d", ...
import logging from torch.optim import SGD, Adam, ASGD, Adamax, Adadelta, Adagrad, RMSprop logger = logging.getLogger("ptsemseg") key2opt = { "sgd": SGD, "adam": Adam, "asgd": ASGD, "adamax": Adamax, "adadelta": Adadelta, "adagrad": Adagrad, "rmsprop": RMSprop, } def get_optimizer(cfg):...
{ "content_hash": "7fce082c16222b53e276d01d86a9e50e", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 86, "avg_line_length": 24.517241379310345, "alnum_prop": 0.6216596343178622, "repo_name": "meetshah1995/pytorch-semseg", "id": "3d7996726b302474e49f3d49995027c680c7a18b", "...
from honeybadger.fake_connection import send_notice from testfixtures import log_capture import json @log_capture() def test_send_notice_logging(l): config = {'api_key': 'aaa'} payload = json.dumps({'test': 'payload'}) send_notice(config, payload) l.check( ('honeybadger.fake_connection', 'IN...
{ "content_hash": "5c822c8b2876948b1e58181ac500c1bf", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 148, "avg_line_length": 36.06666666666667, "alnum_prop": 0.6931608133086876, "repo_name": "honeybadger-io/honeybadger-python", "id": "c69e289a10902d056a62430d0154764ef40be73b...
import base64 from Crypto.Hash import HMAC from Crypto import Random from trove_guestagent.openstack.common.gettextutils import _ # noqa from trove_guestagent.openstack.common import importutils class CryptoutilsException(Exception): """Generic Exception for Crypto utilities.""" message = _("An unknown er...
{ "content_hash": "37121d47fa911923f1f683ce4308928f", "timestamp": "", "source": "github", "line_count": 163, "max_line_length": 79, "avg_line_length": 34.15950920245399, "alnum_prop": 0.6312859195402298, "repo_name": "denismakogon/trove-guestagent", "id": "fb5bf3dd23793cd136ed1ab243c436f4fa5c1fa5", ...
import unittest import devtools_monitor from page_track import PageTrack class MockDevToolsConnection(object): def __init__(self): self.stop_has_been_called = False def RegisterListener(self, name, listener): pass def StopMonitoring(self): self.stop_has_been_called = True class PageTrackTest(uni...
{ "content_hash": "1169828415f3311ee145659c9b352004", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 75, "avg_line_length": 35.049180327868854, "alnum_prop": 0.6449953227315248, "repo_name": "highweb-project/highweb-webcl-html5spec", "id": "3056d99f8ac2cbbe7817c8d83cab058b25...
"""Atom class, used in Structure objects.""" import numpy import warnings import copy from Bio.PDB.Entity import DisorderedEntityWrapper from Bio.PDB.PDBExceptions import PDBConstructionWarning from Bio.PDB.Vector import Vector from Bio.Data import IUPACData class Atom(object): def __init__(self, name, coord, bf...
{ "content_hash": "d1ad21626879f1d1f394c508d09c5826", "timestamp": "", "source": "github", "line_count": 332, "max_line_length": 94, "avg_line_length": 31.44578313253012, "alnum_prop": 0.600287356321839, "repo_name": "bryback/quickseq", "id": "c9764357f159fab588ef52ec41a43fb7ef889b06", "size": "1068...
import getpass, poplib, sys if len(sys.argv) != 3: print 'usage: %s hostname user' % sys.argv[0] exit(2) hostname, user = sys.argv[1:] passwd = getpass.getpass() p = poplib.POP3_SSL(hostname) # or "POP3" if SSL is not supported try: p.user(user) p.pass_(passwd) except poplib.error_proto, e: prin...
{ "content_hash": "a0ea395464af7fe7ea3351bd45cef60d", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 66, "avg_line_length": 22.55, "alnum_prop": 0.6407982261640798, "repo_name": "jac2130/BayesGame", "id": "db2fadba46fcb6c40ae53b189d153133b5b380c2", "size": "536", "binary...
from typing import Optional # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class InitialRecursiveSolution: def isBalanced(self, root: Optional[TreeNode]) -> bool: def ch...
{ "content_hash": "006bb4920bc22e072b1af24aebd1d72b", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 86, "avg_line_length": 24.51851851851852, "alnum_prop": 0.5377643504531722, "repo_name": "vilisimo/ads", "id": "780a8a685257400dc96671799dfc1a5780511ae5", "size": "1207", ...
from __future__ import absolute_import __all__ = ['general','plot','stats','text'] from . import general, plot, stats, text
{ "content_hash": "14d0eeeeb714fd09e40092b2e40b4879", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 43, "avg_line_length": 41.333333333333336, "alnum_prop": 0.6693548387096774, "repo_name": "mattjj/pybasicbayes", "id": "ed6fb6df75d06313f4d24356855e82c8f3e7c651", "size": "1...
from os import path from setuptools import setup setup( name="tucan", version="0.8", description="New Grades Notification Script for TuCaN", long_description=open(path.join(path.dirname(__file__), "README.rst")).read(), url="http://github.com/fhirschmann/tucan", author="Fabian Hirschmann", ...
{ "content_hash": "2e699da1a0c28bc307dd29b77f74462c", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 82, "avg_line_length": 26.428571428571427, "alnum_prop": 0.6504504504504505, "repo_name": "fhirschmann/tucan", "id": "62925aa577e69ad3ae791b706dfaa7d8993a380c", "size": "58...
""" """ __author__ = "Jérôme Samson" __copyright__ = "Copyright 2014, Mikros Image" import os import sys import csv import time import datetime from optparse import OptionParser import numpy as np import pygal from pygal.style import * try: import simplejson as json except ImportError: import json f...
{ "content_hash": "d2d42acece8d53899a15dcaa6db69898", "timestamp": "", "source": "github", "line_count": 230, "max_line_length": 153, "avg_line_length": 36.278260869565216, "alnum_prop": 0.5504554170661553, "repo_name": "smaragden/OpenRenderManagement", "id": "6d179818b830693b8b6e1f627751ec01fe634a6e"...
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from pants.backend.jvm.targets.exportable_jvm_library import ExportableJvmLibrary class JavaLibrary(ExportableJvmLibrary): """A Java library. Normally has conce...
{ "content_hash": "b816a9e5b121a34fad2ee44f9059b100", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 93, "avg_line_length": 39.535714285714285, "alnum_prop": 0.6964769647696477, "repo_name": "dbentley/pants", "id": "78ecc48ca64644a1b82ef9c329d6d086f85fda83", "size": "1254"...
""" Cluster of helper functions. """ import pickle from glob import glob import cv2 import numpy as np from scipy.misc import imresize, imread import os # Constants OUTPUT_DIR = os.path.abspath('output') CALIBRATION_PATH_PICKLE = os.path.abspath('output' + os.sep + 'calibration.p') CAL_IMAGE_PATH = os.path.abspath('...
{ "content_hash": "a1d8fd7bcfa6c5edc517321bef87e098", "timestamp": "", "source": "github", "line_count": 568, "max_line_length": 140, "avg_line_length": 24.79225352112676, "alnum_prop": 0.551839227382474, "repo_name": "akshaybabloo/Car-ND", "id": "036ecdd769a6819a89364ecbf5f894179607de3f", "size": "...
from __future__ import absolute_import from .instrumentation.wsgi import InstanaWSGIMiddleware # Alias for historical name iWSGIMiddleware = InstanaWSGIMiddleware
{ "content_hash": "69b19c75f3d1a9843c814358a59c359f", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 55, "avg_line_length": 27.5, "alnum_prop": 0.8363636363636363, "repo_name": "instana/python-sensor", "id": "666991c3a73c6f9e9f851e09e4bb24f2e9a3b9ff", "size": "231", "bina...
"""Tests for tfx.tools.cli.handler.beam_dag_runner_patcher.""" from unittest import mock import tensorflow as tf from tfx.orchestration import pipeline as tfx_pipeline from tfx.orchestration.beam import beam_dag_runner from tfx.tools.cli.handler import beam_dag_runner_patcher _PIPELINE_NAME = 'pipeline1' class Bea...
{ "content_hash": "c4c75d7a84ab4ec3bbfa88165e051f61", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 73, "avg_line_length": 31.423076923076923, "alnum_prop": 0.7319461444308446, "repo_name": "tensorflow/tfx", "id": "8dc24c85c242a91c9ddf6c8b588e6bab99b1bc08", "size": "1413"...
from __future__ import print_function, division from collections import defaultdict from nltk.compat import Counter from nltk.tag import TaggerI from nltk.tbl import Feature, Template from nltk import jsontags ###################################################################### # Brill Templates #################...
{ "content_hash": "4167ebbafda1fa8dcc001392617d3d45", "timestamp": "", "source": "github", "line_count": 419, "max_line_length": 107, "avg_line_length": 37.9928400954654, "alnum_prop": 0.5635404233934292, "repo_name": "zimmermegan/smarda", "id": "3aa46f87bcc73ac055bdb80368addcca5680ae2e", "size": "1...
import unittest from tests.util.global_reactor import TEST_SWITCHES from tests.util.protocol_util import SshTester, TelnetTester class RoutingEngineTest(unittest.TestCase): def test_2_ssh(self): conf = TEST_SWITCHES["brocade"] tester1 = SshTester("ssh-1", "127.0.0.1", conf["ssh"], u'root', u'root...
{ "content_hash": "1c8a0f1833d26eb98523b4e2dd315db2", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 87, "avg_line_length": 31.08235294117647, "alnum_prop": 0.593111279333838, "repo_name": "internaphosting/fake-switches", "id": "d91b144dc1f193b928a63a7cd04835940961d4ad", "...
from datetime import datetime, timedelta from NodeDefender.db.sql import SQL, EventModel, iCPEModel, SensorModel import NodeDefender def latest(icpe, sensor): return EventModel.query.join(iCPEModel).join(SensorModel).\ filter(iCPEModel.mac_address == icpe).\ filter(SensorModel.mac_address =...
{ "content_hash": "612a0d39ac73a06c06979e80d145a30f", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 77, "avg_line_length": 35.15873015873016, "alnum_prop": 0.6275395033860045, "repo_name": "CTSNE/NodeDefender", "id": "b2b02f9986366c8543574e01d529d97134561671", "size": "22...
import os import textwrap from pip._vendor.six.moves.urllib import parse as urllib_parse from tests.lib import pyversion def test_find_links_relative_path(script, data): """Test find-links as a relative path.""" result = script.pip( 'install', 'parent==0.1', '--no-index', '--...
{ "content_hash": "1852dd68d851bb32ba93b4ee72d5521d", "timestamp": "", "source": "github", "line_count": 73, "max_line_length": 79, "avg_line_length": 31.671232876712327, "alnum_prop": 0.6237024221453287, "repo_name": "xavfernandez/pip", "id": "5a31db8b4826004d65c7c26d2d1ac8c096de3bd5", "size": "231...
import unittest from typing import List from unittest import mock from uuid import UUID import pytest from google.api_core.exceptions import AlreadyExists, GoogleAPICallError from google.cloud.exceptions import NotFound from google.cloud.pubsub_v1.types import ReceivedMessage from googleapiclient.errors import HttpErr...
{ "content_hash": "848af263ba158f9d2cba56ebdf25c2f0", "timestamp": "", "source": "github", "line_count": 543, "max_line_length": 110, "avg_line_length": 41.101289134438304, "alnum_prop": 0.6125996953132001, "repo_name": "mistercrunch/airflow", "id": "027c2b2f3d89eb99a617f6accd1691b2bba488cc", "size"...
""" Created on Thu May 4 06:47:16 2017 @author: lucas """ import tweepy import pandas as pd import numpy as np import time def authenticate_twitter_api( credentials_path="../private_data/twitter_credentials.csv"): """Athenticates with twitter api :credentials_path: path to a csv with a single row c...
{ "content_hash": "81253257919de9c6a28f898cd1592692", "timestamp": "", "source": "github", "line_count": 123, "max_line_length": 85, "avg_line_length": 36.60162601626016, "alnum_prop": 0.6363838294091515, "repo_name": "lgallen/morton_wordvectors", "id": "a8a5408d35966012215ac92dac935dcccd9d67b8", "s...
INSTANCE_ID = 'instance_id' TENANT_ID = 'tenant_id' TENANT_NAME = 'tenant_name' HOST_NAME = 'host_name' # Network attributes NET_ID = 'id' NET_NAME = 'name' NET_VLAN_ID = 'vlan_id' NET_VLAN_NAME = 'vlan_name' NET_PORTS = 'ports' CREDENTIAL_ID = 'credential_id' CREDENTIAL_NAME = 'credential_name' CREDENTIAL_USERNAME =...
{ "content_hash": "f238a41433eb9182c386ba5c1a60f8a9", "timestamp": "", "source": "github", "line_count": 91, "max_line_length": 78, "avg_line_length": 23.395604395604394, "alnum_prop": 0.7271019257867544, "repo_name": "gopal1cloud/neutron", "id": "9d8d7d5314ea5d4fb60235a2ef513383ba65857b", "size": "...
import PyBool_builder as pbb import PyBool_public_interface as pb import copy #This one memoizes. class MemoizeMutable: """ Memoize(fn) - an instance which acts like fn but memoizes its arguments Will work on functions with mutable arguments (slower than Memoize) """ def __init__(self, fn...
{ "content_hash": "36f8630d9a417c7cad194af537491155", "timestamp": "", "source": "github", "line_count": 219, "max_line_length": 78, "avg_line_length": 29.06392694063927, "alnum_prop": 0.5302435192458759, "repo_name": "KingsleyZ/PyBool", "id": "445722dee2954b81264d470a49e93e2ee7e654ce", "size": "692...
'''\ Welcome to the Salt repl which exposes the execution environment of a minion in a pre-configured Python shell __opts__, __salt__, __grains__, and __pillar__ are available. Jinja can be tested with full access to the above structures in the usual way: JINJA("""\\ I am {{ salt['cmd.run']('whoami') }}....
{ "content_hash": "386f2ebda3934a34073ee9d0826e88c9", "timestamp": "", "source": "github", "line_count": 136, "max_line_length": 84, "avg_line_length": 25.022058823529413, "alnum_prop": 0.6112253893623274, "repo_name": "stephane-martin/salt-debian-packaging", "id": "4167cebc924e2a2ac5c31f4c2c85ae848bb...
import generator import pyncs def Build(spec): model_type = spec["model_type"] parameters = pyncs.string_to_generator_map() parameters = {} for key, generator_spec in spec.items(): if key == "model_type": continue value_generator = generator.Build(generator_spec) value_generator.thisown = Fal...
{ "content_hash": "95712d7f03e1b149ecceaa1f4f817d51", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 90, "avg_line_length": 30.533333333333335, "alnum_prop": 0.7139737991266376, "repo_name": "BrainComputationLab/ncs", "id": "ccdb0f4149c5fcd4bf957082f92432f63d994e9b", "size...
import numpy as np from numba import cuda from numba.cuda.testing import unittest class TestArrayAttr(unittest.TestCase): def test_contigous_2d(self): ary = np.arange(10) cary = ary.reshape(2, 5) fary = np.asfortranarray(cary) dcary = cuda.to_device(cary) dfary = cuda.to_d...
{ "content_hash": "357a4f5ecd8adcabc812cb66c3654fe6", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 61, "avg_line_length": 32.91358024691358, "alnum_prop": 0.5926481620405101, "repo_name": "pitrou/numba", "id": "7bb586b15e0124ccd5060b952192548730318342", "size": "2666", ...
"""Implementation of acl command for cloud storage providers.""" from __future__ import absolute_import from gslib import aclhelpers from gslib.cloud_api import AccessDeniedException from gslib.cloud_api import BadRequestException from gslib.cloud_api import Preconditions from gslib.cloud_api import ServiceException ...
{ "content_hash": "730f2651b6171d2ed8ee8b58bfad27e5", "timestamp": "", "source": "github", "line_count": 459, "max_line_length": 87, "avg_line_length": 37.21568627450981, "alnum_prop": 0.6762674159934434, "repo_name": "ltilve/ChromiumGStreamerBackend", "id": "a63dcfe717b87411df801cd938abc140a2595273",...
from django.shortcuts import render_to_response from django.shortcuts import redirect from django.template import RequestContext from django.http import HttpResponseRedirect
{ "content_hash": "9e2ceb3be59c013182752e1b37f88f8c", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 47, "avg_line_length": 43.25, "alnum_prop": 0.8786127167630058, "repo_name": "xtornasol512/phyroserver", "id": "162cefa38e380ee7933a2f0367ab1bad6557fcbe", "size": "197", "...
""" Digit classification ==================== """ import numpy as np import matplotlib.pyplot as plt import deeppy as dp # Fetch MNIST data dataset = dp.dataset.MNIST() x_train, y_train, x_test, y_test = dataset.data(flat=True, dp_dtypes=True) # Normalize pixel intensities scaler = dp.StandardScaler() x_train = sc...
{ "content_hash": "8f17237974a97c36f843efa8161a619b", "timestamp": "", "source": "github", "line_count": 83, "max_line_length": 75, "avg_line_length": 26.397590361445783, "alnum_prop": 0.6211775445002282, "repo_name": "MohammedWasim/deeppy", "id": "40e0c68d9008850a090b7eab1da1901ef2954aa7", "size": ...
import os import re import sys try: from setuptools import setup except ImportError: from distutils.core import setup # Managed by bumpversion version = '0.4.4' def convert_md_to_rst(filename): try: import pypandoc rst = pypandoc.convert('{}.md'.format(filename), 'rst') except (IOError...
{ "content_hash": "5833315d22aee996863116853dc22144", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 70, "avg_line_length": 27.68354430379747, "alnum_prop": 0.5916780978509374, "repo_name": "tooreht/django-jsonsuit", "id": "b2507244604b02af8fe20b2017b349680b33cd55", "size"...
r""" Contains the class library that was generated while working on SPG's engineering challenge. """ from gdelt_data_processor import ( endpoints, event_data, last_updated_data, data_recipient, load_gdelt_event_data, )
{ "content_hash": "9c9b3c40c32e6b466453b33179268e49", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 62, "avg_line_length": 17.285714285714285, "alnum_prop": 0.7024793388429752, "repo_name": "AustinTSchaffer/DailyProgrammer", "id": "df4c50db4402c43707ec801b776ca33c211addcf",...
from pprint import pprint from django.contrib.auth.mixins import PermissionRequiredMixin from django.shortcuts import render from django.views import View from fo2.connections import db_cursor_so from utils.functions.views import cleanned_fields_to_context from estoque import classes, forms, models class Transfer...
{ "content_hash": "fc6374939b7e8e6ddfdbd1c127908073", "timestamp": "", "source": "github", "line_count": 115, "max_line_length": 96, "avg_line_length": 35.10434782608696, "alnum_prop": 0.5405003715630419, "repo_name": "anselmobd/fo2", "id": "00890fd6c406f070ccc49d9e8cf1ddd38dc98ddb", "size": "4040",...
""" The configuration file used by :py:mod:`agar.config` implementations and other libraries using the `google.appengine.api.lib_config`_ configuration library. Configuration overrides go in this file. """ from env_setup import setup; setup() ############################################################################...
{ "content_hash": "2e6ba3f40e79bed03338ac52fe80c4c0", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 98, "avg_line_length": 44, "alnum_prop": 0.5359848484848485, "repo_name": "agostodev/substrate", "id": "49714be2d1a632f3563427968a604f8eff8fb304", "size": "528", "binary"...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.errors import AnsibleParserError, AnsibleError, AnsibleAssertionError from ansible.module_utils.six import iteritems, string_types from ansible.module_utils._text import to_text from ansible.parsing.splitter import par...
{ "content_hash": "8b25f5ff2d06031889ab8fab1ab394a8", "timestamp": "", "source": "github", "line_count": 303, "max_line_length": 160, "avg_line_length": 38.16831683168317, "alnum_prop": 0.5814094249891916, "repo_name": "SergeyCherepanov/ansible", "id": "d23f2f2b9d1596ebe4bb9a75834afcd502adc1e7", "si...
import unittest from django.db import models from django.test.client import Client from django.contrib.auth.models import User, Group from django.contrib.comments.models import Comment from django.contrib.contenttypes.models import ContentType from django.contrib.sites.models import Site from actstream.signals import ...
{ "content_hash": "d836af7e716e20fc975d86277e27f5f3", "timestamp": "", "source": "github", "line_count": 109, "max_line_length": 147, "avg_line_length": 43.03669724770642, "alnum_prop": 0.6175655510552122, "repo_name": "whatsthehubbub/playpilots", "id": "34005e0313bba56fad92eff43e253fe2292f302c", "s...
import os import shutil import tempfile from bcbio.utils import file_exists from bcbio.bam import is_paired, _get_sort_order, sort from bcbio.pipeline import datadict as dd from bcbio.provenance import do from bcbio.distributed.transaction import file_transaction, tx_tmpdir from bcbio.pipeline import config_utils from ...
{ "content_hash": "aee94c51bb350ee6e2798572e2186601", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 101, "avg_line_length": 42.5360824742268, "alnum_prop": 0.6025206010664081, "repo_name": "Cyberbio-Lab/bcbio-nextgen", "id": "23963c91c9cfc41b7b312bbea2f4dd3412043861", "si...
import os from django.core.exceptions import ValidationError from django.db import models from django.utils.translation import ugettext_lazy as _ from model_utils import Choices from x_file_accel_redirects.conf import settings class AccelRedirect(models.Model): FILENAME_SOLVERS = Choices( (1, 'remaind...
{ "content_hash": "dd21e34c91630aaee3e55d530a4eec01", "timestamp": "", "source": "github", "line_count": 83, "max_line_length": 104, "avg_line_length": 34.21686746987952, "alnum_prop": 0.6232394366197183, "repo_name": "42cc/django-x-file-accel", "id": "e8dbc2b078ff89c38a5bf2dc905fa436ad475c3f", "siz...
from nltk.parse import load_parser from nltk.draw.tree import draw_trees from util import skolemize from nltk.sem import logic """ An implementation of the Hole Semantics model, following Blackburn and Bos, Representation and Inference for Natural Language (CSLI, 2005). The semantic representations are built by the g...
{ "content_hash": "929eddb03809e38120afc5679caaf081", "timestamp": "", "source": "github", "line_count": 357, "max_line_length": 95, "avg_line_length": 37.55182072829132, "alnum_prop": 0.5916007757720424, "repo_name": "tadgh/ArgoRevisit", "id": "f3c85cb2400566ac2cfeb66feece22f5b4fcbc69", "size": "13...
from __future__ import absolute_import, unicode_literals import logging from django import get_version from django.contrib.admin.options import ModelAdmin from django.contrib.admin.sites import AdminSite from django.db.models import CharField, Model from django.forms import Form, ModelForm from django.utils import un...
{ "content_hash": "ca1166c8826c81a98ff6bd37fe4f627c", "timestamp": "", "source": "github", "line_count": 251, "max_line_length": 76, "avg_line_length": 29.08764940239044, "alnum_prop": 0.615669086426517, "repo_name": "chripede/django-vies", "id": "b19ea120e5eca207dcc2e2b3ab4507bd41297899", "size": "...
choice = 0 cur_val_pow = 0 min_val_pow = 0 max_val_pow = 9750 cur_pct_pow = 0 min_pct_pow = 0 max_pct_pow = 100 while choice != -1: choice = int(input('Are you entering a (1) Power Percentage or a (2) Power Value? (Enter -1 to quit): ')) if choice == -1: break elif choice == 1: while (cur_p...
{ "content_hash": "5733c323b42597a2b5212d8bb2d39ab7", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 170, "avg_line_length": 49.3235294117647, "alnum_prop": 0.5438282647584973, "repo_name": "emakris1/Testing", "id": "df95197b9b89ad68cdc56fe5c906fd65fe4d1208", "size": "1697...
""" Bug tracker tools. """ import abc import urllib from docutils import nodes from .tool import Tool, Role class BugTracker(Tool): """Abstract class for bug tracker tools.""" __metaclass__ = abc.ABCMeta def __init__(self, project_name): self.project_name = project_name super(BugTracke...
{ "content_hash": "26739aff1cb95123ce33e8a252411eb0", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 74, "avg_line_length": 24.797101449275363, "alnum_prop": 0.614260666277031, "repo_name": "Kozea/sitenco", "id": "33c4ec789441bd1e0e2120dbd91d7b0f60bcd468", "size": "1711", ...
import sys from unittest import mock from neutron.tests import base from neutron.tests import post_mortem_debug class TestTesttoolsExceptionHandler(base.BaseTestCase): def test_exception_handler(self): try: self.fail() except Exception: exc_info = sys.exc_info() w...
{ "content_hash": "a6c51887237eac1c3a57a45aefe53f3c", "timestamp": "", "source": "github", "line_count": 95, "max_line_length": 77, "avg_line_length": 35.305263157894736, "alnum_prop": 0.586463923673226, "repo_name": "mahak/neutron", "id": "15244d949615c0cd1a85f74164e887ec15befcc4", "size": "3956", ...
import json import sys import logging import requests import os import datetime from flask import Flask, jsonify, request, make_response from flask.ext.cache import Cache from dateutil import parser httpSuccessCode = 200 wundergroundBaseUrl = "http://api.wunderground.com/api/" wundergroundConditions = "/conditions/q...
{ "content_hash": "94fcda346ee5211fe41069b598925867", "timestamp": "", "source": "github", "line_count": 344, "max_line_length": 182, "avg_line_length": 36.19767441860465, "alnum_prop": 0.5918727915194346, "repo_name": "brogersyh/Dockerfiles-for-Linux", "id": "94e42c83259276630c6294e9fc6058cca8fd003d"...
from __future__ import division, print_function import numpy as np import scipy.stats import os import logging from astropy.tests.helper import pytest from astropy.modeling import models from astropy.modeling.fitting import _fitter_to_model_params from stingray import Powerspectrum from stingray.modeling import Para...
{ "content_hash": "b8f1c5c05709a07f6344965cfdf010ec", "timestamp": "", "source": "github", "line_count": 1387, "max_line_length": 89, "avg_line_length": 31.346070656092287, "alnum_prop": 0.5453458150286359, "repo_name": "pabell/stingray", "id": "677ff3ce5726a0a8d8dda9b4f365c48d43012c5e", "size": "43...
import paramiko import os def open_ssh_session(ip_address, dns_address, login, passw): '''initiate open session with explicit netobject''' ssh = paramiko.SSHClient() # https://github.com/onyxfish/relay/issues/11 ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) if ip_address: # there mus...
{ "content_hash": "4d0c816ec11c2d9528977521c10e9f40", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 110, "avg_line_length": 40.29032258064516, "alnum_prop": 0.655724579663731, "repo_name": "Landver/netmon", "id": "0780ad5e83310d9f5ae3aee468e5c66d4a976744", "size": "1249",...
def request(context, flow): if "application/x-www-form-urlencoded" in flow.request.headers["content-type"]: form = flow.request.get_form_urlencoded() form["mitmproxy"] = ["rocks"] flow.request.set_form_urlencoded(form)
{ "content_hash": "e10fb2971ef8bd7474d9e2a375ca8d37", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 83, "avg_line_length": 49.2, "alnum_prop": 0.6707317073170732, "repo_name": "devasia1000/anti_adblock", "id": "3d93e392d7f2d0d8f599692e3eab60999c509fdb", "size": "247", "b...
from .network_interfaces_operations import NetworkInterfacesOperations from .application_gateways_operations import ApplicationGatewaysOperations from .express_route_circuit_authorizations_operations import ExpressRouteCircuitAuthorizationsOperations from .express_route_circuit_peerings_operations import ExpressRouteCi...
{ "content_hash": "c6018bfa6f47aef46f0764c108dfca52", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 104, "avg_line_length": 51.549019607843135, "alnum_prop": 0.8535564853556485, "repo_name": "AutorestCI/azure-sdk-for-python", "id": "9fc62b57d75af13897e776c1f2d493c9e60ff59c"...
"""Tests for io_utils.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys import six from tensorflow.python.keras import keras_parameterized from tensorflow.python.keras.utils import io_utils from tensorflow.python.platform import test class ...
{ "content_hash": "fc08d6357795a3c3ed387ded01e0f210", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 80, "avg_line_length": 30.10909090909091, "alnum_prop": 0.6708937198067633, "repo_name": "cxxgtxy/tensorflow", "id": "a0ead4ee623c4974866f9e6c155aac14d1a78338", "size": "23...
"""\ grip.command ~~~~~~~~~~~~ Implements the command-line interface for Grip. Usage: grip [options] [<path>] [<address>] grip -V | --version grip -h | --help Where: <path> is a file to render or a directory containing README.md (- for stdin) <address> is what to listen on, of the form <host>[:<port>], or...
{ "content_hash": "a73cc93a66a00f1eec64435fbb3059d6", "timestamp": "", "source": "github", "line_count": 139, "max_line_length": 78, "avg_line_length": 34.510791366906474, "alnum_prop": 0.5899520533666875, "repo_name": "joeyespo/grip", "id": "3fcb0ded4c172d84d24fdfa8660f77d01a1b3b50", "size": "4797"...
"""Tests for functions.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import time import numpy as np from six.moves import xrange # pylint: disable=redefined-builtin import tensorflow as tf from tensorflow.python.framework import function from tenso...
{ "content_hash": "d65772bad7a05f5df78c983362b854b0", "timestamp": "", "source": "github", "line_count": 460, "max_line_length": 79, "avg_line_length": 35.517391304347825, "alnum_prop": 0.5686742563349247, "repo_name": "RyanYoung25/tensorflow", "id": "6728d31a25472f721d0e4a0bc47bfbe8dc1cb340", "size...
import numpy as np from scipy.spatial.distance import pdist, squareform from .tasks import _fast_geo from .constants import ISPY3 from tree_distance import PhyloTree GOLDEN = (np.sqrt(5)-1)/2 # Functions for OutOfSampleMDS def _eigen(mtx, inverse=False): if np.allclose(mtx, mtx.T): fn = np.linalg.eigh ...
{ "content_hash": "5a4bee8ef247a2a779c1b5c12c8210c4", "timestamp": "", "source": "github", "line_count": 487, "max_line_length": 139, "avg_line_length": 32.6570841889117, "alnum_prop": 0.579728370221328, "repo_name": "kgori/treeCl", "id": "af509df7aea947befd68d458844661ed88d8cb20", "size": "15904", ...
""" Testing the generation of the classes for the rest api """ import pytest import responses from rest_client.generate_classes import generate_classes from rest_client.generate_classes import get_provided_classes, get_class_meta from rest_client.generate_classes import get_objects from .rest_responses import PRODUCT_...
{ "content_hash": "345d7763d40552818124c3b62fdfe5fc", "timestamp": "", "source": "github", "line_count": 129, "max_line_length": 99, "avg_line_length": 42, "alnum_prop": 0.6552233296419343, "repo_name": "RedBeardCode/QDjConChart", "id": "cace301e39ae04ee39c3258baa2411e4bccb71f4", "size": "5468", "...
from pprint import pprint from libcloud.compute.types import Provider from libcloud.compute.providers import get_driver cls = get_driver(Provider.NTTA) driver = cls("my username", "my password", region="ntta-na") pprint(driver.list_nodes())
{ "content_hash": "7e9b3fc982ec2edf32d07debe739b022", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 60, "avg_line_length": 27.11111111111111, "alnum_prop": 0.7745901639344263, "repo_name": "mistio/libcloud", "id": "406ba728af7d3c0e19110349c8951220ed69138f", "size": "244", ...
from django.core.urlresolvers import reverse from django.template import defaultfilters as filters from django.utils import http from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy from horizon_lib import exceptions from horizon_lib import tables from openstack_...
{ "content_hash": "0d54e0ec063bc6e8dd691d110b710e59", "timestamp": "", "source": "github", "line_count": 328, "max_line_length": 79, "avg_line_length": 32.06707317073171, "alnum_prop": 0.5975470621791215, "repo_name": "mrunge/openstack_horizon", "id": "596a1a419ac060e00aa8e160c24a7b3c499a346f", "siz...
import controllers from app import app def run_server(): app.run() if __name__ == "__main__": run_server()
{ "content_hash": "f3bcf01364e5a008de3d60ff60225184", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 26, "avg_line_length": 11.9, "alnum_prop": 0.5882352941176471, "repo_name": "drkitty/checklist", "id": "76839701f860d40902e380afaad43889c9af0234", "size": "142", "binary"...
import pytest import httpretty from requests.exceptions import HTTPError from .fixtures import pretty_api from zipa import api_test_com as t @pytest.mark.httpretty def test_iter_returns_single_object(pretty_api): t.config.secure = False for item in t.item['a']: assert item.name == 'a' @pytest.mark...
{ "content_hash": "36a7271ce0e63a561ae7676cfeb93b20", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 64, "avg_line_length": 23.47222222222222, "alnum_prop": 0.621301775147929, "repo_name": "PressLabs/zipa", "id": "cdc422f23aa03acc6e4e154cff44051b47b9da67", "size": "845", ...
from django.shortcuts import redirect from django.conf import settings __all__ = [ 'LoginRequiredMiddleware', ] class LoginRequiredMiddleware(): ''' This middleware flips Djangos default login_required usage. By default, all views are login required You can use the @public decorator to make a fun...
{ "content_hash": "23be19f89f8d19506e60cfe9b9b36994", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 104, "avg_line_length": 39.074074074074076, "alnum_prop": 0.5753554502369668, "repo_name": "jamesmfriedman/django-primer", "id": "17eb1bb10254140a81c1012a157259d09bc4e8d3", ...
""" This module gathers tree-based methods, including decision, regression and randomized trees. Single and multi-output problems are both handled. """ # Authors: Gilles Louppe <[email protected]> # Peter Prettenhofer <[email protected]> # Brian Holt <[email protected]> # Noel Da...
{ "content_hash": "a296289f559379452f98a30bb640a5c1", "timestamp": "", "source": "github", "line_count": 1024, "max_line_length": 83, "avg_line_length": 39.5009765625, "alnum_prop": 0.573067319340404, "repo_name": "DailyActie/Surrogate-Model", "id": "fbc32e8613f06baeede79887646e86f7b7fd4d67", "size"...
from ...online_crowdsourcing import * import json import yaml import math import os import numpy as np import random import urllib import time BASE_URL = "sbranson.no-ip.org/bluebirds" NUM_COLS = 3 # Crowdsourcing for binary classification. Incorporates a worker skill and image difficulty model class C...
{ "content_hash": "ff7fc4cbf2b13af2b35f8780d10c2ca9", "timestamp": "", "source": "github", "line_count": 212, "max_line_length": 252, "avg_line_length": 60.094339622641506, "alnum_prop": 0.6972527472527472, "repo_name": "sbranson/online_crowdsourcing", "id": "a87b66d732ee252bfc942312ee32589e4032fa75",...
"""The Python datastore API used by app developers. Defines Entity, Query, and Iterator classes, as well as methods for all of the datastore's calls. Also defines conversions between the Python classes and their PB counterparts. The datastore errors are defined in the datastore_errors module. That module is only requ...
{ "content_hash": "16508a749d35c7e8281f00b0e225ba15", "timestamp": "", "source": "github", "line_count": 2865, "max_line_length": 99, "avg_line_length": 31.386387434554972, "alnum_prop": 0.6731278218900825, "repo_name": "ychen820/microblog", "id": "f01e9bb2162fa947b2d8ed78fae1c002dd190e3a", "size": ...
"""Handle remote configuration inputs specified via S3 buckets. """ import os import yaml from bcbio.distributed import objectstore from bcbio import utils def load_s3(sample_config): """Move a sample configuration locally, providing remote upload. """ with objectstore.open(sample_config) as in_handle: ...
{ "content_hash": "49619955aea6e4d327168d82a17d0713", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 108, "avg_line_length": 47.05084745762712, "alnum_prop": 0.5979827089337176, "repo_name": "brainstorm/bcbio-nextgen-vm", "id": "4d2a4c1b51da7357ee166b15e9453695b74f3450", "...
import random from django.core.management.base import BaseCommand from django.contrib.auth.models import User from ...models import ( Transcript, TranscriptPhraseVote ) from ...tasks import update_transcript_stats class Command(BaseCommand): help = 'Creates random votes for 5 phrases in a random transcript'...
{ "content_hash": "72ab0b1163630fd32af8a667ec9c8080", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 70, "avg_line_length": 30.892857142857142, "alnum_prop": 0.623121387283237, "repo_name": "WGBH/FixIt", "id": "c66e9c7d17d0d52e9f800e1c389d1aa23d77c64f", "size": "865", "b...
from bottle import route, static_file, debug, run, get, redirect #from bottle import post, request import os, re, inspect import json #enable bottle debug debug(True) # WebApp route path routePath = '/RpiMonitor' # get directory of WebApp (pyWebMOC.py's dir) rootPath = os.path.dirname(os.path.abspath(inspect.getfile(...
{ "content_hash": "5ee7972eb3321b4330d76da3676d1bc7", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 84, "avg_line_length": 28.80327868852459, "alnum_prop": 0.6898121798520205, "repo_name": "dmitryikh/rpi-monitor", "id": "d05c729b7bb21810629eb12c0a0eb64e5e489749", "size": ...
from sys import maxsize class Group: def __init__(self, name=None, header=None, footer=None, gr_id=None): self.name = name self.header = header self.footer = footer self.id = gr_id def __repr__(self): return "%s:%s; %s; %s" % (self.id, self.name, self.header, self.foote...
{ "content_hash": "ecff25aa658966f0416e8b543267a1d4", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 103, "avg_line_length": 28.45, "alnum_prop": 0.5553602811950791, "repo_name": "lyudmill/python_training", "id": "2a956017117cee47193833b9eb15d97c6bb7795f", "size": "569", ...
import unittest from tkp.db.configstore import store_config, fetch_config from tkp.db import rollback, execute, Database from tkp.db.general import insert_dataset from tkp.testutil.decorators import requires_database from sqlalchemy.exc import IntegrityError config = {'section1': {'key1': 'value1', 'key2': 2}, ...
{ "content_hash": "d69eedcc310f2fd578fdbeeb1168fc54", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 79, "avg_line_length": 33.8955223880597, "alnum_prop": 0.6129458388375165, "repo_name": "mkuiack/tkp", "id": "831c1ecffe729694f332d2934635d15a4f2980b7", "size": "2271", "...
from pyjamas import DOM from pyjamas import Factory from pyjamas.ui.Widget import Widget class Frame(Widget): _props = [("url", "Url", "Url", None), ] def __init__(self, url="", Element=None, **kwargs): kwargs['Url'] = kwargs.get('Url', url) self.setElement(Element or DOM.createI...
{ "content_hash": "c7a32b01663f334e205c759a89065380", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 62, "avg_line_length": 25.62962962962963, "alnum_prop": 0.619942196531792, "repo_name": "damoti/pyjx-gwt", "id": "fad39743fffbafa6d63ad6ac625cdcb0f0cda4ff", "size": "1351",...
import os DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', '[email protected]'), ) MANAGERS = ADMINS PROJECT_ROOT = os.path.dirname(os.path.dirname(__file__)) DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(PROJECT_ROOT, 'example.db'...
{ "content_hash": "f2f91a049a4ad37e920c2038f5026503", "timestamp": "", "source": "github", "line_count": 100, "max_line_length": 98, "avg_line_length": 23.48, "alnum_prop": 0.6316013628620102, "repo_name": "fusionbox/django_polymorphic", "id": "05a5c1f5b47ef9c55d50fa82073d59d1280f3e6c", "size": "234...
from __future__ import with_statement import contextlib import sys from .interfaces import Connectable from .interfaces import ExceptionContext from .util import _distill_params from .util import _distill_params_20 from .util import TransactionalContext from .. import exc from .. import inspection from .. import log ...
{ "content_hash": "f201e28f1411a7235203c15b5afbe90f", "timestamp": "", "source": "github", "line_count": 3323, "max_line_length": 84, "avg_line_length": 35.729762263015346, "alnum_prop": 0.5894045312894803, "repo_name": "monetate/sqlalchemy", "id": "2444b5c7fe1a3d351d956e75e52a0a61dec683e6", "size":...
"""Change the reference to Qt frameworks. Typical usage: % change_qt_reference_mac.py --qtdir=/path/to/qtdir/ \ --target=/path/to/target.app/Contents/MacOS/target """ __author__ = "horo" import optparse import os from util import PrintErrorAndExit from util import RunOrDie def ParseOption(): """Parse c...
{ "content_hash": "a863234383565eb1287fed5caa758631", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 77, "avg_line_length": 24.75438596491228, "alnum_prop": 0.6654854712969526, "repo_name": "takahashikenichi/mozc", "id": "0305b84ce7cb40fdd9d547d2f63198efdb327eda", "size": ...
import os import shutil import sys import random import tempfile import mlflow from mlflow import ( log_metric, log_param, log_artifacts, get_artifact_uri, active_run, get_tracking_uri, log_artifact, MlflowClient, ) if __name__ == "__main__": print("Running {} with tracking URI {}"...
{ "content_hash": "18f8465c9f5b6d55df47ce6e03257ef1", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 84, "avg_line_length": 28.46511627906977, "alnum_prop": 0.6160130718954249, "repo_name": "mlflow/mlflow", "id": "00103d71594ca41b64c5f9c32b203b628910fd1a", "size": "1224", ...
from setuptools import find_packages, setup import os from aima import __version__ as version from aima import __authors__, __github_url__ from aima import __doc__ as description from aima import __name__ as package_name print('Installing package named {0}. . .'.format(package_name)) try: from pip.req import pa...
{ "content_hash": "88c490b88415674d6320d343d4b6fc4c", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 179, "avg_line_length": 40.96666666666667, "alnum_prop": 0.6663954434499593, "repo_name": "hobson/aima", "id": "602f1dc51d2118a1f4659088e9a51fb05d4329d3", "size": "2525", ...
""" ========================== Display images for MEG ========================== """ import numpy as np from expyfun import visual, ExperimentController from expyfun.io import write_hdf5 import time from PIL import Image import os from os import path as op import glob # background color testing = False test_trig = [15...
{ "content_hash": "3e6a666c858e1fc429ca12fbd5fe9fe5", "timestamp": "", "source": "github", "line_count": 250, "max_line_length": 120, "avg_line_length": 31.984, "alnum_prop": 0.5947973986993497, "repo_name": "yeatmanlab/BrainTools", "id": "5f2b4159839d47a92ac201d960c18692d275bb91", "size": "7996", ...
import os import time import pandas as pd import cmapPy.pandasGEXpress.write_gctx as write_gctx import cmapPy.pandasGEXpress.write_gct as write_gct import cmapPy.pandasGEXpress.parse as parse import cmapPy.pandasGEXpress.subset_gctoo as sg # for storing timing results gct_times = {} gctx_times = {} # large input gctx...
{ "content_hash": "2631f2b69b0ff91127eaa98d10f9398c", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 78, "avg_line_length": 32.28888888888889, "alnum_prop": 0.6971782518926359, "repo_name": "cmap/cmapPy", "id": "317f3b4f29f269efaf30d80c7f8f48ccdeac06bc", "size": "1758", ...
"""restructuredText Exporter class""" #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #-------...
{ "content_hash": "da2520151b2ab0697e378a4946128a9f", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 78, "avg_line_length": 31.625, "alnum_prop": 0.433201581027668, "repo_name": "initNirvana/Easyphotos", "id": "731e9785e62a589b713fb880e762982b33e4f695", "size": "1265", "...
from django.core.urlresolvers import reverse from django.test import Client from funfactory.helpers import urlparams from nose.tools import eq_, ok_ from mozillians.common.tests import TestCase, requires_login, requires_vouch from mozillians.groups.models import GroupMembership from mozillians.groups.tests import Gro...
{ "content_hash": "0ff1da78bc19ad4d828415eb4d427736", "timestamp": "", "source": "github", "line_count": 569, "max_line_length": 95, "avg_line_length": 43.300527240773285, "alnum_prop": 0.641326406364153, "repo_name": "anistark/mozillians", "id": "b10f77a7b14bf951efc1950cdeec4e988a3b7d2b", "size": "...
class Calculadora(): def __init__(self): self.op1 = None self.op2 = None self.sinal = None self.__operacoes = {} def calcular(self): operacao_escolhida = self.__operacoes.get(self.sinal) return operacao_escolhida.calcular(self.op1, self.op2) def ...
{ "content_hash": "815f4b4fd5fca8bb2f2fd2ae3db9224d", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 73, "avg_line_length": 27.12280701754386, "alnum_prop": 0.5847347994825356, "repo_name": "renzon/evento-python-para-javeiros", "id": "6ac5339ea2b774d0d516d320575e784a0e5d4f1b...
""" This file (test_crud.py) contains the unit tests for CRUD operations in hydrus.data.crud. """ import random import uuid from hydra_python_core.doc_writer import HydraLink, DocUrl import hydrus.data.crud as crud from hydrus.data.exceptions import PropertyNotGiven from tests.conftest import gen_dummy_object def t...
{ "content_hash": "a87e11142917c889e92e01ca82cf80f0", "timestamp": "", "source": "github", "line_count": 291, "max_line_length": 101, "avg_line_length": 41.96907216494845, "alnum_prop": 0.6036190944075984, "repo_name": "HTTP-APIs/hydrus", "id": "1887016274c94c392062e55597da16b370fdfe3e", "size": "12...
""" This is a self genrated test created by scaffolding.py. you will need to fill it up with all your necessities. Safe hacking :). """ from zope.interface import implements from twisted.python import usage from twisted.plugin import IPlugin from ooni.plugoo.tests import ITest, OONITest from ooni.plugoo.assets import A...
{ "content_hash": "af44a718b7b73a141c34e32191462d46", "timestamp": "", "source": "github", "line_count": 94, "max_line_length": 92, "avg_line_length": 33, "alnum_prop": 0.5918762088974855, "repo_name": "hackerberry/ooni-probe", "id": "358f1eaae634af0f8a952b370a17bbe99aa4ae30", "size": "3102", "bin...
from rest_framework import serializers from task_board.tasks.models import Task, TaskStatuses class TaskSerializer(serializers.ModelSerializer): created_by_username = serializers.StringRelatedField(source='created_by') accomplished_by_username = serializers.StringRelatedField(source='accomplished_by') st...
{ "content_hash": "81178f5c3b9de09081724a29177a04b8", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 87, "avg_line_length": 42.58620689655172, "alnum_prop": 0.6234817813765182, "repo_name": "AlexanderKaluzhny/taskboard", "id": "8e31b2dac8489336cd1e06cecbc5aadc0d2594bb", "s...
from __future__ import annotations from typing import NamedTuple from marshmallow import Schema, fields from airflow.api_connexion.schemas.common_schema import ( ClassReferenceSchema, ColorField, TimeDeltaSchema, WeightRuleField, ) from airflow.api_connexion.schemas.dag_schema import DAGSchema from a...
{ "content_hash": "b0a4299f1be7671f66fa1f6aa9836f89", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 93, "avg_line_length": 33.94871794871795, "alnum_prop": 0.7077039274924471, "repo_name": "nathanielvarona/airflow", "id": "89c1fa68c52acd22010b09df35f097eee34426a4", "size"...
from eutester import Eutester import boto from boto.ec2.regioninfo import RegionInfo class CFNops(Eutester): def __init__(self, endpoint=None, path=None, port=None, region=None, credpath=None, aws_access_key_id=N...
{ "content_hash": "adf3f39f5a52296619ca4a7fcba734fc", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 121, "avg_line_length": 43.166666666666664, "alnum_prop": 0.4781704781704782, "repo_name": "nephomaniac/eutester", "id": "83a3000745186cec52f2ad997bf6f0cf6fee4f9b", "size":...