content stringlengths 5 1.05M |
|---|
import json
from job.model_template.utils import ModelTemplateDriver
DEBUG = False
class DeeFMTemplateDriver(ModelTemplateDriver):
def __init__(self, output_file=None, args=None, local=False):
super(DeeFMTemplateDriver, self).__init__("DeepFM model template" + ("(debuging)" if DEBUG else ""),
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# __coconut_hash__ = 0x412948c
# Compiled with Coconut version 1.5.0-post_dev62 [Fish License]
# Coconut Header: -------------------------------------------------------------
from __future__ import print_function, absolute_import, unicode_literals, division
import sys as... |
"""
Feed File which implements the Hiven Feed type, which should contain social
media information of a specific user and their linked acccounts.
---
Under MIT License
Copyright © 2020 - 2021 Luna Klatzer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated doc... |
from .flownets import FlowNetS
__all__ = ['FlowNetS']
|
import torch
import torch.distributed as dist
class GatherLayer(torch.autograd.Function):
'''Gather tensors from all process, supporting backward propagation.
'''
@staticmethod
def forward(ctx, input):
ctx.save_for_backward(input)
output = [torch.zeros_like(input) \
... |
from abc import ABC
from typing import Callable, Dict, List, Optional, Sequence
from guardpost.authentication import Identity
class AuthorizationError(Exception):
pass
class AuthorizationConfigurationError(Exception):
pass
class PolicyNotFoundError(AuthorizationConfigurationError, RuntimeError):
def ... |
import warnings
import numpy as np
from tqdm import tqdm
from noise import pnoise3, snoise3
import vtk
from vtk.util.numpy_support import numpy_to_vtk
from vtk.numpy_interface import dataset_adapter as dsa
def add_noise_to_sphere(poly_data, octaves, offset=0, scale=0.5):
"""
Expects sphere with radius 1 cent... |
import logging
import os
import sys
from logging import fatal, debug, info, warning
from os import path
from . import utils
from .argument_parser import build_argument_parser
from .metadata_parser import MetadataParser
from .settings import Settings
def main():
# Read arguments
argument_parser = build_argume... |
import click
import questionary as q
import docker
import os
import time
import subprocess
from threading import Thread
from functools import wraps
from colorama import (Fore, Style)
from sqlalchemy.engine.url import make_url
from vantage6.common import (info, warning, error, debug as debug_msg,
... |
from django.conf.urls import url, include
from rest_framework.urlpatterns import format_suffix_patterns
from . import views
urlpatterns = [
url(r'^rides/$', views.RideList.as_view(), name='ride_list'),
url(r'^rides/(?P<pk>\d+)/$', views.RideDetail.as_view(), name='ride_detail'),
url(r'^users/$', views.Us... |
#!/usr/bin/env python
# Demonstration GET friendships/lookup
# See https://dev.twitter.com/rest/reference/get/friendships/lookup
from secret import twitter_instance
from json import dump
import sys
tw = twitter_instance()
# [1]
ids = ','.join((str(i) for i in (577367985, 1220723053, 1288619659)))
response = tw.frie... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.BelongGreenMerchantInfo import BelongGreenMerchantInfo
class AlipayCommerceGreenItemenergySendModel(object):
def __init__(self):
self._alipay_uid = None
self.... |
import random
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.utils.data
import copy
from MTLCNN_single import MTLCNN_single
from MultitaskClassifier import MultitaskClassifier
from Util import Util
class Train_Classifier:
def train_classifier(self, train_arguments... |
"""
Name: jupyter.py
Purpose: Installs a jupyter notebook
Author: PNDA team
Created: 03/10/2016
Copyright (c) 2016 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Apache License, Version 2.0 (the "License").
You may obtain a copy of the License at http://www.apach... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" test_hdf5xltek.py
Description:
"""
# Package Header #
from src.hdf5objects.__header__ import *
# Header #
__author__ = __author__
__credits__ = __credits__
__maintainer__ = __maintainer__
__email__ = __email__
# Imports #
# Standard Libraries #
import datetime
import... |
"""
Provides basic logging functionality
"""
import logging
import inspect
from datetime import datetime
import os, sys
import traceback
class Logger:
"""
generic logger class
"""
def __init__(self, logname=None, project_name=None):
"""
:param level:
:param project_name: if pr... |
#!/usr/bin/env python3
import os
import unittest
import numpy as np
import torch
from pytorch_translate import rnn # noqa
from pytorch_translate import train
from pytorch_translate.tasks import pytorch_translate_task as tasks
from pytorch_translate.test import utils as test_utils
class TestRNNModel(unittest.TestCa... |
# -*- coding: utf-8 -*-
"""
CRUD operation for fan model
"""
import database
from DB import exception
from DB.models import Fan
from DB.api import dbutils as utils
RESP_FIELDS = ['id', 'resource', 'status', 'created_at']
SRC_EXISTED_FIELD = {
'id': 'id',
# 'uuid': 'uuid',
'status': 'status',
'resource_... |
#!/usr/bin/env python
from random import choice
temperaments = ["sanguine", "choleric", "melancholic", "phlegmatic"]
personalities = ["introvert", "extrovert"]
# Based on the former job will be the starting inventory
former_jobs = ["a fireman", "a policeman", "a medic", "unemployed", "a doctor", "a demolitions expert... |
import os
import traceback
from concurrent.futures import CancelledError
import numpy as np
import cv2
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph as pg
import pyqtgraph.opengl as gl
import sklearn.cluster
from pebble import concurrent
from mss import mss
from src.constants import *
from src.cv_img impo... |
#!/usr/bin/env python
import argparse
from Toggl.togglApi import getTogglReport
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Obtain report from Toggl.')
parser.add_argument("--toggl-token", "-tt", help="Set Toggl token.")
parser.add_argument("--toggl-workspace", "-w", help="S... |
"""
Level generator utilities.
"""
import weakref
from math import floor
from random import randrange, choice
from .blt.nice_terminal import terminal
from .geom import Point, Rect, Size
from .draw import draw_rect
class BSPNode:
"""
Node in a binary space partitioning tree
.. py:attribute:: rect
... |
from shortcodes import Shortcode
# Allowed values for position options
ALLOWED_POSITION = ['right', 'left']
class BevelShortcode(Shortcode):
name = 'bevel'
same_tag_closes = True
standalone = True
render_empty = True
template = 'views/partials/bevel.j2'
def _get_position(self, options):
... |
# Generated by Django 4.0.3 on 2022-03-15 20:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0007_alter_category_options'),
]
operations = [
migrations.AlterField(
model_name='tick... |
import random
import math
def prime_factor_generator(n):
yield 2
for i in range(3, int(math.sqrt(n)) + 1, 2):
yield i
def prime_factors(n):
for i in prime_factor_generator(n):
if n % i == 0:
yield i
while True:
n //= i
if n % i != 0:
... |
def largest_palindrome_product(n):
up_digits = "1" + n * "0"
low_digits = "1" + (n-1) * "0"
num_up_digits = int(up_digits)
num_low_digits = int(low_digits)
x = range(num_low_digits, num_up_digits)
largest_num = 0
for i in x:
for j in x:
multi = i * j
... |
# 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... |
import sys
from importlib import import_module
from bumps.pymcfit import PyMCProblem
if len(sys.argv) != 2:
raise ValueError("Expected name of pymc file containing a model")
module =sys.argv[1]
__name__ = module.split('.')[-1]
model = import_module(module)
problem = PyMCProblem(model)
|
#!/usr/bin/env python
import numpy as np
from scipy.misc import imread, imresize
import matplotlib.pyplot as plt
import cv2
import scipy.io
import scipy.stats as st
from scipy import ndimage as ndi
from skimage import feature
from skimage.morphology import skeletonize
import pdb
def gkern(kernlen=21, nsig=3):
... |
"""Test a hydrogen-like atom."""
import jax
import numpy as np
import pytest
import vmcnet.examples.hydrogen_like_atom as hla
from vmcnet.mcmc.simple_position_amplitude import make_simple_position_amplitude_data
from .sgd_train import sgd_vmc_loop_with_logging
from .kfac_train import kfac_vmc_loop_with_logging
def ... |
from django.conf import settings
from cybox.objects.address_object import Address
from cybox.objects.uri_object import URI
cfg = settings.ACTIVE_CONFIG
LOCAL_ALIAS = cfg.by_key('company_alias')
OBJECT_FIELDS = {
'AddressObjectType': [['address_value']],
'DomainNameObjectType': [['value']],
'EmailMessageOb... |
# -*- coding: utf-8 -*-
"""
@Author: oisc <oisc@outlook.com>
@Date: 2018/5/4
@Description:
"""
import math
from collections import namedtuple
from copy import copy
from interface import Annotator
from transition import Session
from transition.shiftreduce import SRTransition, SRConfiguration
class SPINNTreeBuilder(A... |
import requests
import StringIO
import csv
import urllib
import json
import datetime
import md5
from time import sleep
from limit import Limit
from source_iterator import SourceIterator
from source_row_manager import SourceRowManager
class SourceReader:
def __init__(self, date, product, catalogue, url, index, lo... |
"""
A Python module for antenna array analysis
----------
AntArray - Antenna Array Analysis Module
Copyright (C) 2018 - 2019 Zhengyu Peng
E-mail: zpeng.me@gmail.com
Website: https://zpeng.me
` `
-:. -#:
-//:. -###:
-////:. ... |
# importacion de librerias
# constantes
# funciones y metodos
def es_primo(numero):
primo = True
for n in range(2, numero, 1):
if numero % n ==0:
primo = False
break
return primo
# mi programa principal
# ingreso de numero por teclado
numero = int(input('Ingrese un num... |
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8:noet:tabstop=4:softtabstop=4:shiftwidth=8:expandtab
""" python3 class """
# Copyright (c) 2010 - 2020, © Badassops LLC / Luc Suryo
# All rights reserved.
# BSD 3-Clause License : http://www.freebsd.org/copyright/freebsd-license.html
from pprint import PrettyPrin... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2018 Taha Emre Demirkol
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights... |
from itertools import combinations
class Edge:
def __init__(self, frm, to, weight):
self.from_vertex = frm
self.to_vertex = to
self.dist = weight
def _get_edges(graph):
edges = []
for a, b in combinations(range(len(graph)), 2):
if graph[a][b]:
edges.appen... |
# -*- coding: utf-8 -*-
# File generated according to Generator/ClassesRef/Simulation/OPslip.csv
# WARNING! All changes made in this file will be lost!
"""Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Simulation/OPslip
"""
from os import linesep
from sys import getsizeo... |
#!C:/Python35/python.exe
# -*- coding: UTF-8 -*-
#
# belmih 2016
#
import threading
import queue
import argparse
import os
import time
import zipfile
import shutil
import xml.etree.cElementTree as ET
import csv
abspath = os.path.abspath(__file__)
workdir = os.path.dirname(abspath)
os.chdir(workdir)
CSV_ID_LEVEL = "... |
import itertools as it, operator as op, functools as ft
from collections import ChainMap, Mapping, OrderedDict, defaultdict
from pathlib import Path
from pprint import pprint
import os, sys, unittest, types, datetime, re, math
import tempfile, warnings, shutil, zipfile
import yaml # PyYAML module is required for tests... |
import aredis
from ddtrace import config
from ddtrace.vendor import wrapt
from ...internal.utils.wrappers import unwrap
from ...pin import Pin
from ..redis.util import _trace_redis_cmd
from ..redis.util import _trace_redis_execute_pipeline
from ..redis.util import format_command_args
config._add("aredis", dict(_def... |
import uuid
import datetime
import typing
from abc import ABC, abstractmethod
from sensory_cloud.config import Config
from sensory_cloud.services.crypto_service import CryptoService
import sensory_cloud.generated.common.common_pb2 as common_pb2
import sensory_cloud.generated.oauth.oauth_pb2_grpc as oauth_pb2_grpc
imp... |
import IPython.nbformat.v4 as nbformat
from IPython.nbformat import write as nbwrite
import numpy as np
def format_line(line):
"""
Format a line of Matlab into either a markdown line or a code line.
Parameters
----------
line : str
The line of code to be formatted. Formatting occurs accor... |
import os
import sys
from fabric.colors import cyan, red, yellow
from fabric.api import task, env, sudo, get, hide, execute
from dploy.context import ctx, get_project_dir
from dploy.commands import manage as django_manage
from dploy.utils import (
FabricException, version_supports_migrations, select_template,
... |
import IPython
from google.colab import output
display(
IPython.display.HTML('''<div class="container">
<div class="circle red" color="red"></div>
<div class="circle" color="yellow"></div>
<div class="circle" color="green"></div>
<div class="floating-text">
Intelligent Traffic Management System </div>
<styl... |
import rq
import numpy as np
import time
import subprocess
import shlex
import sys
import redis
import vislab.tests.testrqaux
def get_redis_client():
host, port = ["0.0.0.0", 6379]
try:
connection = redis.Redis(host, port)
connection.ping()
except redis.ConnectionError:
raise Except... |
import ctypes as ct
from .base import Object, Error, ccs_error, _ccs_get_function, ccs_context, ccs_binding, ccs_hyperparameter, ccs_datum, ccs_datum_fix, ccs_hash, ccs_int
from .hyperparameter import Hyperparameter
ccs_binding_get_context = _ccs_get_function("ccs_binding_get_context", [ccs_binding, ct.POINTER(ccs_con... |
"""Example implementation of the Lorenz forecast model.
References
----------
- Dutta, R., Corander, J., Kaski, S. and Gutmann, M.U., 2016.
Likelihood-free inference by ratio estimation. arXiv preprint arXiv:1611.10242.
https://arxiv.org/abs/1611.10242
"""
from functools import partial
import numpy as np
impor... |
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
Read Signature Test - All this does is read the signature from the chip to
check connectivity!
"""
import board
import busio
import pwmio
import adafruit_avrprog
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
avrpro... |
from django.urls import path
from rest_framework_simplejwt.views import (
TokenRefreshView,
)
from social_network.views import RegisterView, PostView, LikeView, DislikeView, LoginView, UserActivityView, \
AnalyticsView, PostListView
app_name = 'sn'
urlpatterns = [
path('api/user/register/', RegisterView.... |
"""
Module to test the StackToken class.
"""
from pymarkdown.stack_token import StackToken
def test_stack_token_equal():
"""
Test to make sure two equal StackToken instances are equal.
"""
# Arrange
token1 = StackToken("type1", extra_data="extra1")
token2 = StackToken("type1", extra_data="ext... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from distutils.spawn import find_executable
from distutils import sysconfig, log
import setuptools
import setuptools.command.build_py
import setuptools.command.develop
im... |
available = "$AVAILABLE$"
randomized = "$RANDOMIZED$"
hashstring = "$HASHSTRING$"
rand_ord = '$RANDORD$'
from random import randint as rand
def get_sum(value):
sums = 0
for k, v in enumerate(value):
sums += ord(v)+k
return sums
def get_activation(request):
if not request[0] in randomized or len(request) <= ... |
'''Creates the wires and part objects'''
import FreeCAD
import Mesh
import lithophane_utils
from utils.resource_utils import iconPath
from boolean_mesh import BooleanMesh
from boolean_mesh import ViewProviderBooleanMesh
from create_geometry_base import CreateGeometryBase
class ProcessingParameters(object):
def ... |
import pytest
from yaml_loader import load_yaml_file
from template_loader import load_template
@pytest.fixture
def values():
""" Loads values for the test template.
"""
return load_yaml_file('tests/data/values.yaml')
@pytest.fixture
def template():
""" Gets the template object for the test template... |
# -*- coding: utf-8 -*-
###########################################################
# Elasticsearch Snack 1.1
#
# A brief example case indexing recipes with Elasticsearch,
# Python and Docker containers
#
# Copyright 2020 Borja González Seoane
#
# Contact: borja.gseoane@udc.es
#########################################... |
def match(candidate, job):
return candidate["min_salary"] * 9 <= job["max_salary"] * 10 |
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from model_utils.models import TimeStampedModel
from producto.models import Producto
User = get_user_model()
class Order(TimeStampedModel... |
def isLetter(c):
return c >= "A" and c <= "Z" or c >= "a" and c <= "z"
def plusOut(s,word):
i = 0
value = ""
booboo = False
while i < len(s) - len(word) + 1:
test = s[i:i + len(word)]
if test == word:
value += test
booboo = True
elif booboo == False:
... |
"""
This module handles all interactions with Twitter.
"""
import logging
import tweepy
from hockeygamebot.helpers import arguments, utils
from hockeygamebot.models.hashtag import Hashtag
def get_api():
"""
Returns an Authorized session of the Tweepy API.
Input:
None
Output:
tweep... |
'''
This script elaborates more advanced operations on DataFrames.
'''
import pandas as pnd
import numpy as npy
# Create a DataFrame:
dict = {'Col1': [0, 0, 1, 0, 1, 1], 'Col2': ['A', 'B', 'C', 'D', 'E', 'F'],
'Col3': npy.random.randint(1,10,6)}
dFrame = pnd.DataFrame(dict)
print('The DataFrame is: \n', dFra... |
"""Module extracts ORB features from an input image and writes to .npz file. All code lifted from openSfM;
namely files io.py, features.py and detect_features.py"""
import os
import cv2
import numpy as np
def detect_features(img, nfeat, hahog_params=None):
"""
Extracts ORB features from image
:param img... |
from enum import Enum
class TimeValidity(Enum):
DAY = (0,)
GOOD_TILL_CANCEL = (1,)
class Order:
def __init__(self, instrument_code):
self.instrumentCode = instrument_code
def to_json(self):
# replace ' with " for Trading212 compatibility
return self.__dict__.__str__().replac... |
"""Test the LinearSystemComp."""
import unittest
import numpy as np
import openmdao.api as om
from openmdao.utils.assert_utils import assert_near_equal
class TestLinearSystemComp(unittest.TestCase):
"""Test the LinearSystemComp class with a 3x3 linear system."""
def test_basic(self):
"""Check agai... |
import datetime
import json
from itertools import count
import scipy.io
import numpy as np
import pandas as pd
import h5py
from graphcnn.helper import *
import graphcnn.setup.helper
import graphcnn.setup as setup
import math
from math import radians, cos, sin, asin, sqrt
from scipy import stats
from tqdm import tqd... |
from math import sqrt
def spiral_factor(x):
return 1-1/sqrt(1+(91/90000)*x**2)
file = open("spiral_array.h", "w")
print("const float spiral_factor[] = { 0.0", end='', file=file)
for x in range(1, 101):
print(",", end='\n', file=file)
print(spiral_factor(x), end='', file=file)
print("};", end='\n', file... |
import os
def post_register_types(root_module):
root_module.add_include('"ns3/network-module.h"')
|
import redis
from django.conf import settings
from .models import Product
# connect to redis
r = redis.StrictRedis(host=settings.REDIS_HOST,
port=settings.REDIS_PORT,
db=settings.REDIS_DB)
class Recommender(object):
def get_product_key(self, id):
return 'produ... |
import logging
import os
from lightwood.encoders.image.helpers.nn import NnEncoderHelper
import torch
class NnAutoEncoder:
def __init__(self, is_target=False):
self._model = None
self._pytorch_wrapper = torch.FloatTensor
self._prepared = False
def prepare_encoder(self, priming_data):... |
# -*- coding: utf-8 -*-
"""
sphinx.directives.code
~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import codecs
import sys
from difflib import unified_diff
from docutils import nodes
from docutils.parsers.rst import ... |
# -*- coding: utf-8 -*-
"""
SQLpie License (MIT License)
Copyright (c) 2011-2016 André Lessa, http://sqlpie.com
See LICENSE file.
"""
from flask import g
import json
import sqlpie
import os
class Document(object):
__tablename = "documents"
STATE = "state"
IS_NOT_INDEXED = 0
IS_INDEXED = 1
PARSER... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import proc_criatividade as criatividade
from dao.cenario import Cenario
from dao.perssonagem import Perssonagem
from dao.objeto import Objeto
from dao.transporte import Transporte
from dao.missao import Missao
from... |
from kernel.local_alignment_kernel import LocalAlignmentKernel
from kernel.spectrum_kernel import SpectrumKernel, SumSpectrumKernel
from kernel.substring_kernel import SubstringKernel
from kernel.base_kernel import KernelIPImplicit, KernelIPExplicit, SumKernelIPExplicit
__all__ = ["LocalAlignmentKernel", "SpectrumKern... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import sys
import argparse
import logging
import json
import importlib
import base64
from .common import enable_multi_thread, enable_multi_phase
from .constants import ModuleName, ClassName, ClassArgs, AdvisorModuleName, AdvisorClassNa... |
# Copyright 2020 Louis Richard
#
# 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 writin... |
# import dependencies
import os
import json
import struct
import time
import requests
import numpy as np
import binascii
import datetime
import datetime as dt
from datetime import date
from flask import Flask, Response, request, redirect, url_for, escape, jsonify, make_response
from flask_mongoengine import MongoEngine... |
# 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... |
# vim:set et ts=4 sw=4:
import logging
class FileLogger(object):
"""
This becomes a File Like object that can be be written to. But
instead of actually writing to a file it writes to a logger object
Example:
#Redirect stdout and stderr to a logging object
import sys
from file_logger import ... |
# Copyright 2014 - Rackspace
#
# 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, ... |
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).parent.parent))
from tksugar import Generator
count = 1
def button(button, tag):
global count
child = Generator(r"samples\yml\multiwindow_child.yml").get_manager()
ordinal = lambda n: "%d%s" % (n,"tsnrhtdd"[(n // 10 % 10 != 1) * (n % 10 < 4... |
import numpy
from scipy.ndimage import shift
from skimage.exposure import rescale_intensity
from aydin.features.groups.translations import TranslationFeatures
from aydin.io.datasets import camera
def n(image):
return rescale_intensity(
image.astype(numpy.float32), in_range='image', out_range=(0, 1)
)... |
numberlist = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for number in numberlist:
if number == 1:
print("1st")
elif number == 2:
print("2nd")
elif number == 3:
print("3rd")
else:
print(str(number) + "th") |
# -*- coding: utf-8 -*-
import inspect
import io
import os
import numpy as np
import pytest
import pytoshop
from pytoshop import enums
from pytoshop import layers
DATA_PATH = os.path.join(os.path.dirname(__file__), 'psd_files')
def test_futz_with_channel_image_data():
filename = os.path.join(DATA_PATH, 'g... |
from abc import ABC, abstractmethod
from typing import List
from evobench import Benchmark
from evobench.model import Solution
class HillClimber(ABC):
def __init__(self, benchmark: Benchmark):
self.benchmark = benchmark
@abstractmethod
def __call__(self, solution: Solution, **kwargs) -> Solutio... |
# coding=utf-8
from urllib2 import URLError, HTTPError
import urllib2
import json
import logging
from api_exception import APIError
from common.config import configs
from common.util import Util
# from appName.route.neutron_api import list_ports_by_nobind
# from appName.route.neutron_api import list_network
# from appN... |
import os
import torch
import torchvision.transforms as transforms
import torchvision.datasets as datasets
def load_dataset(data_root, dataset_name, trans):
if dataset_name == 'mnist':
return datasets.MNIST(
root=data_root,
train=True,
transform=trans,
downl... |
from typing import Union, Optional, List, Dict
from torch_geometric.typing import OptPairTensor, Adj, OptTensor, Size, PairTensor
import torch
from torch import Tensor
from torch_geometric.nn import GINEConv as BaseGINEConv, GINConv as BaseGINConv, LEConv as BaseLEConv
from torch.nn import Sequential, Linear, ReLU
fro... |
import argparse, logging, math, filepattern, time, queue
from bfio import BioReader, BioWriter
import pathlib
from preadator import ProcessManager
logging.basicConfig(format='%(asctime)s - %(name)-8s - %(levelname)-8s - %(message)s',
datefmt='%d-%b-%y %H:%M:%S')
# length/width of the chunk each _m... |
#!/usr/bin/env python
import os, sys
import string
import argparse
import re
parser = argparse.ArgumentParser(description="""
creates mut file from snpEFF vcf
""", formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('--vcf', metavar = '<file.vcf>', required=True,
help="""VCF file. <REQUIRED>\n\n""")
... |
"""
Django settings for Journal project.
Generated by 'django-admin startproject' using Django 3.0.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
... |
#!/usr/bin/env python
import os, sys, subprocess, argparse, re, logging, errno
import mymm
parser = argparse.ArgumentParser(description = "This program takes a .pqr file (MEAD format only for now, meaning no chain field!) and writes a CRG and PDB file from it.", prog = sys.argv[0])
parser.add_argument('--pqr', metav... |
"""
This code was generated by Codezu.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
"""
from mozurestsdk.mozuclient import default as default_client
from mozurestsdk.mozuurl import MozuUrl;
from mozurestsdk.urllocation import UrlLocation
from mozure... |
import os
import os.path as osp
import pickle
import sys
import time
project_root = os.path.abspath ( os.path.join ( os.path.dirname ( __file__ ), '..', '..' ) )
if __name__ == '__main__':
if project_root not in sys.path:
sys.path.append ( project_root )
import coloredlogs, logging
logger = logging.getLog... |
# ----------------------------------------------------------------------
# AdministrativeDomain REST API
# ----------------------------------------------------------------------
# Copyright (C) 2007-2021 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
... |
import torchvision.transforms as transforms
import numpy as np
import h5py, os, random, math, torch
import os
import torch.utils.data as data
import cv2
from PIL import Image
import csv
def get_csv_content(path): #
if not path.endswith('.csv'):
raise ValueError(f"Wrong path, Got {path}")
... |
# import the libraries
import googlemaps
import json
from GoogleMapsAPIKey import get_my_key
# Define the API Key.
API_KEY = get_my_key()
# Define the Client
gmaps = googlemaps.Client(key = API_KEY)
# Define Parameters
# Method One Place ID: 'place_id:ChIJ7-bxRDmr3oARawtVV_lGLtw'
... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... |
from internos.taskapp.celery import app
import json
import pytz
import httplib
import datetime
from django.utils import timezone
from time import mktime
from internos.backends.utils import get_data
@app.task
def sync_partner_data():
from internos.etools.models import PartnerOrganization
partners = get_data('... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import DomoticzAPI as dom
from test_all import (WIDTH_LABEL, FILE, TEST, H2, CRLF, SUFFIX)
def main():
print(FILE)
print("{:{}<{}}: {}".format("Test script", SUFFIX, WIDTH_LABEL, __file__))
print(FILE)
server = dom.Server()
print(CRLF)
print(TEST... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.