filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_0_10201
"""initial Revision ID: ca4351944ed4 Revises: Create Date: 2018-12-16 17:28:04.537922 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'ca4351944ed4' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated ...
the-stack_0_10202
#!/usr/bin/python # encoding: utf-8 from __future__ import unicode_literals import os import argparse import plistlib import sys import sqlite3 from sqlite3 import Error from workflow import Workflow3, ICON_INFO, ICON_WARNING, ICON_ERROR KM_APP_SUPPORT = os.path.expanduser("~/Library/Application Support/Keyboard Ma...
the-stack_0_10203
import unittest from test import support import gc import weakref import operator import copy import pickle from random import randrange, shuffle import sys import warnings import collections import collections.abc class PassThru(Exception): pass def check_pass_thru(): raise PassThru yield 1 class BadCmp...
the-stack_0_10204
from dash_labs.templates.base import BaseTemplate import dash_html_components as html class HtmlCard(BaseTemplate): """ Simple template that places all components in a few html Div elements with a card-like border. """ _valid_locations = ("bottom", "top") _default_input_location = "bottom" ...
the-stack_0_10208
#!/usr/bin/env python3 import sys import os import argparse def parseArguments(): parser = argparse.ArgumentParser(description='transform file and header') parser.add_argument("--list_file", help="", type=str,required=True) parser.add_argument('--use_rs',type=str,help="if need to be limited at some rs", d...
the-stack_0_10209
# # Copyright 2017 the original author or 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...
the-stack_0_10216
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import ctypes import math import torch from fairseq.scoring import register_scoring try: from fairseq import libbleu except ImportError ...
the-stack_0_10218
from operator import attrgetter import pyangbind.lib.xpathhelper as xpathhelper from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType from pyangbind.lib.base import PybindBase from d...
the-stack_0_10219
"""Binaries""" from __future__ import print_function from collections import defaultdict import sys def print_table(rows, headers=None, space_between_columns=4): """ Convenience method for printing a list of dictionary objects into a table. Automatically sizes the columns to be the maximum size of any en...
the-stack_0_10220
""" This script runs the application using a development server. """ import bottle import os import sys # routes contains the HTTP handlers for our server and must be imported. import routes import src.emotion_bottle if '--debug' in sys.argv[1:] or 'SERVER_DEBUG' in os.environ: # Debug mode will enable more verb...
the-stack_0_10222
""" Module for generating Arc Line lists Should be run where it is located (for now) """ from __future__ import print_function, absolute_import, division, unicode_literals import os import pdb import datetime from pkg_resources import resource_filename from collections import OrderedDict from astropy.table import T...
the-stack_0_10223
#!/usr/bin/env python from tools.load import LoadMatrix import numpy as np lm=LoadMatrix() traindat = np.ushort(lm.load_numbers('../data/fm_train_word.dat')) testdat = np.ushort(lm.load_numbers('../data/fm_test_word.dat')) parameter_list=[[traindat,testdat,1.2],[traindat,testdat,1.2]] def kernel_linear_word (fm_trai...
the-stack_0_10224
# -*- coding: utf-8 -*- #!/usr/bin/env python '''' wlanのipを探るためのプログラム ''' import socket import fcntl import sys def ifconfig(ifname): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: result = fcntl.ioctl(s.fileno(), 0x8915 ,(ifname+'\0'*32)[:32]) except IOError: return None re...
the-stack_0_10225
# # 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 appl...
the-stack_0_10226
import _plotly_utils.basevalidators class SizeValidator(_plotly_utils.basevalidators.NumberValidator): def __init__( self, plotly_name="size", parent_name="scatterternary.marker", **kwargs ): super(SizeValidator, self).__init__( plotly_name=plotly_name, parent_name=pare...
the-stack_0_10227
from flask import cli from flask.cli import FlaskGroup from lps import create_app, db from lps.models import * from lps.seeds import seed_database, export_seed from lps.mail_utils import send_alert_mail app = create_app() cli = FlaskGroup(create_app=create_app) # DATABASE COMMANDS @cli.command("seed_db") def seed_db...
the-stack_0_10228
# -*- coding: utf-8 -*- """column filter""" __all__ = ['Filter', 'FilterType'] import abc import enum import pandas as pd import re from .default import ValueFetcher from .type import basic_column_type from pyqttable import const from typing import List, Optional, Any class FilterType(enum.Enum): """Column fil...
the-stack_0_10229
# Copyright (C) 2020 TeamUltroid # Ported by X_ImFine # Recode by @mrismanaziz # RecodeV2 by @PacarFerdilla import asyncio import os from datetime import datetime from telethon import events from telethon.tl import functions, types from userbot.events import register from userbot import ( # noqa pylint: disable=un...
the-stack_0_10231
from django.test import TestCase from django_ses.views import (emails_parse, stats_to_list, quota_parse, sum_stats) # Mock of what boto's SESConnection.get_send_statistics() returns STATS_DICT = { u'SendDataPoints': [ { u'Bounces': u'1', u'Complaints':...
the-stack_0_10232
# 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 u...
the-stack_0_10235
import cv2 import pickle import os.path import numpy as np from imutils import paths from sklearn.preprocessing import LabelBinarizer from sklearn.model_selection import train_test_split from keras.models import Sequential from keras.layers.convolutional import Conv2D, MaxPooling2D from keras.layers.core import Flatten...
the-stack_0_10237
""" Setup script for libanac """ import sys from setuptools import setup import libanac install_requires = [ 'beautifulsoup4', 'requests', ] if sys.version_info[:2] < (2, 7): install_requires.append('argparse') setup( name=libanac.__title__, description=libanac.__summary__, long_descripti...
the-stack_0_10238
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import annotations from textwrap import dedent from pants.backend.helm.util_rules.chart_metadata import DEFAULT_API_VERSION, ChartType def gen_chart_file( name: str...
the-stack_0_10239
import numpy as np from .triangle_hash import TriangleHash as _TriangleHash def check_mesh_contains(mesh, points, hash_resolution=512): intersector = MeshIntersector(mesh, hash_resolution) contains = intersector.query(points) return contains class MeshIntersector: def __init__(self, mesh, resolutio...
the-stack_0_10240
# coding: utf-8 # # Copyright 2021 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_10241
#File with 2 function to take an screenshot in linux import gi gi.require_version('Gdk', '3.0') from gi.repository import Gdk from Xlib import display, X from PIL import Image #PIL #Try to integrate with PIL to return an PIL Image def screenShot1(): # full screenshot window = Gdk.get_default_root_window()...
the-stack_0_10246
from bs4 import BeautifulSoup import csv from urllib.request import urlopen from os.path import exists, join from os import mkdir from itertools import groupby from operator import itemgetter def read_page(url): return urlopen(url).read() def clean_comment(name_with_parenthesis): return name_with_parenthesi...
the-stack_0_10247
#!/usr/bin/env python import rospy import json from cv_bridge import CvBridge, CvBridgeError from sensor_msgs.msg import Image, CompressedImage import cv2 import numpy as np from wr8_ai.yolo import fps import wr8_ai.detector_ncs as det import time class ImageReceiverROS: def __init__(self): self.bridg...
the-stack_0_10248
# # 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...
the-stack_0_10251
"""setup.py file.""" import uuid from setuptools import setup, find_packages try: # for pip >= 10 from pip._internal.req import parse_requirements except ImportError: # for pip <= 9.0.3 from pip.req import parse_requirements __author__ = 'Hao Tang <thddaniel92@gmail.com>' install_reqs = parse_requirements...
the-stack_0_10253
from copy import copy, deepcopy import numpy as np import pytest from pandas.compat.numpy import _np_version_under1p17 from pandas.core.dtypes.common import is_scalar import pandas as pd from pandas import DataFrame, MultiIndex, Series, date_range import pandas._testing as tm import pandas.core.common as com # ---...
the-stack_0_10255
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('image_collection', '0006_imageslide_data_class'), ] operations = [ migrations.AddField( model_name='imageslide',...
the-stack_0_10257
pkgname = "dejagnu" pkgver = "1.6.3" pkgrel = 0 build_style = "gnu_configure" make_cmd = "gmake" hostmakedepends = ["gmake", "expect-devel"] makedepends = ["expect-devel"] depends = ["expect"] pkgdesc = "Framework for running test suites on GNU tools" maintainer = "q66 <q66@chimera-linux.org>" license = "GPL-3.0-or-lat...
the-stack_0_10258
# coding=utf-8 # Copyright 2020-present the HuggingFace Inc. team. # # 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 ap...
the-stack_0_10259
# coding: utf-8 """ sick, the spectroscopic inference crank """ import os import re import sys try: from setuptools import setup except ImportError: from distutils.core import setup major, minor1, minor2, release, serial = sys.version_info open_kwargs = {"encoding": "utf-8"} if major >= 3 else {} def rf...
the-stack_0_10260
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License # is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file acc...
the-stack_0_10262
from functools import partial from collections.abc import Iterable from collections import defaultdict from PySide2 import QtCore from PySide2.QtWidgets import (QWidget, QPushButton, QHBoxLayout, QVBoxLayout, QGroupBox, QFormLayout, QLabel, QLineEdit, QComb...
the-stack_0_10264
PROJECT_NAME = 'Olympus Programming' DEBUG_PROJECT_NAME = 'Coursework' IP = '185.255.132.221' PORT = '80' WORKING_DIRECTORY = '/root/project' # Only for server LOCAL_WORKING_DIRECTORY = 'G://Projects/Coursework' # On my pc solution_lang = { 'GNU GCC C99': 'c', 'GNU G++ 17': 'cpp', # 'Kotlin': 'kt', ...
the-stack_0_10268
"""config URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based ...
the-stack_0_10272
# -*- coding: utf-8 -*- from __future__ import unicode_literals, print_function from __future__ import absolute_import import pytest # Allow everything in there to access the DB pytestmark = pytest.mark.django_db from django.db import IntegrityError from django.db.models import ProtectedError from django.conf import ...
the-stack_0_10275
# -*- coding: utf-8 -*- # # Developed by Alex Jercan <jercan_alex27@yahoo.com> # # References: # import os import torch def tensors_to_device(tensors, device): return (tensor.to(device, non_blocking=True) for tensor in tensors) def init_weights(m): if type(m) == torch.nn.Conv2d or type(m) == torch.nn.Conv3...
the-stack_0_10276
###################################################### # # # SOCIALFISH v2.0 # # # # by: vaon4ik # # ...
the-stack_0_10277
import os, itertools import numpy as np from ofTools.util.FileTools import save_yaml def save_case_matrix_direct(case_list, dir_matrix): ### assumes all elements of the list are dict for that case that has the same keys! if not os.path.exists(dir_matrix): os.makedirs(dir_matrix) ofh = open(os.p...
the-stack_0_10283
import cv2 import numpy as np def main(): x = cv2.imread("x.jpg") y = cv2.imread("y.jpg") print(x[300,500]) print(y[300,500]) print(x[300,500]+y[300,500]) toplam = cv2.add(x,y) cv2.imshow("toplam",toplam) agirlikli_toplam = cv2.addWeighted(x,0.3,y,0.7,0) cv2....
the-stack_0_10284
"""Test asyncpraw.models.user.""" from asynctest import mock import pytest from asyncpraw.exceptions import RedditAPIException from asyncpraw.models import Multireddit, Redditor, Subreddit from .. import IntegrationTest class TestUser(IntegrationTest): async def test_blocked(self): self.reddit.read_onl...
the-stack_0_10285
import hetu as ht import models import os import numpy as np import argparse import json import logging from time import time logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') logger = logging.getLogger(__name__) def print_rank0(msg): if dev...
the-stack_0_10287
#!/usr/bin/env python # http://pyode.sourceforge.net/tutorials/tutorial2.html # pyODE example 2: Connecting bodies with joints # modified by Gideon Klompje (removed literals and using # 'ode.Mass.setSphereTotal' instead of 'ode.Mass.setSphere') import ode import pygame from pygame.locals import QUIT, KEYDOWN # C...
the-stack_0_10288
""" Inductive Representation Learning on Large Graphs Paper: http://papers.nips.cc/paper/6703-inductive-representation-learning-on-large-graphs.pdf Code: https://github.com/williamleif/graphsage-simple Simple reference implementation of GraphSAGE. """ import argparse import time import abc import numpy as np import tor...
the-stack_0_10289
# Copyright 2018 The TensorFlow Probability 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 o...
the-stack_0_10290
""" scanner scan the COVID-19 government sites data is fetched and cleaned then pushed to a git repo files are only updated if the cleaned version changes """ from argparse import ArgumentParser, Namespace, RawDescriptionHelpFormatter import configparser import sys import os from datetime import datetime, timezone, ...
the-stack_0_10291
import numpy as np from numpy.testing.utils import assert_equal from brian2.synapses.spikequeue import SpikeQueue from brian2.units.stdunits import ms from brian2.memory.dynamicarray import DynamicArray1D def create_all_to_all(N): ''' Return a tuple containing `synapses` and `delays` in the form that is neede...
the-stack_0_10292
# The MIT License (MIT) # # Copyright (c) 2019 Brent Rubell for Adafruit Industries # # 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 rig...
the-stack_0_10293
from random import randint import sys RANDOM_NUMS = [] class Assign: def assign(self, number, some_member, member_list): for item in member_list: if number == item.assignee: continue some_member.assignee = number break def assign_nums(self, member...
the-stack_0_10297
# coding=utf-8 from __future__ import absolute_import, division, print_function, unicode_literals import math import sys import threading import time from contextlib import contextmanager from datetime import timedelta from itertools import chain, islice, repeat from .animations.utils import spinner_player from .conf...
the-stack_0_10299
SPACE = 'space' COMMENT = 'comment' PLUS_ASSIGN = 'plus_assign' PLUS = 'plus' MOD_ASSIGN = 'mod_assign' MOD = 'mod' DIVISION_ASSIGN = 'div_assign' DIVISION = 'div' POW = 'pow' MULT_ASSIGN = 'mult_assign' MULT = 'mult' NOT = 'not' AND = 'and' OR = 'or' XOR = 'xor' GREATER_EQUAL = 'greater_eq' GREATER = 'greater' LESS_...
the-stack_0_10300
""" Copyright (c) 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 law or agreed to in writing,...
the-stack_0_10301
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from unittest.mock import patch import pandas as pd from ax.core.base_trial import BaseTrial, TrialStatus from ax.core...
the-stack_0_10302
# Copyright 2015 PLUMgrid # # 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, softwar...
the-stack_0_10303
# (C) Copyright 2017 IBM Corp. # (C) Copyright 2017 Inova Development 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-...
the-stack_0_10304
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest from soql.attributes import Integer, Relationship, String from soql import Model from soql import select from soql import SelectClauseIsntValidSubquery from soql import asc, desc, nulls_first, nulls_last from tests.helpers import SoqlAssertions class Gran...
the-stack_0_10305
import numpy as np from torch.nn import functional as F from ConSSL.utils import _PIL_AVAILABLE from ConSSL.utils.warnings import warn_missing_pkg if _PIL_AVAILABLE: from PIL import Image else: # pragma: no cover warn_missing_pkg('PIL', pypi_name='Pillow') class RandomTranslateWithReflect: """ Tran...
the-stack_0_10306
# Copyright 2013-2021 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) from spack import * class Rocthrust(CMakePackage): """Thrust is a parallel algorithm library. This library has been...
the-stack_0_10307
import numpy as np import pandas as pd import os def read_data(): # set the path of the raw data raw_data_path = os.path.join(os.path.pardir,'data','raw') train_file_path = os.path.join(raw_data_path, 'train.csv') test_file_path = os.path.join(raw_data_path, 'test.csv') # read the data with all def...
the-stack_0_10308
import functools import operator from collections import namedtuple from json import dumps, loads from galaxy_test.base.populators import skip_without_tool, summarize_instance_history_on_error from .test_workflows import BaseWorkflowsApiTestCase class WorkflowExtractionApiTestCase(BaseWorkflowsApiTestCase): hist...
the-stack_0_10309
# coding: utf-8 # # Chart presentation (8) - Changing hovertext (1) # In the last lessons we learnt how to use Pandas' <code>df.apply()</code> in conjunction with a user-defined or a <code>lambda</code> function to create a column in our DataFrame to store the value for the hovertext. # # In this lesson we'll apply...
the-stack_0_10310
#!/usr/bin/python3 import json import falcon from lib.const import Version, Message from lib.utility import SystemUtility, DocumentUtility, CustomJSONEncoder from lib.resource import BaseJsonApiResource from lib.database import Session, Server class ServerInfoApiResource(BaseJsonApiResource): def on_get(self, r...
the-stack_0_10313
# Copyright The Cloud Custodian Authors. # SPDX-License-Identifier: Apache-2.0 import itertools import operator import zlib import jmespath import re from c7n.actions import BaseAction, ModifyVpcSecurityGroupsAction from c7n.exceptions import PolicyValidationError, ClientError from c7n.filters import ( DefaultVpcB...
the-stack_0_10318
#!/usr/bin/env python3 # Copyright (c) 2010 ArtForz -- public domain half-a-node # Copyright (c) 2012 Jeff Garzik # Copyright (c) 2010-2016 The Bitcoin Core developers # Copyright (c) 2019 Bitcoin Association # Distributed under the Open BSV software license, see the accompanying file LICENSE. """Bitcoin P2P network h...
the-stack_0_10320
import os import shutil import click import jinja2 import pdfkit import yaml __author__ = "Kevin Ciarniello" __copyright__ = "Copyright 2017, Kevin Ciarniello" __license__ = "GPL" __version__ = "1.0.0" __maintainer__ = "Kevin Ciarniello" __email__ = "kciarnie@gmail.com" # Template defaults defaults = { 'labels':...
the-stack_0_10322
# # Copyright 2021 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # from decimal import Decimal from typing import Union import pytest from enforce_typing import enforce_types from ocean_lib.config import Config from ocean_lib.models.bfactory import BFactory from ocean_lib.models.bpool import BPool fr...
the-stack_0_10323
#!/usr/bin/env python3 import subprocess import argparse from pathlib import Path import re from statistics import stdev, mean, median_high from math import floor, ceil time_parser = re.compile(r'Solution found in (\d+.\d+) ms') num_runs = 10 parser = argparse.ArgumentParser() parser.add_argument('-b', '--binary', ...
the-stack_0_10324
""" .. _ex-report: ================================ Make an MNE-Report with a Slider ================================ In this example, MEG evoked data are plotted in an html slider. """ # Authors: Teon Brooks <teon.brooks@gmail.com> # Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) from m...
the-stack_0_10326
# -*- coding: utf-8 -*- # © 2017-2019, ETH Zurich, Institut für Theoretische Physik # Author: Dominik Gresch <greschd@gmx.ch> """ Defines functions for plotting the results of the identify step. """ from functools import singledispatch import numpy as np import scipy.linalg as la from fsc.export import export from ...
the-stack_0_10328
import numpy as np import pytest from pandas.core.dtypes.common import is_integer import pandas as pd from pandas import Index, Series from pandas.core.indexes.datetimes import Timestamp import pandas.util.testing as tm class TestSeriesQuantile: def test_quantile(self, datetime_series): q = datetime_se...
the-stack_0_10333
## # See the file COPYRIGHT for copyright information. # # 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...
the-stack_0_10334
# -*- coding: utf-8 -*- import os import sys import threading from copy import deepcopy from tempfile import mkstemp import six from six import BytesIO from .import_bind import PostImportHookPatching from ..config import running_remotely from ..debugging.log import LoggerRoot from ..utilities.resource_monitor import...
the-stack_0_10339
# -*- coding:utf-8 -*- # There are two sorted arrays nums1 and nums2 of size m and n respectively. # # Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)). # # Example 1: # # nums1 = [1, 3] # nums2 = [2] # # The median is 2.0 # # # # Example 2: # # nums1 = [1, 2] # nums2 =...
the-stack_0_10340
#! /usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import annotations from itertools import product from unittest import mock import torch from botorch...
the-stack_0_10341
"""Exceptions raised by the dvc.""" from funcy import first from dvc.utils import error_link, format_link, relpath class DvcException(Exception): """Base class for all dvc exceptions.""" def __init__(self, msg, *args): assert msg super().__init__(msg, *args) class InvalidArgumentError(Valu...
the-stack_0_10342
import sys sys.path.append('..') from inner import class_inner class EarthPoint : latitude : float longitude : float def __init__(self,latitude, longitude): self.latitude = latitude self.longitude = longitude def __str__(self): fmt = self.formatter() return...
the-stack_0_10343
import collections import signal from django.template import Template, Context from . import flamegraph try: from debug_toolbar.panels import Panel except ImportError as e: import os if os.environ.get('TESTING'): import mock Panel = mock.Mock() else: raise e template = r""" <...
the-stack_0_10346
""" # This script, search threshold for SparNet model by computing accuracy # It also compute flops for SparNet model # # See Table 3 on the main paper # Example usage: CUDA_VISIBLE_DEVICES=1 python3 -m evaluation.seach_sparnet_th --settings_file config/settings_ncaltech.yaml CUDA_VISIBLE_DEVICES=1 python3 -m evalua...
the-stack_0_10347
import code import os import sys import wx from app.app_utils import Chronometer from app.app_utils import GripyBitmap from classes.ui import UIManager from classes.ui import WorkPageController from classes.ui import WorkPage # TODO: rever isso... replicado em WellPlot WP_FLOAT_PANEL = wx.NewId() class ConsoleCont...
the-stack_0_10348
import copy import itertools import os import tempfile import unittest import numpy as np import pytest import torch from torch import nn import pfrl from pfrl.agents import ppo from pfrl.agents.ppo import PPO from pfrl.envs.abc import ABC from pfrl.experiments import ( train_agent_batch_with_evaluation, trai...
the-stack_0_10350
# Copyright 2013-2022 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 collections import functools as ft import itertools import os import re import shutil import sys from llnl.util im...
the-stack_0_10351
# -*- 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 o...
the-stack_0_10352
from Effects.Effect import Effect from PIL import ImageDraw class Negative(Effect): def Iteration(self): for i in range(self.width): for j in range(self.height): a = self.pix[i, j][0] b = self.pix[i, j][1] c = self.pix[i, j][2] se...
the-stack_0_10353
"""Provide the MessageableMixin class.""" from ....const import API_PATH class MessageableMixin: """Interface for classes that can be messaged.""" def message(self, subject, message, from_subreddit=None): """ Send a message to a redditor or a subreddit's moderators (mod mail). :param...
the-stack_0_10357
import c4d from RedshiftWrapper.Redshift import Redshift def main(): rs = Redshift() if rs is False: return #Assign Material rs.SetMat(doc.GetFirstMaterial()) #Get all node and assign color listNode = rs.GetAllNodes() for node in listNode: node.SetColor() c4d.EventAdd() if __...
the-stack_0_10358
""" Module for managing operation and controller modes. Operation modes can be 'auto', 'comfort', 'standby', 'economy', 'protection' and use either a binary DPT or DPT 20.102. Controller modes use DPT 20.105. """ from itertools import chain from typing import TYPE_CHECKING, Any, Iterator, List, Optional, Union from x...
the-stack_0_10362
"""API to persist and read upload data metrics""" import os import sqlite3 DATABASE_FILENAME = os.path.expanduser('~/pypic.db') def create_upload_table(): """Create the necessary database objects for upload monitoring and persistent data regarding all things video uploads """ db_connection = sqlite...
the-stack_0_10363
from gcn.inits import * import tensorflow as tf flags = tf.app.flags FLAGS = flags.FLAGS # global unique layer ID dictionary for layer name assignment _LAYER_UIDS = {} def get_layer_uid(layer_name=''): """Helper function, assigns unique layer IDs.""" if layer_name not in _LAYER_UIDS: _LAYER_UIDS[lay...
the-stack_0_10364
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- import os import sys sys.path.extend([os.path.dirname(os.path.abspath(__file__))]) import cv2 import time import numpy as np import tensorflow as tf import utils from OneEuroFilter import OneEuroFilter class VNectEstimator: # the side length of the CNN input box ...
the-stack_0_10366
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 24 17:19:18 2022 @author: justoliver """ import pymunk, sys from pymunk.pygame_util import * from pymunk.vec2d import Vec2d import pygame from pygame.locals import * import numpy as np from PIL import Image from pymunk.pygame_util import DrawOpti...
the-stack_0_10369
# Copyright (C) 2019 The Raphielscape Company LLC. # # Licensed under the Raphielscape Public License, Version 1.c (the "License"); # you may not use this file except in compliance with the License. # # You can find misc modules, which dont fit in anything xD """ Userbot module for other small commands. """ from rando...
the-stack_0_10370
# coding: utf-8 # Copyright 2015 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 requir...
the-stack_0_10372
#!/usr/bin/env python """ Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/) See the file 'doc/COPYING' for copying permission """ from lib.core.agent import agent from lib.core.common import arrayizeValue from lib.core.common import Backend from lib.core.common import filterPairValues from lib.core.commo...
the-stack_0_10375
import logging logging.basicConfig(level=logging.DEBUG) from aiomailserver.core.controller import MailServerController import asyncio def exception_handler(*args, **kwargs): logging.exception(args) if __name__ == '__main__': loop = asyncio.get_event_loop() loop.set_debug(True) loop.set_exception_han...
the-stack_0_10377
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import unittest from functools import partial from pathlib import Path from typing import Optional from pants.base.build_root import BuildRoot from pants.fs.archive import TGZ from pants....
the-stack_0_10378
# Copyright 2013-2015 ARM 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 w...