text
string
size
int64
token_count
int64
__version__ = "2.1.1" # Work around to update TensorFlow's absl.logging threshold which alters the # default Python logging output behavior when present. # see: https://github.com/abseil/abseil-py/issues/99 # and: https://github.com/tensorflow/tensorflow/issues/26691#issuecomment-500369493 try: import absl.logging...
5,761
1,782
from __future__ import absolute_import, division, print_function data = r"""cdials_array_family_flex_ext shoebox p1 (tRp2 (cscitbx_array_family_flex_ext grid p3 ((I0 t(I8 tI01 tRp4 (I8 tbS'\x02\x01\x02\x08\x00\x03\\\x01\x03m\x01\x03\x04\x06\x03\x15\x06\x00\x02\x01\x02\x03\x02\x01\x02\x11\x02\x11\x02\x9c\x02\x06\x02\x8...
91,430
87,543
#!/usr/bin/env python """ Info: This script loads the model trained in the cnn-asl.py script and enables the user to use it for classifying unseen ASL letters. It also visualizes the feature map of the last convolutional layer of the network to enable the user to get an insight into exactly which parts of the original ...
11,830
3,208
from Algorithmia import ADK # API calls will begin at the apply() method, with the request body passed as 'input' # For more details, see algorithmia.com/developers/algorithm-development/languages def apply(input): # If your apply function uses state that's loaded into memory via load, you can pass that loaded s...
844
210
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "license...
7,899
2,197
"""Errors module.""" __all__ = [ 'Error', 'AddressError', 'AuthenticationError', 'TransportError', 'ValidationError', 'RegisterError', 'MessageError', 'DBusError', 'SignatureError', 'TooLongError', ] class Error(Exception): """Base class.""" class AddressError(Error): ...
1,032
307
from XDR_iocs import * import pytest from freezegun import freeze_time Client.severity = 'INFO' client = Client({'url': 'test'}) def d_sort(in_dict): return sorted(in_dict.items()) class TestGetHeaders: @freeze_time('2020-06-01T00:00:00Z') def test_sanity(self, mocker): """ Given: ...
31,006
11,187
from django.contrib.auth.models import AbstractUser from django.db.models import CharField from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from django.db import models from PIL import Image class User(AbstractUser): # First Name and Last Name do not cover name patterns ...
1,797
593
# Copyright (c) 2015-2020 Cloudify Platform Ltd. 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 b...
4,444
1,337
# -*- coding: utf-8 -*- """ Created on Sun Aug 19 17:48:13 2018 @author: Sediment """ # -*- coding: utf-8 -*- ''' Keras implementation of deep embedder to improve clustering, inspired by: "Unsupervised Deep Embedding for Clustering Analysis" (Xie et al, ICML 2016) Definition can accept somewhat custom ne...
15,411
5,050
from decimal import ROUND_HALF_DOWN, ROUND_HALF_EVEN, ROUND_HALF_UP, Decimal from math import ceil, floor, log2 from typing import Union import torch from ppq.core import RoundingPolicy def ppq_numerical_round(value: float, policy: RoundingPolicy=RoundingPolicy.ROUND_HALF_EVEN) -> int: """ reference...
4,471
1,505
#!/usr/bin/env python3 # # 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 "L...
11,944
4,119
from django.conf.urls import patterns, url from roomsensor import views urlpatterns = patterns('', url(r'^$', views.index, name='roomsensor'), # ex: /roomsensor/name/ url(r'^(?P<roomsensor_name>\w+)/$', views.display, name='roomsensor_display'), url(r'^(?P<roomsensor_name>\w+)/read/$', views.read, na...
519
189
# main.py # # currently just an example script I use to test my optimization_results module # # WARNING: design point numbers 0-indexed in pandas database, but # eval_id column is the original 1-indexed value given by DAKOTA import optimization_results as optr def main(): a4 = optr.MogaOptimizationResults() ...
1,088
526
# # Copyright (c) 2017 Joy Diamond. All rights reserved. # @gem('Topaz.Core') def gem(): require_gem('Gem.Global') from Gem import gem_global gem_global.testing = true require_gem('Gem.Cache2') require_gem('Gem.DumpCache') require_gem('Gem.GeneratedConjureQuadruple') require_gem('Ge...
2,127
712
import flask from flask import Flask from flask import jsonify from flask import request from flask_cors import CORS, cross_origin from flask import render_template import mwoauth import requests_oauthlib import os import yaml import mwapi from tasks.main import Tasks from save import Save from db import DB from typ...
7,031
2,514
import numpy as np from collections import defaultdict, Counter import random import json from tqdm import tqdm def transX(dataset): rel2id = json.load(open(dataset + '/relation2ids')) ent2id = json.load(open(dataset + '/ent2ids')) with open('../Fast-TransX/' + dataset + '_base/entity2id.txt', 'w') as...
1,483
563
"""Contains the Fortune Teller Character class""" import json import random import discord import datetime from botc import Action, ActionTypes, Townsfolk, Character, Storyteller, RedHerring, \ RecurringAction, Category, StatusList from botc.BOTCUtils import GameLogic from ._utils import TroubleBrewing, TBRole im...
7,673
2,252
from unittest.mock import call, MagicMock, patch from schmetterling.build.maven import build_multi_modules from schmetterling.build.maven import create_build_result from schmetterling.build.maven import create_command from schmetterling.build.maven import create_multi_modules from schmetterling.build.maven import crea...
10,849
3,181
#Sacar las lineas con DEBUG para que el juego funcione import random DIGITOS = 4 def mastermind(): """Funcion principal del juego Mastermind""" print("Bienvenido al Mastermind!") print("Instrucciones: Tenes que adivinar un codigo de {} digitos distintos. Tu cantidad de aciertos son los numeros que estan corr...
1,753
679
#!/usr/bin/env python # -*- coding: utf-8 -*- """The setup script.""" from setuptools import setup, find_packages with open("README.rst") as readme_file: readme = readme_file.read() with open("HISTORY.rst") as history_file: history = history_file.read() requirements = ["Click>=6.0", "suds2==0.7.1"] setup_...
1,499
500
import time import board import displayio import busio from analogio import AnalogIn import neopixel import adafruit_adt7410 from adafruit_bitmap_font import bitmap_font from adafruit_display_text.label import Label from adafruit_button import Button import adafruit_touchscreen from adafruit_pyportal import PyPortal #...
15,233
5,098
import json from btse_futures.constants import OrderType, Side, TimeInForce class Order: """ Class to represent a BTSE Order ... Attributes ---------- size : int order quantity or size. e.g. 1 price : float price. e.g. 7000.0 side: str order side. B...
7,741
2,453
"""Simple mock responses definitions.""" from blinkpy.helpers.util import BlinkURLHandler import blinkpy.helpers.constants as const LOGIN_RESPONSE = { 'region': {'mock': 'Test'}, 'networks': { '1234': {'name': 'test', 'onboarded': True} }, 'authtoken': {'authtoken': 'foobar123', 'message': 'au...
2,037
648
from astropy import coordinates as coord from astropy import wcs from astropy.io import fits from astropy import units as u from misc import bcolors import numpy as np import os def convert_hms_dd(RA, DEC): ''' Convert HMS to DD system ''' if (':' in RA) and (':' in DEC): Coord_dd = coord.SkyCoord(RA, DEC...
2,061
952
import argparse import torch import torch.nn as nn import torchvision import torchvision.transforms as transforms from n3ml.model import DynamicModel_STBP_SNN def validate(val_loader, model, encoder, criterion, opt): model.eval() total_images = 0 num_corrects = 0 total_loss = 0 with torch.no_g...
2,155
747
# If you're new to file handling, be sure to check out with_open.py first! # You'll also want to check out read_text.py before this example. This one is a bit more advanced. with open('read_csv.csv', 'r') as states_file: # Instead of leaving the file contents as a string, we're splitting the file into a list...
2,757
869
import math from torch.optim.lr_scheduler import _LRScheduler from torch.optim.optimizer import Optimizer class PolyLR(_LRScheduler): """ Sets the learning rate of each parameter group according to poly learning rate policy """ def __init__(self, optimizer, max_iter=90000, power=0.9, last_epoch=-1):...
2,334
826
from .dataset import load_data
30
8
import json import logging logger = logging.getLogger(__name__) with open('configuration.json') as f: config = json.load(f) TELEGRAM_TOKEN = config["telegram-bot-token"] NOTION_TOKEN = config["notion-token"] NOTION_TABLE_URL = config["inbox_table"]["table_url"] def check_allowed_user(user_id): """ chec...
1,099
331
#------------------------------------------------------------------------------ # Copyright (c) 2013-2018, Nucleic Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #--------------------------------------------...
472
122
from time import time from typing import Type, TypeVar, MutableMapping, Any, Iterable, Generator, Union import arrow import datetime import math from datapipelines import DataSource, PipelineContext, Query, NotFoundError, validate_query from .common import RiotAPIService, APINotFoundError from ...data import Platform...
12,623
3,780
""" This caching is very important for speed and memory optimizations. There's nothing really spectacular, just some decorators. The following cache types are available: - module caching (`load_parser` and `save_parser`), which uses pickle and is really important to assure low load times of modules like ``numpy``. -...
10,374
2,993
#!/usr/bin/env python # # Software License Agreement (Apache License) # # Copyright 2013 Open Source Robotics Foundation # Author: Morgan Quigley # # 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 ...
6,277
3,458
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'PrestamoDeLibros.ui' # # Created by: PyQt4 UI code generator 4.11.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromU...
1,680
596
############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
3,572
1,171
#!/usr/bin/env python3 # encoding: utf-8 # # Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. # # This file is part of ewm-cloud-robotics # (see https://github.com/SAP/ewm-cloud-robotics). # # This file is licensed under the Apache Software License, v. 2 except as noted # otherwise in the LIC...
4,569
1,461
from . import config, widget # noqa
37
12
from hwtest.shell_utils import run_command def test_linux_usb3hub(): """ Test for Linux Foundation 3.0 root hub in `lsusb` output """ resp = run_command(["lsusb"]) assert "1d6b:0003" in resp
215
81
# Copyright 2012-2014 The Meson development team # 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 agree...
82,820
24,841
"""Tests of cputime.py """ import unittest from reversi.strategies.common import CPU_TIME class TestCputime(unittest.TestCase): """cputime """ def test_cputime(self): self.assertEqual(CPU_TIME, 0.5)
223
85
# -*- coding: utf-8 -*- """ReNS experiments - CIFAR10 Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1byZ4xTfCK2x1Rhkxpl-Vv4sqA-bo4bis # SETUP """ #@title Insatlling Pyorch # !pip install torch # !pip install torchvision #@title Import Dependencies...
5,249
1,931
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 Nebula, 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 # # ...
1,400
409
# 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 the...
2,993
888
from amadeus.client.decorator import Decorator class TripParserStatus(Decorator, object): def __init__(self, client, job_id): Decorator.__init__(self, client) self.job_id = job_id def get(self, **params): ''' Returns the parsing status and the link to the result in cas...
684
209
import py import pytest from iniconfig import IniConfig, ParseError, __all__ as ALL from iniconfig import iscommentline from textwrap import dedent check_tokens = { 'section': ( '[section]', [(0, 'section', None, None)] ), 'value': ( 'value = 1', [(0, None, 'value', '1')] ...
7,737
2,661
import os from subprocess import call from . import glob2 pwd = os.path.dirname(__file__) def get_files_from_path(path, ext): # use set to remove duplicate files. weird...but it happens if os.path.isfile(path): return set([os.path.abspath(path)]) else: # i.e., folder files = glob2.glob(os.path.a...
3,586
1,334
""" Patches views. | Copyright 2017-2021, Voxel51, Inc. | `voxel51.com <https://voxel51.com/>`_ | """ from copy import deepcopy import eta.core.utils as etau import fiftyone.core.aggregations as foa import fiftyone.core.dataset as fod import fiftyone.core.fields as fof import fiftyone.core.labels as fol import fifty...
24,301
7,035
#!/usr/bin/env python # -*- coding: utf-8 -*- """The setup script.""" from setuptools import setup, find_packages with open('README.rst') as readme_file: readme = readme_file.read() {%- set license_classifiers = { 'MIT license': 'License :: OSI Approved :: MIT License', 'BSD license': 'License :: OSI A...
1,973
649
############################################################################## # # Copyright (c) 2002 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
6,153
1,880
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 18 22:42:54 2020 @author: mike """ import numpy as np import tensorflow as tf from tensorflow import keras from sklearn.model_selection import train_test_split from tensorflow.keras.applications import VGG16 from tensorflow.keras import layers fro...
1,855
794
#!/usr/bin/python # # Copyright 2018-2020 Polyaxon, 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 ...
2,158
678
class Student: studentLevel = 'first year computer science 2020/2021 session' studentCounter = 0 registeredCourse='csc102' def __init__(self, thename, thematricno, thesex,thehostelname,theage,thecsc102examscore): self.name = thename self.matricno = thematricno self.sex = thesex ...
1,503
506
from sqlalchemy.engine import reflection from clickhouse_sqlalchemy import Table, engines class ClickHouseInspector(reflection.Inspector): def reflect_table(self, table, *args, **kwargs): # This check is necessary to support direct instantiation of # `clickhouse_sqlalchemy.Table` and then reflect...
1,820
521
""" Unit Tests for the pydisque module. Currently, most of these tests require a fresh instance of Disque to be valid and pass. """ import unittest import json import time import random import six from pydisque.client import Client from redis.exceptions import ResponseError class TestDisque(unittest.TestCase): ...
6,686
2,306
# -*- coding: utf-8 -*- # """*********************************************************************************************""" # FileName [ runner.py ] # Synopsis [ main program that runs the 'Naive Bayes' and 'Decision Tree' training / testing ] # Author [ Ting-Wei Liu (Andi611) ] # Copyright [...
6,289
2,166
import copy import numpy as np import pybullet as p from igibson.metrics.metric_base import MetricBase class BehaviorRobotMetric(MetricBase): def __init__(self): self.initialized = False self.state_cache = {} self.next_state_cache = {} self.agent_pos = {part: [] for part in ["l...
7,393
2,318
import sys from .main import ( _chunk_list, _get_unicode_range_hash, convert_unicode_range, get_120_unicode_ranges, get_unicode_ranges_from_text, generate_css, main, ) __all__ = [ "_chunk_list", "_get_unicode_range_hash", "convert_unicode_range", "get_120_unicode_ranges", ...
438
179
""" This module contains various base dialog base classes that can be used to create custom dialogs for the end user. These classes serve as the basis for the pre-defined static helper methods in the `Messagebox`, and `Querybox` container classes. """ import calendar import textwrap from datetime im...
59,866
15,809
# -------------- #Importing header files import pandas as pd import matplotlib.pyplot as plt import seaborn as sns #Code starts here data = pd.read_csv(path) data.hist(['Rating']) data = data[data['Rating']<=5] data.hist(['Rating']) #Code ends here # -------------- # code starts here total_null = data.isnull().s...
2,504
907
import argparse import operator import os import re import shutil import spacy import tempfile from nerds.utils import spans_to_tokens, get_logger def segment_text_to_sentences(text_file, sentence_splitter): """ Segment text into sentences. Text is provided by BRAT in .txt file. Args: ...
6,597
2,089
""" Ocropus's magic PIL-numpy array conversion routines. They express slightly different behavior from PIL.Image.toarray(). """ import unicodedata import numpy as np from PIL import Image __all__ = ['pil2array', 'array2pil'] def pil2array(im: Image.Image, alpha: int = 0) -> np.array: if im.mode == '1': ...
2,503
832
import sys sys.path.insert(0,'..') from data.whale_data import exchnage_accounts from data.html_helper import check_if_address_name_exists from data.whale_eth_tx_data import * from data.whale_token_tx_data import identify_investor_type_token holding_account = "holding_account" deposit_account = 'deposit_account' withd...
2,877
959
# @Time : 2020/11/14 # @Author : Junyi Li, Gaole He # @Email : lijunyi@ruc.edu.cn # UPDATE: # @Time : 2020/12/2, 2020/11/27, 2020/12/3, 2020/12/26 # @Author : Jinhao Jiang, Xiaoxuan Hu, Tianyi Tang, Jinhao Jiang # @Email : jiangjinhao@std.uestc.edu.cn, huxiaoxuan@ruc.edu.cn, steventang@ruc.edu.cn, jiangjinhao@st...
66,926
20,112
from ...models import Persona, Plugin from . import example, example_cache, example_ratelimit, example_with_args plugin = Plugin( name="rsserpent-plugin-builtin", author=Persona( name="queensferryme", link="https://github.com/queensferryme", email="queensferry.me@gmail.com", ), ...
649
208
import pandas as pd # Define our header col_names = [ "year", "num_males_with_income", "male_median_income_curr_dollars", "male_median_income_2019_dollars", "num_females_with_income", "female_median_income_curr_dollars", "female_median_income_2019_dollars", ] # Load Asian census data XLS, ...
2,859
1,439
""" Dany jest ciąg określony wzorem: A[n+1] = (A[n] % 2) ∗ (3 ∗ A[n] + 1) + (1 − A[n] % 2) ∗ A[n] / 2. Startując z dowolnej liczby naturalnej > 1 ciąg ten osiąga wartość 1. Napisać program, który znajdzie wyraz początkowy z przedziału 2-10000 dla którego wartość 1 jest osiągalna po największej liczbie kroków. """ a0 = ...
520
270
""" ***************************************************************************** * H E A D E R I N F O R M A T I O N * * ****...
61,910
16,992
def say_hi(name,age): print("Hello " + name + ", you are " + age) say_hi("Mike", "35") def cube(num): # function return num*num*num result = cube(4) # variable print(result)
190
78
import glob import json path_in = './airspaces/' path_out = './airspaces_processed/' filenames = [path.split('/')[-1] for path in glob.glob(path_in + '*')] remove = { 'france_fr.geojson': [ 314327, 314187, 314360, 314359, 314362, 314361, 314364, 314...
4,321
2,174
from AndroidSpider import url_manager, html_downloader, html_parser, html_output ''' 爬取百度百科 Android 关键词相关词及简介并输出为一个HTML tab网页 Extra module: BeautifulSoup ''' class SpiderMain(object): def __init__(self): self.urls = url_manager.UrlManager() self.downloader = html_downloader.HtmlDownLoader() ...
1,480
513
MUTATION = '''mutation {{ {mutation} }}''' def _verify_additional_type(additionaltype): """Check that the input to additionaltype is a list of strings. If it is empty, raise ValueError If it is a string, convert it to a list of strings.""" if additionaltype is None: return None if isins...
517
148
import boto import boto3 from config import Config dynamodb = boto3.resource('dynamodb', aws_access_key_id=Config.AWS_KEY, aws_secret_access_key=Config.AWS_SECRET_KEY, region_name=Config.REGION) table = dynamodb.Table('user_details') tables...
951
311
# TODO: implement algorithms in c++ or something to make them fast
70
19
import os import unittest from Logger import Logger class TestLogger(unittest.TestCase): def test_file_handling(self): testLog = Logger("testLog") ## Check if program can create and open file self.assertTrue(testLog.opened) returns = testLog.close() ## Check if logger correc...
2,751
1,017
from logging import warning from requests import get from .info import Info from .provider import Provider from .providers import get_provider class Parser: def __init__(self, args: dict): self.params = args def init_provider( self, chapter_progress: callable = None, ...
1,986
557
# -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2016-12-28 22:09 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('villages', '0007_village_camp'), ] operations = [ migrations.AlterField( ...
487
182
from django.shortcuts import get_object_or_404, render from django.http import HttpResponseRedirect from django.urls import reverse from django.views import generic from django.utils import timezone from .models import Customer class IndexView(generic.ListView): template_name = 'customers/index.html' context_...
1,127
313
# flake8: noqa # pylint: skip-file from __future__ import absolute_import, division, print_function from salt.ext.tornado.test.util import unittest class ImportTest(unittest.TestCase): def test_import_everything(self): # Some of our modules are not otherwise tested. Import them # all (unless they...
1,531
395
"""Holds configurations to read and write with Spark to AWS S3.""" import os from typing import Any, Dict, List, Optional from pyspark.sql import DataFrame from butterfree.configs import environment from butterfree.configs.db import AbstractWriteConfig from butterfree.dataframe_service import extract_partition_value...
3,512
993
#!/usr/bin/env python3 import sys sys.path.append('..') import specrel.geom as geom import specrel.spacetime.physical as phy import specrel.visualize as vis # Shared parameters include_grid = True include_legend = True tlim = (0, 2) xlim = (-2, 2) # A stationary point object stationary = phy.MovingObject(0, draw_opt...
2,401
903
from baremetal import * from math import pi, sin, cos import sys from scale import scale from settings import * from ssb import ssb_polar def modulator(clk, audio, audio_stb, settings): audio_bits = audio.subtype.bits #AM modulation am_mag = Unsigned(12).constant(0) + audio + 2048 am_phase = Signe...
3,101
1,251
from __future__ import absolute_import from six.moves.urllib.parse import urlencode from django.test import RequestFactory from django.contrib.auth.models import AnonymousUser from sentry.auth.helper import handle_new_user from sentry.models import AuthProvider, InviteStatus, OrganizationMember from sentry.testutils ...
4,049
1,140
from broadcast_ping import BroadcastPing EVENT_TYPES = { "PING": BroadcastPing, } class UnknownBroadcastEvent(Exception): pass def new_broadcast_event(data): event_type, payload = data.split(" ", 1) if event_type not in EVENT_TYPES: raise UnknownBroadcastEvent(event_type) return EVENT...
348
123
import datetime import requests from mbta_python.models import Stop, Direction, Schedule, Mode, \ TripSchedule, Alert, StopWithMode, Prediction HOST = "http://realtime.mbta.com/developer/api/v2" def datetime_to_epoch(dt): epoch = datetime.datetime.utcfromtimestamp(0) return int((dt - epoch).total_second...
9,891
2,633
import argparse import glob import os import numpy as np import torch from sklearn.metrics import accuracy_score import models_torch as models import utils EXPERIMENT_DATA_DIR = "/tmp/mgr" def inference(parameters, verbose=True) -> int: # resolve device device = torch.device( "cuda:{}".format(par...
4,583
1,610
"""Computation of ensemble anomalies based on a desired value.""" import os import numpy as np from scipy import stats # User-defined packages from read_netcdf import read_iris, save_n_2d_fields from sel_season_area import sel_area, sel_season def ens_anom(filenames, dir_output, name_outputs, varname, numens, seaso...
4,878
1,645
from django.db import models from django.utils.html import mark_safe, strip_tags from django.utils.text import slugify from django.utils.translation import ugettext as _ from django.utils.translation import ugettext_lazy from django.core.exceptions import ValidationError from django.db.models.signals import post_save, ...
24,074
7,245
import csv from testdata import SOCIALHISTORY_FILE from testdata import rndDate from patient import Patient SMOKINGCODES = { '428041000124106': 'Current some day smoker', '266919005' : 'Never smoker', '449868002' : 'Current every day smoker', '266927001' : 'Unknown if ever smoked', '...
4,026
1,077
{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# dictionaries, look-up tables & key-value pairs\n", "# d = {} OR d = dict()\n", "# e.g. d = {\"George\": 24, \"Tom\": 32}\n", "\n", "d = {}\n", "\n" ] }, { "cell_typ...
4,248
1,962
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os import pytest from llnl.util.filesystem import mkdirp, touch import spack.config from spack.fetch_strategy im...
1,453
475
__author__ = 'hanhanw' import sys from pyspark import SparkConf, SparkContext from pyspark.sql.context import SQLContext from pyspark.sql.types import StructType, StructField, StringType, DoubleType conf = SparkConf().setAppName("temp range sql") sc = SparkContext(conf=conf) sqlContext = SQLContext(sc) assert sc.ver...
2,201
716
from typing_extensions import Required #from sqlalchemy.sql.sqltypes import Boolean from graphene import ObjectType, String, Field, ID, List, DateTime, Mutation, Boolean, Int from models.EventsRelated.EventModel import EventModel from graphqltypes.Utils import extractSession class EventType(ObjectType): id = ID(...
1,059
295
from __future__ import absolute_import # Copyright (c) 2010-2015 openpyxl from openpyxl.styles.colors import Color, BLACK, WHITE from openpyxl.utils.units import ( pixels_to_EMU, EMU_to_pixels, short_color, ) from openpyxl.compat import deprecated from openpyxl.xml.functions import Element, SubElement, t...
11,326
4,228
from VcfQC import VcfQC from ReseqTrackDB import File from ReseqTrackDB import ReseqTrackDB import argparse import os import logging import datetime #get command line arguments parser = argparse.ArgumentParser(description='Script to subset a VCF by excluding the variants within the regions defined by a BED file') ...
3,118
1,064
import os from base import BaseHandler class RestartHandler(BaseHandler): def get(self): if not self.authenticate(superuser=True): return os.system('touch ' + self.application.settings["restart_path"]) self.redirect(self.get_argument("next"))
266
80
# 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,276
1,256
import os def run(**kwargs): print("[*] In environment module.") return str(os.environ)
97
32
from django.shortcuts import render from .models import Disk import os def index(request): context = {} disk_list = Disk.objects.all() context['disk_list'] = disk_list return render(request, 'index.html', context) #def index(request): # module_dir = os.path.dirname(__file__) # file_path = os.p...
507
171
# Copyright Materialize, Inc. and contributors. All rights reserved. # # Use of this software is governed by the Business Source License # included in the LICENSE file at the root of this repository. # # As of the Change Date specified in that file, in accordance with # the Business Source License, use of this software...
1,976
536