text stringlengths 2 999k |
|---|
#
# Copyright (c) 2008-2016 Citrix Systems, 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 l... |
import math
import numpy
import pytest
from openff.toolkit.topology import Molecule, Topology
from openff.toolkit.typing.engines.smirnoff import ForceField, ParameterList
from simtk import unit
@pytest.fixture()
def buckingham_water_force_field() -> ForceField:
"""Create a buckingham water model Forcefield objec... |
#!/usr/bin/env python3
#################################################################################################
# Ev3TrackedExplor3r #
# Version 1.0 #
# ... |
# Copyright 2019 The Texar 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 applicable ... |
# vim: set fileencoding=utf-8 :
# Copyright 2012 Alexander Else <aelse@else.id.au>.
#
# This file is part of the python-crowd library.
#
# python-crowd 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 ve... |
# The App listening to new blocks written read the exstrincs and store the transactions in a mysql/mariadb database.
# the database must be created, the app will create the tables and indexes used.
# import libraries
# system packages
import sys
import os
import json
# Substrate module
from substrateinterface import Su... |
#!/bin/env python
from app import create_app, socketio
app = create_app(debug=True)
if __name__ == '__main__':
socketio.run(app, host="0.0.0.0")
|
'''OpenGL extension EXT.pixel_transform
This module customises the behaviour of the
OpenGL.raw.GL.EXT.pixel_transform to provide a more
Python-friendly API
Overview (from the spec)
This extension provides support for scaling, rotation, translation and
shearing of two-dimensional pixel rectangles in the... |
# Generated by Django 3.2.9 on 2021-11-25 06:33
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('meetups', '0004_remove_meetup_location'),
]
operations = [
migrations.AddField(
model_name='mee... |
import torch
import torch.nn as nn
from collections import OrderedDict
from .utils import load_state_dict_from_url
from .backbone_utils import darknet_backbone
from .transform import YOLOTransform
from .loss import YOLOLoss
__all__ = [
"YOLOv3", "yolov3_darknet53",
]
class YOLOv3(nn.Module):
def __init__(s... |
# Copyright 2015, 2016 OpenMarket Ltd
#
# 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 ... |
import csv
from pathlib import Path
from piecash import open_book
fields = [
"DATE",
"TRANSACTION VALUE",
"DEBIT/CREDIT INDICATOR",
"ACCOUNT",
"ACCOUNT CODE",
"CONTRA ACCOUNT",
"CONTRA ACCOUNT CODE",
"ENTRY TEXT",
]
GNUCASH_BOOK = "../gnucash_books/simple_sample.gnucash"
CSV_EXPORT = ... |
def get_info(path2file):
to_return = dict()
to_return["train_acc"] = []
to_return["train_loss"] = []
to_return["val_acc"] = []
to_return["val_loss"] = []
with open(path2file) as f:
for line in f:
if "train" in line:
... |
"""
pythonbible-api is an API wrapper for the pythonbible library using FastAPI.
"""
__version__ = "0.0.2"
|
# adding a label to gui
import tkinter as tk
from tkinter import ttk #ttk = themed tk
win = tk.Tk() # win is short for windows #constructor
win.title("Python GUI with label")
ttk.Label(win, text="A Label").grid(column=0, row=0) #set label text name an grid coordinates
win.mainloop()
|
import struct
import pytest
from puslib import get_policy
from puslib.ident import PusIdent
from puslib.packet import PusTcPacket, AckFlag
from puslib.parameter import UInt32Parameter, Int16Parameter, Real64Parameter
from puslib.services import RequestVerification, PusService20
from puslib.streams.buffer import Queue... |
# -*- coding: utf-8 -*-
#
# Copyright (C) Red Hat, 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 or ... |
import computer
import numpy as np
import time
Position = (0, 0)
Canvas = np.full([200, 200], -1, dtype=int)
Canvas[0, 0] = 1
Corners = [(0, 0), (0, 0)]
TileCount = 0
Direction = 0
def AddVectors(vec1, vec2):
if(len(vec1) != len(vec2)):
return None
out = []
for v in range(len(vec1)):
... |
import os
import argparse
import json
import torch
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.utils.data import DataLoader
import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping
# from asteroid import TransMask
from asteroid import DPTrans
# from a... |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'plain_base_29138.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
rai... |
def f(x):
# Primera operación
respuesta = 0
# Segunda operacion. Sin importar de x este loop correrá 1000 veces.
for i in range(1000):
respuesta += 1
# Tercera operación. Este loop correrá el valor de x
for i in range(x):
respuesta += x
# Cuarta operación. Esta parte esta... |
# -*- coding: utf-8 -*-
# Copyright 2019, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""
Parameter Class for variable parameters.
"""
class Parameter():
"""Parameter Class for variable parameters"""
de... |
from xdist.plugin import (
is_xdist_worker,
is_xdist_master,
get_xdist_worker_id,
is_xdist_controller,
)
from xdist._version import version as __version__
__all__ = [
"__version__",
"is_xdist_worker",
"is_xdist_master",
"is_xdist_controller",
"get_xdist_worker_id",
]
|
import _plotly_utils.basevalidators
class LenValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="len", parent_name="volume.colorbar", **kwargs):
super(LenValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
ed... |
# predict functions for predict.py
# Danny Olesh 22.11.2021
# Resources used:
# Study learning notes and code from the course
# https://pytorch.org/
# Udacity deeplearning pytorch help
# Self study and experiminationion using ATOM in Anaconda3 environment
# Edited code snippets for certain Network definitions https://... |
"""
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... |
#The is_positive function should return True if the number received is positive and False if it isn't.
#Can you fill in the gaps to make that happen?
def is_positive(number):
if number > 0:
return True
else:
return False
|
import os
class Base(object):
"""
Base object designed for providing generic functionality.
The Base object has the functionality to set title,
set working directories and make directories.
Attributes
----------
title : str
Title of the object.
cwdir : str
Current working directory.
"""
def __init__(... |
# Copyright 2020-2021 The Kubeflow Authors
#
# 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 ... |
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j F Y' # '25 Hydref 2006'
TIME_FORMAT = 'P' # '2:30 y.b.'
DA... |
'''
A custom Keras layer to generate anchor boxes.
Copyright (C) 2018 Pierluigi Ferrari
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 requir... |
# coding: utf-8
import pprint
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
class UpdateRuleResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict):... |
""" Some useful functions to port a model from lasagne to tensorflow.
* Lasagne uses the format BCHW, while tensorflow uses BHWC
(B = batch_size, C = channels, H = height, W = width)
* By default, lasagne uses convolution, while tensorflow implements
cross-correlation (convolution is equivalent to... |
# -*- coding: utf-8 -*-
"""Test atomic values from expression Parser"""
from inspect import isclass
import locale
import math
from json import JSONDecodeError
import pytest
import lark.exceptions
from lark_expr import Expression
from methods import list_methods
# pylint: disable=attribute-defined-outside-init
cla... |
"""
Django settings for commerce project.
Generated by 'django-admin startproject' using Django 3.0.2.
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/
"""
import os
... |
from pathlib import Path
from aiohttp import web
from aiohttp_apiset import SwaggerRouter
def test_app(loop, swagger_router):
app = web.Application(loop=loop)
swagger_router.setup(app)
def test_search_dirs():
d = Path(__file__).parent
r = SwaggerRouter(d / 'data/include.yaml')
r.add_search_dir... |
from . import VecEnvWrapper
from baselines.common.running_mean_std import RunningMeanStd
import numpy as np
class VecNormalize(VecEnvWrapper):
"""
A vectorized wrapper that normalizes the observations
and returns from an environment.
"""
def __init__(self, venv, ob=True, ret=True, clipob=10., cli... |
#Imagine you're writing the software for an inventory system for
#a store. Part of the software needs to check to see if inputted
#product codes are valid.
#
#A product code is valid if all of the following conditions are
#true:
#
# - The length of the product code is a multiple of 4. It could
# be 4, 8, 12, ... |
# 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
# coding: utf-8
# In[1]:
# Load dependencies
import numpy as np
import pandas as pd
from uncertainties import ufloat
from uncertainties import unumpy
# # Biomass C content estimation
#
# Biomass is presented in the paper on a dry-weight basis. As part of the biomass calculation, we converte... |
from core.advbase import *
class Cecile(Adv):
def prerun(self):
self.manachew_gauge = 0
self.manachew_mode = ModeManager(
group="manachew",
buffs=[Selfbuff("manachew_defense", 0.2, -1, "defense", "passive"), Selfbuff("manachew_sd", 0.1, -1, "s", "passive"), Selfbuff("manach... |
# Copyright 2015 NEC 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 applicable l... |
# -*- coding: utf-8 -*-
"""
Based entirely on Django's own ``setup.py``.
"""
import os
import sys
import setuptools
from distutils.command.install import INSTALL_SCHEMES
from distutils.command.install_data import install_data
from setuptools import setup
try:
from setuptools.command.test import test as TestCommand... |
# coding: utf-8
"""
Main BDF class. Defines:
- BDFInputPy
"""
import os
from collections import defaultdict
from itertools import count
from typing import List, Tuple, Optional, Union, Any, cast
from io import StringIO
import numpy as np
from cpylog import get_logger2
from pyNastran.nptyping import NDArrayN2int
fr... |
"""
Utilities required for Ip packages(Storing, removing and checking IP's efficiently).
"""
__version__ = "3.0.0"
__author__ = "rakesht2499"
|
__author__ = 'jonestj1'
import mbuild as mb
class PegMonomer(mb.Compound):
def __init__(self):
super(PegMonomer, self).__init__()
mb.load('peg_monomer.pdb', compound=self, relative_to_module=self.__module__)
self.translate(-self[0].pos)
self.add(mb.Port(anchor=self[0]), 'down')
... |
####################################################################
# #
# THIS FILE IS PART OF THE pycollada LIBRARY SOURCE CODE. #
# USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS #
# GOVERNED BY A BSD-STYLE SOURCE LICENSE INC... |
# coding: utf-8
"""
Megaputer Text Mining API
Megaputer Text Mining API # noqa: E501
OpenAPI spec version: 1.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class PerOperationLimitPeriodic1Response(object):
"""NOTE: This class is auto gene... |
import json
import argparse
from websocket import create_connection
from urllib.parse import urlparse
import tornado.ioloop
import tornado.web
import tornado.websocket
from blockchain import Blockchain, Block
from server import Peer
from const import RESPONSE_BLOCKCHAIN, QUERY_LATEST, QUERY_ALL
parser = argparse.A... |
from typing import Dict
def login_admin(admin: Dict) -> bool:
admin_all = [{"username": "renan", "password": "12345"}]
if admin.get("username") and admin.get("password"):
for index in admin_all:
if str(admin.get("username")).lower() == str(index.get("username")).lower():
if... |
"""
Django settings for yatube project.
Generated by 'django-admin startproject' using Django 2.2.19.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
#... |
import pytest
from capreolus import Benchmark, Task, module_registry
from capreolus.tests.common_fixtures import dummy_index, tmpdir_as_cache
tasks = set(module_registry.get_module_names("task"))
@pytest.mark.parametrize("task_name", tasks)
def test_task_creatable(tmpdir_as_cache, dummy_index, task_name):
provi... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Cisco Systems
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = r"""
---
module: network_access_profiles_info
short_description: Information module for Network Access Profiles
description:
- Get ... |
# coding=utf-8
# *** WARNING: this file was generated by pulumigen. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from . import outp... |
from . import local
import unittest
class LocalDestinationTestCase(unittest.TestCase):
def test_out_dir(self):
config = local.Config(out_dir='~/test/')
destination = local.LocalDestination(config)
# Weakly verify out_dir is expanded.
self.assertNotIn('~', destination.out_dir)
if... |
import math
from warriorpy.warriorpyGeography.src.relativeDirections import BACKWARD, FORWARD
from .base import AbilityBase
class Attack(AbilityBase):
def perform(self, direction="forward"):
self.verify_direction(direction)
receiver = self.unit(direction)
if receiver:
self._u... |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
SERVER_NAME = os.environ.get('SERVER_NAME') or 'localhost.dev:5000'
SECRET_KEY = os.environ.get('SECRET_KEY') or 'nunca-lo-adivinaras'
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
'sqlite:///' + os... |
import collections
import concurrent.futures
import copy
import datetime
import decimal
import functools
import hashlib
import itertools
import json
import os
from contextlib import contextmanager
from enum import Enum
from typing_extensions import Protocol
from typing import (
Tuple, Type, Any, Optional, TypeVar, ... |
import sys
def is_one(x):
return x == 1 or x == 1.0 or x == '1' or x == '1.0'
def is_negone(x):
return x == -1 or x == -1.0 or x == '-1' or x == '-1.0'
def is_nonzero(x):
return x != 0 and x != 0.0 and x != -0.0 and x != '0' and x != '0.0' and x != '-0.0'
def contain_nontrivial( coeffs ):
for coeff ... |
_base_ = [
'../../lvis/mask_rcnn_r50_fpn_sample1e-3_mstrain_1x_lvis_v1.py'
]
# data = dict(train=dict(oversample_thr=0.0))
# model = dict(roi_head=dict(bbox_head=dict(loss_cls=dict(type="Icloglog",activation='normal'),
# init_cfg = dict(type='Constant',val=0.01, bias=-3.45... |
# 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 under the Apache License, Version 2.0 (the
# "License"); you may not u... |
"""Structured representations of system events."""
import logging
import os
from collections import namedtuple
from enum import Enum
from dagster import check
from dagster.core.definitions import (
AssetMaterialization,
EventMetadataEntry,
ExpectationResult,
Materialization,
SolidHandle,
TypeCh... |
from argostrain.dataset import *
from argostrain.utils import *
from collections import deque
from argostranslate import package, translate
MIN_TAG_TEXT_LENGTH = 10
OPEN_TOKEN = '<x>'
CLOSE_TOKEN = '</x>'
def generate_xml_data(source_code, target_code, source_and_target_line):
installed_languages = translate.ge... |
import codecs
import os
import re
import sys
from setuptools import setup, Extension
from setuptools.command.test import test as TestCommand
# Some general-purpose code stolen from
# https://github.com/jeffknupp/sandman/blob/5c4b7074e8ba5a60b00659760e222c57ad24ef91/setup.py
here = os.path.abspath(os.path.dirname(__f... |
"""
This Module start the route and start Flask
"""
from flask import Flask, make_response, request
from flask_restx import Api, Resource, fields
from src.users import UsersDAO
app = Flask(__name__)
api = Api(
app,
version="1.0",
title="UserMVC API",
description="A simple UserMVC API",
)
doc_user = ... |
"""Perform communication related functions."""
from time import sleep
from plugins import USBRelay
can_use_comm = True
try:
from .low_level import low_comm
except Exception as e:
print("[XbeeComm]:", e)
can_use_comm = False
SECRET_KEY = "CURE"
from json import loads
class Comm:
def __init__(s... |
# coding: utf-8
"""
Salt Edge Account Information API
API Reference for services # noqa: E501
OpenAPI spec version: 5.0.0
Contact: support@saltedge.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class CategoriesRespons... |
import numpy as np
import time
import os
import shutil
from tridesclous.dataio import DataIO
from tridesclous.catalogueconstructor import CatalogueConstructor
from tridesclous import mkQApp, CatalogueWindow
from matplotlib import pyplot
from tridesclous.tests.testingtools import setup_catalogue
#~ dataset_name='o... |
from a10sdk.common.A10BaseClass import A10BaseClass
class SignZoneNow(A10BaseClass):
""" :param zone_name: {"description": "Specify the name for the DNS zone, empty means sign all zones", "format": "string", "minLength": 1, "optional": true, "maxLength": 127, "type": "string"}
:param DeviceProxy: The ... |
"""
The :mod:`sklearn.feature_extraction.image` submodule gathers utilities to
extract features from images.
"""
# Authors: Emmanuelle Gouillart <emmanuelle.gouillart@normalesup.org>
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# Olivier Grisel
# Vlad Niculae
# License: BSD 3 clause
fro... |
import os, sys
import json
import ctypes
from cerver import *
from cerver.http import *
web_service = None
# end
def end (signum, frame):
http_cerver_all_stats_print (http_cerver_get (web_service))
cerver_teardown (web_service)
cerver_end ()
sys.exit ("Done!")
# GET /
@ctypes.CFUNCTYPE (None, ctypes.c_void_p, ... |
import base64
def replace_b64_in_dict(item):
"""
Replace base64 string in python dictionary of inference data. Refer to https://github.com/tensorflow/serving/blob/master/tensorflow_serving/g3doc/api_rest.md#encoding-binary-values .
For example: {'inputs': {'images': {'b64': 'YWJjZGVmZ2hpMTIz'}, 'foo': 'bar'}... |
from collections import defaultdict
from promise import Promise
from ....attribute.models import (
AssignedProductAttribute,
AssignedProductAttributeValue,
AssignedVariantAttribute,
AssignedVariantAttributeValue,
AttributeProduct,
AttributeVariant,
)
from ....core.permissions import ProductPer... |
from django.contrib import admin
from .models import *
admin.site.register(Topic)
admin.site.register(Comment)
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# train backbone network with imagenet dataset
#
import os, sys, argparse
import numpy as np
from multiprocessing import cpu_count
import tensorflow.keras.backend as K
from tensorflow.keras.optimizers import Adam, SGD, RMSprop
from tensorflow.keras.preprocessing.image ... |
"""
Django settings for project project.
Generated by 'django-admin startproject' using Django 4.0.3.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
import os
fr... |
"""
Utility functions for training
Author: Zhuo Su, Wenzhe Liu
Date: Aug 22, 2020
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
import os
import shutil
import math
import time
import random
import skimage
impor... |
# This software is open source software available under the BSD-3 license.
#
# Copyright (c) 2020 Triad National Security, LLC. All rights reserved.
# Copyright (c) 2020 Lawrence Livermore National Security, LLC. All rights
# reserved.
# Copyright (c) 2020 UT-Battelle, LLC. All rights reserved.
#
# Additional copyright... |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import sys
sys.dont_write_bytecode = 1
from PyQt4 import QtGui
from MainWindow import MainWindow
__author__ = "Uname"
__version__ = "0.1"
__email__ = "ehcapa@qq.com"
def main():
app = QtGui.QApplication(sys.argv)
app.setStyle("cleanlooks")
window = MainWind... |
import struct
fp = open('test.jbig2', 'rb')
# headerFlags, = struct.unpack('>B', fp.read(1))
# fileOrganisation = headerFlags & 1
# randomAccessOrganisation = fileOrganisation == 0
# pagesKnown = headerFlags & 2
# noOfPagesKnown = pagesKnown == 0
# print('headerFlags:', headerFlags)
segmentNumber = struct.unpack(... |
from qutip.cy.spmatfuncs import *
|
# Copyright 2013 by Rackspace Hosting, 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 or agreed t... |
from hamcrest import assert_that
from allure_commons_test.report import has_test_case
from allure_commons_test.result import with_status
from allure_commons_test.result import has_status_details
from allure_commons_test.result import with_message_contains
from allure_commons_test.result import with_trace_contains
def... |
#!/bin/python3.6
"""
Date Created: Feb 10 2020
This file contains the model descriptions, including original x-vector
architecture. The first two models are in active developement. All others
are provided below
"""
import torch
import torch.nn as nn
from torch.nn import functional as F
class simple... |
import sys
def pwpath():
import os
SPLIT_STR = '/'
if os.name == 'nt':
SPLIT_STR = '\\'
RPATH = os.path.realpath(__file__)
PPATH = SPLIT_STR.join(RPATH.split(SPLIT_STR)[:-1])
PWS_PATH = os.path.join(PPATH, os.path.pardir)
RPWPATH = os.path.realpath(PWS_PATH)
return RPWPATH
sy... |
from rest_framework.response import Response
from iaso.tasks.copy_version import copy_version
from iaso.api.tasks import TaskSerializer
from iaso.models import DataSource, SourceVersion, Task, OrgUnit
from rest_framework import viewsets, permissions, serializers
from iaso.api.common import HasPermission
from django.sh... |
"""
Project:
Author:
"""
from .mqtt_controller import MQTTController
from .handlers.hello_world_handler import HelloWorldHandler
from .handlers.esp32_handler import Esp32Handler
class FridayController(MQTTController):
""" MQTT Controller with setting for Friday project """
HANDLER_LIST = [
HelloWor... |
"""Change pdp_users.password to bytea
Revision ID: f3d30db17bed
Revises: 41da831646e4
Create Date: 2020-12-16 21:26:08.548724
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "f3d30db17bed"
down_revision = "41da831646e4"
branch_labels = None
depends_on = None
... |
import contextlib
import os
import re
import sys
import time
from enum import IntEnum
from logging import getLogger
import sqlparse
from rpy2 import robjects
from . import util
from .dsl import interpreter
logger = getLogger('squares')
class ExitCode(IntEnum):
OK = 0
NON_OPTIMAL = 3
ERROR = 1
SQL_... |
#!/usr/bin/env python
import chess
import chess.svg
from board import Board
from flask import Flask, request, make_response, render_template
app = Flask(__name__)
game = Board()
moves = []
# Flask route for home page.
@app.route('/')
def index():
game = Board()
moves.clear()
return render_template("inde... |
import tempfile
from numpy.testing import assert_equal
from statsmodels.compat.python import lrange, BytesIO
from statsmodels.iolib.smpickle import save_pickle, load_pickle
def test_pickle():
tmpdir = tempfile.mkdtemp(prefix='pickle')
a = lrange(10)
save_pickle(a, tmpdir+'/res.pkl')
b = load_pickle(... |
class ClockCollection(object,ICollection[Clock],IEnumerable[Clock],IEnumerable):
""" Represents an ordered collection of System.Windows.Media.Animation.Clock objects. """
def Add(self,item):
"""
Add(self: ClockCollection,item: Clock)
Adds a new System.Windows.Media.Animation.Clock object to the end of t... |
#!/usr/bin/env python
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# fetch values from package.xml
setup_args = generate_distutils_setup(
packages=['rqt_servicebot_pan_tilt'],
package_dir={'': 'src'},
requires=['std_msgs', 'rospy']
)
setup(**setup_args)
|
#!/usr/bin/env python
import rospy
from lowpass import LowPassFilter
from yaw_controller import YawController
from pid import PID
GAS_DENSITY = 2.858
ONE_MPH = 0.44704
class Controller(object):
def __init__(self, vehicle_mass, fuel_capacity, brake_deadband, decel_limit,
accel_limit, wheel_radius... |
# -*- coding: utf-8 -*-
"""
"""
import concurrent.futures
import imaplib
import warnings
from pprint import pprint
from typing import List, Tuple, Dict
from pymaillib.imap.entity.email_message import ImapFetchedItem, EmailMessage
from pymaillib.imap.query.builders.fetch import FetchQueryBuilder
from pymaillib.imap.cl... |
import os
import signal
import gc
import time
import sys
import select
import curses
import threading
import contextlib
import kaa
import kaa.log
from . import keydef, color, dialog
from kaa import clipboard
from kaa import document
from kaa import keyboard
from kaa import macro
from kaa.exceptions import KaaError
... |
class ApxSignature(object):
def __init__(self,mainType,name,dsg,attr=""):
self.mainType=mainType
self.name=name
self.dsg=dsg
self.attr=attr
def __str__(self):
if (self.attr != None) and len(self.attr)>0:
return '%s"%s"%s:%s'%(self.mainType,self.name,self.dsg,self.att... |
#!/usr/bin/env python3
"""
Author : Adam Matteck
Date : 2021-12-02
"""
import argparse
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
description="Picnic game",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
parser.add_argument(
... |
import argparse
import time
import numpy as np
from pycompss.api.api import barrier, compss_wait_on
import dislib as ds
from dislib.classification import RandomForestClassifier
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--svmlight", help="read files in SVMLight format",
... |
#Here we import the libraries
#requests is a library to make webcalls
#beautifulsoup is our scraping library
#unicodecsv is a replacement for the normal Python csv library, this on supports unicode characters
#New on this one is 're' which allows for regular expressions
import requests, re
from bs4 import BeautifulSoup... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.