text stringlengths 2 999k |
|---|
"""Tests for the dianna.my_module module.
"""
import pytest
from dianna.my_module import hello
def test_hello():
assert hello('nlesc') == 'Hello nlesc!'
def test_hello_with_error():
with pytest.raises(ValueError) as excinfo:
hello('nobody')
assert 'Can not say hello to nobody' in str(excinfo.va... |
"""
Django settings for demo project.
Generated by 'django-admin startproject' using Django 1.8.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths ins... |
import datetime
import discord
from discord.ext import commands
from discord.ext.commands import Bot, Context
from tortoise.functions import Sum
import config
from db.models.stats import Stats
from db.models.user import User
from db.redis import RedisDB
from models.command import CommandInfo
from rpc.client import RP... |
#!/usr/bin/env python
"""
_CMSSW_
Template for a CMSSW Step
"""
import pickle
from future.utils import viewitems
from Utils.Utilities import encodeUnicodeToBytes
from WMCore.WMSpec.ConfigSectionTree import nodeName
from WMCore.WMSpec.Steps.Template import CoreHelper, Template
class CMSSWStepHelper(CoreHelper):
... |
import os
import json
import uuid
import logging
import datetime
from collections import defaultdict, OrderedDict
import jsonschema
from jsonschema import Draft3Validator, FormatChecker
import scrapelib
from pupa import utils
from pupa import settings
from pupa.exceptions import ScrapeError, ScrapeValueError
@Forma... |
# Copyright: 2005-2011 Brian Harring <ferringb@gmail.com
# Copyright: 2006 Marien Zwart <marienz@gentoo.org>
# License: BSD/GPL2
"""pkgcore repository cache clone utility"""
__all__ = ("argparser", "main")
import time
from pkgcore.util import commandline
argparser = commandline.mk_argparser(
domain=False, desc... |
# coding: utf8
from __future__ import unicode_literals
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
from .stop_words import STOP_WORDS
from .lex_attrs import LEX_ATTRS
from .tag_map import TAG_MAP
from .norm_exceptions import NORM_EXCEPTIONS
from ..tokenizer_exceptions import BASE_EXCEPTIONS
from .punctuati... |
#!/usr/bin/python
#
# Copyright 2015 Microsoft 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
#!/usr/bin/env python
#
# Version 0.1 - Copyright (c) 2019 by
#
# Updates:
#
# License: MIT License
#
import argparse
import os.path
import posixpath
filename = 'scene.rib'
#integratorParams = {"int maxPathLength" [10], "int maxContinuationLength" [-1], "int maxNonStochasticOpacityEvents" [0], "string sampleMode" [... |
APP_VERSION = '0.0.1'
HASH_VERSION = 'dev'
|
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Brandmand and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class Incidencias(Document):
pass
|
from datetime import datetime
from mimetypes import types_map
import os
from urllib.parse import unquote
from config import Config
from server.http_parser import Parser
REQUEST_BUF_SIZE = 4096
CHUNK_SIZE = 16384
METHOD_GET = 'GET'
METHOD_HEAD = 'HEAD'
STATUS_OK = 200
FORBIDDEN = 403
NOT_FOUND = 404
METHOD_NOT_ALLO... |
#!/usr/bin/env python
#===============================================================================
# Copyright (c) 2019 Brooke Wolford
# Revised from calculate_risk_scores.py from Dr. Sarah Graham
# Lab of Dr. Cristen Willer and Dr. Mike Boehnke
# University of Michigan
#Permission is hereby granted, free of char... |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
def test_create_user_with_email_successful(self):
"""Test creating a new user with an email is successful"""
email = 'test@gmail.com'
password = 'Testpass123'
user = get_use... |
"""
Ory APIs
Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501
The version of the OpenAPI document: v0.0.1-alpha.71
Contact: support@ory.sh
Generated by: htt... |
from flask import Flask
from flask_restful import Api
from flask_sqlalchemy import SQLAlchemy
from flask_jwt_extended import JWTManager
app = Flask(__name__)
api = Api(app)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///app.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SECRET_KEY'] = 'some-... |
"""
@Project : DuReader
@Module : trim_json.py
@Author : Deco [deco@cubee.com]
@Created : 8/7/18 4:39 PM
@Desc :
"""
import json
file_name = '/decaNLP/.data/squad/train-v1.1.json'
train_file = '/home/projects/DuReader/data/demo_squad/train_demo.json'
valid_file = '/home/projects/DuReader/data/demo_squa... |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from .views import RequestWSTicketView
app_name = "channels_ws_auth"
urlpatterns = [url(r"", RequestWSTicketView.as_view())]
|
import shutil
from solution import app, BASE_DIR
app.config.update({'TESTING': True})
client = app.test_client()
def test_no_dir_supplied():
response = client.get('/scan').get_json()
assert 'Error' in response
def test_dir_does_not_exist():
response = client.get('/scan?directory=test').get_json()
a... |
from typing import Any, Callable, Dict, List, Optional
import os
import torch
from torch.utils.data import Dataset
from catalyst.contrib.datasets.functional import (
download_and_extract_archive,
read_sn3_pascalvincent_tensor,
)
from catalyst.data.dataset.metric_learning import MetricLearningTrainDataset, Que... |
from django.db import models
from daiquiri.core.managers import AccessLevelManager
from daiquiri.jobs.managers import JobManager
class QueryJobManager(JobManager):
def get_size(self, user):
# get the size of all the tables of this user
return self.filter_by_owner(user).exclude(phase=self.model.P... |
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
from gym.envs.classic_control import rendering
from gym_snake.core.new_world import Snake, World
class NewMultipleSnakes(gym.Env):
def __init__(self, size=(10, 10), n_snakes=2, n_fruits=4, screen_res=300):
self.SIZE = size
... |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 28 22:39:01 2019
@author: Oshikuru
"""
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import data
class TFLogreg:
def __init__(self, D, C, param_delta=0.5, param_lambda=1e-3):
"""Arguments:
- D: dimensions of each datapoint
... |
__author__ = 'sdenisenko'
from math import sqrt
def getDivisors(n):
divisors = []
for i in range(2, sqrt(n)):
if n%i:
divisors.append(i)
return divisors
def getTriangleNumebr(n):
return (1/2)*n*(n-1)
def findElement():
pass
s = 1
f = 100
while(True):
t = getTriangleNumeb... |
import os,sys
import pandas as pd
import numpy as np
def get_params():
'''
Define dictionary with parameters
'''
params = {}
params['src'] = '/home/dani/Escritorio/K-LERA-master/Semana4_ok'
# Source data
params['root'] = '/home/dani/Escritorio/K-LERA-master/Semana4_ok'
params['... |
from django.conf.urls import url
from .views import contact, frontpage
urlpatterns = [
url(r'^$', frontpage, name='frontpage'),
url(r'^contact/$', contact, name='contact')
]
|
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import importlib
import importlib.resources
import json
import sys
from jinja2 import Environment, BaseLoader, Templ... |
# 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... |
#!/usr/bin/env python
import fileinput
DELTAS = {
'U': (0, 1),
'D': (0, -1),
'L': (-1, 0),
'R': (1, 0),
}
def trace(path):
x, y = 0, 0
grid = {}
n = 1
for direction, d in path:
dx, dy = DELTAS[direction]
for i in range(0, d):
x += dx
y += dy
... |
#!/usr/bin/env python
import numpy as np
import cv2
import roslib
roslib.load_manifest('traffic_sign')
import rospy
from sensor_msgs.msg import CompressedImage
from std_msgs.msg import String
class image_feature:
def __init__(self):
self.counter = 1;
self.raspi_subscriber = rospy.Subscriber("/r... |
#!/usr/bin/env python3
import sys
import argparse
import pyglet
import numpy as np
import gym
import gym_duckietown
from gym_duckietown.envs import SimpleSimEnv
parser = argparse.ArgumentParser()
parser.add_argument('--env-name', default='SimpleSim-v0')
parser.add_argument('--map-name', default='udem1')
parser.add_... |
import numpy as np
def get_confusion_matrix(output,target):
confusion_matrix = np.zeros((output[0].shape[0],output[0].shape[0]))
for i in range(len(output)):
true_idx = target[i]
pred_idx = np.argmax(output[i])
confusion_matrix[true_idx][pred_idx] += 1.0
return confusion_matri... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Copyright (c) 2017-2018 The Chellit Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the rawtransaction RPCs for asset transactio... |
# import the necessary packages
import os
import argparse
import random
import pandas as pd
import numpy as np
import pickle
import matplotlib.pyplot as plt
import matplotlib
from matplotlib import image, pyplot as plt
from random import sample,randint
matplotlib.use("Agg")
from preprocessor import preprocessor
from t... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 12 11:26:41 2019
@author: omaier
"""
import pyqmri
try:
import unittest2 as unittest
except ImportError:
import unittest
from pyqmri._helper_fun import CLProgram as Program
from pkg_resources import resource_filename
import pyopencl.array a... |
import base64
from contextlib import redirect_stderr
from io import StringIO
from subprocess import DEVNULL # nosec
from typing import TYPE_CHECKING, Dict, Optional
from azure.core.exceptions import ClientAuthenticationError, ResourceNotFoundError
from azure.identity import DefaultAzureCredential
from azure.storage.b... |
# -*- coding: utf-8 -*-
#
from io import BytesIO
import rdflib
import requests
from flask import render_template, url_for
from rdflib import URIRef, Literal, BNode
from requests import Session
from lxml import etree
from geofabric import _config as config
from geofabric.helpers import gml_extract_geom_to_geojson, \
... |
import datetime
import os
from bson.son import SON
from dotenv import load_dotenv
from pymongo import MongoClient
load_dotenv()
USER = os.getenv("MONGO_USER")
PASSWORD = os.getenv("MONGO_PASS")
PORT = 27017
client = MongoClient(host="mongo_db", port=PORT, username=USER, password=PASSWORD)
db = client["statistics"]
... |
def n_primos(n):
def éPrimo(k):
divisores = 0
for i in range(1,k):
if k % i == 0:
divisores += 1
if divisores >= 2:
return False
else:
return True
conta_primos = 0
for i in range(2, n+1):
if éPrimo(i) == True:
... |
""" #EmbraceTheS's options menu state. """
import state
import options
import globes as G
import pygame
import soundwave
import game
import enemy
import player
import items
class Volume(state.State):
""" Volume menu state with the option to change volume """
BACKGROUND = None
NOTCH = None
STEP = 0.1... |
import matplotlib.pyplot as plt
import numpy as np # 导入包
t1 = np.arange(0.0, 4.0, 0.1)
t2 = np.arange(0.0, 4.0, 0.05) # 准备一些数据
fig = plt.figure() # 准备好这张纸,并把句柄传给fig
ax1 = fig.add_subplot(211) # 使用句柄fig添加一个子图
line1, = plt.plot(t1, np.sin(2 * np.pi * t1), '--*') # 绘图,将句柄返给line1
plt.title('sine function de... |
import json
import yaml
from selenium.webdriver.common.keys import Keys
from galaxy_test.base.workflow_fixtures import (
WORKFLOW_NESTED_SIMPLE,
WORKFLOW_OPTIONAL_TRUE_INPUT_COLLECTION,
WORKFLOW_SELECT_FROM_OPTIONAL_DATASET,
WORKFLOW_SIMPLE_CAT_TWICE,
WORKFLOW_SIMPLE_MAPPING,
WORKFLOW_WITH_INV... |
from mcstats import mcstats
mcstats.registry.append(
mcstats.MinecraftStat(
'ride_horse',
{
'title': 'Rider',
'desc': 'Distance ridden on a horse',
'unit': 'cm',
},
mcstats.StatReader(['minecraft:custom','minecraft:horse_one_cm'])
))
|
import os
import random
import json
import torch
import numpy as np
VOCAB_SIZE = 89528
MAX_LENGTH = 150
class Dataset:
def __init__(self, data_dir):
test_percent = 0.1
validation_percent = 0.1
# Index for minibatches
self.data_index = {'train': 0, 'validation': 0,... |
import os
import math
from numpy.testing import *
from numpy import array
import util
import textwrap
def _path(*a):
return os.path.join(*((os.path.dirname(__file__),) + a))
class TestMixed(util.F2PyTest):
sources = [_path('src', 'mixed', 'foo.f'),
_path('src', 'mixed', 'foo_fixed.f90'),
... |
#
# module forward.py
#
# forward chaining inference engine
# see holmes.doc for description
# exports forward(kbase, facts)
#
# forward(kbase, facts) -> prints all facts deduced
# forward(kbase, <filter>) -> prints all deduced facts matching <filter>
# forward(kbase, None) -> returns the list of ded... |
"""
Argo Server API
You can get examples of requests and responses by using the CLI with `--gloglevel=9`, e.g. `argo list --gloglevel=9` # noqa: E501
The version of the OpenAPI document: VERSION
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from ... |
# -------------------------------------------------------------------------------
# Copyright IBM Corp. 2017
#
# 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/licens... |
import pytz
from typing import Collection, Union, List, Optional
from sqlalchemy.orm import joinedload
from aim.storage.types import SafeNone
from aim.storage.structured.entities import (
Run as IRun,
Experiment as IExperiment,
Tag as ITag,
Note as INote,
RunCollection,
TagCollection,
Note... |
# Copyright (c) 2022 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... |
lar = float(input('largura da parede: '))
alt = float(input('altura da parede: '))
aria = lar*alt
print('Sua parede tem {}x{} metros e árie é de {}m²'.format(lar,alt,aria))
tinta = aria/2
print('Para pintar essa parede você vai precisar {}litros de tinta'.format(tinta))
|
from s3fs.utils import read_block, seek_delimiter, tmpfile
import io
import os
def test_tempfile():
with tmpfile() as fn:
with open(fn, 'w'):
pass
assert os.path.exists(fn)
assert not os.path.exists(fn)
def test_read_block():
delimiter = b'\n'
data = delimiter.join([b'123... |
# Copyright 2018 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... |
"""Support for Xiaomi Gateways."""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers import discovery
from homeassistant.helpers.entity import Entity
from homeassistant.components.discovery import SERVICE_XIAOMI_GW
from homeassistant.const import (AT... |
#@author:leacoder
#@des: 递归 电话号码的字母组合
"""
递归处理digits字符串中的每个字符
digits的每个字符又有多种情况(多个字母需要处理)
递归终止条件就是 digits字符串中的每个字符 已处理结束
"""
class Solution:
phone = {'2': ['a', 'b', 'c'],
'3': ['d', 'e', 'f'],
'4': ['g', 'h', 'i'],
'5': ['j', 'k', 'l'],
'6': [... |
import os
import stat
from concurrent.futures import ThreadPoolExecutor
from multiprocessing import cpu_count
from tempfile import TemporaryDirectory, gettempdir
def sources_dir():
path = os.path.join(gettempdir(), "sources")
os.makedirs(path, exist_ok=True)
return path
class BaseBench:
def setup(se... |
from flask import Blueprint, jsonify, abort, session, flash, render_template, request, redirect, url_for
import json
import os.path
from werkzeug.utils import secure_filename
bp = Blueprint('urlshort', __name__)
@bp.route('/')
def home():
return render_template('home.html', codes=session.keys())
@bp.route('/your... |
a = "Hello World"
while True:
a = get()
raw(a)
|
from django.apps import AppConfig
class NewsConfig(AppConfig):
verbose_name = 'Новости'
name = 'news'
|
# THE BEST PLAYER
n,t = list(map(int, input().split()))
d = {}
f = []
for _ in range(n):
name,qt = input().split()
try:
d[int(qt)].append(name)
except:
d[int(qt)] = [name]
f.append(int(qt))
f.sort(reverse = True)
for i in range(t):
d[f[i]].sort()
print(d[f[i]][0... |
import pytest
from helpers.client import QueryRuntimeException
from helpers.cluster import ClickHouseCluster
from ast import literal_eval
cluster = ClickHouseCluster(__file__)
node1 = cluster.add_instance('node1', with_zookeeper=True)
node2 = cluster.add_instance('node2', with_zookeeper=True)
node3 = cluster.add_insta... |
import numpy as np
def generate_surface(data, filename='panair') :
'''
Function to generate vtk files from a panair input mesh
INPUT :
- data is a list of networks which are 3D arrays with the dimensions being
columns, rows, and coordinates)
- 'filename' is a string to use in filenames.
... |
from flask_wtf import FlaskForm
from wtforms import StringField,TextAreaField,SubmitField
from wtforms.validators import Required
class ReviewForm(FlaskForm):
title = StringField('Review title',validators=[Required()])
review = TextAreaField('Movie review')
submit = SubmitField('Submit')
class UpdateProf... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2019-03-20 14:05
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... |
"""
Multiple stacked lstm implemeation on the lip movement data.
Akm Ashiquzzaman
13101002@uap-bd.edu
Fall 2016
"""
from __future__ import print_function
import numpy as np
np.random.seed(1337)
#random seed fixing for reproducibility
#data load & preprocessing
X_train = np.load('../data/videopart43.npy').astype('fl... |
# coding: utf-8
"""
UltraCart Rest API V2
UltraCart REST API Version 2 # noqa: E501
OpenAPI spec version: 2.0.0
Contact: support@ultracart.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class ScreenRecordingFilterVal... |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... |
import scripts.helpers.target_helper_factory
import scripts.helpers.results_helpers.file_searcher
import scripts.helpers.make_helper
import time
import os
import sys
import optparse
module = os.environ["MODULE"]
print("Build Module %s"%module)
parser = optparse.OptionParser()
#parser.add_option("-r",action="store_t... |
# Copyright (c) 2020 SBA- MIT License
import subprocess
import socket
import select
import non_blocking_io_wrapper
from typing import Sequence, Optional
from abc import ABC, abstractmethod
class IProcess(ABC):
process: subprocess.Popen
@abstractmethod
def select(self, timeout: Optional[float]) -> bool... |
import numpy as np
import os
import shutil
import sys
from torch.utils.tensorboard import SummaryWriter
import torch
def model_input(data, device):
datum = data.data[0:1]
if isinstance(datum, np.ndarray):
return torch.from_numpy(datum).float().to(device)
else:
return datum.float().to(devic... |
import torch.utils.data as data
from data import common
class HRDataset(data.Dataset):
'''
Read LR and HR images in train and eval phases.
'''
def name(self):
return common.find_benchmark(self.opt['dataroot_HR'])
def __init__(self, opt):
super(HRDataset, self).__init__()
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# TODO remove use of args and kwargs as much as possible for clearer code.
# General imports.
import numpy as np
from scipy.sparse import issparse, csr_matrix, diags
from scipy.sparse.linalg import spsolve
from scipy.interpolate import interp1d, Akima1DInterpolator
from s... |
# Copyright 2017-present Open Networking 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
#
# Unless required by applicable law or ag... |
try:
import wikipedia
# assert wikipedia.__version__ == "1.4.0"
except:
print("(!) Code in `autogoal.contrib.wikipedia` requires `wikipedia==1.4.0`.")
print("(!) You can install it with `pip install autogoal[wikipedia]`.")
raise
from ._base import (
WikipediaContainsWord,
Wiki... |
import os
import sys
from unittest import mock
import pytest
# Module Vars / Constants
class Vars:
tmpdir_factory = None
tmpdir_home = None
tmpdir_data = None
extrasession_mockers = []
def pytest_sessionstart(session):
""" pytest_sessionstart hook
This runs *before* import and collection o... |
import datetime
import time
import logging
import urllib2
from protorpc import remote
from protorpc import messages
from models import *
from google.appengine.ext import db
from protorpc import message_types
from google.appengine.api import users
import json
class Delivery(messages.Message):
destination_address = ... |
# coding=utf-8
"""
© 2015 LinkedIn Corp. 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 agreed ... |
r"""
``cotk._utils.imports`` provides classes that fake a uninstalled module.
"""
import importlib
import sys
class LazyModule(object):
r'''Lazy loading modules.
Arguments:
module_name (str): The path of import. For example: ``cotk``.
global_dict (str): Override the global dictionary when the module is loaded.
... |
import logging
from flask_sqlalchemy import sqlalchemy
from init import Formula, FormulaSubFormula, SubFormula, Taste, CostEstimation, config
from utilities.scm_enums import ErrorCodes
from utilities.scm_exceptions import ScmException
from utilities.scm_logger import ScmLogger
class FormulaRepository:
logger = S... |
import io
import os
import sys
from shutil import rmtree
from setuptools import setup, Command
# Initialized with template at https://github.com/kennethreitz/setup.py
#
# Package meta-data.
NAME = 'jupyterlab-dash'
DESCRIPTION = 'A JupyterLab extensions for rendering Plotly Dash apps'
URL = 'https://github.com/plotly... |
def topla(a, b): return a + b
print(topla(2, 3))
topla2 = lambda a, b: a + b
print(topla2(2, 3))
def listeyiGoster(liste, gosteriFonksiyonu):
for i in liste:
print(gosteriFonksiyonu(i))
list = [
{"id": 1, "ad": "Alper", "soyad": "Konuralp" },
{"id": 2, "ad": "Burcu", "soyad": "K... |
from uppyyl_simulator.backend.data_structures.state.variable import UppaalVariable
from uppyyl_simulator.backend.data_structures.types.bool import UppaalBool
from uppyyl_simulator.backend.data_structures.types.int import UppaalInt
all_c_language_rules = [
# "Declarations",
"Declaration", "VariableDecls", "Var... |
class InvalidBooleanValue(Exception):
def __init__(self, value):
self.value = value
def get_value(self):
return self.value
class UnknownMainCategory(Exception):
DEFAULT_MESSAGE = 'Main category was not specified.'
def __init__(self, message=DEFAULT_MESSAGE):
self.message = ... |
"Various utility functions and classes."
import csv
import datetime
import functools
import http.client
import io
import json
import os.path
import re
import sqlite3
import string
import threading
import time
import urllib.parse
import uuid
import flask
import jinja2.utils
import marko
import werkzeug.routing
import... |
# -*- coding: utf-8 -*-
import lang.mqllex as mqllex
import yacc.yacc as yacc
from lang.mqllex import tokens
precedence = (
('left', 'PLUS', 'MINUS'),
('left', 'MULTIPLY', 'DIVIDE'),
('left', 'POWER'),
('right', 'UMINUS')
)
def p_program(p):
"""program : program command
| command
... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 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 proper accounting with an equivalent malleability clone
#
from test_framework.test_framework im... |
from django.contrib import admin
from .models import Owner
admin.site.register(Owner)
from .models import Car
admin.site.register(Car)
from .models import Owning
admin.site.register(Owning)
from .models import License
admin.site.register(License)
|
import os
import os.path as osp
import copy
from functools import cmp_to_key
from collections import Counter
from collections import OrderedDict
import json
from glob import glob
from tqdm import tqdm
class Matching:
def __init__(self, annot_dir):
self.annot_dir = annot_dir
self._groups = None
... |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Utilities for doing coverage analysis on the RPC interface.
Provides a way to track which RPC commands... |
"""Unittests for test.support.script_helper. Who tests the test helper?"""
import subprocess
import sys
import os
from test.support import script_helper, requires_subprocess
import unittest
from unittest import mock
class TestScriptHelper(unittest.TestCase):
def test_assert_python_ok(self):
t = script_... |
"""Tests for hermite_e module.
"""
from __future__ import division, absolute_import
import numpy as np
import numpy.polynomial.hermite_e as herme
from numpy.polynomial.polynomial import polyval
from numpy.testing import *
He0 = np.array([ 1 ])
He1 = np.array([ 0 , 1 ])
He2 = np.array([ -1 ,0 , 1 ])
He3 = np.array([ ... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 05 11:34:28 2016
@author: Pedro Leal
"""
import math
from xfoil_module import output_reader
from optimization_tools import plot_generations
filename = "opt_data.txt"
n_generation = 50
outputs_plotted = ['theta']
#output_constrained = ['theta']
#g1 = lambda x: True if x... |
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2019 all rights reserved
#
# superclass
from .Numeric import Numeric
# declaration
class Integer(Numeric):
"""
A type declarator for integers
"""
# constants
typename = 'int' # the name of my type
complaint = 'could n... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print("Hello butts")
|
from gevent.monkey import patch_all
patch_all() # noqa: E402
import logging
from signal import signal
from signal import SIGTERM
from gevent.pywsgi import WSGIServer
from poker.http import app
def signal_handler(signum):
raise SystemExit(1)
signal(SIGTERM, signal_handler)
logging.basicConfig(level=logging.... |
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from profiles_api import views
router = DefaultRouter()
router.register('hello-viewset', views.HelloViewSet, base_name='hello-viewset')
urlpatterns = [
path('hello-view/', views.HelloApiView.as_view()),
path('', include(rou... |
from django.db.models import F, Sum
from rest_framework.response import Response
from rest_framework.views import APIView
from usaspending_api.accounts.models import AppropriationAccountBalances
from usaspending_api.common.cache_decorator import cache_response
from usaspending_api.references.constants import TOTAL_BUDG... |
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2019,2020
"""
Composite transformations.
.. versionadded:: 1.14
"""
__all__ = ['Composite', 'Source', 'Map', 'ForEach']
import streamsx._streams._version
__version__ = streamsx._streams._version.__version__
from abc import ABC, abstractme... |
"""
Discord Leveling System
~~~~~~~~~~~~~~~~~~~~~~~
A library to implement a leveling system into a discord bot. Contains features such as XP, level, ranks, and role awards.
:copyright: (c) 2021-present Defxult#8269
:license: MIT
"""
from .announcement import LevelUpAnnouncement
from .leveling_system import Discord... |
import pandas as pd
import seaborn as sn
import numpy as np
import os
from sklearn.metrics import accuracy_score, classification_report, confusion_matrix
from matplotlib import pyplot as plt
#csv_name:using predict.py and the csv file will be generated.
#labels:A list. The list includes all the category names ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.