text
string
size
int64
token_count
int64
from bisect import bisect_left, bisect_right from collections import deque, Counter from itertools import combinations, permutations from math import gcd, sin, cos, tan, degrees, radians import sys input = lambda: sys.stdin.readline().rstrip() MOD = 10 ** 9 + 7 INF = float("inf") n, d, a = map(int, input().split()) mo...
738
269
from tkinter import* from tkinter import font from experta import * raiz = Tk() raiz.title("Sistema experto- Tipos de covid") raiz.config(bg="#f4f7fa") #raiz.resizable(0,0) mi0Frame = Frame(raiz)#, width="1200", height="700") mi0Frame.grid(row=1, column=0) mi0Frame.config(bg="#f4f7fa") mi3Frame = Frame(raiz)#, width=...
16,532
7,413
import socket import time import shelve preset_command = { 1: ['MB0023,1', 'MI0695,'], 2: ['MB0024,1', 'MI0696,'], 3: ['MB0076,1', 'MI0697,'], 4: ['MB0026,1', 'MI0698,'], } force_command = 'MB0336,1' start_command = 'MB0020,0' stop_command = 'MB0020,1' class Temperature: def __init__(self): ...
6,105
2,293
from django.conf import settings from django.core.mail import send_mail from django.db import models from django.db.models import ForeignKey, OneToOneField, TextField, CharField, \ SET_NULL, CASCADE, BooleanField, UniqueConstraint from django.db.models.signals import post_save from django.dispatch import receiver f...
12,938
3,756
from datetime import date from datetime import datetime dateToday = date.today() print(dateToday)
100
31
# Copyright 2021 Marco Nicola # # 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, ...
1,753
520
#!/usr/bin/env python # -*- mode: python; coding: koi8-r; -*- import os import gtk, gobject imdir = 'images' imtype = 'png' background = '#efebe7' #fill_color = 0xff000000 # red fill_color = int('ff000000', 16) if not os.path.exists(imdir): os.mkdir(imdir) gc = None def draw_rect(): global ...
15,082
6,192
from __future__ import division import matplotlib.pyplot as plt import MDAnalysis as md import numpy as np def calculate_dists(gro_file, xtc_file): u = md.Universe(gro_file, xtc_file) select_group1 = u.selectAtoms("backbone and (resnum 50 or resnum 51)") select_group2 = u.selectAtoms("backbone and (resnum ...
4,687
1,881
import datetime as dt import json from flask_restful import ( Resource, reqparse, ) from flask_security import current_user from marshmallow_sqlalchemy import ModelSchema from .utils import auth_required from .. import db from ..core.utils import log_exception from ..models import ContentFlag class FlagSch...
1,692
492
# -*- coding: utf-8 -*- """ Copyright: Frank Nussbaum (frank.nussbaum@uni-jena.de) This file contains various functions used in the module including - sparse norms and shrinkage operators - a stable logsumexp implementation - array printing-method that allows pasting the output into Python code """ import...
13,231
4,663
# Generated by Django 2.2.4 on 2020-02-07 18:11 from django.db import migrations, models import django.db.models.deletion import jsonfield.fields class Migration(migrations.Migration): dependencies = [ ('authorization', '0001_initial'), ] operations = [ migrations.CreateModel( ...
1,091
334
import torch.nn as nn import torch.nn.functional as F from ssd.modeling.anchor import make_anchor_generator from ssd.utils import bbox from .inference import make_post_processor from .loss import make_loss_evaluator from .predictor import make_ssd_predictor class SSDHead(nn.Module): def __init__(self, cfg, in_ch...
2,081
706
"""Find max element""" #!/usr/bin/env python3 """Find max element""" import random from collections import Counter List = [random.randrange(1, 15) for num in range(10)] def most_frequent(List): occurence_count = Counter(List) return occurence_count.most_common() frequent_number, frequency = most_frequent(Lis...
415
141
# -*- coding: utf-8 -*- import xbmcgui class DialogProgress: def __init__(self): self.dlg = xbmcgui.DialogProgress() self.__reset__() def __reset__(self): self.head = '' self.firstline = '' self.secondline = None self.thirdline = None self.percent = 0 ...
1,659
493
# ex:ts=4:sw=4:sts=4:et # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- # # Copyright (C) 2003, 2004 Chris Larson # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. #...
3,828
1,234
''' Classes implementing various kinematic chains. This module is perhaps mis-located as it does not have a direct BMI role but rather contains code which is useful in supporting BMI control of kinematic chains. This code depends on the 'robot' module (https://github.com/sgowda/robotics_toolbox) ''' import numpy as np...
23,209
7,297
import pygame from pygame.math import Vector2 import json, math class Tilemap: def __init__(self, tileSize, imgs, chunkSize=8): self.tileSize = tileSize self.imgs = imgs self.drawTiles = [] self.chunks = {} self.chunkSize = chunkSize def toChunkScale(self, p): ...
3,622
1,231
""" Miscellaneous utility functions. """ import random import time from contextlib import contextmanager import math import numpy as np import torch from PIL.ImageDraw import Draw # Joints to connect for visualisation, giving the effect of drawing a # basic "skeleton" of the pose. BONES = { 'right_lower_leg': (0...
7,295
2,664
import os import time from datetime import datetime from multiprocessing import Process, Pool def run_proc(n): print('第{}次循环,子进程id:{},父进程id:{}'.format(n, os.getpid(), os.getppid())) time.sleep(1) if __name__ == '__main__': print('父进程id', os.getpid()) # 1. 顺序执行任务 # start = datetime.now() # ...
1,321
633
import pytest from ..change_case import change_case @pytest.mark.parametrize("x_str, expected", [ ("BLACKstar", "blackSTAR"), ("jOhn", "JoHN") ]) def test_change_case(x_str, expected): actual = change_case(x_str) assert actual == expected
268
104
class Carro: def __init__(self, velocidadeMaxima): self.velocidadeMaxima = velocidadeMaxima self.velocidade = 0 def acelerar(self, delta=5): if self.velocidade < self.velocidadeMaxima: self.velocidade += delta else: self.velocidade = 180 return se...
803
287
# coding: utf-8 """ Consolidate Services Description of all APIs # noqa: E501 The version of the OpenAPI document: version not set Generated by: https://openapi-generator.tech """ import pprint import re # noqa: F401 import six from argocd_client.configuration import Configuration class Appli...
9,578
2,770
""" This module contains the retry decorator, which can be used as ``Node`` decorators to retry nodes. See ``kedro.pipeline.node.decorate`` """ import logging from functools import wraps from time import sleep from typing import Callable, Type def retry( exceptions: Type[Exception] = Exception, n_times: int = 1,...
1,818
476
"""Test the ability to download files. Test target: - :py:meth:`lmp.dset._base.BaseDset.download`. """ import os from typing import Callable import pytest import lmp.dset._base import lmp.util.path @pytest.fixture def file_url() -> str: """Download target file URL.""" return 'https://raw.githubusercontent.com...
1,470
531
"""account models.""" from django.contrib.auth.hashers import ( check_password, make_password ) from django.db import models from extension.modelutils import RandomFixedCharField class Account(models.Model): uid = RandomFixedCharField('编号', max_length=32, unique=True) username = models.CharField('用户名',...
1,019
316
# -*- coding: utf-8 -*- import json import unittest from .. import MoviesTest class TestDeleteResource(MoviesTest): def setUp(self): self.setUpClass() super(TestDeleteResource, self).setUp() def test_delete_invalid_id(self): response = self.app.delete('/%s/movies/a1' % self.api, hea...
2,420
810
from django.urls import path, re_path from drf_yasg import openapi from drf_yasg.views import get_schema_view from rest_framework.routers import SimpleRouter, DefaultRouter from rest_framework_simplejwt import views as jwt_views from api.views import * # роутер нужен, чтобы сгенерить урлы под вью сет и самому их не ...
1,347
456
# -*- coding: utf-8 -*- import os import argparse import pathlib import pickle import shutil import time from functools import partial import sys sys.path.append('../') from pathlib import Path import fire import numpy as np import torch import torch.nn as nn import os print(torch.__version__) print(os.environ['PYTHONP...
18,417
6,916
#!/usr/bin/env python3 """ HIAS TassAI Facial Recognition Agent. HIAS TassAI Facial Recognition Agent processes streams from local or remote cameras to identify known and unknown humans. MIT License Copyright (c) 2021 Asociación de Investigacion en Inteligencia Artificial Para la Leucemia Peter Moss Permission is h...
3,112
1,063
# -*- coding: utf-8 -*- class LineConstants: method = 'method' output = 'output' enter = 'enter' parent = 'parent' command = 'command' service = 'service'
181
63
from CommandBase import * import json from MythicResponseRPC import * class TerminalsSendArguments(TaskArguments): def __init__(self, command_line): super().__init__(command_line) self.args = { "window": CommandParameter( name="window", type=ParameterTyp...
2,576
654
import tensorflow as tf from tensorflow.keras import backend #DEPRECATED # An implementation of wasserstein used for a naive implementation of WGAN # calculate wasserstein loss def wasserstein_loss(y_true, y_pred): return backend.mean(y_true * y_pred) # Define the loss functions for the discriminator, # which shoul...
711
226
import re import math import numexpr as ne MATH_CONST = { 'pi': math.pi, 'π': math.pi, 'e': math.e, 'inf': math.inf, 'i': 1j, 'j': 1j, } SUB_MAP = { # replace UTF char with ASCII char '(': '(', ')': ')', ',': ',', '-': '-', '÷': '/', '×': '*', '+': '+', #...
623
278
from collections import Mapping from . import yang_models class Meta(type): class Interface( yang_models .com_adva_netemu_testemu_client_TestInterface_YangListModel): """ Pythonizer for Java class ``TestInterface``. From Java package ``com.adva.netemu.testemu.cli...
1,185
327
import gym import torch from asym_rlpo.utils.debugging import checkraise from .base import Representation class IdentityRepresentation(Representation): def __init__(self, input_space: gym.spaces.Box): super().__init__() checkraise( isinstance(input_space, gym.spaces.Box) ...
666
205
import sys import traceback from ggplib.util import log from ggplib.statemachine import builder from ggplib.db import signature class GameInfo(object): def __init__(self, game, gdl_str): self.game = game self.gdl_str = gdl_str # might be None, depends on whether we grab it from sig.json ...
8,885
2,762
import fiber from django.test import SimpleTestCase from ...test_util import RenderMixin class TestFiberVersion(RenderMixin, SimpleTestCase): def test_fiber_version(self): self.assertRendered('{% load fiber_tags %}{% fiber_version %}', str(fiber.__version__))
274
86
#! /usr/bin/python3 import sys, re from PIL import Image # return the argument if it exists (converted to the same type as the default), otherwise default default = lambda arg, defa: type(defa)(sys.argv[arg]) if len(sys.argv) > arg and sys.argv[arg] else defa # filename of image to evaluate, default is image.jpg IMAG...
7,352
2,303
import pytest from coding_challenge.users.models import User from coding_challenge.users.tests.factories import UserFactory from coding_challenge.ship_manager.models import Ship from coding_challenge.ship_manager.tests.factories import ShipFactory @pytest.fixture(autouse=True) def media_storage(settings, tmpdir): ...
485
155
# -*- coding: utf-8 -*- # @Author: edward # @Date: 2016-05-12 14:11:21 # @Last Modified by: edward # @Last Modified time: 2016-05-12 17:29:48 from functools import partial # api = swagger.docs(Api(app), apiVersion='0.1', # basePath='http://localhost:5000', # resourcePath='/', ...
1,909
627
import os import unittest import sqlalchemy from flask import Flask,session,url_for,redirect from flask_sqlalchemy import SQLAlchemy from application import create_app ,db import unittest import json from caruser.models import User, UserBank from carupload.models import CarOption,Car,CarImage from flask_testing import ...
29,469
9,708
# train-net.py # Use the neural network module to detect simple signals import numpy as np import matplotlib.pyplot as plt import random from src.net import Net def main(): """ Step 1: make dataset """ random.seed() # Make 3 inputs - 1 base and 2 added inputs sig_len = 10 y_base = np.array([1, 2,...
1,947
777
# allowable multiple choice node and edge features # code from https://github.com/snap-stanford/ogb/blob/master/ogb/utils/features.py allowable_features = { "possible_atomic_num_list": list(range(1, 119)) + ["misc"], # type: ignore "possible_chirality_list": [ "CHI_UNSPECIFIED", "CHI_TETRAHEDRA...
2,165
794
"""coupling Hamiltonian class def""" from math import exp import numpy as np from .spinconfig import SpinConfig class Hamiltonian(): """Create a class of Hamiltonian of 2-d Ising model. Parameters ---------- J: float, optional Coupling parameter, default J=-2 . u: float, optional ...
3,401
1,106
import numpy as np def temperature(x): pass def density(x, L): # weak Jeans instability # density = 1. + 0.01 * np.cos(0.8 * (x - 0.5 * L)) # strong Jeans instability # density = 1. + 0.01 * np.cos(0.1 * (x - 0.5 * L)) # linear Landau damping # return 1. + 0.01 * np.cos(0.5 * (x - 0.5 * L))...
618
290
#!/usr/bin/python import os, sys, shutil import subprocess as sub import string import re import datetime, time import optparse target_root = "/sys/kernel/config/target/" spec_root = "/var/target/fabric/" def fabric_err(msg): print >> sys.stderr, msg sys.exit(1) def fabric_configfs_dump(fabric_name, fabric_root, m...
17,866
7,805
""" Helper classes for creating maps in any Source Engine game that uses hl2mp.fgd. This file was auto-generated by import_fgd.py on 2020-01-19 09:11:14.977620. """ from vmflib2.vmf import * class FilterActivatorTeam(Entity): """ Auto-generated from hl2mp.fgd, line 30. A filter that filters by the team o...
12,321
3,687
import os BASE_DIR = os.path.dirname(__file__) __config__ = os.path.abspath(os.path.join(BASE_DIR, "../config.cfg")) __template__ = os.path.abspath(os.path.join(BASE_DIR, "templates")) __static__ = os.path.abspath(os.path.join(BASE_DIR, "static")) __upload__ = os.path.abspath(os.path.join(__static__, "uploads"))
317
128
import nextcord from nextcord.ext import commands import json import os import pymongo import os from keep_alive import keep_alive # Set environment variables # os.environ['info'] = "test:pass123" # os.environ['TOKEN'] = "MY-AWSOME-TOKEN" intents = nextcord.Intents.all() TOKEN = os.environ['TOKEN'] async def prefi...
1,363
509
from models.model_contact import Contact import random import string import os.path import jsonpickle import getopt import sys def random_string(prefix, maxlen): symbols = string.ascii_letters + string.digits return prefix + ''.join([random.choice(symbols) for i in range(random.randrange(maxlen))]) try: ...
1,841
603
# License: BSD 3 clause import gc import unittest import weakref import numpy as np import scipy from scipy.sparse import csr_matrix from tick.array.build.array import tick_double_sparse2d_from_file from tick.array.build.array import tick_double_sparse2d_to_file from tick.array_test.build import array_test as test ...
13,598
4,274
# Author: DINDIN Meryll # Date: 15 September 2019 # Project: RoadBuddy try: from chatbot.imports import * except: from imports import * class Contextualizer: def __init__(self): try: self._load_models() except: drc = ['mo...
6,878
2,181
# encoding=utf-8 import re # import types # noinspection PyUnresolvedReferences import maya.mel as mel # noinspection PyUnresolvedReferences import maya.cmds as cmds # _objectStore = {} # def pyToMelProc(pyObj, args=(), returnType=None, procName=None, useName=False, procPrefix='pyToMel_'): melParams = [] pyPa...
20,731
6,266
from .bubbleio import BubbleIo
31
12
import pandas as pd def dump(df: pd.DataFrame) -> bytes: pass
68
24
import logging import json import uuid from collections import defaultdict import tornado.web import tornado.httpclient from tornado.platform.asyncio import to_asyncio_future import pymongo import motor from rest_tools.client import RestClient from iceprod.server.rest import RESTHandler, RESTHandlerSetup, authorizati...
13,152
3,924
# -*- coding: utf-8 -*- # author: itimor import requests import json try: from urllib.parse import urlencode except ImportError: from urllib import urlencode class FalconClient(object): def __init__(self, endpoint=None, user=None, token=None, keys=[], session=None, ssl_verify=True): self._endpoi...
2,938
886
import matplotlib.pyplot meses = ['Janeiro','Fevereiro','Marco','Abril','Maio','Junho'] valores = [105235, 107697, 110256, 109236, 108859, 109986] matplotlib.pyplot.plot(meses, valores) matplotlib.pyplot.title('Faturamento no primeiro semestre de 2017') matplotlib.pyplot.xlabel('Meses') matplotlib.pyplot.ylabel('Fatur...
411
189
#!/usr/bin/python3 # -*- coding: utf-8 -*- import mysql.connector mydb = mysql.connector.connect( host = "localhost", user = "root", passwd = "schleichkatze", database = "helmstedt" ) mycursor = mydb.cursor() mycursor.execute("SELECT id, gnd FROM helmstedt.temp_prof_kat") myresult = mycursor.fetchall() gnds ...
3,213
1,310
#!/usr/bin/python # -*- coding: utf-8 -*- ''' Unit tests for scrapername. ''' import difflib import filecmp from datetime import datetime from os.path import join from tempfile import gettempdir import pytest from hdx.hdx_configuration import Configuration import hdx.utilities.downloader from hdx.utilities.compare im...
9,035
2,851
# optimizer optimizer = dict(type='SGD', lr=0.001, momentum=0.9, weight_decay=0.001) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict(policy='step', step=[40, 70, 90]) runner = dict(type='EpochBasedRunner', max_epochs=100)
255
111
""" Advent of Code Day 6 - Signals and Noise""" with open('inputs/day_06.txt', 'r') as f: rows = [row.strip() for row in f.readlines()] flipped = zip(*rows) message = '' mod_message = '' for chars in flipped: most_freq = '' least_freq = '' highest = 0 lowest = 100 for char in chars: ...
708
237
import hashlib import json import os import pathlib import shlex import nbformat from invoke import task files_to_format = ["chmp/src", "tasks.py", "chmp/setup.py"] inventories = [ "http://daft-pgm.org", "https://matplotlib.org", "http://www.numpy.org", "https://pandas.pydata.org", "https://docs....
1,846
682
# -*- coding:utf-8 -*- import requests import json import random import hashlib KEY = '' APPID = '' API = 'http://api.fanyi.baidu.com/api/trans/vip/translate' class translation(): def __init__(self,src, fromlang, tolang): self.src = src self.fromlang = fromlang self.tolang = tolang de...
1,016
373
import bolinette.defaults.models import bolinette.defaults.mixins import bolinette.defaults.services import bolinette.defaults.middlewares import bolinette.defaults.controllers import bolinette.defaults.topics
210
66
#!/usr/bin/python3 # -*- coding: utf-8 -*- # Copyright (c) 2021 Salvador E. Tropea # Copyright (c) 2021 Instituto Nacional de Tecnología Industrial # License: Apache 2.0 # Project: KiCost # Adapted from: https://github.com/alexprengere/currencyconverter """ CurrencyConverter: This is reduced version of the 'Currency Co...
2,040
618
import streamlit as st import leafmap def app(): st.title("Add vector datasets") url = "https://raw.githubusercontent.com/giswqs/data/main/world/world_cities.csv" in_csv = st.text_input("Enter a URL to a vector file", url) m = leafmap.Map() if in_csv: m.add_xy_data(in_csv, x="longitude"...
385
144
# -*- coding = utf-8 -*- # @Time:2021/3/1417:56 # @Author:Linyu # @Software:PyCharm from web.pageutils import BooksScore from web.pageutils import BooksCount from web.pageutils import pointsDraw from web.pageutils import scoreRelise from web.pageutils import messBarInfo from web.pageutils import tagRader from web.mod...
1,225
493
# -*- coding: utf-8 -*- import scrapy from scrapy.linkextractors import LinkExtractor from scrapy.spiders import CrawlSpider, Rule from readability import Document import datetime from pprint import pprint class Articles(scrapy.Item): url = scrapy.Field() title = scrapy.Field() author = scrapy.Field() ...
2,252
654
from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django.dispatch import receiver from django_countries.fields import CountryField class Profile(models.Model): """Extend user model with a country field.""" user = models.OneToOneField(...
698
206
import os import sys import tempfile import unittest import subprocess from unittest.mock import Mock, patch import mock from prometheus_client import Histogram from flower.command import apply_options, warn_about_celery_args_used_in_flower_command, apply_env_options from tornado.options import options from tests.uni...
5,684
1,805
#!/usr/bin/env python import requests import subprocess import os import tempfile def download(url): get_response = requests.get(url) file_name = url.split("/")[-1] with open(file_name, "wb") as out_file: out_file.write(get_response.content) temp_directory = tempfile.gettempdir() os.chdir(temp_d...
534
187
import numpy as np import cv2 import math import random import os from tempfile import TemporaryFile from sklearn.model_selection import train_test_split # Creating classes. length=[7,15] width=[1,3] col=[] col.append([0,0,255]) #Blue col.append([255,0,0]) #Red interval=15 angles=[] x=0 while x<180: angles.append(x...
3,524
1,836
# coding: utf-8 """ Octopus Server API No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: 2019.6.7+Branch.tags-2019.6.7.Sha.aa18dc6809953218c66f57eff7d26481d9b23d6a Generated by: https://github.com/swagger-api...
17,703
5,248
""" Does the legwork of searching for matching tracks. Contains: (1) Search functions: - search_message - search_spotipy - search_db - search_lookup (2) String parsers (to clean title name): - clean_title - remove_punctuation (3) Creates new Spotify playlist. - create_playlist """ from typing import Any, Lis...
10,163
3,156
from urllib import urlencode from urllib2 import urlopen import simplejson from django.conf import settings from django.contrib.gis.geos import Point, LineString from django.utils.text import capfirst from django.utils.translation import ugettext as _ from molly.apps.places.models import bearing_to_compass from molly...
3,836
1,051
num_list = [10,50,30,12,6,8,100] def max_min_first_last(nlist): ____________________ # Maximum number ____________________ # Minimum number ____________________ # First number ____________________ # Last number return _____________________________________ print( max_min_first_last(num_list) )
316
99
# MIT License # Copyright (c) 2017 MassChallenge, Inc. import json from oauth2_provider.models import get_application_model from rest_framework.test import APIClient from test_plus.test import TestCase from django.core import mail from django.conf import settings from django.contrib.auth.models import Group from djan...
5,829
1,636
from django.db import models from pydis_site.apps.api.models.bot.user import User from pydis_site.apps.api.models.mixins import ModelReprMixin class AocAccountLink(ModelReprMixin, models.Model): """An AoC account link for a Discord User.""" user = models.OneToOneField( User, on_delete=models...
607
195
import pickle best_trees = [ {'accuracy': 0.36416184971098264, 'tree': ['Attribute', 'att1', ['Value', 'Pend Oreille', ['Leaf', 2.0, 0, 69] ], ['Value', 'Okanogan', ['Leaf', 3.0, 0, 314] ], ['Value...
10,892
5,703
import json #Parse csv to kdb.json with open("kdb.csv", "r", encoding="utf_8") as f: l=[] lines = f.readlines() # remove the header lines.pop(0) for line in lines: tmp1 = line.split('"') if tmp1[15] == "": tmp1[15] = " " if not "" in set([tmp1[1], tmp1[3], tmp...
624
276
import os import shutil import tarfile import urllib.request import pandas as pd CIFAR10_URL = 'https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz' class CIFAR_10: def __init__(self, path, download=True, train=True): self.path = path self.download = download self.train = train ...
2,600
952
def printer(n,k,order): lst = [(order[x],False if x==k else True) for x in range(len(order))] flag, i = True, 0 while flag: if lst[0][0] == max(lst,key=lambda x:x[0])[0]: flag = lst.pop(0)[1] i +=1 else: lst.append(lst.pop(0)) print(i) for _ in range(int(input())): n,k=map(int,input().split()) lst=l...
367
175
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: commands/v1/oracles.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from go...
4,119
1,588
import os parameter_tuning_options = { "experiment_name": "non-regression-tests", # Tuning method alternatives: # - "optimization": use bayesian optimisation # - "grid_search" "tuning_method": "grid_search", # Additionnal options for the grid search method "use_cache": False, # Addit...
2,788
1,122
import networkx as nx from misc import maximum_matching_all from networkx import get_node_attributes def is_tree_based(graph): if is_binary(graph): # print("Graph is not binary! Zhang's won't work!") return None unmatched_reticulation = zhang_graph(graph) if len(unmatched_reticulation) == ...
2,101
675
__all__ = ["BaseIdCardAuthenticationView", "IdCardSigner"] from .signer import IdCardSigner from .views import BaseIdCardAuthenticationView
141
40
from arcade import Sprite class PlaceableInterface: def place(self, *args): pass
101
36
"""RESTful API Document resource.""" from flask_restx import Resource, reqparse from flask_restx._http import HTTPStatus from werkzeug.datastructures import FileStorage from ..service.document_service import ( delete_document, edit_document, get_all_documents, get_document, save_document, ) from ....
3,765
1,161
#!/usr/bin/env python # encoding: utf-8 col_shortener = { 'Q1':'confirm', 'Q2':'faculty', 'Q3':'department', 'Q4':'funders', 'Q5':'position', 'Q6':'use_software', 'Q7':'importance_software', 'Q8':'develop_own_code', 'Q9':'development_expertise', 'Q10':'sufficient_training', ...
1,405
563
import pytest import numpy as np from anndata import AnnData from scipy.sparse import csr_matrix import scanpy as sc # test "data" for 3 cells * 4 genes X = [ [-1, 2, 0, 0], [1, 2, 4, 0], [0, 2, 2, 0], ] # with gene std 1,0,2,0 and center 0,2,2,0 X_scaled = [ [-1, 2, 0, 0], [1, 2, 2, 0], [0, ...
1,974
801
import cv2 import numpy as np import bilinear import patchreg from skimage.util import view_as_windows def bilinear_interpolation_of_patch_registration(master_srcdata, target_srcdata): print("Beginning bilinear_interpolation_of_patch_registration...") w_shape = (1000, 1000, 4) # window_size w_step = (5...
7,810
3,294
# Copyright (c) 2020 # [This program is licensed under the "MIT License"] # Please see the file LICENSE in the source # distribution of this software for license terms. import pygame as pg import ruamel.yaml from random import choice vec = pg.math.Vector2 class Weapon_VFX(pg.sprite.Sprite): """ Weapon_VFX a...
1,253
390
import fnmatch import os import shutil import subprocess import sys import time from collections import OrderedDict try: import configparser except ImportError: import ConfigParser as configparser class PManException(Exception): pass class NoConfigError(PManException): pass class CouldNotFindPytho...
9,860
3,123
import sys import plotly import plotly.plotly as py import plotly.graph_objs as go #Argument 1 must be your plotly username, argument 2 is your api key. Get those by registering for a plotly account. #Argument 3 is the name of the input file to input data from. Must be in the form: Date \n Download \n Upload \n plotl...
1,326
569
from crosshair.libimpl import builtinslib from crosshair.libimpl import collectionslib from crosshair.libimpl import datetimelib from crosshair.libimpl import mathlib from crosshair.libimpl import randomlib from crosshair.libimpl import relib def make_registrations(): builtinslib.make_registrations() collecti...
484
150
import re from django.urls import reverse from rest_framework import serializers from schedulesy.apps.ade_legacy.models import Customization class CustomizationSerializer(serializers.ModelSerializer): configuration = serializers.SerializerMethodField() class Meta: model = Customization fie...
690
181
""" Test Filter Operator """ import os import sys sys.path.insert(1, os.path.join(sys.path[0], '..')) from gva.flows.operators import FilterOperator try: from rich import traceback traceback.install() except ImportError: pass def test_filter_operator_default(): in_d = {'a':1} n =...
927
357
# -*- coding: utf-8 -*- """ Created on Tue May 25 10:24:05 2021 @author: danaukes https://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles """ import sympy sympy.in...
5,620
2,166
"""Adds voice category per channel Revision ID: 6e982c9318a6 Revises: ef54f035a75c Create Date: 2021-12-03 13:18:57.468342 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "6e982c9318a6" down_revision = "ef54f035a75c" branch_labels = None depends_on = None def ...
630
260