text stringlengths 2 999k |
|---|
# Support for python2
from __future__ import print_function
# Import ctypes
from ctypes import *
# Importing Numpy (math, arrays, etc...)
import numpy as np
# Import platform to detect OS
from sys import platform, exit
# Import os utils
from os import path
# Import thermo
from . import thermo
# Import saftvrmie
from . ... |
#
# Copyright (c) 2008-2015 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipaySocialBaseMcommentFootprintSendModel(object):
def __init__(self):
self._biz_type = None
self._ext_data = None
self._footprint_model_code = None
self._footpri... |
import unittest2
import testlib
import mitogen.core
class Thing:
pass
class ListenFireTest(testlib.TestCase):
def test_no_args(self):
thing = Thing()
latch = mitogen.core.Latch()
mitogen.core.listen(thing, 'event',
lambda: latch.put('event fired'))
mitogen.core... |
# python standard library
import time
# this package
from apetools.baseclass import BaseClass
from apetools.commons.errors import ConfigurationError
from apetools.commands.busyboxwget import BusyboxWget, HEADER
class BusyboxWgetSession(BaseClass):
"""
A busybox-based wget monitor
"""
def __init__(se... |
from __future__ import unicode_literals
import datetime
import django
from django import forms
from django.db import models
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.contrib.auth.models import User
class UserProfile(models.Model):
# This line is re... |
# Copyright 2020 Toyota Research Institute. All rights reserved.
import os
from math import pi
import torch
import torch.nn.functional as F
from PIL import Image
import future
from kp2d.kp2d.utils.image import image_grid
class KeypointNet(torch.nn.Module):
"""
Keypoint detection network.
Parameters
... |
'''
Work with virtual machines managed by libvirt
Required python modules: libvirt
'''
# Special Thanks to Michael Dehann, many of the concepts, and a few structures
# of his in the virt func module have been used
import os
import re
import shutil
import subprocess
from xml.dom import minidom
# Import Third Party Li... |
from main import get_temperature
import pytest
from unittest.mock import patch
temp_imputs = [
(62, -14.235004, -51.92528, 16),
]
@patch('main.requests.get')
@pytest.mark.parametrize("temp_farenheit_input, lat, lng, \
celsius_expected_output", temp_imputs)
def test_get_temperature_by... |
# Generated by Django 3.1.3 on 2020-12-06 16:06
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('gears', '0005_auto_20201206_1802'),
]
operations = [
migrations.RemoveField(
model_name='gear',
name='likes',
),
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import webcolors
from collections import OrderedDict
from hypothesis import given
from hypothesis.strategies import sampled_from, text, characters
from matrix.colors import (G, Formatted, FormattedString,
color_html_to_weechat... |
#
#
#
from __future__ import absolute_import, division, print_function, \
unicode_literals
class BaseSource(object):
def __init__(self, id):
self.id = id
if not getattr(self, 'log', False):
raise NotImplementedError('Abstract base class, log property '
... |
#!/usr/bin/env python
# encoding: utf-8
"""
@project:artist_api_test
@author:cloudy
@site:
@file:image.py
@date:2018/1/26 13:59
@description: 对图片处理获得base64
"""
import base64
import os
suffix_list = ["jpg"]
def media_base64():
"""
图片base64
:return:
"""
media_path = os.path.join(os.getcwd(), "test_... |
import torch
import torch.nn as nn
from block import FC_block
class SNN(nn.Module):
def __init__(self, hyperparams):
super(SNN, self).__init__()
self.hyperparams = hyperparams
if self.hyperparams[5] == 'Cifar10':
self.hidden_size = 1500
else:
self.hidden_size... |
from . import db
class User(db.Model):
__tablename__ = "prod_aiohttp_demo_users"
id = db.Column(db.BigInteger(), primary_key=True)
nickname = db.Column(db.Unicode(), default="unnamed")
|
# See LICENSE for licensing information.
#
# Copyright (c) 2016-2019 Regents of the University of California and The Board
# of Regents for the Oklahoma Agricultural and Mechanical College
# (acting for and on behalf of Oklahoma State University)
# All rights reserved.
#
import hierarchy_layout
import hierarchy_spice
i... |
"""
botocore patcher module.
"""
from __future__ import absolute_import
import wrapt
from epsagon.modules.general_wrapper import wrapper
from ..events.botocore import BotocoreEventFactory
def _wrapper(wrapped, instance, args, kwargs):
"""
General wrapper for botocore instrumentation.
:param wrapped: wrap... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... |
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
def gcd(a, b):
if not a%b:
return b
else:
return gcd(b, a%b)
def reduce_fraction(fraction):
return tuple(int(x/gcd(*fraction)) for x in fraction) |
# -*- coding: utf-8 -*-
# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... |
n=int(input()) #출석 부를 횟수
a=input().split() #호명한 번호
for i in range(n): #10
a[i]=int(a[i]) #a 순서대로 저장 # [1, 3, 2, 2, 5, 6, 7, 4, 5, 9]
d=[]
for i in range(24): #d[0, 0, 0, 0, 0, .....0, 0, 0] 24
... |
"""
判断2个基本图形是否发生碰撞,
如果没有碰撞,则返回False
如果碰撞,则返回其中一个碰撞的坐标点,如 {'x': 100, 'y': 200}
"""
from pyleap.mouse import mouse
from pyleap.util import P
__all__ = ['shape_clicked', 'CollisionMixin' ]
def shape_clicked(shape):
shape.transform.update_points(shape.points)
return point_in_points((mouse.x, mouse.y), shape.t... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module provides objects describing the basic parameters of the
pseudopotentials used in Abinit, and a parser to instantiate pseudopotential objects..
"""
from __future__ import unicode_literals, divisio... |
from __future__ import absolute_import, print_function
from sentry.models import Environment, GroupRelease, Release
from sentry.testutils import APITestCase
class GroupEnvironmentDetailsTest(APITestCase):
def test_no_data_empty_env(self):
self.login_as(user=self.user)
group = self.create_group()... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PyGeoEdu documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 8 14:50:02 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021, veena and Contributors
# See license.txt
from __future__ import unicode_literals
# import frappe
import unittest
class TestResourcePlanning(unittest.TestCase):
pass
|
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 2.1.15.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# Bu... |
# Copyright 2018 Fluence Labs Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
import os.path
from data.base_dataset import BaseDataset, get_transform
from data.image_folder import make_dataset
from PIL import Image
import random
class UnalignedDataset(BaseDataset):
def initialize(self, opt):
self.opt = opt
self.root = opt.dataroot
self.dir_A = os.path.join(opt.datar... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
def my_lists(L): return [list(range(1,x)) for x in L]
if __name__ == "__main__":
print(my_lists([1,2,4]))
print(my_lists([0])) |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... |
"""Manifest structure used to store paths that should be included in a test run.
The manifest is represented by a tree of IncludeManifest objects, the root
representing the file and each subnode representing a subdirectory that should
be included or excluded.
"""
import glob
import os
from six import iteritems
from si... |
import shutil
from file_utils import zip_export, wider_create_dir
import gdown
def download(url: str, save_path: str):
gdown.download(url, save_path, quiet=True)
zip_export(save_path)
def face_split_download():
face_split_url = "https://github.com/kadirnar/wideryolo/releases/download/widerface/wider_fac... |
import setuptools
def readme():
with open('README.md') as f:
return f.read()
setuptools.setup(name='gncpy',
version='0.0.0',
description='A package for Guidance, Navigation, and Control (GNC) algorithms.',
long_description=readme(),
url=... |
"""Defines the serializers for jobs and job types"""
from __future__ import absolute_import
import logging
import rest_framework.serializers as serializers
from job.models import Job
from job.job_type_serializers import (JobTypeBaseSerializerV6, JobTypeRevisionBaseSerializer,
Jo... |
class DrillUtilsException(Exception):
pass
class ParserError(DrillUtilsException):
pass
class UnexpectedInputError(ParserError):
def __init__(self, input_):
super().__init__('Cannot parse the geven input ({input})'.format(input=input_))
class ReducerError(DrillUtilsException):
pass
class IllegalActionErr... |
"""
Create ssh executor system
"""
import logging
import os
import shutil
import tarfile
import tempfile
from contextlib import closing
import salt.client.ssh
import salt.client.ssh.shell
import salt.loader
import salt.minion
import salt.roster
import salt.state
import salt.utils.files
import salt.utils.json
import s... |
from .qulacs_converter import QulacsConverter |
import random
from attributes import Agile, Sneaky
from characters import Character
class Thief(Agile, Sneaky, Character):
def pickpocket(self):
return self.sneaky and bool(random.randint(0, 1)) |
import pandas as pd
# pd.options.mode.chained_assignment = None
import numpy as np
import lightgbm as lgb
from sklearn import preprocessing
from sklearn.model_selection import train_test_split,cross_val_score,cross_val_predict
from sklearn.ensemble import RandomTreesEmbedding, RandomForestClassifier, GradientBoostin... |
from bs4 import BeautifulSoup
import requests
import helper
import traceback
def get_jobs(role, location, count_jobs, all_skills):
# URL = "https://www.simplyhired.com/search?q=software+engineer&l=San+Francisco"
URL = "https://www.simplyhired.com/search?q="
for r in role.split():
URL = URL + r + "... |
from __future__ import annotations
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri
from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode
from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType
# This file is auto-generated by generate_classes so do not edi... |
import bpy
from bpy.types import Operator
import bmesh
from bpy_extras.object_utils import AddObjectHelper, object_data_add
from bpy.props import (
BoolProperty,
BoolVectorProperty,
EnumProperty,
FloatProperty,
FloatVectorProperty,
IntProperty,
)
def add_box(width, height, depth):
"""
... |
"""
CryptoAPIs
Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei... |
import asyncio
import random
from userbot.cmdhelp import CmdHelp
from userbot.utils import admin_cmd
@borg.on(admin_cmd(pattern=r"carry$", outgoing=True))
async def _(event):
if event.fwd_from:
return
await event.edit("speaking a line.......")
await asyncio.sleep(2)
x = random.randrange(1, 25... |
# Copyright 2015 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
"""This module defines the vtgate client interface.
"""
from vtdb import vtgate_cursor
# mapping from protocol to python class.
vtgate_client_conn_classes = dict()
... |
from typing import (
AsyncGenerator,
List,
Tuple,
cast,
)
from eth_typing import BlockNumber, Hash32
from cancel_token import CancelToken
from hvm.exceptions import (
HeaderNotFound,
)
from hvm.rlp.headers import BlockHeader
from hvm.rlp.receipts import Receipt
from hvm.rlp.transactions import Ba... |
# Generated by Django 3.2.7 on 2021-10-03 07:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zerver", "0362_send_typing_notifications_user_setting"),
]
operations = [
migrations.AddField(
model_name="realmuserdefault",
... |
# -*- coding: utf-8 -*-
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
# Import salt libs
import salt.modules.postgres as postgresmod
import salt.states.postgres_database as postgres_database
import salt.states.postgres_extension as postgres_extension
import salt.states.... |
#!/usr/bin/env python
from __future__ import (division, print_function)
import os, sys
import ROOT
ROOT.PyConfig.IgnoreCommandLineOptions = True
from importlib import import_module
from PhysicsTools.NanoAODTools.postprocessing.framework.postprocessor import PostProcessor
from FourTopNAOD.Kai.modules.eventselector impo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 19 11:21:10 2020
@author: Bernd Kampe
"""
import logging
import pickle
import re # Only used in exception handling
from collections import namedtuple
from functools import cmp_to_key
from pathlib import Path
from typing import List, Union
import ... |
from pylivetrader import api
from pylivetrader.assets import Asset
import pylivetrader.protocol as zp
from pylivetrader.assets import Equity
from pylivetrader.finance.order import (
Order as ZPOrder,
ORDER_STATUS as ZP_ORDER_STATUS,
)
from pylivetrader.backend.base import BaseBackend
import pandas as pd
import... |
import copy
import numpy
from nn import *
from ml import *
from ActivationFunction import *
class AddTest(Test):
def test(self, nn):
score = 0
for a in range(1, 10):
for b in range(1, 10):
c = 2 * a + b
nn.setnode(0, a)
nn.setnode(1, b)... |
import sys
import random
from abc import ABC, abstractmethod
class Sort(ABC):
@abstractmethod
def sort(self, a):
pass
def is_sorted(self, a):
for i in range(1, len(a)):
if a[i] < a[i - 1]:
return False
return True
class SelectionSort(Sort):
def so... |
from mylocker import *
class example:
@lockhelper(mylocker)
def myfunc(self):
print(" myfunc() called.")
@lockhelper(mylocker)
@lockhelper(lockerex)
def myfunc2(self, a, b):
print(" myfunc2() called.")
return a + b
if __name__=="__main__":
a = example(... |
from numpy import ceil
from pseas.discrimination.discrimination import Discrimination
from typing import Tuple, List, Optional
class SubsetBaseline(Discrimination):
"""
Subset X% baseline for discrimination component.
Parameter:
----------
- ratio: ]0, 1] fraction of instances to run before reach... |
import os
PACKAGEDIR = os.path.abspath(os.path.dirname(__file__))
from .version import __version__
from .fetch_lc import *
from .main import *
from .search import *
from .utils import *
from .constants import *
from .plotting import *
from .lcprocess import *
from .batman import *
from .validate import *
|
from importlib import import_module
_modules = ['branching', 'data_processing', 'exception_handling', 'load_store']
class Execute(object):
def __init__(self, registers, process_mode, memory):
self.instruction = {}
for module_name in _modules:
mod = import_module("Execute." + module_na... |
from django.db import models
from picklefield.fields import PickledObjectField
class RpxData(models.Model):
#Primary key field is automatically created.
#The RPX identifier is essentially an OpenID URL.
identifier = models.URLField(unique = True, verify_exists = False,
... |
from django.contrib.sites.models import Site
from unittest import skipUnless
from django.apps import apps
from django.core.checks import Warning
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
from django.db import connection
from django.http import HttpResponse
from... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Zulip hook for Mercurial changeset pushes.
# Copyright © 2012-2014 Zulip, Inc.
#
# 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 res... |
from bitmovin.resources.models import VorbisCodecConfiguration
from ..rest_service import RestService
class Vorbis(RestService):
BASE_ENDPOINT_URL = 'encoding/configurations/audio/vorbis'
def __init__(self, http_client):
super().__init__(http_client=http_client, relative_url=self.BASE_ENDPOINT_URL, c... |
"""Test different accessory types: Thermostats."""
from unittest.mock import patch
from pyhap.const import HAP_REPR_AID, HAP_REPR_CHARS, HAP_REPR_IID, HAP_REPR_VALUE
import pytest
from homeassistant.components.climate.const import (
ATTR_CURRENT_HUMIDITY,
ATTR_CURRENT_TEMPERATURE,
ATTR_HUMIDITY,
ATTR_... |
crc8table = [0x00, 0x5e, 0xbc, 0xe2, 0x61, 0x3f, 0xdd, 0x83, 0xc2, 0x9c, 0x7e, 0x20, 0xa3, 0xfd, 0x1f, 0x41,
0x9d, 0xc3, 0x21, 0x7f, 0xfc, 0xa2, 0x40, 0x1e, 0x5f, 0x01, 0xe3, 0xbd, 0x3e, 0x60, 0x82, 0xdc,
0x23, 0x7d, 0x9f, 0xc1, 0x42, 0x1c, 0xfe, 0xa0, 0xe1, 0xbf, 0x5d, 0x03, 0x80, 0xde, 0x3c, 0x62,
0xbe, 0xe0, 0x02, 0... |
import re
from pathlib import Path
from unittest import TestCase
from unimport import constants as C
from unimport import utils
from unimport.config import Config, DefaultConfig
TEST_DIR = Path(__file__).parent / "configs"
pyproject = TEST_DIR / "pyproject.toml"
setup_cfg = TEST_DIR / "setup.cfg"
no_unimport_pyproj... |
"""Tests for matcher.py."""
from pytype import abstract
from pytype import config
from pytype import errors
from pytype import utils
from pytype import vm
import unittest
class MatcherTest(unittest.TestCase):
"""Test matcher.AbstractMatcher."""
def setUp(self):
self.vm = vm.VirtualMachine(errors.ErrorLog(... |
from flask import Flask,request
from flask_restful import Resource,Api
from SeoulCampus import seoulCampus
from SejongCampus import sejongCampus
app = Flask(__name__)
api = Api(app)
@app.route("/seoul")
def returnSeoul():
return seoulCampus()
@app.route("/sejong")
def returnSejong():
return sejongC... |
# Copyright (c) Facebook, Inc. and its affiliates.
import math
import numpy as np
from enum import IntEnum, unique
from typing import List, Tuple, Union
import torch
from torch import device
from detectron2.utils.env import TORCH_VERSION
_RawBoxType = Union[List[float], Tuple[float, ...], torch.Tensor, np.ndarray]
... |
################################################################################
# IMPORT MODULES
#-------------------------------------------------------------------------------
import datetime
START = datetime.datetime.now()
import os.path, warnings
import numpy as np
from astropy.table import Table
import astropy... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
# Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
import torch
__all__ = ['SGDW']
#NOTE: modified from https://github.com/wbaek/torchskeleton/tree/master/skeleton/optim
class SGDW(torch.optim.SGD):
"""Implements SGD with weight decay
- **Paper**: [Decoupled Weight Decay Regularization](https://arxiv.org/abs/1711.05101)
- **Implementation**: [GitHub @ w... |
# pylint: disable=all
"""Bokeh forestplot."""
from collections import defaultdict, OrderedDict
from itertools import cycle, tee
import bokeh.plotting as bkp
from bokeh.models import Band, ColumnDataSource, DataRange1d
from bokeh.models.annotations import Title
from bokeh.models.tickers import FixedTicker
import matplo... |
# -*- coding: utf-8 -*-
import os
import subprocess
from .Story import Story
from .parser import Parser
class Bundle:
"""
Bundles all stories that must be compiled together.
"""
def __init__(self, story_files=None):
self.stories = {}
if story_files is None:
story_files = ... |
import random
from typing import TYPE_CHECKING, Callable, cast
from wolfbot import const
from wolfbot.enums import Role
from wolfbot.predictions.engine import get_switch_dict
from wolfbot.predictions.evil import make_evil_prediction
from wolfbot.solvers import SolverState
if TYPE_CHECKING:
from _typeshed import S... |
from functools import reduce
def accuracy(a, b):
common_keys = set(a).intersection(b)
all_keys = set(a).union(b)
score = len(common_keys) / len(all_keys) #key score
if (score == 0):
return score, 'zero'
else: #value score
pred = {}
for k in common_keys:
pred[k] ... |
import json
from typing import Any, Dict, List, Optional
from nuclio.utils import DeployError
from sqlalchemy.orm import Session
from v3io.dataplane import RaiseForStatus
import mlrun.api.api.utils
import mlrun.api.utils.clients.opa
import mlrun.datastore.store_resources
from mlrun.api.api.utils import _submit_run, g... |
try :
file = open( 'nonsuch.txt' , 'r' )
data = file.read()
file.close()
print( data )
except ( FileNotFoundError ) :
print( 'The Program Cannot Find A File' ) |
#!/usr/bin/env python
#
# ESP32 efuse table generation tool
#
# Converts efuse table to header file efuse_table.h.
#
# SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import division, print_function
import argparse
import hashlib
import os
i... |
from bluetooth.Manger import defaultManger, deviceManager
from device.Radio import radio, DisplayMode
from module.EventBus import mainEventBus
import subprocess
from bluetooth.objects.Device import Device
class A2DP:
_interact_with_player = True
_bluealsa_process = None
def __init__(self):
defaul... |
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %%
import os
from functools import partial
# %%
from matplotlib import pyplot as plt
import matplotlib
import pandas as pd
from numpy import unique
# %%
from model_analysis import *
# %% [markdown]
# ### Loading data
# %%
ru... |
from __future__ import annotations
import json
import logging
from typing import Any, Dict, Literal, Optional
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotFound
from django.shortcut... |
import placement_bestfit
class WorstFit(placement_bestfit.BestFit):
def __init__(self, model):
super(WorstFit, self).__init__(model)
def sort(self, host_choice, _key):
host_choice = sorted(host_choice, key = _key)
host_choice.reverse()
return host_choice
... |
# Generated from D:/AnacondaProjects/iust_compilers_teaching/grammars\Java9_v2.g4 by ANTLR 4.8
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2x")
buf.w... |
from django.utils.six.moves import zip
from django.core.exceptions import FieldError
from django.db import transaction
from django.db.backends.util import truncate_name
from django.db.models.constants import LOOKUP_SEP
from django.db.models.query_utils import select_related_descend
from django.db.models.sql.constants ... |
from bsn_sdk_py.common import myecdsa256
from bsn_sdk_py.client.config import Config
from bsn_sdk_py.client.entity.bsn_base import BsnBase
from bsn_sdk_py.until.tools import nonce_str, array_sort, map_sort, obj_sort
class ReqChainCode(BsnBase):
def __init__(self,
chainCode,
funcN... |
from pycoingecko import CoinGeckoAPI
cg = CoinGeckoAPI()
r = cg.get_coins_markets(vs_currency='usd')
def output(x):
l = []
for _ in range(x):
l.append((int(r[_]['market_cap']), r[_]['name']))
for i in range(x):
print(l[i][1], l[i][0])
output(4)
|
# -*- coding: utf-8 -*-
import inspect
import logging
import re
from six import string_types
from . import helpers
from . import magicnumbers
from . import util
from .magicnumbers import maps, language_map
from .xpath import xpb
log = logging.getLogger(__name__)
class Detail(object):
"""Represent a detail bel... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
# 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 ... |
# Lint as: python2, python3
# Copyright 2019 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import A... |
#!/usr/bin/env python3
import datetime
import os
import time
from pathlib import Path
from typing import Dict, Optional, Tuple
import psutil
from smbus2 import SMBus
import cereal.messaging as messaging
from cereal import log
from common.filter_simple import FirstOrderFilter
from common.numpy_fast import clip, interp... |
import dgen_model
import dgen_utils
class dgenDocument(object):
def __init__(self):
self.sections = []
@property
def sections(self):
return self.__sections
@sections.setter
def sections(self, value):
if isinstance(value, str):
self.__sections = [value]
... |
#!/usr/bin/python
from __future__ import division
from __future__ import print_function
"""
This file serves as an example of how to
a) select a problem to be solved
b) select a network type
c) train the network to minimize recovery MSE
"""
import numpy as np
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # BE ... |
from app import app, socketio, PORT, DEBUG
if __name__ == "__main__":
socketio.run(app, host="127.0.0.1", port=int(PORT), debug=DEBUG)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.