filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_4539 | from .output import Output
import gevent
import gevent.monkey
gevent.monkey.patch_socket()
import urllib2
import json
class Elasticsearch(Output):
"""Outputs to an elasticsearch index.
:param string host: elasticsearch host
:param integer port: elasticsearch port
:param string index: (required) elasti... |
the-stack_0_4540 | #!/usr/bin/env python3
# Copyright (c) 2017-2019 The Rhombus Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import json
from test_framework.test_rhombus import RhombusTestFramework, isclose, connect_nodes_bi
cl... |
the-stack_0_4541 | #!/usr/bin/env python
"""
lgc/main.py
Note to program performers:
- parallel_pr_nibble produces the same results as ligra's `apps/localAlg/ACL-Sync-Local-Opt.C`
- ista produces the same results as LocalGraphClustering's `ista_dinput_dense` method
"""
import os
import sys
import argparse
i... |
the-stack_0_4543 | # Ex. 095 +=
# jogador = {'Nome': 'Joelson', 'Gols': [2, 1, 0, 0, 3], 'Total': 6}
jogador = {}
jogadores, gols = [], []
posGol = 0
Blue, Normal, Color, Red = "\033[34m", "\033[m", "\033[36m", "\033[31m"
while True:
jogador['Nome'] = str(input("Nome do jogador: ")).capitalize()
partidas = int(input(f"Quantas p... |
the-stack_0_4544 | import time
import logging
import pytest
import operator
import numpy as np
from copy import copy
from ophyd.epics_motor import EpicsMotor
from ophyd.pseudopos import PseudoPositioner, PseudoSingle
from ophyd import Component as C
from ophyd.utils import ExceptionBundle
logger = logging.getLogger(__name__)
def ... |
the-stack_0_4547 | #!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Copyright (c) 2019-2021 Xenios SEZC
# https://www.veriblock.org
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the wallet accounts properly whe... |
the-stack_0_4548 | # Input:
# 1
# 1
# 1
# 2
if __name__ == '__main__':
# Take the input in correct format
x = int(input())
y = int(input())
z = int(input())
n = int(input())
# Using for loop
# final_list =[]
# Iterate from x to z append the values into one list
# for i in range(x + 1):
# for ... |
the-stack_0_4549 | # *****************************************************************
# Copyright 2013 MIT Lincoln Laboratory
# Project: SPAR
# Authors: ATLH
# Description: Tests for equality_query_generator
#
# Modifications:
# Date Name Modification
# ---- ---- ... |
the-stack_0_4550 | """Provides data related to paths."""
import sys
from pathlib import PurePosixPath, PureWindowsPath
from typing import Any, Final
from mimesis.data import (
FOLDERS,
PLATFORMS,
PROGRAMMING_LANGS,
PROJECT_NAMES,
USERNAMES,
)
from mimesis.providers.base import BaseProvider
__all__ = ["Path"]
clas... |
the-stack_0_4553 | from wurst.geo import geomatcher
from rmnd_lca import DATA_DIR
REGION_MAPPING_FILEPATH = (DATA_DIR / "regionmappingH12.csv")
class Geomap():
"""
Map ecoinvent locations to REMIND regions and vice-versa.
"""
def __init__(self):
self.geo = self.get_REMIND_geomatcher()
def get_REMIND_geomat... |
the-stack_0_4559 |
import os
import re
import numpy as np
import argparse
import sys
from natsort import natsorted
from plyfile import PlyData, PlyElement
import pandas as pd
'''
script to evaluate a model
execution example:
- python3 evaluate_instances.py --path_run /home/uib/Desktop/test_evaluate_instances/ --path_cls /home/uib/Des... |
the-stack_0_4560 | #
# Copyright 2013 eNovance <licensing@enovance.com>
#
# 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 ... |
the-stack_0_4563 | import asyncio
from csv import DictReader
from io import BytesIO
import json
import zipfile
from gtfs_util.util import TextZipFile
from gtfs_util import constants
from gtfs_util.static.models import (
agency,
service,
service_update,
route,
point,
stop_time,
stop,
transfer,
trip,
)
... |
the-stack_0_4565 | #!/usr/bin/python
# -*- coding: utf-8 -*-
##############################################################################
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Amazon Software Lic... |
the-stack_0_4566 | # Copyright 2015 ETH Zurich
#
# 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, sof... |
the-stack_0_4569 | # Complete list of functional components used by this extension.
#
# Components can be disabled with build options matching `goost_*_enabled=no`.
# A branch of components can be disabled as well, like: `goost_core_enabled=no`.
#
# NOTE: Components may not necessarily have structural meaning.
#
components = [
"core/... |
the-stack_0_4570 | from typing import Optional, Dict
from cmd.package.HBShedPackageHandler import HBShedPackageHandler
from cmd.package.modules.Module import Module
from cmd.package.modules.ModulesHandler import ModulesHandler
class ApplyModulePeerDependencies:
def __init__(self, package: HBShedPackageHandler,
de... |
the-stack_0_4573 | # Copyright (c) 2016 Cisco Systems
# 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_4575 | #!/usr/bin/python
#
# Copyright 2018-2022 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
the-stack_0_4576 | # -*- coding: utf-8 -*-
"""
Created on Thu Jun 20 22:04:17 2019
@author: Jiupeng
"""
#Modified from Jiupeng Hu
#from __future__ import print_function
from collections import defaultdict
import os
import sys
import datetime
def decdeg2dms(dd):
deg, mnt = divmod(dd*60.0, 60)
return int(deg), mn... |
the-stack_0_4578 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This script fixes links that contain common spelling mistakes.
This is only possible on wikis that have a template for these misspellings.
Command line options:
-always:XY instead of asking the user what to do, always perform the same
action. For examp... |
the-stack_0_4580 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import ast
import logging
from typing import Dict, Iterable, List
from .annotated_function_generator import (
AnnotatedFunctionGenerator,... |
the-stack_0_4581 | # /usr/bin/env python3.5
# -*- mode: python -*-
# =============================================================================
# @@-COPYRIGHT-START-@@
#
# Copyright (c) 2020, Qualcomm Innovation Center, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification,... |
the-stack_0_4583 | #!/usr/bin/python3
import sys
import copy
from pathlib import Path
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from statsmodels.tsa.stattools import adfuller
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
from statsmodels.tsa.statespace.sarimax import SARIMAX,SARIMAXResults,SA... |
the-stack_0_4586 | import datetime
from django.test import TestCase
from django.utils import timezone
from django.urls import reverse
from .models import Question
# Create your tests here.
def create_question(question_text, days):
"""
Create a question with the given `question_text` and published the
given number of `day... |
the-stack_0_4587 | # Source: https://gist.githubusercontent.com/rogerallen/1583593/raw/0fffdee6149ab1d993dffa51b1fa9aa466704e18/us_state_abbrev.py
# United States of America Python Dictionary to translate States,
# Districts & Territories to Two-Letter codes and vice versa.
#
# https://gist.github.com/rogerallen/1583593
#
# Dedicated to... |
the-stack_0_4589 | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
from .version import __version__, short_version
def digit_version(version_str):
digit_version = []
for x in version_str.split('.'):
if x.isdigit():
digit_version.append(int(x))
elif x.find('rc') != -1:
patch_v... |
the-stack_0_4591 | """JSON input interface."""
import gzip
import json
from pathlib import Path
from typing import Optional, TextIO, Union
from ..music import Music
def load_json(
path: Union[str, Path, TextIO], compressed: Optional[bool] = None
) -> Music:
"""Load a JSON file into a Music object.
Parameters
---------... |
the-stack_0_4592 | """Draw the histgram of the pose distributions
Run it like this:
`python3 -m experimental.distribution.py`
Do not forget to set the dataset file path.
"""
import cv2
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from dataset import get_parsed_dataset
from experimental.pose_estimator impor... |
the-stack_0_4594 | # -*- coding: utf-8 -*-
# Opções para formulários
ufs = ['SP', 'AC', 'AL', 'AP', 'AM', 'BA', 'CE', 'DF', 'ES', 'GO', 'MA',
'MT', 'MS', 'MG', 'PR', 'PB', 'PA', 'PE', 'PI', 'RJ', 'RN', 'RS',
'RO', 'RR', 'SC', 'SE', 'TO']
escolaridade = ['Nenhuma', '1º grau', '2º grau', 'Superior']
cor = ['Branca', 'Ne... |
the-stack_0_4595 | """Utility functions for transducer models."""
import os
import numpy as np
import torch
from espnet_pytorch_library.nets_utils import pad_list
def prepare_loss_inputs(ys_pad, hlens, blank_id=0, ignore_id=-1):
"""Prepare tensors for transducer loss computation.
Args:
ys_pad (torch.Tensor): batch o... |
the-stack_0_4597 | import os
import re
import sys
import textwrap
from typing import Dict
from typing import Generator
import pytest
from _pytest.compat import TYPE_CHECKING
from _pytest.monkeypatch import MonkeyPatch
if TYPE_CHECKING:
from typing import Type
@pytest.fixture
def mp() -> Generator[MonkeyPatch, None, None]:
cwd... |
the-stack_0_4598 | import os
def screen_clear():
if os.name == 'nt':
os.system('cls')
else:
os.system('clear')
screen_clear()
print("Starting....\n")
import time
import cv2
import face_recognition
import numpy
print("Dependecies imported Successfully")
print("Initializing Camera")
cap = cv2.VideoCapture(0)
print("Camer... |
the-stack_0_4599 | from django.shortcuts import render
# Create your views here.
from datetime import datetime
from info.forms import CovidDataForm
from info.models import CovidData
from django.views.generic import ListView,CreateView
from django import forms
#REST
from django.http import HttpResponse
from django.shortcuts import ... |
the-stack_0_4600 | import pandas as pd
import pickle
print('\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n')
print('Starting data labelling...')
with open('cache/data_labeler_vars.pickle', 'rb') as f:
lastIndex, datajobs = pickle.load(f)
print('Starting from index: ' + str(lastIndex))
for i in range(lastIndex, datajobs.shape[0]):
prin... |
the-stack_0_4602 | import sublime
import sublime_plugin
import os
from collections import OrderedDict, namedtuple
from hyperhelp.common import log, hh_syntax
from hyperhelp.core import help_index_list, lookup_help_topic
###----------------------------------------------------------------------------
# A representation of what is goi... |
the-stack_0_4603 | #!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# create two boxes and interpolate between them
#
pts = vtk.vtkPoints()
pts.InsertNextPoint(-1,-1,-1)
pts.InsertNextPoint(1,-1,-1)
pts.InsertNextPoint(1,1,-1)
pts.InsertNextPoint(-1,1... |
the-stack_0_4607 | #!/usr/bin/env python3
"""Shows the crash in the faucet log produced by given input"""
import logging
import os
import sys
from faucet import faucet
from ryu.controller import dpset
from faucet import faucet_experimental_api
import Fake
def main():
# go through all files in directory
# read file and store in... |
the-stack_0_4609 | # Copyright 2021 The Matrix.org Foundation C.I.C.
#
# 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_4610 | import logging
from django.contrib import auth
from django.urls import reverse
from django.utils.deprecation import MiddlewareMixin # https://stackoverflow.com/questions/42232606/django
# -exception-middleware-typeerror-object-takes-no-parameters
from django.conf ... |
the-stack_0_4612 | from ripsaw.genetics.selection import roulette
from ripsaw.genetics.crossovers import point_crossover
from ripsaw.genetics.genotype import Chromosome
from ripsaw.util.logging import Logger
import math
import time
import logging
import multiprocessing as mp
from datetime import datetime
class Optimiser:
def __ini... |
the-stack_0_4614 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from botbuilder.ai.luis import LuisApplication, LuisRecognizer
from botbuilder.core import Recognizer, RecognizerResult, TurnContext
class FlightBookingRecognizer(Recognizer):
def __init__(self, configuration: object):
... |
the-stack_0_4616 | """
This script shows how to count all files in a specific directory.
"""
from argparse import ArgumentParser
import os
from collections import Counter
parser = ArgumentParser()
parser.add_argument('dir', type=str, help='target path')
args = parser.parse_args()
def get_extention(file_name=None):
"""
Return ... |
the-stack_0_4617 | from __future__ import absolute_import, unicode_literals
from django.conf.urls import url
from rankings.views import athlete_redirect_athlete_id_to_slug, athlete_redirect_event_id_to_slug, \
redirect_event_id_to_slug, add_result, report_duplicate, request_competition
from . import views
urlpatterns = [
... |
the-stack_0_4618 | import logging
from typing import Collection, Container, Iterable, Optional, Tuple, Type
from eth.abc import AtomicDatabaseAPI
from eth.exceptions import BlockNotFound
from eth_utils import to_dict, toolz
from eth2._utils.ssz import validate_imported_block_unchanged
from eth2.beacon.chains.abc import BaseBeaconChain
... |
the-stack_0_4621 | import urllib.request
import os, sys
content = ''
attempts = 0
protocol = 'http'
subdomain = 'web135/'
domain = 'j3'
'''
lvl3 = ['']
lvl4 = ['']
lvl5 = ['']
lvl6 = ['']
lvl7 = ['']
lvl8 = ['']'''
root_dir = '../inetpub/wwwroot/wwwlive'
links = ['',
'news',
'emergency-info',
'county-depa... |
the-stack_0_4622 | import time
from basetestcase import BaseTestCase
from remote.remote_util import RemoteMachineShellConnection
from membase.api.rest_client import RestConnection, Bucket, RestHelper
from membase.api.exception import BucketCreationException
from membase.helper.bucket_helper import BucketOperationHelper
from couchbase_hel... |
the-stack_0_4623 |
import math
import numpy as np
from numpy import sqrt
from direct_kinematic import DirectKinematic
class FitnessFunctions(object):
def __init__(self, parameters={}):
self.energy_constants = [31.1,21.1,26.6,8.3,5.00,2.6]
self.velocity_constants = [90,90,90,120,120,190]
return
def eva... |
the-stack_0_4625 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""Pivot h... |
the-stack_0_4626 | from scipy.spatial import distance as dist
from imutils import face_utils
import threading
import cv2
import imutils
EYE_AR_THRESH = 0.2
EYE_AR_CONSEC_FRAMES = 48
class FatigueBackgroundWorker:
def __init__(self, vs, predictor, detector):
self.thread = threading.Thread(target=self.run, args=())
... |
the-stack_0_4627 | """Some commonly used functions, like helpers"""
import lvgl as lv
import qrcode
import math
from micropython import const
import gc
from .components import QRCode, styles
PADDING = const(20)
BTN_HEIGHT = const(70)
HOR_RES = const(480)
VER_RES = const(800)
QR_PADDING = const(40)
def init_styles(dark=True):
if da... |
the-stack_0_4628 | from functools import lru_cache, singledispatch
from typing import Any, Callable, List, Tuple, Union
import attr
@attr.s
class _DispatchNotFound:
"""A dummy object to help signify a dispatch not found."""
pass
class MultiStrategyDispatch:
"""
MultiStrategyDispatch uses a combination of exact-match... |
the-stack_0_4629 | #!/usr/bin/env python3
# Quantopian, Inc. licenses this file 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
the-stack_0_4630 | #!/usr/bin/env python3
"""Mininet tests for FAUCET."""
# pylint: disable=too-many-lines
# pylint: disable=missing-docstring
# pylint: disable=too-many-arguments
# pylint: disable=unbalanced-tuple-unpacking
import binascii
import collections
import copy
import itertools
import ipaddress
import json
import os
import r... |
the-stack_0_4632 | """
molssi_math.py
A sample repository for the MolSSI Workshop at UF.
Some math functions.
"""
def mean(num_list):
"""
Calculate the mean/average of a list of numbers.
Parameters
-----------
num_list : list
The list to take the average of
Returns
-----------
mean_list : floa... |
the-stack_0_4633 | from re import L
import discord
from discord.ext import commands
from discord.ext.commands import bot
from settings import constants
owners = constants.owners
admins = constants.admins
def is_owner(ctx):
""" Checks if the author is one of the owners """
return ctx.author.id in owners
def is_admin(ctx):
... |
the-stack_0_4634 | import matplotlib as mlt
# mlt.use('TkAgg')
# mlt.use('Qt5Agg')
import matplotlib.pyplot as plt
import numpy as np
import pykep as pk
from utils import *
from conversions import *
class plotting(object):
"""
Provide visualization for hodographicShaping trajectories
Samples trajectory at initialization
... |
the-stack_0_4635 | from django import http
from django.db.models import Q
from django.db.transaction import non_atomic_requests
from django.utils.encoding import force_bytes
from django.utils.translation import ugettext
from django.views.decorators.vary import vary_on_headers
import six
import olympia.core.logger
from olympia import a... |
the-stack_0_4636 | import gspread
from oauth2client.service_account import ServiceAccountCredentials
class GoogleSheetMGR(object):
def __init__(self, key, sheet=None, json_file=None):
self.key = key
self.sheet = sheet
if json_file:
self.json_file = json_file
else:
self.json_fil... |
the-stack_0_4637 | """
Train deterministic HM-DenseED
"""
from time import time
import torch
import os
import numpy as np
import scipy.io as io
import sys
import torch.optim as optim
import torch.nn.functional as F
from torch.optim.lr_scheduler import ReduceLROnPlateau
from args import args, device
from models.model import DenseED
from u... |
the-stack_0_4638 | from __future__ import print_function
import torch
import os
import shutil
from collections import defaultdict
import numpy as np
def getNeigh(node_num, feature_map, knn):
similarity = np.dot(feature_map, feature_map.T)
sort_id = np.argsort(-similarity, axis=1)
adj_sets = defaultdict(set)
for n in ... |
the-stack_0_4641 | """Constants for the FRITZ!Box Tools integration."""
DOMAIN = "fritz"
PLATFORMS = ["device_tracker"]
DATA_FRITZ = "fritz_data"
DEFAULT_DEVICE_NAME = "Unknown device"
DEFAULT_HOST = "192.168.178.1"
DEFAULT_PORT = 49000
DEFAULT_USERNAME = ""
ERROR_AUTH_INVALID = "invalid_auth"
ERROR_CONNECTION_ERROR = "connection_e... |
the-stack_0_4643 | import lzma
import os
import subprocess
import re
import zipfile
from typing import Tuple
from unittest import mock
from unittest.mock import MagicMock
import pytest
from aiohttp.test_utils import TestClient
from otupdate import buildroot, common
from otupdate import openembedded
from otupdate.common.update_actions ... |
the-stack_0_4646 | #!/usr/bin/env python3
# Copyright (c) 2020 GBCR Developers
# Copyright (c) 2016-2019 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 processing of feefilter messages."""
from decimal import Dec... |
the-stack_0_4648 | #!/usr/bin/env python3
# <Copyright 2019, Argo AI, LLC. Released under the MIT license.>
from typing import Tuple
import numpy as np
class FrameRecord:
"""
Store representation of a bounding box in some timeframe, in different coordinate systems.
This bounding box comes from a track that shares the sam... |
the-stack_0_4649 | #!/usr/bin/env python3
import serial, sys, json, logging
import paho.mqtt.client as mqtt
CONFIG_FILE='config.json'
try:
with open(CONFIG_FILE) as config_file:
config = json.load(config_file)
except:
print("Config file not present or invalid JSON!")
sys.exit(1)
header_retained = b'#R'
header_unreta... |
the-stack_0_4650 | from PIL import Image
def bytes_to_bin(data):
return "".join(f"{bin(i)[2:]:>08}" for i in data)
def hide_lsb_image(image, binary):
pixels = image.load()
for i in range(image.height):
for j in range(image.width):
r, g, b = pixels[j, i]
bit = int(binary[i % len(binary)])
r = (r & (~0x01)) | bit
g = (g... |
the-stack_0_4651 | import re
import numbers
from collections import namedtuple
from .shapes import *
LAYER_DESCRIPTORS = {
# Caffe Types
'AbsVal': shape_identity,
'Accuracy': shape_scalar,
'ArgMax': shape_not_implemented,
'BatchNorm': shape_identity,
'BNLL': shape_not_implemented,
'Concat': shape_concat,
... |
the-stack_0_4652 | import os
import download
import settings
import translate
import utils
def create_profileicon_json(lang, path):
cdragon_profileicons = download.download_versioned_cdragon_profileicons_summary()
profileicon = {
"type": "profileicon",
"version": settings.patch['json'],
"data": {}
}... |
the-stack_0_4653 | # Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# Author - Shivam Mishra <shivam@frappe.io>
from __future__ import unicode_literals
import frappe
from json import loads, dumps
from frappe import _, DoesNotExistError, ValidationError, _dict
from frappe.boot import get... |
the-stack_0_4655 | #
# 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_0_4656 | # This file contains globals used across the dottizer program
# ==============================================================================
# User Specified Params
# ==============================================================================
# drill_sizes = [] # Sets available drill bits when ... |
the-stack_0_4658 | import numpy as np
import pandas as pd
def clean_Data(data, fill=0, with_pages = False):
'''
Clean the input data, including fill nan with 0 and removing page column
Args:
data: input data for clean
type: ndarray, shape: (series, time_step)
... |
the-stack_0_4659 | """Functions for building the face recognition network.
"""
# MIT License
#
# Copyright (c) 2016 David Sandberg
#
# 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, includ... |
the-stack_0_4662 | from board import Board
from player import HumanPlayer, RandomPlayer, MinimaxPlayer
class Game:
__active_player__ = None
__inactive_player__ = None
__player_1__ = None
__player_2__ = None
__move_symbol__ = {}
def __init__(self, player_1, player_2, size):
self.__player_1__ = player_... |
the-stack_0_4663 | #!/usr/bin/env python3
# MIT License
#
# Copyright (C) 2019-2020, Entynetproject. All Rights Reserved.
#
# 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 withou... |
the-stack_0_4664 | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
the-stack_0_4665 | """
Reaction Result
===============
"""
class ReactionResult:
"""
The result of a reaction.
"""
__slots__ = [
'_new_atoms',
'_new_bonds',
'_deleted_atoms',
'_deleted_bonds',
]
def __init__(
self,
new_atoms,
new_bonds,
deleted_... |
the-stack_0_4666 | import unittest
from time import sleep
from blockchain import Actor, Chain, Config
from blockchain.exceptions import ValidationError
class MyActorTesterOnTestNet(unittest.TestCase):
def setUp(self) -> None:
Config.test_net = True
Config.test_net_wallet_initial_coins = 100
Config.new_block... |
the-stack_0_4667 | # 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 the Li... |
the-stack_0_4669 | import pickle
import sys
import requests
from getpass import getpass
from bs4 import BeautifulSoup
import itertools
import os
import sqlite3
import hashlib
from pathlib import Path
fullpath = sys.argv[0]
pathspc = os.path.dirname(fullpath)
data = dict()
dirpath = sys.argv[1] # Gives the absolutepath of directory
ob... |
the-stack_0_4671 | # Copyright 2013-2021 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 PyLuigi(PythonPackage):
"""Workflow mgmgt + task scheduling + dependency resolution"""
... |
the-stack_0_4674 | '''
validate survey simulations using CMX data.
updates
-------
* 5/19/2020: created script and test to compare which wavelength range I should
use for the exposure time correction factor
'''
import os
import h5py
import fitsio
import numpy as np
import astropy.units as u
# -- feasibgs --
from feasibgs impo... |
the-stack_0_4675 | from typing import Dict
import numpy as np
import torch
import torch.optim as optim
from allennlp.data.dataset_readers.stanford_sentiment_tree_bank import (
StanfordSentimentTreeBankDatasetReader,
)
from allennlp.data.iterators import BucketIterator
from allennlp.data.vocabulary import Vocabulary
from allennlp.mod... |
the-stack_0_4676 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019-2021 CERN.
# Copyright (C) 2019 Northwestern University.
#
# Invenio-Cli is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Invenio module to ease the creation and management of applicatio... |
the-stack_0_4679 | import math
import random
from external.agent import AIAgent as ExtrAIAgent
class Game():
# gap is the gap in pixels between the south Pipe and North Pipe.
def __init__(self,cvsHeight=512,cvsWidth=800,pipeHeight=242,pipeWidth=52, fgHeight=118, birdHeight=38,birdWidth=26):
self.cvsHeight=cvsHeight
... |
the-stack_0_4680 | import random
import time
from subprocess import Popen
# adjust tempo here
tempo = 90
lookup = {
'C': 'c',
'D': 'd',
'E': 'e',
'F': 'f',
'G': 'g',
'A': 'hey',
'B': 'b',
'Bb': 'b flat',
'Eb': 'e flat',
'Ab': 'hey flat',
'Db': 'd flat',
'Gb': 'g flat',
'C#': 'c sharp... |
the-stack_0_4681 | #
# 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_0_4682 | # Ref: https://github.com/doliom/basic-petri-net
from place import P
from transition import T
from model import Model
from arc import Arc
def main():
#places with marking {3.wait, done, free}
p1 = P("p1", 3) # Wait
p2 = P("p2", 0) # Inside
p3 = P("p3", 1) # Done
p4 = P("p4", 1) # Fre... |
the-stack_0_4683 | import asyncio
from concurrent.futures import Executor, ProcessPoolExecutor
from functools import partial
import logging
from multiprocessing import freeze_support
from aiohttp import web
import aiohttp_cors
import black
import click
# This is used internally by tests to shut down the server prematurely
_stop_signal ... |
the-stack_0_4693 | from collections.abc import Iterable
from itertools import repeat
from typing import Callable, TypeVar
T = TypeVar('T')
def count_horizontal_vertical_overlaps(
lines: list[tuple[tuple[int, int], tuple[int, int]]]) -> int:
vents: dict[tuple[int, int], bool] = {}
overlaps = 0
def add(start: int, end: int, m... |
the-stack_0_4694 | from typing import Dict, Optional, Tuple
import numpy as np
from stable_baselines.common import vec_env
from imitation.util import rollout
class Buffer:
"""A FIFO ring buffer for NumPy arrays of a fixed shape and dtype.
Supports random sampling with replacement.
"""
capacity: int
"""The number of data s... |
the-stack_0_4695 | from plenum.common.constants import TRUSTEE, STEWARD, NODE
from stp_core.common.log import getlogger
from indy_common.constants import OWNER, POOL_UPGRADE, TGB, TRUST_ANCHOR, NYM, \
POOL_CONFIG, SCHEMA, CLAIM_DEF, \
POOL_RESTART, VALIDATOR_INFO
from indy_common.roles import Roles
logger = getlogger()
# TODO... |
the-stack_0_4696 | # -*- coding: utf-8 -*-
import argparse
import json
import os
import re
import shutil
import subprocess as sp
import sys
from concurrent import futures
from tempfile import mkdtemp, mkstemp
from typing import List, Tuple
import cx_Oracle
from pyinterprod import logger
from pyinterprod.utils import oracle
from .datab... |
the-stack_0_4702 | #!/bin/python3
import os
import re
# Complete the happyLadybugs function below.
def happyLadybugs(b):
# find if exists any single letter
if b.count('_') == 0 and len(re.sub(r'((.)\2+)', '', b)) != 0:
return 'NO'
for a in set(b):
if a != '_' and b.count(a) == 1:
return 'NO'
... |
the-stack_0_4704 | """Receive signals from a keyboard and use it as a remote control."""
# pylint: disable=import-error
import threading
import logging
import os
import time
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
... |
the-stack_0_4705 | #!/usr/bin/env python
__author__ = 'Florian Hase'
#========================================================================
import copy
import numpy as np
import pickle
from DatabaseManager.database import Database
from Utilities.misc import Printer
#==============================================================... |
the-stack_0_4706 | #!/usr/bin/python
from Solution import Solution
obj = Solution()
#A = [1,1,1,2,2,3]
#A = [0,0,1,1,1,1,2,3,3]
#A = [1, 1, 1, 1]
A = [1]
print(obj.removeDuplicates(A)) |
the-stack_0_4707 | import itertools
import argparse
import datetime
import os
import sys
import re
import time
import numpy as np
import argparse
def filldict(listKeys, listValues):
mydict = {}
for key, value in zip(listKeys, listValues):
mydict[key] = value
return mydict
def generate_script_body(param_dict):
script_body='''#!/b... |
the-stack_0_4708 | # Copyright 2010 OpenStack Foundation
# 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 requ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.