text stringlengths 1 927k |
|---|
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class AssetMaintenanceTeam(Document):
pass |
#------------------------------------------------------------------------------
# Copyright (C) 2009 Richard W. 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 restrictio... |
# Desenvolva uma lógica que leia o peso e a altura de uma pessoa, calcule seu IMC e mostre seu status , de acordo com a tabela abaixo;
# abaixo de 18.5: ABAIXO DO PESO; entre 18.5 e 25: PESO IDEAL; 25 até 30: SOBREPESO; 30 até 40: OBESIDADE; acima de 40: OBESIDADE MÓRBIDA;
peso = float(input('Digite o seu peso: '))
al... |
#!/usr/bin/env python
import os, os.path, errno, sys
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.template
import logging, logging.handlers
from config import *
from util import *
from ws_handler import *
from game_data_handler import GameDataHandler
import process_handler
import... |
from __future__ import annotations
import random
import pytest
def test():
from scitbx.array_family import flex
from dials.algorithms.image.filter import index_of_dispersion_filter
# Create an image
image = flex.random_double(2000 * 2000)
image.reshape(flex.grid(2000, 2000))
mask = flex.ra... |
#!/usr/bin/env python
from numpy import array_equal, polyfit, sqrt, mean, absolute, log10, arange
import numpy as np
from scipy.stats import gmean
try:
from soundfile import SoundFile
wav_loader = 'pysoundfile'
except:
try:
from scikits.audiolab import Sndfile
wav_loader = 'scikits.audiola... |
import re
from subprocess import CalledProcessError
from typing import Any, List, Optional, Tuple
from avionix._process_utils import custom_check_output
def _space_split(output_line: str):
return [
value
for value in re.split(r"(\t| +)", output_line)
if not re.match(r"^\s*$", value)
... |
#!/usr/bin/env python
# pylint: disable=R0903
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2020
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public L... |
# Adapted from http://wiki.python.org/moin/PythonDecoratorLibrary#Cached_Properties
import itertools
import time
from .decorators import wraps
from .python_compat import iteritems
from logging import getLogger
from types import MethodType, FunctionType
logger = getLogger(__name__)
class cached_property(object):
"... |
"""
CS131 - Computer Vision: Foundations and Applications
Assignment 1
Author: Donsuk Lee (donlee90@stanford.edu)
Date created: 07/2017
Last modified: 10/16/2017
Python Version: 3.5+
"""
import numpy as np
def conv_nested(image, kernel):
"""A naive implementation of convolution filter.
This is a naive imple... |
#!/usr/bin/env python
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python test originally created or extracted from other peoples work. The
# parts from me are licensed as below. It is at least Free Software where
# it's copied from other people. In these cases, that will normally be
# ... |
#!/usr/bin/python
#
# pip install tinyrpc
#
from tinyrpc.protocols.jsonrpc import JSONRPCProtocol
from tinyrpc.transports.http import HttpPostClientTransport
from tinyrpc import RPCClient
rpc_client = RPCClient(
JSONRPCProtocol(),
HttpPostClientTransport('http://localhost:8080/')
)
local = rpc_client.get_pr... |
"""
Contrib-util features for Pyasys.
Recommended for advanced developing uses.
""" |
#!/usr/bin/env python3
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
"""DrQA Document Reader model"""
import torch
import torch.optim as optim
import torch.nn.functional as F
impo... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2016 The Tulsi 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/LICE... |
# Import dependencies
import numpy as np
from apogee.spec import continuum
from apogee.tools import bitmask as bm
from .util import get_DR_slice, bitsNotSet
# Future: Define a class for spectra - spectra, error and weight
def process_spectra(spectra_info=None, badcombpixmask=4351, minSNR=50.):
cont_cannon = cont... |
from sciapp.action import Measure
from sciapp.action import Free
from imagepy.app import ConfigManager
class Plugin(Free):
title = "Measure Setting"
para = Measure.default.copy()
view = [
("color", "color", "line", "color"),
("color", "fcolor", "face", "color"),
("color", "tcolor",... |
"""
SecureTranport support for urllib3 via ctypes.
This makes platform-native TLS available to urllib3 users on macOS without the
use of a compiler. This is an important feature because the Python Package
Index is moving to become a TLSv1.2-or-higher server, and the default OpenSSL
that ships with macOS is not capable... |
from leapp.actors import Actor
from leapp.libraries.common import dnfplugin
from leapp.models import (
DNFPluginTask,
DNFWorkaround,
FilteredRpmTransactionTasks,
StorageInfo,
TargetUserSpaceInfo,
UsedTargetRepositories,
XFSPresence
)
from leapp.tags import IPUWorkflowTag, TargetTransactionCh... |
from enum import Enum
class MessageType(Enum):
'''
Enumeration that represents the standard messages that are emitted inside log file.
CORRECT = 1
INCORRECT = 2
DISABLED = 3
ASSERTERROR = 4
'''
CORRECT = 1
INCORRECT = 2
DISABLED = 3
ASSERTERROR = 4
class ScrapType(Enum)... |
import os
import json
import torch
import sys
import time
import random
import numpy as np
from tqdm import tqdm, trange
import torch.multiprocessing as mp
import torch.distributed as dist
from torch.utils.tensorboard import SummaryWriter
from apex.parallel import DistributedDataParallel as DDP
from apex import amp
s... |
import os
import re
import unicodedata
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "systori.settings")
import django
django.setup()
from systori.apps.company.models import Company
from systori.apps.task.models import *
from systori.apps.project.models import *
c = Company.objects.get(schema=input("Company Schem... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class RecognizeTransportationLicenseResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
... |
#
# Copyright 2019 EPAM Systems
#
# 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... |
import unittest.mock as mock
import mycity.test.test_constants as test_constants
import mycity.test.unit_tests.base as base
import mycity.utilities.gis_utils as gis_utils
class GISUtilitiesTestCase(base.BaseTestCase):
def test_get_dest_addresses_from_features(self):
to_test = \
gis_utils._get... |
from django.db import models
from django.conf import settings
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from hexchan import config
class Post(models.Model):
hid = models.IntegerField(
_('HID'),
editable=False,
db_index=True
)
thread = ... |
# Copyright (c) 2021, TS and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class TS_Payroll(Document):
pass |
#!/usr/bin/env vpython
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tests for base_device_trigger.py."""
import argparse
import json
import unittest
import mock
from pyfakefs import fake_filesyste... |
from .setup_parser import setup_parser
from .tools import * |
import data_loader
import numpy as np
import pandas as pd
import re
import os.path
from itertools import product
from string import ascii_lowercase
from sklearn.pipeline import Pipeline, FeatureUnion
from sklearn.decomposition import PCA, TruncatedSVD
from sklearn.metrics import roc_auc_score, accuracy_score, classif... |
# Copyright 2013 Rackspace Hosting.
#
# 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... |
'''
SPDX-License-Identifier: Apache-2.0
Copyright 2017 Massachusetts Institute of Technology.
'''
import os
import subprocess
import time
EXIT_SUCESS = 0
def _execute(cmd, env=None, **kwargs):
proc = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, **kw... |
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..models.w3c_credentials_list_request_tag_query import W3CCredentialsListRequestTagQuery
from ..types import UNSET, Unset
T = TypeVar("T", bound="W3CCredentialsListRequest")
@attr.s(auto_attribs=True)
class W3CCredentialsListRequest:
... |
#!/usr/bin/env python
"""
Copyright (c) 2014-2019 Miroslav Stampar (@stamparm)
See the file 'LICENSE' for copying permission
"""
from core.common import retrieve_content
__url__ = "https://raw.githubusercontent.com/firehol/blocklist-ipsets/master/socks_proxy_7d.ipset"
__check__ = "socks_proxy_7d"
__info__ = "proxy (... |
"""Nox sessions."""
import tempfile
import nox
package = "radio_dreams"
nox.options.sessions = "lint", "tests"
locations = "src", "tests", "noxfile.py", "docs/conf.py"
def install_with_constraints(session, *args, **kwargs):
"""Install packages constrained by Poetry's lock file.
This function is a wrapper... |
# Copyright 2021 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, ... |
# Проанализировать скорость и сложность одного любого алгоритма,
# разработанных в рамках домашнего задания первых трех уроков.
# В массиве случайных целых чисел поменять местами минимальный и максимальный элементы.
import random
import cProfile
def generate_array(size, min_item, max_item):
return [random.randi... |
"""
There are three types of functions implemented in SymPy:
1) defined functions (in the sense that they can be evaluated) like
exp or sin; they have a name and a body:
f = exp
2) undefined function which have a name but no body. Undefined
functions can be defined using a Function cla... |
from buildings import buildings
class Console:
"""
The console is merely the game logic. Here includes all main functions
including moving, building, the queue handler and perhaps notifications*?
*Although notifications will need another class
- learn about thread safety
- just m... |
"""
Temperature Scale Converter
- Converts celsius sclae to fahrenheit and vice-versa
Author : (Niyoj Oli)[https://github.com/niyoj]
Date : 24/09/21
"""
temp = input("Input the temperature you would like to convert? (e.g., 45F, 102C etc.) : ")
degree = int(temp[:-1])
i_convention = temp[-1]
if i_convention.upper() =... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2021 Mergify SAS
#
# 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 applicab... |
from .main import bvcs, bvlag, bvtcg, cpqp, lctcg, nnls
__all__ = ['bvcs', 'bvlag', 'bvtcg', 'cpqp', 'lctcg', 'nnls'] |
import os
import sys
import subprocess
from os import system
from time import sleep
follow = """
{+}-- https://www.facebook.com/dzmanisso
{+}-- https://twitter.com/ManissoDz
{+}-- https://github.com/Manisso
{+}-- https://www.linkedin.com/in/Manisso
{+}-- https://www.instagram.com/man.i.s/
"""
#Wash is a utility for i... |
#!/usr/bin/env python
#
# Copyright 2016 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
"""Test the vtgate master buffer.
During a master failover, vtgate should automatically buffer (stall) requests
for a configured time and retr... |
#!/usr/bin/env python
# Copyright (C) 2022 Rhys Mainwaring
#
# 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 applicabl... |
# Copyright 2017 National Computational Infrastructure(NCI).
# 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
#
# Unl... |
# -*- coding: utf-8 -*-
#
# desiutil documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 9 10:43:33 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... |
from match import Match
from rl_agent import Rl_Agent
def init():
num_players = 3
rl_agent = Rl_Agent()
match = Match(num_players, rl_agent)
rl_agent.set_match(match)
match.start()
match.run()
match.end()
if __name__ == '__main__':
init() |
import tempfile
from pathlib import Path
import requests
from ocrd.constants import TMP_PREFIX
from ocrd_utils import (
getLogger,
is_local_filename,
get_local_filename,
remove_non_path_from_url,
nth_url_segment
)
from ocrd.workspace import Workspace
from ocrd_models import OcrdMets
from ocrd_mode... |
import luigi
import datetime
import networkx as nx
from DBbridge.ConsultasCassandra import ConsultasCassandra
from DBbridge.ConsultasNeo4j import ConsultasNeo4j
from RecolectorTwitter import RecolectorUsuarioTwitter, RecolectorFavoritosTwitter
from Config.Conf import Conf
def remove_edges(g, in_degree=1):
g2=g.cop... |
#!/usr/bin/python3
# Copyright (c) 2018 Bart Massey
# [This program is licensed under the "MIT License"]
# Please see the file LICENSE in the source
# distribution of this software for license terms.
# Print a random line from stdin.
from sys import stdin
from random import randrange
lines = list(stdin)
line = lines... |
from django.conf.urls import url
from cov19 import views
urlpatterns = [
url('map', views.reptile,name='map'),
url('time', views.time1,name='history'),
url('index', views.index,name='index'),
url('move', views.move,name='move'),
url('wordcloud', views.wordc,name='wordcloud'),
url('line', views.l... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from happy_python import bytearray_to_str, gen_random_str, to_hex_str1, is_ascii_str, to_hex_str2, \
from_hex_str
from happy_python import bytes_to_str
from happy_python import dict_to_str
from happy_python import str_to_dict
class TestUtils(unittes... |
# -*- coding: utf-8 -*-
from model.parameters import *
def test_add_contact(app, db, check_ui, json_contacts):
contact = json_contacts
old_contacts = db.get_contact_list()
app.contact.create_new_contact(contact)
new_contacts = db.get_contact_list()
old_contacts.append(contact)
assert sorted(ol... |
from glad.lang.common.loader import BaseLoader
from glad.lang.d.loader import LOAD_OPENGL_DLL
_GLX_LOADER = \
LOAD_OPENGL_DLL % {'pre':'private', 'init':'open_gl',
'proc':'get_proc', 'terminate':'close_gl'} + '''
bool gladLoadGLX() {
bool status = false;
if(open_gl()) {
sta... |
# coding=UTF-8
'''
@Author: xiaoyichao
LastEditors: xiaoyichao
@Date: 2020-01-02 16:55:23
LastEditTime: 2021-06-06 21:54:28
@Description: 删除ES的索引, del_index_name 是要删除的索引的名字
'''
from es_operate import ESCURD
from elasticsearch import Elasticsearch
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os... |
#!/usr/bin/env python
"""A kernel that compares two ASCII files and outputs the differences in a detailed
format.
"""
__author__ = "Ioannis Paraskevakos <i.paraskev@rutgers.edu>"
__copyright__ = "Copyright 2014, http://radical.rutgers.edu"
__license__ = "MIT"
from copy import deepcopy
from radical.ensemblem... |
import numpy as np
import h5py
import time
import os
# functions (to be moved to utils.py)
def add_meta_keys(fn, pars_keys, image_keys=[]):
with h5py.File(fn, 'r') as f:
for key in f.keys():
if key not in pars_keys and key not in image_keys:
pars_keys.append(key)
return 0
... |
# imports - standard imports
import sys
import os.path as osp
import random
import collections
# imports - third-party imports
from ccapi.util.gevent import patch
patch()
import requests
# from requests_cache.core import CachedSession
import grequests as greq
from grequests import AsyncRequest... |
"""
AMPAREX Rest API Documentation
This is the description of the AMPAREX Rest API. All REST calls plus the corresponding data model are described in this documentation. Direct calls to the server are possible over this page.<br/>Following steps are needed to use the API:<br/><br/>1. Get the ... |
from random import randint
class Solution(object):
def findKthLargest(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
left = 0
right = len(nums) - 1
while left <= right:
pivot_idx = randint(left, right)
... |
import random
import time
import math
import os.path
import numpy as np
import pandas as pd
from pysc2.agents import base_agent
from pysc2.env import sc2_env, run_loop
from pysc2.lib import actions, features, units
from absl import app
from baseline.sc2.agent.DRLAgentWithVanillaDQN import TerranRLAgentWithRawActsA... |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... |
import argparse
import traceback
import json
import requests
from vkbottle.api import UserApi
from vkbottle.user import User
from logger import logger, Logger, LoggerLevel
import const
from commands import commands_bp
from error_handlers import error_handlers_bp
from objects.json_orm import Database, DatabaseError
fr... |
# -*- coding: utf-8 -*-
#
# 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
#... |
"""Unit test package for with_op.""" |
#
# Copyright (C) 2019-2020 Authlete, 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 t... |
# Copyright 2013-2020 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)
#
# Author: Mark Olesen <mark.olesen@esi-group.com>
#
# Legal Notice
# ------------
# OPENFOAM is a trademark owned by Ope... |
import pandas as pd
import matplotlib.pyplot as plt, mpld3
import numpy as np
import scipy.signal as sp
import matplotlib.ticker as plticker
df=pd.read_csv('numbers2.csv')
df.columns=['DATE', 'EMPLOYEES']
df.DATE=pd.to_datetime(df.DATE)
df.EMPLOYEES=np.log(df.EMPLOYEES)
trend=sp.savgol_filter(df.EMPLOYEES, 707, 4)
unsp... |
# Operations on a Computational Graph
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from tensorflow.python.framework import ops
ops.reset_default_graph()
# Create graph
sess = tf.Session()
# Create tensors
# Create data to feed in
x_vals = np.array([1., 3., 5., 7., 9.])
x_data = tf.place... |
def distribute_guests(n, end_command):
guests = set()
for _ in range(n):
guest = input()
guests.add(guest)
while True:
guest_arrived = input()
if guest_arrived == end_command:
break
guests.remove(guest_arrived)
return guests
def print_guests(guests):... |
from fractions import gcd
def lcm(x, y):
return x // gcd(x, y) * y
N, M = map(int, input().split())
S = input()
T = input()
for i in range(N):
if M * i % N == 0 and S[i] != T[M * i // N]:
print(-1)
exit()
print(lcm(N, M)) |
while(True):
try:
a, b = map(int, input().split())
print(a^b)
except EOFError:
break |
from core_engine.utils.aws.rekognition_helper import (
create_project,
delete_project,
version_description,
get_all_projects,
)
from core_engine import logger
logging = logger(__name__)
class ProjectController:
def __init__(self):
pass
def create_project_controller(self, project_name... |
"""The tests for the Media group platform."""
from unittest.mock import patch
import async_timeout
import pytest
from homeassistant.components.group import DOMAIN
from homeassistant.components.media_player import (
ATTR_MEDIA_CONTENT_TYPE,
ATTR_MEDIA_SEEK_POSITION,
ATTR_MEDIA_SHUFFLE,
ATTR_MEDIA_VOLUM... |
import pytest
from gene_finder.utils import get_neighborhood_ranges
def _build_hit_dictionary(coords):
hits = {}
for coord in coords:
key = "hit_{}_{}".format(coord[0], coord[1])
hits[key] = {}
hits[key]["Query_start-pos"] = coord[0]
hits[key]["Query_end-pos"] = coord[1]
ret... |
# ------------------------------------------------------------------------------
#
# MIT License
#
# Copyright (c) 2021 nogira
#
# 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 restri... |
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT
import logging
from os import getenv
from flask import Flask
from lazy_object_proxy import Proxy
from prometheus_client import make_wsgi_app as prometheus_app
from werkzeug.middleware.dispatcher import DispatcherMiddleware
from packit.uti... |
# -*- coding: utf-8 -*-
import datetime
import pytest
from flask import url_for
from flask_login import current_user
from scout.server.extensions import store
TEST_SUBPANEL = dict(
title="Subp title",
subtitle="Subp subtitle",
created=datetime.datetime.now(),
updated=datetime.datetime.now(),
)
def ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 19 15:03:36 2021
@author: tech
"""
import argparse
import pickle
from collections import Counter
from itertools import tee
from typing import Any, Iterable, Iterator
import spacy
import zstandard as zstd
from spacy.matcher import Matcher
from tqdm ... |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino.tools.mo.ops.Cast import Cast
from openvino.tools.mo.ops.elementwise import Add, Equal
from openvino.tools.mo.ops.select import Select
from openvino.tools.mo.front.common.partial_infer.utils import int64... |
import matplotlib.colors as mplColors
import numpy as np
from bokeh.io import output_notebook
from bokeh.plotting import figure
from bokeh.resources import INLINE
from freud import box
from matplotlib import cm
output_notebook(resources=INLINE)
# define vertices for hexagons
verts = [
[0.537284965911771, 0.310201... |
"""
Django settings for djangogirls project.
Generated by 'django-admin startproject' using Django 2.1.4.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import o... |
import logging
import math
from json import dumps, loads
from typing import Dict, List, Optional
from markupsafe import escape
from sqlalchemy.sql.expression import and_, false, func, null, or_, true
from galaxy.model.item_attrs import get_foreign_key, UsesAnnotations, UsesItemRatings
from galaxy.util import restore_... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
import requests
import json
from shapely.geometry import Polygon, Point
base_url = "http://api.data.mos.ru/v1/datasets/1927/"
dump_filename = "/users/seriozha/Downloads/ru-msk.csv"
s = requests.Session()
outfile = open(dump_filename,'w')
count = int(s.... |
from lark import Lark, Transformer
import operator
import os
class Condition:
def __init__(self):
filename = os.path.join(
os.path.dirname(__file__),
'grammars/condition.g'
)
with open(filename) as grammar_file:
self.parser = Lark(
gram... |
_base_ = [
'../_base_/datasets/ade20k_repeat.py',
'../_base_/default_runtime.py',
'../_base_/schedules/schedule_160k_adamw.py'
]
norm_cfg = dict(type='SyncBN', requires_grad=True)
model = dict(
type='SDModule',
cfg_s=dict(
type='EncoderDecoder',
pretrained='pretrained/resnet50_v1c-... |
import uuid
from typing import Any, Dict
from loguru import logger
from analytics.signal import analytic_signal
from users.models import CustomUser
class UserInterface:
@staticmethod
def get_username(*, user_id: uuid.UUID) -> Dict[str, Any]:
return {"username": CustomUser.objects.get(user_uuid=user_... |
# Umutcan CEYHAN 260201003
import numpy
class Game():
def __init__(self,map_width,map_height,init_time, action_cost):
# The Game initializes map parameters.
self.mapwidth = map_width
self.mapheight = map_height
# The Game initializes its map with all empty squares.
self.ma... |
#!/usr/bin/env python
"""
desc goes here
"""
import json
import logging
import os
import time
import uuid
from urllib.parse import urljoin, quote
import requests
from requests import HTTPError
from ingest.api.requests_utils import optimistic_session
class IngestApi:
def __init__(self, url=None, ingest_api_root=... |
import numpy as np
import sklearn.metrics as sk
SUPPORTED_METRICS = ['accuracy', 'auc', 'rmse']
def error_check(flat_true_values, pred_values):
if len(flat_true_values) != len(pred_values):
raise ValueError("preds and true values need to have same shape")
def accuracy(flat_true_values, pred_values):
... |
# This problem was asked by Facebook.
# Given an N by N matrix, rotate it by 90 degrees clockwise.
# For example, given the following matrix:
# [[1, 2, 3, 4],
# [5, 6, 7, 8],
# [9, 10, 11, 12],
# [13, 14, 15, 16]]
# you should return:
# Follow-up: What if you couldn't use any extra space?
####
def rotate90(arr):
... |
from mmdet.core import (bbox2roi, bbox_mapping, merge_aug_bboxes,
merge_aug_masks, merge_aug_proposals, multiclass_nms)
class RPNTestMixin(object):
def simple_test_rpn(self, x, img_meta, rpn_test_cfg):
rpn_outs = self.rpn_head(x)
if len(rpn_outs) == 3: # bg_vector
... |
# Copyright 2013 dotCloud 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 t... |
"""
Test saving and loading of simulations as eggs.
"""
import cPickle
import glob
import logging
import os.path
import pkg_resources
import shutil
import subprocess
import sys
import unittest
import nose
from enthought.traits.api import Callable
from openmdao.main.api import Assembly, Component, Container, SAVE_PIC... |
'''
Copyright (c) 2011-2017, Agora Games, LLC All rights reserved.
https://github.com/agoragames/haigha/blob/master/LICENSE.txt
'''
from chai import Chai
from haigha.transports import event_transport
from haigha.transports.event_transport import *
class EventTransportTest(Chai):
def setUp(self):
super... |
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
# Test case ID : 12712454
# Test Case Title : Verify overlap nodes in script canvas
# fmt: off
class Tests:
... |
"""Dictionary of default configuration names
"""
from . import config_1q_X
from . import config_1q_X_N1Z
from . import config_1q_X_N2Z
from . import config_1q_X_N3Z
from . import config_1q_X_N4Z
from . import config_1q_XY
from . import config_1q_XY_N1X_N5Z
from . import config_1q_XY_N1X_N6Z
from . import config_1q_XY_... |
import logging
from followthemoney import model
from servicelayer.worker import Worker
from ingestors.manager import Manager
log = logging.getLogger(__name__)
class IngestWorker(Worker):
"""A long running task runner that uses Redis as a task queue"""
def dispatch_next(self, task, entities):
next_s... |
# -*- coding: utf-8 -*-
"""File containing a Windows Registry plugin to parse the USBStor key."""
from __future__ import unicode_literals
from plaso.containers import time_events
from plaso.containers import windows_events
from plaso.lib import definitions
from plaso.parsers import logger
from plaso.parsers import wi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.