text stringlengths 1 927k |
|---|
from django.urls import path
from . import views
import image_mgr.views
from django.contrib.auth.decorators import login_required
app_name = "label_app"
urlpatterns = [
path('',
login_required(views.tool), name="label_tool"),
path('Images/f/<str:filename>.jpg',
image_mgr.views.image_file, name... |
import typing
def floor_sum(n: int) -> int:
s = 0
i = 1
while i <= n:
x = n // i
j = n // x + 1
s += x * (j - i)
i = j
return s
def main() -> typing.NoReturn:
n = int(input())
print(floor_sum(n))
main() |
import cv2
import dropbox
import time
import random
start_time = time.time()
def take_snapshot():
number = random.randint(0,100)
#initializing cv2
videoCaptureObject = cv2.VideoCapture(0)
result = True
while(result):
#read the frames while the camera is on
ret,frame = videoCaptureO... |
import requests
import os
import time
import pytest
import yaml
import uuid
URL = os.environ["URL"]
EMAIL = os.environ["EMAIL"]
PASSWORD = os.environ["PASSWORD"]
CLUSTER_NAME = "agent-integration-test-" + uuid.uuid4().hex[:5]
NAMESPACE = "agent-integration-test"
AGET_IMAGE = os.environ["AGENT_IMAGE"]
TEST_CONSTRAINT... |
# Copyright (c) 2021-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 ... |
# adapted from https://github.com/open-mmlab/mmcv or
# https://github.com/open-mmlab/mmdetection
from .conv_module import ConvModule
plugin_cfg = {
# format: layer_type: (abbreviation, module)
'ConvModule': ('conv_block', ConvModule),
}
def build_plugin_layer(cfg, postfix='', **kwargs):
"""Build plugin l... |
#!/usr/bin/env python3
# Very basic serial loader.
# Does no checking/verification that the upload succeeded
# Code is always loaded into the same location in RAM. (APPMEMSTART)
#
# protocol is:
# - host (this script) sends break condition
# - target (the board) replies with ASCII U
# - host sends entire binary image
... |
"""
Draws a dashed square
"""
from turtle import Turtle, Screen
timmy = Turtle()
timmy.shape("turtle")
for _ in range(4):
for _ in range(15):
timmy.pendown()
timmy.forward(10)
timmy.penup()
timmy.forward(10)
timmy.left(90)
screen = Screen()
screen.exitonclick() |
import torch.nn as nn
class Generator(nn.Module):
def __init__(self, nc, ngf, nz):
super(Generator,self).__init__()
self.layer1 = nn.Sequential(nn.ConvTranspose2d(nz,ngf*32,kernel_size=4),
nn.BatchNorm2d(ngf*32),
nn.ReLU())
... |
"""
act.qc.qctests
------------------------------
Here we define the methods for performing the tests and putting the
results in the ancillary quality control varible. If you add a test
to this file you will need to add a method reference in the main
qcfilter class definition to make it callable.
"""
import numpy as... |
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 UserSerializer, AuthTokenSerializer
class CreateUserView(generics.CreateAPIView):
"""Create a new user in the s... |
import io
import base64
from IPython.display import HTML
import gym
import numpy as np
def play_video(filename):
encoded = base64.b64encode(io.open(filename, 'r+b').read())
embedded = HTML(data='''
<video controls>
<source src="data:video/mp4;base64,{0}" type="video/mp4" />
</video>... |
def get_phases(FLAGS):
return [
{'name' : 'Pre',
'num_epochs': FLAGS.pre_train_epochs,
'policy' : FLAGS.pre_train_policy if (FLAGS.pre_train_policy != 'same') else FLAGS.planner,
'incl_uk' : FLAGS.pre_train_uk,
'final_eval': False},
... |
from constants.core.constraints import CoreConstraintConstants
from exceptions.core.constraints import InvalidConstraintPropertyException
from exceptions.core.base import UnSupportedException
from orm.core.columns import CoreSQLColumn
from orm.core.tables import TableMetaClass
class CoreConstraint:
"""CoreConstra... |
from django.conf.urls import url
from .views import finaid_edit, finaid_email, finaid_message, finaid_review, \
finaid_review_detail, finaid_status, finaid_download_csv, \
receipt_upload, FinaidAcceptView, FinaidDeclineView, \
FinaidProvideInfoView, FinaidWithdrawView, FinaidRequestMoreView
urlpatterns =... |
# lambda or also called anonymous function
# def double(n)
# return n*2
# Now you can write it in one line
double = lambda n: n*2
print(double(10))
# With if else
find_larger = lambda a, b: a if a > b else b
print(find_larger(24, 69))
# With lists
names = ["Alan", "Gregory", "Zlatan", "Jonas", "Tom", "Augusti... |
#!/usr/bin/env python
# Installation script for diffpy.Structure
"""srxplanar - 2D diffraction image integration and uncertainty propagation
using non splitting pixel algorithm
Packages: diffpy.srxplanar
"""
import os
from setuptools import setup, find_packages
# versioncfgfile holds version data for git commit ... |
import warnings
from collections import namedtuple
from enum import Enum
from dagster import check
from dagster.core.storage.tags import PARENT_RUN_ID_TAG, ROOT_RUN_ID_TAG
from dagster.core.utils import make_new_run_id
from dagster.serdes import Persistable, whitelist_for_persistence, whitelist_for_serdes
from .tags ... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Run a YOLO_v3 style detection model on test images.
"""
import colorsys
import os
import random
import time
import cv2
import numpy as np
from keras import backend as K
from keras.models import load_model
from PIL import Image, ImageDraw, ImageFont
from timeit import ... |
"""Wrapper to integrate with Arcanist's .arcconfig file."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# phlsys_arcconfig
#
# Public Functions:
# find_arcconfig
# load
# get_arcconfig
#
... |
from conans import ConanFile, CMake
import os
class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
requires = "glfw/3.3.4"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
bin... |
import numpy as np
import pytest
from tests.functional.bach.test_data_and_utils import assert_equals_data, \
get_df_with_railway_data, get_df_with_test_data
def test_value_counts_basic(engine):
bt = get_df_with_test_data(engine)[['municipality']]
result = bt.value_counts()
np.testing.assert_equal(
... |
import unittest
import ray
import ray.rllib.agents.sac as sac
from ray.rllib.utils.framework import try_import_tf, try_import_torch
from ray.rllib.utils.test_utils import check_compute_single_action, framework_iterator
tf1, tf, tfv = try_import_tf()
torch, nn = try_import_torch()
class TestRNNSAC(unittest.TestCase)... |
"""
This file offers the methods to automatically retrieve the graph Actinomyces vulturis.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protein a... |
log_level = 'INFO'
load_from = None
resume_from = None
dist_params = dict(backend='nccl')
workflow = [('train', 1)]
checkpoint_config = dict(interval=10)
evaluation = dict(interval=10, metric='mAP', key_indicator='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning... |
#!/usr/bin/env python
# 2018, Patrick Wieschollek <mail@patwie.com>
from __future__ import print_function
import numpy as np
import tensorflow as tf
from user_ops import matrix_add
np.random.seed(42)
tf.set_random_seed(42)
matA = np.random.randn(1, 2, 3, 4).astype(np.float32) * 10
matB = np.random.randn(1, 2, 3, 4).... |
import timeit
import statistics
_setup = '''
from PIL import Image
num_colors = 6
img = Image.open('data/test.png')
img.load()
'''
_code = '''
import colorgram
colorgram.extract(img, num_colors)
'''
number = 20
repeats = 10
measures = timeit.repeat(setup=_setup, stmt=_code, number=number, repeat=repeats)
_mean = sta... |
# Copyright 2021 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... |
# coding=utf-8
# 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 requ... |
# misc.py - miscellaneous geodesy and time functions
#
# This file is Copyright (c) 2010 by the GPSD project
# BSD terms apply: see the file COPYING in the distribution root for details.
# This code runs compatibly under Python 2 and 3.x for x >= 2.
# Preserve this property!
from __future__ import absolute_import, pri... |
# pyflyby/_imports2s.py.
# Copyright (C) 2011-2017 Karl Chen.
# License: MIT http://opensource.org/licenses/MIT
from __future__ import absolute_import, division, with_statement
import re
from pyflyby._file import FileText, Filename
from pyflyby._flags import CompilerFlags
from pyflyby._ide... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.13.5
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... |
from backlight.labelizer.utils import load_label, from_dataframe, create_labels # noqa |
import pathlib
import os.path
import itertools
import logging
import time
import json
logger = logging.getLogger(__name__)
curr_path = pathlib.Path(__file__).parent.absolute()
def jl_test_file_path(filename):
return os.path.join(curr_path, "jl_dash_assets", filename)
def test_jldada001_assets(dashjl):
fp = jl... |
# Construct taken from Standard Library, anydbm.py.
def my_open(file, flag='r', mode=0666):
_ = file
_ = flag
print ''
print 'mode: ', mode
return 'OK'
def test_open():
result = open('some file')
print 'result: ', result |
class ErrorCodes(object):
"""
A set of constants representing validation errors. Validation error messages can change, but the codes will not.
See the source for a list of all errors codes.
Codes can be used to check for specific validation errors::
result = Transaction.sale({})
asser... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tensorflow/core/framework/summary.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf i... |
from django.apps import AppConfig
class NewsletterConfig(AppConfig):
name = "newsletter" |
import fixtures
import testtools
import os
import uuid
from connections import ContrailConnections
from contrail_test_init import *
from vn_test import *
from vm_test import *
from quantum_test import *
from vnc_api_test import *
from nova_test import *
from testresources import OptimisingTestSuite, TestResource
clas... |
####### RNN DECODER
import torch
import torch.nn as nn
import torch.nn.functional as F
class Attention(nn.Module):
'''
Attention network for calculate attention value
'''
def __init__(self, encoder_dim, decoder_dim, attention_dim):
'''
:param encoder_dim: input size of encoder network
... |
def recall(pycm_obj):
return {key: pycm_obj.TPR[key] if pycm_obj.TPR[key] != "None" else 0. for key in pycm_obj.TPR}
def precision(pycm_obj):
return {key: pycm_obj.PPV[key] if pycm_obj.PPV[key] != "None" else 0. for key in pycm_obj.PPV}
def f1(pycm_obj):
return {key: pycm_obj.F1[key] if pycm_obj.F1[key]... |
"""Functions that analyze dialogues and models.
"""
import json
from collections import defaultdict
import numpy as np
from cocoa.core.entity import is_entity
from cocoa.model.util import entropy, safe_div
from cocoa.model.counter import build_vocabulary, count_ngrams
from cocoa.model.ngram import MLENgramModel
from ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
vispy backend for the IPython notebook (vnc approach).
We aim to have:
* ipynb_static - export visualization to a static notebook
* ipynb_vnc - vnc-approach: render in Py... |
with open('desafio-ibge.csv', encoding='ISO-8859-1') as arquivo:
for inf in arquivo:
inf = inf.strip().split(',')
print(inf[8], inf[3]) |
from __future__ import division, absolute_import
import json
from twisted.words.xish import domish
from twisted.python import log
from twisted.words.protocols.jabber.jid import JID
from twisted.internet import defer
from twisted.application import service
from twisted.words.protocols.jabber import jid
from wokkel.xm... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider, Button, RadioButtons
fig, ax = plt.subplots()
plt.subplots_adjust(left=0.25, bottom=0.25)
t = np.arange(0.0, 1.0, 0.001)
a0 = 5
f0 = 3
delta_f = 5.0
s = a0 * np.sin(2 * np.pi * f0 * t)
l, = plt.plot(t, s, lw=2)
ax.margins(x=0)
a... |
"""
Classes example based on:
http://interactivepython.org/runestone/static/pythonds/Introduction/
ObjectOrientedProgramminginPythonDefiningClasses.html
@author Alex Sáez
"""
class LogicGate(object):
def __init__(self, name):
self.name = name
self._output = None
def connect_output_to(self, o... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
#! /opt/sharcnet/python/2.7.3/bin/python
# #######################################
# SUBMISSION
# #######################################
# sqsub -r 10m -f xeon -q mpi -o extracting_features_for_billboard -n 2 python ./4_SCRIPTS/MPI/3_billboard_metrics_test.py 0 (8 songs)
# sqsub -r 90m -f xeon -q mpi -o extracting_f... |
from service import Service
class RuTaxi(Service):
def send_sms(self):
self.session.post('https://moscow.rutaxi.ru/ajax_keycode.html',
data={'1': self.formatted_phone}) |
import numpy as np
import time
import json
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from django.http import HttpResponseRedirect, HttpResponse, JsonResponse
from django.views.generic.base import TemplateView
from django.core import serializers
from django.shortcuts import render
fr... |
# coding: utf-8
import pprint
import re
import six
class BackendApiBase:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is ... |
from django import forms
from .models import Genome1kSample
class Genomes1kForm(forms.Form):
sample = forms.ModelChoiceField(
queryset=Genome1kSample.objects.all().order_by('name'),
) |
def getDB(log, config):
'''Factory method for getting specific DB implementation'''
supported_dbms = {}
try:
from .aCTDBSqlite import aCTDBSqlite
supported_dbms['sqlite'] = aCTDBSqlite
except:
pass
try:
from .aCTDBMySQL import aCTDBMySQL
supported_dbms['mysq... |
"""
Websocket based API for Home Assistant.
For more details about this component, please refer to the documentation at
https://home-assistant.io/developers/websocket_api/
"""
import asyncio
from contextlib import suppress
from functools import partial
import json
import logging
from aiohttp import web
import voluptu... |
"""
.. todo::
doc
"""
__all__ = [
"cached_path",
"get_filepath",
"get_cache_path",
"split_filename_suffix",
"get_from_cache",
]
import os
import re
import shutil
import tempfile
from pathlib import Path
from urllib.parse import urlparse
import requests
from requests import HTTPError
from tqdm... |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains th... |
from molsysmt._private.digestion import digest_item, digest_atom_indices, digest_structure_indices
def to_parmed_Structure(item, atom_indices='all', structure_indices='all', check=True):
if check:
digest_item(item, 'file:mol2')
atom_indices = digest_atom_indices(atom_indices)
structure_in... |
from PyQt5.QtWidgets import QMainWindow, QDialogButtonBox
from PyQt5.QtWidgets import QVBoxLayout
from PyQt5.QtWidgets import QGridLayout
from PyQt5.QtWidgets import QFormLayout
from PyQt5.QtWidgets import QWidget
from PyQt5.QtWidgets import QLineEdit
from PyQt5.QtWidgets import QLabel
from PyQt5.QtWidgets import QDial... |
#!/usr/bin/env python3
import sys
sys.path.insert(0, "../lib-ext")
sys.path.insert(0, "..")
import unittest
from omron_2jcie_bu01 import Omron2JCIE_BU01
class BLENotificationTestCase(unittest.TestCase):
ADDRESS = None
@classmethod
def setUpClass(cls):
sensor = Omron2JCIE_BU01.ble()
cls.AD... |
import cv2
import time
# this is accessing my Ubuntu/Linxux /dev/ folder to check
# probably you have different path
# I can check the available options by running `ls /dev/video*` at CLI
# mine shows video0, video1, video5, video6 right now
cap = cv2.VideoCapture('/dev/video5')
# allow the camera to warmup
time.sleep... |
from django.db import models
# Create your models here.
class BaseModel(models.Model):
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
creator = models.IntegerField()
updator = models.IntegerField()
class Meta:
abstract = True
class Workfl... |
from . import FixtureTest
class AirportIataCodes(FixtureTest):
def test_sfo(self):
# San Francisco International
self.load_fixtures(['https://www.openstreetmap.org/way/23718192'])
self.assert_has_feature(
13, 1311, 3170, 'pois',
{'kind': 'aerodrome', 'iata': 'SFO'}... |
#!/usr/bin/env python3
"""
This file is for configuration testing Airflow images.
The Airflow image is started in Docker, configured to access an
instance of postgres, which is also running in Docker.
Testinfra is used to configuration test the image. In effect,
testinfra simplifies and provides syntactic sugar for do... |
# coding=utf-8
from zentropi import (
Agent,
on_event,
on_message,
on_state,
run_agents
)
from zentropi.shell import ZentropiShell
class Relay(Agent):
@on_event('*** started')
def setup(self, event):
# Define custom states.
self.states.power = False
@on_message('switch... |
"""
A CLI that allows you to easily manage your airflow-dev-env
"""
import sys
from PyInquirer import style_from_dict, prompt, Separator
import subprocess
from manage_config import *
banner = """
___ _ _
_ / ___)_ ) ( )
_ _(_)_ __|... |
import datetime
from django.utils.decorators import method_decorator
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import viewsets
from rest_framework.filters import OrderingFilter
from rest_framework.pagination import LimitOffsetPagination
from rest_framework.parsers import FileUpl... |
#!/usr/bin/env python3
# -*- Coding: UTF-8 -*- #
# -*- System: Linux -*- #
# -*- Usage: *.py -*- #
# Owner: Jacob B. Sanders
# Source: code.cloud-technology.io
# License: BSD 2-Clause License
"""
...
"""
# =============================================================================
# Standard Library
# ===... |
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... |
# coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#---------------------------------------------------------------------... |
"""Functions for parsing Links
"""
__all__ = ("parseLinkLabel", "parseLinkDestination", "parseLinkTitle")
from .parse_link_label import parseLinkLabel
from .parse_link_destination import parseLinkDestination
from .parse_link_title import parseLinkTitle |
def setup():
size (600,600)
noLoop()
def drawMyScene(myColor,x):
rotate(PI/4*x)
fill(myColor)
rect(0,50,150,50)
rect(50,0,50,150)
def draw():
background(20)
smooth()
noStroke()
pushMatrix()
translate(100,0)
drawMyScene(180,1)
popMatrix()
pus... |
from django_hosts import patterns, host
host_patterns = patterns(
'',
host(r'fanpai', 'kcc3.urls', name='root'),
host(r'yakuman', 'yakumans.urls', name='yakumans'),
) |
# Copyright (c) 2022 Massachusetts Institute of Technology
# Usage:
#
# python project_tooling/add_header.py
#
import fileinput
import os
import os.path as path
from pathlib import Path
OLD_HEADER = "# Copyright (c) 2021 Massachusetts Institute of Technology"
NEW_HEADER = "# Copyright (c) 2021 Massachusetts Institut... |
#!/usr/bin/env python
'''
searx is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
searx is distributed in the hope that it will be use... |
# Once for All: Train One Network and Specialize it for Efficient Deployment
# Han Cai, Chuang Gan, Tianzhe Wang, Zhekai Zhang, Song Han
# International Conference on Learning Representations (ICLR), 2020.
import copy
import torch.nn as nn
from codebase.third_party.spos_ofa.ofa.utils.layers import set_layer_from_conf... |
import io
from dagster_aws.s3 import S3FakeSession, S3FileCache, S3FileHandle
def test_s3_file_cache_file_not_present():
session_fake = S3FakeSession()
file_store = S3FileCache(
s3_bucket='some-bucket', s3_key='some-key', s3_session=session_fake, overwrite=False
)
assert not file_store.has_f... |
# Copyright 2015 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... |
import random
import re
from datetime import datetime
from flask import request, abort, current_app, make_response, jsonify, session
from info import redis_store, constants, db
from info.libs.yuntongxun.sms import CCP
from info.models import User
from info.modules.passport import passport_blu
from info.utils.captcha.c... |
import os
import logging
import shlex
import subprocess
from documentstore_migracao import config, exceptions
logger = logging.getLogger(__name__)
ISIS2JSON_PATH = "%s/documentstore_migracao/utils/isis2json/isis2json.py" % (
config.BASE_PATH
)
def create_output_dir(path):
output_dir = "/".join(path.split("... |
import pytest
from vyper import compiler
from vyper.exceptions import InvalidType, TypeMismatch
fail_list = [
(
"""
@external
def convert2(inp: uint256) -> uint256:
return convert(inp, bytes32)
""",
TypeMismatch,
),
(
"""
@external
def modtest(x: uint256, y: int128) -> uint... |
import sys
import fcntl
import struct
import array
import bluetooth
import _bluetooth as bt # low level bluetooth wrappers.
def __get_acl_conn_handle(sock, addr):
hci_fd = sock.fileno()
reqstr = struct.pack( "6sB17s", bt.str2ba(addr), bt.ACL_LINK, "\0" * 17)
request = array.array( "c", reqstr )
fcntl... |
# Generated by Django 2.1 on 2018-08-21 07:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0006_auto_20180821_1312'),
]
operations = [
migrations.CreateModel(
name='Locality',
fields=[
... |
from .adsclient import AdsClient
from .adsconnection import AdsConnection
from .adsdatatypes import AdsDatatype
from .adsexception import PyadsException
from .adsexception import AdsException
from .adsexception import PyadsTypeError
from .adsstate import AdsState
from .adssymbol import AdsSymbol
from .amspacket import ... |
"""
Created on 22.09.2009
@author: alen
"""
import uuid
from oauth import oauth
from django.conf import settings
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.shortcuts import render_to_response
from django.utils.translation import gettext as _
from django.utils.h... |
from __future__ import division
import torch
import torch.nn as nn
from .base import BaseDetector
from .test_mixins import RPNTestMixin
from .. import builder
from ..registry import DETECTORS
from mmdet.core import (build_assigner, bbox2roi, bbox2result, build_sampler,
merge_aug_masks)
@DETE... |
"""Extract, format and print information about Python stack traces."""
import collections
import itertools
import linecache
import sys
__all__ = ['extract_stack', 'extract_tb', 'format_exception',
'format_exception_only', 'format_list', 'format_stack',
'format_tb', 'print_exc', 'format_exc', 'pr... |
import numpy as np
from scipy.special import expit
def log_cost(theta, x, y_i, hyper_p):
"""
Logistic regression cost function with regularization.
Parameters
----------
theta : array_like
Shape (n+1,). Parameter values for function.
x : array_like
... |
from django.forms.models import modelform_factory
from django.views.generic import (
DetailView,
CreateView,
UpdateView,
DeleteView,
TemplateView
)
from django_tables2 import SingleTableView
from crudbuilder.registry import registry
from crudbuilder.mixins import (
CrudBuilderMixin,
BaseLis... |
import numpy as np
from C4Board import C4Board
from random import seed, choice
from os import urandom
from time import time
from itertools import cycle
from sys import argv
def getTrainingData(noOfGames, dataGenFlag, inpTrainFile, outTrainFile):
turnFlag = 0
gameEndState = 0
tempOutTrainList = [] # stores exp... |
# orm/util.py
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from .. import sql, util, event, exc as sa_exc, inspection
from ..sql import expression... |
import unittest
import requests
import jwt
import json
import sys
from contextlib import contextmanager
from functools import wraps
class TestJWT(unittest.TestCase):
HMAC_SECURED_URL = "http://testjwt.local/hmac_secured"
RSA_SECURED_URL = "http://testjwt.local/rsa_secured"
EC_SECURED_URL = "http://testjwt... |
import os
import requests as rt
from pathlib import Path
"""
Recebe ano como inteiro e COD_ESC como string para determinar o endereço do
arquivo e definição do nome para ser salvo. Retorna o nome do arquivo.
"""
def download_pdf(ano, COD_ESC):
ano = str(ano)
url = 'http://idesp.edunet.sp.gov.br/arquivos'+... |
# -*- encoding: utf-8 -*-
r"""
Display Manager
This is the heart of the rich output system, the display manager
arbitrates between
* Backend capabilities: what can be displayed
* Backend preferences: what gives good quality on the backend
* Sage capabilities: every Sage object can only generate certain
representa... |
# -*- coding:utf-8 -*-
from flask import Blueprint
admin_bp= Blueprint('admin', __name__) |
# Generated by Django 3.0.5 on 2020-05-03 03:55
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('core', '0002_user_last_name'),
]
operations = [
migrations.AddField(
model_name='user',
... |
# Copyright 2021 Fagner Cunha
#
# 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,... |
"""
This file is an example of some Sublime specific plugin code that is contained
within the dependency but later exposed via the bootstrapped system package.
In use this could be one or more files with a variety of commands and event
listeners. The examples here do nothing but generate log messages.
Note that this ... |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import re
import datetime
import mock
from distutils.version import StrictVersion
from redis import Redis
from tests import RQTestCase, fixtures
from rq.utils import backend_class, ens... |
import os
# os.environ["CUDA_VISIBLE_DEVICES"] = "0"
from ResNet import ResNet
import argparse
from utils import *
import time
from common.utils import allocate_gpu
def find_next_time(path_list, default=-1):
if default > -1:
return default
run_times = [int(path.split('_')[0]) for path in path_list]
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.