text
string
size
int64
token_count
int64
# -*- coding: utf-8 -*- # This program is designed to create XML sidecar files for harvesting metadata into Mediaflux. # # Author: Jay van Schyndel # Date: 02 May 2017. # # Significant modifications done by: Daniel Baird # Date: 2018 and early 2019 # # Scenario. Metadata is stored in an MS Excel file in various colu...
18,839
5,474
from django.shortcuts import render from django.shortcuts import HttpResponse from .forms import FoodFitnessForm from django.contrib.auth.models import User # function to test with def index(request): return HttpResponse("You made it.") # function to create new user def createUser(request): form = FoodFitness...
1,147
329
# Conta somente números pares for c in range(2, 51, 2): print(c, end=' ') print("Acabou!")
98
46
from __future__ import print_function # A script to help you with manipulating CSV-files. This is especially necessary when dealing with # CSVs that have more than 65536 lines because those can not (yet) be opened in Excel or Numbers. # This script works with two files from ourworldindata.org: # https://ourworldindat...
4,763
1,388
go_to_tender_page = "Live Tenders" search_bar = "#sr_buyer_chzn > a > span" all_dept_names = "#sr_buyer_chzn > div > ul > li:nth-of-type(n+1)" search_button = '#frm_sr > div.actionBtn > input[type="button"]:nth-child(1)' type_name = '#sr_buyer_chzn > div > div > input[type="text"]' scroll_down = "window.scrollTo(0, doc...
1,713
667
""" Module serializes `Profile` model :generates JSON from fields in `Profile` model """ import logging from rest_framework import serializers from authors.apps.authentication.serializers import UserSerializer from authors.apps.profiles.models import Profile, Following logger = logging.getLogger(__name__) c...
2,590
675
from django import forms import cass class LoginForm(forms.Form): username = forms.CharField(max_length=30) password = forms.CharField(widget=forms.PasswordInput(render_value=False)) def clean(self): username = self.cleaned_data['username'] password = self.cleaned_data['password'] ...
1,849
506
import os # os.environ["OMP_NUM_THREADS"] = "16" import logging logging.basicConfig(filename=snakemake.log[0], level=logging.INFO) import pandas as pd import numpy as np # seak imports from seak.data_loaders import intersect_ids, EnsemblVEPLoader, VariantLoaderSnpReader, CovariatesLoaderCSV from seak.scoretest impo...
16,047
5,667
#!/bin/env python # 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 # d...
4,741
1,861
from abc import ABC, abstractmethod class Pizza(ABC): @abstractmethod def prepare(self): pass def bake(self): print("baking pizza for 12min in 400 degrees..") def cut(self): print("cutting pizza in pieces") def box(self): print("putting pizza in box") class NY...
2,240
710
from flask import Flask from flask_sqlalchemy import SQLAlchemy db_url = 'postgresql://postgres:postgres@localhost:5432/postgres' db = SQLAlchemy() def create_app(): app = Flask(__name__) app.config["SQLALCHEMY_DATABASE_URI"] = db_url app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False # initialize ...
366
135
#!/usr/bin/python # -*- coding: utf8 -*- # 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 i...
2,677
886
"""Describe how you could use a single array to implement three stacks.""" class StackManager: def __init__(self): self.stacks = [] self.top = { 1: None, 2: None, 3: None, } self.length = { 1: 0, 2: 0, 3: 0, ...
1,925
609
__author__ = 'chenshuai' cast = ["Cleese", "Plain", "Jones", "Idle"] print cast print len(cast) print cast[1] cast.append("Gilliam") print cast cast.pop() print cast cast.extend(["Gilliam", "Chapman"]) print cast cast.remove("Chapman") print cast cast.insert(0, "Chapman") print cast movies = ["The Holy Grail", "The L...
5,434
1,898
from SQLPythonGenerator import SQLPythonGenerator class SQLitePythonGenerator(SQLPythonGenerator): pass
110
25
from toee import * def OnBeginSpellCast(spell): print "Dirge OnBeginSpellCast" print "spell.target_list=", spell.target_list print "spell.caster=", spell.caster, " caster.level= ", spell.caster_level def OnSpellEffect(spell): print "Dirge OnSpellEffect" targetsToRemove = [] spell.duration...
994
365
from OMIEData.Downloaders.general_omie_downloader import GeneralOMIEDownloader class MarginalPriceDownloader(GeneralOMIEDownloader): url_year = 'AGNO_YYYY' url_month = '/MES_MM/TXT/' url_name = 'INT_PBC_EV_H_1_DD_MM_YYYY_DD_MM_YYYY.TXT' output_mask = 'PMD_YYYYMMDD.txt' def __init__(self): ...
468
188
from struct import unpack from os.path import getsize # 第一步 读取 out 文件的 二进制 内容 def un_sub_400CC0() -> tuple: """ :return: 返回一个元祖,内容是从 out 文件中读取的内容 """ # 读取 out 文件 outFilePath = "./out" outLength = getsize(outFilePath) with open(outFilePath, 'rb') as outFile: # B = unsigned char ...
5,556
2,768
from textblob import TextBlob from textblob import Word import nltk nltk.download('punkt') nltk.download('wordnet') #getting correct sentences words = ['Machin','Learnin','corect'] corrected_words = [] for i in words: corrected_words.append(TextBlob(i)) print('worng words :', words) print('Corrected words :') for...
1,345
420
import os from os import path old_sample_rate = float(input("What was the original sample rate? ")) new_sample_rate = float(input("What is the new sample rate? ")) for file in os.listdir(os.getcwd()): name = file.rsplit(".",1)[0] if file.rsplit(".",1)[-1] == "opus" and path.exists(name + ".opus.txt"): ...
942
310
from django import template from django.conf import settings from django.template.loader import render_to_string from djblets.util.decorators import basictag from reviewboard.extensions.hooks import DiffViewerActionHook, \ NavigationBarHook, \ ...
2,221
592
from abc import ABC, abstractmethod from typing import Dict, Any import tensorflow as tf import numpy as np from opengnn.utils.data import diverse_batch, batch_and_bucket_by_size from opengnn.utils.data import filter_examples_by_size, truncate_examples_by_size def optimize(loss: tf.Tensor, params: Dict[st...
8,671
2,411
from pathlib import Path from .ast import NodeVisitor class Output(NodeVisitor): def __init__(self, context: dict, path: Path, templates: dict): self.context = context self.path = path self.templates = {} for filename, template in templates.items(): self.templates[pat...
894
225
import imp import os from functools import wraps from ansible.errors import AnsibleAuthenticationFailure from ansible.plugins import connection # HACK: workaround to import the SSH connection plugin _ssh_mod = os.path.join(os.path.dirname(connection.__file__), "ssh.py") _ssh = imp.load_source("_ssh", _ssh_mod) # Us...
2,449
664
import os import json def rel_fn(fn): dir_name = os.path.dirname(os.path.realpath(__file__)) return os.path.join(dir_name, fn) def mock_json(fn): with open(rel_fn(fn)) as f: return json.load(f)
218
87
""" This file aims to simulate the Belousov–Zhabotinsky reaction, is a chemical mixture which, when heated, undergoes a series of reactions that cause the chemical concentrations in the mixture to oscillate between two extremes (x, y). """ import numpy as np import matplotlib.pyplot as plt ## Constants a = 1 b = 3 ...
3,423
1,243
import pysolr from django.conf import settings from django.core.management import call_command from django.test import TestCase from haystack import indexes from haystack.sites import SearchSite from core.models import MockModel class SolrMockSearchIndex(indexes.SearchIndex): text = indexes.CharField(document=Tru...
2,747
899
""" Copyright 2020 Jackpine Technologies 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 ...
15,633
4,831
from __future__ import print_function import json import boto3 print('Loading function') s3 = boto3.client('s3') bucket_of_interest = "secretcatpics" # For a PutObjectAcl API Event, gets the bucket and key name from the event # If the object is not private, then it makes the object private by making a # PutObjectA...
1,703
566
import unittest from apiclient.errors import HttpError from google.appengine.ext import testbed, ndb from mock import patch, Mock from src.commons.big_query.copy_job_async.copy_job.copy_job_request \ import CopyJobRequest from src.commons.big_query.copy_job_async.copy_job.copy_job_service \ import CopyJobServ...
17,156
4,890
import cv2 import numpy as np import matplotlib.pyplot as plt image = np.flip(cv2.imread('../img/dog_muffin.jpg'), axis=2) mask = np.zeros(image.shape[:2], dtype="uint8") cv2.rectangle(mask, (90, 120), (160, 190), 255, -1) masked = cv2.bitwise_and(image, image, mask=mask) plt.figure(figsize=(20, 10)) plt.imshow(np.fl...
399
182
from __future__ import annotations from typing import Any, Dict, List from abc import ABC, abstractmethod from datetime import datetime from collections import namedtuple from lazy_property import LazyProperty from .sqlalchemy_tables import ObjectDefinition import wysdom from jetavator.services import ComputeServ...
2,676
747
from .abstract import Kernel from .auto import AutoKernel from .numpy import *
79
22
from django import forms from .models import Announcement # from .models import Role from .models import Assignment from .models import CourseMaterial from .models import Grade from .models import StudentUploadFile from .models import Syllabus from .models import Assistant from django.forms import ClearableFileInput #...
1,500
429
# # plots.py -- classes for plots added to Ginga canvases. # # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # import sys import numpy as np from ginga.canvas.CanvasObject import (CanvasObjectBase, _color, register_canva...
29,172
9,367
import csv import os import sys from collections import defaultdict PERSONS_OUTPUT_FILENAME_TEMPLATE = "persons_data_%s.csv" DISQUALIFICATIONS_FILENAME_TEMPLATE = "disqualifications_data_%s.csv" EXEMPTIONS_FILENAME_TEMPLATE = 'exemptions_data_%s.csv' SNAPSHOT_HEADER_IDENTIFIER = "DISQUALS" TRAILER_RECORD_IDENTIFIER = ...
8,305
2,821
from os import makedirs, errno from os.path import exists, join import numpy as np from matplotlib import pyplot as plt import itertools from sklearn import preprocessing def makeDir(path): ''' To create output path if doesn't exist see: https://stackoverflow.com/questions/273192/how-can-i-create...
2,875
983
import os import torch import torch.utils.data from PIL import Image import sys import numpy as np if sys.version_info[0] == 2: import xml.etree.cElementTree as ET else: import xml.etree.ElementTree as ET from maskrcnn_benchmark.structures.bounding_box import BoxList from maskrcnn_benchmark.structures.bound...
9,802
3,252
############################################################################## # # Copyright (c) 2003-2020 by The University of Queensland # http://www.uq.edu.au # # Primary Business: Queensland, Australia # Licensed under the Apache License, version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # # Development unti...
25,744
9,034
""" :copyright: (c)Copyright 2013, Intel Corporation All Rights Reserved. The source code contained or described here in and all documents related to the source code ("Material") are owned by Intel Corporation or its suppliers or licensors. Title to the Material remains with Intel Corporation or its suppliers and lic...
9,680
2,666
''' Austin Richards 4/14/21 excel_to_csv.py automates the conversion of many xlsx files into csv files. This program names the csv file in the format <filename>_<sheetname>.csv ''' import logging import os, csv, openpyxl from pathlib import Path from openpyxl.utils import get_column_letter logging.basicConfig(level=...
2,256
697
# Checks for an XXX error ### @replace "XXX", ('absolute/relative' if has_rel else 'absolute') # with an error of at most 1e-XXX ### @replace "XXX", prec # Don't edit this file. Edit real_abs_rel_template.py instead, and then run _real_check_gen.py # Oh, actually, you're editing the correct file. Go on. ...
2,041
637
import time import os import subprocess import threading class ProcessHandler: def __init__(self, *args, on_output=None): self.process = subprocess.Popen(args, stdin=subprocess.PIPE, stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True) self.on_output = on_output self.sta...
1,099
340
import os from setuptools import setup readme = open('README.md').read() requirements = ['click', 'feedparser', 'beautifulsoup4'] setup( name = "whatsnew", version = "0.13", author = "Patrick Tyler Haas", author_email = "patrick.tyler.haas@gmail.com", description = ("A lightweight, convenient too...
977
311
import argparse import logging import sys from timeswitch.switch.manager import SwitchManager from timeswitch.app import setup_app from timeswitch.api import setup_api from timeswitch.model import setup_model # ###################################### # # parsing commandline args # #####################################...
2,880
829
import sys, os, time from pathlib import Path import pickle import datetime as dt import glob import h5py import numpy as np from matplotlib import pyplot as plt from multiprocessing import Pool from functools import partial import torch from torchvision import datasets, transforms def subsample(x, n=0, m=200): ...
12,055
3,642
from django.views.generic import DeleteView, DetailView, UpdateView, CreateView from django.forms.models import BaseInlineFormSet from django.forms.models import inlineformset_factory from braces.views import LoginRequiredMixin, UserFormKwargsMixin, SelectRelatedMixin from ..models import Letter, Attachment from ..form...
2,369
693
import numpy as np from pychunkedgraph.backend import chunkedgraph, chunkedgraph_utils import cloudvolume def initialize_chunkedgraph(cg_table_id, ws_cv_path, chunk_size, cg_mesh_dir, fan_out=2, instance_id=None, project_id=None): """ Initalizes a chunkedgraph on BigTable :param ...
1,760
622
#!/usr/bin/env python3 from guizero import App, Text, Slider, Combo, PushButton, Box, Picture pause = True def readsensors(): return {"hlt" : 160, "rims" : 152, "bk" : 75} def handlepause(): global pause global pauseState print("Pause Button pressed") if pause: print("running") pa...
2,691
1,077
from click.testing import CliRunner from resolos.interface import ( res_remote_add, res_remote_remove, res_init, res_sync, res ) from resolos.remote import read_remote_db, list_remote_ids, delete_remote from tests.common import verify_result import logging from pathlib import Path import os log...
2,498
761
# -*- coding: utf-8 -*- from builtins import * from model.group import Group import pytest import allure #@pytest.mark.parametrize("group", testdata, ids=[repr(x) for x in testdata]) @allure.step('test_add_group') def test_add_group(app, db, json_groups, check_ui): group=json_groups #with pytest.allu...
946
332
import urllib3 import lxml.etree as etree import lxml.objectify as objectify # Declare IP Address ip_address = "192.168.0.123" # Generate XML and XSD Validation genius_schema = etree.XMLSchema(file='Genius.xsd') xml_parser = objectify.makeparser(schema=genius_schema) # Send Status Request genius_comm = urllib3.PoolMan...
753
255
#!/usr/bin/env python __description__ =\ """ editNames.py Goes through a file looking for a set of strings, replacing each one with a specific counterpart. The strings are defined in a delimited text file with columns naemd "key" and "value". """ __author__ = "Michael J. Harms" __date__ = "091205" __usage__ = "editT...
6,270
1,939
#!/usr/bin/env python3 # _*_ coding: utf-8 _*_ """Test docx2python.docx_context.py author: Shay Hill created: 6/26/2019 """ import os import shutil import zipfile from collections import defaultdict from typing import Any, Dict import pytest from docx2python.docx_context import ( collect_docProps, collect_nu...
3,988
1,279
import transporters.approximator.runner as ra from data.parameters_names import ParametersNames as Parameters def transport(approximator, particles): """matrix in format returned by data.particles_generator functions""" segments = dict() segments["start"] = particles matrix_for_transporter = partic...
1,022
297
from .embeddings import BertEmbeddings from .encoder import BertEncoder from .pooler import Pooler from .pertrained_hooks import pretrained_bert_hook, pretrained_bert_classifier_hook
183
58
# -*- coding: utf-8 -*- # Generated by Django 1.11.10 on 2018-06-26 20:22 from __future__ import unicode_literals import django.contrib.postgres.fields.jsonb from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('confsponsor', '0007_contract_per_conference'), ] ...
666
224
import example_problem.analyst.dialogue_functions as analyst import example_problem.engineer.dialogue_functions as engineer import example_problem.critic.dialogue_functions as critic
186
50
#!/usr/bin/env python3 # Copyright 2021 Alibaba Group Holding Limited. # # 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...
9,077
3,010
import graph.bfs as bfs import graph.dfs as dfs
47
17
# -*- coding: utf-8 -*- """HydraTK core event handling implementation class .. module:: core.eventhandler :platform: Unix :synopsis: HydraTK core event handling implementation class .. moduleauthor:: Petr Czaderna <pc@hydratk.org> """ from hydratk.core import hsignal class EventHandler(object): """Class ...
1,542
571
" Charon: Context handler for saving an entity. " import logging import couchdb from . import constants from . import utils class Field(object): "Specification of a data field for an entity." type ='text' def __init__(self, key, title=None, description=None, mandatory=False, editable...
13,660
3,637
from django.contrib.auth import get_user_model from django.urls import reverse from django.test import TestCase from rest_framework import status from rest_framework.test import APIClient from core.models import PortfolioItem from projects.serializers import PortfolioItemSerializer PORTFOLIO_URL = reverse('project...
5,264
1,543
# -*- coding: utf-8 -*- """ Created on: Sun May 21 05:09:40 2017 Author: Waldu Woensdregt Description: Code uses OpenWPM package to extract HTTPS responses from selected set of URLs (defined in GetListOfSiteURLsToExtract) and then splits the resulting data into individual ...
3,662
1,264
import pandas as pd import datetime import geopandas as gpd import os from tqdm import tqdm from shapely import wkt from config import config import trackintel as ti def generate_Location(df, epsilon, user): """Cluster staypoints to locations, with different parameters and distinguish 'user' and 'dataset'""" ...
2,545
967
from EVBUS import EVBUS from sklearn.datasets import load_boston import sklearn.model_selection as xval boston = load_boston() Y = boston.data[:, 12] X = boston.data[:, 0:12] bos_X_train, bos_X_test, bos_y_train, bos_y_test = xval.train_test_split(X, Y, test_size=0.3) evbus = EVBUS.varU(bos_X_train, bos_y_train, bos_...
369
165
from __future__ import absolute_import from __future__ import unicode_literals from django.contrib.auth import get_user_model from django.core.urlresolvers import reverse from django.test import TestCase from django.utils.translation import ugettext as _ from bazaar.listings.models import Listing from rest_framework...
7,226
2,102
import json import requests from bs4 import BeautifulSoup PAGE_URL = 'https://olympics.com/tokyo-2020/olympic-games/en/results/all-sports/medal-standings.htm' def get_table(html=None): if not html: html = requests.get(PAGE_URL).content site = BeautifulSoup(html, 'html.parser') table = site.find('table', ...
2,141
707
import queue import json import logging import threading from crawlers.core.flags import FLAGS class BaseThread(threading.Thread): def __init__(self, name: str, worker, pool): threading.Thread.__init__(self, name=name) self._worker = worker # can be a Fetcher/Parser/Saver instance self...
5,348
1,563
from .sophie import SophieAI
30
12
#!/usr/bin/env python2.7 # # Take various CSV inputs and produce a read-to-import conference schedule. import pandas as pd from datetime import date def main(): dfs = [] t = pd.read_csv('talks.csv') t['kind_slug'] = 'talk' t['proposal_id'] = t.pop('proposal') t['day'] = date(2016, 5, 30) + pd.t...
1,848
757
NUM_ROWS = 128 NUM_COLS = 8 """ Cool solution: https://github.com/tymofij/advent-of-code-2020/blob/master/05/seats.py Cool solution using str.translate: def seat_id(s, t=str.maketrans("FBLR", "0101")): return int(s.translate(t), 2) def max_seat_id(boarding_passes): return max(map(seat_id,...
2,468
978
import os import cv2 import numpy as np import re path_regex = re.compile('^.+?/(.*)') def resize_image(im, factor): row, col, chan = im.shape col_re = np.rint(col*factor).astype(int) row_re = np.rint(row*factor).astype(int) im = cv2.resize(im, (col_re, row_re)) #resize patch return im imdir = ...
997
394
from distutils.core import setup, Extension from numpy.distutils.misc_util import get_numpy_include_dirs setup(ext_modules=[Extension("arc_c_extensions", ["arc_c_extensions.c"], extra_compile_args = ['-Wall', '-O3'], include_dirs=get_numpy_include_dirs())])
294
92
import sys import os import ttk import Tkinter as tk import tkMessageBox from ttkHyperlinkLabel import HyperlinkLabel from config import applongname, appversion import myNotebook as nb import json import requests import zlib import re import webbrowser this = sys.modules[__name__] this.apiURL = "http://factiongist.her...
5,133
1,640
import os from logging import getLogger from django.core.exceptions import ValidationError from django.db import models, transaction from django.template.defaultfilters import filesizeformat, pluralize from django.urls import reverse from django.utils import timezone from django.utils.translation import gettext_lazy a...
12,542
3,588
# Operadores de identidade # serve para compara objetos não somente se eles sao iguais , mas sim se estao no mesmo local de memoria(na mesma variavel) x = ["apple", "banana"] y = ["apple", "banana"] z = x print(x is z) print(x is y) print(x == y) print(x is not z) print(x is not y) print(x != y)
301
120
WINDOW_SIZE = 8000 KMER_SIZE = 6 UPPER_THRESHOLD = 0.75 LOWER_THRESHOLD = 0.5 TUNE_METRIC = 1000 MINIMUM_GI_SIZE = 10000
121
82
import moeda n = float(input('Digite o preço: R$')) print (f'O dobro de {moeda.moeda(n)} é {moeda.dobro(n, True)}') print (f'A metade de {moeda.moeda(n)} é {moeda.metade(n, True)}') print (f'O aumento de 10% de {moeda.moeda(n)} é {moeda.aumento(n, 10, True)}') print (f'O desconto de 13% de {moeda.moeda(n)} é {moeda.de...
343
167
import vi.csp import collections import operator BacktrackStatistics = collections.namedtuple( 'BacktrackStatistics', ['calls', 'failures']) def backtrack_search(network): statistics = BacktrackStatistics(calls=0, failures=0) # Ensure arc consistency before making any assumptions: return backtrack(vi...
1,618
433
#! env python # coding: utf-8 # 功能:对文字部分使用k-means算法进行聚类 import os import time import sys import cv2 from sklearn.cluster import KMeans from sklearn.decomposition import PCA from sklearn.externals import joblib def get_img_as_vector(fn): im = cv2.imread(fn) im = im[:, :, 0] retval, dst = cv2.threshold(im,...
1,377
592
import torch from torch.utils.data import Dataset import json import numpy as np import os from PIL import Image, ImageFilter from torchvision import transforms as T from models.camera import Camera from tqdm import tqdm from .ray_utils import * class BlenderEfficientShadows(Dataset): def __init__(self, root_dir,...
14,735
4,967
class Solution(object): def longestPalindrome(self, s): """ :type s: str :rtype: str """ if len(s) == 1: return s start = 0 end = len(s) maxlength = 0 longest = "" while(start < len(s)): substring = s[start:end] ...
625
168
# # PySNMP MIB module RBN-ICR-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RBN-ICR-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 20:44:25 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 0...
10,410
4,829
#!/usr/bin/env python # coding: utf-8 # In[93]: import os from shutil import copyfile import json print("cwd = ", os.getcwd()) current_folder = os.getcwd() #extracted_train_data = os.path.join(current_folder, "extracted_train_data") extracted_train_data = "/dataset/training/" #annotations_dir = '/data/annotations'...
14,325
5,116
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'second_childwin.ui' # # Created by: PyQt5 UI code generator 5.15.0 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 i...
4,721
1,816
import os import matplotlib.pyplot as plt import numpy as np from models import models_util DIFFICULTY_LABEL = "Star Difficulty" BPM_LABEL = "BPM" LENGTH_LABEL = "Length" CS_LABEL = "Circle Size" DRAIN_LABEL = "HP Drain" ACCURACY_LABEL = "Accuracy" AR_LABEL = "Approach Rate" SAVE_FOLDER = "visualization/" def prin...
1,683
681
import unittest from unittest.mock import * from src.zad02.main import Subscriber class SubscriberTest(unittest.TestCase): def setUp(self): self.subscriber = Subscriber() def test_add_client(self): self.subscriber.add_client = MagicMock(return_value=["Andrzej"]) self.assertEqual(["An...
2,327
743
# import some common libraries # import some common detectron2 utilities from detectron2.config import get_cfg from detectron2.data import ( build_detection_test_loader, build_detection_train_loader, ) from detectron2.engine import default_argument_parser, default_setup, launch, DefaultTrainer # import ADE ...
2,077
680
# OpenWeatherMap API Key weather_api_key = "3796d9507516315ec2ebdc39473cc6ea" # Google API Key g_key = "AIzaSyDQ3DTH86ntlGML7QCVhKWSocZX8Cb4yBA"
146
89
PERMISSION_DENIED_MESSAGE: str = "***PERMISSION DENIED!*** \n" \ "You are not permitted to use this command. \n" \ "Please contact to your server master. \n." ERROR_OCCURRED_MESSAGE: str = "***ERROR OCCURRED!*** \n" \ "Error has occu...
2,411
622
from pydicom.sr import _snomed_dict import os import re import pydicom.sr._snomed_dict folder = "E:\\work\\QIICR\\dcmqi" Out_Folder = "E:\\work\\QIICR\\renamed_dcmqi" def recursive_file_find(address, regexp): filelist = os.listdir(address) approvedlist=[] for filename in filelist: fullpath = os.p...
4,035
1,458
# coding=utf-8 # Copyright 2018 The DisentanglementLib 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 # # Un...
9,417
3,244
# Created by Chenye Yang, Haokai Zhao, Zhuoyue Xing on 2019/10/13. # Copyright © 2019 Chenye Yang, Haokai Zhao, Zhuoyue Xing . All rights reserved. from machine import Pin, I2C, RTC, Timer import socket import ssd1306 import time import network import urequests import json # ESP8266 connects to a router def ConnectWIF...
6,515
2,548
# ____ _ __ _ _ # # / ___|| | ___ _ / _| __ _| | | ___ _ __ # # \___ \| |/ / | | | |_ / _` | | |/ _ \ '_ \ # # ___) | <| |_| | _| (_| | | | __/ | | |# # |____/|_|\_\\__, |_| \__,_|_|_|\___|_| |_|# # |___/ ######### # ____ ____ ...
1,397
440
from rdflib import Namespace, XSD from rdflib.namespace import DC, DCTERMS FHIRCAT_CORD = Namespace("http://fhircat.org/cord-19/") SSO = Namespace("http://semanticscholar.org/cv-research/") DOI = Namespace("https://doi.org/") PUBMED = Namespace("https://www.ncbi.nlm.nih.gov/pubmed/") PMC = Namespace("https://www.ncbi....
453
189
import sys import os import argparse from types import MethodType from importlib import import_module from argparse import RawTextHelpFormatter # Note: this applies to all options, might not always be what we want... from pbutils.configs import get_config, get_config_from_data, to_dict, inject_opts, CP from .strings ...
6,568
1,885
#!/usr/bin/env python3 import json from django.core.management.base import BaseCommand from api.models import User class Command(BaseCommand): help = 'Print a dict of user status (number of users signed up per day) to stdout' def handle(self, *args, **options): stats = {} for user in User.o...
513
160
import pytest from common import SCHEMAS_PATH, assert_yaml_header_and_footer, load_yaml from jsonschema import ValidationError @pytest.mark.parametrize("path", SCHEMAS_PATH.glob("asdf-schema-*.yaml")) def test_asdf_schema(path): assert_yaml_header_and_footer(path) # Asserting no exceptions here load_yaml...
1,234
411
import tensorflow as tf from retinanet.dataloader.anchor_generator import AnchorBoxGenerator from retinanet.dataloader.preprocessing_pipeline import PreprocessingPipeline from retinanet.dataloader.utils import compute_iou class LabelEncoder: def __init__(self, params): self.input_shape = params.input.inp...
5,552
1,893