filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_11552 | # Copyright 2015 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 applicable law or a... |
the-stack_0_11553 | # Copyright (c) 2016, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSHelperFn, AWSObject, AWSProperty, Tags
from .validators import boolean, integer, positive_integer
class SourceAuth(AWSProperty):
props = {
'Resource': (basestring, False),
... |
the-stack_0_11554 | import sys
sys.path.append('.')
from util.game import Game
from util.func import Case
from util.card import Card, CardList, CardSuit
from util.player import Player
from typing import List, Optional, Tuple
import random
class LevelUp(Game):
### Constants
PLAYERNUM: int = 4
CARDPOOL: List[Card] = [Card(i) fo... |
the-stack_0_11555 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
""" Read data from the magnetometer and print it out, ASAP! """
import board
import adafruit_lsm303dlh_mag
i2c = board.I2C() # uses board.SCL and board.SDA
sensor = adafruit_lsm303dlh_mag.LSM303DLH_Mag(i2c)
whi... |
the-stack_0_11556 | '''
File: pathtracker.py
Path tracking simulation with Stanley steering control and PID speed control.
author: Atsushi Sakai (@Atsushi_twi)
Ref:
- [Stanley: The robot that won the DARPA grand challenge](http://isl.ecst.csuchico.edu/DOCS/darpa2005/DARPA%202005%20Stanley.pdf)
- [Autonomous Automobile Path Tracki... |
the-stack_0_11557 | import os
import json
from tabulate import tabulate
from hyperopt import Trials, STATUS_OK, tpe
from hyperas import optim
from hyperas.distributions import choice, uniform
from keras.layers import Dense, Dropout, Input, LSTM
from keras.constraints import maxnorm
from keras.callbacks import EarlyStopping, ModelCheckpoin... |
the-stack_0_11559 | """Support for deCONZ binary sensors."""
from pydeconz.sensor import Presence, Vibration
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.const import ATTR_TEMPERATURE
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
... |
the-stack_0_11560 | #!/usr/bin/env python
"""settings.py
Udacity conference server-side Python App Engine app user settings
$Id$
created/forked from conference.py by wesc on 2014 may 24
"""
# Replace the following lines with client IDs obtained from the APIs
# Console or Cloud Console.
WEB_CLIENT_ID = '1009053430959-tdqqi86iai9gdqlo... |
the-stack_0_11561 | import subprocess
import logging
import sys
from contextlib import contextmanager
@contextmanager
def maybe_open1(out):
if isinstance(out, str):
with open(out, "ab") as f:
yield f
else:
yield out
@contextmanager
def maybe_open2(stdout, stderr):
with maybe_open1(stdout) as fou... |
the-stack_0_11562 | import numpy as np
def calc_jacobian(frames: list, transformations: dict, jsize: int) -> np.array:
"""
Args:
frames (list): frames to compute jacobian
transformations (dict): transformations from forward kinematics
thetas (int): size of joint space
Returns:
Jacobian (np.arr... |
the-stack_0_11564 | """
Copyright (c) 2018-2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
the-stack_0_11566 | from DataUploader.PgsqlDataUploader import PgsqlDataUploader
def clean():
input_file = 'csvfiles.json'
uploader = PgsqlDataUploader(input_file)
uploader.run_script("sql/AdventureWorks_postgres_drop.sql")
uploader.clean_up()
def prepare():
input_file = 'csvfiles.json'
uploader = PgsqlDataUp... |
the-stack_0_11567 |
import sys
from rlpyt.utils.launching.affinity import affinity_from_code
from rlpyt.samplers.parallel.gpu.sampler import GpuSampler
from rlpyt.samplers.parallel.gpu.collectors import GpuWaitResetCollector
from rlpyt.envs.atari.atari_env import AtariEnv, AtariTrajInfo
from rlpyt.algos.pg.a2c import A2C
from rlpyt.agen... |
the-stack_0_11569 | #!/usr/bin/env python
"""
model.py
Self defined model definition.
Usage:
"""
from __future__ import absolute_import
from __future__ import print_function
import sys
import numpy as np
import torch
import torch.nn as torch_nn
import torchaudio
import torch.nn.functional as torch_nn_func
import sandbox.block_nn as n... |
the-stack_0_11571 | from django.conf.urls import url
from . import views
urlpatterns = [
url(r"^$", views.PostListView.as_view(), name="post_list"),
url(r'^about/$', views.AboutView.as_view(), name='about'),
url(r"^post/(?P<pk>\d+)$", views.PostDetailView.as_view(), name="post_detail"),
url(r"^post/new/$", views.CreatePos... |
the-stack_0_11572 | from django.db import migrations
def create_site(apps, schema_editor):
Site = apps.get_model("sites", "Site")
custom_domain = "sana-khan-34437.botics.co"
site_params = {
"name": "Sana Khan",
}
if custom_domain:
site_params["domain"] = custom_domain
Site.objects.update_or_crea... |
the-stack_0_11573 | # Import Flask
from flask import Flask, jsonify
# Dependencies and Setup
import numpy as np
import datetime as dt
# Python SQL Toolkit and Object Relational Mapper
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from sqlal... |
the-stack_0_11575 | import math
def get_odd(n):
while True:
if n%2:
return n
n//=2
def solve():
n=int(input())
c='Ashishgup'
o='FastestFinger'
while True:
if n<=1:
print(o)
break
if (n%2) or n==2:
print(c)
break
if ... |
the-stack_0_11576 | # -*- coding=utf-8 -*-
import os
from setuptools import setup, find_packages
DIR_PATH = os.path.dirname(os.path.abspath(__file__))
LONGDOC = '''
jionlp
================================================================================
面向公司算法和使用部门提供算法api接口
安装方法:
代码使用 Python 3
- 半自动安装:
$ git clone http://git.... |
the-stack_0_11577 | """
This file offers the methods to automatically retrieve the graph Rhizobium leguminosarum viciae 3841.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: pro... |
the-stack_0_11578 | # -*- coding: utf-8 -*-
__author__ = 'ooo'
__date__ = '2019/1/15 12:17'
import math, torch
import torch.nn as nn
import torch.nn.functional as F
class ViewLayer(nn.Module):
def __init__(self, dim=-1):
super(ViewLayer, self).__init__()
self.dim = dim
def forward(self, x):
# print('vie... |
the-stack_0_11579 | import time
import sqlalchemy_1_3 as tsa
from sqlalchemy_1_3 import create_engine
from sqlalchemy_1_3 import event
from sqlalchemy_1_3 import exc
from sqlalchemy_1_3 import Integer
from sqlalchemy_1_3 import MetaData
from sqlalchemy_1_3 import pool
from sqlalchemy_1_3 import select
from sqlalchemy_1_3 import String
fr... |
the-stack_0_11580 | # pylint: disable=C,R,W
from datetime import datetime, timedelta
import inspect
import logging
import os
import re
import time
import traceback
from urllib import parse
from flask import (
flash, g, Markup, redirect, render_template, request, Response, url_for,
)
from flask_appbuilder import expose, SimpleFormView... |
the-stack_0_11581 | from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect, \
get_object_or_404 # redirect consegue mandar uma pessoa p uma url, no caso a person_list
# get object é para pegar o objeto do usuário e caso não consiga, retorna um 404
from .models import Pessoa
from .forms... |
the-stack_0_11584 | # Copyright 2016 - Nokia Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
the-stack_0_11588 | import copy
import random
import time
from functools import partial
from sklearn.utils import shuffle
import numpy as np
from sklearn import linear_model
from dnl import Sampling_Methods, Solver
from dnl.PredictPlustOptimizeUtils import compute_C_k
from dnl.Solver import get_optimization_objective
from dnl.Utils impo... |
the-stack_0_11589 | '''
Copyright Vulcan Inc. 2018-2020
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://www.apache.org/licenses/LICENSE-2.0
or in the "license" file accompanying this file. This file is d... |
the-stack_0_11591 | # postgresql/psycopg2.py
# Copyright (C) 2005-2019 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
r"""
.. dialect:: postgresql+psycopg2
:name: psycopg2
:dbapi: psycopg2... |
the-stack_0_11592 | from __future__ import absolute_import
import os
import posixpath
import pysvn
from cobra.core.constants import README_MARKUPS
from cobra.core.markup import rest2html, can_markup, is_markdown, is_rst, is_plain
from cobra.core.markdown import markdown
def get_readme(repository, path='', revision=None):
# 1 - ... |
the-stack_0_11593 | # coding: utf-8
# Copyright (c) Scanlon Materials Theory Group
# Distributed under the terms of the MIT License.
"""
A script to calculate and plot optical spectra from ab initio calculations.
"""
import os
from glob import glob
import sys
import logging
import warnings
import argparse
from collections import Ordered... |
the-stack_0_11594 | # Copyright 2014 Cisco Systems, 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 o... |
the-stack_0_11595 | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
import glob
import json
import os
def main(blastdir):
print('Populating organism selftargeting spacer objects')
for fn in glob.glob(blastdir + '/*.json'):
# get loci intervals of organism
accession = os.path.splitext(os.path.split(fn)[1])[0]
... |
the-stack_0_11597 | """This module implements row model of MUFG bank CSV."""
from __future__ import annotations
from abc import ABC
from dataclasses import dataclass
from datetime import datetime
from enum import Enum
from typing import Optional
from zaimcsvconverter.file_csv_convert import FileCsvConvert
from zaimcsvconverter.inputcsvf... |
the-stack_0_11598 | # coding=utf-8
# Copyright 2022 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... |
the-stack_0_11599 | """ A Qt API selector that can be used to switch between PyQt and PySide.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import os
import sys
from matplotlib import rcParams, verbose
# Available APIs.
QT_API_PYQT = 'PyQt4' # API is no... |
the-stack_0_11600 | from pygame import *
from random import *
from time import time as timer
win_widh = 1000
win_hight = 400
win = display.set_mode((win_widh, win_hight))
display.set_caption('Plants')
ImegHero = 'Woodman.png'
ImeBack = 'Forest.png'
ImeAnemi = 'BigCliz.png'
img_bullet = 'Ball.png'
TimeNow = timer()
Time... |
the-stack_0_11601 | # pylint: disable=g-direct-third-party-import
# pylint: disable=g-bad-file-header
# Copyright 2017 The Bazel 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
#
# ... |
the-stack_0_11603 | # Copyright 2016 PerfKitBenchmarker 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 appli... |
the-stack_0_11604 | """Load a layout in Blender."""
from pathlib import Path
from pprint import pformat
from typing import Dict, Optional
import bpy
import json
from avalon import api
from avalon.blender.pipeline import AVALON_CONTAINERS
from avalon.blender.pipeline import AVALON_CONTAINER_ID
from avalon.blender.pipeline import AVALON_... |
the-stack_0_11606 | # Copyright 2019 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
the-stack_0_11607 | import re
import django.forms
def get_cleaned_text_file_content(uploaded_file):
"""Read uploaded file, try to fix up encoding to UTF-8 and
transform line endings into Unix style, then return the content as
a UTF-8 string. Errors are reported as
django.forms.ValidationError exceptions."""
if not u... |
the-stack_0_11609 | #!/usr/bin/python3
import spidev
import time
tx_array = [0]*512
# Split an integer input into a two byte array to send via SPI
def write_pot(input):
print(input)
msb = input >> 8
lsb = input & 0xFF
print(spi.xfer([msb,lsb,msb,lsb]))
if __name__ == '__main__':
spi = spidev.SpiDev()
ret = spi.... |
the-stack_0_11610 |
safety_hotline_meta = {
'attributes': {
'primary': {
'field': 'description',
'name': 'Description',
},
'secondary': {
'field': None,
'name': None,
},
},
'dates': {
'date_attribute': 'date_created',
'date_granularity': 'year',
'default_date_filter': '2017',
... |
the-stack_0_11612 | #cfgfactory.py
import utility
import numpy.random
import cfg
import logging
class CFGFactory:
def __init__(self):
self.number_terminals = 100
self.number_nonterminals = 5
self.binary_rules = 40
self.lexical_rules = 100
self.strict_cnf = True
def generate_nonterminals(self):
nonterminals = [ 'S']
for... |
the-stack_0_11614 | from PIL import Image
class Painter:
def __init__(self, k, palette_name, color):
self.k = k
self.palette_name = palette_name
self.color = color
self.ctr = 0 # for frames
def format_frame(self,n):
return f"frames/{self.palette_name}-{self.k}-{n}.png"
def current_frame_name(self):
self.ctr += 1
return... |
the-stack_0_11615 | # This file is a part of OpenCV project.
# It is a subject to the license terms in the LICENSE file found in the top-level directory
# of this distribution and at http://opencv.org/license.html.
#
# Copyright (C) 2018, Intel Corporation, all rights reserved.
# Third party copyrights are property of their respectiv... |
the-stack_0_11616 | import datetime
import os
import time
from uuid import UUID, uuid4
from django import forms as django_forms, http
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.core.files.storage import default_storage as storage
from django.db import transaction
from django.db.model... |
the-stack_0_11619 | """LSTM Controller."""
import torch
from torch import nn
from torch.nn import Parameter
import numpy as np
# torch.set_default_tensor_type('torch.cuda.FloatTensor')
class LSTMController(nn.Module):
"""An NTM controller based on LSTM."""
def __init__(self, num_inputs, num_outputs, num_layers):
super(LS... |
the-stack_0_11620 | import requests
import os
import zipfile
def unzipper(file_path, dirname):
with zipfile.ZipFile(file_path) as zf:
files = zf.namelist()
zf.extractall(dirname)
def download_http(url, file_path):
r = requests.get(url)
with open(file_path, "wb") as f:
f.write(r.content)
def downlo... |
the-stack_0_11624 | '''
OpenIMU SPI package version 0.2.0.
-pip install spidev3.4,
-read package through SPI interface, OpenIMU330BI test on Pi3 board(Raspbian OS,Raspberry 3B+).
-Spi slave: OpenIMU 330 EVK
-Pins connection:
Pi3 330/300 evk
miso <==> miso
mosi <==> mosi
sck <==> ... |
the-stack_0_11625 | import struct
from django.forms import ValidationError
from .const import (
BANDTYPE_FLAG_HASNODATA, GDAL_TO_POSTGIS, GDAL_TO_STRUCT,
POSTGIS_HEADER_STRUCTURE, POSTGIS_TO_GDAL, STRUCT_SIZE,
)
def pack(structure, data):
"""
Pack data into hex string with little endian format.
"""
return struc... |
the-stack_0_11626 | # -*- coding: utf-8 -*-
from django.db import migrations
import organizations.fields
class Migration(migrations.Migration):
dependencies = [("organizations", "0001_initial")]
operations = [
migrations.AlterField(
model_name="organization",
name="slug",
field=orga... |
the-stack_0_11627 | # (C) Copyright [2020] Hewlett Packard Enterprise Development LP
#
# 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,... |
the-stack_0_11628 | from twython import Twython
def read_strings_from_file(file_path, how_many):
with open(file_path, 'r') as file:
data = file.read()
return data.split()[:how_many]
def read_key_and_secret(file_path):
return read_strings_from_file(file_path, 2)
def read_token_secret_pin(file_path):
return rea... |
the-stack_0_11632 | #
# Copyright (c) 2017, Massachusetts Institute of Technology 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 notice, this
# list o... |
the-stack_0_11636 | from django.http import HttpResponse
from django.shortcuts import render
from django.contrib import messages
from django.http import HttpResponseRedirect
from cfbets.forms import SignUpForm, UserProfileForm
from django.contrib.auth import authenticate, login
from django.contrib.auth.decorators import login_required
fro... |
the-stack_0_11637 | # Copyright (c) OpenMMLab. All rights reserved.
import os
import os.path as osp
from .base_vfi_dataset import BaseVFIDataset
from .registry import DATASETS
@DATASETS.register_module()
class VFIVimeo90K7FramesDataset(BaseVFIDataset):
"""Utilize Vimeo90K dataset (7 frames) for video frame interpolation.
Load ... |
the-stack_0_11639 | """ This process performs a restore of all the application entities from a
given restore.
"""
import argparse
import logging
import os
from appscale.common import appscale_info
from ..backup.datastore_restore import DatastoreRestore
from ..dbconstants import APP_ENTITY_SCHEMA
from ..dbconstants import APP_ENTITY_TABLE... |
the-stack_0_11640 | """Helper sensor for calculating utility costs."""
from __future__ import annotations
from dataclasses import dataclass
from functools import partial
from typing import Any, Final, Literal, TypeVar, cast
from homeassistant.components.sensor import (
ATTR_LAST_RESET,
DEVICE_CLASS_MONETARY,
STATE_CLASS_MEAS... |
the-stack_0_11644 | # Copyright 2018 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_0_11647 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import copy
import logging
import math
from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from reagent import types as rlt
from reagent.core.configuration import param_hash
from re... |
the-stack_0_11648 | # -*- coding: utf-8 -*-
"""Vertical structure functions for ROMS
:func:`sdepth`
Depth of s-levels
:func:`zslice`
Slice a 3D field in s-coordinates to fixed depth
:func:`multi_zslice`
Slice a 3D field to several depth levels
:func:`z_average`
Vertical average of a 3D field
:func:`s_stretch`
Compute vertical ... |
the-stack_0_11652 | import subprocess
import os
import urllib.request
import sys
from typing import Optional
from conapp.file_paths import get_snapshot_filename
from conapp.validate import validate_subprocess
from conapp.definitions import USER_HOME_DIR, DEFAULT_STRIP_COMPONENTS
def apply_config(file_name: str) -> None:
"""
A w... |
the-stack_0_11653 | from django.conf.urls import url
from . import views
app_name = 'polls'
urlpatterns = [
# ex: /polls/
url(r'^$', views.IndexView.as_view(), name='index'),
# ex: /polls/5/
url(r'^(?P<pk>[0-9]+)/$', views.DetailView.as_view(), name='detail'),
# ex: /polls/5/results/
url(r'^(?P<pk>[0-9]+)/result... |
the-stack_0_11655 | from typing import Tuple
import PIL
import torch
import torchvision.transforms as transforms
from .datasets import DATASET_STATS, SUPPORTED_DATASETS
from .gaussian_blur import GaussianBlur
class SimCLRDataTransform:
"""Applies augmentations to sample two times, as described in SimCLR paper"""
def __init_... |
the-stack_0_11656 | import reveallib
import reveallib64
from utils import *
from multiprocessing.pool import Pool
import signal
import os
import math
import argparse
import logging
import intervaltree
import matplotlib
import sortedcontainers
import time
def plot(plt,anchors,sep,wait=True,nc='r',rc='g',color=None,edges=False,lines=False,... |
the-stack_0_11658 | # ------------------------------------------------------------------------------
# Training code.
# Example command:
# python -m torch.distributed.launch --nproc_per_node=4 tools/train_net.py --cfg PATH_TO_CONFIG_FILE
# Written by Bowen Cheng (bcheng9@illinois.edu)
# ----------------------------------------------------... |
the-stack_0_11659 | # 利用鸢尾花数据集,实现前向传播、反向传播,可视化loss曲线
# 导入所需模块
import tensorflow as tf
from sklearn import datasets
from matplotlib import pyplot as plt
import numpy as np
import time ##1##
# 导入数据,分别为输入特征和标签
x_data = datasets.load_iris().data
y_data = datasets.load_iris().target
# 随机打乱数据(因为原始数据是顺序的,顺序不打乱会影响准确率)
# seed: 随机... |
the-stack_0_11660 | import cgi
import re
import urllib.parse
import warnings
from collections import defaultdict
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
from typing import Dict
from typing import Iterator
from typing import List
from typing import Optional
import requests
import requests.auth
fr... |
the-stack_0_11661 | '''
Client.Processor.* tests.
'''
from tests.integration.util import (
create_client
)
import pytest
import plaid
import json
from plaid.model.processor_token_create_request import ProcessorTokenCreateRequest
from plaid.model.processor_stripe_bank_account_token_create_request import ProcessorStripeBankAccountTokenC... |
the-stack_0_11664 | import pathlib
from setuptools import setup, find_packages
BASE_DIR = pathlib.Path(__file__).parent
PACKAGE_NAME = 'nlp_api'
VERSION = '0.0.01'
AUTHOR = 'Aivin V. Solatorio'
URL = 'https://github.com/avsolatorio/wb_nlp/app/nlp_api'
LICENSE = 'MIT'
DESCRIPTION = 'Python API'
INSTALL_REQUIRES = ['fastapi']
# Settin... |
the-stack_0_11666 | """
This is a sample simulation that does not represent any particular biological system. It is just a showcase
of how create a Simulation object, add forces, and initialize the reporter.
In this simulation, a simple polymer chain of 10,000 monomers is
"""
import time
import numpy as np
import os, sys
import polych... |
the-stack_0_11667 | """
Command line tool to copy experiment metadata from one NeXus file to the other.
"""
import sys
import logging
import argparse
import freephil
from pathlib import Path
from . import (
version_parser,
full_copy_parser,
tristan_copy_parser,
)
from ..nxs_copy import CopyNexus, CopyTristanNexus
# Define... |
the-stack_0_11669 | #
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
the-stack_0_11670 |
if __name__ != "__main__":
import csv
import time
import pandas as pd
class ObrasBot():
def __init__(self, browser, portal_url, categorias, veiculo, nome_csv, *colunas):
self.browser = browser
self.categorias = [c.upper() for c in categorias]
self.veiculo... |
the-stack_0_11671 | # -*- coding: utf-8 -*-
# Copyright 2018-2019 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 applicabl... |
the-stack_0_11672 |
from torchvision.transforms import ToPILImage
from datasets.data_utils import DatasetOutput, default_transform
from typing import Callable
from PIL import Image
from .data_utils import slide_windows_over_img, DatasetOutput
import torch
import torch.nn as nn
from torch.utils.data import Dataset
class GenericImageDatas... |
the-stack_0_11676 | import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt
img = cv.imread('img/entrada/folha-de-mamao-menor.jpg',0)
edges = cv.Canny(img,100,200)
plt.subplot(121),plt.imshow(img,cmap = 'gray')
plt.title('Original Image'), plt.xticks([]), plt.yticks([])
plt.subplot(122),plt.imshow(edges,cmap = 'gray')
plt... |
the-stack_0_11677 | # coding=utf-8
# Copyright 2021 TF-Transformers Authors and 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/licens... |
the-stack_0_11678 | #!/usr/bin/python
"""
Convert polarised CST element files to OSKAR scalar element pattern format.
"""
from __future__ import print_function
import sys
import numpy
def load_cst_file(filename):
""""
Loads a CST element pattern file into a numpy matrix.
Parameters
----------
filename : string
... |
the-stack_0_11679 | import asyncio
from datetime import datetime
import io
import os
from pathlib import Path
from telethon import events, functions, types
from telethon.tl.types import InputMessagesFilterDocument
from . import *
@bot.on(phoenix_cmd(pattern=r"cmds"))
@bot.on(sudo_cmd(pattern=r"cmds", allow_sudo=True))
async def kk(eve... |
the-stack_0_11682 | #!/usr/bin/python
#
# sslsniff Captures data on read/recv or write/send functions of OpenSSL and
# GnuTLS
# For Linux, uses BCC, eBPF.
#
# USAGE: sslsniff.py [-h] [-p PID] [-c COMM] [-o] [-g] [-d]
#
# Licensed under the Apache License, Version 2.0 (the "License")
#
# 12-Aug-2016 Adrian Lopez C... |
the-stack_0_11683 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import json
import time
import logging
from . import builder_config
from .utils import save_profiled_results, merge_info
from nn_meter.builder.backends import connect_backend
logging = logging.getLogger("nn-Meter")
def convert_models(b... |
the-stack_0_11685 | import numpy as np
class KNN:
"""
K-neariest-neighbor classifier using L1 loss
"""
def __init__(self, k=1):
self.k = k
def fit(self, X, y):
self.train_X = X
self.train_y = y
def predict(self, X, num_loops=0):
'''
Uses the KNN model to predict clases fo... |
the-stack_0_11687 |
"""Class :py:class:`CMDBBUtils` utilities for calib manager DB methods
==============================================================================
Usage ::
# Test: python lcls2/psana/psana/graphqt/CMDBUtils.py
# Import
from psana.graphqt.CMDBUtils import dbu
# See test at the EOF
See:
- :clas... |
the-stack_0_11688 | # Copyright 2021 The Private Cardinality Estimation Framework 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 b... |
the-stack_0_11689 | import torch
torch.cuda.manual_seed(3)
torch.manual_seed(3)
import data_handler, tracking_nn
import sys
from torch.optim import Adam
flag = int(sys.argv[1])
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
print("Working on", device)
batch_size = 32
cnn = tracking_nn.CNN().to(device)
if flag... |
the-stack_0_11691 | import numpy as np
import multidim
import itertools
import os
import hdbscan
import sys
import time
import pandas as pd
from copy import deepcopy
from matplotlib.patches import Ellipse
from ripser import ripser
from persim import plot_diagrams
from numba import jit, njit, prange
from sklearn import mixtu... |
the-stack_0_11692 | from os.path import abspath, join, dirname
from sys import path
from envs.keys_and_passwords import *
PROJECT_ROOT = abspath(join(dirname(__file__), "../"))
APPS_DIR = abspath(join(dirname(__file__), "../", "apps"))
path.insert(0, PROJECT_ROOT)
path.insert(0, APPS_DIR)
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (... |
the-stack_0_11693 | #!/usr/bin/env python3
import argparse
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
from litex.soc.integration.soc_core import *
from litex.soc.integration.builder import *
from litex_boards.platforms import arty
from ring import *
# CRG --------------------------------------------... |
the-stack_0_11694 | import os, sys
import math
import numpy as np
import cv2
from PIL import Image, ImageDraw, ImageFont
import argparse
def parse_args():
def str2bool(v):
return v.lower() in ("true", "t", "1")
parser = argparse.ArgumentParser()
# params for prediction engine
parser.add_argument("--use_gpu", type... |
the-stack_0_11695 | """
Generic setup of the data sources and the model training.
Based on:
https://github.com/fchollet/keras/blob/master/examples/mnist_mlp.py
and also on
https://github.com/fchollet/keras/blob/master/examples/mnist_cnn.py
"""
import logging
# Keras
from keras.models import Sequential
from keras.layers import D... |
the-stack_0_11696 | # Copyright 2019 Christo Kirov. 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 ... |
the-stack_0_11697 | import tensorflow as tf
class GAINGenerator(object):
"""This is class to impute missing value with proper values from
observed data and missing mask (0/1 flags indicating missing value)
"""
def __init__(self):
pass
def generate(self, x, m, z, drop):
"""Generate candidate values to ... |
the-stack_0_11698 | import unittest2
import os
import tempfile
import shutil
import pip
from hoplite.client.status_updater import MockStatusUpdater
from hoplite.builtin_plugins.constants import InstallPythonPackageJobConstants as KEYS
from hoplite.builtin_plugins import install_python_package_job
from httmock import urlmatch, response, HT... |
the-stack_0_11701 | from decimal import Decimal as D
from oscar.core.loading import get_class
from oscar.test import factories
Default = get_class('partner.strategy', 'Default')
def add_product(basket, price=None, quantity=1, product=None):
"""
Helper to add a product to the basket.
"""
has_strategy = False
try:
... |
the-stack_0_11702 | import pytest
import spacy
from spacy.language import Language
from timexy.languages.en import en
label = "timexy_label"
lang = "en"
@pytest.fixture()
def nlp() -> Language:
nlp = spacy.blank(lang)
nlp.add_pipe("timexy", config={"label": label})
return nlp
test_data = [t for rule in en.rules for t in ... |
the-stack_0_11703 | #AQUÍ irán las pruebas que se realicen sobre GitHub.
#Importamos las librerías necesarias.
from github import Github
from github.GithubException import UnknownObjectException
import aux_functions as aux
import dataF_functions as d
import ci_tools as ci
import github_search as ghs
# import openpyxl --> esta hay que ins... |
the-stack_0_11704 | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import errno
import ... |
the-stack_0_11705 | from django.test import TestCase
from .models import Item
class TestModels(TestCase):
def test_new_item_defaults_to_done_false(self):
item = Item.objects.create(name="Test DoneFalse Item")
self.assertFalse(item.done)
def test_item_string_method_returns_name(self):
item_name ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.