text stringlengths 4 1.02M | meta dict |
|---|---|
from flask import Flask, jsonify, render_template, request
from slugify import slugify
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/slugify', methods=['POST'])
def _slugify():
if request.is_xhr:
text = request.get_json().get('text', '')
els... | {
"content_hash": "dbc2df5ede4b59d012de9373aa39bc3e",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 58,
"avg_line_length": 21.03846153846154,
"alnum_prop": 0.5813528336380256,
"repo_name": "mozillazg/slugify",
"id": "e97716ef8874e37f1968651b2c904eeb6c0ddd31",
"size": "572... |
"""
Copy of ``django.contrib.admin.utils.get_deleted_objects`` and a subclass of
``django.contrib.admin.utils.NestedObjects`` that work with djongo_polymorphic querysets.
Ultimatly these should go directly into django_polymorphic or, in a more generic way, into django itself.
This code has been copied from Django 1.4.... | {
"content_hash": "c7612c7a9067162b6228499b5afced7a",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 106,
"avg_line_length": 38.94871794871795,
"alnum_prop": 0.6270572745227123,
"repo_name": "amboycharlie/Child-Friendly-LCMS",
"id": "44b3a78f678b4449e477d2568feca2bdc1f010c3"... |
"""Home Assistant auth provider."""
import asyncio
import base64
from collections import OrderedDict
import logging
from typing import Any, Dict, List, Optional, Set, cast
import bcrypt
import voluptuous as vol
from homeassistant.const import CONF_ID
from homeassistant.core import HomeAssistant, callback
from homeass... | {
"content_hash": "1cdc845ecb532ffd2a9ce35d8985d26f",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 88,
"avg_line_length": 31.728476821192054,
"alnum_prop": 0.5905865163848883,
"repo_name": "leppa/home-assistant",
"id": "9ddbf4189f79b20e49df988c3d01e74b62279671",
"size":... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
################################################################################
# Documentation
################################################################################
ANSIBLE_METADATA = {'metadata_version': '1.1', 'statu... | {
"content_hash": "17896313be436f8c66e384afe6a90d06",
"timestamp": "",
"source": "github",
"line_count": 752,
"max_line_length": 150,
"avg_line_length": 37.59175531914894,
"alnum_prop": 0.6764653861119955,
"repo_name": "thaim/ansible",
"id": "29e259078c46db47bd4ee38f36192b738c3045b8",
"size": "29006... |
"""
Insertion Sort
Take the last value of a list and compare it to each element
of the sorted sublist and places it accordingly until there
are no more elements of the given list.
Worst Case Performance: O(n^2) comparisons and swaps
Best Case Performance: O(n) comparisons, O(1) swaps
Average Case Performance: O(n^2... | {
"content_hash": "a5ce9538bb4110425887094c81d28837",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 60,
"avg_line_length": 22.19047619047619,
"alnum_prop": 0.6963519313304721,
"repo_name": "eshim/Algorithms",
"id": "f5de44a074fb4d8d070b8dfde11200cf0aa9a820",
"size": "932"... |
from __future__ import unicode_literals
from django import forms
from legislative.models import LegislativeSession
from select2.widgets import SelectMultiple
class SearchBillForm(forms.Form):
search_name = forms.CharField(required=False,
label="Keywords")
# search_sessions = f... | {
"content_hash": "5343e3efa77cf919c5c76591e29a7ec6",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 70,
"avg_line_length": 38.2,
"alnum_prop": 0.6771378708551483,
"repo_name": "access-missouri/am-django-project",
"id": "bfc71da216bf9fceadfe2d29a72b223d68ce1a96",
"size": "... |
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Gallery',
fields=[
... | {
"content_hash": "571ff04cb402d9589ca9ac4b5bed1c92",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 147,
"avg_line_length": 40.926829268292686,
"alnum_prop": 0.5887961859356377,
"repo_name": "gygcnc/gygcnc",
"id": "606a7a440cb2100e841cc2a83cbc0a44118c5d06",
"size": "1702"... |
import contextlib
import functools
import alembic
from alembic import context
from alembic import op
import sqlalchemy as sa
from sqlalchemy.engine import reflection
# Neutron milestones for upgrade aliases
LIBERTY = 'liberty'
NEUTRON_MILESTONES = [
# earlier milestones were not tagged
LIBERTY,
]
CREATION_O... | {
"content_hash": "b87182769ad84df01b339e5df3dc06d7",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 79,
"avg_line_length": 32.7962962962963,
"alnum_prop": 0.6175418784114436,
"repo_name": "dhanunjaya/neutron",
"id": "81b491083083b4fe19a39bf33ff216e65437cd35",
"size": "59... |
'''
Class to access the Wikipedia articles' word indexes stored in the hdf5 file.
'''
import h5py
import parameters as prm
class WikiIdx():
def __init__(self, path):
if prm.load_emb_mem:
#self.f = h5py.File(path, 'r', driver='core')
# don't use driver='core'. Reading from the numpy... | {
"content_hash": "e506e123df3a369b0a3845ff27fa0da1",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 77,
"avg_line_length": 27.448275862068964,
"alnum_prop": 0.542713567839196,
"repo_name": "nyu-dl/WebNav",
"id": "9df606dd0c6dd062e41223f4162348317130b591",
"size": "796",
... |
from flask import Blueprint, render_template, request, redirect, url_for, flash
from flask_security.decorators import login_required
from flask_security import current_user
from recruit_app.user.managers import EveManager
from recruit_app.user.eve_api_manager import EveApiManager
from recruit_app.user.forms import Upd... | {
"content_hash": "89ad1b79bd640c1fba550de57c1fc61f",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 128,
"avg_line_length": 37.5377358490566,
"alnum_prop": 0.6592108569992461,
"repo_name": "tyler274/Recruitment-App",
"id": "4e6c6e35c03b8fbdac624b32ad908d044df5f60a",
"siz... |
import datetime
from corehq.form_processor.interfaces.dbaccessors import FormAccessors
from corehq.form_processor.interfaces.processor import FormProcessorInterface
from corehq.form_processor.models import Attachment
from corehq.form_processor.utils import convert_xform_to_json, adjust_datetimes
from couchforms import... | {
"content_hash": "51508df1fd2543aca34b5331e48c7d73",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 102,
"avg_line_length": 38.64545454545455,
"alnum_prop": 0.6933662667607622,
"repo_name": "qedsoftware/commcare-hq",
"id": "e71a63cdc627a4c867cec90458ac6dc81a262e0d",
"siz... |
import ast
import operator
import pytest
from radon.complexity import *
from radon.contrib.flake8 import Flake8Checker
from radon.visitors import Class, Function
from .test_complexity_visitor import GENERAL_CASES, dedent
get_index = lambda seq: lambda index: seq[index]
def _compute_cc_rank(score):
# This is r... | {
"content_hash": "01bf3bd810633acb846b49366c937603",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 78,
"avg_line_length": 26.449152542372882,
"alnum_prop": 0.5914770906760654,
"repo_name": "rubik/radon",
"id": "95d2d1568a074895b0db5c055f9742b41ad23720",
"size": "3121",
... |
from django.urls import path
from .views import simple_session_view
urlpatterns = [
path("session/", simple_session_view),
]
| {
"content_hash": "93bae0fa16f6427ecc08968c82d3b711",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 42,
"avg_line_length": 18.714285714285715,
"alnum_prop": 0.7251908396946565,
"repo_name": "modelbrouwers/django-sessionprofile",
"id": "bf301d415c5e388d6c9e8359ab81011c9e11b96... |
__author__ = 'chihchieh.sun'
# -*- coding: utf-8 -*-
import pickle
# 也可以這樣: C 語言實現版本效率較佳
# import cPickle as pickle
import urllib.request
# proxy setting
proxy = urllib.request.getproxies()
proxy_support = urllib.request.ProxyHandler({'sock5': proxy.get('http')})
opener = urllib.request.build_opener(prox... | {
"content_hash": "25f82f27d008ee0d8e967bf4d13e8a10",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 73,
"avg_line_length": 27.5,
"alnum_prop": 0.696969696969697,
"repo_name": "z-Wind/Python_Challenge",
"id": "dbb5894e7d9351291548aed443236ca7649e759b",
"size": "742",
"bi... |
from __future__ import absolute_import
import json
import responses
from sentry import options
from sentry.models import Integration, OrganizationIntegration
from sentry.testutils import APITestCase
UNSET = object()
LINK_SHARED_EVENT = """{
"type": "link_shared",
"channel": "Cxxxxxx",
"user": "Uxxxxxxx"... | {
"content_hash": "1fce0ee95f94e03d1fbc3799889cfff3",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 77,
"avg_line_length": 31.967741935483872,
"alnum_prop": 0.5524722502522704,
"repo_name": "gencer/sentry",
"id": "93ba4a90dd5211e7fb944d18813d591b5ec7105e",
"size": "3964"... |
from django.conf.urls import url
from produto.views import *
urlpatterns = [
url(r'^inserir/$', Produto.as_view(), name='produto_inserir'),
url(r'^editar/$', Produto.as_view(), name='produto_editar'),
url(r'^deletar/$', Produto.as_view(), name='produto_deletar'),
url(r'^$', Produto.as_view(), name='cli... | {
"content_hash": "18f613fe218810b0e526e64643032148",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 66,
"avg_line_length": 36.666666666666664,
"alnum_prop": 0.6424242424242425,
"repo_name": "acca90/django-tests",
"id": "19b314dacd2911f75c141168178db0dd27ecbf76",
"size": "3... |
import numpy as np
import cPickle as pickle
from scipy.stats import mode
from sklearn.preprocessing import StandardScaler
from missing_data_imputation import Imputer
#declare csv headers
x = np.genfromtxt('../adult-dataset/adult-test-raw',
delimiter=', ', dtype=object)
# binarize labels
labels =... | {
"content_hash": "da11bfa4446118a644e934619f83a8e0",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 109,
"avg_line_length": 41.08064516129032,
"alnum_prop": 0.7406753042795445,
"repo_name": "jvpoulos/cs289-project",
"id": "ce067a9bed0ae96f563a8ff6cf38b1418c8b8b90",
"size... |
from datetime import timedelta, datetime
import sys
from mwparserfromhell import parse as parse_markup
from bwikibot.cli import get_wiki, action
from bwikibot.api import datetime2zulu, zulu2datetime, WikiError
from bwikibot.ui import cprint
@action('check_uploads')
def main(start_from, limit):
''' Check and mark... | {
"content_hash": "8080bddbba88c6cc59437f9467f9c4d1",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 164,
"avg_line_length": 33.71369294605809,
"alnum_prop": 0.5627076923076924,
"repo_name": "bunyk/bwikibot",
"id": "602de55dd666483c487050a023602cce5ac0d6ab",
"size": "8966... |
from flask_restful import Resource
class REST(Resource):
def __init__(self, **kwargs):
self._database = kwargs['database']
self._home = kwargs['home']
| {
"content_hash": "d15fdf65a0b0acff11865a0bbf8f50c1",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 37,
"avg_line_length": 22.571428571428573,
"alnum_prop": 0.6835443037974683,
"repo_name": "abelfodil/protohome",
"id": "eaa183747479bb81e5958411a6757af298f0f378",
"size": "1... |
from flask_wtf import Form
from wtforms import StringField, IntegerField
from wtforms.fields.html5 import EmailField
from wtforms.validators import *
class CreateMonkeyForm(Form):
name = StringField('name', validators=[DataRequired()])
age = IntegerField('age', validators=[DataRequired()])
email = EmailFi... | {
"content_hash": "277ae1598bac305bd46943cda50fa58a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 61,
"avg_line_length": 35.8125,
"alnum_prop": 0.7364746945898778,
"repo_name": "Nonse/monkeys",
"id": "f74dc9ecb093044dac44b4cd0ccae489bc5f31b1",
"size": "573",
"binary":... |
"""Formatter for the Keychain password database file."""
from plaso.formatters import interface
class KeychainApplicationRecordFormatter(interface.ConditionalEventFormatter):
"""Formatter for keychain application record event."""
DATA_TYPE = 'mac:keychain:application'
FORMAT_STRING_PIECES = [
u'Name: {... | {
"content_hash": "9b84891bc8a071924656b95e71558d8c",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 78,
"avg_line_length": 26.52777777777778,
"alnum_prop": 0.6973821989528796,
"repo_name": "cvandeplas/plaso",
"id": "ee70616f0a33507aae5f06dc758766c686a42a9d",
"size": "1653... |
from __future__ import unicode_literals
from django.db import migrations
import forum.models
class Migration(migrations.Migration):
dependencies = [
('forum', '0005_auto_20171006_1336'),
]
operations = [
migrations.AlterField(
model_name='post',
name='body',
... | {
"content_hash": "cf006735e14c96776cab99ec37ebd627",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 178,
"avg_line_length": 26.94736842105263,
"alnum_prop": 0.638671875,
"repo_name": "Kromey/akwriters",
"id": "e3d9d8168b01e7b0a8edb6c23cfb74c485064e9d",
"size": "585",
"b... |
"""
Fix typo
Revision ID: 2d6390eebe90
Revises: 08447ab49999
Create Date: 2018-11-12 03:05:20.555925
"""
from alembic import op
revision = "2d6390eebe90"
down_revision = "08447ab49999"
def upgrade():
op.create_index(
"journals_submitted_date_id_idx",
"journals",
["submitted_date", "id"]... | {
"content_hash": "cf70a51c52cf8831567d12126881a45b",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 75,
"avg_line_length": 20.8125,
"alnum_prop": 0.6291291291291291,
"repo_name": "pypa/warehouse",
"id": "4274672e6054084754cda0cd69fa51c2ef3b6d84",
"size": "1206",
"binary... |
import sys
from PyQt4 import QtCore
from PyQt4 import QtGui
import functools
from manual_control_ui import Ui_MainWindow
NUM_TUNNELS = 6
NUM_GATES_PER_TUNNEL = 3
NUM_LEDS_PER_TUNNEL = 2
Open = True
Close = False
On = True
Off = False
ODOR_0 = 0
ODOR_1 = 1
ETHANOL = 2
GATE_LED_DIGITAL_TAB_INDEX = 0
GATE_LED_ANALOG_TAB_... | {
"content_hash": "3d38fdd1fdb595895a851aeb4222ebc9",
"timestamp": "",
"source": "github",
"line_count": 632,
"max_line_length": 155,
"avg_line_length": 53.31487341772152,
"alnum_prop": 0.720848790621754,
"repo_name": "JaneliaSciComp/fly-alcohol-assay",
"id": "a1e7562a457fc37d6cd03830e1a4f49c2de6f8d3"... |
"""Abstraction for quantizing neural networks implemented in jax."""
import contextlib
import dataclasses
import enum
import functools
import logging
import typing
from typing import Iterable, Optional, Tuple, Union
from absl import flags
from aqt.jax_legacy.jax import compute_cost_utils
from aqt.jax_legacy.jax impor... | {
"content_hash": "8a1ac73df2e2780515871adc76873748",
"timestamp": "",
"source": "github",
"line_count": 1469,
"max_line_length": 105,
"avg_line_length": 42.89720898570456,
"alnum_prop": 0.6749873048114764,
"repo_name": "google/aqt",
"id": "983f575b7815ffd2cc5b4e274c2369216b8b117e",
"size": "63592",... |
from generate import Generator
from gensim import models
from plan import train_planner
from paths import save_dir
import argparse
import os
import sys
if __name__ == '__main__':
parser = argparse.ArgumentParser(description = 'Chinese poem generation.')
parser.add_argument('-p', dest = 'planner', default = Fa... | {
"content_hash": "4ce31915268003ee6d05f6954a43a1ad",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 78,
"avg_line_length": 37.29032258064516,
"alnum_prop": 0.6150519031141869,
"repo_name": "DevinZ1993/Chinese-Poetry-Generation",
"id": "b58f0e15533faf70fb925811a0406397246f96... |
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QStackedLayout
app = QApplication(sys.argv)
# Make widgets
window = QWidget()
btn1 = QPushButton("One")
btn2 = QPushButton("Two")
btn3 = QPushButton("Three")
# Set the layout
stack = QStackedLayout()
stack.addWidget(btn1)
stack.addWidget... | {
"content_hash": "bbaf2753ea86a318f46a288a23b94d75",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 119,
"avg_line_length": 21.52777777777778,
"alnum_prop": 0.7496774193548387,
"repo_name": "jeremiedecock/snippets",
"id": "b128a107077ef8ee2b91133b3a62bba47b54c3c4",
"size"... |
import logging
import logging.config
import os
import os.path
import click
from .geocoder import (BingGeocoder, get_addresses_from_file,
pretty_print_statuses, write_addresses_to_file)
try:
from .service import download_jobs, check_pending_jobs
except ImportError:
download_jobs = None
check_pending_jo... | {
"content_hash": "1886d0c3ffe8b1d3545e22589452a368",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 93,
"avg_line_length": 28.58041958041958,
"alnum_prop": 0.6266209933936873,
"repo_name": "newsapps/bing-bulk-geocoder",
"id": "d39cd18ebb1bd9c01823e0e4c9571dd252fc4a91",
"... |
"""
Author: robalar <rbthales@gmail.com>
URL: github.com/Streams
This file is part of streams
Streams is free software, and is distributed under the MIT licence.
See LICENCE or opensource.org/licenses/MIT
"""
from streams.search import providers
import logging
logger = logging.getLogger(__name__)
def do_search(ter... | {
"content_hash": "922ec69b41f98194246fde3eaf921247",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 92,
"avg_line_length": 24.75,
"alnum_prop": 0.6515151515151515,
"repo_name": "robalar/Streams",
"id": "670bf98f4d755c4929a8b6db09a2fd44bb0ff2ca",
"size": "990",
"binary":... |
from flask import Flask, render_template, session, redirect, url_for, flash
from flask_wtf import FlaskForm
from flask_bootstrap import Bootstrap
from wtforms import StringField, SubmitField
from wtforms.validators import DataRequired
app = Flask(__name__)
app.config['SECRET_KEY'] = 'had to guess string'
Bootstrap(a... | {
"content_hash": "78c95847b3622f33965c6ab312981067",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 83,
"avg_line_length": 29.151515151515152,
"alnum_prop": 0.6621621621621622,
"repo_name": "sharkspeed/dororis",
"id": "600c6d9aefcbb980d4e7a79dfb0c7f4bc9a786cc",
"size": "1... |
class Solution(object):
def inorderTraversal(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
list = []
return self.helper(root, list)
def helper(self, root, list):
if root == None:
return []
self.helper(root.left, list)
... | {
"content_hash": "3797b07561e4fc7a121d046641067170",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 38,
"avg_line_length": 23.88235294117647,
"alnum_prop": 0.5197044334975369,
"repo_name": "Jspsun/LEETCodePractice",
"id": "426bdec1dd0db261e03771a3ddf712db2fe2dd22",
"size"... |
from __future__ import absolute_import, division, print_function
import os
import sys
import _pytest._code
import py
import pytest
from _pytest.main import EXIT_NOTESTSCOLLECTED, EXIT_USAGEERROR
class TestGeneralUsage(object):
def test_config_error(self, testdir):
testdir.makeconftest("""
def... | {
"content_hash": "57564e435b0207331e3215ca71498d0c",
"timestamp": "",
"source": "github",
"line_count": 847,
"max_line_length": 101,
"avg_line_length": 34.226682408500594,
"alnum_prop": 0.5460158675405312,
"repo_name": "MichaelAquilina/pytest",
"id": "71277690641f16763fd0581d7ec5e78f3e28fdeb",
"siz... |
from testbase import TestBase
from corepro.externalaccount import ExternalAccount
class TestAcExternalAccountPrepaid(TestBase):
def setUp(self):
pass
def tearDown(self):
pass
def test_create(self):
ea = ExternalAccount()
ea.customerId = TestBase.prepaidCustomerId
... | {
"content_hash": "9765e9b846a66d0480e3dce702a51f0a",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 151,
"avg_line_length": 41.266666666666666,
"alnum_prop": 0.7162089391491653,
"repo_name": "socialmoney/corepro-sdk-python",
"id": "c072edf331b6d0ee524ce2fa8b2eb97b0a1e7345",... |
from nussl.separation.base.separation_base import SeparationBase
import pytest
from nussl.separation import (
primitive,
factorization,
composite,
SeparationException
)
import numpy as np
import os
import nussl
import copy
import random
REGRESSION_PATH = 'tests/separation/regression/composite/'
os.make... | {
"content_hash": "0fa28c71c8e349c5ab2cec17235eed82",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 91,
"avg_line_length": 31.117948717948718,
"alnum_prop": 0.5993737640079103,
"repo_name": "interactiveaudiolab/nussl",
"id": "0a15c69258caec171821e543117e9e250eeddf4a",
"s... |
import pexpect, os, sys, tty, select
lispCmd = '../arc.sh' # or, 'sbcl', or whatever should probably work
pipeLoc = os.path.expanduser("~/.vimarc-pipe") # this path has to be the same as in vimarc.vim
if not os.path.exists(pipeLoc):
os.system("mkfifo -m go-rwx " + pipeLoc)
class Funnel(pexpect.spawn):
""" hac... | {
"content_hash": "97366ba89297b945780049a0792231ef",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 103,
"avg_line_length": 39.73529411764706,
"alnum_prop": 0.5636565507031829,
"repo_name": "LaxWorks/news",
"id": "ff3aa818a4d24b9b38055f33a63d0e43d1c6afe8",
"size": "2820",... |
"""Tests of skipped field log message filtering"""
import logging
import os
import fiona
from fiona.logutils import LogFiltering, FieldSkipLogFilter
def test_filtering(caplog):
"""Test that ordinary log messages pass"""
logger = logging.getLogger()
with LogFiltering(logger, FieldSkipLogFilter()):
... | {
"content_hash": "4c2c747df4ce75ce8b87055ff65575ba",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 95,
"avg_line_length": 36.96153846153846,
"alnum_prop": 0.68210197710718,
"repo_name": "Toblerity/Fiona",
"id": "baa9bcf18b1a3f750f23c3062772e01c017f2b91",
"size": "1922",
... |
import json
import hashlib
import hmac
import pytest
from slackeventsapi import SlackEventAdapter
def create_signature(secret, timestamp, data):
req = str.encode('v0:' + str(timestamp) + ':') + str.encode(data)
request_signature= 'v0='+hmac.new(
str.encode(secret),
req, hashlib.sha256
).he... | {
"content_hash": "5cddb11c3a7973b26c249f22595e0456",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 72,
"avg_line_length": 27.04255319148936,
"alnum_prop": 0.6805664830841857,
"repo_name": "slackapi/python-slack-events-api",
"id": "052341564dfa5074214fff4ed1d2b8da2d86797b",... |
"""
We will start by initializing the database from wurfl stream.
It should return a tuple (db, index)
>>> from mobi.devices.index.radixtree import NOTSET
>>> from mobi.devices.wurfl.db import initialize_db
>>> db, index = initialize_db(config)
>>> db is not None
True
>>> index #doctest: +ELLIP... | {
"content_hash": "e642619e721e7bfddee5ef4c11933d36",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 74,
"avg_line_length": 24.54794520547945,
"alnum_prop": 0.6311383928571429,
"repo_name": "infrae/mobi.devices",
"id": "6a990231532ca3ec1a4fe6cab7d851d5de957a01",
"size": "1... |
from __future__ import absolute_import, unicode_literals
from kombu import Connection
from kombu.tests.case import Case, mock, patch
class test_get_manager(Case):
@mock.mask_modules('pyrabbit')
def test_without_pyrabbit(self):
with self.assertRaises(ImportError):
Connection('amqp://').g... | {
"content_hash": "273e30c375236fa1120989814bfad94d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 63,
"avg_line_length": 34.666666666666664,
"alnum_prop": 0.5849358974358975,
"repo_name": "Elastica/kombu",
"id": "03eb634e5bbda631932057a11157831612894ab1",
"size": "1248"... |
"""
Library for retrieving information about catkin packages.
"""
__version__ = '0.3.9' # same version as in setup.py
| {
"content_hash": "9177dea7105c7742e11fe7ae13efb8a6",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 57,
"avg_line_length": 24,
"alnum_prop": 0.6833333333333333,
"repo_name": "harmishhk/catkin_pkg",
"id": "54ef71c53b2233b6b2fa5797ed4ee45fd138c6c4",
"size": "1725",
"binary... |
import os
import unittest
from exprail import loader
from exprail.node import NodeType
class LoaderTest(unittest.TestCase):
"""Unittest for grammar loading"""
def test_missing_grammar_file(self):
with self.assertRaises(ValueError):
_ = loader.load_expressions('grammars/missing.grammar')
... | {
"content_hash": "6c53043ebbcedf8c654aacac1600260e",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 90,
"avg_line_length": 38.68571428571428,
"alnum_prop": 0.5960118168389956,
"repo_name": "piller-imre/exprail-python",
"id": "f52c6ce170958a64180905fd083e4dfaf59a0d1f",
"s... |
"""
Created on Sat Jan 25 22:34:05 2020
@author: mostafamousavi
"""
from EQTransformer.core.tester import tester
import pytest
import glob
import os
def test_predictor():
tester(input_hdf5='../sampleData&Model/100samples.hdf5',
input_testset='test_trainer_outputs/test.npy',
input_model='t... | {
"content_hash": "bea568bf0a0ae36e90e1ea6b0662186d",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 81,
"avg_line_length": 26.5,
"alnum_prop": 0.6067924528301887,
"repo_name": "smousavi05/EQTransformer",
"id": "731d1ce3e2a8a41d67af3ffcb21dd9a473dcf006",
"size": "1372",
... |
import json
import os
import subprocess
import uuid
from contextlib import contextmanager
import pytest
def exec_cmd(cmd, env=None, stdin=None, timeout=None):
"""Execute CLI command
:param cmd: Program and arguments
:type cmd: [str]
:param env: Environment variables
:type env: dict | None
:... | {
"content_hash": "d5b2935d9ecb9b231f161c51d3ebd385",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 90,
"avg_line_length": 30.347457627118644,
"alnum_prop": 0.607092990784697,
"repo_name": "kensipe/dcos-cli",
"id": "e12f120251770645c3af9c8f56ade010f6f8a001",
"size": "358... |
class Axis(object):
"""
:param label: Name of the Axis
:param format: d3.js axis format
:param dateFormat: Modify values to JS Date objects and set d3.time.format
refer to https://github.com/mbostock/d3/wiki/Time-Formatting
"""
def __init__(self, label=None, format=None,... | {
"content_hash": "52a6d81a678b9e6d378c22b27aa61479",
"timestamp": "",
"source": "github",
"line_count": 194,
"max_line_length": 120,
"avg_line_length": 36.402061855670105,
"alnum_prop": 0.5845369583687341,
"repo_name": "qedsoftware/commcare-hq",
"id": "87c6841e6f560c7562ae90996f68b9761ecfd02b",
"si... |
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('home', '0003_auto_20160929_1254'),
]
operations = [
migrations.AlterField(
model_n... | {
"content_hash": "7d28978216e67e001c8c9db90acca26c",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 108,
"avg_line_length": 25.76,
"alnum_prop": 0.5993788819875776,
"repo_name": "maxwallasaurus/arboretum",
"id": "de634cc8816665748513fd6952251d4f6f43ffbd",
"size": "717",
... |
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.gridspec as gridspec
from loguru import logger as log
from astropy.time import Time, TimeDelta
from nicer.plotutils import *
def sci_plots(etable, gtitable, args):
# GRID SET UP
figure2 = plt.figure(figsize=(11, 8.5), facecolor="white")
... | {
"content_hash": "9d28f5c487d4830d32ea9d4dd3faa9ed",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 112,
"avg_line_length": 35.00813008130081,
"alnum_prop": 0.6179749187180679,
"repo_name": "paulray/NICERsoft",
"id": "d0ce75029bee86adbbb5a54042ba300ff4b4a22c",
"size": "4... |
"""
GIS: GIS related utilities.
"""
###############################################################################
## Imports
###############################################################################
import math
###############################################################################
## GIS Format Con... | {
"content_hash": "ad974598f3aeb61071e6b1f2d20d5df1",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 79,
"avg_line_length": 28.962962962962962,
"alnum_prop": 0.5166240409207161,
"repo_name": "scdoshi/djutils",
"id": "ead5fa33dec7171d3a19058af867a48ad9c74f86",
"size": "2346... |
'''
Written by Lijun An and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
'''
import os
import argparse
import pandas as pd
import numpy as np
import xgboost as xgb
from scipy.stats import sem
from config import global_config
from utils.misc import txt2list, list2txt, create_folder... | {
"content_hash": "a12fe5dca1cdc70906cc124c79947431",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 79,
"avg_line_length": 38.712418300653596,
"alnum_prop": 0.5880465980077664,
"repo_name": "ThomasYeoLab/CBIG",
"id": "e81efd4d257f9580a1e51a1f042e0630ba163031",
"size": "5... |
from django import template
from django.core.cache import cache
from docutils import nodes
from docutils.core import publish_parts
from docutils.parsers.rst import directives, Directive
from docutils.core import publish_cmdline, default_description
from pygments import highlight
from pygments.lexers import get_lexer_by... | {
"content_hash": "53cd6d327f628a7f6911648fc411e7f4",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 103,
"avg_line_length": 41.989010989010985,
"alnum_prop": 0.6370060193666579,
"repo_name": "Justasic/StackSmash",
"id": "4f03f114e11f943f32ffde8aa2b6c0ef86568917",
"size": ... |
import logging
from pprint import pformat
import re
from string import Formatter
from jenkins_jobs.errors import JenkinsJobsException
from jenkins_jobs.local_yaml import CustomLoader
logger = logging.getLogger(__name__)
def deep_format(obj, paramdict, allow_empty=False):
"""Apply the paramdict via str.format() ... | {
"content_hash": "4ffb128d66c75223693941295a500632",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 79,
"avg_line_length": 36.719298245614034,
"alnum_prop": 0.5652173913043478,
"repo_name": "rsig/jenkins-job-builder",
"id": "008d66e74d8cf1e6494108f0839347c580c5b346",
"si... |
'''
This module provides utility functions to format data
'''
def prettify_seconds(seconds):
"""
Prettifies seconds.
Takes number of seconds (int) as input and returns a prettified string.
Example:
>>> prettify_seconds(342543)
'3 days, 23 hours, 9 minutes and 3 seconds'
"""
if seconds ... | {
"content_hash": "e237482f899b60d31657a501a57fb421",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 99,
"avg_line_length": 38.87096774193548,
"alnum_prop": 0.6016597510373444,
"repo_name": "Stefan-Code/gglsbl3",
"id": "b07ecf333dc0ef599503df7aef43ffcd1a132b40",
"size": "2... |
import scrapy
import re
from locations.items import GeojsonPointItem
class LouGreySpider(scrapy.Spider):
name = "lou_grey"
allowed_domains = ["stores.louandgrey.com"]
download_delay = 0.5
start_urls = (
'https://stores.louandgrey.com/',
)
def parse_stores(self, response):
r... | {
"content_hash": "aa3b98d56a62c8be726ba76a5ca51dc5",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 193,
"avg_line_length": 48.276923076923076,
"alnum_prop": 0.5959209687699172,
"repo_name": "iandees/all-the-places",
"id": "b1fca5a5dd85c2a86d8a89382454462f22c07fba",
"size... |
from setuptools import setup
import re
try:
import multiprocessing
except ImportError:
pass
# harddeal, hardeal, onus
pledge_py = open('pledge/__init__.py').read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", pledge_py))
# Metadata fields extracted from decontractors.py
AUTHOR_EMAIL = metadata['a... | {
"content_hash": "ee8fefe6834992d3cf39abd44ee68350",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 67,
"avg_line_length": 24.555555555555557,
"alnum_prop": 0.670814479638009,
"repo_name": "jhorman/pledge",
"id": "b727a0bef801592b0d0fd19536fc01c74a317b8b",
"size": "971",
... |
import copy
import json
import logging
from datetime import datetime
from cryptography.fernet import Fernet
from sqlitedict import SqliteDict
from mirror.event_bus import Event
from mirror.paths import ROOTDIR
_logger = logging.getLogger(__name__)
class PluginContext:
"""Services provided to plugins.
Plug... | {
"content_hash": "e64e11127d665093f10ebe7e24f7a921",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 87,
"avg_line_length": 32.554054054054056,
"alnum_prop": 0.6168534661685346,
"repo_name": "genericmoniker/mirror",
"id": "24d8469626e65737defc8c1e1ee47cd4cdac12c2",
"size"... |
"""Opinionated basic logging setup."""
import logging
import sys
LOGGERS = {}
def get_handler():
"""Return a stdout stream handler"""
handler = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter(
"[%(asctime)s][%(name)10s][%(levelname)7s] %(message)s"
)
handler.setFormatter(... | {
"content_hash": "4143227b86b7fe478f0aa1cfcf246b0c",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 67,
"avg_line_length": 25.333333333333332,
"alnum_prop": 0.618421052631579,
"repo_name": "uc-cdis/cdis-python-utils",
"id": "f21cc1a58da18b64e89ab228744bbb8e21934065",
"siz... |
from ...Helpers.environment import Environment
def while_statement(env, node):
"""
'While' statement def for AST.
interpret - runtime function for Evaluator (body interpret while condition).
"""
while node.condition.interpret(env):
node.body.interpret(env)
def for_statement(env, node):
... | {
"content_hash": "39acff34432539ffea07163c0f28c8d5",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 80,
"avg_line_length": 27.228571428571428,
"alnum_prop": 0.6516264428121721,
"repo_name": "PetukhovVictor/compiler",
"id": "22ae1abead9672da3fd0260a0ec97cbb1165a3ad",
"size... |
import _plotly_utils.basevalidators
class StepsValidator(_plotly_utils.basevalidators.CompoundArrayValidator):
def __init__(self, plotly_name="steps", parent_name="layout.slider", **kwargs):
super(StepsValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "19ac47ecc07917f60de19516ee13fe89",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 83,
"avg_line_length": 47.940298507462686,
"alnum_prop": 0.563200498132005,
"repo_name": "plotly/plotly.py",
"id": "c2f6b1f0c7d250fa5dbae75e4b2a67da8f5ec1e2",
"size": "3212... |
"""
Code to load an expert policy and generate roll-out data for behavioral cloning.
Example usage:
python run_expert.py experts/Humanoid-v1.pkl Humanoid-v1 --render \
--num_rollouts 20
Author of this script and included expert policies: Jonathan Ho (hoj@openai.com)
"""
import pickle
import tensorflow... | {
"content_hash": "6fe2dd67d13d3bdad38be44c57ea2504",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 96,
"avg_line_length": 30.990654205607477,
"alnum_prop": 0.5464414957780458,
"repo_name": "pashadude/TensorflowReinforcementLearning",
"id": "a4ceea40a3644eb477b84dbaba23506... |
from __future__ import unicode_literals
from django.db import migrations, models
import utils.validators
class Migration(migrations.Migration):
dependencies = [
('events', '0014_auto_20151012_1419'),
]
operations = [
migrations.AlterField(
model_name='event',
name=... | {
"content_hash": "b96001f9ff41bf50ad14173670f699f9",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 119,
"avg_line_length": 40.86046511627907,
"alnum_prop": 0.5304496300512237,
"repo_name": "I-sektionen/i-portalen",
"id": "6c935cb64ee9416bc5928c898edde1420c3a07f1",
"size"... |
from mcrouter.test.MCProcess import Memcached
from mcrouter.test.McrouterTestCase import McrouterTestCase
import os
import time
class TestDebugFifos(McrouterTestCase):
config = './mcrouter/test/mcrouter_test_basic_1_1_1.json'
extra_args = ['--proxy-threads=1']
def setUp(self):
self.add_server(Mem... | {
"content_hash": "f0bc44ae49000c034b86e54cc1ffcea1",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 75,
"avg_line_length": 32.01851851851852,
"alnum_prop": 0.6124927703875073,
"repo_name": "facebook/mcrouter",
"id": "c334d162bc1320b110e0422ba9758d3b2da399bd",
"size": "193... |
"""
Command Interface for interacting with controllers.
"""
from pycopia import CLI
from pycopia import IO
from pycopia import UI
class ConfiguratorShellCLI(CLI.GenericCLI):
def _setup(self, obj, name):
# Obtain host name directly from device.
# this also asserts the configurator is working.
... | {
"content_hash": "0b4a0081f42584282765db70ea5b790a",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 93,
"avg_line_length": 25.84375,
"alnum_prop": 0.5722490931076178,
"repo_name": "kdart/pycopia3",
"id": "8fcbe036225a504978c1b61f440472d0bdf48aa6",
"size": "3376",
"bina... |
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.core.exceptions import SuspiciousOperation
from django.db import IntegrityError, transaction, router
from django.utils.encoding import force_unicode
from django.utils import timezone
class SessionStore(SessionBase):
"""
Imp... | {
"content_hash": "bb9cee00b0789f76e7d7f1692e1f4231",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 77,
"avg_line_length": 33.851851851851855,
"alnum_prop": 0.5929978118161926,
"repo_name": "mixman/djangodev",
"id": "219d97d36841a6ab4a163e80f1d9069a11516f65",
"size": "274... |
"""This example updates the CPC bid and status for a given ad group.
To get ad groups, run get_ad_groups.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentication i... | {
"content_hash": "596d2f48328c27490ce80000c9b6642e",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 78,
"avg_line_length": 29.231884057971016,
"alnum_prop": 0.6351016360932077,
"repo_name": "Aloomaio/googleads-python-lib",
"id": "879c7334f6eef0a5322cb3d3466aca019ca4f033",
... |
from django.core import formfields, validators
from django.core.extensions import DjangoContext, render_to_response
from django.core.template import loader
from django.models.auth import users
from django.views.decorators.auth import login_required
from django.utils.httpwrappers import HttpResponseRedirect
class Passw... | {
"content_hash": "2ce634bfbcee6bb9d625eb3461888f44",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 139,
"avg_line_length": 45.31,
"alnum_prop": 0.6618847936437873,
"repo_name": "tungvx/deploy",
"id": "09d3037560b2f4c8e16ef2f97b56d367c50946e2",
"size": "4531",
"binary"... |
import math
import random
import pickle
ALPHA = 1
def sigmoid(x):
return 1/(1 + math.pow(math.e, -x))
def linear(x):
return x
"""NEURONS"""
class Neuron(object):
def __init__(self, fn):
self.sum = 0
self.fn = fn
def add(self, value):
pass
def clear(self):
self.sum = 0
def output(self):
return sel... | {
"content_hash": "a8eff397e6ffc58d385f572ac3f4ac08",
"timestamp": "",
"source": "github",
"line_count": 249,
"max_line_length": 97,
"avg_line_length": 22.518072289156628,
"alnum_prop": 0.6695202425539504,
"repo_name": "zaibacu/pynn",
"id": "797ccd19d148f88205dd7efa50228aa5bea32309",
"size": "5607",... |
from django.conf.urls import url
from tracker.views import *
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required
app_name = 'tracker'
urlpatterns = [
#url(r'^$', lambda r: HttpResponseRedirect('issues')),
url(r'^issues/$', issue_view, name='issues'),
url(r'^notific... | {
"content_hash": "d50c65b658eaa50f5060a612d5669dfd",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 122,
"avg_line_length": 50.833333333333336,
"alnum_prop": 0.7191256830601093,
"repo_name": "giantas/elibrary",
"id": "5866033e00848bf77cd0bdd9b3a5224827964135",
"size": "91... |
"""
mnist_loader
~~~~~~~~~~~~
A library to load the MNIST image data. For details of the data
structures that are returned, see the doc strings for ``load_data``
and ``load_data_wrapper``. In practice, ``load_data_wrapper`` is the
function usually called by our neural network code.
"""
#### Libraries
# Standard libr... | {
"content_hash": "0751d96a395e7ed93586359c49ec348a",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 81,
"avg_line_length": 44.16883116883117,
"alnum_prop": 0.6833284328138782,
"repo_name": "quoniammm/happy-machine-learning",
"id": "c768b30212490bf96274cab7b9d6dc91795de14e",... |
from json import loads
from manager_rest.test import base_test
class UserTestCase(base_test.BaseServerTestCase):
def test_get_user(self):
response = self.get('/user')
result = loads(response.data)
self._assert_response(result)
def _assert_response(self, result):
self.assertE... | {
"content_hash": "de2c3439218ac66f56c25e530fabf64b",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 62,
"avg_line_length": 33.3,
"alnum_prop": 0.6576576576576577,
"repo_name": "cloudify-cosmo/cloudify-manager",
"id": "27a511bd74a0cd89482a2193c0d014127d2ccdb2",
"size": "13... |
from flexbe_core import Behavior, Autonomy, OperatableStateMachine, ConcurrencyContainer, PriorityContainer, Logger
from sara_flexbe_states.GetRosParam import GetRosParam
from flexbe_states.check_condition_state import CheckConditionState
from sara_flexbe_states.list_entities_by_name import list_entities_by_name
from f... | {
"content_hash": "15e8bfac84d7a3f0b33d2945ea389e4f",
"timestamp": "",
"source": "github",
"line_count": 274,
"max_line_length": 119,
"avg_line_length": 35.872262773722625,
"alnum_prop": 0.6241733645335232,
"repo_name": "WalkingMachine/sara_behaviors",
"id": "cbe28f27bf07d835654278475b19593f281497e2",... |
"""Low level testing function (draw a cube)
This module provides a simple function for drawing
a cube. It is used by various modules for low level
testing purposes (i.e. in module-level rather than
system level tests).
This version was taken from the NeHe tutorials,
to replace the original which did not include
text... | {
"content_hash": "15a2cab4298195f9bca87cce46052f42",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 77,
"avg_line_length": 36.94827586206897,
"alnum_prop": 0.5142323845076995,
"repo_name": "alexus37/AugmentedRealityChess",
"id": "4f555ce3ada735e80060766e05f3a4ba67d2659a",
... |
import os, sys, re
import numpy as np
import pyfits, pylab
from .dataset import Dataset
class DECaLSData(Dataset):
def __init__(self, decalsfilename=None):
"""DECaLSData(decalsfilename=None)
Read in DECaLS catalog data from FITS file.
"""
Dataset.__init__(self, decalsfilename, "DECaLSData", '')
... | {
"content_hash": "02541e87bd34f87d4b6f1e9761d06892",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 247,
"avg_line_length": 36.65395894428153,
"alnum_prop": 0.5562044963597088,
"repo_name": "wkiri/DEMUD",
"id": "dd53069e184d5d7799bf23f596ca12d6842c7e6b",
"size": "13373",... |
"""Some utility functions."""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#
# License: BSD (3-clause)
from collections import OrderedDict
from copy import deepcopy
import logging
import json
import numpy as np
from .check import _check_pandas_installed, _check_preload, _validate_type
from ._logging i... | {
"content_hash": "48f11157258414f5187fed6442606d65",
"timestamp": "",
"source": "github",
"line_count": 537,
"max_line_length": 79,
"avg_line_length": 36.625698324022345,
"alnum_prop": 0.5458612975391499,
"repo_name": "rkmaddox/mne-python",
"id": "79cd45f6c9ed7b981cf6150cce8a94216af7772c",
"size": ... |
import tornado.ioloop
import tornado.web
import tornado.options
import logging
import json
from feedgen.feed import FeedGenerator
import os
logger=logging
# logger = logging.getLogger('web-codereview')
# logger.setLevel(logging.DEBUG)
# # create console handler and set level to debug
# ch = logging.StreamHandler()
# ... | {
"content_hash": "aca6d75bc59d2fefa6a322475b882d6f",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 139,
"avg_line_length": 29.366336633663366,
"alnum_prop": 0.6481793661496965,
"repo_name": "adewinter/hosting-codereview",
"id": "cbc72ded37bf07337d0d84cc4adf4def88de5217",
... |
import httplib as http
import os
from flask import send_from_directory
from framework import status
from framework import sentry
from framework.routing import Rule
from framework.flask import redirect
from framework.routing import WebRenderer
from framework.exceptions import HTTPError
from framework.auth import get_d... | {
"content_hash": "3829dcd947512e550431dc7caf6ab991",
"timestamp": "",
"source": "github",
"line_count": 1097,
"max_line_length": 106,
"avg_line_length": 32.27894257064722,
"alnum_prop": 0.5204462016379554,
"repo_name": "AndrewSallans/osf.io",
"id": "1ec502771bfcc3edabff7e6fa7ce26d6a34a4905",
"size"... |
import sys
import unittest
import itertools
from shenv import core
context = core.Context()
universe = context.universe
category = context.category
version = context.version
class HandlesCallbacks:
def __append(self,name,univ,cat,ver,state):
t = lambda x: type(x) if x is not None else None
... | {
"content_hash": "6a204b906f51ca3a24994b4b14e46b90",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 111,
"avg_line_length": 29.665689149560116,
"alnum_prop": 0.6099248714907078,
"repo_name": "josharnold52/shenv",
"id": "234b3108c6214c5e87ac49c02e7e2bc1fc7a2311",
"size": ... |
"""
Django settings for ccbc_library project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ..... | {
"content_hash": "59015dce5f7fa200ca9e9d3a51f8d0cc",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 106,
"avg_line_length": 30.47486033519553,
"alnum_prop": 0.6823098075160403,
"repo_name": "comsaint/ccbc",
"id": "1722b215e3137778b99cb34a7ab2aef496fc08c5",
"size": "5455"... |
"""
stringimporter
=================
dumb loading of arbitrary strings into simulated Python modules
"""
import importlib.abc
import sys
import types
class DummyModuleLoader(importlib.abc.SourceLoader):
def __init__(self, name, src_code, filename=None):
self._dummy_name = name
self._src_code = s... | {
"content_hash": "e3cbfa4ff5f2927bd078cd7c95abadb2",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 79,
"avg_line_length": 30.5,
"alnum_prop": 0.6531147540983606,
"repo_name": "majerteam/stringimporter",
"id": "c3c39683360ffb72e280af062cfe055a2bf2df6f",
"size": "1525",
... |
from .chainpoint import ChainPointV2
__version__ = '0.2.1'
| {
"content_hash": "bdb9b7b1234ea3f01b2194cd7cf04835",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 36,
"avg_line_length": 20,
"alnum_prop": 0.7,
"repo_name": "karask/blockchain-proofs",
"id": "ba85dd38a5f328628643aec7b2232593b2969230",
"size": "60",
"binary": false,
"... |
import time
from upm import pyupm_temperature as upm
from upm import pyupm_servo as servo
from wiringx86 import GPIOGalileo as GPIO
from upm import pyupm_jhd1313m1 as lcd
pino_sensor_temperatura = 0
pino_rele = 5
pino_pot = 15
pino_servo = 8
pinos = GPIO(debug=False)
pinos.pinMode(pino_rele, pinos.OUTPUT)
pinos.pinMo... | {
"content_hash": "120fa9ede52f413b8ba5a68c441b6efa",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 54,
"avg_line_length": 24.904761904761905,
"alnum_prop": 0.7351816443594646,
"repo_name": "Atzingen/curso-IoT-2017",
"id": "ae3f88632e2eb4202f8b30a15280686076dd4f80",
"size... |
from sql_translator.sql_parser.parser import SQLScript
from sql_translator.sql_parser.lexer import SQLLexer
def parse(sql):
return SQLScript.parse(SQLLexer(sql))
| {
"content_hash": "aa9eab0910fb6df354b12adbe0daf51b",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 54,
"avg_line_length": 28,
"alnum_prop": 0.7976190476190477,
"repo_name": "GoogleCloudPlatform/datacatalog-tag-engine",
"id": "2683da5a534610887042129a1d68829c2d02f287",
"si... |
from core.moduleguess import ModuleGuess
from core.moduleexception import ProbeException, ProbeSucceed
from core.argparse import ArgumentParser
from tempfile import mkdtemp
from os import path
mysqlphpdump = """
function dmp ($tableQ)
{
$result = "\n-- Dumping data for table `$tableQ`\n";
$query = mysql_query(... | {
"content_hash": "6d4ca3a3627eca916ab66042e2d82162",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 160,
"avg_line_length": 37.4,
"alnum_prop": 0.5109922756981581,
"repo_name": "JeyZeta/Dangerous",
"id": "3ecb60ae3d3d327bf81afb57c45963772b09c5b4",
"size": "5049",
"bina... |
import tensorflow as tf
import os, time, json
from openml.apiconnector import APIConnector
from scipy.io.arff import loadarff
import numpy as np
from SGDDataset import SGDDataSet
# The MNIST dataset has 10 classes, representing the digits 0 through 9.
NUM_CLASSES = 10
# The MNIST images are always 28x28 pixels.
IMAGE... | {
"content_hash": "9f301fa8da073dd283524cef273b96ef",
"timestamp": "",
"source": "github",
"line_count": 238,
"max_line_length": 122,
"avg_line_length": 42.48739495798319,
"alnum_prop": 0.6275712025316456,
"repo_name": "lidalei/DataMining",
"id": "4e7e71751e656731d3137153985fedc1187e8214",
"size": "... |
import logging
from google.appengine.ext import db
from rogerthat.bizz.job import run_job
from rogerthat.utils import now
from shop.models import CustomerSignup, CustomerSignupStatus
def all_pending_signups():
return CustomerSignup.all(keys_only=True).filter('status', CustomerSignupStatus.PENDING)
def remove_... | {
"content_hash": "3d8d08b8965483aca60c562cd553a025",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 92,
"avg_line_length": 34.07692307692308,
"alnum_prop": 0.7415349887133182,
"repo_name": "our-city-app/oca-backend",
"id": "527f6fcf89c87ebdf6090e2747662a3fd0f2c410",
"size... |
from bs4 import BeautifulSoup as Soup
import urls
import re
import proxy
from datetime import *
import time
from time import mktime
import functions
from pytz import timezone
import authenticate
def team_books ( config, session = False ):
url = "https://www.lectio.dk/lectio/%s/BD/HoldReservations.aspx?HoldID=%s" % ( ... | {
"content_hash": "1d9cd09e43d215a4d8fa5d88ce925e48",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 130,
"avg_line_length": 29.36986301369863,
"alnum_prop": 0.6464552238805971,
"repo_name": "boh1996/LectioAPI",
"id": "b6e452f4c2a33c1a0ed200f87c45b9672cb9b267",
"size": "21... |
"""
Multi cut -- Thai word segmentation with maximum matching.
Original code from Korakot Chaovavanich.
:See Also:
* `Facebook post \
<https://www.facebook.com/groups/408004796247683/permalink/431283740586455/>`_
* `GitHub Gist \
<https://gist.github.com/korakot/fe26c65dc9eed467f4497f784a805716... | {
"content_hash": "568ec74c748fcdcc5770bfedf083c1de",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 86,
"avg_line_length": 27.962025316455698,
"alnum_prop": 0.5425531914893617,
"repo_name": "PyThaiNLP/pythainlp",
"id": "8f2df023a588c84c27ca6de63f403e7f3f67b83a",
"size": ... |
"""Test utils."""
import functools
from typing import Any, Callable
import chex
from etils import enp
from jax3d.utils.typing import Tree
import numpy as np
def assert_tree_all(
fn: Callable[..., Any],
*trees: Tree[Any],
) -> None:
"""`chex.assert_tree_all_equal_comparator` with automatic error message.
... | {
"content_hash": "de159f61e4ebf90de6c2cf041eee0639",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 75,
"avg_line_length": 25.797752808988765,
"alnum_prop": 0.6371951219512195,
"repo_name": "google-research/jax3d",
"id": "3e66c27fcc02cb3e23e8896f0f2e8427f803852f",
"size":... |
"""
TileMap loader for python for Tiled, a generic tile map editor
from http://mapeditor.org/ .
It loads the \*.tmx files produced by Tiled.
"""
# Versioning scheme based on: http://en.wikipedia.org/wiki/Versioning#Designating_development_stage
#
# +-- api change, probably incompatible with older versions
# | ... | {
"content_hash": "238ef7ceefbc5ac8a8a196a5b0d00ba7",
"timestamp": "",
"source": "github",
"line_count": 909,
"max_line_length": 116,
"avg_line_length": 35.42684268426843,
"alnum_prop": 0.5221252678321896,
"repo_name": "Knowlege/tiledtmxloader",
"id": "fc06bdb3dab3deb0be86156c4177a63ec0a20b61",
"siz... |
from datetime import datetime
from trac.core import *
from trac.resource import Resource
from trac.util.datefmt import from_utimestamp, to_utimestamp, utc
from trac.util.translation import _
from trac.wiki.api import WikiSystem
class WikiPage(object):
"""Represents a wiki page (new or existing)."""
realm = ... | {
"content_hash": "b1613be5081a559e3079f2aba8e8b775",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 79,
"avg_line_length": 39.74863387978142,
"alnum_prop": 0.5299697552928238,
"repo_name": "zjj/trac_hack",
"id": "fe2b0bfebc23f7d9b1fa0a1a7a790e3961cb1620",
"size": "7982",... |
import csv
import os
import scrapy
file = open('RootList.csv', 'rb')
reader = csv.reader(file)
RootList = list(reader)
file.close()
print RootList
if os.path.isfile('NodeListMul.csv'):
os.system('rm NodeListMul.csv')
for element in RootList:
file = open('RootPath.dat','wb') # write RootList into RootPath.dat;
... | {
"content_hash": "766632452029884ae51a92baf40a9196",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 70,
"avg_line_length": 19.28205128205128,
"alnum_prop": 0.6861702127659575,
"repo_name": "sortsimilar/Citation-Tree",
"id": "78cea4c0fd0f83a4ff40064306207b33c2631bf7",
"siz... |
'''BonjourMeal URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-b... | {
"content_hash": "55448ac62afa1c22220a2dfd9e5bba48",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 77,
"avg_line_length": 36.074074074074076,
"alnum_prop": 0.7094455852156057,
"repo_name": "google-business-communications/bm-bonjour-meal-django-starter-code",
"id": "69633a4... |
"""
Copyright (c) 2012, Vukasin Toroman <vukasin@toroman.name>
"""
import subprocess
import tornado.ioloop
import time
import fcntl
import functools
import os
class GenericSubprocess (object):
def __init__(self, timeout=-1, **popen_args):
self.args = dict()
self.args["stdout"] = subprocess.PIPE
... | {
"content_hash": "df0a1c5dd25755d86fbdcc45762cabed",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 182,
"avg_line_length": 36.22222222222222,
"alnum_prop": 0.5990115882753919,
"repo_name": "golden-tech-native/gd_facerecognize",
"id": "63f527b9b7f03e40f7f37e6106f6a578d6051... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('councilmatic_core', '0048_post_shape'),
]
operations = [
migrations.AlterModelOptions(
name='membership',
options={'base_manager_name': 'objects'},
),
... | {
"content_hash": "afa34f13a8c3b467db1024240f1db794",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 64,
"avg_line_length": 27.17142857142857,
"alnum_prop": 0.5331230283911672,
"repo_name": "datamade/django-councilmatic",
"id": "a980e54b6736ecb55321a9724b4c96855bcfd841",
"... |
import abc
class AmphoraLoadBalancerDriver(object, metaclass=abc.ABCMeta):
@abc.abstractmethod
def update_amphora_listeners(self, loadbalancer, amphora,
timeout_dict):
"""Update the amphora with a new configuration.
:param loadbalancer: List of listeners to up... | {
"content_hash": "232efd3740a332c44173660491b8fbff",
"timestamp": "",
"source": "github",
"line_count": 270,
"max_line_length": 80,
"avg_line_length": 42.42962962962963,
"alnum_prop": 0.6274441340782123,
"repo_name": "openstack/octavia",
"id": "1886cb4cf8acd1a2e7565a8a2e94bf8dd9d04f3b",
"size": "12... |
from datetime import datetime
from app import create_uuid, db
from app.dao.dao_utils import autocommit, version_class
from app.models import (
COMPLAINT_CALLBACK_TYPE,
DELIVERY_STATUS_CALLBACK_TYPE,
ServiceCallbackApi,
)
@autocommit
@version_class(ServiceCallbackApi)
def save_service_callback_api(service... | {
"content_hash": "be76a66c43eba04a78acc91d49b20c1a",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 115,
"avg_line_length": 32.30612244897959,
"alnum_prop": 0.7567909033480733,
"repo_name": "alphagov/notifications-api",
"id": "dae4a01bfce5454003aaf160f6758357457a3fd4",
"s... |
"""
Test HeatMap
------------
"""
import folium
from folium.plugins import HeatMap
from folium.utilities import normalize
from jinja2 import Template
import numpy as np
import pytest
def test_heat_map():
np.random.seed(3141592)
data = (np.random.normal(size=(100, 2)) * np.array([[1, 1]]) +
np.... | {
"content_hash": "90dc69d230ce6296517d1da0d0ea196d",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 144,
"avg_line_length": 27.852941176470587,
"alnum_prop": 0.5575501583949314,
"repo_name": "ocefpaf/folium",
"id": "2515399b2cd572cbd19d47b77cff3f89dd2cfe5e",
"size": "1894... |
from google.cloud.vision_helpers.decorators import add_single_feature_methods
from google.cloud.vision_helpers import VisionHelpers
from .services.image_annotator import ImageAnnotatorClient as IacImageAnnotatorClient
from .services.image_annotator import ImageAnnotatorAsyncClient
from .services.product_search import ... | {
"content_hash": "ae6411b7effd835a95c938ec0323f95e",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 85,
"avg_line_length": 40.54736842105263,
"alnum_prop": 0.8155503634475597,
"repo_name": "googleapis/python-vision",
"id": "bfe927d259d6bcbf8d72f5051a2439a2c361434d",
"siz... |
from shinymud.lib.sport_plugins import SportError
from shinymud.models.area import Area
import traceback
import json
import re
def format(world, raw_data):
"""Deserialize an area saved in ShinyAreaFormat and adds it to the world.
raw_data - the data to be deserialized into a Shiny Area object.
world ... | {
"content_hash": "08e35631acc5ca0753fb52c302b07c5b",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 78,
"avg_line_length": 42.55,
"alnum_prop": 0.6089894242068156,
"repo_name": "shinymud/ShinyMUD",
"id": "ff4cbbb4ab241253694e72ad2ee31a04a4fa03f2",
"size": "3404",
"binar... |
__license__ = 'MIT License <http://www.opensource.org/licenses/mit-license.php>'
__author__ = 'Lucas Theis <lucas@theis.io>'
__docformat__ = 'epytext'
try:
from django.conf.urls import url
except ImportError:
from django.conf.urls.defaults import url
from publications import views
app_name = 'publications'
u... | {
"content_hash": "a760d89c58804deba3f9e74cc4d8b9d5",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 80,
"avg_line_length": 34.904761904761905,
"alnum_prop": 0.616643929058663,
"repo_name": "lucastheis/django-publications",
"id": "58d2c15ba9bfb0c1da0261cb7d92dead0bafb85c",
... |
import unittest
from telemetry.internal.backends.chrome import gpu_compositing_checker
from telemetry.internal.platform import system_info
class GpuCompositingChecker(unittest.TestCase):
def testAssertGpuCompositingEnabledFailed(self):
data = {
'model_name': 'MacBookPro 10.1',
'gpu': {
... | {
"content_hash": "0b424d7b7457b92eb51776fde8b608b8",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 70,
"avg_line_length": 31.435897435897434,
"alnum_prop": 0.6027732463295269,
"repo_name": "endlessm/chromium-browser",
"id": "91c0900f2563e6974980493ec91de4f5b4f678db",
"si... |
"""Single slice vgg with normalised scale.
"""
import functools
import lasagne as nn
import numpy as np
import theano
import theano.tensor as T
import data_loader
import deep_learning_layers
import image_transform
import layers
import preprocess
import postprocess
import objectives
import theano_printer
import update... | {
"content_hash": "7c22cfe06e1bafb06ecf044c3f14c9e3",
"timestamp": "",
"source": "github",
"line_count": 213,
"max_line_length": 175,
"avg_line_length": 44.924882629107984,
"alnum_prop": 0.6996551363778869,
"repo_name": "317070/kaggle-heart",
"id": "bd1f254cdf1306609809e207053494d9e77cfc1b",
"size":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.