text stringlengths 4 1.02M | meta dict |
|---|---|
import collections
from abc import ABC, ABCMeta, abstractmethod
from prompt_toolkit import prompt, PromptSession
from prompt_toolkit.completion import Completer, Completion
from prompt_toolkit.shortcuts import CompleteStyle
from prompt_toolkit.filters import completion_is_selected, has_completions
from prompt_toolkit.k... | {
"content_hash": "418bc802ff23acc4fceec26e0e421e3d",
"timestamp": "",
"source": "github",
"line_count": 531,
"max_line_length": 118,
"avg_line_length": 28.14312617702448,
"alnum_prop": 0.5551391862955032,
"repo_name": "TobiasKaiser/passmate",
"id": "0839eef3bf50ad32f5b02fa6193841ff66c56dd1",
"size"... |
from Get_Data import *
from Get_Tour import *
from gurobipy import *
import http.server
import json
import numpy as np
import os.path
import geojson
import random
import math
# Start setting up a simple local server
def start_server(port=8000, bind="", cgi=False):
if cgi==True:
http.serve... | {
"content_hash": "d434e61d7f3df80a6929c5d86d1a592d",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 226,
"avg_line_length": 49.46296296296296,
"alnum_prop": 0.5803070011231748,
"repo_name": "alegde/OSTSP-Project",
"id": "2c7ce3fc633d07e6e4be788f4822ed5520683c8c",
"size": ... |
import json
import os
import re
import pytest
import yaml
from Pegasus.api.writable import _CustomEncoder
def _tojson(obj):
"""Returns dict representation of obj using writable._CustomEncoder"""
return json.loads(json.dumps(obj, cls=_CustomEncoder))
@pytest.fixture(scope="module")
def convert_yaml_schemas... | {
"content_hash": "2e069030e2c664bda22776ae1f5523c4",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 85,
"avg_line_length": 28.13095238095238,
"alnum_prop": 0.5801946677951756,
"repo_name": "pegasus-isi/pegasus",
"id": "e0ca1d5bfd5731fccf99edefb2100efea3335291",
"size": "2... |
from rest_framework import routers
from .views import RefreshTokenViewSet
router = routers.SimpleRouter()
router.register(r'refresh-token', RefreshTokenViewSet)
| {
"content_hash": "8597dc662fd281b70201cdfa4e55760a",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 54,
"avg_line_length": 27.166666666666668,
"alnum_prop": 0.8282208588957055,
"repo_name": "lock8/django-rest-framework-jwt-refresh-token",
"id": "bef0127377397f963096aa99b11ee... |
def extractFillertranslationsWordpressCom(item):
'''
Parser for 'fillertranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('vermillion', 'Vermillion', ... | {
"content_hash": "5850753a9fbe6e6117d48d6c7977cb18",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 104,
"avg_line_length": 30.761904761904763,
"alnum_prop": 0.6207430340557275,
"repo_name": "fake-name/ReadableWebProxy",
"id": "5444508a5e52146deb6be6b4e919174f38a28c6f",
"... |
import gzip
import numpy
import pytest
from deep_qa.data.embeddings import PretrainedEmbeddings
from deep_qa.data.data_indexer import DataIndexer
from deep_qa.models.text_classification import ClassificationModel
from deep_qa.common.checks import ConfigurationError
from ..common.test_case import DeepQaTestCase
class ... | {
"content_hash": "048fceb8dfbfd4402ea8bcdacad4dc6c",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 101,
"avg_line_length": 52.31730769230769,
"alnum_prop": 0.6072413159345709,
"repo_name": "matt-gardner/deep_qa",
"id": "6b5344ecefa1aef6d7d37f613ec0a632d6c2f7d2",
"size":... |
from participantCollection import ParticipantCollection
import re
import datetime
import pyperclip
# Edit Me!
# This script gets run on the first day of the following month, and that month's URL is
# what goes here. E.g. If this directory is the directory for February, this script gets
# run on March 1, and this URL ... | {
"content_hash": "54f15d0bef5a8fc895fdb22be28b03fc",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 199,
"avg_line_length": 45.12307692307692,
"alnum_prop": 0.680872826457552,
"repo_name": "foobarbazblarg/stayclean",
"id": "fe2ee1530ef7102e5378f0c7fa2f22efac971f84",
"size... |
import logging
import time
import pykka
logger = logging.getLogger(__name__)
class Future(pykka.ThreadingFuture):
Timeout = pykka.Timeout
@classmethod
def exception(cls, exc=None):
future = cls()
future.set_exception((type(exc), exc, None))
return future
@classmethod
d... | {
"content_hash": "40fcbd2716a71a6524b154a3ecd5f644",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 77,
"avg_line_length": 26.317073170731707,
"alnum_prop": 0.5866543095458758,
"repo_name": "tkem/mopidy-dleyna",
"id": "b1ac8564c9e4abdb2b0c7bad1562af18cceeb506",
"size": "1... |
"""Tests for tf_agents.bandits.environments.classification_environment."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
from absl.testing.absltest import mock
import numpy as np
import tensorflow as tf # pylint: di... | {
"content_hash": "3b5f84d44076489da0ee90779a461ccf",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 80,
"avg_line_length": 42.73557692307692,
"alnum_prop": 0.6598042524468444,
"repo_name": "tensorflow/agents",
"id": "a7591e7e8cb89c049b8952c14cb8d64cf6e1b9dc",
"size": "94... |
"""Contains internal functions for interacting with the Batfish service."""
from typing import TYPE_CHECKING, Any, Dict, Optional, Union # noqa: F401
from pybatfish.client import restv2helper
from pybatfish.client.consts import CoordConsts
from pybatfish.datamodel.answer import Answer # noqa: F401
from pybatfish.ut... | {
"content_hash": "1e6d721f0180932d880162be1a258a95",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 82,
"avg_line_length": 31.178571428571427,
"alnum_prop": 0.6918671248568156,
"repo_name": "batfish/pybatfish",
"id": "3cd5846f55b2ac105cd0eafb61e9259e66082bdb",
"size": "23... |
import numpy as np
import torch
from typing import Dict
from fairseq.data.monolingual_dataset import MonolingualDataset
from . import FairseqDataset
class LMContextWindowDataset(FairseqDataset):
"""
Wraps a MonolingualDataset and provides more context for evaluation.
Each item in the new dataset will h... | {
"content_hash": "15a29e1741041036511d76e755d087d9",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 90,
"avg_line_length": 34.81521739130435,
"alnum_prop": 0.6088042460193569,
"repo_name": "pytorch/fairseq",
"id": "1a945927cf0d96719003685676a990737a3762b2",
"size": "3381"... |
import sys
from sys import stderr
import json
from os.path import basename, getsize
from safe import extract_metadata
from safe.index import write_metadata
from util.cli import error
def usage():
""" Print short command usage. """
exename = basename(sys.argv[0])
print >>stderr, "USAGE: %s <md-schema> <safe... | {
"content_hash": "50f897a51dc10f5c64c8dd5480ebd25c",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 79,
"avg_line_length": 28.72972972972973,
"alnum_prop": 0.6302916274694261,
"repo_name": "DREAM-ODA-OS/tools",
"id": "1450d061a2cff4f7a8f65b77b56f39480e2aa3cf",
"size": "25... |
import json
class bag_of_words(dict):
def __missing__(self, word):
return 0
def __len__(self):
return sum(self.values())
def __iadd__(self, d):
for word, count in d.items():
self[word] += count
return self
def read(self, tokenizer, string):
for tp... | {
"content_hash": "776618d5898cc6a48dc1e5446b70f2ba",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 69,
"avg_line_length": 28.46315789473684,
"alnum_prop": 0.4940828402366864,
"repo_name": "rschaniel/BM25F",
"id": "2347653a125fb74759d4966e0ab012e5f69aafb6",
"size": "2704"... |
from datetime import datetime
import os
import argparse # argument parser library
from prettytable import PrettyTable
from prettytable import ALL
import pwd
from shutil import copyfile
import getpass
Dir = os.path.dirname(os.path.realpath(__file__))
def exitLoop(ncycle):
limit = 6
retu... | {
"content_hash": "17a8130313be4344bea385ef4e9ad515",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 200,
"avg_line_length": 38.67832167832168,
"alnum_prop": 0.5956427409148436,
"repo_name": "tuos/dasMonitorAOD2015",
"id": "86429ba9006665b934886aaeb4b8cee1a73db062",
"size... |
import sys
from day14_part1 import *
# Calculate the accumulated points gained along the race
def points_gained(reindeers, time):
points = [0] * len(reindeers)
for second in range(1, time + 1):
positions = distances_traveled(reindeers, second)
leading_position = max(positions)
# Each re... | {
"content_hash": "71847ba4d50cbbb1443d98c629b3dca4",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 71,
"avg_line_length": 34.705882352941174,
"alnum_prop": 0.6508474576271186,
"repo_name": "jkbockstael/adventofcode-2015",
"id": "0e3ccbc12c52f02e7f0e29412aa3bccac54542dc",
... |
'''Base Module for Sensor Collection Management'''
import functools
import collections
import logging
import multiprocessing
import os
import subprocess
logger = logging.getLogger(__name__)
__all__ = ['RA_DELIMITER', 'RA_FIELDS']
intconv = functools.partial(int, base=0)
# Ra Options and Fields
RA_DELIMITER = ','
R... | {
"content_hash": "a8ada664387c5fa4627e57114fbcb871",
"timestamp": "",
"source": "github",
"line_count": 151,
"max_line_length": 76,
"avg_line_length": 29.079470198675498,
"alnum_prop": 0.5167387838761103,
"repo_name": "effluxsystems/pyefflux",
"id": "f1062167e451d2f7cf146baa526e9886cd8d5d46",
"size... |
"""
The coupling module describes features of coupling functions.
NB bug/feature wrt. TVB here: we assume pre_syn is observables, not state vars.
If single expression given, applied to all observables. Otherwise,
empty expressions stop evaluation of coupling on one or more observables.
A connection is specified node... | {
"content_hash": "f45035f3143d2f3ce2eee76738a4d5e8",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 79,
"avg_line_length": 30.89622641509434,
"alnum_prop": 0.6137404580152672,
"repo_name": "the-virtual-brain/tvb-hpc",
"id": "4163bf4ae16e849bd1e2be33219598be0693d3cb",
"si... |
import numpy as np
import random
import tensorflow as tf
import maddpg.common.tf_util as U
from maddpg.common.distributions import make_pdtype
from maddpg import AgentTrainer
from maddpg.trainer.replay_buffer import ReplayBuffer
def discount_with_dones(rewards, dones, gamma):
discounted = []
r = 0
for re... | {
"content_hash": "d477ec3369479bb2559b2cae08293eeb",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 164,
"avg_line_length": 42.12244897959184,
"alnum_prop": 0.6028343023255814,
"repo_name": "openai/maddpg",
"id": "a3f5de65aadfc2fffe6793d5749be5be520b5e74",
"size": "8256"... |
"""
Very simple script to replace a template with another one.
It also converts the old MediaWiki boilerplate format to the new template format.
Syntax: python template.py [-remove] [xml[:filename]] oldTemplate [newTemplate]
Specify the template on the command line. The program will pick up the template
page, and lo... | {
"content_hash": "a3c1dd220cf5380143b2dac97b8b3db6",
"timestamp": "",
"source": "github",
"line_count": 393,
"max_line_length": 101,
"avg_line_length": 37.70992366412214,
"alnum_prop": 0.5936572199730095,
"repo_name": "hperala/kontuwikibot",
"id": "f7c520c4b1e30615c4c753aafad6f1e6445cf859",
"size":... |
from pentagon.component import ComponentBase
import os
class Component(ComponentBase):
_path = os.path.dirname(__file__)
| {
"content_hash": "3c11a37a95cb542fe1e20c9f1aa3e800",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 44,
"avg_line_length": 21.166666666666668,
"alnum_prop": 0.7559055118110236,
"repo_name": "reactiveops/pentagon",
"id": "ec618c1aebf2a65c482dead1c5c3ebfccf0b7c40",
"size": "... |
import urllib
from pymongo import MongoClient
from pymongo import ReadPreference
from pymongo import monitoring
from heisen.config import settings
from heisen.core.log import logger
class CommandLogger(monitoring.CommandListener):
def __init__(self, *args, **kwargs):
self.log_query = kwargs.pop('log_que... | {
"content_hash": "2efa3cab1d812e210e51c5abedfeedc5",
"timestamp": "",
"source": "github",
"line_count": 114,
"max_line_length": 90,
"avg_line_length": 30.973684210526315,
"alnum_prop": 0.5817048994619088,
"repo_name": "HeisenCore/heisen",
"id": "20435789708ec671ebacb55f18f3b21dc7c32d7c",
"size": "3... |
import os
import logging
from pyramid.config import Configurator
from pyramid.session import SignedCookieSessionFactory
from pyramid.view import view_config
from waitress import serve
import psycopg2
from contextlib import closing
from pyramid.events import NewRequest, subscriber
import datetime
from pyramid.httpexcept... | {
"content_hash": "61dadf7b51404c8a14704cac8b45c0a7",
"timestamp": "",
"source": "github",
"line_count": 250,
"max_line_length": 87,
"avg_line_length": 31.968,
"alnum_prop": 0.6584084084084084,
"repo_name": "alibulota/learning_journal",
"id": "8ee4bf8c28295ca63804dabc7d431daa3265f5d4",
"size": "8016... |
from models import burgers
from bcs import periodic
from simulation import simulation
from methods import weno3_lf
from rk import rk3
from grid import grid
from matplotlib import pyplot
Ngz = 3
Npoints = 400
interval = grid([-1, 1], Npoints, Ngz)
model = burgers.burgers(initial_data = burgers.initial_square())
sim = s... | {
"content_hash": "f559a935fa78621e81b9a734ecc4f944",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 64,
"avg_line_length": 24.22222222222222,
"alnum_prop": 0.7614678899082569,
"repo_name": "IanHawke/toy-evolve",
"id": "83c7daa5b9cfae0aa97d75766f00f0b039ff2cff",
"size": "4... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['ConstantTrend'] , ['Seasonal_DayOfWeek'] , ['AR'] ); | {
"content_hash": "9717c29fc84ad19c71a44d3f86cf99a9",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 86,
"avg_line_length": 39.75,
"alnum_prop": 0.710691823899371,
"repo_name": "antoinecarme/pyaf",
"id": "b6a28ce7306e5b26e28a3e353b008b3d21cf434c",
"size": "159",
"binary":... |
import unittest
import numpy as np
from parameterized import parameterized
from monai.apps.pathology.transforms.post.dictionary import GenerateInstanceBorderd
from tests.utils import TEST_NDARRAYS
EXCEPTION_TESTS = []
TESTS = []
np.random.RandomState(123)
for p in TEST_NDARRAYS:
EXCEPTION_TESTS.append(
... | {
"content_hash": "63b3af69a324f8d935103cee1932b755",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 94,
"avg_line_length": 29.31081081081081,
"alnum_prop": 0.5527893038266483,
"repo_name": "Project-MONAI/MONAI",
"id": "a4ee5221a64835d2ba7e5e09f92d5db97db9d8ea",
"size": "2... |
from rest_framework import serializers
class SudoStatusSerializer(serializers.Serializer):
valid = serializers.BooleanField()
expires_at = serializers.DateTimeField(default=None)
class SudoRenewSerializer(serializers.Serializer):
password = serializers.CharField(required=True)
| {
"content_hash": "3b8d4c74998d79fb0aa024d7fef0d771",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 56,
"avg_line_length": 29.4,
"alnum_prop": 0.8061224489795918,
"repo_name": "sparcs-kaist/sparcssso",
"id": "cab07b0b77e0191f2df22a4bd4ab83259583dcc0",
"size": "294",
"bi... |
import typing
from flask import json
FlaskHeaders = typing.Union[typing.List[typing.Tuple[str, str]], typing.Dict[str, str]]
FlaskResponse = typing.Tuple[str, int, FlaskHeaders]
def success(data, status=200) -> FlaskResponse:
return json.dumps(data, indent=2), status, [("Content-Type", "application/json")]
de... | {
"content_hash": "a0c6ecd39c91951468113526d2e32ebb",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 87,
"avg_line_length": 34,
"alnum_prop": 0.6650326797385621,
"repo_name": "nanobox-io/nanobox-adapter-libcloud",
"id": "2ae19d9f700aec11b84d59742166f45a0dbe4d79",
"size": "... |
'''Convenient data files for use in other modules.'''
from . import molecular_bio
from . import genbank
from .restriction_sites import fallback_enzymes
| {
"content_hash": "f22761d04a47116c6cf4156f3c4f1d32",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 53,
"avg_line_length": 38,
"alnum_prop": 0.7828947368421053,
"repo_name": "klavinslab/coral",
"id": "949873b908204e931bbd6a9df283a6d34bd8fb58",
"size": "152",
"binary": fa... |
import graphene
from ...page import models
from ..utils import filter_by_query_param, sort_queryset
from .sorters import PageSortField
PAGE_SEARCH_FIELDS = ("content", "slug", "title")
def resolve_page(info, global_page_id=None, slug=None):
assert global_page_id or slug, "No page ID or slug provided."
user ... | {
"content_hash": "2aea7e2a408dd2bfb578a38e05ed1152",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 83,
"avg_line_length": 33.96153846153846,
"alnum_prop": 0.695356738391846,
"repo_name": "maferelo/saleor",
"id": "42cde649091c078498ef5ea8379a57f1152190a6",
"size": "883",
... |
import contextlib
import uuid
import mock
import webob
from nova.api.openstack.compute.contrib import floating_ips as fips_v2
from nova.api.openstack.compute.plugins.v3 import floating_ips as fips_v21
from nova.api.openstack import extensions
from nova import compute
from nova.compute import utils as compute_utils
fr... | {
"content_hash": "4f008e3f67c81b236eecef8934892884",
"timestamp": "",
"source": "github",
"line_count": 870,
"max_line_length": 78,
"avg_line_length": 41.33103448275862,
"alnum_prop": 0.5850992824962457,
"repo_name": "cloudbase/nova-virtualbox",
"id": "f1368f36c3e05748987f76ff9bb99e09f0189c39",
"si... |
from wishlist_app.models import Item, WishlistGroup, GroupItem
from django.forms import ModelForm, ModelMultipleChoiceField, CheckboxSelectMultiple
class ItemForm(ModelForm):
# Representing the many to many related field in item groups
groups = ModelMultipleChoiceField(queryset=WishlistGroup.objects.all(), w... | {
"content_hash": "518e0569b7f4386cfa8a8a3fdde29e4a",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 122,
"avg_line_length": 39.88333333333333,
"alnum_prop": 0.6188884245716674,
"repo_name": "pclements12/PyWishlist",
"id": "28a363b40d6194713b6d41d52f9b4e83295c3c63",
"size"... |
"""Tests for dicom_web.py."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import posixpath
from typing import Any, Dict, Optional, Text, Tuple
from absl.testing import absltest
from absl.testing import parameterized
import google.auth.crede... | {
"content_hash": "ce3dd7898593a287eb278ac5b181d6c8",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 80,
"avg_line_length": 37.888888888888886,
"alnum_prop": 0.6748126425545781,
"repo_name": "GoogleCloudPlatform/healthcare",
"id": "e8f4aed07507f1748d2bdd7fff67a6a2f4e61190",... |
import operator
from .local_time import get_now, TZ
from copy import deepcopy
from datetime import timedelta
from dateutil.parser import parse
from dpath.util import delete as xpathdelete, get as xpathget, new as xpathnew
from haversine import haversine
from json import load, loads
from jsonpath_rw import parse as pars... | {
"content_hash": "6d48619353b063f66d3257d675fefa00",
"timestamp": "",
"source": "github",
"line_count": 673,
"max_line_length": 134,
"avg_line_length": 35.187221396731054,
"alnum_prop": 0.5939782948355221,
"repo_name": "kosaniak/robot_tests",
"id": "bdeb22cf828c56c115f307ee0bfc9e980ee5a5a8",
"size"... |
import pyxon.decode as pd
def unobjectify(obj):
"""
Turns a python object (must be a class instance)
into the corresponding JSON data.
Example:
>>> @sprop.a # sprop annotations are needed to tell the
>>> @sprop.b # unobjectify function what parameter need
>>> @sprop.c # to be written out.... | {
"content_hash": "b0f01714027a08ba3f12e4daf69a2087",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 72,
"avg_line_length": 28.516393442622952,
"alnum_prop": 0.61540672607071,
"repo_name": "k-j-m/Pyxon",
"id": "6aff4d7639431aa38a4d3a68b963afee4300b218",
"size": "3479",
... |
import base_filters
COPY_GOOGLE_DOC_KEY = '1Dr-ORDEr6iCs-i7arcBI2h6lFWdMbBFB7J8JZCdcUFQ'
USE_ASSETS = False
# Use these variables to override the default cache timeouts for this graphic
# DEFAULT_MAX_AGE = 20
# ASSETS_MAX_AGE = 300
JINJA_FILTER_FUNCTIONS = base_filters.FILTERS
| {
"content_hash": "b108d4b47d4f117e43b8748c7273bd65",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 77,
"avg_line_length": 25.636363636363637,
"alnum_prop": 0.7836879432624113,
"repo_name": "stlpublicradio/dailygraphics",
"id": "f9936de1e3f500d01be75a32df3426b8795a5191",
... |
from google.cloud import aiplatform_v1beta1
def sample_cancel_batch_prediction_job():
# Create a client
client = aiplatform_v1beta1.JobServiceClient()
# Initialize request argument(s)
request = aiplatform_v1beta1.CancelBatchPredictionJobRequest(
name="name_value",
)
# Make the reques... | {
"content_hash": "2553b1460b656172c0bb5e00704ae7b5",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 88,
"avg_line_length": 27.58823529411765,
"alnum_prop": 0.7505330490405118,
"repo_name": "googleapis/python-aiplatform",
"id": "a80c7d6b1cef514ac624aa209bcc03732623ef69",
"... |
import logging
import requests
from botologist.util import parse_dt, time_until
import botologist.plugin
log = logging.getLogger(__name__)
def get_next_episode_info(show, tz="UTC"):
query = {"q": show, "embed": "nextepisode"}
try:
response = requests.get(
"http://api.tvmaze.com/singlesear... | {
"content_hash": "000399888a25ee91b857019cb926b1f2",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 85,
"avg_line_length": 31.719298245614034,
"alnum_prop": 0.588495575221239,
"repo_name": "anlutro/botologist",
"id": "5d912e4cbd400dd97486df2467281d071f5b04b2",
"size": "18... |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from tenant_schemas.models import TenantMixin
from protocolle.auxiliar.models import Instituicao
class Client(TenantMixin):
institute = models.ForeignKey(Instituicao, verbose_name=_(u'Instituição'),
... | {
"content_hash": "6af920546c52f6f4bb179cae8851fc16",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 78,
"avg_line_length": 30.615384615384617,
"alnum_prop": 0.6846733668341709,
"repo_name": "klebercode/protocolle",
"id": "d23e53f4b854119ce8bbd1719b1d6a74185da2b3",
"size":... |
'''Qeez statistics queue module
* queue monitors:
$ rq-dashboard --redis_url=unix:///tmp/redis.sock?db=1 \
--bind=127.0.0.1 --port=9181 --interval=5000
or
$ rqinfo --url unix:///tmp/redis.sock?db=1
* queue worker:
$ rqworker --url unix:///tmp/redis.sock?db=1 --name my-worker-nr-x --verbose
# or
# python manage.py... | {
"content_hash": "e3b7423e3326b6ce3126fb1dd6207a83",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 76,
"avg_line_length": 27.683333333333334,
"alnum_prop": 0.6053582179409994,
"repo_name": "soutys/qeez_stats",
"id": "76c57083b0487623edb6def29ad2f7975de66222",
"size": "3... |
from django.conf.urls.defaults import *
urlpatterns = patterns('emailstubs',
# Example:
# (r'^server/', include('server.foo.urls')),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contr... | {
"content_hash": "a24ff67fae391f8e406fe053bef2a999",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 76,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.6547368421052632,
"repo_name": "eob/synckit-research",
"id": "54e82d2e2d792ba48fbc1331c1c7fbb3704c212b",
"size": ... |
import subprocess
def reboot():
subprocess.call(['sudo', 'reboot', 'now'])
| {
"content_hash": "081b4e02fac4e16c5a42c0ab07860e01",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 43,
"avg_line_length": 19.25,
"alnum_prop": 0.6753246753246753,
"repo_name": "akd001/RPi",
"id": "65ce39740bc1f3b5d831e573daf6a074e832989c",
"size": "77",
"binary": false,... |
import os.path
from cStringIO import StringIO
from flask import Flask, render_template, make_response, redirect, request,\
url_for
from werkzeug import secure_filename
from fixer import fix_sms
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
OUTPUT_PATH = os.path.join(PROJECT_ROOT, '../output/')
app = ... | {
"content_hash": "242613946f264b6d6f864f2423839878",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 84,
"avg_line_length": 31.695652173913043,
"alnum_prop": 0.594421582075903,
"repo_name": "ianonavy/sms-fixer",
"id": "bfa336aea4a0da019e0c35dd7df512d96f5b19e5",
"size": "22... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from aldryn_newsblog.utils.migration import rename_tables_old_to_new, rename_tables_new_to_old
class Migration(SchemaMigration):
def forwards(self, orm):
rename_ta... | {
"content_hash": "dcec1707c78ef06c4d81f03f0fb3f5ef",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 195,
"avg_line_length": 86.7479674796748,
"alnum_prop": 0.5642455482661668,
"repo_name": "czpython/aldryn-newsblog",
"id": "66da86c8bb85c9b2e59145fe6fc42f9097feeba3",
"siz... |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('Localizr', '0002_auto_20171123_0213'),
]
operations = [
migrations.AlterField(
model_name='appinfo',
name='base_locale',
... | {
"content_hash": "5574fedbc929a395afc7f809cd2be6f7",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 106,
"avg_line_length": 26.11111111111111,
"alnum_prop": 0.6085106382978723,
"repo_name": "michaelhenry/Localizr",
"id": "9057b785f951d06495f1c807edda7849089431f7",
"size":... |
import matplotlib.pyplot as plt
import numpy as np
from scipy.constants import mu_0
from ...utils import omega
from ....utils import validate_type, validate_list_of_types
# Define the default component dictionaries
DEFAULT_COMP_DICT = {
"xx": {"color": "green", "label": "Imp_xx", "marker": "_", "ls": "None"},
... | {
"content_hash": "f5aa22ee98bbc52d435706ef828e3344",
"timestamp": "",
"source": "github",
"line_count": 885,
"max_line_length": 88,
"avg_line_length": 33.159322033898306,
"alnum_prop": 0.5323383084577115,
"repo_name": "simpeg/simpeg",
"id": "701aa106f60b06c2eef9bfc0e26751fd3e6b7a6b",
"size": "29346... |
"""
WSGI config for autoscaling project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... | {
"content_hash": "51262c59544e78ee44177a9acb9fa1de",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 24.9375,
"alnum_prop": 0.7744360902255639,
"repo_name": "cuongnb14/autoscaling-paas",
"id": "5a7920a8da21dba6db29d87d903b9f52731ee4b3",
"size": "399"... |
import code
import traceback
import cgi
import sys
import json
import gc
from StringIO import StringIO
import clastic
def make_eval_app():
resources = {"global_contexts": {}}
routes = [
('/', get_console_html),
('/console/<eval_context>', get_console_html),
('/eval/<eval_context>', ev... | {
"content_hash": "b18182e2b4f9ab0e75b02accba7f9f6f",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 107,
"avg_line_length": 29.247474747474747,
"alnum_prop": 0.5294422379554481,
"repo_name": "paypal/support",
"id": "afe899300b246db98ac4db3c832ce0d9a15f8a57",
"size": "579... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^', include('newsfeed.urls')),
url(r'^', include('premises.urls')),
url(r'^', include('profiles.urls')),
url(r'^blog/', include('blog.urls')),
url('', include(... | {
"content_hash": "b294912490ada3e791489148fa1bee91",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 72,
"avg_line_length": 32.46153846153846,
"alnum_prop": 0.6516587677725119,
"repo_name": "beratdogan/arguman.org",
"id": "b311ce5dc1c676d09702d145d4eabd19c212fa06",
"size":... |
"""
This scripts is used for checking the correctness of statistics reported
by the gem5 simulator. It can excercise certain components in the memory
subsystem. The reported values could be used to compare against a validated
set of statistics.
"""
import m5
import argparse
import importlib
from m5.objects import Roo... | {
"content_hash": "69de0c0579bc6f6ea0397f926b0b6d37",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 79,
"avg_line_length": 28.931578947368422,
"alnum_prop": 0.643441877387666,
"repo_name": "gem5/gem5",
"id": "ede49937ac99511a0cbab163338e700af556ede6",
"size": "7047",
"... |
import logging
from typing import Dict, Any
from rflambda.sentinel2.new_sentinel2_event import NewSentinel2Event
from rflambda.model import handler
logger = logging.getLogger(__name__)
def handle(event: Dict[str, Any], context: Dict[str, Any]):
logger.info('Parsing s3 information from SNS event')
logger.deb... | {
"content_hash": "31ad82f9234fb887d1f66d3d34ad76aa",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 68,
"avg_line_length": 31.071428571428573,
"alnum_prop": 0.7517241379310344,
"repo_name": "aaronxsu/raster-foundry",
"id": "f1443bc4a0b4779d46dc3c1a34d49f603a4b0d5a",
"size... |
import math
import types
import ctypes
import numpy as np
from numpy import ctypeslib
# from numpy.ctypeslib import _typecodes
from numba import llvm_types, _ext
from numba.minivect.minitypes import *
from numba.minivect import miniast, minitypes
__all__ = minitypes.__all__ + [
'O', 'b', 'i1', 'i2', 'i4', 'i8', ... | {
"content_hash": "c71524b95ae4104607cc92b94a249996",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 79,
"avg_line_length": 23.67111111111111,
"alnum_prop": 0.5903116785580172,
"repo_name": "teoliphant/numba",
"id": "3dcc4a985d096b19bb1e5a5344920ae6e90b44ce",
"size": "532... |
import argparse
import json
import os.path
from joblib import Parallel, delayed
import tweepy
from tflda.timelines import download_timelines
if __name__ == "__main__":
parser = argparse.ArgumentParser(description = 'Twitter Friends LDA',
epilog = 'lol moar tw33tz', add_help = 'How to use',
prog =... | {
"content_hash": "f79e33c17036a1c28b584582b3bb8839",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 93,
"avg_line_length": 36.53191489361702,
"alnum_prop": 0.6249271986022131,
"repo_name": "magsol/twitter-friends-lda",
"id": "8d2bbc827f2e3de43b718c503a40ac17201ec0fd",
"si... |
"""
__MT_post__TransitionType.py_____________________________________________________
Automatically generated AToM3 syntactic object (DO NOT MODIFY DIRECTLY)
Author: gehan
Modified: Sun Feb 15 10:31:26 2015
_________________________________________________________________________________
"""
from ASGNode import *
fro... | {
"content_hash": "b9cb223c8191d2cf159c50ca9b0eba83",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 752,
"avg_line_length": 55.78151260504202,
"alnum_prop": 0.5697499246761073,
"repo_name": "levilucio/SyVOLT",
"id": "8400366e0e278837c367a488c8979449388f6311",
"size": "66... |
from fabric.api import run, task, sudo, put
from fabric.utils import puts
from fabric.operations import open_shell
from fabric.context_managers import settings
from maestro.config import default_settings
from maestro.decorators import hosts_required
@task
@hosts_required
def memory():
"""
Shows system uptime
... | {
"content_hash": "3e57cf09f15e1c5271db3965709ebf63",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 90,
"avg_line_length": 21.67391304347826,
"alnum_prop": 0.6283851554663992,
"repo_name": "ehazlett/fabric-maestro",
"id": "87d965ef5f471cde3a450d8d54237bebb5c3206a",
"size"... |
import vim
def plugin_enabled_modules():
v_enabled = vim.eval('g:pandoc#modules#enabled')
v_disabled = vim.eval('g:pandoc#modules#disabled')
return [m for m in v_enabled if m not in v_disabled]
| {
"content_hash": "32345b64848e573d2d7783a0d3b432a9",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 56,
"avg_line_length": 34.5,
"alnum_prop": 0.6956521739130435,
"repo_name": "pathing/my_exvim",
"id": "f9aec7939423d58f0cb787efb8a66ecbd78e3f3a",
"size": "207",
"binary": ... |
import os
import hashlib
import constants
import sqlite3
HERE = os.path.dirname(__file__)
def get_path(key):
return os.path.join(HERE, "data", key)
def get_hash(string):
h = hashlib.new('md5')
h.update(string)
return h.hexdigest()
def put(files):
db_entries = []
for filename, contents in fil... | {
"content_hash": "6f29a9bc2a3c316ec661dc04e3083b4e",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 100,
"avg_line_length": 28.816326530612244,
"alnum_prop": 0.6111898016997167,
"repo_name": "wnavarre/email-dictator",
"id": "bd850ec55259c729972621b54204a8d7db147ae4",
"siz... |
import _plotly_utils.basevalidators
class ZminValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="zmin", parent_name="densitymapbox", **kwargs):
super(ZminValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
e... | {
"content_hash": "9a8c0c55dce064978e58541a4f7f454a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 82,
"avg_line_length": 39.30769230769231,
"alnum_prop": 0.6027397260273972,
"repo_name": "plotly/python-api",
"id": "0ed2c47cb365e5447f636664370c67bf2526a346",
"size": "511... |
"""Shortcuts
.. module:: core.shortcuts
:platform: Linux, Unix
:synopsis: Shortcuts for core app
.. moduleauthor:: Nickolas Fox <[email protected]>
"""
# coding: utf-8
from django.shortcuts import render_to_response
from django.template import RequestContext
def direct_to_template(request, template, con... | {
"content_hash": "e2b2047f9e739165ab8a787776bd5887",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 73,
"avg_line_length": 30.181818181818183,
"alnum_prop": 0.6927710843373494,
"repo_name": "tarvitz/djtp",
"id": "b223457181231b0f3c2cdb04d362a9f1659796a1",
"size": "996",
... |
from datetime import datetime, timedelta
import hashlib
import os
import random
import tempfile
import time
import unittest
from glob import glob
from py4j.protocol import Py4JJavaError
from pyspark import shuffle, RDD
from pyspark.resource import ExecutorResourceRequests, ResourceProfileBuilder,\
TaskResourceReq... | {
"content_hash": "951f565c0db11697116b3d802f9007da",
"timestamp": "",
"source": "github",
"line_count": 913,
"max_line_length": 99,
"avg_line_length": 41.801752464403066,
"alnum_prop": 0.5997117778068911,
"repo_name": "milliman/spark",
"id": "60c000f6d90437484d5e0d071da3c75226121392",
"size": "3894... |
import redis
class RedisConnectionPingable:
"""Checker for ensuring that redis is up and a connection is possible."""
def __init__(self, host, port=6379, db=0, auth=None):
"""Initialise a new RedisConnectionPingable."""
self.host = host
self.port = port
self.db = db
se... | {
"content_hash": "d11ea1cc63b128eb383ad7f6c6c3b52d",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 88,
"avg_line_length": 31.814814814814813,
"alnum_prop": 0.5657741559953434,
"repo_name": "dammitjim/healthysnake",
"id": "9e4f33e70ab3051953067fef59f4dfea9f0c0f1e",
"size"... |
import os
import sys
import json
BUILD_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(
os.path.dirname(os.path.abspath(__file__)))))
BUILD_INTERNAL_ROOT = os.path.join(
os.path.dirname(BUILD_ROOT), 'build_internal')
sys.path.append(os.path.join(BUILD_ROOT, 'third_party'))
from recipe_engine import lo... | {
"content_hash": "87551ec40498505bcd355647925b2ceb",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 77,
"avg_line_length": 26.54901960784314,
"alnum_prop": 0.6255539143279173,
"repo_name": "eunchong/build",
"id": "035f854c4b3ec40900a8757108355513ab8969ad",
"size": "1543",... |
import pytest
import sys
import openpnm as op
from numpy.testing import assert_approx_equal, assert_allclose
from openpnm.utils import get_mixture_model_args
import chemicals
from thermo import Chemical
is_python_38 = sys.version_info[:2] == (3, 8)
is_linux = sys.platform.startswith('linux')
condition = is_python_38 ... | {
"content_hash": "390350ac42e25d69764b38c2d0a1cede",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 90,
"avg_line_length": 39.17901234567901,
"alnum_prop": 0.593666299038916,
"repo_name": "PMEAL/OpenPNM",
"id": "b617c3ba88b03dac2e9a557dc2a923804dd3b73b",
"size": "6347",
... |
from cloudify import non_existent # NOQA
from cloudify.decorators import operation
@operation
def run(**_):
pass
| {
"content_hash": "5454c4b69ba9ec65bf6d99636174f490",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 41,
"avg_line_length": 15.125,
"alnum_prop": 0.7355371900826446,
"repo_name": "geokala/cloudify-agent",
"id": "10a63f64272ad0aed85544452b3b31685a1c599d",
"size": "826",
"b... |
"""Adds a note type "Default".
"""
from django.utils.translation import gettext_lazy as _
from django.conf import settings
from lino.api import rt, dd
def objects():
NoteType = rt.models.notes.NoteType
yield NoteType(**dd.str2kw('name', _("Default")))
# yield noteType(
# _("Default"), build_m... | {
"content_hash": "70be74761aacf6a62722aa193a1116d9",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 71,
"avg_line_length": 20.11111111111111,
"alnum_prop": 0.6657458563535912,
"repo_name": "lino-framework/xl",
"id": "a0b1cac26ad93b50998a4038188dd4aa7415ce2d",
"size": "504... |
import pika
import requests
import logging
import time
import json
defaults = {'logging': {'levels': {'': 'INFO'}}}
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s+0000 - %(name)s - %(levelname)s - %(message)s')
logging.Formatter.converter = time.gmtime
logging.getLogger('pika').setLev... | {
"content_hash": "ce5b5ee331ea1f5eba1967a3f3c7654c",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 87,
"avg_line_length": 32.621212121212125,
"alnum_prop": 0.6470041802136554,
"repo_name": "Shaywei/rabbitmq",
"id": "b9c4d62acec3dfde4f96d0da20b14f5d41a4df71",
"size": "217... |
import functools
import six
from .constants import MESSAGES
from .logger import logger
from .common import StateError
def inherit_docstrings(cls):
'''
Take a base class and apply it's docstrings to functions
that do NOT have docstrings.
'''
bases = cls.__bases__
for base_class in bases:
... | {
"content_hash": "35537b7be013a7c0f0ce7d3891236a21",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 80,
"avg_line_length": 33.83720930232558,
"alnum_prop": 0.5646048109965636,
"repo_name": "benjolitz/aerospike",
"id": "92d62122b4ecd46cc6bf6eb094bd7843ca2ca8f4",
"size": "2... |
from django.test import TestCase
from django.contrib.auth import get_user_model
import datetime
from treatment_sheets.models import TxSheet, TxItem
from common.models import Prescription
User = get_user_model()
class TxSheetTest(TestCase):
def setUp(self):
self.owner = User.objects.create(username='Mar... | {
"content_hash": "db9c1bec6436b261f2a6b6b291a012c4",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 101,
"avg_line_length": 32.92307692307692,
"alnum_prop": 0.6699766355140186,
"repo_name": "onnudilol/vetcalc",
"id": "34a89aa3a57e4f1b84fc561aaaa905a89a21c761",
"size": "17... |
from django.db import models
from django.contrib.auth.models import User
class UserToken(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
tokens = models.PositiveSmallIntegerField()
def deduct(self):
self.tokens -= 1
self.save()
def __str__(self):
re... | {
"content_hash": "835c52598ed41a9f379bbb1a537c2666",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 63,
"avg_line_length": 26.5,
"alnum_prop": 0.6657681940700808,
"repo_name": "wfhio/tramcar",
"id": "aa73aa2a0dc77264ee7391785c7410d34146f056",
"size": "371",
"binary": fa... |
import pandas as pd
import argparse
from collections import defaultdict
import os
import math
def fix_strange_metaxa_vals(vals):
for i, val in enumerate(vals):
if i == 2 and val == 'Flavobacteria':
vals[2] = 'Flavobacteriia'
if i == 3 and val == 'Micrococcales':
vals[3] = "... | {
"content_hash": "b821731f7adb8daa574ba9bda634caa1",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 164,
"avg_line_length": 46.64545454545455,
"alnum_prop": 0.5928668875462872,
"repo_name": "EnvGen/toolbox",
"id": "48e6ed16d9d5a09524470b0500f32b743df1de03",
"size": "5131... |
import logging
import json
from colorlog import ColoredFormatter
from relay import log
def configure_logging(add_handler, log=log):
"""
Configure log records. If adding a handler, make the formatter print all
passed in key:value data.
ie log.extra('msg', extra=dict(a=1))
generates 'msg ... | {
"content_hash": "6c5c90ae705e61b7b0413a20f12f4302",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 79,
"avg_line_length": 33.55,
"alnum_prop": 0.6224540486835569,
"repo_name": "sailthru/relay",
"id": "3cc73335459e360aa739c65ce584d6a234c72543",
"size": "2013",
"binary":... |
"""
States to manage git repositories and git configuration
.. important::
Before using git over ssh, make sure your remote host fingerprint exists in
your ``~/.ssh/known_hosts`` file.
.. versionchanged:: 2015.8.8
This state module now requires git 1.6.5 (released 10 October 2009) or
newer.
"""
impor... | {
"content_hash": "87b740d2084289bf182b61455475fc6c",
"timestamp": "",
"source": "github",
"line_count": 3278,
"max_line_length": 112,
"avg_line_length": 38.711409395973156,
"alnum_prop": 0.47386048417601817,
"repo_name": "saltstack/salt",
"id": "307c2651f89f1230c028c97ae169c43f248d8951",
"size": "1... |
import os
import sys
from pathlib import Path
class Setup:
CONFIGURATION_FILE = os.path.join(Path(__file__).parents[1], "config", "server.cfg")
VLC_DEFAULT_COMMAND = "vlc -f"
POSIX = 'posix' in sys.builtin_module_names
VLC_PLAYLIST_END = "vlc://quit"
| {
"content_hash": "d45754dfc7f24a0ebdd77a976315e755",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 88,
"avg_line_length": 26.9,
"alnum_prop": 0.6728624535315985,
"repo_name": "danfr/RemoteTV",
"id": "185cbf721bcd3c3eddb2d6a3d61438b9d90e0363",
"size": "269",
"binary": f... |
from collections import defaultdict
import heapq
def top_k_frequent(nums, k):
counter = defaultdict(int)
for n in nums:
counter[n] += 1
return heapq.nlargest(k, counter, key=lambda x: counter[x])
| {
"content_hash": "59c647b683f057e76bc70e746104fd53",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 63,
"avg_line_length": 24.22222222222222,
"alnum_prop": 0.6788990825688074,
"repo_name": "xq5he/leetcodepy",
"id": "d564a53ab0ba0229f87be3ce23d2ca77cf54e8af",
"size": "218",... |
"""The version information for this release of PyCLibrary.
"""
from __future__ import (division, unicode_literals, print_function,
absolute_import)
from collections import namedtuple
# The major release number. Differences in the major number indicate
# possibly large differences in API.
MAJOR... | {
"content_hash": "1c0579add1c5c68b92db762debe0aa97",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 77,
"avg_line_length": 38.625,
"alnum_prop": 0.7346278317152104,
"repo_name": "mrh1997/pyclibrary",
"id": "dad8f0e626e529bac7ad4adf5db8d7202cf6b943",
"size": "1623",
"bin... |
from django.apps import apps
from django.core.management.base import BaseCommand, CommandError
from ... import models, utils
from ...exceptions import NotHistoricalModelError
get_model = apps.get_model
class Command(BaseCommand):
args = "<app.model app.model ...>"
help = (
"Populates the correspondi... | {
"content_hash": "e8eea7c6d50a8d9769643a159d1169d9",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 88,
"avg_line_length": 36.86470588235294,
"alnum_prop": 0.562629647359183,
"repo_name": "treyhunner/django-simple-history",
"id": "3fc2c5807d955f3361913cdb6d4f7e4b9f0c7977",... |
from .exception import TinEyeServiceException, TinEyeServiceError, TinEyeServiceWarning
from .image import Image
from .matchengine_request import MatchEngineRequest
from .mobileengine_request import MobileEngineRequest
from .multicolorengine_request import MulticolorEngineRequest
from .wineengine_request import WineEng... | {
"content_hash": "efdc2bf561124532a98306e18ac4a583",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 87,
"avg_line_length": 55.166666666666664,
"alnum_prop": 0.8851963746223565,
"repo_name": "TinEye/tineyeservices_python",
"id": "5b1c6238a77291fe71bd78ad49b9f1d99aabc663",
"... |
import time
from twisted.internet import protocol, defer
from twisted.python import failure
import twisted.internet.reactor
import constants
import encoding
import msgtypes
import msgformat
from contact import Contact
reactor = twisted.internet.reactor
class TimeoutError(Exception):
""" Raised when a RPC times ... | {
"content_hash": "269c12bab19a9fd0e08fb2a5f12a2739",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 174,
"avg_line_length": 47.111486486486484,
"alnum_prop": 0.5806382215847974,
"repo_name": "anupcshan/buddyfs",
"id": "54f440cb31c77c065ad93252175ccc09d6bf3ce0",
"size": "... |
"""This examples show how to use some features of the LED wrapper of the
LetMeCreate library.
It turns on gradually all the LED's present on the Ci40 from left to right in
1.6 second. This operation is repeated three times.
"""
from letmecreate.core import led
from time import sleep
led.init()
for i in range(10):
... | {
"content_hash": "67e476810470b91e896e3cb4f519baf8",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 77,
"avg_line_length": 22.8,
"alnum_prop": 0.7192982456140351,
"repo_name": "francois-berder/PyLetMeCreate",
"id": "3da885694207b69bb7e0adbdfb311e0edf1b4e3d",
"size": "479"... |
class Forex_Tick(object):
def __init__(self, line):
split = line.split('\t')
if len(split) != 7:
raise Exception("Error: CSV file not formated as expected for OLHC")
self.Ticker = split[0]
self.Date = split[1]
self.Time = split[2]
self.Open = float(split[... | {
"content_hash": "52797951a0d36479c5e3ad65e85ad0e5",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 80,
"avg_line_length": 29.875,
"alnum_prop": 0.5439330543933054,
"repo_name": "mikesligo/FYP-fuzzy-time-series",
"id": "6e76611b04bf08cbda994a4384fb5787a90e0b8a",
"size": "... |
import pandas as pd
def go():
df = pd.read_csv("../data/allegations_clean.csv")
cat_df = pd.read_csv("../data/categories.csv")
ids = cat_df.cat_id.tolist()
physical = cat_df.physical.tolist()
df.set_index(['crid', 'officer_id'], inplace = True)
df.replace(to_replace=ids, value=physical, inpla... | {
"content_hash": "2af64f7f5411495a83d0ec18c970eadf",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 95,
"avg_line_length": 28.38888888888889,
"alnum_prop": 0.6183953033268101,
"repo_name": "ladyson/police-complaints",
"id": "48fa1e8f09f4e28b329da8b80bf7feae2af130bf",
"siz... |
"""
This is a dumb wrapper to netCDF4 Python binding. The purpose of this module
is to provide a compatibility layer to an old wrapper to netCDF C library,
which is removed.
For more information about netCDF, please refer to
http://www.unidata.ucar.edu/software/netcdf/index.html
"""
import numpy as np
import solv... | {
"content_hash": "48757df8a000c75c9052c264f82e4ea0",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 85,
"avg_line_length": 29.477941176470587,
"alnum_prop": 0.5702170117236218,
"repo_name": "yungyuc/solvcon",
"id": "b0ddd9bbd68ac0e896d07568d1ce71df5b64ba7c",
"size": "559... |
from pyvows import Vows, expect
from thumbor.context import Context
from thumbor.config import Config
from fixtures.storage_fixture import IMAGE_URL, IMAGE_BYTES, get_server
from boto.s3.connection import S3Connection
from moto import mock_s3
from tc_aws.storages.s3_storage import Storage
import logging
logging.get... | {
"content_hash": "63a64fb0afced99b1cc4633ae0a8bc0e",
"timestamp": "",
"source": "github",
"line_count": 273,
"max_line_length": 136,
"avg_line_length": 40.18681318681319,
"alnum_prop": 0.5849056603773585,
"repo_name": "voxmedia/aws",
"id": "5be742c4b5b4590b0eee799f10464a70aee8aba7",
"size": "11016"... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.oep import OpenEnergyPlatformManagementServiceAPIs
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-oep
# USAGE
python operations_list.py
Before run the sample, please set the values of the client ID, tenant ID and ... | {
"content_hash": "53131b129e5cab084c7e88db771b1f6d",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 142,
"avg_line_length": 33.666666666666664,
"alnum_prop": 0.7495049504950495,
"repo_name": "Azure/azure-sdk-for-python",
"id": "95d6ad1af1e4f3ff47a1d142497bccf905734002",
"... |
import sys
import django
def main():
print(
"\n\n\n%s\n Python: %s, Django: %s\n%s\n"
% (
"=" * 120,
".".join(map(str, sys.version_info[:3])),
".".join(map(str, django.VERSION[:3])),
"-" * 120,
)
)
import logging
logging.basicC... | {
"content_hash": "658c0f9d63a1d38790e1e6082aebfda5",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 69,
"avg_line_length": 23.020833333333332,
"alnum_prop": 0.5737556561085972,
"repo_name": "5monkeys/django-formapi",
"id": "24f74e04f3de5b6cfb49d147e946f4c01fce23e3",
"size... |
import asyncio
from .base import REDIS_LOCATION
MSG_PACK_CACHES = {
"default": {
"BACKEND": "django_asyncio_redis.cache.AsyncRedisCache",
"POOLSIZE": None,
"LOCATION": REDIS_LOCATION,
"LOOP": asyncio.get_event_loop(),
"SERIALIZER": "django_asyncio_redis.serializers.msgpack.... | {
"content_hash": "4807548a05c842d391dba39ad22aa7ae",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 82,
"avg_line_length": 26.692307692307693,
"alnum_prop": 0.6455331412103746,
"repo_name": "mackeyja92/django-asyncio-redis",
"id": "87b5a14fcec05ee1cf42353d4fad2160ef3157e8",... |
import urllib2
import re
import logging
import csv
import datetime
from django.core.management.base import BaseCommand
from django.contrib.contenttypes.models import ContentType
from knesset.mks.models import Member
from knesset.committees.models import Committee
from knesset.events.models import Event
logger = logg... | {
"content_hash": "d641fcc35f77e57221098c202b4c5f54",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 166,
"avg_line_length": 47.0919540229885,
"alnum_prop": 0.5443007078350012,
"repo_name": "livni/old-OK",
"id": "bb250a4ffa0297c300b2df321f281e27a685bfcd",
"size": "4125",
... |
import warnings
from . import ops
from .groupby import DataArrayGroupBy, DatasetGroupBy
RESAMPLE_DIM = "__resample_dim__"
class Resample:
"""An object that extends the `GroupBy` object with additional logic
for handling specialized re-sampling operations.
You should create a `Resample` object by using ... | {
"content_hash": "d72246559614192e24d4fed28c046c5a",
"timestamp": "",
"source": "github",
"line_count": 352,
"max_line_length": 95,
"avg_line_length": 34.96306818181818,
"alnum_prop": 0.5915332737466482,
"repo_name": "xray/xray",
"id": "a00dedc8d05bde669c5d0c8958dc2b3720f65511",
"size": "12307",
... |
"""
RSA Key management
"""
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives.asymmetric.padding import PSS, MGF1
from cryptography.hazmat.primitives.hashes impor... | {
"content_hash": "d34f20fe748e655a565ce595960ea47c",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 77,
"avg_line_length": 33.02453987730061,
"alnum_prop": 0.5875905628831507,
"repo_name": "mbedmicro/mbed",
"id": "a7230e30eb368aa53a8ed8175a594c34f67cf82f",
"size": "6131"... |
"""Auth providers for Home Assistant."""
from __future__ import annotations
from collections.abc import Mapping
import importlib
import logging
import types
from typing import Any
import voluptuous as vol
from voluptuous.humanize import humanize_error
from homeassistant import data_entry_flow, requirements
from home... | {
"content_hash": "b1a1ed1ccffbeca300cfd814462e63ee",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 88,
"avg_line_length": 33.12328767123287,
"alnum_prop": 0.6198304383788255,
"repo_name": "kennedyshead/home-assistant",
"id": "d2dfa0e1c6d8bfd0ddf1e711864767c1bdd53222",
"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('boletin', '0003_auto_20151211_0441'),
]
operations = [
migrations.AlterField(
model_name='registrado',
name='codigo_postal',... | {
"content_hash": "9f2c12d2efb1430be64c391c67177069",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 47,
"avg_line_length": 21.055555555555557,
"alnum_prop": 0.5936675461741425,
"repo_name": "probardjango/Probar-Django-1.9",
"id": "402a13098871eff14fc1136a5b5055c5e89faf38",
... |
from os import path
from setuptools import setup
README = path.join(path.dirname(path.abspath(__file__)), "README.rst")
setup(
name="fforms",
version="1.1.1",
description=("Standalone HTML form validation library"),
long_description=open(README).read(),
author="Felipe Ochoa",
author_email="fel... | {
"content_hash": "c0cb77c85db1ac0eb0c1c3ca755cb0dc",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 70,
"avg_line_length": 31.12,
"alnum_prop": 0.6375321336760925,
"repo_name": "felipeochoa/fforms",
"id": "71d86e7a008353b939239338f16650119be1b06f",
"size": "778",
"binar... |
from __future__ import print_function
import os
import re
import warnings
import numpy as np
from .. import registry as io_registry
from ... import units as u
from ...extern import six
from ...extern.six import string_types
from ...table import Table
from ...utils import OrderedDict
from ...utils.exceptions import A... | {
"content_hash": "33056e6d9715ef1e8da9b1484837de93",
"timestamp": "",
"source": "github",
"line_count": 302,
"max_line_length": 81,
"avg_line_length": 32.950331125827816,
"alnum_prop": 0.5611496332026932,
"repo_name": "piotroxp/scibibscan",
"id": "a1a2349f33f509200d123f9ec8904c763b5ba751",
"size": ... |
import os
from twisted.trial import unittest
from scrapy.utils.iterators import csviter, xmliter, _body_or_str, xmliter_lxml
from scrapy.http import XmlResponse, TextResponse, Response
from tests import get_testdata
class XmliterTestCase(unittest.TestCase):
xmliter = staticmethod(xmliter)
def test_xmliter... | {
"content_hash": "d32c582bfe930267d7d8bd0f8d8dabd6",
"timestamp": "",
"source": "github",
"line_count": 417,
"max_line_length": 112,
"avg_line_length": 42.8968824940048,
"alnum_prop": 0.5088327370304114,
"repo_name": "starrify/scrapy",
"id": "79f5a2bbebaec69e014b5b8fbeefd499dce6413c",
"size": "1794... |
import unittest
from io import StringIO
from ...worksheet import Worksheet
class TestWriteFilterColumn(unittest.TestCase):
"""
Test the Worksheet _write_filter_column() method.
"""
def setUp(self):
self.fh = StringIO()
self.worksheet = Worksheet()
self.worksheet._set_filehand... | {
"content_hash": "bed95289a0757cb441a1245d1c233483",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 98,
"avg_line_length": 26.24,
"alnum_prop": 0.6326219512195121,
"repo_name": "jmcnamara/XlsxWriter",
"id": "3b5088615365b91e56bf9e3f18b28f790151a266",
"size": "869",
"bin... |
"""
Display all redis keys and values
"""
import time
import sys
import os
if __name__ == '__main__':
# add parent directory to python path such that we can import modules
HERE = os.path.dirname(os.path.realpath(__file__))
PROJ_PATH = os.path.abspath(os.path.join(HERE, '../'))
sys.path.insert(0, PROJ... | {
"content_hash": "d7125083793276bb90d3850977dd789d",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 73,
"avg_line_length": 25.5,
"alnum_prop": 0.5434173669467787,
"repo_name": "meteotest/h5pySWMR",
"id": "db038343e0421173a3b202dfa5b6884a1ed8b6d3",
"size": "739",
"binary... |
import os
import sys
import psycopg2
import psycopg2.extras
import ujson
import json
import argparse
def pg_connect(**cargs):
pg_conn = psycopg2.connect(**cargs)
pg_conn.reset()
pg_conn.set_session(
isolation_level=psycopg2.extensions.ISOLATION_LEVEL_REPEATABLE_READ,
readonly=True,
... | {
"content_hash": "ebe91c961b24a0e590dc2af69021eb38",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 101,
"avg_line_length": 30.017391304347825,
"alnum_prop": 0.593279258400927,
"repo_name": "jpictor/dskit",
"id": "8e6e2f13aab5112d0a2596a9895f50015f821144",
"size": "3452"... |
def escape_double_quote(string):
return string.replace('\\', '\\\\').replace('"', '\\"')
def unescape_double_quote(string):
quoting = False
chars = []
for c in string:
if not quoting:
if c == '\\':
quoting = True
else:
chars.append(c)
... | {
"content_hash": "c6069e0da07e0b363a23ace42fb41ac5",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 98,
"avg_line_length": 27.815068493150687,
"alnum_prop": 0.5456784043339079,
"repo_name": "talwrii/jsdb",
"id": "d0a785b79adef8f13c56b61c8b6fb4f2d5ad3a99",
"size": "8175",... |
import os
import sys
import rts2
# from astropy.io import ascii
class filter_set:
"""Class to simplify look up of filter by name and number
uses the python [] operator to lookup filter number
or name. If you give it the name it will return the
number and vice versa. it also uses aliases for the
... | {
"content_hash": "2b0368e7e825bf63f7aca3f0e2366233",
"timestamp": "",
"source": "github",
"line_count": 317,
"max_line_length": 122,
"avg_line_length": 33.29652996845426,
"alnum_prop": 0.5894836570345807,
"repo_name": "bjweiner/ARTN",
"id": "eb13411b01592cde4b82323d802753e127474b87",
"size": "11368... |
import os
import unittest
from transformers import BertTokenizerFast
from transformers.models.bert.tokenization_bert import (
VOCAB_FILES_NAMES,
BasicTokenizer,
BertTokenizer,
WordpieceTokenizer,
_is_control,
_is_punctuation,
_is_whitespace,
)
from transformers.testing_utils import require_... | {
"content_hash": "6f0c05d8afbfa8aea02649f5379655d4",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 116,
"avg_line_length": 38.382456140350875,
"alnum_prop": 0.5537983362281744,
"repo_name": "huggingface/pytorch-transformers",
"id": "3b8dced0ab4a98af38fba75b9ad8eab1b49010d... |
import sys
import time
import logging
from lbrynet.core import log_support
from lbrynet.core.client.ClientRequest import ClientRequest
from lbrynet.core.server.ServerProtocol import ServerProtocol
from lbrynet.core.client.ClientProtocol import ClientProtocol
from lbrynet.core.RateLimiter import RateLimiter
from lbryne... | {
"content_hash": "9b5eb4db457562ec966ebb029ea393e6",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 126,
"avg_line_length": 44.88931297709924,
"alnum_prop": 0.6957741688631919,
"repo_name": "zestyr/lbry",
"id": "4fa508d194a4b878cc0cea45452a16e8996e9f64",
"size": "11761",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.