text
string
size
int64
token_count
int64
from PyQt6.QtWidgets import QApplication, QWidget, QFileDialog import PyQt6.QtCore as QtCore import PyQt6.QtGui as QtGui import sys, time, json, requests, traceback, configparser, os import MrWorldwideUI, ConfigurationUI, UpdateManagerUI version = "v1.0.0" class LangTypes: ENGLISH = "English" ARABIC = "Arabic" CHI...
17,357
6,229
# -*- coding: utf-8 -*- # Copyright 2020 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 ...
7,429
2,343
""" PyBBIO - bbio.py Copyright (c) 2012-2015 - Alexander Hiam <alex@graycat.io> Released under the MIT license https://github.com/graycatlabs/PyBBIO """ import sys, atexit from .platform import platform_init, platform_cleanup from .common import ADDITIONAL_CLEANUP, util_init def bbio_init(): """ Pre-run initia...
2,181
681
""" The Endeavors asset collection has a number of irregular assets. Be careful writing any custom code here. """ from app.assets import endeavors from app import models class Assets(models.AssetCollection): def __init__(self, *args, **kwargs): self.root_module = endeavors models.Asset...
365
103
import sys from PyQt5 import QtCore, QtWidgets from PyQt5.QtWidgets import QMainWindow, QLabel, QGridLayout, QWidget from PyQt5.QtCore import QSize class HelloWindow(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.setMinimumSize(QSize(280, 120)) self.setWindowTitle("Olรก, ...
804
271
#!/usr/bin/env python import os import sys import numpy from setuptools import setup, Extension #include markdown description in pip page this_directory = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f: long_description = f.read() # https://g...
1,523
530
# This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
2,619
711
import torch.nn as nn import torch.nn.functional as F from haptic.Pointnet_Pointnet2_pytorch.models.pointnet2_utils import PointNetSetAbstractionMsg,PointNetFeaturePropagation class get_shared_model(nn.Module): def __init__(self, use_batch_norm, num_classes, num_input_channel=7): super(get_shared_model, s...
10,064
4,329
from django.contrib import admin from .models import Notification admin.site.register(Notification)
100
23
import krpc import time import math from simple_pid import PID conn = krpc.connect(name="UI Test") vessel = conn.space_center.active_vessel kerbin_frame = vessel.orbit.body.reference_frame orb_frame = vessel.orbital_reference_frame srf_frame = vessel.surface_reference_frame surface_gravity = vessel.orbit.body.surface_...
2,234
804
from cx_core import integration as integration_module from cx_core.controller import Controller def test_get_integrations(fake_controller: Controller): integrations = integration_module.get_integrations(fake_controller, {}) inteagration_names = {i.name for i in integrations} assert inteagration_names == {...
433
132
############################################################################### # # Python script utilities as included from the cloudera-framework-assembly, # do not edit directly # ############################################################################### import os import re def qualify(path): return path...
478
128
import datetime import os from io import BytesIO import logging from functools import wraps from copy import deepcopy from collections import Counter import slugify import yaml import mistune import requests from flask import \ Blueprint, Flask, render_template, abort, send_file, make_response from flask_cors imp...
11,760
3,660
# coding: utf-8 import numpy as np import torch.nn as nn class distance_loss(nn.Module): def __init__(self): with open('../data/raw/Cellular_Baselocation_baidu') as f: gpss = f.readlines() self.X = [] self.Y = [] for gps in gpss: x, y = float(gps.split()[0]...
1,425
527
import pygame as pg from pygame.locals import * import sys import board.chess_board as board w = 60 * 8 h = 60 * 8 class Game: """ Class to setup and start a game """ def __init__(self): self.b = board.Board(w, h) def get_board(self): """ Returns board :return: B...
1,316
361
#importing libraries import torch import torch.utils.data as data import os import random from PIL import Image class CreateDataset(data.Dataset): def __init__(self , imagedir , subfolder='train' , direction = 'AtoB' , flip = False , transform = None ,resize_scale = None , crop_size = None): ...
2,515
840
# @Time : 2022/1/1 # @Author : Yuanhang Zhou # @email : sdzyh002@gmail.com import os from math import floor import torch from loguru import logger from typing import List, Dict from copy import copy, deepcopy import pickle import os import numpy import ipdb from crslab.config import PRETRAIN_PATH, SAVE_P...
20,126
6,303
# flake8: noqa """This is the main public API of Morepath. Additional public APIs can be imported from the :mod:`morepath.error` and :mod:`morepath.pdbsupport` modules. For custom directive implementations that interact with core directives for grouping or subclassing purposes, or that need to use one of the Morepath ...
1,198
338
EMAIL_AND_FAX_FORM_CONSTANTS = { }
37
22
#Prediction model using an instance of the Monte Carlo simulation and Brownian Motion equation #import of libraries import numpy as np import pandas as pd from pandas_datareader import data as wb import matplotlib.pyplot as plt from scipy.stats import norm #ticker selection def mainFunction(tradingSymbol): data ...
2,242
727
""" Modified version of train_bert.py that adds DeepSpeed """ import os import datetime import json import pathlib import re import string from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, TypeVar, Union import random import datasets import fire import logging impo...
31,716
9,218
# Given a singly linked list, determine if it is a palindrome. # Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def isPalindrome(self, head: ListNode) -> bool: fast = slow = head # find t...
825
225
""" Rocky is a CLI based provisioning and management tool for CloudCIX Cloud software. Rocky is designed to operate in an out of band (OOB) network, serarated from other CloudCIX networks. Rocky's purpose is to facilitate monitoring, testing, debug and recovery """ __version__ = '0.3.5'
290
87
from tkinter import * import time root=Tk() root.title('Calculator') root.config(bg='wheat') def display(x): global s s=s+x text.set(s) def solve(): global s try: s=str(eval(text.get())) except Exception as e: text.set(e) s='' else: text.set(s) def clear(): global s s='' text.set(...
1,671
866
import glob import os import keras import tensorflow as tf from keras.models import load_model from keras.callbacks import ModelCheckpoint import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import src.util.Files as Files from src.util.ImageLoader import load_images_generator, resize_image, load...
8,280
2,761
from .utils import _get_return_type def windowed(data, size, step=1, ret_type=None): ''' dp.windowed applies a window function to a collection of data items. Parameters ----------- :param data: an iterable collection of data :param size: the window size :param step: the window step :p...
1,353
488
#!/usr/bin/env python ''' 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")...
8,717
2,232
import os import csv import numpy as np from sklearn.utils import shuffle ## Read in frame data samples = [] with open('/../opt/carnd_p3/data/driving_log.csv') as csvfile: #open the log file reader = csv.reader(csvfile) #as a readable csv for line in reader: samples.append(line) #add each line of th...
5,040
1,533
#!/usr/bin/env python3 """ A script containing the basic principles of the extraction primitive inner workings""" from __future__ import division, print_function from ghostdr import polyfit import numpy as pn # Firstly, let's find all the needed files fitsdir='/Users/mireland/data/ghost/cal_frames/' #Define the f...
2,357
851
import unittest import datetime import kronos string_format_time = "%Y-%m-%d %H:%M:%S" date_time_str = "2020-07-19 18:14:21" class KronosTest(unittest.TestCase): def test_get_day_of_week(self): for i in range(len(kronos.week_days)): date = kronos.get_date_time_from_string(f"2020-08-{10 + i} 1...
1,506
660
##!/usr/bin/env python3 # Mass Flow Controller Arduino driver # Copyright (C) 2015 Simon Howroyd, Jason James # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 o...
1,368
435
from asyncio import Future from greenlet import getcurrent import psycopg2 from psycopg2 import * # noqa from psycopg2 import extensions, OperationalError __version__ = psycopg2.__version__ def psycopg2_wait_callback(conn): """A wait callback to allow greenlet to work with Psycopg. The caller must be from...
2,558
767
# Copyright 2011-2012 10gen, 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 writing,...
27,984
8,396
import argparse_helper as argparse import config_dir import sys from .editor import Editor def main(*args): if len(args) > 0: args = [args] parser = argparse.ArgumentParser() parser.add_argument("-f", dest="cfg_file", help="query save name") parser.add_argument("-x", default=False, action="st...
2,177
694
import ez_setup ez_setup.use_setuptools() from setuptools import setup, find_packages import import_utils setup( name = "import-utils", version = import_utils.__version__, description = 'A module that supports simple programmatic module imports', packages = find_packages(), author = 'Evgeny.Fadeev...
888
269
import numpy as np from visual_dynamics.policies import CameraTargetPolicy class RandomOffsetCameraTargetPolicy(CameraTargetPolicy): def __init__(self, env, target_env, camera_node_name, agent_node_name, target_node_name, height=12.0, radius=16.0, angle=(-np.pi/4, np.pi/4), tightness=0.1, hra_in...
1,704
475
with open("inputday3.txt") as f: data = [x for x in f.read().split()] gamma = "" epsilon = "" for b in range(0, len(data[0])): one = 0 zero = 0 for c in range(0, len(data)): if data[c][b] == '0': zero += 1 else: one += 1 if zero > one: ...
1,401
575
from __future__ import print_function from PIL import Image import os import os.path import numpy as np import sys from misc import AverageMeter from eval_accuracy import simple_accuracy if sys.version_info[0] == 2: import cPickle as pickle else: import pickle import torch.utils.data as data import torch from ...
12,449
3,744
import json import logging import os from typing import Optional from mir import scm from mir.tools import mir_storage def mir_check_repo_dvc_dirty(mir_root: str = ".") -> bool: names = [name for name in mir_storage.get_all_mir_paths() if os.path.isfile(os.path.join(mir_root, name))] if names: dvc_cm...
1,920
670
import argparse import math import os import pickle from typing import List import cv2 import numpy as np import torch from PIL import Image, ImageDraw, ImageFont import configs.paths_config from configs import paths_config from training.networks import SynthesisBlock def add_texts_to_image_vertical(texts, pivot_im...
3,624
1,265
import pandas as pd # UD 1.0 CONLL_COLUMNS = ['i', 'w', 'l', 'p', 'n', 'm', 'g', 'f', 'd', 'c'] # UD 2.0 CONLL_COLUMNS_V2 = ['i', 'w', 'l', 'x', 'p', 'm', 'g', 'f', 'e', 'o'] # possible morphological attributes MORPH_ATTS = ['type', 'animacy', #'gender', 'number' ...
6,845
2,316
#!/bin/python3 import argparse import datetime import functools import logging import os import psycopg2 from dateutil.relativedelta import relativedelta from atpy.data.cache.lmdb_cache import * from atpy.data.cache.postgres_cache import BarsInPeriodProvider from atpy.data.cache.postgres_cache import request_adjustm...
2,491
830
def download_pdf(URL): from selenium import webdriver from time import sleep URL = URL options = webdriver.ChromeOptions() options.add_experimental_option('prefs', { # Change default directory for downloads "download.default_directory": r"E:\coding\other\class-url-automation\src\pdf...
746
221
# (C) Datadog, Inc. 2018-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) import click from ..console import CONTEXT_SETTINGS from .check import check_run from .ls import ls from .prune import prune from .reload import reload_env from .shell import shell from .start import star...
609
205
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from .. import _utilities, _tables from ...
8,584
2,538
from locust import HttpUser, TaskSet, task, constant from locust import LoadTestShape class UserTasks(TaskSet): @task def get_root(self): self.client.get("/") class WebsiteUser(HttpUser): wait_time = constant(0.5) tasks = [UserTasks] class StagesShape(LoadTestShape): """ A simply l...
1,491
469
# coding:utf-8 from sqlalchemy import text from db.basic_db import db_session from db.models import SeedIds from decorators.decorator import db_commit_decorator def get_seed(): """ Get all user id to be crawled :return: user ids """ return db_session.query(SeedIds).filter(text('status=0')).all() d...
2,115
778
""" Area Weighted Interpolation """ import numpy as np import geopandas as gpd from ._vectorized_raster_interpolation import _fast_append_profile_in_gdf import warnings from scipy.sparse import dok_matrix, diags, coo_matrix import pandas as pd from tobler.util.util import _check_crs, _nan_check, _inf_check, _check_p...
16,745
5,154
## # This software was developed and / or modified by Raytheon Company, # pursuant to Contract DG133W-05-CQ-1067 with the US Government. # # U.S. EXPORT CONTROLLED TECHNICAL DATA # This software product contains export-restricted data whose # export/transfer/disclosure is restricted by U.S. law. Dissemination # to ...
49,568
19,612
import time old_input_value = False flag_falling_edge = None start = None flag_output_mask = False DELAY_CONST = 10 # delay time from falling edge ... . output = None def response_function(): global old_input_value, flag_falling_edge, start, flag_output_mask, output if flag_falling...
1,701
564
from ansiblemetrics.ansible_modules import DEPRECATED_MODULES_LIST from ansiblemetrics.ansible_metric import AnsibleMetric class NumDeprecatedModules(AnsibleMetric): """ This class measures the number of times tasks use deprecated modules.""" def count(self): """Return the deprecated modules occurren...
1,345
329
""" This module does validation for data input in incidents """ import re class Validate(): """ methods for validatin incidents input data """ def valid_email(self, email): self.vemail = re.match( r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)", email) if not self.vem...
789
251
#!/usr/bin/python from distutils.version import LooseVersion import argparse import logging import requests import re session = requests.Session() # authorization token TOKEN_URL = "https://auth.docker.io/token?service=registry.docker.io&scope=repository:%s:pull" # find all tags TAGS_URL = "https://index.docker.io...
2,710
850
from .terraform import TerraformManager import pytest from _pytest.tmpdir import TempPathFactory @pytest.fixture(scope='session') def tfenv(tmp_path_factory: TempPathFactory): env_vars = { } with TerraformManager(path_factory=tmp_path_factory, env_vars=env_vars) as deployment: yield deplo...
326
99
#!/usr/bin/env python # -*- coding: utf-8 -*- # # vim: encoding=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 yo...
2,933
1,067
# -*- coding: utf-8 -*- #Copyright (c) 2010,12 Walter Bender #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, ...
10,935
3,615
try: from django.forms.utils import pretty_name except ImportError: from django.forms.forms import pretty_name from django.template import Context from django.template.loader import render_to_string from .compat import context_flatten class Group(list): """ A simplistic representation of backends tha...
1,384
392
""" """ from eodc_openeo_bindings.map_utils import map_default def map_lt(process): """ """ param_dict = {'y': 'float'} return map_default(process, 'lt', 'apply', param_dict) def map_lte(process): """ """ param_dict = {'y': 'float'} return map_default(process, 'lte', 'apply',...
971
353
"""FLOW RELATED SYSTEM TEST CASES."""
38
18
#!/usr/bin/python # -*- coding: utf-8 -*- from flask import Flask, request, abort, render_template from datetime import timedelta import pymysql from search import start_search, decorate page_dir = "E:/WEBPAGES_RAW" app = Flask(__name__) app.config['DEBUG'] = True app.config['SEND_FILE_MAX_AGE_DEFAULT'] ...
1,444
550
#!/usr/bin/env pvpython # -*- Python -*- (syntax highlighting) # ---------------------------------------------------------------------- # # Brad T. Aagaard, U.S. Geological Survey # Charles A. Williams, GNS Science # Matthew G. Knepley, University at Buffalo # # This code was developed as part of the Computational Infr...
5,355
1,780
from spaceone.inventory.libs.manager import AWSManager # todo: __init__์—์„œ ํ•œ๋ฒˆ์— ๋ช…์„ธ ํ• ์ˆ˜ ์žˆ๊ฒŒ ๋ฐ”๊พธ๊ธฐ # ์ง€๊ธˆ์€ ๋กœ์ผ€์ดํ„ฐ์—์„œ ๊ธ€๋กœ๋ฒŒ์—์„œ ๊ฐ’์„ ๊ฐ€์ ธ์˜ค๋Š” ๋กœ์ง ๋•Œ๋ฌธ์— ๋ณ„๋„ ํŒŒ์ผ์ด ์—†์œผ๋ฉด ์—๋Ÿฌ ๋ฐœ์ƒ class RDSConnectorManager(AWSManager): connector_name = 'RDSConnector'
220
160
#!/usr/bin/env python import argparse import hashlib import os import tempfile from lib.config import s3_config from lib.util import download, rm_rf, s3put DIST_URL = 'https://atom.io/download/atom-shell/' def main(): args = parse_args() url = DIST_URL + args.version + '/' directory, files = download_files...
1,775
649
# import the necessary packages from sklearn.cluster import KMeans import skimage import matplotlib.pyplot as plt import argparse import cv2 def mean_image(image,clt): image2=image for x in range(len(image2)): classes=clt.predict(image2[x]) for y in range(len(classes)): image2[x,y]=clt.cluster_cen...
2,533
979
from sys import argv from base64 import b64encode with open("data", 'rb') as fIn: b = fIn.read() print(b64encode(b).decode())
134
52
#!/usr/bin/env python # -*- coding: utf-8 -*- """ .. codeauthor:: Cรฉdric Dumay <cedric.dumay@gmail.com> """ import logging import sys, os, json from cdumay_rest_client.client import RESTClient from cdumay_rest_client.exceptions import NotFound, HTTPException class NoSuchFile(NotFound): """NoSuchFile""" def o...
1,691
560
import numpy as np import pytest import apexpy import tempfile import os import h5py from ttools import create_dataset, config, io, utils map_periods = [np.timedelta64(10, 'm'), np.timedelta64(30, 'm'), np.timedelta64(1, 'h'), np.timedelta64(2, 'h')] @pytest.fixture def times(): yield np.datetime64('2010-01-01T...
4,484
1,961
import typer def name_callback(value: str): if value != "Camila": raise typer.BadParameter("Only Camila is allowed") return value def main(name: str = typer.Option(..., callback=name_callback)): typer.echo(f"Hello {name}") if __name__ == "__main__": typer.run(main)
296
103
import socket import threading from time import sleep from threading import Thread import json import sys def display_test(address, port,text_result, test): if (text_result == "QFT_SUCCESS" and test == True) or (text_result != "QFT_SUCCESS" and test == False): # Test is correct ...
3,276
1,072
#!/usr/bin/env python2 import math import os import random import sys import time import logging import argparse import numpy as np from six.moves import xrange import json import torch import torch.nn as nn import torch.optim as optim from torch import cuda from torch.autograd import Variable from torch.nn.utils im...
14,277
4,538
# Copyright (c) 2013-2014 Rackspace, 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 ...
5,388
1,492
from math import sqrt def stream_primes(num): primes = [] candidate = 2 for i in range(num): prime = next_prime(primes, candidate) primes.append(prime) candidate = prime + 1 yield prime def next_prime(primes, candidate): while True: for prime in primes: ...
567
162
import datetime from app.models import Log from flask_login import current_user from app.extensions import db # https://stackoverflow.com/questions/6558535/find-the-date-for-the-first-monday-after-a-given-date def next_weekday( d: datetime.datetime = datetime.datetime.utcnow(), weekday: int = 0, ) -> datetime...
777
265
power = {'BUSES': {'Area': 1.33155, 'Bus/Area': 1.33155, 'Bus/Gate Leakage': 0.00662954, 'Bus/Peak Dynamic': 0.0, 'Bus/Runtime Dynamic': 0.0, 'Bus/Subthreshold Leakage': 0.0691322, 'Bus/Subthreshold Leakage with power gating': 0.0259246, 'Gate...
68,625
25,686
from typing import List, Dict import json from gtmcore.http import ConcurrentRequestManager, ConcurrentRequest from gtmcore.environment.packagemanager import PackageManager, PackageResult, PackageMetadata from gtmcore.container import container_for_context from gtmcore.labbook import LabBook from gtmcore.logging impor...
9,582
2,362
"""Conversion of Matplotlib / Seaborn inputs to plotly.""" import os.path as op from pkg_resources import resource_filename import json def mpl_to_px_inputs(inputs, plt_types=None): """Convert typical matplotlib inputs to plotly to simplify API. Parameters ---------- inputs : dict Dictionary ...
1,147
351
"""Fizzbuzz for loop variant 3""" for x in range(1, 101): OUTPUT = "" if x % 3 == 0: OUTPUT += "Fizz" if x % 5 == 0: OUTPUT += "Buzz" print(OUTPUT or x)
186
83
from tensor.main_module import Tensor import numpy as np def getTensor(value): if type(value) is np.ndarray: return Tensor.numpy2Tensor(value) elif type(value) is Tensor: return value else: raise Exception
242
73
# 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 t...
3,337
932
# coding=utf-8 # Copyright (c) 2021 Ant Group import sys LABEL_SEP = '@' INDENT_STRING1 = 'โ”‚ย ย  ' INDENT_STRING2 = 'โ”œโ”€โ”€' EMPTY_TOKEN = '___EMPTY___' def print_tree(const_tree, indent=0, out=sys.stdout): for i in range(indent - 1): out.write(INDENT_STRING1) if indent > 0: out.write(INDENT_STR...
9,050
2,582
import pytest from iminuit import minimize import numpy as np from numpy.testing import assert_allclose, assert_equal opt = pytest.importorskip("scipy.optimize") def func(x, *args): c = args[0] if args else 1 return c + x[0] ** 2 + (x[1] - 1) ** 2 + (x[2] - 2) ** 2 def grad(x, *args): return 2 * (x - (...
4,098
1,804
# coded by: salism3 # 23 - 05 - 2020 23:18 (Malam Takbir) from bs4 import BeautifulSoup as parser from . import sorting import re def to_bs4(html): return parser(html, "html.parser") def refsrc(html): return True if re.search(r'http.+\Wrefsrc', html) else False def parsing_href(html, href, one = Fals...
2,468
1,008
# coding: utf-8 """ TGS API A production scale tool for BYOND server management # noqa: E501 OpenAPI spec version: 9.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from __future__ import absolute_import import unittest import swagger_client from swagger_client.model...
878
283
from setuptools import find_packages, setup setup( name='src', packages=find_packages(), version='0.1.0', description='Python codebase for the housing classification ML problem', author='Joesan', license='', )
235
69
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmedit.models.backbones.sr_backbones.edvr_net import (EDVRNet, PCDAlignment, TSAFusion) def test_pcd_alignment(): "...
4,187
1,550
# type: ignore __all__ = [ "readDatastoreImage", "datastore", ] def readDatastoreImage(*args): raise NotImplementedError("readDatastoreImage") def datastore(*args): raise NotImplementedError("datastore")
225
81
import os from shutil import rmtree from tempfile import mkdtemp from unittest import TestCase from enjoliver import generator class GenerateGroupTestCase(TestCase): api_uri = None test_matchbox_path = None test_resources_path = None tests_path = None @classmethod def setUpClass(cls): ...
12,229
4,248
# Enter your code here. Read input from STDIN. Print output to STDOUT import calendar mm,dd,yyyy = map(int,input().split()) day = ["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"] val = int (calendar.weekday(yyyy,mm,dd)) print(day[val])
265
105
"""Defines the models for trigger rules and events""" from __future__ import unicode_literals import django.contrib.postgres.fields from django.db import models, transaction from django.utils.timezone import now class TriggerEventManager(models.Manager): """Provides additional methods for handling trigger events...
7,560
1,952
""" Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Silver Medal" and "Bronze Medal". Example 1: Input: [5, 4, 3, 2, 1] Output: ["Gold Medal", "Silver Medal", "Bronze Medal", "4", "5"] Explanation: The fir...
1,125
358
from ..base import BaseHistoryItem, GenericHistoryItem from ..utils import PolymorphicBase class ArchivedHistoryItem(BaseHistoryItem): field = "archived" field_name = "Valuation assessment: Archived" def get_value(self, value): if value is True: return "Archived" elif value is...
987
297
import sys import numpy as np from sern import * ids, lon, lat = np.loadtxt('nodes', unpack = True) links = np.loadtxt('links', dtype = 'int') A, b = AdjacencyMatrix(ids, links) lon, lat = lon[b], lat[b] n = A.shape[0] # LinkProbability expects A as triu A = A[np.triu_indices(n, 1)] # play around with the scale, may...
727
278
# Copyright 2018 Flight Lab 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in w...
3,899
1,232
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from .acquisition import AcquisitionFunction from .analytic import ( AnalyticAcquisitionFunction, ConstrainedExpectedImprovement, ExpectedImprovement, NoisyExpectedImprovement, PosteriorMean, Probabil...
1,504
479
"""Randomize the minitaur_gym_alternating_leg_env when reset() is called. The randomization include swing_offset, extension_offset of all legs that mimics bent legs, desired_pitch from user input, battery voltage and motor damping. """ import os, inspect currentdir = os.path.dirname(os.path.abspath(inspect.getfile(in...
2,810
958
""" The TensorProductState class and supporting functionality. """ #*************************************************************************************************** # Copyright 2015, 2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS). # Under the terms of Contract DE-NA0003525 with NTESS, the U....
14,704
4,223
import graphene import graphene_django from django.http import HttpResponseForbidden from graphene_django.views import GraphQLView from graphql import GraphQLError from edivorce.apps.core.models import Document class PrivateGraphQLView(GraphQLView): def dispatch(self, request, *args, **kwargs): if not re...
3,216
954
from .exceptions import MazeNotSolved, AlgorithmNotFound from .dijkstra import Dijkstra from .astar import Astar from functools import wraps import warnings from daedalus import Maze as _maze from PIL import Image warnings.simplefilter("once", UserWarning) class Maze: """ Create a maze and solve it. A...
5,862
1,705
import os def get_note_dic(): _note_dic = {'C': 0, 'C#': 1, 'Db': 1, 'D': 2, 'D#': 3, 'Eb': 3, 'E': 4, 'F': 5, 'F#': 6, 'Gb': 6, 'G': 7, 'G#': 8, 'Ab': 8, 'A': 9, 'A#': 10, 'Bb': 10, 'B': 11} return _note_dic def get_value_list(): values = {"16": 16, "8": 8, "4": 4, "2"...
4,215
1,976
#!/usr/bin/python """Interface to OpenShift oc command""" import os import shlex import shutil import subprocess from ansible.module_utils.basic import AnsibleModule ADDITIONAL_PATH_LOOKUPS = ['/usr/local/bin', os.path.expanduser('~/bin')] def locate_oc_binary(): """Find and return oc binary file""" # htt...
2,182
695