text stringlengths 4 1.02M | meta dict |
|---|---|
import json
class Union(object):
def __init__(self, clauses):
self.clauses = clauses
class InnerJoin(object):
def __init__(self, tables, expr):
self.tables = tables
self.expr = expr
def sql(self, **kwargs):
return ' '.join(['INNER JOIN ' + t for t in self.tables]) + ' ON... | {
"content_hash": "904f018f485c02e1370d51b8c2092ab9",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 105,
"avg_line_length": 25.4,
"alnum_prop": 0.5623864324651726,
"repo_name": "tsandall/contrib",
"id": "0e99aa17234229bb44ae9afbb56a047a08cadcdc",
"size": "3302",
"binar... |
"""Tests for AVM Fritz!Box sensor component."""
from datetime import timedelta
from unittest.mock import Mock
from requests.exceptions import HTTPError
from homeassistant.components.fritzbox.const import (
ATTR_STATE_DEVICE_LOCKED,
ATTR_STATE_LOCKED,
DOMAIN as FB_DOMAIN,
)
from homeassistant.components.se... | {
"content_hash": "91bebe0cc1d95a08cf605d5bc2ab862f",
"timestamp": "",
"source": "github",
"line_count": 99,
"max_line_length": 82,
"avg_line_length": 34.83838383838384,
"alnum_prop": 0.7074514351986083,
"repo_name": "lukas-hetzenecker/home-assistant",
"id": "42cf90bba58a0a4927397a14720ff2024e8030ad",... |
from satchmo.configuration import *
from django.utils.translation import ugettext_lazy as _
PAYMENT_MODULES = config_get('PAYMENT', 'MODULES')
PAYMENT_MODULES.add_choice(('PAYMENT_AUTOSUCCESS', _('Auto Success Module')))
PAYMENT_GROUP = ConfigurationGroup('PAYMENT_AUTOSUCCESS',
_('Payment Auto Success Module Set... | {
"content_hash": "cb805451d7603bd3ceaf1d3c01d54c0a",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 99,
"avg_line_length": 32.53658536585366,
"alnum_prop": 0.6341829085457271,
"repo_name": "roadhead/satchmo",
"id": "6fe1b4ad228c498104e8040bca37e17de04fbca9",
"size": "1334... |
"""Entity classes for the QNAP QSW integration."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from aioqsw.const import (
QSD_FIRMWARE,
QSD_FIRMWARE_INFO,
QSD_MAC,
QSD_PRODUCT,
QSD_SYSTEM_BOARD,
)
from homeassistant.config_entries import ConfigEntry... | {
"content_hash": "a23c8a1735bc7c86dd206f47408e6f65",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 78,
"avg_line_length": 29.892473118279568,
"alnum_prop": 0.6449640287769784,
"repo_name": "toddeye/home-assistant",
"id": "c3550610d837ced020fa5ed028f30a04f20b936a",
"size"... |
from .ops import ops
| {
"content_hash": "5273a62f7d540813281c17b89e29f918",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 20,
"avg_line_length": 21,
"alnum_prop": 0.7619047619047619,
"repo_name": "testedminds/sand",
"id": "5de8061268518671c31f15a7eb4690428f755eb2",
"size": "21",
"binary": fal... |
import subprocess
import os
import os.path as op
import shutil
import tempfile
import logging
import numpy as np
from dipy.core.geometry import cart2sphere
from mittens.utils import get_dsi_studio_ODF_geometry
from mittens.spatial import oriented_array_to_lpsplus
import nibabel as nib
import json
logger = logging.getL... | {
"content_hash": "fa23d76fdb168d5f8ef00281de0b8f6f",
"timestamp": "",
"source": "github",
"line_count": 154,
"max_line_length": 86,
"avg_line_length": 31.967532467532468,
"alnum_prop": 0.6148689823278489,
"repo_name": "mattcieslak/MITTENS",
"id": "872216cf8c15137ed02a0a146f5dcefb60abeae8",
"size": ... |
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
'numpy',
'scipy'
]
setup_requirements = [
'pytest-runner',
]
test_req... | {
"content_hash": "35a87f58306f62ec69d82416c8d6ff4a",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 74,
"avg_line_length": 28.160714285714285,
"alnum_prop": 0.6303107165504122,
"repo_name": "paulthebaker/ceedub",
"id": "ca3b2ce9a3b371359dbd4a84b142c5109585f906",
"size": "... |
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.services.compute.xml.common import xml_to_json
class ExtensionsV3ClientXML(RestClientXML):
def __init__(self, config, username, password, auth_url, tenant_name=None):
super(ExtensionsV3ClientXML, self).__init__(confi... | {
"content_hash": "3e5e6b2959e79b287d126e261e616013",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 79,
"avg_line_length": 36.42857142857143,
"alnum_prop": 0.6225490196078431,
"repo_name": "armando-migliaccio/tempest",
"id": "e03251cf8fb734504754c0ac774278ae9fe26361",
"si... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0047_resource_description'),
]
operations = [
migrations.CreateModel(
name='ApplyText',
fields=[
('i... | {
"content_hash": "546305b6e59b89092ee681bff8f6655a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 114,
"avg_line_length": 24.7,
"alnum_prop": 0.5647773279352226,
"repo_name": "OKThess/website",
"id": "d8a07eb7c68b1dd7c67306e17e9f6f907b99d9f8",
"size": "567",
"binary":... |
from django.db.models import Q
from avocado.models import DataField
def get_fields_by_label(labels):
"""Constructs a DataField QuerySet given a list of labels.
The label format can be <app>, <app.model> or <app.model.field>.
"""
conditions = []
for label in labels:
labels = label.split('... | {
"content_hash": "8be5c90ebe431607470fd2cec4b88bab",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 68,
"avg_line_length": 27.54054054054054,
"alnum_prop": 0.5574092247301276,
"repo_name": "murphyke/avocado",
"id": "7596f2eb8362f98f4ef1e27c4fa6ee6bce44f66a",
"size": "1019... |
from __future__ import print_function
import os
import sys
import uuid
import time
import shelve
import urllib
import sqlite3
import tempfile
import argparse
import subprocess as sp
import multiprocessing as mp
from StringIO import StringIO
from collections import Counter
import numpy as np
import pandas as pd
impor... | {
"content_hash": "1123fdf56567cdc37d93e38eb1bdd293",
"timestamp": "",
"source": "github",
"line_count": 405,
"max_line_length": 150,
"avg_line_length": 35.79753086419753,
"alnum_prop": 0.5599393019726859,
"repo_name": "briney/abtools",
"id": "0f47e60d7016220715558f550a90da1185c3ced8",
"size": "1485... |
import sys
sys.path.insert(0,'C:\\Dev\\HeeksCAM')
import math
sys.path.insert(0,'C:\\Dev\\HeeksCAM/Boolean')
import area
area.set_units(1)
from nc.nc import *
from nc.emc2b import *
output('C:\\Users\\Dan\\AppData\\Local\\Temp\\test.ngc')
program_begin(1, 'Program 1')
absolute()
metric()
set_plane(0)
#(3 mm Slot Cutt... | {
"content_hash": "6f4d43e2cfef0b6b8351b5eff6ce904c",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 212,
"avg_line_length": 46.09090909090909,
"alnum_prop": 0.6725838264299803,
"repo_name": "play113/swer",
"id": "480345624e36bd14dac24dc8f87c02791976bf8e",
"size": "1094",
... |
from flask import Flask, render_template, session, request, redirect
import random
app = Flask(__name__)
app.secret_key = 'my_secret_key'
@app.route('/')
def index():
if not 'gold' in session:
session['gold'] = 0
if not 'activities' in session:
session['activities'] = []
return render_templ... | {
"content_hash": "0d3bebea5491801c91bf01ba7b9f9690",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 68,
"avg_line_length": 23.333333333333332,
"alnum_prop": 0.6285714285714286,
"repo_name": "jiobert/python",
"id": "3d00ded91cd8d000de0cd245c07ef655a9875a63",
"size": "840",... |
import sys, os
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#sys.path.append(os.path.abspath(... | {
"content_hash": "64159e929efa4c87618b055f519675db",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 82,
"avg_line_length": 32.258823529411764,
"alnum_prop": 0.6934719183078045,
"repo_name": "mobyle2-legacy/WTForms",
"id": "610a0748588fb401691659e3196741b0079b40f4",
"size... |
import pytest
from PythonUtils.storer import Store
from PythonUtils.record import Record
data = "data11,data12,data13,data14\ndata21,data22,data23,data24\n"
@pytest.fixture(autouse=True)
def example_store(tmp_path):
p = tmp_path / "example_store.csv"
with open(p, "w") as example_file:
example_file.wri... | {
"content_hash": "2981d9984a65d15234370c14816ee907",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 73,
"avg_line_length": 28.818181818181817,
"alnum_prop": 0.6666666666666666,
"repo_name": "tiy1807/PythonUtils",
"id": "7ece83947114a9ed3ae54da2fc4dd4b64bf18eef",
"size": "... |
from networking_odl.ml2 import mech_driver
from oslo.config import cfg
from neutron.common import constants as n_const
from neutron.extensions import portbindings
from neutron.openstack.common import log
from neutron.plugins.common import constants
from neutron.plugins.ml2 import driver_api as api
LOG = log.getLogger... | {
"content_hash": "b45bc8d1a506f1bb1c9460a260b9565b",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 75,
"avg_line_length": 39.53982300884956,
"alnum_prop": 0.6161593554162936,
"repo_name": "Metaswitch/calico-neutron",
"id": "b1d48c5944893de770e770dd9f65e4499b7268fd",
"si... |
import re
# Using object instead of string to allow for later expansion of info about each line
class OutputLine:
def __init__(self, parent):
self.__parent = parent
self.__character_count = 0
self.__indent_count = -1
self.__items = []
self.__empty = True
def get_charac... | {
"content_hash": "408c65592ec801eeeaf026cd10567909",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 101,
"avg_line_length": 29.858024691358025,
"alnum_prop": 0.5670870374198883,
"repo_name": "aecepoglu/js-beautify",
"id": "3505128a18313f88677695670f2761907b3bce91",
"size... |
from enum import Enum
from azure.core import CaseInsensitiveEnumMeta
class AgeUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The Age Unit of measurement.
"""
UNSPECIFIED = "Unspecified"
YEAR = "Year"
MONTH = "Month"
WEEK = "Week"
DAY = "Day"
class AnalyzeTextLROResultsKind(str, E... | {
"content_hash": "cb1cb69f99be47cf45137753653f4496",
"timestamp": "",
"source": "github",
"line_count": 722,
"max_line_length": 102,
"avg_line_length": 38.541551246537395,
"alnum_prop": 0.727997987566033,
"repo_name": "Azure/azure-sdk-for-python",
"id": "8bb926dfe7b121b45c9bcc1428d5fd632da1e35a",
"... |
from oslo_config import cfg
from oslo_serialization import base64
from oslo_serialization import jsonutils
from oslo_utils import versionutils
from oslo_versionedobjects import fields
from cinder import db
from cinder import exception
from cinder.i18n import _
from cinder import objects
from cinder.objects import base... | {
"content_hash": "701e990cece653f37975a23b901b9db6",
"timestamp": "",
"source": "github",
"line_count": 325,
"max_line_length": 79,
"avg_line_length": 40.356923076923074,
"alnum_prop": 0.6189387008234217,
"repo_name": "j-griffith/cinder",
"id": "add4b8c49ee44b53fe15b03391851679d9448848",
"size": "1... |
import datetime
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
class RenewBookForm(forms.Form):
renewal_date = forms.DateField(help_text='Enter a date between now and 4 weeks (default 3).')
def clean_renewal_date(self):
... | {
"content_hash": "1a62b359807d156870a87c4e093caf5a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 97,
"avg_line_length": 36.5,
"alnum_prop": 0.6904109589041096,
"repo_name": "pavlenk0/my-catalog",
"id": "73dc6ddf6f2cf606508bd8d2559b33cd7b19a537",
"size": "730",
"binar... |
from msrest.paging import Paged
class ExpressRouteCircuitPaged(Paged):
"""
A paging container for iterating over a list of :class:`ExpressRouteCircuit <azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuit>` object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
... | {
"content_hash": "5da27bfcff2e8a7388fe81a8875257a5",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 147,
"avg_line_length": 32.0625,
"alnum_prop": 0.6393762183235867,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "377f17938aa993c77e3825bbfc36ded7876abf95",
"size":... |
from django.urls import reverse
from django.views.generic import DetailView, ListView
from django.views.generic.edit import UpdateView, CreateView
from ..models import Asset
from .mixins import LoginRequiredMixin
class AssetDetail(LoginRequiredMixin, DetailView):
model = Asset
template_name = 'portfolio/asse... | {
"content_hash": "e4f7a2d1f85092d5bc22d59d69c4a785",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 72,
"avg_line_length": 28.114285714285714,
"alnum_prop": 0.7276422764227642,
"repo_name": "mcouthon/mcrypto",
"id": "959bacdcbec44b4636b967bb51721988db11c70a",
"size": "984... |
import os
import re
import time
import datetime
import hashlib
import string
import random
from google.appengine.ext import webapp
from google.appengine.api import memcache
from google.appengine.ext import db
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template
from v2ex.babel... | {
"content_hash": "f1cf1da4e0d7b346d502f58aa0d68021",
"timestamp": "",
"source": "github",
"line_count": 268,
"max_line_length": 107,
"avg_line_length": 39.899253731343286,
"alnum_prop": 0.5243617319741887,
"repo_name": "melice/akiraguru",
"id": "f1419988a1616c57cf685800753f0e5caa8dffd7",
"size": "1... |
from __future__ import unicode_literals
from django.apps import AppConfig
class ImageServerConfig(AppConfig):
name = 'image_server'
| {
"content_hash": "5ddf3b4f5135499eb74077b047881825",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 39,
"avg_line_length": 19.857142857142858,
"alnum_prop": 0.762589928057554,
"repo_name": "sunshaoyan/ISeeNN",
"id": "e4ff1fbc154a4705cf4308fc77eef9af1b91c33f",
"size": "139"... |
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 'Subscriber'
db.create_table(u'subscribers_subscriber', (
(u'id', self.gf('django.db.models.fields.AutoFi... | {
"content_hash": "fc55e316ec439699347bcf32b25952d3",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 112,
"avg_line_length": 43.32432432432432,
"alnum_prop": 0.603243917654398,
"repo_name": "jcalazan/glucose-tracker",
"id": "acf7ff46e2ba8dd2cc8fe357758710ba89318e0f",
"size... |
from __future__ import unicode_literals
from django.core.exceptions import ObjectDoesNotExist
from django.db import migrations, models
import django.db.models.deletion
def forwards_func(apps, schema_editor):
ChangeSet = apps.get_model('editor', 'ChangeSet')
for changeset in ChangeSet.objects.all():
t... | {
"content_hash": "ef68f86ca8a108515c971676d356fac5",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 174,
"avg_line_length": 35.56603773584906,
"alnum_prop": 0.6148541114058356,
"repo_name": "c3nav/c3nav",
"id": "8ab5020521ca528677822bc0415ae819bc652747",
"size": "1958",
... |
from toolz import curried
from ..utils.core import sanitize_dataframe
from ..utils.data import (
MaxRowsError,
curry,
limit_rows,
pipe,
sample,
to_csv,
to_json,
to_values,
check_data_type,
)
from ..utils.data import DataTransformerRegistry as _DataTransformerRegistry
@curried.curry... | {
"content_hash": "d8f699e6186956dd05845c7fd256adde",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 76,
"avg_line_length": 22.4,
"alnum_prop": 0.6339285714285714,
"repo_name": "jakevdp/altair",
"id": "30289160beb260a896f04812d1eb586eb7c306ea",
"size": "1008",
"binary": ... |
"""Support for Ecovacs Ecovacs Vacuums."""
from __future__ import annotations
import logging
import sucks
from homeassistant.components.vacuum import VacuumEntity, VacuumEntityFeature
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant... | {
"content_hash": "11ec8fecc88b493ba397ca1ce06f83ed",
"timestamp": "",
"source": "github",
"line_count": 179,
"max_line_length": 88,
"avg_line_length": 32.039106145251395,
"alnum_prop": 0.6367916303400174,
"repo_name": "toddeye/home-assistant",
"id": "8557658d1286b7d05545617e8ab502a9b9681fbe",
"size... |
import eventlet
from quantum.common import topics
from quantum.openstack.common import log as logging
from quantum.openstack.common.notifier import api
from quantum.openstack.common.notifier import rpc_notifier
from quantum.openstack.common import rpc
from quantum.openstack.common.rpc import proxy
from quantum.openst... | {
"content_hash": "0d026b74a1b3c4f58b0ca8395f9dc59d",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 75,
"avg_line_length": 35.10344827586207,
"alnum_prop": 0.5890635232481991,
"repo_name": "wallnerryan/quantum_migrate",
"id": "0b9a62a5974610527be6fdd514e915c9bf7a51bf",
"s... |
"""
The MIT License (MIT)
Copyright (c) 2015-2020 Rapptz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, ... | {
"content_hash": "91c0929f0213b0cd7196746ad17f04b8",
"timestamp": "",
"source": "github",
"line_count": 388,
"max_line_length": 111,
"avg_line_length": 36.69845360824742,
"alnum_prop": 0.5644357047545474,
"repo_name": "khazhyk/discord.py",
"id": "e80491697801be587ab64e449ed142530e116ad3",
"size": "... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0003_userprofile_institutional_email'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='... | {
"content_hash": "051223e9486c191901082ecf8a3ad312",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 74,
"avg_line_length": 24.11111111111111,
"alnum_prop": 0.6267281105990783,
"repo_name": "chop-dbhi/biorepo-portal",
"id": "64059245143ccbd0d7b783802855a68f3d3bd00a",
"size... |
'''
Sample-launcher application.
'''
# local modules
from common import splitfn
# built-in modules
import sys
import webbrowser
import Tkinter as tk
from glob import glob
from subprocess import Popen
from ScrolledText import ScrolledText
#from IPython.Shell import IPShellEmbed
#ipshell = IPShellEmbed()
exclude_lis... | {
"content_hash": "3657d00fc0ba6c527997391b23b6c999",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 103,
"avg_line_length": 32.35403726708075,
"alnum_prop": 0.5521213284699559,
"repo_name": "ironbox360/PyCV-time",
"id": "03d624ddcf5a71ecadb845ce974a9825ae2a910c",
"size":... |
import mock
from neutron_lib import context
from oslo_utils import uuidutils
from neutron.api.rpc.callbacks.consumer import registry
from neutron.api.rpc.callbacks import events
from neutron.api.rpc.callbacks import resources
from neutron.api.rpc.handlers import resources_rpc
from neutron.plugins.ml2.drivers.openvswit... | {
"content_hash": "e4c40727288e31a2efc53e8a59f9fa57",
"timestamp": "",
"source": "github",
"line_count": 116,
"max_line_length": 79,
"avg_line_length": 39.56896551724138,
"alnum_prop": 0.681917211328976,
"repo_name": "eayunstack/neutron",
"id": "cd452a11d64423ed6a1578d41c98248813abc2d3",
"size": "52... |
import unittest
from airflow import settings
from airflow.models import DAG
from airflow.models.pool import Pool
from airflow.models.taskinstance import TaskInstance as TI
from airflow.operators.dummy_operator import DummyOperator
from airflow.utils import timezone
from airflow.utils.state import State
from tests.test... | {
"content_hash": "bd5bb20c5f2e17f7c973c536f135cca1",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 71,
"avg_line_length": 32.73015873015873,
"alnum_prop": 0.6420950533462657,
"repo_name": "r39132/airflow",
"id": "cff4de6fd984429a4f475c4282b941f0dad24958",
"size": "2874",... |
"""Writer for tox.ini files."""
import glob
import os
from l2tdevtools.dependency_writers import interface
class ToxIniWriter(interface.DependencyFileWriter):
"""Tox.ini file writer."""
_TEMPLATE_DIRECTORY = os.path.join('data', 'templates', 'tox.ini')
PATH = 'tox.ini'
def _GenerateFromTemplate(self, tem... | {
"content_hash": "9901b7c09c8826ad875249522da7a691",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 78,
"avg_line_length": 31.235849056603772,
"alnum_prop": 0.6454243430987617,
"repo_name": "joachimmetz/l2tdevtools",
"id": "8e7e332df9a161bdb7db833bc131f6f6a766d7af",
"siz... |
""" Tests for decompiling lambdas """
import unittest
from raco.python.util import decompile
class TestDecompileFunctions(unittest.TestCase):
def test_simple(self):
def f():
def g(): return 0
return g
s = decompile.get_source(f())
exec s
self.assertEquals(... | {
"content_hash": "bc28fd21cf11efeec258606d05edd7f9",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 66,
"avg_line_length": 24.72,
"alnum_prop": 0.5009708737864078,
"repo_name": "uwescience/raco",
"id": "6af4f4d594beb065d96711900bdb49ae790f32e7",
"size": "3106",
"binary... |
from typing import Text
from pyannote.audio import Model
def pretrained(checkpoint: Text):
return Model.from_pretrained(
checkpoint, map_location=lambda storage, loc: storage
)
| {
"content_hash": "81d965727ae014dc820cd06f733e299d",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 61,
"avg_line_length": 24.375,
"alnum_prop": 0.7384615384615385,
"repo_name": "pyannote/pyannote-audio",
"id": "95a439b3ffbef5d9d8ea7e8d909a7cbb092af2d6",
"size": "1301",
... |
'''
Log out from binstar
'''
import getpass
from binstar_client.utils import get_server_api, remove_token
import logging
from binstar_client import errors
log = logging.getLogger('binstar.logout')
def main(args):
aserver_api = get_server_api(args.token, args.site, args.log_level)
if aserver_api.token:
#... | {
"content_hash": "391d6e2d36d1d6d8dbde9a79a507cd9c",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 80,
"avg_line_length": 30.114285714285714,
"alnum_prop": 0.6233396584440227,
"repo_name": "GiovanniConserva/TestDeploy",
"id": "10e42424be28ee4075761b04aebf5fbdecf57635",
"... |
"""Compute metrics for trackers using MOTChallenge ground-truth data."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
from collections import OrderedDict
import io
import logging
import os
import sys
from tempfile import NamedTemporaryFil... | {
"content_hash": "ed1154fbcfed138b9a2f27c17e119038",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 155,
"avg_line_length": 34.42696629213483,
"alnum_prop": 0.631364229765013,
"repo_name": "cheind/py-motmetrics",
"id": "7815d2dfecad87c9ea3c3691da070a1547d07c65",
"size": ... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('auth', '0009_alter_user_last_name_max_length'),
('assays', '0033'),
]
operations = [
migrations.AddField(
model_name='assaystudy',
name='collaborator_groups'... | {
"content_hash": "9fe8d169d6a011611db0291ca310085a",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 112,
"avg_line_length": 26.58823529411765,
"alnum_prop": 0.6017699115044248,
"repo_name": "UPDDI/mps-database-server",
"id": "bb1ff8e698c724e2a05eabcd4ac2fa6db35a2a2f",
"si... |
from google.cloud import gke_multicloud_v1
async def sample_list_azure_node_pools():
# Create a client
client = gke_multicloud_v1.AzureClustersAsyncClient()
# Initialize request argument(s)
request = gke_multicloud_v1.ListAzureNodePoolsRequest(
parent="parent_value",
)
# Make the req... | {
"content_hash": "7466422f9a5ab604d228fe8350b82a10",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 73,
"avg_line_length": 27.7,
"alnum_prop": 0.720216606498195,
"repo_name": "googleapis/python-gke-multicloud",
"id": "7cd8efcec297cbc755bca9d00f2bec17b8da4aa2",
"size": "19... |
"""Datasource-specific classes
This is where datasource specific logic is implemented. Each mission should
have its own file with one or more classes defined. Typically, these classes
will be subclasses of the :mod`sunpy.map.Map` class.
"""
__all__ = ['sdo', 'soho', 'stereo', 'rhessi', 'proba2', 'yohkoh', 'hinode']
| {
"content_hash": "6d1f3ff01e34f5270a98ffabb25b214c",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 76,
"avg_line_length": 45.42857142857143,
"alnum_prop": 0.7264150943396226,
"repo_name": "mjm159/sunpy",
"id": "f76aff9464061b7c0e1d4a7408fc91be540b35fd",
"size": "318",
"... |
from django.contrib.auth.views import LogoutView
from django.urls import include, path
from two_factor.gateways.twilio.urls import urlpatterns as tf_twilio_urls
from two_factor.urls import urlpatterns as tf_urls
from two_factor.views import LoginView
from .views import SecureView
urlpatterns = [
path(
'a... | {
"content_hash": "0d49a15c64fc46a90c4b84a788f896db",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 73,
"avg_line_length": 28.019607843137255,
"alnum_prop": 0.6095171448565431,
"repo_name": "Bouke/django-two-factor-auth",
"id": "4610bec29d576d900a0eff6d9b1ebe03890aeeac",
... |
from collections import namedtuple
import numpy as np
from numba.tests.support import (TestCase, MemoryLeakMixin,
skip_parfors_unsupported, captured_stdout)
from numba import njit, typed, literal_unroll, prange
from numba.core import types, errors, ir
from numba.testing import unittest... | {
"content_hash": "04c225dfba02da2780289eb81f98bba5",
"timestamp": "",
"source": "github",
"line_count": 1981,
"max_line_length": 80,
"avg_line_length": 30.0550227158001,
"alnum_prop": 0.4789129814071449,
"repo_name": "sklam/numba",
"id": "ad6ddad180704c97f4d54e30bf63ae76b5ec577e",
"size": "59539",
... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import logging
import re
from scss.namespace import Namespace
log = logging.getLogger(__name__)
SORTED_SELECTORS = False
sort = sorted if SORTED_SELECTORS else lambda it: it
def extend_unique(seq,... | {
"content_hash": "07bca7d2839b84e6a5aacbaf426a63d5",
"timestamp": "",
"source": "github",
"line_count": 366,
"max_line_length": 88,
"avg_line_length": 31.73497267759563,
"alnum_prop": 0.5788204907447266,
"repo_name": "LChristakis/chalice-hunter",
"id": "32dd74a94ea7ca44656e5769cdc827a4180c6a5f",
"s... |
import doctest
import os
import maec
project = u'python-maec'
copyright = u'2018, The MITRE Corporation'
version = maec.__version__
release = version
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
]
templates_path =... | {
"content_hash": "06a04b273133651dd4e54a8bd8777414",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 62,
"avg_line_length": 20.47826086956522,
"alnum_prop": 0.6613588110403397,
"repo_name": "MAECProject/python-maec",
"id": "37ffa6ef689f8aedb929f33323dd50e1e73fb6e8",
"size"... |
"""
Installs and configures Glance
"""
import uuid
import logging
from packstack.installer import validators
from packstack.installer import basedefs
from packstack.installer import utils
from packstack.installer.utils import split_hosts
from packstack.modules.shortcuts import get_mq
from packstack.modules.ospluginu... | {
"content_hash": "173c70d47f0649f61c61f2416fe87285",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 78,
"avg_line_length": 36.11214953271028,
"alnum_prop": 0.6138716356107661,
"repo_name": "yuw726/openstack-packstack",
"id": "810c228d3295ac01e112e3bfc485768d2b274f2d",
"s... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("coredb", "0003_run_pipeline"),
]
operations = [
migrations.RemoveField(
model_name="project",
name="deleted",
),
migrations.RemoveField(
... | {
"content_hash": "4b1c11abf7205d5740b27b8506d8e0c1",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 85,
"avg_line_length": 26.487179487179485,
"alnum_prop": 0.45498547918683446,
"repo_name": "polyaxon/polyaxon",
"id": "e9101f401d96228f60a06955d486f52786549026",
"size": "1... |
from rest_framework import serializers
from mkt.fireplace.serializers import FeedFireplaceESAppSerializer
from mkt.webapps.serializers import (AppSerializer, ESAppFeedSerializer,
ESAppFeedCollectionSerializer,
ESAppSerializer)
class FeedCollec... | {
"content_hash": "fae06602a60ecf0f0ada6be03b2b5c3b",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 79,
"avg_line_length": 37.34814814814815,
"alnum_prop": 0.6118603728679095,
"repo_name": "jasonthomas/zamboni",
"id": "dbefb5711979282383cf6ecfa6e1b411e266b2f5",
"size": "... |
import pytest
import unittest
from modules.sfp_trashpanda import sfp_trashpanda
from sflib import SpiderFoot
from spiderfoot import SpiderFootEvent, SpiderFootTarget
@pytest.mark.usefixtures
class TestModuleTrashpanda(unittest.TestCase):
def test_opts(self):
module = sfp_trashpanda()
self.assert... | {
"content_hash": "c3d8061b60b39f5d3dcf1134d7362015",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 81,
"avg_line_length": 30.163265306122447,
"alnum_prop": 0.6711772665764547,
"repo_name": "smicallef/spiderfoot",
"id": "d677c64826cb4e2b0a0976bd6bb99a0ba4578bcb",
"size": ... |
"""Tests for checkpoint_utils.init_from_checkpoint with Distribution Strategy.
These tests are located here instead of as part of
`python.training.CheckpointsTest` because they need access to distribution
strategies which are only present in contrib right now.
TODO(priyag): Move the tests to core `python.training.Chec... | {
"content_hash": "31a2a1d843e5db435147a0e442770778",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 78,
"avg_line_length": 38.75,
"alnum_prop": 0.7125,
"repo_name": "girving/tensorflow",
"id": "865dba803f562e0ab98341dd8343e3c72b03d39b",
"size": "3169",
"binary": false,
... |
"""setuptools.command.bdist_egg
Build .egg distributions"""
# This module should be kept compatible with Python 2.3
import sys, os, marshal
from setuptools import Command
from distutils.dir_util import remove_tree, mkpath
try:
# Python 2.7 or >=3.2
from sysconfig import get_path, get_python_version
def _g... | {
"content_hash": "f2deb64cf2cdb86b7b6b8a45f5cab71d",
"timestamp": "",
"source": "github",
"line_count": 529,
"max_line_length": 79,
"avg_line_length": 32.992438563327035,
"alnum_prop": 0.5746290036096946,
"repo_name": "Andrew-Katcha/storyteller",
"id": "8f4d44c32807ed1748c371bb7b1aef28510f1883",
"s... |
"""A tf.distribute.Strategy for running on a single device."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.distribute import device_util
from tensorflow.python.distribute import distribute_lib
from tensorflow.python.distribute imp... | {
"content_hash": "0b783b20f584ecb585bfcedd9afa32a3",
"timestamp": "",
"source": "github",
"line_count": 452,
"max_line_length": 114,
"avg_line_length": 37.913716814159294,
"alnum_prop": 0.6886853008111105,
"repo_name": "aldian/tensorflow",
"id": "8f40a5f7991060186bd6e7da220980553888d398",
"size": "... |
"""
S3 Adobe PDF codec
@copyright: 2011-15 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including ... | {
"content_hash": "070020c94c41080c3d2a467a31438813",
"timestamp": "",
"source": "github",
"line_count": 1693,
"max_line_length": 123,
"avg_line_length": 37.70702894270526,
"alnum_prop": 0.47689463955637706,
"repo_name": "sahana/Turkey",
"id": "82b93bc58d5f227c8e4e4197edee45d60cb1d4cc",
"size": "638... |
import Queue
from twisted.python import log
from twisted.internet import reactor, task
from twisted.internet.defer import Deferred
import linuxcnc
from .command import Command
from .machine_proto import MachineTalk
MODES = {
linuxcnc.MODE_MANUAL: 'manual',
linuxcnc.MODE_AUTO: 'auto',
linuxcnc.MODE_MDI: ... | {
"content_hash": "b83387f57cd8c02359221d6544c8da14",
"timestamp": "",
"source": "github",
"line_count": 272,
"max_line_length": 103,
"avg_line_length": 27.238970588235293,
"alnum_prop": 0.5613443109731407,
"repo_name": "sorki/hacked_cnc",
"id": "cb916c44b9c6186344230203675ddf8ceb8ff3d8",
"size": "7... |
from distutils.core import setup
setup(
name='foursquare_bot',
version='1.0.0',
packages=['foursquare_bot',
'foursquare_bot.components',
'foursquare_bot.components.commands',
'foursquare_bot.components.events',
],
url='',
license='BSD',
au... | {
"content_hash": "4ddc3dad0cb5ddad4f4aa371337c398d",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 71,
"avg_line_length": 31.058823529411764,
"alnum_prop": 0.6231060606060606,
"repo_name": "rerobins/rho_foursquare_bot",
"id": "5030af449b32dd7141f04180eb94672a12524156",
"... |
"""Tests for google.protobuf.descriptor_database."""
__author__ = 'matthewtoia@google.com (Matt Toia)'
import unittest
from google.protobuf import descriptor_pb2
from google.protobuf.internal import factory_test2_pb2
from google.protobuf import descriptor_database
class DescriptorDatabaseTest(unittest.T... | {
"content_hash": "db58c79a9e0054fa0fa9fbab1fee6b67",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 76,
"avg_line_length": 39.5625,
"alnum_prop": 0.7377567140600316,
"repo_name": "alphapigger/igetui",
"id": "bdb684418681382951942b6a5604b8de0ce8100c",
"size": "2935",
"bi... |
from textwrap import dedent
from ceph_medic.checks import osds
from ceph_medic import metadata
class TestOSDS(object):
def test_fails_check_ceph_fsid(self):
data = {'paths': {'/var/lib/ceph': {'files': {
'/var/lib/ceph/osd/ceph-0/ceph_fsid': {'contents': "fsid1"},
'/var/lib/ceph/o... | {
"content_hash": "d480bdd300264224bbdfbbee9ff06267",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 95,
"avg_line_length": 34.60162601626016,
"alnum_prop": 0.5549812030075187,
"repo_name": "alfredodeza/ceph-doctor",
"id": "671019f18b7b8e5a63f69a07b8fd6422d5ccd6a6",
"size... |
import pandas as pd
import statsmodels.api as sm
house_price_gr = pd.read_csv('house_price_gr.csv', encoding = 'gbk')
d1 = sm.stats.DescrStatsW(house_price_gr.rate)
#d1.tconfint_mean(0.05) | {
"content_hash": "ee88a30ddbd1c90806e7a312f5f8a215",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 68,
"avg_line_length": 31.5,
"alnum_prop": 0.7407407407407407,
"repo_name": "tiandizhiguai/test",
"id": "7353552d91af78dc41130af78d70054d53294857",
"size": "235",
"binary"... |
"""
.. codeauthor:: Cédric Dumay <cedric.dumay@gmail.com>
"""
from cdumay_error.types import ValidationError
from flask_tat.base import BaseTATClient
CASCADE = ("nocascade", "cascade", "cascadeforce")
class TATClient(BaseTATClient):
def message_list(self, topic, **kwargs):
return self.client.do_request... | {
"content_hash": "df3ded1dbba02e75af57227a2ceb7cde",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 80,
"avg_line_length": 37.03157894736842,
"alnum_prop": 0.5795906765207505,
"repo_name": "cdumay/flask-tat",
"id": "c35e441435b28240999ca072ccb79bcb350b5e5f",
"size": "3566... |
"""
WSGI config for sistema 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.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... | {
"content_hash": "0c5e2d8dc0139b22dd69a16b34998c70",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 24.4375,
"alnum_prop": 0.7698209718670077,
"repo_name": "kaiocesar/django-template",
"id": "02a71182b5b51dec7b74b43ae19580e23ebc33ae",
"size": "391",... |
import logging
import os
import re
import subprocess
import sys
import time
import urllib2
import xml.dom.minidom
from layout_package import path_utils
from layout_package import test_expectations
from layout_package import test_failures
sys.path.append(path_utils.PathFromBase('third_party'))
import simplejson
class... | {
"content_hash": "7c1bb6a679ef08261a7659829201beb3",
"timestamp": "",
"source": "github",
"line_count": 429,
"max_line_length": 80,
"avg_line_length": 36.934731934731936,
"alnum_prop": 0.6706847585989271,
"repo_name": "rwatson/chromium-capsicum",
"id": "fac8a29e592e90615f9d79d62e625076c6d6e981",
"s... |
from django.db import models
from django.core.urlresolvers import reverse
from jsonfield import JSONField
import collections
# Create your models here.
| {
"content_hash": "d9f43c0474b4ded98d2429c302b0d090",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 44,
"avg_line_length": 22,
"alnum_prop": 0.8311688311688312,
"repo_name": "intuinno/vistalk",
"id": "e391e7227b57975fb33438a1c8da64bd8104ef19",
"size": "154",
"binary": fa... |
""" msgmerget tool
Tool specific initialization for `msgmerge` tool.
"""
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation ... | {
"content_hash": "4b8a5ddeca096e8cde27373c1b7aa4f6",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 113,
"avg_line_length": 41.27884615384615,
"alnum_prop": 0.5683671092476124,
"repo_name": "jjenki11/blaze-chem-rendering",
"id": "35315f939e94977922eae16bb23e925ce70a9f99",
... |
import json
from lxml import etree
from tempest.common import http
from tempest.common.rest_client import RestClientXML
from tempest import exceptions
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
from tempest.services.compute.xml.common import xml_to... | {
"content_hash": "2f86dabef4a9258175a86574a28807e3",
"timestamp": "",
"source": "github",
"line_count": 297,
"max_line_length": 79,
"avg_line_length": 38.629629629629626,
"alnum_prop": 0.549986925825852,
"repo_name": "adkerr/tempest",
"id": "9c0a72c5fdc80583d260b267b0a546c5b473de29",
"size": "12144... |
try:
from ._version import version as __version__
except ImportError:
__version__ = "0.0.0+unknown"
| {
"content_hash": "e64ba4a71bd5443b871d1bc9ac370b18",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 48,
"avg_line_length": 27,
"alnum_prop": 0.6481481481481481,
"repo_name": "graphicore/fontbakery",
"id": "ecedf43f8b52cb3608589e81b651f7edb47056d8",
"size": "108",
"binary... |
import pytest
import os
from tests.conftest import *
from commandment.models import Device
# from sqlalchemy.orm import scoped_session
TEST_DIR = os.path.realpath(os.path.dirname(__file__))
TEST_DATA_DIR = os.path.realpath(TEST_DIR + '/../../testdata')
@pytest.fixture(scope='function')
def device(session):
d = D... | {
"content_hash": "c80f1c664c9ce31fc7b0e7f7fe1a4fc4",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 88,
"avg_line_length": 24.862068965517242,
"alnum_prop": 0.6567267683772539,
"repo_name": "mosen/commandment",
"id": "7726609be41cce28790c5e30da93193e47f0aa9e",
"size": "14... |
from __future__ import absolute_import
from sentry.models import ServiceHook
from sentry.testutils import APITestCase
class ListProjectServiceHooksTest(APITestCase):
def test_simple(self):
project = self.create_project()
hook = ServiceHook.objects.get_or_create(
project_id=project.id,... | {
"content_hash": "66f5178c4f2920a99867904c1070ce60",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 63,
"avg_line_length": 35.450980392156865,
"alnum_prop": 0.5824115044247787,
"repo_name": "ifduyue/sentry",
"id": "17d1cd4bbdb7435468a81159f56631f8cf128435",
"size": "1808"... |
from .entries import *
from .layout import *
from .actor import *
from .mm import *
__author__ = 'TimeWz667'
| {
"content_hash": "d1bc08f856c1eb68a4a633e78f2f0858",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 24,
"avg_line_length": 15.857142857142858,
"alnum_prop": 0.6756756756756757,
"repo_name": "TimeWz667/Kamanian",
"id": "6cdf735695bfd0e6a9ad966c96e5d476fb8bc7e4",
"size": "11... |
from Bio.Seq import reverse_complement
def findPrimer(primer, seq):
"""
Look for a primer sequence.
@param primer: A C{str} primer sequence.
@param seq: A BioPython C{Bio.Seq} sequence.
@return: A C{list} of zero-based offsets into the sequence at which the
primer can be found. If no ins... | {
"content_hash": "776edc64e81df047c8593ad13c6a7545",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 77,
"avg_line_length": 33.7816091954023,
"alnum_prop": 0.6543041850969717,
"repo_name": "acorg/dark-matter",
"id": "028bd00278176ab02a8d83edb0eb84d398df6d54",
"size": "2939... |
from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
class FavoritEntfernen(webapp.RequestHandler):
def get(self):
mobile = self.request.get('mobile')
if mobile != "true":
mobile = "false"
# AMI des zu löschenden Favo... | {
"content_hash": "4e491fad30b9385a01e42998b606ddd8",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 191,
"avg_line_length": 38.5,
"alnum_prop": 0.6142093200916731,
"repo_name": "nagyistoce/koalacloud",
"id": "5c4b8edb9e945def1567b86bb650008362844748",
"size": "1362",
"b... |
from syutil.crypto.jsonsign import verify_signed_json
from syutil.crypto.signing_key import (
decode_verify_key_bytes, write_signing_keys
)
from syutil.base64util import decode_base64
import urllib2
import json
import sys
import dns.resolver
import pprint
import argparse
import logging
def get_targets(server_name... | {
"content_hash": "d0b9352288dd60dcddde2f5067fb5368",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 81,
"avg_line_length": 31.375,
"alnum_prop": 0.6148738379814077,
"repo_name": "rzr/synapse",
"id": "59e3d603ac0a4130fafeb27c91e5ab880a597b83",
"size": "2260",
"binary": f... |
from __future__ import absolute_import
from sentry import analytics
class RepoLinkedEvent(analytics.Event):
type = "repo.linked"
attributes = (
analytics.Attribute("user_id", required=False),
analytics.Attribute("default_user_id"),
analytics.Attribute("organization_id"),
anal... | {
"content_hash": "339131e14a3104dd1b5a300122a144fe",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 55,
"avg_line_length": 24.38888888888889,
"alnum_prop": 0.6856492027334852,
"repo_name": "mvaled/sentry",
"id": "ac198d5e337d2ab4c2ceaccaf8a4d0e9bbbe8541",
"size": "439",
... |
"""
Manage hosts in the current zone.
"""
import collections
import UserDict
from oslo.config import cfg
from nova.compute import task_states
from nova.compute import vm_states
from nova import db
from nova import exception
from nova.openstack.common.gettextutils import _
from nova.openstack.common import jsonutils
... | {
"content_hash": "0b90d27ac2e1928cdb989a260c137690",
"timestamp": "",
"source": "github",
"line_count": 463,
"max_line_length": 79,
"avg_line_length": 39.8768898488121,
"alnum_prop": 0.5793749661485132,
"repo_name": "devoid/nova",
"id": "3ef1547f48b08044d7616decdba93b3c51478706",
"size": "19103",
... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('socialnet', '0042_remotecomment'),
]
operations = [
migrations.RemoveField(
model_name='remotecomment',
name='comment',
),
... | {
"content_hash": "07617320ee3d586f66c2e0cafd9dca8f",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 44,
"avg_line_length": 20.1,
"alnum_prop": 0.5771144278606966,
"repo_name": "CMPUT404F16T06/CMPUT404Project",
"id": "ebd6d1848c3e4368205109aa6932ca39c7bf053e",
"size": "475... |
import os
import os.path
import pkg_resources
import platform
import re
import shutil
import sys
import tempfile
if sys.hexversion < 0x02070000:
import unittest2 as unittest
else:
import unittest
if sys.hexversion <= 0x03030000:
from mock import patch
else:
from unittest.mock import patch
if sys.hexve... | {
"content_hash": "f0020dbf7243a9020cad4a9f1ba45731",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 80,
"avg_line_length": 37.10333333333333,
"alnum_prop": 0.5547569849968557,
"repo_name": "quintusdias/python-xmp-toolkit",
"id": "9cdd930203803d017c78fa67b3bcbb88f4334058",
... |
from __future__ import absolute_import
import os
from sqlalchemy.orm.exc import NoResultFound
# ============= local library imports ==========================
from pychron.paths import paths
from pychron.database.core.database_adapter import DatabaseAdapter
from pychron.database.orms.local_lab_orm import LabTable, Ba... | {
"content_hash": "26dd02e63e45abfd65d79d48851341cc",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 71,
"avg_line_length": 31.80952380952381,
"alnum_prop": 0.5741017964071856,
"repo_name": "UManPychron/pychron",
"id": "0c2cb220635395bc8f103d66d8b5fa5d174cb9c8",
"size": "2... |
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
from subprocess import check_output
from keras.models import Model
from keras.layers import Dense, Embedding, Input , Activation
from keras.layers import LSTM, Bidirectional, GlobalMaxPool1D, Dropout, GRU
from ker... | {
"content_hash": "6f4337b2fa84cfa3e0dd6d51e6d08b44",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 176,
"avg_line_length": 38.76628352490422,
"alnum_prop": 0.6578375172959083,
"repo_name": "gtesei/fast-furious",
"id": "3bdf5466d3ca5e0f022bacec7dea759774569fa9",
"size": ... |
import sys
from typing import TYPE_CHECKING
if sys.version_info < (3, 7) or TYPE_CHECKING:
from ._aaxis import Aaxis
from ._baxis import Baxis
from ._caxis import Caxis
from ._domain import Domain
from . import aaxis
from . import baxis
from . import caxis
else:
from _plotly_utils.impor... | {
"content_hash": "8e8a3fbe1e6e964670c51a26c389395a",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 79,
"avg_line_length": 28.736842105263158,
"alnum_prop": 0.608058608058608,
"repo_name": "plotly/plotly.py",
"id": "5bd479382d022762352c2234b79f580f1df85ef3",
"size": "546"... |
"""
Controller class for deploying a game
"""
from urllib3.exceptions import HTTPError, SSLError
from simplejson import dump as json_dump, load as json_load, loads as json_loads, JSONDecodeError
from os import stat, sep, error, rename, remove, makedirs, utime, access, R_OK, walk
from os.path import join, basename, abs... | {
"content_hash": "1f7dbf20bd4e6b2e3476613de4248802",
"timestamp": "",
"source": "github",
"line_count": 934,
"max_line_length": 120,
"avg_line_length": 40.50428265524625,
"alnum_prop": 0.46390526287964895,
"repo_name": "turbulenz/turbulenz_local",
"id": "a2948013514f920a8a0a04fc480f18374a490db1",
"... |
print "You enter a dark room with two doors. Do you go through door #1 or door #2?"
door = raw_input("> ")
if door == "1":
print "There's a giant bear here eating a cheese cake. What do you do?"
print "1. Take the cake."
print "2. Scream at the bear."
bear = raw_input("> ")
if bear == "1":
... | {
"content_hash": "a58b3a1f736e8a26612bc304fe78513e",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 83,
"avg_line_length": 31.939393939393938,
"alnum_prop": 0.6233396584440227,
"repo_name": "dadavidson/Python_Lab",
"id": "8f8d8b6bd14567392fbfdda414801e080152239f",
"size":... |
import sys
import os
import subprocess
import time
from datetime import datetime
import shutil
import tempfile
import hashlib
import re
import logging
import argparse
################
#### Telegraf Variables
################
# Packaging variables
PACKAGE_NAME = "telegraf"
INSTALL_ROOT_DIR = "/usr/bin"
LOG_DIR = "/var... | {
"content_hash": "32231fb8181af8e8164b61a1d7946f0b",
"timestamp": "",
"source": "github",
"line_count": 925,
"max_line_length": 135,
"avg_line_length": 42.09081081081081,
"alnum_prop": 0.516694919607541,
"repo_name": "irr/telegraf",
"id": "aeaa04fd3ad8bd4516cbb3cb21b5017e377d7c04",
"size": "38956",... |
"""distutils.msvc9compiler
Contains MSVCCompiler, an implementation of the abstract CCompiler class
for the Microsoft Visual Studio 2008.
The module is compatible with VS 2005 and VS 2008. You can find legacy support
for older versions of VS in distutils.msvccompiler.
"""
# Written by Perry Stoll
# hacked by Robin B... | {
"content_hash": "1c2e1c74b4079644195ef56f657e990e",
"timestamp": "",
"source": "github",
"line_count": 764,
"max_line_length": 99,
"avg_line_length": 38.40837696335078,
"alnum_prop": 0.542257360959651,
"repo_name": "xxd3vin/spp-sdk",
"id": "06b874874352d5654bb808ab5767db4e29909c16",
"size": "29344... |
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from .. import models
from .._serialization import Deserializer, Serializer
from ._configuration import MicrosoftLogzConfiguration
fr... | {
"content_hash": "47fe39a316b3d644a4f30a8bbda46857",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 116,
"avg_line_length": 48.42201834862385,
"alnum_prop": 0.718075028419856,
"repo_name": "Azure/azure-sdk-for-python",
"id": "d6b8b51deed2b4791fcc0915738302262ed1f296",
"s... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
from glob import glob
from ..libraries.file import File
from ..libraries.tools import get_setting
from .command import Command
class PioBridge(Command):
... | {
"content_hash": "c75d2fd570307482b9d117cd8c9787f8",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 72,
"avg_line_length": 28.3135593220339,
"alnum_prop": 0.5983238551331936,
"repo_name": "gepd/Deviot",
"id": "ae64e8e6ff4a54c6ad248228eb47574bd59a77c6",
"size": "3388",
... |
from pearce.emulator import OriginalRecipe, ExtraCrispy
from pearce.mocks.customHODModels import *
from pearce.mocks import cat_dict
from pearce.inference import run_mcmc_iterator
from astropy.table import Table
from halotools.mock_observables import wp
import numpy as np
from os import path
training_dir = '/u/ki/swmc... | {
"content_hash": "e4b7c9f46d3a964c0ba0372bc7406fee",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 191,
"avg_line_length": 39.795081967213115,
"alnum_prop": 0.6545829042224511,
"repo_name": "mclaughlin6464/pearce",
"id": "9f76399de759e08a4c468931cb76d4fe0cbabc77",
"size... |
"""Renewable certificates storage."""
import datetime
import logging
import os
import re
import configobj
import parsedatetime
import pytz
import six
import certbot
from certbot import cli
from certbot import constants
from certbot import crypto_util
from certbot import errors
from certbot import error_handler
from c... | {
"content_hash": "917db5f65a8117c31532d5fadfe214d7",
"timestamp": "",
"source": "github",
"line_count": 900,
"max_line_length": 91,
"avg_line_length": 41.172222222222224,
"alnum_prop": 0.6247739846174606,
"repo_name": "jtl999/certbot",
"id": "c740657d8a6cfa45ac74d8448c327c4f942881ce",
"size": "3705... |
from sqlalchemy import or_
from flask_admin._compat import as_unicode, string_types
from flask_admin.model.ajax import AjaxModelLoader, DEFAULT_PAGE_SIZE
class QueryAjaxModelLoader(AjaxModelLoader):
def __init__(self, name, session, model, **options):
"""
Constructor.
:param fiel... | {
"content_hash": "0a718cd3c43f2bb176b819146116b1f2",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 109,
"avg_line_length": 32.57142857142857,
"alnum_prop": 0.6124401913875598,
"repo_name": "Junnplus/flask-admin",
"id": "ad221e2955ae16ed5e71e771bb4f28d764a025fd",
"size": ... |
"""The SleuthKit (TSK) partition format analyzer helper implementation."""
import pytsk3
from dfvfs.analyzer import analyzer
from dfvfs.analyzer import analyzer_helper
from dfvfs.lib import definitions
from dfvfs.lib import tsk_image
class TSKPartitionAnalyzerHelper(analyzer_helper.AnalyzerHelper):
"""Class that ... | {
"content_hash": "50f3875bd3efecd94bc914360677d35b",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 76,
"avg_line_length": 27.725,
"alnum_prop": 0.7484220018034266,
"repo_name": "jorik041/dfvfs",
"id": "7169add50a610017e5b3bdd27e05f5d9efe22476",
"size": "1133",
"binary"... |
import sys
from collections import namedtuple
from jinja2 import Environment
from jinja2 import FileSystemLoader
from psycopg2.extras import RealDictCursor
from tilequeue.query import DBConnectionPool
from tilequeue.transform import calculate_padded_bounds
TemplateSpec = namedtuple('TemplateSpec', 'template start_z... | {
"content_hash": "2af868ff974ad319d5b1a5c08760a983",
"timestamp": "",
"source": "github",
"line_count": 292,
"max_line_length": 79,
"avg_line_length": 36.18493150684932,
"alnum_prop": 0.627295097482491,
"repo_name": "tilezen/tilequeue",
"id": "27ce93c7afa7cc9c567b0f15555c2291c6e89cfb",
"size": "105... |
"""
Core components of Home Assistant.
Home Assistant is a Home Automation framework for observing the state
of entities and react to changes.
"""
# pylint: disable=unused-import, too-many-lines
import asyncio
from concurrent.futures import ThreadPoolExecutor
import enum
import logging
import os
import re
import sys
i... | {
"content_hash": "ce2a93a87efb25982af2604f04a0b9a0",
"timestamp": "",
"source": "github",
"line_count": 1107,
"max_line_length": 79,
"avg_line_length": 32.91237579042457,
"alnum_prop": 0.5933743206894658,
"repo_name": "keerts/home-assistant",
"id": "29c61842c671e1f699250fa3f3ba9dfc578a681b",
"size"... |
from datetime import datetime
from sandglass import Sandglass,ben
__all__ = ['tslice','timediff']
def tslice(unit,start=None,end=None,step=1,count=None):
'''tslice(unit,start=None,end=None,step=1,count=None) -> generator of Sandglass object
unit in ['year', 'month', 'day', 'hour', 'minute', 'second', 'microse... | {
"content_hash": "c015bc4c9803966f53b5e0301af43331",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 90,
"avg_line_length": 29.148936170212767,
"alnum_prop": 0.589051094890511,
"repo_name": "kzczencode/sandglass",
"id": "c903492c507a084d42c77f6d2016c73622f7e150",
"size": "... |
'''
Manage RabbitMQ Users.
.. code-block:: yaml
rabbit_user:
rabbitmq_user.present:
- password: password
- force: True
- tags: administrator
- permissions:
- '/':
- '.*'
- '.*'
- '.*'
... | {
"content_hash": "8a80888ca01e4a05197fdff7cb06ca9c",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 80,
"avg_line_length": 29.790849673202615,
"alnum_prop": 0.49670908293111016,
"repo_name": "victorywang80/Maintenance",
"id": "3b7141bcc5588925fe267b6183dc7ac3f2ec290b",
"... |
import sys
import json
import traceback
from flask.ext.wtf import TextField, Required, URL
from labmanager.forms import AddForm, RetrospectiveForm, GenericPermissionForm
from labmanager.rlms import register, Laboratory, BaseRLMS, BaseFormCreator, Capabilities, Versions
def get_module(version):
return sys.modules... | {
"content_hash": "62ec5a1f33b14f073b568674d8eb2ae8",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 165,
"avg_line_length": 32.214285714285715,
"alnum_prop": 0.6486819413648682,
"repo_name": "porduna/labmanager",
"id": "9c88f8cc46fa27182b66b49c3e024c91162b8c8f",
"size": ... |
import pytest
from unittest import mock
from awx.main.models import (
UnifiedJob,
UnifiedJobTemplate,
WorkflowJob,
WorkflowJobNode,
WorkflowApprovalTemplate,
Job,
User,
Project,
JobTemplate,
Inventory
)
def test_incorrectly_formatted_variables():
bad_data = '{"bar":"foo'
... | {
"content_hash": "fad24f66b1a58f153ab7d9aebbffc883",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 113,
"avg_line_length": 32.191489361702125,
"alnum_prop": 0.6096056400088126,
"repo_name": "GoogleCloudPlatform/sap-deployment-automation",
"id": "a3f9123f379fcd5a12cc74b1f4... |
import numpy as np
from scipy.stats import norm
from scipy.stats import beta
from matplotlib import mlab
# d-prime
def dprime(confusion_matrix):
"""
Function takes in a 2x2 confusion matrix and returns the d-prime value for the predictions.
d' = z(hit rate)-z(false alarm rate)
http://en.wikipedia.org... | {
"content_hash": "5c18d886ec1127c7f50e983f83f5dc7c",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 144,
"avg_line_length": 29.30252100840336,
"alnum_prop": 0.6375107542299971,
"repo_name": "gentnerlab/pyoperant",
"id": "dacfc2857fbbaf0a94b9046a866f48eea4b952fd",
"size":... |
"""
:module: watchdog.utils
:synopsis: Utility classes and functions.
:author: yesudeep@google.com (Yesudeep Mangalapilly)
Classes
-------
.. autoclass:: BaseThread
:members:
:show-inheritance:
:inherited-members:
"""
import os
import sys
import threading
try:
import watchdog.utils.platform
from watc... | {
"content_hash": "d331ea04a06911f5f69016608e5eb160",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 93,
"avg_line_length": 28.782312925170068,
"alnum_prop": 0.6369652564405578,
"repo_name": "TidalPaladin/Superliminal-resin",
"id": "8e6acb164033e357045d40c1004f4017fd0ac287"... |
__author__ = 'Andreas Bader'
__version__ = "0.01"
# db_folders -> List of DB Folder (for space check)
# db_client -> name of ycsb client
# db_args -> special ycsb arguments for this db
# db_name -> name of this db (e.g. for workload file)
# db_desc -> more detailed name/description
# jvm_args -> special jvm_args for t... | {
"content_hash": "1554eb76131affd1db2a58efd02e62ce",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 230,
"avg_line_length": 71.29850746268657,
"alnum_prop": 0.6996022608331589,
"repo_name": "TSDBBench/Overlord",
"id": "a39472269b09ba4c6b9435703fecc82b14aa1499",
"size": "4... |
"""
********************************************************************************
* Name: views.py
* Author: Nathan Swain
* Created On: 2014
* Copyright: (c) Brigham Young University 2014
* License: BSD 2-Clause
********************************************************************************
"""
from django.shortcut... | {
"content_hash": "076d30af863edfd7a82e187098d02927",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 80,
"avg_line_length": 25.057142857142857,
"alnum_prop": 0.6117445838084379,
"repo_name": "tethysplatform/tethys",
"id": "7d572cd69448c24da935813c759a7c6097a620a4",
"size":... |
from setuptools import setup, find_packages
from rudix import VERSION
with open('README') as f:
README = f.read()
setup(name='rudix',
version=VERSION,
license='BSD',
description='Rudix Package Manager',
long_description=README,
author='Rudá Moura',
author_email='ruda.moura@gmai... | {
"content_hash": "201e2e10eb84c4f2e8c47fc32f87992f",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 67,
"avg_line_length": 35.375,
"alnum_prop": 0.5712603062426383,
"repo_name": "rudix-mac/rpm",
"id": "133657bbd8b97278b31b9b128bc322dd9229390b",
"size": "897",
"binary": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.