text stringlengths 2 999k |
|---|
"""
Pipeline imports
"""
from .base import Pipeline
from .extractor import Extractor
from .factory import PipelineFactory
from .hfmodel import HFModel
from .hfonnx import HFOnnx
from .hfpipeline import HFPipeline
from .hftrainer import HFTrainer
from .labels import Labels
from .mlonnx import MLOnnx
from .questions imp... |
from __future__ import unicode_literals
import re
import json
from django.conf import settings
from django.core.files import File
from django.shortcuts import render, get_object_or_404, redirect
from django.views.decorators.http import require_POST
from django.utils.translation import ugettext_lazy as _
from django.h... |
# -*- coding: utf-8 -*-
import pandas as pd
from bio2bel import make_downloader
from ..constants import REGULATORY_SITES_PATH, REGULATORY_SITES_URL
__all__ = [
'download_regulatory_sites'
]
download_regulatory_sites = make_downloader(REGULATORY_SITES_URL, REGULATORY_SITES_PATH)
def get_regulatory_sites_df(url... |
#!/usr/bin/env python
# Copyright (c) 2011, Willow Garage, Inc.
# 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 copyright
# noti... |
"""
parser telnet
create by judy 2019/11/21
"""
import json
import os
import traceback
from commonbaby.mslog import MsLogger, MsLogManager
from datacontract.iscandataset.iscantask import IscanTask
from idownclient.clientdatafeedback.scoutdatafeedback.portinfo import (
PortInfo, Telnet)
from .zgrab2parserbase im... |
import os.path
from moler.config import load_config
from moler.device.device import DeviceFactory
def test_network_outage():
load_config(config=os.path.abspath('my_devices.yml'))
unix1 = DeviceFactory.get_device(name='MyMachine1')
unix2 = DeviceFactory.get_device(name='MyMachine2')
if __name__ == '__mai... |
from veripb import InvalidProof
from veripb.rules import Rule, EmptyRule, register_rule
from veripb.rules import ReversePolishNotation, IsContradiction
from veripb.rules_register import register_rule, dom_friendly_rules, rules_to_dict
from veripb.parser import OPBParser, MaybeWordParser, ParseContext
from veripb impor... |
# -*- coding: utf-8 -*-
import os
import os.path
import sys
import time
import glob
import http.cookiejar
import tempfile
import lz4.block
import datetime
import configparser
try:
import json
except ImportError:
import simplejson as json
try:
from pysqlite2 import dbapi2 as sqlite3
except ImportError:
... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1.10.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
class V... |
import os
from urllib import parse as urlparse
def fix_catalog_url(url):
"""
Replace .html with .xml extension
"""
from os.path import splitext, join
u = urlparse.urlsplit(url)
name, ext = splitext(u.path)
if ext == ".html":
u = urlparse.urlsplit(url.replace(".html", ".xml"))
... |
import datetime
from backtrader_ib_api.finviz import get_stock_info, estimate_next_earnings_date
def test_stock_info():
stock_info = get_stock_info("AAPL")
print(stock_info)
def test_estimate_next_earnings_date():
next_earnings_date = estimate_next_earnings_date("AAPL")
print(next_earnings_date)
... |
#!/usr/bin/python
# Copyright 2016 Google 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... |
import asyncio
import json
import os
import string
from statistics import mean
from typing import Any
from packaging import version as pyver
import pytz
from alerts.models import SEVERITY_CHOICES
from core.models import CoreSettings
from django.conf import settings
from django.contrib.postgres.fields import ArrayField... |
from DataStructures.heaps import MinHeap, MaxHeap
class ArrayBasedQueue:
def __init__(self) -> None:
self.__container = []
self.__size = 0
def isEmpty(self) -> bool:
return len(self.__container) == 0
def enqueue(self, item) -> None:
self.__container.append(item)
s... |
"""Public interface exposed by library.
This module contains all the interfaces that represents a generic Apple TV device and
all its features.
"""
from abc import ABC, abstractmethod
import asyncio
import hashlib
import inspect
import io
from ipaddress import IPv4Address
import re
from typing import (
Any,
C... |
size = int(input())
assert size % 2 == 1
lst = [int(x) for x in input().split()]
#print (lst)
for i in range(len(lst)+1):
tmp = lst.pop()
#print (lst, "%s[%s]: %s"%(tmp, i, lst[i]), sep=' ')
if not tmp in lst:
print (tmp)
break
lst.insert(0, tmp)
|
import base64
import json
import boto3
import datetime
def lambda_handler(event, context):
"""
Receive a batch of events from Kinesis and insert as-is into our DynamoDB table if invoked asynchronously,
otherwise perform an asynchronous invocation of this Lambda and immediately return
"""
if not e... |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2019, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... |
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from v1.forms import FilterableListForm
from v1.models.learn_page import AbstractFilterPage
from v1.util.ref import get_category_children
from v1.util.util import get_secondary_nav_items
class FilterableListMixin(object):
"""Wagtail Page mi... |
# Copyright (c) 2006-2017, Christoph Gohlke
# Copyright (c) 2006-2017, The Regents of the University of California
# Produced at the Laboratory for Fluorescence Dynamics
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the followin... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from ckeditor.fields import RichTextField
class Question(models.Model):
question = models.CharField(max_length=255, unique=True)
answer = models.CharField(max_length=255)
explanation = RichTextField()
... |
import os
import sys
import traceback
from language_fragments import load_module
USAGE = "python -m language_fragments mode [options]"
### library `modes`
MODES = {}
## tools
MODES["random_sat_sampler"] = "language_fragments.tools.random_sat_nl"
def main(argv):
"""The main execution point
:param ... |
# import the necessary packages
import time
import cv2
import imutils
import numpy as np
from imutils.video import FileVideoStream
fvs = FileVideoStream('data/sarwesh.mp4', queue_size=1024).start() # with bag
time.sleep(1.0)
kernelSize = 7
backgroundHistory = 15
openposeProtoFile = "dnn_models/pose/coco/pose_deplo... |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
'''
MIT License
Copyright (c) 2019 Shunsuke Saito, Zeng Huang, and Ryota Natsume
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 Sof... |
# coding=utf-8
# Copyright 2020 The Google Research 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 applicab... |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), ... |
# Copyright (c) 2021 PPViT Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
#
# 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... |
#------------------------------------------------------------------------------
# Copyright (c) 2008, Riverbank Computing Limited
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditi... |
from __future__ import unicode_literals
import logging
import os
from mopidy import config, ext
__version__ = '1.0.1'
logger = logging.getLogger(__name__)
class Extension(ext.Extension):
dist_name = 'Mopidy-TtsGpio-opi'
ext_name = 'ttsgpio-opi'
version = __version__
def get_default_config(sel... |
import funcoes
from time import sleep
from random import randint
funcoes.browser()
for c in range(0, 10):
#fazer ataque
funcoes.ataque()
#voltar ao contador
funcoes.contador()
#esperar 4min a 5min
x = randint(250, 300)
sleep(x)
# abrir o browser
funcoes.browser()
|
#
# This file is part of the Fonolo Python Wrapper package.
#
# (c) Foncloud, Inc.
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
import re
from .requesthandler import RequestHandler
from ..exception.exception import FonoloException
cl... |
# 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... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-04-05 05:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('chembddb', '0020_auto_20170602_0900'),
]
operatio... |
# Copyright 2018 Google, 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 writing, ... |
import requests
import os
class Config:
def __init__(self, config=None):
self.baseUrl = ""
if config is not None:
if "baseUrl" in config:
self.baseUrl = config["baseUrl"]
class Client:
def __init__(self, config):
self.config = config
def list_device_... |
from bs4 import BeautifulSoup
# Get Attribute from object Or Get Index from array etc...
def get_attr_with_err(src_object, index, none_if_empty=False, obj_if_empty=False):
result, is_error = None, False
try:
result = src_object[index]
if type(result) == list and none_if_empty:
if le... |
"""'Git type Path Source."""
import logging
import shutil
import subprocess
import tempfile
from pathlib import Path
from typing import Any, Dict, Optional
from .source import Source
LOGGER = logging.getLogger(__name__)
class Git(Source):
"""Git Path Source.
The Git path source can be tasked with cloning a... |
ParserException = type('ParserException', (Exception,), {})
ParserWarning = type('ParserWarning', (ParserException,), {})
ParserError = type('ParserError', (ParserException,), {})
InvalidSynonyms = type('InvalidSynonyms', (ParserException,), {})
|
# encoding: utf-8
import os
import sys
import re
import time
import inspect
import itertools
import pkgutil
from flask import Blueprint, send_from_directory
from flask.ctx import _AppCtxGlobals
from flask.sessions import SessionInterface
from flask_multistatic import MultiStaticFlask
import six
from werkzeug.excepti... |
from datetime import datetime
from datetime import date
from datetime import timedelta
# Calculating the days until Christmas
today_date = date.today()
christmas = date(2020, 12, 25)
days_until_christmas = (today_date - christmas).days
# print(f'days_until_christmas = {days_until_christmas}')
# if today_date == ch... |
# Copyright (c) 2012 OpenStack Foundation
# 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 ... |
import sys
import os
import shutil
import time
import numpy as np
import uuid
import datetime
from ...common.database import Database
from .joukowski import JoukowskiAirfoil
from ..optimizer.swarm import Swarm
SIMCOLLECTION = "simulations"
LOGCOLLECTION = "logs"
DESIGNSCOLLECTION = "designs"
class Simulation(Jouko... |
"""
This script is for computing the definite integrals usingLegendre-Guass Quadrature.
Computes the Legendre-Gauss nodes and weights on interval [a,b] with truncation order N.
If f is a continuous function on [a,b], with a descritization induced by a vector x
of points in [a,b], evalute the definite integral of the... |
import lazy_dataset
from collections import OrderedDict
def test_unbatch():
examples = OrderedDict(
a=[0, 1, 2],
b=[3, 4],
c=[5, 6, 7]
)
ds = lazy_dataset.new(examples)
ds = ds.unbatch()
assert list(ds) == list(range(8))
def fragment_fn(ex):
for i in ex.split('_'):
... |
from urllib.request import urlretrieve
import time
import tarfile
URL_path = r"https://aiedugithub4a2.blob.core.windows.net/a2-data"
filename = r"Data.tar.gz"
print("Please input the local folder path:")
local = input()
from_path = URL_path + "/" + filename
to_path = local + "/" + filename
print("Downloading...")
tr... |
import pytest
from dvc.config import ConfigError
from dvc.exceptions import DvcException
from dvc.fs.s3 import S3FileSystem
bucket_name = "bucket-name"
prefix = "some/prefix"
url = f"s3://{bucket_name}/{prefix}"
key_id = "key-id"
key_secret = "key-secret"
session_token = "session-token"
@pytest.fixture(autouse=True... |
"""
Renders a colormapped image of a scalar value field, and a cross section
chosen by a line interactor.
"""
# Standard library imports
from optparse import OptionParser
import sys
# Major library imports
from numpy import array, linspace, meshgrid, nanmin, nanmax, pi, zeros
# Enthought library imports
from chaco.... |
# Copyright 2018 DeepMind Technologies 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
from setuptools import setup, find_packages
setup(
name='MusicParser',
version='1.0.1',
url='https://github.com/rubysoho07/MusicParser',
author='Yungon Park',
author_email='hahafree12@gmail.com',
description='Parsing music album from music information sites.',
install_requires=[
"re... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tf_pose.runner import infer, Estimator, get_estimator
|
#
# Tests for the Unary Operator classes
#
import pybamm
import unittest
import numpy as np
from scipy.sparse import diags
class TestUnaryOperators(unittest.TestCase):
def test_unary_operator(self):
a = pybamm.Symbol("a", domain=["test"])
un = pybamm.UnaryOperator("unary test", a)
self.as... |
# -*- coding: utf-8 -*-
"""
This is module that represents the helper methods.
Updated since version 1.1:
1. Added check_path_exist(), check_is_directory() and check_is_file().
Updated since version 1.2 (OpenWarp - Add Logging Functionality) :
Added support for logging
"""
__author__ = "caoweiquan... |
import unittest
import test.test_tools
test.test_tools.skip_if_missing('c-analyzer')
with test.test_tools.imports_under_tool('c-analyzer'):
from cpython.__main__ import main
class ActualChecks(unittest.TestCase):
# XXX Also run the check in "make check".
#@unittest.expectedFailure
# Failing on one o... |
'''def encode(shiftCount,plaintText):
abjat=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
for char in plaintText:
if(plaintText.isalpha() and plaintText.upper()):
#harus true
print(plaintText.isalpha())
#memi... |
"""
github3.repos
=============
This module contains the classes relating to repositories.
"""
from base64 import b64decode
from requests import post
from collections import Callable
from github3.events import Event
from github3.issues import Issue, IssueEvent, Label, Milestone, issue_params
from github3.git import ... |
"""
WSGI config for scrum project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTIN... |
# -*- coding: utf-8 -*-
"""
biosppy.signals.ecg
-------------------
This module provides methods to process Electrocardiographic (ECG) signals.
Implemented code assumes a single-channel Lead I like ECG signal.
:copyright: (c) 2015-2017 by Instituto de Telecomunicacoes
:license: BSD 3-clause, see LICENSE for more det... |
# 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 RPaleotree(RPackage):
"""Paleontological and Phylogenetic Analyses of Evolution
Prov... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"module_name": "jrdsite",
"color": "red",
"icon": "octicon octicon-file-directory",
"type": "module",
"label": _("jrdsite")
}
]
|
# Copyright (C) 2016-present the asyncpg authors and contributors
# <see AUTHORS file>
#
# This module is part of asyncpg and is released under
# the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
import collections
from . import compat
from . import connresource
from . import exceptions
class Curs... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# Copyright 2016 Intel Corporation
# Copyright 2014 Rackspace, 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
#
# Unle... |
print("Moje ulubione potrawy to:", "curry", "pad thai", "burrito", sep="\n")
|
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import math
import sys
import unittest
from unittest import TestCase, main
from nni.algorithms.compression.pytorch.pruning import TransformerHea... |
from colorsys import hsv_to_rgb
from functools import reduce
import math
import operator
import queue
import time
import threading
from cuesdk import CueSdk
from cuesdk.helpers import ColorRgb
def swirls2(env, px, py):
"""
Source https://www.shadertoy.com/view/4dX3Rf
"""
t = env.time
x = px - (e... |
# import the neccessary package
from keras.utils import np_utils
import numpy as np
import h5py
class HDF5DatasetGenerator:
def __init__(self,dbPath,batchSize,preprocessors=None,
aug=None,binarize=True, classes=2):
# store the batch size, preprocessors, and data augmentor,
... |
#!/usr/bin/python
#****************************************************************************
#* ivpm.py
#*
#* This is the bootstrap ivpm.py script that is included with each project.
#* This script ensures that the *actual* ivpm is downloaded in the
#* project packages dir
#***************************************... |
from collections import Sequence, Iterable
isproperty = lambda attr: not (not attr.__name__ \
or attr.__name__.startswith('_') \
or callable(attr) or isinstance(attr, property) )
ispropertyof = lambda obj, name: getattr(obj, name) \
and isproperty(getattr(obj, name))
ismethod = lambda attr: not (not at... |
# Copyright 2013 OpenStack Foundation
# 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... |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
""" Implementation of abstract Disposable.
"""
from abc import ABCMeta, abstractmethod
class Disposable(metaclass=ABCMeta):
"""
Implementation of the disposable pattern. A disposable is usually
returned on resource allocation. Calling .dispose() on the returned
disposable is freeing the resource.
... |
#!/usr/bin/env python
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os, logging
from nonstdlib.debug import *
class ListHandler(logging.Handler):
def __init__(self):
logging.Handler.__init__(self)
self.records = []
def _... |
#!/usr/bin/python3
# -*-: coding: utf-8 -*-
"""
:author: lubosson
:date: 2019-04-15
:desc:
"""
import sys
sys.path.append('..')
""" 关键字搜索API """
SEARCH_API = "https://xcx.qichacha.com/wxa/v1/base/advancedSearchNew"
""" 企业详情API """
COMPANY_DETAIL_API = "https://xcx.qichacha.com/wxa/v1/base/getEntDetail"
""" 地区代码列表 """
... |
#!/usr/bin/env python3
import strawberryfields as sf
from strawberryfields.ops import *
from strawberryfields.utils import scale
from numpy import pi, sqrt
import numpy as np
# initialize engine and program objects
eng = sf.Engine(backend="gaussian")
gaussian_cloning = sf.Program(4)
with gaussian_cloning.context as q... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'my_project.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise Imp... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation.
# Copyright 2012-2013 Hewlett-Packard Development Company, L.P.
# 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 ... |
from datetime import timedelta, date
from django.db.models import Max
from custom.icds_reports.utils.aggregation_helpers.distributed.base import BaseICDSAggregationDistributedHelper
from custom.icds_reports.const import AGG_DASHBOARD_ACTIVITY
from django.utils.functional import cached_property
from django.contrib.auth... |
"""
serialize_to_hdf5
===============
Autogenerated DPF operator classes.
"""
from warnings import warn
from ansys.dpf.core.dpf_operator import Operator
from ansys.dpf.core.inputs import Input, _Inputs
from ansys.dpf.core.outputs import _Outputs
from ansys.dpf.core.operators.specification import PinSpecification, Speci... |
# Generated by Django 3.0.7 on 2020-06-08 17:05
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('post', '0005_post_previous_post'),
]
operations = [
migrations.AddField(
model_name='post',
... |
import os
import mock
import pytest
from six.moves import shlex_quote
from mlflow.exceptions import ExecutionException
from mlflow.projects._project_spec import EntryPoint
from mlflow.utils.file_utils import TempDir
from tests.projects.utils import load_project, TEST_PROJECT_DIR
def test_entry_point_compute_params(... |
import csv
from urllib import request
from bs4 import BeautifulSoup
from house_info import house, gethtml_bs
def get_city_dict():
with open ('citys.csv') as f:
reader = csv.reader(f)
#print(dict(reader))
return dict(reader)
def get_area_dict(url):
html, bs = gethtml_bs(url)
areas_... |
import random
"""This program plays a game of Rock, Paper, Scissors between two Players,
and reports both Player's scores each round."""
"""The Player class is the parent class for all of the Players
in this game"""
class Player:
moves = ['rock', 'paper', 'scissors']
def __init__(self):
... |
import os
import pandas as pd
import pypospack.utils
from pypospack.pyposmat.data.pipeline import PyposmatPipeline
pypospack_root_dir = pypospack.utils.get_pypospack_root_directory()
configuration_dir = 'examples/PCA_param_clusters_in_qoi_space/configuration/'
config_fn_0 = os.path.join(pypospack_root_dir,
... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
# pyOCD debugger
# Copyright (c) 2006-2013,2018 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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/LICENS... |
# -*- coding: utf-8 -*-
"""The APFS file entry implementation."""
from dfdatetime import apfs_time as dfdatetime_apfs_time
from dfvfs.lib import definitions
from dfvfs.lib import errors
from dfvfs.path import apfs_path_spec
from dfvfs.vfs import attribute
from dfvfs.vfs import apfs_attribute
from dfvfs.vfs import fil... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
if __name__ == '__main__':
n = int(input("Value of n? "))
x = float(input("Value of x? "))
S = 0.0
for k in range(1, n + 1):
a = math.log(k * x) / (k * k)
S += a
print(f"S = {S}") |
# Importing the needed python packages
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
import time
import sys
from pylab import *
from matplotlib.patches import Rectangle
# Defining the right hand side of the ODEs (rate of changes of predator and prey)
def NegativeFBmodel(A,B,kA... |
import hashlib
from django.core.cache import cache
class ExponentialCache(object):
""" ExponentialCache interfaces with the cache for the growth and backoff classes
The `increment` function updates the key's hit count and the `delete_key` function clears it
"""
@classmethod
def _get_cache_key(cl... |
# Copyright (c) 2021 PPViT Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
import pygame, math, random, json
pygame.init()
pygame.font.init()
# Basic setup
pygame.display.set_caption('PARTICLES DEMO')
win = pygame.display.set_mode((1920 // 1.5, 1080 // 1.5))
clock = pygame.time.Clock()
# Camera
cam = [0, 0]
# A text drawing method
def write(text, x, y, size=32):
font = pygame.font.SysFont... |
import cocotb
from cocotb.triggers import RisingEdge, FallingEdge
def gen():
yield 4
class Cocotb_backend:
def __init__(self, clk, valid, data, ack):
self.__clk = clk
self.__valid = valid
self.__data = data
self.__ack = ack
def decorator(self, func):
return cocotb... |
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from trackintel.visualization.util import regular_figure, save_fig
from trackintel.visualization.osm import plot_osm_streets
def plot_positionfixes(positionfixes, out_filename=None, plot_osm=False):
"""Plots positionfixes (optionally to a file... |
# -*- coding: latin-1 -*-
from __future__ import division
from PyQt4 import QtGui
from functools import partial
import sys, time
try:
import picamera
except:
pass
def tira_foto(self):
'''
Método que tira fotos com a picamera
A foto tirada é mostrada no label_camera, que foi alterado para mostrar imag... |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
import sys
import os
from datetime import timedelta
from argparse import ArgumentParser
from .atsobjs import loadObjects, AtsObject
def get_nearby_objects(ats_objects: dict, target: AtsObject, radius: int=200, nres: int=20) -> list:
""" Does the actual work of getting nearby objects """
dists = [(x.distInRadiu... |
import numpy as np
def tour_select(fitness, tournament_size):
"""Tournament selection. Choose number of individuals to participate
and select the one with the best fitness.
Parameters
----------
fitness : array_like
An array of each individual's fitness.
tournament_size : int
... |
#!/usr/bin/env python
#
# Copyright 2017 Pixar Animation Studios
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.