text stringlengths 4 1.02M | meta dict |
|---|---|
"""Helpers for the decoding phase of jobs."""
import pickle
import lingvo.compat as tf
from lingvo.core import py_utils
from lingvo.core.ops import record_pb2
def WriteKeyValuePairs(filename, key_value_pairs):
"""Writes `key_value_pairs` to `filename`."""
with open(filename, 'wb') as f:
pickle.dump(key_valu... | {
"content_hash": "c9c9d3261749867f24f2e1b7ff9024e3",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 69,
"avg_line_length": 28.2,
"alnum_prop": 0.7222222222222222,
"repo_name": "tensorflow/lingvo",
"id": "c693a534c0c2863c46b119131ca9cc8c22499bf9",
"size": "1535",
"binary... |
import abc
from typing import Awaitable, Callable, Optional, Sequence, Union
import pkg_resources
import google.auth # type: ignore
import google.api_core # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core... | {
"content_hash": "a522278d3553632fcc1005c87fc24019",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 101,
"avg_line_length": 36.31794871794872,
"alnum_prop": 0.6107031911889297,
"repo_name": "googleads/google-ads-python",
"id": "1dc1bed3ebbf6bb0f21ac964430d85e2a439348c",
... |
"""
tu
~~~~~~~~~~~~~~~
Text Universes module.
"""
import webapp2
from main import jinja_env
class BaseHandler(webapp2.RequestHandler):
def prepare_response(self, template_path, **kwargs):
temp = jinja_env.get_template(template_path)
self.response.write(temp.render(kwargs))
def pr... | {
"content_hash": "24ead71add2502673b2895a59a9c7bb7",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 56,
"avg_line_length": 24.38888888888889,
"alnum_prop": 0.6514806378132119,
"repo_name": "dlebech/Text-Universes",
"id": "e4023fbccb1fde6ae48a332ba5b9789a1616f2c9",
"size":... |
"""Generate a dot graph from the output of several profilers."""
__author__ = "Jose Fonseca et al"
import sys
import math
import os.path
import re
import textwrap
import optparse
import xml.parsers.expat
import collections
import locale
# Python 2.x/3.x compatibility
if sys.version_info[0] >= 3:
PYTHON_3 = Tru... | {
"content_hash": "a0ff6e922ff9ecb5ecab47d863f4343e",
"timestamp": "",
"source": "github",
"line_count": 3261,
"max_line_length": 155,
"avg_line_length": 32.50843299601349,
"alnum_prop": 0.5356287142722385,
"repo_name": "yonggang985/Sniper",
"id": "90790d299e2e2551d968710f4134e3b185fab4b4",
"size": ... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('resources', '0002_resource_thumbnail'),
]
operations = [
migrations.RenameField(
model_name='resource',
old_name='thumbnail'... | {
"content_hash": "47f2104c0ca556d272e3dcac00b48115",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 92,
"avg_line_length": 27.606060606060606,
"alnum_prop": 0.5521405049396267,
"repo_name": "SFvue/sfvue3",
"id": "aef85d4bb687f09352d91a968accb11a8628ee61",
"size": "935",
... |
"""This module contains the classes JobQueue and Job."""
import logging
import time
import warnings
import datetime
import weakref
from numbers import Number
from threading import Thread, Lock, Event
from queue import PriorityQueue, Empty
class Days(object):
MON, TUE, WED, THU, FRI, SAT, SUN = range(7)
EVERY... | {
"content_hash": "bd01d59b37e940b23bccecffafa7012b",
"timestamp": "",
"source": "github",
"line_count": 494,
"max_line_length": 98,
"avg_line_length": 39.56275303643725,
"alnum_prop": 0.5698935734752354,
"repo_name": "thonkify/thonkify",
"id": "dbb5c2f452ef606e6513c0674ed243668c454f19",
"size": "20... |
'''
Created on Apr 25, 2011
@author: Carsten Witzke
'''
from pydoc import deque
import os
import numpy
class LibsvmFileImporter(object):
'''
Imports files in LIBSVM format. Includes simple comment-handling.
'''
__file = None
__dataSet = None
def __init__(self, filename, binary=False):
... | {
"content_hash": "cad74939765b10a70e86aafa93f3b49a",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 123,
"avg_line_length": 35.17834394904459,
"alnum_prop": 0.4975556762629006,
"repo_name": "whiskey/Machine-Learning",
"id": "e5db14d458a2e49dbe215572fb26bfda4d2219df",
"si... |
import re
import time
import autonetkit.ank_messaging as ank_messaging
import autonetkit.config as config
import autonetkit.log as log
try:
import Exscript
except ImportError:
log.warning('Deployment requires Exscript: pip install https://github.com/knipknap/exscript/tarball/master'
)
def de... | {
"content_hash": "01cb765deb2097adf217a64af32b87d8",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 113,
"avg_line_length": 31.765432098765434,
"alnum_prop": 0.559528436325949,
"repo_name": "sysbot/autonetkit",
"id": "e2aa3e544ab173fa7255cd5251b02ffaaf38bb63",
"size": "7... |
I am really *Markdown* but I am set as Code. Fix me!
# <markdowncell>
# Python in Fifteen Minutes
# -------------------------
# <markdowncell>
# ### Why?
#
# * Python is easy to learn
# * Python is easy to read
# * Python has lots of great tools to do things quickly
# <markdowncell>
# ### How?
# <markdowncell>
... | {
"content_hash": "06785d5f0062d85742859b0211c86182",
"timestamp": "",
"source": "github",
"line_count": 663,
"max_line_length": 250,
"avg_line_length": 19.368024132730014,
"alnum_prop": 0.6720660384705242,
"repo_name": "seanpue/al340",
"id": "33f13bc25ab56d391bbf727164c8975a9525465c",
"size": "1381... |
from google.appengine.ext import db
class Play(db.Model):
artist = db.StringProperty(required = True)
album_artist = db.StringProperty(required = True)
album = db.StringProperty(required = True)
title = db.StringProperty(required = True)
time = db.DateTimeProperty(auto_now_add = True) # in UTC
timezone = db.Stri... | {
"content_hash": "5886ddc62b0af1026ed33ff6365d8853",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 57,
"avg_line_length": 37.4,
"alnum_prop": 0.7486631016042781,
"repo_name": "mmjbot/muslogger",
"id": "d5da8ae2d864331c1b3cf7fdd28ea2cf641b76ce",
"size": "374",
"binary":... |
from absl.testing import parameterized
from fruit_test_common import *
COMMON_DEFINITIONS = '''
#include "test_common.h"
struct Annotation1 {};
'''
def escape_regex(regex):
# We un-escape the space because we strip the spaces in fruit_test_common, and this would otherwise leave a
# stray back... | {
"content_hash": "63101450a2901eef5b84b5595249c88b",
"timestamp": "",
"source": "github",
"line_count": 482,
"max_line_length": 142,
"avg_line_length": 33.50207468879668,
"alnum_prop": 0.49752291305424823,
"repo_name": "google/fruit",
"id": "84aa7d11726b1866b578c909e30319c4633c3f79",
"size": "16770... |
from operator import __or__ as OR
import random
from django.db.models import Q
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from .models import Product
class ProductDetailView(DetailView):
"""Return product detail."""
template_name = 'products/detail.ht... | {
"content_hash": "cd35bc7430f2c828e2caa0a445022993",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 71,
"avg_line_length": 30.729166666666668,
"alnum_prop": 0.6230508474576271,
"repo_name": "ular/toko",
"id": "e13a97c36b673d828c04ecce457b403c2a7d08a5",
"size": "1475",
"... |
import rospy
from numpy import arctan2, sqrt, arange, pi, sin, cos, save
from sys import path, exit
path.append('Modules/')
from communication import LabNavigation
from sensor_msgs.msg import LaserScan
from actuate import ROS2DimActuate
from tracker import PlanarTracker
from time import sleep, time
from path_planning i... | {
"content_hash": "184637f3112380c38bbfdd35bcd14a36",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 169,
"avg_line_length": 38.24778761061947,
"alnum_prop": 0.6217029153169829,
"repo_name": "NASLab/GroundROS",
"id": "0d4dfdc9420f0cfdf2cf1a92169a1882b47c3089",
"size": "43... |
"""
APP: Trumpatron
DESC: Bot.py Unit Test
CREATION_DATE: 2017-03-01
"""
# MODULES
# | Native
# | Third-Party
import pytest
import tweepy
# | Custom
import lib.trump
class DummyArgParse:
"""
A dummy object that mimics the object returned from ArgParse
"""
log_file = ''
log_level = ''
con... | {
"content_hash": "2b8517e88c871f232347c9f4afefb70b",
"timestamp": "",
"source": "github",
"line_count": 289,
"max_line_length": 145,
"avg_line_length": 27.235294117647058,
"alnum_prop": 0.6662431711345446,
"repo_name": "magneticstain/TrumpaTron",
"id": "4ccf774b5468fdc07333d0417eee9a485c2c30a3",
"s... |
from django.conf.urls import patterns, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from rest_framework.urlpatterns import format_suffix_patterns
from .views import (LocationListApi, LocationDetailApi, LocationArticleApi,
LocationDetail, CategoriesList, CategoryDetail, A... | {
"content_hash": "10943cc68c684abf63b43ef18fee3eb3",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 128,
"avg_line_length": 57.696969696969695,
"alnum_prop": 0.6811974789915967,
"repo_name": "RuralIndia/pari",
"id": "261343dd08e45304ad4246c1e339d211cede2603",
"size": "190... |
from codecs import open
from setuptools import setup
long_description = open('README.rst', 'r', encoding='utf-8').read()
setup(
name='flask-talisman',
version='0.7.0',
description='HTTP security headers for Flask.',
long_description=long_description,
url='https://github.com/GoogleCloudPlatfo... | {
"content_hash": "f68fef24d6a3f753e5eacc9ebc8a4079",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 71,
"avg_line_length": 25.653061224489797,
"alnum_prop": 0.6157517899761337,
"repo_name": "GoogleCloudPlatform/flask-talisman",
"id": "2c5c028cdb64dba7f0aa3588e16c1c73298c060... |
import asyncio
import osu_ds
import time
import configparser
parser = configparser.ConfigParser()
parser.read("config.ini")
# You can get your api key from https://osu.ppy.sh/p/api
key = parser.get("osu", "key")
osu = osu_ds.OsuApi(api_key=key)
loop = asyncio.get_event_loop()
async def show_user_info(name):
t ... | {
"content_hash": "acb59cf43f823e4b4495a3a75bb3a43b",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 93,
"avg_line_length": 22.40909090909091,
"alnum_prop": 0.6146044624746451,
"repo_name": "DefaltSimon/osu-ds",
"id": "aec7aad3bb2fc51457d0d9ac9123f47f4d2b14f9",
"size": "10... |
from __future__ import print_function
import logging as std_logging
import os
from oslo_config import cfg
from oslo_log import log as logging
from tempest.test_discover import plugins
# TODO(marun) Replace use of oslo_config's global ConfigOpts
# (cfg.CONF) instance with a local instance (cfg.ConfigOpts()) once
#... | {
"content_hash": "cf3b46712079dccb6710461dba1dfdf3",
"timestamp": "",
"source": "github",
"line_count": 1355,
"max_line_length": 79,
"avg_line_length": 43.16531365313653,
"alnum_prop": 0.5570791088922703,
"repo_name": "flyingfish007/tempest",
"id": "7655c75b91af728e487981642eca4df2c70eb243",
"size"... |
import copy
import functools
import inspect
import os
import time
from testtools import testcase
from oslotest import base
from oslo_log import log as logging
from oslo_config import cfg
from oslo_config import fixture as cfg_fixture
from oslo_messaging import conffixture as messaging_fixture
from designate import po... | {
"content_hash": "cf877f70594f6a3d0e436d6237e35baa",
"timestamp": "",
"source": "github",
"line_count": 761,
"max_line_length": 78,
"avg_line_length": 31.921156373193167,
"alnum_prop": 0.5521570887534991,
"repo_name": "grahamhayes/designate",
"id": "68762e25bb2cbe5901134bb27621979e3b7a9643",
"size"... |
import re
# syntax of poly files;
# name
# number
# indented list of longitude, latitude
# end
# possibly another number
# another end
class PolyfileParser(object):
newline = re.compile(r'\s*\n')
whitespace = re.compile(r'\s+')
end = re.compile(r'END')
word = re.compile(r'\w+')
... | {
"content_hash": "8d5782394d47bafa9c9575f5a8cc99cf",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 123,
"avg_line_length": 31.862068965517242,
"alnum_prop": 0.5551948051948052,
"repo_name": "bdw/GridKit",
"id": "5ee5bd2b24996f563ab8161fb2ef747fab9d7b97",
"size": "1848",
... |
"""Dataset snapshot and related functionality."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.py... | {
"content_hash": "b8b4c24581c447d14e343d2a1695dde8",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 80,
"avg_line_length": 45.02873563218391,
"alnum_prop": 0.6816847479259732,
"repo_name": "gunan/tensorflow",
"id": "942aec712c3ad926c802046b936c590c5b6c8376",
"size": "852... |
import unittest
from utils import CensysTestCase
from censys.certificates import CensysCertificates
class CensysCertificatesTests(CensysTestCase):
CERT_SHA = "fce621c0dc1c666d03d660472f636ce91e66e96460545f0da7eb1a24873e2f70"
@classmethod
def setUpClass(cls):
cls._api = CensysCertificates()
... | {
"content_hash": "8d7b6b8b293513d61c6e47a3fa6ca5b4",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 81,
"avg_line_length": 27.97872340425532,
"alnum_prop": 0.6083650190114068,
"repo_name": "Censys/censys-python",
"id": "13dccd31d39725c0378f51e51785a9cf8f1dbef6",
"size": "... |
import django.contrib.auth.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("users", "0002_auto_20160606_1320")]
operations = [
migrations.AlterField(
model_name="user",
name="username",
field=models.CharF... | {
"content_hash": "47db446121b7a9e632cde226578c49a9",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 99,
"avg_line_length": 33.31818181818182,
"alnum_prop": 0.5743519781718963,
"repo_name": "mimischi/django-clock",
"id": "5ba2079d8e433875ac23fb2442133f02fb74ec40",
"size": ... |
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import Client
# lfc imports
import lfc.utils.registration
from lfc.utils import import_module
from lfc.models import Application
from lfc.models import Portal
# lfc_page imports
from lfc_page.models import Page
cla... | {
"content_hash": "b2cef8c7a76feaddfb2d5750d2149b7f",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 96,
"avg_line_length": 31.319526627218934,
"alnum_prop": 0.5909692046098621,
"repo_name": "diefenbach/django-lfc",
"id": "bb8a8a529a44905178debb3350f280bbb7048051",
"size"... |
import _plotly_utils.basevalidators
class CategoryarrayValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(
self, plotly_name="categoryarray", parent_name="layout.scene.zaxis", **kwargs
):
super(CategoryarrayValidator, self).__init__(
plotly_name=plotly_name,
... | {
"content_hash": "33292f5aade1587e38e0e5aaefa6148b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 85,
"avg_line_length": 34.07692307692308,
"alnum_prop": 0.6252821670428894,
"repo_name": "plotly/plotly.py",
"id": "e422240b9c831645f39185fc366187c1808346a3",
"size": "443"... |
import _plotly_utils.basevalidators
class CautoValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="cauto", parent_name="barpolar.marker.line", **kwargs
):
super(CautoValidator, self).__init__(
plotly_name=plotly_name,
parent_name=p... | {
"content_hash": "4ac59c6bef89835ec0e2c4ab04aa91c6",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 79,
"avg_line_length": 34.8,
"alnum_prop": 0.5881226053639846,
"repo_name": "plotly/python-api",
"id": "476270cabef641808d8ef51ea2d56006ebb2b4b7",
"size": "522",
"binary"... |
def get_int(msg):
while True:
try:
i = int(input(msg))
return i
except ValueError as err:
print(err)
#
print("type integers, each followed by <enter>, or ^D or ^Z to finish")
#
total = 0
count = 0
#
while True:
try:
number = get_int("enter an integer: ... | {
"content_hash": "cf759252eeeab82e9ed12f91b06ccf22",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 75,
"avg_line_length": 19.26923076923077,
"alnum_prop": 0.5169660678642715,
"repo_name": "ombt/analytics",
"id": "85f2ae2450c9f3cb41842722d83c2b944f75bbc7",
"size": "854",
... |
from ironic_lib import metrics_utils
from ironic_lib import utils as il_utils
from oslo_log import log
from oslo_utils import units
import six.moves.urllib_parse as urlparse
from ironic.common import dhcp_factory
from ironic.common import exception
from ironic.common.glance_service import service_utils
from ironic.com... | {
"content_hash": "5e79bcf291f6471c869ce6154c3dee8d",
"timestamp": "",
"source": "github",
"line_count": 640,
"max_line_length": 79,
"avg_line_length": 43.546875,
"alnum_prop": 0.6151417294581988,
"repo_name": "NaohiroTamura/ironic",
"id": "e07753fefa154bbebebef4032fe81821f9349cbf",
"size": "28449",... |
from random import randint
from time import sleep
import tweepy
import config
old_tweets = []
def get_tweets(name, api):
lst = []
statuses = api.user_timeline(id = name, count = 500, include_rts = False)
for status in statuses:
status_encoded = status.text.encode('utf-8')
status_encod... | {
"content_hash": "85b7e3a6442e13fdb7d8e39dac1e2704",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 78,
"avg_line_length": 26.220588235294116,
"alnum_prop": 0.6006730229949523,
"repo_name": "leonardolima/pcordanilo",
"id": "ad55f8f92bf9a3ee588638811456b40450354404",
"size... |
from setuptools import setup
# http://bugs.python.org/issue15881#msg170215 workaround:
try:
import multiprocessing
except ImportError:
pass
VERSION = '0.1.1'
setup(
name='Carcade',
version=VERSION,
description='Static site generator powered by Jinja2.',
long_description=open('README.rst').r... | {
"content_hash": "1b2f5cd15f0babd9da03c3a7ccfe2ec9",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 59,
"avg_line_length": 29.305084745762713,
"alnum_prop": 0.5795257374204743,
"repo_name": "aromanovich/carcade",
"id": "8d9e386c28158c8d299ffa494c9d703e8f89559e",
"size": "... |
from setuptools import setup, find_packages
import os
# Check dex so file exists in dex directory.
so_file = "libDex.so"
dex_dir = os.path.join(os.path.dirname(__file__), 'dex')
if not os.path.exists(os.path.join(dex_dir, so_file)):
raise FileNotFoundError(f"{so_file} not found in dex/, "
f... | {
"content_hash": "e23e55adafc47e942ce6e8ecfe3e7cdc",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 75,
"avg_line_length": 30.761904761904763,
"alnum_prop": 0.6671826625386997,
"repo_name": "google-research/dex-lang",
"id": "67250e49da73cb912b7f85526176c49d939908cd",
"siz... |
from .exceptions import TerminationNotice
__all__ = ['Job', 'SuicideJob', 'SimpleJob']
class Job(object):
"Interface for a Job object."
def __init__(self):
pass
def run(self):
"The actual task for the job should be implemented here."
pass
class SuicideJob(Job):
"A worker rece... | {
"content_hash": "da30c9e39a858e626335019a05c6bfd0",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 75,
"avg_line_length": 29.76923076923077,
"alnum_prop": 0.6037898363479759,
"repo_name": "Codeusa/Shrinkwrap-worker",
"id": "e4f24a8a85c68ca5cc18de137fa80b0f7095f46b",
"siz... |
from models import AbstractTemporalModel
| {
"content_hash": "07acce3acc14e30c80e8484084c78026",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 40,
"avg_line_length": 41,
"alnum_prop": 0.9024390243902439,
"repo_name": "shriramrseee/django-temporal-models",
"id": "35c566e37a0d4c0af8ff04f086320d9194a7662f",
"size": "6... |
"""CLI options."""
import click
from common import chronicle_auth
verbose_option = click.option(
"--verbose", is_flag=True, help="Prints verbose output to the console.")
credential_file_option = click.option(
"-c",
"--credential_file",
help=f"Path of Service Account JSON. Default: {chronicle_auth.de... | {
"content_hash": "c0c9d0266238a04b23e3c287389c2739",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 90,
"avg_line_length": 27.96969696969697,
"alnum_prop": 0.6359696641386782,
"repo_name": "chronicle/cli",
"id": "4e03ce504a63f2ca52534e049ab9de15cc62e12a",
"size": "1499",
... |
"""Gradients for operators defined in array_ops.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python import pywrap_tensorflow
from tensorflow.python.eager import context
from tensorflow.python.framework import constant_op
from tenso... | {
"content_hash": "541812f3a2f923f82a2feeb4125da147",
"timestamp": "",
"source": "github",
"line_count": 897,
"max_line_length": 100,
"avg_line_length": 36.04905239687849,
"alnum_prop": 0.6689448292924295,
"repo_name": "ageron/tensorflow",
"id": "337cf2ff5592b52e8c3e3f1c8eae2c61075e4c74",
"size": "3... |
import struct
from pydoop.mapreduce.pipes import run_task, Factory
from pydoop.mapreduce.api import Mapper, Reducer
class WordCountMapper(Mapper):
def map(self, context):
for w in context.value.split():
context.emit(w, 1)
class WordCountReducer(Reducer):
def reduce(self, context):
... | {
"content_hash": "ff1d47c2237a867c418cc8f7f0d764df",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 71,
"avg_line_length": 23.47826086956522,
"alnum_prop": 0.6814814814814815,
"repo_name": "simleo/pydoop",
"id": "c848ba80678b84826db84c4cae8eca7680aad17f",
"size": "1174",
... |
import logging
import re
import sys
import traceback
import mwparserfromhell as mwp
from .extractor import TemplateExtractor
logger = logging.getLogger(__name__)
PROJECT_NAME = "vikiproje"
def from_template(template):
template_name = str(template.name).lower().strip()
if template_name[:9] == "vikiproje" a... | {
"content_hash": "06a88c928d02172f5377ca87b4a7aaa0",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 105,
"avg_line_length": 31.77027027027027,
"alnum_prop": 0.584857507443641,
"repo_name": "nettrom/Wiki-Class",
"id": "de197b650c5d36a0a0a1eeaac35db990d82c6622",
"size": "23... |
import unittest
import sys
from androguard.core.bytecodes import dvm
class AnnotationTest(unittest.TestCase):
def testAnnotation(self):
with open("examples/android/TestsAnnotation/classes.dex", "rb") as f:
d = dvm.DalvikVMFormat(f.read())
clazz = d.get_class('Landroid/support/v4/widge... | {
"content_hash": "a22bb1868fc7c42a875fcf2d154cdda8",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 137,
"avg_line_length": 40.875,
"alnum_prop": 0.7293577981651376,
"repo_name": "androguard/androguard",
"id": "d03d0e00d406aa8a7e3677981b4d70488a0c1e16",
"size": "654",
"... |
"""
Some methods which are useful but didn't quite fit into the graph classes.
"""
import logging
import numpy
import scipy.sparse
class GraphUtils(object):
def __init__(self):
pass
@staticmethod
def vertexLabelPairs(graph, edgeArray):
"""
Create an array of pairs of vertex la... | {
"content_hash": "ad114f0aa25a8aea572d1275274e2761",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 99,
"avg_line_length": 33.93801652892562,
"alnum_prop": 0.5680019481310118,
"repo_name": "charanpald/APGL",
"id": "cb7949cdadda4db1fff84fd646679731dd0116a8",
"size": "8213... |
from cmd3.shell import function_command
from cloudmesh.shell.cm_list import shell_command_list
class cm_shell_list:
def activate_cm_shell_list(self):
self.register_command_topic('cloud', 'list')
@function_command(shell_command_list)
def do_list(self, args, arguments):
shell_command_list... | {
"content_hash": "0ee3814ac74c28af65fcc02f52301650",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 54,
"avg_line_length": 25.53846153846154,
"alnum_prop": 0.713855421686747,
"repo_name": "rajpushkar83/cloudmesh",
"id": "47fe4a66a9da9b5b15509f78249b2b75f5ad32d2",
"size": ... |
import csv
class SimpleSaleInfo:
def __init__(self, city, item):
self.city = city
self.item = item
def _read_sales(sales_file_path):
sales = []
with open(sales_file_path, encoding='utf-8') as f:
sales_reader = csv.reader(f)
for row in sales_reader:
if any(row... | {
"content_hash": "4f829072033bd1af13d5ceb4ae69c593",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 84,
"avg_line_length": 25.931506849315067,
"alnum_prop": 0.560486001056524,
"repo_name": "vladislav-karamfilov/Python-Playground",
"id": "cbb4e67897ac4ffc7a2fe4ac53c10a0e96a3... |
__author__ = 'Mind'
import cv2
import numpy as np
import glob
import matplotlib.pyplot as plt
print('Loading training data...')
e0 = cv2.getTickCount()
# load training data
image_array = np.zeros((1, 38400))
label_array = np.zeros((1, 11), 'float')
training_data = glob.glob('training_data_temptest0407.npz')
for sin... | {
"content_hash": "2c1a337fd60a371c0ff354a0fa0e6b08",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 86,
"avg_line_length": 30.831858407079647,
"alnum_prop": 0.6977611940298507,
"repo_name": "lurenlym/BPnetwork_smartcar",
"id": "8012810ce954fe9f87bcd8d907287e0c9c498da1",
... |
from django import forms
from .models import Message
class MessageForm(forms.ModelForm):
class Meta:
model = Message
fields = ('name', 'email', 'message')
# Przykładowa metoda sprawdzająca
def clean_name(self):
data = self.cleaned_data['name']
if "A" not in data:
r... | {
"content_hash": "de49b35a0b57af20c1ad248466753965",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 83,
"avg_line_length": 27.333333333333332,
"alnum_prop": 0.6414634146341464,
"repo_name": "adrianborkowski/kurs_django",
"id": "3a1e7e050ae0077dd8f1c84ca5a94b35afa20925",
"... |
import functools
def Memoize(f):
"""Decorator to cache return values of function."""
memoize_dict = {}
@functools.wraps(f)
def wrapper(*args, **kwargs):
key = repr((args, kwargs))
if key not in memoize_dict:
memoize_dict[key] = f(*args, **kwargs)
return memoize_dict[key]
return wrapper
| {
"content_hash": "aef162b5411bc2d04b32f599abc8c17d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 53,
"avg_line_length": 24.384615384615383,
"alnum_prop": 0.6498422712933754,
"repo_name": "catapult-project/catapult",
"id": "5d2861077dab480ed87fdd155007ea4580bfa723",
"si... |
from django.core.paginator import Paginator, InvalidPage, Page
from rest_framework.response import Response
from rest_framework import status
import six
STATUS_CODES = {
'created': status.HTTP_201_CREATED,
'updated': status.HTTP_200_OK,
'accepted': status.HTTP_202_ACCEPTED
}
class MultipleObjectMixin(obj... | {
"content_hash": "5d1eaacd7831eb7ec8948fa082bbf5e1",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 78,
"avg_line_length": 33.733333333333334,
"alnum_prop": 0.61699604743083,
"repo_name": "pombredanne/djangorest-alchemy",
"id": "b8d2e7a3db202b3287512ed5cec1cb36a0780dcf",
... |
"""Tests for draft upgrade services."""
from __future__ import annotations
from core import feconf
from core import utils
from core.domain import draft_upgrade_services
from core.domain import exp_domain
from core.domain import exp_fetchers
from core.domain import exp_services
from core.domain import state_domain
fro... | {
"content_hash": "333c08d91056585d4d7445ca0552b125",
"timestamp": "",
"source": "github",
"line_count": 2122,
"max_line_length": 80,
"avg_line_length": 43.433081998114986,
"alnum_prop": 0.4839147181685021,
"repo_name": "oppia/oppia",
"id": "76dcd1bcb020d09a58945edfe51c3b22dc27cd46",
"size": "93252"... |
from django.test import TestCase
from django.contrib.auth.models import User
class BaseTestCase(TestCase):
def setUp(self):
self.me = self.create_user('bob')
self.login(self.me.username)
self.her = self.create_user('alice')
def create_user(self, username='bob'):
return User.o... | {
"content_hash": "062ae70293635152898f7d4a196f2644",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 76,
"avg_line_length": 26.428571428571427,
"alnum_prop": 0.6713513513513514,
"repo_name": "amarandon/smeuhsocial",
"id": "4e9ad93800696bcac21d3a43444b580f3dd001a4",
"size":... |
import cv2
cascade_path = "./haarcascade_frontalface_alt.xml"
color = (255, 255, 255) # color of rectangle for face detection
cam = cv2.VideoCapture(0)
count=0
while True:
ret, capture = cam.read()
if not ret:
print('error')
break
count += 1
if count > 1:
image = capture.copy()... | {
"content_hash": "eea42256aa4a9698826da8a8a21aa4f0",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 104,
"avg_line_length": 28.821428571428573,
"alnum_prop": 0.6257744733581165,
"repo_name": "karaage0703/python-image-processing",
"id": "6c00590100d74a9207c37d99089fd1f6358c0... |
"""
SnapSearch.api.backend
~~~~~~~~~~~~~~~~~~~~~~
wrapper for communication with SnapSearch backend service
:copyright: 2014 by `SnapSearch <https://snapsearch.io/>`_
:license: MIT, see LICENSE for more details.
:author: `LIU Yu <[email protected]>`_
:date: 2014/03/08
"""
__all__ = ['dis... | {
"content_hash": "26ee083f760160df91538b6c029fd91c",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 77,
"avg_line_length": 27.301075268817204,
"alnum_prop": 0.6165813312327688,
"repo_name": "SnapSearch/SnapSearch-Client-Python",
"id": "932f8c1a253daed09e2072a3bafd03a8feeec... |
from datetime import datetime
from functools import wraps
import netaddr
import time
from oslo.config import cfg
from akanda.rug.api import configuration
from akanda.rug.api import akanda_client as router_api
from akanda.rug.api import quantum
DOWN = 'down'
BOOTING = 'booting'
UP = 'up'
CONFIGURED = 'configured'
RES... | {
"content_hash": "6792ba6983eaa89e2f1d8f81950ac600",
"timestamp": "",
"source": "github",
"line_count": 523,
"max_line_length": 79,
"avg_line_length": 39.07648183556405,
"alnum_prop": 0.5593286685912805,
"repo_name": "dreamhost/akanda-rug",
"id": "91fbebb933a9350001d98266fb90c5dc47693f48",
"size": ... |
import unittest
from linkedList import LinkedList
class tests(unittest.TestCase):
def setUp(self):
self.list = LinkedList(range(4))
def testEmptyLength(self):
linkedList = LinkedList()
self.assertEqual(len(linkedList), 0)
def testElementValues(self):
elements = range(4)
... | {
"content_hash": "4f7a708eeb5502e90925ff0d1ea8382e",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 59,
"avg_line_length": 28.833333333333332,
"alnum_prop": 0.6005780346820809,
"repo_name": "dooleykh/rehash",
"id": "337ae2da7cfdb3e2e31180dfba58485f82b9b598",
"size": "1730... |
from typing import List
from RULEngine.Game.OurPlayer import OurPlayer
from RULEngine.Util.geometry import get_distance
from RULEngine.Util.Pose import Pose
from RULEngine.Util.constant import POSITION_DEADZONE, ROBOT_RADIUS
from ai.Algorithm.evaluation_module import is_ball_our_side
from ai.STA.Action.PathfindToPosit... | {
"content_hash": "8e4e0612d1a7fe9a9f14613d603056a6",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 110,
"avg_line_length": 36.72,
"alnum_prop": 0.6900871459694989,
"repo_name": "MaximeGLegault/StrategyIA",
"id": "9da25d5c429af539eaabb3beb568903a105d815d",
"size": "1878",... |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=1, faild_point=100000, path_list=[
[TestAction.create_mini_vm, 'vm1', 'cluster=cluster1'],
[TestAction.destroy_vm, 'vm1'],
[TestAction.create_mini_... | {
"content_hash": "51a7cbdc59c5e81b8ef849c42f4a79f1",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 104,
"avg_line_length": 39,
"alnum_prop": 0.685690653432589,
"repo_name": "zstackio/zstack-woodpecker",
"id": "ccd3ac1e7d9b50b39eb850655419a7a367a8581f",
"size": "2418",
... |
"""
.. _sfm-reconst:
==============================================
Reconstruction with the Sparse Fascicle Model
==============================================
In this example, we will use the Sparse Fascicle Model [Rokem2015]_, to
reconstruct the fiber orientation distribution function (fODF) in every voxel.
First... | {
"content_hash": "e7622d81809c87b754d5e76110adb45a",
"timestamp": "",
"source": "github",
"line_count": 173,
"max_line_length": 111,
"avg_line_length": 33.61271676300578,
"alnum_prop": 0.7011177987962167,
"repo_name": "StongeEtienne/dipy",
"id": "ebcdb62b002a17be8f142da6792c54669bbfae97",
"size": "... |
import sys
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
... | {
"content_hash": "a1437729d56cf31c371049bace10e7bb",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 225,
"avg_line_length": 44.66153846153846,
"alnum_prop": 0.6553565277299346,
"repo_name": "Azure/azure-sdk-for-python",
"id": "7b33f6df7dc7f91c4e5a2b9f67b40cb5304a3143",
"... |
from modules.controller import Controller
PUMP_PIN = 24 # pin of pump
if __name__ == "__main__":
controller = Controller(PUMP_PIN)
controller.run(50, 1)
print("Pump Start for a second with 50% power")
| {
"content_hash": "adb6b58ce13500f52e977126ca9419fc",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 51,
"avg_line_length": 24.11111111111111,
"alnum_prop": 0.6589861751152074,
"repo_name": "farmy-maker/farmy-py",
"id": "fd44946bf78d83337f09a7bf8a52d68d1ffd61b5",
"size": "2... |
from aone_app import app
app.run(debug=True)
| {
"content_hash": "fb9da6ff3cd7c0b1e00d9a809807b070",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 24,
"avg_line_length": 22.5,
"alnum_prop": 0.7777777777777778,
"repo_name": "anokata/pythonPetProjects",
"id": "3a08f9619ac650ba31bc6436905ad63a24a2a6be",
"size": "45",
"b... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('matches', '0003_auto_20150127_0910'),
]
operations = [
migrations.AlterField(
model_name='match',
name='datetime',
... | {
"content_hash": "ccabfbaef79fcda2404aa592c3b4c6b9",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 60,
"avg_line_length": 22.31578947368421,
"alnum_prop": 0.5919811320754716,
"repo_name": "Zundrium/djangocms-gamegroup",
"id": "de32bd33139d4b070b61499bdc81993c6ffc1ad4",
"... |
from runner.koan import *
class AboutClassAttributes(Koan):
class Dog(object):
pass
def test_new_style_class_objects_are_objects(self):
# Note: Old style class instances are not objects but they are being
# phased out it Python 3.
fido = self.Dog()
self.assertEqual(Tr... | {
"content_hash": "583a1427e306a99b9f4e5ed6424a6815",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 79,
"avg_line_length": 32.25316455696203,
"alnum_prop": 0.5788854003139717,
"repo_name": "hnarayanan/python-koans",
"id": "c248c88e33ad6d9bd05e4eeea5e505dba3a6cb85",
"size... |
from mayavi.core.registry import registry
from mayavi.core.pipeline_info import PipelineInfo
from mayavi.core.metadata import SourceMetadata
from simphony_mayavi.plugins.engine_manager_mayavi2 import (
EngineManagerMayavi2Plugin)
cuds_reader_info = SourceMetadata(
id="CUDSReader",
class_name="simphony_maya... | {
"content_hash": "5b1cc63923925b407c183d9a56b2bcd4",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 73,
"avg_line_length": 33.92,
"alnum_prop": 0.714622641509434,
"repo_name": "simphony/simphony-mayavi",
"id": "ddad6b8710428d50f986080c29db321d7a41dc98",
"size": "848",
"... |
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
ex... | {
"content_hash": "975ad77e476f24b6dbf6217f277c234c",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 107,
"avg_line_length": 53.38666666666666,
"alnum_prop": 0.7100399600399601,
"repo_name": "isbm/pybug",
"id": "8879b3cd71903ca04cb0f6635ff75346b41610f2",
"size": "4202",
... |
u"""ci_play setup script
:copyright: Copyright (c) 2022 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from pykern import pksetup
pksetup.setup(
name='ci_play',
author='RadiaSoft LLC',
author_email='[email protected]',
description='ci_play',
inst... | {
"content_hash": "8ccd36bcc0872bb8474ce1c44ed09227",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 67,
"avg_line_length": 30.724137931034484,
"alnum_prop": 0.6184062850729517,
"repo_name": "robnagler/ci-play",
"id": "dce75d9a310ecd694d343aa4ed39ae4a2a10031e",
"size": "91... |
"""Runs code on a fleet of machines.
This runs the lingvo code on a fleet of docker for demonstration and testing
purposes. We assume the following:
* There is a running container
* There is a shared volume in /sharedfs. In reality, this would be something
like an NFS or HDFS mount.
The script is run on the host and ... | {
"content_hash": "7a12ea58992a1edd9824b5d26d88b145",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 80,
"avg_line_length": 28.927884615384617,
"alnum_prop": 0.6337045039056008,
"repo_name": "tensorflow/lingvo",
"id": "6ebc6e22f830d31b0963f958310a3695201cf9ef",
"size": "6... |
from rest_framework.test import APITestCase, APIRequestFactory, force_authenticate
from api.v2.views import QuotaViewSet as ViewSet
from api.tests.factories import UserFactory, AnonymousUserFactory,\
IdentityFactory, ProviderFactory, GroupFactory,\
IdentityMembershipFactory, QuotaFactory, AllocationFactory
from... | {
"content_hash": "ebf8b0eb5afaf9167260de050ac8902c",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 82,
"avg_line_length": 36.610169491525426,
"alnum_prop": 0.6576388888888889,
"repo_name": "CCI-MOC/GUI-Backend",
"id": "8c4fcbb517aed513f7cf6e2b2893dd58b2a0bdcd",
"size": ... |
from pastpy.database_image import DatabaseImage
class DummyDatabaseImage(DatabaseImage):
def __init__(self, *, image_index, object_index):
self.__image_index = image_index
self.__object_index = object_index
@property
def full_size_url(self):
return "http://placehold.it/510x670"
... | {
"content_hash": "5b798cf86b0de874620dae3d5b27886c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 85,
"avg_line_length": 27.842105263157894,
"alnum_prop": 0.6465028355387523,
"repo_name": "minorg/pastpy",
"id": "ddfe030b69cdc6b73477c604e7200311f0b99c21",
"size": "529",
... |
response.view.replace('.html','.mobile.html')
#Mobile Views
from gluon.contrib.user_agent_parser import mobilize
# method for default loading page
@mobilize
def index():
response.flash = T("Welcome to KPW.org!")
response.title = T('KPW.org')
message = ""
return dict(message=message)
# method to show ... | {
"content_hash": "0eb5b47d409fa7eef1231ebf83831307",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 62,
"avg_line_length": 22.475,
"alnum_prop": 0.699666295884316,
"repo_name": "highlanderkev/kpw.org",
"id": "dfa65ab64e17fc57e2e7b9a473d02a27542ada9e",
"size": "1453",
"b... |
"""Amber relaxation."""
| {
"content_hash": "cdacfa8467310980b9b0f0ed83f46ce6",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 23,
"avg_line_length": 24,
"alnum_prop": 0.625,
"repo_name": "deepmind/alphafold",
"id": "98feaf80700f21bf7c1c5e7f755d3c38d0008dba",
"size": "618",
"binary": false,
"cop... |
from django.middleware.cache import CacheMiddleware
from django.utils.cache import patch_response_headers, get_max_age
from models import FancyModel
from django.http import HttpResponse
from django.core import serializers
from cache.manager import cache_manager
def fancy_view(request):
cache_version = cache_manag... | {
"content_hash": "96905774e796b62e111ed0e142f5637e",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 81,
"avg_line_length": 34.30612244897959,
"alnum_prop": 0.7144556811421773,
"repo_name": "ff0000/scarlet",
"id": "531cf221db67ea35bc04f161aef1dbdcc26b2515",
"size": "1681",... |
""" This template creates a Pub/Sub (publish-subscribe) service. """
from hashlib import sha1
import json
def set_optional_property(destination, source, prop_name):
""" Copies the property value if present. """
if prop_name in source:
destination[prop_name] = source[prop_name]
def create_subscripti... | {
"content_hash": "d77bfa09d83257f9193708e1dcbd960d",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 112,
"avg_line_length": 31.258426966292134,
"alnum_prop": 0.604960460100647,
"repo_name": "GoogleCloudPlatform/cloud-foundation-toolkit",
"id": "f496a32b36e15232d44a14f6fa6d7... |
from Tkinter import * # Importing the Tkinter (tool box) library
root = Tk() # Create a background window
# Create a list
li = 'Carl Patrick Lindsay Helmut Chris Gwen'.split()
listb = Listbox(root) # Create a listbox widget
for item in li: ... | {
"content_hash": "1d8ea7f65a6c1a30d50823d4cd525def",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 77,
"avg_line_length": 51.9,
"alnum_prop": 0.5645472061657033,
"repo_name": "felixzhao/BookDigger",
"id": "1e255fa3208a37ead6d28eb2a2963f7dc8455cad",
"size": "519",
"bina... |
import sys
from litmos.api import API
from litmos.litmos import LitmosType
from litmos.team import Team
from litmos.user import User
from litmos.course import Course
from litmos.course_module import CourseModule
__version__ = "1.3.0"
class Litmos(object):
ACCEPTABLE_TYPES = ['User', 'Team', 'Course', 'CourseMod... | {
"content_hash": "3a8bee14ea21ecb18b344c24a1718825",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 84,
"avg_line_length": 27.40740740740741,
"alnum_prop": 0.6472972972972973,
"repo_name": "charliequinn/python-litmos-api",
"id": "107ee9c1ff710d4e892f0fa23baa097e193b2e4d",
... |
"""
Epydoc parser for ReStructuredText strings. ReStructuredText is the
standard markup language used by the Docutils project.
L{parse_docstring()} provides the primary interface to this module; it
returns a L{ParsedRstDocstring}, which supports all of the methods
defined by L{ParsedDocstring}.
L{ParsedRstDocstring} ... | {
"content_hash": "8ee70d5ae83bff7f6306217c125d49dd",
"timestamp": "",
"source": "github",
"line_count": 940,
"max_line_length": 80,
"avg_line_length": 40.26276595744681,
"alnum_prop": 0.6142626892488177,
"repo_name": "danse/epydoc",
"id": "da35c17f58406b5b888c15523738898fd226da05",
"size": "38007",... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "search.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is real... | {
"content_hash": "2a26187f9ce14cafc97174e5da1d53e1",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 77,
"avg_line_length": 37.23809523809524,
"alnum_prop": 0.6202046035805626,
"repo_name": "shailendert/Vertical-Search-Engine",
"id": "d3fadeab366ccdb0eba8b64ccce4ec0004f8f22f... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('forms', '0005_auto_20170624_1747'),
]
operations = [
migrations.CreateModel(
name='TurnexType',
... | {
"content_hash": "dbd6f60f82f7c03bb7e6264b56147543",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 118,
"avg_line_length": 31.52173913043478,
"alnum_prop": 0.5958620689655172,
"repo_name": "mleger45/turnex",
"id": "4ffd543749d841cd029559675acf16c64b11df4a",
"size": "798"... |
from harpoon.docker import _create_image_matcher
class TestImageMatcher(object):
def test_image_without_registry_and_tag(self):
matcher = _create_image_matcher("spam")
assert matcher("spam")
assert not matcher("spamsuffix")
assert not matcher("prefixspam")
def test_image_with_... | {
"content_hash": "854a7b02ea67eb5e7be6395ab218b8ef",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 59,
"avg_line_length": 37.57142857142857,
"alnum_prop": 0.6653992395437263,
"repo_name": "Trundle/harpoon",
"id": "8b7f51a9a8341234c75f3223ff6f66c0b890de1a",
"size": "789",... |
"""Config flow to configure the GDACS integration."""
import logging
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import (
CONF_LATITUDE,
CONF_LONGITUDE,
CONF_RADIUS,
CONF_SCAN_INTERVAL,
)
from homeassistant.helpers import config_validation as cv
from .co... | {
"content_hash": "38ede4744ba54b5f4077209d03a24bb5",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 81,
"avg_line_length": 33.885245901639344,
"alnum_prop": 0.683599419448476,
"repo_name": "adrienbrault/home-assistant",
"id": "b672b56ad9b9b672ee93092f9d4d4f2d80b2e81d",
"s... |
__author__ = "Juan C. Caicedo, [email protected]"
from pybrain.rl.learners.valuebased.interface import ActionValueInterface
import caffe
import os
import utils.utils as cu
import numpy as np
import random
import learn.rl.RLConfig as config
EXPLORE = 0
EXPLOIT = 1
def defaultSampler():
return np.random.random([... | {
"content_hash": "870140e460b2685f46f1c0e48e674dc0",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 141,
"avg_line_length": 28.55223880597015,
"alnum_prop": 0.6826973340303188,
"repo_name": "jccaicedo/localization-agent",
"id": "41379926a9d951c3524b6d208816f87d1b92e20a",
... |
import os
import csv
import re
import pandas as pd
from pandas import Series, DataFrame
siteDict = {}
for dirPath, dirNames, fileNames in os.walk('BSR'):
print '#file:' + str(len(fileNames))
for i,f in enumerate(fileNames[:]):
if f[0] == '.':
continue
else:
fullfile = os.path.join(dirPath, f)
print i
... | {
"content_hash": "2db67a2db24cae60d036bf74cc14a1bd",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 73,
"avg_line_length": 28.16,
"alnum_prop": 0.6448863636363636,
"repo_name": "ypochien/TaiwanStockBSR",
"id": "9e2359ee893259c81d066f98b49e455c98df058b",
"size": "730",
"... |
import tomviz.operators
import tomviz.utils
import os
from enum import Enum
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
class DistanceMethod(Enum):
Eucledian = 0
CityBlock = 1
ChessBoard = 2
class PropagationDirection(Enum):
Xpos = 0
Xneg = 1... | {
"content_hash": "e759c1795f3b4748dafcca6e501ca57c",
"timestamp": "",
"source": "github",
"line_count": 434,
"max_line_length": 79,
"avg_line_length": 33.83410138248848,
"alnum_prop": 0.5917324979569599,
"repo_name": "OpenChemistry/tomviz",
"id": "03c48fe70b26c6d0a6a633f97f13d2c946cc6607",
"size": ... |
from time import sleep
import zmq
from locust.rpc import zmqrpc, Message
from locust.test.testcases import LocustTestCase
from locust.exception import RPCError
class ZMQRPC_tests(LocustTestCase):
def setUp(self):
super().setUp()
self.server = zmqrpc.Server("127.0.0.1", 0)
self.client = zmq... | {
"content_hash": "abad393d6373663cf8e1688a2a6b8afb",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 83,
"avg_line_length": 37.592592592592595,
"alnum_prop": 0.6433497536945813,
"repo_name": "mbeacom/locust",
"id": "abaa8144adbf09d863af29b6c714099d0a332960",
"size": "2030"... |
"""The application's model objects"""
from zope.sqlalchemy import ZopeTransactionExtension
from sqlalchemy.orm import scoped_session, sessionmaker
# from sqlalchemy import MetaData
from sqlalchemy.ext.declarative import declarative_base
# Global session manager: DBSession() returns the Thread-local
# session object a... | {
"content_hash": "38eaa6fdf8943752cdd1e3e7ef0d7cf1",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 78,
"avg_line_length": 37.25,
"alnum_prop": 0.7441275167785235,
"repo_name": "LamCiuLoeng/budget",
"id": "b7047b1f44f9376538330052c860be6e82338daf",
"size": "2408",
"bina... |
import logging
import os
import re
__version__ = '1.29.16'
class NullHandler(logging.Handler):
def emit(self, record):
pass
# Configure default logger to do nothing
log = logging.getLogger('botocore')
log.addHandler(NullHandler())
_INITIALIZERS = []
_first_cap_regex = re.compile('(.)([A-Z][a-z]+)')
_... | {
"content_hash": "fe47929b833f17cfd252047985444a6c",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 78,
"avg_line_length": 34.296,
"alnum_prop": 0.6773967809657103,
"repo_name": "boto/botocore",
"id": "9b7116342e243bfc70e803195fffe34fc28d7c2d",
"size": "4914",
"binary"... |
from __future__ import print_function
import traceback
import sys
import threading
from contextlib import contextmanager
from stat import S_IXOTH
from os import pardir, stat, chmod, access, X_OK, pathsep, environ
from os import makedirs, listdir
from os.path import join, dirname, isfile, split
from os.path import exi... | {
"content_hash": "7344d3e3b51d4ed0245398550ceb6d4d",
"timestamp": "",
"source": "github",
"line_count": 448,
"max_line_length": 110,
"avg_line_length": 28.598214285714285,
"alnum_prop": 0.6293318763659069,
"repo_name": "jmchilton/pulsar",
"id": "e8e16898289e3fe896307e8c9e25d7289aea880a",
"size": "1... |
import logging
import os
import shutil
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger("post_gen_project")
DOCS_SOURCES = "docs_sources"
ALL_TEMP_FOLDERS = [DOCS_SOURCES, "licenses", "macros"]
DOCS_FILES_BY_TOOL = {
"mkdocs": ["index.md", "/mkdocs.yml"],
"sphinx": ["conf.py", "index.rst", ... | {
"content_hash": "0c8e656feb1936b21efd8326bd2918fe",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 83,
"avg_line_length": 27.97872340425532,
"alnum_prop": 0.6281368821292775,
"repo_name": "pytest-dev/cookiecutter-pytest-plugin",
"id": "a300dd33cbd7aaf59414e60f1148dcfd0f54e... |
import datetime
import boto3
import argparse
import sys
import time
import random
session = boto3.Session(profile_name='admin')
client = session.client('emr')
def make_instances():
return {
'InstanceGroups': [
{
'InstanceRole': 'MASTER',
'Market': 'SPOT',
'BidPri... | {
"content_hash": "e582e1eb7df79105eca32b2018d8c91e",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 137,
"avg_line_length": 32.92727272727273,
"alnum_prop": 0.522547395545739,
"repo_name": "paulhtremblay/boto_emr",
"id": "b9e51031464f45866e4d0d3ea61523b4837d1ebf",
"size"... |
import os
import sys
import pymysql
try:
pymysql
except ImportError:
'Error import pymysql'
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "catalog.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The a... | {
"content_hash": "cc6aa3685b598907880bf4a4c6ab236a",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 77,
"avg_line_length": 29.82758620689655,
"alnum_prop": 0.6289017341040463,
"repo_name": "Sergey19940808/catalog",
"id": "b935b90368824e7141b5e275e3ddf0bda17f5986",
"size":... |
import argparse
import json
import os
import subprocess
import sys
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
'--action', metavar="action", default="setup",
choices=['setup', 'teardown', 'run_test'])
parser.add_argument(
'--service-name', metavar="ser... | {
"content_hash": "f3ee16c80deff32e67bd5a8b0f4106e9",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 92,
"avg_line_length": 30.453488372093023,
"alnum_prop": 0.6139747995418099,
"repo_name": "richbrowne/f5-openstack-agent",
"id": "11a6dac1f85a2543591cd5742e110f7811dd12e6",
... |
from fibpro.rpc import GenericClient, Server
from fibpro.logsink import LogSinkClient
from fibpro.pricing import PricingClient
class ControllerBase(object):
NAME = "controller"
LOG_RPC = True
class ControllerServer(ControllerBase, Server):
def server_init(self):
self.log = LogSinkClient(self.serv... | {
"content_hash": "e2f36ad932a009a98fa340567fdbb071",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 98,
"avg_line_length": 39.67567567567568,
"alnum_prop": 0.6607629427792916,
"repo_name": "neumark/practical-microservices",
"id": "599ed41c9db10f305901ee389a77ced35bdc45de",
... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 30, transform = "BoxCox", sigma = 0.0, exog_count = 100, ar_order = 12); | {
"content_hash": "8c69a29012956d27a59faa83b20cf545",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 169,
"avg_line_length": 38.42857142857143,
"alnum_prop": 0.7100371747211895,
"repo_name": "antoinecarme/pyaf",
"id": "919450f1577bc28af5016a8ec784a71e6002bf01",
"size": "269... |
from config import *
import time
class Load():
def __init__(self, chan):
self.channel = chan.channel
self.botnick = chan.botnick
self.sendmsg = chan.sendmsg
self.leavechan = chan.leavechan
self.joinchan = chan.joinchan
self.name = "ignore"
self.sendmsg("... | {
"content_hash": "ad81499a3b6c5e2a0b8bc326260d983e",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 95,
"avg_line_length": 35.87234042553192,
"alnum_prop": 0.5118623962040332,
"repo_name": "rbracken/internbot",
"id": "3256f7154561ae1d24294402cae941cdcd3e81c4",
"size": "16... |
TableList = [
'LatestMirror',
'CommitLock',
'Branches',
'Items',
'Versions',
'Labels',
'LabelMap',
'Flavors',
'FlavorMap',
'FlavorScores',
'Users',
'UserGroups',
'UserGroupMembers',
'EntitlementGroups',
'Entitlements',
'EntitlementOwners',
'Entitlement... | {
"content_hash": "dc2b4cef6988f2d6506a3d2539425a22",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 30,
"avg_line_length": 18.77777777777778,
"alnum_prop": 0.5810650887573965,
"repo_name": "fedora-conary/conary",
"id": "4f36521750c74cb5fe39165759064a9403f54e92",
"size": "... |
import contextlib
import string
import sys
import tempfile
from unittest import mock
import numpy as np
import pytest
import cupy
from cupy import testing
@contextlib.contextmanager
def use_temporary_cache_dir():
target = 'cupy.fft._callback.get_cache_dir'
with tempfile.TemporaryDirectory() as path:
... | {
"content_hash": "45cf7aedc250c3d09dce92851e630310",
"timestamp": "",
"source": "github",
"line_count": 710,
"max_line_length": 79,
"avg_line_length": 41.426760563380284,
"alnum_prop": 0.5499269030700711,
"repo_name": "cupy/cupy",
"id": "de9995fdb86116da5630504b0f6a9db950483a8d",
"size": "29413",
... |
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pickle
import os.path
from datetime import datetime
from sklearn.metrics import mean_squared_error
from sklearn.metrics.regression import r2_score
from sklearn.model_selection import StratifiedKFold
from include.datas... | {
"content_hash": "5c2354f9c5b6328cf93c1eec9f3e7a2f",
"timestamp": "",
"source": "github",
"line_count": 365,
"max_line_length": 179,
"avg_line_length": 41.74794520547945,
"alnum_prop": 0.6130725817036357,
"repo_name": "zakkum42/Bosch",
"id": "00f52359cec2c934d30d7622df25fe6c76e91978",
"size": "1532... |
import os, sys
import tensorflow as tf
class IW(tf.keras.Model):
def __init__(self, model_sd, iw_max=1e6):
super().__init__()
self.model_sd = model_sd
self.iw_max = iw_max
def __call__(self, x, training=False, iw=True):
probs = self.model_sd(x, training=False)['probs']
... | {
"content_hash": "3a9ad6717ee2e97ef978fb56de79a008",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 72,
"avg_line_length": 23.547169811320753,
"alnum_prop": 0.5560897435897436,
"repo_name": "googleinterns/intern2020_cocal",
"id": "32175f19d8da53e696122e4302ff7de3135468a7",
... |
from django.test import TestCase
from django.contrib.auth.models import User
from django.core.cache import cache
from boardinghouse.models import Schema
from boardinghouse.schema import get_active_schemata, get_all_schemata
class TestUserSchemataCache(TestCase):
def test_adding_schema_to_user_clears_cache(self):
... | {
"content_hash": "1cf2abc6c48473a3a98d6ed39268b946",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 83,
"avg_line_length": 37.95294117647059,
"alnum_prop": 0.6553006819590824,
"repo_name": "luzfcb/django-boardinghouse",
"id": "3b1f56cdf532b46517eba6f332f87456d184f707",
"s... |
"""Tests for the experimental input pipeline ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import numpy as np
from tensorflow.contrib.data.python.ops import batching
from tensorflow.contrib.data.python.ops import optimization
from ten... | {
"content_hash": "96d33a72b8f716181663f12adbb858f8",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 78,
"avg_line_length": 35.07361963190184,
"alnum_prop": 0.553262200454784,
"repo_name": "AnishShah/tensorflow",
"id": "0a87d3e90550da8485b4f9acd941c836d7b62951",
"size": "... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('basicviz', '0011_auto_20160717_2121'),
]
operations = [
migrations.AddField(
model_name='experiment',
name='description',
... | {
"content_hash": "402334a29961c39726a43fc9148e9466",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 63,
"avg_line_length": 22.842105263157894,
"alnum_prop": 0.5990783410138248,
"repo_name": "sdrogers/ms2ldaviz",
"id": "49c8e625606dead1e3dc26d669aea3d9a18d1fcc",
"size": "4... |
from core.himesis import Himesis
import uuid
class Hlayer1rule15(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule layer1rule15.
"""
# Flag this instance as compiled now
self.is_compiled = True
... | {
"content_hash": "399f540928faa5fa2ba0d605986cb5f3",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 205,
"avg_line_length": 39.76724137931034,
"alnum_prop": 0.5378278777368307,
"repo_name": "levilucio/SyVOLT",
"id": "51a9d1d3546ad99bd99753d0698709f524329505",
"size": "46... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Font(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatter.marker.colorbar.title"
_path_str = "scatter.marker.colorbar.title.font"
_valid_props =... | {
"content_hash": "55fbfaead8ac178b1efd668b06355535",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 82,
"avg_line_length": 37.69298245614035,
"alnum_prop": 0.5609727717011869,
"repo_name": "plotly/python-api",
"id": "3c7d1ca13e2784ad51c47412edb9767d00d7a950",
"size": "85... |
import os
from datetime import datetime
from math import ceil
from flask.ext.sqlalchemy import SQLAlchemy
from flask import Flask, request, session, redirect, url_for, render_template, flash
basedir = os.path.abspath(os.path.dirname(__file__))
app = Flask(__name__)
'''Configuration - Debug can be removed for product... | {
"content_hash": "2b8c1ab2d7506606cc6a6ea19aecd805",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 115,
"avg_line_length": 34.294642857142854,
"alnum_prop": 0.6456651913564176,
"repo_name": "sicongl/miniblog",
"id": "0c8582a9938423cacf4445e2af1827727b00852b",
"size": "3... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.