filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_5542 | import socket
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
return "ahoj"
if __name__ == "__main__":
# resolving machine IP address for correct web publishing
hostname = socket.gethostname()
ip_here = socket.gethostbyname(hostname)
app.run(debug=True, host=ip_here... |
the-stack_0_5545 | from typing import Any
import typing
from conda_forge_tick.xonsh_utils import indir
from .core import MiniMigrator
from conda_forge_tick.utils import as_iterable
if typing.TYPE_CHECKING:
from ..migrators_types import AttrsTypedDict
class PipMigrator(MiniMigrator):
bad_install = (
"python setup.py in... |
the-stack_0_5546 | import warnings
from torchvision.datasets import *
from .base import *
from .coco import COCOSegmentation
from .ade20k import ADE20KSegmentation
from .pascal_voc import VOCSegmentation
from .pascal_aug import VOCAugSegmentation
from .pcontext import ContextSegmentation
from .cityscapes import CitySegmentation
from .ima... |
the-stack_0_5547 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class Article(object):
def __init__(self):
self._action_name = None
self._desc = None
self._image_url = None
self._title = None
self._url = None
... |
the-stack_0_5548 | # Copyright 2015 Mellanox Technologies, 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 t... |
the-stack_0_5549 | from os import urandom
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
class AESCipher:
""" Wrapper for cryptography aes cipher.
:attr char: padding_value(char): padding character used for encryption.
"""
padding_val... |
the-stack_0_5550 | import os
import gmplot
import requests
from requests import RequestException
from numpy import random
class CoordinatesPlotter:
@staticmethod
def plot_coordinates_on_map():
apikey = ''
try:
response = requests.get("")
response.raise_for_status()
print(res... |
the-stack_0_5552 | #
# Copyright 2020 Intellivoid Technologies
#
# 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_5553 | from django import forms
from django.contrib import admin
from django.contrib.admin.utils import unquote
from django.http import (
JsonResponse, HttpResponse, HttpResponseBadRequest, HttpResponseForbidden
)
from django.utils import timezone
from django.urls import re_path
from experiments import conf
from experime... |
the-stack_0_5554 |
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
"""Base Widget class. Allows user to create widgets in the back-end that render
in the IPython notebook front-end.
"""
from contextlib import contextmanager
from collections.abc import Iterable
from IPython.core.get... |
the-stack_0_5556 | #
# Copyright 2017-2018 Stanislav Pidhorskyi. All rights reserved.
# License: https://raw.githubusercontent.com/podgorskiy/impy/master/LICENSE.txt
#
from setuptools import setup, Extension, find_packages
from distutils.errors import *
from distutils.dep_util import newer_group
from distutils import log
from distutils.... |
the-stack_0_5558 | import argparse
import threading
import time
# import uuid
from http.server import BaseHTTPRequestHandler, HTTPServer
from typing import Tuple, Union
import consul
import yaml
from consul.base import Check
from logger import create_info_logger
from utils.network import find_open_port, get_ip_address
logger = create... |
the-stack_0_5561 |
import os, sys, time, random, argparse, math
import numpy as np
from copy import deepcopy
from collections import defaultdict
import torch
import torch.nn as nn
import wandb
from tqdm import tqdm
from pathlib import Path
from hessian_eigenthings import compute_hessian_eigenthings
lib_dir = (Path(__file__).parent / '.... |
the-stack_0_5562 | """
VHDL Mode for Sublime Text 3
This package attempts to recreate to some level of fidelity the features
in the vhdl-mode in Emacs.
"""
import os
import time
import re
import textwrap
import sublime
import sublime_plugin
#from threading import Thread
from . import vhdl_lang as vhdl
from . import vhdl_... |
the-stack_0_5563 | """
Data structures required for our testing.
"""
import os
import shutil
from wsgi_intercept import httplib2_intercept
import wsgi_intercept
from tiddlyweb.web.serve import load_app
from tiddlyweb.model.collections import Tiddlers
from tiddlyweb.model.bag import Bag
from tiddlyweb.model.tiddler import Tiddler
from ... |
the-stack_0_5564 | #!/Users/marc/miniconda3/bin/python3
import math
import numpy as np
def sphere_vertices( n ):
phistep = math.pi / n
thetastep = 2*math.pi / n
vertices = []
for i in range( n+1 ):
phi = - math.pi/2 + i * phistep
if i == 0:
tb = 'bottom'
elif i==n:
tb = '... |
the-stack_0_5565 | #!/usr/bin/env python
import os
import subprocess
import re
import time
import json
from charmhelpers.core import hookenv
from charmhelpers.core.host import get_nic_mtu, service_start, service_running
from charmhelpers.fetch import apt_install
class Lldp():
lldp_out = '/home/ubuntu/lldp_output.json'
enabled ... |
the-stack_0_5566 | # -*- coding: utf-8 -*-
import pytest
import datetime
from web.processors.event import create_or_update_event
@pytest.mark.django_db
def test_unknown_URL(db, client):
response = client.get('/bar-foo/')
assert response.status_code == 404
@pytest.mark.django_db
def test_country_redirect(db, client):
# T... |
the-stack_0_5567 | import json
import os
from typing import Union
from pathlib import Path
from jsonschema import RefResolver, Draft7Validator
from aqt import mw
from aqt.qt import QWidget, QLabel, Qt
from ...lib.config import serialize_setting, deserialize_setting
from ...lib.config_types import TWConcrScript, TWMetaScript
from ...... |
the-stack_0_5568 | r"""
Polynomial Regression
=====================
This example shows how to use the :py:class:`pylops.Regression` operator
to perform *Polynomial regression analysis*.
In short, polynomial regression is the problem of finding the best fitting
coefficients for the following equation:
.. math::
y_i = \sum_{... |
the-stack_0_5570 | # -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-用户管理(Bk-User) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the Lic... |
the-stack_0_5572 | #!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'getTotalX' function below.
#
# The function is expected to return an INTEGER.
# The function accepts following parameters:
# 1. INTEGER_ARRAY a
# 2. INTEGER_ARRAY b
#
def isCommonFactor(b, num):
for e in b:
if (e %... |
the-stack_0_5574 | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
the-stack_0_5575 | import torch.nn as nn
import torch.optim as optim
import argparse
import os
from utils import process_all_files,load_GloVe,accuracy_cal
from model import GA_Reader
from data_loader import DataLoader,TestLoader
def train(epochs,iterations,loader_train,loader_val,
model,optimizer,loss_function):
for e... |
the-stack_0_5577 | '''
Merge Sort
Time Complexity: O(N*log(N))
Space Complexity: N
'''
from algorithms.Algorithm import Algorithm
class MergeSort(Algorithm):
def __init__(self):
super().__init__("Merge Sort")
def algorithm(self, temp_array = [], index = 0):
if temp_array == []:
temp_ar... |
the-stack_0_5578 | import json
import re
from lxml import html
import HTMLInfo
import sys
class JDPrice(object):
def __init__(self, url):
self.url = url
HTMLInfo.REFERER = url
r = HTMLInfo.get_html(url)
self.html = r.text
self.info = self.get_product()
def get_url_page(self):
... |
the-stack_0_5580 | # Modelliere eine Warteschlange von Autos beim TÜV
# Aufgaben: Eingabe des Autokennzeichens eines neuen Kunden
# Anhängen des neuen Kfz-Kennz. an die bestehende Warteschlange
# Ausgabe des Kfz-Kennz. des nächsten Autos
# Entfernen dieses Kennz. anschließend
# Programm beende... |
the-stack_0_5583 | import json
import logging
from os import execv, unlink
import subprocess
from threading import Thread
from time import sleep
import netifaces
from fiotest.api import API
from fiotest.spec import Reboot, Sequence, Test, TestSpec
log = logging.getLogger()
class SpecStopped(Exception):
pass
class SpecRunner:
... |
the-stack_0_5584 | from django.shortcuts import render, get_object_or_404, redirect
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator
from django.db.models import Count
from django.contrib import messages
from .models import Poll, Choice, Vote
from .forms import PollAddForm, EditPollFor... |
the-stack_0_5586 | # Copyright (C) 2017-2018 Intel Corporation
#
# SPDX-License-Identifier: MIT
import dpctl
import base_bs_erf
import numba_dppy
from math import log, sqrt, exp, erf
@numba_dppy.kernel
def black_scholes( nopt, price, strike, t, rate, vol, call, put):
mr = -rate
sig_sig_two = vol * vol * 2
i = numba_dpp... |
the-stack_0_5587 | from db import connection
cnx = connection()
cursor = cnx.cursor()
def execute(names, query, cursor=cursor):
print(query)
cursor.execute(query)
print('\t'.join(names))
for tpl in cursor:
print('\t'.join(str(s) for s in tpl))
print()
def where_clauses(no_forks=False, language=None):
w... |
the-stack_0_5588 | import pandas as pd
import requests
import us
from bs4 import BeautifulSoup
from can_tools.scrapers.base import CMU
from can_tools.scrapers.official.base import CountyDashboard
class ArizonaMaricopaVaccine(CountyDashboard):
"""
Fetch county level Covid-19 vaccination data from official Maricopa county websit... |
the-stack_0_5589 | # Copyright 2020 Huawei Technologies Co., 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... |
the-stack_0_5591 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... |
the-stack_0_5592 | #!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a com... |
the-stack_0_5596 | import collections
import glob
import itertools
import logging
import os
from dxtbx.imageset import ImageSequence
from dxtbx.model.experiment_list import (
BeamComparison,
DetectorComparison,
ExperimentList,
ExperimentListFactory,
GoniometerComparison,
)
from dxtbx.sequence_filenames import locate_... |
the-stack_0_5597 | '''
Homebrew for Mac OS X
'''
# Import salt libs
import salt
from salt.modules.yumpkg import _compare_versions
def __virtual__():
'''
Confine this module to Mac OS with Homebrew.
'''
if salt.utils.which('brew') and __grains__['os'] == 'MacOS':
return 'pkg'
def list_pkgs(*args):
'''
... |
the-stack_0_5599 | from datetime import datetime
SKILLS = ['overall', 'attack', 'defence', 'strength', 'hitpoints',
'ranged', 'prayer', 'magic', 'cooking', 'woodcutting',
'fletching', 'fishing', 'firemaking', 'crafting', 'smithing',
'mining', 'herblore', 'agility', 'theiving', 'slayer',
'farming',... |
the-stack_0_5603 | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class DialignTx(MakefilePackage):
"""DIALIGN-TX: greedy and progressive approaches for segment-b... |
the-stack_0_5604 | #!/usr/bin/env python
# ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# 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
... |
the-stack_0_5606 | #!/usr/bin/env python
import argparse
import re
import sys
from os.path import isfile, join
from subprocess import PIPE, TimeoutExpired, run
class BaseTask:
TIME_LIMIT_SECONDS = 1
SPACES_RE = re.compile(r"\s+", re.M)
def __init__(self, continue_on_error=True, only_matching=None):
self.continue_o... |
the-stack_0_5609 | import argparse
import bs4
import json
import io
import os
import requests
import zipfile
class Scraper():
"""A scraper with which to scrape Scratch projects.
Typical usage example:
from ccl_scratch_tools import Scraper
scraper = Scraper()
project = scraper.download_project... |
the-stack_0_5610 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 The Project U-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
import csv
import numpy as np
from utils ... |
the-stack_0_5613 | from blazingsql import DataType
from Configuration import ExecutionMode
from Configuration import Settings as Settings
from DataBase import createSchema as cs
from pynvml import nvmlInit
from Runner import runTest
from Utils import Execution, gpuMemory, init_context, skip_test
queryType = "Full outer join"
def main(... |
the-stack_0_5614 | """
This file offers the methods to automatically retrieve the graph G54.
The graph is automatically retrieved from the NetworkRepository repository.
References
---------------------
Please cite the following if you use the data:
```bib
@inproceedings{nr,
title = {The Network Data Repository with Interactive G... |
the-stack_0_5616 | # Local imports
from gmprocess.metrics.imt.imt import IMT
class PGA(IMT):
"""Class defining steps and invalid imts, for peak ground acceleration."""
# making invalid IMCs a class variable because
# 1) it doesn't change with instances
# 2) information can now be retrieved without
# instantiatin... |
the-stack_0_5618 | import frappe
from frappe import _
def execute(filters=None):
columns = get_columns(filters)
if filters.summary_based_on_month:
month_summary, chart = get_summary_based_on_month(filters)
if month_summary:
data = month_summary
if not filters.summary_based_on_month:
chart = {}
fee_data = get_fees(... |
the-stack_0_5619 | import torch
import torch.nn as nn
class MNIST_Network(nn.Module):
def __init__(self):
super(MNIST_Network, self).__init__()
self.conv1 = nn.Conv2d(1, 32, kernel_size = 5, padding=2)
self.relu1 = nn.ReLU()
self.pool1 = nn.MaxPool2d(2, stride=2)
self.conv2 = nn... |
the-stack_0_5620 | # Copyright (c) 2020 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_5621 | import numpy as np
import pandas as pd
try:
import cudf.dataframe as gdf
except ImportError as e:
print("Failed to import cuDF: " + str(e))
print("Skipping this test")
from sklearn import datasets
import sys
import unittest
import xgboost as xgb
from regression_test_utilities import run_suite, parameter_co... |
the-stack_0_5625 | #
# Parse tree nodes
#
from __future__ import absolute_import
import cython
cython.declare(sys=object, os=object, copy=object,
Builtin=object, error=object, warning=object, Naming=object, PyrexTypes=object,
py_object_type=object, ModuleScope=object, LocalScope=object, ClosureScope=obje... |
the-stack_0_5626 | import mxnet as mx
import numpy as np
class SEC_expand_loss(mx.metric.EvalMetric):
def __init__(self):
super(SEC_expand_loss, self).__init__("SEC_expand_loss")
def update(self, labels, preds):
self.num_inst += 1
self.sum_metric += preds[2].asnumpy()[0]
class SEC_seed_loss(mx.metric.Ev... |
the-stack_0_5627 | # Copyright 2018 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 agreed to in writing, ... |
the-stack_0_5628 | # Copyright 2021 The MediaPipe 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 requi_RED by applicable law or agreed to... |
the-stack_0_5630 | class Articles:
"""
class to define Article objects
"""
def __init__(self, source: dict, author: str, title: str, description: str,
url: str, url_to_image: str, published_at: str):
"""
method to define Article object properties
:param source:
:param auth... |
the-stack_0_5631 | """Setup script for gristmill."""
from setuptools import setup, find_packages
with open('README.rst', 'r') as readme:
DESCRIPTION = readme.read()
CLASSIFIERS = [
'Development Status :: 1 - Planning',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Appro... |
the-stack_0_5632 | from ops import *
from utils import *
from glob import glob
import time
from tensorflow.contrib.data import prefetch_to_device, shuffle_and_repeat, map_and_batch
class DRIT(object) :
def __init__(self, sess, args):
self.model_name = 'DRIT'
self.sess = sess
self.checkpoint_dir = args.checkpo... |
the-stack_0_5633 | import discord
from discord.ext import commands
class Example(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_ready(self):
print('Bot is online')
@commands.command()
async def loadtest(self, ctx):
await c... |
the-stack_0_5637 | #!/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.
import os
import click
import dataloader as torcharrow_dataloader
import torch
import t... |
the-stack_0_5638 | # Copyright 2019 Nokia
#
# 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_5639 | # Copyright 2021 Huawei Technologies Co., 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... |
the-stack_0_5641 | #!/usr/bin/env python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
A script to check that the (Linux) executables produced by gitian only contain
allowed gcc, glibc and libstdc++... |
the-stack_0_5643 | # sqlalchemy/pool.py
# Copyright (C) 2005-2021 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
"""Base constructs for connection pools.
"""
from collections import deque
im... |
the-stack_0_5644 | # Copyright (c) 2012-2016 Seafile Ltd.
# encoding: utf-8
from django.core.management.base import BaseCommand
from seaserv import seafile_api
from seahub.wiki.models import GroupWiki, Wiki, DuplicateWikiNameError
class Command(BaseCommand):
help = 'Migrate records in wiki_group_wiki table to wiki_wiki table.'
... |
the-stack_0_5646 | import compas_rrc as rrc
if __name__ == '__main__':
# Create Ros Client
ros = rrc.RosClient()
ros.run()
# Create ABB Client
abb = rrc.AbbClient(ros, '/rob1')
print('Connected.')
# No operation
done = abb.send_and_wait(rrc.Noop())
# Print feedback
print('Feedback = ', done)... |
the-stack_0_5650 |
import traceback
import json
from pathlib import Path
import time
try:
print(str(Path().resolve()))
commands_dict = {
"commands": {
"!rng": "You have boosted RNG NAME",
"!test": "Test response"
}
}
with open(str(Path().resolve()) + r'\core\commands.jso... |
the-stack_0_5655 | #!/usr/bin/python
# Copyright (c) 2013 The Native Client 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 os
import sys
from buildbot_lib import (
BuildContext, BuildStatus, Command, ParseStandardCommandLine,
RemoveScons... |
the-stack_0_5657 | class SelectionSequentialTransform(object):
def __init__(self, tokenizer, max_len):
self.tokenizer = tokenizer
self.max_len = max_len
def __call__(self, texts):
input_ids_list, segment_ids_list, input_masks_list, contexts_masks_list = [], [], [], []
for text in texts:
... |
the-stack_0_5658 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) Philipp Wagner. All rights reserved.
# Licensed under the BSD license. See LICENSE file in the project root for full license information.
import sys, os
sys.path.append("../..")
# Import Matplotlib:
import matplotlib
matplotlib.use('Agg')
import matplotli... |
the-stack_0_5659 | # -*- coding: utf-8 -*-
# @Time : 09/07/2021 02:56
# @Author : Rodolfo Londero
# @Email : rodolfopl@gmail.com
# @File : test_text.py
# @Software : VSCode
import pytest
class TestText13Bus:
@pytest.fixture(scope='function')
def dss(self, solve_snap_13bus):
dss = solve_snap_13bus
... |
the-stack_0_5660 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import cv2
import numpy as np
import time
import math
from air_drone_vertical.edge_detection_canny_multi_rects import *
if __name__ == '__main__':
cnt = 0
while cnt < 600:
file_name = 'C:\\Users\\18056\\PycharmProjects\\untitled\\air_drone_vertical\\pic1\\'... |
the-stack_0_5662 | from typing import Optional, Tuple
from flask import url_for
from app.questionnaire.location import Location
from app.questionnaire.path_finder import PathFinder
from app.questionnaire.rules import evaluate_when_rules
class Router:
def __init__(self, schema, answer_store, list_store, progress_store, metadata):
... |
the-stack_0_5666 | from __future__ import division
import keras
import six
from keras.models import Model
from keras.layers import (
Input,
Activation,
Dense,
Flatten
)
from keras.layers.convolutional import (
Conv2D,
MaxPooling2D,
AveragePooling2D
)
from keras.layers.merge import add
from keras.layers.normal... |
the-stack_0_5667 | # coding=utf-8
# Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA 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... |
the-stack_0_5669 | # 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_0_5670 | """
Instruction for the candidate.
1) Given a string compres the repeating letters following each letter
with number of repetition in the output string
2) Example:
'a' -> 'a1'
'aaa' -> 'a3'
'aabb' -> 'a2b2'
'' -> ''
"""
def rle(test_string):
result = ''
i... |
the-stack_0_5672 | import gym
import os
from floatenv import FloatEnv
def get_user_action(env):
env.render(show_position_numbers=True)
print("What action would you like to take? Enter a location and an increment value:")
str_action = input().strip(" ")
locations = str_action.split(" ")
if len(locations) != 2:
... |
the-stack_0_5674 | # This file was automatically created by FeynRules 2.3.32
# Mathematica version: 11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)
# Date: Sat 21 Apr 2018 20:43:27
from object_library import all_parameters, Parameter
from function_library import complexconjugate, re, im, csc, sec, acsc, asec, cot
# This is a defau... |
the-stack_0_5675 | import rich.repr
@rich.repr.auto
class Bird:
def __init__(self, name, eats=None, fly=True, extinct=False):
self.name = name
self.eats = list(eats) if eats else []
self.fly = fly
self.extinct = extinct
# Note that the repr is still generated without Rich
# Try commenting out the f... |
the-stack_0_5676 | from .base import *
from .mgr import CoreManager as Mgr
class CreationPhaseManager:
_id_generator = id_generator()
def __init__(self, obj_type, has_color=False, add_to_hist=False):
self._obj = None
self._obj_type = obj_type
self._has_color = has_color
self._add_to_hist = add... |
the-stack_0_5678 | # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
import onnx
from onnx import helper, TensorProto
IN = helper.make_tensor_value_info('in', TensorProto.FLOAT, [7])
OUT = helper.make_tensor_value_info('out', TensorProto.INT8, [7])
nodes = [
helper.make_node(
... |
the-stack_0_5680 | from setuptools import setup
CLASSIFIERS = [
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django",
"Framework :: Django :: 1.11",
"Framework :: Django :: 2.0",
"Intended Audience :: Developers",
# "License :: MIT License",
... |
the-stack_0_5681 | # coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class UpdateClusterRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The k... |
the-stack_0_5682 | from flask import Blueprint, request, abort, send_file, Response, make_response
from app.helpers.google_maps import get_static_map
from app.helpers.slack import verify_slack_request
from flask_jwt_extended import jwt_required
from app.model import db,UserResponse
from flask import current_app as app
from datetime impor... |
the-stack_0_5683 | #!/usr/bin/env python
from __future__ import with_statement
# ==============================================================================
# MetaPhlAn v2.x: METAgenomic PHyLogenetic ANalysis for taxonomic classification
# of metagenomic data
#
# Authors: Nicola Segata (nicola.segata@unitn.it),
# ... |
the-stack_0_5688 | # import modules
import numpy as np
from numpy.linalg import norm
import astropy.units as u
from astropy.constants import G
from pathlib import Path
# import plotting modules
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
# my modules
from galaxy.galaxy import Galaxy
from gala... |
the-stack_0_5689 | '''
This code is due to Yutong Deng (@yutongD), Yingtong Dou (@Yingtong Dou) and UIC BDSC Lab
DGFraud (A Deep Graph-based Toolbox for Fraud Detection)
https://github.com/safe-graph/DGFraud
'''
import tensorflow as tf
import argparse
from algorithms.Player2Vec.Player2Vec import Player2Vec
import time
from utils.data_loa... |
the-stack_0_5690 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Python for AHDA.
Part 5, Example 10.
"""
# Named Entity Recognition
import nltk
nltk.download('max_ent_chunker')
nltk.download('words')
print()
sentence = "President Trump visited the United Nations headquarters in New York."
tokens = nltk.word_tokenize(sentence)
p... |
the-stack_0_5692 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import wx
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import os
import time
sys.path.append(os.path.abspath(".."))
from mem import RTxxx_memcore
from ui import RTxxx_uidef
from ui import uidef
from ui import uivar
from ui import uilang
kRetryPingTimes = 5
clas... |
the-stack_0_5694 | # 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 applic... |
the-stack_0_5696 | #Author-Chun-Yu Ke
#Description-Creates a VGmesh component.
import adsk.core, adsk.fusion, adsk.cam, traceback
import math
import time
# Globals
_app = adsk.core.Application.cast(None)
_ui = adsk.core.UserInterface.cast(None)
_units = 'mm'
# Command inputs
_deltaAngle = adsk.core.DropDownCommandInput.cast(None)
_out... |
the-stack_0_5698 | # Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... |
the-stack_0_5702 | # 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_5704 | import scapy.all as scapy
import sys
#Send 10 VLAN paclkets. With data = "Test"
eth_src = "00:00:00:00:00:01" #Host 1
eth_dst = "00:00:00:00:00:02" #Host 2
eth_type = 0x8100 #VLAN
data = "Test" #Data to send
total_packets = 10 #Number of packets to send
l2packet = scapy.Ether(type=eth_type,src=eth_src,dst=eth_dst)/d... |
the-stack_0_5706 | # Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... |
the-stack_0_5707 | import pygame as pg
import gym_gvgai as gvg
class Game:
def __init__(self, game, lvl):
self.env = gvg.make('gvgai-' + game + '-' + lvl + '-v0')
self.stateObs = self.env.reset()
size = (len(self.stateObs), len(self.stateObs[0]))
self.transpose = size[0] < size[1]
i... |
the-stack_0_5708 | import collections
import copy
from builtins import range
from typing import Union
import numpy as np
from speclite.filters import FilterResponse, FilterSequence
from threeML.plugins.XYLike import XYLike
from threeML.utils.photometry import FilterSet, PhotometericObservation
__instrument_name = "Generic photometric ... |
the-stack_0_5710 | #
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 Raphael Michel and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by ... |
the-stack_0_5711 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
import glob
import salem
from combine2d.core.utils import NonRGIGlacierDirectory
from combine2d.core.test_cases import Borden, Giluwe
from combine2d.core.arithmetics import RMSE, mean_BIAS, percentiles
from combine2d.core.data_logging impo... |
the-stack_0_5712 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# Copyright (C) 2020-2021 LuaVela Authors. See Copyright Notice in COPYRIGHT
# Copyright (C) 2015-2020 IPONWEB Ltd. See Copyright Notice in COPYRIGHT
# This file does only contain a selection of the most common options. For a
# full... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.