text
string
size
int64
token_count
int64
# coding: utf-8 # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
6,674
1,825
# Copyright (c) 2022, salesforce.com, inc. # All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause import os import re import time import random import argparse import torch from transformers import ...
6,920
2,502
import unittest from services import RoverRunnerService from tests.test_environment.marses import small_mars_with_one_rover_empty_commands from tests.test_environment import mocks as m from data_objects import Rover class TestRoverRunnerService(unittest.TestCase): def test_rover_runner_moves_rover_forward(self):...
4,351
1,607
import argparse import warnings warnings.simplefilter("ignore", UserWarning) import files from tensorboardX import SummaryWriter import os import numpy as np import time import torch import torch.optim import torch.nn as nn import torch.utils.data import torchvision import torchvision.transforms as tfs from data impo...
12,734
4,048
# -*- coding: utf-8 -*- from tests import HangulizeTestCase from hangulize.langs.vie import Vietnamese class VietnameseTestCase(HangulizeTestCase): """ http://korean.go.kr/09_new/dic/rule/rule_foreign_0218.jsp """ lang = Vietnamese() def test_1st(self): """제1항 nh는 이어지는 모음과 합쳐서 한 음절로 적는다....
1,341
767
from mathlibpy.functions import * import unittest class SinTester(unittest.TestCase): def setUp(self): self.sin = Sin() def test_call(self): self.assertEqual(self.sin(0), 0) def test_eq(self): self.assertEqual(self.sin, Sin()) def test_get_derivative_call(self): sel...
1,054
393
class Solution: def nextGreatestLetter(self, letters: list, target: str) -> str: if target < letters[0] or target >= letters[-1]: return letters[0] left, right = 0, len(letters) - 1 while left < right: mid = left + (right - left) // 2 if letters[mid] > tar...
639
200
import nonebot from nonebot import on_command from nonebot.rule import to_me from nonebot.typing import T_State from nonebot.adapters import Bot, Event from nonebot.log import logger from .config import global_config from .schedule import anti_cpdaily_check_routine cpdaily = on_command('cpdaily') scheduler = nonebot...
1,004
335
""" ============ Dollar Ticks ============ Use a `~.ticker.FormatStrFormatter` to prepend dollar signs on y axis labels. """ import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as ticker # Fixing random state for reproducibility np.random.seed(19680801) fig, ax = plt.subplots() ax.plot(100*np...
978
327
import json import re from flask import request, abort, jsonify from Chibrary import config from Chibrary.config import logger from Chibrary.exceptions import * from functools import wraps from urllib import parse from Chibrary.server import db def parse_url_query(url: str) -> dict: if not url.lower().startswith(...
6,746
2,498
import numpy as np from something import Top i = 0 while i < 10: a = np.ndarray((10,4)) b = np.ones((10, Top)) i += 1 del Top # show_store()
155
68
from aiohttp_admin2.mappers import Mapper from aiohttp_admin2.mappers import fields class FloatMapper(Mapper): field = fields.FloatField() def test_correct_float_type(): """ In this test we check success convert to float type. """ mapper = FloatMapper({"field": 1}) mapper.is_valid() ass...
897
307
""" Try to load all of the MODFLOW-USG examples in ../examples/data/mfusg_test. These are the examples that are distributed with MODFLOW-USG. """ import os import flopy # make the working directory tpth = os.path.join("temp", "t038") if not os.path.isdir(tpth): os.makedirs(tpth) # build list of name files to try...
1,163
438
#!/usr/bin/env python3 import os from argparse import ArgumentParser, ArgumentTypeError, FileType, Namespace from typing import Any def DirType(string: str) -> str: if os.path.isdir(string): return string raise ArgumentTypeError( 'Directory does not exist: "{}"'.format(os.path.abspath(string))...
999
327
from typing import Optional from asn1crypto import core, x509, cms __all__ = [ 'Target', 'TargetCert', 'Targets', 'SequenceOfTargets', 'AttrSpec', 'AAControls' ] class TargetCert(core.Sequence): _fields = [ ('target_certificate', cms.IssuerSerial), ('target_name', x509.GeneralName, {'opt...
3,488
1,186
from model.group import Group import random def test_delete_some_group(app): if len(app.group.get_group_list()) <= 1: app.group.add_new_group(Group(name='test')) old_list = app.group.get_group_list() index = random.randrange(len(old_list)) app.group.delete_group_by_index(index) new_list = ...
448
162
''' Autor: Gurkirt Singh Start data: 15th May 2016 purpose: of this file is read frame level predictions and process them to produce a label per video ''' from sklearn.svm import LinearSVC from sklearn.ensemble import RandomForestClassifier import numpy as np import pickle import os import time,json import pylab as pl...
3,173
1,198
import csv def csv_dict_writer(path, headers, data): with open(path, 'w', newline='') as csvfile: writer = csv.DictWriter(csvfile, delimiter=',', fieldnames=headers) writer.writeheader() for record in data: writer.writerow(record) if __name__ =...
910
334
# SPDX-FileCopyrightText: 2017 Fermi Research Alliance, LLC # SPDX-License-Identifier: Apache-2.0 import pytest from decisionengine.framework.modules import Publisher, Source from decisionengine.framework.modules.Module import verify_products from decisionengine.framework.modules.Source import Parameter def test_mu...
2,355
737
import torch import torch.nn as nn from torch.nn.functional import max_pool1d from utility.model_parameter import Configuration, ModelParameter class CNNLayer(nn.Module): def __init__(self, config: Configuration, vocab_size=30000, use_embeddings=True, embed_dim=-1, **kwargs): super(CNNLayer, self).__init...
1,687
584
''' <xs:complexType name="backup"> <xs:annotation> <xs:documentation></xs:documentation> </xs:annotation> <xs:sequence> <xs:group ref="duration"/> <xs:group ref="editorial"/> </xs:sequence> </xs:complexType> ''' from musicscore.dtd.dtd import Sequence, GroupReference, Element from musicscore.musicxml...
1,129
324
import nltk import re import csv import string import collections import numpy as np from nltk.corpus import wordnet from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer from nltk.tokenize import WordPunctTokenizer from sklearn.metrics import classification_report from sklearn.metric...
4,429
1,586
import torch import numpy as np import hashlib from torch.autograd import Variable import os def deterministic_random(min_value, max_value, data): digest = hashlib.sha256(data.encode()).digest() raw_value = int.from_bytes(digest[:4], byteorder='little', signed=False) return int(raw_value / (2 ** 32 - 1...
7,304
2,751
from ibm_watson import TextToSpeechV1, SpeechToTextV1, DetailedResponse from os import system from json import loads class Converter: k_s2t_api_key = "0pxCnJQ_r5Yy3SZDRhYS4XshrTMJyZEsuc45SbBcfGgf" k_t2s_api_key = "euoR7ZdLMOBd29wP1fNaZFJsqwKt45TUmwcVwpzbQBcA" k_s2t_url = "https://stream.watsonplatform.n...
1,362
566
from subprocess import run def perform_shutdown(body): arg = "" if body["reboot"]: _is_reboot = arg + "-r" else: _is_reboot = arg + "-h" time_to_shutdown = str(body['timeToShutdown']) result = run(["/sbin/shutdown", _is_reboot, time_to_shutdown]) return body
301
116
# Generated by Django 2.1.7 on 2019-02-23 23:45 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('torrents', '0010_auto_20190223_0326'), ] operations = [ migrations.AlterModelOptions( name='realm', options={'ordering': ('n...
346
132
from . import (emoji as emj, keyboards as kb, telegram as tg, phrases as phr, finance as fin, utils, glossary, bots, gcp, sed, db)
281
71
#!/usr/bin/env python # -*- coding: utf-8 """ :mod:`question.serializers` -- serializers """ from rest_framework import serializers from .models import Question, PossibleAnswer from category.models import Category class PossibleAnswerSerializer(serializers.ModelSerializer): class Meta: model = PossibleA...
1,136
298
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'src/ui_ShowResultDialog.ui' # # Created: Sat May 16 17:05:43 2015 # by: PyQt5 UI code generator 5.4 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def s...
2,147
712
""" mixcoatl.admin.api_key ---------------------- Implements access to the DCM ApiKey API """ from mixcoatl.resource import Resource from mixcoatl.decorators.lazy import lazy_property from mixcoatl.decorators.validations import required_attrs from mixcoatl.utils import uncamel, camelize, camel_keys, uncamel_keys impor...
6,484
1,868
my_set = {1, 3, 5} my_dict = {'name': 'Jose', 'age': 90} another_dict = {1: 15, 2: 75, 3: 150} lottery_players = [ { 'name': 'Rolf', 'numbers': (13, 45, 66, 23, 22) }, { 'name': 'John', 'numbers': (14, 56, 80, 23, 22) } ] universities = [ { 'name': 'Oxford',...
414
203
"""Class :py:class:`QWTable` is a QTableView->QWidget for tree model ====================================================================== Usage :: # Run test: python lcls2/psdaq/psdaq/control_gui/QWTable.py from psdaq.control_gui.QWTable import QWTable w = QWTable() Created on 2019-03-28 by Mikhail D...
7,589
2,476
"""Extension loader for filetype handlers. The extension objects provided by MIMEExtensionLoader objects have four attributes: parse, embed, add_options, and update_options. The first two are used as handlers for supporting the MIME type as primary and embeded resources. The last two are (currently) only used for pr...
1,948
580
# coding: utf-8 # (C) Copyright IBM Corp. 2021. # # 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...
38,737
10,591
import functions from pytest import approx from bcca.test import should_print def test_add_em_up(): assert functions.add_em_up(1, 2, 3) == 6 assert functions.add_em_up(4, 5, 6) == 15 def test_sub_sub_hubbub(): assert functions.sub_sub_hubbub(1, 2, 3) == -4 def test_square_area(): assert functions....
3,765
1,830
from django.contrib import admin from .models import Product admin.site.register(Product)
90
23
# coding=utf-8 from __future__ import unicode_literals from .base import BasePlugin class TextPlugin(BasePlugin): ext = 'txt'
134
45
#!/usr/bin/env python3 # Project: VUT FIT SUI Project - Dice Wars # Authors: # - Josef Kolář <xkolar71@stud.fit.vutbr.cz> # - Dominik Harmim <xharmi00@stud.fit.vutbr.cz> # - Petr Kapoun <xkapou04@stud.fit.vutbr.cz> # - Jindřich Šesták <xsesta05@stud.fit.vutbr.cz> # Year: 2020 # Description: Genera...
2,013
726
import functools import sys from contextlib import contextmanager import pytest _orig_trace = None def pytest_configure(): global _orig_trace _orig_trace = sys.gettrace() @pytest.fixture(scope="session", autouse=True) def term(): """Configure TERM for predictable output from Pygments.""" from _pyt...
4,041
1,368
""" Various generic env utilties. """ def center_crop_img(img, crop_zoom): """ crop_zoom is amount to "zoom" into the image. E.g. 2.0 would cut out half of the width, half of the height, and only give the center. """ raw_height, raw_width = img.shape[:2] center = raw_height // 2, raw_width // 2 cro...
1,279
532
# -*- coding: utf-8 -*- from __future__ import absolute_import import mock from exam import fixture from sentry import options from sentry.models import Project from sentry.testutils import TestCase from sentry.utils.http import ( is_same_domain, is_valid_origin, get_origins, absolute_uri, is_valid_ip, ) clas...
9,006
3,013
# -*- coding: utf-8 -*- """WebHelpers used in project.""" #from webhelpers import date, feedgenerator, html, number, misc, text from markupsafe import Markup def bold(text): return Markup('<strong>%s</strong>' % text)
224
79
import sys; from Thesis.load.loadBenchmark import runLoadBenchmarkAsBatch; from Thesis.cluster.RiakCluster import RiakCluster; NORMAL_BINDING = 'riak'; CONSISTENCY_BINDING = 'riak_consistency'; IPS_IN_CLUSTER = ['172.16.33.14', '172.16.33.15', '172.16.33.16', '172.16.33.17', '172.16.33.18']; def main(): if len(s...
1,555
612
# coding: utf-8 # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. import unittest from mock import patch from auto_nag.people import People from auto_nag.round_robin im...
4,947
1,830
# should re-write compiled functions to take a local and global dict # as input. from __future__ import absolute_import, print_function import sys import os from . import ext_tools from . import catalog from . import common_info from numpy.core.multiarray import _get_ndarray_c_version ndarray_api_version = '/* NDARRA...
21,473
5,658
# Copyright 2015 Tesora Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
22,062
5,732
import pathlib import yaml documentations = {"Our Platform": "QuantConnect-Platform-2.0.0.yaml", "Alpha Streams": "QuantConnect-Alpha-0.8.yaml"} def RequestTable(api_call, params): writeUp = '<table class="table qc-table">\n<thead>\n<tr>\n' writeUp += f'<th colspan="2"><code>{api_call}</code...
18,018
4,992
from .utils import get_request, authorized class Hubs: @authorized def getHubs(self): url = self.api_url + '/project/v1/hubs' headers = { 'Authorization': '%s %s' % (self.token_type, self.access_token) } return get_request(url, headers) @authorized def g...
551
187
from django.conf.urls import url # from .views import BaseIndexView urlpatterns = [ # url(r'^$', BaseIndexView.as_view(), name="index"), ]
144
50
# Copyright (c) 2018, Palo Alto Networks # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS...
10,427
3,096
import glob import logging import os import warnings import pytest from _pytest.outcomes import Failed from _pytest.reports import TestReport from .broker_pact import BrokerPact, BrokerPacts, PactBrokerConfig from .result import PytestResult, log def pytest_addoption(parser): group = parser.getgroup("pact speci...
8,841
2,613
# -*- coding: utf-8 -*- def docstring_property(class_doc): """Property attribute for docstrings. Took from: https://gist.github.com/bfroehle/4041015 >>> class A(object): ... '''Main docstring''' ... def __init__(self, x): ... self.x = x ... @docstring_property(__doc__)...
1,503
459
import warnings try: import cudasift as cs except: cs = None import numpy as np import pandas as pd def match(edge, aidx=None, bidx=None, **kwargs): """ Apply a composite CUDA matcher and ratio check. If this method is used, no additional ratio check is necessary and no symmetry check is requir...
1,906
625
from flask_restx import Api from app.apis.hello import api as hello api = Api( title='api', version='1.0', description='', prefix='/api', doc='/api' ) api.add_namespace(hello)
199
72
# coding: utf-8 import unittest from test.support import captured_stdout from brainfuck import BrainFuck class TestCore(unittest.TestCase): def test_hello_world(self): bf = BrainFuck() with captured_stdout() as stdout: bf.run() self.assertEqual(stdout.getvalue(), "Hello, wo...
1,339
477
from fastapi import FastAPI, Request, Response from fastapi.responses import HTMLResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates from utils import get_page_data, process_initial import uvicorn app = FastAPI() templates = Jinja2Templates(directory="templates") app.mou...
788
242
# # Python script using OME API to create a new static group # # _author_ = Raajeev Kalyanaraman <Raajeev.Kalyanaraman@Dell.com> # _version_ = 0.1 # # Copyright (c) 2020 Dell EMC Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Lic...
4,515
1,232
from typing import Callable, Optional, Tuple, Union import numpy as np from torch.utils.data import DataLoader, Sampler from torch.utils.data.dataset import Subset, ConcatDataset import torch.utils.data.distributed as data_dist from dataflow.datasets import get_train_dataset, get_val_dataset, TransformedDataset, get...
4,531
1,366
from datetime import datetime, timedelta from typing import Any, Dict, Optional import graphene import jwt from django.conf import settings from django.core.handlers.wsgi import WSGIRequest from ..account.models import User from ..app.models import App from .permissions import ( get_permission_names, get_perm...
6,309
2,130
import os, json, logging, jsonpath_rw_ext, jsonpath_rw from jsonpath_rw import jsonpath, parse from . import events from ast import literal_eval from flask import make_response logger = logging.getLogger(__name__) CONFIG_PATH = '/tests/settings/config.json' class ClientConfiguration: """ This class is a handl...
3,513
940
# Generated by Django 2.2.4 on 2019-11-14 16:48 import django.contrib.postgres.fields.jsonb from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('data', '0022_discardaction'), ] operations = [ migrations.AddField( model_name='discardactio...
458
154
from json import JSONEncoder from time import time class Jsonable: """Abstract class to standardize the toJson method to be implemented by any class that wants to be serialized to JSON""" def toJson(self): """Abstract method""" raise NotImplementedError('You should implement this method in...
1,297
399
"""Compute pi.""" from decimal import Decimal, getcontext import argparse import itertools class ComputePi: """Compute pi to a specific precision using multiple algorithms.""" @staticmethod def BBP(precision): """Compute pi using the Bailey-Borwein-Plouffe formula.""" getcontext().prec = ...
2,034
711
#!/usr/bin/python3 import time from brownie import ( DataTypes, TransparentUpgradeableProxy, ProxyAdmin, config, network, Contract, ) from scripts.helpful_scripts import get_account, encode_function_data def main(): account = get_account() print(config["networks"][network.show_active()...
1,657
507
import torch.nn as nn class BidirectionalLSTM(nn.Module): # Module to extract BLSTM features from convolutional feature map def __init__(self, nIn, nHidden, nOut): super(BidirectionalLSTM, self).__init__() self.rnn = nn.LSTM(nIn, nHidden, bidirectional=True) self.embedding = nn.Linear...
659
243
class PaintEventArgs(EventArgs,IDisposable): """ Provides data for the System.Windows.Forms.Control.Paint event. PaintEventArgs(graphics: Graphics,clipRect: Rectangle) """ def Instance(self): """ This function has been arbitrarily put into the stubs""" return PaintEventArgs() def Dispose(self):...
1,436
472
# written by Jaekwang Cha # version 0.1 # ================== IMPORT CUSTOM LEARNING LIBRARIES ===================== # from customs.train import train, test from customs.dataset import load_dataset from customs.model import load_model # ================== TRAINING SETTINGS ================== # import argparse...
5,173
1,615
#!/usr/bin/env python3 import logging import sys import subprocess from pathlib import Path from datetime import datetime from Pegasus.api import * logging.basicConfig(level=logging.DEBUG) # --- Work Dir Setup ----------------------------------------------------------- RUN_ID = "024-sc4-gridftp-http-" + datetime.no...
4,812
1,767
import torch from ceem.opt_criteria import * from ceem.systems import LorenzAttractor from ceem.dynamics import * from ceem.smoother import * from ceem import utils def test_smoother(): utils.set_rng_seed(1) torch.set_default_dtype(torch.float64) sigma = torch.tensor([10.]) rho = torch.tensor([28....
1,600
687
# This code is part of Qiskit. # # (C) Copyright IBM 2020. # # 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...
5,787
1,558
# Create your views here. from .models import Mfund import plotly.graph_objects as go from plotly.offline import plot from plotly.tools import make_subplots from django.db.models import Q from django.conf import settings from django.shortcuts import redirect from django.contrib.auth.decorators import login_require...
8,401
2,751
#coding: utf-8 from gevent import monkey monkey.patch_all() from gevent.pool import Pool import gevent import requests import urllib import os import time import re import ssl class Downloader: def __init__(self, pool_size, retry=3): self.pool = Pool(pool_size) self.session = self._get_http_sessio...
5,444
1,800
# Generated by Django 3.2.9 on 2021-12-06 10:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('restaurants', '0001_initial'), ] operations = [ migrations.AddField( model_name='restaurant', name='description', ...
474
149
#!/usr/bin/env python3 import os import contextlib from PyQt5 import QtCore, QtWidgets from dsrlib.settings import Settings class LayoutBuilder: def __init__(self, target): self.target = target self._stack = [] @contextlib.contextmanager def _layout(self, cls, *args, **kwargs): ...
5,910
1,658
#!/usr/bin/env python3 # # Copyright 2017-2020 GridGain 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 applicab...
37,201
10,474
import logging import os import re import uuid from pathlib import Path from ludwig.constants import CHECKSUM, META, TEST, TRAINING, VALIDATION from ludwig.data.cache.util import calculate_checksum from ludwig.utils import data_utils from ludwig.utils.fs_utils import delete, path_exists logger = logging.getLogger(__n...
5,425
1,571
import pprint from FactorioCalcBase.data.binary import sorted_recipe_list, production_machine_category_list_dict from FactorioCalcBase.recipe import Recipe from FactorioCalcBase.calculator_base import CalculatorBase from FactorioCalcBase.dependency_dict_common_function import dict_add_number import time def test_chan...
2,629
788
# Copyright (c) 2006- Facebook # Distributed under the Thrift Software License # # See accompanying file LICENSE or visit the Thrift site at: # http://developers.facebook.com/thrift/ class TType: STOP = 0 VOID = 1 BOOL = 2 BYTE = 3 I08 = 3 DOUBLE = 4 I16 = 6 I32 = 8 I64 = 10 STR...
2,561
980
# # Copyright 2018 Picovoice 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 writ...
6,546
2,151
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 20 22:18:58 2020 @author: https://stackoverflow.com/questions/293431/python-object-deleting-itself @editor: thirschbuechler this is probably overkill to alternatively exit a with-context, rather than by exception, but hey, maybe it will be needed, ...
1,549
503
#!/usr/bin/env python # -*- coding: utf-8 -*- """A module containing an algorithm for hand gesture recognition""" import numpy as np import cv2 from typing import Tuple __author__ = "Michael Beyeler" __license__ = "GNU GPL 3.0 or later" def recognize(img_gray): """Recognizes hand gesture in a single-channel dep...
6,593
2,091
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' // Copyright (c) 2015 Intel 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...
4,224
1,239
import sys import os from . import filesys MAIN_USAGE_MESSAGE = """ usage: xlab command ... Options: positional arguments: command project """ def project(args): if len(args) != 1: print("error: Invalid arguments.") exit() if args[0] == 'init': root = os.getcwd() ...
688
238
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
16,294
4,800
from api import app from unittest import TestCase class TestIntegrations(TestCase): maxDiff = None def setUp(self): self.app_client = app.test_client() def test_get_itrns(self): """ This function test retrieving protein interactions for various species' genes. """ ...
1,880
561
# install BeautifulSoup4 before running # # prints out historical data in csv format: # # [date, open, high, low, close, volume] # import re, csv, sys, urllib2 from bs4 import BeautifulSoup # If start date and end date is the same only one value will be returned and # if not the multiple values which can be used to ma...
2,261
825
import sys import io from collections import defaultdict import struct from time import sleep import queue import threading import serial from serial import SerialException RUN_LABELS = ('Time left', 'Temp 1', 'Temp 2', 'Off Goal', 'Temp Change', 'Duty cycle (/30)', 'Heating', 'Cycle', 'Total time', 'Goal temp') MSG...
5,460
1,623
#!/usr/bin/env python3 # Copyright (c) 2018 The Bitcoin developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ Test that a node receiving many (potentially out of order) blocks exits initial block download (IBD; this occur...
2,549
782
from django.db import models from djangostagram.users import models as user_model # Create your models here. # This class is used in other models as an inheritance. # An often-used pattern class TimeStamedModel(models.Model): created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeFi...
1,325
370
from guillotina.contrib.workflows.interfaces import IWorkflowChangedEvent from guillotina.events import ObjectEvent from zope.interface import implementer @implementer(IWorkflowChangedEvent) class WorkflowChangedEvent(ObjectEvent): """An object has been moved""" def __init__(self, object, workflow, action, c...
497
133
""" Suppress COVID EHR vaccine concepts. Original Issues: DC-1692 """ # Python imports import logging # Project imports from cdr_cleaner.cleaning_rules.deid.concept_suppression import AbstractBqLookupTableConceptSuppression from constants.cdr_cleaner import clean_cdr as cdr_consts from common import JINJA_ENV, CDM_T...
6,340
1,955
import pydbhub from typing import Any, Dict, List, Tuple from json.decoder import JSONDecodeError import requests import io def send_request_json(query_url: str, data: Dict[str, Any]) -> Tuple[List[Any], str]: """ send_request_json sends a request to DBHub.io, formatting the returned result as JSON Param...
3,494
1,043
import pytest from calcscore import round_score # you'll be picking what teams make it to the next round # - so picking 32, then 16, then 8, 4, 2, 1...i.e. round 1-6 winners # teams will have a name & a seed # seed doesn't change, so maybe make that not passed around w/ results def test_round_score_invalid_round():...
809
287
import unittest from operator import attrgetter import obonet from pyobo import SynonymTypeDef, get from pyobo.struct import Reference from pyobo.struct.struct import ( iterate_graph_synonym_typedefs, iterate_graph_typedefs, iterate_node_parents, iterate_node_properties, iterate_node_relationships, iterate_no...
4,803
1,610
# -*- coding: utf-8 -*- # + ## Utilidades comunes entre places y OSM. # + import csv import ast import codecs from math import cos, asin, sqrt # + def read_csv_with_encoding(filename, delimiter="|", encoding="iso-8859-1"): with codecs.open(filename, encoding=encoding) as fp: reader = csv.reader(fp, deli...
2,676
908
#This script Imports Game Data from ESPN, and Odds from the ODDS-API, and then imports them into a MySQL table, example in workbench here https://puu.sh/HOKCj/ce199eec8e.png import mysql.connector import requests import json import datetime import time #Connection to the MYSQL Server. mydb = mysql.connector....
7,851
2,742
"""Tests for neurodocker.main""" # Author: Jakub Kaczmarzyk <jakubk@mit.edu> from __future__ import absolute_import, unicode_literals import sys import pytest from neurodocker.neurodocker import create_parser, parse_args, main def test_generate(): args = ("generate -b ubuntu:17.04 -p apt" " --arg ...
4,302
1,578
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright (C) 2020 The Project U-Ray Authors. # # Use of this source code is governed by a ISC-style # license that can be found in the LICENSE file or at # https://opensource.org/licenses/ISC # # SPDX-License-Identifier: ISC ''' FDCE Primitive: D Flip-Flop with Clock...
2,778
1,058
from typing import Callable import numpy as np from hmc.integrators.states.leapfrog_state import LeapfrogState from hmc.integrators.fields import riemannian from hmc.linalg import solve_psd class RiemannianLeapfrogState(LeapfrogState): """The Riemannian leapfrog state uses the Fisher information matrix to provi...
2,697
857
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # || ____ _ __ # +------+ / __ )(_) /_______________ _____ ___ # | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \ # +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/ # || || /_____/_/\__/\___/_/ \__,_/ /___/\___/ # # Copyright (C) 2...
2,834
962