text stringlengths 957 885k |
|---|
<gh_stars>100-1000
import click
import json, cPickle
import requests, zipfile
import os, glob
from music21 import analysis, converter, corpus, meter
from music21.note import Note
from constants import *
@click.group()
def datasets():
"""Constructs various datasets."""
pass
@click.command()
@click.option('-... |
<reponame>mail2nsrajesh/oslo.service
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wit... |
<filename>dbe/issues/views.py
from pprint import pprint
from django.http import HttpResponse
from django.core.urlresolvers import reverse, reverse_lazy
from django.contrib.admin.views.decorators import staff_member_required
from django.forms import forms
from django.core.mail import send_mail
from shared.utils import ... |
from src.evaluation.gnn_evaluation_module import eval_gnn
from src.models.gat_models import MonoGAT#, BiGAT, TriGAT
from src.models.rgcn_models import MonoRGCN, RGCN2
from src.models.appnp_model import MonoAPPNPModel
from src.models.multi_layered_model import MonoModel#, BiModel, TriModel
from torch_geometric.nn import... |
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
import config
import utils
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import plot_utils
import numpy as np
import pandas as pd
import scipy.spatial.distance as ssd
impo... |
import json
import re
import pprint
import os
import argparse
import pandas as pd
import random
import numpy as np
from tqdm import tqdm
SQUAD_TEST_HEADS = ['where were', 'what political', 'what religion', 'why did', 'what type', 'what language', 'who had', 'what percentage', 'what can', 'how much']
def strip(sent):... |
<filename>tests/test_forward.py
import os
import sys
import numpy as np
import torch
sys.path.insert(0, os.path.abspath('../retina'))
def _demo_mm_inputs(
input_shape=(1, 3, 300, 300), num_items=None, num_classes=10):
"""
Create a superset of inputs needed to run test or train batches.
Args:
... |
"""
Unit tests for memory networks.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from texar.tf.modules.memory.memory_network import MemNetRNNLike
from texar.tf import context
# pylint: disable=no-member, too-many-locals, too... |
#!/usr/local/bin/python3
# encoding: utf-8
'''
webcamloop -- get image from cam and ftp it, loop
see configuration file
@author: <EMAIL>
@copyright: 2020 werner.fuerst
@license: CC0
@contact: <EMAIL>
@deffield updated: Updated
'''
__all__ = []
__version__ = 0.1
__date__ = '2020-02-21'
__updated__ = ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os.path
import logging
import datetime
import markdown
from dateutil.parser import *
from dateutil.relativedelta import *
import trialcondition
import trialmedication
import trialallergy
import triallab
import trialmutation
import clinicaltrials.jsondocument.jsond... |
<reponame>zouguojian/pollutant-prediction
# -- coding: utf-8 --
import tensorflow as tf
import numpy as np
import argparse
from spatial_temporal_model.hyparameter import parameter
import pandas as pd
class DataIterator():
def __init__(self,
site_id=0,
site_num=41,
... |
from implementation.hospitalViejo import Hospital
import numpy as np
from implementation.optimizer.AllocationOptimizerHeuristica import AllocationOptimizer
#from implementation.optimizer.AllocationOptimizerGoalProgramming3 import AllocationOptimizer
#from implementation.optimizer.AllocationOptimizerNonGoal import Alloc... |
# Licensed under an MIT open source license - see LICENSE
from __future__ import print_function, absolute_import, division
import astropy.units as u
import numpy as np
from astropy.io import fits
from warnings import warn
try:
from radio_beam import Beam, NoBeamException
RADIO_BEAM_INSTALL = True
except Impo... |
<reponame>infosecsecurity/OSPTF<filename>RVS/TerminalEmulator.py
# Copyright (c) 2012-2015 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your... |
import hashlib
import mock
import pytest
from rest_framework import status
from rest_framework.reverse import reverse
from apps.mood_groups.models import UserMoodGroup, MoodGroup
from apps.moods.models import UserMood, Mood
from apps.users.models import User
from tests.request_helper import pytest_request
MOOD_FIELD... |
import configurations
from eval import Evaluate
from utils import Vectorizer, headline2abstractdataset, load_embeddings
from seq2seq.fb_seq2seq import FbSeq2seq
from seq2seq.EncoderRNN import EncoderRNN
from seq2seq.DecoderRNNFB import DecoderRNNFB
from seq2seq.ContextEncoder import ContextEncoder
import torch
import t... |
<reponame>SanketSinha10/Datalake-Pipeline<filename>src/datawarehousing/change_data_capture.py
import hashlib
from pyspark.sql import SparkSession, DataFrame, Window
from pyspark.sql.functions import col, row_number
from utils.Utilities import is_null_or_empty
def append_audit_attributes_to_xml(file, file_contents, ... |
<filename>bands_inspect/_cli.py
# -*- coding: utf-8 -*-
# (c) 2017-2019, ETH Zurich, Institut fuer Theoretische Physik
# Author: <NAME> <<EMAIL>>
"""
Defines the bands-inspect CLI.
"""
import click
import numpy as np
import matplotlib.pyplot as plt
from . import io
from . import plot
from .compare import difference ... |
"""
File: darc_evaluator.py
Author: <NAME>
Email: <EMAIL>
Github: https://github.com/Drayer34
Description: Evaluator used in the context of the DARC (Data Anonymization and Re-identification
Competition).
"""
import os
import logging
import pandas as pd
import redis
try:
from darc_core.metrics import Metrics, ut... |
<reponame>caleb15/mocurly
"""Classes used to simulate recurly resources and endpoints
Each endpoint class will define the CRUD interface into the resource.
"""
from datetime import datetime
import recurly
import six
import random
import string
import dateutil.relativedelta
import dateutil.parser
from dateutil.tz impo... |
<filename>ShowVerticalMetrics.glyphsReporter/Contents/Resources/plugin.py
# encoding: utf-8
from __future__ import division, print_function, unicode_literals
###########################################################################################################
#
#
# Reporter Plugin
#
# Read the docs:
# https://gi... |
import random
import shutil
import cv2
import numpy as np
import os
from subprocess import call, STDOUT
global count
def frame_extraction(video):
if not os.path.exists("./tmp"):
os.makedirs("tmp")
temp_folder = "./tmp"
vidcap = cv2.VideoCapture(video)
count = 0
while True:
succe... |
"""Zhang Gradient Projection Debiasing Baseline Model."""
from __future__ import annotations
from typing import NamedTuple, cast
import ethicml as em
from kit import implements
from kit.torch import CrossEntropyLoss, TrainingMode
import pandas as pd
import pytorch_lightning as pl
from pytorch_lightning.utilities.types... |
import radical.utils
import saga
import os
import random
from pandaharvester.harvestercore import core_utils
from pandaharvester.harvestercore.plugin_base import PluginBase
from pandaharvester.harvestercore.work_spec import WorkSpec as ws
# setup base logger
baseLogger = core_utils.setup_logger('saga_submitter')
# S... |
# -*- coding: utf-8 -*-
import os
import time
from datetime import datetime
import logging
from scipy.sparse import lil_matrix
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squar... |
################################################################################
# populate_obs_instrument_GB_occ.py
#
# Routines to populate fields specific to ground-based instruments.
################################################################################
import numpy as np
import julian
import pdsfile
f... |
"""
Backend for django cache
"""
import socket
from functools import wraps
from django.core.cache import InvalidCacheBackendError
from django.core.cache.backends.memcached import PyLibMCCache
from .cluster_utils import get_cluster_info
def invalidate_cache_after_error(f):
"""
catch any exception and invalidat... |
#!/usr/bin/env python3
# blinkt/display-led-test.py 3.374.570 2019-01-23T22:16:37.530539-06:00 (CST) https://github.com/BradleyA/pi-display uadmin six-rpi3b.cptx86.com 3.373
# blinkt/display-led-test.py update with --> production standard 1-5 include Copyright notice close #67
# blinkt/display-led-test.py... |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, unicode_literals, print_function)
"""
==============================
PyOrganism Regulatory Elements
==============================
:Authors:
<NAME>
:Date:
2012-06-08
:Copyright:
Copyright(c) 2012 Jacobs University of Bremen. All rights re... |
<filename>kcs/steering/__main__.py
"""Calculate the "steering" table
Calculates the ranges for a given dataset, where it matches the CMIP
distribution for yearly temperature change for a given scenario(s).
For example, if the scenario is 90% (percentile), 2050, it will yield
a year-range for the given input data, whe... |
import find_mxnet
import argparse,logging,os
import mxnet as mx
from symbol_resnet import resnet
import socket
import getpass
def multi_factor_scheduler(begin_epoch, epoch_size, step=[60, 75, 90], factor=0.1):
step_ = [epoch_size * (x-begin_epoch) for x in step if x-begin_epoch > 0]
return mx.lr_sched... |
<reponame>rummanwaqar/rcommander-core<gh_stars>1-10
import re
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from nodebox.gui.qt.ValueLadder import ValueLadder
from nodebox.util.PyFontify import fontify
whiteRE = re.compile(r"[ \t]+")
commentRE = re.compile(r"[ \t]*(#)")
def findWhitespace(s, pos=0... |
"""
@author: <NAME>, The University of Sheffield, <EMAIL>
References
----------
<NAME>., <NAME>., <NAME>. and <NAME>., 2020. Side Information Dependence as a
Regulariser for Analyzing Human Brain Conditions across Cognitive Experiments.
In Proceedings of the 34th AAAI Conference on Artificial Intelligence (AAAI 2020).... |
#
# Created by <NAME> on 29/December/2019
#
import time
import math
import requests
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import xml.etree.ElementTree as ET
driver_path = "D:\Program Files\PycharmProjects\Trendyol-Scraper-Crawler\chromedriver.exe"... |
<filename>localstack/services/dynamodbstreams/dynamodbstreams_api.py
import json
import uuid
import hashlib
from flask import Flask, jsonify, request, make_response
from localstack.services import generic_proxy
from localstack.utils.aws import aws_stack
from localstack.utils.common import to_str, to_bytes
APP_NAME = '... |
import os
from collections import defaultdict
full_names = {
'AR': 'Arabic',
'BG': 'Bulgarian',
'CH': 'Mandarin',
'CH_char': 'Mandarin',
'EN': 'English',
'WU': 'Cantonese',
'CR': 'Croatian',
... |
#==============================================================================
#
# Program: ParaView
# Module: extract_selection.py
#
# Copyright (c) Kitware, Inc.
# All rights reserved.
# See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
#
# This software is distributed WITHO... |
<reponame>mkazin/SubnauticaMap<gh_stars>0
import unittest
from mongoengine import connect
from controller.user_data import UserDataController
from model.map_data import Marker
from model.player_data import PlayerData
class UserDataControllerTestCase(unittest.TestCase):
db = None
player_singleton = None
... |
<filename>util/test/chpl_launchcmd.py
#!/usr/bin/env python
"""Run Chapel test (execution only) inside pbs or slurm batch job.
The job name is set from the environment variable CHPL_LAUNCHCMD_NAME_PREFIX
(defaulting to Chpl) and the name of the program being executing. For example,
running `chpl_launchcmd.py ./hello`... |
# Copyright 2018 DeepMind Technologies Limited. 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 ... |
<reponame>chen1i/fedlearner
import datetime
import logging
import os
INDEX_TYPE = ('metrics', 'data_join', 'raw_data')
# YYYY-MM-DD'T'hh:mm:ss.SSSSSSZ
_es_datetime_format = 'strict_date_optional_time'
# WARNING: MAPPINGS BELOW ARE COMPATIBILITY MEASURES AND SHOULD NOT BE MODIFIED.
RAW_DATA_MAPPINGS = {
"dynamic": ... |
<gh_stars>0
"""
Algolia - Slack slash command (+ django webhook) Integration
1. slack에서 /algolia [keyword]를 검색하면 algolia index에서 해당 값이 포함된
검색 결과를 리턴해줌.
(2. slack app내의 "Interactivity & Shortcuts"를 사용해서 django webhook endpoint에
trending keyword를 등록해주는 workflow 완성 - 코드는 backend 서버에 포함)
"""
import os
import requests
fro... |
<reponame>dendisuhubdy/kaggle-rsna<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 21 18:01:28 2019
Models
"""
from torch import nn
import pytorch_retinanet.dataloader
import pytorch_retinanet.model
import pytorch_retinanet.model_incresv2
import pytorch_retinanet.model_nasnet_mobile
import pytorch_r... |
<gh_stars>1-10
from __future__ import absolute_import
from collections import namedtuple
from fnmatch import fnmatch
from parsimonious.grammar import Grammar, NodeVisitor
from parsimonious.exceptions import ParseError # noqa
from sentry.utils.safe import get_path
__all__ = ('parse_rules', 'dump_schema', 'load_schema... |
import datetime
from werkzeug.exceptions import BadRequest
from server.models import db, Assignment, Group, GroupAction, User
from tests import OkTestCase
class TestGroup(OkTestCase):
def setUp(self):
super(TestGroup, self).setUp()
self.setup_course()
def test_invite(self):
Group.inv... |
#!/opt/homebrew/bin/python3.9
##
## Icebreaker and IceSugar RSMB5 project - RV32I for Lattice iCE40
## With complete open-source toolchain flow using:
## -> yosys
## -> icarus verilog
## -> icestorm project
##
## Tests are written in several languages
## -> Systemverilog Pure Testbench (Vivado)
## -> UVM testbench ... |
<filename>setup.py
#!/usr/bin/env python
from distutils.command.build import build
from distutils.spawn import find_executable
import sys
import os
import subprocess
import errno
from version import get_version
KPROCESSOR = r"""
_ _____
| | | __ \ ... |
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.VerticalPanel import VerticalPanel
from FlowPlayer import Player, Configuration, ControlsPlugin, ContentPlugin, Clip
from pyjamas import log
class FlowPlayerExample:
def onModuleLoad(self):
self.panel = VerticalPanel()
self.player = ... |
<filename>butcher/rubygems.py
"""Manage rubygems for butcher's internal use.
Much like the rest of Butcher, this is fairly gross.
"""
import os
import subprocess
from twitter.common import app
from twitter.common import log
from butcher import error
app.add_option(
'--gemdir', dest='gem_basedir', default='/var/l... |
<reponame>coderzh/pywasm3
#!/usr/bin/env python3
import os, struct, time
import multiprocessing as mp
import wasm3
import numpy
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "true"
# Set to 44100 for better quality, or 11025 for faster computation
sample_rate = 22050
duration = 164000
buffersize = 128*4
prebuffer = 1... |
<reponame>kallif003/Sistema-Delivery
def sql_info_pedido(*args):
try:
data = args[0]
cursor = args[1]
telaInfoPedido = args[2]
QtWidgets = args[3]
id2 = int(telaInfoPedido.codigo.text())
listaPedido = []
sql = ("select id, telefone, nome, cep, endereco, num... |
<reponame>VirtualL/home-assistant<filename>homeassistant/components/snmp/device_tracker.py
"""Support for fetching WiFi associations through SNMP."""
import binascii
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.device_tracker import (
D... |
class Instruccion:
'''This is an abstract class'''
class CrearBD(Instruccion) :
'''
Esta clase representa la funcion para crear una base de datos solo recibe el nombre de la BD
'''
def __init__(self,reemplazar,verificacion,nombre, propietario, modo) :
self.reemplazar = reemplazar
... |
<reponame>biyiklioglu/container-service-extension
# container-service-extension
# Copyright (c) 2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
"""
CSE client tests to test validity and functionality of `vcd cse` CLI commands.
Tests these following commands:
$ vcd cse version
$ vcd cse ... |
import numpy as np
import glob
import time
import cv2
import os
import signal
import argparse
import matplotlib as mpl
# For plotting without a screen
mpl.use('Agg')
import matplotlib.pyplot as plt
from multiprocessing import Pool
from vehicle_detector import VehicleDetector
from multiprocessing import Pool
from utils... |
<gh_stars>0
from models import Organisation
from datetime import datetime
import csv
filepath = r'E:\db44.csv'
filepath_write = r'E:\db5_new.csv'
arr1 = []
arr2 = []
max_coloumn = 22
dictionary = {}
class Record:
def __init__(self, arr):
self.reg_number = arr[0]
self.reg_date = arr[1]
self... |
<filename>old/gridsearchXGboostR.py<gh_stars>10-100
# The process of performing random search with cross validation is:
# 1. Set up a grid of hyperparameters to evaluate
# 2. Randomly sample a combination of hyperparameters
# 3. Create a model with the selected combination
# 4. Evaluate the model using cross validation... |
"""
Copyright 2015-2019, Institute for Systems Biology
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 ... |
<reponame>awslabs/aws-crt-builder<filename>tests/test_project.py
import os
import unittest
import unittest.mock as mock
from builder.core.project import Project
from builder.core.spec import BuildSpec
from builder.actions.script import Script
import builder.core.api # force API to load and expose the virtual module
... |
<reponame>tungstenfabric/tf-charms
#!/usr/bin/env python3
import json
import sys
import yaml
from charmhelpers.core.hookenv import (
Hooks,
UnregisteredHookError,
config,
log,
is_leader,
leader_get,
leader_set,
relation_id,
relation_get,
relation_ids,
related_units,
stat... |
<reponame>aprilnovak/openmc
from collections.abc import Mapping
from ctypes import c_int, c_int32, c_double, c_char_p, POINTER
from weakref import WeakValueDictionary
import numpy as np
from numpy.ctypeslib import as_array
import scipy.stats
from openmc.data.reaction import REACTION_NAME
from . import _dll, Nuclide
f... |
#!/usr/bin/env python
import asyncio
import sys
request_1 = """Content-Length: 4642
{
"jsonrpc": "2.0",
"id": 0,
"method": "initialize",
"params": {
"processId": 3406,
"rootPath": "/home/eckhart/Entwicklung/DHParser/examples/json",
"rootUri": "file:///home/eckhart/Entwicklung/DHParser/examples/... |
<reponame>cbwang2016/PKUAutoElective2<gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# filename: main.py
# modified: 2019-09-11
import os
import time
from optparse import OptionParser
from multiprocessing import Process, Manager, Queue
from autoelective import __version__, __date__
from autoelective.co... |
<reponame>mt-upc/SHAS
import argparse
from pathlib import Path
import yaml
def create_xml_content(
segmentation: list[dict],
lang_text: list[str],
split: str,
src_lang: str,
tgt_lang: str,
is_src: bool,
) -> list[str]:
"""
Args:
segmentation (list): content of the yaml file
... |
#!/usr/bin/env python
u"""
ecco_monthly_harmonics.py
Written by <NAME> (10/2021)
Reads monthly ECCO ocean bottom pressure anomalies and converts to
spherical harmonic coefficients
INPUTS:
ECCO Near Real-Time models
kf080i: Kalman filter analysis
https://ecco.jpl.nasa.gov/drive/files/NearRea... |
<reponame>hpcaitech/ColossalAI-Examples
import math
import torch
from colossalai import nn as col_nn
from colossalai.registry import LAYERS, MODELS
from torch import dtype, nn
__all__ = [
'mixer_s32',
'mixer_s16',
'mixer_b32',
'mixer_b16',
'mixer_l32',
'mixer_l16',
'mixer_h14',
]
_init_rul... |
<reponame>DarthReca/AML-Project
import argparse
from typing import Tuple
import torch
from optimizer_helper import get_optim_and_scheduler
from torch import nn
from torch.utils.data import DataLoader
from resnet import ResNet, Classifier
import os
#### Implement Step1
def _do_epoch(
args: argparse.Namespace,
... |
<filename>data/external/repositories_2to3/196684/Kaggle_xBle-master/model_library.py
import pandas as pd
import numpy as np
import pickle as pickle
import os
from sklearn import preprocessing
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import TruncatedSVD
from sklearn.ensemble i... |
<filename>examples/example_CascadedEmbeddings.py
# The testing module requires faiss
# So if you don't have that, then this import will break
from pytorch_metric_learning import losses, miners, samplers, trainers, testers
import pytorch_metric_learning.utils.logging_presets as logging_presets
import numpy as np
fr... |
from .. import util
import duo_client.admin
from .base import TestAdmin
class TestAdmins(TestAdmin):
# Uses underlying paging
def test_get_admins(self):
response = self.client_list.get_admins()
response = response[0]
self.assertEqual(response['method'], 'GET')
(uri, args) = res... |
<gh_stars>0
import sys
import tempfile
import hashlib
import os
from shutil import rmtree, copy2
from bioconda_utils.recipe import Recipe as bioconda_utils_Recipe
from birg.filesystem import Filesystem
from birg.buildscript import BuildScript
from birg.recipe import Recipe
from birg.utils import (
copytree,
c... |
<gh_stars>10-100
"""
Set of functions used to parse and transform email headers.
"""
from __future__ import unicode_literals
import datetime
import email
import chardet
import six
from django.utils import timezone
from django.utils.html import escape
from django.utils.formats import date_format
from modoboa.lib.em... |
<filename>ds_project/yolov2/losses.py
import math
import torch
import torch.nn as nn
from utils import bbox_ious
'''
Code was taken from https://github.com/uvipen/Yolo-v2-pytorch
'''
class YoloLoss(nn.modules.loss._Loss):
def __init__(self, num_classes, anchors, device, reduction=32, coord_scale=1.0, noobject_sca... |
#!/bin/python3
from binance.client import Client
from datetime import datetime, timezone
import os
# load in settings,
# load in pot
# get 4hour data from binance
# See if any buy/sells need to be placed
# execute transactions
# save transactions to separate file
# save pot file
## Pot concept :- When saving pot, if a... |
# Copyright 2016 The Johns Hopkins University Applied Physics Laboratory
#
# 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... |
import pytest
import torch
from torch.autograd import gradcheck
from torch.testing import assert_allclose
import kornia.geometry.epipolar as epi
import test_common as utils
class TestEssentialFromFundamental:
def test_smoke(self, device, dtype):
F_mat = torch.rand(1, 3, 3, device=device, dtype=dtype)
... |
import unittest
import rpy3.rinterface as rinterface
import rpy3.rlike.container as rlc
rinterface.initr()
class SexpClosureTestCase(unittest.TestCase):
def setUp(self):
self.console = rinterface.get_writeconsole()
def noconsole(x):
pass
rinterface.set_writeconsole(noconsole... |
from flask_pymongo import PyMongo
from flask import Flask, flash, render_template, redirect, request, url_for, \
session, flash, Markup
from bson.objectid import ObjectId
from werkzeug.security import generate_password_hash, check_password_hash
import os
from os import path
if path.exists("env.py"):
imp... |
<filename>src/fattoush/driver/sauce.py
# (c) 2014 Mind Candy Ltd. All Rights Reserved.
# Licensed under the MIT License; you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://opensource.org/licenses/MIT.
"""
Interface between Sauce Labs and lettuce driver
"""... |
<reponame>HARDROCO/WHO-MAIL-ME<filename>src/WMM_visual.py
# ##### Coding: utf-8 ####
# See README.md for information and usage about the project
# Copyright (c) 2020 HARDROCO
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the MIT A short and simple permissive li... |
from datetime import datetime
from re import sub
from decimal import Decimal
from json_handler import JsonHandler
import writers
jh = JsonHandler()
LEAGUES_DATA = jh.load_leagues()
dt = datetime
def league_id_to_league_name(league_id):
for leagues in LEAGUES_DATA:
league_name = list(leagues.values())[1... |
#!/usr/bin/env python3
# Copyright (c) 2018-2021 The MobileCoin Foundation
"""
The purpose of this strategy is to test client behavior with a mobilecoind wallet.
Example setup and usage:
```
python3 test_client.py --key-dir ../../../target/sample_data/master/keys/
```
"""
import argparse
import concurrent.future... |
"""Pytorch dataset object that loads MNIST dataset as bags."""
import numpy as np
import torch
import torch.utils.data as data_utils
from torchvision import datasets, transforms
class MnistBags(data_utils.Dataset):
def __init__(self, target_number=9, mean_bag_length=10, var_bag_length=2, num_bag=250, seed=1, tra... |
<filename>reports/tests.py
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
"""
Reports: test suites
"""
from django.test import TestCase
from django.test.client import Client
from django.core.urlresolvers import reverse
from django.contrib.auth.models im... |
<reponame>pulumi/pulumi-aws-native<gh_stars>10-100
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Seque... |
<filename>src/day13.py
from typing import NamedTuple, Set, List
import pytest
class Point(NamedTuple):
x: int
y: int
@classmethod
def from_string(cls, input_string: str) -> "Point":
[x, y] = input_string.strip().split(",")
return Point(x=int(x), y=int(y))
@pytest.mark.parametrize(
... |
# Created byMartin.cz
# Copyright (c) <NAME>. All rights reserved.
import decimal
from .. enums import *
from .. properties import *
from . utils import *
from . formatter import Formatter
class TimeFormatter(Formatter):
"""
This formatter tool formats given time in seconds into reasonable time
represe... |
<reponame>mjirik/cellid
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect
from django.contrib.auth.forms import UserCreationForm
# Imaginary function to handle an uploaded file.
# from .imageprocessing import handle_uploaded_file
from dja... |
<reponame>lupino3/jupyter-Kqlmagic<gh_stars>0
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------------... |
import numbers
import numpy
from Calculator import Calculator
from Function import Function
from Operator import Operator
from Queue import Queue
from Stack import Stack
class TestHandler:
_test_items = ["firstItem", "secondItem", "thirdItem", "lastItem"]
def run(self):
self._test_queue()
s... |
<reponame>lee14257/delphi-epidata-py
from dataclasses import dataclass, field
from enum import Enum
from datetime import date
from urllib.parse import urlencode
from typing import (
Any,
Dict,
Final,
Generic,
Iterable,
List,
Mapping,
Optional,
Sequence,
Tuple,
TypeVar,
Ty... |
import tensorflow as tf
from tensorflow.contrib.layers import flatten
import pickle
from tensorflow.examples.tutorials.mnist import input_data
import random
import numpy as np
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
import cv2
import glob
import matplotlib.image as mpimg
i... |
# !/usr/bin/env/python3
# Copyright (c) Facebook, Inc. and its affiliates.
# 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 ... |
<reponame>smoe/SSUsearch
#! /usr/bin/env python
# corrent ssu rRNA gene copy number based on the taxon copy number table from
# copyrigter.
# by gjr; 080614
"""
Corrent ssu rRNA gene copy number based on the taxon copy number table from
copyrigter.
% python copyrighter.py <copy.table> <sample.gg.taxonomy> <outfile... |
import socket
import sys
import thread
import Tkinter as tk
from time import sleep
from protocol import *
LINE = "----------------------------------------"
class ChatRoomClient():
def __init__(self, username):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.username = username
... |
#!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
import rospy
import math
import numpy as np
from robot.robot import Robot
from robot.obstacle import Obstacle
ORBIT_KP_V = -0.5
ORBIT_KP_W = 4.2
#REMAINING_RANGE_V = 20
#REMAINING_RANGE_YAW = 7
class Behavior(Robot,Obstacle):
def __init_... |
import pyrr
from PyFlow.Core import(
FunctionLibraryBase,
IMPLEMENT_NODE
)
from PyFlow.Core.Common import *
class QuatLib(FunctionLibraryBase):
'''doc string for QuatLib'''
def __init__(self,packageName):
super(QuatLib, self).__init__(packageName)
@staticmethod
@IMPLEMENT_NODE(returns... |
'''
Date: 12-17-2018
Problem description:
===================
This problem was asked by Google.
Given an array of integers and a number k, where 1 <= k <= length of the array,
compute the maximum values of each subarray of length k.
For example, given array = [10, 5, 2, 7, 8, 7] and k = 3,
we should get: [10, 7, 8,... |
# Copyright (c) <NAME>
# 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... |
#! /usr/bin/env python
"""Script to generate the raw sub-package APIs
Basically just drives OpenGLGenerator with options to produce
the various modules we want...
"""
import os, sys, logging, re, compileall
import openglgenerator
from OpenGL import platform
try:
from OpenGL import GL
except (ImportError, Attribute... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.