filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_26395 | from __future__ import print_function
# 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, Versio... |
the-stack_106_26397 |
'''A wrapper for fixed column text files
This module copies a fixed column TXT file into a dictionary to manipulate,
and enrich. It can also be exported into a TXT file with a different
structure than the original file.
'''
import logging
from pathlib import Path
import sys
import tempfile
import beetools
import di... |
the-stack_106_26399 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# 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... |
the-stack_106_26401 | # -*- coding: utf-8 -*-
import json
import typing
from apispec import APISpec
import pytest
import serpyco
from serpyco import nested_field
from serpyco import string_field
from apispec_serpyco import SerpycoPlugin
from apispec_serpyco.utils import schema_name_resolver
import dataclasses
from dataclasses import datac... |
the-stack_106_26404 | from django.db import migrations
def create_site(apps, schema_editor):
Site = apps.get_model("sites", "Site")
custom_domain = "test-1.botics.co"
site_params = {
"name": "test",
}
if custom_domain:
site_params["domain"] = custom_domain
Site.objects.update_or_create(defaults=si... |
the-stack_106_26405 | from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, Text, \
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
class Monokai_darkStyle(Style):
"""
This style mimics the Monokai color scheme.
"""
background_color = "#000000"
highli... |
the-stack_106_26406 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import List, Union, Any
import warnings
import numpy as np
import scipy.stats
from ..common.typetools import ... |
the-stack_106_26407 | import matplotlib.pyplot as plt
import numpy as np
def plot_period(X, y=None,
channel_names=None,
init_second=None,
sample_rate=None,
out_path=None,
return_fig=False):
"""
Plots one period (typically 30 seconds) of PSG data with i... |
the-stack_106_26409 |
# COPYRIGHT 2007 BY BBN TECHNOLOGIES CORP.
# BY USING THIS SOFTWARE THE USER EXPRESSLY AGREES: (1) TO BE BOUND BY
# THE TERMS OF THIS AGREEMENT; (2) THAT YOU ARE AUTHORIZED TO AGREE TO
# THESE TERMS ON BEHALF OF YOURSELF AND YOUR ORGANIZATION; (3) IF YOU OR
# YOUR ORGANIZATION DO NOT AGREE WITH THE TERMS OF THIS AGR... |
the-stack_106_26412 | """
Break fastq sequences into smaller chunks. Eg. from nanopore reads we want smaller pieces
"""
import os
import sys
import argparse
from roblib import stream_fastq
__author__ = 'Rob Edwards'
def rewrite_fastq(inf, outf, sz, verbose):
"""
Rewrite a fastq file
:param inf: input fastq file
:param out... |
the-stack_106_26415 | # ------------------------------------------------------------
# Copyright 2021 The Dapr 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... |
the-stack_106_26416 | from organisations.boundaries.management.base import BaseOsniCommand
from organisations.boundaries.osni import OsniLayer
from organisations.models import OrganisationDivision
class Command(BaseOsniCommand):
def handle(self, *args, **options):
url = "http://osni-spatial-ni.opendata.arcgis.com/datasets/563d... |
the-stack_106_26417 | from django.http import Http404
from django.test import RequestFactory, TestCase
from django.urls import reverse
from agreements.models import Agreement, Issuer
from agreements.views import issuer_search
class TestIssuerSearch(TestCase):
def setUp(self):
self.request = RequestFactory().get("/")
def ... |
the-stack_106_26419 | t_search = pd.DataFrame(index = tag_list,
columns = ['search_num'])
# 페이스북 로그인 페이지로
driver = webdriver.Chrome('./chromedriver')
url = 'https://www.facebook.com/'
driver.get(url)
time.sleep(2)
# 로그인 완료
driver.find_element_by_xpath('//*[@id="email"]').send_keys(fb_id)
time.sleep(2)
d... |
the-stack_106_26420 | import random
import warnings
import time
import numpy as np
import compressors
from sklearn.preprocessing import MinMaxScaler
class Client:
def __init__(self, client_id, group=None, train_data={'x' : [],'y' : []}, eval_data={'x' : [],'y' : []}, model=None):
self._model = model
self.id = clie... |
the-stack_106_26423 | import os, datetime, zipfile
from datetime import date
from os import path
def export(config):
MODULE_PATH = os.path.join(os.path.dirname(__file__))
print("\n========================");
print("EXPORTING PROJECT INTO ARCHIVE")
print("\n")
project_folder = config["project"]["path"]
if (not (os.path.isdir(projec... |
the-stack_106_26424 | from __future__ import unicode_literals
import mock
import pytest
from hermes_python.hermes import Hermes
from hermes_python.ontology import MqttOptions
from hermes_python.ontology.dialogue import StartSessionMessage, SessionInitNotification, ContinueSessionMessage
from hermes_python.ontology.injection import Injectio... |
the-stack_106_26425 | # -*- coding:utf-8 -*-
# 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
# "... |
the-stack_106_26426 | from tapiriik.settings import WEB_ROOT, SPORTTRACKS_OPENFIT_ENDPOINT, SPORTTRACKS_CLIENT_ID, SPORTTRACKS_CLIENT_SECRET
from tapiriik.services.service_base import ServiceAuthenticationType, ServiceBase
from tapiriik.services.interchange import UploadedActivity, ActivityType, ActivityStatistic, ActivityStatisticUnit, W... |
the-stack_106_26428 | import sys
import gzip
import json
import pytest
import numpy as np
import yaml
from aizynthfinder.context.config import Configuration
from aizynthfinder.context.policy import ExpansionPolicy, FilterPolicy
from aizynthfinder.context.stock import Stock
from aizynthfinder.mcts.node import Node
from aizynthfinder.chem i... |
the-stack_106_26431 | """
Action class for Jaseci
Each action has an id, name, timestamp and it's set of edges.
"""
from .item import item
from jaseci.actions.live_actions import live_actions
# ACTION_PACKAGE = 'jaseci.actions.'
class action(item):
"""
Action class for Jaseci
preset_in_out holds a set of parameters in the fo... |
the-stack_106_26433 | #!/usr/bin/env python3
# Copyright (c) 2017-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test multiwallet.
Verify that a defid node can load multiple wallet files
"""
import os
import shutil
... |
the-stack_106_26434 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
the-stack_106_26435 | import asyncio
import logging
import pathlib
import signal
import socket
import time
from typing import Dict, List
import pkg_resources
from fibo.util.chia_logging import initialize_logging
from fibo.util.config import load_config
from fibo.util.default_root import DEFAULT_ROOT_PATH
from fibo.util.setproctitle import... |
the-stack_106_26437 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy documentation build configuration file.
#
# 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 file.
#
# All configurati... |
the-stack_106_26439 | import socket
from Node import Node
#ustawienenia naszego gniazda, port oraz nagłówek domyslny
HEADER = 64
PORT = 5050
FORMAT = 'utf-8' #formatowanie tekstu
DISCONNECT_MESSAGE = "!DISCONNECT" #formatowanie tekstu
SERVER = "10.9.25.109" # ip klienta
ADDR = (SERVER, PORT)
client = socket.socket(socket.AF_INET, socket.SO... |
the-stack_106_26440 | #
# Copyright 2021 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 agreed to in writing, ... |
the-stack_106_26441 | import logging
from config_utils import *
from sqlalchemy import *
from postgres_query import sql_query_action
logger = logging.getLogger()
class Camera_Query(object):
def __init__(self, postgres_db_conn):
self.conn = postgres_db_conn
def add_camera(self, camera_id, location, coordinate, address, ... |
the-stack_106_26442 | import pytest
from django.urls import reverse
from ..views import get_filtered_user_queryset
pytestmark = pytest.mark.django_db(transaction=True)
@pytest.mark.parametrize(
"filter_type, filter_mode, expected_result",
[
([], "any", 5), # Find everyone
(
["notification_digest", "f... |
the-stack_106_26443 | """
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import salt.states.layman as layman
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase
class LaymanTestCase(TestCase, LoaderModuleMockMixin):
"""
Test cas... |
the-stack_106_26445 | """
---------------------------------------------------------------------
-- Author: Jhosimar George Arias Figueroa
---------------------------------------------------------------------
Custom Layers
"""
import torch
from torch import nn
from torch.nn import functional as F
# Flatten layer
class Flatten(nn.Module):
... |
the-stack_106_26447 | #!/usr/bin/env python
# coding=utf-8
"""
test_neoepiscope.py
Tests functions in neoepiscope.py.
The MIT License (MIT)
Copyright (c) 2018 Mary A. Wood, Austin Nguyen,
Abhinav Nellore, and Reid Thompson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and... |
the-stack_106_26448 | import mmdet2trt.ops.util_ops as mm2trt_util
import torch
from mmdet2trt.core.post_processing.batched_nms import BatchedNMS
from mmdet2trt.models.builder import build_wraper, register_wraper
from torch import nn
@register_wraper('mmdet.models.GARetinaHead')
class GuidedAnchorHeadWraper(nn.Module):
def __init__(s... |
the-stack_106_26450 | from krogon.k8s.k8s_env_vars import add_environment_secret
from krogon.nullable import nlist, nmap
from typing import List
import krogon.maybe as M
def cron_job(name: str, image: str):
return K8sJobTemplate(name, image)
class K8sJobTemplate:
def __init__(self, name: str, image: str):
super().__init_... |
the-stack_106_26451 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import json
import logging
import shlex
import subprocess
from collections import defaultdict
from typing import Dict, List, Optional
import detectron2.utils.comm as comm
from detectron2.data import MetadataCatal... |
the-stack_106_26452 | from six import string_types
import numpy as np
from landlab.components.erosion_deposition.generalized_erosion_deposition import (_GeneralizedErosionDeposition,
DEFAULT_MINIMUM_TIME_STEP)
from landlab.utils.return_array import return_array_at_node
from .cfunc... |
the-stack_106_26453 | """
clint.textui.progress
~~~~~~~~~~~~~~~~~
This module provides the progressbar functionality.
"""
import os
import sys
import time
import crayons
from pipenv.environments import PIPENV_COLORBLIND, PIPENV_HIDE_EMOJIS
STREAM = sys.stderr
MILL_TEMPLATE = "%s %s %i/%i\r"
DOTS_CHAR = "."
if PIPENV_HIDE_EMOJIS:
... |
the-stack_106_26454 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Evangelos A. Dimopoulos, Evan K. Irving-Pease"
__copyright__ = "Copyright 2020, University of Oxford"
__email__ = "antonisdim41@gmail.com"
__license__ = "MIT"
import argparse
import hashlib
import os
import re
import sys
import pandas as pd
import yaml
REG... |
the-stack_106_26456 | # -*- coding: utf-8 -*-
#
# 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 "L... |
the-stack_106_26460 | import unittest
import numpy as np
from cpprb import LaBERmean, LaBERlazy, LaBERmax
class TestLaBER:
def test_init(self):
laber = self.cls(12)
self.assertEqual(laber.batch_size, 12)
np.testing.assert_array_equal(laber.idx, [i for i in range(12*4)])
self.assertEqual(laber.eps, 1e-6... |
the-stack_106_26461 | """
MIT License
Copyright (c) 2021 GamingGeek
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, dis... |
the-stack_106_26462 | """
Copyright 2013 Rackspace
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_106_26463 | """Test module for tools pkg i.e. MagicTools"""
from IPython import get_ipython
import jarvis
import tools
ip = get_ipython()
my_magic = jarvis.MagicTools(ip)
def test_retrieve_pkg_version(capsys):
"""Notebook equivalent:
%retrieve_pkg_version
"""
my_magic.retrieve_pkg_version('')
captured = cap... |
the-stack_106_26464 | #!/usr/bin/env python3
# Copyright (c) 2021, Justin D Holcomb (justin@justinholcomb.me) All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above co... |
the-stack_106_26465 | #!/usr/bin/python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the follo... |
the-stack_106_26467 | """PythonDjango URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.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-... |
the-stack_106_26468 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import re
import odoo.tests
RE_ONLY = re.compile('QUnit\.only\(')
@odoo.tests.tagged('post_install', '-at_install')
class WebSuite(odoo.tests.HttpCase):
def test_01_js(self):
# webclient desktop test suit... |
the-stack_106_26469 | from collections import OrderedDict
from collections.abc import Mapping, Iterator
from contextlib import contextmanager
from functools import partial
from hashlib import md5
from numbers import Number
from operator import getitem
import inspect
import pickle
import os
import threading
import uuid
from tlz import merge... |
the-stack_106_26471 | from sklearn.preprocessing import MinMaxScaler
import settings
import pandas as pd
import numpy as np
from sklearn.metrics import average_precision_score, recall_score
from xgboost.sklearn import XGBClassifier
from sklearn.metrics import accuracy_score
from sklearn.utils import shuffle
def run_xgboost_ml(df_trai... |
the-stack_106_26473 | from lazydata.cli.commands.BaseCommand import BaseCommand
from lazydata.storage.cloudsetup import setup_aws_credentials
from lazydata.storage.localsetup import setup_local_folder
class ConfigCommand(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('backend', type=str, help='The backend t... |
the-stack_106_26476 | import os
import string
import random
import base64
import binascii
import json
from datetime import date, datetime
def file_write(data, path, filename):
os.makedirs(path, exist_ok=True)
if data:
with open('{}/{}.json'.format(path, filename), 'w+') as outfile:
outfile.write(data)
o... |
the-stack_106_26477 | # Author: Mark Wronkiewicz <wronk@uw.edu>
#
# License: BSD (3-clause)
import os.path as op
import warnings
import numpy as np
import sys
import scipy
from numpy.testing import assert_equal, assert_allclose
from nose.tools import assert_true, assert_raises
from nose.plugins.skip import SkipTest
from distutils.version i... |
the-stack_106_26478 | import math
import os
import json
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import transforms
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from tqdm import tqdm
import torch.optim.lr_scheduler as lr_scheduler
from dataset.dataset im... |
the-stack_106_26481 | import math
import numpy as np
import pandas as pd
import statistics
import time
import concurrent
import copy
import random
from concurrent.futures import ProcessPoolExecutor
from sklearn.metrics import mean_absolute_error, mean_squared_error
from sklearn.model_selection import train_test_split
from formulabot.mep imp... |
the-stack_106_26482 | # encoding: utf-8
from __future__ import annotations
import functools
import inspect
import importlib
from collections import defaultdict, OrderedDict
from logging import getLogger
from typing import Any, Callable, Collection, KeysView, Optional, Union
from types import ModuleType
from ckan.common import config
imp... |
the-stack_106_26483 | """
Platform for the garadget cover component.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/garadget/
"""
import logging
import voluptuous as vol
import requests
from homeassistant.components.cover import CoverDevice, PLATFORM_SCHEMA
from homeassistant... |
the-stack_106_26484 | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test wallet group functionality."""
from test_framework.test_framework import MinicoinTestFramework
from te... |
the-stack_106_26485 | import os
import re
import pandas as pd
from extractor import extract
from voluptuous import (Schema, Required, All, Optional, Length, Any,
MultipleInvalid, Match, Coerce)
# Lookups
iso_country = pd.read_csv('./Lookups/ISO_COUNTRY.csv', dtype='str',
encoding='latin', k... |
the-stack_106_26486 | import logging
def setup_logging(debug=False):
root_logger = logging.getLogger()
debug_fomatter = logging.Formatter(
fmt="%(asctime)s.%(msecs)03d %(levelname).4s [%(name)s] %(message)s",
datefmt="%H:%M:%S",
)
logger_handle = logging.StreamHandler()
logger_handle.setFormatter(debug... |
the-stack_106_26487 | import numpy as np
try:
from scipy.sparse.linalg import spsolve
from scipy.sparse import coo_matrix, eye
except ImportError:
pass
from . import triangles
from .util import unitize
from .geometry import index_sparse
from .triangles import mass_properties
def filter_laplacian(mesh,
la... |
the-stack_106_26490 | #!/usr/bin/env python3
"""The setup script."""
from setuptools import find_packages, setup
with open('requirements.txt') as f:
requirements = f.read().strip().split('\n')
with open('README.md') as f:
long_description = f.read()
setup(
maintainer='Xdev',
maintainer_email='xdev@ucar.edu',
python_r... |
the-stack_106_26491 | import json
import re
import sys
from collections import defaultdict
from datetime import date, datetime
from functools import wraps
import click
from .cve_api import CveApi, CveApiError
from . import __version__
CVE_RE = re.compile(r"^CVE-[12]\d{3}-\d{4,}$")
CONTEXT_SETTINGS = {
"help_option_names": ["-h", "--h... |
the-stack_106_26492 | from pandac.PandaModules import *
from toontown.toonbase.ToontownGlobals import *
from direct.gui.DirectGui import *
from pandac.PandaModules import *
from direct.showbase import DirectObject
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import StateData
from toontown.toonbase import ToontownGlobal... |
the-stack_106_26493 | #!/usr/bin/env python3
# Copyright (c) 2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''Test generateblock rpc.
'''
from test_framework.test_framework import BitcoinTestFramework
from test_framew... |
the-stack_106_26495 | # Author: Acer Zhang
# Datetime: 2021/10/27
# Copyright belongs to the author.
# Please indicate the source for reprinting.
from setuptools import setup
from setuptools import find_packages
__version__ = "0.1"
setup(
name='AgentEnc',
version=__version__,
packages=['agentenc', 'agentenc.ops', 'agentenc.e... |
the-stack_106_26496 | import logging
from modules.location import Location, gen_plr
import const
class_name = "Outside"
class Outside(Location):
prefix = "o"
def __init__(self, server):
super().__init__(server)
self.commands.update({"r": self.room, "gr": self.get_room})
def get_room(self, msg, client):
... |
the-stack_106_26498 | #!/usr/bin/env python
# coding: utf-8
from transformers import (
AutoModelForSequenceClassification,
AutoTokenizer,
Trainer,
TrainingArguments,
TrainerCallback,
EarlyStoppingCallback
)
from sklearn.metrics import accuracy_score, precision_recall_fscore_support
from transformers.trainer_ca... |
the-stack_106_26499 | """
weasyprint.formatting_structure.build
-------------------------------------
Turn an element tree with associated CSS style (computed values)
into a "before layout" formatting structure / box tree.
This includes creating anonymous boxes and processing whitespace
as necessary.
"""
import c... |
the-stack_106_26500 | from pudzu.charts import *
from pudzu.sandbox.bamboo import *
from PIL import ImageEnhance
df = pd.read_csv("datasets/eumothers.csv").set_index("country")
FONT = sans
PALETTE = {
"IWD": VegaPalette10.RED,
"SE": VegaPalette10.GREEN,
"FSL": VegaPalette10.ORANGE,
"FSM": VegaPalette10.LIGHTBLUE,
"SSM"... |
the-stack_106_26502 |
# import the definition of the steps and input files:
from Configuration.PyReleaseValidation.relval_steps import *
# here only define the workflows as a combination of the steps defined above:
workflows = Matrix()
# each workflow defines a name and a list of steps to be done.
# if no explicit name/label given for ... |
the-stack_106_26503 | '''
uses code from
https://pypi.org/project/combalg-py/
https://pythonhosted.org/combalg-py/
License: MIT License (MIT)
Author: Sam Stump
'''
def all(n, k):
'''
A generator that returns all of the compositions of n into k parts.
:param n: integer to compose
:type n: int
:param k: number of parts... |
the-stack_106_26504 | from moduleUsefulFunctions_20180215 import *
import scikits.bootstrap as boot
plt.close()
def updateDictData(dictionaryToUpdate,sequence,counts):
if sequence in dictionaryToUpdate:
dictionaryToUpdate[sequence]+=counts
else:
dictionaryToUpdate[sequence]=counts
def listToDictConverter(listOfDim... |
the-stack_106_26507 | from Abstract.Expression import Expression
from Environment.Environment import Environment
from Environment.Value import Value
from Enum.typeExpression import typeExpression
class Multiply(Expression):
def __init__(self, left: Expression, right: Expression) -> None:
super().__init__()
self.leftExp... |
the-stack_106_26509 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#Royal Cuevas
#2285562
#cueva114@mail.chapman.edu
#PHYS220 Fall 2018
#CW 09
import numpy as np
import matplotlib.pyplot as plt
def gradient(x, o=1):
"""Requires a 1-dimensional matrix.
Will compute the derivative of the
corresponding function.
For large... |
the-stack_106_26512 | # Copyright 2016 Twitter. 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 applicable law or agree... |
the-stack_106_26513 | #!/usr/bin/env python3
import ufarc
class Iterate(ufarc.Ahsm):
def __init__(self,):
super().__init__(Iterate.initial)
ufarc.SIGNAL.register("ITERATE")
def initial(me, event):
print("initial")
me.iter_evt = (ufarc.SIGNAL.ITERATE, None)
return me.tran(me, Iterate.iter... |
the-stack_106_26516 | """Plot functions for the profiling report."""
import copy
from typing import Any, Callable, Optional, Union
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from matplotlib.colors import Colormap, LinearSegmentedColormap, ListedColormap
from matplotlib.patches import P... |
the-stack_106_26518 | import random
import numpy as np
import config
s1, a1 = config.patch_size_subtracter, config.patch_size_adder
def is_in_bounds(im, idx):
i, j, k = idx
return \
i - s1 >= 0 and i + a1 < im.shape[0] and \
j - s1 >= 0 and j + a1 < im.shape[1] and \
k - s1 >= 0 and k + a1 < im.shape[2]
de... |
the-stack_106_26520 | # -*- Python -*-
import os
import platform
import re
import subprocess
import tempfile
import lit.formats
import lit.util
from lit.llvm import llvm_config
from lit.llvm.subst import ToolSubst
from lit.llvm.subst import FindTool
# Configuration file for the 'lit' test runner.
# name: The name of this test suite.
co... |
the-stack_106_26524 | """
Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
import boto3
from botocore.paginate import (PageIterator, Paginator)
from botocore.client import BaseClient
fro... |
the-stack_106_26525 | #-*- coding: utf-8 -*-
import os
import torch
import argparse
import numpy as np
from tqdm import tqdm
from transformers import BertTokenizer
from dataset import DualSample, TokenizedSample, OriginalDataset
def tokenize_data(data, mode='train'):
max_forward_asp_query_length = 0
max_forward_opi_query_length ... |
the-stack_106_26526 | # -*- coding: utf-8 -*-
# --------------------------
# Copyright © 2014 - Qentinel Group.
#
# 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/LIC... |
the-stack_106_26530 |
from time import time
import tumor2d
from fitmulticell.sumstat import SummaryStatistics as ss
import matplotlib.pyplot as plt
from string import capwords
import os
import pyabc
from fitmulticell.model import MorpheusModel
import numpy as np
import scipy
def eucl_dist(sim, obs):
total = 0
for key in sim:
... |
the-stack_106_26531 | import discord
from discord.ext import commands
import io
import textwrap
import os
import traceback
from contextlib import redirect_stdout
from Admin.admin import Files
intents = discord.Intents().default()
intents.members = True
bot = commands.Bot(command_prefix=Files.config("main","prefix"), intents=intents, case_in... |
the-stack_106_26532 | #
# 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 us... |
the-stack_106_26533 | from keras.models import Model
from keras.layers import Conv2D, MaxPooling2D, GlobalMaxPooling2D, Input
from keras.utils.data_utils import get_file
import keras.backend as K
import h5py
import numpy as np
import tensorflow as tf
WEIGHTS_PATH_NO_TOP = 'https://github.com/fchollet/deep-learning-models/releases/download/... |
the-stack_106_26535 | import numpy as np
class RLSFilterAnalyticIntercept():
"""
Class representing the state of a recursive least squares estimator with
intercept estimation.
"""
def __init__(self, input_dim, output_dim, alpha=1.0, forgetting_factor=1.0):
self.input_dim = input_dim
self.output_dim = o... |
the-stack_106_26536 | #!/usr/bin/env python3
# Copyright (c) 2020 The DIVI developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Tests the workflow for setting up a masternode vault (with prepared
# unvault tx and destroyed private key), run... |
the-stack_106_26537 | """Function to compare global distributions of turnover time."""
import os.path
import iris
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import scipy.stats as stats
from esmvaltool.diag_scripts.shared import (
ProvenanceLogger,
get_diagnostic_filename,... |
the-stack_106_26540 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json, pprint
import requests
class Authenticator( object ):
""" Enables easy calls to the BorrowDirect authN/Z webservices.
BorrowDirect 'Authentication Web Service' docs: <http://borrowdirect.pbworks.com/w/page/90132761/Authenticati... |
the-stack_106_26541 | # Copyright 2018-2021 Streamlit 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 agreed to in wr... |
the-stack_106_26542 | import ccsyspath
LOG_PATH = "/var/log/codeplag.log"
SUPPORTED_EXTENSIONS = {
'py': [
r'.py\b'
],
'cpp': [
r'.cpp\b',
r'.c\b',
r'.h\b'
]
}
COMPILE_ARGS = '-x c++ --std=c++11'.split()
SYSPATH = ccsyspath.system_include_paths('clang++')
INCARGS = [b'-I' + inc for inc in SY... |
the-stack_106_26545 | from collections import OrderedDict
from typing import Tuple, Union
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
class Bottleneck(nn.Module):
expansion = 4
def __init__(self, inplanes, planes, stride=1):
super().__init__()
# all conv layers have strid... |
the-stack_106_26546 | import os, pickle, subprocess
from threading import Thread
import numpy as np
from datasets.open_bhb import OpenBHB
from sklearn.model_selection import GridSearchCV
from sklearn.base import is_classifier, is_regressor, clone
class OpenBHBMLTrainer(Thread):
"""
A convenient worker specially adapted to perform M... |
the-stack_106_26548 | import numpy as np
from multiagent.core import World, Agent, Landmark, Radius
from multiagent.scenario import BaseScenario
class Scenario(BaseScenario):
def make_world(self, args=None):
world = World()
# set any world properties first
world.dim_c = 2
num_good_agents = 1
num... |
the-stack_106_26549 | #!/usr/bin/env python2.6
"""
Tue Dec 4 11:54:18 PST 2012
Parse Blast XML output file and cluster sequences using greedy approach.
Input: Blast xml file
Output: Text file, each line = 1 cluster, each element of a cluster is space-separated
Algorithm summary:
Sorted sequences by descending in size
Start with the large... |
the-stack_106_26550 | # QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Licen... |
the-stack_106_26551 | # This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this open-source project.
""" Define the Logger class to print log"""
import os
import sys
import logging
from datetime import datetime
class Logger:
def __init__(self, args, output_dir):
... |
the-stack_106_26553 | # Copyright 2019 Stanislav Pidhorskyi
#
# 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 ... |
the-stack_106_26554 | import uuid
import random
import string
from otree.api import (
models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer,
Currency as c, currency_range
)
from django.db.models import UUIDField
from jsonfield import JSONField
import Levenshtein as lev
author = 'oTree Bogota Tutorial 2018'
doc ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.