text stringlengths 4 1.02M | meta dict |
|---|---|
"""Generate a config file for fakezk topology."""
__author__ = 'enisoc@google.com (Anthony Yeh)'
import base64
import codecs
import json
class FakeZkConfig(object):
"""Create fakezk config for use as static topology for vtgate."""
def __init__(self, mysql_port, cell='test_cell', host='127.0.0.1'):
self.key... | {
"content_hash": "b25c3dafa0592169251c03904d364434",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 77,
"avg_line_length": 29.5,
"alnum_prop": 0.5295866785608088,
"repo_name": "yangzhongj/vitess",
"id": "85db901b9805c39c4afbb03ea5429a0f2281e05f",
"size": "3414",
"binar... |
"""Bucket sort task for generalization."""
import functools
from typing import Mapping
import chex
import jax
from jax import nn as jnn
from jax import numpy as jnp
from jax import random as jrandom
from neural_networks_chomsky_hierarchy.tasks import task
class BucketSort(task.GeneralizationTask):
"""A task whic... | {
"content_hash": "60865df6c831dd2b2696c18dc47346de",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 80,
"avg_line_length": 29.686567164179106,
"alnum_prop": 0.6561085972850679,
"repo_name": "deepmind/neural_networks_chomsky_hierarchy",
"id": "7415a757df96ccda4eb47cc4cfbe8f3... |
from flask.ext.wtf import Form
from wtforms import TextField, BooleanField
from wtforms.validators import Required
class LoginForm(Form):
openid = TextField('openid', validators = [Required()])
remember_me = BooleanField('remember_me', default = False) | {
"content_hash": "be8102ef28268086b636e07457f1d566",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 62,
"avg_line_length": 38.142857142857146,
"alnum_prop": 0.7453183520599251,
"repo_name": "code-haven/flask-microblog",
"id": "6d88d413e1ed616cfc66ce3076706d405fc5fccd",
"si... |
import boto3
# Create SQS client
sqs = boto3.client('sqs')
queue_url = 'SQS_QUEUE_URL'
# Send message to SQS queue
response = sqs.send_message(
QueueUrl=queue_url,
DelaySeconds=10,
MessageAttributes={
'Title': {
'DataType': 'String',
'StringValue': 'The Whistler'
... | {
"content_hash": "65ad82c1908433b662cfe9e28713120a",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 68,
"avg_line_length": 20.848484848484848,
"alnum_prop": 0.5305232558139535,
"repo_name": "imshashank/aws-doc-sdk-examples",
"id": "3eb4bb45008047ffe3fcfe6080fcbff603e48b7d",... |
import logging
from types import NoneType
from enum import Enum
from framework.plugin_loader import get_plugin, get_config
from intercom import ResourceNotFound
from intercom.tag import Tag
from intercom.user import User
from mcfw.rpc import arguments, returns
from plugins.intercom_support.intercom_support_plugin impo... | {
"content_hash": "8a772c2058fcb75d16b5c05445e6a1e0",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 116,
"avg_line_length": 38.15277777777778,
"alnum_prop": 0.7186021113942482,
"repo_name": "threefoldfoundation/app_backend",
"id": "e221c5273ce060bb44bf667e80462c13a3f7f473",... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='sites',
fiel... | {
"content_hash": "1c2af0655e866484841b65194946bda6",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 99,
"avg_line_length": 24,
"alnum_prop": 0.6052631578947368,
"repo_name": "ugoertz/django-familio",
"id": "a92b2ef906c55cc50330f48ec1afd1837b24f222",
"size": "480",
"bina... |
from __future__ import unicode_literals
import os.path
import glob
import errno
from lnc.plugins.base_plugin import BasePlugin
from lnc.lib.process import cmd_try_run, cmd_run, _COMMAND_NOT_FOUND_MSG
from lnc.lib.io import mkdir_p, filter_regexp, needs_update
from lnc.lib.exceptions import ProgramError
def handler(... | {
"content_hash": "73e8ec06a16a7866568f73e805ed4c0a",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 78,
"avg_line_length": 32.65151515151515,
"alnum_prop": 0.5470997679814386,
"repo_name": "atrosinenko/lecture-notes-compiler",
"id": "49adf8d60619eee06a5ffc95646ecacd835e722c... |
import os
import json
inverse_ohlc_ratio = None
sym_sid_map = None
sid_sym_map = None
sid_name_map = None
ohlc_ratio = None
inverse_ohlc_ratio = None
inverse_ohlc_ratio_instrument = None
def sid(symbol):
"""
Returns the arbitrary id assigned to the instrument
symbol.
See broker/oanda_instruments... | {
"content_hash": "c028dd596ea016788724e90ccabe6082",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 101,
"avg_line_length": 27.265822784810126,
"alnum_prop": 0.6541318477251625,
"repo_name": "bernoullio/toolbox",
"id": "1bf11074fffaf5f27ffb7c34d6051668ff8187b6",
"size": "... |
import pytest
import unittest
from modules.sfp_onyphe import sfp_onyphe
from sflib import SpiderFoot
from spiderfoot import SpiderFootEvent, SpiderFootTarget
@pytest.mark.usefixtures
class TestModuleOnyphe(unittest.TestCase):
def test_opts(self):
module = sfp_onyphe()
self.assertEqual(len(module... | {
"content_hash": "48af1b583984f4533bc6fd6cd3fb0282",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 81,
"avg_line_length": 29.53061224489796,
"alnum_prop": 0.663441603317208,
"repo_name": "smicallef/spiderfoot",
"id": "2a7a930b77e07a6fc8ecf2cbd66e31b81744d9ae",
"size": "1... |
from commands.cmds.BaseCommand import *
from packet.send import chat
class cmd(BaseCommand):
def process(self):
self.osc = self.cmdobj['scope']
chat(self.osc, self.jsconcat(), 1)
def jsconcat(self):
self.plugins = self.osc.plugins
self.pcount = len(self.plugins)
return "... | {
"content_hash": "7f965cd9a93c4d797145004df26a8f1c",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 79,
"avg_line_length": 34.81818181818182,
"alnum_prop": 0.6292428198433421,
"repo_name": "Armored-Dragon/pymineserver",
"id": "4f32652d741b3847af3e882303c24d3f9a5abda6",
"s... |
import os
from nose import SkipTest
from funtests import transport
class test_SQS(transport.TransportCase):
transport = 'SQS'
prefix = 'sqs'
event_loop_max = 100
message_size_limit = 4192 # SQS max body size / 2.
reliable_purge = False
#: does not guarantee FIFO order, even in simple cases
... | {
"content_hash": "b3ebe94ccbf93a5cda6ec0285b11eaa6",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 66,
"avg_line_length": 29.25,
"alnum_prop": 0.645909645909646,
"repo_name": "jindongh/kombu",
"id": "31f689b21646e1e07a2bd799b7d047689ea862a3",
"size": "819",
"binary": f... |
from django.apps import AppConfig
class ImagerProfileConfig(AppConfig):
name = 'imager_profile'
def ready(self):
from imager_profile import handlers
| {
"content_hash": "b81e4d0536de2e764c2aca90f10ba831",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 43,
"avg_line_length": 21,
"alnum_prop": 0.7261904761904762,
"repo_name": "nadiabahrami/django-imager",
"id": "48b4d32603cc4235e00d0537e51207738123a9be",
"size": "168",
"b... |
from __future__ import absolute_import
from google.appengine.ext import ndb
import model
import util
import config
from .counter import CountableLazy
from .icon import Iconize
from .collection import Collection, AddCollection
"""
A tag consists of three model classes:
TagStructure: Which holds all tag specific dat... | {
"content_hash": "e93bb7567e9efa220b3e5daae51403fd",
"timestamp": "",
"source": "github",
"line_count": 610,
"max_line_length": 116,
"avg_line_length": 36.442622950819676,
"alnum_prop": 0.5560053981106613,
"repo_name": "wodore/wodore-ng",
"id": "0bef6aa8ce4298150161df6b507e4a1c19d320c9",
"size": "2... |
"""empty message
Revision ID: 3ad5422060a7
Revises: d0ff2f23d725
Create Date: 2016-05-19 00:01:43.633946
"""
# revision identifiers, used by Alembic.
revision = '3ad5422060a7'
down_revision = 'd0ff2f23d725'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | {
"content_hash": "0b50abdbfd0552f4954f225360bcf1ba",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 80,
"avg_line_length": 24.833333333333332,
"alnum_prop": 0.687248322147651,
"repo_name": "WillSkywalker/blog",
"id": "6b2f824d489ace42638cbd168b726d78c1a6d240",
"size": "74... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('smsforms', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='sqlxformssession',
name='current_action_due',
field=models.DateTimeField(nu... | {
"content_hash": "b7628a592bb8b2b85203dd2085e91c95",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 114,
"avg_line_length": 32.527272727272724,
"alnum_prop": 0.5645612073784237,
"repo_name": "dimagi/commcare-hq",
"id": "523e53ee0a2c7019da11cc7c07bf74e37a6da61e",
"size": "... |
import urllib
from cStringIO import StringIO
from nose.tools import eq_, ok_, assert_raises
import mock
from airmozilla.base.tests.testbase import DjangoTestCase
from airmozilla.main.models import Event, VidlySubmission
from airmozilla.manage import vidly
def get_custom_XML(**kwargs):
return (
'<?xml v... | {
"content_hash": "cba99fbe80bf4bbf9982aa93485e5a80",
"timestamp": "",
"source": "github",
"line_count": 506,
"max_line_length": 79,
"avg_line_length": 35.541501976284586,
"alnum_prop": 0.5728425266903915,
"repo_name": "Nolski/airmozilla",
"id": "dcbdaacd823e440fccf0e3c116ade7bfd79268e3",
"size": "1... |
"""Main Application Controllers"""
import functools
import hashlib
import httplib2
import os.path
import uuid
import socket
from collections import OrderedDict
import time
from datetime import datetime
from functools import partial
import zmq
import json
import ConfigParser
from flask import ( Flask, render_template,... | {
"content_hash": "d8fb4b311b0df9c7a13d0872c0a69ab9",
"timestamp": "",
"source": "github",
"line_count": 641,
"max_line_length": 121,
"avg_line_length": 40.522620904836195,
"alnum_prop": 0.6179788257940327,
"repo_name": "mambocab/cstar_perf",
"id": "8eb116cfb442d78148cdf370fa22e37a2f1051b5",
"size":... |
from __future__ import unicode_literals
from importlib import import_module
from django.apps import apps
from django.core.management import call_command
from django.core.management.base import BaseCommand, CommandError
from django.db import connections, DEFAULT_DB_ALIAS
from django.db.migrations.loader import Migration... | {
"content_hash": "165e6fff29d93b9126f618df952f9db0",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 103,
"avg_line_length": 41.88659793814433,
"alnum_prop": 0.584051193699237,
"repo_name": "VantageAnalytics/django-migration-sniffer",
"id": "593ff98d2bb2d7cef00d525616f656444... |
import httplib
import urllib, urllib2
import json
import base64
import functools
import logging
import time
class RequestApi(object):
TimeOut = 3
DEBUG_LEVEL = 1
HOST = "api.douban.com"
@classmethod
def request(cls, method, path, params, headers={}, host=''):
"""test --- http://api.doub... | {
"content_hash": "432202b1dd36cdbf90a563efe8e13353",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 107,
"avg_line_length": 30.384615384615383,
"alnum_prop": 0.5569620253164557,
"repo_name": "lisawei/api_automate_test",
"id": "1d902e1bd8e2acd637a05c27f6478767854beeaa",
"s... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
docs_dir = os.path.dirname(os.path.abspath(__file__))
project_dir ... | {
"content_hash": "5cb30cd1c93c4c81062c0100a2d3096b",
"timestamp": "",
"source": "github",
"line_count": 239,
"max_line_length": 90,
"avg_line_length": 32.74058577405858,
"alnum_prop": 0.7056869009584664,
"repo_name": "pgollakota/django-chartit",
"id": "7174c50678d9bc5b1e5f969cdb0798e576965d22",
"si... |
from asynctnt_queue import Queue, Tube, Task
from asynctnt_queue.task import Status
from tests import BaseTarantoolTestCase
class TubeTestCase(BaseTarantoolTestCase):
def create_tube(self):
q = Queue(self.conn)
return q.tube("test_tube")
def _data_obj(self):
return {
'key'... | {
"content_hash": "610d754c32086682863c1678075003a3",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 77,
"avg_line_length": 35.45522388059702,
"alnum_prop": 0.6002946748053042,
"repo_name": "igorcoding/asynctnt-queue",
"id": "8d641bda4b3d5f6a22347976dcd59553a5a547a5",
"si... |
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import values
from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
from twilio.base.page import Page
class SinkValidateList(ListResource):... | {
"content_hash": "1e792e207e950d9a24a16ccf29802aed",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 108,
"avg_line_length": 31.57037037037037,
"alnum_prop": 0.6377287658376349,
"repo_name": "twilio/twilio-python",
"id": "644778060e67cba33a42dc55ce58915d9dbb154a",
"size":... |
"""Represent a signal repeater."""
from pytradfri.const import ROOT_SIGNAL_REPEATER
class SignalRepeater:
"""Represent a signal repeater."""
def __init__(self, device, index):
self.device = device
self.index = index
@property
def raw(self):
"""Return raw data that it represen... | {
"content_hash": "e31d0996602c875255ff38501ed914e6",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 64,
"avg_line_length": 26.133333333333333,
"alnum_prop": 0.6479591836734694,
"repo_name": "rubenbe/pytradfri",
"id": "f80748d75d407321b3b40cf4100a7129eb384482",
"size": "39... |
{
'name': 'Products & Pricelists',
'version': '1.2',
'category': 'Sales',
'depends': ['base', 'decimal_precision', 'mail', 'report'],
'demo': [
'product_demo.xml',
'product_image_demo.xml',
],
'description': """
This is the base module for managing products and pricelists in ... | {
"content_hash": "4bc2c91958e3c2ff2871f88f5ced9c58",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 74,
"avg_line_length": 29.510204081632654,
"alnum_prop": 0.5746887966804979,
"repo_name": "vileopratama/vitech",
"id": "85c7d763f8b5fb61d6a5fb0992fa9307914d707d",
"size": "... |
"""Structural variation detection for split and paired reads using lumpy.
Uses lumpyexpress for lumpy integration and samblaster for read preparation:
https://github.com/GregoryFaust/samblaster
https://github.com/arq5x/lumpy-sv
"""
from distutils.version import LooseVersion
import contextlib
import os
import sys
impor... | {
"content_hash": "7e725d5af82ad94783283ea84f50e8a0",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 116,
"avg_line_length": 48.91428571428571,
"alnum_prop": 0.576518691588785,
"repo_name": "brainstorm/bcbio-nextgen",
"id": "0b03d1974cdd1a3820350080bc7ff24d5bf3ca37",
"siz... |
"""Entrypoint for Cook's sidecar progress reporter."""
import faulthandler
import logging
import os
import requests
import signal
import sys
import cook.sidecar.config as csc
import cook.sidecar.tracker as cst
from cook.sidecar import util
from cook.sidecar.version import VERSION
def start_progress_trackers():
... | {
"content_hash": "e11608cb873729701e8a689ae9370e8f",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 129,
"avg_line_length": 41.910714285714285,
"alnum_prop": 0.6374094588836813,
"repo_name": "twosigma/Cook",
"id": "ddf986fd405187121fc0758311df77b5315d8763",
"size": "5842... |
import re
import pandas as pd
import numpy as np
from numpy import int64
from pandas.tseries.offsets import *
# copied from pandas.tseries.offset
__all__ = {
'day': Day,
'businessday': BusinessDay,
'bday': BDay,
'custombusinessday': CustomBusinessDay,
'cday': CDay,
'cbmonthend': CBMonthEnd,
... | {
"content_hash": "eaaf059fa4cf26b627be95b40e87fb8d",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 73,
"avg_line_length": 27.158940397350992,
"alnum_prop": 0.5993660082906608,
"repo_name": "nekopuni/adagio",
"id": "de8394ead01b782d6c95816840853bcd17eb73a7",
"size": "410... |
import copy
import pickle
import sqlalchemy as sa
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import String
from sqlalchemy import testing
from sqlalchemy.orm import aliased
from sqlalchemy.orm import attributes
from sqlalchemy.orm import clear_mappe... | {
"content_hash": "93b4c76e3cd705d4b0de274fe1c361cf",
"timestamp": "",
"source": "github",
"line_count": 867,
"max_line_length": 79,
"avg_line_length": 33.01038062283737,
"alnum_prop": 0.5495108315863033,
"repo_name": "sqlalchemy/sqlalchemy",
"id": "710c98ee6d26df1ec3e6968bc7630c2cbb6e22ee",
"size":... |
from .channel_steepness import SteepnessFinder
__all__ = ['SteepnessFinder', ]
| {
"content_hash": "1974bba3641a1b03b4252f7ffb44bef7",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 46,
"avg_line_length": 20.25,
"alnum_prop": 0.7283950617283951,
"repo_name": "Carralex/landlab",
"id": "d3ce7ad17e114e2f842872180382504e22d8aab8",
"size": "81",
"binary": ... |
import pybindgen
def generate(file_):
mod = pybindgen.Module('_rabinkarprh')
mod.add_include('"rabinkarp.h"')
mod.add_container('std::list<unsigned int>', 'unsigned int', 'list')
mod.add_container('std::list<double>', 'double', 'list')
cls = mod.add_class('RabinKarpHash')
cls.add_constructor(... | {
"content_hash": "55de38571c955751aacdefd0d0929ce4",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 80,
"avg_line_length": 45.06666666666667,
"alnum_prop": 0.5724852071005917,
"repo_name": "netleibi/fastchunking",
"id": "821794d76569df47f125a3ed73bbf643b5bab55c",
"size": ... |
from django.shortcuts import render, get_object_or_404
from .models import Officer
def index(request):
officers = Officer.objects.all()
return render(request, 'officers/index.jade', {'officers': officers})
def detail_id(request, officer_id):
officer = get_object_or_404(Officer, pk=officer_id)
return render(re... | {
"content_hash": "aabd0d803391d46f0508f44126e1dd31",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 77,
"avg_line_length": 40.5,
"alnum_prop": 0.7442680776014109,
"repo_name": "sreidy/roboticsclub.org",
"id": "cf5b74e4d56346aa3048af87ccdd786d26ee37f7",
"size": "567",
"b... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lowfat', '0083_auto_20161221_1411'),
]
operations = [
migrations.AlterField(
model_name='claimant',
name='application_year',... | {
"content_hash": "9628de21e81e13a785bfd75a7c8d3421",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 52,
"avg_line_length": 21.72222222222222,
"alnum_prop": 0.6035805626598465,
"repo_name": "softwaresaved/fat",
"id": "3ce2bdf95a8a1adf65ba66b8bc7a22ea7db20a82",
"size": "464... |
import os
import psutil
import logging
from time import sleep
from reynard.monitors import Monitor
from katcp import Sensor
from subprocess import Popen,PIPE
log = logging.getLogger("reynard.monitor.memory")
class MemoryMonitor(Monitor):
def __init__(self,polling_interval=1):
super(MemoryMonitor,self).__i... | {
"content_hash": "0ac76b0877e81ceeacc9a5e0f5fab2b5",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 89,
"avg_line_length": 31,
"alnum_prop": 0.5572249226690235,
"repo_name": "ewanbarr/reynard",
"id": "197b19900f5b709103cf1f57ab45a9389d1b89f1",
"size": "2263",
"binary": ... |
from __future__ import unicode_literals
from django.db import models, migrations
def migrate_comments(apps, schema_editor):
AlertConfig = apps.get_model("main", "AlertConfig")
for t in ['fanfunding', 'streamtip', 'imraising', 'twitchalerts']:
configs = AlertConfig.objects.filter(type=t)
for c ... | {
"content_hash": "675526b28d67a7e9b1eea154b233150d",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 70,
"avg_line_length": 29.476190476190474,
"alnum_prop": 0.6122778675282714,
"repo_name": "google/mirandum",
"id": "f1e6e07fb694bc65e988b5ffa8eb427a909b73de",
"size": "1256... |
from mptypes import mpmathify, extraprec, eps, mpf, MultiPrecisionArithmetic
from calculus import diff
from functions import sqrt, sign, ldexp
from matrices import matrix, norm as norm_
from linalg import lu_solve
from copy import copy
##############
# 1D-SOLVERS #
##############
class Newton:
"""
1d-solver g... | {
"content_hash": "4643d39ee0e474dd0bd05b5bb5f411c5",
"timestamp": "",
"source": "github",
"line_count": 1068,
"max_line_length": 83,
"avg_line_length": 29.584269662921347,
"alnum_prop": 0.5200974806937587,
"repo_name": "jbaayen/sympy",
"id": "ef6b2ec5b46f94fda4beda25ae20798d9a1e7665",
"size": "3159... |
from app import app
from flask import render_template,request
from models import BillRecord,BillRecord_Form
@app.route('/')
def index():
form = BillRecord_Form()
todos = BillRecord.objects.order_by('-time')
return render_template("index.html", todos=todos,form=form)
# return render_template("index.h... | {
"content_hash": "9484e41ff530171471dd4d7aeb394db3",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 64,
"avg_line_length": 29.133333333333333,
"alnum_prop": 0.6710526315789473,
"repo_name": "niasand/learn_how_to_flask",
"id": "e9d7b1205036f570b0b2fdfb33ae83e4bc9d7820",
"s... |
import requests
import json
# Detect all human faces present in a given image and try to guess their age, gender and emotion state via their facial shapes
# Target image: Feel free to change to whatever image holding as many human faces as you want
img = 'http://www.scienceforums.com/uploads/1282315190/gallery_... | {
"content_hash": "762089432423193edf7a125c39d67ed4",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 148,
"avg_line_length": 37.333333333333336,
"alnum_prop": 0.6464285714285715,
"repo_name": "symisc/pixlab",
"id": "a509b2f763edfac7f3af8e55f12635114298dc67",
"size": "1120"... |
import _plotly_utils.basevalidators
class ShowtickprefixValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self,
plotly_name="showtickprefix",
parent_name="densitymapbox.colorbar",
**kwargs
):
super(ShowtickprefixValidator, self).__init__(
... | {
"content_hash": "ce8c89905430e8120eaced7b0e9c0c65",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 80,
"avg_line_length": 33.333333333333336,
"alnum_prop": 0.5833333333333334,
"repo_name": "plotly/python-api",
"id": "bb505c2f0f923660aa97932a77fa896fbcd99f09",
"size": "60... |
import operator
import collections
import logging
logger = logging.getLogger(__name__)
def get_accumulated_probabilities(sorted_candidate_lengths, current_round_acc_probability):
'''Take a dictionary of sorted candidate alphabets and calculate the
relative probability of each candidate being in the target s... | {
"content_hash": "888af10ff9f264a8f5c6bf2d48f3460e",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 104,
"avg_line_length": 37.04761904761905,
"alnum_prop": 0.7078589790672053,
"repo_name": "dionyziz/rupture",
"id": "628aff60dc80770b0628b1b582186d369a911bff",
"size": "54... |
"""
BitBake SFTP Fetch implementation
Class for fetching files via SFTP. It tries to adhere to the (now
expired) IETF Internet Draft for "Uniform Resource Identifier (URI)
Scheme for Secure File Transfer Protocol (SFTP) and Secure Shell
(SSH)" (SECSH URI).
It uses SFTP (as to adhere to the SECSH URI specification). I... | {
"content_hash": "401470d5fcd47843099b14b9c38ff838",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 75,
"avg_line_length": 33.15748031496063,
"alnum_prop": 0.6618380432201377,
"repo_name": "wwright2/dcim3-angstrom1",
"id": "8ea4ef2ff3b5ac54069e56b68737a0ddd3ffbdcd",
"siz... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "visiblapp.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "bb587991543b563bdeabb869cf5e06fd",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 73,
"avg_line_length": 25.555555555555557,
"alnum_prop": 0.7130434782608696,
"repo_name": "joshcrist20/visiblapp",
"id": "97687e2896405c01b9caaa5f133d941ac1b2d393",
"size": ... |
import numpy as np
from rllab.core.serializable import Serializable
from rllab.envs.base import Step
from rllab.envs.proxy_env import ProxyEnv
from rllab.misc import autoargs
from rllab.misc.overrides import overrides
class NoisyObservationEnv(ProxyEnv, Serializable):
@autoargs.arg('obs_noise', type=float,
... | {
"content_hash": "13817d436c62df21466f19480f3fbd26",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 79,
"avg_line_length": 32.59493670886076,
"alnum_prop": 0.6062135922330097,
"repo_name": "brain-research/mirage-rl-qprop",
"id": "afe8d063b6dc4dd15c05d618501e87d23489c9fd",
... |
import sys
import wx
from .process import Process
from ..widgets import Label, Font
class Runner(wx.EvtHandler):
def __init__(self, config, notebook):
wx.EvtHandler.__init__(self)
self.Bind(wx.EVT_TIMER, self.OnTimer)
self.name = config.name
self._timer = wx.Timer(self)
s... | {
"content_hash": "bd915d5d0620193d6ae07151f45a305b",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 74,
"avg_line_length": 27.323741007194243,
"alnum_prop": 0.5966298051606108,
"repo_name": "robotframework/RIDE",
"id": "b6b53f2a08c95b44fadce894595b242206ab89f7",
"size": ... |
"""
The MatchMaker classes should accept a Topic or Fanout exchange key and
return keys for direct exchanges, per (approximate) AMQP parlance.
"""
from essential.config import cfg
from essential import importutils
from essential import log as logging
from essential.rpc import matchmaker as mm_common
redis = importuti... | {
"content_hash": "aad210b160c57139bc634f99b670239b",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 79,
"avg_line_length": 32.16279069767442,
"alnum_prop": 0.5996625692938058,
"repo_name": "zhangxiaolins/python_base",
"id": "176956ce06f7e375d329c7c044775ff884360538",
"si... |
"""Handle /_ah/warmup requests on instance start."""
__author__ = 'Mike Gainer (mgainer@google.com)'
import appengine_config
from modules.warmup import warmup
from tests.functional import actions
class WarmupTests(actions.TestBase):
def test_warmup_dev(self):
self.get('http://localhost:8081' + warmup.Wa... | {
"content_hash": "c5b9f2fb4279ae0e5f40c06daa9732b7",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 75,
"avg_line_length": 41.09375,
"alnum_prop": 0.6692015209125475,
"repo_name": "andela-angene/coursebuilder-core",
"id": "f4ec931103803f3ad084c6b7dbd3bf2f0c55b29e",
"size"... |
from __future__ import unicode_literals
from djblets.webapi.testing.decorators import webapi_test_template
from reviewboard.webapi.tests.mixins_extra_data import (ExtraDataItemMixin,
ExtraDataListMixin)
class BaseCommentListMixin(object):
@webapi_test_temp... | {
"content_hash": "8511ffc0f0e76517431ca7fc490d25f8",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 79,
"avg_line_length": 36.22857142857143,
"alnum_prop": 0.5910883280757098,
"repo_name": "sgallagher/reviewboard",
"id": "517457ab332eea87c783c27a6c25c50dbb1445f8",
"size"... |
r"""Simple transfer learning with an Inception v3 architecture model.
With support for TensorBoard.
This example shows how to take a Inception v3 architecture model trained on
ImageNet images, and train a new top layer that can recognize other classes of
images.
The top layer receives as input a 2048-dimensional vec... | {
"content_hash": "fe24cb30fd5db202dcbe5eca2dd3b030",
"timestamp": "",
"source": "github",
"line_count": 1089,
"max_line_length": 90,
"avg_line_length": 39.85123966942149,
"alnum_prop": 0.6591317572238352,
"repo_name": "kashim-zcxk/clasificador-mascota",
"id": "59e99b0d61d215879cc30c58c0b437af6ffb94ac... |
import os.path
from nova.api.openstack import common
from nova.image import glance
class ViewBuilder(common.ViewBuilder):
_collection_name = "images"
def basic(self, request, image):
"""Return a dictionary with basic image attributes."""
return {
"image": {
"id":... | {
"content_hash": "011428600d39399e62c4dcedb26509ff",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 79,
"avg_line_length": 35.73134328358209,
"alnum_prop": 0.4780701754385965,
"repo_name": "DirectXMan12/nova-hacking",
"id": "cc0718a4ebb7b80bd54566c4286d586fa6a226ce",
"si... |
import sys
import os
from Crypto.Cipher import AES
from django.views.debug import technical_500_response
from django.template.loader import render_to_string
from django.conf import settings
from .utils import get_decode_key, get_client_key
BLOCK_SIZE = 16
MONKEY_FORCE_ACTIVE = getattr(settings, "MONKEY_FORCE_ACTIVE... | {
"content_hash": "b63e8550623d2321431e2d2b1944a1e9",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 94,
"avg_line_length": 33.43181818181818,
"alnum_prop": 0.583956492182189,
"repo_name": "ionelmc/django-monkey-team",
"id": "261254cadf18e54bdbf76ecaa4201d9d007ce578",
"siz... |
from math import log
import numpy as np
import copy
from collections import defaultdict
import random
from simple_rl.pomdp.BeliefMDPClass import BeliefMDP
class BeliefSparseSampling(object):
'''
A Sparse Sampling Algorithm for Near-Optimal Planning in Large Markov Decision Processes (Kearns et al)
Assum... | {
"content_hash": "29dcb88f5bdc2f9b907e3f57fccb81c0",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 124,
"avg_line_length": 39.113207547169814,
"alnum_prop": 0.5972021225277376,
"repo_name": "david-abel/simple_rl",
"id": "939259c24dba38ce2fcf1798db2bfa2127379f41",
"size"... |
from __future__ import division, print_function, absolute_import
import os
import sys
sys.path = [os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")] + sys.path
from crox.core import main
if __name__ == '__main__':
main()
| {
"content_hash": "3a21402bd66b5c1307d18fe68d88c691",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 86,
"avg_line_length": 26.666666666666668,
"alnum_prop": 0.6583333333333333,
"repo_name": "gustavla/crox",
"id": "f6c4ff1e56378a721cff207e0b897179e75df852",
"size": "262",
... |
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django.contrib.gis.db import models
import datetime
from django.utils import timezone
class AlertNotification(models.Model):
INCIDENT, NEARMISS, HAZARD, THEFT, UNDEFINED = range(5)
ACTION_CHOICES = (
(INC... | {
"content_hash": "8aa03b21cb864218e284d287a9770cb0",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 111,
"avg_line_length": 28.573333333333334,
"alnum_prop": 0.6677554829678022,
"repo_name": "SPARLab/BikeMaps",
"id": "8be2a4cdfbdee742f55f242a86ec83c31283c87f",
"size": "21... |
import sys
import socket
import random
from threading import Thread
from math import gcd
from base64 import b64encode
def lcm(a, b):
"""Return lowest common multiple of a and b"""
return a * b // gcd(a, b)
with open("key.png", "rb") as f:
SECRET = b64encode(f.read())
PAD_LENGTH = 1024 * 100
REPEAT = lcm... | {
"content_hash": "423e2e0948b2e64f0445c19bad07bb08",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 72,
"avg_line_length": 28.6734693877551,
"alnum_prop": 0.6170818505338078,
"repo_name": "Enteee/Enteee.github.io",
"id": "c6275789d918748049a5ebd918e07f59ee91bada",
"size":... |
import numpy as np
import tensorflow as tf
from .. import config
from ..distribution import Distribution
def _normal_logp(X, mu, sigma):
return (
tf.log(1 / (tf.constant(np.sqrt(2 * np.pi), dtype=config.dtype) * sigma)) -
(X - mu)**2 / (tf.constant(2, dtype=config.dtype) * sigma**2)
)
def _... | {
"content_hash": "b37935607d5a59dc4ac96c2bb5ec6c29",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 86,
"avg_line_length": 26.551724137931036,
"alnum_prop": 0.612987012987013,
"repo_name": "ibab/tensorprob",
"id": "97dd3f5500675cb037704aac2e6a5012ece9d0a8",
"size": "1540"... |
"""
============================================
Wifi 802.11 simulation (:mod:`commpy.wifi80211`)
============================================
.. autosummary::
:toctree: generated/
Wifi80211 -- Class to simulate the transmissions and receiving parameters of physical layer 802.11
"""
import math
from typing ... | {
"content_hash": "add79adb39e62b584d2137e0238f7484",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 125,
"avg_line_length": 38.032863849765256,
"alnum_prop": 0.5199358103937786,
"repo_name": "veeresht/CommPy",
"id": "58ee43569929c3f20573c2ba4cfec264437a3d01",
"size": "81... |
from .BasicRNNCell import BasicRNNCell
from .GRU import GRUCell
from .LSTM import BasicLSTMCell
__all__ = ('GRUCell', 'BasicLSTMCell', 'BasicRNNCell')
| {
"content_hash": "9c01fab41bcc90f3d5030987d514ea15",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 54,
"avg_line_length": 30.4,
"alnum_prop": 0.7631578947368421,
"repo_name": "SwordYork/sequencing",
"id": "efec7698437165137dc5088dbb32300abf777330",
"size": "301",
"binar... |
import numpy as np
from pandas._libs.tslibs import fields
import pandas.util.testing as tm
def test_fields_readonly():
# https://github.com/vaexio/vaex/issues/357
# fields functions should't raise when we pass read-only data
dtindex = np.arange(5, dtype=np.int64) * 10 ** 9 * 3600 * 24 * 32
dtindex.... | {
"content_hash": "a56b2c23b5d3f946fbfb68acc77d5bfe",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 75,
"avg_line_length": 36.903225806451616,
"alnum_prop": 0.6809440559440559,
"repo_name": "toobaz/pandas",
"id": "cd729956a027c025b914a939a4286178af6bc26c",
"size": "1144",... |
"""Nikola -- a modular, fast, simple, static website generator."""
import os
import sys
__version__ = '8.0.0.dev0'
DEBUG = bool(os.getenv('NIKOLA_DEBUG'))
if sys.version_info[0] == 2:
raise Exception("Nikola does not support Python 2.")
from .nikola import Nikola # NOQA
from . import plugins # NOQA
| {
"content_hash": "f1e86fd58cc11bb25004fa87e2972db9",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 66,
"avg_line_length": 23.846153846153847,
"alnum_prop": 0.6806451612903226,
"repo_name": "gwax/nikola",
"id": "578564206efa449ca58be39175217e9a229d62c0",
"size": "1452",
... |
from .views import CarrierCRUDL, Carriers
from django.conf.urls import patterns, url, include
urlpatterns = CarrierCRUDL().as_urlpatterns()
urlpatterns += patterns('carriers.views',
url(r'^carriers', Carriers.as_view(), name='carriers.carriers'))
| {
"content_hash": "7d2e7d9fee93ee7c5dc28d7ed6331fba",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 88,
"avg_line_length": 39,
"alnum_prop": 0.6996336996336996,
"repo_name": "nyaruka/sigtrac",
"id": "921de5bdc2c6db5fd35c0e713d8f54cc70b8254a",
"size": "273",
"binary": fal... |
from msrest.serialization import Model
class ExpressRouteCircuitPeeringConfig(Model):
"""Specifies the peering configuration.
:param advertised_public_prefixes: The reference of
AdvertisedPublicPrefixes.
:type advertised_public_prefixes: list[str]
:param advertised_communities: The communities o... | {
"content_hash": "0d2fc7f6db868516cf4eacf5a4ff5138",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 225,
"avg_line_length": 52.70454545454545,
"alnum_prop": 0.709357481673135,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "b1ffd9ef70aa45c3585d41eeea351a4623382cdd",
"... |
from flask import Flask , jsonify , request,abort
from AI import main
import pandas as pd
import numpy as np
import datetime
import twilio_service
from pymongo import MongoClient
app = Flask(__name__)
@app.route('/verify', methods=['POST'])
def get_probability():
if not request.json:
abort(400)
df= p... | {
"content_hash": "58e6fe3ae81f760e1087a195f049ae75",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 147,
"avg_line_length": 48.484375,
"alnum_prop": 0.6455043506284242,
"repo_name": "imironica/Fraud-Detection-System",
"id": "4d269321d73ca2017002f48fc1b23da035e9acda",
"siz... |
import numpy as np
import matplotlib.pyplot as plt
import plotly
n = 50
x, y, z, s, ew = np.random.rand(5, n)
c, ec = np.random.rand(2, n, 4)
area_scale, width_scale = 500, 5
fig, ax = plt.subplots()
sc = ax.scatter(x, y, c=c,
s=np.square(s)*area_scale,
edgecolor=ec,
li... | {
"content_hash": "b72cd79a21e3846515d4446e60f4a029",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 91,
"avg_line_length": 27.055555555555557,
"alnum_prop": 0.6262833675564682,
"repo_name": "jeremiedecock/snippets",
"id": "9fb1b5824da297400d97038e38881dc56661f208",
"size"... |
from ClassBuilder import ClassBuilder
def main():
instance = ClassBuilder() \
.with_attribute_1('Attribute 1') \
.with_attribute_2('Attribute 2') \
.with_attribute_3('Attribute 3') \
.build()
print (instance.attribute_1)
print (instance.attribute_2)
print (instance.attr... | {
"content_hash": "4c420e90f6b66e94313dc1783190f15e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 42,
"avg_line_length": 24.071428571428573,
"alnum_prop": 0.6261127596439169,
"repo_name": "danieldeveloper001/Learning",
"id": "586b489a0a7c3802ad76670f0d75a78ad5b2d947",
"... |
import os, sys, tempfile
from subprocess import Popen
import math, numpy
from common import config, fileutils
class GNUPlot:
def __init__(self, filename, title, group=None):
self.group = group
self.filename = filename.replace(" ", "-")
self.title = title
self.data = {}
sel... | {
"content_hash": "77569ed291b965dac994f7186e7edf91",
"timestamp": "",
"source": "github",
"line_count": 408,
"max_line_length": 86,
"avg_line_length": 33.89705882352941,
"alnum_prop": 0.5203904555314534,
"repo_name": "sonya/eea",
"id": "fa0bc5a1aeb0db1c4a370630ad3117d5958418b8",
"size": "14410",
... |
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import os
import re
from lib.core.common import singleTimeWarnMessage
from lib.core.data import kb
from lib.core.enums import DBMS
from lib.core.enums import PRIORITY
from lib.core.settings import ... | {
"content_hash": "b3df54fef913223b4f4fd90aa122870f",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 207,
"avg_line_length": 34.9811320754717,
"alnum_prop": 0.6434735706580367,
"repo_name": "michaelhidalgo/7WCSQ",
"id": "ef9c4ff61ff577f37f72546d0655f967115d77fa",
"size": "... |
import argparse
parser = argparse.ArgumentParser(description="Go through the chunks, and plot comparisons relative to the original files.")
parser.add_argument("--chunk_index", type=int, help="Only run the calibration on a specific chunk.")
args = parser.parse_args()
import numpy as np
import matplotlib.pyplot as pl... | {
"content_hash": "af11409b74da2811f2545d8c29ba85dc",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 123,
"avg_line_length": 33.120879120879124,
"alnum_prop": 0.6420039814200398,
"repo_name": "iancze/PSOAP",
"id": "27971402911b7a20ec228502fd4638db67b8d15c",
"size": "3037",... |
from __future__ import print_function
import copy
#import logging
import sys
import math
import numpy as np
from sasdata.dataloader.data_info import Data1D
from sasdata.dataloader.data_info import Data2D
_SMALLVALUE = 1.0e-10
class FitHandler(object):
"""
Abstract interface for fit thread handler.
The ... | {
"content_hash": "9e4d422e99bf2f440a83414ea20d743d",
"timestamp": "",
"source": "github",
"line_count": 638,
"max_line_length": 98,
"avg_line_length": 31.921630094043888,
"alnum_prop": 0.5562211529018953,
"repo_name": "SasView/sasview",
"id": "e374f5a7af8fbe8231fc9e47ae64fe6faf51c9c1",
"size": "203... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('products', '0015_collection_brands'),
]
operations = [
migrations.AddField(
model_name='product',
name='default',
... | {
"content_hash": "8b96da3efe927dd52953569c58f74ef0",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 116,
"avg_line_length": 24.666666666666668,
"alnum_prop": 0.6193693693693694,
"repo_name": "vanabo/mattress",
"id": "ba912d0efa17da0deb0f0ae3bede02150b284fc2",
"size": "468... |
"""
This module provides some utils for calculating metrics
"""
import numpy as np
from sklearn.metrics import average_precision_score, confusion_matrix
def softmax(raw_score, T=1):
exp_s = np.exp((raw_score - raw_score.max(axis=-1)[..., None])*T)
sum_s = exp_s.sum(axis=-1)
return exp_s / sum_s[..., None]... | {
"content_hash": "0f6d840a19cfa4d083846b3ccb7a41ee",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 88,
"avg_line_length": 29.766666666666666,
"alnum_prop": 0.6388577827547592,
"repo_name": "ZhanningGao/temporal-segment-networks",
"id": "b9804cc0c12d9da811933b60dbbba8b26c15... |
from __future__ import absolute_import
import logging
import os
import re
import shutil
import sys
import tempfile
import zipfile
from distutils.util import change_root
from distutils import sysconfig
from email.parser import FeedParser
from pip._vendor import pkg_resources, six
from pip._vendor.six.moves import con... | {
"content_hash": "8a9ba787913cba503acf332b41d80df8",
"timestamp": "",
"source": "github",
"line_count": 1064,
"max_line_length": 79,
"avg_line_length": 38.04981203007519,
"alnum_prop": 0.5233049277510189,
"repo_name": "mattcaldwell/pip",
"id": "1a928579e221906ed11a1ad071e5d7938f3d2312",
"size": "40... |
from opencv_engine.tiff_support import TiffMixin, TIFF_FORMATS
try:
import cv
except ImportError:
import cv2.cv as cv
from colour import Color
from thumbor.engines import BaseEngine
from pexif import JpegFile, ExifSegment
try:
from thumbor.ext.filters import _composite
FILTERS_AVAILABLE = True
excep... | {
"content_hash": "fe04357e173f61c7f55cca70dd67e252",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 108,
"avg_line_length": 32.92079207920792,
"alnum_prop": 0.5688721804511279,
"repo_name": "dronedeploy/opencv-engine",
"id": "e27e8c2108a5c2cf27d8957891b008605836bd66",
"s... |
from gpconfig_modules.compare_segment_guc import MultiValueGuc
from gpconfig_modules.database_segment_guc import DatabaseSegmentGuc
class GucCollection:
"""
provide an enhanced dict of gucs, with responsibilities to assemble sets of info per segment.
"""
COORDINATOR_KEY = '-1'
def __init__(self)... | {
"content_hash": "369b63513dbee80e004994d670f0d429",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 97,
"avg_line_length": 33.52054794520548,
"alnum_prop": 0.6011442582754393,
"repo_name": "greenplum-db/gpdb",
"id": "1f1978e751ecc6e0955d7260522a5ddc8a53bb6f",
"size": "244... |
from __future__ import with_statement
import time
try:
import simplejson as json
except ImportError:
import json
import logging
from tornado.web import HTTPError
from octopus.core.communication import HttpResponse, Http400, Http404, Http403, HttpConflict, Http500
from octopus.core.enums.rendernode import *
f... | {
"content_hash": "03f8867d46a2a578b3c1b249fc55bbd5",
"timestamp": "",
"source": "github",
"line_count": 414,
"max_line_length": 199,
"avg_line_length": 37.908212560386474,
"alnum_prop": 0.6136102969287626,
"repo_name": "mikrosimage/OpenRenderManagement",
"id": "52f0fb2d5fffcf2cdd3e36c10b68e64c0a38249... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('workflows', '0011_auto_20221116_1028'),
]
operations = [
migrations.AlterField(
model_name='workflow',
name='creation_time',... | {
"content_hash": "323bd9d6e562e170c0087fef2e9b843a",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 69,
"avg_line_length": 25.434782608695652,
"alnum_prop": 0.588034188034188,
"repo_name": "xflows/clowdflows-backend",
"id": "634e061d1880221d2946980c713bba6355cb5212",
"siz... |
from distutils.core import setup
setup(
name='imutils',
packages=['imutils'],
version='0.2.2',
description='A series of convenience functions to make basic image processing functions such as translation, rotation, resizing, skeletonization, displaying Matplotlib images, sorting contours, detecting edge... | {
"content_hash": "201a4ca316e2d26886344363f0a0aa64",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 261,
"avg_line_length": 46.46666666666667,
"alnum_prop": 0.7245337159253945,
"repo_name": "PanTomaszRoszczynialski/imutils",
"id": "9d3ee463681f14d5e718d05c4b69c11dc9f84778",... |
from google.cloud import dialogflow_v2
def sample_list_conversations():
# Create a client
client = dialogflow_v2.ConversationsClient()
# Initialize request argument(s)
request = dialogflow_v2.ListConversationsRequest(
parent="parent_value",
)
# Make the request
page_result = clie... | {
"content_hash": "9e534b7d4ed174d48966aba99231ff77",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 68,
"avg_line_length": 25.65,
"alnum_prop": 0.7153996101364523,
"repo_name": "googleapis/python-dialogflow",
"id": "ac64eba364b955d41aebf6c827d1da866ad3c43a",
"size": "1912... |
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.template.loader import render_to_string
from django.views.generic import TemplateView
from django_cradmin import javascriptregistry
from django_cradmin.apps.cradmin_generic_token_with_metadata.models import GenericTokenWithMet... | {
"content_hash": "d08a0b0f372f5501219e366f9f0e726c",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 102,
"avg_line_length": 38.24418604651163,
"alnum_prop": 0.6670720583764062,
"repo_name": "appressoas/django_cradmin",
"id": "abd2ec3d429a204d1c6483da8545a782e1d0ddc7",
"si... |
"""Module for single entry transformers."""
import logging
from collections import defaultdict
from operator import attrgetter
from ....core.models.base import RemoteInstance
from ....core.exceptions import DoesNotExistException, SkipField
from ....core.models.terminal import (
SshKey, Identity,
)
from .base import... | {
"content_hash": "73ba903894c3a9dbd4d9edbfc5ec01ff",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 77,
"avg_line_length": 34.52466367713004,
"alnum_prop": 0.6231978178984283,
"repo_name": "Crystalnix/serverauditor-sshconfig",
"id": "0a74c7d9819681bcb31f639ff15c6ef950a9565... |
import unittest
import numpy as np
from op_test import OpTest
class TestShapeOp(OpTest):
def setUp(self):
self.op_type = "shape"
self.config()
self.shape = [2, 3]
input = np.zeros(self.shape)
self.inputs = {'Input': input}
self.outputs = {'Out': np.array(self.shape)... | {
"content_hash": "ef59c00b5c06eeeb4b2588edd9b8e2ca",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 52,
"avg_line_length": 19.393939393939394,
"alnum_prop": 0.5703125,
"repo_name": "jacquesqiao/Paddle",
"id": "a62ee050075cb8c9f8817c142825a89c24bdfedf",
"size": "1253",
"... |
from JumpScale import j
import sys
import time
try:
import ujson as json
except:
import json
from JumpScale.tools import cmdutils
from JumpScale.legacy.redisworker.RedisWorker import RedisWorkerFactory
from logging import FileHandler
import os
RUNTIME = 24 * 3600
def restart_program():
"""Restarts the... | {
"content_hash": "2a99b7fc37f743fa8069971a23fd9748",
"timestamp": "",
"source": "github",
"line_count": 263,
"max_line_length": 126,
"avg_line_length": 43.51330798479088,
"alnum_prop": 0.4699405802167074,
"repo_name": "Jumpscale/jumpscale_core8",
"id": "34de79bdb485703c6611b09f8fc00d98a896f05e",
"s... |
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import sys
from multiprocessing import Process
ERR_SLEEP = 15
MAX_NONCE = 1000000L
settings = {}
pp = pprint.PrettyPrinter(indent=4)
class MegacoinRPC:
OBJID = 1
def __init__(self, host, port, username, passw... | {
"content_hash": "8369d3f9c6442d4dba7979309e1acca1",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 84,
"avg_line_length": 25.420408163265307,
"alnum_prop": 0.6453114964675658,
"repo_name": "CCPorg/MEC-MegaCoin-Ver-179600-Copy",
"id": "0ef05a332edff146c270c45bcc3c76a0f7cd5... |
"""
Base widget, all widgets inherit from this.
"""
import pygame
from pygame.locals import Rect, SRCALPHA
from pygame import draw
from ._locals import *
from ._locals import (has_focus, is_active, add_widget, remove_widget_order,
set_cursor, remove_cursor)
import collections
class Simple(pygame... | {
"content_hash": "fc72eb4a2599167159c80953ffcb157c",
"timestamp": "",
"source": "github",
"line_count": 545,
"max_line_length": 98,
"avg_line_length": 33.09357798165138,
"alnum_prop": 0.5326014637391883,
"repo_name": "OneOneFour/ICSP_Monte_Carlo",
"id": "5d8b4e77fa56db35c495e5dc4ecdbdb70e951071",
"... |
from io import BytesIO
from .node import (Node, AtomNode, BinaryExpressionNode, BinaryOperatorNode,
ConditionalNode, DataNode, IndexNode, KeyValueNode, ListNode,
NumberNode, StringNode, UnaryExpressionNode,
UnaryOperatorNode, ValueNode, VariableNode)
class Par... | {
"content_hash": "16a7aed153b0561664c5dad87b868ae2",
"timestamp": "",
"source": "github",
"line_count": 771,
"max_line_length": 141,
"avg_line_length": 32.82101167315175,
"alnum_prop": 0.5191859316340645,
"repo_name": "nwjs/chromium.src",
"id": "c0ef9b4dd33d43722c3ea8b8d5f755605f7672af",
"size": "2... |
from __future__ import print_function
import logging
logging.basicConfig()
import av
from av.codec import CodecContext, CodecParser
from av.video import VideoFrame
from av.packet import Packet
cc = CodecContext.create('mpeg4', 'r')
print(cc)
fh = open('test.mp4', 'r')
frame_count = 0
while True:
chunk = f... | {
"content_hash": "e42fc4374a0542f1a5ac79e65796d18b",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 61,
"avg_line_length": 19.818181818181817,
"alnum_prop": 0.6299694189602446,
"repo_name": "mikeboers/PyAV",
"id": "67d70855e2a910e81e541adaf3e90343e903009f",
"size": "654",... |
class IrProjectPipeline(object):
def process_item(self, item, spider):
return item
| {
"content_hash": "18e5eb608325c2b6a611383cc253e4eb",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 41,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.6947368421052632,
"repo_name": "EliHar/InfoRetrievalSearch",
"id": "41befd2dcf5ff47f8546659e22a7adf1a555a0c0",
"si... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('content', '0025_auto_20160426_0848'),
]
operations = [
migrations.RenameModel(
old_name='CustomPage1',
new_name='CustomPage'... | {
"content_hash": "49fca9f34b4412aaf6e1d9785a707dd4",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 47,
"avg_line_length": 19.941176470588236,
"alnum_prop": 0.5988200589970502,
"repo_name": "RachellCalhoun/lightandleadership",
"id": "ecc3771c95856663dda9f6e6439f94c04dbfb184... |
import tensorflow as tf
import random as rand
import numpy as np
data = np.reshape(rand.sample(range(10000), 1000), (1000,1))
label = data
#Setting configurations
n_nodes_hl1 = 3 #nodes in hidden layer 1
n_nodes_hl2 = 5 #nodes in hidden layer 2
n_nodes_hl3 = 3 #nodes in hidden layer 3
n_classes = 1 #number of classe... | {
"content_hash": "f0498b48b37ccb9d4d67f8c9115eea12",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 169,
"avg_line_length": 39.82222222222222,
"alnum_prop": 0.705078125,
"repo_name": "derdav3/tf-sparql",
"id": "b0116e76a91e791f629e9a2a0ef01a0b84f9e384",
"size": "3584",
... |
import itertools
import json
import os
import subprocess as sp
import time
from nltk.corpus import treebank
from nltk.metrics import accuracy
from nltk.tag.api import TaggerI
from nltk.tag.perceptron import PerceptronTagger
from nltk.tag.util import untag
from tabulate import tabulate
AP_TIME = []
def pipe_through... | {
"content_hash": "ee710bc03acad3675f134ddaded9b41c",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 78,
"avg_line_length": 29,
"alnum_prop": 0.6039019963702359,
"repo_name": "jdkato/prose",
"id": "ef8b30e8d0062bc6763444409b5d576ea1f95616",
"size": "2204",
"binary": fals... |
__version__='3.3.0'
__doc__="""Collection of axes for charts.
The current collection comprises axes for charts using cartesian
coordinate systems. All axes might have tick marks and labels.
There are two dichotomies for axes: one of X and Y flavours and
another of category and value flavours.
Category axes have an or... | {
"content_hash": "2c4da4902a8c29944e28f69953f82ed8",
"timestamp": "",
"source": "github",
"line_count": 2442,
"max_line_length": 222,
"avg_line_length": 38.45864045864046,
"alnum_prop": 0.5556454704203757,
"repo_name": "sandeepkoduri/GAE-html-to-pdf",
"id": "b91ef4f421d93fa202b2c32d7b026304d8d27bb5",... |
import os
os.system('sudo sh /home/sivsushruth/Cyberpass/add_ip.sh') | {
"content_hash": "94f48af166670f756d16e2e1ec4b756c",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 58,
"avg_line_length": 34,
"alnum_prop": 0.7794117647058824,
"repo_name": "GingerNinja23/CyberBoost",
"id": "323cd251474d65c7ad976d5f1585964cddc46a00",
"size": "68",
"bina... |
""" ProgressBar
Example:
.. UIExample:: 100
from flexx import app, event, ui
class Example(ui.Widget):
def init(self):
with ui.HBox():
self.b1 = ui.Button(flex=0, text='Less')
self.b2 = ui.Button(flex=0, text='More')
self.prog = ui.Progres... | {
"content_hash": "c046b7c2d05e7d473abee03507b0d893",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 84,
"avg_line_length": 28.666666666666668,
"alnum_prop": 0.5480416156670747,
"repo_name": "jrversteegh/flexx",
"id": "a6a793025133a5877707168c1401fa84f4c57327",
"size": "3... |
"""Wrapper script to use Pywikibot in 'directory' mode.
Run scripts using:
python pwb.py <name_of_script> <options>
and it will use the package directory to store all user files, will fix up
search paths so the package does not need to be installed, etc.
"""
# (C) Pywikibot team, 2015
#
# Distributed under the t... | {
"content_hash": "c0770b1be36c500fb13f4efcd061c4fa",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 93,
"avg_line_length": 33.11764705882353,
"alnum_prop": 0.6132622853759621,
"repo_name": "h4ck3rm1k3/pywikibot-core",
"id": "395019e49898ba6fe1a835cf383515d39d3609eb",
"si... |
import unittest
def number_digits(n):
if n == 0:
return 1
if n < 0:
return number_digits(-n)
digits = 0
while n != 0:
digits += 1
n //= 10
return digits
def triangle(n):
return n * (n+1) // 2
def square(n):
return n * n
def pentagonal(n):
return n * (3*n-1) // 2
def hexagonal(n):
... | {
"content_hash": "3555be6740cbd0b3bae6cde842efdefc",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 54,
"avg_line_length": 25.95505617977528,
"alnum_prop": 0.6619047619047619,
"repo_name": "brunorijsman/euler-problems-python",
"id": "f949997fe5de94d4cf77f96735cdfd940c534fea... |
import graphene
from ...core.permissions import ShippingPermissions
from ...shipping import models
from ..channel.types import ChannelContext
from ..core.connection import create_connection_slice, filter_connection_queryset
from ..core.fields import FilterConnectionField, PermissionsField
from ..core.utils import from... | {
"content_hash": "309940508d065055b056cfa93b0befa8",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 88,
"avg_line_length": 41.06172839506173,
"alnum_prop": 0.7387251954299459,
"repo_name": "mociepka/saleor",
"id": "6bf101b0007466b1edfecb165385475f08e29023",
"size": "3326"... |
"""
Infobip Client API Libraries OpenAPI Specification
OpenAPI specification containing public endpoints supported in client API libraries. # noqa: E501
The version of the OpenAPI document: 1.0.172
Contact: support@infobip.com
Generated by: https://openapi-generator.tech
"""
import re # noqa: ... | {
"content_hash": "52e475ed393d08e0a91dacad82d82bd7",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 122,
"avg_line_length": 41.451977401129945,
"alnum_prop": 0.555267820635137,
"repo_name": "infobip/infobip-api-python-client",
"id": "6e626a5cbb13b095d48ed79cfce29391c9ac272... |
from unicodedata import category
from django.core.management.base import BaseCommand, CommandError
from workflows.models import Category, AbstractWidget, AbstractInput, AbstractOutput, AbstractOption
from django.core import serializers
from optparse import make_option
import uuid
import os
import sys
from djang... | {
"content_hash": "59f1dc6b06295a3a8f24449de02c6d31",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 105,
"avg_line_length": 36.36666666666667,
"alnum_prop": 0.6801099908340972,
"repo_name": "xflows/clowdflows",
"id": "708eb5f43b048aa0e23984e9f02b2d5cda2756c0",
"size": "10... |
import base64
import json
import os
import re
import dill
from airflow.contrib.hooks.gcs_hook import GoogleCloudStorageHook
from airflow.contrib.operators.mlengine_operator import MLEngineBatchPredictionOperator
from airflow.contrib.operators.dataflow_operator import DataFlowPythonOperator
from airflow.exceptions imp... | {
"content_hash": "a5ab636704b38f1eae77aba58aaf61a9",
"timestamp": "",
"source": "github",
"line_count": 230,
"max_line_length": 87,
"avg_line_length": 44.24782608695652,
"alnum_prop": 0.6653237692836789,
"repo_name": "sergiohgz/incubator-airflow",
"id": "7ce784ebb4ae336a6c3ecf65bd6bf08278ec616b",
"... |
import abc
import os
import json
import time
import logging
from urllib.parse import urlencode
import jwt
from hailtop.utils import request_retry_transient_errors
log = logging.getLogger(__name__)
class Credentials(abc.ABC):
@staticmethod
def from_file(credentials_file):
with open(credentials_file) a... | {
"content_hash": "6f774fd7ec2cd1b641121e6f5c94f989",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 206,
"avg_line_length": 38.333333333333336,
"alnum_prop": 0.6239789196310935,
"repo_name": "cseed/hail",
"id": "60792b1927c77cf22a515ae02a49fc9e5368aea7",
"size": "3795",
... |
import logging
log = logging.getLogger()
logging.basicConfig(level=logging.DEBUG)
import collections
class Model(collections.MutableMapping):
model = {}
validate = {}
def __init__(self, *args, **kwargs):
self.update(dict(*args, **kwargs))
self.__dict__.update(self.model)
def __get... | {
"content_hash": "89f4c0e629c9afebc949b4499a941045",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 68,
"avg_line_length": 23.860759493670887,
"alnum_prop": 0.47320954907161805,
"repo_name": "xbcsmith/frell",
"id": "a54e4eea3dba758f6838913cfbb1b6fa91e73f76",
"size": "1885... |
"""
K-Means
"""
# Standard Library Dependencies
from __future__ import division, print_function, absolute_import
from warnings import warn
from time import time
import os
from operator import itemgetter
# External Dependencies
import numpy as np
from scipy.io import loadmat
from numpy.linalg import norm as norm2
# %m... | {
"content_hash": "e4d0246142a42bc6316ff09108cad857",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 86,
"avg_line_length": 32.369565217391305,
"alnum_prop": 0.6183120662637117,
"repo_name": "mathandy/Classifiers2LearnWith",
"id": "dd95cebd58690999c9f7eee35db83beb637a0688",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.