text stringlengths 4 1.02M | meta dict |
|---|---|
from contextlib import contextmanager
from errno import EACCES, EAGAIN
from fcntl import lockf, LOCK_NB
import os
import socket
def openlock(filename, operation, wait=True):
"""
Returns a file-like object that gets a fnctl() lock.
`operation` should be one of LOCK_SH or LOCK_EX for shared or
exclusiv... | {
"content_hash": "48635c72cb960df442f0277a8517226c",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 79,
"avg_line_length": 30.45098039215686,
"alnum_prop": 0.6445589182227945,
"repo_name": "e-loue/django-lean",
"id": "ecf138b3a1b0a0354c3df50d2d6f6cd6d0cde96e",
"size": "15... |
import math
import time
import random
class Trace(object):
"""
An L{ITrace} provider which delegates to zero or more L{ITracers} and
allows setting a default L{IEndpoint} to associate with L{IAnnotation}s
@ivar _tracers: C{list} of one or more L{ITracer} providers.
@ivar _endpoint: An L{IEndpoint... | {
"content_hash": "3867d0783487518249fe6f4efe34e5a1",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 78,
"avg_line_length": 30.445255474452555,
"alnum_prop": 0.5900263725725245,
"repo_name": "marioskogias/blkin",
"id": "e0a3ed2c3a3ed76eecf722150e11cbc944338adc",
"size": "... |
from rest_framework.exceptions import APIException
from rest_framework import status
# AC Service exceptions
class ACException(Exception):
msg = None
status = None
def __init__(self, msg=None, status=None):
# Set defaults (if not set in subclass)
if self.msg is None:
self.ms... | {
"content_hash": "0f3236d98645fb45ac3248b0b5a6f4f2",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 93,
"avg_line_length": 25.321739130434782,
"alnum_prop": 0.7060439560439561,
"repo_name": "AudioCommons/ac-mediator",
"id": "9da87b0350b1ac6ffa3da3d0d533cb0cff3602e5",
"si... |
"""
Random walk
-----------
"""
def random_walk(game):
"""
Solves MasterMind by throwing out random codes.
On average takes about 5 time n guesses, where n
is the number of possible solutions of the Mastermind Game.
For 6\ :sup:`4`, this means about 6000 guesses.
Re... | {
"content_hash": "ae7afc65a55759dd3ff8a583be806dfd",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 67,
"avg_line_length": 27.571428571428573,
"alnum_prop": 0.5803108808290155,
"repo_name": "Eberhofer/MasterMind",
"id": "e1c8fdfb0a0359ae1173d1c09b77a152715d6610",
"size": ... |
"""
uru_crm.modules.veggies
~~~~~~~~~~~~~~~~~~
Available_Veggie model definition(s)
"""
from sqlalchemy import Column
from uru_crm.extensions import db
from uru_crm.utils import STRING_LEN
from uru_crm.modules.base import Base
class Available_Veggie(Base):
veggie = db.Column(db.String(STRING_LEN), ... | {
"content_hash": "e6ca6acedf8193f3ced8e0b93663532e",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 63,
"avg_line_length": 25.555555555555557,
"alnum_prop": 0.7,
"repo_name": "gitbenji/uru-crm",
"id": "05a7eaf3dc63aee1b283f44ffd07465f9653be1e",
"size": "484",
"binary": ... |
"""Unittests for completion stages."""
from __future__ import print_function
import mock
from chromite.cbuildbot import commands
from chromite.cbuildbot import manifest_version
from chromite.cbuildbot import prebuilts
from chromite.cbuildbot.stages import completion_stages
from chromite.cbuildbot.stages import gener... | {
"content_hash": "fed24869f74703c0d0551428cceb3f98",
"timestamp": "",
"source": "github",
"line_count": 337,
"max_line_length": 80,
"avg_line_length": 35.51632047477745,
"alnum_prop": 0.6642994402205699,
"repo_name": "endlessm/chromium-browser",
"id": "c64a862c12dc8ec4b7524855ee2e0444818e707d",
"si... |
from __future__ import absolute_import
from django.utils import timezone
from sentry.testutils import AcceptanceTestCase
class ProjectIssuesTest(AcceptanceTestCase):
def setUp(self):
super(ProjectIssuesTest, self).setUp()
self.user = self.create_user('foo@example.com')
self.org = self.cr... | {
"content_hash": "1cdb570f6507036c030e097bfadee8b0",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 81,
"avg_line_length": 37.608695652173914,
"alnum_prop": 0.6473988439306358,
"repo_name": "jean/sentry",
"id": "45f2dfff7986c7a0076a523d705b1d42798c58f9",
"size": "1730",
... |
import numpy as np
import os.path as op
from numpy.testing import assert_array_almost_equal, assert_array_equal
from nose.tools import assert_true, assert_false, assert_equal, assert_raises
import mne
from mne import Epochs, read_events, pick_types, create_info, EpochsArray
from mne.io import read_raw_fif
from mne.uti... | {
"content_hash": "268a97848b16446c412706ad59d55e85",
"timestamp": "",
"source": "github",
"line_count": 563,
"max_line_length": 79,
"avg_line_length": 40.38721136767318,
"alnum_prop": 0.5876066496613599,
"repo_name": "jaeilepp/mne-python",
"id": "6080075b7948f14b2dbe8eb18fb8a3bcf476d6aa",
"size": "... |
import io
import os
import sys
import time
import base64
from IOST_Prepare import *
from IOST_Config import *
from IOST_Basic import *
from IOST_Host import *
import vte
import ConfigParser
import pango
#======================================================================
shortcuts={}
_COP... | {
"content_hash": "d6ef03fc56656d043e913483278e6dc6",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 112,
"avg_line_length": 41.4169741697417,
"alnum_prop": 0.3776728439059159,
"repo_name": "HPPTECH/hpp_IOSTressTest",
"id": "af56318f9964109d3dd183bf2b420d524af9a664",
"siz... |
"""
Tests for Timestamp timezone-related methods
"""
from datetime import datetime, date, timedelta
from distutils.version import LooseVersion
import pytest
import pytz
from pytz.exceptions import AmbiguousTimeError, NonExistentTimeError
import dateutil
from dateutil.tz import gettz, tzoffset
import pandas.util.testi... | {
"content_hash": "6bf6b0bb009b6fc718f5333a1b941be4",
"timestamp": "",
"source": "github",
"line_count": 308,
"max_line_length": 79,
"avg_line_length": 40.55194805194805,
"alnum_prop": 0.5910328262610088,
"repo_name": "cython-testbed/pandas",
"id": "8cebfafeae82a3c80097e690e7120e7b0d181683",
"size":... |
"""Power cycle devices using the 'Mbed TAS RM REST API'."""
import os
import json
import time
import requests
from .host_test_plugins import HostTestPluginBase
class HostTestPluginPowerCycleResetMethod(HostTestPluginBase):
"""Plugin interface adaptor for Mbed TAS RM REST API."""
name = "HostTestPluginPowerC... | {
"content_hash": "079e0c941238322bce1e9493cb2f179b",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 85,
"avg_line_length": 32.6536312849162,
"alnum_prop": 0.5011120615911036,
"repo_name": "ARMmbed/greentea",
"id": "8b22bc055554d9cbbe0d9bc46f4f4d825db98f11",
"size": "5959... |
import logging as _logging
from scli.constants import ParameterName as Name
from scli.terminal.base import TerminalBase
from scli.terminal.beanstalk_terminal import BeanstalkTerminal
from scli.terminal.service_terminal import ServiceTerminal
from scli.terminal.rds_terminal import RdsTerminal
log = _logging.getLogger... | {
"content_hash": "f759f647382060aadd94a7d689665f1f",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 91,
"avg_line_length": 40.470588235294116,
"alnum_prop": 0.6494186046511627,
"repo_name": "JoaoVasques/aws-devtool",
"id": "aee34190fed56f75785d68fa938424972fa8aa4a",
"size... |
from collections.abc import Sequence
import numpy as np
import pytest
try:
import rowan
skip_rowan = False
except ImportError:
skip_rowan = True
import hoomd
import hoomd.md as md
skip_rowan = pytest.mark.skipif(skip_rowan, reason="rowan cannot be imported.")
@pytest.fixture
def valid_body_definition(... | {
"content_hash": "6097592350fad3fb9e88190e4a4e37d5",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 79,
"avg_line_length": 37.82333333333333,
"alnum_prop": 0.6198995329161893,
"repo_name": "joaander/hoomd-blue",
"id": "642e26ef6552f4649a35294c5f6766ab33b60852",
"size": "... |
from .composition_parts import DebugInfo
from .composition_parts import WithIdentifier
class Proxy(object):
"""
Proxies attribute access on this object to the target object.
"""
def __init__(self,
target_object=None,
target_attrs=None,
target_attrs_w... | {
"content_hash": "70ee681ae4b941495dcc6ccf557acbff",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 80,
"avg_line_length": 37.71356783919598,
"alnum_prop": 0.6131912058627582,
"repo_name": "chromium/chromium",
"id": "8de5e54524c977fe14585aeff44fb8f92cbd79f7",
"size": "76... |
import os
import sys
import json
import time
import requests
from uai.utils.utils import _verfy_ac
from uai.utils.logger import uai_logger
from uaitrain.arch_conf.base_conf import *
from uai.utils.retcode_checker import *
MAX_POLL_STEPS = 200
DEPLOY_ID_FILE = './deploy_id.log'
UCLOUD_API_URL = 'http://api.ucloud.cn'
P... | {
"content_hash": "38796a23279b71f49e6f62ea3aa6266c",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 144,
"avg_line_length": 47.73118279569893,
"alnum_prop": 0.5839152962378914,
"repo_name": "ucloud/uai-sdk",
"id": "ce4515946289ce8cdf8ac5f5e1dc5fb71ecc58e4",
"size": "9565... |
import ftplib
import os
import paramiko
from nova import exception as nova_exception
from nova.openstack.common import log as logging
from nova.virt.powervm import exception
LOG = logging.getLogger(__name__)
class Connection(object):
def __init__(self, host, username, password, port=22):
self.host = h... | {
"content_hash": "3bf82085e47d282b16452fa1ad5170d2",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 77,
"avg_line_length": 34.77857142857143,
"alnum_prop": 0.6181967549804888,
"repo_name": "fajoy/nova",
"id": "bf69be84e03d9a73564b871b20ac4971d537ce9a",
"size": "5510",
... |
"""
Support for switches which integrates with other components.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.template/
"""
import logging
from homeassistant.components.switch import ENTITY_ID_FORMAT, SwitchDevice
from homeassistant.const impor... | {
"content_hash": "25ca82d1a94cd4d37fcd2b6655d34e45",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 77,
"avg_line_length": 31.885906040268456,
"alnum_prop": 0.5981898547674174,
"repo_name": "hmronline/home-assistant",
"id": "ebb3cb422589516bb08f20f7e4de9620f63be60f",
"si... |
from django.db import models
class Project(models.Model):
name = models.CharField(max_length=10)
url = models.URLField()
project_query = models.TextField()
epics_query = models.TextField()
stories_query = models.TextField()
tasks_query = models.TextField()
def __unicode__(self):
retu... | {
"content_hash": "c2923234054c5d2e81dc3818423848db",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 42,
"avg_line_length": 27.666666666666668,
"alnum_prop": 0.6807228915662651,
"repo_name": "purplecode/probable.backlog",
"id": "2449236410b93213b556f8a74781c7f4d2433533",
"... |
from flask import current_app, flash, redirect, render_template, request, session, url_for, make_response
from flask_login import current_user, login_required, login_user, logout_user
from sqlalchemy.exc import IntegrityError
from app import login_manager, db
from app.auth import auth
from app.auth.forms import LoginF... | {
"content_hash": "bf479d7829c415d99fdfde01d093f0df",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 197,
"avg_line_length": 43.35807860262009,
"alnum_prop": 0.5956289656561587,
"repo_name": "nycrecords/intranet",
"id": "566c97c3d9f680e6429ce477b6e4928b58152579",
"size": ... |
"""
This module holds the quantization config class object that is accessed globally by library modules.
DIRECT USE OF THIS MODULE BY USER IS PROHIBITED.
"""
# List that holds quantization config class object, Length is always one!
# Object is added automatically on class creation
G_CONFIG_OBJECT = []
def add_config... | {
"content_hash": "a0af0424063ff8ab8262ac122ce5e3b6",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 100,
"avg_line_length": 29.304347826086957,
"alnum_prop": 0.6676557863501483,
"repo_name": "NVIDIA/TensorRT",
"id": "c2595bfa0f307a108c94839e2d0a395b33724274",
"size": "203... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import pytest
from rasa_nlu.utils import relative_normpath, recursively_find_files
def test_relative_normpath():
assert relative_normpath("/my/test/path/file.txt",... | {
"content_hash": "7a98474723a3eeae1d8939605a256296",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 85,
"avg_line_length": 32.291666666666664,
"alnum_prop": 0.7380645161290322,
"repo_name": "verloop/rasa_nlu",
"id": "67c5a2c149d70ef0dcf4d1af75bf003123596a13",
"size": "775... |
from django.db import models
from django.contrib.auth.models import User, Group
from common.middleware import get_current_user
class Favorite(models.Model):
"""
Model representing a favorite
"""
user = models.ForeignKey(User, help_text="Owner user")
fname = models.CharField(max_length=100, help_te... | {
"content_hash": "173d9385eb70850e5e05104193ae86b3",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 77,
"avg_line_length": 35.44,
"alnum_prop": 0.6501128668171557,
"repo_name": "prabhu/pynationalrail",
"id": "adb61a548ef6ed306b742d2d0f327947d8898052",
"size": "886",
"bi... |
from unittest.mock import patch
import matplotlib.pyplot as plt
import pytest
from astropy import units as u
from astropy.io import fits
from astropy.utils.data import get_pkg_data_filename
from astropy.visualization.wcsaxes.core import WCSAxes
from astropy.wcs import WCS
MSX_HEADER = fits.Header.fromtextfile(get_pk... | {
"content_hash": "105b722bb14381c6ebff435983d886f9",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 79,
"avg_line_length": 27.25423728813559,
"alnum_prop": 0.6632462686567164,
"repo_name": "larrybradley/astropy",
"id": "701bf0d0bfd16c54c2591e74868cbba5ae9eee17",
"size": ... |
from six import PY3
import sys
from robot.utils import NormalizedDict
class Metadata(NormalizedDict):
def __init__(self, initial=None):
NormalizedDict.__init__(self, initial, ignore='_')
def __unicode__(self):
return u'{%s}' % ', '.join('%s: %s' % (k, self[k]) for k in self)
def __str... | {
"content_hash": "2a18d08ee2303515d687bfd81e197ff7",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 73,
"avg_line_length": 22.91304347826087,
"alnum_prop": 0.5692599620493358,
"repo_name": "userzimmermann/robotframework-python3",
"id": "23f6da6cae72a408979f1bd5baef9b0cf457a... |
import argparse
import itertools
import logging
import os
import subprocess
import sys
from ..manifest import manifest, update
here = os.path.dirname(__file__)
wpt_root = os.path.abspath(os.path.join(here, os.pardir, os.pardir))
logger = logging.getLogger()
def get_git_cmd(repo_path):
"""Create a function for ... | {
"content_hash": "9e420cbab49b57de233edd501623205f",
"timestamp": "",
"source": "github",
"line_count": 286,
"max_line_length": 133,
"avg_line_length": 40.44055944055944,
"alnum_prop": 0.5895728860453052,
"repo_name": "youtube/cobalt",
"id": "89e6e2764aeaed264951f1358c5377ec608856b8",
"size": "1156... |
"""
Remove tweets containing labels we don't want.
Constantine Lignos
February 2013
"""
# Copyright (c) 2013 Constantine Lignos
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistribu... | {
"content_hash": "60c6b48897ace7c7f3d3096fb342de2d",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 77,
"avg_line_length": 36.01724137931034,
"alnum_prop": 0.7410244135950216,
"repo_name": "ConstantineLignos/Codeswitchador",
"id": "895766d88d44ff97cfa5849c38cf5775698b6ef8",... |
from abc import abstractmethod, ABCMeta
from .security import Permissions, require
from .utils import json_response, validate_query
class AbstractResource(metaclass=ABCMeta):
def __init__(self, *, primary_key, resource_name=None):
class_name = self.__class__.__name__.lower()
self._resource_name ... | {
"content_hash": "ac02a438ecf9d2834628ed447817c8c4",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 64,
"avg_line_length": 33.403225806451616,
"alnum_prop": 0.632061805890874,
"repo_name": "jettify/aiohttp_admin",
"id": "c8ad8277a5d96ff6375522f6a96476c97f88154e",
"size": ... |
from django.conf.urls import *
from SAMPLEAPP.views import *
urlpatterns = patterns('',
#url(r'^SAMPLEAPP/foo/$', SAMPLEAPPView.as_view(), name='SAMPLEAPP_view'),
) | {
"content_hash": "0b2cb27c8c032b45196c9f95d1d399ee",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 82,
"avg_line_length": 28.833333333333332,
"alnum_prop": 0.6878612716763006,
"repo_name": "auzigog/jbrinkerhoff.com",
"id": "4cf3e8fe2cb3fff34507b9b0453568932717a198",
"size... |
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
im... | {
"content_hash": "3cbf547fbbf83223feffc10f14645764",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 105,
"avg_line_length": 22.65,
"alnum_prop": 0.7130242825607064,
"repo_name": "djkonro/client-python",
"id": "782131f15ad513a1937480c4c9c53a1bd9a19042",
"size": "923",
"b... |
import os
import logging
from dessn.framework.fitter import Fitter
from dessn.framework.models.approx_model import ApproximateModel
from dessn.framework.simulations.snana_sys import SNANASysSimulation
from dessn.framework.simulations.selection_effects import lowz_sel, des_sel
from chainconsumer import ChainConsumer
i... | {
"content_hash": "72c8b11225bb6e3f2c925017559f3eb6",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 112,
"avg_line_length": 51.833333333333336,
"alnum_prop": 0.6312968917470525,
"repo_name": "dessn/sn-bhm",
"id": "e31d51f675d8940b3ea51a4f18c1975793db1fb5",
"size": "2799",... |
"""
This is an example settings/local.py file.
These settings overrides what's in settings/base.py
"""
from . import base
# To extend any settings from settings/base.py here's an example.
# If you don't need to extend any settings from base.py, you do not need
# to import base above
INSTALLED_APPS = base.INSTALLED_A... | {
"content_hash": "c0626688db896309a8fb9d854e4fa8de",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 77,
"avg_line_length": 27.808988764044944,
"alnum_prop": 0.6521212121212121,
"repo_name": "adandan01/quizeme",
"id": "37567617e894c6addb7ec6062bbd75c0ae8f2573",
"size": "24... |
import traceback
from collections import namedtuple, defaultdict
import itertools
import logging
import textwrap
from shutil import get_terminal_size
from .abstract import Callable, DTypeSpec, Dummy, Literal, Type, weakref
from .common import Opaque
from .misc import unliteral
from numba.core import errors, utils, typ... | {
"content_hash": "d4b8a8d22676a942dcd5b393e0be7a25",
"timestamp": "",
"source": "github",
"line_count": 726,
"max_line_length": 80,
"avg_line_length": 36.64462809917355,
"alnum_prop": 0.5274770711171253,
"repo_name": "seibert/numba",
"id": "64b2bda24ddb3012245d013ad162daef5485ae52",
"size": "26604"... |
"""
Commands helpers.
.. currentmodule:: curious.commands
.. autosummary::
:toctree: commands
manager
context
decorators
plugin
utils
ratelimit
help
conditions
exc
converters
"""
from curious.commands.context import Context
from curious.commands.decorators import command,... | {
"content_hash": "f467c75f2329131f900816895f1b52a8",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 58,
"avg_line_length": 17.791666666666668,
"alnum_prop": 0.7353629976580797,
"repo_name": "SunDwarf/curious",
"id": "9b961afbdaa6370f395e3b3ea710451d0bf9bf25",
"size": "110... |
from dex.tools.clang_opt_bisect.Tool import Tool
| {
"content_hash": "83418c6ac2dce2c17dbed4de48df2ae5",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 48,
"avg_line_length": 49,
"alnum_prop": 0.8163265306122449,
"repo_name": "endlessm/chromium-browser",
"id": "b933e690b236fde57540a4cfc2b4709991304999",
"size": "328",
"bi... |
"""Tests for the VMDK image path specification implementation."""
import unittest
from dfvfs.path import vmdk_path_spec
from tests.path import test_lib
class VMDKPathSpecTest(test_lib.PathSpecTestCase):
"""Tests for the VMDK image path specification implementation."""
def testInitialize(self):
"""Tests th... | {
"content_hash": "7327bb71c71fb7926944973ae6479f91",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 72,
"avg_line_length": 26.725,
"alnum_prop": 0.7043966323666978,
"repo_name": "log2timeline/dfvfs",
"id": "a1af0d491dd78a26bab472b1441b750539828baf",
"size": "1115",
"bin... |
"""
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": "b80aea52105aa1e6388dbbb7f79720c7",
"timestamp": "",
"source": "github",
"line_count": 1080,
"max_line_length": 119,
"avg_line_length": 32.15648148148148,
"alnum_prop": 0.632439747761237,
"repo_name": "apache/incubator-tinkerpop",
"id": "a5a258a6429383e2c963265370b313bc205ce96a",
"... |
"""Switch between depending on pyglib.app or an OSS replacement."""
from __future__ import absolute_import
# pylint: disable=unused-import
# pylint: disable=g-import-not-at-top
# pylint: disable=wildcard-import
import tensorflow.python.platform
from . import control_imports
if control_imports.USE_OSS and control_import... | {
"content_hash": "848d90bad230ae5bb20ec607070cef2d",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 67,
"avg_line_length": 37.714285714285715,
"alnum_prop": 0.7859848484848485,
"repo_name": "aksaxena80/test",
"id": "7186d6e0b5515001d35884a8a93a1dcbf90ff60e",
"size": "528"... |
"""
conference.py -- Udacity conference server-side Python App Engine API;
uses Google Cloud Endpoints
$Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $
created by wesc on 2014 apr 21
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
from datetime import datetime
import endpoints
import loggin... | {
"content_hash": "a14de6842d8da30f19b2a9cce736ae8a",
"timestamp": "",
"source": "github",
"line_count": 830,
"max_line_length": 99,
"avg_line_length": 39.126506024096386,
"alnum_prop": 0.5936566589684372,
"repo_name": "osmdawy/Conference",
"id": "17ca969e791c5e105d7a983e33669f415511e68c",
"size": "... |
"""
Module to hold the encoder model.
"""
from tqdm import tqdm
import tensorflow as tf
import numpy as np
import os
import matplotlib
try:
if os.environ["SSH_CONNECTION"]:
matplotlib.use("Pdf")
except KeyError:
pass
import matplotlib.pyplot as plt
# Import MNIST data
from tensorflow.examples.tutorial... | {
"content_hash": "8c6a563746c81fb0ffcc33f89b0a6dc0",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 89,
"avg_line_length": 32.08,
"alnum_prop": 0.6638403990024938,
"repo_name": "MaxStrange/swedish_chef",
"id": "fdcf3a6475aa4bc3ca12f37503f5dfebb5a5cbb3",
"size": "4010",
... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'DisplayField', fields ['display_format']
db.delete_unique('report_builder_displayfield', ['display_... | {
"content_hash": "6abddb9a89e62f2283b5c8d9ed856f8b",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 190,
"avg_line_length": 77.32173913043478,
"alnum_prop": 0.5653396311291048,
"repo_name": "amaudy/django-report-builder",
"id": "62979104db78feea7d335815eca555ee045ce70c",
... |
import feedparser
import reader
from kaikai import Vocab
def pp(*args):
import pprint
out = open(1, 'w', encoding="utf-8", closefd=False)
pprint.pprint(*args, stream=out)
def pr(*args):
out = open(1, 'w', encoding="utf-8", closefd=False)
print(*args, file=out)
FEEDLIST = [
"../newnews/data/t... | {
"content_hash": "4f26c3e87cc0ac154d383d18b399d35d",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 58,
"avg_line_length": 24.794871794871796,
"alnum_prop": 0.6132368148914168,
"repo_name": "khachik/kaikai",
"id": "28fb35598e87a0f461d001fd2b8cdb02c6ef3427",
"size": "967",... |
"""
fs.s3fs
=======
**Currently only avaiable on Python2 due to boto not being available for Python3**
FS subclass accessing files in Amazon S3
This module provides the class 'S3FS', which implements the FS filesystem
interface for objects stored in Amazon Simple Storage Service (S3).
"""
import os
import datetime... | {
"content_hash": "9ec724a52e61d490a5fb76596ad2e2df",
"timestamp": "",
"source": "github",
"line_count": 747,
"max_line_length": 144,
"avg_line_length": 39.13253012048193,
"alnum_prop": 0.5523399014778325,
"repo_name": "pscottdevos/pyfilesystem",
"id": "b72036bd9c30be21f4d95ea8342cf5d5b47097a6",
"si... |
import sys
import os
includeos_src = os.environ.get('INCLUDEOS_SRC',
os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))).split('/test')[0])
sys.path.insert(0,includeos_src)
from vmrunner import vmrunner
import socket
def transmit_test(grgr):
print "<Test.py> Perfo... | {
"content_hash": "93ba561330f146ba5d64ac1707421b79",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 120,
"avg_line_length": 25.761904761904763,
"alnum_prop": 0.6571164510166358,
"repo_name": "ingve/IncludeOS",
"id": "adffc9e8ca4c62fcbbfc87b00f1c59c7a5985723",
"size": "110... |
def check_for_anagram(string_a, string_b):
char_list_a = list(string_a)
char_list_b = list(string_b)
char_list_a.sort()
char_list_b.sort()
if char_list_a == char_list_b:
print ("Anagram exists")
return True
else:
print ("The words don't form an Anagram")
return ... | {
"content_hash": "d602d3e817766097a0d933467b74d10a",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 49,
"avg_line_length": 24.4,
"alnum_prop": 0.6010928961748634,
"repo_name": "anthonynsimon/python-data-structures-algorithms",
"id": "0e22cd9a09cba6eb6fc2f8395112592072edbd50... |
import time
import unittest
from phaxio import PhaxioApi
from phaxio.exceptions import AuthenticationError, APIError
try:
raw_input
except NameError:
raw_input = input
class ErrorHandlingTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
super(ErrorHandlingTestCase, cls).setUpCla... | {
"content_hash": "9b660134de0b61cfaca14015badaf0ac",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 93,
"avg_line_length": 30.571428571428573,
"alnum_prop": 0.6668891855807744,
"repo_name": "jfialkoff/pyphaxio",
"id": "a960e45a07a63af522f0fd2637df692237bc68d7",
"size": "1... |
"""Tests for the experimental input pipeline ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import threading
import numpy as np
from tensorflow.contrib.data.python.ops import dataset_ops
from tensorflow.core.protobuf import config_pb2
from tensorf... | {
"content_hash": "78a666280cddfbf2932579bd0a20e936",
"timestamp": "",
"source": "github",
"line_count": 539,
"max_line_length": 80,
"avg_line_length": 41.34879406307978,
"alnum_prop": 0.6410463498900705,
"repo_name": "tornadozou/tensorflow",
"id": "acbd117a3312ee0374dc6fff215fe2c22db2e366",
"size":... |
import requests
import io
import json
class finboxRequest:
def __init__(self):
self.url = "https://api.finbox.io/beta"
self.headers = {
'authorization': "Bearer 509e960d5d374b8958f00bd5e977d13f001925fe",
'accept': "application/json",
'content-type': "applicatio... | {
"content_hash": "33c9339d4b3292b335ad5c5ab3ec9ad3",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 79,
"avg_line_length": 29.555555555555557,
"alnum_prop": 0.4781954887218045,
"repo_name": "kevin-f-liu/WSBAuto",
"id": "50532815b211070735086ab877df6b0b2d77ee4f",
"size": "... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
# This flag is used to mark that a migration shouldn't be automatically run in
# production. We set this to True for operations that we think are risky and want
# someone from ops to ru... | {
"content_hash": "ec6a1bb3a0e1fe84e83df826075cd677",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 104,
"avg_line_length": 42.02564102564103,
"alnum_prop": 0.6259914582062233,
"repo_name": "beeftornado/sentry",
"id": "a9cba66ba57750c4745f8ac5f40ddf82593df280",
"size": "1... |
from django.contrib import admin
from autorski.models import Joke
class JokeAdmin(admin.ModelAdmin):
list_display = ['author', 'effective_votes', 'date']
list_filter = ['date']
search_fields = ['body', 'author']
def effective_votes(self, obj):
return obj.votes
admin.site.register(Joke, Jok... | {
"content_hash": "a0cdbd24da7c93ffe6bedc964fb0002c",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 56,
"avg_line_length": 21.866666666666667,
"alnum_prop": 0.6829268292682927,
"repo_name": "jchmura/suchary-django",
"id": "62c6ee6fc2a71d5b7c1dc798cd52747d1cf3c696",
"size"... |
from pygments.formatters import HtmlFormatter
from django.shortcuts import render, get_object_or_404, redirect
from .models import Media
def share_view(request, url_hash):
media_item = get_object_or_404(Media, url_hash=url_hash)
media_item.view_count += 1
media_item.save()
if media_item.media_type ==... | {
"content_hash": "407213bfb32f671d0c185cec3aee599f",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 96,
"avg_line_length": 31.185185185185187,
"alnum_prop": 0.6745843230403801,
"repo_name": "ethanal/Nimbus",
"id": "8a1463cd0eb6f5598747838dce12812b67e3e74c",
"size": "842",... |
import os
from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin,\
FileOpenDialogModuleMixin
import module_utils
from external import transfer_function_widget
import vtk
import wx
TF_LIBRARY = {
'CT Hip (bones+vasculature)' : [
(-1024.0, (0, 0, 0), 0),
... | {
"content_hash": "9afef4b163b4d1404c4605bed47b59cb",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 91,
"avg_line_length": 33.45192307692308,
"alnum_prop": 0.5398102903133084,
"repo_name": "chrisidefix/devide",
"id": "9cb16f576ecc27f00f07da74de6bca3c1962920b",
"size": "1... |
import tensorflow as tf
def feed_forward_nn(input_tensor,
num_hidden_layers,
output_dim,
keep_prob=None,
hidden_dim=-1,
activation="tanh",
normalizer="none"):
"""Creates a fully connected feed for... | {
"content_hash": "d0705d9c45687929eae8a55eac26ca76",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 76,
"avg_line_length": 34.4264705882353,
"alnum_prop": 0.6292182827851346,
"repo_name": "brain-research/mpnn",
"id": "3d74ba7cf67f174ed993f2eb71a759925dcbc839",
"size": "30... |
import numpy
import six
from chainer import cuda
from chainer import function
from chainer.functions.pooling import pooling_2d
from chainer.utils import conv
from chainer.utils import conv_nd
from chainer.utils import type_check
if cuda.cudnn_enabled:
cudnn = cuda.cudnn
libcudnn = cudnn.cudnn
_cudnn_vers... | {
"content_hash": "b7aefaa0d80318b46e46fec73e55c5bd",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 76,
"avg_line_length": 32.12765957446808,
"alnum_prop": 0.5960264900662252,
"repo_name": "delta2323/chainer",
"id": "232004753bf25c3f13bae29d9c2daf3226576b27",
"size": "302... |
"""
PointStream -- The main galvo multiple object drawing algorithm.
This code is responsible for drawing multiple objects.
It will need to be improved for efficiency.
FIXME/NOTE: The documentation / variable names are a bit out of date.
"Ball", where it occurs, means ... | {
"content_hash": "a076be446b040246bada559ed2df1f70",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 76,
"avg_line_length": 35.58083832335329,
"alnum_prop": 0.42998990238976775,
"repo_name": "topher515/laser-fingers",
"id": "3f348b171e4f1e955e5483904f78480c7eba6972",
"siz... |
import morepath
class App(morepath.App):
pass
class Foo:
pass
@App.path(path="foo", model=Foo)
def get_foo():
return Foo()
| {
"content_hash": "82c164e2bd50a17e124f67eb5bc0d075",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 32,
"avg_line_length": 10.071428571428571,
"alnum_prop": 0.6312056737588653,
"repo_name": "morepath/morepath",
"id": "1e284d1a9749e4ec9f0daecd10b6a634da5d1659",
"size": "14... |
"""Unit test for treadmill.scheduler.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import time
import unittest
import sys
# Disable W0611: Unused import
import tests.treadmill_test_skip_windows # pylint: disa... | {
"content_hash": "de594d29d90c4c2484637690d0ff31d1",
"timestamp": "",
"source": "github",
"line_count": 1645,
"max_line_length": 79,
"avg_line_length": 38.45835866261398,
"alnum_prop": 0.5705614567526556,
"repo_name": "bretttegart/treadmill",
"id": "8d5bd83ca44a6215cafbcfc73a3f1e590cf448c3",
"size"... |
"""HTML sanitized string field."""
from __future__ import absolute_import, print_function
import bleach
from .sanitizedunicode import SanitizedUnicode
class SanitizedHTML(SanitizedUnicode):
"""String field which strips sanitizes HTML using the bleach library."""
def __init__(self, tags=None, attrs=None, *... | {
"content_hash": "257a8083482d76e8e54f6db1f90e0724",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 76,
"avg_line_length": 25.436363636363637,
"alnum_prop": 0.44889206576125806,
"repo_name": "tiborsimko/invenio-records-rest",
"id": "7eb03d3c1c4b94d1c256432566b311937c5b5cce"... |
import unittest
import numpy as np
import sys
sys.path.append('..')
from op_test import OpTest
from paddle.fluid import core
import paddle
alignment = 256
paddle.enable_static()
class TestAllocContinuousSpace(OpTest):
def setUp(self):
self.op_type = "coalesce_tensor"
self.dtype, self.fluid_dtype... | {
"content_hash": "997a26f76a7a4e0ceba82ef79d8be6e6",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 80,
"avg_line_length": 31.632653061224488,
"alnum_prop": 0.5725806451612904,
"repo_name": "PaddlePaddle/Paddle",
"id": "97bc47971f475acd1e433f7253672aa006c73c5c",
"size": "... |
def mean(values: list) -> int:
length = len(values)
result = 0
for value in values:
result += value
result /= length
return result
def median(values: list) -> float:
length = len(values)
values = sorted(values)
if length % 2 != 0:
return values[length // 2]
else:
return (values[length // 2] + values[le... | {
"content_hash": "86af3f0cdf23e58dfc8ad770cab22dec",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 66,
"avg_line_length": 21.07894736842105,
"alnum_prop": 0.6441947565543071,
"repo_name": "ehouarn-perret/EhouarnPerret.Python.HackerRank",
"id": "f4da015b3ca3e9bf2341a41a325d... |
import distribute_setup
distribute_setup.use_setuptools()
import sys
from setuptools import setup
def read_file(name):
"""
Read file content
"""
f = open(name)
try:
return f.read()
except IOError:
print("could not read %r" % name)
f.close()
PROJECT = 'skeleton'
VERS... | {
"content_hash": "396daa6535d5844b2242873307e430ea",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 79,
"avg_line_length": 24.728571428571428,
"alnum_prop": 0.5967648757943386,
"repo_name": "dinoboff/skeleton",
"id": "d73a0fa16c1f2776950efda988ef971ac5b76ef2",
"size": "17... |
from flask import Blueprint
from flask import render_template, request, redirect
from cloudmesh.config.cm_keys import cm_keys
from cloudmesh.util.util import cond_decorator
import cloudmesh
from flask.ext.login import login_required
from cloudmesh.util.logger import LOGGER
log = LOGGER(__file__)
mooc_module = Blu... | {
"content_hash": "f1670238fc080aeca726be75ef4fb0f2",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 52,
"avg_line_length": 18.48,
"alnum_prop": 0.7510822510822511,
"repo_name": "rajpushkar83/cloudmesh",
"id": "8838bdf3f3ae19d0cb3968e8afff792e96f0e93d",
"size": "462",
"b... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.sql import SqlManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-sql
# USAGE
python failover_a_managed_instance..py
Before run the sample, please set the values of the client ID, tenant ID and client ... | {
"content_hash": "903022e8e609a41f7b40a3e2d1f375e0",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 135,
"avg_line_length": 33.696969696969695,
"alnum_prop": 0.7320143884892086,
"repo_name": "Azure/azure-sdk-for-python",
"id": "7d620328daca0e949785a4a6d94872ffcdd16e05",
"... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('taxbrain', '0051_auto_20150303_1454'),
]
operations = [
migrations.RenameField(
model_name='taxsaveinputs',
old_name='item_p... | {
"content_hash": "70c19239f24d0795a43d500a2cba9f56",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 73,
"avg_line_length": 31.666666666666668,
"alnum_prop": 0.5903508771929824,
"repo_name": "nolanzandi/webapp-public",
"id": "25ace0ae5aa2572553fdee53990a184942184cfe",
"siz... |
from app import create_app, db
from app.models import User, Role, Permission, Question, Comment, Vote, Answer
from flask_script import Manager, Shell
from flask_migrate import Migrate, MigrateCommand
import os
app = create_app('default')
manager = Manager(app)
migrate = Migrate(app, db)
def make_shell_context():
... | {
"content_hash": "5b49f359a32079f07f7b868473f6c7c6",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 78,
"avg_line_length": 24.73076923076923,
"alnum_prop": 0.6765163297045101,
"repo_name": "VashonHu/MyWebsiteWithFlask",
"id": "c387098d6633d5f47c84dff481e7c43b6c2fa104",
"s... |
from __future__ import unicode_literals
from urllib import quote
import cloudstorage
from cloudstorage.storage_api import _StorageApi
from google.appengine.api.blobstore import blobstore
from rogerthat.consts import DEBUG, ROGERTHAT_ATTACHMENTS_BUCKET
from rogerthat.settings import get_server_settings
from rogerthat... | {
"content_hash": "000e7054364542fc2a5a5cb3c852abb7",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 75,
"avg_line_length": 31.2,
"alnum_prop": 0.6493589743589744,
"repo_name": "our-city-app/oca-backend",
"id": "eb3537f6ba193b29bcc096d478630e57786d660b",
"size": "2200",
... |
"""Facebook platform for notify component."""
import json
import logging
from aiohttp.hdrs import CONTENT_TYPE
import requests
import voluptuous as vol
from homeassistant.const import CONTENT_TYPE_JSON
import homeassistant.helpers.config_validation as cv
from homeassistant.components.notify import (
ATTR_DATA,
... | {
"content_hash": "57c5f0e8ee93f81bf189dba19c340ee5",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 82,
"avg_line_length": 32.66942148760331,
"alnum_prop": 0.5722236276245889,
"repo_name": "qedi-r/home-assistant",
"id": "452b81c0f16a0602d59efc54f19fb48e17290629",
"size":... |
import hashlib
import os
from oslo_concurrency import lockutils
from oslo_log import log as logging
import six
import yaml
from tempest import clients
from tempest.common import cred_provider
from tempest.common import fixed_network
from tempest import config
from tempest import exceptions
CONF = config.CONF
LOG = l... | {
"content_hash": "a8a1a2fe2834044fb09a81a377fe2e3c",
"timestamp": "",
"source": "github",
"line_count": 341,
"max_line_length": 79,
"avg_line_length": 41.74486803519061,
"alnum_prop": 0.5832103969090271,
"repo_name": "Juraci/tempest",
"id": "78e0e72657f47b8e22fd74bb5a7eb6b3834dddbf",
"size": "14873... |
import argparse
import sys
import beakerx_tabledisplay
from notebook import notebookapp as app
from .install import install, uninstall
def install_subparser(subparser):
install_parser = subparser.add_parser('install', help='installs BeakerX tabledisplay extensions')
install_parser.set_defaults(func=install)
... | {
"content_hash": "9f32f8e48043361cec474640ba9099c2",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 107,
"avg_line_length": 36.02040816326531,
"alnum_prop": 0.6560906515580737,
"repo_name": "twosigma/beaker-notebook",
"id": "082309322ccc8b0d52bfef6145de06cb5b161424",
"siz... |
import angr
import logging
l = logging.getLogger(name=__name__)
PROT_READ = 0x1 # /* Page can be read. */
PROT_WRITE = 0x2 # /* Page can be written. */
PROT_EXEC = 0x4 # /* Page can be executed. */
PROT_NONE = 0x0 # /* Page can not be accessed. */
MAP_SHARED = 0x01 # ... | {
"content_hash": "cd0d34010dd55cec3bc5c142671ad5d1",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 149,
"avg_line_length": 34.16504854368932,
"alnum_prop": 0.5575447570332481,
"repo_name": "schieb/angr",
"id": "b8035c3699cbcdeb0446401a153e6dd591896cb5",
"size": "3519",
... |
"""logging api
Revision ID: c8c222d42aa9
Revises: 62c781cb6192
Create Date: 2017-05-30 11:51:08.173604
"""
# revision identifiers, used by Alembic.
revision = 'c8c222d42aa9'
down_revision = '62c781cb6192'
from alembic import op
import sqlalchemy as sa
from neutron_lib.db import constants as db_const
def upgrade(... | {
"content_hash": "a1c2b7c7bf56372b07e5587fb1057f84",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 76,
"avg_line_length": 34.17777777777778,
"alnum_prop": 0.5858257477243173,
"repo_name": "eayunstack/neutron",
"id": "4c41a1fc5856281943a0d06cbf401cf3496033e3",
"size": "21... |
import wpl
class LibraryAccount(wpl.LibraryAccount):
def login_url(self):
return 'https://books.kpl.org/iii/cas/login?service=' + \
'https://books.kpl.org/patroninfo~S2/j_acegi_cas_security_check&lang=eng&scope=2'
| {
"content_hash": "d25b6f6e644abd36eba5103fc44341d2",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 96,
"avg_line_length": 34.714285714285715,
"alnum_prop": 0.6707818930041153,
"repo_name": "LibraryHippo/LibraryHippo",
"id": "201aac4060d7b5bedb81705bf09cea55a99282b5",
"siz... |
import mufsim.gamedb as db
import mufsim.stackitems as si
from mufsim.interface import network_interface as netifc
from mufsim.logger import log
from mufsim.errors import MufRuntimeError
from mufsim.insts.base import Instruction, instr
@instr("descriptors")
class InstDescriptors(Instruction):
def execute(self, fr... | {
"content_hash": "bbe432e18bdecd1deaffcb032c0bc797",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 73,
"avg_line_length": 28.227272727272727,
"alnum_prop": 0.5969404186795492,
"repo_name": "revarbat/mufsim",
"id": "7623aa8ade4fbf24e21db361224fa3796468cd88",
"size": "621... |
from .base import CreditCardProvider
from .gencc import amexPrefixList
from .gencc import credit_card_number
from random import Random
class AmexProvider(CreditCardProvider):
def __init__(self, *args, **kwargs):
super(AmexProvider, self).__init__(*args, **kwargs)
def get_credit_card_number(self):
... | {
"content_hash": "6b669014cd1a2dee256ba9417c7992ab",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 73,
"avg_line_length": 29.642857142857142,
"alnum_prop": 0.7156626506024096,
"repo_name": "ryankanno/vor",
"id": "ce45992f10dac30d187644fada1f7f57ba86506d",
"size": "462",
... |
"""Validate solutions by enforcing file and table formats
"""
import os
import re
import logging
import time
import random
import requests
from lxml import html as HTMLParser
def read_solutions_table(readme_fp):
def parse_line(line):
elems = [el for el in line.strip().split('|') if el]
question_e... | {
"content_hash": "2a8c4323e376c86c56a4b10fc6ff4027",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 102,
"avg_line_length": 39.170731707317074,
"alnum_prop": 0.5471149854711499,
"repo_name": "franklingu/leetcode-solutions",
"id": "2e54d5b98ea493b2cd677677b4f94665016ebfe2",... |
from __future__ import absolute_import, unicode_literals
import os
from django import VERSION as DJANGO_VERSION
from django.utils.translation import ugettext_lazy as _
######################
# MEZZANINE SETTINGS #
######################
# The following settings are already defined with default values in
# the ``def... | {
"content_hash": "97c84642187c2f67c02f3cab3eadf1d8",
"timestamp": "",
"source": "github",
"line_count": 348,
"max_line_length": 79,
"avg_line_length": 34.57471264367816,
"alnum_prop": 0.676529255319149,
"repo_name": "Nick011/lolsteak",
"id": "18d15186a6b6afd4b9221b689a2b997c7ddd03cb",
"size": "1203... |
import re
import sys
from operator import add
from pyspark import SparkContext
def computeContribs(urls, rank):
"""Calculates URL contributions to the rank of other URLs."""
num_urls = len(urls)
for url in urls:
yield (url, rank / num_urls)
def parseNeighbors(urls):
"""Parses a urls pair st... | {
"content_hash": "1797bf8d4f965a24682cb3bf87509824",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 99,
"avg_line_length": 34.81818181818182,
"alnum_prop": 0.6428198433420366,
"repo_name": "thrill/fst-bench",
"id": "9fc8389798f22ffeead4a547275b61e3d151a153",
"size": "2882... |
import threading
import logging
import struct
import time
from typing import Callable, Optional
from .network import CanError
logger = logging.getLogger(__name__)
NMT_STATES = {
0: 'INITIALISING',
4: 'STOPPED',
5: 'OPERATIONAL',
80: 'SLEEP',
96: 'STANDBY',
127: 'PRE-OPERATIONAL'
}
NMT_COMMAN... | {
"content_hash": "e9dca12e18dc68c9590aede0f0563d37",
"timestamp": "",
"source": "github",
"line_count": 264,
"max_line_length": 102,
"avg_line_length": 31.481060606060606,
"alnum_prop": 0.5639513897244616,
"repo_name": "christiansandberg/canopen",
"id": "09963de06e4fe98cde73f3e5474933156539fd43",
"... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/furniture/all/shared_frn_all_lamp_candlestick_free_s02.iff"
result.attribute_template_id = 6
result.stfName("frn_n","frn_lamp_candlestick_dearic")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ###... | {
"content_hash": "f07bf0d6bf407ac6c3f65106fb1926d7",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 95,
"avg_line_length": 26,
"alnum_prop": 0.7100591715976331,
"repo_name": "anhstudios/swganh",
"id": "a6adfb799d14255ac56ad59537e7b153cdf17959",
"size": "483",
"binary": ... |
from gen_callback import *
from gen_caller import *
from gen_init_function import *
from gen_signatures import *
from gen_singleton import *
from gen_extclass import *
def gen_all(args):
open('callback.hpp', 'w').write(gen_callback(args))
open('caller.hpp', 'w').write(gen_caller(args))
open('init_function.... | {
"content_hash": "4123f6ce26e423314449b4753e7cf961",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 65,
"avg_line_length": 27.115384615384617,
"alnum_prop": 0.6354609929078014,
"repo_name": "Ezeer/VegaStrike_win32FR",
"id": "3877d181ff32d8daf2178f777f6e815779d57240",
"siz... |
import datetime
from decimal import Decimal
import hashlib
import logging
import urllib
from django.contrib.sites.models import Site
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse
from django.utils.timezone import utc
from django.utils.translation import ugettext_la... | {
"content_hash": "33cb5794a7ff2d08fc43edfc3273cfe8",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 146,
"avg_line_length": 41.62987012987013,
"alnum_prop": 0.6136328185930432,
"repo_name": "KrzysiekJ/django-getpaid",
"id": "33ca5919f27ac696616ab3bf0a3845c26ace3273",
"si... |
import mui4py.mui4py_mod as mui4py_mod
from mui4py.common import CppClass, get_cpp_name, array2Point, _Point
from mui4py.config import Config
from mui4py.types import *
from mui4py.geometry import Geometry
from mui4py.samplers import Sampler, ChronoSampler
import numpy as np
import re
import copy
# TODO: Add communica... | {
"content_hash": "7b902b4708c118a9c725bed451e8224e",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 124,
"avg_line_length": 42.87542087542087,
"alnum_prop": 0.5506517983351656,
"repo_name": "yhtang/MUI",
"id": "ff40d61e46a951ff136da907989d411cfac04cd3",
"size": "12734",
... |
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class VersionConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "osmaxx.version"
verbose_name = _("Version")
| {
"content_hash": "3fe8ff9d6ca9687aa70d6d9b4ec0d592",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 56,
"avg_line_length": 30,
"alnum_prop": 0.7416666666666667,
"repo_name": "geometalab/osmaxx",
"id": "ff0d44f93cf770990d8bfc2e77ea9d30d3cc21b5",
"size": "240",
"binary": f... |
from dal import autocomplete
from django import forms
from .models import TModel
class TForm(forms.ModelForm):
class Meta:
model = TModel
fields = ('name', 'test')
widgets = {
'test': autocomplete.ModelSelect2(url='secure_data')
}
| {
"content_hash": "369ae3b9585586fe715b484307c52a8e",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 64,
"avg_line_length": 20.214285714285715,
"alnum_prop": 0.6148409893992933,
"repo_name": "yourlabs/django-autocomplete-light",
"id": "720ea5f56f0a0c6f28dddb8b14df519709d10b5... |
import subprocess
import os
import sys
import shutil
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
return True
def check_cmake_exists(cmake_command):
"""
Check whether CMake is installed. If not, print
informative ... | {
"content_hash": "b419d525b4df75db2a8cbda958ef6d7d",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 110,
"avg_line_length": 31.80625,
"alnum_prop": 0.609157005305561,
"repo_name": "miroi/sec_quant_F90",
"id": "a635d408bab8c6ac2b51c19a528fe9b726397e6b",
"size": "5211",
... |
import logging
import os
from pathlib import Path
import jinja2
from couchdbkit.ext.django import schema
from django.core.management.base import BaseCommand
from django.utils.dateparse import parse_date, parse_datetime
from corehq.util.couchdb_management import couch_config
from corehq.util.doc_processor.couch import... | {
"content_hash": "be82105a84422919c9b37ba7501a5711",
"timestamp": "",
"source": "github",
"line_count": 370,
"max_line_length": 110,
"avg_line_length": 41.38918918918919,
"alnum_prop": 0.5731356928300901,
"repo_name": "dimagi/commcare-hq",
"id": "ee9732a4fa1b55e351380bbfe873de4c42dc545c",
"size": "... |
import math
import numpy as np
import tensorflow as tf
import util
class Network(object):
def __init__(self, variable_scope, inputs, reward_scaling, config,
write_summaries):
self.scope = variable_scope
self.inputs = inputs
self.config = config
self.write_summaries = write_summaries
... | {
"content_hash": "85a0c20dcfa531e4a6be78d03aa939a1",
"timestamp": "",
"source": "github",
"line_count": 201,
"max_line_length": 79,
"avg_line_length": 34.492537313432834,
"alnum_prop": 0.6470503389586038,
"repo_name": "brendanator/atari-rl",
"id": "a826a85bede5918f69131a30ed14264dce1dd45f",
"size":... |
"""Tests for the XRT client."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.compiler.xla.python import xla_client
from tensorflow.compiler.xla.python import xrt
from tensorflow.python.platform import test
def BuildA... | {
"content_hash": "02809604fd56fa111dd4e1876dd98b9b",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 77,
"avg_line_length": 30.266666666666666,
"alnum_prop": 0.6953010279001468,
"repo_name": "kevin-coder/tensorflow-fork",
"id": "c53ac1071e342c36abb1c513bbf461be491bdf88",
"... |
import unittest
import numpy
import pytest
import cupy
from cupy.cuda import runtime
from cupy import testing
@testing.parameterize(
{'shape': ()},
{'shape': (1,)},
{'shape': (1, 1, 1)},
)
class TestNdarrayItem(unittest.TestCase):
@testing.for_all_dtypes()
@testing.numpy_cupy_equal()
def te... | {
"content_hash": "1963455add90808bee7352ff2efe829f",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 69,
"avg_line_length": 24.135593220338983,
"alnum_prop": 0.5582865168539326,
"repo_name": "cupy/cupy",
"id": "806e6cc1382cb6dcc8c590bd0541e6f983e57650",
"size": "1424",
"... |
import arrow
from django import template
from django.core.urlresolvers import reverse
register = template.Library()
@register.filter
def get_total_subject_posts(subject):
"""
get_total_subject_posts():
"""
total_posts = 0
for thread in subject.threads.all():
total_posts += thread.posts.co... | {
"content_hash": "e6cd93ff899854b9b7e0ffc4ff6b6863",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 64,
"avg_line_length": 20.636363636363637,
"alnum_prop": 0.6622613803230544,
"repo_name": "GunnerJnr/_CodeInstitute",
"id": "bb0e2f13aa5d9d87de00d66c7be5666a49c7b8c9",
"siz... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import json
import re
from collections import namedtuple
from pants.base.workunit import WorkUnit, WorkUnitLabel
from pants.task.task import Task
from pants.util.memo... | {
"content_hash": "6990f5599b6cde7e1bea3406d88eea53",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 99,
"avg_line_length": 40.96363636363636,
"alnum_prop": 0.6767273265275928,
"repo_name": "fkorotkov/pants",
"id": "6def91c702efd97472f55e7d5eb8f5d75add5384",
"size": "6906... |
from djangoappengine.settings_base import *
import os
# Activate django-dbindexer for the default database
DATABASES['native'] = DATABASES['default']
DATABASES['default'] = {'ENGINE': 'dbindexer', 'TARGET': 'native'}
AUTOLOAD_SITECONF = 'indexes'
SITE_ID = 1
ADMINS = (
('Thiago Pagonha', 'thi.pag@gmail.com'),
... | {
"content_hash": "763e16c5da7ae038da4f6dff7a0ad2b1",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 83,
"avg_line_length": 30.322916666666668,
"alnum_prop": 0.7069735486087255,
"repo_name": "thiagopa/thiagopagonha",
"id": "d9bcdc70f9078b0778b7f49978b3682f91b8e26f",
"size"... |
from __future__ import unicode_literals
import importlib
import inspect
import os
import re
import sys
import tempfile
from unittest import skipIf
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import DatabaseError, connection
from django.template import Temp... | {
"content_hash": "d567bf92c8b92450be11cae349fa7aed",
"timestamp": "",
"source": "github",
"line_count": 955,
"max_line_length": 117,
"avg_line_length": 42.84502617801047,
"alnum_prop": 0.6189114548964978,
"repo_name": "sadaf2605/django",
"id": "11ecc4c8d43454ae76a72f091abc235485ce7ae3",
"size": "41... |
import requests
from bs4 import BeautifulSoup
url ="https://github.com/jackfischer"
req = requests.get(url)
soup = BeautifulSoup(req.content, "html.parser")
img = soup.find(class_="avatar")
imageurl = img.attrs["src"]
resp = requests.get(imageurl)
f = open("imagewoo.png", 'wb')
for b in resp:
f.write(b)
| {
"content_hash": "8e1e4209f48c351a10237ae13e7d5638",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 48,
"avg_line_length": 18.41176470588235,
"alnum_prop": 0.7060702875399361,
"repo_name": "HackBinghamton/club",
"id": "7045cedcd1a09759d25e45f64a2bf25922873a50",
"size": "3... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
# -- General conf... | {
"content_hash": "4b2425c548e34b3d47f402ebc9e216a2",
"timestamp": "",
"source": "github",
"line_count": 253,
"max_line_length": 79,
"avg_line_length": 31.52173913043478,
"alnum_prop": 0.700564263322884,
"repo_name": "theCatWisel/ThreatExchange",
"id": "e48ddfbfbab99a795b82ba725775912ca3b09422",
"si... |
from __future__ import unicode_literals
from ..utils import GCOR
def test_GCOR_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=True,
usedefault=True,
),
in_file=dict(argstr='-input %s',
copyfile=Fal... | {
"content_hash": "3779793fc5005dbcb78dc974d488b47e",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 67,
"avg_line_length": 24.34090909090909,
"alnum_prop": 0.6022408963585434,
"repo_name": "mick-d/nipype",
"id": "9f307dda3497615b4d28e1833159cc82b51e272f",
"size": "1125",
... |
import pytest
from .config import *
@pytest.fixture
def app(request):
main.app.config["TESTING"] = True
main.app.config["SQLALCHEMY_DATABASE_URI"] = TEST_DATABASE_URI
ctx = main.app.app_context()
ctx.push()
def teardown():
ctx.pop()
request.addfinalizer(teardown)
return main.app
... | {
"content_hash": "5ec3248906b0c168ffe6fbb17b23a23b",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 66,
"avg_line_length": 21.025316455696203,
"alnum_prop": 0.6538229981938591,
"repo_name": "JungWinter/yellowid-flask",
"id": "93d35f24bc1d732ada89b430c5405f9303bca146",
"si... |
from __future__ import absolute_import, division, print_function
from jaspyx.context import Context
from jaspyx.scope import Scope
class ClassContext(Context):
def __init__(self, parent, name):
super(ClassContext, self).__init__(parent)
self.scope = Scope(self.scope)
self.scope.prefix = pa... | {
"content_hash": "1178a7d851337650f702b82ad8e540ce",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 69,
"avg_line_length": 36.09090909090909,
"alnum_prop": 0.690176322418136,
"repo_name": "ztane/jaspyx",
"id": "47396a1cd7b48026b5dc4140d026e4c7a66e8c3f",
"size": "397",
"... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('todo', '0003_auto_20170621_1759'),
]
operations = [
migrations.AlterField(
model_name='item',
name='complete',
f... | {
"content_hash": "ee4bcf4830fb08d9c7676875f6800bcd",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 53,
"avg_line_length": 23,
"alnum_prop": 0.5633270321361059,
"repo_name": "noah-dev/todo_django",
"id": "fa3cbaebe183c2d020bb2ea4219131b7214e1915",
"size": "602",
"binary... |
from st2tests.base import BaseActionAliasTestCase
class StartDiscovery(BaseActionAliasTestCase):
action_alias_name = "start_discovery"
def test_start_discovery(self):
format_string = self.action_alias_db.formats[0]['representation'][0]
format_strings = self.action_alias_db.get_format_strings(... | {
"content_hash": "0730627f4198dc0b2a7881649943def9",
"timestamp": "",
"source": "github",
"line_count": 203,
"max_line_length": 111,
"avg_line_length": 41.645320197044335,
"alnum_prop": 0.5590253134610835,
"repo_name": "tonybaloney/st2contrib",
"id": "07145590c5ff00a9a859426e993fc258a80f6198",
"siz... |
"""Module définissant une classe statique pour tester les commandes."""
from primaires.joueur.contextes.connexion.mode_connecte import ModeConnecte
class TestCommande:
"""Classe utilisée pour tester les commandes."""
@staticmethod
def entrer_commande(joueur, message):
"""Exécute la commande indi... | {
"content_hash": "8d3aa210d6b3a9812945e13625bbc603",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 75,
"avg_line_length": 36.214285714285715,
"alnum_prop": 0.7218934911242604,
"repo_name": "stormi/tsunami",
"id": "24532fcf1ce37e724c2f7b9c2ee63a81602ba657",
"size": "2073"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.