text stringlengths 4 1.02M | meta dict |
|---|---|
from django.contrib.auth.models import User, Group
from rest_framework import serializers
| {
"content_hash": "da19c3ff75a588f5005181a3d0e429ac",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 50,
"avg_line_length": 45,
"alnum_prop": 0.8444444444444444,
"repo_name": "MobileWebApps/backend-python-rest-gae",
"id": "5a974d8c007d716bae45c6f87f863acfe7e0a95e",
"size": ... |
import demistomock as demisto
from CommonServerPython import *
import subprocess
import uuid
USERNAME = demisto.params()['credentials']['identifier'].replace("'", "''")
PASSWORD = demisto.params()['credentials']['password'].replace("'", "''")
EXCHANGE_FQDN = demisto.params()['exchangeFQDN'].replace("'", "''")
UNSECURE... | {
"content_hash": "d96f2008cbff9934c2925a845dba9d90",
"timestamp": "",
"source": "github",
"line_count": 422,
"max_line_length": 126,
"avg_line_length": 36.187203791469194,
"alnum_prop": 0.6558182175365072,
"repo_name": "VirusTotal/content",
"id": "cac2798d330a35b4cb295b774b73ce9affeb8156",
"size": ... |
"""
Copyright 2014 Novartis Institutes for Biomedical Research
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 a... | {
"content_hash": "af65728eea231765f1bd9414f10688db",
"timestamp": "",
"source": "github",
"line_count": 490,
"max_line_length": 272,
"avg_line_length": 60.86326530612245,
"alnum_prop": 0.48087046910102943,
"repo_name": "Novartis/yap",
"id": "23331f71f894aeb7aa22feadbfdf8518ee75da57",
"size": "29845... |
import decimal
from keystoneauth1 import session as ks_sess
import mock
from oslo_config import fixture as config_fixture
from oslotest import base
import testscenarios
from cloudkitty import collector
from cloudkitty import db
from cloudkitty.db import api as ck_db_api
from cloudkitty import rating
class FakeColle... | {
"content_hash": "e191d90b50b8b062109b417337a5e1dd",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 71,
"avg_line_length": 28.766233766233768,
"alnum_prop": 0.6221218961625282,
"repo_name": "stackforge/cloudkitty",
"id": "ed84dae966cdd49edd53ad4db0a8fe1dff343231",
"size":... |
import sys
import os
import cmd
import threading
from gppylib.commands.base import WorkerPool, REMOTE, ExecutionError
from gppylib.commands.unix import Hostname, Echo
sys.path.append(sys.path[0] + '/lib')
import pxssh
import pexpect
import socket
class HostNameError(Exception):
def __init__(self, msg, lineno = 0... | {
"content_hash": "f786a00bc2b7ee3095c75da3979b40d4",
"timestamp": "",
"source": "github",
"line_count": 346,
"max_line_length": 108,
"avg_line_length": 32.40462427745665,
"alnum_prop": 0.557260078487335,
"repo_name": "huor/incubator-hawq",
"id": "6240bedd64cb92cbf17c90bd0d9c9f65461e295f",
"size": "... |
'''
Created on May 5, 2016
@author: xiao
'''
from argparse import ArgumentParser
from generate import *
from multiprocessing import Pool
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument("seed", type = int, default = 103, nargs = '?',
help = "seed to make the ge... | {
"content_hash": "999836cf5ee77a5a8b7f5fe3cd0db5d6",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 88,
"avg_line_length": 39.74193548387097,
"alnum_prop": 0.6055194805194806,
"repo_name": "xiao-cheng/html-generator",
"id": "649fc3e9d90c58669678796843a157ba85c4dc49",
"siz... |
"""Test basic ceilometer-api app
"""
import os
import tempfile
import unittest
from oslo.config import cfg
from ceilometer.api.v1 import app
from ceilometer.api import acl
from ceilometer import service
class TestApp(unittest.TestCase):
def tearDown(self):
cfg.CONF.reset()
def test_keystone_middle... | {
"content_hash": "026f146d0f55d2dacf215ab067f72313",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 79,
"avg_line_length": 33.714285714285715,
"alnum_prop": 0.6322033898305085,
"repo_name": "dreamhost/ceilometer",
"id": "c38356ac17bd1b75603fd844da7fdf3357ba400f",
"size": ... |
from __future__ import unicode_literals
from itertools import chain
from math import log
from nltk.probability import (ConditionalProbDist, ConditionalFreqDist,
SimpleGoodTuringProbDist)
from nltk.util import ingrams
from nltk.model.api import ModelI
from nltk import compat
def _estim... | {
"content_hash": "ae3120169124c81aa3fad991390735a8",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 103,
"avg_line_length": 35.5764192139738,
"alnum_prop": 0.5943292009328587,
"repo_name": "syllog1sm/TextBlob",
"id": "c43f76334a7bbcc37302398db4bbd6b27121edc8",
"size": "8... |
import _plotly_utils.basevalidators
class TextValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="text", parent_name="isosurface.colorbar.title", **kwargs
):
super(TextValidator, self).__init__(
plotly_name=plotly_name,
parent_name=... | {
"content_hash": "d8bd551eb4a47afa3e8b26b77fab4206",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 83,
"avg_line_length": 33.142857142857146,
"alnum_prop": 0.5926724137931034,
"repo_name": "plotly/python-api",
"id": "5595928c4077299b2043fb2dfc16614cdfbc65f1",
"size": "46... |
server = {
'port': '8080',
'host': '0.0.0.0'
}
# Pecan Application Configurations
app = {
'root': 'interceptor.api.controllers.root.RootController',
'modules': ['interceptor.api'],
'static_root': '%(confdir)s/public',
'template_path': '%(confdir)s/templates',
'debug': False,
}
logging = ... | {
"content_hash": "ba0ee1f1103bc8978a596a4105cb9482",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 66,
"avg_line_length": 22.372093023255815,
"alnum_prop": 0.5145530145530145,
"repo_name": "uhobawuhot/interceptor",
"id": "7c92dd46d3dfbf6a091db083e3a08fe7d6d58221",
"size"... |
from django.db import models, connection
from . import denorms
from django.conf import settings
import django.db.models
def denormalized(DBField, *args, **kwargs):
"""
Turns a callable into model field, analogous to python's ``@property`` decorator.
The callable will be used to compute the value of the fi... | {
"content_hash": "cd3fa222339e285addfb5709545bbba6",
"timestamp": "",
"source": "github",
"line_count": 346,
"max_line_length": 121,
"avg_line_length": 35.956647398843934,
"alnum_prop": 0.5975403906438389,
"repo_name": "alex-mcleod/django-denorm",
"id": "f8d2fc3d90792d45fbc2731e1e49fd8b8199be00",
"... |
import argparse
import os
import stat
import sys
voice_parse_error = "Error in line %d: voice lines must look like 'David: zarvox' (without quotes)"
dialog_name_error = "Error in line %d: name '%s' was not assigned a voice"
dialog_parse_error = "Error in line %d: dialogue lines must look like 'David: hello there' (wit... | {
"content_hash": "ca04a4e5e83455d47f2cbeb0a2ee7249",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 108,
"avg_line_length": 29.246575342465754,
"alnum_prop": 0.5587822014051522,
"repo_name": "david-crespo/say_script",
"id": "0f307b0f95ecaf4848777d7d978002b50bec4592",
"siz... |
"""
Test how lldb reacts to wrong commands
"""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class UnknownCommandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__... | {
"content_hash": "0a61a719b33e475be7346dfd92e079d9",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 95,
"avg_line_length": 35.69230769230769,
"alnum_prop": 0.7133620689655172,
"repo_name": "youtube/cobalt_sandbox",
"id": "c25f9afbfa4eda9f9844c12114a553deb11fd20b",
"size":... |
import argparse
import sys
import os
import tempfile
import shutil
import subprocess
import ntpath
"""
-h, --help show this help message and exit
-o PATH, --output-path PATH
Directory where output files will be written
-n NAME Analysis name
--output-format FORMAT... | {
"content_hash": "e3d0aeea9c6f582c5e0ac8d96b1bd912",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 187,
"avg_line_length": 51.12307692307692,
"alnum_prop": 0.5761360216671683,
"repo_name": "saketkc/galaxy_tools",
"id": "ec91eba1e3a25ee152177fd9fd8da97bdb6ea0da",
"size":... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'NetworkGroup.slug'
db.delete_column(u'organisation_networkgroup', 'slug')
... | {
"content_hash": "99e56e13f22cff1adaf88a3c107f1871",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 200,
"avg_line_length": 78.7741935483871,
"alnum_prop": 0.5566475566475566,
"repo_name": "MjAbuz/foundation",
"id": "04ca34ccda32363d8cd8336fd14d3e36e7dc79ae",
"size": "14... |
"""TPU Feature Column Library."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import math
import enum
from tensorflow.python.feature_column import feature_column as fc
from tensorflow.python.feature_column import feature_column_lib as fc_li... | {
"content_hash": "992ecab301958d4aec33bfe5fd959822",
"timestamp": "",
"source": "github",
"line_count": 1078,
"max_line_length": 112,
"avg_line_length": 43.526901669758814,
"alnum_prop": 0.6774221047696176,
"repo_name": "petewarden/tensorflow",
"id": "32472053791d15df5a69049a1d59cb63b1f6f865",
"siz... |
import random
from sqlalchemy import exc
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import lambda_stmt
from sqlalchemy import String
from sqlalchemy import testing
from sqlalchemy import update
from sqlalchemy.future import select
from sqlalchemy.orm import aliased
from sqlalchemy... | {
"content_hash": "c02d6aa4f33223759937b4a1cd6acdca",
"timestamp": "",
"source": "github",
"line_count": 463,
"max_line_length": 79,
"avg_line_length": 31.481641468682504,
"alnum_prop": 0.514681668496158,
"repo_name": "j5int/sqlalchemy",
"id": "6de702ad4b0cd529cc05a2911e6daf583cec5c70",
"size": "145... |
"""Simulates carbon-cache after loading the carbon plugin.
This fail is required as there is no way to load a plugin from
carbon configuration, such as what
https://github.com/graphite-project/carbon/pull/139
implements.
"""
from __future__ import absolute_import
from __future__ import print_function
import os
import... | {
"content_hash": "e113b70dcf3098f3b8042f3f9f6d34d6",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 79,
"avg_line_length": 37.89795918367347,
"alnum_prop": 0.691437802907916,
"repo_name": "natbraun/biggraphite",
"id": "bab009053164f4e5db5f24a1f308cf1591492609",
"size": "2... |
"""Support for wired binary sensors attached to a Konnected device."""
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_STATE,
CONF_BINARY_SENSORS,
CONF_DEVICES,
CONF_NAME,
CONF_TYPE,
)
from homeassistant.core import cal... | {
"content_hash": "0611dbcc110f777173339372e920a34f",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 85,
"avg_line_length": 30.325842696629213,
"alnum_prop": 0.62726935902186,
"repo_name": "home-assistant/home-assistant",
"id": "2647d43a44eaa6b00335797a365271ad3c4fe3c5",
"... |
import contextlib
import pandas
import pytest
import modin.pandas as pd
import numpy as np
from numpy.testing import assert_array_equal
from modin.utils import get_current_execution, to_pandas
from modin.test.test_utils import warns_that_defaulting_to_pandas
from pandas.testing import assert_frame_equal
from .utils im... | {
"content_hash": "3927534f74382cfc67f2377878a7d632",
"timestamp": "",
"source": "github",
"line_count": 824,
"max_line_length": 88,
"avg_line_length": 34.112864077669904,
"alnum_prop": 0.5708491942082607,
"repo_name": "modin-project/modin",
"id": "4b6f3a4acdf2ae6d12a3035d6b2d3f86cb880a68",
"size": ... |
"""
tests.test_component_group
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests the group compoments.
"""
# pylint: disable=protected-access,too-many-public-methods
import unittest
import logging
import homeassistant as ha
from homeassistant.const import STATE_ON, STATE_OFF, STATE_HOME, STATE_UNKNOWN
import homeassistant.component... | {
"content_hash": "1f80110b88e19318a9de4ed2ef590f64",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 82,
"avg_line_length": 37.37155963302752,
"alnum_prop": 0.6047624892598502,
"repo_name": "Jaidan/jaidan-hab-home-assistant",
"id": "36ce2b80319b9a9a4e9b555e8b212ce6a152e49b"... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Budget'
db.create_table(u'accounting_main_budget', (
(u'id', self.gf(... | {
"content_hash": "debf83bb671b660c4d404dc9e5d066b9",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 195,
"avg_line_length": 78.39574468085107,
"alnum_prop": 0.5699397492265104,
"repo_name": "ArcaniteSolutions/truffe2",
"id": "3fb99479e4d0002ac59f0acb0ea34ca3ccc6543a",
"s... |
import os
import time
import threading
import logging
from cactus.utils.filesystem import fileList
from cactus.utils.network import retry
class PollingListener(object):
def __init__(self, path, f, delay = .5, ignore = None):
self.path = path
self.f = f
self.delay = delay
self.ignor... | {
"content_hash": "516349e73e57837baf43bfb04c7502b5",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 83,
"avg_line_length": 24.879518072289155,
"alnum_prop": 0.49878934624697335,
"repo_name": "danielmorosan/Cactus",
"id": "ea67ab2a17dc38a16735345dd2a4727cc33b51a7",
"size":... |
class BansheePackage (Package):
def __init__ (self):
Package.__init__ (self, 'banshee', 'master')
self.sources = [
'git://git.gnome.org/banshee'
]
self.git_branch = 'master'
self.configure = [ 'NOCONFIGURE=1 ./autogen.sh && ./profile-configure %{profile.name} --prefix=%{prefix}' ]
self.sources.extend(... | {
"content_hash": "a59f2a1c1020b44fea311433cee21bcb",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 109,
"avg_line_length": 23.77777777777778,
"alnum_prop": 0.6238317757009346,
"repo_name": "bl8/bockbuild",
"id": "79f1f30c809fc1082e022e2f0044af11b16081b9",
"size": "428",
... |
from django.db import models
from django.conf import settings
from allauth.account.models import EmailAddress
def _path_to_avatar(instance, filename):
return '{user_id}/{dirname}/{filename}'.format(
user_id=instance.user.id,
dirname=settings.AVATAR_DIR_NAME,
... | {
"content_hash": "8a5e25c694cfa88f558dd683137d000b",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 99,
"avg_line_length": 39.39473684210526,
"alnum_prop": 0.6259185036740147,
"repo_name": "vuonghv/brs",
"id": "cb110924b0604685f889e834b65f2d85acef8ef0",
"size": "1497",
... |
"""
open-dobot Accelerometers Calibration tool.
This tool continuously reports accelerometers and angles from those.
Use this tool to find offsets for your accelerometers.
Follow the procedure below to enable accelerometers reporting mode on FPGA.
No action required on RAMPS as GY-521 accelerometers can be read at a... | {
"content_hash": "87aa58dd2d8eb581f0d7b2f04831e234",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 167,
"avg_line_length": 44.12307692307692,
"alnum_prop": 0.7294281729428173,
"repo_name": "maxosprojects/open-dobot",
"id": "7f55458d3cbf42896acaf493192ce75d4f6eed3c",
"siz... |
"""
The NumastatCollector collects numa statistics for all nodes.
#### Dependencies
* /sys/devices/system/node
#### Starting point
* https://github.com/disqus/diamond-collectors/blob/master/numastat/numastat.py
"""
import os
import diamond.collector
class NumastatCollector(diamond.collector.Collector):
N... | {
"content_hash": "8a5c0476216c937c0e29004bc5ba3e69",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 80,
"avg_line_length": 24.47222222222222,
"alnum_prop": 0.5465380249716232,
"repo_name": "venkey-ariv/fullerite",
"id": "2df1b20734da23d3701a8a92d906495dac3caacb",
"size": ... |
from django import forms
from .validators import IBANValidator, BICValidator, IBAN_COUNTRY_CODE_LENGTH
DEFAULT_DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'
'%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
'%d %b %Y', '%d %b, %Y',... | {
"content_hash": "9588a5e3ac06fd3b8e7c3e5e04f684c7",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 118,
"avg_line_length": 38.91111111111111,
"alnum_prop": 0.6105082809822958,
"repo_name": "patrickcurl/ztruck",
"id": "0051a2dc3dbe39e7d48d364e34065682763e00b8",
"size": "... |
import os
from wic import msger
from wic.utils import runner
from wic.utils.errors import ImageError
from wic.utils.fs_related import *
from wic.utils.oe.misc import *
# Overhead of the MBR partitioning scheme (just one sector)
MBR_OVERHEAD = 1
# Size of a sector in bytes
SECTOR_SIZE = 512
class Image:
"""
... | {
"content_hash": "c09e69b0e936aa98bc03fbc19038ec3b",
"timestamp": "",
"source": "github",
"line_count": 340,
"max_line_length": 122,
"avg_line_length": 40.911764705882355,
"alnum_prop": 0.5098490294751977,
"repo_name": "wwright2/dcim3-angstrom1",
"id": "fb95cc790e0016a2ecf307841b9d9f48a1f04f13",
"s... |
from __future__ import absolute_import
from copy import copy
from collections import (Iterable, Mapping, defaultdict)
import functools
import itertools
import six
def is_nonstring_iterable(value):
"""
:param value: the object to check
:return: whether the given value is a non-string iterable object
""... | {
"content_hash": "db3f87b23c3d51f1911d90b63f08a368",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 122,
"avg_line_length": 32.77732793522267,
"alnum_prop": 0.6364871541501976,
"repo_name": "ohsu-qin/qiutil",
"id": "d191c7e29bfec9492f9c23802dbf3b0efac6202d",
"size": "827... |
import _plotly_utils.basevalidators
class BordercolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="bordercolor", parent_name="sankey.hoverlabel", **kwargs
):
super(BordercolorValidator, self).__init__(
plotly_name=plotly_name,
... | {
"content_hash": "a09f29d3f342bb4c721e7dea9c7a2d6e",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 82,
"avg_line_length": 35.2,
"alnum_prop": 0.5984848484848485,
"repo_name": "plotly/python-api",
"id": "cf9dd26c84aff54cf6d7a2dda10826f92a148df5",
"size": "528",
"binary"... |
"""Tests for the Bond fan device."""
from __future__ import annotations
from datetime import timedelta
from unittest.mock import call
from bond_api import Action, DeviceType, Direction
import pytest
from homeassistant import core
from homeassistant.components import fan
from homeassistant.components.bond.const impor... | {
"content_hash": "d002eadc53f259c014c3c70c8714871c",
"timestamp": "",
"source": "github",
"line_count": 477,
"max_line_length": 114,
"avg_line_length": 35.39622641509434,
"alnum_prop": 0.650497512437811,
"repo_name": "GenericStudent/home-assistant",
"id": "061e94595bf41de71efe8f89efb5b6c780cde7c5",
... |
import copy
import tkinter as tk
from pprint import pprint
import numpy as np
from img_utils.tk_scrolled_frame import ScrolledFrame
from img_utils.scrolled_canvas import ScrolledCanvas
class EntryTable(tk.Frame):
"""
Tkinter table sth like Excel matrix.
raw_kernel = [][] Table with tk.StringVar()
np... | {
"content_hash": "8a5fb3fc9cb2850b58fa301a8c7f0f5e",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 81,
"avg_line_length": 28.36046511627907,
"alnum_prop": 0.5432554325543255,
"repo_name": "hawwestin/MSR.APO",
"id": "4b3de929c5db8053d4da6764f8bec1db9b022650",
"size": "243... |
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/chemistry/shared_medpack_wound_strength_e.iff"
result.attribute_template_id = -1
result.stfName("string_id_table","")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "c0694169ca73c4e3b724b62e24d4308d",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 89,
"avg_line_length": 24.46153846153846,
"alnum_prop": 0.7012578616352201,
"repo_name": "anhstudios/swganh",
"id": "39d20dd3498ec3725cedf9843f9a0b7f35e5686c",
"size": "463... |
from sentry.utils.locking.lock import Lock
class LockManager(object):
def __init__(self, backend):
self.backend = backend
def get(self, key, duration, routing_key=None):
"""
Retrieve a ``Lock`` instance.
"""
return Lock(self.backend, key, duration, routing_key)
| {
"content_hash": "d7827a7826762ddb7ad5ffd55e720442",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 61,
"avg_line_length": 26.083333333333332,
"alnum_prop": 0.6134185303514377,
"repo_name": "mitsuhiko/sentry",
"id": "e479dc5e1be8daa0c7b65e9ab5776874e2fb4087",
"size": "313... |
import sys
# [START storage_release_event_based_hold]
from google.cloud import storage
def release_event_based_hold(bucket_name, blob_name):
"""Releases the event based hold on a given blob"""
# bucket_name = "my-bucket"
# blob_name = "my-blob"
storage_client = storage.Client()
bucket = storage... | {
"content_hash": "f8ddd4a8697b5b9e2944d874238eb881",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 76,
"avg_line_length": 23.85185185185185,
"alnum_prop": 0.6739130434782609,
"repo_name": "googleapis/python-storage",
"id": "1db637cd9e7f40203698a425983ef5c0e10e55b7",
"siz... |
"""Part of the Keras training engine related to distributed training.
"""
# pylint: disable=protected-access
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import numpy as np
from tensorflow.python.framework import errors
from tensorflow.python.k... | {
"content_hash": "5e65437a63aca1d8616e7069cc12e554",
"timestamp": "",
"source": "github",
"line_count": 441,
"max_line_length": 83,
"avg_line_length": 37.36507936507937,
"alnum_prop": 0.667738803252822,
"repo_name": "aselle/tensorflow",
"id": "75e466d593899ee3c94d257981afc62ce014f07a",
"size": "171... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class ListInventorySupplyByDateRange(Choreography):
def __init__(self, temboo_session):
"""... | {
"content_hash": "49907e9c1c6b82966e1343daac0a6ed9",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 284,
"avg_line_length": 55.21782178217822,
"alnum_prop": 0.7202797202797203,
"repo_name": "jordanemedlock/psychtruths",
"id": "61e3c76d51e500036cd9c948163dd5f7504e9786",
"... |
import re
from datetime import datetime
from werkzeug.security import generate_password_hash, check_password_hash
from flask import url_for
from flask.ext.login import UserMixin
from . import db, login_manager
class User(UserMixin, db.Model):
__tablename__ = 'user'
id = db.Column(db.Integer, primary_key=Tru... | {
"content_hash": "c2ee5dcd966b31db1f68c8c10115b522",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 78,
"avg_line_length": 31.048076923076923,
"alnum_prop": 0.5977082688138743,
"repo_name": "poulp/flask-todolist",
"id": "26334a230f6a93d6ff4b9ec2753be93cc7f98467",
"size":... |
import collections
import contextlib
import json
import os
import posixpath
import socket
import sys
import threading
import types
from . import streamname, varint
_StreamParamsBase = collections.namedtuple('_StreamParamsBase',
('name', 'type', 'content_type', 'tags', 'tee', 'binary_file_extension'))
# Magic n... | {
"content_hash": "dd21d39038faf531565c4b60e09b45d2",
"timestamp": "",
"source": "github",
"line_count": 579,
"max_line_length": 80,
"avg_line_length": 32.15371329879102,
"alnum_prop": 0.6653596175538486,
"repo_name": "endlessm/chromium-browser",
"id": "89bbe77f09ab427fba5d028f4546bfe1a909fbf2",
"si... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import logging
import time
from ray.tune.error import TuneError
from ray.tune.experiment import convert_to_experiment_list, Experiment
from ray.tune.analysis import ExperimentAnalysis
from ray.tune.suggest imp... | {
"content_hash": "72f1e3c06ee9469fd42b6639bf066ae5",
"timestamp": "",
"source": "github",
"line_count": 335,
"max_line_length": 79,
"avg_line_length": 41.298507462686565,
"alnum_prop": 0.6252981568485725,
"repo_name": "ujvl/ray-ng",
"id": "73747c449da79a665dbca7bf1595350f3dbc0a08",
"size": "13835",... |
from django.apps import AppConfig
class MyblogConfig(AppConfig):
name = 'myblog'
| {
"content_hash": "33031554fb7df867314e5223ddc0157e",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 33,
"avg_line_length": 17.4,
"alnum_prop": 0.7471264367816092,
"repo_name": "robalford/reConstruct",
"id": "5e29c8d94efb8d09fa361bbfd37b8672a7e3a7e4",
"size": "87",
"binar... |
"""Unit test for cgroups module.
"""
import builtins
import io
import os
import shutil
import tempfile
import unittest
import mock
import treadmill
from treadmill import cgroups
from treadmill import cgutils
PROCCGROUPS = """#subsys_name hierarchy num_cgroups enabled
cpuset 4 1 0
ns ... | {
"content_hash": "410caa0f1474e95932f2f3f570564226",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 78,
"avg_line_length": 42.851851851851855,
"alnum_prop": 0.5202325764123517,
"repo_name": "keithhendry/treadmill",
"id": "5d0901fd8cbadbee8dab3595767d74d039e46bde",
"size"... |
"""
Copyright (c) 2016, John Deutscher
Description: Sample Python script for Azure Media Indexer V1
License: MIT (see LICENSE.txt file for details)
Documentation : https://azure.microsoft.com/en-us/documentation/articles/media-services-index-content/
"""
import os
import json
import azurerm
import time
import sys
#impo... | {
"content_hash": "e22203b475f4ae298b8c2a4d27134911",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 192,
"avg_line_length": 50.430034129692835,
"alnum_prop": 0.6389415268002165,
"repo_name": "gbowerman/azurerm",
"id": "6d7ad92fd630ed5c3c569f0bf4712c8697e57838",
"size": "... |
from oslo_config import cfg
ephemeral_storage_encryption_group = cfg.OptGroup(
name='ephemeral_storage_encryption',
title='Ephemeral storage encryption options')
ephemeral_storage_encryption_opts = [
cfg.BoolOpt('enabled',
default=False,
help="""
Enables/disables LVM epheme... | {
"content_hash": "b91de3ee32f0e6d08a41d3b9dbd42b01",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 78,
"avg_line_length": 26.387755102040817,
"alnum_prop": 0.6705336426914154,
"repo_name": "xuweiliang/Codelibrary",
"id": "8747cfc27287bf982c9b45c37c6ad42872c5495c",
"size"... |
class GiraffeException(Exception):
pass
class EdgeCreatesLoop(GiraffeException):
pass
class NoSuchVertex(GiraffeException):
pass
class NoSuchEdge(GiraffeException):
pass
| {
"content_hash": "480ae9d18c320b44b52f1971b0c1266c",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 40,
"avg_line_length": 17.181818181818183,
"alnum_prop": 0.7724867724867724,
"repo_name": "Julian/giraffe",
"id": "965f28f66ffe60471fca40f6d0cc3a907060502f",
"size": "189",... |
import re
import uuid
from pylons import tmpl_context as c
from pylons.controllers.util import abort
from r2.lib.validator import (
Validator,
VBoolean,
VLength,
VMarkdownLength,
VPermissions,
)
from r2.lib.db import tdb_cassandra
from r2.lib.errors import errors
from r2.lib.utils import UrlParser... | {
"content_hash": "13756ee13fc466dd751bf73db284a0a0",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 108,
"avg_line_length": 25.91156462585034,
"alnum_prop": 0.5914938304016802,
"repo_name": "madbook/reddit-plugin-liveupdate",
"id": "f2a556ecc68e622054b1cb025ca733587270c378... |
"""test checking use of the logging module
"""
__revision__ = ''
import __builtin__
# Muck up the names in an effort to confuse...
import logging as renamed_logging
import os as logging
FORMAT_STR = '{0}, {1}'
# Statements that should be flagged:
renamed_logging.debug('{0}, {1}'.format(4, 5))
renamed_logging.log(r... | {
"content_hash": "284b8f3bd19d883393871facc5132fb2",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 68,
"avg_line_length": 30.84,
"alnum_prop": 0.6964980544747081,
"repo_name": "willemneal/Docky",
"id": "efe6b1a80154df48a8f45b2883ad433c8b58a096",
"size": "815",
"binary"... |
"""
Module to do callbacks for Keras models.
"""
from __future__ import division
from keras.callbacks import Callback # ModelCheckpoint , EarlyStopping
import matplotlib.pyplot as plt
import h5py
import itertools
import logging
import numpy as np
import os
import subprocess
import shutil
import codecs
import sys
fro... | {
"content_hash": "61cbe0a68630e4dbc8f652806788a389",
"timestamp": "",
"source": "github",
"line_count": 404,
"max_line_length": 99,
"avg_line_length": 41.38861386138614,
"alnum_prop": 0.562346749596316,
"repo_name": "elliottd/GroundedTranslation",
"id": "5766868b9e5ffbb1a2b492901d1b7734582e4ae7",
"... |
from decimal import Decimal as D
import zlib
from django.db import models
from django.db.models import Sum
from django.conf import settings
from django.utils.encoding import python_2_unicode_compatible
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from django.core.except... | {
"content_hash": "3ac67394ea5396c912dcf10074c74c1d",
"timestamp": "",
"source": "github",
"line_count": 850,
"max_line_length": 79,
"avg_line_length": 33.758823529411764,
"alnum_prop": 0.5871406168322008,
"repo_name": "kapt/django-oscar",
"id": "da4cfc6f3e8a49876e5a08acfa66cf8de63b93cd",
"size": "2... |
import os
import shutil
import time
from mklib import Task
from mklib.common import relpath
class foo(Task):
default = True
results = ["foo.txt"]
deps = ["bar.txt"]
def make(self):
src = self.deps[0].path
dst = self.results[0].path
self.log.info("cp %s %s", relpath(src), relpat... | {
"content_hash": "5b67ef5c4266b68223ce534c2b38cd46",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 61,
"avg_line_length": 22.321428571428573,
"alnum_prop": 0.552,
"repo_name": "ActiveState/mk",
"id": "f730d5a0e8a7dfd1b3a7e4a2eaba92d308f2bc8f",
"size": "625",
"binary": ... |
import pytest
from actstream.actions import follow
from grandchallenge.notifications.models import Notification
from tests.factories import UserFactory
from tests.notifications_tests.factories import NotificationFactory
@pytest.mark.django_db
def test_notification_preference_created():
u = UserFactory()
pre... | {
"content_hash": "176e68198db54166d40969afff57ca8b",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 76,
"avg_line_length": 25.666666666666668,
"alnum_prop": 0.7422577422577422,
"repo_name": "comic/comic-django",
"id": "713e58a2168a13477cee67e68fca66a30e66c868",
"size": "1... |
''' Used by :class:`hystrix.command.Command` to record metrics.'''
from __future__ import absolute_import
import logging
import six
from hystrix.rolling_number import RollingNumber
log = logging.getLogger(__name__)
class Metrics(object):
""" Base class for metrics
Args:
counter (:class:`hystrix.ro... | {
"content_hash": "43748aadd633d3fa2bd089a70264da8a",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 79,
"avg_line_length": 31.221556886227546,
"alnum_prop": 0.5573456079785194,
"repo_name": "yonglehou/hystrix-py",
"id": "dc9438fa29d8c590147f50e874b7eb2f1d76813f",
"size":... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.base.address import SyntheticAddress, parse_spec
from pants.base.address_lookup_error import AddressLookupError
from pants.base.build_graph import BuildGrap... | {
"content_hash": "563e7c63423059146255d7a145489a74",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 103,
"avg_line_length": 41.80898876404494,
"alnum_prop": 0.5739496551106333,
"repo_name": "TansyArron/pants",
"id": "63afac7ce997ff0dc3cf1670a9bcb5489cef6efc",
"size": "11... |
"""
Freezes final grades for a course
"""
import csv
import argparse
from collections import namedtuple
from django.core.management import BaseCommand, CommandError
from grades.models import ProctoredExamGrade
class ParsingError(CommandError):
"""Custom class for parsing exceptions"""
pass
class GradeRowPa... | {
"content_hash": "01360eb1614b6d95f456767cac91d90f",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 113,
"avg_line_length": 41.79831932773109,
"alnum_prop": 0.6252513067953357,
"repo_name": "mitodl/micromasters",
"id": "b59f947632eb19e13dc0384944eada9ee7051e2d",
"size": ... |
"""
.. module: security_monkey.views.GuardDutyEventMapPointsList
:platform: Unix
.. version:: $$VERSION$$
.. moduleauthor:: Pritam D. Gautam <pritam.gautam@nuagedm.com> @nuagedm
"""
import datetime
from flask import jsonify, request
from security_monkey import db, rbac
from security_monkey.views import Authentic... | {
"content_hash": "c2306316d4a72c752cef44c42eb0334e",
"timestamp": "",
"source": "github",
"line_count": 458,
"max_line_length": 119,
"avg_line_length": 39.87117903930131,
"alnum_prop": 0.4967964514539182,
"repo_name": "stackArmor/security_monkey",
"id": "0f0bc0167acec2cd27c33fd12e97f1f0414f9e7f",
"... |
"""Policy package for prngmgr."""
| {
"content_hash": "a8849ba1bd2a0cb6a29a394b72c21635",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 33,
"avg_line_length": 34,
"alnum_prop": 0.6764705882352942,
"repo_name": "wolcomm/prngmgr",
"id": "54797a7390af4037d259ae135d97ad4809e508d6",
"size": "686",
"binary": fal... |
from thumbor.loaders import http_loader
from tornado.concurrent import return_future
from urllib import unquote
def _normalize_url(url):
url = http_loader.quote_url(unquote(url))
return url if url.startswith('http') else 'https://%s' % url
def validate(context, url):
return http_loader.validate(context,... | {
"content_hash": "1f32bf39a46d61c8ad12792f86f4f4ca",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 91,
"avg_line_length": 27.76,
"alnum_prop": 0.7463976945244957,
"repo_name": "jdunaravich/thumbor",
"id": "cee70e9564c7a78b136def10eeb1dc7c23e56210",
"size": "945",
"bina... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import SimpleHTTPServer
import SocketServer
import unittest
from contextlib import contextmanager
from threading import Thread
from pants.base.build_invalid... | {
"content_hash": "74b4b3fa2d8c40cb3c4990ba23d9d120",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 98,
"avg_line_length": 37.14666666666667,
"alnum_prop": 0.6834170854271356,
"repo_name": "scode/pants",
"id": "845a7723daa582db60f83b79bd27a6fc06728838",
"size": "8505",
... |
"""Generate notebooks and documentation from python scripts."""
from __future__ import print_function
import os
import os.path
from glob import glob
import re
import pickle
from timeit import default_timer as timer
import warnings
import py2jn
import pypandoc
import nbformat
from sphinx.ext import intersphinx
from ... | {
"content_hash": "1a3021bc407e9249c890a33a2a2d8924",
"timestamp": "",
"source": "github",
"line_count": 1078,
"max_line_length": 79,
"avg_line_length": 34.57421150278293,
"alnum_prop": 0.5694239489147058,
"repo_name": "bwohlberg/sporco",
"id": "cce59696931ad81a988fd8ae58feb3853f1ae2d3",
"size": "37... |
import argparse
import sys
from cardice.config import Configurator
from cardice.provision import Provisioner
USAGE = """cardice command [options...]"""
def make_parser():
"""Parse commandline arguments using a git-like subcommands scheme"""
common_parser = argparse.ArgumentParser(
add_help=False,
... | {
"content_hash": "a19817ad1643bb89e5c34beb142866cb",
"timestamp": "",
"source": "github",
"line_count": 144,
"max_line_length": 78,
"avg_line_length": 30.618055555555557,
"alnum_prop": 0.6194148332955318,
"repo_name": "ogrisel/cardice",
"id": "b880a6cef9df89f105772a1d196900f6fc2d1f54",
"size": "440... |
"""cutarelease -- Cut a release of your project.
A script that will help cut a release for a git-based project that follows
a few conventions. It'll update your changelog (CHANGES.md), add a git
tag, push those changes, update your version to the next patch level release
and create a new changelog section for that new... | {
"content_hash": "b90aeb100d6b8e68349594070865e1c4",
"timestamp": "",
"source": "github",
"line_count": 593,
"max_line_length": 87,
"avg_line_length": 36.251264755480605,
"alnum_prop": 0.5661720240033493,
"repo_name": "Mitali-Sodhi/CodeLingo",
"id": "67ae02050fd1abb5d0d0084d4153c608cbf270f0",
"size... |
from case import Case
class Case7_1_2(Case):
DESCRIPTION = """Send two close frames"""
EXPECTATION = """Clean close with normal code. Second close frame ignored."""
def init(self):
self.suppressClose = True
def onConnectionLost(self, failedByMe):
Case.onConnectionLost(se... | {
"content_hash": "6d77a3d91d2e1d73d53f6c14afe5776c",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 112,
"avg_line_length": 29.20689655172414,
"alnum_prop": 0.6139315230224321,
"repo_name": "frivoal/presto-testo",
"id": "26394a4fc76d07a0efb7ad4b441c211246f1b3b9",
"size": ... |
"""
This file contains preprocessing tools based on polynomials.
"""
import collections
from numbers import Integral
from itertools import chain, combinations
from itertools import combinations_with_replacement as combinations_w_r
import numpy as np
from scipy import sparse
from scipy.interpolate import BSpline
from s... | {
"content_hash": "a3c298d6dca5aa28cc6536fea0e5b628",
"timestamp": "",
"source": "github",
"line_count": 936,
"max_line_length": 88,
"avg_line_length": 38.48183760683761,
"alnum_prop": 0.5379660734612288,
"repo_name": "betatim/scikit-learn",
"id": "3e1dd4f6602b336a9539b1aedef7cbf7cec74fe9",
"size": ... |
import ctypes
from ctypes import WinDLL, wintypes
shell32 = WinDLL("shell32")
kernel32 = WinDLL("kernel32")
shlwapi = WinDLL("shlwapi")
GetCommandLineW = kernel32.GetCommandLineW
GetCommandLineW.argtypes = []
GetCommandLineW.restype = wintypes.LPCWSTR
CommandLineToArgvW = shell32.CommandLineToArgvW
CommandLineToArg... | {
"content_hash": "2db9e3a7246558adee1fde4ec3b377c0",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 78,
"avg_line_length": 27.579881656804734,
"alnum_prop": 0.7747264535507402,
"repo_name": "lazka/senf",
"id": "ab312e4317c63a5f1d2e00b5c41dfbaa436580e1",
"size": "5779",
... |
import json
import os
BASE_DIR = os.path.dirname(__file__)
def load_debater_rankings():
return json.load(
open(os.path.join(BASE_DIR, "debater_finished_scores.json"), "r"))
def load_team_rankings():
return json.load(
open(os.path.join(BASE_DIR, "team_finished_scores.json"), "r"))
| {
"content_hash": "8f9b2965899c85a8f49a38d7c0bfea58",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 74,
"avg_line_length": 22.142857142857142,
"alnum_prop": 0.6516129032258065,
"repo_name": "jolynch/mit-tab",
"id": "fd5f7a4ddb6d2f45e9ffc85f6cc60241c6b05e41",
"size": "310"... |
"""Excel IRTDServer implementation.
This module is a functional example of how to implement the IRTDServer interface
in python, using the pywin32 extensions. Further details, about this interface
and it can be found at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexcl2k2/html/odc_xlrtdfaq.a... | {
"content_hash": "8494596cc0a4cc33fe03134e039c6c19",
"timestamp": "",
"source": "github",
"line_count": 409,
"max_line_length": 106,
"avg_line_length": 37.960880195599024,
"alnum_prop": 0.6818240370990596,
"repo_name": "huguesv/PTVS",
"id": "fea0754fec63380fac06b42b697321be71fb0c51",
"size": "15526... |
import re
import smartypants
def amp(text):
"""Wraps apersands in HTML with ``<span class="amp">`` so they can be
styled with CSS. Apersands are also normalized to ``&``. Requires
ampersands to have whitespace or an `` `` on both sides.
>>> amp('One & two')
u'One <span class="amp">&<... | {
"content_hash": "e6cef0023106799faeadd54e485f442d",
"timestamp": "",
"source": "github",
"line_count": 245,
"max_line_length": 168,
"avg_line_length": 42.118367346938776,
"alnum_prop": 0.532319023161159,
"repo_name": "mirisuzanne/sidesaddle",
"id": "f0517e960d1f476f5a53d848212593900c9208ed",
"size... |
"""
Code in ``conda.base`` is the lowest level of the application stack. It is loaded and executed
virtually every time the application is executed. Any code within, and any of its imports, must
be highly performant.
Conda modules importable from ``conda.base`` are
- ``conda._vendor``
- ``conda.base``
- ``conda.comm... | {
"content_hash": "d51d4e84da87aa92914f02ddfd2ae267",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 95,
"avg_line_length": 26.944444444444443,
"alnum_prop": 0.7072164948453609,
"repo_name": "zooba/PTVS",
"id": "b5bc3ae1ad278385fe1bb12b03ec2d75b4cacc54",
"size": "584",
"... |
import dataclasses
import json # type: ignore
import re
from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union
import warnings
from google.api_core import gapic_v1, path_template, rest_helpers, rest_streaming
from google.api_core import exceptions as core_exceptions
from google.api_core import retr... | {
"content_hash": "fdcef2f381bb998ff63f54c5cb2cf6a2",
"timestamp": "",
"source": "github",
"line_count": 1144,
"max_line_length": 105,
"avg_line_length": 40.25699300699301,
"alnum_prop": 0.5802101880401268,
"repo_name": "googleapis/python-compute",
"id": "8b1ac042a56a28e04ae5b6fad83a80c922b49449",
"... |
import six.moves.builtins as __builtin__
setattr(__builtin__, '_', lambda x: x)
# Set up logging to output debugging
import logging
logger = logging.getLogger()
hdlr = logging.FileHandler('run_tests.log', 'w')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.ad... | {
"content_hash": "2c485807f5eaf90165d8edfea55fed62",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 70,
"avg_line_length": 33.27272727272727,
"alnum_prop": 0.7459016393442623,
"repo_name": "tantexian/sps-2014-12-4",
"id": "b1f12689adcacc3a739339b2cb1835bd1c9a5cbb",
"size"... |
"""Common parameter types for validating a request reference."""
boolean = {
'type': 'boolean',
'enum': [True, False]
}
# NOTE(lbragstad): Be mindful of this pattern as it might require changes
# once this is used on user names, LDAP-based user names specifically since
# commas aren't allowed in the following... | {
"content_hash": "5821ac0820cfe0acc33dc5df1551fc57",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 78,
"avg_line_length": 30.72222222222222,
"alnum_prop": 0.596745027124774,
"repo_name": "hughsaunders/keystone",
"id": "4ee08e1320835b89d1a266938368672e3cb26566",
"size": "... |
import statistics
from typing import TextIO, Tuple, Dict
from aoc2019.intcode import Computer, read_program
def render_screen(computer: Computer, screen: Dict[Tuple[int, int], int]):
while computer.output:
x = computer.output.popleft()
y = computer.output.popleft()
val = computer.output.p... | {
"content_hash": "6ac0a2bb011fdef4ac4d69e29d909eed",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 77,
"avg_line_length": 23.473684210526315,
"alnum_prop": 0.5896860986547086,
"repo_name": "bertptrs/adventofcode",
"id": "5aea8bd0de99df8b348638b785891cc2a7aa1d05",
"size":... |
"""
WSGI config for opencmdb project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETT... | {
"content_hash": "4400c21483e69d2bb4f00d18826185e2",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 24.5625,
"alnum_prop": 0.7709923664122137,
"repo_name": "unixhot/opencmdb",
"id": "a3263e7a6b8f57886ac4c6e12755e12e23b57662",
"size": "393",
"binar... |
from ..core import Dimensioned, AttrTree
try:
import pandas
from .pandas import DFrame # pyflakes:ignore (API import)
except:
pandas = None
try:
import seaborn
from .seaborn import * # pyflakes:ignore (API import)
except:
seaborn = None
from .collector import * # pyflakes:ignore (AP... | {
"content_hash": "641a075f7b17a2dba203169ac863fe87",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 70,
"avg_line_length": 25.26086956521739,
"alnum_prop": 0.6678141135972461,
"repo_name": "mjabri/holoviews",
"id": "7b90d8bbe095f802db9b35a5faa87b9ad049c506",
"size": "581"... |
from flask import current_app, request
from flask_appbuilder.security.sqla.models import Permission, Role
from marshmallow import ValidationError
from sqlalchemy import func
from airflow._vendor.connexion import NoContent
from airflow.api_connexion import security
from airflow.api_connexion.exceptions import AlreadyEx... | {
"content_hash": "d4eecb184657f0ffad5b022491b89ce4",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 107,
"avg_line_length": 40.713235294117645,
"alnum_prop": 0.6866534224309193,
"repo_name": "dhuang/incubator-airflow",
"id": "8996a189fd26d6460ebafdcfe959dc64c24f259c",
"s... |
"""
MoinMoin - init "logging" system
WARNING
-------
logging must be configured VERY early, before the code in log.getLogger
gets executed. Thus, logging is configured either by:
a) an environment variable MOINLOGGINGCONF that contains the path/filename
of a logging configuration... | {
"content_hash": "eb9ea55e17f6026511410540b8eeb59c",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 105,
"avg_line_length": 37.383720930232556,
"alnum_prop": 0.6575427682737169,
"repo_name": "Glottotopia/aagd",
"id": "92ca2aa33d28f7763b337e9aec4f3ed41d13aab4",
"size": "6... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: azure_rm_virtualnetworkpeering_facts
version_added: "2.8"
sho... | {
"content_hash": "b9394fdb5cc35540e46562fe943d20fb",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 180,
"avg_line_length": 34.82203389830509,
"alnum_prop": 0.5975906546605013,
"repo_name": "SergeyCherepanov/ansible",
"id": "7af9e30cc25f592233c7b18cbf328bd13919161c",
"si... |
import re
from pynmea.utils import checksum_calc
class NMEASentence(object):
""" Base sentence class. This is used to pull apart a sentence.
It will not have any real reference to what things mean. Things that
subclass this base class should all the additional functionality.
"""
def __init... | {
"content_hash": "4b52a965ba35509097c9674095b2c849",
"timestamp": "",
"source": "github",
"line_count": 959,
"max_line_length": 102,
"avg_line_length": 33.56934306569343,
"alnum_prop": 0.5133724722765819,
"repo_name": "esatel/ADCPy",
"id": "2d44398f129d77ceb3119cb73f95985fa6e69a72",
"size": "32193"... |
import pandas as pd, numpy as np, os, gc
# LOAD AND FREQUENCY-ENCODE
FE = ['EngineVersion','AppVersion','AvSigVersion','Census_OSVersion']
# LOAD AND ONE-HOT-ENCODE
OHE = [ 'RtpStateBitfield','IsSxsPassiveMode','DefaultBrowsersIdentifier',
'AVProductStatesIdentifier','AVProductsInstalled', 'AVProductsEnabled',... | {
"content_hash": "042cd0e7012dfe71e9a3e7aaf6d9db3a",
"timestamp": "",
"source": "github",
"line_count": 278,
"max_line_length": 956,
"avg_line_length": 41.910071942446045,
"alnum_prop": 0.682087374474294,
"repo_name": "AdityaSoni19031997/Machine-Learning",
"id": "6dbea4bd6b7f4304e701dc21660bc69c09da9... |
class ConnectionResolverInterface(object):
def connection(self, name=None):
raise NotImplementedError()
def get_default_connection(self):
raise NotImplementedError()
def set_default_connection(self, name):
raise NotImplementedError()
| {
"content_hash": "7734fdfcb3684eae4d22030ccb45cfb5",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 43,
"avg_line_length": 27.3,
"alnum_prop": 0.706959706959707,
"repo_name": "sdispater/eloquent",
"id": "d9329b90e1fbac6360e55d1002b8fb8560da082b",
"size": "299",
"binary"... |
from __future__ import unicode_literals
from django.db import migrations
import djgeojson.fields
def forwards_func(apps, schema_editor):
# We get the model from the versioned app registry;
# if we directly import it, it'll be the wrong version
Organization = apps.get_model("organizations", "Organization"... | {
"content_hash": "b6f85147e9e190a7f8fb61cf53e08a6f",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 94,
"avg_line_length": 29.285714285714285,
"alnum_prop": 0.6731707317073171,
"repo_name": "watchdogpolska/watchdog-kj-kultura",
"id": "6a2b9e794345f4f685c0aa50a4bac50adffe284... |
'''
libqp test script
'''
import libqp
print 'test hand and card:'
cd = libqp.card_t()
cd.suit = libqp.cdSuitHeart
cd.rank = libqp.cdRankAce
h = libqp.hand_new(20)
print 'push' a card to hand'
libqp.hand_push(h,cd)
cd.rank = libqp.cdRank2
print 'push a card to hand'
libqp.hand_push(h,cd)
print 'print a hand'
libqp.h... | {
"content_hash": "c6c1c03f8ad5e748ce3551d730ebcb83",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 29,
"avg_line_length": 18.666666666666668,
"alnum_prop": 0.7053571428571429,
"repo_name": "huangtao/qipai",
"id": "be960e504cb85fb5c14739a0af269d0da95203e4",
"size": "336",... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'BillingContactInfo'
db.create_table('accounting_billingcontactinfo', (
('account', self.gf('djan... | {
"content_hash": "fd178d3db43595446bc5ba3a6b5b49c1",
"timestamp": "",
"source": "github",
"line_count": 247,
"max_line_length": 175,
"avg_line_length": 76.34412955465586,
"alnum_prop": 0.5713528132788884,
"repo_name": "SEL-Columbia/commcare-hq",
"id": "816bcf251739414e095cd9acb709a854481a4010",
"si... |
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.core.exceptions import ValidationError
from lists.models import (
ListModel
)
User = get_user_model()
class ListModelTestCase(TestCase):
fixtures = [
'users.json',
'lists.json',
]
def test_we... | {
"content_hash": "7d48e1567221f8a0f9f44d50ea9d727d",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 70,
"avg_line_length": 27.87912087912088,
"alnum_prop": 0.5652345289712258,
"repo_name": "petkostas/Todo-List",
"id": "7705caaeedc9d3b71ebe3821be8d303885526d0a",
"size": "2... |
"""
Given a string s consists of upper/lower-case alphabets and empty space
characters ' ', return the length of last word in the string.
If the last word does not exist, return 0.
Note: A word is defined as a character sequence consists of non-space
characters only.
For example, Given s = "Hello World",
return 5.
"... | {
"content_hash": "9b0b14828da7c69194c02fee37b431c0",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 71,
"avg_line_length": 22.9,
"alnum_prop": 0.512372634643377,
"repo_name": "shichao-an/leetcode-python",
"id": "772576bd912e7fbc985681a29d4d94c9a573e628",
"size": "687",
... |
def fizz_buzz(number):
if number % 15 == 0:
return "Fizz Buzz"
elif number % 3 == 0:
return "Fizz"
elif number % 5 == 0:
return "Buzz"
return str(number)
if __name__ == '__main__':
# These using only for self-checking and not necessary for auto-testing
assert fizz_buzz(... | {
"content_hash": "e17e218f2be5e64374e94aea3caa7525",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 75,
"avg_line_length": 34.125,
"alnum_prop": 0.5824175824175825,
"repo_name": "kpbochenek/empireofcode",
"id": "d00b6d65e835fb5a3172a6fc25431892244800a0",
"size": "571",
... |
"""Utilities for unit-testing Keras."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import contextlib
import functools
import itertools
import threading
import numpy as np
from tensorflow.python import tf2
from tensorflow.python.eag... | {
"content_hash": "74a28987ce4ef809dced4a3b0de36d98",
"timestamp": "",
"source": "github",
"line_count": 1085,
"max_line_length": 92,
"avg_line_length": 34.04516129032258,
"alnum_prop": 0.6731367930913127,
"repo_name": "aam-at/tensorflow",
"id": "fecf52e71b358090d194c7d15b430a143eff0cc1",
"size": "3... |
import os
def command():
# TODO: make this look for entry_points so third-party templates can be used
# TODO: make this verify that there's a manifest.json present
# TODO: make this display manifest.json's description along side template names
import armstrong.cli.templates
p = armstrong.cli.templ... | {
"content_hash": "78a3d0467cf740b10b765083d53dcb95",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 83,
"avg_line_length": 43,
"alnum_prop": 0.687984496124031,
"repo_name": "armstrong/armstrong.cli",
"id": "b5f2080a54faf3a6c8bdaf647be60020c9d75271",
"size": "516",
"bina... |
class Collection(object):
def __init__(self, items=None):
"""
Creates a new Collection
:param items: The collection items
:type items: dict or list or Collection
:rtype: None
"""
if items is None:
items = []
else:
items = sel... | {
"content_hash": "b8d1be28098166ce394913162523d263",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 94,
"avg_line_length": 24.8546511627907,
"alnum_prop": 0.5396491228070175,
"repo_name": "sdispater/eloquent",
"id": "5ccf84b1c7c2275c97f46884eb88d0ac40b0dea8",
"size": "43... |
import sys
import os
import os.path as P
import subprocess
import shutil
from subprocess import PIPE
crates = {
"ndarray": ("docs", ""),
"ndarray-rand": ("", "ndarray-rand"),
#"ndarray-rblas": ("", "ndarray-rblas"),
}
def crate_name(s):
"""Return crate name (with underscores) """
return s.replace(... | {
"content_hash": "b352f0fca24cb0c9e72c021f3d7b9777",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 114,
"avg_line_length": 27.38961038961039,
"alnum_prop": 0.5765765765765766,
"repo_name": "Pireax/rust-ndarray",
"id": "a207f65962fa999c6d9c104c347be2876e944113",
"size": "... |
from django.contrib.postgres.indexes import BrinIndex, GinIndex
from django.db import connection
from django.test import skipUnlessDBFeature
from . import PostgreSQLTestCase
from .models import CharFieldModel, IntegerArrayModel
@skipUnlessDBFeature('has_brin_index_support')
class BrinIndexTests(PostgreSQLTestCase):
... | {
"content_hash": "ca32f71fb1eda783cdd79ed316d11cc3",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 107,
"avg_line_length": 45.11538461538461,
"alnum_prop": 0.6681585677749361,
"repo_name": "mattseymour/django",
"id": "9298b86e7387cb857bdc722a9d5db51ce1fb4f1d",
"size": "... |
"""
Project name: Open Methodology for Security Tool Developers
Project URL: https://github.com/cr0hn/OMSTD
Copyright (c) 2014, cr0hn<-AT->cr0hn.com
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. R... | {
"content_hash": "9c68dfe600c33a1e06aefb68d9bd86af",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 755,
"avg_line_length": 36.94392523364486,
"alnum_prop": 0.663546673412598,
"repo_name": "goyoregalado/OMSTD",
"id": "bacb354ced18b7edc48f58dcefaf60708a90e4a6",
"size": "3... |
import sys
import os
import subprocess
from optparse import OptionParser
def main(argv=None):
parser = OptionParser(usage="Usage: %prog [options] [--] VAR=VALUE... command [options] arg1 arg2...")
parser.add_option("-i", "--ignore-environment",
action="store_true", default=False,
... | {
"content_hash": "477d2d1ed73bb4c9999ed62f0213910b",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 106,
"avg_line_length": 29,
"alnum_prop": 0.5501567398119123,
"repo_name": "irinabov/debian-qpid-proton",
"id": "443bdcac68ecd07aa47ffa87a4b13f744e4df5d2",
"size": "2147",
... |
import pytest
from numpy.testing import assert_equal
from spacy import util
from spacy.training import Example
from spacy.lang.en import English
from spacy.language import Language
from spacy.tests.util import make_tempdir
from spacy.morphology import Morphology
from spacy.attrs import MORPH
from spacy.tokens import D... | {
"content_hash": "08a46ee4f92d4915b4d53f4abe7d1f10",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 102,
"avg_line_length": 35.64824120603015,
"alnum_prop": 0.6265858471948125,
"repo_name": "honnibal/spaCy",
"id": "11d6f0477d49a7f52187cd30aa5d4998bdfb04d4",
"size": "7094... |
from .conf import settings
from .interrogate import (
node_installed, node_version, node_version_raw, raise_if_node_missing, raise_if_node_version_less_than, run_command
)
def ensure_node_installed():
raise_if_node_missing()
def ensure_node_version_gte(required_version):
ensure_node_installed()
rais... | {
"content_hash": "0a46fbe77375a33657ba330020e5a799",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 119,
"avg_line_length": 26.166666666666668,
"alnum_prop": 0.7282377919320594,
"repo_name": "markfinger/python-nodejs",
"id": "c6e77ed79831edba915176e54066d7a168dcde40",
"si... |
from typing import Dict, List, Tuple
from collections import Counter
import numpy as np
from sklearn.utils.linear_assignment_ import linear_assignment
from overrides import overrides
from allennlp.training.metrics.metric import Metric
@Metric.register("conll_coref_scores")
class ConllCorefScores(Metric):
def __i... | {
"content_hash": "573d93544bff0d9c61ca37700207e03f",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 138,
"avg_line_length": 43.85858585858586,
"alnum_prop": 0.5971902349147858,
"repo_name": "nafitzgerald/allennlp",
"id": "1428f76981c90879ae3579d43cd57d642eec1071",
"size"... |
from django.shortcuts import render
def index(request):
return render(request, 'index.html', {
'foo': 'bar',
})
| {
"content_hash": "b4c551d0486bd7fbf3397b5742a79b70",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 42,
"avg_line_length": 19.142857142857142,
"alnum_prop": 0.5970149253731343,
"repo_name": "Semprini/cbe-utilities",
"id": "4a5405a9e735075417a313f4d0c888eae34e1c10",
"size":... |
import sys, os
def copydata(outfile, infile):
while 1:
data = infile.read(512)
if (data):
outfile.write(data)
else:
break
def alignoffset(outfile):
offset = outfile.tell()
outfile.seek((offset + 511) & ~511)
return outfile.tell()
def appendimage(outfile... | {
"content_hash": "a26234297397bddc69e7373f43ddccd9",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 90,
"avg_line_length": 27.347826086956523,
"alnum_prop": 0.6446740858505564,
"repo_name": "ghostkim-sc/SMG920T_profiling_enabled",
"id": "dcc82949c3232c7fac9bb9eabc0b133c7c2d... |
"""Utility functions specifically for airdialogue model."""
import codecs
import random
import re
import numpy as np
import tensorflow.compat.v1 as tf
from airdialogue.evaluator import infer_utils
from airdialogue.evaluator.metrics import f1
from airdialogue.evaluator.metrics.flight_distance import generate_scaled_fli... | {
"content_hash": "ecfe01e399b99189b3a5390f047ebe38",
"timestamp": "",
"source": "github",
"line_count": 328,
"max_line_length": 100,
"avg_line_length": 34.551829268292686,
"alnum_prop": 0.6052236830495015,
"repo_name": "google/airdialogue_model",
"id": "864832e52b4a945412d96ec9119b0a7085d150f1",
"s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.