text stringlengths 1 927k |
|---|
# config.py
__all__ = ['VOCroot', 'COCOroot', 'VOC_300', 'VOC_SSD_300', 'VOC_512', 'COCO_300',
'COCO_SSD_300', 'COCO_512', 'COCO_mobile_300']
VOCroot = "data/VOCdevkit" # path to VOCdevkit root dir
COCOroot = "data/COCO" # path to COCO root dir
# RFB CONFIGS
VOC_300 = {
'feature_maps': [38, 19, ... |
#-*- coding: utf-8 -*-
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth import get_user_model
from django.contrib import messages
from django.utils.translation import ugettext as _
from spirit.utils.decorators import administrator_required
from spirit.forms.admin import UserE... |
# Copyright 2012-2017 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agree... |
# -*- coding: utf-8 -*-
from sqlalchemy.ext.declarative import declarative_base
OrmBase = declarative_base() |
# Automatically generated from poetry/pyproject.toml
# flake8: noqa
# -*- coding: utf-8 -*-
from setuptools import setup
packages = \
['c7n_mailer', 'c7n_mailer.azure_mailer']
package_data = \
{'': ['*'], 'c7n_mailer': ['msg-templates/*']}
install_requires = \
['Jinja2>=3.0,<4.0',
'boto3>=1.11.12,<2.0.0',
'datadog... |
"""Multicast transport for stomp.py.
Obviously not a typical message broker, but convenient if you don't have a broker, but still want to use stomp.py
methods.
"""
import struct
from stomp.connect import BaseConnection
from stomp.protocol import *
from stomp.transport import *
from stomp.utils import *
MCAST_GRP = ... |
"""anjou.config
Reads and parses the configuration YAML.
Functions:
read_config(str) -> dict (throws ConfigException)
"""
from cerberus import Validator
from cerberus.validator import DocumentError
from yaml import safe_load
from anjou.model import CONFIG_SCHEMA, ConfigException
def _is_valid(config: dict) ->... |
# <pep8-80 compliant>
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 option) any later version.
#
# ... |
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import numpy as np
class Mesh(object):
def __init__(self, mesh_cells, domain_upper, mat_map):
assert type(mesh_cells) == int, "mesh_cells must be an int"
self._mesh_params = {'x_cell': mesh_cells,
... |
# Meu código
"""
from math import sqrt
co = float(input('Digite um valor pro cateto oposto: '))
ca = float(input('Digite um valor pro cateto adjacente: '))
co2 = co * co
ca2 = ca * ca
rqm = (ca2 + co2)
rq = sqrt(rqm)
print("O valor da hipotenusa é de {:.2f}".format(rq))
"""
# Código do curso
from math import hypot
co =... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This program processes transcribed audio in Transcriber files and copies all
relevant speech segments into a destination directory.
It also extracts transcriptions and saves them alongside the copied wavs.
It scans for '*.trs' to extract transcriptions and names of wav... |
#
# Copyright (C) 2019 The Android Open Source Project
#
# 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 la... |
# Copyright 2019 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 math
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn import Module
def fused_leaky_relu(input, bias, negative_slope=0.2, scale=2 ** 0.5):
rest_dim = [1] * (input.ndim - bias.ndim - 1)
input = input.cuda()
if input.ndim == 3:
return (
F.leaky_r... |
from typing import Any, Callable, Iterable, List, Optional, Tuple, Union
import warnings
import numpy as np
import pytorch_lightning
from scipy.sparse import csr_matrix
import torch
from torchmetrics import Metric
from torchmetrics.functional import auroc
from tqdm.auto import tqdm
import collie
from collie.interacti... |
import cv2
################################################################
path = 'haarcascades/haarcascade_frontalface_default.xml' # PATH OF THE CASCADE
cameraNo = 1 # CAMERA NUMBER
objectName = 'Arduino' # OBJECT NAME TO DISPLAY
frameWidth= 640 # DISPLAY WIDTH
frame... |
# ---------------------------------------------------------------------
# Eltex.LTE.get_config
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# NOC module... |
from .smoothing import smooth_path
from .rrt import TreeNode, configs
from .utils import irange, argmin, RRT_ITERATIONS, RRT_RESTARTS, RRT_SMOOTHING
def rrt_connect(q1, q2, distance, sample, extend, collision, iterations=RRT_ITERATIONS):
if collision(q1) or collision(q2):
return None
root1, root2 = Tr... |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 law o... |
class Graph:
graph_dict={}
def addEdge(self,node,neighbour):
if node not in self.graph_dict:
self.graph_dict[node]=[neighbour]
else:
self.graph_dict[node].append(neighbour)
def show_edges(self):
for node in self.graph_dict:
... |
# Generated by Django 2.2.7 on 2020-01-23 23:37
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('accounts', '0010_watched... |
"""
WSGI config for games project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTING... |
import uuid
from django.db import models
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser
)
from django.db.models.signals import post_save
class MyUserManager(BaseUserManager):
def create_user(self, email, password=None):
if not email:
raise ValueError('Users must... |
# -*- coding: utf-8 -*-
def run():
number = int(raw_input('Ingresa un numero: '))
state = is_prime(number)
if state == True:
print('Es primo')
else:
print('No es primo')
def is_prime(number):
if number < 2:
return False
elif number == 2:
return True
elif numb... |
import logging
import wx
class LogPanel(wx.Panel):
"""
Simple wxPanel containing a text control which will display the root
logger's stream.
"""
class CustomConsoleHandler(logging.StreamHandler):
def __init__(self, text_ctrl, *args, **kwargs):
super().__init__(*args, *... |
# encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from django.test import TestCase
from .models import MicroBlogPost
class AppConfigTests(TestCase):
def test_index_collection(self):
from haystack import connections
unified_index = connections[... |
"""
Module to provide tests related to the MD019 rule.
"""
from test.markdown_scanner import MarkdownScanner
import pytest
# pylint: disable=too-many-lines
@pytest.mark.rules
def test_md019_good_single_spacing():
"""
Test to make sure this rule does not trigger with a document that
contains an Atx Headi... |
"""Class for printing reports on profiled python code."""
# Class for printing reports on profiled python code. rev 1.0 4/1/94
#
# Based on prior profile module by Sjoerd Mullender...
# which was hacked somewhat by: Guido van Rossum
#
# see profile.doc and profile.py for more info.
# Copyright 1994, by InfoSeek Co... |
import ray
import mlflow
import torch
from src.models import Bagging
from src.models import LogisticRegression
from src.evaluation import loocv
from src.utils import data_loaders
from src.utils import data_savers
from src.utils import mlflow as u_mlflow
RUN_NAME = "Bagging Logistic Regression"
MODEL_NAME = "bagging-l... |
# coding: utf-8
import re
import numpy as np
from scipy import stats
from abc import ABCMeta, abstractmethod
from .utils import mk_class_get
from .utils import handleKeyError
from .utils import handleRandomState
class KerasyAbstInitializer(metaclass=ABCMeta):
def __init__(self):
self.name = re.sub(r"([a-z... |
from operator import itemgetter, attrgetter
from query.models import Video
from esper.prelude import collect
from rekall.interval_list import Interval, IntervalList
import os
import json
import re
CAPTION_METADATA_DIR = '/app/data/subs/meta'
def clean_speaker(speaker):
speaker = speaker.lower()
speaker = re.s... |
import random
import itertools
import subprocess as sp
import os
import shutil
from subprocess import STDOUT
import os, sys
import numpy as np
from mindmappings.parameters import Parameters
from mindmappings.costModel.timeloop.timeloop import Timeloop
from mindmappings.utils.utils import factors, replicate
examples = ... |
# -*- test-case-name: twisted.test.test_logfile -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
A rotating, browsable log file.
"""
# System Imports
import os, glob, time, stat
from twisted.python import threadable
class BaseLogFile:
"""
The base class for a log file that ... |
import logging
import shutil
import pickle
import dropbox
from datetime import datetime
from pathlib import Path
from threading import Event
from requests.exceptions import ReadTimeout, ConnectionError
from dropbox.exceptions import ApiError, AuthError
from dropbox.files import FileMetadata, FolderMetadata
from .misc i... |
from __future__ import print_function, division
import numpy as np
from scipy.stats import chi2, multivariate_normal
from mlfromscratch.utils import mean_squared_error, train_test_split, polynomial_features
class BayesianRegression(object):
"""Bayesian regression model. If poly_degree is specified the features w... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
"""
WSGI config for ask project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ask.settings")
from django.core.wsgi impo... |
import os
import re
import json
from typing import List, Dict, Set
from collections import defaultdict
from stog.data.dataset_readers.amr_parsing.io import AMRIO
from stog.data.dataset_readers.amr_parsing.amr import AMR
def prev_token_is(index: int, k: int, amr: AMR, pattern: str):
if index - k >= 0:
ret... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-28 10:44
from __future__ import unicode_literals
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
depe... |
#! usr/bin/python3.6
"""
Module initially auto generated using V5Automation files from CATIA V5 R28 on 2020-06-11 12:40:47.360445
.. warning::
The notes denoted "CAA V5 Visual Basic Help" are to be used as reference only.
They are there as a guide as to how the visual basic / catscript function... |
# Copyright 2022 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Serialization Methods for Classes.
This module is inspired by the `serde` crate in Rust, and the dataclasses python
module.
It provides a type-aware mecha... |
import struct
print(struct.calcsize("P") * 8) |
from wtforms import DecimalField, Form, RadioField
from wtforms.validators import NumberRange
class NCForm(Form):
c8_0 = DecimalField('C8:0', validators=[NumberRange()])
c10_0 = DecimalField('C10:0', validators=[NumberRange()])
c12_0 = DecimalField('C12:0', validators=[NumberRange()])
c14_0 = DecimalF... |
"""
Bali ModelResource
"""
from .resource import Resource
from ..db.operators import get_filters_expr
from ..schemas import ListRequest
__all__ = ['ModelResource']
class ModelResource(Resource):
"""
`ModelResource` is a fast way to implement resource layer
for model objects
"""
model = None
... |
#!/usr/bin/env python2
# Copyright (c) 2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import socket
import traceback, sys
from binascii import hexlify
import time, os
from socks5 import Socks5Conf... |
# Copyright 2018 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 (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 ... |
import django
if django.VERSION >= (1, 10, 1):
def user_is_authenticated(user):
# Explicit comparision due to the following bug
# https://code.djangoproject.com/ticket/26988
return user.is_authenticated == True # noqa E712
else:
def user_is_authenticated(user):
return user.is_... |
"""Stack loss data"""
__all__ = ['COPYRIGHT','TITLE','SOURCE','DESCRSHORT','DESCRLONG','NOTE', 'load']
__docformat__ = 'restructuredtext'
COPYRIGHT = """This is public domain. """
TITLE = __doc__
SOURCE = """
Brownlee, K. A. (1965), "Statistical Theory and Methodology in
Science and Engineering", 2nd e... |
import cv2
import mediapipe as mp
class handDetector():
"""
Initiating:
mode = False --> when using dynamic video capture
maxHands --> How many hands to detect
detectionCon --> success of detection
trackCon --> used for tracking of hand, might have increased latency
"""
def __init__(sel... |
import win32com.client
import clipboard
from win32api import SetCursorPos, mouse_event
from win32con import MOUSEEVENTF_LEFTDOWN, MOUSEEVENTF_LEFTUP
from time import sleep
from pyautogui import hotkey
from pynput import mouse
import pythoncom
#Select text
#press mouse button
#ctrl+c
#remove new line characters and ta... |
from office365.runtime.client_value import ClientValue
from office365.sharepoint.principal.principalSource import PrincipalSource
from office365.sharepoint.principal.principalType import PrincipalType
class ClientPeoplePickerQueryParameters(ClientValue):
def __init__(self, queryString, allowEmailAddresses=True, ... |
import datetime
from pydantic import BaseModel
class BinsOpened(BaseModel):
card_id: str
bin_id: int
bin_type: str
timestamp: datetime.datetime
weight: int
recycle_status_ok: bool = False
class BinsStatus(BaseModel):
bin_id: int
timestamp: datetime.datetime
waste_status: int |
print(sum([i for i in range(1_000_000)])) |
import qtm.base
import qtm.optimizer
import qtm.loss
import qtm.utilities
import numpy as np
import typing, types
import qiskit
import matplotlib.pyplot as plt
class QuantumCompilation():
def __init__(self) -> None:
self.u = None
self.vdagger = None
self.is_trained = False
self.opti... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-06 15:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('hit', '0006_auto_20160520_1810'),
]
operations = [
... |
# Generated by Django 2.0.9 on 2018-12-12 14:42
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('leave', '0003_auto_20181212_1214'),
]
operations = [
migrations.AddField(
model_name='request',
name... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
-----------------------------------------------------------------------------
Copyright (C) 2006-2014 University of Dundee. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public Lic... |
from time import sleep, time
import RPi.GPIO as gpio
import physical_objects as ph
gpio.setwarnings(False)
gpio.setmode(gpio.BCM)
# Initialize the physical objects in the system
elevator = ph.Elevator(motor1 = 23, motor2 = 24, enable = 25, speed = 50)
button = ph.Button(pin = 14)
dispenser = ph.Dispenser(pulse = 17,... |
"""
MIT License
Copyright (c) 2020 Airbyte
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, distr... |
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
import json
import logging
from urllib.parse import urlencode
import mock
from django_dynamic_fixture import get
from django.test import TestCase
from readthedocs.builds.models import Version
from readthedocs... |
import pymysql.cursors
from apscheduler.schedulers.blocking import BlockingScheduler
import pushNotification
import time
#I use the apscheduler to do schedule job, to prevent use too much system resource
current_rowcount_result = {}
first_check = True
#This is the connection of database
#This whole documentation cou... |
#!/usr/bin/env python
"""
Copyright 2017-2018 Fizyr (https://fizyr.com)
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 ... |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from pybrain.utilities import abstractMethod
from pybrain.structure.modules import Table, Module, TanhLayer, LinearLayer, BiasUnit
from pybrain.structure.connections import FullConnection
from pybrain.structure.networks import FeedForwardNetwork
from pybrain.struct... |
# -*- coding: utf-8 -*-
'''
Copyright (c) 2015 by Tobias Houska
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: Tobias Houska and Benjamin Manns
:paper: Houska, T., Kraft, P., Chamorro-Chavez, A. and Breuer, L.:
SPOTting Model Parameters Using a Ready-Made Python Package,
PLoS ONE, 10... |
g = [ ([],[('sel','V'),('cat','C')]),
([],[('sel','V'),('pos','wh'),('cat','C')]),
(['the'],[('sel','N'),('cat','D')]),
(['which'],[('sel','N'),('cat','D'),('neg','wh')]),
(['king'],[('cat','N')]),
(['queen'],[('cat','N')]),
(['wine'],[('cat','N')]),
(['beer'],[... |
import logging
import os
import unittest
from typing import (
Any,
Optional,
)
from galaxy.tool_util.verify.test_data import TestDataResolver
from galaxy_test.base.env import (
setup_keep_outdir,
target_url_parts,
)
log = logging.getLogger(__name__)
class FunctionalTestCase(unittest.TestCase):
"... |
from rest_framework.serializers import ModelSerializer
from api.models import Stock_En_Tienda, Tienda, Categoria, SubCategoria, Producto
class Stock_En_TiendaSerializer(ModelSerializer):
class Meta:
model = Stock_En_Tienda
depth = 2
fields = '__all__'
class TiendaSerializer(ModelSeriali... |
#!/usr/bin/env python3
"""
Sends a PWM via UAVCAN
"""
import argparse
import uavcan
import os
DSDL_DIR = os.path.join(os.path.dirname(__file__), "../uavcan_data_types/cvra")
def parse_args():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"port",
help="SocketCAN i... |
#
# Copyright 2014 "Igor Feoktistov" <ifeoktistov@yahoo.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
# 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... |
#!/usr/bin/env python
"""Generate data export CSVs
Load model data from the API or the existing CSV, process it according
to the rules defined in the CONFIG and store the output in the CSV.
CSV files are read from and saved to `<output-dir>/<model>.csv`
If called without a model name the script will dump all defined... |
# 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 Li... |
# -*- coding: utf-8 -*-
from numpy import array
from skyfield import api
from skyfield.api import EarthSatellite, load
from skyfield.constants import AU_KM, AU_M
from skyfield.sgp4lib import TEME_to_ITRF
from skyfield.timelib import julian_date
line1 = '1 25544U 98067A 18184.80969102 .00001614 00000-0 31745-4 0 ... |
""" A static class that allows the type of a file to be checked.
"""
import os
from subprocess import PIPE
from .popenwrapper import Popen
class FileType(object):
""" A hack to grok the type of input files.
"""
# These are just here to keep pylint happy.
UNKNOWN = None
ELF_EXECUTABLE = None
... |
from collections import OrderedDict, ChainMap
from copy import deepcopy
import os
import json
import pickle
import re
import io
import pandas
from libalignmentrs.alignment import SeqMatrix
from libalignmentrs.readers import fasta_to_dict
from alignmentrs.utils import to_intlist
__all__ = [
'FastaSerdeMixin', 'D... |
from .__init__ import *
def dataSummaryFunc(number_values=15, minval=5, maxval=50):
random_list = []
for i in range(number_values):
n = random.randint(minval, maxval)
random_list.append(n)
a = sum(random_list)
mean = a / number_values
var = 0
for i in range(number_values):
... |
from typing import Tuple
import seaborn as sns
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def heatmap(
elements: pd.DataFrame,
prop: str,
style: str = "whitegrid",
figsize: Tuple[int] = (16, 10),
cmap: str = "RdBu_r",
lw: int = 1,
output: str = None,
**kwarg... |
"""apps URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/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-based vi... |
# Software License Agreement (BSD License)
#
# Copyright (c) 2013, Eric Perko
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrigh... |
#!/usr/bin/env python3
from __future__ import print_function
import gzip
import json
import re
import sys
# import time
from argparse import ArgumentParser
# from datetime import datetime
class Options:
def __init__(self):
self.usage = 'characterise_inauthentic_tweets.py -i <file of tweets> [-v|--verbos... |
import re
import nltk
import numpy
word_tags = ['CC', 'CD', 'DT', 'EX', 'FW', 'IN', 'JJ', 'JJR',
'JJS', 'LS', 'MD', 'NN', 'NNS', 'NNP', 'NNPS', 'PDT',
'POS', 'PRP', 'PRP$', 'RB', 'RBR', 'RBS', 'RP',
'SYM', 'TO', 'UH', 'VB', 'VBD', 'VBG', 'VBN', 'VBP',
'VBZ', 'WDT', ... |
#!/usr/bin/python2
# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for the EC-3PO interpreter."""
from __future__ import print_function
# pylint: disable=cros-logging-import
import loggi... |
__import__("pkg_resources").declare_namespace(__name__)
import ctypes
import os
from . import api
class File(object):
def __init__(self, filepath):
super(File, self).__init__()
self._path = filepath
def _get_version_info_size(self):
filepath = ctypes.create_unicode_buffer(self._path)
... |
import sys
import re
from math import *
class lattice_parser:
'''
input:
lines is lattice section lines,
line is usedline
'''
def __init__(self, fileName, lineName):
self.fileName = fileName
self.lineName = lineName.upper() # in code, upper case convention
... |
def hello():
""" prints hello, world """
print("Hello, world!")
def areacircle(radius):
""" Computes the area of a circle of the given radius """
area = 3.14*radius**2
print("The area of a circle of radius",radius,"is", area)
def areatriangle(b,h):
area = 0.5*b*h
print("The area of a triangl... |
from django import forms
from django.contrib.auth.models import User
from newsletter.models import Report
from newsletter.models import SiteUser
from django.contrib.auth.models import Group, Permission
class ReportForm(forms.ModelForm):
COUNTRIES = (('US', 'United States'),
('CA', 'Canada'),
... |
import file_io
def check_bool(val):
if val == 'true' or val == "True":
val = True
if val == 'false' or val == "False":
val = False
return val
def check_digit(val):
if val.replace(".","").isdigit():
val = float(val)
if val.is_integer():
val = int(val)
ret... |
import datetime
import json
import os
from decimal import Decimal
from uuid import UUID
import pytest
import respx
from conftest import *
from shipstation.api import ShipStation
from shipstation.models import *
from shipstation.pagination import Page
@respx.mock
def test_get_carrier(ss: ShipStation, mocked_api: res... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*
import numpy as np
from vpython import sphere, vector, color, rate
from box_utils import build_box, check_wall_hit
def create_balls(N: int=1, r: float=.2) -> list[sphere]:
balls = []
for i in range(N):
ball = sphere(color=color.green, radius=r, make_tra... |
import os
import shutil
import unittest
import tempfile
import platform
import getpass
import tarfile
from gppylib.db import dbconn
from gppylib.gparray import GpArray
from gppylib.gpversion import MAIN_VERSION
from contextlib import closing
from gppylib.commands import gp
from gppylib.commands.unix import Scp
from gp... |
from fireSummary.routes.api.v1.fires_router import fires_endpoints, glad_endpoints
from flask import jsonify
# GENERIC Error
def error(status=400, detail='Bad Request'):
return jsonify(errors=[{
'status': status,
'detail': detail
}]), status |
# AUTOGENERATED! DO NOT EDIT! File to edit: 04_summary image.ipynb (unless otherwise specified).
__all__ = [] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2014, Red Hat, Inc.
# Tim Bielawa <tbielawa@redhat.com>
# Magnus Hedemark <mhedemar@redhat.com>
# Copyright 2017, Dag Wieers <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ impo... |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import abc
import six
from cryptography_patched import utils
from crypt... |
# Import
import tensorflow as tf
import numpy as np
import pandas as pd
from collections import deque
import random
import tetris as tetris
# Hyperparameter
num_episodes = 500
num_exploration_episodes = 100
max_len_episode = 1000
batch_size = 40
learning_rate = 0.005
gamma = 0.95
initial_epsilon = 1.0
final_epsilo... |
# import the necessary packages
from __future__ import absolute_import
import numpy as np
import cv2
from ..convenience import is_cv2
class RootSIFT:
def __init__(self):
# initialize the SIFT feature extractor for OpenCV 2.4
if is_cv2():
self.extractor = cv2.DescriptorExtractor_create("SIFT")
# otherwise in... |
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import torch
import torch.multiprocessing as mp
from rlstructures import TemporalDictTensor, DictTensor
class Buffer:
def get_free_... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'haha.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
from databaseHandling import InterfaceClass
from webcam.webcam import Webcam
import sys... |
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
# 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/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.