filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_29164 | from tkinter import *
window = Tk()
window.geometry("400x300+20+10")
window.title('The Grid Manager')
class MyWindow:
def __init__(self,window):
self.lbl1 = Entry(window,bd=3,justify="center")
self.lbl1.grid(row=0,column=0,padx=2)
self.lbl1.insert(0,"Standard Calculator")
... |
the-stack_106_29165 | from uuid import uuid4
from django.db import models
class BaseModelMixin(models.Model):
"""
Abstract Model class creation and modification datetimes
['site', 'created', 'updated']
"""
slug = models.SlugField(
max_length=100, unique=True, db_index=True,
default=uuid4, editable=Fal... |
the-stack_106_29166 | #
# 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, software
# distributed under t... |
the-stack_106_29169 | # Natural Language Toolkit: Table widget
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Tkinter widgets for displaying multi-column listboxes and tables.
"""
from __future__ import division
import nltk.compa... |
the-stack_106_29170 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import torch.utils.model_zoo as model_zoo
import torch
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152']
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth'... |
the-stack_106_29172 | # Copyright 2018 The Cirq Developers
#
# 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 ... |
the-stack_106_29173 | import json # https://docs.python.org/3/library/csv.html
# https://django-extensions.readthedocs.io/en/latest/runscript.html
import os
from index.models import Game_Model, Image_Model
def run():
fileNumber = 7
while fileNumber <= 7:
with open(f'res/data_{fileNumber}.json', "r") as f:
dat... |
the-stack_106_29175 | # -*- coding: utf-8 -*-
import lxml.etree
import six
import zeit.content.article.article
import zeit.wochenmarkt.interfaces
import zeit.wochenmarkt.testing
import zope.component
class TestRecipeCategoriesWhitelist(
zeit.wochenmarkt.testing.FunctionalTestCase):
def test_category_should_be_found_through_xm... |
the-stack_106_29179 | import os
import time
import random
import ujson as json
from typing import List, Set
from collections import OrderedDict
from nltk.tokenize import word_tokenize
from multiprocessing import Manager
stop_words = set(corpus.stopwords.words('english'))
random.seed(22)
base_url = 'https://en.wikipedia.org/?curid={}'
cla... |
the-stack_106_29180 | import errno
import os
import gevent.socket
import six
from geventhttpclient import __version__
from geventhttpclient.connectionpool import ConnectionPool
from geventhttpclient.header import Headers
from geventhttpclient.response import HTTPConnectionClosed
from geventhttpclient.response import HTTPSocketPoolResponse... |
the-stack_106_29182 | #
# 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 us... |
the-stack_106_29183 | from typing import Union
class Vehicle:
def __init__(self, type: str, model: str, price: int) -> None:
self.type: str = type
self.model: str = model
self.price: int = price
self.owner: Union[str, None] = None
def buy(self, money: int, owner: str) -> str:
if self.ow... |
the-stack_106_29184 | # encoding = utf-8
import os
import pdb
import time
import numpy as np
import torch
from torch import optim
from torch.autograd import Variable
from dataloader.dataloaders import train_dataloader, val_dataloader
from network import get_model
from eval import evaluate
from options import opt
from scheduler import sc... |
the-stack_106_29186 | # Copyright 2017 Presys Instrumentos e Sistemas Ltda.
# 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_29187 | # from https://github.com/amdegroot/ssd.pytorch
import torch
from torchvision import transforms
import cv2
import numpy as np
import types
from numpy import random
from PIL import Image
from torchvision.transforms import functional as F
from torchvision.transforms import Normalize as TorchNormalize
def intersect(b... |
the-stack_106_29188 | from bs4 import BeautifulSoup
import numpy as np
import requests
import re
import time
import random
class TradeList(object):
"""
A web scraper to extract sales attributes from autotrader.co.uk
Specify the make, model, postcode and search radius for the vehicle
Part of a larger machine learning sales... |
the-stack_106_29189 | # qubit number=4
# total number=40
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_29190 | '''
___ _ ___ __ _______
/\/\ _ __ / _ \ | __ _ _ _ ___ _ __ / __\ / / \_ _ /
/ \| '__/ /_)/ |/ _` | | | |/ _ \ '__|____ / / / / / /
/ /\/\ \ | / ___/| | (_| | |_| | __/ | |_____/ /___/ /___/\/ /_
\/ \/_| \/ |_|\__,_|\__, |\___|_| \_... |
the-stack_106_29191 | """
LIF (Leaky integrate-and-fire) Neuron model
Copyright(c) HiroshiARAKI
"""
import numpy as np
import matplotlib.pyplot as plt
from .neuron import Neuron
from ..tools import kernel
class LIF(Neuron):
"""
LIF: leaky integrate-and-fire model
"""
def __init__(self,
time: int,
... |
the-stack_106_29195 | from kit.dependency_file import *
class probability:
def set_exp_pr(self,pop,pressure):
self.pop = pop;
sigma = 0;
for x in (pop):
sigma += (math.exp(-pressure * x['evaluation']));
for x in pop:
x['pr'] = (math.exp(-pressure * x['evaluatio... |
the-stack_106_29196 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from typing import List, Optional, Dict, Any, Tuple
import torch
import torch.distribut... |
the-stack_106_29199 | #!/usr/bin/env python3
# Copyright (c) 2014-2020 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 behavior of headers messages to announce blocks.
Setup:
- Two nodes:
- node0 is the node-und... |
the-stack_106_29200 | # Copyright 2015 Intel 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 requir... |
the-stack_106_29202 | import logging
from tests.helpers.log_helper import log_operation
def create_namespace(database, namespace_name):
"""
Create a namespace
"""
db, db_name = database
log_operation.info(f"Create a namespace with name '{namespace_name}' on database '{db_name}'")
try:
db.namespace_open(nam... |
the-stack_106_29205 | import cv2 as cv
import numpy as np
class Blender:
BLENDER_CHOICES = ('multiband', 'feather', 'no',)
DEFAULT_BLENDER = 'multiband'
DEFAULT_BLEND_STRENGTH = 5
def __init__(self, blender_type=DEFAULT_BLENDER,
blend_strength=DEFAULT_BLEND_STRENGTH):
self.blender_type = blender_... |
the-stack_106_29208 | from pfunk import Collection, StringField, EnumField, Enum, ReferenceField, SlugField
from pfunk.resources import Index
from pfunk.contrib.auth.collections import User, Group
from pfunk.contrib.auth.resources import GenericGroupBasedRole, GenericUserBasedRole
GENDER_PRONOUN = Enum(name='gender_pronouns', choices=['he'... |
the-stack_106_29210 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
import tensorflow.compat.v1 as tf
from . import modeling
def _get_initializer(FLAGS):
"""Get variable intializer."""
if FLAGS.init == 'uniform':
initializer = tf.initiali... |
the-stack_106_29213 | __version__ = '1.0.0b4'
import io
import cmd
import sys
import readline
import shlex
import traceback
import importlib.util
from argparse import _SubParsersAction
from argparse import _HelpAction, Action
from contextlib import redirect_stdout
# Prevent to execute exit() when help and error method in argparse.Argpars... |
the-stack_106_29214 | # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
#
"""
Parsing for the moduli file, which contains Diffie-Hellman prime groups.
Maintainer: Paul Swartz
"""
def parseModuliFile(filename):
lines = open(filename).readlines()
primes = {}
for l in lines:
l = l.strip(... |
the-stack_106_29215 |
#importing the necessary modules
from sklearn import datasets
from sklearn.model_selection import train_test_split
import numpy as np
import matplotlib.pyplot as plt
#calcuating the mean
def mean(values):
return sum(values)/float(len(values))
#calculating the variance
def variance(values,mean):
return sum([(x-mea... |
the-stack_106_29218 | # Copyright 2016 OpenMarket Ltd
#
# 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 writin... |
the-stack_106_29219 | """Spark helper functions"""
import csv
import logging
import os
from pathlib import Path
from typing import AnyStr, List, Union
from pyspark.sql import Row, SparkSession
from pyspark.sql.types import StructType, StringType
from pyspark import SparkConf
from dsgrid.exceptions import DSGInvalidField
from dsgrid.utils... |
the-stack_106_29220 | """meltano run command and supporting functions."""
from typing import List, Union
import click
import structlog
from meltano.core.block.blockset import BlockSet
from meltano.core.block.parser import BlockParser, validate_block_sets
from meltano.core.block.plugin_command import PluginCommandBlock
from meltano.core.pr... |
the-stack_106_29221 | """
*************************************************************************
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you 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 ht... |
the-stack_106_29224 | import os
import time
import pandas as pd
from tqdm import tqdm
from pm4py.objects.log.importer.xes import importer as xes_importer
from pm4py.algo.discovery.inductive import algorithm as inductive_miner
from pm4py.algo.conformance.tokenreplay import algorithm as token_replay
from skmultiflow.utils import calculate_obj... |
the-stack_106_29225 | import rlkit.misc.hyperparameter as hyp
from multiworld.envs.pygame import PickAndPlaceEnv
from rlkit.launchers.launcher_util import run_experiment
from rlkit.torch.sets.vae_launcher import train_set_vae
if __name__ == "__main__":
variant = dict(
env_id='OneObject-PickAndPlace-BigBall-RandomInit-2D-v1',
... |
the-stack_106_29226 | import http.client
con_obj = http.client.HTTPSConnection("www.imdb.com")
con_obj.request("GET", "/")
response = con_obj.getresponse()
print("Status: {}".format(response.status))
read_data = response.read(1000)
print(read_data)
con_obj.close()
|
the-stack_106_29228 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import math
from functools import partial
__all__ = ['WideResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101']
def conv3x3x3(in_planes, out_planes, stride=1):
# 3x3x3 convolution with padding
return nn... |
the-stack_106_29230 | # -*- coding: utf-8 -*-
import logging
from subprocess import CalledProcessError, check_call
from apps.offline.models import THUMBNAIL_HEIGHT
def create_thumbnail(instance):
logger = logging.getLogger(__name__)
logger.debug('Checking for thumbnail for "%s".' % instance.title)
if instance.thumbnail_exist... |
the-stack_106_29234 | # pylint: disable=E1101
from warnings import catch_warnings
from datetime import datetime, timedelta
from functools import partial
from textwrap import dedent
from operator import methodcaller
import pytz
import pytest
import dateutil
import numpy as np
import pandas as pd
import pandas.tseries.offsets as offsets
im... |
the-stack_106_29235 | import os
import torch
import pickle
from MeLU import MeLU
from options import config
def selection(melu, master_path, topk):
if not os.path.exists("{}/scores/".format(master_path)):
os.mkdir("{}/scores/".format(master_path))
if config['use_cuda']:
melu.cuda()
melu.eval()
... |
the-stack_106_29237 | import numpy as np
from bokeh import plotting
from bokeh.embed import components
from bokeh.io import curdoc
from bokeh.models import FuncTickFormatter, OpenURL, TapTool
from bokeh.models import Label, Legend, LegendItem, LogAxis, Range1d
from bokeh.themes import Theme
from utils import get_update_time, load_data, log... |
the-stack_106_29238 | from typing import Set
import logging
from pathlib import Path
import itertools as it
import re
from zensols.config import YamlConfig
logger = logging.getLogger(__name__)
class AppConfig(YamlConfig):
"""Application specific configuration access and parsing.
Since much of the application centers around confi... |
the-stack_106_29239 | """
==============
SGD: Penalties
==============
Contours of where the penalty is equal to 1
for the three penalties L1, L2 and elastic-net.
All of the above are supported by
:class:`sklearn.linear_model.stochastic_gradient`.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
l1_color = "navy"
l... |
the-stack_106_29241 | # -*- coding: utf-8 -*-
"""VGG16 model for Keras.
# Reference
- [Very Deep Convolutional Networks for Large-Scale Image Recognition](https://arxiv.org/abs/1409.1556)
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import warnings
from keras.models impor... |
the-stack_106_29242 | #!/usr/bin/env python
# Copyright 2016 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
the-stack_106_29243 | '''
Created on Apr 1, 2015
@author: bgt
'''
import unittest
import github
from GitHubDao import GitHubDao
import NonSomeFinder
class FunctionalityTest(unittest.TestCase):
def setUp(self):
self.positiveCase="sferik/twitter"
self.negativeCase="tomibgt/GitHubResearchDataMiner"
self.urlToPars... |
the-stack_106_29244 | from complementos import *
eps = 1e-10
#1
def Leer_Datos(filename):
df = pd.read_csv(filename, sep = "\t")
np_arr = df.to_numpy()
np_arr = np_arr.T
temp = [np.ones(np_arr.shape[1]).tolist()]
for i in np_arr:
temp.append(i.tolist())
answer = np.asarray(temp)
return answer
#2
def No... |
the-stack_106_29245 | import os, sys
import numpy as np
import matplotlib.pyplot as plt
import functools
import argparse
import inspect
def parse(func):
"""
Quick and dirty way to make any main with optional keyword arguments parsable from the command line.
"""
@functools.wraps(func)
def wrapper(**kwargs):
# Ge... |
the-stack_106_29246 | import pyb
def test_irq():
# test basic disable/enable
i1 = pyb.disable_irq()
print(i1)
pyb.enable_irq() # by default should enable IRQ
# check that interrupts are enabled by waiting for ticks
pyb.delay(10)
# check nested disable/enable
i1 = pyb.disable_irq()
i2 = pyb.disable_ir... |
the-stack_106_29247 | # -*- coding: utf-8 -*-
"""Implements classes for generating data by schema."""
from typing import Any, Callable, Final, Iterator, List, Optional, Sequence
from mimesis.exceptions import FieldError, SchemaError
from mimesis.locales import Locale
from mimesis.providers.generic import Generic
from mimesis.typing import... |
the-stack_106_29248 | import click
from amusement import Parks
@click.command()
@click.argument('name', nargs=1, type=click.Choice(Parks.keys()))
@click.option('--type', type=click.Choice(['rides', 'shows']), prompt='Please choose rides or shows')
def cli(name, type):
park = Parks[name]
if type == 'rides':
print_rides(park.... |
the-stack_106_29249 | from typing import Any, Dict, List, Optional, Tuple
from ConfigSpace.configuration_space import Configuration, ConfigurationSpace
import numpy as np
from sklearn.base import ClassifierMixin
from autoPyTorch.pipeline.base_pipeline import BasePipeline
from autoPyTorch.pipeline.components.base_choice import autoPyTorc... |
the-stack_106_29253 | # -*- coding: utf-8 -*-
import tempfile
import threading
from urllib.parse import quote
import json
import datetime
import time
import math
import re
import sys
import os
try:
from selenium import webdriver
from selenium.common.exceptions import TimeoutException, WebDriverException
from selenium.common.ex... |
the-stack_106_29254 | from collections import OrderedDict, defaultdict
from copy import deepcopy
from typing import Any, Dict
import pytest
from zulipterminal.config.keys import keys_for_command
from zulipterminal.helper import initial_index as helper_initial_index
from zulipterminal.ui_tools.boxes import MessageBox
from zulipterminal.ui_... |
the-stack_106_29259 | from __future__ import division, absolute_import
import re
import numpy as np
from dataset_loader import DatasetLoader
import tflearn
from tflearn.layers.core import input_data, dropout, fully_connected, flatten
from tflearn.layers.conv import conv_2d, max_pool_2d, avg_pool_2d
from tflearn.layers.merge_ops import merge... |
the-stack_106_29261 | from os import path
def run():
with open(path.join(path.dirname(__file__), '../inputs/03.txt')) as file:
n = int(file.read())
print('part 1:', spiral_distance(n))
print('part 2:', first_greater_than(n))
def first_greater_than(n):
x = 0
y = 0
directions = [(1, 0), (0, 1), (-1, 0), (0, -... |
the-stack_106_29262 | # 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
#
# Unlessf required by ap... |
the-stack_106_29264 | #!/usr/bin/env python3
# Safe Update: A simple service that waits for network access and tries to
# update every 10 minutes. It's intended to make the OP update process more
# robust against Git repository corruption. This service DOES NOT try to fix
# an already-corrupt BASEDIR Git repo, only prevent it from happenin... |
the-stack_106_29267 | import numpy as np
import json
import os
import cv2
import matplotlib.pyplot as plt
from scipy.spatial.distance import cdist
from scipy.optimize import linear_sum_assignment
import argparse
def computeIoU(head_bb, person_bb, epsilon=0.1, threshold=0.7):
"""
compute the ratio of intersection and union of the gi... |
the-stack_106_29268 | from datetime import datetime, timedelta
from urllib.parse import urljoin
from isodate import parse_datetime, parse_duration
import requests
from solcast.base import Base
class RadiationEstimatedActuals(Base):
end_point = 'radiation/estimated_actuals'
def __init__(self, latitude, longitude, *args, **kwarg... |
the-stack_106_29269 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2021 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
"""Minolta light-measuring devices
See http://www.konicaminolta.com/instruments
---------... |
the-stack_106_29272 | import sys
from PyQt5.QtCore import Qt, QDir, QUrl
from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import QWidget, QGridLayout, QLabel, QPushButton, QApplication
from PyQt5.QtMultimedia import QMediaContent, QMediaPlayer
class janela_vencedor(QWidget):
def __init__(self, equipe_vencedora):
QWidget.__ini... |
the-stack_106_29273 | from constants import *
from utils.db import connect_db
@connect_db
def add_email(db, email):
table = db[EMAILS_TABLE]
table.upsert(email, [EMAIL_KEY])
@connect_db
def remove_email(db, email):
table = db[EMAILS_TABLE]
table.delete(email=email)
@connect_db
def get_email(db, email):
table = db[... |
the-stack_106_29275 | import os
import sys
import shutil
import json
import time
import datetime
import tempfile
import warnings
from collections import defaultdict
import tensorflow as tf
from tensorflow.python import pywrap_tensorflow
from tensorflow.core.util import event_pb2
from tensorflow.python.util import compat
DEBUG = 10
INFO = ... |
the-stack_106_29276 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# 地址:http: //www.runoob.com/python/python-exercise-example85.html
def func(num):
j = 1
sum = 9
m = 9
flag = True
while flag:
if sum % num == 0:
print(sum)
flag = False
else:
m *= 10
sum +... |
the-stack_106_29280 | # circulaRprint #
# Circular Plotter controller for Raspberry Pi #
# Author: Oehrly, 2018 #
#################################################
#
# SegmentAccelerationPlanner and StepAccelerationPlanner
# The SegmentAP manages the acceleration from segment to segm... |
the-stack_106_29282 | import argparse
import datetime
import json
import logging
import os
import os.path
import random
import sys
import time
import urllib.request
from mastodon import Mastodon
import tracery
from tracery.modifiers import base_english
logging.basicConfig(level=logging.INFO)
class Config:
def __init__(self, path):
... |
the-stack_106_29283 | import pkg_resources
from mako.lookup import TemplateLookup
from bravado_types.config import Config
from bravado_types.data_model import SpecInfo
from bravado_types.metadata import Metadata
def render(metadata: Metadata, spec: SpecInfo, config: Config) -> None:
"""
Render module and stub files for a given Sw... |
the-stack_106_29286 | import pytest
import torch
from deepspeech.models import DeepSpeech2
@pytest.fixture
def model():
return DeepSpeech2()
def test_load_state_dict_restores_parameters(model):
act_model = DeepSpeech2()
act_model.load_state_dict(model.state_dict())
# Naive equality check: all network parameters are equ... |
the-stack_106_29288 | import logging
import requests
import pickle
import os
import json
import urllib
from math import sin, cos, sqrt, atan2, radians
log = logging.getLogger(__name__)
# Telegram tokens - see https://www.mariansauter.de/2018/01/send-telegram-notifications-to-your-mobile-from-python-opensesame/
#
bot_token = 'your token'
b... |
the-stack_106_29289 | import _plotly_utils.basevalidators
class TextfontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self,
plotly_name='textfont',
parent_name='scatterpolargl.selected',
**kwargs
):
super(TextfontValidator, self).__init__(
plotly_name=... |
the-stack_106_29290 | import os
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
from train_noff1 import main, create_argparser
import valid_noff1
from multiprocessing import Process
from datetime import datetime
from time import sleep
def hidden_dim_search():
# get default args and manipulate them
args = ... |
the-stack_106_29291 | # -*- coding: utf-8 -*-
import re
from pathlib import Path
from textwrap import dedent
from unittest.mock import call, patch
import pytest
from jsonschema import ValidationError
from jaffle.config.jaffle_config import JaffleConfig
from jaffle.config.template_string import TemplateString
from jaffle.config.value impo... |
the-stack_106_29292 | # 🚩 Dada Ki Jay Ho 🚩
import os
import webbrowser
from Resources.UsedForBoth.text_to_speech import sayAndWait
path = ""
def open_folder(cmd:str):
global path
if "open" in cmd and ("folder" in cmd or "drive" in cmd):
if "drive" in cmd:
cmd = cmd.replace("drive", "")
drive_nam... |
the-stack_106_29294 | # -*- coding: utf-8 -*-
from simmate.workflow_engine import s3task_to_workflow
from simmate.calculators.vasp.tasks.relaxation import (
Quality01Relaxation as Quality01RelaxationTask,
)
from simmate.calculators.vasp.database.relaxation import (
Quality01Relaxation as Quality01RelaxationResults,
)
workflow = s3... |
the-stack_106_29295 | # 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 app... |
the-stack_106_29296 | from __future__ import unicode_literals
import os
import shlex
import subprocess
import sys
import syslog
import time
from traceback import format_exception
from cyder.base.mixins import MutexMixin
from cyder.base.utils import (copy_tree, dict_merge, log, run_command,
set_attrs, shell_ou... |
the-stack_106_29297 | from flask import Flask, render_template, request
import jsonify
import requests
import pickle
import numpy as np
import sklearn
from sklearn.preprocessing import StandardScaler
app = Flask(__name__)
model = pickle.load(open('random_forest_regression_model.pkl', 'rb'))
@app.route('/',methods=['GET'])
def Home... |
the-stack_106_29298 | # encoding=utf8
# pylint: disable=anomalous-backslash-in-string
import math
__all__ = ['Whitley']
class Whitley(object):
r"""Implementation of Whitley function.
Date: 2018
Authors: Grega Vrbančič and Lucija Brezočnik
License: MIT
Function: **Whitley function**
:math:`f(\mathbf{x}) = ... |
the-stack_106_29299 | import os
def migratoryBirds(arr):
count = [0, 0, 0, 0, 0]
for i in range(len(arr)):
if arr[i] == 1:
count[0] += 1
if arr[i] == 2:
count[1] += 1
if arr[i] == 3:
count[2] += 1
if arr[i] == 4:
count[3] += 1
if arr[i] == ... |
the-stack_106_29301 | ########
# Copyright (c) 2019 Cloudify Platform Ltd. 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 requi... |
the-stack_106_29304 | def func1():
import dtlpy as dl
if dl.token_expired():
dl.login()
def func2():
project = dl.projects.create(project_name='project-sdk-tutorial')
project.datasets.create(dataset_name='dataset-sdk-tutorial')
def func3():
project = dl.projects.get(project_name='project-sdk-tutorial')
da... |
the-stack_106_29305 | import os
import pandas as pd
import korbinian
from Bio import SeqIO
# import debugging tools
from korbinian.utils import pr, pc, pn, aaa
def create_nonred_uniprot_flatfile_via_uniref(s, uniprot_dir, selected_uniprot_records_flatfile, logging):
""" Creates a non-redundant UniProt flatfile from redundant redundant ... |
the-stack_106_29308 | import datetime
import pytest
from blackbox import config
from blackbox import noop_pg_backup_statements
from blackbox import small_push_dir
from gs_integration_help import default_test_gs_bucket
from os import path
from s3_integration_help import default_test_bucket
from stage_pgxlog import pg_xlog
# Quiet pyflakes ... |
the-stack_106_29310 | import numpy as np
import pytest
import taichi as ti
@pytest.mark.skipif(not ti.has_pytorch(), reason='Pytorch not installed.')
@ti.test(exclude=ti.opengl)
def test_ndarray_2d():
n = 4
m = 7
@ti.kernel
def run(x: ti.any_arr(), y: ti.any_arr()):
for i in range(n):
for j in range(m... |
the-stack_106_29312 | import sys
import torch
import argparse
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import shutil
from torch.autograd import Variable
from torch.utils import data
import os
from dataset import IC15Loader
from metrics import runningScore
import models
from util import Logger, AverageMeter
... |
the-stack_106_29313 | import logging
import sdk_cmd
LOG = logging.getLogger(__name__)
def add_acls(user: str, task: str, topic: str, zookeeper_endpoint: str, env_str=None):
"""
Add Porducer and Consumer ACLs for the specifed user and topic
"""
_add_role_acls("producer", user, task, topic, zookeeper_endpoint, env_str)
... |
the-stack_106_29314 | from tkinter import *
from PIL import ImageTk, Image # Picture Processing library
"""
Instatantiate new window and define its properties
"""
# Create Window
root = Tk()
# Create Title
root.title('ME362')
# Define Default Window Size
root.geometry("800x800") #(Width x Height)
# root.state('zoomed') #Fullscr... |
the-stack_106_29315 | import collections
import filecmp
import logging
import os
import shutil
import pytest
from mock import patch
from dvc.cache.base import CloudCache
from dvc.dvcfile import DVC_FILE_SUFFIX, PIPELINE_FILE, Dvcfile
from dvc.exceptions import (
CheckoutError,
CheckoutErrorSuggestGit,
ConfirmRemoveError,
D... |
the-stack_106_29319 | # Copyright 2018 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_29323 | import turtle
import ball
num_balls = int(input("Number of balls to simulate: "))
turtle.speed(0)
turtle.tracer(0)
turtle.hideturtle()
canvas_width = turtle.screensize()[0]
canvas_height = turtle.screensize()[1]
ball_radius = 0.05 * canvas_width
turtle.colormode(255)
color_list = []
xpos = []
ypos = []
vx = []
vy = []... |
the-stack_106_29330 | import numpy as np
from perfect_information_game.tablebases import SymmetryTransform
from perfect_information_game.tablebases import AbstractTablebaseManager, get_verified_chess_subclass
class ChessTablebaseManager(AbstractTablebaseManager):
"""
Each tablebase has a descriptor, in a form such as KQkn (king an... |
the-stack_106_29331 | # Copyright (c) 2009 Raymond Hettinger
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation files
# (the "Software"), to deal in the Software without restriction,
# including without limitation the rights to use, copy, modify, merge,
# publish,... |
the-stack_106_29332 | # (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import re
from io import StringIO
DESCRIPTION_LINE_LENGTH_LIMIT = 120
TAB_SECTION_START = '<!-- xxx tabs xxx -->'
TAB_SECTION_END = '<!-- xxz tabs xxx -->'
TAB_START = '<!-- xxx tab "{}" xxx -->'
TAB_END... |
the-stack_106_29333 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
# @Time : 2020-07-16 09:01
# @Author : WangCong
# @Email : iwangcong@outlook.com
import numpy as np
import cv2
camera_parameter = {
# R
"R": [[-0.91536173, 0.40180837, 0.02574754],
[0.05154812, 0.18037357, -0.98224649],
[-0.39931903, -0.8977... |
the-stack_106_29335 | import numpy as np
from datetime import datetime
import time
from flask import Flask
from flask import Markup
from flask import Flask, request
from flask import render_template
from . import database
from .core import publishers
from . import apis
from . import exceptions
app = Flask(__name__)
def get_weekly_topic_... |
the-stack_106_29336 | # a123_apple_1.py
import turtle as trtl
#-----setup-----
t=0
tstep = 0.25
delx = 2
g = -1
yvel = 20
y=0
apple_image = "apple.gif" # Store the file name of your shape
pear_image = "pear.gif" # Store the file name of your shape
wn = trtl.Screen()
wn.setup(width=0.... |
the-stack_106_29337 | import requests
import pandas as pd
import datetime as dt
import numpy as np
#### dict_keys(['table', 'currency', 'code', 'rates'])
def getCurrencyLow(days, currency, currencyName): # Getting currency below 350 days (used for getting data from larger time periods)
today = dt.datetime.today()
for i in range(da... |
the-stack_106_29340 | import os
import cloudpickle
from quake.client.base.client import Client
from quake.client.base.plan import Plan
_global_plan = Plan()
_global_client = None
_pickle_cache = {}
_inouts_objs = {}
def get_inout_obj(obj):
pair = _inouts_objs.get(id(obj))
if pair:
return pair[0]
else:
return ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.