text stringlengths 4 1.02M | meta dict |
|---|---|
import socket
try:
from select import poll, POLLIN
except ImportError: # `poll` doesn't exist on OSX and other platforms
poll = False
try:
from select import select
except ImportError: # `select` doesn't exist on AppEngine.
select = False
def is_connection_dropped(conn): # Platform-... | {
"content_hash": "631d499262db7e26a81104233b021f74",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 76,
"avg_line_length": 33.54,
"alnum_prop": 0.6243291592128801,
"repo_name": "angela278/UPDream",
"id": "9ed5a64c1d5bcc8aba69ba3da9e868385b66aa3c",
"size": "3354",
"bina... |
import pkg_resources
import re
import optparse
import os
import stat
import sys
import imp
from paste.script import command
from paste.script import create_distro
beginning_letter = re.compile(r"^[^a-z]*")
valid_only = re.compile(r"[^a-z0-9_]")
class MokshaQuickstartCommand(command.Command):
"""Create new Moksha... | {
"content_hash": "10e722287b8c29b6bde040462d0132e0",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 83,
"avg_line_length": 34.8719512195122,
"alnum_prop": 0.5679314565483476,
"repo_name": "ralphbean/moksha",
"id": "45afa902a85e9efc79557bc78ec4c094d0231e45",
"size": "5719... |
import hashlib
import hmac
import posixpath
import httplib2
from oslo_cache import core as cache_core
from oslo_config import cfg
from oslo_log import log as logging
import six
import six.moves.urllib.parse as urlparse
import webob
from ec2api import context as ec2_context
from ec2api import exception
from ec2api.i18... | {
"content_hash": "67cacfe9570788697e7a82722abcd576",
"timestamp": "",
"source": "github",
"line_count": 271,
"max_line_length": 78,
"avg_line_length": 40.210332103321036,
"alnum_prop": 0.5747453427548866,
"repo_name": "stackforge/ec2-api",
"id": "aea8b9d8631469756be01ecb53faa3f1f3407d24",
"size": "... |
import errno
import os
import re
import subprocess
import sys
def get_keywords():
# these strings will be replaced by git during git-archive.
# setup.py/versioneer.py will grep for the variable names, so they must
# each be defined on a line of their own. _version.py will just call
# get_keywords().
... | {
"content_hash": "f50bf827ea2c6d603bda3fd073cc7a1c",
"timestamp": "",
"source": "github",
"line_count": 450,
"max_line_length": 79,
"avg_line_length": 33.94444444444444,
"alnum_prop": 0.5711292962356792,
"repo_name": "brocade/pysdn",
"id": "0e6cf35524f1aaa014e3d1b521d307936641058d",
"size": "15750"... |
import urllib2
from bs4 import BeautifulSoup
def crawl(url):
soup = BeautifulSoup(urllib2.urlopen(url).read())
title = soup.title.text.split('|', 1)[0].strip()
episodes = []
resources = soup.select('dl.resource-list')
for resource in resources:
resource_items = resource.select('dd.resource... | {
"content_hash": "cafe0044d295f01fd30d208dd336ef9c",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 64,
"avg_line_length": 34.875,
"alnum_prop": 0.49372759856630827,
"repo_name": "exherb/tvee",
"id": "4b40eec41cf67f6e96fedddefaa524630d0f56e4",
"size": "1154",
"binary": ... |
from rest_framework import status as http_status
import itertools
from flask import request
from framework import status
from framework.exceptions import HTTPError
from framework.flask import redirect # VOL-aware redirect
from framework.auth.decorators import must_be_signed
from website.archiver import ARCHIVER_SU... | {
"content_hash": "b4c894c3a1ef2ff6f3dcfa45dac9ce9b",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 166,
"avg_line_length": 39.77307692307692,
"alnum_prop": 0.6703413596363988,
"repo_name": "baylee-d/osf.io",
"id": "812ecc66d8b93021a5bc90cad161a2a52f302584",
"size": "103... |
from Exporter import Exporter
from ClassExporter import ClassExporter
from FunctionExporter import FunctionExporter
from EnumExporter import EnumExporter
from VarExporter import VarExporter
from infos import *
from declarations import *
import os.path
import exporters
import MultipleCodeUnit
#============... | {
"content_hash": "762175e173ab26b6601c3a862f36aa61",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 81,
"avg_line_length": 37.8051948051948,
"alnum_prop": 0.5984197870147716,
"repo_name": "DD-L/deel.boost.python",
"id": "9b3cce2f33672b98068fc84143a151c5e64343d6",
"size": ... |
import os
import sys
import pbr.version
# 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(os.pa... | {
"content_hash": "fc8cc148c470c5cfc672106e416d0e5b",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 88,
"avg_line_length": 31.96062992125984,
"alnum_prop": 0.6957378664695738,
"repo_name": "BjoernT/python-openstackclient",
"id": "f4434ec1547cc9ab847ac3f6ee102b44b71db9af",
... |
from pandac.PandaModules import *
from direct.directnotify.DirectNotifyGlobal import *
from direct.showbase import Loader
from toontown.toontowngui import ToontownLoadingScreen
from toontown.dna.DNAParser import *
class ToontownLoader(Loader.Loader):
TickPeriod = 0.2
def __init__(self, base):
Loader.L... | {
"content_hash": "c9beba664e44e9d84223407a435a7101",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 132,
"avg_line_length": 35.17,
"alnum_prop": 0.6044924651691783,
"repo_name": "ToonTownInfiniteRepo/ToontownInfinite",
"id": "253219f1ee4a7a46ecdd595ddbd510b7e725783e",
"s... |
"""
DataFrame
---------
An efficient 2D container for potentially mixed-type time series or other
labeled data series.
Similar to its R counterpart, data.frame, except providing automatic data
alignment and a host of useful data manipulation methods having to do with the
labeling information
"""
import collections
fro... | {
"content_hash": "8c9558e6e06024576d8bb16788bd17dd",
"timestamp": "",
"source": "github",
"line_count": 8436,
"max_line_length": 169,
"avg_line_length": 34.63442389758179,
"alnum_prop": 0.5217677016592739,
"repo_name": "toobaz/pandas",
"id": "33066ccef0687e0ca1345f3c6fbac72844717024",
"size": "2921... |
"""9-3. Users:
Make a class called User. Create two attributes called first_name
and last_name, and then create several other attributes that are typically stored
in a user profile . Make a method called describe_user() that prints a summary
of the user’s information . Make another method called greet_user() that... | {
"content_hash": "498187c7af348ff55f685ace905d3e4c",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 87,
"avg_line_length": 35.775862068965516,
"alnum_prop": 0.6318072289156627,
"repo_name": "AnhellO/DAS_Sistemas",
"id": "946298632bf2455270dbaa3fb86c600accc425b2",
"size": ... |
"""Tests for tensorflow.python.framework.python_api_parameter_converter."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
import numpy as np
from tensorflow.core.framework import types_pb2
from tensorflow.python im... | {
"content_hash": "a18fe815e411fd6ad5b1451aa8ef79d9",
"timestamp": "",
"source": "github",
"line_count": 472,
"max_line_length": 83,
"avg_line_length": 41.46822033898305,
"alnum_prop": 0.55765595463138,
"repo_name": "petewarden/tensorflow",
"id": "6c182163b98168be2c636b3f039ac279e2869668",
"size": "... |
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name=... | {
"content_hash": "4b38483a67f3702eb86460cd7be01251",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 114,
"avg_line_length": 32.458333333333336,
"alnum_prop": 0.5301668806161746,
"repo_name": "disko/modoboa-admin-limits",
"id": "ccc3b0b8e1c3b5fafe5c46149908baaab1028973",
"... |
from __future__ import division
import warnings
import numpy as np
from .widget import Widget
from ...util.np_backport import nanmean
class Grid(Widget):
"""
Widget that automatically sets the position and size of child Widgets to
proportionally divide its internal area into a grid.
Parameters
... | {
"content_hash": "3ed5ba4703f0d16add53d08ad81fce77",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 79,
"avg_line_length": 38.551867219917014,
"alnum_prop": 0.5431062318372619,
"repo_name": "sh4wn/vispy",
"id": "6bec17c9eedf8be3ed494c59af29e4aa7bd7bfa7",
"size": "9436",
... |
from __future__ import print_function
import eagle_util_funcs
import os.path
import subprocess
import sys
try:
import yaml
except ImportError:
print('Please install PyYaml')
sys.exit(1)
def generate_gerber(brdFile, outFile, layers):
ret = eagle_util_funcs.run_eagle([
'-X', # Run ... | {
"content_hash": "a21ff3a4d58f28e0e83eb0a67b856cd8",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 77,
"avg_line_length": 29.810526315789474,
"alnum_prop": 0.5787429378531074,
"repo_name": "SamboyKirk/tenshi",
"id": "5827bfc2428307d4ea6f0312f6c468d310f2421c",
"size": "36... |
"""Utilities to normalize a stream of tensors (typically observations)."""
import tensorflow as tf
class Normalizer(tf.Module):
"""Normalizes tensors by tracking their element-wise mean and variance."""
def __init__(self, eps=0.001, clip_range=(-5, 5)):
"""Initialize the normalizer.
Args:
eps: A ... | {
"content_hash": "b3d1756811bb5efca2f282cbccac5a0f",
"timestamp": "",
"source": "github",
"line_count": 196,
"max_line_length": 80,
"avg_line_length": 38.234693877551024,
"alnum_prop": 0.6453162530024019,
"repo_name": "google-research/seed_rl",
"id": "b7543a69ce9daca79cbc2ddb487a117366377c0a",
"siz... |
"""Config flow to configure forked-daapd devices."""
from contextlib import suppress
import logging
from pyforked_daapd import ForkedDaapdAPI
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PASSWORD, CONF_PORT
from homeassistant.core import ... | {
"content_hash": "871db8c63ab83b0c8185aafbd3f39fc7",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 86,
"avg_line_length": 36.58115183246073,
"alnum_prop": 0.5740661227994848,
"repo_name": "adrienbrault/home-assistant",
"id": "6bcc35f0a525a3807381ae31b9d00cdc7f3eba6f",
"... |
import os
import yaml
import unittest
from validator import Required, validate, InstanceOf
class TestAllYaml(unittest.TestCase):
def test_recursive_yaml(self):
yaml_files = []
for root, _, fnames in os.walk(os.getcwd()):
for fname in fnames:
if (fname.endswith('.yaml'... | {
"content_hash": "84c4a464cf7e43206d006c1d3bb1346f",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 71,
"avg_line_length": 36.166666666666664,
"alnum_prop": 0.4502304147465438,
"repo_name": "ritjoe/ofCourse",
"id": "061c9f140e7184f73c63c9c9a85b72de5744f4e1",
"size": "2170... |
"""Support for Blockchain.com sensors."""
from datetime import timedelta
import logging
from pyblockchain import get_balance, validate_address
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import ATTR_ATTRIBUTION, CONF_NAME
import homeassis... | {
"content_hash": "d748a05d13c5a52e278fa57cf4a9d1c9",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 73,
"avg_line_length": 27.85,
"alnum_prop": 0.698982645122681,
"repo_name": "Danielhiversen/home-assistant",
"id": "9d31d4c05838b015ac0654753a5d621021ed2b38",
"size": "1671... |
"""
This module contains the go to line dialog.
"""
from pyqode.core._forms import dlg_goto_line_ui
from pyqode.qt import QtWidgets
class DlgGotoLine(QtWidgets.QDialog, dlg_goto_line_ui.Ui_Dialog):
"""
Goto line dialog.
"""
def __init__(self, parent, current_line, line_count):
QtWidgets.QDialo... | {
"content_hash": "1f49e84980e09702fab5e4524f775fa8",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 76,
"avg_line_length": 35.69047619047619,
"alnum_prop": 0.6350900600400267,
"repo_name": "tommo/gii",
"id": "c462d9177170ed3bd3faf8f84f852ea141774e33",
"size": "1499",
"b... |
from convert_api_to_pypredef import Convert, Contains
try:
import unittest
except:
import sys
sys.stderr.write('--- PYTHONPATH FOUND:\n')
sys.stderr.write('\n'.join(sys.path))
sys.stderr.write('\n--- END PYTHONPATH\n')
raise
from StringIO import StringIO
#=======================================... | {
"content_hash": "4b36f77918d4e0697d812ae366f60c37",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 129,
"avg_line_length": 43.3448275862069,
"alnum_prop": 0.5318217979315831,
"repo_name": "ArcherSys/ArcherSys",
"id": "af58671a49278263cbc6724c4de81ced437ce12b",
"size": "2... |
import setuptools
setuptools.setup(
name="nova_dirsvc_plugin",
version=1,
packages=['nova_dirsvc_plugin'],
entry_points={
'nova.hooks': [
'create_instance=nova_dirsvc_plugin.hooks:SaveToDirSvc',
'delete_instance=nova_dirsvc_plugin.hooks:DeleteFromDirSvc',
]
}... | {
"content_hash": "0e657a4d222cb6b9b44a6abc04593673",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 72,
"avg_line_length": 24.923076923076923,
"alnum_prop": 0.6203703703703703,
"repo_name": "fultonj/nova_dirsvc_plugin",
"id": "f6460aed369b85ae3e15fb2225481a1b3d8d5909",
"s... |
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import lldb
def fuzz_obj(obj):
obj.Append(lldb.SBValue())
obj.GetSize()
obj.GetValueAtIndex(100)
obj.FindValueObjectByUID(200)
for val in obj:
s = str(val)
| {
"content_hash": "2638c24e39206c9c8fb42c616be993e1",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 88,
"avg_line_length": 20.285714285714285,
"alnum_prop": 0.6690140845070423,
"repo_name": "apple/swift-lldb",
"id": "f20c87752499e4d5bf4a9386b707ede49a706d7a",
"size": "284... |
import shutil
import os
import tempfile
import subprocess
import json
def run_test(code, test):
try:
# Create folder
tmp_dir = tempfile.mkdtemp()
print("Folder Created:",tmp_dir )
# Create the project
print("Creating Project", tmp_dir)
try:
out = subpr... | {
"content_hash": "5b5f770edc0852cd3cad09855a52ac76",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 110,
"avg_line_length": 25.56756756756757,
"alnum_prop": 0.47436575052854124,
"repo_name": "mariosky/protoboard",
"id": "d9ac6c00d37606340d15f10fd3d49ec06e62d2db",
"size":... |
import imp
import os.path
import sys
import unittest
from mojom.generate import module as mojom
from mojom.generate import translate
from mojom.parse import ast
class TranslateTest(unittest.TestCase):
"""Tests |parser.Parse()|."""
def testSimpleArray(self):
"""Tests a simple int32[]."""
# pylint: disabl... | {
"content_hash": "8e5f49e248970a79235eb4ee3289bfda",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 80,
"avg_line_length": 36.1078431372549,
"alnum_prop": 0.6326364376866684,
"repo_name": "nwjs/chromium.src",
"id": "4259374513f2bf7146e2f6ab6b6be958aa85f4ca",
"size": "382... |
"""Generates YAML configuration files for distributed Tensorflow workers.
The workers will be run in a Kubernetes (k8s) container cluster.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
# Note: It is intentional that we do n... | {
"content_hash": "9e22938d62fa726d4fd1348aa35d2ce3",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 79,
"avg_line_length": 28.275109170305676,
"alnum_prop": 0.5536679536679536,
"repo_name": "panmari/tensorflow",
"id": "e3fde2180acce87403f9364da94da65d9f96cd44",
"size": "... |
import random
import math
class Neuron(object):
def __init__(self, prev_n_neurons):
self._synapticWeights = []
for i in range(prev_n_neurons):
self._synapticWeights.append(random.random() - 0.5)
self.lamda = 1.5
self._activation = 0.0
def activate(self, inputs):
self._activation = 0.0
for i in range... | {
"content_hash": "336184eed7f88c6b9a07d0e99787978d",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 106,
"avg_line_length": 28.532544378698226,
"alnum_prop": 0.638946495230195,
"repo_name": "vigor95/vigor95.github.io",
"id": "800da8e6f8696272681916943219a03e3342b6d6",
"s... |
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
from tests import pyunit_utils
import h2o
import numpy as np
from h2o.utils.typechecks import assert_is_type
from h2o.frame import H2OFrame
def h2o_H2OFrame_cut():
"""
Python API test: h2o.frame.H2OFrame.cut(breaks, labels=None, in... | {
"content_hash": "127389e070976ec2d0feb0c212fb1444",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 117,
"avg_line_length": 39.833333333333336,
"alnum_prop": 0.7039748953974896,
"repo_name": "h2oai/h2o-3",
"id": "a08bc671a639f6572b000d00f16c9c51cddd8070",
"size": "956",
... |
"""
Library to make simple python functions as robot keywords
"""
import ipaddress
def get_ip_version(ip_string):
"""Get ip version as integer number"""
ip = ipaddress.ip_address(unicode(ip_string))
return ip.version
| {
"content_hash": "b4809710ab8145464b1538930e85ad3e",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 57,
"avg_line_length": 25.555555555555557,
"alnum_prop": 0.7130434782608696,
"repo_name": "rastislavszabo/vpp",
"id": "09f406d31723256a977351c0eaafbe58b0638a0b",
"size": "23... |
import unittest
import warnings
import mock
from brew.exceptions import DataLoaderException
from brew.exceptions import GrainException
from brew.exceptions import HopException
from brew.exceptions import YeastException
from brew.parsers import DataLoader
from brew.parsers import JSONDataLoader
from brew.parsers import... | {
"content_hash": "4e3e87e0d1ef1cd7de54b61139198381",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 86,
"avg_line_length": 34.48972602739726,
"alnum_prop": 0.6021249131168702,
"repo_name": "chrisgilmerproj/brewday",
"id": "f2ebff6033f10fe2eda20dbf5901bd076504394a",
"size... |
import os
from setuptools import find_packages
from setuptools import setup
PACKAGE_ROOT = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(PACKAGE_ROOT, 'README.rst')) as file_obj:
README = file_obj.read()
# NOTE: This is duplicated throughout and we should try to
# consolidate.
SETUP_B... | {
"content_hash": "8dd4831ccebd8fb1b7f60b05f14851cf",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 72,
"avg_line_length": 27.98148148148148,
"alnum_prop": 0.6194573130377233,
"repo_name": "Fkawala/gcloud-python",
"id": "98aea8dbe15b0ac807d0369380139b14dea6f2b3",
"size": ... |
from __future__ import print_function
import argparse
import requests
import json
import wget
import sys
import os
__author__ = "Vesselin Bontchev <[email protected]>"
__license__ = "GPL"
__VERSION__ = "1.02"
def error(e):
print("Error: %s." % e, file=sys.stderr)
sys.exit(-1)
def makeOutputDir(pageNum):
... | {
"content_hash": "0cb606778e20f9e2dde92def6671d3eb",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 87,
"avg_line_length": 32,
"alnum_prop": 0.5775162337662337,
"repo_name": "bontchev/wlscrape",
"id": "c48fc243c7945d357c40eb7041023119119c8563",
"size": "2487",
"binary":... |
import re
import string
from csmpe.plugins import CSMPlugin
from csmpe.core_plugins.csm_install_operations.ios_xe.utils import number_of_rsp
class Plugin(CSMPlugin):
"""
This plugin checks if the node redundancy is sufficient to proceed the upgrade.
"""
name = "Node Redundancy Check Plugin"
platfo... | {
"content_hash": "b7783c1e39acbbe9b19abc8df59fe146",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 83,
"avg_line_length": 32.77358490566038,
"alnum_prop": 0.4925158318940702,
"repo_name": "anushreejangid/csmpe-main",
"id": "7fd428f023372e4122ff56a73f7ece211faf81db",
"si... |
from will.plugin import WillPlugin
from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings
class EmergencyContactsPlugin(WillPlugin):
@respond_to("^set my contact info to (?P<contact_info>.*)", multiline=True)
def set_my_info(self, message, contact_info=""... | {
"content_hash": "bcb6e0289bf86e8fe09fdefc752ffc80",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 108,
"avg_line_length": 40.34615384615385,
"alnum_prop": 0.6291706387035272,
"repo_name": "woohgit/will",
"id": "d890c61d2b1c88d8a9eec277d52d4f4e6ca20d84",
"size": "1049",
... |
import os
import sys
import tempfile
import time
import numpy as np
import pytest
import ray
import ray._private.utils
import ray.ray_constants as ray_constants
from ray.exceptions import RayTaskError
from ray.test_utils import (wait_for_condition, SignalActor, init_error_pubsub,
get_error... | {
"content_hash": "7c4737538edde7838dc8feb376e1066f",
"timestamp": "",
"source": "github",
"line_count": 622,
"max_line_length": 79,
"avg_line_length": 30.726688102893892,
"alnum_prop": 0.6381331100879029,
"repo_name": "pcmoritz/ray-1",
"id": "e0407a728994dafeae086ca89720b7e04a3e3611",
"size": "1911... |
from __future__ import annotations
import collections
from datetime import timedelta
import functools
import gc
import json
import operator
import pickle
import re
from typing import (
TYPE_CHECKING,
Any,
AnyStr,
Callable,
Hashable,
Literal,
Mapping,
Sequence,
cast,
overload,
)
... | {
"content_hash": "1b8a0b763bcbf92e715097b7492cd492",
"timestamp": "",
"source": "github",
"line_count": 11642,
"max_line_length": 104,
"avg_line_length": 33.289125579797286,
"alnum_prop": 0.5206398109156964,
"repo_name": "gfyoung/pandas",
"id": "5f57c353391c2601c2476e6a7b8d7693d0eb9b28",
"size": "3... |
from api import *
import os
@cmd_func('ls', ['dir'])
def list_dir(interpreter, line):
if not line:
res = os.listdir('.')
else:
dir = os.path.dirname(line)
if not dir:
res = os.listdir('.')
inp = line
else:
res = os.listdir(dir)
in... | {
"content_hash": "e5c51c9808bf596369ed1b15a2a06e66",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 90,
"avg_line_length": 29.363636363636363,
"alnum_prop": 0.544891640866873,
"repo_name": "kinpa200296/cmdpy",
"id": "6dce95e442071244c677b107fb147f01e448319f",
"size": "129... |
import copy
import os
import shutil
import tempfile
import mock
from oslo_utils import fileutils
from oslo_utils import timeutils
from cinder import test
from cinder.volume import configuration as conf
class TargetDriverFixture(test.TestCase):
def setUp(self):
super(TargetDriverFixture, self).setUp()
... | {
"content_hash": "c0023d8eb63bd23c0f48be01ec7d9032",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 79,
"avg_line_length": 40.277227722772274,
"alnum_prop": 0.5464601769911505,
"repo_name": "eharney/cinder",
"id": "1d1bf20669920d7331181581d42d2a633adf76bb",
"size": "4641... |
"""A simple JavaScript 1.5 lexer which is used for the JavaScript
extractor.
"""
import re
from operator import itemgetter
operators = [
'+', '-', '*', '%', '!=', '==', '<', '>', '<=', '>=', '=',
'+=', '-=', '*=', '%=', '<<', '>>', '>>>', '<<=', '>>=',
'>>>=', '&', '&=', '|', '|=', '&&', '||', '^', '^=',... | {
"content_hash": "6df17008c893d3ae9ca7bd67ff655652",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 76,
"avg_line_length": 31.753086419753085,
"alnum_prop": 0.49144634525660963,
"repo_name": "toomoresuch/pysonengine",
"id": "d063ef09c2f64f2841aca43f9144842121d41956",
"si... |
"""
Nordigen Account Information Services API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2.0 (v2)
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F... | {
"content_hash": "4b3c36a7ee8b874085d2c05cb98305b3",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 119,
"avg_line_length": 30.885714285714286,
"alnum_prop": 0.5723866790009251,
"repo_name": "ltowarek/budget-supervisor",
"id": "ec69fbdd76407b1dce7c8cc41e6f9362f7ecd22b",
... |
"""Remove assistance/vc columns from rb
Revision ID: 7024f7f66e20
Revises: a83e77e11e36
Create Date: 2019-04-25 15:07:20.614620
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '7024f7f66e20'
down_revision = 'a83e77e11e36'
branch_labels = None
depends_on = None
... | {
"content_hash": "6a780745d6bf67394bff94052b4dd417",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 113,
"avg_line_length": 41.95238095238095,
"alnum_prop": 0.674233825198638,
"repo_name": "DirkHoffmann/indico",
"id": "ff89c5244fc3b8daf28a400cbde58802437c7c77",
"size": "1... |
"""
Cell messaging module.
This module defines the different message types that are passed between
cells and the methods that they can call when the target cell has been
reached.
The interface into this module is the MessageRunner class.
"""
import sys
from eventlet import queue
from oslo.config import cfg
from nov... | {
"content_hash": "4fe50eff572cc213865026e2248933bf",
"timestamp": "",
"source": "github",
"line_count": 1369,
"max_line_length": 78,
"avg_line_length": 43.096420745069395,
"alnum_prop": 0.5880099662706147,
"repo_name": "DirectXMan12/nova-hacking",
"id": "6f4183f5d140619926975488cec486ce403be65d",
"... |
import binascii
import dns.exception
import dns.rdata
import dns.tokenizer
class NSAP(dns.rdata.Rdata):
"""NSAP record.
@ivar address: a NASP
@type address: string
@see: RFC 1706"""
__slots__ = ['address']
def __init__(self, rdclass, rdtype, address):
super(NSAP, self).__init__(rd... | {
"content_hash": "00f532b4f6cd870e957e214e15e0063b",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 76,
"avg_line_length": 30.046511627906977,
"alnum_prop": 0.6246130030959752,
"repo_name": "cloudera/hue",
"id": "05d0745ef83e6c568276389ae497f9554654e492",
"size": "2079",
... |
r"""Tests for tfrbert_task.py."""
import os
from absl import flags
from absl.testing import parameterized
import numpy as np
import tensorflow as tf
from official.nlp.configs import encoders
from tensorflow_ranking.extension.premade import tfrbert_task
from tensorflow_ranking.python import data as tfr_data
from tens... | {
"content_hash": "740b748abbddc9096d1832fa99dc718d",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 79,
"avg_line_length": 36.56331877729258,
"alnum_prop": 0.654484653051475,
"repo_name": "tensorflow/ranking",
"id": "d810b07d57ff4bb7c271608cdf44754fa44eae43",
"size": "89... |
from __future__ import absolute_import, division, print_function
from functools import wraps
__all__ = ['memoize', 'singleton', 'memoize_attr_check']
def _make_key(args, kwargs):
return args, frozenset(kwargs.items())
def memoize(func):
"""Save results of function calls to avoid repeated calculation"""
... | {
"content_hash": "4c3858449373e6b3f5ec225433f9676a",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 78,
"avg_line_length": 25.64367816091954,
"alnum_prop": 0.6131779471089198,
"repo_name": "stscieisenhamer/glue",
"id": "29d3727e38083b7ced9b53064ac5bfd0c68f4624",
"size": "... |
from django.core.exceptions import ValidationError
from django.utils.dateparse import parse_date
class DateDisplayMixin:
@property
def active_period_text(self):
text = f"{self.start_date.strftime('%d %b %Y')}"
if self.end_date:
return f"{text} to {self.end_date.strftime('%d %b %Y')... | {
"content_hash": "798ba3c24fc0ac21c514d4e07353262f",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 89,
"avg_line_length": 34.41860465116279,
"alnum_prop": 0.5527027027027027,
"repo_name": "DemocracyClub/EveryElection",
"id": "1e48f7ccc63973fb867e9a5c2c474eb1ad01c254",
"s... |
"""Support for Canary camera."""
import asyncio
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera
from homeassistant.components.ffmpeg import DATA_FFMPEG
from homeassistant.helpers import config_validation as cv
from homeassistan... | {
"content_hash": "126c718116fa87e70b623411ab70dbe3",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 87,
"avg_line_length": 31.25409836065574,
"alnum_prop": 0.6126409651193286,
"repo_name": "Cinntax/home-assistant",
"id": "8a6d27b891663d9270048496ba9dea481f0a4378",
"size"... |
from include import IncludeManager
from django.apps import apps
from django.db import models
from django.utils import timezone
from osf.models.base import BaseModel, ObjectIDMixin
from osf.utils.datetime_aware_jsonfield import DateTimeAwareJSONField
from osf.utils.fields import NonNaiveDateTimeField
from website.util ... | {
"content_hash": "74e1246e7f0cc0453ebb702143f2c972",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 123,
"avg_line_length": 40.185792349726775,
"alnum_prop": 0.6782703290726135,
"repo_name": "pattisdr/osf.io",
"id": "4f1b3d0e6432684e71a6da3f9cf8d88bb62b9b2e",
"size": "73... |
import unittest
import IECore
import Gaffer
import GafferTest
class SpeedTest( unittest.TestCase ) :
# original (r335):
#
# 15.110s
# 15.088s
# 15.102s
#
# interned string :
#
# 17.288s
# 17.216s
# 17.213s
#
# no setName in addChildInternal (still interned string) :
#
# 0.104s
# 0.099s
# 0.099s
#
... | {
"content_hash": "aabea18cf28f9155601ede13e6e0ef74",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 71,
"avg_line_length": 20.302325581395348,
"alnum_prop": 0.6609392898052692,
"repo_name": "paulondc/gaffer",
"id": "9135f65c0b502c81859a904519fe0cf9a2100df7",
"size": "3551... |
import os
from os.path import join
import sys
import json
import csv
import subprocess
import shutil
import itertools
from django.views.generic import ListView, DetailView
from django.views.generic.base import ContextMixin
from django.views.generic.edit import CreateView, DeleteView, UpdateView
from django.contrib.mes... | {
"content_hash": "92e9c98eadd9d30b8a3b0687fcef62e2",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 114,
"avg_line_length": 34.87218045112782,
"alnum_prop": 0.6191246226821906,
"repo_name": "0x0mar/memex-explorer",
"id": "2bd725565c6ccb9aaf5b87e283d7193db5ac9d1b",
"size"... |
"""
Support for Insteon dimmers via local hub control.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/light.insteon_local/
"""
import json
import logging
import os
from datetime import timedelta
from homeassistant.components.light import (
ATTR_BRI... | {
"content_hash": "f64da0b11b22e5132c5172511a0e209d",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 79,
"avg_line_length": 32.69101123595506,
"alnum_prop": 0.606461591338718,
"repo_name": "kyvinh/home-assistant",
"id": "c51c7d9d8390409a8deb3a00923e5cf87bb438c9",
"size": ... |
from django.http import HttpResponseRedirect, HttpResponse, Http404
from django import http
from django.shortcuts import get_object_or_404
from django.template.loader import render_to_string
from django.views.decorators.http import require_POST
from django.core.exceptions import ObjectDoesNotExist
from django.db import... | {
"content_hash": "4d54f4b26a2853bfc0c1c4f464e8ca95",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 128,
"avg_line_length": 35.02,
"alnum_prop": 0.7064534551684751,
"repo_name": "rmanocha/django-crowdsource",
"id": "49aee44071f9fab154e63049e4580f04c01c233e",
"size": "1751... |
"""Unit tests for ReviewRequestPageEntryRegistry."""
from __future__ import unicode_literals
from djblets.registries.errors import AlreadyRegisteredError
from reviewboard.reviews.detail import (BaseReviewRequestPageEntry,
ReviewRequestPageEntryRegistry)
from reviewboard.testin... | {
"content_hash": "e4db1358110b73e7577f224a40645873",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 78,
"avg_line_length": 34.54666666666667,
"alnum_prop": 0.6896950984175994,
"repo_name": "chipx86/reviewboard",
"id": "0af22861e022c1fb37d38b9f0307ffb3c8b67772",
"size": "2... |
import functools
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
f... | {
"content_hash": "c6837965d53df807090e73795b9af77e",
"timestamp": "",
"source": "github",
"line_count": 310,
"max_line_length": 214,
"avg_line_length": 44.170967741935485,
"alnum_prop": 0.6603373986708537,
"repo_name": "Azure/azure-sdk-for-python",
"id": "99514f21c10d847650c0dfcb1c8153867455b682",
... |
class cPDFiDNameObfuscation(cPluginParent):
# onlyValidPDF = True
name = 'Name Obfuscation plugin'
def __init__(self, oPDFiD):
self.oPDFiD = oPDFiD
def Score(self):
if sum([oCount.hexcode for oCount in self.oPDFiD.keywords.values()]) > 0:
return 1.0
else:
... | {
"content_hash": "6b35ed8f96376c1b64dda3514aa0b972",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 81,
"avg_line_length": 26.142857142857142,
"alnum_prop": 0.6256830601092896,
"repo_name": "Rafiot/KittenGroomer",
"id": "e116da2e571607206734476c00dfe93b5cc3c84b",
"size": ... |
from django.apps import AppConfig
class DjangoSmokeTestsConfig(AppConfig):
name = 'django_smoke_tests'
| {
"content_hash": "945a17a464982881e9af4dc6d4820862",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 40,
"avg_line_length": 21.8,
"alnum_prop": 0.7798165137614679,
"repo_name": "kamilkijak/django-smoke-tests",
"id": "e22c59a73e5e3a3da86c1674e8c17435869d366d",
"size": "129",... |
import socket
import threading
import json
class EnablerConnection():
def __init__(self):
self.connections = []
self.stopped = False
self.enabler_listening_port = 40001
self.local_ip = socket.gethostbyname(socket.gethostname())
t = threading.Thread(target=self.listen_loop,... | {
"content_hash": "fc3007f34a1bb952c017abf81aebb8cb",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 80,
"avg_line_length": 34.72222222222222,
"alnum_prop": 0.5704,
"repo_name": "worldline-spain/openxc-vehicle-simulator",
"id": "97b08cef24f2a40f01a225af4b3a8f416867b6ac",
"... |
"""Defines IntegrityChecker."""
import re
import concurrent.futures
from typing import ( # noqa: F401
Any,
cast,
List,
Optional,
Set,
)
from .function_description import ( # noqa: F401
FunctionDescription,
)
from .docstring.base import BaseDocstring
from .docstring.docstring import Docstring... | {
"content_hash": "1894abffe4135a73a1feb05e39f9e0b5",
"timestamp": "",
"source": "github",
"line_count": 542,
"max_line_length": 78,
"avg_line_length": 35.10516605166052,
"alnum_prop": 0.5648814842066537,
"repo_name": "terrencepreilly/darglint",
"id": "76349984a19e8b9af4ab7d8d8e7c57bfc267b216",
"siz... |
"""
make report for QA using reportlab module
"""
from reportlab.pdfgen import canvas
import numpy as N
import time
import os
def mk_dti_report(infile,dtidir,datavars):
#imgsnr,meansfnr,spikes,badvols):
timestamp=time.strftime('%B %d, %Y: %H:%M:%S')
report_header=[]
report_header.a... | {
"content_hash": "bf680c257a800433a8b823573895992c",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 109,
"avg_line_length": 32.20754716981132,
"alnum_prop": 0.6449912126537786,
"repo_name": "poldrack/dtiqa",
"id": "d07b0c8c0884dd676b8f1e4a0fc95068c4a97fd6",
"size": "1707"... |
"""
"""
from __future__ import absolute_import
from ..unitquantity import UnitLength, UnitQuantity
m = meter = metre = UnitLength(
'meter',
symbol='m',
aliases=['meters', 'metre', 'metres']
)
km = kilometer = kilometre = UnitLength(
'kilometer',
1000*m,
symbol='km',
aliases=['kilometers', ... | {
"content_hash": "603976524595814060be055a690d90fd",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 76,
"avg_line_length": 22.369791666666668,
"alnum_prop": 0.6190919674039581,
"repo_name": "AdaptiveApplications/carnegie",
"id": "0a7e822e21a2d7cdda8cd62d250ad79b53ff88a6",
... |
"""
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": "6a0aaea08bf8a1cc6bce039018695977",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 115,
"avg_line_length": 41.367924528301884,
"alnum_prop": 0.7393386545039908,
"repo_name": "arenadata/ambari",
"id": "736e5e36ebdfa51dcfb98a54f2c74e3b96d71f79",
"size": "4... |
"""
Support for native homogeneous lists.
"""
import math
import operator
from llvmlite import ir
from numba.core import types, typing, errors, cgutils
from numba.core.imputils import (lower_builtin, lower_cast,
iternext_impl, impl_ret_borrowed,
... | {
"content_hash": "c7a0e6bb76a52b33aa5cf0adf2fd43d8",
"timestamp": "",
"source": "github",
"line_count": 1254,
"max_line_length": 100,
"avg_line_length": 34.83014354066986,
"alnum_prop": 0.6092909311536965,
"repo_name": "seibert/numba",
"id": "69d5fbf4990f656e92adfad4fbf3fedfe4885bc4",
"size": "4367... |
import soundcloud
import requests
import sys
import argparse
import demjson
from datetime import datetime
from os.path import exists
from os import mkdir
from subprocess import Popen, PIPE
from mutagen.mp3 import MP3, EasyMP3
from mutagen.id3 import APIC
from mutagen.id3 import ID3 as OldID3
from clint.textui import ... | {
"content_hash": "01428f01605ca4b947fda97480b40ce1",
"timestamp": "",
"source": "github",
"line_count": 331,
"max_line_length": 141,
"avg_line_length": 37.09969788519638,
"alnum_prop": 0.5344462540716612,
"repo_name": "dylanlesko/SoundScrape",
"id": "81960f42aff5c56916180a7658371eb2b2499210",
"size... |
"""
Title: Gradient Centralization for Better Training Performance
Author: [Rishit Dagli](https://github.com/Rishit-dagli)
Date created: 06/18/21
Last modified: 06/18/21
Description: Implement Gradient Centralization to improve training performance of DNNs.
"""
"""
## Introduction
This example implements [Gradient Cen... | {
"content_hash": "f98cb6781b03e8fb950a319c0e4a2f0a",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 97,
"avg_line_length": 31.033834586466167,
"alnum_prop": 0.7182313749242883,
"repo_name": "keras-team/keras-io",
"id": "8e842ece0a4c8aad30000a13b9f195e739666641",
"size": ... |
"""
Read/Write Avro File Object Containers.
"""
import zlib
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from avro import schema
from avro import io
try:
import snappy
has_snappy = True
except ImportError:
has_snappy = False
#
# Constants
#
VERSION = 1
MAGIC = 'Obj' +... | {
"content_hash": "f663eb27695c687e15ed2dfaa4dd8427",
"timestamp": "",
"source": "github",
"line_count": 372,
"max_line_length": 78,
"avg_line_length": 32.206989247311824,
"alnum_prop": 0.6534512978883231,
"repo_name": "wuranbo/goavro",
"id": "2602acb1dd25c05c25a0093780da07a996827f05",
"size": "1276... |
'''
instruction: this script is used to write word document.
dependent: py-docx
'''
from docx import Document
from docx.shared import Inches
'''
reference method, not in use.
'''
def operDocx():
document = Document()
document.add_heading('Document Title', 0)
p = document.add_paragraph('A plain paragra... | {
"content_hash": "32f1d47cb4c8022d05406a3ae0507ffc",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 154,
"avg_line_length": 32.039370078740156,
"alnum_prop": 0.4863602850823298,
"repo_name": "clobob/generate_quizs",
"id": "40cd446c6553a2820cddbb4ecd95fcb413a9a0eb",
"size... |
import sys
import os
import zlib
import functools
import threading
from typing import Any, Callable, IO, Iterable, Optional, Tuple, Union, TYPE_CHECKING
from urllib.parse import urlencode
import requests
from requests.utils import super_len
if TYPE_CHECKING:
from requests_toolbelt import MultipartEncoder
from .c... | {
"content_hash": "7dccde0c456aab7a6c1d9d2b934decd1",
"timestamp": "",
"source": "github",
"line_count": 269,
"max_line_length": 99,
"avg_line_length": 28.78810408921933,
"alnum_prop": 0.6122159090909091,
"repo_name": "PKRoma/httpie",
"id": "4a993b3a25001ad6e1dcd5b420d8d4c772c5a5c5",
"size": "7744",... |
from SCons.Script import *
import os
import os.path
import glob
import platform
###############################################################################
# Modular library helpers
###############################################################################
import autoconfig
import toolsets
"""Make Root Env... | {
"content_hash": "56a660e529789c3cb7e1d078a3266b22",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 102,
"avg_line_length": 33.101190476190474,
"alnum_prop": 0.5119582808847329,
"repo_name": "pkrusche/bsponmpi_template",
"id": "2e0a51b94264f6f8b1767322554a3c5a596dc19e",
... |
"""Test configs for gather."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.compat.v1 as tf
from tensorflow.lite.testing.zip_test_utils import create_tensor_data
from tensorflow.lite.testing.zip_test_utils import make_zip_of_tests
from t... | {
"content_hash": "e202e2ba9f0f507c0672bdfbd670b4a4",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 78,
"avg_line_length": 33.24444444444445,
"alnum_prop": 0.5812165775401069,
"repo_name": "frreiss/tensorflow-fred",
"id": "bfb1d619f724c0b104db036fd66d25b594b13f4b",
"size"... |
from django.contrib import admin
from subcollections.models import Collection, Syndication
class CollectionAdmin(admin.ModelAdmin):
list_display = ('id', 'title', 'is_public', 'is_syndicated', 'updated')
search_fields = ['title', 'description', 'author']
raw_id_fields = ('items',)
readonly_fields = (... | {
"content_hash": "d024aac7dfd953106c5256c404fc0a0c",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 75,
"avg_line_length": 28.310344827586206,
"alnum_prop": 0.6516443361753959,
"repo_name": "uq-eresearch/uqam",
"id": "7ca5f27b3a5dad674e9d1b659e0814220883aa57",
"size": "82... |
from __future__ import unicode_literals
import frappe
import unittest
from .google_settings import get_file_picker_settings
class TestGoogleSettings(unittest.TestCase):
def setUp(self):
settings = frappe.get_single("Google Settings")
settings.client_id = "test_client_id"
settings.app_id = "test_app_id"
set... | {
"content_hash": "c132baabfddec19bcb6d0067078d545f",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 87,
"avg_line_length": 37.976190476190474,
"alnum_prop": 0.722257053291536,
"repo_name": "mhbu50/frappe",
"id": "cddf9f3697fd1eabcaf3d7437c14361660f49a9e",
"size": "1706",
... |
"""
Examples to use client api.
"""
from json import dumps
from os import environ
import requests
server = 'http://127.0.0.1:8000/'
root = server + 'api/'
# call client api requires valid user, you can register at first
auth = ('admin', 'admin')
def test_register_client():
"""use this api to register as a test... | {
"content_hash": "dad39a4fb2f2371cf9d3e1b75d6147cc",
"timestamp": "",
"source": "github",
"line_count": 172,
"max_line_length": 93,
"avg_line_length": 28.232558139534884,
"alnum_prop": 0.528830313014827,
"repo_name": "tobyqin/testcube",
"id": "0ce22ced749307410fe257e1318437d8681ffd02",
"size": "485... |
from chainer.dataset.tabular import _asmode # NOQA
from chainer.dataset.tabular import _concat # NOQA
from chainer.dataset.tabular import _join # NOQA
from chainer.dataset.tabular import _slice # NOQA
from chainer.dataset.tabular import _transform # NOQA
from chainer.dataset.tabular import _with_converter # NOQA
... | {
"content_hash": "f2d705bfdd497b0c3bbc82ea3fa87f58",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 76,
"avg_line_length": 51.333333333333336,
"alnum_prop": 0.7987012987012987,
"repo_name": "chainer/chainer",
"id": "eb78935b0e2c24957c27dca4683cef4c496ccf6b",
"size": "462",... |
import base64
import hashlib
import json
import os
import demistomock as demisto
import requests
from CommonServerPython import *
from CommonServerUserPython import *
handle_proxy()
VERIFY_CERTIFICATE = not demisto.params().get('insecure', False)
URL = demisto.params()['server']
XML_NS = demisto.params()['xml_ns']
US... | {
"content_hash": "17f8473997c87fcbe51595582eb37ab5",
"timestamp": "",
"source": "github",
"line_count": 409,
"max_line_length": 120,
"avg_line_length": 45.19804400977995,
"alnum_prop": 0.5695661581737531,
"repo_name": "VirusTotal/content",
"id": "3d79d52422c977d744515e79481eee95b2681a8d",
"size": "... |
from anndata import read_csv, read_h5ad, read_loom, read_text
from ._anndata import (
get_from_registry,
register_tensor_from_anndata,
setup_anndata,
transfer_anndata_setup,
view_anndata_setup,
)
from ._datasets import (
annotation_simulation,
brainlarge_dataset,
breast_cancer_dataset,
... | {
"content_hash": "c870cc2711c63edaec82cd569a8ebdda",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 73,
"avg_line_length": 22.35,
"alnum_prop": 0.6413124533929903,
"repo_name": "YosefLab/scVI",
"id": "d30ffe2cdaf1b843568445c91c7c2e6dc1de11e5",
"size": "1341",
"binary": ... |
from __future__ import unicode_literals
from django.db import models, migrations
import ckeditor.fields
class Migration(migrations.Migration):
dependencies = [
('biblioteca', '0002_auto_20160328_2122'),
]
operations = [
migrations.AlterModelOptions(
name='temas',
... | {
"content_hash": "be2256c48974c4d5c9dc7788cc1ed8a8",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 131,
"avg_line_length": 29.75,
"alnum_prop": 0.6002400960384153,
"repo_name": "ErickMurillo/plataforma_fadcanic",
"id": "6b8e1c2c56a7428131257b8ce260eab7592324a1",
"size": ... |
import os
import sys
import getpass
import subprocess
try:
from fabricate import *
except ImportError, e:
print "Couldn't find the fabricate module."
sys.exit(1)
sender_sources = ['sender.c']
receiver_sources = ['receiver.c']
includes = []
cflags = ['-ggdb', '-O2', '-fPIC',
'-std=gnu99', '-Wall', '-Werror']... | {
"content_hash": "5de86dd04c8dabff7c26fe0312410f99",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 68,
"avg_line_length": 19.55,
"alnum_prop": 0.6470588235294118,
"repo_name": "kklt92/NetworkingCodeExamples",
"id": "69d3fd311eaddb575bafae42201b5b4db722e443",
"size": "801... |
from django.conf.urls import include, url
urlpatterns = [
url(r'^event/', include('sedastrela.events.urls', namespace='events')),
url(r'^news/', include('sedastrela.news.urls', namespace='news')),
url(r'^page/', include('sedastrela.pages.urls', namespace='pages')),
url(r'^', include('sedastrela.home.u... | {
"content_hash": "fb547b3d944e8b1dcc90d6b3c8180a88",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 75,
"avg_line_length": 34.9,
"alnum_prop": 0.664756446991404,
"repo_name": "ondrejsika/sedastrela",
"id": "93a3d723458c506bc39d561288ff8d8c6fe6b28d",
"size": "349",
"bina... |
import os
import numpy as np
import flopy
pth = os.path.join('..', 'data', 'mf2005_test')
opth = os.path.join('data')
mname = 'tr2k_s3'
ml = flopy.modflow.Modflow.load(mname, version='mf2005', model_ws=pth, verbose=True)
ml.change_model_ws(opth)
ml.write_input()
ml.set_exename('mf2005dbl')
ml.run_model()
print('... | {
"content_hash": "ebe0bd25ad2d395dd5f91d3799da6606",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 84,
"avg_line_length": 17.526315789473685,
"alnum_prop": 0.6876876876876877,
"repo_name": "mrustl/flopy",
"id": "6fdfe659cb059570dfd75a2a716b1bcf671bdfa0",
"size": "333",
... |
"""This mod flips the the data along x or y direction."""
from colorview2d import imod
class Flip(imod.IMod):
"""
The mod class to flip the data.
"""
def __init__(self):
imod.IMod.__init__(self)
self.default_args = (True, )
def do_apply(self, data, modargs):
if modargs:
... | {
"content_hash": "126ab20ff3335ab2e80aee8788b4e3ea",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 57,
"avg_line_length": 19.45,
"alnum_prop": 0.5398457583547558,
"repo_name": "Loisel/colorview2d",
"id": "e7afb320978b8f11a963442b7c5e179ace2ba4c9",
"size": "389",
"binar... |
import decimal, logging
from django.db import models
from shops.models import Shop
from preferences.models import ShippingItem, ShippingPrice, ShippingWeight, TaxState
class ShippingCalculator():
@classmethod
def get_charge(cls, cart):
total_price = cart.total()
total_weight = cart.total... | {
"content_hash": "c8ed6549933d0a7849c0b95329e632c0",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 116,
"avg_line_length": 41.53658536585366,
"alnum_prop": 0.6259541984732825,
"repo_name": "codepython/CollectorCity-Market-Place",
"id": "44beeb3a7596aea6a455df7069501f3e5d8c... |
import os
import webapp2
IS_DEV = os.environ["SERVER_SOFTWARE"][:3] == "Dev"
allowed_users = set()
if IS_DEV:
allowed_users.add("dev-instance")
else:
# Add your Java App Engine proxy App Id here
allowed_users.add("your-java-appengine-proxy-app-id")
class LoggingHandler(webapp2.RequestHandler):
def po... | {
"content_hash": "bc13120b561673d34b6ae5885dd8a004",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 72,
"avg_line_length": 28.541666666666668,
"alnum_prop": 0.6773722627737226,
"repo_name": "tswast/java-docs-samples",
"id": "49145bbd749beadc388ff913dff4ed2956e0ff6e",
"siz... |
from __future__ import absolute_import
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.shortcuts import render
from typing import Callable
from confirmation.models import Confirmation
from zerver.lib.actions import do_change_notification_settings, clear_scheduled_emails
... | {
"content_hash": "6c3a7f88bcc7e8bb2510090e0d57a1c8",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 97,
"avg_line_length": 43.51724137931034,
"alnum_prop": 0.7603011093502378,
"repo_name": "verma-varsha/zulip",
"id": "08647cb681e88ccdf6b348d3ab1c36277ab55c05",
"size": "25... |
import argparse
import itertools
import json
import logging
import os
import re
import shutil
import signal
import socket
import subprocess
import sys
import time
import traceback
import logging.handlers
from scapy import config as scapy_config
scapy_config.logLevel = 40
scapy_config.use_pcap = True
import scapy.al... | {
"content_hash": "1da2012417588dd0271604e283ca0ecd",
"timestamp": "",
"source": "github",
"line_count": 676,
"max_line_length": 79,
"avg_line_length": 36.7085798816568,
"alnum_prop": 0.5405198468668144,
"repo_name": "Axam/nsx-web",
"id": "8400e9580b22d0a9f31782bdc4dfc1468c2a8b94",
"size": "25610",
... |
import numpy as np
import scipy.ndimage as ndimage
#import matplotlib
import matplotlib.pyplot as plt
import os
import glob
import datetime
from PIL import Image
from PIL import ImageEnhance
import webbrowser
import sys
ALPHA=.5
DELTA=r'$\Delta$'
COLORS=["b","g","orange","r","m"]
def COL(frac):
return plt.cm.get_... | {
"content_hash": "7c9ea149f158467d252357fd399d489b",
"timestamp": "",
"source": "github",
"line_count": 512,
"max_line_length": 122,
"avg_line_length": 42.96484375,
"alnum_prop": 0.6023274843167561,
"repo_name": "swharden/ROI-Analysis-Pipeline",
"id": "accba07ca4c773b06f031ba3109b5ed965df77af",
"si... |
import pandas
import numpy as np
from google.cloud import datastore
from math import floor
import pdb
RATING_KIND = 'Rating'
MOVIE_KIND = 'Movie'
PROJECT_ID = 'cf-mr-service'
client = datastore.Client(PROJECT_ID)
def load_from_store():
query = client.query(kind=RATING_KIND)
result = query.fetch()
rating =... | {
"content_hash": "1b605e8b0503b3b129b3a2a97b1b6292",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 110,
"avg_line_length": 33.25609756097561,
"alnum_prop": 0.6017601760176018,
"repo_name": "komod/cf-movie-recommend",
"id": "2e764231cf330a2c514be79457e8bde518fb1578",
"siz... |
"""
This module is deprecated.
Please use :mod:`airflow.providers.apache.hive.transfers.vertica_to_hive`.
"""
import warnings
from airflow.providers.apache.hive.transfers.vertica_to_hive import VerticaToHiveOperator
warnings.warn(
"This module is deprecated. Please use `airflow.providers.apache.hive.transfers.ve... | {
"content_hash": "50fc507f15cfbfc0f79bafa5a49fc7fc",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 103,
"avg_line_length": 28.59375,
"alnum_prop": 0.6786885245901639,
"repo_name": "bolkedebruin/airflow",
"id": "49ddea172f374f6c6480ff8137ee841f63a8f782",
"size": "1702",
... |
"""
Set covering problem in Google CP Solver.
This example is from the OPL example covering.mod
'''
Consider selecting workers to build a house. The construction of a
house can be divided into a number of tasks, each requiring a number of
skills (e.g., plumbing or masonry). A worker may or may not perform... | {
"content_hash": "8b9be02cca6b0f4035ce0bdd36cac2c8",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 80,
"avg_line_length": 29.78125,
"alnum_prop": 0.6240818467995802,
"repo_name": "or-tools/or-tools",
"id": "bcdf574c0fad6d4ad130f6f661b2af7e0658194f",
"size": "4412",
"b... |
import gc
import os
import time
from datetime import datetime, date, timedelta
from optparse import make_option
from django.core.files.storage import get_storage_class
from django.core.management.base import BaseCommand
from easy_thumbnails.conf import settings
from easy_thumbnails.models import Source
class Thumbna... | {
"content_hash": "1f0ea74084d9a7f11c8e653f16a1adec",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 79,
"avg_line_length": 34.627450980392155,
"alnum_prop": 0.569271423178558,
"repo_name": "siovene/easy-thumbnails",
"id": "be28b55e36bc7fffc263c77f764983e7824c4455",
"size... |
from collections import (
OrderedDict,
abc,
)
from datetime import (
date,
datetime,
timedelta,
)
import functools
import itertools
import re
import warnings
import numpy as np
import numpy.ma as ma
import numpy.ma.mrecords as mrecords
import pytest
import pytz
from pandas.compat import np_version... | {
"content_hash": "500862f45cde956cfc1b6668ae9c05fd",
"timestamp": "",
"source": "github",
"line_count": 2962,
"max_line_length": 88,
"avg_line_length": 36.33828494260635,
"alnum_prop": 0.5428489139119609,
"repo_name": "jorisvandenbossche/pandas",
"id": "f92bbe1c718ab08132b2dd4279c65b426bfc55bd",
"s... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def DasAgentUnavailableEvent(vim, *args, **kwargs):
'''This event records that VirtualCent... | {
"content_hash": "afd47ce1aeaffc99babc87c928d0178b",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 124,
"avg_line_length": 42.275,
"alnum_prop": 0.6540508574807806,
"repo_name": "xuru/pyvisdk",
"id": "ed574b2f9f02461a68c90a0e438864d9495ad2ae",
"size": "1692",
"binary":... |
from model import *
from pins import *
from boards import *
from pinners import *
from attributions import * | {
"content_hash": "326fc15014b33c5cdc0eea34902b1f18",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 26,
"avg_line_length": 21.6,
"alnum_prop": 0.7777777777777778,
"repo_name": "svenfraeys/py-pinterest",
"id": "7c8e383d6200323669c43941d2db5a77ec272909",
"size": "108",
"bi... |
"""
A custom directive that allows alternative contents to be generated
on odd and even pages.
"""
from docutils.parsers import rst
from docutils.nodes import Admonition, Element
from docutils.parsers.rst import directives
class OddEvenNode(Admonition, Element):
pass
class OddEven(rst.Directive):
"""
... | {
"content_hash": "5f88bd016386768d86085b4b8001460d",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 78,
"avg_line_length": 25.055555555555557,
"alnum_prop": 0.70509977827051,
"repo_name": "aquavitae/rst2pdf-py3-dev",
"id": "efabd033e9785ac428e0443f0c15f70090ba123e",
"size... |
from __future__ import print_function
import banyan_c
class RankUpdator(object):
"""
Updates nodes by the size of their subtree. Allows trees employing this to efficiently answer
queries such as "what is the k-th key?" and "what is the order of key 'a' in the
collection?".
Examp... | {
"content_hash": "a4d346609005fa04047beec5de8d2743",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 98,
"avg_line_length": 24.862745098039216,
"alnum_prop": 0.5110410094637224,
"repo_name": "pyannote/pyannote-banyan",
"id": "2d8f193395f89f447593f206469f78b2744258d0",
"siz... |
from functools import wraps
from pycloudia.utils.defer import inline_callbacks, return_value, maybe_deferred
from pycloudia.cluster.consts import HEADER, STATUS
from pycloudia.cluster.interfaces import IRequestPackage
__all__ = [
'ResolverMeta',
'resolve_errors',
'resolve_method',
]
class ResolverMeta(... | {
"content_hash": "87399d1a6c2b9c790239b4727675a349",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 88,
"avg_line_length": 31.5625,
"alnum_prop": 0.5952475247524752,
"repo_name": "cordis/pycloudia",
"id": "17672e293ca680ab131aefaa1b530b83bd639cf6",
"size": "2525",
"bina... |
class Executor:
pass
| {
"content_hash": "13a2fd90f69bdc371d7ed5c49a393215",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 15,
"avg_line_length": 12.5,
"alnum_prop": 0.68,
"repo_name": "edublancas/python-ds-tools",
"id": "4453f038090e20a73c337aa98f459c986c1ce608",
"size": "26",
"binary": false... |
"""dyn.core is a utilities module for use internally within the dyn library
itself. Although it's possible to use this functionality outside of the dyn
library, it is not recommened and could possible result in some strange
behavior.
"""
import base64
import copy
import locale
import logging
import re
import threading
... | {
"content_hash": "210ad18424eb6de5ad31cf5873cbcd8f",
"timestamp": "",
"source": "github",
"line_count": 518,
"max_line_length": 80,
"avg_line_length": 38.488416988416986,
"alnum_prop": 0.5694437478055876,
"repo_name": "dyninc/dyn-python",
"id": "0e12036a881741c4387d171f17c2b11463563982",
"size": "1... |
'''Crontab generator for Citation Hunt.
This outputs the schedule of database update jobs for all languages.
The runs for different languages are spread out evenly within a given day, and
the runs for a given language are spread out evenly across the days of the
month.
'''
import os
import sys
_upper_dir = os.path.a... | {
"content_hash": "e68c2ea3bcec49eddaae1b6162d613d4",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 92,
"avg_line_length": 29.060606060606062,
"alnum_prop": 0.6282586027111574,
"repo_name": "eggpi/citationhunt",
"id": "552cf76743e47a5e0c33bebc3d4da9ecee03432b",
"size": "1... |
import _plotly_utils.basevalidators
class TickformatValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="tickformat",
parent_name="choroplethmapbox.colorbar",
**kwargs
):
super(TickformatValidator, self).__init__(
plotly_... | {
"content_hash": "7669b72b701cdd1b376f3b1cb407fbb2",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 72,
"avg_line_length": 30.11764705882353,
"alnum_prop": 0.5859375,
"repo_name": "plotly/python-api",
"id": "0e0b1a49f559f2f32a2026341d8c6cc29b355b5c",
"size": "512",
"bin... |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from modeltranslation.admin import TranslationAdmin
from paperclip.models import Attachment
from .models import FileType, Organism, Theme, RecordSource
class OrganismAdmin(admin.ModelAdmin):
list_display = ('organism', 'stru... | {
"content_hash": "eee19d43e86ea80566d43c9210ef5563",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 71,
"avg_line_length": 31.78787878787879,
"alnum_prop": 0.6882745471877979,
"repo_name": "mabhub/Geotrek",
"id": "73d6cb1e3a36f59f91e9508b538619b279a21543",
"size": "2098",... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.