text stringlengths 4 1.02M | meta dict |
|---|---|
from xkcdpass import xkcd_password as xp
import base64
import hashlib
from Crypto import Random
from Crypto.Hash import SHA256
from Crypto.Cipher import AES
import models
def generatePassword():
# create a wordlist from the default wordfile
# use words between 5 and 8 letters long
wordfile = xp.locate_wor... | {
"content_hash": "9430b4c243019a87cf670ee8efd77cce",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 111,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.6330308529945553,
"repo_name": "Payamg690/txtcensoring",
"id": "ccb69ad1ee62ae7356bac8ad5322f6107be71f7f",
"size... |
import re
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
from zinnia.sitemaps import TagSitemap, AuthorSitemap, CategorySitemap, EntrySitemap
from simplecms.sitemap import PageSitemap
sitemaps = {
'tags': TagSitemap(),
... | {
"content_hash": "fe63cbdfd6ee3d7f12e48b1495c91ddf",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 84,
"avg_line_length": 28.333333333333332,
"alnum_prop": 0.6408304498269897,
"repo_name": "starshipfactory/sfblog",
"id": "de1ac361b4a88b9bdd8193d6aacf6d8a56f74457",
"size"... |
import wpilib
class ButtonDebouncer:
'''Useful utility class for debouncing buttons'''
def __init__(self, joystick, buttonnum, period=0.5):
'''
:param joystick: Joystick object
:type joystick: :class:`wpilib.Joystick`
:param buttonnum: Number of button to retrieve
... | {
"content_hash": "c9c3119da8ab02220780ad7a4c2a4b03",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 88,
"avg_line_length": 37,
"alnum_prop": 0.5975975975975976,
"repo_name": "Twinters007/robotpy-wpilib-utilities",
"id": "d6fe60d5f513d8d50f277c311124d0e7921737f3",
"size": ... |
import datetime
from jinja2 import Template
import bot_logger
import lang
import models
def history_user(msg):
user = models.User(msg.author.name)
if user.is_registered():
# get user history
data_raw = user.get_history()
# keep only 30 last entry
data = data_raw[-30:]
... | {
"content_hash": "a4a4afc5ab39bf9df9ed4cee585b03a1",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 120,
"avg_line_length": 33.83673469387755,
"alnum_prop": 0.5723763570566948,
"repo_name": "just-an-dev/sodogetip",
"id": "f2833be19e30bc109d42289b4208d80dfc6efa85",
"size":... |
import pytest
from pytest_bdd import scenarios
pytestmark = [
pytest.mark.bdd,
pytest.mark.usefixtures('workbook'),
]
scenarios(
'antibodies.feature',
'biosamples.feature',
'experiments.feature',
'search.feature',
'targets.feature',
)
| {
"content_hash": "922b3263c8bfafb1bba64158c86dc297",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 40,
"avg_line_length": 17.666666666666668,
"alnum_prop": 0.6792452830188679,
"repo_name": "T2DREAM/t2dream-portal",
"id": "47386035125d75324fb2b5c48415b257897d3047",
"size"... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.append(os.path.abspath('.'))
# -- General configuration... | {
"content_hash": "8e3ee1af92cd695f7e96c07a21a77ed4",
"timestamp": "",
"source": "github",
"line_count": 185,
"max_line_length": 80,
"avg_line_length": 32.810810810810814,
"alnum_prop": 0.7095551894563427,
"repo_name": "gregplaysguitar/glamkit",
"id": "379ddbd4afb15fedde7513cce923324b612bc8a8",
"siz... |
def process(extractor, transformer, loader):
"""
Extract-Transform-Load process
:param extractor: partial extractor function
:param transformer: partial transformer function
:param loader: partial loader function
"""
submissions_generator = extractor()
events_generator = transform... | {
"content_hash": "8e36500808cf777f25978da1be3d009d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 57,
"avg_line_length": 28.923076923076923,
"alnum_prop": 0.7207446808510638,
"repo_name": "CloverHealth/pycon2017",
"id": "2724800f363fc3a792bb629c1f34ed2eec472eb8",
"size"... |
import re
from SCons.Script import * # the usual scons stuff you get in a SConscript
import collections
def generate(env):
"""
Add builders and construction variables for the
SubstInFile tool.
Adds SubstInFile builder, which substitutes the keys->values of SUBST_DICT
from the source to the target... | {
"content_hash": "e0652c077f7afbfe7e0c9ebf14384c87",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 113,
"avg_line_length": 41.1625,
"alnum_prop": 0.5924688733677498,
"repo_name": "fanqiang001/HMI_SDK_LIB",
"id": "5d235e7ee209d02f12847bf4472601db86a59c2b",
"size": "3511",... |
import argparse
import os
from sklearn.model_selection import GridSearchCV
from sklearn.linear_model import Ridge
from sklearn.kernel_ridge import KernelRidge
from sklearn.preprocessing import PolynomialFeatures
from sklearn.pipeline import Pipeline
from sklearn.metrics.pairwise import polynomial_kernel
import numpy ... | {
"content_hash": "b2686892229580b6b52a92dbfa330154",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 98,
"avg_line_length": 37.161764705882355,
"alnum_prop": 0.6588840522358528,
"repo_name": "jhartford/DeepIV",
"id": "7da3813f33e32985776460be5c4205b853cf0d7a",
"size": "252... |
import numpy as np
import healpy as hp
import time
import emcee
from astropy.io import fits
from chainconsumer import ChainConsumer
# To make plots
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
from matplotlib import rc
rc('text', usetex=True)
rc('font', family='serif')
#import matplotlib
#matplotlib.... | {
"content_hash": "c38bda9b3c8016f7705c6129076d811f",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 46,
"avg_line_length": 23.666666666666668,
"alnum_prop": 0.7887323943661971,
"repo_name": "edgarmsalazar/systematics",
"id": "7f9c1c7133ec391c50ef173f668e6d12d5f1b5b9",
"si... |
from __future__ import unicode_literals
import django
# Django REST Surveys specific settings:
REST_SURVEYS = {
#'SURVEY_AUTHENTICATION_CLASSES': (SessionAuthentication,),
#'SURVEY_PERMISSION_CLASSES': (IsAuthenticated,),
#'SURVEY_RESPONSE_AUTHENTICATION_CLASSES': (SessionAuthentication,),
#'SURVEY_RES... | {
"content_hash": "b846d20306f283f6588a96f95a744676",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 73,
"avg_line_length": 32.83783783783784,
"alnum_prop": 0.6296296296296297,
"repo_name": "danxshap/django-rest-surveys",
"id": "3d19557b5d39e4e1e30e71ea1900b15c1c0da119",
"... |
from ._singleton import Singleton
from ._decorators import not_implemented
class ObjectView:
def __init__(self, dictionary: dict):
self.__dict__ = dictionary
| {
"content_hash": "108d8060251aba0795b61013739fb8cc",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 41,
"avg_line_length": 24.571428571428573,
"alnum_prop": 0.6976744186046512,
"repo_name": "DavidBarishev/ClashOfClansBot",
"id": "901932901ba6f7f4bc5410c7a30a53ea2ded9e9b",
... |
"""Package tests."""
#
# (C) Pywikibot team, 2007-2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, print_function, unicode_literals
__version__ = '$Id$'
import functools
import os
import warnings
__all__ = ('requests', 'TestRequest',
'patch_request', 'unpa... | {
"content_hash": "e227aaf50afa437154409ace8f879887",
"timestamp": "",
"source": "github",
"line_count": 338,
"max_line_length": 79,
"avg_line_length": 27.819526627218934,
"alnum_prop": 0.6209720302031266,
"repo_name": "darthbhyrava/pywikibot-local",
"id": "c7a66bf997ce31daab8e7ced49522584a3626aa1",
... |
"""
Script that extracts all the messages from the Indexdeadletter queue and
starts Index.IdWriters for the messages with operation == 'write_id_index'.
For Index.IdWriters that successfully start, the corresponding message is
deleted from the queue.
"""
import argparse
import botocore
import boto3
import json
import... | {
"content_hash": "0e05afc937c96c6dd9d06b72420f4d54",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 117,
"avg_line_length": 34.916666666666664,
"alnum_prop": 0.6073985680190931,
"repo_name": "jhuapl-boss/boss-manage",
"id": "7c7a779b393425384f4fbb953ef7eb84f652f003",
"si... |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.test.utils import override_settings
from temba_client.types import Group as TembaGroup
from tracpro.test import factories
from tracpro.test.cases import TracProDataTest, TracProTest
from .. import models
@override_sett... | {
"content_hash": "4f58e2bdaa8a0d12770fd445007a64a0",
"timestamp": "",
"source": "github",
"line_count": 347,
"max_line_length": 87,
"avg_line_length": 40.487031700288185,
"alnum_prop": 0.6362018649014165,
"repo_name": "xkmato/tracpro",
"id": "7f95abbb006004483b65942be87dc2596bbf5f0d",
"size": "1404... |
__all__ = ['cimpl','kafkatest']
from .cimpl import *
| {
"content_hash": "735d38fbf5aaff7b7cfd5dac0253afc0",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 31,
"avg_line_length": 26.5,
"alnum_prop": 0.6037735849056604,
"repo_name": "blindroot/confluent-kafka-python",
"id": "d998bec72704b84774c9db18d723b709ef52218e",
"size": "53... |
"""This example gets the changes in the account during the last 24 hours.
Tags: CustomerSyncService.get
"""
__author__ = 'api.kwinter@gmail.com (Kevin Winter)'
import datetime
import os
import sys
sys.path.insert(0, os.path.join('..', '..', '..', '..', '..'))
# Import appropriate classes from the client library.
fr... | {
"content_hash": "03e69230a4f9d756655cf75aae8d51a9",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 79,
"avg_line_length": 37.84090909090909,
"alnum_prop": 0.5960960960960962,
"repo_name": "nearlyfreeapps/python-googleadwords",
"id": "9a55e9cd1dabc894be78e23a9122fc78d69d9e0... |
from person_group_active_records import PersonGroupActiveRecords
from person_active_records import PersonActiveRecords
from person_faces_active_records import PersonFacesActiveRecords
__all__ = [
"person_faces_active_records",
"person_group_active_records",
"person_active_records"
]
| {
"content_hash": "da626899bef241275ee330335ddddd51",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 64,
"avg_line_length": 29.8,
"alnum_prop": 0.785234899328859,
"repo_name": "anhhoangiot/people_recognition_pi",
"id": "8e76fa44f28b4eab457c0c41f8a9e9bd3b8f5665",
"size": "4... |
from msrest.paging import Paged
class MediaServicePaged(Paged):
"""
A paging container for iterating over a list of :class:`MediaService <azure.mgmt.media.models.MediaService>` object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'valu... | {
"content_hash": "e1ed8ffae3895198189a625acc2eafc9",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 119,
"avg_line_length": 29,
"alnum_prop": 0.6077586206896551,
"repo_name": "lmazuel/azure-sdk-for-python",
"id": "a579089d3c962c35a34bf7e2bb824eecbb1541c0",
"size": "938",
... |
"""
"""
# Import python libs
import logging
# Import third party libs
from django.db import models
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.db.models.signals import pre_save, post_save
f... | {
"content_hash": "3171c1e5ac572bcc6e1c0170361d520b",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 95,
"avg_line_length": 31.066666666666666,
"alnum_prop": 0.6781115879828327,
"repo_name": "rangertaha/django-actions",
"id": "b7b2425d78f03435f55c25e81273cec72cd3d554",
"s... |
"""
This module contains the TreeGrower class.
TreeGrower builds a regression tree fitting a Newton-Raphson step, based on
the gradients and hessians of the training data.
"""
# Author: Nicolas Hug
from heapq import heappush, heappop
import numpy as np
from timeit import default_timer as time
import numbers
from .sp... | {
"content_hash": "02450b1c6cbf46d1c00b57d668b81df2",
"timestamp": "",
"source": "github",
"line_count": 709,
"max_line_length": 88,
"avg_line_length": 38.57263751763047,
"alnum_prop": 0.6075764224074887,
"repo_name": "huzq/scikit-learn",
"id": "1733b5745f8a2a6609e7899f706ebe50070327e4",
"size": "27... |
"""SCM-specific utility classes."""
import cStringIO
import glob
import logging
import os
import re
import sys
import tempfile
import time
from xml.etree import ElementTree
import gclient_utils
import subprocess2
def ValidateEmail(email):
return (re.match(r"^[a-zA-Z0-9._%-+]+@[a-zA-Z0-9._%-]+.[a-zA-Z]{2,6}$", ema... | {
"content_hash": "56f8bd4e294d021d91ff8b01f67d6a72",
"timestamp": "",
"source": "github",
"line_count": 1165,
"max_line_length": 80,
"avg_line_length": 35.906437768240345,
"alnum_prop": 0.6009418852047524,
"repo_name": "HackFisher/depot_tools",
"id": "9bc96bc8055832707a749d3b9d256766b5a43956",
"siz... |
import wx
from styles import *
from helpers import Dyer, Face, Hand, HandSet, TickSet, Box
from setup import Setup
#----------------------------------------------------------------------
class AnalogClock(wx.PyWindow):
"""An analog clock."""
def __init__(self, parent, id=wx.ID_ANY, pos=wx.Defau... | {
"content_hash": "b438b76042e61bd7d44f4d08e4f066e0",
"timestamp": "",
"source": "github",
"line_count": 626,
"max_line_length": 79,
"avg_line_length": 28.72523961661342,
"alnum_prop": 0.5526637748859972,
"repo_name": "ktan2020/legacy-automation",
"id": "0403090f3103d5f2ac457c649a909a5c29943926",
"s... |
"""A test library providing dialogs for interacting with users.
``Dialogs`` is Robot Framework's standard library that provides means
for pausing the test execution and getting input from users. The
dialogs are slightly different depending on whether tests are run on
Python, IronPython or Jython but they provide the s... | {
"content_hash": "19f9c45346ecf029933175481d9eb947",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 113,
"avg_line_length": 39.452991452991455,
"alnum_prop": 0.7081889081455806,
"repo_name": "HelioGuilherme66/RIDE",
"id": "fedf1cd170c3624cf0e6d9282332a28c080e23dc",
"size... |
from contextlib import ExitStack
from ..errors import *
from .state import State
from .core import Context, Object, BoundObject, Type
from .function import FunctionType
from .forward import ForwardTarget
class Call(Object):
called = None
values = None
return_type = None
function = None
function_t... | {
"content_hash": "a3ecdeb723b707f5f7a35b323c021d65",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 113,
"avg_line_length": 32.359375,
"alnum_prop": 0.607436021245775,
"repo_name": "pektin/jam",
"id": "220e32e7e32a077b2f522373b9eca948e0226b59",
"size": "2071",
"binary":... |
from abc import ABCMeta, abstractmethod, abstractproperty
class IAdapter(object):
__metaclass__ = ABCMeta
@abstractmethod
def authenticate(self, access_token):
"""
:type access_token: C{str}
:rtype: L{Deferred} of L{pyligaforex.services.auth.platforms.interfaces.IProfile}
... | {
"content_hash": "fdc82c13a264af2241b19311ad735b8d",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 100,
"avg_line_length": 20.75,
"alnum_prop": 0.5485943775100401,
"repo_name": "cordis/pycloudia-chat",
"id": "b98471a116369346fe06e4f88a679403d5e130fa",
"size": "1245",
"... |
import matplotlib.pyplot as plt
import random as rand
class alien:
state = 0 #Unhatched
lifetime = 0
sex = 0
def __init__(self):
self.sex= rand.randint(0,1)
return
days = 30
num_eggs = 3
hatch_time = 5
num_landed = 2
day_ticker = [1]
alien_ticker = [1]
aliens... | {
"content_hash": "e0b8ed49b380b313da92d17ff4065e4d",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 108,
"avg_line_length": 25.41176470588235,
"alnum_prop": 0.5594135802469136,
"repo_name": "Samathy/AlienInvasion",
"id": "2578ef4f647c4405684eb830a0a1154c0c1aaf3f",
"size":... |
from __future__ import print_function
import email.parser
import logging
import json
import math
import os
import pickle
import sys
import traceback
import unittest
from contextlib import closing, contextmanager
from gzip import GzipFile
from shutil import rmtree
import gc
import time
from textwrap import dedent
from h... | {
"content_hash": "4d4d7cce8fc940101241eb867465fa68",
"timestamp": "",
"source": "github",
"line_count": 9668,
"max_line_length": 79,
"avg_line_length": 44.485208936698385,
"alnum_prop": 0.5219690152830965,
"repo_name": "aerwin3/swift",
"id": "6e55e74fa2181d9b1e3bf2ecc80cda27947f91ed",
"size": "4307... |
import pytest
import numpy as np
from numpy.testing import assert_allclose
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Flatten
from keras.layers.embeddings import Embedding
from keras.constraints import unitnorm
from keras import backend as K
X1 = np.array([[1], [2]], dtype='i... | {
"content_hash": "f1e2e56771cc9ab9a6f7f980475a35ec",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 75,
"avg_line_length": 34.25806451612903,
"alnum_prop": 0.6431261770244822,
"repo_name": "daviddiazvico/keras",
"id": "ad8490c0c3e371f5f12c2cf2a91146edb52856f6",
"size": "1... |
"""Tests the Google Kubernetes Engine API client."""
import json
import unittest
import unittest.mock as mock
import google.auth
from google.oauth2 import credentials
from tests import unittest_utils
from tests.common.gcp_api.test_data import (
fake_container_responses as fake_container)
from tests.common.gcp_api... | {
"content_hash": "c3d3d9d126377bf6f6e4ac3c4995b68a",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 78,
"avg_line_length": 38.5,
"alnum_prop": 0.6621057513914657,
"repo_name": "forseti-security/forseti-security",
"id": "7fa99652711f609144105648009f22e83f3e3f39",
"size": ... |
"""Tests for the segmentation subpackage."""
# First party modules
import hwrt.segmentation as segmentation
import tests.testhelper as testhelper
def prepare_beams():
"""
Prepare one beam object for each recording.
Returns
-------
list
A list of beam objects
"""
beams = []
hw... | {
"content_hash": "c63d9dd4d54c2b5d377a12b8ce4f8fc5",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 65,
"avg_line_length": 23.86842105263158,
"alnum_prop": 0.6350606394707828,
"repo_name": "MartinThoma/hwrt",
"id": "d19f64f34c831c99cbde01d7357377aa967d8259",
"size": "930"... |
"""ALOT dataset handler.""" # NOTYPO
import functools
import os
import tarfile
from dm_nevis.datasets_storage.handlers import extraction_utils as utils
from dm_nevis.datasets_storage.handlers import splits
from dm_nevis.datasets_storage.handlers import types
from tensorflow.io import gfile
# pylint:disable=missin... | {
"content_hash": "05f06961186dcf79fc6f211974eb8d17",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 78,
"avg_line_length": 32.377049180327866,
"alnum_prop": 0.6855696202531646,
"repo_name": "deepmind/dm_nevis",
"id": "644665a8dc62f95db63e4d4d40353b016798f890",
"size": "25... |
from collections import defaultdict
def turnpike(distances):
distances = sorted(filter(lambda x: x > 0, distances))
def solve(distances, points):
if not distances:
return points
return solve_point(distances, points, distances[-1]) or solve_point(distances, points, points[-1] - di... | {
"content_hash": "932ff528c0df5cabae0725f5ba7c81ed",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 122,
"avg_line_length": 26.535714285714285,
"alnum_prop": 0.5356662180349933,
"repo_name": "cowboysmall/rosalind",
"id": "a0bcc2f299f5b46febc03577293b4e7e09028892",
"size":... |
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
from litex.gen import LiteXModule
from litex_boards.platforms import lattice_ice40up5k_evn
from litex.build.lattice.programmer import IceStormProgrammer
from litex.soc.cores.ram import Up5kSPRAM
from litex.soc.cores.clock import iCE40PLL
f... | {
"content_hash": "8752476fad644cca31e4eefa15bbaf22",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 139,
"avg_line_length": 39.770833333333336,
"alnum_prop": 0.5219137419242186,
"repo_name": "litex-hub/litex-boards",
"id": "752e74a053e850df8b27236d676792647ac94fb2",
"siz... |
import base_report
from openerp.report import report_sxw
class cdr(base_report.base_report):
def __init__(self, cr, uid, name, context):
super(cdr, self).__init__(cr, uid, name, context)
report_sxw.report_sxw('report.l10n.fr.compute_resultant', 'account.move.line','addons/l10n_fr/report/compute_resultant_... | {
"content_hash": "b6439332429d737ba91203f1fac4f3cd",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 157,
"avg_line_length": 38.81818181818182,
"alnum_prop": 0.7330210772833724,
"repo_name": "ntiufalara/openerp7",
"id": "5eb62d7e82d789d9ccd2c76d6e8ca5e6ebf0772a",
"size": "... |
import os
import sys
sys.path.insert(0, os.getcwd())
sys.path.insert(0, os.path.join(os.getcwd(), os.pardir))
# noinspection PyUnresolvedReferences
from .settings import *
| {
"content_hash": "caa0cd788905259c785036de6e3b521f",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 56,
"avg_line_length": 24.714285714285715,
"alnum_prop": 0.7572254335260116,
"repo_name": "dekoza/django-getpaid",
"id": "e4eb1b491216e7060ced53bba85ecf3b651821f2",
"size": ... |
"""
n_queens_ii.py
Created by Shengwei on 2014-07-31.
"""
# https://oj.leetcode.com/problems/n-queens-ii/
# tags: medium / hard, matrix, bit manipulation, generator, dfs, bitmap
"""
Follow up for N-Queens problem.
Now, instead outputting board configurations, return the total number of distinct solutions.
"""
# No... | {
"content_hash": "6a102eeb7d1ffa0b74da0602a4bed09a",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 94,
"avg_line_length": 29.263157894736842,
"alnum_prop": 0.5467625899280576,
"repo_name": "CodingVault/LeetCodeInPython",
"id": "47bd29411198a045d9756f85c61dafaea8e1943c",
... |
from director import applogic as app
from director.debugVis import DebugData
from director import transformUtils
from director import objectmodel as om
from director import affordanceitems
from director import affordanceurdf
from director.uuidutil import newUUID
import director.vtkAll as vtk
import numpy as np
import ... | {
"content_hash": "5ffd474d021bc4aef105aead70eac411",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 116,
"avg_line_length": 37.25547445255474,
"alnum_prop": 0.7043495297805643,
"repo_name": "RobotLocomotion/director",
"id": "c94ae8e5b7823d08ae1c056a57e021f00ecc04ef",
"si... |
from __future__ import absolute_import, print_function
import numpy as np
import matplotlib.pyplot as plt
_sew_name = 'sum_edge_weights'
def graph_volume(graph, weight=None):
name = _sew_name
if weight is None:
name += '_unweighted'
else:
name += '_weighted'
if name not in graph.graph... | {
"content_hash": "512abfdbcecadfbdb77d24d19f09c90e",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 73,
"avg_line_length": 29.10169491525424,
"alnum_prop": 0.5870704717530577,
"repo_name": "marianotepper/sgft",
"id": "95ec7c5c540165f43bdae51cf9b2f75f6b5de3ef",
"size": "17... |
import numpy as np
import pandas as pd
import uuid
METHODS = [
'add', 'sub', 'mul', 'floordiv', 'div', 'truediv', 'mod',
'divmod', 'pow', 'lshift', 'rshift', 'and', 'or', 'xor'
]
_df = pd.DataFrame()
_se = pd.Series()
PANDAS_DATAFRAME_OBJECTS = [
attr for attr in dir(_df)
if not attr.startswith('_')... | {
"content_hash": "664955c72bb3daafb15cb37c02744aac",
"timestamp": "",
"source": "github",
"line_count": 386,
"max_line_length": 79,
"avg_line_length": 25.917098445595855,
"alnum_prop": 0.531687325069972,
"repo_name": "xmnlab/skdata",
"id": "f29a19ba28e81d3fd175f7372fb9a1e4c5d96798",
"size": "10004"... |
"""Defines the base configuration class for a trigger rule"""
from __future__ import unicode_literals
from abc import ABCMeta, abstractmethod
class TriggerRuleConfiguration(object):
"""The base class that represents the configuration for a trigger rule
"""
__metaclass__ = ABCMeta
def __init__(self,... | {
"content_hash": "045261866c2b9fef050271cda8e170dd",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 116,
"avg_line_length": 29.11904761904762,
"alnum_prop": 0.6647587898609976,
"repo_name": "ngageoint/scale",
"id": "22617a9537ee441de287274f50fbbb628860be18",
"size": "1223... |
"""
airPy is a flight controller based on pyboard and written in micropython.
The MIT License (MIT)
Copyright (c) 2016 Fabrizio Scimia, fabrizio.scimia@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in... | {
"content_hash": "93d1438d61f1029f5a6afeec41e44147",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 77,
"avg_line_length": 39.42424242424242,
"alnum_prop": 0.5564950038431975,
"repo_name": "Sokrates80/air-py",
"id": "72f024503c774149004b35a8d365b3f8825fcd5f",
"size": "260... |
from __future__ import print_function
import codecs
import os
import os.path
import pytest
import stat
import subprocess
import sys
if sys.version_info.major == 2:
from StringIO import StringIO
else:
from io import StringIO
import x2y.options
import x2y.x2y
class Cmd(object):
def __init__(self, cmd, chd... | {
"content_hash": "33256b0aa343727ed3d28310d5199bcc",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 145,
"avg_line_length": 30.794701986754966,
"alnum_prop": 0.5494623655913978,
"repo_name": "bnomis/x2y",
"id": "ef101313cf1f6e4c27f73d7cea5d742baf324081",
"size": "4696",
... |
from django.core.management.base import BaseCommand
from twiggy_goodies.django import LogMixin
from allmychanges.browser import Browser
class Command(LogMixin, BaseCommand):
help = u"""Download package sources into a temporary directory."""
def handle(self, *args, **options):
webkit = Browser()
path = 'cap... | {
"content_hash": "db702d52f5ce26db1adf563a0bd5917c",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 70,
"avg_line_length": 31.133333333333333,
"alnum_prop": 0.7366167023554604,
"repo_name": "AllMyChanges/allmychanges.com",
"id": "d3e4dfe2974c9ef50634fcf92f0a7185bd29b352",
... |
"""
This module is the main part of the library. It houses the Scheduler class and related exceptions.
"""
from threading import Thread, Event, Lock
from datetime import datetime, timedelta
from logging import getLogger
import os
import sys
from apscheduler.util import *
from apscheduler.triggers import SimpleTrigger... | {
"content_hash": "e9ce9dba887d93d6a8ff9a9c881dbecd",
"timestamp": "",
"source": "github",
"line_count": 551,
"max_line_length": 120,
"avg_line_length": 39.94736842105263,
"alnum_prop": 0.5864794875289628,
"repo_name": "yonglehou/apscheduler",
"id": "599073a5d1699b0aeff1d98a906fd9f20f85e973",
"size"... |
import pydoop.mapreduce.api as api
class Reducer(api.Reducer):
def reduce(self, context):
s = sum(map(int, context.values))
context.emit(context.key, str(s))
| {
"content_hash": "3b9c6cb012eca22affdc90c56424f0cc",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 41,
"avg_line_length": 22.625,
"alnum_prop": 0.6574585635359116,
"repo_name": "mdrio/pydoop",
"id": "1e03c298b15e2e04b0ac21f66143c911c6f94361",
"size": "792",
"binary": fa... |
from string import ascii_lowercase
from urllib.parse import urljoin
from rdflib import Graph
from sphinx import addnodes
from sphinx.domains import Domain, ObjType
from sphinx.locale import _
from sphinx.directives import ObjectDescription
from sphinx.roles import XRefRole
from sphinx.util.nodes import make_refnode
... | {
"content_hash": "523a83db8245586b433d49a56829ae52",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 102,
"avg_line_length": 28.16030534351145,
"alnum_prop": 0.6039577121171049,
"repo_name": "paulhoule/gastrodon",
"id": "b55342f75f65b5de5620eab4618bc94de0b52db7",
"size": ... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models, connection
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Action.timestamp_date'
db.add_column(u'actstream_action', 'timestamp_... | {
"content_hash": "664e80357950e5b6b26bf1242402f325",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 219,
"avg_line_length": 71.4421768707483,
"alnum_prop": 0.558845934107789,
"repo_name": "affan2/django-activity-stream",
"id": "46e246c7a80d7321fe90e8f52ea881635059d948",
... |
from __future__ import absolute_import, unicode_literals
from __future__ import division, print_function
import uuid
from datetime import datetime
from django import forms
from crispy_forms import layout, helper, bootstrap
from crispy_forms.utils import TEMPLATE_PACK
class RangeWidget(forms.widgets.MultiWidget):
... | {
"content_hash": "724e009351416f5197d5f8a87ceafd91",
"timestamp": "",
"source": "github",
"line_count": 367,
"max_line_length": 79,
"avg_line_length": 38.25613079019074,
"alnum_prop": 0.5783475783475783,
"repo_name": "neuroticnerd/bryce-crispies",
"id": "baffbbe3ba880f54dc17b153b7bde09ddfe22507",
"... |
import unittest
from rethink import Rethink
class TestSuite(unittest.TestCase):
def test(self):
rethink = Rethink()
rethink.populate()
things = rethink.count()
self.failIf(things != 5)
def main():
unittest.main()
if __name__ == "__main__":
main()
| {
"content_hash": "6820989571b5b994f736f460f8eb4f7b",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 35,
"avg_line_length": 16.5,
"alnum_prop": 0.5925925925925926,
"repo_name": "vidyar/sample-python-rethinkdb",
"id": "2de4a74e35b0b113adb9eb05655ee9f0e1f699dc",
"size": "297... |
"""The test for the statistics sensor platform."""
from __future__ import annotations
from collections.abc import Sequence
from datetime import datetime, timedelta
import statistics
from typing import Any
from unittest.mock import patch
from homeassistant import config as hass_config
from homeassistant.components.sen... | {
"content_hash": "09185b9ed3aec9f3ddcbb18d32e5d94b",
"timestamp": "",
"source": "github",
"line_count": 1151,
"max_line_length": 104,
"avg_line_length": 35.609904430929625,
"alnum_prop": 0.5306804596579403,
"repo_name": "nkgilley/home-assistant",
"id": "56255216f528c2d9b999409f1f7e6e2a298218d7",
"s... |
"""StarLine Account."""
from datetime import datetime, timedelta
from typing import Any, Callable, Dict, Optional
from starline import StarlineApi, StarlineDevice
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.event import async_track_time_... | {
"content_hash": "358f627a3a9a0f14671ffd0ee935ae74",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 84,
"avg_line_length": 33.76223776223776,
"alnum_prop": 0.5880281690140845,
"repo_name": "Teagan42/home-assistant",
"id": "8d0214d1b5c4ffc19c0a45a7b84c3f9434ff8dfe",
"size... |
import string
import random
WORDLIST_FILENAME = "words.txt"
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
def loadWords():
"""
Returns a list of valid words. Words are strings of lowercase letters.
Depending on the size of the word list, this fu... | {
"content_hash": "d70761da8bdce165b14145fb0d7be269",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 81,
"avg_line_length": 26.425641025641024,
"alnum_prop": 0.6244905880069862,
"repo_name": "virdiignis/MITx6.00.1x",
"id": "8c8e37002f9c879124ece8586477aeaa303f62c1",
"size... |
"""
This application demonstrates how to find duplicate questions (paraphrases) in a long
list of sentences.
"""
from sentence_transformers import SentenceTransformer, util
# Questions can be a long list of sentences up to 100k sentences or more.
# For demonstration purposes, we limit it to a few questions which all ... | {
"content_hash": "b7816d0a697939da0a88b498ddcfe6c8",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 126,
"avg_line_length": 43.07142857142857,
"alnum_prop": 0.7103372028745163,
"repo_name": "UKPLab/sentence-transformers",
"id": "035234d9f6e51c1d7fee7e484599ab14b92deb87",
... |
import functools
import mock
import netaddr
import testtools
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import uuidutils
from neutron.agent.common import config as agent_config
from neutron.agent.common import ovs_lib
from neutron.agent.l3 import agent as neutron_l3_agent
from ne... | {
"content_hash": "a4dce97b30559a9cc49bf48a1c98ffe8",
"timestamp": "",
"source": "github",
"line_count": 468,
"max_line_length": 79,
"avg_line_length": 44.22435897435897,
"alnum_prop": 0.589505725467459,
"repo_name": "chitr/neutron",
"id": "465338a90832d6edf17d9cf25ab1e5d538cc849c",
"size": "21330",... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Feed.unit'
db.delete_column('feeds_feed', 'unit')
def backwards(self, orm):
# Addin... | {
"content_hash": "5d7aeb7ca38458a770f4fe83be8c86c4",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 210,
"avg_line_length": 73.70370370370371,
"alnum_prop": 0.5449246231155779,
"repo_name": "mollyproject/mollyproject",
"id": "0e34dbfc3e3ced676e37afeb05a04fd0cac5f795",
"s... |
import tests.perf.test_ozone_ar_speed_many as gen
gen.run_test(50)
| {
"content_hash": "693acf3b339913b8e720880bb8040a5f",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 49,
"avg_line_length": 17.25,
"alnum_prop": 0.7536231884057971,
"repo_name": "antoinecarme/pyaf",
"id": "c3186a8e922df99a1fdf1672b24e10d5842d441d",
"size": "69",
"binary":... |
from __future__ import absolute_import, division, print_function
import collections
import os
import threading
import types
import warnings
from cryptography.exceptions import InternalError
from cryptography.hazmat.bindings._openssl import ffi, lib
from cryptography.hazmat.bindings.openssl._conditional import CONDITI... | {
"content_hash": "fe685ee9a8a627dc7e5b6925bd3f4274",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 79,
"avg_line_length": 33.60775862068966,
"alnum_prop": 0.5883031935359754,
"repo_name": "Ayrx/cryptography",
"id": "2b9dca5c48ee2d5d8a3c01d8fb117e92b6dec8d0",
"size": "79... |
try:
from django.conf.urls import patterns, url, include
except ImportError: # Django < 1.4
from django.conf.urls.defaults import patterns, url, include
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib import admin
from . import views
admin.autodiscover()
urlpattern... | {
"content_hash": "0a913fa245a35c0d5ca7cb8b9f560813",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 71,
"avg_line_length": 31.133333333333333,
"alnum_prop": 0.7194860813704497,
"repo_name": "zerok/django-flatblocks",
"id": "cd7df777211763dcecc485b7edd31b8d0701b226",
"size... |
from oslo_config import cfg
watcher_applier = cfg.OptGroup(name='watcher_applier',
title='Options for the Applier messaging '
'core')
APPLIER_MANAGER_OPTS = [
cfg.IntOpt('workers',
default=1,
min=1,
required... | {
"content_hash": "f994b4361289730ec307e0b41989da96",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 74,
"avg_line_length": 34.93181818181818,
"alnum_prop": 0.564736499674691,
"repo_name": "openstack/watcher",
"id": "34ee80d9602ff04e0bf9d265786d04dc891f9aca",
"size": "2207... |
import internal
def setOutputDir(dir):
internal.core.setOutputDir(dir)
def getOutputDir():
return internal.core.getOutputDir()
| {
"content_hash": "6ba528fd3205bafe4a81ff8de8c69479",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 39,
"avg_line_length": 19.571428571428573,
"alnum_prop": 0.7591240875912408,
"repo_name": "danielpalomino/gem5",
"id": "7341e16c7336e6df4c134a46feb92c7663a7a21b",
"size": "1... |
from rest_framework import routers
from . import views
class CircuitsRootView(routers.APIRootView):
"""
Circuits API root view
"""
def get_view_name(self):
return 'Circuits'
router = routers.DefaultRouter()
router.APIRootView = CircuitsRootView
# Providers
router.register(r'providers', vie... | {
"content_hash": "af0f64f8f0a2d9aa2ffe1958dc502169",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 73,
"avg_line_length": 22.692307692307693,
"alnum_prop": 0.7627118644067796,
"repo_name": "Alphalink/netbox",
"id": "dfe0624e8d1723765485b49ffbe9e842428ca521",
"size": "590... |
import re, enum
# Precompiled regex for matching named groups in regex patterns
group_regex = re.compile(r'\?P<(.+?)>')
class Segment:
"""Segment of parsed text"""
def __init__(self, text, token=None, match=None, **params):
self.text = text
self.params = params
if token and match:
... | {
"content_hash": "6244e7a4c89894a5de834eac0e0246ba",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 100,
"avg_line_length": 36.65340909090909,
"alnum_prop": 0.5823903270810727,
"repo_name": "xmikos/reparser",
"id": "053a307e335208162bf600d7f8d7aa28b913c90d",
"size": "645... |
import sys
import time
import os
try:
# Python 2
from StringIO import StringIO
except ImportError:
# Python 3
from io import StringIO
sys.path.insert(0, "python")
import libxml2
# Memory debug specific
libxml2.debugMemory(1)
debug = 0
quiet = 1
#
# the testsuite description
#
CONF=os.path.join(os.path... | {
"content_hash": "09019b296f4ec14c367fce44d4355fc8",
"timestamp": "",
"source": "github",
"line_count": 421,
"max_line_length": 104,
"avg_line_length": 26.75059382422803,
"alnum_prop": 0.5898597052033386,
"repo_name": "nwjs/chromium.src",
"id": "559503a1297722e5124a99dc2ecfd129b11aa390",
"size": "1... |
import math
import pytest
def test_it_works():
assert 2 + 2 == 4
@pytest.mark.skip("known issue in math")
def test_failure():
assert math.pi == 3
| {
"content_hash": "786c4c7a94f41276526bf316138c5ef7",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 40,
"avg_line_length": 14.363636363636363,
"alnum_prop": 0.6455696202531646,
"repo_name": "andrewgryan/talks",
"id": "f68f4e8c57efef49dd47833c8177236bbae92cc4",
"size": "15... |
from flask import request, jsonify
from flask_restful import abort, Api, Resource
from . import get_db
from validation import *
from flask.ext.login import LoginManager, login_required, current_user, logout_user, login_user
class SuggestionVote(Resource):
@login_required
def post(self, sug_id):
direct... | {
"content_hash": "33e7b0bd7e3c467d4dd1a59cd9e6e838",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 110,
"avg_line_length": 35.08695652173913,
"alnum_prop": 0.5811648079306072,
"repo_name": "sfprime/textonfleek",
"id": "aea775d2d0bb44e44aa579373f36ff486fd05e3b",
"size": "... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='APIReference',
fields=[
('id', models.AutoField(serialize=False, primar... | {
"content_hash": "e0932a14c0ea4238698bbe6271c2bf82",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 476,
"avg_line_length": 57.54666666666667,
"alnum_prop": 0.5768072289156626,
"repo_name": "peterayeni/django-kong-admin",
"id": "87ba10bfa89c8b30923702a00ad7c0ed0ddca226",
... |
"""
wechatpy.messages
~~~~~~~~~~~~~~~~~~
This module defines all the messages you can get from WeChat server
:copyright: (c) 2014 by messense.
:license: MIT, see LICENSE for more details.
"""
from __future__ import absolute_import, unicode_literals
import copy
import six
from wechatpy.fields impo... | {
"content_hash": "56063e199ff0f43643a25855e036fe75",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 75,
"avg_line_length": 23.825581395348838,
"alnum_prop": 0.6217667154709614,
"repo_name": "hunter007/wechatpy",
"id": "b53c6d1b796d3e0b81316ad4e1c531a65dd0a058",
"size": "... |
from __future__ import division
import requests
import json
import pandas as pd
import numpy as np
from itertools import chain
from shapely.geometry import LineString, Point
"""
If you wish to retrieve route data directly into a DataFrame
df['travel_time_valhalla'], df['valhalla_route'] = zip(*
df.apply(route_va... | {
"content_hash": "4b89649d4d1db1b6378e936d6eebf700",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 108,
"avg_line_length": 31.91393442622951,
"alnum_prop": 0.6078078849364326,
"repo_name": "urschrei/router_comparison",
"id": "8e772b36a573e2ccafd3f4df2d68dc19e213711e",
"... |
"""Run regression test suite.
This module calls down into individual test cases via subprocess. It will
forward all unrecognized arguments onto the individual test scripts.
For a description of arguments recognized by test scripts, see
`test/functional/test_framework/test_framework.py:BitcoinTestFramework.main`.
"""... | {
"content_hash": "d3cb6bdce5222439fd152dfc697b7a4f",
"timestamp": "",
"source": "github",
"line_count": 697,
"max_line_length": 205,
"avg_line_length": 39.14203730272597,
"alnum_prop": 0.6077633604574445,
"repo_name": "FeatherCoin/Feathercoin",
"id": "210929cbb4ee89f4d97999437c2ebaf2b48993fa",
"siz... |
from django.conf.urls import include, url
from . import views
urlpatterns = [
url(r'^albums/$', views.AlbumsPage.as_view(), name='albums'),
url(r'^(?P<pk>\d+)-(?P<slug>[-\w]+)/$', views.AlbumDetailView.as_view(), name='album-detail'),
#url(r'^(?P<pk>\d+)/edit/$', views.AlbumEditView.as_view(), name='album... | {
"content_hash": "05cddff55e204eeb1772be718102633c",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 98,
"avg_line_length": 36.18181818181818,
"alnum_prop": 0.6180904522613065,
"repo_name": "contactr2m/remote_repo",
"id": "f35b9edb37176b64e17c612243b9f28786ee9b76",
"size":... |
from parglare import Grammar, Parser
def test_multiple_rules_with_assignments():
'''
See https://github.com/igordejanovic/parglare/issues/23
'''
text = "a"
grammar_str = """\
A : "a" ;
A : "b" ;
"""
grammar = Grammar.from_string(grammar_str)
parser = Parser(grammar)
resu... | {
"content_hash": "c4ad38a0befe0bfa0e87796a42b85c0d",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 59,
"avg_line_length": 21.536585365853657,
"alnum_prop": 0.5628539071347678,
"repo_name": "igordejanovic/parglare",
"id": "bc220d104374277bfd80884fda9c0831a920dd69",
"size"... |
from __future__ import unicode_literals
from django.apps import AppConfig
class VaultConfig(AppConfig):
name = 'vault'
| {
"content_hash": "67cbd5e56477a990df57eac90c7532ff",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 39,
"avg_line_length": 18,
"alnum_prop": 0.746031746031746,
"repo_name": "tmukherjee13/passman",
"id": "3f4b8a03c8fad06d795ef2f5479f2a54d7212a15",
"size": "126",
"binary":... |
"""Training and input utilities. See @{$python/contrib.training} guide.
@@batch_sequences_with_states
@@NextQueuedSequenceBatch
@@SequenceQueueingStateSaver
@@rejection_sample
@@resample_at_rate
@@stratified_sample
@@weighted_resample
@@bucket
@@bucket_by_sequence_length
"""
from __future__ import absolute_import
fro... | {
"content_hash": "3c5b1843e838b74ec12db9fc2caca966",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 90,
"avg_line_length": 51.048780487804876,
"alnum_prop": 0.8404204491161013,
"repo_name": "jjas0nn/solvem",
"id": "245f36c2fe25ff925565a92d27e43ab8dc1c1839",
"size": "2782"... |
"""strided_slice/set in python"""
def strided_slice_python(data, begin, end, strides, slice_mode="end"):
"""Python version of strided slice operator.
Parameters
----------
data : numpy.ndarray
Input data
begin : list
Begining of the slices.
end : list
End of the slic... | {
"content_hash": "89a63e9f7898f479b6d3c78011179b05",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 94,
"avg_line_length": 25.06451612903226,
"alnum_prop": 0.5448305448305448,
"repo_name": "tqchen/tvm",
"id": "c5eb72396c4feee84e3cfd5e8178467eca5135ea",
"size": "3116",
"... |
import json
from django import forms
from django.conf import settings
from django.contrib.admin.utils import (
display_for_field, flatten_fieldsets, help_text_for_field, label_for_field,
lookup_field,
)
from django.core.exceptions import ObjectDoesNotExist
from django.db.models.fields.related import ManyToMany... | {
"content_hash": "4a8f7480c88d9524f64e318c0a0c3652",
"timestamp": "",
"source": "github",
"line_count": 402,
"max_line_length": 117,
"avg_line_length": 38.308457711442784,
"alnum_prop": 0.5884415584415584,
"repo_name": "fenginx/django",
"id": "83719f4346e2da530d42d5420c874299da4f57cd",
"size": "154... |
from model_utils import Choices
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext as _
from typedmodels.models import TypedModel
from share.models.fuzzycount import FuzzyCountManager
class CeleryTask(TypedModel):
STATUS = Choices(
(0, 'started', ... | {
"content_hash": "2f3abe5077046104c57d6f29d4e46d56",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 98,
"avg_line_length": 34.64102564102564,
"alnum_prop": 0.691339748334567,
"repo_name": "laurenbarker/SHARE",
"id": "26e63c31ced415ad88260570c74722ab325e9139",
"size": "135... |
from autonetkit.design.utils.graph_utils import force_layout
from autonetkit.load.common import build_model_from_nx_graph
from autonetkit.workflow.workflow import BaseWorkflow
def main():
"""
"""
workflow = BaseWorkflow()
import networkx as nx
graph = nx.random_internet_as_graph(100)
network... | {
"content_hash": "0eb51b59ad5cc4123b44e1eec4d5f9d5",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 60,
"avg_line_length": 26.2,
"alnum_prop": 0.6450381679389313,
"repo_name": "sk2/autonetkit",
"id": "7f912e6f1bd38e3b59718638af3b69bdf32947f0",
"size": "786",
"binary": f... |
import sys
try: # real kodi
import xbmc
import xbmcaddon
import xbmcgui
import xbmcplugin
except ImportError: # mocked kodi
from mock_kodi import xbmc
from mock_kodi import xbmcaddon
from mock_kodi import xbmcgui
from mock_kodi import xbmcplugin
try: # python2
from urllib import... | {
"content_hash": "696a91644b42f929551f62a4745aa272",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 76,
"avg_line_length": 30.24576271186441,
"alnum_prop": 0.5903614457831325,
"repo_name": "weirdgiraffe/plugin.video.giraffe.seasonvar",
"id": "96b5d88c601d96a45e9502d53db28d... |
import json
import uuid
from argparse import ArgumentParser
from typing import Tuple
from avro.schema import Schema
from confluent_kafka import avro
from confluent_kafka.avro import AvroProducer
def parse_command_line_args():
arg_parser = ArgumentParser()
arg_parser.add_argument("--topic", required=True, he... | {
"content_hash": "312050e05643a9837637dbab6092c8d3",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 92,
"avg_line_length": 28.404255319148938,
"alnum_prop": 0.6352059925093633,
"repo_name": "linkedin/WhereHows",
"id": "4ce3fa0d1cd2d3af29fa78b202a1512ecd73f963",
"size": "2... |
from __future__ import print_function
from PIL import Image
import os
import sys
class Interval(object):
def __init__(self, interval="0"):
self.setinterval(interval)
def setinterval(self, interval):
self.hilo = []
for s in interval.split(","):
if not s.strip():
... | {
"content_hash": "ce8889edda4e68557b044adb924d42d6",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 75,
"avg_line_length": 22.365384615384617,
"alnum_prop": 0.5223559759243336,
"repo_name": "ruhackhers/hackhers-2017-filter",
"id": "9db0fd217784fba7315555b0b1fe6708351e5042"... |
from __future__ import division
import math
import random
import matplotlib.pyplot as plt
import scipy.signal as sig
from itertools import product
from misc import common_part_values, metric_prefix
from anneal import Annealer
# Setup optimization targets
target_q = 0.707 # 1/sqrt(2) - Which is the... | {
"content_hash": "04791e2c0fa90d35c1cba335415506de",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 125,
"avg_line_length": 31.629411764705882,
"alnum_prop": 0.5914078482425145,
"repo_name": "KevinNJ/Projects",
"id": "5679c5cd18208e1e2dff8a11ff266b9cb7d2ec25",
"size": "5... |
from ACTIIndicatorFeed import custom_build_iterator
import requests_mock
import pytest
from JSONFeedApiModule import Client
PARAMS = {'api_token': 'test_api_key', 'insecure': True,
'indicator_type': ['IP', 'Domain'],
'feed_name_to_config': {
'IP': {'extractor': 'results', 'indicator'... | {
"content_hash": "c5708de3837429ab50d1320376c35fcc",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 116,
"avg_line_length": 43.70238095238095,
"alnum_prop": 0.5676927267774449,
"repo_name": "demisto/content",
"id": "3626f05448b4d483f06b20f4a9ce50858258e6c5",
"size": "3671... |
from distutils.core import setup
setup(name='zencoder',
version='0.4',
description='Integration library for Zencoder',
author='Alex Schworer',
author_email='alex.schworer@gmail.com',
url='http://github.com/schworer/zencoder-py',
license="MIT License",
install_requires=['httpli... | {
"content_hash": "e41aeed2e0b13ef750e4467fb147811b",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 53,
"avg_line_length": 27.846153846153847,
"alnum_prop": 0.643646408839779,
"repo_name": "torchbox/zencoder-py",
"id": "cf876d77a7d4bea322b32953b46b0d98013217dd",
"size": "... |
from __future__ import print_function
from __future__ import division
import sys
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.model_selection import H2OModelSelectionEstimator as modelSelection
# test modelselection with mode=gaussian for regression only. In particular... | {
"content_hash": "5f444c5d074c49962d24f7f2d32ae427",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 169,
"avg_line_length": 63.40816326530612,
"alnum_prop": 0.6614097199871258,
"repo_name": "h2oai/h2o-3",
"id": "4cc64b78e6d01f3cf92792107ddcf6c2f5f2b8dd",
"size": "3107",
... |
from models import PresencePurpose, AnchorTime
from django.contrib import admin
from .models import SessionInfo
admin.site.register(PresencePurpose)
admin.site.register(AnchorTime)
class SessionInfoAdmin(admin.ModelAdmin):
model = SessionInfo
list_display = ('user', 'created', 'destroyed')
admin.site.regis... | {
"content_hash": "9d4b2096ef2c4e639bba7fd10112993f",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 51,
"avg_line_length": 25.294117647058822,
"alnum_prop": 0.8,
"repo_name": "SlashRoot/WHAT",
"id": "5cf58ed1cebcbf249617f668a3c02f3cd61350ae",
"size": "430",
"binary": fa... |
"""ECC secp256k1 crypto routines
WARNING: This module does not mlock() secrets; your private keys may end up on
disk in swap! Use with caution!
"""
import ctypes
import ctypes.util
import hashlib
import sys
ssl = ctypes.cdll.LoadLibrary(ctypes.util.find_library ('ssl') or 'libeay32')
ssl.BN_new.restype = ctypes.c_v... | {
"content_hash": "b21f62ffd661dbf6cff3bcdeb4083f27",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 130,
"avg_line_length": 36.70742358078603,
"alnum_prop": 0.6314537235308113,
"repo_name": "LIMXTEC/LIMX",
"id": "36a2be6261574e4f9cf20bb6811f6a6c2f6caea7",
"size": "8521",... |
from .sanetime import SaneTime,sanetime,time,nsanetime,ntime
from .sanetztime import SaneTzTime,sanetztime,tztime,nsanetztime,ntztime
from .sanedelta import SaneDelta,sanedelta,delta,nsanedelta,ndelta
from .sanespan import SaneSpan,sanespan,span,nsanespan,nspan
| {
"content_hash": "7d2db3893135df3019b79d6af4c0fcae",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 72,
"avg_line_length": 52.6,
"alnum_prop": 0.8593155893536122,
"repo_name": "HubSpot/sanetime",
"id": "2bda5bbc49a96ee7eb29d45bc978475879a6e644",
"size": "263",
"binary": ... |
from __future__ import print_function
from verta._internal_utils import time_utils
from verta._protos.public.monitoring.Summary_pb2 import AggregationQuerySummary
from verta.external import six
class Aggregation(object):
"""A query object specifying how summary samples should be aggregated.
Attributes
-... | {
"content_hash": "0ef1ad94b530d375b2a42aceb0c8ab79",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 98,
"avg_line_length": 31.104347826086958,
"alnum_prop": 0.6306961140620632,
"repo_name": "mitdbg/modeldb",
"id": "21f0cb8435e46dd98eb20283a31a56b798278a8d",
"size": "3602... |
try:
try:
from ucollections import deque
except ImportError:
from collections import deque
except ImportError:
print("SKIP")
raise SystemExit
d = deque((), 2)
print(len(d))
print(bool(d))
try:
d.popleft()
except IndexError:
print("IndexError")
print(d.append(1))
print(len(d))... | {
"content_hash": "d416ca3d0020ad6b994553c3182732c4",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 64,
"avg_line_length": 15.426470588235293,
"alnum_prop": 0.657769304099142,
"repo_name": "adafruit/micropython",
"id": "19966fcb07871323324ee91130cfec70f4224dd0",
"size": "... |
import unittest
import mock
_FLASK_TRACE_ID = "flask0id"
_FLASK_SPAN_ID = "span0flask"
_FLASK_HTTP_REQUEST = {"requestUrl": "https://flask.palletsprojects.com/en/1.1.x/"}
_DJANGO_TRACE_ID = "django0id"
_DJANGO_SPAN_ID = "span0django"
_DJANGO_HTTP_REQUEST = {"requestUrl": "https://www.djangoproject.com/"}
class Test... | {
"content_hash": "2c3f7aefb92aba185263e176c3116674",
"timestamp": "",
"source": "github",
"line_count": 452,
"max_line_length": 89,
"avg_line_length": 37.60176991150443,
"alnum_prop": 0.6392092257001647,
"repo_name": "googleapis/python-logging",
"id": "6a7ff245fdd9cbd8633c607cc1f3908c4a7988ea",
"si... |
from . import builder
from . import differentiable
from . import fitter
from . import modelinstance
from . import aam
from . import atm
from . import clm
from . import dlib
from . import lk
from . import math
from . import result
from . import sdm
from . import transform
from . import visualize
from ._version import... | {
"content_hash": "bfac9f0545134b560050b9df7064ab32",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 39,
"avg_line_length": 18.666666666666668,
"alnum_prop": 0.7474489795918368,
"repo_name": "grigorisg9gr/menpofit",
"id": "c0d56ab6f40c10ac182f5da61ce02fe801f30624",
"size":... |
from blocks.bricks import (
application, Initializable)
from blocks.bricks.recurrent import recurrent
from blocks.bricks.parallel import Distribute
from blocks.utils import dict_subset, dict_union, pack
class AttentionRecurrent(Initializable):
"""Combines an attention mechanism and a recurrent transition.
... | {
"content_hash": "22413e9e66c87fc8f6fded0b1c2d9e8e",
"timestamp": "",
"source": "github",
"line_count": 214,
"max_line_length": 78,
"avg_line_length": 42.6822429906542,
"alnum_prop": 0.6356470330632801,
"repo_name": "mila-udem/blocks-extras",
"id": "d8a087af07051d3e850cf2634edbd799a77555a4",
"size"... |
"""This example updates a base rate's value.
To determine which base rates exist, run get_all_base_rates.py.
"""
# Import appropriate modules from the client library.
from googleads import dfp
BASE_RATE_ID = 'INSERT_BASE_RATE_ID_HERE'
def main(client, base_rate_id):
# Initialize appropriate service.
base_rat... | {
"content_hash": "cb3742498d8d3470e71fa9bc69cc8001",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 77,
"avg_line_length": 28.28125,
"alnum_prop": 0.6314917127071823,
"repo_name": "wubr2000/googleads-python-lib",
"id": "f5323598aedaa159773e99624a78f29de5b58223",
"size": "... |
"""Views for email notifications."""
from ggrc.notifications import common
from ggrc.login import login_required
def init_notification_views(app):
"""Add url rules for all notification views.
Args:
app: current flask app.
"""
app.add_url_rule(
"/_notifications/send_daily_digest", "send_daily_diges... | {
"content_hash": "1a993e2550dc896d1ef92d29b7041227",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 77,
"avg_line_length": 31.347826086956523,
"alnum_prop": 0.7226074895977809,
"repo_name": "edofic/ggrc-core",
"id": "0805131c09bd88f2480ae9622bb883cebca1bcdf",
"size": "834... |
from utils.dockerutils import exec_dockerinspect
from icrawl_plugin import IContainerCrawler
import logging
logger = logging.getLogger('crawlutils')
class DockerinspectContainerCrawler(IContainerCrawler):
def get_feature(self):
return 'dockerinspect'
def crawl(self, container_id, avoid_setns=False... | {
"content_hash": "6c39e86717f112a5af1ed7b749ce3917",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 63,
"avg_line_length": 27.4375,
"alnum_prop": 0.7494305239179955,
"repo_name": "sastryduri/agentless-system-crawler",
"id": "0e851660958e2dbae08f8b264ab8bcc7df15386e",
"siz... |
headPort = "COM7"
rightHandPort = "COM8"
rightArmPort = "COM8"
leftArmPort = "COM7"
i01 = Runtime.createAndStart("i01", "InMoov")
rightArm = i01.startRightArm(rightArmPort)
rightHand = i01.startRightHand(rightHandPort)
leftArm = i01.startLeftArm(leftArmPort)
head = i01.startHead(headPort)
neck = i01.getHeadTracking()... | {
"content_hash": "0646204a9eb1083b63a468997e91d6cb",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 83,
"avg_line_length": 29.202898550724637,
"alnum_prop": 0.678908188585608,
"repo_name": "DarkRebel/myrobotlab",
"id": "00c739dea875cc04b7165800e20dcfa9ae4bfee9",
"size": "... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 7, transform = "Anscombe", sigma = 0.0, exog_count = 100, ar_order = 0); | {
"content_hash": "310c0415a3a7300800d0808cfe626c8a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 164,
"avg_line_length": 37.714285714285715,
"alnum_prop": 0.7045454545454546,
"repo_name": "antoinecarme/pyaf",
"id": "19e33e677effc9fbe98c81fa3df53ebd9fc61508",
"size": "26... |
"""Functions used in preparing Guido's gorgeous lasagna.
Learn about Guido, the creator of the Python language: https://en.wikipedia.org/wiki/Guido_van_Rossum
"""
# TODO: define the 'EXPECTED_BAKE_TIME' constant
# TODO: consider defining the 'PREPARATION_TIME' constant
# equal to the time it takes to prepare a ... | {
"content_hash": "8f904ab7eba7c792122ee7c82cda2089",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 101,
"avg_line_length": 33.13333333333333,
"alnum_prop": 0.7233400402414487,
"repo_name": "jmluy/xpython",
"id": "b08e1a7149b9466cd4083065fc9ef35fe6dc5aff",
"size": "994",
... |
import json
import logging
from edge.opensearch.fgdcresponse import FgdcResponse
from datetime import datetime
class FgdcResponseBySolr(FgdcResponse):
def __init__(self):
super(FgdcResponseBySolr, self).__init__()
def generate(self, solrDatasetResponse, solrGranuleResponse = None, pretty=False):
... | {
"content_hash": "14e2af6faf47305699388e21230047e7",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 199,
"avg_line_length": 58.91489361702128,
"alnum_prop": 0.5645840857108463,
"repo_name": "dataplumber/edge",
"id": "562dc08dfc2c43b2550c0e557ea386c11ae7006f",
"size": "83... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.