text stringlengths 2 999k |
|---|
from __future__ import annotations
from abc import ABC, abstractmethod
import typing
from pantra.oid import get_node
from pantra.session import trace_errors, Session
from pantra.workers import thread_worker
if typing.TYPE_CHECKING:
from typing import *
from pantra.components.context import Context, RenderNod... |
"""
This file contains the generic, assorted views that don't fall under one of
the other applications. Views are django's way of processing e.g. html
templates on the fly.
"""
from django.contrib.admin.sites import site
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_r... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 TU Wien.
#
# Invenio-Users-Resources is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""Users service."""
from invenio_accounts.models import User
from invenio_records_resources.service... |
#####################################################################
# #
# /tab_base_classes.py #
# #
# Copyright 2013, Monash University ... |
"""empty message
Revision ID: e3f9f9c13c
Revises: 52b884ded89
Create Date: 2015-11-02 13:56:17.387911
"""
# revision identifiers, used by Alembic.
revision = 'e3f9f9c13c'
down_revision = '52b884ded89'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please... |
# -*- coding: utf-8 -*-
r"""
Install Python packages with pip to either the system or a virtualenv
Windows Support
===============
.. versionadded:: 2014.7.4
Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your... |
#!/usr/bin/python
################################################################################
# gravity.py
#
# Classes and methods to deal with gravity fields of oblate planets.
#
# Mark R. Showalter, SETI Institute, March 2010
# Revised October 2011.
# Revised December 2, 2011 (BSW) - add unit tests
# ... |
#!/bin/sh
# -*- coding: utf-8
# fuctrl.py version history
# ver.0.2.0 (28Dec2014): the first version.
# Ctrl methods were collected from other modules.
import sys
#from nt import lstat
import cmd
sys.path.insert(0,'.')
import wxversion
wxversion.select("2.8")
import wx
import os
import shutil
... |
import time
import datetime
def create_non_revoke_interval(timeframe):
# timeframe containes two variables, the To and from of the non-revoked to and from parameters in the send presentation request message
# The to and from timeframe variables are always relative to now.
# The to and from time is represe... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module defining NumPy array-based distribution classes.
One of the features of joint distributions is that we can marginalize them.
This requires that we are able to construct smaller outcomes from larger
outcomes. For example, an outcome like '10101' might become '01... |
from blacksheep.server.authorization import auth
from blacksheep.server.controllers import ApiController, post
from domain import Roles
from domain.blobs import BlobsHandler, InitializeUploadInput, InitializeUploadOutput
class BlobsController(ApiController):
def __init__(self, manager: BlobsHandler) -> None:
... |
import cv2
import numpy as np
import os
print('WORKIND')
os.chdir('/Users/jyarbrou/Computer_vision/Bat_project/bat_project//Bat_images/mixed_targets')
current_directory = os.getcwd()
print(current_directory)
count = 0
# filename_0 = 'bat_111511.avi'
# filename_1 = 'bat_111603.avi'
# filename_2 = 'bat_112309.avi'
# fil... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Thanks to @kandnub, for this awesome module !!
#
# Licensed under the Raphielscape Public License, Version 1.c (the "License");
# you may not use this file except in compliance with the License.
#
""" Userbot module for reverse searching stickers and images on Goog... |
start_year = 1870
year_increment = 10
data = ['None', [2, 9, 9, 5, 12, 30, 7, 4, 0, 7, 2, 1, 3, 3, 1],
'Floral', [1, 4, 5, 7, 6, 13, 8, 3, 2, 2, 2, 1, 1, 3, 5],
'Intricate', [4, 13, 9, 9, 19, 12, 5, 8, 3, 3, 1, 3, 6, 1, 5]]
percentage_markers = True
border_color = 'black'
fill_color = 'black'... |
__all__ = ['imread', 'imsave']
import numpy as np
from six import string_types
from PIL import Image
from ...util import img_as_ubyte, img_as_uint
from ...external.tifffile import imread as tif_imread, imsave as tif_imsave
def imread(fname, dtype=None, img_num=None, **kwargs):
"""Load an image from file.
P... |
figlet = ''
figlet += ' __ ___ ____ _ __\n'
figlet += ' / |/ /___ _/ / /__________ _(_) /\n'
figlet += ' / /|_/ / __ `/ / __/ ___/ __ `/ / /\n'
figlet += ' / / / / /_/ / / /_/ / / /_/ / / /\n'
figlet += '/_/ /_/\__,_/_/\__/_/ \__,_/_/_/\n\n'
|
#
# markdown/__version__.py
#
# version_info should conform to PEP 386
# (major, minor, micro, alpha/beta/rc/final, #)
# (1, 1, 2, 'alpha', 0) => "1.1.2.dev"
# (1, 2, 0, 'beta', 2) => "1.2b2"
version_info = (2, 6, 3, 'final', 0)
def _get_version():
" Returns a PEP 386-compliant version number from version_info. "... |
from flask import render_template
from app import db
from app.errors import bp
@bp.app_errorhandler(404)
def not_found_error(error=None):
return render_template('errors/404.html'), 404
@bp.app_errorhandler(500)
def internal_error(error=None):
db.session.rollback()
return render_template('errors/500.html... |
# Lint as: python2, python3
# Copyright 2019 Google LLC. 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 req... |
import logging
import os
import astropy.io.fits
import datetime
import yaml
logger = logging.getLogger()
qlf_root = os.getenv('QLF_ROOT')
if not qlf_root:
raise ValueError('QLF_ROOT not define.')
# TODO: flat program can also use flat_preproc.
program_mapping = {
'flat': 'flat', # flat_preproc
'arc': '... |
def test_config_arg():
from argdeco import CommandDecorator, arg
from argdeco.config import config_factory
command = CommandDecorator(compiler_factory=config_factory())
@command('foo', arg('--first'), arg('--second', default=1, config_name="foo.bar"))
def cmd_foo(config):
assert config['fo... |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Pershyancoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the listtransactions API."""
from test_framework.test_framework import PershyancoinTestFrame... |
import sys
import argparse
import logging
from typing import List
from pacos2.mock.best_effort_actor import BestEffortActor
from pacos2.mock.impulses import PeriodicImpulse, IDiscreteImpulse, IClock
from pacos2.message import Message, Address
from pacos2.impul_discr_evt_engine import (
ImpulsiveDiscreteEventEngine,... |
# Generated by Django 3.1.1 on 2020-09-10 14:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('customers', '0002_customer_created_by'),
]
operations = [
migrations.AddField(
model_name='customer',
name='website'... |
# Copyright (c) 2022, NVIDIA CORPORATION. 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... |
# -*- coding: utf-8 -*-
import os
from setuptools import find_packages
from setuptools import setup
base_dir = os.path.dirname(__file__)
setup(
name='elastalert',
version='0.1.28',
description='Runs custom filters on Elasticsearch and alerts on matches',
author='Quentin Long',
author_email='qlo@y... |
# Copyright 2020 The TensorFlow 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 applica... |
# ActivitySim
# See full license in LICENSE.txt.
import logging
import pandas as pd
from activitysim.core import tracing
from activitysim.core import config
from activitysim.core import inject
from activitysim.core import pipeline
from activitysim.core import timetable as tt
from activitysim.core import simulate
fro... |
import os
import unittest
from checkov.kubernetes.checks.ApiServerAdmissionControlEventRateLimit import check
from checkov.kubernetes.runner import Runner
from checkov.runner_filter import RunnerFilter
class TestApiServerAdmissionControlEventRateLimit(unittest.TestCase):
def test_summary(self):
runner =... |
# Generated by Django 3.1.3 on 2021-09-30 09:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('users', '0002_auto_20210930_0840'),
]
operations = [
migrations.CreateModel(
name='Permission',... |
# -*- coding: utf-8 -*-
"""
Chat Room Demo for Miniboa.
"""
import logging
from miniboa import TelnetServer
IDLE_TIMEOUT = 300
CLIENT_LIST = []
SERVER_RUN = True
def on_connect(client):
"""
Sample on_connect function.
Handles new connections.
"""
logging.info("Opened connection to {}".format(cli... |
#!/usr/bin/env python
# coding: utf-8
# In[18]:
import numpy as np
class Perceptron(object) :
def __init__(self, eta=0.01, n_iter=50,random_state=1):
self.eta = eta
self.n_iter = n_iter
self.random_state = random_state
def fit(self,x,y):
rgen =np.random.RandomState(s... |
from mykrobe.variants.schema.models import VariantCallSet
from mykrobe.variants.schema.models import CallSet
from mykrobe.variants.schema.models import Call
from mykrobe.variants.schema.models import VariantCall
from mykrobe.variants.schema.models import SequenceCall
from mykrobe.variants.schema.models import Variant
f... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding unique constraint on 'PackageVersion', fields ['version', 'package']
db.create_unique('folivora_pac... |
from structural.frame2d import Frame2D
import math
import unittest
FRAME_A = 10.0
FRAME_E = 29000.0
FRAME_IX = 100.0
KIPS_PER_FOOT = 2.5
# 2.5*25^2/8 = 195.3125
#class PointLoad:
# def __init__(self, x, P):
# self.x = x
# self.P = P
#pointload_set = [PointLoad(5.5, 10.0), PointLoad(13.4, 8.0)]
c... |
#!/usr/bin/env python3
# blocktools.py - utilities for manipulating blocks and transactions
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from .mininode import *
from .script... |
# -*- coding: utf-8 -*-
# @Time : 2021/8/2 5:12 PM
# @Author : kevin_w
# @Site :
# @File : util.py
# @Comment :
import numpy as np
import gym
import argparse
import torch
import torchvision.transforms as T
from PIL import Image
# define parameter
parser = argparse.ArgumentParser(description="RL REINFORCE e... |
import time
import threading
import numpy as np
import theano
import cPickle
import matplotlib.pyplot as plt
from multiprocessing import Process
from multiprocessing import Manager
import environment
import job_distribution
import pg_network
import slow_down_cdf
def init_accums(pg_learner): # in rmsprop
accums... |
def F(n):
if n > 2:
return F(n - 1) + G(n - 2)
else:
return n + 1
def G(n):
if n > 2:
return G(n - 1) + F(n - 2)
else:
return n
print(F(7)) |
# Copyright 2021 Google LLC
#
# 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, ... |
"""koji interface classes for osg-build"""
# pylint: disable=W0614,C0103
from __future__ import absolute_import
from __future__ import print_function
try:
import configparser
except ImportError:
import ConfigParser as configparser
import logging
import random
import re
import os
import string
import sys
impor... |
# Class
# "The best material model of a cat is another, or preferably the same, cat."
#
# You probably won't define your own in this class, but you will have to know how to use someone else's.
#
# Stanley H.I. Lio
# hlio@hawaii.edu
# OCN318, S18
# this defines a CLASS (indentation matters! a lot!):
class Mordor:
... |
import dateparser.search
import datetime
from harvest.config import LANGUAGES
def search_dates(text):
results = dateparser.search.search_dates(text, languages=LANGUAGES, settings={'RETURN_AS_TIMEZONE_AWARE': False})
valid_dates = []
if results is not None:
for result in results:
if res... |
# vim: encoding=utf-8
"""
This file can be imported for currency related functions.
It is also used as a program to gather currency data.
Currencies data is gathered every five minutes using cron (see crontab).
Data is stored in CURRENCIES_FILE.
At the moment data is stored in a plain file.
It will be moved to a mon... |
from . import log_states |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import optparse
import os
import sys
import time
import py_utils
from py_utils import cloud_storage # pylint: disable=import-error
from tel... |
# Generated by Django 3.2.5 on 2021-07-18 07:50
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('student', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='C... |
"""
Author - Shikhar Gupta 2018229
"""
sBox = [0xa, 0x5, 0x9, 0xb, 0x1, 0x7, 0x8, 0xf,
0x6, 0x0, 0x2, 0x3, 0xc, 0x4, 0xd, 0xe]
s_Box = [0x9, 0x4, 0xa, 0xb, 0xd, 0x1, 0x8, 0x5,
0x6, 0x2, 0x0, 0x3, 0xc, 0xe, 0xf, 0x7]
class AES_Decryption:
def __init__(self, key):
self.expanded_key = self.... |
import numpy as np
from pandas import date_range
import os
import xarray as xr
from cPickle import dump
def save_iterable(ds, ds_p, cols_iii, rows_iii, ix, it_name, it_path, seasonal=False):
iterables = []
for nit, (row, col) in enumerate(zip(rows_iii, cols_iii)):
ds_pi = ds_p.isel(y=row, x=col)
... |
# Generated by Django 3.1.3 on 2021-10-13 02:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('onlinecourse', '0002_auto_20211010_1531'),
]
operations = [
migrations.AlterField(
model_name='instructor',
name='to... |
# It returns True if pattern is found in the text, otherwise False.
def naive(text, pattern, length_text, length_pattern):
if length_text<length_pattern:
return False
for i in range(length_text-length_pattern):
x = i
for j in range(length_pattern):
if pattern[j]==text[x]:
... |
"""
Space are blocked if they do not way of placing assets within the location url
"""
BLOCKED_SPACES = [
11,
147,
154,
] |
import random
import string
from cache import Cache
from client_factory import ClientFactory
class CommonMethods():
def __init__(self, cache):
self.cache = cache
self.client_factory = ClientFactory(self.cache)
def get_unused(self, name, resource):
if self.cache[name][resource]['used'... |
import json
import pytest
from loguru import logger
from typer.testing import CliRunner
from likemyso import callback
from likemyso.main import app
runner = CliRunner()
def test_cli():
"""TODO: Docstring for test_cli.
:returns: TODO
"""
result = runner.invoke(app, ["start", "--help"])
assert... |
""" The CNN Encoder Model """
import torch.nn as nn
from torchvision.models import resnet18
class CNN(nn.Module):
""" The CNN Model """
def __init__(self, encoder_output_dim):
super().__init__()
self.cnn = resnet18(pretrained=True)
self.cnn = nn.Sequential(*list(self.cnn.children())[... |
"""
MIT License
Copyright (c) 2022 Grapphy
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
to use, copy, modify, merge, publish, dist... |
from django.urls import path, include
from . import views
from rest_framework import routers # allows us to create GET and POST requests
#1)create router
router = routers.DefaultRouter()
#2)register view with the RestFramework so we can see them in the Rest Framework homepage as links
router.register('all', views.Reso... |
# coding=utf-8
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, print_function
import os
from collections import deque
from textwrap import dedent
from pex import third_party
from pex.common impo... |
# -------------------------------------------------------------
#
# 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 unde... |
import requests
import datetime
from dateutil.relativedelta import relativedelta
import json
from auth_handler import get_cj_api_auth
auth = get_cj_api_auth()
auth = (auth[0], auth[1])
base_url = 'http://api.cratejoy.com/v1/'
def get_date_key(endpoint):
if endpoint == 'shipments':
return 'adjusted_orde... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import hashlib
from... |
# Copyright 2013-2022 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)
from spack import *
class Apfel(AutotoolsPackage):
"""APFEL is a library able to perform DGLAP evolution up to NNLO ... |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
data = np.loadtxt("datos.dat")
x = np.arange(0,101,1)
y = np.arange(0,101,1)
fig = plt.figure()
ax = Axes3D(fig)
ax.plot_trisurf(x,y, data)
plt.savefig("fig.png") |
from __future__ import absolute_import
from django.contrib import admin
from .models import Group, Feed, Entry
class GroupAdmin(admin.ModelAdmin):
pass
admin.site.register(Group, GroupAdmin)
class FeedAdmin(admin.ModelAdmin):
list_display = ['xml_url', 'title', 'group', 'published_time', 'last_polled_tim... |
from django import forms
from django.conf import settings
from django.contrib.flatpages.models import FlatPage
from django.utils.translation import gettext, gettext_lazy as _
class FlatpageForm(forms.ModelForm):
url = forms.RegexField(
label=_("URL"),
max_length=100,
regex=r'^[-\w/\.~]+$',... |
"""well.py: resqpy well module providing trajectory, deviation survey, blocked well, wellbore frame and marker frame and md datum classes.
Example::
# Wellbore interpretations
for well in model.iter_wellbore_interpretations():
print(well.title)
for trajectory in well.iter_trajectories():
p... |
from typing import Dict, Optional, List, Any
import torch
import torch.nn.functional as F
from allennlp.data import Vocabulary
from allennlp.models.model import Model
from allennlp.modules import FeedForward, TextFieldEmbedder, Seq2SeqEncoder
from allennlp.nn import InitializerApplicator, RegularizerApplicator
from al... |
import os
from zipfile import ZipFile
import configparser
import json
config_file = 'build_config.ini'
def start_config_worker():
global config_file
config = configparser.ConfigParser()
config.read(config_file)
if not config.has_section("BuildSettings"):
config.add_section("BuildSettings")
... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Sphinx configuration."""
from __future__ import print_function
import os
import... |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
diff = [0] * n
for i in range(len(a) - 1):
diff[i] = abs(a[i] - a[i+1])
diff[-1] = abs(a[-1] - k) + a[0]
print(k - max(diff))
|
"""
ASGI config for trading_app project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault("DJANGO_S... |
"""
2D maze obstacle environments
"""
from gym_obstacles.planners.rrt import pathSearch
|
# Copyright 2015 Oliver Cope
#
# 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 _pydevd_bundle import pydevd_xml
from os.path import basename
from _pydev_bundle import pydev_log
from urllib.parse import unquote_plus
#===================================================================================================
# print_var_node
#===============================================... |
# Module version
version_info = (0, 2, 0, 'final', 1)
# Module version stage suffix map
_specifier_ = {'alpha': 'alpha', 'beta': 'beta', 'candidate': 'rc', 'final': ''}
# Module version accessible using {{ cookiecutter.python_package_name }}.__version__
__version__ = '%s.%s.%s%s'%(version_info[0], version_info[1], ve... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from collections.abc import Iterable
from typing import Iterable as IterableType, overload, Type, Union
import torch
import torch.distribut... |
#
# Copyright (C) 2012 - 2017 Satoru SATOH <ssato @ redhat.com>
# License: MIT
#
"""Misc utility routines for anyconfig module.
"""
from __future__ import absolute_import
import collections
import glob
import os.path
import types
import anyconfig.compat
def get_file_extension(file_path):
"""
>>> get_file_ex... |
# Generated by Django 2.0 on 2018-04-18 17:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cooggerapp', '0009_auto_20180412_2341'),
]
operations = [
migrations.AddField(
model_name='content',
name='modcomment'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
######################################################################
# Copyright 2017 Telera www.telera.eu
#
# 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 th... |
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime
default_args = { 'start_date': datetime(2018,1,1) }
with DAG('example', default_args=default_args) as dag:
(
BashOperator(task_id='print_date', bash_command='echo "Hello, world!"', )
>>
... |
"""Tests for multiples of 3 or 5 code kata"""
import pytest
PARAMS_TABLE = [
(4, 3),
(10, 23),
(13, 45),
(0, 0),
(3, 0),
(6, 8)
]
@pytest.mark.parametrize("n, result", PARAMS_TABLE)
def test_multiples_of_3_or_5(n, result):
"""Testing the multiples of 3 or 5 kata"""
from multiples_of_3... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ShowApiVersionRequest:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The ... |
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import pytest
from packaging.version import InvalidVersion, Version
from internal_backend.utilities.register import PantsReleases
def _branch_name(revision_str: str) -> str:
return ... |
from rest_framework import generics, authentication, permissions
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from user.serializers import AuthTokenSerializer, UserSerializer
class CreateUserView(generics.CreateAPIView):
"""Create a new user in the s... |
import numpy as np
import configparser
import pickle
import os.path as osfuncs
import hashlib
import logging
# custom modules
import graph_ltpl
def main_offline_callback(globtraj_param_path: str,
graph_off_config_path: str,
graph_store_path: str,
... |
"""Python STIX2 Environment API."""
import copy
from .datastore import CompositeDataSource, DataStoreMixin
from .equivalence.graph import graph_equivalence, graph_similarity
from .equivalence.object import object_equivalence, object_similarity
from .parsing import parse as _parse
class ObjectFactory(object):
"""... |
"""Tests for the /protocols router."""
import pytest
from datetime import datetime
from decoy import Decoy, matchers
from fastapi import UploadFile
from pathlib import Path
from opentrons.protocols.api_support.types import APIVersion
from opentrons.protocol_reader import (
ProtocolReader,
ProtocolSource,
... |
import numpy as np
import random
from sklearn.metrics import f1_score
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC
from sklearn.model_selection import train_test_split
def marginal_entropy(x):
x_counter = {xi: 0 for xi in x}
for xi in ... |
import sys
sys.path.append('/home/kailu/EDSR-PyTorch/code/')
sys.path.append('/home/wukailu/EDSR-PyTorch/code/')
from utils.tools import submit_jobs, random_params
def params_for_single_train():
params = {
'project_name': 'layerwise_model_train',
'gpus': 1,
'num_epochs': 300,
'we... |
from load_dataset import load_helen_annotation, load_muct_annotation
from BBox_utils import BBox, IoU
from Landmark_utils import rotate
import sys
sys.path.append('../')
from train_models.MTCNN_config import config
import cv2
import os
import random
import numpy as np
LANDMARK_LEN = config.LANDMARK_SIZE * 2
NETS_IM... |
"""makewiki URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-base... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2020-2022 Barcelona Supercomputing Center (BSC), Spain
#
# 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... |
import sys
import re
def main(fileName):
c1, c2 = 2069194, 16426071
c1loop = 0
c2loop = 0
temp = 7
while temp != c1:
temp *= 7
temp = temp % 20201227
c1loop += 1
temp = 7
while temp != c2:
temp *= 7
temp = temp % 20201227
c2loo... |
def area(a,b):
return a*b
print(area(2,3))
# key word args
print(area(a=2,b=3))
def area_1(a,b=5):
return a*b
print(area_1(2))
### add n numbers of args
def mean(*args):
return args
print(mean(1,23,'hi'))
def mean(*args):
return sum(args) / len(args)
print(mean(1,23,22))
### keyword Arg... |
# Load Plugins Here
from .example import custom_example
# Uncomment to load Deepfry Plugin
# from .deepfry import deepfry
|
import click
from lxml import etree
from commands.common import create_playlist, write_xml
@click.command()
@click.argument('rekordbox_xml')
@click.argument('destination_xml')
def trackswithoutplaylist(rekordbox_xml, destination_xml):
et = etree.parse(rekordbox_xml)
root = et.getroot()
tracks = root.find... |
from scripts import utils
import datetime
def test_merge_concat():
# Tests string
assert utils.merge_concat("1") == "1"
assert utils.merge_concat("1", "2") == "1 2"
assert utils.merge_concat("1", "2", "3") == "1 2 3"
assert utils.merge_concat("a", "b", "ab") == "a b ab"
# Tests integer
... |
#!/usr/bin/python
#
# Copyright 2018-2021 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 ... |
import os
import argparse
import json
import logging
from collections import defaultdict, Counter, OrderedDict
from matplotlib import pyplot as plt
import numpy as np
import seaborn as sns
from utils.global_vars import POS_TAGS_MAP
logging.basicConfig(format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.