filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_8472 | """Customized dataloader for general video classification tasks."""
import os
import warnings
import numpy as np
try:
from decord import VideoReader, cpu
except ImportError:
VideoReader = None
cpu = None
import torch
from torch.utils.data import Dataset
from ..transforms.videotransforms import video_trans... |
the-stack_0_8474 | # Copyright 2014 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Grab bag file for transaction."""
import logging
from google.appengine.api import datastore_errors
from google.appengine.ext import ndb
from ... |
the-stack_0_8476 | # -*- coding: utf-8 -*-
# vim: ft=python
"""
tests.unit.test_lfulib
"""
from __future__ import absolute_import
# Import 3rd party libs.
import pytest
# Import from local project.
from lfucache.exceptions import InvalidItemException
from lfucache.lfulib import LFUCache
# Import test scaffolding.
from tests.unit.fixt... |
the-stack_0_8481 | # Copyright (c) 2014 EMC 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 requ... |
the-stack_0_8484 | from database.models import *
from database.queries import hasKVPair
from IPython import embed
import numpy as np
from database.imports import printD,ploc,datetime,timedelta,_tdb,FlushError,IntegrityError
#_tdb.tdbOff()
#FIXME TODO, make all these things use queries instead of generating you nub
#and failover to cr... |
the-stack_0_8485 | #
# Copyright 2018 Analytics Zoo Authors.
#
# 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... |
the-stack_0_8488 | # Copyright (c) 2014-2016, ConfigSpace developers
# Matthias Feurer
# Katharina Eggensperger
# and others (see commit history).
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributi... |
the-stack_0_8490 | import os
import sys
import uuid
import fileinput
import boto3
region = os.getenv('AWS_REGION')
tg = os.getenv('AWS_IOT_THING_NAME')
try:
mac_address = hex(uuid.getnode())
mac_address = mac_address[2:8] + 'fffe' + mac_address[8:]
print('the GatewayEui for the gateway will be', mac_address)
input_f... |
the-stack_0_8491 | import csv
import math
import re
import argparse
import random
def calculate_quota(num_winners, num_votes):
return math.floor(num_votes * (1.0 / (1 + num_winners)))
class Candidate:
""" A model for representing vote counts.
Args:
name: String key for the candidate.
ballots: A 2D array w... |
the-stack_0_8492 | class Student(object):
"""This is a Superclass
It holds holds the total number of students
"""
counter = 0
def __init__(self):
type(self).counter += 1
def __del__(self):
type(self).counter -= 1
def student_stream(self):
"""data encapsulation: color can not be accessed by another class
Abstracti... |
the-stack_0_8493 |
from unittest import TestCase
from unittest import mock
from multiphase.multiphase import Multiphase
class MultiphaseTests(TestCase):
"""
Test Multiphase.
"""
def setUp(self):
self.app = Multiphase()
def test_run(self):
"""
Test the run code.
"""
args = []... |
the-stack_0_8494 | """
Data structure for 1-dimensional cross-sectional and time series data
"""
from io import StringIO
from shutil import get_terminal_size
from textwrap import dedent
from typing import (
IO,
TYPE_CHECKING,
Any,
Callable,
Iterable,
List,
Optional,
Tuple,
Type,
Uni... |
the-stack_0_8495 | """
Support for Wink lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.wink/
"""
import colorsys
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_RGB_COLOR, SUPPORT_BRIGHTNESS,
SUPPORT_COLOR_TEMP, SU... |
the-stack_0_8496 | """
Django settings for healthchecks project.
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings
"""
import os
import warnings
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def envbool(s, default):
v = os.getenv(s, default=default)
... |
the-stack_0_8497 | # Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
"""Defines the dashboard class."""
import json
import os
import uuid
from html.parser import HTMLParser
from rai_core_flask import FlaskHelper # , environment_detector
from responsibleai.serialization_utilities import serialize_json_safe
cla... |
the-stack_0_8498 | import toppra
import numpy as np
from _mplib import *
import toppra as ta
import toppra.constraint as constraint
import toppra.algorithm as algo
from transforms3d.quaternions import quat2mat
from typing import Tuple
class Planner(object):
def __init__(
self,
urdf="./panda/panda.urdf",
srdf="./panda/panda.srdf"... |
the-stack_0_8499 | from __future__ import division
import argparse
import copy
import os
import os.path as osp
import time
import mmcv
import torch
from mmcv import Config
from mmcv.runner import init_dist
from mmdet import __version__
from mmdet.apis import set_random_seed, train_detector
from mmdet.datasets import build_dataset
from ... |
the-stack_0_8504 | from recipe_scrapers.heb import HEB
from tests import ScraperTest
class TestHEBScraper(ScraperTest):
scraper_class = HEB
def test_host(self):
self.assertEqual("heb.com", self.harvester_class.host())
def test_canonical_url(self):
self.assertEqual(
"https://www.heb.com/recipe/... |
the-stack_0_8505 | import cStringIO
import logging
from datetime import datetime
from clarity_ext_scripts.covid.controls import controls_barcode_generator
from clarity_ext_scripts.covid.services.knm_service import KNMClientFromExtension
from clarity_ext_scripts.covid.create_samples.common import (
BaseRawSampleListFile, ValidatedSamp... |
the-stack_0_8506 | #!/usr/bin/env python3
# Copyright (c) 2015-2016 The Deft developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test processing of unrequested blocks.
Setup: two nodes, node0+node1, not connected to each other. Node1 will ... |
the-stack_0_8512 | import ntpath
from lead2gold.tools.tool import Tool
from lead2gold.util import pwm2consensus
from lead2gold.util import sequence2pwm
from lead2gold.motif import Motif
class EMD(Tool):
"""Class implementing a EMD search tool motif convertor.
"""
toolName = "EMD"
def __init__(self):
"""Initialize all class attr... |
the-stack_0_8513 | # copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# 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... |
the-stack_0_8516 | #!/usr/bin/env python
import rospy
import actionlib
from actionlib_msgs.msg import *
from geometry_msgs.msg import Pose, Point, Quaternion, Twist
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
from tf.transformations import quaternion_from_euler
from visualization_msgs.msg import Marker
from math import r... |
the-stack_0_8517 | #!/usr/bin/env python
import sys
import logging
import argparse
import json
from pds_pipelines.db import db_connect
from pds_pipelines.models.pds_models import Files
from pds_pipelines.RedisQueue import RedisQueue
from pds_pipelines.config import pds_log, pds_info, pds_db
class Args:
def __init__(self):
... |
the-stack_0_8518 | # -*- coding: utf-8 -*-
"""
requests.utils
~~~~~~~~~~~~~~
This module provides utlity functions that are used within Requests
that are also useful for external consumption.
"""
import cgi
import codecs
import http.cookiejar
import os
import random
import re
import zlib
from urllib2 import parse_http_list as _parse... |
the-stack_0_8520 | from enum import Enum
import random
import pampy
class Case(Enum):
Nominative = 1
Accusative = 2
Genitive = 3
Dative = 4
class Gender(Enum):
Female = 1
Masculine = 2
Neutral = 3
class Declension(Enum):
First = 1
Second = 2
Third = 3
class Number(Enum):
Single = 1
... |
the-stack_0_8521 | from __future__ import print_function
import time
class Looper(object):
"""Represents the state of a loop of events."""
RECORD, PAUSE, PLAY = 'record', 'pause', 'play'
def __init__(self, state=PAUSE, events=None, loop_length=0):
self.state = state
if state == Looper.RECORD:
se... |
the-stack_0_8522 | from . import BaseAction
from ..db.controllers import ServerController
class SetAdminRoleAction(BaseAction):
action_name = "imdb_tv_shows"
admin = True
controller = ServerController()
async def action(self, msg):
toggle_value = self.get_message_data(msg)
if not toggle_value:
... |
the-stack_0_8523 | #!/usr/bin/env python
import unittest
import socket
from framework import VppTestCase, VppTestRunner
from vpp_ip_route import VppIpRoute, VppRoutePath, VppMplsRoute, \
VppMplsTable, VppIpMRoute, VppMRoutePath, VppIpTable, \
MRouteEntryFlags, MRouteItfFlags, MPLS_LABEL_INVALID, DpoProto
from vpp_bier import *
... |
the-stack_0_8524 | from __future__ import unicode_literals
import arrow
import json
import unittest
import sys
from httmock import HTTMock
from nose.tools import eq_
from misfit import Misfit, MisfitGoal, MisfitSummary
from misfit.exceptions import MisfitException
from .mocks import MisfitHttMock
class TestMisfitAPI(unittest.TestCa... |
the-stack_0_8528 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# keplerian documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# 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... |
the-stack_0_8532 | import time, traceback, json
import rethinkdb as r
TIX = 'tix' # DB
VENU = 'venu' # TABLE
ID = 'id' # COLUMN
TS = 'ts' # COLUMN
SMAP = 'smap' # COLUMN
UMAP = 'umap' # COLUMN
MAX = 'max' # COLUMN
CNT = 20 # number of seats
def init(conn, event):
# try to drop table (may or may not exist)
rv = ... |
the-stack_0_8534 | # Copyright 2002 Gary Strangman. All rights reserved
# Copyright 2002-2016 The SciPy Developers
#
# The original code from Gary Strangman was heavily adapted for
# use in SciPy by Travis Oliphant. The original code came with the
# following disclaimer:
#
# This software is provided "as-is". There are no expressed or... |
the-stack_0_8535 | #****************************************************#
# This file is part of OPTALG. #
# #
# Copyright (c) 2019, Tomas Tinoco De Rubira. #
# #
# OPTALG is released under the BSD 2-clause l... |
the-stack_0_8537 | # 2020 CCC PROBLEM J1'S SOLUTION:
# declaring variables for the treat sizes.
SMALL_TREATS = int(input())
MEDIUM_TREATS = int(input())
LARGE_TREATS = int(input())
# arithmetic calculation for the determinant.
determinant = (1 * SMALL_TREATS) + (2 * MEDIUM_TREATS) + (3 * LARGE_TREATS)
# determining whether t... |
the-stack_0_8538 | import logging
from django.core.management.base import BaseCommand
from django.db import connection, connections
from django.conf import settings
from usaspending.common.helpers import timer
logger = logging.getLogger('console')
# Website columns need for update from financial_accounts_by_program_activity_object_cl... |
the-stack_0_8539 | """Base actions for the players to take."""
from csrv.model.actions import action
from csrv.model import appropriations
from csrv.model import cost
from csrv.model import errors
from csrv.model import events
from csrv.model import game_object
from csrv.model import parameters
from csrv.model.cards import card_info
c... |
the-stack_0_8542 | import json
import os
from typing import Optional
from eth_abi import encode_abi
from web3 import Web3, HTTPProvider
from web3.contract import Contract
try:
from web3.utils.abi import get_constructor_abi, merge_args_and_kwargs
from web3.utils.events import get_event_data
from web3.utils.filters import con... |
the-stack_0_8543 | #!/usr/bin/env python3
"""
Example: Write the contents of a Buffer to disk.
"""
from supercollider import Server, Synth, Buffer, HEADER_FORMAT_WAV
import math
OUTPUT_FILE = "/tmp/440.wav"
#-------------------------------------------------------------------------------
# Create connection to default server on local... |
the-stack_0_8545 | from random import randint
"""
Найти наименьшее натуральное число, записываемое в десятичной системе счисления только с помощью цифр 0 и 1,
которое делится без остатка на заданное число К (2 ≤ К ≤ 100).
"""
def first_exercise(numbers, divider):
array = [number for number in numbers if number % divider ... |
the-stack_0_8546 | import os
import posixpath
import string
from pathlib import PurePath
from shutil import copyfileobj, rmtree
import boto3
from flask import current_app, redirect, send_file
from flask.helpers import safe_join
from werkzeug.utils import secure_filename
from CTFd.utils import get_app_config
from CTFd.utils.encoding imp... |
the-stack_0_8548 | # -*- coding:utf-8 -*-
# pylint: disable=C0103, C0413
"""
Initializing telegram bot
"""
from os import environ
from telebot import TeleBot, types
from config import DEFAULT_LANGUAGE, EN
TOKEN = environ.get("TELEGRAM_BOT_TOKEN")
APP_SITE = environ.get("APP_SITE")
DEFAULT_PARSE_MODE = "HTML"
MESSAGE_NOT_FOUND = "Sorry... |
the-stack_0_8550 | import os
import glob
import pandas as pd
game_files = glob.glob(os.path.join(os.getcwd(), 'games', '*.EVE'))
game_files.sort()
game_frames = []
for game_file in game_files:
game_frame = pd.read_csv(game_file, names=['type', 'multi2', 'multi3', 'multi4', 'multi5', 'multi6', 'event'])
game_frames.append(game_f... |
the-stack_0_8554 | import sys
import pygame
from bullet import Bullet
def check_keydown_events(event, ai_settings, screen, ship, bullets):
"""Respond to keypresses."""
if event.key == pygame.K_RIGHT:
ship.moving_right = True
elif event.key == pygame.K_LEFT:
ship.moving_left = True
elif event.key == pyga... |
the-stack_0_8557 | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import argparse
import llnl.util.tty as tty
import spack.cmd
import spack.environment as ev
import spack.repo
import spa... |
the-stack_0_8558 | # -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsLogger.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__autho... |
the-stack_0_8561 | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 13 17:22:08 2019
@author: Chenghai Li
"""
import math
import time
import torch
import torch.nn as nn
import numpy as np
from torchdiffeq import odeint_adjoint as odeint
import matplotlib.pyplot as plt
from scipy import interpolate
device = torch.device('... |
the-stack_0_8562 | from django.urls import path
from .views import post_comment_create_and_list_view, like_unlike_post, PostDeleteView, PostUpdateView
app_name = 'posts'
urlpatterns = [
path('', post_comment_create_and_list_view, name='main-post-view'),
path('liked/', like_unlike_post, name='like-post-view'),
path('<pk>/del... |
the-stack_0_8565 | #!/bin/env python
#===============================================================================
# NAME: SerialHVisitor.py
#
# DESCRIPTION: A visitor responsible for the generation of header file
# for each serializable class.
#
# AUTHOR: reder
# EMAIL: reder@jpl.nasa.gov
# DATE CREATED : June 4, 2007
... |
the-stack_0_8567 | import PyPDF2
# This code will add the watermark file on each of the files from super_pdf
template = PyPDF2.PdfFileReader(open('super_pdf', 'rb'))
watermark = PyPDF2.PdfFileReader(open('wtr.pdf', 'rb'))
output = PyPDF2.PdfFileWriter()
for i in range(template.getNumPages()):
page = template.getPage(i)
page.merg... |
the-stack_0_8569 | import os
import subprocess
from platform import system
from time import sleep
try:
from psutil import NoSuchProcess, Process
except ImportError:
""" Don't make psutil a strict requirement, but use if available. """
Process = None
def kill_pid(pid, use_psutil=True):
if use_psutil and Process:
... |
the-stack_0_8572 | # Demonstrates the IPTC Media Topics document classification capability of the (Cloud based) expert.ai Natural Language API
from expertai.nlapi.cloud.client import ExpertAiClient
client = ExpertAiClient()
text = "Michael Jordan was one of the best basketball players of all time. Scoring was Jordan's stand-out skill, ... |
the-stack_0_8573 | import logging
import sys
# Make sure a NullHandler is available
# This was added in Python 2.7/3.2
try:
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
# Make sure that dictConfig is available
# This was added in Python... |
the-stack_0_8575 | # -*- coding: utf-8 -*-
#
# records.py
# csvdiff
#
import six
import csv
from . import error
class InvalidKeyError(Exception):
pass
def load(file_or_stream, sep=','):
istream = (open(file_or_stream)
if not hasattr(file_or_stream, 'read')
else file_or_stream)
# unicode... |
the-stack_0_8576 | #!/usr/bin/env python
from __future__ import print_function
import gripql
import argparse
import pandas
import math
def load_matrix(args):
conn = gripql.Connection(args.server)
O = conn.graph(args.db)
matrix = pandas.read_csv(args.input, sep="\t", index_col=0)
for name, row in matrix.iterrows():
... |
the-stack_0_8577 | # This is a dict where each entry contains an label for a morphological feature,
# or the label for the UPOS tag if the key is 'upos'
pos_properties = {'ADJ': ['Degree', 'Number', 'Gender', 'Case'],
'ADP': ['Number', 'Gender', 'Case'],
'ADV': ['Degree', 'Abbr'],
'AUX': ['Mood',
'Aspect',
'Tense',
... |
the-stack_0_8580 | """AI."""
from mgz import Version
from mgz.util import Find
from construct import (Array, Byte, If, Int16ul, Int32sl, Int32ul, Padding,
PascalString, Struct, this, IfThenElse)
# pylint: disable=invalid-name
script = "script"/Struct(
Padding(4),
"seq"/Int32sl,
"max_rules"/Int16ul,
... |
the-stack_0_8581 | # Copyright (c) 2020 Graphcore Ltd. All rights reserved.
from contextlib import contextmanager
import copy
import fcntl
import hashlib
import os
from typing import Dict, Any
import torch
# Do not import any poptorch.* here: it will break the poptorch module
from ._logging import logger
from . import poptorch_core
# ... |
the-stack_0_8582 | #excersise when we create 2 inherited classes from main Turtle. Each has defined function to turn in predefined direction.
#after we create 20 turtles and list them
#we check the turtles in list and assign pen colors
#let all turtles draw square, each with assigned color and turning in predefined direction
from turtle... |
the-stack_0_8583 | # Copyright 2019 Xanadu Quantum Technologies 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 law or agre... |
the-stack_0_8584 | #In 1
from __future__ import print_function
from __future__ import division
import pandas as pd
import numpy as np
# from matplotlib import pyplot as plt
# import seaborn as sns
# from sklearn.model_selection import train_test_split
import statsmodels.api as sm
# just for the sake of this blog post!
from warnings... |
the-stack_0_8585 | """Xbox Media Source Implementation."""
from __future__ import annotations
from dataclasses import dataclass
from pydantic.error_wrappers import ValidationError # pylint: disable=no-name-in-module
from xbox.webapi.api.client import XboxLiveClient
from xbox.webapi.api.provider.catalog.models import FieldsTemplate, Im... |
the-stack_0_8587 | #Reads files
#input = open('words.txt','r')
input = open('http://woz.cs.missouriwestern.edu/data/docs/moby.txt')
for line in input:
line = line.strip()
print("The line is",line)
input.close()
print("Done") |
the-stack_0_8588 | from commands import tankdrive
import ctre
from wpilib import SmartDashboard as Dash
from wpilib.command import Subsystem
from constants import Constants
from utils import singleton, units, lazytalonsrx
import math
class Drive(Subsystem, metaclass=singleton.Singleton):
"""The Drive subsystem controls the drive ... |
the-stack_0_8591 | import numpy as np
import scipy.signal
from typing import Dict, Optional
from ray.rllib.evaluation.episode import MultiAgentEpisode
from ray.rllib.policy.policy import Policy
from ray.rllib.policy.sample_batch import SampleBatch
from ray.rllib.utils.annotations import DeveloperAPI
from ray.rllib.utils.typing import Ag... |
the-stack_0_8594 | # 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 ... |
the-stack_0_8595 | from flask import Flask, request, jsonify
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
import os
from flask_cors import CORS
# Init app
app = Flask(__name__)
#config headers
CORS(app)
basedir = os.path.abspath(os.path.dirname(__file__))
# Database
app.config['SQLALCHEMY_DATABASE... |
the-stack_0_8597 | import sys
import pygame
from pygame.locals import *
from constants import *
from event import HandleEvent
from utils.vector import Vector3
from utils.camera import Camera
from utils.light import Light
from utils.mesh.base import Mesh
from utils.mesh.meshes import *
from utils.mesh.spheres import *
from utils.mesh.poin... |
the-stack_0_8598 | from torchvision.datasets import CIFAR10
from torchvision.datasets import CIFAR100
from torch.utils.data import DataLoader
from torchvision.transforms import Compose, Pad, RandomCrop, RandomHorizontalFlip
from torchvision.transforms import ToTensor, Normalize
CIFAR10_CLASS = [
"airplane", "automobile", "bird", "c... |
the-stack_0_8600 | import sys
from typing import List
def reverse_args(av: List[str]) -> None:
if len(av) == 1:
return
without_program_name = av[1:len(av)]
joined = ' '.join(without_program_name)
reversed = joined[::-1]
swap_Aa_aA = reversed.swapcase()
print(swap_Aa_aA)
return
if __name__ == "__main_... |
the-stack_0_8601 | """
example showing how to plot data from a DEM file and an ESRI shape file using
gdal (http://pypi.python.org/pypi/GDAL).
"""
from osgeo import gdal, ogr
from mpl_toolkits.basemap import Basemap, cm
import numpy as np
import matplotlib.pyplot as plt
from numpy import ma
# read 2.5 minute U.S. DEM file using gdal.
# ... |
the-stack_0_8607 | # Copyright 2015 VMware, 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.0
#
# Unless required by a... |
the-stack_0_8608 | #!/usr/bin/env python3
# Copyright 2019 Intel Corporation
#
# 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... |
the-stack_0_8611 | from functools import reduce
from sys import *
import numpy as np
import random as r
import socket
import struct
import subprocess as sp
import threading
from threading import Thread
import ast
import time
import datetime as dt
import os
import psutil
from netifaces import interfaces, ifaddresses, AF_INET
import paho.m... |
the-stack_0_8613 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
the-stack_0_8614 | # *********************************************************************************
# REopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions a... |
the-stack_0_8615 | # Copyright (C) 2021, Mindee.
# This program is licensed under the Apache License version 2.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0.txt> for full license details.
import json
import os
from typing import Any, Callable, List, Optional, Tuple
import numpy as np
from doctr.utils.geometry i... |
the-stack_0_8616 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Dummy router supporting IGD."""
# Instructions:
# - Change `SOURCE``. When using IPv6, be sure to set the scope_id, the last value in the tuple.
# - Run this module.
# - Run upnp-client (change IP to your own IP):
# upnp-client call-action 'http://0.0.0.0:8000/device... |
the-stack_0_8620 | from dagster_graphql.client.util import parse_raw_log_lines
from dagster_k8s.utils import (
get_pod_names_in_job,
retrieve_pod_logs,
wait_for_job,
wait_for_job_success,
)
from dagster import check
def wait_for_job_ready(job_name, namespace):
'''Wait for a dagster-k8s job to be ready
'''
c... |
the-stack_0_8622 | # -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2022 all rights reserved
#
from .SI import meter
from .SI import kilo, centi, milli, micro, nano
#
# definitions of common length units
# data taken from Appendix F of Halliday, Resnick, Walker, "Fundamentals of Physics",
# fourth edition,... |
the-stack_0_8623 | #!/usr/bin/env python3
# Modules
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import GaussianNB, MultinomialNB
from sklearn.svm import SVC
import time
import torch
import torch.nn as nn
import torch.optim as optim
fr... |
the-stack_0_8625 | # coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... |
the-stack_0_8626 | import tensorflow as tf
_CSV_COLUMNS = [
'age', 'workclass', 'fnlwgt', 'education', 'education_num',
'marital_status', 'occupation', 'relationship', 'race', 'gender',
'capital_gain', 'capital_loss', 'hours_per_week', 'native_country',
'income_bracket'
]
_CSV_COLUMN_DEFAULTS = [[0], [''], [0], [''], [0... |
the-stack_0_8628 | # Copyright (c) 2021, 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 applic... |
the-stack_0_8629 | from tree_common import TreeNode, insert, inOrderTraversal
from typing import List
from ...fundamentals.linked_lists.single_list import Node as LinkedNode
"""
Use Created linked lists from a tree
"""
def tree_to_linked_lists(root:TreeNode) -> List[LinkedNode]:
result = [LinkedNode]
level_to_linked_list(root, re... |
the-stack_0_8630 | # -*- coding: utf-8 -*-
'''
Manage RabbitMQ Plugins
=======================
.. versionadded:: 2014.1.0
Example:
.. code-block:: yaml
some_plugin:
rabbitmq_plugin.enabled: []
'''
# Import Python Libs
from __future__ import absolute_import, unicode_literals, print_function
import logging
# Import Salt Lib... |
the-stack_0_8631 | # -*- coding: utf-8 -*-
# Scrapy settings for weibo_m project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# https://doc.scrapy.org/en/latest/topics/settings.html
# https://doc.scrapy.org/en/latest/topic... |
the-stack_0_8636 | from collections import OrderedDict, deque, namedtuple
import numpy as np
from sklearn.model_selection import train_test_split
from torchlib.dataset.utils import create_data_loader
from torchlib.deep_rl import BaseAgent
class Dataset(object):
def __init__(self):
self._states = []
self._actions =... |
the-stack_0_8637 | #!/usr/bin/env python3
# Copyright (c) 2016 The Magmelldollar Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.mininode import *
from test_framework.test_framework import MagmelldollarTestFramewo... |
the-stack_0_8639 | import numpy as np
from yt.testing import \
fake_random_ds, \
fake_particle_ds, \
assert_equal, \
assert_rel_equal, \
assert_almost_equal
from yt import particle_filter
def setup():
from yt.config import ytcfg
ytcfg["yt","__withintesting"] = "True"
def test_extrema():
for nprocs in [... |
the-stack_0_8640 | from tensorflow.keras import Input
from tensorflow.keras.layers import Dropout, Dense
from tensorflow.keras.optimizers import Adam
from tensorflow.keras import regularizers
from tensorflow.keras.losses import SparseCategoricalCrossentropy
from graphgallery import floatx
from graphgallery.nn.models import TFKeras
cl... |
the-stack_0_8641 | import graphistry, os, pandas as pd, streamlit as st
from time import sleep
from components import GraphistrySt, URLParam
from css import all_css
from util import getChild
############################################
#
# DASHBOARD SETTINGS
#
############################################
# Controls how entrypoint.p... |
the-stack_0_8644 | import gc
import os
from os.path import join as pjoin
import sys
from argparse import ArgumentTypeError
from pprint import pprint
import yaml
from datetime import datetime
import logging
import numpy as np
import numpy.random
import tensorflow as tf
from PIL import Image
import matplotlib as mpl
from matplotlib import... |
the-stack_0_8646 | from unittest import TestCase
from shutil import copyfile
import os
from pysumma.Simulation import Simulation
class TestSimulation(TestCase):
# Create a new fileManager.txt file with the correct file paths for the system it's run on
my_path = os.path.abspath(os.path.dirname(__file__))
filename = 'fileMana... |
the-stack_0_8647 | ALPHABET = "abcdefghijklmnopqrstuvwxyz"
def increment(pwd):
incremented = ""
pos_not_z = len(pwd) - 1
while pwd[pos_not_z] == "z":
incremented = "a" + incremented
pos_not_z -= 1
incremented = pwd[:pos_not_z] + ALPHABET[ALPHABET.index(pwd[pos_not_z]) + 1] + incremented
return increm... |
the-stack_0_8648 | """
(C) Copyright 2021 IBM Corp.
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
dist... |
the-stack_0_8649 | """
This file offers the methods to automatically retrieve the graph Thermoplasmatales archaeon E-plasma.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: pro... |
the-stack_0_8650 | # pyright:reportUnknownMemberType=false
# pyright:reportUnknownArgumentType=false
# pyright:reportUnknownLambdaType=false
import re
from itertools import accumulate
from typing import Any, List
import ja_core_news_sm
from py_pdf_term._common.consts import JAPANESE_REGEX, NOSPACE_REGEX, SYMBOL_REGEX
from ..data impo... |
the-stack_0_8651 | import theano.tensor as T
def cca_loss(outdim_size, use_all_singular_values):
"""
The main loss function (inner_cca_objective) is wrapped in this function due to
the constraints imposed by Keras on objective functions
"""
def inner_cca_objective(y_true, y_pred):
"""
It is the loss ... |
the-stack_0_8652 | _base_ = [
'../_base_/models/mask_rcnn_swin_fpn.py',
'../_base_/datasets/coco_instance.py',
'../_base_/schedules/schedule_1x.py',
'../_base_/default_runtime.py'
]
model = dict(
backbone=dict(
in_chans=3,
embed_dim=96,
depths=[2, 2, 6, 2],
num_heads=[3, 6, 12, 24],
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.