content stringlengths 5 1.05M |
|---|
from server.util import ScriptManager
def npcClick2_522(c, npcId):
c.getShops().openShop(1)
def npcClick2_523(c, npcId):
c.getShops().openShop(1)
def npcClick2_546(c, npcId):
c.getShops().openShop(7)
def npcClick2_548(c, npcId):
c.getShops().openShop(8)
def npcClick2_537(c, npcId):
c.getShops().openShop(9)
d... |
class Road:
_length: int
_width: int
def __init__(self, length: int, width: int):
"""конструктор класса
:param length: длинна в метрах
:param width: ширина в метрах
"""
self._length = length
self._width = width
def calculate(self, height: int = 5, mass_m... |
# -*- coding: utf-8 -*-
from settings import * # noqa
HIPCHAT_ENABLED = False
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'
},
}
# the django apps aren't required for the tests,
INSTALLED_APPS = ('trello_webhooks',)
try:
import django_nose # noqa... |
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
import os
from pathlib import Path
from aws_cdk import (
aws_lambda as lambda_,
aws_apigateway as api_gw,
aws_efs as efs,
aws_ec2 as ec2,
core as cdk,
)
class ServerlessHuggingFaceStack(cdk.S... |
import logging
from SDM.nodes.MiddleWare import MiddleWare
from SDM.rules.SynDestPushingRule import SynDestPushingRule
from SDM.util import bytes_to_ipv4
class SynMiddleWare(MiddleWare):
def __init__(self, ovs_switch, controller_ip="127.0.0.1", switch_ip=None, controller_port=6633, switch_port=None,
... |
#!/usr/bin/env python3
import random
from operator import itemgetter
from matplotlib import pyplot as plt
import sys
class GeneticAlgorithm(object):
def __init__(self, genetics):
self.genetics = genetics
pass
def run(self):
"""
Run method represents core of genetic algorithm ... |
# Generated by Django 3.2.3 on 2021-05-29 16:10
import uuid
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("authentik_flows", "0018_oob_flows"),
]
operations = [
migrations.CreateMod... |
'''Faça um programa que leia um angulo qualquer e mostre na sua tela o valor do seno, cosseno e tangente desse angulo'''
import math
ang = float(input('Digite um ângulo: '))
sen = math.sin(math.radians(ang))
cos = math.cos(math.radians(ang))
tan = math.tan(math.radians(ang))
print ('O valor para Seno é {:.2f}\nO valo... |
# Copyright 2020 The TensorFlow Probability 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... |
import json
data = """ [
{
"First_name":"Cristian",
"Second_name": "Santiago",
"Last_name": "da Silva"
},
{
"day": "31",
"month": "October",
"year": "1991",
"age": "29"
}]
"""
info = json.loads(data)
print('Idade:', info[1]['day'])
|
import pandas as pd
my_data = pd.read_csv('Users/meyhel01/Documents/Traitify Excel/traitifydata.csv'', sep=',', engine='c')
labels=[]
for i in sorted(traits):
labels.append(i)
frame = pd.DataFrame(my_data, columns=labels)
frame = frame.corr()
frame.to_csv('corr_matrix.csv')
|
# -*- coding: utf-8 -*-
from datetime import datetime
from flask import Flask, jsonify
from flask_restful import Resource, Api
import logging
"""
time-api
"""
app = Flask(__name__)
app.config['JSONIFY_PRETTYPRINT_REGULAR'] = True
api = Api(app)
log = logging.getLogger('werkzeug')
log.setLevel(logging.WARNING)
clas... |
#!/usr/bin/env python
# __BEGIN_LICENSE__
# Copyright (c) 2009-2012, United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The NGT platform is licensed under the Apache License, Version 2.0 (the
# "License"); you may not use ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Test string manipulation
"""
import os
import commonlibs.strings.strings as s
HERE = os.path.abspath(os.path.dirname(__file__))
TEST_FILE_a = os.path.join(HERE, 'a.txt')
def test_is_string_in_file():
assert s.is_string_in_file("phone number", TEST_FILE_a) is ... |
# -*- coding:utf-8 -*-
import urllib2
# 构建一个HTTPHandler处理器对象,支持处理HTTP的请求
# http_handler = urllib2.HTTPHandler()
# 在HTTPHandler增加参数"debuglevel=1"将会自动打开Debug log 模式,
# 程序在执行的时候会打印收发包的信息
http_handler = urllib2.HTTPHandler()
# 调用build_opener()方法构建一个自定义的opener对象,参数是构建的处理器对象
opener = urllib2.build_opener(http_handler)
r... |
# Class to store information about a known exploit.
# This code doesn't actually exploit anything.
# These have members
class exploit():
def __init__(self):
self.title = None
self.description = None
self.urls = []
self.info = {}
self.refnos = {}
def set_title(self, tit... |
import os
import pandas as pd, numpy as np
from rudolf.paths import RESULTSDIR
from rudolf.plotting import _get_detrended_flare_data
flaredir = os.path.join(RESULTSDIR, 'flares')
# read data
method = 'itergp'
cachepath = os.path.join(flaredir, f'flare_checker_cache_{method}.pkl')
c = _get_detrended_flare_data(cachepa... |
# -*- coding: utf-8 -*-
# Copyright 2019 Mathijs Lagerberg.
#
# 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... |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# read data
df_intrinsic = pd.read_csv('./intrinsic_velocities.tsv', '\t')
df_initial = pd.read_csv('./velocities_at_x.tsv', '\t')
# do plotting
fig, axes = plt.subplots(2, 2, figsize = (12, 7))
# sorted by coefficient... |
# Copyright 2013-2018 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 DealiiParameterGui(CMakePackage):
"""A qt based graphical user interface for editing deal.... |
import pulsar as psr
def load_ref_system():
""" Returns dimethyl_sulfoxide as found in the IQMol fragment library.
All credit to https://github.com/nutjunkie/IQmol
"""
return psr.make_system("""
C 1.5407 -0.3295 0.0798
S -0.0596 0.4296 -0.3610
C ... |
"""Example 6: second version of a submission is announced."""
from unittest import TestCase, mock
import tempfile
from datetime import datetime
from pytz import UTC
from flask import Flask
from ...services import classic
from ... import save, load, load_fast, domain, exceptions, core
CCO = 'http://creativecommons.o... |
from flask import *
from WSServer import server
import WSServer.games
main_pages = Blueprint('main_pages', __name__, template_folder='templates', static_folder='static')
@main_pages.route('/')
def lobby():
return render_template('base.html', channel_id=1)
@main_pages.route('/auth', methods=['POST', 'GET'])
def... |
from covid19uncle import GlobalCovid19,ThaiCovid19
#Example:
data = GlobalCovid19()
print(data['italy'])
print(data['italy']['total'])
print(data['italy']['new_cases'])
print(data['italy']['total_deaths'])
print(data['italy']['new_deaths'])
print(data['italy']['total_recoverd'])
print(data['italy']['active... |
'''
This file biult for adding the Objective Function.
The main function is objective_funcion() to be called
from any other files such as GA and TS.
'''
def objective_function(chromosome):
'''
This function is the objective function for any case needed it only need
a chromosome to return the fitness value... |
#!../../../env/bin/python
'''
This script will query all messages new as of yesterday and ensure
that they exist in the archive
'''
# Standalone broilerplate -------------------------------------------------------------
from django_setup import do_setup
do_setup()
# ----------------------------------------------------... |
from RequirementBaseClass import RequirementBaseClass
from Strategy.StrategyBaseClass import StrategyBaseClass
import StructuredMask
class FunctionCreator(RequirementBaseClass, StrategyBaseClass):
masks: list
def __init__(self, function_name):
RequirementBaseClass.__init__(self)
# Syntax
... |
__all__ = ['flexible_distribute', 'FlexibleDistribute', 'to_admin']
import csv
import os
import threading
from BusinessCentralLayer.middleware.work_io import *
from BusinessLogicLayer.dog import subs2node
@logger.catch()
class FlexibleDistribute(object):
"""数据交换 弹性分发"""
def __init__(self, docker: tuple = N... |
MOD = 1000000
REM = 1
for i in range(3, MOD):
if i % 2 != 0 and i % 5 != 0:
REM = REM * i % MOD
def count_factor(n, f):
ret = 0
div = f
while n >= div:
ret += n / div
div *= f
return ret
def even_factorize(n):
if n == 0:
return 1
else:
return factori... |
import sys
import numpy as np
from numpy.ctypeslib import ndpointer, load_library
from numpy.testing import *
try:
cdll = load_library('multiarray', np.core.multiarray.__file__)
_HAS_CTYPE = True
except ImportError:
_HAS_CTYPE = False
class TestLoadLibrary(TestCase):
@dec.skipif(not _HAS_CTYPE, "ctyp... |
# TODO - put all constants here
|
# Cálculos Genéricos.
def sumar(n1, n2):
print("El resultado de la suma de", n1, "más", n2, "es:", n1+n2)
def restar(n1, n2):
print("El resultado de la resta de", n1, "menos", n2, "es:", n1-n2)
def producto(n1, n2):
print("El resultado del producto de", n1, "por", n2, "es:", n1*n2)
def divis(n1... |
import pygame
import game_objects
import consts
import color
import animations
from typing import Tuple, List
import random
import status
import effect
class Excepties(game_objects.GameObject):
def __init__(self, status_: status.Status) -> None:
super().__init__()
self._animation = animations.Err... |
from __future__ import absolute_import, division, print_function, unicode_literals
import os.path
from echomesh.base import Name
from echomesh.base import Path
from echomesh.base import Platform
from echomesh.base import Yaml
COMMAND_PATH = None
COMMAND_PATH_NAMES = None
def clean(*path):
return os.path.join(*pat... |
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Driver for determining which type of servo is being used."""
import logging
import os
import hw_driver
import servo.servo_logging
class metadataErro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# $Id: close_orphaned_testsets.py $
# pylint: disable=C0301
"""
Maintenance tool for closing orphaned testsets.
"""
__copyright__ = \
"""
Copyright (C) 2012-2017 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.vi... |
from symbolicExpressions import *
import math
debug = False
def make_env(lst_of_identifiers, test_pt):
env = {}
for (id, v) in zip(lst_of_identifiers, test_pt):
env[id] = v
return env
def checkFunctionValidity(fun_expr, lst_of_identifiers, test_point_list):
for test_pt in test_point_list:
... |
import re
import itertools as it
import numpy as np
from seasalt import create_feature_names
def transformer_custom_settings(global_dict, X, y=None, fit=True, names=True):
r = re.compile(r"trans\d+")
Z = []
f = []
for st in list(filter(r.match, global_dict)):
sidx = st[5:]
sm = "meta" ... |
"""
SC101 Baby Names Project
Adapted from Nick Parlante's Baby Names assignment by
Jerry Liao.
File: babygraphics.py
Name: Jade Yeh
This file shows graphic of the name_data.
The user provides names and the coder will draw a line chart containing year and rank for the certain names.
"""
import tkinter
import babynames... |
#!/usr/bin/env python
# Using Arista's pyeapi, create a script that allows you to add a VLAN (both the VLAN ID and the VLAN name).
# Your script should first check that the VLAN ID is available and only add the VLAN if it doesn't already exist.
# Use VLAN IDs between 100 and 999. You should be able to call the script... |
from setuptools import setup, find_packages
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(
name="pytiingo",
version="0.0.1",
description="Python SDK for Tiingo Financial Markets API",
long_description=long_description,
long_description_content_type="te... |
#!/usr/bin/env python
# Copyright 2016 Johns Hopkins University (Author: Daniel Povey)
# Apache 2.0.
from __future__ import print_function
from __future__ import division
import sys
import argparse
import math
from collections import defaultdict
# note, this was originally based
parser = argparse.ArgumentParser(
... |
num=int(input("Enter a number : "))
if num%2==0:
print(num," is even.")
else:
print(num," is odd.") |
import unittest
from katas.kyu_7.looking_for_a_benefactor import new_avg
class NewAverageTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(new_avg([
129306, 37783, 169930, 177970, 66848, 68272, 120258, 10307,
162807, 54503, 66465, 177701, 144296, 171044, 126332,... |
"""FPCore context canonicalizer and condenser."""
from ..fpbench import fpcast as ast
from . import interpreter
from . import evalctx
prop_uses_real_precision = {'pre', 'spec'}
op_is_boolean = {
ast.LT,
ast.GT,
ast.LEQ,
ast.GEQ,
ast.EQ,
ast.NEQ,
ast.Isfinite,
ast.Isinf,
ast.Isnan... |
# Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License,
# attached with Common Clause Condition 1.0, found in the LICENSES directory.
def __bytes2ul(b):
return int.from_bytes(b, byteorder='little', signed=False)
def mmh2(bstr, seed=0xc70f6907, signed=True)... |
frase = input('Insíra a frase desejada: ').lower().strip()
print('A letra"A" aparece {} vezes nessa frase!'.format(frase.count('a')))
print('A letra "A" aparece pela primeira vez na posição {} e pela última vez na posição {}'.format(frase.find('a'), frase.rfind('a')))
|
import hashlib
import hmac
import time
from hyperquant.api import Platform, Sorting, Direction
from hyperquant.clients import Endpoint, WSClient, Trade, ParamName, Error, \
ErrorCode, Channel, \
Info, WSConverter, RESTConverter, PlatformRESTClient, PrivatePlatformRESTClient
# https://docs.bitfinex.com/v1/doc... |
import os
from bridgedata.models.gcbc_images import GCBCImages
import numpy as np
from bridgedata.utils.general_utils import AttrDict
current_dir = os.path.dirname(os.path.realpath(__file__))
from bridgedata_experiments.dataset_lmdb import TOTAL_NUM_TASKS_ALIASING, task_name_aliasing_dict, bridge_data_config
from widow... |
# -*- coding: utf-8 -*-
'''
Created on 24.2.2009
@author: Jaakko Lintula <jaakko.lintula@iki.fi>
'''
import connection, events
import time, logging
Event = events.Event
LOG_FILENAME = "pyircfs.log"
#logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG, format='%(asctime)s %(name)-12s %(levelname)-8s %(messa... |
import matplotlib.pyplot as plt
def diagram(list_: list, file: str = None) -> None:
"""
Function for create plot with diagram and save to file.
:param file: str - path to file with diagram
:param list_: list - list for creating diagram
:return None
"""
labels = [val for val in range(1, len... |
from django.shortcuts import render
def teste(request):
return render(request, 'sobre/bla.html')
|
import sys
sys.path.append('../')
import globals
def removeEndDigit(name):
return name.strip("0123456789")
class outputHandler():
constraints = {}
mergedConstraints = {}
message = ""
heading = """#NS Output
set ns [new Simulator]
source tb_compat.tcl
"""
footer = """$ns rtproto Sess... |
import pytest
from py42._internal.client_factories import MicroserviceClientFactory
from py42._internal.clients.alertrules import AlertRulesClient
from py42._internal.clients.alerts import AlertClient
from py42.modules.alertrules import AlertRulesModule
@pytest.fixture
def mock_microservice_client_factory(mocker):
... |
from __future__ import annotations
from unittest import TestCase
from jsonclasses.exceptions import ValidationException
from tests.classes.enum_user import Gender, EnumUser
from tests.classes.value_gender_user import ValueGender, ValueGenderUser
from tests.classes.lname_gender_user import LnameGender, LnameGenderUser
... |
from abc import ABC, abstractmethod
from typing import List
from github import InputGitTreeElement
import discord
from . import format_model
class GitTreeElementCreator(ABC):
"""
Discordモデルを受け取りInputGitTreeElementを作成して返す動作の抽象基底クラス。
"""
@abstractmethod
def create_channel_element(sel... |
#
# Copyright (c), 2018-2020, SISSA (International School for Advanced Studies).
# All rights reserved.
# This file is distributed under the terms of the MIT License.
# See the file 'LICENSE' in the root directory of the present
# distribution, or http://opensource.org/licenses/MIT.
#
# @author Davide Brunato <brunato@... |
from __future__ import print_function
__author__ = 'nickv'
travis_file_name = '.travis.yml'
new_stable_branch_line = '/^stable\d+(\.\d+)?$/'
old_stable_branch_lines = {
'stable4',
'stable4.5',
'stable5',
'stable6',
'stable7',
'stable8',
'/^stable\d*$/'
}
def is_stable_branch_line(line)... |
# This file is part of the Indico plugins.
# Copyright (C) 2002 - 2020 CERN
#
# The Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License;
# see the LICENSE file for more details.
from __future__ import unicode_literals
import re
from wtforms import Valid... |
from enum import Enum
class RoundType(Enum):
BLOODBATH = 'bloodbath'
DAY = 'day'
NIGHT = 'night'
FEAST = 'feast'
ARENA = 'arena'
FALLEN = 'fallen'
class ErrorCode(Enum):
NO_GAME = 0x0
GAME_EXISTS = 0x1
GAME_STARTED = 0x2
GAME_FULL = 0x3
PLAYER_EXISTS = 0x... |
# -*-coding:utf-8 -*-
"""
Created on 2015-05-19
@author: Danny<manyunkai@hotmail.com>
DannyWork Project
"""
from __future__ import unicode_literals
from django import forms
from .models import ImageItem
class ImageItemForm(forms.ModelForm):
"""
图片对象 Form
"""
class Meta:
model = ImageItem
... |
# -*- coding: utf8 -*-fr
"""
Import all class needed
"""
__version__ = '1.0'
__authors__ = ['Guillaume Philippon <guillaume.philippon@lal.in2p3.fr>']
from itopapi.model.prototype import ItopapiPrototype, ItopapiUnimplementedMethod
from itopapi.model.rack import ItopapiRack
from itopapi.model.server import ItopapiSer... |
import os
import stat
import shutil
import subprocess
import git
def __remove_readonly(fn, path, excinfo):
if fn is os.rmdir:
os.chmod(path, stat.S_IWRITE)
os.rmdir(path)
elif fn is os.remove:
os.chmod(path, stat.S_IWRITE)
os.remove(path)
def delete(details):
if details[... |
##fixing index fastq.gz seq names to match RDP assembler's seq names###
import sys
import gzip
from Bio import SeqIO
if len(sys.argv) != 3:
print("USAGE: python fix_index_fastqgz_names.py XXX_I.fastq.gz FIXED_I.fastq")
sys.exit()
f = gzip.open(sys.argv[1], 'rU')
output = open(sys.argv[2], 'w')
for records in SeqI... |
'''
--- Part Two ---
The air conditioner comes online! Its cold air feels good for a while, but then the TEST alarms start to go off. Since the air conditioner can't vent its heat anywhere but back into the spacecraft, it's actually making the air inside the ship warmer.
Instead, you'll need to use the TEST to extend ... |
# O(n) time | O(n) space
def minHeightBst(array):
return minHeightBstHelper(array, 0, len(array)-1, None)
def minHeightBstHelper(array, startIdx, endIdx, root):
if endIdx < startIdx:
return
mid = (endIdx + startIdx) // 2
if root:
if array[mid] < root.value:
root.left = BST(... |
# users/forms.py
# Django modules
from django.shortcuts import render
from django.views.generic import CreateView
from django.contrib.auth.views import LoginView, LogoutView
# Locals
from users.forms import RegisterForm
# Create your views here.
# Class:RegisterView
class RegisterView(CreateView):
# Note: order... |
"""
Azimuth / elevation <==> Right ascension, declination
"""
from __future__ import annotations
from datetime import datetime
from .vallado import azel2radec as vazel2radec, radec2azel as vradec2azel
from .timeconv import str2dt # astropy can't handle xarray times (yet)
try:
from astropy.time import Time
f... |
# Copyright 2020 ByteDance 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 writin... |
from setuptools import find_packages, setup
from city_scrapers_core import __version__
with open("README.md", "r") as f:
long_description = f.read()
setup(
name="city-scrapers-core",
version=__version__,
license="MIT",
author="Pat Sier",
author_email="pat@citybureau.org",
description="Co... |
from conans import ConanFile, tools
import os
import shutil
from distutils.dir_util import copy_tree
class CrashpadConan(ConanFile):
name = "crashpad"
version = "1.0"
short_paths = True
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
... |
#!/usr/bin/env python2
# coding: utf-8
import errno
import os
import re
import string
import types
import subprocess32
from .colored_string import ColoredString
listtype = (types.TupleType, types.ListType)
invisible_chars = ''.join(map(unichr, range(0, 32)))
invisible_chars_re = re.compile('[%s]' % re.escape(invi... |
from art.attacks import SaliencyMapMethod
from tools.art.adversarial_attack import AdversarialAttack
class SaliencyMapAttack(AdversarialAttack):
def __init__(self, model, theta=0.1, gamma=1.0, batch_size=16):
super().__init__(model=model)
self._theta = theta
self._gamma = gamma
se... |
#!/usr/bin/env python3
# Copyright (C) 2017-2020 The btclib developers
#
# This file is part of btclib. It is subject to the license terms in the
# LICENSE file found in the top-level directory of this distribution.
#
# No part of btclib including this file, may be copied, modified, propagated,
# or distributed except... |
'''4. Elaborar um programa para imprimir os números de 1 (inclusive) a 10 (inclusive)
em ordem decrescente.Utilize for'''
print("Numeros de 1 a 10 crescente")
for contador in range(10, 0, -1):
print(contador) |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from six.moves import mock
from sasctl.core import PagedList, RestObj
from .test_pageiterator import paging
def test_len_no_paging():
items = [{'name': 'a'}... |
"""
taskcat python module
"""
from .collector import *
from .configurator import *
from .deployer import *
from .mutator import *
from .reporter import *
from .stacker import *
from .reaper import *
from .tester import *
from .utils import *
from .validator import *
|
"""
consume_reconcile_queue
"""
|
__author__ = 'tonycastronova'
__AdapedBy__ = 'AdelAbdallah'
class Schema():
def __init__(self, name):
self.__name = name
self.__tables = []
def name(self):
return self.__name
def add_table(self, table):
self.__tables.append(table)
def get_tables(self):
return ... |
"""
Definition of the :class:`AnalysisVersion` class.
"""
from typing import Any
from django.db import models
from django_analyses.models import help_text
from django_analyses.models.managers.analysis_version import (
AnalysisVersionManager,
)
from django_analyses.models.utils import get_analysis_version_interface... |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.
# pylint: disable=missing-module-docstring
# pylint: disable=missing-class-docstring
# pylint: disable=missing-function-d... |
from app.a_star import AStar
from app.common import get_directions
from app.common import check_if_path_in_between_walls
from app.common import add_large_opponent_move_walls
from app.common import remove_large_opponent_move_walls
from app.common import DEBUG_LOGS
def consumption_choices(data, aStar, walls, ... |
# Copyright (c) 2019, Danish Technological Institute.
# 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.
# -*- coding: utf-8 -*-
""" Command to change directory into Tracker projects
"""
import logging
import shut... |
from NarrativeService.ServiceUtils import ServiceUtils
class ReportFetcher(object):
def __init__(self, ws_client):
self.ws_client = ws_client
def find_report_from_object(self, upa):
#TODO:
# 1. make sure upa's real.
# first, fetch object references (without data)
ref_... |
# Generated by Django 3.2.4 on 2021-08-17 01:31
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Countries',
fields=[
('id', models.BigAutoF... |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
"""adding_error_codes_table
Revision ID: 6ba89cd39cc8
Revises: 8eac44955fb6
Create Date: 2020-04-14 12:36:57.094459
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '6ba89cd39cc8'
down_revision = '8eac44955fb6'
branch_labels = None
depends_on = None
def upgrad... |
# from app.table import table
#
#
# from app import data
# import csv
#
# a = []
#
# with open('tickers.csv') as csvfile:
# res = csv.reader(csvfile)
# for i in res:
# a.append(i[1])
#
# print(a)
# |
# -*- encoding: utf-8 -*-
"""
Created by eniocc at 11/10/2020
"""
from py_dss_interface.models.Solution.SolutionF import SolutionF
from py_dss_interface.models.Solution.SolutionI import SolutionI
from py_dss_interface.models.Solution.SolutionS import SolutionS
from py_dss_interface.models.Solution.SolutionV import So... |
import pyodbc
from math import ceil
def string_conexao():
# Dados da conexao com o Banco
driver_sql = '{SQL Server}'
server = 'SERVIDOR'
database = 'BANCO_DE_DADOS'
user = 'usuario'
psw = 'senha'
string_de_conexao = f"DRIVER={driver_sql};SERVER={server};DATABASE={database};USER ... |
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.testutil.pexrc_util import (
setup_pexrc_with_pex_python_path as setup_pexrc_with_pex_python_path,
) # noqa
from pants_test.deprecated_testinfra import deprecated_testinfra_m... |
import json
import requests
import pytz
from datetime import datetime
from beer_search_v2.models import Product, ProductType, ContainerType
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand
from beer_search_v2.utils import get_country_instance, get_alcohol_categor... |
import py
from rpython.translator.cli.test.runtest import CliTest
import rpython.translator.oosupport.test_template.dict as oodict
class TestCliDict(CliTest, oodict.BaseTestDict):
def test_dict_of_dict(self):
py.test.skip("CLI doesn't support recursive dicts")
def test_recursive(self):
py.test... |
import numpy as np
from faker import Faker
fake = Faker()
# generate nodes
def generate_nodes(N, M):
'''
Each node has 4 attributes:
-> Year of Birth(Integer)
-> Name(String)
-> Gender(M/F)
-> Num Posts(int)
-> Num Friends(int)
-> Unique ID(int)
'''
birth... |
class Item:
def __init__(self, name, description, amount, individual_value):
self.name = name
self.description = description
self.amount = amount
self.individual_value = individual_value
@property
def worth(self):
return f'${self.amount * self.individual_value:.2f}'... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 NORDUnet A/S
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# ... |
# Copyright 2016 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... |
import os
from flask import Flask, render_template, request
import solver_handler
app = Flask(__name__)
@app.route('/')
def home_page():
return render_template('enter_hexdump.html')
# route and function to handle the upload page
@app.route('/', methods=['GET', 'POST'])
def enter_hexdump_page():
if request.... |
import numpy as np
def find(x):
"""
Input:
- x: the process dataset in numpy array format
Output:
- mu, sigma, theta
Ornstein–Uhlenbeck process with long-term mean mu, volatility sigma, and mean reversion speed theta.
"""
s_x = np.sum(x[:-1])
s_y = np.sum(x[1:])
s_xx = np.sum(x[:-1]**2)
s_yy = np.sum... |
#
# MLDB-1713-wildcard-groupby.py
# Mathieu Bolduc, 2016-08-15
# This file is part of MLDB. Copyright 2016 mldb.ai inc. All rights reserved.
#
from mldb import mldb, MldbUnitTest, ResponseException
class MLDB1713WildcardGroupby(MldbUnitTest): # noqa
def test_wildcard_groupby(self):
msg = "Wildcard canno... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.