filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_3664 | """
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import pytest
import salt.states.apache as apache
import salt.utils.files
from tests.support.mock import MagicMock, mock_open, patch
@pytest.fixture
def configure_loader_modules():
return {apache: {}}
def test_configfile():
"""
Test to allo... |
the-stack_0_3665 | import os
from typing import List
import sqlite3
from datamodels import car
def setupNewDB(dirpath):
if not os.path.exists(dirpath):
os.makedirs(dirpath)
if os.path.isfile(dirpath + "/newdata.db"):
os.remove(dirpath + "/newdata.db")
newdb = sqlite3.connect(dirpath + "/newdata.db")
... |
the-stack_0_3669 | '''
Support for Tomcat
'''
# Import Python Libs
import os
def __catalina_home():
'''
Tomcat paths differ depending on packaging
'''
locations = ['/usr/share/tomcat6', '/opt/tomcat']
for location in locations:
if os.path.isdir(location):
return location
def version():
'''
... |
the-stack_0_3675 | import os
import sys
import subprocess
from tqdm import tqdm
from Bio.Seq import Seq
from Bio import SeqIO, SearchIO
from Bio.SeqRecord import SeqRecord
from Bio.Blast.Applications import NcbiblastpCommandline
from src.python.preprocess2 import *
from itertools import cycle
import matplotlib.pyplot as plt
from py... |
the-stack_0_3676 | import csv
from datetime import datetime, time
from decimal import Decimal
from openpyxl import load_workbook, Workbook
from employee.models import Employee
from .models import MaximoTicket, MaximoTimeRegister
import logging
logger = logging.getLogger(__name__)
__author__ = 'lberrocal'
def row_to_dictionary(excel_r... |
the-stack_0_3677 | # Copyright 2016 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 agreed to ... |
the-stack_0_3679 | import copy
import sys
from rlpyt.utils.launching.affinity import encode_affinity, quick_affinity_code
from rlpyt.utils.launching.exp_launcher import run_experiments
from rlpyt.utils.launching.variant import VariantLevel, make_variants
args = sys.argv[1:]
assert len(args) == 2
my_computer = int(args[0])
num_computers... |
the-stack_0_3680 | import torch
import torch.nn as nn
import physics_aware_training.digital_twin_utils
class DNN(nn.Module):
def __init__(self, input_dim, nparams, output_dim, Nunits = None, batchnorm = False, nlaf = 'relu', **kwargs):
'''
Defines configurable deep neural network with fully connected layers and a cho... |
the-stack_0_3681 | # Copyright (c) 2012-2018 The Divi Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Divi base58 encoding and decoding.
Based on https://divitalk.org/index.php?topic=1026.0 (public domain)
'''
import hashlib
# f... |
the-stack_0_3682 | """Python wrapper for Breeze ChMS API: http://www.breezechms.com/api
This API wrapper allows churches to build custom functionality integrated with
Breeze Church Management System.
Usage:
from breeze import breeze
breeze_api = breeze.BreezeApi(
breeze_url='https://demo.breezechms.com',
api_key='5c2d2... |
the-stack_0_3684 | # Copyright 2019, A10 Networks
#
# 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_3685 | # Copyright (c) 2018 PaddlePaddle 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_3686 | from dotenv import load_dotenv
load_dotenv()
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
import tkinter as tk
import webbrowser
def open_spotify(url):
webbrowser.open(url, new = 2)
def create_label(text):
return tk.Label(master = frm_recommendations, text = text)
def create_bu... |
the-stack_0_3687 | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... |
the-stack_0_3689 | import subprocess
import multiprocessing
import logging
import os.path
import pygments.util
import pygments.lexers
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger("classify_linguist")
from .common import *
def classify_pygments(path):
with open(path, "rb") as f:
data = f.read()
... |
the-stack_0_3690 | import configparser
import functools
import arrow
cf = configparser.ConfigParser()
configFile = "config/config.ini"
# configFile = "F:\\code_space\\eniac\\factor_server_docker\\ENIAC\\config\\config.ini"
cf.read(configFile)
"配置来源的属性"
#es
dbHost = cf.get("service_es", "db_host")
dbPort = cf.getint("service_es", "db_p... |
the-stack_0_3691 | #!/usr/bin/env python
#
# tournament.py -- implementation of a Swiss-system tournament
#
import psycopg2
from contextlib import contextmanager
@contextmanager
def db_helper():
"""
Database helper function using context lib. Creates a cursor from a
database connection object, yields that cursor to the oth... |
the-stack_0_3695 | # coding=utf-8
from __future__ import absolute_import, print_function
import posixpath
from urllib import urlencode
# noinspection PyUnresolvedReferences
from six.moves.urllib.parse import parse_qsl, urlsplit, urlunsplit
__author__ = 'Tyler Butler <tyler@tylerbutler.com>'
try:
# noinspection PyUnresolvedReferen... |
the-stack_0_3696 | """factories for creating mincVolumes"""
from .volumes import mincException, mincVolume, getDtype, transform_xyz_coordinates_using_xfm, transform_multiple_xyz_coordinates_using_xfm
def volumeFromFile(filename, dtype="double", readonly=True, labels=False):
"""creates a new mincVolume from existing file."""
v =... |
the-stack_0_3702 | from rasa.nlu.components import Component
from typing import Any, Optional, Text, Dict, TYPE_CHECKING
import os
import spacy
import pickle
from spacy.matcher import Matcher
from rasa.nlu.extractors.extractor import EntityExtractor
if TYPE_CHECKING:
from rasa.nlu.model import Metadata
PATTERN_NER_FILE = 'pattern_... |
the-stack_0_3703 | import bpy
class AMK2BPanel(bpy.types.Panel):
bl_label = "AMK2B"
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
@classmethod
def poll(cls, context):
return hasattr(bpy, "amk2b")
def draw(self, context):
layout = self.layout
row = layout.row()
row.label(t... |
the-stack_0_3704 | #!/usr/bin/env python3
# Copyright (c) 2018-2020 The Lksc Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import time
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import c... |
the-stack_0_3705 | from config import OWNER_ID
from pyrogram.types.bots_and_keyboards import reply_keyboard_markup
from TamilBots.modules import *
from pyrogram import idle, filters
from pyrogram.types import InlineKeyboardMarkup
from pyrogram.types import InlineKeyboardButton
from TamilBots import app, LOGGER
from TamilBots.TamilBots im... |
the-stack_0_3707 | from sqlalchemy.orm import Session
from aspen.database.models import CanSee, DataType
from aspen.test_infra.models.usergroup import group_factory
def test_can_see_constructor_with_datatype(session: Session):
"""Test that we can construct a CanSee object with a `data_type` argument."""
group1 = group_factory(... |
the-stack_0_3710 | import gc
import math
import os
import struct
import bpy, bpy.props, bpy.ops
import mathutils
from io_scene_valvesource import utils as vs_utils
# <summary> Formats a float value to be suitable for bvh output </summary>
def FloatToBvhString(value):
return "{0:f}".format(value)
def WriteHeader(file, f... |
the-stack_0_3711 | """museumadmin URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-b... |
the-stack_0_3714 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Regression tests for the units.format package
"""
import pytest
from numpy.testing import assert_allclose
from astropy.tests.helper import catch_warnings
from astropy import units as u
from astropy.constants import si
from as... |
the-stack_0_3715 | def fibonacciSequence(N):
result = []
previous = 1
previousPrevious = 1
result.append(1)
result.append(1)
for i in range(N - 3):
current = previous + previousPrevious
result.append(current)
previousPrevious = previous
previous = current
return re... |
the-stack_0_3717 | """
Copyright (c) 2019 4masaka
This software is released under the MIT License.
https://opensource.org/licenses/MIT
"""
from typing import Dict, Optional
import aiohttp
from frugal.aio.transport import FTransportBase
from frugal.context import FContext
from thrift.transport.TTransport import TMemoryBuffer, TTrans... |
the-stack_0_3718 | # Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
""" Tests different allocation lifetimes. """
import pytest
import dace
from dace.codegen.targets import framecode
from dace.sdfg import infer_types
import numpy as np
N = dace.symbol('N')
def _test_determine_alloc(lifetime: dac... |
the-stack_0_3719 | # -*- coding: utf-8 -*-
"""
/***************************************************************************
SeaIceData
A QGIS plugin
Downloads sea ice concentration data from NSIDC
-------------------
begin : 2014-10-02
copyrig... |
the-stack_0_3720 | import inspect
import logging
from typing import Any, Dict, Optional
from panoramic.cli.husky.common.exception_enums import (
ComponentType,
ExceptionGroup,
ExceptionSeverity,
)
from panoramic.cli.husky.common.util import exception_to_string_with_traceback
logger = logging.getLogger(__name__)
class Exce... |
the-stack_0_3721 | #Except for the pytorch part content of this file is copied from https://github.com/abisee/pointer-generator/blob/master/
from __future__ import unicode_literals, print_function, division
import sys
# reload(sys)
# sys.setdefaultencoding('utf8')
import imp
imp.reload(sys)
import os
import time
import torch
from to... |
the-stack_0_3723 | #!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the RPC HTTP basics."""
from test_framework.test_framework import KabberryTestFramework
from test... |
the-stack_0_3726 | #!/usr/bin/env python
# Copyright (C) 2013 The Android Open Source Project
#
# 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_3732 | #!/usr/bin/env python3
"""
Read class averages mrc file and save it to jpg.
Automatically remove the edges.
INPUT: mrcs file of 2D class averages
OUTPUT: a dir for the jpg output
The name of the jpg file would be "particlename_diamxxkxx_classnumber.jpg"
"""
import os
import mrcfile
import numpy as np
from PIL import I... |
the-stack_0_3733 | import smtplib
import ast
import getpass
import sys
#ENTER DETAILS BELOW
DEFAULT_RECIPIENT = ''
pwd = ""
def send_mail(mailfile,SUBJECT,recipient = DEFAULT_RECIPIENT):
if recipient == '.':
recipient = DEFAULT_RECIPIENT
s = smtplib.SMTP('smtp.gmail.com', 587)
s.starttls()
s.login(DEF... |
the-stack_0_3737 | import voltage
from voltage.ext import commands
import random
from utils import get_db, check_account, cooldown
# (name, multiplier)
people = [
("Enoki", 1),
("Insert", 1.2),
("NotJan", 0.9),
("Jan", 1),
("Delta", 1.2),
("z3", 0.1),
("atal", 1.5),
("Fatal", 1.2),
]
# (message, (mi... |
the-stack_0_3738 | # 107. Binary Tree Level Order Traversal II
# ttungl@gmail.com
# Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
# For example:
# Given binary tree [3,9,20,null,null,15,7],
# 3
# / \
# 9 20
# / \
# 15 ... |
the-stack_0_3739 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple iohub eye tracker device demo.
Select which tracker to use by setting the TRACKER variable below.
"""
from __future__ import absolute_import, division, print_function
from psychopy import core, visual
from psychopy.iohub import launchHubServer
from psychopy.iohu... |
the-stack_0_3740 | class Solution:
def XXX(self, nums: List[int]) -> List[List[int]]:
flag = [0 for i in nums]
res = [[]]
for i in nums:
tem = deepcopy(res)
for j in range(len(tem)):
tem[j].append(i)
res.extend(tem)
return res
|
the-stack_0_3741 | from __future__ import print_function, division, absolute_import
import re
import requests
from fsspec import AbstractFileSystem
from fsspec.utils import tokenize, DEFAULT_BLOCK_SIZE
# https://stackoverflow.com/a/15926317/3821154
ex = re.compile(r"""<a\s+(?:[^>]*?\s+)?href=(["'])(.*?)\1""")
ex2 = re.compile(r"""(http... |
the-stack_0_3742 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the profiling CLI arguments helper."""
from __future__ import unicode_literals
import argparse
import unittest
from plaso.cli import tools
from plaso.cli.helpers import profiling
from plaso.lib import errors
from tests import test_lib as shared_test_lib
from te... |
the-stack_0_3743 | # -*- coding: utf-8 -*-
"""
pygments.lexers.praat
~~~~~~~~~~~~~~~~~~~~~
Lexer for Praat
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, words, bygroups, include
from pygments.token import Name, T... |
the-stack_0_3745 | """
The MIT License (MIT)
Copyright (c) 2015-present Rapptz
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, merg... |
the-stack_0_3748 | #!/usr/bin/env python3
from sensor import sensor
from room_devices import room_devices
from mqtt import mqtt
# from instance import room_devices
from threading import Thread
import curses
import time
def salutation(screen):
screen.addstr(0, 0, "digite 0 para sair do programa")
screen.addstr(1, 0, "digite 1 para adi... |
the-stack_0_3752 | # Predicting Customer Lifetime Value
## Loading and Viewing Data
from pandas import Series, DataFrame
import pandas as pd
import numpy as np
import os
import matplotlib.pylab as plt
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
import sklearn.metrics
raw_data... |
the-stack_0_3754 | from contextlib import suppress
from urllib.parse import urlparse
import vobject
from django.conf import settings
from django.contrib import messages
from django.db.models import Q
from django.http import Http404, HttpResponse
from django.shortcuts import render
from django.utils.functional import cached_property
from... |
the-stack_0_3755 | # coding: utf-8
#
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file
# except in compliance with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "lice... |
the-stack_0_3757 | # 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_0_3758 | import ast
import sys
import time
from collections import namedtuple
from contextlib import contextmanager
from contextvars import ContextVar
from itertools import count
from varname import ImproperUseError, VarnameRetrievingError, argname, varname
from varname.utils import get_node
global_context = ContextVar("globa... |
the-stack_0_3759 | #
# Copyright 2018 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
the-stack_0_3762 | # -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/ContactPoint
Release: STU3
Version: 3.0.2
Revision: 11917
Last updated: 2019-10-24T11:53:00+11:00
"""
from pydantic import Field
from . import element, fhirtypes
class ContactPoint(element.Element):
"""Disclaimer: Any field name ends wi... |
the-stack_0_3767 | import numpy as np
from cleverhans.attacks import ProjectedGradientDescent
from tools.cleverhans.adversarial_attack import AdversarialAttack
class PGDAttack(AdversarialAttack):
def __init__(self, model, targeted=False, step_size_iter=0.05, max_perturbation=0.3, n_iterations=10,
norm_order=np.inf... |
the-stack_0_3768 | # Copyright (c) 2021 PaddlePaddle 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 ap... |
the-stack_0_3769 |
def melt(df):
"""Melt a census dataframe into two value columns, for the estimate and margin"""
import pandas as pd
# Intial melt
melted = pd.melt(df, id_vars=list(df.columns[:9]), value_vars=list(df.columns[9:]))
melted = melted[['gvid', 'variable', 'value']]
# Make two seperate frames for... |
the-stack_0_3770 | #!/usr/bin/env python3
# Copyright (c) 2015-2020 The Beans Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test multisig RPCs"""
import binascii
import decimal
import itertools
import json
import os
from test_fr... |
the-stack_0_3771 | import pytest
from unittest import mock
import mlflow
from mlflow.exceptions import MlflowException
import mlflow.spark
from mlflow._spark_autologging import _get_current_listener, PythonSubscriber
from tests.spark.autologging.utils import _get_or_create_spark_session
@pytest.fixture()
def spark_session():
sessi... |
the-stack_0_3772 | from random import choice
import numpy as np
from tensorflow.python.keras.utils.data_utils import Sequence
from debvader.normalize import Normalizer
class COSMOSsequence(Sequence):
def __init__(
self,
list_of_samples,
x_col_name,
y_col_name,
batch_size,
num_iterat... |
the-stack_0_3773 | from mpi4py import MPI
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
if rank == 0:
data = [1,3,5,7]
comm.send(data, dest=1)
if rank == 1:
info = MPI.Status()
data = comm.recv(source=0, status=info)
print("Received %d bytes of data." % info.Get_count())
print("Received %d integers." % info.Get... |
the-stack_0_3774 | #!/usr/bin/env python3
"""Simple server written using an event loop."""
import argparse
import logging
import os
import sys
try:
import ssl
except ImportError: # pragma: no cover
ssl = None
import asyncio
import aiohttp
import aiohttp.server
class HttpRequestHandler(aiohttp.server.ServerHttpProtocol):
... |
the-stack_0_3775 | import unittest
import threading
import queue
import time
import sys
sys.path.append("./functions")
import windows
class Streamer:
def __init__(self):
self.buffer = queue.Queue(maxsize=2)
def post(self, item):
if self.buffer.full():
#print("waiting")
self.buffer.join... |
the-stack_0_3776 | # Copyright DataStax, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... |
the-stack_0_3778 | from xml.etree import ElementTree as ET
import re
import copy
import json
from tqdm import tqdm
FILE = 'kanjidic2.xml'
TEMPLATE = {
"kanji": "",
"strokes": 0,
"freq": None,
"jlpt": None,
"grade": 0,
"reading": {
"kun": [],
"on": []
},
"meaning": [],
"name_reading": ... |
the-stack_0_3779 | """
Python Markdown
A Python implementation of John Gruber's Markdown.
Documentation: https://python-markdown.github.io/
GitHub: https://github.com/Python-Markdown/markdown/
PyPI: https://pypi.org/project/Markdown/
Started by Manfred Stienstra (http://www.dwerg.net/).
Maintained for a few years by Yuri Takhteyev (ht... |
the-stack_0_3781 | import re
from collections import defaultdict
from typing import Dict, Set
import structlog
from django.conf import settings
from django.core.management.base import BaseCommand
from ee.clickhouse.sql.schema import CREATE_TABLE_QUERIES, get_table_name
from posthog.client import sync_execute
logger = structlog.get_log... |
the-stack_0_3782 | from os.path import join, dirname
import mock
import pytest
from .base import all_products, active_products
from .. import environment
from .. import products
test_paths = {"/": {"tests_path": join(dirname(__file__), "..", "..", "..", "..")}} # repo root
environment.do_delayed_imports(None, test_paths)
@active_pr... |
the-stack_0_3783 | def valid_parentheses(string):
result=[char for char in string if char in "()"]
comp=-1
total=len(result)
if len(result)%2==1:
return False
index=0
while True:
if total==0:
return True
if index>=total-1:
index=0
total=len(result)
... |
the-stack_0_3786 | """Class to analyze the gains from fe55 cluster fitting"""
import numpy as np
from lsst.eotest.sensor import Fe55GainFitter
from lsst.eo_utils.base.defaults import ALL_SLOTS
from lsst.eo_utils.base.config_utils import EOUtilOptions
from lsst.eo_utils.base.data_utils import TableDict, vstack_tables
from lsst.eo_ut... |
the-stack_0_3787 | import os
import shutil
N = 6
data_root = "/media/data/umutlu/AIC20_track4/"
original_image_folder = data_root + "test_ori_images/"
subset_folder = data_root + "subset_test_ori_images/"
for i in range(1, 101):
org_video_folder = original_image_folder + str(i) + "/"
subset_video_folder = subset_folder + str(... |
the-stack_0_3788 |
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
the-stack_0_3790 | #!/usr/bin/env python3
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from test_framework.script import *
from test_framework.mininode import *
from test_framework.address import *
from test_framework.qtum import *
import sys
import random
import time
class QtumTransa... |
the-stack_0_3791 | from app.engine.combat.solver import CombatPhaseSolver
from app.engine import skill_system, item_system
from app.engine.game_state import game
from app.engine.combat.simple_combat import SimpleCombat
from app.engine.objects.unit import UnitObject
from app.engine.objects.item import ItemObject
class BaseCombat(Simple... |
the-stack_0_3792 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def check(S,a,b):
if (a in S) and (b not in S):
return 0
if (b in S) and (a not in S):
return 0
return 1
def main():
S = str(input())
flag = 1
for a,b in [['N','S'],['E','W']]:
flag = min(check(S,a,b),flag)
if flag==1:
... |
the-stack_0_3794 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import socket
import time
import sys
import random
import traceback
def send_flag(your_teamnum, jury_hostport, flag):
global requests
url = 'http://' + jury_hostport + '/flag?teamid=' + str(your_teamnum) + '&flag=' + flag
try:
r = reque... |
the-stack_0_3803 | import warnings
from datetime import timedelta
from string import digits
from typing import Union
CHAR_TO_RU_STR = {'y': ('лет', 'год', 'года'),
'M': ('Месяцев', 'Месяц', 'Месяца'),
'w': ('недель', 'неделя', 'недели'),
'd': ('дней', 'день', 'дня'),
... |
the-stack_0_3804 | # -*- 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_0_3806 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Conv2d, Sequential, ModuleList, ReLU
from src.ssd import SSD
from src import rfb_config
from src import config
rfb_config.define_img_size(config.NETWORK_INPUT_SIZE)
class BasicConv(nn.Module):
def __init__(self, in_planes, o... |
the-stack_0_3807 | # ----------------------------------------------------------------
# Copyright 2016 Cisco Systems
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
the-stack_0_3809 | from setuptools import setup
package_name = 'carebt_kb'
setup(
name=package_name,
version='0.0.0',
packages=[package_name],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml']),
],
insta... |
the-stack_0_3810 | # %%
import pandas as pd
import numpy as np
# %%
# Data Preprocess
df=pd.read_csv("./dataset/google-play-store-apps/googleplaystore.csv")
for i in df:
print(df[i].value_counts())
df.replace("NaN",np.nan,inplace=True)
df.isnull().sum()
# %%
df.dropna(inplace=True)
# %%
out=pd.DataFrame(df,columns=["App","Category"... |
the-stack_0_3811 | # Copyright 2017 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_0_3813 | import scrapy
from scrapy.loader import ItemLoader
from itemloaders_example.items import QuoteItem
class QuotesWithItemLoaderSpider(scrapy.Spider):
name = "quotes-with-itemloader"
start_urls = [
'http://quotes.toscrape.com',
]
def parse(self, response):
for quote in response.css('div.... |
the-stack_0_3817 | # @file LibraryClassCheck.py
#
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
import logging
import os
from edk2toolext.environment.plugintypes.ci_build_plugin import ICiBuildPlugin
from edk2toollib.uefi.edk2.parsers.dec_parser import DecParser
from edk2toollib.uefi.ed... |
the-stack_0_3820 | """
I/O for DOLFIN's XML format, cf.
<https://people.sc.fsu.edu/~jburkardt/data/dolfin_xml/dolfin_xml.html>.
"""
import logging
import os
import pathlib
import re
from xml.etree import ElementTree as ET
import numpy
from .._exceptions import ReadError, WriteError
from .._helpers import register
from .._mesh import Me... |
the-stack_0_3822 | import argparse
import logging
import os
import sys
# prevent asap other modules from defining the root logger using basicConfig
import automl.logger
import automl
from automl.utils import Namespace as ns, config_load, datetime_iso, str2bool
from automl import log
parser = argparse.ArgumentParser()
parser.add_argum... |
the-stack_0_3824 | import numpy
from six import moves
import chainer
from chainer import cuda
from chainer import function
from chainer.utils import conv
from chainer.utils import type_check
from chainer import variable
if cuda.cudnn_enabled:
cudnn = cuda.cudnn
libcudnn = cuda.cudnn.cudnn
_fwd_pref = libcudnn.CUDNN_CONVOLUT... |
the-stack_0_3825 | from xml.dom import minidom as xd
import re
from AbstractRule import AbstractRule
class FileNamingRule(AbstractRule):
def __init__(self):
AbstractRule.__init__(self)
self.DictionaryList = []
self.DictionaryBaseClassList = []
def execute(self):
f = open("./Rules/FileNamingRules/... |
the-stack_0_3826 | '''
torch implementation
https://github.com/sksq96/pytorch-summary/blob/master/torchsummary/torchsummary.py
'''
import numpy as np
import jittor as jt
from jittor import nn
from jittor import init
from collections import OrderedDict
device_list = ['cpu', 'cuda']
def summary(model, input_size, batch_size=-1, device='... |
the-stack_0_3827 | # Copyright 2022 Dakewe Biotech 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... |
the-stack_0_3831 | #!/usr/bin/python
# Copyright 2014 Google.
#
# 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... |
the-stack_0_3832 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# torchgan documentation build configuration file, created by
# sphinx-quickstart on Sat Oct 6 13:31:50 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... |
the-stack_0_3833 | import tensorflow as tf
import numpy as np
from networks.select import select_G
from dataset import train_dataset_sim, test_dataset_sim
from loss import G_loss
from args import parse_args
import metasurface.solver as solver
import metasurface.conv as conv
import scipy.optimize as scp_opt
import os
import time
## Log... |
the-stack_0_3835 | import os
import numpy as np
from PIL import Image
from .seg_dataset import SegDataset
from .voc_seg_dataset import VOCMetaInfo
class CityscapesSegDataset(SegDataset):
"""
Cityscapes semantic segmentation dataset.
Parameters:
----------
root : str
Path to a folder with `leftImg8bit` and `... |
the-stack_0_3837 | from flask import Flask, jsonify # 新增代码。装入Flask
import pandas as pd
app = Flask(__name__) # 新增代码
@app.route("/") # 新增代码,对应执行root()函数
def root():
return app.send_static_file("visual.html")
@app.route("/getData1")
def getData1():
df = pd.read_csv("./out/PeopleInSubwayTime.csv")
data = [df.iloc[:, 0].t... |
the-stack_0_3838 | # encoding: utf-8
import pyparsing as pyp
import re
def to_obj(result):
'''Convert nested ParseResults structure to list / dict.
Args:
result (ParseResults) : pyparsing result
Returns:
list / dict containing results
'''
d = result.asDict()
if d:
for k in d:
... |
the-stack_0_3839 | #!/usr/bin/env python
import pika
import time
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='rabbit'))
channel = connection.channel()
channel.queue_declare(queue='task_queue', durable=True)
print(' [*] Waiting for messages. To exit press CTRL+C')
def callback(ch, method, properties, bo... |
the-stack_0_3841 | """
Plugins resource control over the API.
"""
import logging
from galaxy import exceptions
from galaxy.managers import hdas, histories
from galaxy.web import expose_api
from galaxy.webapps.base.controller import BaseAPIController
log = logging.getLogger(__name__)
class PluginsController(BaseAPIController):
"""... |
the-stack_0_3844 | from setuptools import setup, find_packages
import d2l
requirements = [
'jupyter==1.0.0',
'numpy==1.21.5',
'matplotlib==3.5.1',
'requests==2.25.1',
'pandas==1.2.4'
]
setup(
name='d2l',
version=d2l.__version__,
python_requires='>=3.5',
author='D2L Developers',
author_email='d2l.... |
the-stack_0_3847 | # Copyright (c) 2020, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty, Tags
from .validators import (boolean, integer)
VALID_SIGNIN_ALGORITHM = ('SHA256WITHECDSA', 'SHA256WITHRSA',
'SHA384WITHECDSA', 'SHA384WITHRSA'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.