filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_10381 | from email.mime.text import MIMEText
import random
import smtplib
import jinja2
import datetime
from pebbles.client import PBClient
from pebbles.models import Instance
from pebbles.tasks.celery_app import logger, get_token, local_config, get_dynamic_config
from pebbles.tasks.provisioning_tasks import run_update
from p... |
the-stack_0_10382 | import os
import re
from datetime import timedelta
from typing import Any, Dict, List, Optional
from unittest import mock, skipUnless
from unittest.mock import MagicMock, call, patch
from django.apps import apps
from django.conf import settings
from django.core.management import call_command, find_commands
from django... |
the-stack_0_10386 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''The base class for task transformer objects'''
import numpy as np
from librosa import time_to_frames, times_like
from librosa.sequence import viterbi_binary, viterbi_discriminative
import jams
from ..base import Scope
__all__ = ['BaseTaskTransformer']
def fill_val... |
the-stack_0_10390 | """Datasets are defined as scripts and have unique properties.
The Module defines generic dataset properties and models the
functions available for inheritance by the scripts or datasets.
"""
from __future__ import print_function
from weaver.engines import choose_engine
from weaver.lib.models import *
from weaver.lib.... |
the-stack_0_10391 | # -*- coding: utf-8 -*-
"""
Use nose
`$ pip install nose`
`$ nosetests`
"""
from hyde.generator import Generator
from hyde.site import Site
from hyde.tests.util import assert_no_diff
from fswrap import File, Folder
SCSS_SOURCE = File(__file__).parent.child_folder('scss')
TEST_SITE = File(__file__).parent.parent.child... |
the-stack_0_10392 | #!/usr/bin/env python
__all__ = ['douban_download']
import urllib.request, urllib.parse
from ..common import *
def douban_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
html = get_html(url)
if re.match(r'https?://movie', url):
title = match1(html, 'name="description" con... |
the-stack_0_10397 | # flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all.
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... |
the-stack_0_10398 | #!/usr/bin/env python3
questions = {
"strong": "Do ye like yer drinks strong?",
"salty": "Do ye like it with a salty tang?",
"bitter": "Are ye a lubber who likes it bitter?",
"sweet": "Would ye like a bit of sweetness with yer poison?",
"fruity": "Are ye one for a fruity finish?",
}
ingredients =... |
the-stack_0_10401 | import abc
from time import time
from urllib import parse
from ... import gvars
from ...utils import open_connection
class HTTPResponse:
def __init__(self, client):
self.client = client
self.done = False
self.header_size = 0
self.body_size = 0
self.speed = 0
self.st... |
the-stack_0_10404 | from django.conf import settings
from django.conf.urls import handler404, handler500
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path
handler404 = 'foodgram_project.views.page_not_found' # noqa
handler500 = 'foodgram_project.views.server_error' # noqa
... |
the-stack_0_10405 | import sqlite3 as sql
import queries as qrs
import pandas as pd
# assignment 1
def connect_db(db='../rpg_db.sqlite3'):
return sql.connect(db)
def exec(conn, query):
curs = conn.cursor()
curs.execute(query)
res = curs.fetchall()
return res
# assignment 2
df = pd.DataFrame(pd.read_csv('../buddym... |
the-stack_0_10406 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
PyCOMPSs Testbench
========================
"""
# Imports
import unittest
from modules.testMpiDecorator import testMpiDecorator
def main():
suite = unittest.TestLoader().loadTestsFromTestCase(testMpiDecorator)
unittest.TextTestRunner(verbosity=2).run(suite)
... |
the-stack_0_10408 | #!/usr/bin/python
#
# Converts KML files to BigQuery WKT geography objects (CSV)
from __future__ import print_function
import sys
import re
import xml.etree.ElementTree
e = xml.etree.ElementTree.parse(sys.argv[1]).getroot()
p = re.compile('^\{(.+?)\}')
matches = p.match(e.tag)
xmlns = matches.group(1)
document = e[... |
the-stack_0_10409 | #!usr/bin/python3.7
#author: kang-newbie
#github: https://github.com/kang-newbie
#contact: https://t.me/kang_nuubi
import os,sys,time
try:
os.mkdir('audio')
except: pass
def os_detek():
if os.name in ['nt', 'win32']:
os.system('cls')
else:
os.system('clear')
banner="""
;;;;;;;;;;;;;;;;;
; ... |
the-stack_0_10411 | # model settings
input_size = 300
model = dict(
type='SingleStageDetector',
#pretrained='open-mmlab://vgg16_caffe',
pretrained='vgg16_caffe-292e1171.pth',
backbone=dict(
type='SSDVGG',
input_size=input_size,
depth=16,
with_last_pool=False,
ceil_mode=True,
... |
the-stack_0_10412 | from rest_framework import renderers
class PlainTextRenderer(renderers.BaseRenderer):
media_type = 'text/plain'
format = 'text'
def render(self, data, media_type=None, renderer_context=None):
json_data = renderers.JSONRenderer().render(data, media_type, renderer_context)
return str(json_d... |
the-stack_0_10413 | import json
import numpy
import os
import re
import sys
# This script depends on a SJSON parsing package:
# https://pypi.python.org/pypi/SJSON/1.1.0
# https://shelter13.net/projects/SJSON/
# https://bitbucket.org/Anteru/sjson/src
import sjson
def get_clip_names(benchmarks):
clip_names = []
for bench in benchmarks:
... |
the-stack_0_10414 | # -*- coding: utf-8 -*-
'''
A salt interface to psutil, a system and process library.
See http://code.google.com/p/psutil.
:depends: - psutil Python module, version 0.3.0 or later
- python-utmp package (optional)
'''
# Import python libs
from __future__ import absolute_import
import time
import datetime... |
the-stack_0_10415 | # implementation of SLIC Superpixel algorithm
# reference: SLIC Superpixels Compared to State-of-the-art Superpixel Methods
# DOI: 10.1109/TPAMI.2012.120
# website: https://infoscience.epfl.ch/record/177415
# reference: SLIC算法分割超像素原理及Python实现: https://www.kawabangga.com/posts/1923
import cv2 as cv
import numpy as np
im... |
the-stack_0_10417 | # coding: utf-8
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ShowProcessResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
... |
the-stack_0_10418 | # -*- coding:utf-8 -*-
__author__ = 'Randolph'
import os
import math
import gensim
import logging
import json
import torch
import numpy as np
import pandas as pd
from scipy import stats
from texttable import Texttable
from gensim.models import KeyedVectors
import torch.nn.utils.rnn as rnn_utils
def option():
""... |
the-stack_0_10419 | import tempfile
import pathlib
import os
import shutil
from renamer.search import FileSearcher
class TestFileSearcher:
@classmethod
def setup_class(cls):
cls.file_searcher = FileSearcher()
cls.tmpdir = tempfile.mkdtemp()
cls.file1_path = os.path.join(cls.tmpdir, 'file1.txt')
... |
the-stack_0_10422 | import os
from datetime import datetime, timezone
import numpy as np
import pandas as pd
import pyspark.sql.functions as F
import pyspark.sql.types as pt
import pytest
from pyspark.sql import SparkSession
import ibis
from ibis import util
from ibis.backends.tests.base import BackendTest, RoundAwayFromZero
_pyspark_t... |
the-stack_0_10423 | from abc import ABC, abstractmethod
from .io.chem import load_molecule, build_fp
from .io.backends import PyTablesStorageBackend
from .FPSim2lib.utils import PyPopcount
import numpy as np
class BaseEngine(ABC):
fp_filename = None
storage = None
def __init__(
self,
fp_filename: str,
... |
the-stack_0_10425 | from matrx.actions.action import Action, ActionResult
from matrx.objects.agent_body import AgentBody
def _act_move(grid_world, agent_id, dx, dy):
""" Private MATRX method.
The method that actually mutates the location of an AgentBody based on a
delta-x and delta-y.
Parameters
----------
grid... |
the-stack_0_10426 | import torch
import numpy as np
import networkx as nx
class CenterObjective():
def __init__(self, dist, dmax, temp, hardmax=False):
'''
dist: (num customers) * (num locations) matrix
dmax: maximum distance that can be suffered by any customer (e.g., if
no facilities ... |
the-stack_0_10427 | import scipy.stats
import numpy as np
from math import ceil
from .. import img_as_float
from ..restoration._denoise_cy import _denoise_bilateral, _denoise_tv_bregman
from .._shared.utils import warn
import pywt
import skimage.color as color
import numbers
def denoise_bilateral(image, win_size=None, sigma_color=None, ... |
the-stack_0_10428 | from recsys.preprocess import *
from sklearn import model_selection
import numpy as np
from recsys.utility import *
RANDOM_STATE = 42
np.random.seed(RANDOM_STATE)
train = get_train()
target_playlist = get_target_playlists()
target_tracks = get_target_tracks()
# Uncomment if you want to test
# train, test, target_pla... |
the-stack_0_10429 | """
Engines API
Allow clients to fetch Analytics through APIs. # noqa: E501
The version of the OpenAPI document: v3:[pa,spar,vault,pub,quant,fi,axp,afi,npo,bpm,fpo,others],v1:[fiab]
Contact: analytics.api.support@factset.com
Generated by: https://openapi-generator.tech
"""
import re # noqa: F4... |
the-stack_0_10432 | import torch
from torch import nn
from torch.nn import functional as F
from models import infogan
class Encoder(nn.Module):
def __init__(self, latent_dim: int):
super().__init__()
self.h1_nchan = 64
self.conv1 = nn.Sequential(
nn.Conv2d(1, self.h1_nchan, kernel_size=4, str... |
the-stack_0_10433 | import gym
__all__ = ['SkipWrapper']
def SkipWrapper(repeat_count):
class SkipWrapper(gym.Wrapper):
"""
Generic common frame skipping wrapper
Will perform action for `x` additional steps
"""
def __init__(self, env):
super(SkipWrapper, self).__init__(env)... |
the-stack_0_10435 | #!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_literals
# Command line :
# python -m benchmark.VAR.GG.NN
import os
import logging
from config import SEED
from config import _ERROR
from co... |
the-stack_0_10437 | import argparse
from tdw.controller import Controller
from tdw.remote_build_launcher import RemoteBuildLauncher
class MinimalRemote(Controller):
"""
A minimal example of how to use the launch binaries daemon to
start and connect to a build on a remote node. Note: the remote
must be running binary_mana... |
the-stack_0_10438 | # Copyright (C) 2019 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Test bulk issuetracker synchronization."""
# pylint: disable=too-many-lines,invalid-name
import unittest
from collections import OrderedDict
import ddt
import mock
from flask import g
from ggrc import ... |
the-stack_0_10439 | import time
from collections import OrderedDict
import json
import os
import re
import praw
from dotenv import load_dotenv, find_dotenv
import requests
load_dotenv(find_dotenv())
client_id=os.environ['REDDIT_CLIENT_ID']
client_secret=os.environ['REDDIT_CLIENT_SECRET']
password=os.environ['REDDIT_PASSWORD']
username=... |
the-stack_0_10440 | from flask import Flask, request
import requests
import geopy
import re
# import geopy.distance
from geopy.geocoders import Nominatim
import json
from datetime import datetime
import constants
from twilio.twiml.messaging_response import MessagingResponse
# Create Flask app instance
app = Flask(__name__)
# Create geol... |
the-stack_0_10442 | import unittest
from fds.analyticsapi.engines.api.linked_pa_templates_api import LinkedPATemplatesApi
from fds.analyticsapi.engines.model.linked_pa_template_parameters_root import LinkedPATemplateParametersRoot
from fds.analyticsapi.engines.model.linked_pa_template_parameters import LinkedPATemplateParameters
from fds... |
the-stack_0_10443 | from unittest import TestCase
from tests import get_data
from pytezos.michelson.converter import build_schema, decode_micheline, encode_micheline, micheline_to_michelson
class StorageTestKT1D8STdsizybSqDGCDn19s8R8Fn6KcDW9xg(TestCase):
@classmethod
def setUpClass(cls):
cls.maxDiff = None
cls.... |
the-stack_0_10444 | import os
import torch
import torch.optim as optim
import torch.backends.cudnn as cudnn
import argparse
import torch.utils.data as data
from data import AnnotationTransform, BaseTransform, VOCDetection, detection_collate, coco_detection_collate, seq_detection_collate, mb_cfg, dataset_training_cfg, COCOroot, COCODetecti... |
the-stack_0_10445 | from __future__ import absolute_import
from django.db.models import Q
from rest_framework import serializers
from rest_framework.response import Response
from sentry.api.bases.organization import (
OrganizationEndpoint, OrganizationPermission
)
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.ap... |
the-stack_0_10446 | from schematic.models.metadata import MetadataModel
from schematic import CONFIG
config = CONFIG.load_config("schematic/config.yml")
inputMModelLocation = CONFIG["model"]["input"]["location"]
inputMModelLocationType = CONFIG["model"]["input"]["file_type"]
manifest_title = CONFIG["manifest"]["title"]
manifest_data_t... |
the-stack_0_10447 | from __future__ import division, print_function
import argparse
import datetime
import json
import os
import os.path
import shlex
import subprocess
DATA_TABLE_NAME = "ncbi_taxonomy_sqlite"
def build_sqlite(taxonomy_dir, output_directory, name=None, description=None):
if not os.path.exists(output_directory):
... |
the-stack_0_10448 | """Customized Django paginators."""
from __future__ import unicode_literals
from math import ceil
from django.core.paginator import (
EmptyPage,
Page,
PageNotAnInteger,
Paginator,
)
class CustomPage(Page):
"""Handle different number of items on the first page."""
def start_index(self):
... |
the-stack_0_10449 | # -*- coding: utf-8 -*-
# Copyright 2018 IBM.
#
# 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 agre... |
the-stack_0_10451 | #!/usr/bin/env python
# encoding: utf-8
"""
@author: sherlock
@contact: sherlockliao01@gmail.com
"""
import logging
import os
import sys
sys.path.append('.')
from fastreid.config import get_cfg
from fastreid.engine import DefaultTrainer, default_argument_parser, default_setup, launch, Hazytrainer
from fastreid.util... |
the-stack_0_10452 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
the-stack_0_10455 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
the-stack_0_10456 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
the-stack_0_10457 | # Copyright 2020 MONAI 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_0_10458 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
the-stack_0_10460 | __author__ = 'Sergei'
from model.contact import Contact
def test_contact_new(app):
old_contact = app.contact.get_contact_list()
contacts = Contact(first_n="first", mid_n="middle",last_n="last",nick_n= "kuk",company= "adda",address= "575 oiweojdckjgsd,russia",home_ph= "12134519827",cell_ph= "120092340980",emai... |
the-stack_0_10462 | """
===============================================
vidgear library source-code is deployed under the Apache 2.0 License:
Copyright (c) 2019-2020 Abhishek Thakur(@abhiTronix) <abhi.una12@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance wi... |
the-stack_0_10465 | import unittest
from pathlib import Path
from taskcat import Config
from taskcat.testing._unit_test import UnitTest
from taskcat.testing.base_test import BaseTest
class TestUnitTest(unittest.TestCase):
BaseTest.__abstractmethods__ = set()
@classmethod
def setUpClass(cls):
input_file = ".taskcat... |
the-stack_0_10466 | """
This file offers the methods to automatically retrieve the graph Eubacterium sp. AB3007.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protein... |
the-stack_0_10467 | #! /usr/bin/env python
try:
from io import StringIO
import builtins
except ImportError: # Python 3
from io import StringIO
import builtins as __builtin__
import glob
import os
import shutil
import sys
sys.path.append(os.path.dirname(sys.path[0]))
import AUTOutil
import bifDiag
import parseB
import par... |
the-stack_0_10468 | '''
Created on 5/9/2014
@author: victor
'''
import unittest
from pyproct.data.handler.dataHandler import DataHandler
from pyproct.data.handler.test.TestDataLoader import FakeFileLoader
class DataHandlerMock(DataHandler):
def get_loader(self, data_type):
return FakeFileLoader
class FakeSourceGenerator():... |
the-stack_0_10470 | import string
from time import sleep
from loguru import logger
from tacticalrmm.celery import app
from django.conf import settings
from agents.models import Agent
from .models import ChocoSoftware, ChocoLog, InstalledSoftware
logger.configure(**settings.LOG_CONFIG)
@app.task()
def install_chocolatey(pk, wait=False)... |
the-stack_0_10472 | from mythic_c2_container.C2ProfileBase import *
import sys
# request is a dictionary: {"action": func_name, "message": "the input", "task_id": task id num}
# must return an RPCResponse() object and set .status to an instance of RPCStatus and response to str of message
async def test(request):
response = RPCRespon... |
the-stack_0_10476 | import os.path
import sys
import tqdm
import pathlib
import cv2 as cv
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
import xml.etree.ElementTree as ET
from torchvision import ops
from torchvision import transforms
from torch.utils.data import... |
the-stack_0_10477 | #
# Copyright (C) 2008 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 by applicable la... |
the-stack_0_10478 | # Copyright 2022 Maximilien Le Clei.
#
# 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 w... |
the-stack_0_10479 | """Tests for the templatetags of the markdown_utils app."""
from django.test import TestCase
from ..templatetags import markdown_utils_tags as tags
class RenderMarkdownTestCase(TestCase):
"""Tests for the ``render_markdown`` assignment tag."""
longMessage = True
def test_tag(self):
result = tags... |
the-stack_0_10480 | """Measurements collection."""
from datetime import datetime, timedelta
from typing import Optional, cast
import pymongo
from pymongo.database import Database
from model.metric import Metric
from model.queries import get_attribute_type, get_measured_attribute
from server_utilities.functions import iso_timestamp, per... |
the-stack_0_10482 | import os
import asyncio
from jina import __default_host__
from jina.importer import ImportExtensions
from jina.serve.runtimes.gateway import GatewayRuntime
from jina.serve.runtimes.gateway.http.app import get_fastapi_app
__all__ = ['HTTPGatewayRuntime']
class HTTPGatewayRuntime(GatewayRuntime):
"""Runtime for... |
the-stack_0_10484 | from multiprocessing.connection import wait
from bot import dp
from aiogram import types
from aiogram.dispatcher.storage import FSMContext
from filters import Main, IsOwner
from functions.client import cidSelect, getpasswordState, sidSelect, pidSelect, cnSelect, sftSelect, scidSelect, getloginState, schoolInfo
from sta... |
the-stack_0_10486 | # Title: 개미
# Link: https://www.acmicpc.net/problem/4307
import sys
sys.setrecursionlimit(10 ** 6)
read_single_int = lambda: int(sys.stdin.readline().strip())
read_list_int = lambda: list(map(int, sys.stdin.readline().strip().split(' ')))
def solution(l: int, n: int, ants: list):
fast, slow = 0, 0
for a... |
the-stack_0_10487 | from datetime import datetime
import pytz as pytz
import scrapy
from fosdem_event_scraper.settings import INPUT_FILE
class FosdemEventSpider(scrapy.Spider):
name = "fosdem-event"
def start_requests(self):
with open(INPUT_FILE, "r") as fhandle:
for url in map(str.rstrip, fhandle.readline... |
the-stack_0_10488 | from __future__ import print_function
import os
import warnings
warnings.filterwarnings('ignore')
import time
import torch
import shutil
import argparse
from m2det import build_net
import torch.utils.data as data
import torch.backends.cudnn as cudnn
from torch.nn.utils.clip_grad import clip_grad_norm_
from layers.func... |
the-stack_0_10489 | from typing import *
class Solution:
def fourSum(self, nums: List[int], target: int) -> List[List[int]]:
result = set()
nums_len = len(nums)
nums.sort()
for i in range(nums_len):
for j in range(i + 1, nums_len):
k = j + 1
l = nums_len -... |
the-stack_0_10490 | import pandas as pd
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torch
import torchvision
import torchvision.transforms as transforms
from sklearn.model_selection import train_test_split
from torch.utils.data import TensorDataset, DataLoader, ... |
the-stack_0_10491 | #from .exchanges import Exchange, FTXSpot
import asyncio
class Order:
def __init__(self, order_id: str, base: str, quote: str, side: str, volume: float):
self.id = order_id
self.base = base
self.quote = quote
self.side = side.upper()
self.volume = volume
self.remaining_volume = volume
self.open = T... |
the-stack_0_10492 | __all__ = ["Monitor", "get_monitor_files", "load_results"]
import csv
import json
import os
import time
from glob import glob
from typing import List, Optional, Tuple, Union
import gym
import numpy as np
import pandas
from stable_baselines3.common.type_aliases import GymObs, GymStepReturn
class Monitor(gym.Wrapper... |
the-stack_0_10494 | # Copyright 2021 The NetKet 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_0_10497 | from inspect import signature
from typing import Any, Type, TypeVar
from httpx import Response
from .errors import TelePayError
T = TypeVar("T")
def validate_response(response: Response) -> None:
if response.status_code < 200 or response.status_code >= 300:
error_data = response.json()
error = ... |
the-stack_0_10498 | # Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
# You can find misc modules, which dont fit in anything xD
""" scape module for other small commands. """
from random ... |
the-stack_0_10500 | import operator
import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
@pytest.fixture
def data():
return pd.array(
[True, False] * 4 + [np.nan] + [True, False] * 44 + [np.nan] + [True, False],
dtype="boolean",
)
@pytest.fixture
def left_array():
return pd.ar... |
the-stack_0_10505 | import os
import re
import copy
import json
import logging
import configparser
from androguard.misc import *
from androguard.core import *
from analysis_utils import AnalysisUtils
from code_analyser_trace_adv import CodeTraceAdvanced
from common import Conversions
TRACE_FORWARD = 'FORWARD'
TRACE_REVERSE = 'REVERSE'
T... |
the-stack_0_10506 | params = {
'type': 'MBPO',
'universe': 'gym',
'domain': 'FetchPickAndPlace',
'task': 'v1',
'log_dir': '~/ray_mbpo/',
'exp_name': 'defaults',
'kwargs': {
'epoch_length': 1000,
'train_every_n_steps': 1,
'actor_train_repeat': 1,
'critic_train_repeat': 20,
... |
the-stack_0_10507 | #!/usr/bin/env python
import codecs
import os.path
import re
import sys
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
return codecs.open(os.path.join(here, *parts), 'r').read()
def find_version(*file_paths):
version_file = read(*file_paths... |
the-stack_0_10508 | from PyQt5 import QtCore, QtWidgets
def __package_list_updated(scene):
"""Rename package."""
for i in range(scene.ui.packages_listWidget.count()):
scene.project_data.packages[i] = scene.ui.packages_listWidget.item(i).text()
def __add_new_package(scene):
"""Add new package."""
selector = scen... |
the-stack_0_10511 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import os
import sys
import json
import time
import random
import getpass
import datetime
import gettext
import requests
import base64
from ikabot import config
from ikabot.config import *
from ikabot.helpers.botComm import *
from ikabot.helpers.gui import bann... |
the-stack_0_10512 | """
util
~~~~
Various utility routines for working with `tkinter`.
"""
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.font as tkfont
import tkinter.filedialog
import datetime as _datetime
import webbrowser as _web
import logging as _logging
NSEW = tk.N + tk.S + tk.E + tk.W
def screen_size(root):
... |
the-stack_0_10516 | # --------------
import pandas as pd
from collections import Counter
# Load dataset
data=pd.read_csv(path)
print(data.isnull().sum())
print(data.describe)
# --------------
import seaborn as sns
from matplotlib import pyplot as plt
sns.set_style(style='darkgrid')
# Store the label values
#X=data.drop(columns=["Ac... |
the-stack_0_10518 | import base64
import errno
import http.client
import logging
import os
import stat
import os.path as p
import pprint
import pwd
import re
import shutil
import socket
import subprocess
import time
import traceback
import urllib.parse
import shlex
import urllib3
import requests
try:
# Please, add modules that requir... |
the-stack_0_10519 | """ This file contains code for a fully convolutional
(i.e. contains zero fully connected layers) neural network
for detecting lanes. This version assumes the inputs
to be road images in the shape of 80 x 160 x 3 (RGB) with
the labels as 80 x 160 x 1 (just the G channel with a
re-drawn lane). Note that in order to... |
the-stack_0_10520 | def number_of_carries(a, b):
temp1, temp2=str(a), str(b)
temp1=temp1.rjust(len(temp2), "0")
temp2=temp2.rjust(len(temp1), "0")
carry=add=0
for i,j in zip(temp1[::-1], temp2[::-1]):
if (int(i)+int(j)+add)>=10:
carry+=1
add=1
else:
add=0
return c... |
the-stack_0_10523 | from question_model import Question
from data import question_data
from quiz_brain import QuizBrain
question_bank = list()
for q_data in question_data:
q_text = q_data['question']
q_answer = q_data['correct_answer']
new_q = Question(q_text, q_answer)
question_bank.append(new_q)
quiz = QuizBrain(questi... |
the-stack_0_10524 | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
the-stack_0_10525 | #!/usr/bin/env python3
# ----------------------------------------------------------------------
#
# Brad T. Aagaard, U.S. Geological Survey
# Charles A. Williams, GNS Science
# Matthew G. Knepley, University of Chicago
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geo... |
the-stack_0_10527 | from django import forms
from .models import Produto, Categoria, Materia
class cadastrar_produto(forms.ModelForm):
class Meta:
model = Produto
fields = ['nome', 'slug','categoria', 'descricao', 'price']
def save(self, commit=True):
this = super(cadastrar_produto, self).save(commit=Fal... |
the-stack_0_10530 | """
Mask R-CNN
Common utility functions and classes.
Copyright (c) 2017 Matterport, Inc.
Licensed under the MIT License (see LICENSE for details)
Written by Waleed Abdulla
"""
import sys
import os
import logging
import math
import random
import numpy as np
import tensorflow as tf
import scipy
import sk... |
the-stack_0_10532 | # Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import time
import power_state
class CrosECPower(power_state.PowerStateDriver):
"""Driver for power_state for boards support EC command."""
def... |
the-stack_0_10535 | def math():
test_case = int(input())
for i in range(test_case):
name, mass = (map(str, input().split()))
if name == 'Thor':
print('Y')
else:
print('N')
if __name__ == '__main__':
math()
|
the-stack_0_10537 | import torch
import torch.nn as nn
import torch.nn.functional as F
from encoding import get_encoder
from ffmlp import FFMLP
class SDFNetwork(nn.Module):
def __init__(self,
encoding="hashgrid",
num_layers=3,
skips=[],
hidden_dim=64,
... |
the-stack_0_10538 | #!/usr/bin/env python3
""" Listens for CEC keypresses and prints the keycode
"""
from time import sleep
import cec
from cecdaemon.const import USER_CONTROL_CODES, COMMANDS
import json
def print_keycode(event, *data):
""" Takes a python-cec cec.EVENT_COMMAND callback and prints the user control code
:param e... |
the-stack_0_10539 | #!/usr/bin/python
#
# 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 distribut... |
the-stack_0_10540 | import torch
import torch.nn as nn
import torch.nn.functional as F
class Att2One(nn.Module):
def __init__(self, input_dim, hidden_dim=256):
super(Att2One, self).__init__()
self.linear_trans = nn.Linear(input_dim, hidden_dim)
self.linear_q = nn.Linear(hidden_dim, 1, bias=False)
def f... |
the-stack_0_10544 | import setuptools
with open("README.rst", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="nbless",
version="0.2.38",
author="Martin Skarzynski",
author_email="marskar@gmail.com",
description="Construct, deconstruct, convert, and run Jupyter notebooks.",
long_description=lo... |
the-stack_0_10545 | # -*- coding: utf-8 -*-
"""
pygments.lexers.tcl
~~~~~~~~~~~~~~~~~~~
Lexers for Tcl and related languages.
:copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from testflows._core.contrib.pygments.lexer import RegexLexer, include, words
fr... |
the-stack_0_10546 | # coding: utf-8
# Modified Work: Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.