text stringlengths 1 927k |
|---|
import pandas as pd
import math
import numpy as np
import time
import imp
import pickle
import os
from os import path
import json
from chefboost.commons import functions, evaluate as eval
from chefboost.training import Preprocess, Training
from chefboost.tuning import gbm, adaboost, randomforest
#--------------------... |
nome = input("Digite o seu nome: ")
print("Olá,Seja bem vindo, {}!".format(nome)) |
import requests
import random
from bs4 import BeautifulSoup
import re
from langdetect import detect
import os
import json
from cloudant import Cloudant
from datetime import datetime,date
import time
import tweet
db_name = 'mydb'
client = None
db = None
if 'VCAP_SERVICES' in os.environ:
vcap = json.loads(os.geten... |
from OpenGLCffi.GL import params
@params(api='gl', prms=['mode', 'first', 'count', 'instancecount', 'baseinstance'])
def glDrawArraysInstancedBaseInstance(mode, first, count, instancecount, baseinstance):
pass
@params(api='gl', prms=['mode', 'count', 'type', 'indices', 'instancecount', 'baseinstance'])
def glDrawEle... |
'''base config for nonlocalnet'''
# config for dataset
DATASET_CFG = {
'type': '',
'rootdir': '',
'train': {
'set': 'train',
'aug_opts': [
('Resize', {'output_size': (2048, 512), 'keep_ratio': True, 'scale_range': (0.5, 2.0)}),
('RandomCrop', {'crop_size': (512, 512),... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from math import ceil
from .entities import CimBaseDataCollection, Stop
class VesselFutureStopsPrediction:
"""Wrapper to get (predict, without noise) vessel future stops, the number of stops is limited by configuration.
Examples:
... |
class MapyMaster(object):
def __init__(self):
print ("hello Mapy master")
def __call__(self, *args, **kwargs):
print ("hello from Mapy master") |
# coding: utf-8
import os
import time
root = os.path.join(os.path.dirname(__file__), "..", "..")
script_dir = os.path.join(root, "notebook", "script")
timestamp = time.time()
print "timestamp of this script is %d" % timestamp
gen_save_file_path = lambda suffix: os.path.join(script_dir, "preflop_neuralnet_training_note... |
from pydantic import Field
from buglog.utils import Bug
#################################################
# EXCERCISES
class SideBridge(Bug):
"""Excercise: a side bridge"""
reps: int = Field(1, title="Repetitions", gt=0)
times: int = Field(..., gt=0)
class Squats(Bug):
"""Excercise: squats"""
r... |
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from guardian.shortcuts import get_perms, remove_perm
from apps.projects.models import Project, ProjectContributor, ProjectAPIToken
from apps.reporting.models import ReportInformation
@receiver(post_save, sender=Project)
d... |
#!/usr/bin/python
# ==============================================================================
# Author: Tao Li (taoli@ucsd.edu)
# Date: May 7, 2015
# Question: 081-Search-in-Rotated-Sorted-Array-II
# Link: https://leetcode.com/problems/search-in-rotated-sorted-array-ii/
# ================================... |
from sqlalchemy.orm import Session
from . import models, schemas
def get_user(db: Session, user_id: int):
return db.query(models.User).filter(models.User.id == user_id).first()
def get_users(db: Session, skip: int = 0, limit: int = 100):
return db.query(models.User).offset(skip).limit(limit).all()
def crea... |
import json
import time
from bottle import Bottle, request
from engine.app import app
api_server = Bottle()
# CAREFUL: Do NOT perform any computation-related tasks inside these methods, nor inside functions called from them!
# Otherwise your app does not respond to calls made by the FeatureCloud system quickly eno... |
import gc
import os
from clang.cindex import CursorKind
from clang.cindex import Cursor
from clang.cindex import File
from clang.cindex import Index
from clang.cindex import SourceLocation
from clang.cindex import SourceRange
from clang.cindex import TranslationUnitSaveError
from clang.cindex import TranslationUnitLoa... |
"""
Provide a generic structure to support window functions,
similar to how we have a Groupby object.
"""
from __future__ import annotations
import copy
from datetime import timedelta
from functools import partial
import inspect
from textwrap import dedent
from typing import (
TYPE_CHECKING,
Any,
Callable,... |
from dragonn.utils import rolling_window
import numpy as np
from sklearn.metrics import auc, precision_recall_curve
import matplotlib.pyplot as plt
import pdb
from keras import backend as K
import tensorflow as tf
def positionalPRC(embeddings, scores,window_stride=1, coverage_thresh_for_positive=0.8,verbose=Fals... |
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 10 11:24:08 2021
@author: qizhe
"""
# import heapq
from sortedcontainers import SortedList
class StockPrice:
"""
答案:双百通过。
利用了一个“容器”有序列表
能不能自己维护一个有序列表? 应该很简单吧?
当时做题的时候,缺的就是这个有序列表。
"""
def __init__(self):
self.priceDict =... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from awsglue.blueprint.workflow import Workflow, Entities
from awsglue.blueprint.job import Job
from awsglue.blueprint.crawler import *
import boto3
from botocore.client import ClientError
import datetime
def g... |
from __future__ import absolute_import
# Copyright (c) 2010-2017 openpyxl
# Copyright (c) 2018 qyou.casia@gmail.com
"""
Read a chart
"""
from .chartspace import ChartSpace, PlotArea
from openpyxl.xml.functions import fromstring
from openpyxl.packaging.relationship import get_rel, get_rels_path, get_dependents
from o... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 15_subcoco_effdet_icevision_fastai.ipynb (unless otherwise specified).
__all__ = ['SubCocoParser', 'parse_subcoco', 'SaveModelDupBestCallback', 'FastGPUMonitorCallback',
'gen_transforms_and_learner', 'run_training', 'save_final']
# Cell
import glob
import json
im... |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
import pytest
from openpyxl.xml.functions import fromstring, tostring
from openpyxl.tests.helper import compare_xml
@pytest.fixture
def BookView():
from ..views import BookView
return BookView
class TestBookView:
def test_ctor(se... |
# generated by datamodel-codegen:
# filename: schema/type/usageDetails.json
# timestamp: 2021-08-17T03:53:57+00:00
from __future__ import annotations
from typing import Optional
from pydantic import BaseModel, Extra, Field, confloat, conint
from . import basic
class UsageStats(BaseModel):
class Config:
... |
#!/usr/bin/env python
# coding: utf-8
# In[21]:
import pandas as pd
import numpy as np
import json
import zipfile
import matplotlib.pyplot as plt
import seaborn as sns
import re
# In[12]:
wikidata = pd.read_json('wikidata-movies.json.gz', orient='record', lines=True)
genres = pd.read_json('genres.json.gz', ori... |
"""
Interface to the config_compilers.xml file. This class inherits from GenericXML.py
"""
from CIME.XML.standard_module_setup import *
from CIME.XML.generic_xml import GenericXML
from CIME.XML.files import Files
from CIME.XML.compilerblock import CompilerBlock
from CIME.BuildTools.makemacroswriter import MakeMacroWr... |
# -*- coding: utf-8 -*-
"""ViPRoPE.ipynb
Automatically generated by Colaboratory.
"""
import torch, math
import torchvision
import torchvision.transforms as transforms
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
!pip install torchsummary
from torchsummary import summary
import time
impo... |
from vseq.models.wavenet.model import WaveNet
from vseq.models.wavenet.modules import CausalConv1d, OutConv1d, ResidualBlock, ResidualStack |
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
"""Hash table.
Running time: O(n) where n == len(nums).
"""
d = {nums[0]: 0}
for i in range(1, len(nums)):
if target - nums[i] in d:
return [i, d[target - nums[i]]]
... |
# -*- coding: utf-8 -*-
import math
import numpy as np
import numba
from numpy import linalg as LA
from utils import get_num_break_slice
@numba.jit(nopython=True)
def calculate_Pi_mDelta(Ys, Mu, Sigma, sigma_s):
# get number of point in each matrix
sc_cell_num = Ys.shape[0]
ref_cell_num = Mu.shape[0]
... |
from model.group import Group
class GroupHelper:
def __init__(self, app):
self.app = app
def return_to_groups_page(self):
wd = self.app.wd
wd.find_element_by_link_text("group page").click()
def create(self, group):
wd = self.app.wd
self.open_groups_page()
... |
import os
from math import pi, cos, sin, tan
from pyaedt.generic.general_methods import aedt_exception_handler
from pyaedt.modeler.Primitives import Primitives
from pyaedt.modeler.GeometryOperators import GeometryOperators
from pyaedt.modeler.multiparts import MultiPartComponent, Environment
from pyaedt.modeler.actors... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... |
""" Script for the tgrouping function.
Run with:
python tgrouping_script.py
"""
# Loading modules.
from __future__ import absolute_import, division, print_function
import os
import numpy as np
from scipy.stats import gamma
import matplotlib.pyplot as plt
import nibabel as nib
import sys
import numpy.linalg as npl
... |
import numpy as np
import pandas as pd
import pytest
from pytest import param
import ibis.expr.datatypes as dt
from ibis.tests.backends import (
BigQuery,
Clickhouse,
MySQL,
Postgres,
PySpark,
SQLite,
)
from ibis.udf.vectorized import reduction
@reduction(input_type=[dt.double], output_type=d... |
from contextlib import contextmanager
import colorama
import atexit
import faulthandler
import hashlib
import inspect
import io
import json
import logging
import os
import redis
from six.moves import queue
import sys
import threading
import time
import traceback
# Ray modules
import ray.cloudpickle as pickle
import ra... |
import logging
from django.dispatch import Signal, receiver
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from django.conf import settings
class Event(models.Model):
user = models.ForeignKey(settings.AUTH_U... |
from sympy import Symbol, I
from qnet.algebra.core.operator_algebra import (
LocalSigma, rewrite_with_operator_pm_cc, OperatorPlusMinusCC)
from qnet.algebra.library.fock_operators import Destroy, Create
from qnet.algebra.core.hilbert_space_algebra import LocalSpace
from qnet.printing import srepr
def test_simple... |
import random
from ..core import Basic, Integer
from ..core.compatibility import as_int
class GrayCode(Basic):
"""
A Gray code is essentially a Hamiltonian walk on
a n-dimensional cube with edge length of one.
The vertices of the cube are represented by vectors
whose values are binary. The Hamilt... |
# 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 agreed to in writing, s... |
#!/usr/bin/env python3
import argparse
import os
import subprocess
import sys
from datetime import datetime
import boto3
from nctogtiff import nctogtiff
from weight import preprocess
class FetchGOES(object):
BANDS = {
1: 'blu',
2: 'red',
3: 'nir',
}
def __init__(self, dt=None, ... |
# coding: utf-8
# In[171]:
# Ido Michael
import tensorflow as tf
import os, struct
import numpy as np
import matplotlib.pyplot as plt
import ParsePowerEDFA
from sklearn.metrics import mean_squared_error
from sklearn.metrics import mean_absolute_error
import math
import sys
import configparser
import random
print(tf... |
#
# 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
# ... |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applica... |
# postgresql/ext.py
# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
from itertools import zip_longest
from .array import ARRAY
from ...sql import coe... |
from .sql_database import SQLDatabase
from .matplotlib_graph import MatplotlibGraph |
# -*- coding: utf-8 -*-
"""Application utilities."""
import datetime
from typing import Optional
from urllib.parse import urlparse, urljoin
import pytz
from babel import dates as babel_dates
from flask import current_app, request, url_for
from flask_login import current_user
from flask_mail import Message
from . ... |
# Copyright 2019 Atalaya Tech, 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, ... |
#!/usr/bin/evn python3
# coding=utf-8
import logging
class AppException(Exception):
def __init__(self, *args, **kwargs):
logger = logging.getLogger("tornado.access")
# 控制台是否输出日志
logger.propagate = False
logger.error(f"AppException:{args}")
class AppValueError(AppException):
d... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# coding: utf-8
# flake8: noqa
"""
Cost Management
The API for Project Koku and OpenShift cost management. You can find out more about Project Koku at [https://github.com/project-koku/](https://github.com/project-koku/). # noqa: E501
The version of the OpenAPI document: 1.0.2
Generated by: https://o... |
# Generated by Django 3.2.7 on 2021-09-18 14:05
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Prisoner',
fields=[
... |
# -*- coding: utf-8 -*-
__author__ = 'Arseniy'
from model.contact import Contact
from model.group import Group
import random
def test_add_some_contact_to_some_group(app, orm):
if len(orm.get_group_list()) == 0:
app.group.create(Group(name="new group"))
if len(orm.get_contact_list()) == 0:
app.... |
#!C:\Users\kyj20\PycharmProjects\untitled6\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==40.8.0','console_scripts','easy_install'
__requires__ = 'setuptools==40.8.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|... |
# coding: utf-8
# cf.http://d.hatena.ne.jp/white_wheels/20100327/p3
import numpy as np
import matplotlib.pylab as plt
from mpl_toolkits.mplot3d import Axes3D
import logging
logger = logging.getLogger(__name__)
def _numerical_gradient_no_batch(f, x):
h = 1e-4 # 0.0001
grad = np.zeros_like(x)
... |
# Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
from typing import Union
class int(float):
def __init__(self, arg: int): pass
# def __add__(self, other: float) -> float: pass
# def __add__(self, other: complex) -> complex: pass
def __add__(self, other: int) -> int: pass
# def __sub__(self, other: float) -> float: pass
# def __sub__(self, o... |
import os
import time
import e2e.clickhouse as clickhouse
import e2e.kubectl as kubectl
import e2e.settings as settings
import e2e.yaml_manifest as yaml_manifest
from testflows.core import fail, Given, Then, current
current_dir = os.path.dirname(os.path.abspath(__file__))
operator_label = "-l app=clickhouse-operato... |
# 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... |
# Copyright 2018 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 accompa... |
# 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 -*-
from pprint import pprint
from scrapy.spiders import SitemapSpider
class HuluSitemap(SitemapSpider):
name = 'hulu_sitemap'
allowed_domains = ['hulu.com']
sitemap_urls = ['https://www.hulu.com/sitemap_index.xml']
def sitemap_filter(self, entries):
for entry in entries:
... |
# -*- coding: utf-8 -*-
# BioSTEAM: The Biorefinery Simulation and Techno-Economic Analysis Modules
# Copyright (C) 2020, Yoel Cortes-Pena <yoelcortes@gmail.com>
#
# This module is under the UIUC open-source license. See
# github.com/BioSTEAMDevelopmentGroup/biosteam/blob/master/LICENSE.txt
# for license details.
"""... |
# pylint: disable=C, R, not-callable, no-member, arguments-differ
import json
from functools import partial
import pymatgen
import torch
import random
from se3cnn.non_linearities import GatedBlock
from se3cnn.non_linearities.rescaled_act import relu, sigmoid
from se3cnn.point.kernel import Kernel
from se3cnn.point.ope... |
"""
There may need to be a time when this file will need to get factored out into its parts.
These functions should be thread safe iterators (or generators -- whichever is faster), which yeild batches of their results.
There should be functionality to materialize them into sparse thingys or something with good perf
... |
# This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
__name__ = "biotite.application"
__author__ = "Patrick Kunzmann"
__all__ = ["MSAApp"]
import abc
from tempfile import NamedTemporaryFile
from collections import Or... |
#!/usr/bin/env python
# Considering natural numbers of the form, a^(b), where a, b < 100, what
# is the maximum digital sum?
import operator
from python.decorators import euler_timer
from python.functions import apply_to_list
def digit_sum(n):
return sum(int(dig) for dig in str(n))
def main(verbose=False):
... |
"""
Tests for the Admin model.
"""
import pytest # noqa: F401
from flask_bcrypt import check_password_hash
from library_registry.model import Admin
from library_registry.model_helpers import create
class TestAdminModel:
def test_authenticate_autocreates_first_admin(self, db_session):
"""
GI... |
import abc #abstract base class
import numpy as np
#####Adjacency Matrix#########
# You should use adjacency matrix for small densily connected graphs
# space complexity O(V^2)
############################################################
#Base Class representation of class with all interface methods
#######... |
from Drawing import *
sg = Drawing(alpha=0, omega=10)
sg.addNode("a")
sg.addNode("b")
sg.addNode("c")
sg.addNode("d")
sg.addLink("a", "b", 0, 4)
sg.addLink("a", "b", 6, 9)
sg.addLink("a", "c", 2, 5, height=0.4)
sg.addLink("b", "c", 1, 8)
sg.addLink("b", "d", 7, 10, height=0.4)
sg.addLink("c", "d", 6, 9)
sg.addNodeCl... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... |
# msl_v2_rule.py
# Defines the rules for gold standard and ambiguous subjects for msl v2 labels
#
# Steven Lu 8/21/2019
import numpy as np
class MSLV2Rule(object):
def __init__(self, retirement_count):
if retirement_count % 2 == 0 and retirement_count < 3:
raise ValueError('retirement count m... |
#!/usr/bin/env python
# Copyright 2017 Calico 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agr... |
from collections import namedtuple
Field = namedtuple('Field', ('name', 'data'))
Downloads = Field('download_count', 'COUNT(*)')
Date = Field('download_date', 'FORMAT_TIMESTAMP("%Y-%m-%d", timestamp)')
Month = Field('download_month', 'FORMAT_TIMESTAMP("%Y-%m", timestamp)')
Year = Field('download_year', 'FORMAT_TIMESTA... |
import numpy as np
import pandas as pd
class GradientFreeResourceAllocator:
def __init__(self, depth=3, lmda=1, n_restarts=10, n_trials=int(1e3),\
allocationMethod='variablePrecision'):
# General parameters with default values
self.lmda = lmda
self.n_trials = n_trials
... |
import glob
import os
from typing import Sequence
def get_inputdata_file(name: str) -> str:
return os.path.join(os.path.dirname(__file__), 'inputdata', name)
def get_inputdata_files(pattern: str) -> Sequence[str]:
return glob.glob(os.path.join(os.path.dirname(__file__), 'inputdata', pattern)) |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2014-2016 bromix (plugin.video.youtube)
Copyright (C) 2016-2018 plugin.video.youtube
SPDX-License-Identifier: GPL-2.0-only
See LICENSES/GPL-2.0-only for more information.
"""
import re
import datetime
from .base_item import BaseItem
try:
from six.moves ... |
from __future__ import division
import unittest
import numpy as np
import linvpy as lp
import generate_random
from scipy.sparse.linalg import lsmr
import matplotlib.pyplot as plt
import optimal as opt
import mestimator_marta as marta
import random
import copy
import toolboxinverse as inv
TESTING_ITERATIONS = 50
# For ... |
# Copyright 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 obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... |
#!/usr/bin/env python
"""
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");... |
# Copyright 2018 Changan Wang
# 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, so... |
class IterRator(object):
def __init__(self, l, n):
self.l = l
self.n = n
def __iter__(self):
for i in range(0, len(self.l), 2):
yield self.l[i: i+self.n]
it = IterRator([1,2,3,4,5], 2)
for item in it:
print item |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import numpy as np
import pandas as pd
from sklearn.metrics import mean_squared_error
def get_possession_team(player, movement):
"""
Return the team_id of the ball_handler
"""
team_id = movement.loc[movement.player_id == player, 'team_id'].values[0]
return team_id
def get_ball_handler(movement):... |
# Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
# -*- coding: utf-8 -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from __future__ import unicode_literals
import socket
from .common import HyperlinkTestCase
from .. import URL, URLParseError
# automatically import the py27 windows implementation when appropriate
from .. import _url
fr... |
"""
URL patterns for Operational Intelligence related views
"""
from django.urls import re_path
from core.oi import jbviews
urlpatterns = [
re_path(r'^oi/jobsbuster/$', jbviews.jbhome, name='jobsBuster'),
] |
"""
SQL-style merge routines
"""
import copy
import string
import warnings
import numpy as np
from pandas._libs import hashtable as libhashtable, join as libjoin, lib
from pandas.compat import lzip
from pandas.errors import MergeError
from pandas.util._decorators import Appender, Substitution
from pandas.core.dtype... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# */AIPND-revision/intropyproject-classify-pet-images/check_images.py
#
# PROGRAMMER: Zhecho Zhechev
# DATE CREATED: 2019-09-10T10:23:32+03:00
# REVISED DATE:
# PURPOSE: Classifies pet images using a pretrained CNN model, compares these
# classifications to the t... |
"""Helpers for script and condition tracing."""
from __future__ import annotations
from collections import deque
from collections.abc import Callable, Generator
from contextlib import contextmanager
from contextvars import ContextVar
from functools import wraps
from typing import Any, cast
from homeassistant.helpers.... |
# Owner(s): ["oncall: fx"]
import torch
import torch.fx.experimental.fx_acc.acc_ops as acc_ops
import torch.nn as nn
from torch.testing._internal.common_fx2trt import AccTestCase
from parameterized import parameterized
class TestGetitemConverter(AccTestCase):
@parameterized.expand(
[
("slice_... |
ADJACENTS = ((-1 - 1j), (0 - 1j), (1 - 1j), (-1 + 0j), (1 + 0j), (-1 + 1j), (0 + 1j), (1 + 1j))
def compute_step():
new_flashes = set()
for k in octopuses:
octopuses[k] += 1
if octopuses[k] > 9:
octopuses[k] = 0
new_flashes.add(k)
while new_flashes:
for k i... |
################################################################################
# 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... |
# Replace the file path with an existing text file on your machine.
with open("/home/aditya/Desktop/sample.txt", "r") as file_:
lines = file_.readlines()
for line in lines:
print(lines) |
#python
print("Project by PRAHLAD SHUKLA")
import smtplib
form email.mime.multipart import MIME Multipart
from email.mime.text import MIMETEXT
sender="thecyberkiddie@gmail.com"
receiver="shuklaprahlad414@gmail.com"
msg MIME Multipart()
msg ['TO']=receiver
msg ['FROM']=sender
msg ['SUBJECT']='HTML MESSAGE'
html="""
<h... |
"""
The MIT License
Copyright (c) 2017-2020 Mark Douthwaite
"""
from .discrete import DiscreteFactor
from .set import FactorSet
__all__ = [
"FactorSet",
"DiscreteFactor",
] |
from typing import Optional, Any
from ..apibase import SlobsClass
from .scenenode import (
SceneNode,
)
from .factories import (
scenenode_factory,
sceneitem_factory,
sceneitemfolder_factory,
selection_factory,
source_factory,
register,
)
from .typedefs import ISceneNodeAddOptions, ISourceAd... |
# Motor B controls Left-Right movement
# Motor C controls the height of arm
# Motor A controls the fingers
# Direction keys - to move the arm
# Space will open the claw
# Z will close the claw
# The light sensor will be configured to also close if a certain
# threshold is reached with an object being in front of it
... |
# Encoding: UTF-8
import os
import pytest
parametrize = pytest.mark.parametrize
@parametrize(
('input', 'table', 'id'),
[
# Simple lookups
(u'Eevee', 'pokemon_species', 133),
(u'Scratch', 'moves', 10),
(u'Master Ball', 'items', 1),
(u'normal', 'types', 1),
(u'... |
# Data Parallel Control (dpCtl)
#
# Copyright 2020-2021 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.... |
from django.contrib import admin
from pconsc.models import PredictallJob
admin.site.register(PredictallJob) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.