filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_30199 | # coding=utf-8
# Copyright 2021 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_30200 | from sqlalchemy import Column, Integer, ForeignKey, PrimaryKeyConstraint
import settings
from src.models.company import Company
from src.models.user import User
from src.services.email import EmailService
from src.utils.validators import validate_company_assignment
from src.utils.exceptions import Conflict, HTTPExcept... |
the-stack_106_30201 | # Be sure to run this file from the "region_of_acquisition" folder
# cd examples/region_of_acquisition
#
import yaml
import time
import os
import sys
import copy
import pickle
import pybullet as p
import numpy as np
import pandas as pd
import pathos.multiprocessing as mp
from functools import partial
from itertools... |
the-stack_106_30202 | import http.client
from os import getenv
# import dotenv
from flask import json
# dotenv.load_dotenv()
# api_key = getenv('API_KEY')
class MainWallet():
def __init__(self):
self.key = ""
def initialize_wallet(self):
wallet_data = create_wallet(self.key)
print("Wallet-data: ", wallet_... |
the-stack_106_30204 | """
Tests for application.
"""
import responses
def test_get_info(helpers, fb_api):
with responses.RequestsMock() as m:
m.add(
method=responses.GET,
url=f"https://graph.facebook.com/{fb_api.version}/{fb_api.app_id}",
json=helpers.load_json(
"testdat... |
the-stack_106_30205 | import collections
c = collections.Counter('extremely')
c['z'] = 0
print(c)
#该elements()方法返回一个迭代器,
# 它生成所有已知的项目Counter。
print(list(c.elements()))
"""
output:
Counter({'e': 3, 'x': 1, 't': 1, 'r': 1, 'm': 1, 'l': 1, 'y': 1,
'z': 0})
['e', 'e', 'e', 'x', 't', 'r', 'm', 'l', 'y']
""" |
the-stack_106_30206 | import sys
import time
from datetime import datetime
from pynng import Req0, Rep0, Timeout
# print(str(datetime.now()))
def node0(url: str):
with Rep0(listen=url, recv_timeout=100) as sock:
while True:
try:
msg = sock.recv()
if str(msg.decode()) == 'DATE':
... |
the-stack_106_30208 | # -*- coding: UTF-8 -*-
import base64
import json
import sys
from datetime import datetime
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from QcloudApi.qcloudapi import QcloudApi
# 配置文件、日志路径与证书文件夹
config_file_path = sys.path[0] + '/config.json'
tmp_file_path = sys.path[0] + '... |
the-stack_106_30211 | # Copyright 2022 MosaicML Composer authors
# SPDX-License-Identifier: Apache-2.0
import os
import pathlib
import sys
import pytest
from torch.utils.data import DataLoader
from composer import Callback, Event, State, Trainer
from composer.loggers import FileLogger, FileLoggerHparams, Logger, LoggerDestination, LogLev... |
the-stack_106_30215 | import functools
import math
import operator
import random
import re
import sys
import error
def isdigit(string):
return all(i in '1234567890-.' for i in string)
def eval_(string):
if '.' in string: return float(string)
try: return int(string)
except: return string
class Stack(list)... |
the-stack_106_30216 | import torch
import torch.nn as nn
from collections import OrderedDict
from ptsemseg.utils import initialize_weights
class _DenseLayer(nn.Sequential):
def __init__(self, num_input_features, growth_rate, bn_size, drop_rate):
super(_DenseLayer, self).__init__()
if bn_size is not None:
se... |
the-stack_106_30219 | # 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 use ... |
the-stack_106_30221 | from __future__ import absolute_import, division, print_function, unicode_literals
import json
import random
import unittest
from amaascore.assets.custom_asset import CustomAsset
from amaascore.assets.interface import AssetsInterface
from tests.unit.config import STAGE
class Pizza(CustomAsset):
def __init__(sel... |
the-stack_106_30222 | from MDSplus import *
my_tree=Tree('test',-1,'edit')
#Set up nodes
try :
my_tree.addNode('scratch','structure')
my_node=my_tree.getNode('scratch')
my_node.addNode('my_name','text')
my_node.addNode('my_age','numeric')
my_node.addNode('age_months','numeric')
my_node.addNode('timebase','axis')
... |
the-stack_106_30223 | import pygame, sys, random, os
from DinoRun import *
from pygame.locals import *
import time
sys.path.insert(0, '../../')
WINDOWWIDTH = 1280
WINDOWHEIGHT = 720
# PHan backgroud menu
BG_MENU_IMG = pygame.image.load('img/backgroundMenu.png')
BG_PLAY_IMG = pygame.image.load("img/BackGroundPlay.png")
BG_MENU_SetAV = pyga... |
the-stack_106_30224 | import time
import adafruit_lis3dh
import board
import busio
import neopixel
# This is derviced from: https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH/blob/master/examples/spinner.py
def flash(c):
pixels.fill((0, 0, 0))
for i in range(3):
pixels.fill(c)
pixels.show()
time.sl... |
the-stack_106_30226 | from __future__ import unicode_literals
from datetime import timedelta
import logging
from django.conf import settings
from django.db import transaction
from django.utils import timezone
from waldur_core.core import tasks as core_tasks, utils as core_utils
from waldur_core.quotas import exceptions as quotas_exceptio... |
the-stack_106_30227 | import subprocess
import logging as logger
from . import const, utils
def get_command_with_options(command, aliases, exec_params):
"""
Find command by aliases and build exec docker options
"""
if command[0] in aliases:
key = command[0]
command = aliases[key]['command'] + list(command[... |
the-stack_106_30228 | #!/usr/bin/env python
from common.realtime import sec_since_boot
from cereal import car
from selfdrive.config import Conversions as CV
from selfdrive.controls.lib.drive_helpers import EventTypes as ET, create_event
from selfdrive.controls.lib.vehicle_model import VehicleModel
from selfdrive.car.toyota.carstate import C... |
the-stack_106_30231 | class Solution:
def shortestDistance(self, wordsDict: List[str], word1: str, word2: str) -> int:
"""
makes: [1,5,7,10]
^
coding: [3,9,12]
^
"""
word1_idx = []
word2_idx = []
for idx, word in... |
the-stack_106_30232 | from muse.util import RandomFactory
from muse.util import TestRunner
def testGenIntN() -> bool:
value = 0
for _ in range(8192):
if RandomFactory.genIntN(0, 0) != 0:
return False
if RandomFactory.genIntN(1, 1) != 1:
return False
value = RandomFactory.genIntN(0, ... |
the-stack_106_30234 | from setuptools import setup
from setuptools import find_namespace_packages
# Open the README file.
with open(file="README.md", mode="r") as fh:
long_description = fh.read()
setup(
name='federal-reserve-python-api',
# Define Author Info.
author='Alex Reed',
author_email='coding.sigma@gmail.com',... |
the-stack_106_30235 | # qubit number=4
# total number=39
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_30236 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
the-stack_106_30237 | #!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Run regression test suite.
This module calls down into individual test cases via subprocess. It will
f... |
the-stack_106_30240 | # Copyright 2018-2022 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_30243 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
the-stack_106_30245 | # Copyright (c) 2004-2015 Odoo S.A.
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License MIT (https://opensource.org/licenses/MIT).
# pylint: disable=sql-injection
from random import choice
from string import digits
from odoo import SUPERUSER_ID, _, api, exceptions, fields, mo... |
the-stack_106_30246 | """
Code to manage the creation and SQL rendering of 'where' constraints.
"""
from django.core.exceptions import EmptyResultSet
from django.utils import tree
from django.utils.functional import cached_property
# Connection types
AND = 'AND'
OR = 'OR'
class WhereNode(tree.Node):
"""
Used to represent the SQL... |
the-stack_106_30247 | import setuptools
with open('README.md', 'r') as fh:
long_description = fh.read()
setuptools.setup(
name='python-amazon-paapi',
version='3.3.1',
author='Sergio Abad',
author_email='sergio.abad@bytelix.com',
description='Amazon Product Advertising API 5.0 wrapper for Python',
long_descripti... |
the-stack_106_30248 | from keras.models import Sequential
from keras.layers import *
from skimage.measure import compare_psnr
import numpy as np
import keras.backend as K
from keras.callbacks import *
def psnr(base_image,altered_image):
try:
MSE=K.mean(K.square(base_image-altered_image))
if(MSE==0):
return 100
else:
return 20*K... |
the-stack_106_30250 | # The MIT License
#
# Copyright (c) 2008
# Shibzoukhov Zaur Moukhadinovich
# szport@gmail.com
#
# 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 limitati... |
the-stack_106_30251 | import torch
import numpy as np
import pytorch_lightning as pl
from typing import Any, Dict, Tuple
from prohmr.models import SMPL
from yacs.config import CfgNode
from prohmr.utils import SkeletonRenderer
from prohmr.utils.geometry import aa_to_rotmat, perspective_projection
from prohmr.optimization import Optimizatio... |
the-stack_106_30252 | from bs4 import BeautifulSoup
from io import BytesIO
import mock
import pytest
from PIL import Image
from django.conf import settings
from capapi.tests.helpers import check_response
from capweb.helpers import reverse, page_image_url
from scripts import update_snippets
@pytest.mark.django_db
def test_nav(client, ing... |
the-stack_106_30255 | import numpy as np
from pathlib import Path
import xarray as xr
import pandas as pd
from pyproj import Proj, transform
import pickle as pkl
from autocorr_functions import *
import autocorr_cmls as accml
import sys
sys.path.append("/home/adameshel/Documents/code/")
from helper_functions import *
# Create a dict with a... |
the-stack_106_30256 | # Copyright 2013 Rackspace Hosting
# 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 require... |
the-stack_106_30258 | # SPDX-License-Identifier: Apache-2.0
# This file is for testing ONNX with ONNXRuntime during ONNX Release
# Create a general scenario to use ONNXRuntime with ONNX
def example_test_with_ort() -> None:
import onnx
import numpy # type: ignore
import onnxruntime as rt # type: ignore
from onnxruntime.da... |
the-stack_106_30259 | import datetime
from .args import (
build_argparser,
get_students_from_args,
get_assignments_from_args,
compute_stogit_url,
)
def args(arglist):
return vars(build_argparser().parse_args(args=arglist))
students = {
'my': ['rives'],
'section-a': ['student-a'],
'section-b': ['student-b'... |
the-stack_106_30260 | import asyncio
from asyncio.events import AbstractEventLoop
from typing import Optional
import pytest
from temporal.converter import DEFAULT_DATA_CONVERTER_INSTANCE
from temporal.workerfactory import WorkerFactory
from temporal.workflow import WorkflowClient
from . import cleanup_worker
loop: Optional[AbstractEventL... |
the-stack_106_30261 | from urllib.request import urlopen
protein_seq_file = 'data/newUpdated_protein_R64-3.fsa'
protparam_file = 'data/newUpdated_protparam_R64-3.txt'
codonw_file = 'data/newUpdated_coding_codonw_R64-3.out'
protparam_root_url = 'https://web.expasy.org/cgi-bin/protparam/protparam?sequence='
aaList = ['ala', 'arg', 'asn', '... |
the-stack_106_30262 | """
Component to offer a way to select an option from a list.
For more details about this component, please refer to the documentation
at https://home-assistant.io/components/input_select/
"""
import asyncio
import logging
import voluptuous as vol
from homeassistant.const import ATTR_ENTITY_ID, CONF_ICON, CONF_NAME
... |
the-stack_106_30263 | import gtk
import gobject
import logging
import wasp.fms
LOG = logging.getLogger("ui.control")
def _make_left_fancy_label(txt, use_markup=True, padding=5):
lbl = gtk.Label(txt)
lbl.set_use_markup(use_markup)
lbl.set_alignment(0.0, 0.5)
lbl.set_padding(padding, 0)
return lbl
class _FMSAxisWidget(... |
the-stack_106_30265 | """
intro_3_05_variable_names_1.py
Example code from Section 3.5 of <Introduction to SFC Models Using Python.>
Demonstration how variable names are built up.
Copyright 2017 Brian Romanchuk
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License... |
the-stack_106_30266 | # 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_30268 | # coding: utf-8
from django.conf.urls import url
from bootcamp.feeds import views
urlpatterns = [
url(r'^$', views.feeds, name='feeds'),
url(r'^post/$', views.post, name='post'),
url(r'^like/$', views.like, name='like'),
url(r'^comment/$', views.comment, name='comment'),
url(r'^load/$', views.loa... |
the-stack_106_30270 | # Modifications copyright 2022 AI Singapore
#
# 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... |
the-stack_106_30272 | """
Gets concordance for keywords and groups by word.
"""
from defoe import query_utils
from defoe.alto.query_utils import get_page_matches
def do_query(archives, config_file=None, logger=None, context=None):
"""
Gets concordance for keywords and groups by word.
config_file must be the path to a configu... |
the-stack_106_30273 | import numpy as np
import cv2
import tensorflow as tf
import os
import webbrowser
url = 'http://localhost:8080/index.html'
chrome_path = '/usr/bin/google-chrome %s'
data_dir = "dataset"
labels = next(os.walk(data_dir))[1]
labels.sort()
img_size = 256
cap = cv2.VideoCapture(0)
while(True):
ret, frame = cap.rea... |
the-stack_106_30274 | from __future__ import absolute_import
from __future__ import print_function
import argparse
import numpy as np
import time
from models.simple import SimpleModel
from models.contrastive import ContrastiveModel
"""
Basic deep neural network that works with SVM input
"""
parser = argparse.ArgumentParser(descripti... |
the-stack_106_30277 | #!/usr/bin/env python3
import sys
import struct
import os
from scapy.all import sniff, sendp, hexdump, get_if_list, get_if_hwaddr
from scapy.all import Packet, IPOption
from scapy.all import ShortField, IntField, LongField, BitField, FieldListField, FieldLenField
from scapy.all import IP, TCP, UDP, Raw
from scapy.laye... |
the-stack_106_30279 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# Copyright 2017-2020 Airinnova AB and the Airfoils authors
#
# 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_30280 | # -*- coding: utf-8 -*-
import os
import sys
sys.path.insert(0, os.path.abspath(".."))
# -- General configuration ------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
exten... |
the-stack_106_30282 | from collections import OrderedDict
from typing import Any, Generic, Iterable, Mapping, Type, TypeVar, Union
from miscutils.mappings import Namespace
__all__ = [
"EnvParser",
"Param",
"Error",
"InvalidParam",
"ParseError",
"InvalidValue",
"MissingValue",
]
class Error(Exception):
"""... |
the-stack_106_30285 | """
Support for Wink lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.wink/
"""
import asyncio
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_HS_COLOR, SUPPORT_BRIGHTNESS,
SUPPORT_COLOR_TEMP, SUPP... |
the-stack_106_30286 | #!/bin/python
import sys, getopt
def main(argv):
opts, args = getopt.getopt(argv, "hi")
invertColormap = False
for opt, arg in opts:
if opt == '-h':
usage()
sys.exit()
elif opt == '-i':
invertColormap = True
data = open(args[0], 'rb').read()
str_out = "#include <stdint.h>\n#incl... |
the-stack_106_30287 | import numpy as np
import jax
from jax import jit
import collections, itertools
from functools import lru_cache as cache
from .representation import Rep, ScalarRep, Scalar
from .linear_operator_base import LinearOperator
from .linear_operators import LazyPerm, LazyDirectSum, LazyKron, LazyKronsum, I, lazy_direct_matmat... |
the-stack_106_30288 | import sys
sys.stdin = open("input.txt", "r")
#sys.stdout = open("output.txt", "w")
def dfs(graph, start):
visited, stack = set(), [start]
while stack:
vertex = stack.pop()
if vertex not in visited:
visited.add(vertex)
stack.extend(graph[vertex] - visited)
return vis... |
the-stack_106_30289 | # Copyright (c) 2021 PPViT Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
the-stack_106_30290 | import pytest
from django.urls import resolve, reverse
from islam_fitz.users.models import User
pytestmark = pytest.mark.django_db
def test_detail(user: User):
assert (
reverse("users:detail", kwargs={"username": user.username})
== f"/users/{user.username}/"
)
assert resolve(f"/users/{us... |
the-stack_106_30292 | import pytest
from unittest import TestCase
from pyflamegpu import *
import os
XML_FILE_NAME = "test.xml"
JSON_FILE_NAME = "test.json"
AGENT_COUNT = 100
class ValidateEnv(pyflamegpu.HostFunctionCallback):
"""
pyflamegpu requires step functions to be a class which extends the StepFunction base class.
This ... |
the-stack_106_30295 | # Copyright (c) 2020 the original author or 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
the-stack_106_30296 | import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
from pprint import pprint
from numpy.random import choice
from scipy.spatial.distance import cdist
# Make sure that caffe is on the python path:
caffe_root = '../../caffe/' # this file is expected to be in {caffe_root}/examples
import sys
sys.pa... |
the-stack_106_30297 | # Copyright 2019 Kakao Brain
#
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.
import tempfile
import pytest
import torch
import torch.distributed as dist
@pytest.fixtu... |
the-stack_106_30299 | #=============================================================================================
# MODULE DOCSTRING
#=============================================================================================
"""
Markov chain Monte Carlo simulation framework.
DESCRIPTION
This module provides a framework for equilibr... |
the-stack_106_30300 | """
Display one 4-D image layer using the add_image API
"""
from skimage import data
import napari
blobs = data.binary_blobs(
length=128, blob_size_fraction=0.05, n_dim=2, volume_fraction=0.25
).astype(float)
viewer = napari.view_image(blobs, name='blobs')
@viewer.bind_key('a')
def accept_image(viewer):
m... |
the-stack_106_30301 | #!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
A bridge to publish and subscribe to EventAdmin events over the network using
MQTT
:author: Thomas Calmant
:copyright: Copyright 2016, Thomas Calmant
:license: Apache License 2.0
:version: 0.6.4
..
Copyright 2016 Thomas Calmant
Licensed under the Apa... |
the-stack_106_30302 | #!/usr/bin/env python
import os,sys
# import all necessary stuff
import osg
import osgDB
import osgViewer
import osgART
# just a convenience function
def createImageBackground(video):
layer = osgART.VideoLayer()
layer.setSize(video)
geode = osgART.VideoGeode(osgART.VideoGeode.USE_TEXTURE_2D, video)
osgART.addTex... |
the-stack_106_30303 | # Copyright The PyTorch Lightning 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 agreed to i... |
the-stack_106_30305 | from __future__ import print_function, division
import matplotlib
import logging
from sys import stdout
matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab!
from neuralnilm import (Net, RealApplianceSource,
BLSTMLayer, DimshuffleLayer,
Bidirectio... |
the-stack_106_30307 | '''
Created on Apr 10, 2017
@author: gpetrochenkov
'''
from flask import Flask, jsonify, request, Response
from dicttoxml import dicttoxml
from RestAPI.utilities import check_exists, validate_format
from RestAPI.service_workers import get_comma_sep_values, basin_chars
import os
from RestAPI.service_workers import deli... |
the-stack_106_30309 | from pysondb import db
import asyncio
class PysonManager:
def __init__(self):
self.data_batch = []
self.is_running = True
self.batch_sync_completed = False
self.db_connection = db.getDb("user_prox_chat_db.json")
async def initalize(self):
asyncio.create_task(... |
the-stack_106_30310 |
def BasinStyle(lineColor="#fff",lineWidth=1,fill=False,fillColor="#f33"):
lineStyle = {
"type":"line",
"paint": {
"line-color":lineColor,
"line-width":lineWidth
},
}
fillStyle = {
"type":"fill",
"paint":{
"fill-color":fillColor,
... |
the-stack_106_30311 |
'''Trains a simple convnet on the MNIST dataset.
Gets to 99.25% test accuracy after 12 epochs
(there is still a lot of margin for parameter tuning).
16 seconds per epoch on a GRID K520 GPU.
'''
from __future__ import print_function
import keras
from keras.datasets import mnist
from keras.models import Sequential
fro... |
the-stack_106_30312 | #!/usr/bin/python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
the-stack_106_30314 | import collections
import time
from .cache import Cache
class _Link(object):
__slots__ = ('key', 'expire', 'next', 'prev')
def __init__(self, key=None, expire=None):
self.key = key
self.expire = expire
def __reduce__(self):
return _Link, (self.key, self.expire)
def unlink(... |
the-stack_106_30316 | import os
import sys
from methods import detect_darwin_sdk_path
def is_active():
return True
def get_name():
return "OSX"
def can_build():
if sys.platform == "darwin" or ("OSXCROSS_ROOT" in os.environ):
return True
return False
def get_opts():
from SCons.Variables import BoolVariab... |
the-stack_106_30317 | from django.contrib import messages
from django.shortcuts import render, HttpResponseRedirect
from django.contrib.auth.forms import UserCreationForm
from django.urls import reverse_lazy
from .forms import *
from .serializers import *
from django.views import generic
from django.contrib.messages.views import SuccessMess... |
the-stack_106_30320 | """
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... |
the-stack_106_30321 | import unittest
import pysal.examples as ex
import os
class Example_Tester(unittest.TestCase):
def test_get_path(self):
pathparts = os.path.normpath(ex.get_path('')).split(os.path.sep)
self.localpath = os.path.join(*pathparts[-2:])
self.assertEquals(self.localpath, os.path.normpath('pysal/... |
the-stack_106_30322 | import rospy
from geometry_msgs.msg import Twist, PoseStamped
from tf2_ros import TransformListener, Buffer
import sys
def local_pose_callback(data):
global local_pose
local_pose = data
if __name__ == '__main__':
vehicle_type = sys.argv[1]
vehicle_id = sys.argv[2]
rospy.init_node(vehicle_type+'_'+... |
the-stack_106_30326 | # privates.py
import sys
import itertools
class PrivateAccessError(Exception):
pass
class PrivateDataMetaclass(type):
def __new__(metacls,name,bases,dct):
function = type(lambda x:x)
privates = set(dct.get('__private__',()))
codes = set()
for val in dct.values():
... |
the-stack_106_30330 | #!/usr/bin/env python3
import argparse
import os
import shutil
import tempfile
import unittest
from unittest.mock import Mock
from unittest.mock import patch
from pico8.build import build
from pico8.game import game
from pico8.lua import lua
class TestDoBuild(unittest.TestCase):
def setUp(self):
self.te... |
the-stack_106_30331 | #coding:utf-8
#
# id: bugs.gh_6740
# title: Allow parenthesized query expression for standard-compliance
# decription:
# https://github.com/FirebirdSQL/firebird/issues/6740
#
# NOTE. Queries which do not use `WITH` clause now can be enclosed in pare... |
the-stack_106_30332 | # The following comments couldn't be translated into the new config version:
# eg to write payload to the oracle database
# replace CondDBCommon.connect = "oracle://cms_orcoff_int2r/CMS_COND_CSC"
# Database output service
import FWCore.ParameterSet.Config as cms
process = cms.Process("ProcessOne")
#PopCon config
... |
the-stack_106_30333 | import argparse
import os
from util import util
import torch
import models
import data
class BaseOptions():
"""This class defines options used during both training and test time.
It also implements several helper functions such as parsing, printing, and saving the options.
It also gathers additional opti... |
the-stack_106_30335 | # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
import awkward as ak
np = ak.nplike.NumpyMetadata.instance()
# @ak._v2._connect.numpy.implements("prod")
def prod(array, axis=None, keepdims=False, mask_identity=False, flatten_records=False):
"""
Args:
array: Ar... |
the-stack_106_30336 | import os
from abc import ABCMeta, abstractmethod
class SimulationFailedError(BaseException):
"""
This exception will be raised when simulator fails
to calculate the performance of the circuit.
"""
def __init__(self, *args):
if args:
self.message = args[0]
else:
... |
the-stack_106_30337 | # --------------------------------------------------------------------------
# Source file provided under Apache License, Version 2.0, January 2004,
# http://www.apache.org/licenses/
# (c) Copyright IBM Corp. 2015, 2016
# --------------------------------------------------------------------------
import warnings
f... |
the-stack_106_30339 | """
You are given a string, S, and a list of words, L, that are all of the same length.
Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without any intervening characters.
For example, given:
S: "barfoothefoobarman"
L: ["foo", "bar"]
You should return the indi... |
the-stack_106_30340 | from itertools import groupby
import numpy as np
from yt.geometry.selection_routines import AlwaysSelector
from yt.utilities.io_handler import BaseIOHandler
from yt.utilities.logger import ytLogger as mylog
# -----------------------------------------------------------------------------
# GAMER shares a similar HDF5 ... |
the-stack_106_30342 | """
Define the SeriesGroupBy and DataFrameGroupBy
classes that hold the groupby interfaces (and some implementations).
These are user facing as the result of the ``df.groupby(...)`` operations,
which here returns a DataFrameGroupBy object.
"""
from __future__ import annotations
from collections import abc, namedtuple... |
the-stack_106_30343 | #Import functions from the 'article_duplicates_modules.py'
import os
from article_duplicates_modules import minimize_difference, deduplicator
textlist5 = minimize_difference(textlist4)
textlist6 = deduplicator(textlist5)
#Print output into a file
#Since new line characters are cleaned from the articles, they ... |
the-stack_106_30344 | # from pathlib import Path
import json, pdb, os, numpy as np, cv2, threading, math #collections, random
# import pickle, sys, itertools, string, sys, re, datetime, time, shutil, copy
from urllib.request import urlopen
# from tempfile import NamedTemporaryFile
import torch
from torch import nn, cuda, backends, FloatTen... |
the-stack_106_30347 | import argparse
import importlib
import io
import json
import pathlib
import sys
import time
from clvm import to_sexp_f, KEYWORD_FROM_ATOM, KEYWORD_TO_ATOM, SExp
from clvm.EvalError import EvalError
from clvm.serialize import sexp_from_stream, sexp_to_stream
from clvm.operators import OP_REWRITE
from ir import reader... |
the-stack_106_30348 | """
========================================
Regression on continuous data (rER[P/F])
========================================
This demonstrates how rER[P/F]s - regressing the continuous data - is a
generalisation of traditional averaging. If all preprocessing steps
are the same, no overlap between epochs exists, and ... |
the-stack_106_30350 | import re
import sys
import string
from toolz import pluck
from brocclib.get_xml import get_lineage
from brocclib.taxonomy import Lineage
fields = lambda f: iter(map(string.strip, l.split('\t')) for l in f)
isnumeric = re.compile(r'\d+').match
standard = lambda d: ";".join( Lineage(d).get_standard_taxa("species") )... |
the-stack_106_30351 | from tracardi_dot_notation.dot_accessor import DotAccessor
from tracardi.process_engine.tql.transformer.transformer_namespace import TransformerNamespace
from lark import v_args, Token
@v_args(inline=True)
class CalcTransformer(TransformerNamespace):
from operator import add, sub, mul, truediv as div, neg
nu... |
the-stack_106_30352 | import py
import pytest
from xdist.workermanage import NodeManager
from xdist.scheduler import (
EachScheduling,
LoadScheduling,
LoadScopeScheduling,
LoadFileScheduling,
)
from six.moves.queue import Empty, Queue
class Interrupted(KeyboardInterrupt):
""" signals an immediate interruption. """
... |
the-stack_106_30354 | # Copyright 2019-2021 Canaan 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 writ... |
the-stack_106_30356 | import inspect
import json
import os
import random
import shutil
import tempfile
import weakref
from dataclasses import asdict
from functools import wraps
from pathlib import Path
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
import numpy as np
import pyarrow as pa
import xxhash
from datasets.tab... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.