text stringlengths 4 1.02M | meta dict |
|---|---|
import pytest
import decimal
import datetime
import pyarrow as pa
# Marks all of the tests in this module
# Ignore these with pytest ... -m 'not orc'
pytestmark = pytest.mark.orc
try:
from pandas.util.testing import assert_frame_equal
import pandas as pd
except ImportError:
pass
@pytest.fixture(scope=... | {
"content_hash": "2dbff0854a5ceca9cec9366385c1d636",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 73,
"avg_line_length": 31.973684210526315,
"alnum_prop": 0.5814814814814815,
"repo_name": "itaiin/arrow",
"id": "2a274c9b249f021829e5af5d82d2db8a8f6a22d1",
"size": "5646",... |
"""Tests for XLA op wrappers."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
import numpy as np
from tensorflow.compiler.tests import xla_test
from tensorflow.compiler.tf2xla.python import xla
from tensorflow.comp... | {
"content_hash": "1f85005e61c74b4a973e2dfe4978578d",
"timestamp": "",
"source": "github",
"line_count": 403,
"max_line_length": 79,
"avg_line_length": 37.593052109181144,
"alnum_prop": 0.5908910891089109,
"repo_name": "renyi533/tensorflow",
"id": "3c2fcbc0fcc6849559561e7b0e7bdc7575993872",
"size": ... |
"""
PSim.py - The Python Semiconductor Dynamics Simulator
Created on Mon Mar 09 10:07:36 2015
@author: Matthew Rowley
"""
from __future__ import division
import numpy as np
from multiprocessing import Pool
# Some universal constants
ps = 10.0**-12
ns = 10.0**-9
sqrt_2pi = np.sqrt(2 * np.pi)
def bEqn(g, e, h, Gdecay... | {
"content_hash": "881a9dfeaece617431e164d134cc9db0",
"timestamp": "",
"source": "github",
"line_count": 335,
"max_line_length": 101,
"avg_line_length": 34.76119402985075,
"alnum_prop": 0.5264061829111206,
"repo_name": "mattbrowley/PSim",
"id": "b1aad77d9660c2b28a2096fd43497b3b05bcfcf5",
"size": "11... |
"""
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | {
"content_hash": "0227ad0c0c0366099bd930988b4313d9",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 80,
"avg_line_length": 25.18840579710145,
"alnum_prop": 0.5247410817031071,
"repo_name": "onlineconvert/onlineconvert-api-sdk-python3",
"id": "ba467864dbcb38f5c6eecfd2ad90d0d... |
import os
import sys
import coverage_helper
"""
Coverage for Linux
On the Linux Coverage Bots, coverage information is stored in
scons-out/coverage-<os>-<arch>/coverage.lcov
The data is in the form of:
SF:<file_name>
DA:<line,hits>
end_of_record
Where SF specifices the full path to the soruce file. DA spe... | {
"content_hash": "10b3e2208e2c896da187e3840ea51ae8",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 79,
"avg_line_length": 28.394495412844037,
"alnum_prop": 0.6668820678513732,
"repo_name": "nacl-webkit/native_client",
"id": "803095ea2073790b6194f1ac9a85251f2315c5cb",
"s... |
"""Print the first 10 lines of the given files.
"""
from __future__ import print_function
import argparse
import sys
import fileinput
def filter_non_printable(s):
return ''.join([c if (31 < ord(c) < 127 or c in "\n\r\t\b") else ' ' for c in s])
def head(f, nlines):
if nlines >= 0:
for i, line in enu... | {
"content_hash": "2b432e76cf5e07dad73ba6b95a121ff2",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 85,
"avg_line_length": 28.730337078651687,
"alnum_prop": 0.4591317950723504,
"repo_name": "cclauss/stash",
"id": "b916e0cf3d0b37aa0b8aff461d469f2f222054e5",
"size": "2557",... |
##
## Copyright 2016 SRI International
## See COPYING file distributed along with the package for the copyright and license terms.
##
import pandas
import RwrapperNew
#
# Variables from surveys needed for DRHQ
#
# LimeSurvey field names
lime_fields = [ "dhr_sec2 [dhr7_1]", "dhr_sec2 [dhr8_1]", "dhr_sec2 [dhr9_1... | {
"content_hash": "5b098e16e1f277b8cf1a608831c915dd",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 220,
"avg_line_length": 36.21739130434783,
"alnum_prop": 0.6830732292917167,
"repo_name": "abonil91/ncanda-data-integration",
"id": "c7279006c9959a33e4727a7c88a470b7caebce8b"... |
from celery.task import task
from djpostman.receiver import ImapMailReceiver
import logging
from djpostman.models import Message
logger = logging.getLogger(__name__)
@task
def send_mail_task(msg_id):
try:
msg = Message.objects.get(id=msg_id)
msg.email.send()
msg.sent = True
msg.save... | {
"content_hash": "a19dbfdb84807f387ca31c00de70c3f9",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 48,
"avg_line_length": 24.6,
"alnum_prop": 0.676829268292683,
"repo_name": "iterativ/djpostman",
"id": "91ebcccbb94b470b219fea8559f8ee336e916c01",
"size": "680",
"binary"... |
import os
import sys
import logging
from urllib import urlencode
import urlparse
# for CSRF state tokens
import time
import base64
# Get available json parser
try:
# should be the fastest on App Engine py27.
import json
except ImportError:
try:
import simplejson as json
except ImportError:
from djan... | {
"content_hash": "6417fedf63320820a2932a4a8f7b86e0",
"timestamp": "",
"source": "github",
"line_count": 580,
"max_line_length": 97,
"avg_line_length": 34.55172413793103,
"alnum_prop": 0.6516467065868263,
"repo_name": "Gabicoware/txtbranch",
"id": "1e20dc70aaf79a0e871d26eecd7e6c5d6d974ce5",
"size": ... |
from msrest.serialization import Model
class PeriodicTimerSourceInfo(Model):
"""Periodic timer event source.
All required parameters must be populated in order to send to Azure.
:param start_time: Required. The time of the day that results in a valid
trigger. Schedule is computed with reference to ... | {
"content_hash": "0f655883f96094c4a0b274f976981bf4",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 88,
"avg_line_length": 37.55555555555556,
"alnum_prop": 0.647189349112426,
"repo_name": "Azure/azure-sdk-for-python",
"id": "702286995e38532ffd35666eacab580ea3131bbc",
"siz... |
from pyquery import PyQuery as pq
from nose.tools import eq_
from django.forms import ModelForm
from olympia.amo.tests import TestCase
from olympia.translations import forms, fields
from olympia.translations.tests.testapp.models import TranslatedModel
class TestForm(forms.TranslationFormMixin, ModelForm):
name ... | {
"content_hash": "1ae1127522067c1b48fe293373ee5655",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 70,
"avg_line_length": 28.11111111111111,
"alnum_prop": 0.69433465085639,
"repo_name": "jpetto/olympia",
"id": "4ad58c04ebf7f0aa4a4cb6f3840ec6a9066bed88",
"size": "759",
... |
from collections import namedtuple
import os
import binascii
IMMUTABLE_OBJECT_FIELDS = ['oauth_authorization_uri', 'oauth_token_uri', 'oauth_token_refresh_uri', 'api_uri',
'redirect_uri', 'response_type', 'state', 'client_id', 'client_secret', 'scope',
'grant_type'... | {
"content_hash": "2c3c7759fd3b95a5ac4543f0954ecf42",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 125,
"avg_line_length": 40.73626373626374,
"alnum_prop": 0.6234151605071486,
"repo_name": "SequencingDOTcom/oAuth2-Code-Example-.NET",
"id": "a975ba12c078f8aea4234e4337d7c204... |
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
logging.getLogger('cassandra').addHandler(NullHandler())
__version_info__ = (3, 4, 1, 'post0')
__version__ = '.'.join(map(str, __version_info__))
class ConsistencyLevel(object):
"""
Spcifies how many replicas must... | {
"content_hash": "b922e64a769e58a35e0937203ac6b4c1",
"timestamp": "",
"source": "github",
"line_count": 483,
"max_line_length": 123,
"avg_line_length": 27.401656314699792,
"alnum_prop": 0.6468454854552323,
"repo_name": "kishkaru/python-driver",
"id": "67f5b147ff46e012313d94d4232829c5bad57f2a",
"siz... |
"""Unit tests for tracker_file and parallel_tracker_file."""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import stat
from gslib.exception import CommandException
from gslib.parallel_tracker_file import ... | {
"content_hash": "a24e04c16c61c6a451b2bf4073bcfa0e",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 87,
"avg_line_length": 42.690582959641254,
"alnum_prop": 0.6409663865546219,
"repo_name": "GoogleCloudPlatform/gsutil",
"id": "3e0557955e7358e0f2f868ac1b9800b2b05609c7",
"... |
from django.test import TestCase, Client
from django import http
from django.conf import settings
from django.core.handlers import wsgi, base
class RequestFactory(Client):
def __init__(self):
Client.__init__(self)
self._handler = base.BaseHandler()
self._handler.load_middleware()
s... | {
"content_hash": "2f67e92a0df512639a673f0375ed884f",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 93,
"avg_line_length": 31.880434782608695,
"alnum_prop": 0.5980225025571088,
"repo_name": "strogo/turbion",
"id": "d80d517d638b72b1f79b0e9343089eae40ff3bb6",
"size": "2933"... |
"""Tests for RNN cells."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import numpy as np
# TODO(ebrevdo): Remove once _linear is fully deprecated.
# pylint: disable=protected-access
from tensorflow.contrib import rnn as contrib_rnn
... | {
"content_hash": "0472ce25859375946d95eecf059e687d",
"timestamp": "",
"source": "github",
"line_count": 841,
"max_line_length": 80,
"avg_line_length": 43.49346016646849,
"alnum_prop": 0.607824375307562,
"repo_name": "mdrumond/tensorflow",
"id": "8349188f6f3ff36087e90d69a3ae3c3675ad3801",
"size": "3... |
"""Tooth.py: Public Tooth class representing tooth entities in the educational game Trusty Brusher."""
class Tooth:
"""
A Tooth in the Mouth of a Person.
self.location: int value indicating location of Tooth in the Mouth
self.has_cavity: bool value indicating whether or not the Tooth has a cav... | {
"content_hash": "fe2c4b421566ab534ee0ddb3fef1beec",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 102,
"avg_line_length": 31.228571428571428,
"alnum_prop": 0.6642268984446478,
"repo_name": "jposchel/trusty-brusher-python",
"id": "f7471b6efca2868ad1b3290ccfc22121afc28c5f",... |
"""
This file is part of the PSL software.
Copyright 2011-2015 University of Maryland
Copyright 2013-2022 The Regents of the University of California
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
... | {
"content_hash": "e4f45ef10feda3906242c543a669a37b",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 72,
"avg_line_length": 39.705882352941174,
"alnum_prop": 0.7955555555555556,
"repo_name": "linqs/psl",
"id": "4b3d273fd249a3b84e48a459f903ece7b5d8c54a",
"size": "675",
"b... |
""" Utilities to parse a list of constraints and extract matching subcube """
from ast import literal_eval
from typing import Callable, Dict, List, Optional, Tuple, Union
import numpy as np
from iris import Constraint
from iris.cube import Cube
from improver.metadata.constants import FLOAT_DTYPE
from improver.utilit... | {
"content_hash": "d7f364b78a239f4b85ce2ec92a9e3cc4",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 86,
"avg_line_length": 37.26428571428571,
"alnum_prop": 0.6258386045620088,
"repo_name": "fionaRust/improver",
"id": "b7f482806095b36118fe40934adf7a4438f26f92",
"size": "1... |
import sys
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import Pi... | {
"content_hash": "0287f673f36bfc8591427b7fc24255db",
"timestamp": "",
"source": "github",
"line_count": 468,
"max_line_length": 251,
"avg_line_length": 46.00213675213675,
"alnum_prop": 0.6636629662315946,
"repo_name": "Azure/azure-sdk-for-python",
"id": "96c55728294dfc60f716377f69c876a145edbe05",
"... |
"""This is not that game - data converter.
Converts (PostgresSQL) SQL files into Django fixture (json) data file.
"""
import os
import sys
import random
import pprint
import csv
import cgi
import sqlite3
# json support, TODO consider http://pypi.python.org/pypi/omnijson
try:
# Python 2.6+
import json
except I... | {
"content_hash": "948afff307f64ada046cfbf5d4fa481f",
"timestamp": "",
"source": "github",
"line_count": 321,
"max_line_length": 179,
"avg_line_length": 34.18691588785047,
"alnum_prop": 0.58529250956807,
"repo_name": "phildini/cards-against-django",
"id": "f659763d301bfca8a799f7fd84d561b79a972701",
... |
import os
from viper.common.abstracts import Module
from viper.core.session import __sessions__
class XorSearch(Module):
cmd = 'xor'
description = 'Search for xor Strings'
authors = ['Kevin Breen', 'nex']
def __init__(self):
super(XorSearch, self).__init__()
self.parser.add_argument(... | {
"content_hash": "5b5188f6f459098169996b347b4c1aea",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 118,
"avg_line_length": 34.92481203007519,
"alnum_prop": 0.47922497308934336,
"repo_name": "jorik041/viper",
"id": "0193d7e459455ccfe445578bb5ab613773457277",
"size": "478... |
from __future__ import print_function
from setuptools import setup, find_packages, Command, Extension
from setuptools.command.sdist import sdist
from setuptools.command.build_py import build_py
from setuptools.command.egg_info import egg_info
from subprocess import check_call
import os
import sys
import platform
here ... | {
"content_hash": "3c65ce34b959e38003e11df3af6e463c",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 124,
"avg_line_length": 33.793103448275865,
"alnum_prop": 0.585204081632653,
"repo_name": "j-towns/iprofiler",
"id": "5af511ae08109caf45ecb60619f056b8b6bc80f3",
"size": "5... |
"""Dump functions called by static intializers in a Linux Release binary.
Usage example:
tools/linux/dump-static-intializers.py out/Release/chrome
A brief overview of static initialization:
1) the compiler writes out, per object file, a function that contains
the static intializers for that file.
2) the compiler... | {
"content_hash": "471c45dae751c4b84c1e8d4b1dae881b",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 79,
"avg_line_length": 36.87222222222222,
"alnum_prop": 0.6640048214554769,
"repo_name": "aYukiSekiguchi/ACCESS-Chromium",
"id": "14fe46994a89a4aa3d017e174ccbce290a1484b9",
... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Technology'
db.create_table(u'projects_technology', (
(u'id', self.gf('django.db.models.fields.AutoField... | {
"content_hash": "8de0f41ff296474e3b8e18baaffd3f16",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 146,
"avg_line_length": 45.343283582089555,
"alnum_prop": 0.5957867017774852,
"repo_name": "develersrl/projectboard",
"id": "2fd623e3b2e76ca8f5c349e07311411344dc53c1",
"siz... |
from polls.models import *
from appauth.models import *
import xml.etree.ElementTree as ET
import requests
def callbackfunction(tree):
print(ET.tostring(tree))
username = tree[0][0].text.lower() + "@rpi.edu"
tree[0][0].text = username
user, user_created = User.objects.get_or_create(username=username)
# if(user.f... | {
"content_hash": "80895d44cf2d5dc24dca55ce87b9ab9f",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 93,
"avg_line_length": 33.76923076923077,
"alnum_prop": 0.6480637813211845,
"repo_name": "PrefPy/opra",
"id": "f452c4ab1f371d695be91b8f434e27b5a076125b",
"size": "878",
"... |
import pytest
from typing import Any, Dict, List
from dataclasses import dataclass
from proto import Message
import gaarf.parsers as parsers
@dataclass
class FakeGoogleAdsRowElement:
value: int
text: str
name: str
@dataclass
class TextAttribute:
text: str
@dataclass
class NameAttribute:
name: ... | {
"content_hash": "cf65068f0c9b12676f9a6cffd6ba2dcc",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 75,
"avg_line_length": 26.757575757575758,
"alnum_prop": 0.6718006795016987,
"repo_name": "google/ads-api-report-fetcher",
"id": "2a32cd5e522cfaf0c94ca76319ea0739fa3f0373",
... |
from django.contrib.auth import get_user_model
from django.shortcuts import render, get_object_or_404
# Create your views here.
User = get_user_model()
from .models import Profile
def profile_view(request, username):
user = get_object_or_404(User, username=username)
profile, created = Profile.objects.get_or_create... | {
"content_hash": "d5f282b3601ea77365cb1c5a1f90c0ef",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 62,
"avg_line_length": 32.76923076923077,
"alnum_prop": 0.7652582159624414,
"repo_name": "pachinko/matchmaker_profile",
"id": "302167ab6c832a33575efb64539fe151a612a6f9",
"s... |
import os.path as path
import os
import time
import datetime
#email
MAX_DELTA_S = 60 * 60 #max is 1 hour
DATA_DIR = 'user_data'
DIR = os.getcwd()+'/'+DATA_DIR+'/'
N = len(os.listdir(DIR))
print 'N files = ', N
if N > 0:
i = 0
for filename in os.listdir(DIR):
tm = path.getmtime(DIR + filena... | {
"content_hash": "7161d87645c02c1a4488d60f123abe98",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 91,
"avg_line_length": 26.653846153846153,
"alnum_prop": 0.5541125541125541,
"repo_name": "realms-team/solmanager",
"id": "ab2d44590c16e10b62c927a650c6aa649d096449",
"size"... |
"""
Test the various aspects/components of content serialization/deserialization
"""
import pytest
from django.contrib.auth.models import User
from xml.etree.ElementTree import Element, SubElement
from xml.etree import ElementTree
from ..impexp import WheelSerializer, Exporter, Importer
from ..node import Node
... | {
"content_hash": "ba3ad851819171fe52fe67d8f774f968",
"timestamp": "",
"source": "github",
"line_count": 476,
"max_line_length": 443,
"avg_line_length": 36.55042016806723,
"alnum_prop": 0.595125876537533,
"repo_name": "wheelcms/wheelcms_axle",
"id": "09f1997b175291dffd5dd472ee15d5bf6860dcbf",
"size"... |
"""Test the National Weather Service (NWS) config flow."""
import aiohttp
from homeassistant import config_entries, setup
from homeassistant.components.nws.const import DOMAIN
from tests.async_mock import patch
async def test_form(hass, mock_simple_nws_config):
"""Test we get the form."""
hass.config.latitu... | {
"content_hash": "44f42642da8e3f0e964eb2d03dd4bccc",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 76,
"avg_line_length": 34.36842105263158,
"alnum_prop": 0.6500765696784073,
"repo_name": "mKeRix/home-assistant",
"id": "bca852fa379670dc1656539946e457af4790d820",
"size":... |
"""
Created on Thu Sep 28 15:17:50 2017
@author: zqwu
"""
import numpy as np
import tensorflow as tf
import copy
import sys
from deepchem.metrics import to_one_hot, from_one_hot
from deepchem.models import KerasModel, layers
from deepchem.models.losses import L2Loss, SoftmaxCrossEntropy
from deepchem.trans import und... | {
"content_hash": "4b12d680c417ec6ad6be0e6b66019961",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 108,
"avg_line_length": 32.77454545454545,
"alnum_prop": 0.6254299345389992,
"repo_name": "miaecle/deepchem",
"id": "30ee965f5e696139427999b414aa12751e881316",
"size": "90... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 19 14:51:07 2017
@author: ajaver
Get the food contour using thresholdings and morphological operations.
"""
import tables
import numpy as np
import cv2
from skimage.transform import hough_circle, hough_circle_peaks
from skimage.morphology import ... | {
"content_hash": "88e5aa46783b257b6572a6506cbadf8a",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 112,
"avg_line_length": 33.6301775147929,
"alnum_prop": 0.5802762382334828,
"repo_name": "ver228/tierpsy-tracker",
"id": "a25a899655169387084894058da43298a3223fcf",
"size"... |
""" Floyd - server
serves floyd sites on a local http server
"""
import os
import sys
import threading
import re
import logging
import posixpath
from urlparse import urlparse
from urllib import unquote
from floyd import get_version
import BaseHTTPServer
from CGIHTTPServer import CGIHTTPRequestHandler
from SocketSe... | {
"content_hash": "1e341924a4a37891d2a03b0e808c2de3",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 86,
"avg_line_length": 28.036363636363635,
"alnum_prop": 0.6705577172503242,
"repo_name": "nikcub/floyd",
"id": "94833562b8365d58698d89b8ba9c4524743aab37",
"size": "3366",... |
import tornado.httpserver
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
application = tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
http_server = tornado.httpserver.HTTPServer(applic... | {
"content_hash": "a2ad88040222b60661fdb98b1f488bcc",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 60,
"avg_line_length": 25.0625,
"alnum_prop": 0.7007481296758105,
"repo_name": "toymachine/concurrence",
"id": "87ed88133fbb5c9c5f6e22a719a642e32927998a",
"size": "401",
... |
from sqlalchemy import sql
from neutron.common import constants as const
from neutron.db import agents_db
from neutron.db import common_db_mixin as base_db
from neutron.db import models_v2
from neutron.openstack.common import jsonutils
from neutron.openstack.common import timeutils
from neutron.plugins.ml2.drivers.l2p... | {
"content_hash": "0e15eeebdd7cae2028a34e5611069349",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 85,
"avg_line_length": 47.112,
"alnum_prop": 0.5590083205977245,
"repo_name": "nash-x/hws",
"id": "6aa375544faa9082eaa8cfb000bf626633dcdf61",
"size": "6530",
"binary": f... |
from model.contact import Contact
import random
def test_modify_contact_firstname_lastname(app, db, check_ui):
if len(db.get_contact_list()) == 0:
app.contact.create(Contact(firstname="Test contact", lastname="Modified lastname"))
old_contacts = db.get_contact_list()
contact_random = random.choice... | {
"content_hash": "0bb61e0644e3078192a08024bf8196bf",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 105,
"avg_line_length": 45.21052631578947,
"alnum_prop": 0.7136204889406287,
"repo_name": "SherMary/python_training",
"id": "d166cfbc9cc391e0fc9e28ec08210d4b3bfa7c33",
"siz... |
class ddt_tile():
def __init__(self,tileparameters_I = [],specificparameters_I = []):
if tileparameters_I:self.tileparameters = tileparameters_I;
else: self.tileparameters = [];
if specificparameters_I:self.specificparameters = specificparameters_I;
else: self.specificparameters = []... | {
"content_hash": "93d528be9306c2b27d557ccfe6c213f4",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 79,
"avg_line_length": 32.11764705882353,
"alnum_prop": 0.532967032967033,
"repo_name": "dmccloskey/ddt_python",
"id": "144c1a7bfe5c2a0977a837d69e2843b2ec2b63f8",
"size": ... |
"""
Cart-pole balancing with randomly positioned radial basis functions
"""
from rlpy.Domains import InfCartPoleBalance
from rlpy.Agents import Q_Learning
from rlpy.Representations import *
from rlpy.Policies import eGreedy
from rlpy.Experiments import Experiment
import numpy as np
from hyperopt import hp
param_space ... | {
"content_hash": "defe2106555c6a2e43a4df6749d93da0",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 87,
"avg_line_length": 35.6,
"alnum_prop": 0.6466292134831461,
"repo_name": "MDPvis/rlpy",
"id": "fb9263cc1b7a66f920a4e5be5ccb8dc5a03e0509",
"size": "1780",
"binary": fal... |
import os
import sys
import unittest
from xml.etree import ElementTree
import emma_coverage_stats
from pylib import constants
sys.path.append(os.path.join(
constants.DIR_SOURCE_ROOT, 'third_party', 'pymock'))
import mock # pylint: disable=F0401
EMPTY_COVERAGE_STATS_DICT = {
'files': {},
'patch': {
'incr... | {
"content_hash": "5a2aea2f32354a1f8e4855dc4fdd777b",
"timestamp": "",
"source": "github",
"line_count": 559,
"max_line_length": 80,
"avg_line_length": 37.79785330948122,
"alnum_prop": 0.5916986132803256,
"repo_name": "vadimtk/chrome4sdp",
"id": "111f24aec194d64b2fc864fb7013b7a54e10c6d6",
"size": "2... |
from indy_node.server.upgrade_log import UpgradeLog
from indy_node.test import waits
from indy_node.test.upgrade.helper import checkUpgradeScheduled, \
sdk_ensure_upgrade_sent
from plenum.common.constants import VERSION
from plenum.test.delayers import req_delay
from plenum.test.test_node import getNonPrimaryReplic... | {
"content_hash": "0640d46deb648bb9fa08dd08bb802d25",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 79,
"avg_line_length": 43.32432432432432,
"alnum_prop": 0.7074235807860262,
"repo_name": "spivachuk/sovrin-node",
"id": "fdf3f653c25e9c425a371b0a6e5cbeabc249a117",
"size": ... |
from ikalog.utils.image_filters.filters import *
| {
"content_hash": "79a4ee249ca20b81a22569632da2a618",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 48,
"avg_line_length": 49,
"alnum_prop": 0.8163265306122449,
"repo_name": "hasegaw/IkaLog",
"id": "597e1fdff0c2676a5cb2ebbc0579d648ade510f0",
"size": "732",
"binary": fals... |
"""Move local source snapshots to GCP.
"""
import os
import os.path
import tarfile
from googlecloudsdk.api_lib.storage import storage_util
from googlecloudsdk.api_lib.util import apis as core_apis
from googlecloudsdk.core import log
from googlecloudsdk.core.util import files
class FileMetadata(object):
"""FileMe... | {
"content_hash": "f01424b98a8eca4b26e6d5fc88017442",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 78,
"avg_line_length": 31.891304347826086,
"alnum_prop": 0.6445126107702794,
"repo_name": "Sorsly/subtle",
"id": "2bec695268807473e2dd973c10d69c49ae56b493",
"size": "3529",... |
from __future__ import absolute_import
from pdbuddy.matchers.function import FunctionMatcher
from pdbuddy.trace_context import TraceContext
def test_true():
assert FunctionMatcher(lambda *args: True)(
TraceContext(object(), object(), object()))
def test_false():
assert FunctionMatcher(lambda *args:... | {
"content_hash": "c917ba2d2f8d1e2de464bf48bff6fd39",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 53,
"avg_line_length": 27.142857142857142,
"alnum_prop": 0.7157894736842105,
"repo_name": "emou/pdbuddy",
"id": "2cb410c7f985cefe0ea7364f36c1aeba3838c52d",
"size": "380",
... |
from .base import BaseAction
from ...misc.utils import prints_body
class ListBucketsAction(BaseAction):
command = "list-buckets"
usage = "%(prog)s [-z <zone> -f <conf_file>]"
@classmethod
def add_ext_arguments(cls, parser):
parser.add_argument(
"-z",
"--zone",
... | {
"content_hash": "cada8d9a1d8605a0db05b4ba72202f88",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 60,
"avg_line_length": 26.28,
"alnum_prop": 0.5677321156773212,
"repo_name": "yunify/qingcloud-cli",
"id": "397c57dc9e78df4aee92c913e145d92af9396dd6",
"size": "1490",
"bi... |
from .WindowAdapter import *
| {
"content_hash": "49353612fa7cad06d5989901e6c71378",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 28,
"avg_line_length": 30,
"alnum_prop": 0.7666666666666667,
"repo_name": "ktan2020/jpype",
"id": "1e4688d751ceb0b33900f26eb8ba1dbc5c17482e",
"size": "807",
"binary": fals... |
from __future__ import unicode_literals
from ..tensors import EstimateResponseForSH
def test_EstimateResponseForSH_inputs():
input_map = dict(args=dict(argstr='%s',
),
debug=dict(argstr='-debug',
),
encoding_file=dict(argstr='-grad %s',
mandatory=True,
position=1,
),
environ=dict(n... | {
"content_hash": "5c03f5b7328102de8e8236c458e2cbb1",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 67,
"avg_line_length": 25.125,
"alnum_prop": 0.6211798152096659,
"repo_name": "mick-d/nipype",
"id": "07928dfe43c93862af0ab458dab2b60880dbf42c",
"size": "1461",
"binary":... |
"""
Sphinx directive to support embedded IPython code.
This directive allows pasting of entire interactive IPython sessions, prompts
and all, and their code will actually get re-executed at doc build time, with
all prompts renumbered sequentially. It also allows you to input code as a pure
python input by giving the a... | {
"content_hash": "0520a04c32a14c2c0e83f43a2e039343",
"timestamp": "",
"source": "github",
"line_count": 1090,
"max_line_length": 124,
"avg_line_length": 34.6651376146789,
"alnum_prop": 0.5702792113272462,
"repo_name": "jmmease/pandas",
"id": "922767a8e2d467bc04a60aa2860b852871eacb72",
"size": "3781... |
import pytest
import responses
import arcgis_sdk
from .shortcuts import add_response
@responses.activate
def test_refresh_token(client):
add_response(
'GET',
'oauth2/token/',
json={'access_token': 'new!'})
assert client.refresh_token(
client_id='client_id',
refresh_t... | {
"content_hash": "f62269fe516f79b199954fc74656ef4a",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 78,
"avg_line_length": 21.0072202166065,
"alnum_prop": 0.5791373088159477,
"repo_name": "mongkok/arcgis-sdk",
"id": "aa7be799ade9c9f656c83a777a7778b0832f75e8",
"size": "58... |
from django.http import HttpResponse, HttpResponseRedirect, Http404, HttpResponseServerError
from django.utils.safestring import mark_safe
from django.views.decorators.http import require_POST
from corehq.apps.commtrack.views import BaseCommTrackManageView
from corehq.apps.domain.decorators import domain_admin_require... | {
"content_hash": "6df9b52029b38bb9fd7dfc1dc2334ce7",
"timestamp": "",
"source": "github",
"line_count": 365,
"max_line_length": 111,
"avg_line_length": 33.25479452054795,
"alnum_prop": 0.6326412918108419,
"repo_name": "gmimano/commcaretest",
"id": "39849948c17aa0f306e9cda84f6ff36ef7e0d184",
"size":... |
import time
from threading import Thread
import pyBotCore
## Run the bot and flood counter in own threads
def initialize():
bot = Thread(target=pyBotCore.pyBot)
fld = Thread(target=pyBotCore.Flood)
cobelearn = Thread(target=pyBotCore.CobeLearn)
bot.daemon = True
bot.start()
fld.daemon = True
fld.start()
cobe... | {
"content_hash": "3651ed27184301598c10d80e2f1443a8",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 107,
"avg_line_length": 25.257142857142856,
"alnum_prop": 0.7251131221719457,
"repo_name": "jasuka/pyBot",
"id": "3e70105e96f33d666b682a7ddd655247d3d00f5f",
"size": "933",
... |
"""Notebook related utilities"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
import asyncio
import concurrent.futures
import ctypes
import errno
import inspect
import os
import socket
import stat
import sys
from distutils.... | {
"content_hash": "f487d4f1151e0e2db2a11b9c00b2e2f4",
"timestamp": "",
"source": "github",
"line_count": 401,
"max_line_length": 97,
"avg_line_length": 30.122194513715712,
"alnum_prop": 0.6380495074095538,
"repo_name": "sserrot/champion_relationships",
"id": "c8bae60543492fa8892d4795399fc065c920b4e6",... |
"""For environment specific extensions."""
import abc
from typing import Optional
from tfx.orchestration.experimental.core import orchestration_options
from tfx.proto.orchestration import pipeline_pb2
_ENV = None
class Env(abc.ABC):
"""Base class for environment specific extensions."""
def __enter__(self) -> ... | {
"content_hash": "2886b54f028492cb1db4cc2301c12e60",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 77,
"avg_line_length": 24.575757575757574,
"alnum_prop": 0.6985203452527744,
"repo_name": "tensorflow/tfx",
"id": "ac789b40e737b28eb7b09b4ce73859193ecfa8cb",
"size": "2218"... |
''' view_pcap worker '''
import zerorpc
import pprint
import os
class ViewPcap(object):
''' ViewPcap: Generates a view for a pcap sample (depends on Bro)'''
dependencies = ['pcap_bro']
def __init__(self):
self.workbench = zerorpc.Client(timeout=300, heartbeat=60)
self.workbench.connect("tc... | {
"content_hash": "ab463d0b794e4983e177ecab7581643e",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 119,
"avg_line_length": 31.263157894736842,
"alnum_prop": 0.6083052749719416,
"repo_name": "SuperCowPowers/workbench",
"id": "8f2a1cfc1bbc6c40e24928a3f55ddb0a94d48690",
"si... |
from marshmallow.fields import String
from indico.core.marshmallow import mm
from indico.modules.events.registration.models.forms import RegistrationForm
class RegistrationFormPrincipalSchema(mm.SQLAlchemyAutoSchema):
class Meta:
model = RegistrationForm
fields = ('id', 'name', 'identifier')
... | {
"content_hash": "29ffce0a8cf13bdc976ce48f55e42d7f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 76,
"avg_line_length": 29.23076923076923,
"alnum_prop": 0.7473684210526316,
"repo_name": "pferreir/indico",
"id": "70844a6987feb4d19fbc7442c81de3f0efe23fa1",
"size": "594",... |
"""Run ES and PES to tune regularization hyperparameters (e.g., L2 coefficient)
for UCI regression tasks.
Run the UCI experiments:
------------------------
for INIT_THETA in 5 3 1 -1 -3 -5 ; do
CUDA_VISIBLE_DEVICES=-1 python uci.py \
--estimate=pes \
--K=1 \
--outer_lr=0.003 \
--lr... | {
"content_hash": "f7a6167139be5e2cca3f86dd832dd47e",
"timestamp": "",
"source": "github",
"line_count": 407,
"max_line_length": 118,
"avg_line_length": 29.479115479115478,
"alnum_prop": 0.6256876146024337,
"repo_name": "google-research/google-research",
"id": "eeab21992b1bcf7d1940a629fe7e92c15cc51c77... |
import time
import unittest
import decimal
from pypayd import priceinfo
class PriceInfoTests(unittest.TestCase):
def testDummyTicker(self):
self.assertEqual(priceinfo.ticker.getPrice(ticker="dummy"), 350)
self.assertEqual(priceinfo.ticker.getPriceInBTC(ticker="dummy", amount=175.0), 0.5)
def ... | {
"content_hash": "ecc82e148e3067b18e469b112556fc1f",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 102,
"avg_line_length": 42.44444444444444,
"alnum_prop": 0.6969895287958116,
"repo_name": "pik/pypayd",
"id": "103122e6ddbb26445402362c9c9392c93a86c3c9",
"size": "1528",
... |
from django.contrib import admin
from easyscan_app.models import ScanRequest
class ScanRequestAdmin( admin.ModelAdmin ):
date_hierarchy = u'create_datetime'
ordering = [ u'-id' ]
list_display = [
u'id', u'create_datetime', u'status',
u'item_title', u'item_barcode', u'item_callnumber', u'it... | {
"content_hash": "4b39fc75091c0a15738b7cd982d3f1ca",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 165,
"avg_line_length": 50.03846153846154,
"alnum_prop": 0.6479631053036126,
"repo_name": "birkin/easyscan",
"id": "2c50be07d419b064f61462baa3895c320ce5781e",
"size": "1326... |
from __future__ import print_function, division, absolute_import
from rapid.common import spectrum, ZMat, SpectrumError
__all__ = ['spectrum',
'ZMat',
'SpectrumError',
]
| {
"content_hash": "3c5418e360d046794f9c7161e026165f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 64,
"avg_line_length": 22.77777777777778,
"alnum_prop": 0.6097560975609756,
"repo_name": "jensengrouppsu/rapid",
"id": "6467e64e0e7a4f9bd05ff61bc7c503d8983d3bba",
"size": "2... |
"""
This is the ``docutils.parsers.restructuredtext.states`` module, the core of
the reStructuredText parser. It defines the following:
:Classes:
- `RSTStateMachine`: reStructuredText parser's entry point.
- `NestedStateMachine`: recursive StateMachine.
- `RSTState`: reStructuredText State superclass.
... | {
"content_hash": "567131873835ef172c72bd65c82ff752",
"timestamp": "",
"source": "github",
"line_count": 3004,
"max_line_length": 80,
"avg_line_length": 42.09753661784288,
"alnum_prop": 0.5462316445386325,
"repo_name": "aswadrangnekar/khandelwal",
"id": "79404957325a3d524c13ec5e68053a3f3c89924f",
"s... |
import os
import shutil
import subprocess
from flask import g
from flask_testing import TestCase
from yawt import create_app
from yawt.utils import ChangedFiles
from yawtext import Plugin
from yawtext.git import _git_cmd
from yawtext.test import TempGitFolder
from yawtext.vc import vc_status, vc_add_tracked, vc_add_t... | {
"content_hash": "3be2714ae90c0500d0d2d128024133f4",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 76,
"avg_line_length": 32.032786885245905,
"alnum_prop": 0.5905834186284544,
"repo_name": "drivet/yawt",
"id": "108f9084ca6ce2648f8086a978628f4fe760596a",
"size": "5881",
... |
"""Tests that the combined appengine and Django models function correctly."""
import unittest
from django.db.models import get_models
from google.appengine.ext import db
from appengine_django.models import BaseModel
from appengine_django.models import ModelManager
from appengine_django.models import ModelOptions
fr... | {
"content_hash": "8e3d9b773a83cd8ab4f3dd1348a012a8",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 79,
"avg_line_length": 45.48936170212766,
"alnum_prop": 0.7331618334892422,
"repo_name": "pfeilbr/qik",
"id": "de895fa9154bb051fbb1494a92139385c9eb6ec7",
"size": "4875",
... |
from m5.defines import buildEnv
from m5.params import *
from m5.proxy import *
from m5.util.fdthelper import *
from m5.objects.ArmSystem import ArmExtension
from m5.objects.ClockDomain import ClockDomain, SrcClockDomain
from m5.objects.VoltageDomain import VoltageDomain
from m5.objects.Device import \
BasicPioDevic... | {
"content_hash": "8f4c4843a92d53954f276c13cd52d7ba",
"timestamp": "",
"source": "github",
"line_count": 1415,
"max_line_length": 85,
"avg_line_length": 37.78798586572438,
"alnum_prop": 0.6293248550589116,
"repo_name": "gem5/gem5",
"id": "6645b39b69d7c81976cf7c06e628305df2506c0a",
"size": "55638",
... |
from steem import Steem
from py2neo import Graph, Node, Relationship
import json
import time
import sys
sys.path.append('../steem_graph')
from steem_graph import graph as gdb
from steem_graph import database as db
database_name = "steemit-local.db"
# build my following graph
gdb.build_following_graph("marnee")
# get... | {
"content_hash": "fead210d33d123ccd2be68465cd8b9cb",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 54,
"avg_line_length": 27,
"alnum_prop": 0.7474747474747475,
"repo_name": "mandelbrotmesh/steem-graph",
"id": "26ff6d2579e8433230348df87ba2efb5974ee23a",
"size": "594",
"... |
import appdirs
import os
def application_data_directory():
# Parameters are 'App Name' and 'App Author'
# TODO: Get these values from the same place as setup.py
return appdirs.user_data_dir("Ice", "Scott Rice")
def data_file_path(filename):
return os.path.join(application_data_directory(), filename)
def arch... | {
"content_hash": "97aae0c23b944aee660001d758f38fb2",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 61,
"avg_line_length": 27.31578947368421,
"alnum_prop": 0.720616570327553,
"repo_name": "scottrice/Ice",
"id": "c4df847f0cb852213b931d324e203d57bc89bf9d",
"size": "538",
... |
from django.test import TestCase
from accelerator.tests.utils import login_as_new_user, login_as_user
from accelerator_abstract.models.base_startup_role import (
BaseStartupRole
)
from accelerator_abstract.models.base_user_role import (
BaseUserRole
)
from accelerator.tests.contexts import (
StartupTeamMem... | {
"content_hash": "f3d93d716bc6b09f7e89b3c824c3fd02",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 73,
"avg_line_length": 38.16279069767442,
"alnum_prop": 0.7041438147471054,
"repo_name": "masschallenge/django-accelerator",
"id": "4f3270ef361c4efe1dc010761431408e373cf919",... |
from __future__ import unicode_literals
import codecs
import os
try:
import docutils.core
import docutils.io
has_docutils = True
except ImportError:
has_docutils = False
from nikola.plugin_categories import PageCompiler
class CompileRest(PageCompiler):
"""Compile reSt into HTML."""
name = "... | {
"content_hash": "75da1d11c9da6fc135793d1f04145704",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 136,
"avg_line_length": 39.85470085470085,
"alnum_prop": 0.5891057259275144,
"repo_name": "damianavila/nikola",
"id": "a4ce73cced5c8e2807d175b9d70e2046f94a21f1",
"size": "... |
"""Add urls to asana, with title suggestions!"""
import logging
import os
import urlparse
import asana
from flask import Flask, request, session, redirect, render_template_string, render_template, jsonify, url_for
import flask_wtf
from wtforms import SelectField, SubmitField, StringField, BooleanField
from wtforms.val... | {
"content_hash": "eaabacddb3ec39077b25472b7999cbae",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 116,
"avg_line_length": 33.25668449197861,
"alnum_prop": 0.613603473227207,
"repo_name": "mjperrone/asana-media",
"id": "34c7400225c35e08e7ee3ffec372f30b62cf2171",
"size":... |
"""Support for binary sensor using RPi GPIO."""
from __future__ import annotations
import asyncio
import voluptuous as vol
from homeassistant.components import rpi_gpio
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import DEVICE_DEFAULT_NAME
from home... | {
"content_hash": "0e3f3b824e397c14d0073b246cc15dac",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 86,
"avg_line_length": 31.201834862385322,
"alnum_prop": 0.6721552484563363,
"repo_name": "rohitranjan1991/home-assistant",
"id": "e183b463e45f1ecc4917d4fcbae3838110a953a3",... |
__version__ = '0.4.1'
import sys
import shlex
import os
from os import path
from docutils import nodes
from docutils.parsers import rst
from docutils.parsers.rst.directives import flag, unchanged
from sphinx import addnodes
from sphinx.util.osutil import ensuredir
from sphinx.ext.graphviz import graphviz as graphviz... | {
"content_hash": "eb4ce8b31e0e5ce2fd51ec23ede8f336",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 113,
"avg_line_length": 32.879746835443036,
"alnum_prop": 0.5645813282001925,
"repo_name": "stonier/ecto",
"id": "bc8390c6dc868cc955dac2bc6541666036d6a2af",
"size": "6641"... |
"""
Unit Tests for cinder.scheduler.rpcapi
"""
import copy
import mock
from oslo_config import cfg
from cinder import context
from cinder.scheduler import rpcapi as scheduler_rpcapi
from cinder import test
CONF = cfg.CONF
class SchedulerRpcAPITestCase(test.TestCase):
def setUp(self):
super(Scheduler... | {
"content_hash": "b57f6b3d3ecc26806151256a1da373b2",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 77,
"avg_line_length": 41.50967741935484,
"alnum_prop": 0.47342244327012745,
"repo_name": "scality/cinder",
"id": "60c935f195a79e04bf6c8fca78fa7a946efe9d62",
"size": "7042... |
import io
import glob
import sys
import os
import re
import json
import shutil
import colorama
import jinja2
dumb_replacements = [
["{% if any(post.is_mathjax for post in posts) %}", '{% if posts|selectattr("is_mathjax")|list %}'],
["json.dumps(title)", "title|tojson"],
["{{ parent.extra_head() }}", "{{ s... | {
"content_hash": "375e5be4cc535a454456c34e66a1fccd",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 104,
"avg_line_length": 35.943231441048034,
"alnum_prop": 0.5497509415623861,
"repo_name": "jjconti/nikola",
"id": "abd18e91b191dccb2f53c06aa5db32603e538842",
"size": "825... |
from __future__ import absolute_import
from __future__ import unicode_literals
from builtins import next
from builtins import map
from builtins import str
from builtins import object
import os, re, rdflib, zipfile, tempfile, codecs, chardet, unicodedata, iso8601
import shutil, copy, logging
import xml.etree.ElementTr... | {
"content_hash": "5b6ffdc93f788c73501fc386d92f775e",
"timestamp": "",
"source": "github",
"line_count": 555,
"max_line_length": 109,
"avg_line_length": 33.531531531531535,
"alnum_prop": 0.5576571735626008,
"repo_name": "upconsulting/IsisCB",
"id": "306fb039603b55224cb8b16eb171de2ab7fcbb30",
"size":... |
from logging import getLogger
logger = getLogger(__name__)
import time
import collections
from django.db import models
from django.db.models import query
from django.db.models.fields.related import ReverseSingleRelatedObjectDescriptor
class PrefetchManagerMixin(models.Manager):
use_for_related_fields = True
... | {
"content_hash": "ebaa9b8f5ddfc1185527a3e84c73d277",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 186,
"avg_line_length": 38.10943396226415,
"alnum_prop": 0.5896623428062184,
"repo_name": "festicket/django-prefetch",
"id": "197f1dae8f1ef3e8153224e483ba4279cfeb32f2",
"s... |
from parlai.utils.testing import AutoTeacherTest
class TestDefaultTeacher(AutoTeacherTest):
task = "funpedia"
class TestFunpediaTeacher(AutoTeacherTest):
task = "funpedia:funpedia"
class TestNopersonaTeacher(AutoTeacherTest):
task = "funpedia:nopersona"
class TestLmTeacher(AutoTeacherTest):
task... | {
"content_hash": "c762e9b667de493caddb17269373ff2e",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 49,
"avg_line_length": 19.8,
"alnum_prop": 0.7717171717171717,
"repo_name": "facebookresearch/ParlAI",
"id": "7026f049b77beb6a83e4ebc68ee454449574fc3f",
"size": "695",
"b... |
import os
import time
import threading
from datetime import datetime
from RandomIO import RandomIO
from .exc import DownstreamError
class DownstreamContract(object):
def __init__(self,
client,
hash,
seed,
size,
challenge,
... | {
"content_hash": "d3c51f2c73bb54976f08848d33fa0a28",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 82,
"avg_line_length": 30.441176470588236,
"alnum_prop": 0.5233494363929146,
"repo_name": "Storj/downstream-farmer",
"id": "91ca9175e572f25cd3969d55cf2c350f3bb6a624",
"siz... |
import collections
class OrderedSet(collections.MutableSet):
# Extract from:
# - https://docs.python.org/3/library/collections.abc.html?highlight=orderedset
# - https://code.activestate.com/recipes/576694/
def __init__(self, iterable=None):
self.end = end = []
end += [None, end... | {
"content_hash": "1a530b4ca42b4c6bf991e461b7d6665b",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 87,
"avg_line_length": 29.241935483870968,
"alnum_prop": 0.5041367898510756,
"repo_name": "mattcongy/itshop",
"id": "c5ca3c59a2beff969a1b52578ba259a177d6c40c",
"size": "274... |
"""
Handler for reading Kicad libraries and generating netlists.
"""
from __future__ import ( # isort:skip
absolute_import,
division,
print_function,
unicode_literals,
)
import os.path
import re
import time
from builtins import dict, int, range, str, zip
from collections import namedtuple
from futur... | {
"content_hash": "7a1f898383d653db069b244fdd6cef98",
"timestamp": "",
"source": "github",
"line_count": 1680,
"max_line_length": 115,
"avg_line_length": 36.17619047619048,
"alnum_prop": 0.4993912070554166,
"repo_name": "xesscorp/skidl",
"id": "040d79347a891a56d5c5a188798f73459e5edac7",
"size": "608... |
from apps.invite_remixer.urls import reverse_invite_id
from canvas.metrics import Metrics
from canvas.util import Base36DecodeException
class TrackInviteMiddleware(object):
def process_request(self, request):
invite_id = request.GET.get('invite')
if not invite_id:
return
try:
... | {
"content_hash": "e4897c0b2048d7eb34ae46eddeb099ff",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 118,
"avg_line_length": 30.55,
"alnum_prop": 0.6759410801963993,
"repo_name": "drawquest/drawquest-web",
"id": "9b21129e845bee9d8f63ad2bed9ff893929d8730",
"size": "611",
... |
from setuptools import setup, find_packages
import sys, os
here = os.path.abspath(os.path.dirname(__file__))
try:
README = open(os.path.join(here, 'README.rst')).read()
except IOError:
README = ''
version = "0.0.1"
setup(
name='tgext.pylogservice',
version=version,
description="",
long_descri... | {
"content_hash": "8530c4326404b16aa7ccb2200dbc0e76",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 94,
"avg_line_length": 24.12121212121212,
"alnum_prop": 0.621859296482412,
"repo_name": "tongpa/tgext.pylogservice",
"id": "a7b4a4acdae87c18e37d1565f1dbbe13da1186d6",
"size... |
"""
MAP Client, a program to generate detailed musculoskeletal models for OpenSim.
Copyright (C) 2012 University of Auckland
This file is part of MAP Client. (http://launchpad.net/mapclient)
MAP Client is free software: you can redistribute it and/or modify
it under the terms of the GNU General Publi... | {
"content_hash": "004ac5333338b498b0a46a7e83f4bfce",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 78,
"avg_line_length": 45.08695652173913,
"alnum_prop": 0.7540983606557377,
"repo_name": "MusculoskeletalAtlasProject/mapclient-tests",
"id": "bb2111507804babe1049dd7bad0184f... |
from future import standard_library # noqa
standard_library.install_aliases() # noqa
import inspect
import json
import time
import markdown
import re
import zipfile
import os
import io
from builtins import str
from pygments import highlight, lexers
from pygments.formatters import HtmlFormatter
from flask import re... | {
"content_hash": "feb8d370f256adcce9f651ddbc67962a",
"timestamp": "",
"source": "github",
"line_count": 424,
"max_line_length": 97,
"avg_line_length": 33.8938679245283,
"alnum_prop": 0.6004453413123652,
"repo_name": "r39132/airflow",
"id": "e097499e38c07b3761e409613b0fb1bae3b57e55",
"size": "15183"... |
import unittest
from panda import Panda
from panda.tests.safety import libpandasafety_py
import panda.tests.safety.common as common
from panda.tests.safety.common import CANPackerPanda
from panda.tests.safety.hyundai_common import HyundaiButtonBase, HyundaiLongitudinalBase
# 4 bit checkusm used in some hyundai messag... | {
"content_hash": "ba1c598ab7f6cdc31b351153b697e85f",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 130,
"avg_line_length": 35.60891089108911,
"alnum_prop": 0.6593910746559155,
"repo_name": "commaai/panda",
"id": "6c35e874d8521e4f78a137b9de158f9395cb0727",
"size": "7216"... |
"""The tests for the MQTT subscription component."""
from unittest import mock
from homeassistant.components.mqtt.subscription import (
async_subscribe_topics,
async_unsubscribe_topics,
)
from homeassistant.core import callback
from tests.common import async_fire_mqtt_message, async_mock_mqtt_component
asyn... | {
"content_hash": "f966a5830411b2f1f039fbc5c6affc6c",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 83,
"avg_line_length": 27.856382978723403,
"alnum_prop": 0.5982432690471644,
"repo_name": "Teagan42/home-assistant",
"id": "6c906cda1d1dee7efd636fa77e0231cdc3501bad",
"siz... |
from pocket_change.auth import PocketChangeUser
from flask import g
@PocketChangeUser.authenticator
def jira_auth(user):
if g.jira.verify_credentials(user.name, user.password):
# If the user already exists in the database,
# update their password to match what authenticated
# in Jira ... | {
"content_hash": "d31cddbf4cfa425a6042713ea89facd3",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 59,
"avg_line_length": 34.1764705882353,
"alnum_prop": 0.6712564543889845,
"repo_name": "psusloparov/sneeze",
"id": "4f4a216ebd3f098eedc07d20693e904d097ec0f3",
"size": "581... |
from django.conf.urls.defaults import patterns, url
from django.views.generic import DetailView, ListView
from gamesquad.models import Game, Squad
urlpatterns = patterns('',
(r'^games/$',
ListView.as_view(
model=Game,
context_object_name='gamelist',
template_name='gamesq... | {
"content_hash": "d1f17de998b64fcf2bbd00d308eb3d16",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 58,
"avg_line_length": 33.333333333333336,
"alnum_prop": 0.57875,
"repo_name": "jokey2k/ShockGsite",
"id": "1e62c94ab2b209de216579d3f047dbc119830a38",
"size": "800",
"bin... |
""" EvoNorm in PyTorch
Based on `Evolving Normalization-Activation Layers` - https://arxiv.org/abs/2004.02967
@inproceedings{NEURIPS2020,
author = {Liu, Hanxiao and Brock, Andy and Simonyan, Karen and Le, Quoc},
booktitle = {Advances in Neural Information Processing Systems},
editor = {H. Larochelle and M. Ranzato ... | {
"content_hash": "e668e6d12127bd73fb3c560849541b7b",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 114,
"avg_line_length": 39.38068181818182,
"alnum_prop": 0.5784879526763814,
"repo_name": "rwightman/pytorch-image-models",
"id": "ea77620712c80a54d943ef0b920556cbafc1f9f6",... |
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import click
from .cli import cli
from ava.runtime import settings
@cli.command()
@click.argument("app")
def launch(app):
""" Launch web application.
"""
click.launch('http://127.0.0.1:%s' % setti... | {
"content_hash": "593e010c8bf03a63e7ca1fd00e23e2c3",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 77,
"avg_line_length": 25.071428571428573,
"alnum_prop": 0.6467236467236467,
"repo_name": "eavatar/ava",
"id": "c283f13fac5355084eb3f399e4f467a631d1bd51",
"size": "375",
... |
def main(j, args, params, tags, tasklet):
params.merge(args)
doc = params.doc
macrostr = params.macrostr
macrostr = macrostr.split('\n')
if j.portal.server.active.isLoggedInFromCTX(params.requestContext):
loginorlogout = "Logout: /system/login?user_logoff_=1"
else:
loginorlogou... | {
"content_hash": "be14a91e62edbdde07e76b8c4eef9594",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 71,
"avg_line_length": 23.666666666666668,
"alnum_prop": 0.6619718309859155,
"repo_name": "Jumpscale/jumpscale_portal8",
"id": "4032d24adac9d575fde425c5aa66fbb123005569",
"... |
import logging
from collections import defaultdict
from billy.core import db, settings
logger = logging.getLogger('billy')
def _speech_report_dict():
return {
'unmatched_speakers': set(),
"_speakers_with_id_count": 0
}
def scan_speeches(abbr):
sessions = defaultdict(_speech_report_dict... | {
"content_hash": "924fdde2f3b2693038f0dd98024f82a3",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 65,
"avg_line_length": 25.18918918918919,
"alnum_prop": 0.6233905579399142,
"repo_name": "mileswwatkins/billy",
"id": "52fefbd39a850714d8c3f1ea140de3e20d98e514",
"size": "9... |
"""Test urls for the ``cmsplugin_redirect`` app."""
from django.conf import settings
from django.conf.urls.defaults import include, patterns, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('cms.urls')),
)
... | {
"content_hash": "b2a20f0f3ccbab42f21b22caec2b5379",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 130,
"avg_line_length": 28.72222222222222,
"alnum_prop": 0.6499032882011605,
"repo_name": "bitmazk/cmsplugin-redirect",
"id": "b9ef890cb34f7afa4f90075aacf7d1f439478992",
"s... |
import warnings
from cloudkitty.rating.hash.controllers import * # noqa
def deprecated():
warnings.warn(
('The hashmap billing controllers are deprecated. '
'Please use rating\'s one instead.'),
DeprecationWarning,
stacklevel=3)
deprecated()
| {
"content_hash": "235a158dc8529f7ac4f40be0b4b2f136",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 59,
"avg_line_length": 20.357142857142858,
"alnum_prop": 0.6666666666666666,
"repo_name": "muraliselva10/cloudkitty",
"id": "ea8c2df372964100d975bfa59a1efc5b16e83357",
"siz... |
from abc import ABCMeta, abstractmethod
class EventProcessor(metaclass=ABCMeta):
@abstractmethod
def can_process(self, event):
pass
@abstractmethod
def process(self, event, rg):
pass
| {
"content_hash": "a6a0e0bff13fe11afa57af717aff1594",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 40,
"avg_line_length": 19.818181818181817,
"alnum_prop": 0.6788990825688074,
"repo_name": "kagemiku/gpbot-line",
"id": "508048514c7789c3c938fdc5dff6ba51e5fc8264",
"size": "... |
"""Constants for iss."""
DOMAIN = "iss"
| {
"content_hash": "e66256ddc39fad0d8132a793aba1b779",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 24,
"avg_line_length": 13.666666666666666,
"alnum_prop": 0.5853658536585366,
"repo_name": "w1ll1am23/home-assistant",
"id": "3d240041b67f836ecf13a4da8debc49329f03713",
"size... |
"""
:codeauthor: Anthony Shaw <anthonyshaw@apache.org>
"""
import salt.states.net_napalm_yang as netyang
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase
TEST_DATA = {"foo": "bar"}
class NetyangTestCase(TestCase, Loade... | {
"content_hash": "27d04042af5c41a6061711aac0585b19",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 88,
"avg_line_length": 39.45614035087719,
"alnum_prop": 0.5393508225878169,
"repo_name": "saltstack/salt",
"id": "5179ae9266825496ef728fb8c26cc9d3c4793727",
"size": "2249",... |
{
'': '',
'!=': '!=',
'!langcode!': 'zh-cn',
'!langname!': '中文',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"更新" 是選擇性的條件式, 格式就像 "欄位1=\'值\'". 但是 JOIN 的資料不可以使用 update 或是 delete"',
'%(nrows)s records found': '%(nrows)s records found',
'%s %%{row} de... | {
"content_hash": "56e5af54c37d683b06cf85eba3574ad4",
"timestamp": "",
"source": "github",
"line_count": 321,
"max_line_length": 219,
"avg_line_length": 36.39563862928349,
"alnum_prop": 0.6666951981511599,
"repo_name": "lucadealfaro/crowdranker",
"id": "aa0446ee4a5d3239109555323998f0a62772e7bb",
"si... |
from __future__ import absolute_import, print_function
from django.db import models
from django.utils import timezone
from sentry.db.models import (
BoundedPositiveIntegerField, Model, sane_repr
)
class Repository(Model):
__core__ = True
organization_id = BoundedPositiveIntegerField(db_index=True)
... | {
"content_hash": "3aa939942d799d0afe47d2b9a2b8c215",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 64,
"avg_line_length": 26.73913043478261,
"alnum_prop": 0.6910569105691057,
"repo_name": "alexm92/sentry",
"id": "06dd0efe38f39e3a883669892af8f9ccbfaf8fa5",
"size": "615",
... |
import sys
import os.path
import glob
import datetime
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import numpy
'''
Draws a graph of the output from "lake_measure.py"
To use, pass in the output file from that tool.
'''
def parse_lake_results(name):
f = open(name, 'r')
x_axis ... | {
"content_hash": "983bebc6a2363d5660be612416687626",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 145,
"avg_line_length": 33.88356164383562,
"alnum_prop": 0.5627653123104912,
"repo_name": "asurunis/CrisisMappingToolkit",
"id": "ed030e1238dc3a210986a325b601599c07c6a779",
... |
import unittest
from mock import MagicMock
from hazelcast.proxy.cp.atomic_reference import AtomicReference
class AtomicReferenceInvalidInputTest(unittest.TestCase):
def setUp(self):
self.atomic_ref = AtomicReference(MagicMock(), None, None, None, None)
def test_alter(self):
self._check_erro... | {
"content_hash": "08c0b6d9b659dc5af17121934b2d6750",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 78,
"avg_line_length": 27.892857142857142,
"alnum_prop": 0.6619718309859155,
"repo_name": "hazelcast/hazelcast-python-client",
"id": "36d0ad00a15d36971aaccd99dfd80b84be6b5e11... |
import urllib
from types import *
def iscontenttype(URLorFile,contentType='text'):
"""
Return true or false (1 or 0) based on HTTP Content-Type.
Accepts either a url (string) or a "urllib.urlopen" file.
Defaults to 'text' type.
Only looks at start of content-type, so you can be as vague or prec... | {
"content_hash": "2893a5f789ed44404dac2d714a003fe7",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 74,
"avg_line_length": 29.379310344827587,
"alnum_prop": 0.5927230046948356,
"repo_name": "ActiveState/code",
"id": "e63053a38552ce7213e1cd3f5875e69967522d04",
"size": "852... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.