text stringlengths 4 1.02M | meta dict |
|---|---|
import random
class Hand(object):
def __init__(self, n):
'''
Initialize a Hand.
n: integer, the size of the hand.
'''
assert type(n) == int
self.HAND_SIZE = n
self.VOWELS = 'aeiou'
self.CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
# Deal a new hand
... | {
"content_hash": "5cc06d3f831ec7f7ee355e99d2886cce",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 155,
"avg_line_length": 27.794871794871796,
"alnum_prop": 0.5738007380073801,
"repo_name": "spradeepv/dive-into-python",
"id": "5cd0793069496d22c6186d0ef3771faae6855241",
... |
from __future__ import unicode_literals
import json
from django.conf import settings
from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import QuerySet, Q
from django.utils.encoding import python_... | {
"content_hash": "ebf18616a6ccf783e8eca942aa9e29be",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 162,
"avg_line_length": 41.9812030075188,
"alnum_prop": 0.6479806572938122,
"repo_name": "chris-griffin/django-auditlog",
"id": "2ba3947adfd4b2fab8d4056da412ca1cd1acb12c",
... |
"""Build PO gettext files for server apps (html and py).
"""
import os
from django.conf import settings
from django.core.management.base import BaseCommand
from django.core.management import call_command
class Command(BaseCommand):
help = "Build PO gettext files for server apps (html and py)."
def add_argu... | {
"content_hash": "80e0f537ba31334a6a8f25b20c59c30a",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 99,
"avg_line_length": 31.696969696969695,
"alnum_prop": 0.5879541108986616,
"repo_name": "coll-gate/collgate",
"id": "5e1a0b3553e0ce27cc688719edb5f46ac27db9ba",
"size": "1... |
import copy
import numpy as np
try:
import torch
from torch.autograd import Variable
except Exception:
pass
from src.play.model.Move import Move
from src.play.model.Game import BLACK, WHITE
from .utils import network_input
from .model_zero import ConvNet
class ConvBot():
def __init__(self, logic: {... | {
"content_hash": "f67b86bac3d4e9ef3fe95c428335d9ba",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 80,
"avg_line_length": 32.640776699029125,
"alnum_prop": 0.5621653777513385,
"repo_name": "nathbo/GO_DILab",
"id": "74ffaf81111b5b9a30eb775eadf1582b88ac2858",
"size": "336... |
from email.parser import FeedParser
import os
import imp
import pkg_resources
import re
import sys
import shutil
import tempfile
import textwrap
import zipfile
from distutils.util import change_root
from pip.locations import (bin_py, running_under_virtualenv,PIP_DELETE_MARKER_FILENAME,
write... | {
"content_hash": "68d3c3340d5acea46996ecf4ea593d07",
"timestamp": "",
"source": "github",
"line_count": 1809,
"max_line_length": 156,
"avg_line_length": 43.90491984521835,
"alnum_prop": 0.5360596293311846,
"repo_name": "qwcode/pip",
"id": "b1c7c43d37438094378365cfa4a111cb5029f1f9",
"size": "79424",... |
"""Test Chipsec client actions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import collections
import sys
from absl import app
from chipsec.helper import oshelper
import mock
from grr_response_client import vfs
# If grr_response_client.components.... | {
"content_hash": "058ae018f7a0f0c11eca2d0ac61829ee",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 99,
"avg_line_length": 39.57992565055762,
"alnum_prop": 0.7205785667324129,
"repo_name": "dunkhong/grr",
"id": "bdf924f103a2aca3a297a4daca6f16114c05b3c0",
"size": "10669",... |
import csv
import sys
import logging
logger = logging.getLogger(__name__)
try:
from scipy.stats import pearsonr, spearmanr
from sklearn.metrics import matthews_corrcoef, f1_score
_has_sklearn = True
except (AttributeError, ImportError) as e:
logger.warning("To use data.metrics please install scikit-le... | {
"content_hash": "f6ff40b468ac888740d0cfe07262a547",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 117,
"avg_line_length": 32.026666666666664,
"alnum_prop": 0.5749375520399667,
"repo_name": "HLTCHKUST/Xpersona",
"id": "5a46eb05d3badcae4848ae00445990a3b88ee761",
"size": "... |
import gurobipy as gu
from ticdat import TicDatFactory, standard_main
# ------------------------ define the input schema --------------------------------
input_schema = TicDatFactory (
commodities = [["Name"],[]],
nodes = [["Name"],[]],
arcs = [["Source", "Destination"],["Capacity"]],
cost = [["Co... | {
"content_hash": "b33e6108e146d4e55b0832ccd00ab872",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 98,
"avg_line_length": 47.648148148148145,
"alnum_prop": 0.5369218810726778,
"repo_name": "opalytics/opalytics-ticdat",
"id": "ce693eb7c279ca763253623eb8f75b811658e668",
"... |
"""Poller Apps."""
| {
"content_hash": "1ae08976429f2feffce1a3434f81e9ab",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 18,
"avg_line_length": 19,
"alnum_prop": 0.5263157894736842,
"repo_name": "LokiNetworks/empower-runtime",
"id": "95b96ff6745aa84f7f22918ed86fe69565af430c",
"size": "628",
... |
"""Converts Haiku functions to dot."""
import collections
import contextlib
import functools
import html
from typing import Any, Callable, NamedTuple, List, Optional
from haiku._src import config
from haiku._src import data_structures
from haiku._src import module
from haiku._src import utils
import jax
# Import tre... | {
"content_hash": "ee33b2f3bfb743fa2becb0a4a8387f1d",
"timestamp": "",
"source": "github",
"line_count": 421,
"max_line_length": 79,
"avg_line_length": 29.826603325415675,
"alnum_prop": 0.6004618937644342,
"repo_name": "deepmind/dm-haiku",
"id": "674b1c2668302fcb6852aa43110ca984742e2973",
"size": "1... |
"""
This module contains the `ExpandoTextCtrl` which is a multi-line
text control that will expand its height on the fly to be able to show
all the lines of the content of the control.
"""
import wx
import wx.lib.newevent
# This event class and binder object can be used to catch
# notifications that the E... | {
"content_hash": "e98585f06b0212201a73c90a3c38718d",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 80,
"avg_line_length": 40.62735849056604,
"alnum_prop": 0.5410426100081273,
"repo_name": "ktan2020/legacy-automation",
"id": "ad3d668eb9d2904ca37ae84a62fbc2a5c2a07dee",
"s... |
import logging
from fake_switches.adapters import tftp_reader
from fake_switches.command_processing.piping_processor_base import NotPipingProcessor
from fake_switches.terminal import NoopTerminalController
class SwitchTftpParser(object):
def __init__(self, configuration, reader=None):
self.configuration ... | {
"content_hash": "867f110dbdf2adf993425d77ad118ef4",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 90,
"avg_line_length": 38.64,
"alnum_prop": 0.6956521739130435,
"repo_name": "mlecours/fake-switches",
"id": "edf32a0b0a8ecaac05d9d139195b969681156368",
"size": "1540",
"... |
from reportlab.lib.enums import TA_LEFT
from reportlab.lib.fonts import addMapping
from reportlab.lib.pagesizes import landscape, A4
from reportlab.lib.styles import ParagraphStyle
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.platypus.frames import Frame, ShowBoun... | {
"content_hash": "6b23209e073d7ce2334857aae5d2e069",
"timestamp": "",
"source": "github",
"line_count": 950,
"max_line_length": 121,
"avg_line_length": 35.565263157894734,
"alnum_prop": 0.56400390682807,
"repo_name": "bogdal/xhtml2pdf",
"id": "9edc5a014af34522c56b1aa1f01300e659b04f53",
"size": "338... |
""" Distributed toolkit: Extends `multiprocessing.managers`_ to
support distributed computing.
"""
from getpass import getuser
from multiprocessing import Process, connection, current_process, util
from multiprocessing.managers import (BaseManager, BaseProxy, Server, State,
dispatc... | {
"content_hash": "676aec13d6e445af6af8114281e30b15",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 76,
"avg_line_length": 34.82203389830509,
"alnum_prop": 0.5744706741299587,
"repo_name": "pbattaglia/distributed",
"id": "781d753876070573e133792c7928ad252eedfc77",
"size"... |
import _plotly_utils.basevalidators
class XValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="x", parent_name="heatmapgl.colorbar", **kwargs):
super(XValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_... | {
"content_hash": "1950608114579742193b4c0a095e4f1d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 84,
"avg_line_length": 35.92307692307692,
"alnum_prop": 0.5802997858672377,
"repo_name": "plotly/plotly.py",
"id": "9b43cb865bf486911507ffd1b750afd4d47a448c",
"size": "467"... |
import os
from setuptools import setup
# Utility function to read the README file.
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name = "pinko",
version = "1.0.0... | {
"content_hash": "f1f9b7d81b0988d9ee8dc37ce18d1688",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 77,
"avg_line_length": 30.48,
"alnum_prop": 0.6259842519685039,
"repo_name": "MadaooQuake/Pinko",
"id": "a9af03ecc3ab95658d19cb00c839cdb6fa2fec7b",
"size": "762",
"binary... |
"""
Requires the JSAnimation package,
https://github.com/jakevdp/JSAnimation
"""
import glob
from matplotlib import image, animation
from matplotlib import pyplot as plt
from JSAnimation import IPython_display
def make_plotdir(plotdir='_plots', clobber=True):
"""
Utility function to create a directory fo... | {
"content_hash": "54bc2618f6684759fbef67ee87a2d1d0",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 80,
"avg_line_length": 30.74,
"alnum_prop": 0.6509433962264151,
"repo_name": "philipwangdk/HPC",
"id": "c9731937891fd3664c4c80b9538b9da27b0cf97c",
"size": "3074",
"binar... |
from django import http
from django.template import Context, RequestContext
from coffin.template.loader import render_to_string
__all__ = ('page_not_found', 'server_error', 'shortcut')
# no Jinja version for this needed
from django.views.defaults import shortcut
def page_not_found(request, template_na... | {
"content_hash": "3b7a712775f14f5e132a61658b26e7fd",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 72,
"avg_line_length": 26.8,
"alnum_prop": 0.6556503198294243,
"repo_name": "akx/coffin",
"id": "4386a49be7dc8a6a83e80a591931860fedd42f3b",
"size": "938",
"binary": false... |
from __future__ import unicode_literals
import re
from decimal import Decimal
from django.contrib.gis.db.models import functions
from django.contrib.gis.geos import LineString, Point, Polygon, fromstr
from django.contrib.gis.measure import Area
from django.db import connection
from django.db.models import Sum
from dj... | {
"content_hash": "190ead99c1cd01a00066694fab7259c4",
"timestamp": "",
"source": "github",
"line_count": 492,
"max_line_length": 118,
"avg_line_length": 47.579268292682926,
"alnum_prop": 0.6177538553547781,
"repo_name": "carljm/django",
"id": "0e5f2ee693c059711d2f67e376f3edeffb4a4109",
"size": "2340... |
import os
import sys
import six
from .errors import LoadRAMLError
from .loader import RAMLLoader
if sys.version_info[0] == 2:
from io import open
def load_file(raml_file):
try:
with _get_raml_object(raml_file) as raml:
return RAMLLoader().load(raml)
except IOError as e:
rais... | {
"content_hash": "d9c3ec52f88c12cea87b795551614d9c",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 70,
"avg_line_length": 23.75609756097561,
"alnum_prop": 0.6180698151950719,
"repo_name": "spotify/ramlfications",
"id": "a198e779876ccb1934b97dd2fb988a3919336187",
"size": ... |
"""Unit tests for tracker_file and parallel_tracker_file."""
from gslib.exception import CommandException
from gslib.parallel_tracker_file import ObjectFromTracker
from gslib.parallel_tracker_file import ReadParallelUploadTrackerFile
from gslib.parallel_tracker_file import ValidateParallelCompositeTrackerData
from gsl... | {
"content_hash": "6cc5cb5b8f6e0237027c9aea2407cd18",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 87,
"avg_line_length": 43.98924731182796,
"alnum_prop": 0.7012955267660719,
"repo_name": "Sorsly/subtle",
"id": "5938d296a049a5a68126330787fd60023cf7bb15",
"size": "8802",... |
from xml.dom.minidom import parse, parseString
from legacy.models import Constituency
from boundaries.models import Boundary
from django.contrib.gis.geos import Point#
import django.core.management.base
maxZoom = 10
google_dist = 20037508.34
def reduceName(n):
return n.lower().replace(",", " ").replace("&", " an... | {
"content_hash": "e46c069f1dd7340645b3c78f86510a9f",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 136,
"avg_line_length": 48.24050632911393,
"alnum_prop": 0.4025190238782472,
"repo_name": "electionleaflets/electionleaflets",
"id": "19d778e289af3d6407f48d5e2fe1e778449e595b... |
import copy
import crcmod
from common.conversions import Conversions as CV
from selfdrive.car.tesla.values import CANBUS, CarControllerParams
class TeslaCAN:
def __init__(self, packer, pt_packer):
self.packer = packer
self.pt_packer = pt_packer
self.crc = crcmod.mkCrcFun(0x11d, initCrc=0x00, rev=False,... | {
"content_hash": "2fa3f95b72c7a44000b9d604811abd7a",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 92,
"avg_line_length": 35.70967741935484,
"alnum_prop": 0.6635049683830172,
"repo_name": "commaai/openpilot",
"id": "e5d904f80efc50f6c6905a4453adf9ecfcaa9fc5",
"size": "221... |
from __future__ import absolute_import, print_function
import pony
from pony.utils import decorator_with_params, tostring
from pony.templating import htmltag, Html, htmljoin, lazy, BoundMarkup
from pony.web import local, http, url
from pony.postprocessing import css_link, script_link
def blueprint_link(colu... | {
"content_hash": "d3bb2d032944dd1fdf8b34dde0e71651",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 147,
"avg_line_length": 45.358620689655176,
"alnum_prop": 0.5727535350463737,
"repo_name": "compiteing/flask-ponypermission",
"id": "d5ee9c96dc8de51cdf17ab525664566ce2b3c69d... |
from azure.mgmt.storage.models import StorageAccount
from c7n_azure.constants import FUNCTION_EVENT_TRIGGER_MODE, FUNCTION_TIME_TRIGGER_MODE, \
CONTAINER_EVENT_TRIGGER_MODE, CONTAINER_TIME_TRIGGER_MODE
from c7n_azure.policy import AzureEventGridMode, AzureFunctionMode, AzureModeCommon
from mock import mock, patch, ... | {
"content_hash": "dbc2a7083ac004999588c793589cea47",
"timestamp": "",
"source": "github",
"line_count": 657,
"max_line_length": 99,
"avg_line_length": 41.23744292237443,
"alnum_prop": 0.5170339202007899,
"repo_name": "capitalone/cloud-custodian",
"id": "981d45725216fb17565eec54f8a0e1fc82153dee",
"s... |
"""
chdir2
~~~~~~
An alternative implementation of :func:`chdir.chdir()`.
:copyright: © 2014 by Petr Zemek <s3rvac@gmail.com>
:license: BSD, see LICENSE for more details
"""
import os
class chdir2():
"""An alternative implementation of :func:`chdir.chdir()`."""
def __init__(self, dir):... | {
"content_hash": "ad9996e86069abb12b32753fa85b19a3",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 65,
"avg_line_length": 20.04,
"alnum_prop": 0.5748502994011976,
"repo_name": "s3rvac/blog",
"id": "50d482ec65f793292dd3090bb9ec7df3bc6a4636",
"size": "502",
"binary": fal... |
import os
from nose.tools import assert_is_not_none, assert_equals
from cmt.components import Meteorology as Component
from . import example_dir
cfg_file = os.path.join(example_dir, 'June_20_67_meteorology.cfg')
var_name = 'atmosphere_water__rainfall_volume_flux'
def setup_module():
global component
compone... | {
"content_hash": "c10c499d31409dc151375e5141d7a3f3",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 66,
"avg_line_length": 22.102803738317757,
"alnum_prop": 0.66553911205074,
"repo_name": "Elchin/topoflow-cmi-testing",
"id": "e841c3c83b6ffa676729aea92145df1e207a63a4",
"s... |
def test_distro_metadata(analyzed_data):
result = analyzed_data()
actual = result["image"]["imagedata"]["analysis_report"]["analyzer_meta"]
# This is odd, it nests another `analyzer_meta` in there
expected = {
"analyzer_meta": {
"base": {"DISTRO": "centos", "DISTROVERS": "8", "LIKEDI... | {
"content_hash": "885fe0d15c94a21bd77600897e602a67",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 88,
"avg_line_length": 31.76,
"alnum_prop": 0.5440806045340051,
"repo_name": "anchore/anchore-engine",
"id": "7816fea99b5abe849a3cff8fc1c9ac4750e7ad0e",
"size": "862",
"b... |
import pytest
from flex.error_messages import MESSAGES
from flex.exceptions import ValidationError
from flex.loading.definitions.schema import schema_validator
from tests.utils import (
assert_path_not_in_errors,
assert_message_in_errors,
)
def test_pattern_is_not_required():
try:
schema_validat... | {
"content_hash": "5c9d3cfdc8854dcd338cb669fc6038bc",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 60,
"avg_line_length": 22.775862068965516,
"alnum_prop": 0.6343679031037093,
"repo_name": "pipermerriam/flex",
"id": "732f6c731ebb989732d808eff160e7f03db95d15",
"size": "13... |
import gzip
from ..system_tools import gunzip
def test_gunzip(tmp_path):
filename = tmp_path / 'test_gunzip.txt.gz'
# First create a gzip file
content = b"Bla"
with gzip.open(filename, "wb") as f:
f.write(content)
# Then test our gunzip command works
gunzip(str(filename))
with ope... | {
"content_hash": "a3a10dbc42c5439e2d2cdf9aa8d9651a",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 51,
"avg_line_length": 26.5625,
"alnum_prop": 0.6376470588235295,
"repo_name": "imbasimba/astroquery",
"id": "32e98d6e58b0bb30da96c2586e5b39753fab92c3",
"size": "490",
"b... |
from colorthief import ColorThief
import sys
color_thief = ColorThief(sys.argv[1])
palette = color_thief.get_palette(color_count=6)
print palette
| {
"content_hash": "7ee096c27f776d8d4c884ae2839c7d86",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 48,
"avg_line_length": 29.2,
"alnum_prop": 0.8013698630136986,
"repo_name": "fthomasmorel/insapp-go",
"id": "cfbf0032903e68a5926ba8f3fae2a57610246c5b",
"size": "146",
"bin... |
import errno
import logging
import optparse
import os
import os.path
import re
import shutil
import subprocess
import sys
SOURCE_ROOT = os.path.join(os.path.dirname(__file__), "../..")
# Add the build-support dir to the system path so we can import kudu-util.
sys.path.append(os.path.join(SOURCE_ROOT, "build-support"))... | {
"content_hash": "bb49239603769a8d0552e9e46fe1d0b2",
"timestamp": "",
"source": "github",
"line_count": 474,
"max_line_length": 102,
"avg_line_length": 35.01054852320675,
"alnum_prop": 0.6254896053028021,
"repo_name": "helifu/kudu",
"id": "c17e911dc846eea7378e2b7b9727b8415080cbef",
"size": "18030",... |
import pytest
from unittest.mock import patch
from cartoframes.exceptions import CatalogError
from cartoframes.data.observatory.catalog.entity import CatalogList
from cartoframes.data.observatory.catalog.country import Country
from cartoframes.data.observatory.catalog.repository.country_repo import CountryRepository
... | {
"content_hash": "b4122f94f6e96d91b19231772d63bc8a",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 91,
"avg_line_length": 32.104,
"alnum_prop": 0.6287067032145527,
"repo_name": "CartoDB/cartoframes",
"id": "df8477a8ebd4ff9a56814eedfc6393cacf05b6b0",
"size": "4013",
"b... |
from OpenGLCffi.GLX import params
@params(api='glx', prms=['dpy', 'drawable', 'group'])
def glXJoinSwapGroupNV(dpy, drawable, group):
pass
@params(api='glx', prms=['dpy', 'group', 'barrier'])
def glXBindSwapBarrierNV(dpy, group, barrier):
pass
@params(api='glx', prms=['dpy', 'drawable', 'group', 'barrier'])
def g... | {
"content_hash": "3c65eabe0c61a2001894889a5838fb59",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 70,
"avg_line_length": 23.225806451612904,
"alnum_prop": 0.6930555555555555,
"repo_name": "cydenix/OpenGLCffi",
"id": "96e8adbb59fce3122be3bb6b3c2b3f932c32b3f1",
"size": "7... |
from __future__ import unicode_literals
from django.db import migrations, models
import dkmodelfields.monthfield
import dkmodelfields.statusfield
import dkmodelfields.yearfield
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | {
"content_hash": "59149b0b9757faf0fd408e0c776110f0",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 825,
"avg_line_length": 49.8421052631579,
"alnum_prop": 0.45987328405491024,
"repo_name": "datakortet/dkmodelfields",
"id": "2208b766ebc80635958d8da57f4d09156f172e21",
"siz... |
"""Main function a la Guido:
http://www.artima.com/weblogs/viewpost.jsp?thread=4829
"""
import getopt
import sys
from assertEquals.cli.reporters import detail, summarize
WINDOWS = sys.platform.find('win') == 0
class Usage(Exception):
def __init__(self, msg):
self.msg = msg
def main(argv=None):
... | {
"content_hash": "bbfa83bbf5e08c41ff73a4483879c725",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 77,
"avg_line_length": 28.22222222222222,
"alnum_prop": 0.4970472440944882,
"repo_name": "whit537/assertEquals",
"id": "624ba7fd5afb5e8a152d2ad53a048718053ed061",
"size": "... |
import os
import sys
import cv2
import numpy as np
import tensorflow as tf
import tensorflow_addons as tfa
import matplotlib.pyplot as plt
from ravens.models import ResNet43_8s
from ravens import utils
class TransportGoal:
"""Daniel: Transporter for the placing module, with goal images.
Built on top of the... | {
"content_hash": "62d4bf78163e1a5fb07e792c73063ea1",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 94,
"avg_line_length": 44.72875816993464,
"alnum_prop": 0.5896105793818952,
"repo_name": "DanielTakeshi/deformable-ravens",
"id": "0aafbd728ded3c727fb9518d2ce6a2c0e234ddaa",... |
from django.shortcuts import render
# Create your views here.
def angular(request):
return render(request, 'base.html') | {
"content_hash": "588783bb0272dde35bf7d3cc5168c2b1",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 39,
"avg_line_length": 24.8,
"alnum_prop": 0.7580645161290323,
"repo_name": "chackett87/GameGap",
"id": "bf3a1bdaa3972f0d990cbe3b0ea4c9901fe5988c",
"size": "124",
"binary"... |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(self, plotly_name="color", parent_name="carpet.baxis", **kwargs):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "55e5ab98c16b67e7ac1b95e231b2c30c",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 82,
"avg_line_length": 36.666666666666664,
"alnum_prop": 0.6045454545454545,
"repo_name": "plotly/python-api",
"id": "03a04003c94ab44ad69fce7f3c2b384678faab79",
"size": "44... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "ba6282df11f5c04090d512b761c28d7c",
"timestamp": "",
"source": "github",
"line_count": 139,
"max_line_length": 142,
"avg_line_length": 40.70503597122302,
"alnum_prop": 0.7143867090844821,
"repo_name": "radicalbit/ambari",
"id": "66731f80ef5a6e1be3b4e341dbc629eb76c7ce14",
"size": "5... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
("annotations", "0001_initial"),
)
def forwards(self, orm):
# Adding field 'Source.labelset'
db.add_column('images_so... | {
"content_hash": "2074d91d51fc5173c3ea9607f7fa93c5",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 182,
"avg_line_length": 71.07954545454545,
"alnum_prop": 0.538449240607514,
"repo_name": "DevangS/CoralNet",
"id": "f8655442d1c513305f032bd45b9b780c2ddfc38a",
"size": "125... |
"""A simple network to use in tests and examples."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.contrib.distribute.python import step_fn
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.framework import constant... | {
"content_hash": "8a669b42460bd719666cfe551ecff748",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 80,
"avg_line_length": 33.69318181818182,
"alnum_prop": 0.66070826306914,
"repo_name": "allenlavoie/tensorflow",
"id": "cef5fd2f8943d348a0721cd72032bf6cb2199ad9",
"size": "... |
import configparser
import yaml
import time
from PyQt4 import QtSql
class DataBase:
def __init__(self):
# get url from kagisys.conf
self.config = configparser.SafeConfigParser()
self.config.read('/home/pi/project/kagisys.conf')
url = self.config.get('Slack', 'url')
self.db = QtSql.QSqlDatabase.addDatabase... | {
"content_hash": "1adebb4c2613359e414374eaa716447e",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 67,
"avg_line_length": 27.18867924528302,
"alnum_prop": 0.6766134628730048,
"repo_name": "tnct-spc/kagisys_logic",
"id": "092c28f49f4e41140380ac3c1ec1fad597a4a1d7",
"size":... |
class StorageError(Exception):
pass
class NoSuchFile(StorageError):
pass
class FileExists(StorageError):
pass
class WaitForLockTimout(StorageError):
pass
class WaitForUnlockTimout(StorageError):
pass
| {
"content_hash": "1fd755b0e0394522b0337f1b982b11f0",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 40,
"avg_line_length": 16,
"alnum_prop": 0.7589285714285714,
"repo_name": "epegzz/StorageAlchemy",
"id": "51760b2abee95cd109be8ccb53c14bdeab2f8ae1",
"size": "248",
"binar... |
import csv
import json
import zipfile
from pprint import pformat
from cStringIO import StringIO
import grequests
from crowdflower import logger
def read_zip_csv(zf):
for zipinfo in zf.filelist:
zipinfo_fp = zf.open(zipinfo)
reader = csv.DictReader(zipinfo_fp)
for row in reader:
... | {
"content_hash": "21663fc3e52756f95bb2274d5a6ed1f3",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 481,
"avg_line_length": 32.20161290322581,
"alnum_prop": 0.5593538692712247,
"repo_name": "jfrazee/crowdflower",
"id": "c91d505bd37e9171bca9d128bd0acb870cfb94e4",
"size": ... |
from __future__ import unicode_literals
from django.apps import AppConfig
class RetailPartnersConfig(AppConfig):
name = 'retail_partners'
| {
"content_hash": "64642605d6e916f9e66b60d35ec68204",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 39,
"avg_line_length": 20.714285714285715,
"alnum_prop": 0.7724137931034483,
"repo_name": "darshanbagul/EntityManagement",
"id": "d88a40b5aae92f455a014b1c92183a729442beed",
... |
"""Resource state representation handlers for GGRC models. Builder modules will
produce specific resource state representations for GGRC models as well as
update/create GGRC model instances from resource state representations.
"""
from .json import * # noqa
class simple_property(property):
pass
| {
"content_hash": "7ae2c599515a56733811f6db7ebe0e08",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 79,
"avg_line_length": 33.44444444444444,
"alnum_prop": 0.8006644518272426,
"repo_name": "selahssea/ggrc-core",
"id": "d8e45246dcf91e0529aaaa0e6d73ca5bf4ea5689",
"size": "41... |
"""Python wrappers for the Google Storage RESTful API."""
__all__ = ['ReadBuffer',
'StreamingBuffer',
]
import collections
import os
import urlparse
from . import api_utils
from . import common
from . import errors
from . import rest_api
try:
from google.appengine.api import urlfetch
fr... | {
"content_hash": "f4d840ed6c8031ac2211c3f61480e347",
"timestamp": "",
"source": "github",
"line_count": 919,
"max_line_length": 85,
"avg_line_length": 30.652883569096844,
"alnum_prop": 0.6339013134540291,
"repo_name": "bentilly/heroes",
"id": "26254fdade028c68649df683fb31c171d4954ffa",
"size": "287... |
from django.test import TestCase
from radmin.utils import *
from radmin.console import *
class TestUtils(TestCase):
def test_radmin_import(self):
""" testing loading a module by string """
impo = radmin_import('radmin.views.sample')
self.assertEqual(impo(), 'Hi there!')
self.assertE... | {
"content_hash": "873c0fc083fd8815e6efcffbfb6b4ecc",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 71,
"avg_line_length": 37.2,
"alnum_prop": 0.6908602150537635,
"repo_name": "mick-t/django-radmin-console",
"id": "b4ccf0743f3f7b34db64b7c3813ca858f8726694",
"size": "372",... |
import unittest
import pytest
from selenium.webdriver.common.by import By
class RenderedWebElementTests(unittest.TestCase):
@pytest.mark.ignore_chrome
def testShouldPickUpStyleOfAnElement(self):
self._loadPage("javascriptPage")
element = self.driver.find_element(by=By.ID, value="green-paren... | {
"content_hash": "ab4d8c86aed4aab882460b4dd134a147",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 100,
"avg_line_length": 39.38709677419355,
"alnum_prop": 0.6781326781326781,
"repo_name": "sag-enorman/selenium",
"id": "c1fed12640b3f16f5fdf6914fd77363b8a0e2780",
"size": ... |
import os
import sys
import shutil
import subprocess
def check_sudo_status():
sudo_status = subprocess.Popen('sudo', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if "usage: sudo" not in sudo_status.stdout.read().decode('utf-8'):
print('\nThe command "sudo" dose not exists')
return False
... | {
"content_hash": "be25e7851a771bcb8a2f414c7f582d61",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 130,
"avg_line_length": 39.2972972972973,
"alnum_prop": 0.5842503438789546,
"repo_name": "wanghongjuan/meta-iotqa-1",
"id": "42cfe2fff9171cde7be2de3df7f74319a3599b51",
"siz... |
from __future__ import absolute_import
from createsend.createsend import CreateSendBase
from createsend.utils import json_to_py
class JourneyEmail(CreateSendBase):
"""Represents a journey and associated functionality"""
def __init__(self, auth=None, journey_email_id=None):
self.journey_ema... | {
"content_hash": "710caada98cb9db255ed9e43036ea8ba",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 102,
"avg_line_length": 47.02,
"alnum_prop": 0.6563164610803913,
"repo_name": "campaignmonitor/createsend-python",
"id": "fd0139481ca1f8ec4889357549b2b81cd187cc63",
"size":... |
"""Test modules for nested-dict."""
| {
"content_hash": "8e0a2f95ef91e462291410c7fa21dfdf",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 35,
"avg_line_length": 36,
"alnum_prop": 0.6666666666666666,
"repo_name": "bunbun/nested-dict",
"id": "4dd636addbf3c71a6f6475f4c296a1c8d8755f06",
"size": "36",
"binary": f... |
from __future__ import division, absolute_import, print_function
import os.path
from mock import Mock, patch, call
from tempfile import mkdtemp
from shutil import rmtree
from test._common import unittest
from test.helper import TestHelper
from beets.util import bytestring_path
from beetsplug.thumbnails import (Thumb... | {
"content_hash": "d3a32a8e825700442a1a4ebaa7976eb9",
"timestamp": "",
"source": "github",
"line_count": 276,
"max_line_length": 79,
"avg_line_length": 38.268115942028984,
"alnum_prop": 0.6014012497633024,
"repo_name": "jcoady9/beets",
"id": "fe1c80f4a860630fe1ff86b37bcc39d829aa35b9",
"size": "11229... |
from rpython.translator.c.test.test_genc import compile
from rpython.rlib.longlong2float import longlong2float, float2longlong
from rpython.rlib.longlong2float import uint2singlefloat, singlefloat2uint
from rpython.rlib.rarithmetic import r_singlefloat, r_longlong
from rpython.rtyper.test.test_llinterp import interpret... | {
"content_hash": "19e760b8ed6c37f63378a734b62a725d",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 78,
"avg_line_length": 28.88659793814433,
"alnum_prop": 0.6142041399000714,
"repo_name": "oblique-labs/pyVM",
"id": "1b39085c3bf6a0900f0334c497ac11c9bc949a6d",
"size": "280... |
from app import db
# Define a base model for other database tables to inherit
class Base(db.Model):
__abstract__ = True
id = db.Column(db.Integer, primary_key=True)
date_created = db.Column(
db.DateTime, default=db.func.current_timestamp())
date_modified = db.Column(
db.DateTime, de... | {
"content_hash": "14791e1ac48027ef6b4fae2d409aaba0",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 58,
"avg_line_length": 25.727272727272727,
"alnum_prop": 0.6378091872791519,
"repo_name": "rosaldo/large-flask-app",
"id": "47a325f3cbf2841c14678071c9f270dfe122cf1d",
"size... |
from framework.utils import OWTFLogger
from framework.dependency_management.dependency_resolver import ServiceLocator
DESCRIPTION = "Sends a bunch of URLs through selenium"
CATEGORIES = ['RCE', 'SQLI', 'XSS', 'CHARSET']
def run(PluginInfo):
Content = []
config = ServiceLocator.get_component("config")
OW... | {
"content_hash": "78d962ce7dbab69f080ce62017b41172",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 118,
"avg_line_length": 39.515151515151516,
"alnum_prop": 0.6510736196319018,
"repo_name": "DarKnight24/owtf",
"id": "9be7f93e4a259b853acf65b5567d34706c036022",
"size": "13... |
"""
Implementation of handler class and corresponding descriptor.
"""
import weakref
import inspect
from ._dict import Dict
from ._loop import loop
from . import logger
console = window = None
def this_is_js():
return False
def looks_like_method(func):
if hasattr(func, '__func__'):
return False ... | {
"content_hash": "5234ce2be4aa2bcec1ff9c3d1f30f0c0",
"timestamp": "",
"source": "github",
"line_count": 392,
"max_line_length": 87,
"avg_line_length": 36.566326530612244,
"alnum_prop": 0.5790428352169666,
"repo_name": "JohnLunzer/flexx",
"id": "577e6a5d9247b75c2e3eb6a4575ac42a42c246ce",
"size": "14... |
from collections import OrderedDict
import sqlalchemy as sa
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship, column_property, foreign, joinedload, contains_eager
from sqlalchemy.sql import select, func, exists
from sqlalchemy.dialects.postgresql import UUID, JSONB
from geoalchemy2 import Geom... | {
"content_hash": "bd3f57c7aca85ed63f0fb116d028799e",
"timestamp": "",
"source": "github",
"line_count": 470,
"max_line_length": 124,
"avg_line_length": 46.0468085106383,
"alnum_prop": 0.6968394787912393,
"repo_name": "PnEcrins/GeoNature",
"id": "031f186dc43ee7ca1d2ecb6edf4c367ad3f7f4d5",
"size": "2... |
import os
import crypt
from django.db import models
from django.conf import settings
from django.forms import CharField, Form, PasswordInput
from django.contrib.auth.models import Group
from django.utils.translation import ugettext_lazy as _
from django.utils.crypto import get_random_string
from django.contrib.auth.mo... | {
"content_hash": "4d5a194fdfd50f326b5a2776ac7e3afe",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 116,
"avg_line_length": 37.09,
"alnum_prop": 0.6443785386896738,
"repo_name": "fim/purefap",
"id": "3b82e775ff7c018180692b14df2e96f10ce30ada",
"size": "3709",
"binary": ... |
import os
import sys
import string
import random
from os import environ
from socket import getfqdn
from tempfile import NamedTemporaryFile
from lib.python.utils import detect_debug_mode, assert_command, validate_env
from lib.python.utils import mkdir_p
from lib.python.utils import log_and_stdout, apt_get_update
# Oh ... | {
"content_hash": "0c2f39018253dd499fa59c03977f0b77",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 104,
"avg_line_length": 35.63661202185792,
"alnum_prop": 0.5793145748677452,
"repo_name": "Nextdoor/rightscale_rightlink10_rightscripts",
"id": "ddbea3f8971f523f73daf0893161... |
import unittest
from RetweetFilter import RetweetFilter
class TestRetweetFilter(unittest.TestCase):
def testTweetCacheFilter(self):
retweetFilter = RetweetFilter()
firstTweet = retweetFilter.checkAndCacheTweet("I like to play with my cat, my cat is cute")
self.assertEqual(firstTweet, True)
identicalTweet =... | {
"content_hash": "47914b939b610b12d152504f2e7cdde7",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 112,
"avg_line_length": 34.04347826086956,
"alnum_prop": 0.7509578544061303,
"repo_name": "Lily418/CatHack",
"id": "3c92defc500ffbe240ceb64664a9d7287705e203",
"size": "783"... |
import platform, json, os
from utilities import printing_chdir, printing_mkdir, do_cmake
def generate_linux():
with open("settings.json") as settings_file:
settings_json = json.loads(settings_file.read())
current_directory = os.getcwd()
gcc_install_location = settings_json["gcc_install_loca... | {
"content_hash": "e6337c49c1af5c0197c89dffbcaf1c4b",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 191,
"avg_line_length": 49.8141592920354,
"alnum_prop": 0.6931959495469888,
"repo_name": "DanGrayson/cgc1",
"id": "1464e85395a1c6c0cc68258044ed8b73c31443ad",
"size": "5719... |
"""Support for Joaoapps Join services."""
import logging
from pyjoin import (
get_devices,
ring_device,
send_file,
send_notification,
send_sms,
send_url,
set_wallpaper,
)
import voluptuous as vol
from homeassistant.const import CONF_API_KEY, CONF_NAME
import homeassistant.helpers.config_va... | {
"content_hash": "06e14e3a90ee09973249141143038e9b",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 81,
"avg_line_length": 30.905797101449274,
"alnum_prop": 0.5671746776084408,
"repo_name": "Teagan42/home-assistant",
"id": "10cbcf6b5c0684a66b889be9375c4a3cc8887319",
"siz... |
from tmc import db
article_tags = db.Table('tags_joiner',
db.Column('tag_id', db.Integer, db.ForeignKey('tags.id')),
db.Column('article_id', db.Integer, db.ForeignKey('articles.id')),
db.PrimaryKeyConstraint('tag_id', 'article_id'))
class Tag(db... | {
"content_hash": "9a0ec9f986f6d2e09df5c0e874980e2d",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 117,
"avg_line_length": 45.23255813953488,
"alnum_prop": 0.6185089974293059,
"repo_name": "dougmiller/theMetaCity",
"id": "bf8da72d9a76e9315a4d4be09d89de646a5175f1",
"size"... |
from warnings import warn
from rapidsms.conf import settings
from rapidsms.utils.modules import (find_python_files, get_class,
import_class, try_import)
from .exceptions import HandlerError
from .handlers.base import BaseHandler
def get_handlers():
"""
Return a list of th... | {
"content_hash": "93dbfbb80338afb7d6767f5c4c0cab91",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 75,
"avg_line_length": 34.417910447761194,
"alnum_prop": 0.6461405030355594,
"repo_name": "peterayeni/rapidsms",
"id": "c12f667e314059d57abbd698be698f6afd366f04",
"size": ... |
from cvxpy.atoms.affine.diag import diag
from cvxpy.reductions.dgp2dcp.atom_canonicalizers.add_canon import add_canon
from cvxpy.reductions.dgp2dcp.util import explicit_sum
def trace_canon(expr, args):
diag_sum = explicit_sum(diag(args[0]))
return add_canon(diag_sum, diag_sum.args)
| {
"content_hash": "8511619c7516f575c5283dc62d76ef0b",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 76,
"avg_line_length": 36.625,
"alnum_prop": 0.7747440273037542,
"repo_name": "merraksh/cvxpy",
"id": "eb9c0f48ff462e9dbc6e919ab555065be3832a3d",
"size": "293",
"binary": ... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', 'tvenc.views.index', name='index'),
url(r'^recorded/$', 'tvenc.views.list_recorded', name='list_recorded'),
url(r'^api/', include('tvenc.api.urls')),
url(r'^... | {
"content_hash": "4ade3a456e4fc337dba0c38d9120086a",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 75,
"avg_line_length": 29.833333333333332,
"alnum_prop": 0.6675977653631285,
"repo_name": "chibiegg/tvenc",
"id": "2835a788d9c8a39c23b95c3c50833122e153df51",
"size": "358",... |
from __future__ import absolute_import, unicode_literals
import os
from setuptools import find_packages, setup
version = __import__('logtailer').__version__
def read(fname):
# read the contents of a text file
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="django-logtai... | {
"content_hash": "e3ae5f30ea2d5c450d047469c3cb9642",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 74,
"avg_line_length": 33.074074074074076,
"alnum_prop": 0.5968645016797313,
"repo_name": "fireantology/django-logtailer",
"id": "8486a58f4c6af8bafcf14ae7218c13838617a5e4",
... |
"""
Builder for Nordic nRF51 series ARM microcontrollers.
"""
from os.path import join
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Default,
DefaultEnvironment, SConscript)
env = DefaultEnvironment()
SConscript(env.subst(join("$PIOBUILDER_DIR", "scripts", "basearm.py"))... | {
"content_hash": "df4b67b511336ff4d3361938b90d6416",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 75,
"avg_line_length": 20.148936170212767,
"alnum_prop": 0.6948257655755016,
"repo_name": "mcanthony/platformio",
"id": "caed2f55874d6ac7084d074f3f77baa1398228ec",
"size": ... |
"""Abstract classes."""
from __future__ import absolute_import, unicode_literals
import abc
from collections import Callable
from .five import with_metaclass
__all__ = ['Thenable']
@with_metaclass(abc.ABCMeta)
class Thenable(Callable): # pragma: no cover
"""Object that supports ``.then()``."""
__slots__... | {
"content_hash": "7856431aa0968ee171d91a417e997ed4",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 74,
"avg_line_length": 23.283783783783782,
"alnum_prop": 0.620429483459083,
"repo_name": "ammarkhann/FinalSeniorCode",
"id": "5c8d381e9e86154f14c09165805343d2eb1cd414",
"si... |
import unittest
from unittest import mock
import pytest
from airflow import DAG
from airflow.exceptions import AirflowException
from airflow.sensors.sql_sensor import SqlSensor
from airflow.utils.timezone import datetime
DEFAULT_DATE = datetime(2015, 1, 1)
TEST_DAG_ID = 'unit_test_sql_dag'
class TestSqlSensor(unit... | {
"content_hash": "5ad5c6ba896d3c69fb0bcb2b17f659cf",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 98,
"avg_line_length": 35.05701754385965,
"alnum_prop": 0.6085324659076692,
"repo_name": "wileeam/airflow",
"id": "cc228e14e3b8713540906fb728647bcc764ac545",
"size": "8780... |
from oslo_log import log
from neutron._i18n import _
from neutron.plugins.ml2 import driver_api as api
LOG = log.getLogger(__name__)
class LoggerMechanismDriver(api.MechanismDriver):
"""Mechanism driver that logs all calls and parameters made.
Generally used for testing and debugging.
"""
def init... | {
"content_hash": "30fcfb80d731cc92097e27d23b1b8cad",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 73,
"avg_line_length": 40.495726495726494,
"alnum_prop": 0.6072182355424229,
"repo_name": "dims/neutron",
"id": "93b1f53ff5168c3c366e61348cc4924b8648e4e9",
"size": "5378",... |
"""Implementation of compile_html based on odfpy.
You will need, of course, to install odfpy
"""
import os
import io
import shutil
import lxml.etree as etree
from nikola.plugin_categories import PageCompiler
from nikola.utils import makedirs, req_missing
try:
from odf.odf2xhtml import ODF2XHTML
except ImportE... | {
"content_hash": "30a2f4cda14358ba00a72dc5df824f94",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 85,
"avg_line_length": 30.27027027027027,
"alnum_prop": 0.6133928571428572,
"repo_name": "getnikola/plugins",
"id": "aab3e94cfcbd8d15dab04e7f9a17c0b0a22186c0",
"size": "337... |
class GameHangman:
def __init__(self, word, total_tries=10):
self.word = word.lower()
self.right_letters = []
self.wrong_letters = []
self.total_tries = total_tries
self.tries = 0
@property
def tries_left(self):
return self.total_tries - self.tries
@pro... | {
"content_hash": "54efd63e45556dbd63c84ace7c57c3ec",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 105,
"avg_line_length": 29.054054054054053,
"alnum_prop": 0.5572093023255814,
"repo_name": "shikhir-arora/Giesela",
"id": "7e1ea3a8e6eb8d35a16b1c53c2af898d926567ca",
"size"... |
class Selector:
def __init__(self, t, ln):
import cssqc.parser
self.lineno = ln
if t is None:
self.text = []
else:
self.text = t
i = cssqc.parser.CSSQC.getInstance()
if i is not None:
i.register(self.__class__.__na... | {
"content_hash": "2939d97404220c0259b6ac792dda0425",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 89,
"avg_line_length": 26.964285714285715,
"alnum_prop": 0.47549668874172185,
"repo_name": "matematik7/CSSQC",
"id": "b172f1cb465d67d2842e9c3adeb35f91895cabfc",
"size": "11... |
import sys
from collections import OrderedDict
from types import MappingProxyType, DynamicClassAttribute
__all__ = ['Enum', 'IntEnum', 'unique']
def _is_descriptor(obj):
"""Returns True if obj is a descriptor, False otherwise."""
return (
hasattr(obj, '__get__') or
hasattr(obj, '__set... | {
"content_hash": "54c647c1327692b4880eae10f278cd1d",
"timestamp": "",
"source": "github",
"line_count": 568,
"max_line_length": 99,
"avg_line_length": 38.91021126760563,
"alnum_prop": 0.5622370028505498,
"repo_name": "juanyaw/python",
"id": "c28f3452a75372a5a61c068e975ebd44ddd4540f",
"size": "22101... |
"""
Copyright 2015-2018 Jacob M. Graving <jgraving@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag... | {
"content_hash": "8fc7b1020f4cd524c13bba31cbfa84bb",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 80,
"avg_line_length": 31.233962264150943,
"alnum_prop": 0.4670774435181829,
"repo_name": "jgraving/pinpoint",
"id": "9977df18404e2acd9ff0b1728bc507c73671eae9",
"size": "8... |
r"""Create a dataset for training and evaluating the basic RNN model.
Example usage:
$ bazel build magenta/models/basic_rnn:basic_rnn_create_dataset
$ ./bazel-bin/magenta/models/basic_rnn/basic_rnn_create_dataset \
--input=/tmp/note_sequences.tfrecord \
--output_dir=/tmp/basic_rnn \
--eval_ratio=0.10
... | {
"content_hash": "38afd838fbc820d4937324507e71981e",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 78,
"avg_line_length": 25.257142857142856,
"alnum_prop": 0.7352941176470589,
"repo_name": "hanzorama/magenta",
"id": "8355267811a44de2263d9a986eb739c8e187650a",
"size": "14... |
from __future__ import unicode_literals
from django.db import models, migrations
import sortedm2m.fields
import sortedm2m.operations
class Migration(migrations.Migration):
dependencies = [
('altersortedmanytomanyfield_tests', '0001_initial'),
]
operations = [
sortedm2m.operations.AlterS... | {
"content_hash": "bbc77b36ded41ed8aad6104c0e7b9e0e",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 119,
"avg_line_length": 30.925925925925927,
"alnum_prop": 0.6622754491017964,
"repo_name": "gradel/django-sortedm2m",
"id": "6d072596a80894b8df96b2a5ef1d81bbac2df81f",
"siz... |
"""PValue, PCollection: one node of a dataflow graph.
A node of a dataflow processing graph is a PValue. Currently, there is only
one type: PCollection (a potentially very large set of arbitrary values).
Once created, a PValue belongs to a pipeline and has an associated
transform (of type PTransform), which describes ... | {
"content_hash": "5f8576616124761c48d2e74d7a9c9cb2",
"timestamp": "",
"source": "github",
"line_count": 617,
"max_line_length": 94,
"avg_line_length": 33.233387358184764,
"alnum_prop": 0.6803706413069983,
"repo_name": "RyanSkraba/beam",
"id": "1aa89136b6933882d7c45e3e8889fafdb554b626",
"size": "212... |
"""Loaders for deserializing records in the REST API."""
from .marshmallow import json_patch_loader, marshmallow_loader
from ..schemas import RecordSchemaJSONV1
json_v1 = marshmallow_loader(RecordSchemaJSONV1)
"""Simple example loader that will take any JSON."""
json_patch_v1 = json_patch_loader
"""Simple example lo... | {
"content_hash": "4af1c1b50a691433617041a369041646",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 62,
"avg_line_length": 27.6,
"alnum_prop": 0.7294685990338164,
"repo_name": "tiborsimko/invenio-records-rest",
"id": "84aef63f0cf62de204dc15bbfac5bdd1066d311c",
"size": "64... |
"""Utility functions for Kalibrate output paring."""
import decimal
from . import sanity
def options_string_builder(option_mapping, args):
"""Return arguments for CLI invocation of kal."""
options_string = ""
for option, flag in option_mapping.items():
if option in args:
options_strin... | {
"content_hash": "6717fa2cbac433d58d3d2f700b63d956",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 76,
"avg_line_length": 34.148648648648646,
"alnum_prop": 0.5621949610869278,
"repo_name": "ashmastaflash/kal-wrapper",
"id": "ac51a438db54bb1d9e4cc155e0110201eddafd0b",
"s... |
"""
ORCID Member
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: Latest
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class FamilyN... | {
"content_hash": "bc05f58835599630d9dcdd862b1b703d",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 119,
"avg_line_length": 28.01834862385321,
"alnum_prop": 0.5399476096922069,
"repo_name": "Royal-Society-of-New-Zealand/NZ-ORCID-Hub",
"id": "fddfee29b3ba8c01f3ecc5f59064cea... |
"""This module contains SFTP operator."""
import os
from pathlib import Path
from typing import Any
from airflow.exceptions import AirflowException
from airflow.models import BaseOperator
from airflow.providers.ssh.hooks.ssh import SSHHook
class SFTPOperation:
"""Operation that can be used with SFTP/"""
PUT... | {
"content_hash": "ce6587bcf35196a894b5f5d75189bd1d",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 108,
"avg_line_length": 40.41104294478528,
"alnum_prop": 0.599514194625778,
"repo_name": "apache/incubator-airflow",
"id": "3a1d023a9a414145ded452195e68427921a56886",
"siz... |
"""Test Chipsec client actions."""
__author__ = "Thiebaud Weksteen <tweksteen@gmail.com>"
import collections
import sys
import mock
from chipsec.helper import oshelper
from grr.client import vfs
from grr.client.components.chipsec_support.actions import chipsec_types
from grr.lib import flags
from grr.lib import tes... | {
"content_hash": "ae2811934545d03551bebc63e1688a14",
"timestamp": "",
"source": "github",
"line_count": 255,
"max_line_length": 78,
"avg_line_length": 38.43529411764706,
"alnum_prop": 0.7117641057034997,
"repo_name": "destijl/grr",
"id": "2eef197035239c7e6fcecd07789c5a6a07b88b9f",
"size": "9823",
... |
import os
import glob
import sys
import json
sys.path.append(os.path.abspath(".."))
os.environ['DJANGO_SETTINGS_MODULE'] = 'ocrsite.settings'
from ocrlab import nodes as nodetree_nodes
from nodetree import script, registry
def run(nodelist, outpath):
s = script.Script(nodelist)
term = s.get_terminals()[0]
... | {
"content_hash": "817501bc41886874564a6cd425058d5c",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 57,
"avg_line_length": 24.444444444444443,
"alnum_prop": 0.6102272727272727,
"repo_name": "mikesname/python-ocrlab",
"id": "9c4e898ba22dd21327a1ed89c8d7ecbc6c77b9f6",
"size... |
def compareAndRep(numbers , a , b):
temp = numbers[a]
numbers[a] = numbers[b]
numbers[b] = temp
return numbers
def printList(numbers):
strp = ""
for i in range(0 , len(numbers)):
strp += str(numbers[i])
if(i+1 < len(numbers)):
strp += " "
print strp
N = int(raw_input())
numbers = map(int , raw_input()... | {
"content_hash": "e48f75398af3be31df2a9bd2e3f2139e",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 51,
"avg_line_length": 21.217391304347824,
"alnum_prop": 0.6086065573770492,
"repo_name": "MajidLashgarian/HackerRank",
"id": "d09779b44258db67cf126ad9856a6bb1a0d2cb6f",
"s... |
import json
import decimal #for rounding totals
##### HOSPITAL ASSOCIATED INFECTIONS #####
f = open( '../src/assets/data/src/HAI_transposed.json', 'rU' )
src = json.load(f)
f.close()
tree = []
ratingClasses = {"No Different than National Benchmark":"normal", "Better than the National Benchmark":"good", "Worse than th... | {
"content_hash": "ae40d81294a0eaac00e741cdb15df8fc",
"timestamp": "",
"source": "github",
"line_count": 243,
"max_line_length": 583,
"avg_line_length": 44.864197530864196,
"alnum_prop": 0.6341955604476243,
"repo_name": "NewsappAJC/hospitalCheckup",
"id": "bc59ae34388912dbafa53654bec2a8fc05290b52",
... |
"""
This is the Docutils (Python Documentation Utilities) package.
Package Structure
=================
Modules:
- __init__.py: Contains component base classes, exception classes, and
Docutils version information.
- core.py: Contains the ``Publisher`` class and ``publish_*()`` convenience
functions.
- frontend.... | {
"content_hash": "9827f6812757b38f87ba5337fcee4dca",
"timestamp": "",
"source": "github",
"line_count": 200,
"max_line_length": 81,
"avg_line_length": 34.74,
"alnum_prop": 0.6971790443293034,
"repo_name": "akiokio/centralfitestoque",
"id": "ee78b43c56e6a0705cb9fb668b924987fca2145d",
"size": "7112",... |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, DateTime
from itsdangerous import URLSafeTimedSerializer
from enum import Enum
import AppConfig
Base = declarative_base()
login_serializer = URLSafeTimedSerializer(AppConfig.APPSECRETKEY)
class UserPrivileges(E... | {
"content_hash": "b562de22f1ce7f0ec0605e87cc80b86d",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 86,
"avg_line_length": 23.85,
"alnum_prop": 0.6582809224318659,
"repo_name": "mandrive/FlaskTest",
"id": "b5e5c217921d6376b82cff02a34037a380c2d467",
"size": "1431",
"bina... |
import inspect
from pprint import pprint
import example
pprint(inspect.getmembers(example.B, inspect.isfunction))
| {
"content_hash": "925dc9b5618d9dad7f5e3dcbbd5a44a0",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 57,
"avg_line_length": 19.333333333333332,
"alnum_prop": 0.8275862068965517,
"repo_name": "jasonwee/asus-rt-n14uhp-mrtg",
"id": "7ee9a8b8ae242dab3019f8cc9e7d3cba9dabc3c9",
"... |
"""
.. module:: freebayes
:platform: Unix, OSX
:synopsis: A wrapper module for calling ScanIndel.
.. moduleauthor:: Daniel Gaston <daniel.gaston@dal.ca>
"""
from ddb_ngsflow import pipeline
def run_flt3_itdseek(job, config, name):
"""Run ITDseek without a matched normal sample
:param config: The confi... | {
"content_hash": "c53fa37e483b8231d02201346e7af94a",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 78,
"avg_line_length": 31.91176470588235,
"alnum_prop": 0.5898617511520737,
"repo_name": "dgaston/ddbio-ngsflow",
"id": "409c10726420a266b59161e26730972f055dcae8",
"size": ... |
import os
from serenata_toolbox import log, settings
from serenata_toolbox.datasets.downloader import Downloader
from serenata_toolbox.datasets.local import LocalDatasets
class Datasets:
"""
This is a wrapper for three different classes that together handle the
datasets locally and the download of new on... | {
"content_hash": "2a9737611b8237f54e07a2ba558328cd",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 82,
"avg_line_length": 35.5,
"alnum_prop": 0.7105860972285325,
"repo_name": "datasciencebr/serenata-toolbox",
"id": "287fea258e54c23feac5a4c87153e3eb583bd0c7",
"size": "220... |
import pandas as pd
import pemi
class SaSqlSourcePipe(pemi.Pipe):
def __init__(self, *, sql, engine, schema=None, result=True, chunk_size=None):
super().__init__()
self.sql = sql
self.engine = engine
self.schema = schema
self.result = result
self.chunk_size = chunk... | {
"content_hash": "6561a960548d510c09f82eeaff3d7b5d",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 84,
"avg_line_length": 26.387096774193548,
"alnum_prop": 0.5287286063569682,
"repo_name": "inside-track/pemi",
"id": "68ff1a4f5b3a37fc7d3654254be9c5b12183fa02",
"size": "16... |
import os
from errno import EEXIST
from os.path import isdir
import requests
from django.apps import apps
from django.core.management.color import no_style
from django.core.serializers import deserialize
from django.db import connection
from django.db.models import ImageField
def puts(value):
try:
verbos... | {
"content_hash": "7de5b3ae14844115a397ad4df1748672",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 76,
"avg_line_length": 25.83076923076923,
"alnum_prop": 0.6203097081596188,
"repo_name": "prestontimmons/django-synctool",
"id": "92d4a790ec5d1b131a521352f3a1a7600bdc2104",
... |
from files import VariableByte
from unittest import TestCase
class TestVariableByte(TestCase):
def setUp(self):
self.numbers_input = [777, 1234, 2551, 16]
self.byte_input = b'\x06\x89\t\xd2\x13\xf7\x90'
def test_encoding(self):
res = b'\x06\x89\t\xd2\x13\xf7\x90'
self.assertE... | {
"content_hash": "23d38dab10a2b2d1a2fc632e4395aefa",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 72,
"avg_line_length": 29.88235294117647,
"alnum_prop": 0.6653543307086615,
"repo_name": "Xia0ben/IQPlayground",
"id": "1a84426fb319345feefe76ea7a0e681bb682c1a6",
"size": "... |
"""Volume v1 Snapshot action implementations"""
import copy
import functools
import logging
from cliff import columns as cliff_columns
from osc_lib.cli import format_columns
from osc_lib.cli import parseractions
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
from opensta... | {
"content_hash": "d674d4be28ccc13d1ab21534d73d280e",
"timestamp": "",
"source": "github",
"line_count": 360,
"max_line_length": 78,
"avg_line_length": 33.81944444444444,
"alnum_prop": 0.5420123203285421,
"repo_name": "dtroyer/python-openstackclient",
"id": "966db48ff1e7dc6085977ba38bf27b33306cdfe5",
... |
#!/usr/bin/env python
#
# Appcelerator Titanium Module Packager
#
#
import os, subprocess, sys, glob, string
import zipfile
from datetime import date
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
os.chdir(cwd)
required_module_keys = ['name','version','moduleid','description','copyright','... | {
"content_hash": "7c0be0ff24da598574b95b2092fdd7cc",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 125,
"avg_line_length": 30.44843049327354,
"alnum_prop": 0.6905743740795287,
"repo_name": "reydelamirienda/Titanium.UIActivityViewController",
"id": "2a0e7a82c181cfad44fe1d1... |
import percolation as P, social as S, rdflib as r, builtins as B, re, datetime, os, shutil
c=P.utils.check
class GDFTriplification:
"""Produce a linked data publication tree from a standard GDF file.
INPUTS:
======
=> the data directory path
=> the file name (filename_friendship) of the friendship... | {
"content_hash": "b0910d5e1bb4beb2ed5d1833445c4fe2",
"timestamp": "",
"source": "github",
"line_count": 373,
"max_line_length": 128,
"avg_line_length": 49.14477211796247,
"alnum_prop": 0.5138290327859909,
"repo_name": "ttm/socialLegacy",
"id": "033702a36202f23072abcd60a21617d924032cba",
"size": "18... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.