filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_16295 | # -*- coding: utf-8 -*- #
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
the-stack_106_16296 |
import pytorch_lightning as pl
import hydra
import torch
import yaml
import os
import numpy as np
from lib.snarf_model import SNARFModel
@hydra.main(config_path="config", config_name="config")
def main(opt):
print(opt.pretty())
pl.seed_everything(42, workers=True)
torch.set_num_threads(10)
# data... |
the-stack_106_16299 | import sys
import os
import re
INPUT_DIR = os.path.join('..', 'converted')
PREFIX = '''\\documentclass[a4paper]{article}
\\makeatletter
\\renewcommand\\tableofcontents{%
\\@starttoc{toc}%
}
\\makeatother
\\linespread{1.2}
\\usepackage[russian]{babel}
\\usepackage{csquotes}
\\usepackage{fontspec}
\\setmainfont{... |
the-stack_106_16300 | import argparse
import logging
import os
from builder.build_phrasal_thesauri_offline import get_corpus_features_cmd_parser
from discoutils.misc import force_symlink
'''
If using SVD, symlink the reduced vectors for all unigrams and NPs (done by build_phrasal_..
as as part of training Baroni) to the right location.
Ot... |
the-stack_106_16303 | import geopandas as gpd
from pathlib import Path
from osgeo import gdal
import rasterio
import shutil
import subprocess
import tempfile
from tqdm import tqdm
from ..raster.gdalutils import rasterize
from ..raster.gdalutils import PROXIMITY_PATH
def calc_distance_to_border(polygons, template_raster, dst_raster, over... |
the-stack_106_16304 | import datetime
from sqlalchemy import and_
from app.cruds.table_repository import TableRepository
from db import models
class EmailDetailsCrud(TableRepository):
def __init__(self, db) -> None:
super().__init__(db=db, entity=models.EmailDetails)
def create_message_details(self, subject: str,
... |
the-stack_106_16307 | # 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_106_16308 | from __future__ import print_function
import os
import pathlib
from box import Box, BoxList
from PIL import Image
import requests
import yaml
SLACKMOJI_DL_DIR = 'downloaded'
# https://stackoverflow.com/questions/25108581/python-yaml-dump-bad-indentation
class MyDumper(yaml.Dumper):
def increase_indent(self, fl... |
the-stack_106_16311 | '''
Create and run workflow
Uses
https://github.com/couler-proj/couler
'''
import os
import json
import urllib
import couler.argo as couler
from couler.argo_submitter import ArgoSubmitter
from . import cargo
from ExecutionEnvironment.executor import (
setup_bash_patterns,
BaseExecutor,
Workflow,
)
clas... |
the-stack_106_16313 | import os
import ssl
import smtplib
from typing import Optional, List
from email.utils import formatdate
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
class Gmail:
def __init__(self, from_: str, to: Optional[str] = None, cc:... |
the-stack_106_16314 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas.geometry import scale_vector
from compas.geometry import normalize_vector
from compas.geometry import add_vectors
from compas.geometry import subtract_vectors
from compas.geometry import cross_vecto... |
the-stack_106_16315 | # Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from datadog_api_client.v2.model_utils import (
ModelNormal,
cached_property,
... |
the-stack_106_16317 | # -*- coding: utf-8 -*-
"""
Compute the shortest paths and path lengths between nodes in the graph.
These algorithms work with undirected and directed graphs.
For directed graphs the paths can be computed in the reverse
order by first flipping the edge orientation using R=G.reverse(copy=False).
"""
# Copyright (C... |
the-stack_106_16319 | # -*- coding: utf-8 -*-
import torch
def aeq(*args):
"""
Assert all arguments have the same value
"""
arguments = (arg for arg in args)
first = next(arguments)
assert all(arg == first for arg in arguments), \
"Not all arguments have the same value: " + str(args)
def sequence_mask(le... |
the-stack_106_16320 | from docplex.mp.model import Model
import docplex.mp.solution as Solucion
import numpy as np
print(Solucion)
n=11
ciudades=[i for i in range(n)] # Creamos ciudades de la 0 a la 9
arcos =[(i,j) for i in ciudades for j in ciudades if i!=j]
random=np.random
random.seed(1)
coord_x=random.rand(n)*100
coord_y=random.rand... |
the-stack_106_16321 | #!/usr/bin/env python3
import math
import re
import itertools
import networkx as nx
def parse(line):
m = re.match(r'(\S+) to (\S+) = (\d+)', line)
if m:
return m.group(1), m.group(2), int(m.group(3))
def part1(filename):
with open(filename) as f:
lines = f.readlines()
G = nx.Graph... |
the-stack_106_16323 | from datapackage_pipelines.wrapper import ingest, spew
import logging
def main():
parameters, datapackage, resources, stats = ingest() + ({},)
bills = {}
israel_law_bill_ids = {}
for bill in next(resources):
bill['law_ministry_ids'] = []
bills[bill['BillID']] = bill
if bill['Is... |
the-stack_106_16324 | import os
import dcp.utils as utils
import torch
import torch.nn as nn
__all__ = ["CheckPoint"]
class CheckPoint(object):
"""
save model state to file
check_point_params: model, optimizer, epoch
"""
def __init__(self, save_path, logger):
self.save_path = os.path.join(save_path, "check_... |
the-stack_106_16325 | from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.shortcuts import render, redirect, get_object_or_404
from friendship.exceptions import AlreadyExistsError
from friendship.models import Follow
from .models import Image, Profile, Comments
from .forms impor... |
the-stack_106_16326 | #
# Copyright (c) 2018 Institute for Basic Science
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge... |
the-stack_106_16328 | import argparse
import numpy as np
import os
import torch
import torch.nn as nn
from torchvision import datasets, transforms
from models import *
# Prune settings
parser = argparse.ArgumentParser(description='PyTorch Slimming CIFAR prune')
parser.add_argument('--dataset', type=str, default='cifar10',
... |
the-stack_106_16335 | #!/usr/bin/env python
# encoding: utf-8
import os
import sys
import subprocess
sys.path.append( os.path.join(os.path.dirname(__file__), '..') )
from plasma.client.client import Client
from plasma_tools.config import tools_config
def process_cmd(command, raise_exception=True):
command = "python plasma_tools/cli.... |
the-stack_106_16338 | # -*- test-case-name: xquotient.test.historic.test_mta3to4 -*-
from axiom.test.historic.stubloader import saveStub
from axiom.dependency import installOn
from xquotient.mail import MailTransferAgent
def createDatabase(store):
"""
Create a MailTransferAgent with both SMTP and SMTP/SSL configured in the
g... |
the-stack_106_16340 | from sqlalchemy.orm import mapper, relationship
from sqlalchemy import Table, Column, Date, Integer, String, MetaData, ForeignKey
from domain import model
metadata = MetaData()
order_lines = Table(
'order_lines', metadata,
Column('id', Integer, primary_key=True, autoincrement=True),
Column('orderid', Str... |
the-stack_106_16341 | from django.urls import NoReverseMatch
from django.utils import html
from corehq.apps.api.es import ReportCaseESView, ReportFormESView
from corehq.apps.es import filters
from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumn
from corehq.apps.reports.filters.base import BaseSingleOptionFilter
fro... |
the-stack_106_16342 | #!/usr/bin/env python3
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
im... |
the-stack_106_16343 | #
# (c) 2017 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is d... |
the-stack_106_16345 | # -*- coding: utf-8 -*-
"""
Tests of DAK handling.
"""
import sys
import shutil
import time
import platform
import os
import json
import unittest
import datetime
# Disable all import warnings since the imports are pretty hacky
#pylint: disable=import-error,wrong-import-order,wrong-import-position
sys.path.append('../l... |
the-stack_106_16346 | import coremltools as ct
import numpy as np
import tensorflow as tf
path = r"C:\Users\Administrator\Desktop\yolov4-keras_stapler\pb\saved_model.pb"
# Load the protobuf file from the disk and parse it to retrieve the
# graph_def
with tf.io.gfile.GFile(path, "rb") as f:
graph_def = tf.compat.v1.GraphDef()
graph... |
the-stack_106_16347 | import asyncio
import logging
import types
from collections import defaultdict
from typing import Dict
logger = logging.getLogger(__name__)
class EventManager:
__subscribers: Dict = defaultdict(set)
@classmethod
def subscribe(cls, subscriber, event):
cls.__subscribers[event].add(subscriber)
... |
the-stack_106_16349 | # -*- coding: utf-8 -*-
"""
Created on Sun Jan 24 19:35:05 2021
@author: Jireh Jam
"""
from __future__ import print_function, division
from keras.applications import VGG19
from keras.layers import Input, Dense, Flatten, Dropout, Concatenate, Multiply, Lambda, Add
from keras.layers import BatchNormalizatio... |
the-stack_106_16350 | #
# Copyright 2014 Grupo de Sistemas Inteligentes (GSI) DIT, UPM
#
# 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
#
# Unles... |
the-stack_106_16352 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
# - Generated by tools/entrypoint_co... |
the-stack_106_16353 | #!/usr/bin/env python
import os,sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
from math import ceil
from time import time
import numpy as np
import cupy as cp
import fire
import h5py
from numba ... |
the-stack_106_16355 |
#注意,要用到谷歌无头浏览器哦,,可以自己去安装,
#教程https://www.jianshu.com/p/11d519e2d0cb
import os
import re
import requests
from tkinter import *
from lxml import etree
# 导入chrome无头浏览器
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
'''
下面的函数作用及功能:
1,获取到要下载书籍的最新(最大)章节,以便后面遍历章节需要。
2,获取到每一章节的名字与url,... |
the-stack_106_16356 | #!/usr/bin/env python3
import argparse
import io
import json
import os
import sys
import copy
from datetime import datetime
from decimal import Decimal
from tempfile import NamedTemporaryFile, mkstemp
from joblib import Parallel, delayed, parallel_backend
from jsonschema import Draft4Validator, FormatChecker
from sin... |
the-stack_106_16357 | #!/usr/bin/env python3
#
# Copyright (c) 2018, Nicola Coretti
# All rights reserved.
import abc
import enum
import numbers
import functools
MAJOR_VERSION = 0
MINOR_VERSION = 4
PATCH_VERSION = 1
VERSION_TEMPLATE = '{major}.{minor}.{patch}'
LIBRARY_VERSION = VERSION_TEMPLATE.format(major=MAJOR_VERSION, minor=MINOR_VER... |
the-stack_106_16358 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2015 clowwindy
#
# 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 r... |
the-stack_106_16359 | import dlib
import numpy as np
import cv2
from PIL import Image
def interpolate_latents(latent_A, latent_B, ratio):
return latent_A + ratio * (latent_B - latent_A)
def interpolate_styles(style_A, style_B, ratio):
if style_A is None or style_B is None:
return
style = []
for s_A, s_B in zip(st... |
the-stack_106_16361 | """
Create a new file inside the actions application directory and name it utils.py
You need to define a shortcut function that will allow you to create new Action
objects in a simple way.
"""
import datetime
from django.utils import timezone
from django.contrib.contenttypes.models import ContentType
fr... |
the-stack_106_16365 | # Copyright 2018-2019 The glTF-Blender-IO authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
the-stack_106_16368 | from __future__ import print_function
import os
from simpleflow import Workflow, activity
@activity.with_attributes(task_list='quickstart', version='example')
def repeat50k(s):
return s * 50000
@activity.with_attributes(task_list='quickstart', version='example')
def length(x):
return len(x)
class JumboF... |
the-stack_106_16369 | '''
grammar.py: an object-oriented implementation of formal grammar
I attempted to create a general-purpose framework for defining formal grammars.
See the example notebook where I create a formal grammar that mimmicks
Barsalou's 1999 Perceptual Symbol Systems framework.
Author: Matthew A. Turner
Date: 2/24/2017
'''
... |
the-stack_106_16371 | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Quicksilver(MakefilePackage):
"""Quicksilver is a proxy application that represents some e... |
the-stack_106_16374 | # Copyright 2016 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... |
the-stack_106_16375 | from requests import Response
class ResponseError(Exception):
"""Raised for all non 200 response code from API methods"""
def __init__(self, response: Response) -> None:
self.response = response
@property
def headers(self):
headers_str = ''
if self.response.headers:
... |
the-stack_106_16376 | import argparse
import ast
import logging
import sys
import traceback
import zmq
import vistrails.core.db.io
from vistrails.core.db.locator import UntitledLocator, FileLocator
from vistrails.core.vistrail.controller import VistrailController
from mldebugger.utils import record_python_run
from mldebugger.pipeline impo... |
the-stack_106_16377 | from sharpy.plans.acts import *
from sharpy.plans.acts.terran import *
from sharpy.plans.require import *
from sharpy.plans.tactics import *
from sharpy.plans.tactics.terran import *
from sharpy.plans import BuildOrder, Step, StepBuildGas
from sc2 import UnitTypeId, Race
from sc2.ids.upgrade_id import UpgradeId
from s... |
the-stack_106_16378 | # 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 ... |
the-stack_106_16379 | #!/usr/bin/env python
# Copyright 2015-2016 Yelp 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 ... |
the-stack_106_16380 | #####################################################################
# #
# camera_server.py #
# #
# Copyright 2016, Monash University ... |
the-stack_106_16382 | """
DEPRECATED soon. (I haven't tested this code since 2014)
This plugin allows you to receive test notifications through HipChat.
Mentions only occur during normal business hours. (Can be changed)
By default, only failure notifications will be sent.
"""
import os
import requests
import logging
import datetime
from no... |
the-stack_106_16383 | import adafruit_tlc5947
import board
import busio
import digitalio
import time
SCK = board.SCK
MOSI = board.MOSI
LATCH = digitalio.DigitalInOut(board.D22)
number_of_boards = 3
number_of_channels = number_of_boards * 24
spi = busio.SPI(clock=SCK, MOSI=MOSI)
tlc5947 = adafruit_tlc5947.TLC5947(spi, LATCH,num_drivers=n... |
the-stack_106_16384 | # coding: utf-8
"""
Swagger Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
OpenAPI spec version: 1.0.0
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/sw... |
the-stack_106_16385 | import csv
import numpy as np
def getDataSource(data_path):
size_of_tv = []
Average_time_spent = []
with open(data_path) as csv_file:
csv_reader = csv.DictReader(csv_file)
for row in csv_reader:
size_of_tv.append(float(row["Size of TV"]))
Average_time_spent.append(f... |
the-stack_106_16387 | from rest_framework import viewsets, status
from rest_framework.response import Response
from rest_framework.permissions import AllowAny
from api.authentication.serializers import RegisterSerializer
class RegisterViewSet(viewsets.ModelViewSet):
http_method_names = ["post"]
permission_classes = (AllowAny,)
... |
the-stack_106_16389 | import importlib
import pathlib
import os
import pandas as pd
import numpy as np
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
from dash.dependencies import Input, Output, State
# constants = importlib.import_module("apps.dash-oil-gas-ternary.consta... |
the-stack_106_16390 | import base64
import datetime
import json
import os
import traceback
import frappe
import jwt
import requests
from requests.auth import HTTPBasicAuth
def validate():
"""
Additional validation to execute along with frappe request
"""
authorization_header = frappe.get_request_header("Authorization", str()).split("... |
the-stack_106_16391 | import marshal
import os
import secrets
import glob
from . import exceptions as _except
from . import polyfill
from .table import Table
from .document import Document
from .chunk import Chunk
from .autogenerateid import AutoGenerateId
from .console import Console
import atexit
name = "tasho"
class Database():
... |
the-stack_106_16392 | from maza.core.exploit import *
from maza.core.http.http_client import HTTPClient
class Exploit(HTTPClient):
__info__ = {
"name": "SIEMENS IP-Camera CCMS2025 Password Disclosure",
"description": "Module exploits SIEMENS IP-Camera CCMS2025 Password Dislosure vulnerability. If target is vulnerable "... |
the-stack_106_16393 | import hashlib
import json
import os
# import shutil
import tempfile
import zipfile
from wsgiref.util import FileWrapper
from django.conf import settings
from django.db import transaction
from django.db.models import Q
from django.http import StreamingHttpResponse, FileResponse
from account.decorators import problem_... |
the-stack_106_16395 |
# set random number generator
np.random.seed(2020)
# initialize step_end, n, t_range, v and syn
step_end = int(t_max / dt)
n = 50
t_range = np.linspace(0, t_max, num=step_end)
v_n = el * np.ones([n, step_end])
syn = i_mean * (1 + 0.1 * (t_max / dt)**(0.5) * (2 * np.random.random([n, step_end]) - 1))
# loop for step_... |
the-stack_106_16396 | #!/usr/bin/env python
##############################################################################
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
################################... |
the-stack_106_16397 | # Copyright 2019-2020 QuantumBlack Visual Analytics Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# THE SOFTWARE IS PROVIDED "AS IS"... |
the-stack_106_16399 | """
===================================
Compare cross decomposition methods
===================================
Simple usage of various cross decomposition algorithms:
- PLSCanonical
- PLSRegression, with multivariate response, a.k.a. PLS2
- PLSRegression, with univariate response, a.k.a. PLS1
- CCA
Given 2 multivari... |
the-stack_106_16400 | import re
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
import torchvision.transforms as transforms
from PIL import Image
import numpy as np
model_urls = {
'densenet121': 'https://download.pytorch.org/... |
the-stack_106_16401 | # Copyright 2020 ponai Consortium
# 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... |
the-stack_106_16404 | """Takes the data from the raw tables and processes it for use in the student timeseries data"""
from pandas import read_csv
from data.research.columns import REFColumns
from util.add_z_score import add_z_score
def extract_research_quality_metrics():
"""Takes the data from the raw tables and prepares it for the ... |
the-stack_106_16405 | # -*- coding: utf-8 -*-
"""
@author: Junxiao Song
"""
from __future__ import print_function
import numpy as np
class Board(object):
"""board for the game"""
def __init__(self, **kwargs):
self.width = int(kwargs.get('width', 8))
self.height = int(kwargs.get('height', 8))
# board state... |
the-stack_106_16407 | import sys
import os
import httplib2
import urllib.request as urllib2
import logging
class Downloader(object):
def __init__(self):
self.filepath = None
def get_filepath(self):
return self.filepath
def download(self, url, path, fallback_filename):
logging.debug("Downloading URL {}"... |
the-stack_106_16408 | """
Defines:
- ResultSet(allowed_results)
Attributes
----------
- allowed
- found
- saved
Methods
-------
- is_saved(result)
- is_not_saved(result)
- clear()
- add(result)
- remove(results)
- _found_result(result)
- update(self, results)
"""
import re
from copy import de... |
the-stack_106_16410 | """distutils.command.build_py
Implements the Distutils 'build_py' command."""
__revision__ = "$Id$"
import os
import sys
from glob import glob
from distutils.core import Command
from distutils.errors import DistutilsOptionError, DistutilsFileError
from distutils.util import convert_path
from distutils import log
c... |
the-stack_106_16411 | # coding=utf-8
# Copyright (C) 2019 ATHENA AUTHORS; Ruixiong Zhang; Lan Yu;
# 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/LICEN... |
the-stack_106_16413 | import base64
import requests
import re
import os
from github import Github
START_COMMENT = '<!--START_SECTION:waka-->'
END_COMMENT = '<!--END_SECTION:waka-->'
listReg = f'{START_COMMENT}[\\s\\S]+{END_COMMENT}'
user = os.getenv("INPUT_USERNAME")
waka_key = os.getenv("INPUT_WAKATIME_API_KEY")
ghtoken = os.getenv("INPU... |
the-stack_106_16415 | # Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. Yo... |
the-stack_106_16416 | #!/usr/bin/env python3
import arrow
from bs4 import BeautifulSoup
import datetime
import re
import requests
import pandas as pd
from pytz import timezone
ab_timezone = 'Canada/Mountain'
def convert_time_str(ts):
"""Takes a time string and converts into an aware datetime object."""
dt_naive = datetime.datet... |
the-stack_106_16417 | #usr/bin/python3.9
from pathlib import Path
class filetypeDetector(object):
FILETYPE_PDF = 'pdf'
FILETYPE_TIFF = 'tiff'
FILETYPE_JPEG = 'jpeg'
FILETYPE_PNG = 'png'
def __init__(self, file_path: str):
self.file = Path(file_path)
def detect(self):
file_handle = open(self.file.re... |
the-stack_106_16418 | from graph.ApplyFunction import ApplyFunction
class Transversal:
def __init__(self, graph, origin, udf):
self.graph = graph
self.origin = origin
self.udf = udf
self.app = ApplyFunction(graph, [])
if origin[0].source:
self.orientation = "successors"
eli... |
the-stack_106_16419 | """
Visitor hierarchy to inspect and/or create IETs.
The main Visitor class is adapted from https://github.com/coneoproject/COFFEE.
"""
from __future__ import absolute_import
import inspect
from collections import Iterable, OrderedDict, defaultdict
from operator import attrgetter
import cgen as c
import numpy as np... |
the-stack_106_16420 | # qubit number=4
# total number=30
import cirq
import qiskit
from qiskit.providers.aer import QasmSimulator
from qiskit.test.mock import FakeVigo
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import ... |
the-stack_106_16421 | from enum import Enum
from engine.assets import GLBFile, GLTFFile
from . import TypedArray, TypedArrayFormat as AFmt
from ..base_types import name_generator, Id
mesh_name = name_generator("Mesh")
# Maps of default attributes exported in a GLTF file
DEFAULT_ATTRIBUTES_MAP = {
"POSITION": "POSITION", "NORMAL": "NOR... |
the-stack_106_16422 | #!/usr/bin/env python
"""
@package mi.dataset.parser.wc_wm_cspp
@file marine-integrations/mi/dataset/parser/wc_wm_cspp.py
@author Jeff Roy
@brief wc_wm Parser for the cspp_eng_cspp dataset driver
Release notes: This is one of 4 parsers that make up that driver
initial release
"""
__author__ = 'Jeff Roy'
__license__ ... |
the-stack_106_16423 |
import matplotlib.cm as cm
import numpy
def collate_family_defining(filename):
"""
scan a filename and list all 'FAMILY-DEFINING' features
"""
oh = open(filename, "rU")
doms = []
for line in oh:
if "FAMILY-DEFINING" in line:
line = line.strip().split()
... |
the-stack_106_16424 | #!/usr/bin/env python
## /*=========================================================================
## Program: Visualization Toolkit
## Module: HeaderTesting.py
## Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
## All rights reserved.
## See Copyright.txt or http://www.kitware.com/Copyright... |
the-stack_106_16426 | # -*- coding: utf-8 -*-
"""
sjkscan.postprocessing
~~~~~~~~~~~~~~~~~~~~~~
Implements all post processing related actions that sjkscan take on a
scanned document.
:copyright: (c) 2016 by Svante Kvarnström
:license: BSD, see LICENSE for more details.
"""
import logging
import os
import re
impor... |
the-stack_106_16428 | # !/usr/bin/python
# -*- coding:utf-8 -*-
# Author: Shengjia Yan
# Date: 2017-10-26
# Email: i@yanshengjia.com
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import logging
import numpy as np
import itertools
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
def load_confusion_ma... |
the-stack_106_16430 | import os
import json
from glob import glob
from hypothesis import target
from matplotlib import patches
import numpy as np
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import torch
class Data():
def __init__(self):
self.VAL_LAB_DIR = glob("/Users/yangdongjae/Desktop/2022/Developing/lecttue-d... |
the-stack_106_16431 | import os
import re
from pathlib import Path
from typing import (
Dict,
Generator,
Iterator,
List,
Optional,
Sequence,
Tuple,
Union,
Set,
)
from projectreport.searcher.rotating_list import RotatingList
from projectreport.tools.expand_glob import all_possible_paths
def read_all_fil... |
the-stack_106_16432 | # -*- coding: utf-8 -*-
# TensorFlow Production Example (Evaluating)
#----------------------------------
#
# We pull together everything and create an example
# of best tensorflow production tips
#
# The example we will productionalize is the spam/ham RNN
# from the RNN Chapter.
import os
import re
import numpy ... |
the-stack_106_16435 | import torch
import pickle
import serialization
from copy import deepcopy
import pytest
def test_pytorch():
arr = torch.ones((128, 256, 256), dtype=torch.float32)
arr[8, 8, 8] = 2
arrpkl = pickle.dumps(arr)
data = [
1, "2", arr,
[3, "4", deepcopy(arr), {"arr": deepcopy(arr)}],
... |
the-stack_106_16436 | # This script prints a list of all in-use devices in an organization
# to sdtout or a file (Devices which are part of a network are considered in-use).
# The fields printed are 'serial' and 'model' separated by a comma (,).
#
# You need to have Python 3 and the Requests module installed. You
# can download the ... |
the-stack_106_16438 | from typing import Callable, Dict, Literal, TypeVar, Union, overload
import anyio.abc
from typing_extensions import ParamSpec
from ...utils import MISSING
from ..base import CommandInteraction
from .base import Callback
from .context import MessageCommand, UserCommand
from .option import CommandType
from .slash impor... |
the-stack_106_16439 | # -*- coding: utf-8 -*-
import os
import re
import shutil
from concurrent.futures import ThreadPoolExecutor
import logging
import asyncio
import discord
from ..core.app import App
from ..sources import crawler_list
from ..utils.uploader import upload
from ..binders import available_formats
logger = logging.getLogger(... |
the-stack_106_16441 | """IPv4 Static Routes Classes."""
from fmcapi.api_objects.apiclasstemplate import APIClassTemplate
from .devicerecords import DeviceRecords
from fmcapi.api_objects.object_services.networkaddresses import NetworkAddresses
from fmcapi.api_objects.object_services.slamonitors import SLAMonitors
from fmcapi.api_objects.obj... |
the-stack_106_16443 | # Determine if a string has all unique characters.
def is_unique(s):
for x in range(0, len(s)):
for y in range(x+1,len(s)):
if s[x]==s[y]:
return False
return True
# Should have used new array with simple 128 hash function and check for less than 128 size string
# That would ... |
the-stack_106_16444 | # Copyright 2013-2018 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agree... |
the-stack_106_16445 | import pygame
class Ship():
def __init__(self,screen):
"""初始化飞船并设置其初始位置"""
self.screen = screen
#加载飞船图像并获取其外接矩形
self.image = pygame.image.load('image/ship.bmp')
self.rect = self.image.get_rect()
self.screen_rect = screen.get_rect()
#将每艘新飞船放在屏幕底部中央
self.rect.centerx = self.screen_rect.centerx
self... |
the-stack_106_16448 | from math import atan2
from cereal import car
from common.numpy_fast import interp
from common.realtime import DT_DMON
from selfdrive.hardware import TICI
from common.filter_simple import FirstOrderFilter
from common.stat_live import RunningStatFilter
EventName = car.CarEvent.EventName
# ****************************... |
the-stack_106_16451 | # Copyright 2014 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_106_16452 | """Main command."""
import os
import sys
from pytest_bdd.scripts import main
PATH = os.path.dirname(__file__)
def test_main(monkeypatch, capsys):
"""Test if main commmand shows help when called without the subcommand."""
monkeypatch.setattr(sys, "argv", ["pytest-bdd"])
monkeypatch.setattr(sys, "exit", ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.