text stringlengths 957 885k |
|---|
import os
import tensorflow as tf
from . import util
from .flag import FLAGS, add_flag, add_required_flag
DEFAULT_BATCH_SIZE = 64
MODES = [tf.contrib.learn.ModeKeys.TRAIN,
tf.contrib.learn.ModeKeys.EVAL,
tf.contrib.learn.ModeKeys.INFER]
def _add_file_flag(mode):
assert isinstance(mode, str)
... |
"""
BiGAN/ALI adds another encoder that encoder the input to latent space z.
The discriminator mark real/fake using the joint distribution of (x, z).
We don't provide the label to the network and hope that it can automatically
captures unsupervised features that can be directly used for downstream tasks.
"""
import nu... |
<gh_stars>0
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : resnet.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 03/31/2018
#
# This file is part of Jacinle.
# Distributed under terms of the MIT license.
import math
import functools
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
from... |
<gh_stars>0
"""
Degrade a trajectory if needed
"""
from pup.common.datatypes import Traj
from pup.common.enums import DegradationType, PreviousPurchaseType
from pup.config import Config
from pup.voi import voi_utils
def degrade_trajectory(trajectory: Traj,
degradation_type: DegradationType,
... |
<filename>dropBookDialog.py
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import qdarkstyle
from PyQt5.QtSql import *
import time
class dropBookDialog(QDialog):
drop_book_successful_signal=pyqtSignal()
def __init__(self, parent=None):
super(dropBookDial... |
<reponame>ahaupt/ralph
# -*- coding: utf-8 -*-
from django import forms
from django.conf import settings
from django.forms import ValidationError
from django.forms.formsets import DELETION_FIELD_NAME
from django.forms.models import BaseInlineFormSet
from django.utils.translation import ugettext_lazy as _
from ralph.as... |
<reponame>TwinMooon/transformers-plus-performers<filename>src/transformers/modeling_performer_attention.py
from torch import nn
from typing import Optional, Union
import logging
import numpy as np
import torch
import torch.nn.functional as F
from .configuration_performer_attention import PerformerAttentionConfig
from ... |
<filename>Day 35/rain_alert/venv/lib/python3.9/site-packages/twilio/rest/messaging/v1/use_case.py
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import values
from twilio.base.instance_resource import InstanceResource
from twilio... |
#!/usr/bin/env python2.7
"""
The following script is used for writing code comments offline and writing
them in a format suitable for the given version control software and
potentially ticketing system. Example: svn + trac (edgewall).
Example usage
-------------
vim
===
Utilising this script in vim is done by defi... |
# ####################################################################################
# # Author:
# # Username:
# #
# # Assignment: E1 - Coding Portion
# # Purpose: Evaluate your ability to write code in Python
# # Value: 25 points total
# #
# # Instructions:
# # Complete ALL of the tasks indicated below. Read caref... |
<filename>placer/m_topo.py
# Copyright 2020 University of Illinois Board of Trustees. All Rights Reserved.
# Author: <NAME>, DPRG (https://dprg.cs.uiuc.edu)
# This file is part of Baechi, which is released under specific terms. See file License.txt file for full license details.
# ======================================... |
#
# 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 us... |
"""Per-prefix data, mapping each prefix to a dict of locale:name.
Auto-generated file, do not edit by hand.
"""
from ..util import u
# Copyright (C) 2011-2016 The Libphonenumber Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... |
<gh_stars>10-100
# ========================================================================
# Copyright 2018 ELIT
#
# 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... |
<filename>generator-train.py<gh_stars>1-10
from generator import *
from utils import *
import argparse
from torch.autograd import Variable
import os
set_seed(seed)
parser = argparse.ArgumentParser(description='train-generator-network')
parser.add_argument('--teacher_dir', type=str, default='./Model/')
parser.add_argum... |
<filename>bin/get_ranking_from_relevance_estimation.py
#!/usr/bin/env pypy
import sys
import glob
import argparse
from collections import defaultdict
import heapq
try:
import simplejson as json
except ImportError:
import json
rel_funcs = {
'DBN': lambda a, b, s_c, s_e: a * s_c,
'UBM': lambda a, b, s_... |
# Python modules
import re
import os
import tempfile
import shutil
import xml.etree.cElementTree as ElementTree
import decimal
# 3rd party modules
# Our modules
import vespa.common.constants as constants
import vespa.common.util.db as util_db
import vespa.common.util.import_ as util_import
import vespa.common.util.m... |
<reponame>PingjunChen/ThyroidGeneralWSI<gh_stars>1-10
# -*- coding: utf-8 -*-
import os, sys
import numpy as np
from numba import jit
import torch
import torch.nn as nn
import torch.nn.functional as F
@jit(nopython=True)
def get_mask(B, N, true_num=None):
'''
Parameters:
------------
B@int: batch... |
<filename>analysis/dpa.py<gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
* Copyright (c) 2017, <NAME>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of ... |
<filename>parlai/agents/programr/retrieval_model/entailment.py
import torch
from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification
from parlai.agents.programr.utils.logging.ylogger import YLogger, timed_task
class Entailment:
def __init__(self, tokenizer_filepath, model_filepath):
... |
<reponame>radhermit/bite<filename>src/bite/client/bugzilla.py
from collections import OrderedDict
from itertools import chain
import pprint
import re
import subprocess
import sys
from urllib.parse import parse_qs
from snakeoil.strings import pluralism
from . import Cli, login_required
from .. import const
from ..exce... |
<reponame>neuroevolution-ai/NeuroEvolution<filename>Others/CTRNN_FunctionApproximation_CMA-ES.py
import random
import time
import numpy as np
from deap import algorithms
from deap import base
from deap import creator
from deap import tools
from deap import cma
from scoop import futures
from scipy.integrate import ode... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test read/write functionality for JP2KAK JPEG2000 driver.
# Author: <NAME> <<EMAIL>>
#
####################################################... |
# ========================================
# [] File Name : histogram_2d.py
#
# [] Creation Date : April 2018
#
# [] Author 2 : <NAME>
# ========================================
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
# Number of samples
NUM_SAMPLES = 10000
# Bin ... |
<gh_stars>0
import cv2
import PIL.Image
import numpy as np
import torch
image = PIL.Image.open("/home/manhas/Pictures/1.jpg")
image = image.resize((1536//2, 2048//2))
image_shape = [2048//2, 1536//2]
mask = np.ones(image_shape, dtype=np.uint8)*255
print(mask.shape)
mask[746//2:2044//2, 427//2:1008//2] = 0
cv2.imshow... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
This module defines how each container file (FoV) is handled
"""
from __future__ import print_function
import os
import re
import random
import numpy as np
import logging
import sys
if sys.version_info[0] < 3:
import pathlib2 as pathlib
else:
import pathlib
... |
<gh_stars>1-10
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import cv2
from dataset import DataSet
batch_size = 100;
sample_size = 100;
epochs = 3001;
steps = 1000;
Z_dimension = 100;
dataset = DataSet(test_prob=0, one_hot=False)
def conv2d(X, filters, kernel_size = 2, strides = 2, paddi... |
<reponame>ibegleris/w-fopo<gh_stars>0
from step_index_functions import *
from data_plotters_animators import save_variables
from scipy.interpolate import interp1d
from scipy.optimize import brenth
@profile
def fibre_creator(a_vec, f_vec, dnerr, per=['ge', 'sio2'], filename='step_index_2m', filepath='loading_data/step_... |
from subprocess import Popen, PIPE
from gtp import parse_vertex, gtp_move, gtp_color
from gtp import BLACK, WHITE, PASS
import os,sys,inspect
# reset the working dir
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parent... |
<reponame>virdio/mediapipe
# Copyright 2020 The MediaPipe 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 a... |
# -*- coding: utf-8 -*-
from unittest import TestCase
from chatterbot.utils.clean import clean_whitespace
from chatterbot.utils.clean import clean
from chatterbot.utils.module_loading import import_module
class UtilityTests(TestCase):
def test_import_module(self):
datetime = import_module('datetime.datet... |
import math
from pprint import pprint
from datetime import datetime
from itertools import repeat, izip_longest
import variable
# STATES
META = 1
HEADER = 2
DATA = 3
NOTICES = 4
class tableParser(object):
def __init__(self, structure, variables, csv_data):
self.structure = structure
self.csv_d... |
import glob
import json
import os
import subprocess
# Represents a TeaCode Bundle
class Bundle:
def __init__(self, file):
"""
Given a .tcbundle file, extract contents.
:param file: A .tcbundle file.
"""
self._content = json.load(file)
self._name: str = self._content... |
# -*- coding: utf-8 -*-
"""
# Naive Bayes Classifiers
In machine learning, Naïve Bayes classification is a straightforward and powerful algorithm for the classification task. Naïve Bayes classification is based on applying Bayes’ theorem with strong independence assumption between the features. Naïve Bayes classificati... |
<reponame>ksmit799/POTCO-PS
# File: L (Python 2.4)
import math
from pandac.PandaModules import NodePath
from panda3d.core import TextNode
from pirates.piratesgui.GuiButton import GuiButton
from direct.gui.DirectGui import *
from direct.gui.OnscreenImage import OnscreenImage
from pandac.PandaModules import Transparency... |
import os
import networkx as nx
# Column indices of the interesting fields in SNOMED's
# Description and Relationship files
_SNOMED_TERM_FIELD_ID = 0 # term activity (deprecated terms will have active = 0)
_SNOMED_TERM_FIELD_ACTIVE = 2 # term activity (deprecated terms will have active = 0)
_SNOMED_DESC_FIELD_ACTIV... |
<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#Author:Winston.Wang
print('-------------Python内建的filter()函数用于过滤序列学习-------------')
'''
和map()类似,filter()也接收一个函数和一个序列。和map()不同的是,
filter()把传入的函数依次作用于每个元素,
然后根据返回值是True还是False决定保留还是丢弃该元素
'''
L = list(range(1,100));
#保留奇数,使用map并不能把不需要的元素给移除,只会返回None.L的长度不变
def od... |
import logging
import math
import lucene, argparse
from drqa import retriever
from drqa import tokenizers
from java.util import HashMap
from java.io import StringReader
from java.lang import System
from java.nio.file import Path, Paths
from org.apache.lucene.analysis.core import WhitespaceAnalyzer
from org.apache.luc... |
import os
import random
from .config import CfgNode as CN
_C = CN()
_C.VERSION = 1
_C.config = CN()
_C.config.name = ''
# ---------------------------------------------------------------------------- #
# input
# ---------------------------------------------------------------------------- #
_C.input = CN()
_C.input.... |
from django.views.generic import TemplateView, DetailView, ListView
from .models import Question, Choice
from django.shortcuts import get_object_or_404
from django.shortcuts import redirect, render
from django.contrib.auth.decorators import login_required
from django.contrib.admin.views.decorators import staff_member_r... |
<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import print_function
from datetime import datetime
import random
import numpy as np
import gym
import json
import torch
from torch import Tensor
import torch.nn.functional as F
import torch.optim as optim
from utils import *
from torch import argmax
from dqn import ... |
<reponame>bupt-ipcr/RL4Net<filename>rl4net/agents/DQN_base.py
#!/usr/bin/env python
# coding=utf-8
"""
@author: <NAME>
@create time: 2019-11-17 11:23
@edit time: 2021-04-15 15:41
@file: /RL4Net-PA/root/anaconda3/envs/PA/lib/python3.7/site-packages/rl4net/agents/DQN_base.py
@desc: 创建DQN对象
"""
import os
import torch
impo... |
import pytz
import dateutil.parser
from waterbutler.core import metadata
class BaseOsfStorageMetadata:
@property
def provider(self):
return 'osfstorage'
class BaseOsfStorageItemMetadata(BaseOsfStorageMetadata):
def __init__(self, raw, materialized):
super().__init__(raw)
self._... |
import numpy as np
from collections import defaultdict
def parse_files(input_file, method, all_names_scientific, all_names_other, nodes, merged, ranks, verbose):
def retrieveValidTaxID(taxid, name=None, rank=None):
# Normalize taxids into one single version of the taxonomic database (one provided as a parameter)
... |
import tests2 as t
t.testing(method = 'KIR', initial = 'sin', velocity = 'const')
t.testing(method = 'KIR', initial = 'sin', velocity = 'x')
t.testing(method = 'KIR', initial = 'sin', velocity = 'func')
t.testing(method = 'KIR', initial = 'peak', velocity = 'const')
t.testing(method = 'KIR', initial = 'peak', ve... |
<filename>tests/unit/test_torch_dataloader.py
#
# Copyright (c) 2021, NVIDIA CORPORATION.
#
# 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
#
... |
"""Advent of Code 2020 Solutions
Author: <NAME>
"""
import io, itertools, math, re, modules.userInput
TARGETS = [2020, 30000000]
def play(input_stream:io.TextIOWrapper, day_part, input_parameters, log_level):
# Initialize and read input
inputs = input_stream.read().split('\n')
rules = []
m... |
<filename>1-class/part_2.py
import collections
from pprint import pprint
from typing import List, Generator
from sys import getsizeof
import itertools
# range
print(my_range := range(10), type(my_range))
print(list(my_range))
print(list(range(2, 30, 3)))
sum_all = 0
for i in range(10):
sum_all += i
print(sum_... |
"""Adjust some old Python 2 idioms to their modern counterparts.
* Change some type comparisons to isinstance() calls:
type(x) == T -> isinstance(x, T)
type(x) jest T -> isinstance(x, T)
type(x) != T -> nie isinstance(x, T)
type(x) jest nie T -> nie isinstance(x, T)
* Change "dopóki 1:" into "dopóki P... |
<reponame>Madscba/02460_federated_learning
from cifar10_noniid import get_dataset_cifar10_extr_noniid
from network import cifar_net
import torch.optim as optim
import torch.nn as nn
import numpy as np
from copy import deepcopy
import torch
import matplotlib.pyplot as plt
# data
num_clients = 100
nclass = ... |
import logging
import os
import requests
import shutil
import sys
import CloudFlare
import traceback
from importlib import import_module
from django.conf import settings
from django.core.cache import cache
from django.core.exceptions import ImproperlyConfigured
from django.dispatch import receiver
from django.db.mode... |
import sys
from collections import OrderedDict
from django.conf import settings
from django.contrib.postgres import fields as pg_fields
from django.db import models
from django.utils import timezone
from . import fakes
from .compat import HAS_GEOS, HAS_PSYCOPG2
STRING_FIELDS = (
models.CharField,
models.Tex... |
<reponame>xm0625/py-multiprogress-sqlite
# coding=utf-8
# 解决py2.7中文出现write错误的问题
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
# 解决py2.7中文出现write错误的问题 #
import sqlite_manager_client_helper as helper
import socket
import time
if __name__ == "__main__":
m = helper.SqliteManager(address=('127.0.0.1', 50001... |
<gh_stars>10-100
"""Power functions."""
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
import os
import numpy as np
from nipype.utils.filemanip import split_filename
from mne import read_epochs
from mne.io import read_raw_fif
from scipy.signal import welch
from .fif2array import _get_raw_array
def _compute_... |
<gh_stars>0
from loguru import logger
from PicImageSearch.Utils import SauceNAOResponse
from ..Utils import get_error_message
from .network import HandOver
class AsyncSauceNAO(HandOver):
def __init__(
self,
api_key: str = None,
*,
numres: int = 5,
hide: int = 1,
mi... |
<filename>cli/tests/orchestrate/commands/instances/test_create.py
# python3
# Copyright 2020 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
#
# https://www.apache.org/licenses... |
# -*- coding: utf-8 -*-
import os
import shutil
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from django.db.models import signals
from django.db.models.fields.files import ImageField, ImageFileDescriptor
from forms import StdImageFormField
from widgets import DelAdminFileWi... |
# -*- coding: utf-8 -*-
from email.header import Header
from openprocurement.api.utils import get_now
# ContractDocumentResourceTest
def contract_milestone_document(self):
response = self.app.patch_json('/contracts/{}?acc_token={}'.format(
self.contract_id, self.contract_token), {"data": {"status": "act... |
# Copyright 2021 NREL
# 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
# distri... |
"""SingerTarget and supporting classes.
This module contains the SingerTarget class as well as a supporting BookmarkWriter class.
"""
import json
import logging
from datetime import datetime
from typing import List
from meltano.core.behavior.hookable import hook
from meltano.core.db import project_engine
from meltano... |
# Ova skripta se koristi za učitavanje .gml fajla u graph objekat.
# Namenjena je za digg dataset
# Od tog grafa kreira se .csv fajl sa atributima za svaku vezu grafa
# Kreiraju se dva fajla onaj sa pravim i onaj sa pseudo atributima
import os
from metric_functions import *
import time
import networkx as nx
import pan... |
"""
Given a sorted array `nums`, remove the duplicates from the array.
Example 1:
Given nums = [0, 1, 2, 3, 3, 3, 4]
Your function should return [0, 1, 2, 3, 4]
Example 2:
Given nums = [0, 1, 1, 2, 2, 2, 3, 4, 4, 5]
Your function should return [0, 1, 2, 3, 4, 5].
*Note: For your first-pass, an out-of-place solut... |
<filename>tests/test_preprocessing/test_imputation.py<gh_stars>10-100
import unittest
import os
import sys
import site
ai4_dir = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
site.addsitedir(ai4_dir)
import numpy as np
import pandas as pd
np.random.seed(313)
from ai4water.preprocessing.imputation i... |
<filename>kadal/demo/MOBOdemo_customfunc2.py
import os
# Set a single thread per process for numpy with MKL/BLAS
os.environ['MKL_NUM_THREADS'] = '1'
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['MKL_DEBUG_CPU_TYPE'] = '5'
import numpy as np
from matplotlib import pyplot as plt
from copy import deepcopy
from ka... |
# -*- coding: utf-8 -*-
"""Helper utilities and decorators."""
try:
from urlparse import urlparse, urljoin
except ImportError:
from urllib.parse import urlparse, urljoin
from flask import request, redirect, url_for, current_app
from flask import flash
import hashlib
import base64
import sha3
from ecdsa import... |
<gh_stars>0
#!/usr/bin/python
# -*- utf-8 -*-
class Solution:
# @return a list of lists of length 3, [[val1,val2,val3]]
def threeSum(self, num):
ret = []
length = len(num)
if length < 3:
return ret
num.sort()
for a in range(length - 2):
if a == ... |
<gh_stars>1-10
#!/usr/bin/env python
# coding=utf-8
"""
CoMET - Convolutional Motif Extraction Tool
-------------------------------------------
CoMET is an automated tool for the discovery of protein motifs from arbitrarily
large protein sequence datasets.
(c) 2015-2017 Massachusetts Institute of T... |
<reponame>pallet-io/Pallet-API<gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2017-05-15 13:48
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import notification.validators
import uuid
class Migrati... |
<reponame>bela127/active_learning_ts<filename>active_learning_ts/evaluation/evaluator.py
from typing import List
from active_learning_ts.logging.data_blackboard import Blackboard
from active_learning_ts.evaluation.evaluation_metric import EvaluationMetric
from active_learning_ts.experiments.blueprint_instance import B... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021, 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
<filename>build/android/gyp/compile_resources.py
#!/usr/bin/env python
#
# Copyright (c) 2012 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.
"""Compile Android resources into an intermediate APK.
This can also generate a... |
<reponame>Bankee-256/Smart-traffic-lights
'''the UI of fuzzy knowledge management'''
import constants
import utils
import datetime
import MySQLdb
import numpy as np
from PyQt5 import uic, QtCore, QtGui
from PyQt5.QtWidgets import *
class Stats:
def __init__(self):
# 从文件中加载UI定义
# 从 U... |
# Tests for clone script
from pathlib import Path
import pytest
import abcclassroom.clone as abcclone
@pytest.fixture
def test_files(default_config, tmp_path, test_data):
"""
Creates the directories for cloning student repos and for holding
submitted material. Creates two notebook and one non-notebook f... |
import numpy as np
import utils
# read data from text files
with open('data/reviews.txt', 'r') as f:
reviews = f.read()
with open('data/labels.txt', 'r') as f:
labels = f.read()
print(reviews[:30])
## Data pre-processing
# We'll want to get rid of periods and extraneous punctuation.
# Also, you might not... |
from __future__ import unicode_literals, print_function
import re
import ast
import random
import pandas as pd
import spacy
from pathlib import Path
from spacy.util import minibatch, compounding
from excelcy import ExcelCy
from excelcy.storage import Config
from src.common import constants, load_book_by_nr
from src... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import os
# os.environ['TL_BACKEND'] = 'paddle'
# os.environ['TL_BACKEND'] = 'tensorflow'
# os.environ['TL_BACKEND'] = 'mindspore'
os.environ['TL_BACKEND'] = 'torch'
import time
from tensorlayerx.dataflow import Dataset, DataLoader
from tensorlayerx.vision.transforms import ... |
<filename>app/tracker_rtt.py
# /*
# File: scripts/video_tracker.nut
# Author: Astrofra
# */
# /*!
# @short RenderToTextureTracker
# @author Astrofra
# */
# class RenderToTextureTracker
# {
# screen_material = 0
# current_clip = 0
# scene_path = 0
# duration = 0.0
# emu_clock = 0.0
# main_camera =... |
from suls.sul import SUL
from subprocess import check_output, Popen, STDOUT, PIPE
from queue import Queue, Empty
from threading import Thread
import re
import pygtrie
import hashlib
from pathlib import Path
import pickle
import os
import sys
class RERSConnectorV4(SUL):
def __init__(self, path_to_binary):
s... |
<gh_stars>0
#!/usr/bin/env python
"""
Master script for running the SSM. Given the path to a configuration file
as an argument, it will construct an SSM and run it according to the
configuration.
An incorrect configuration will lead to the SSM quitting immediately.
"""
import os
import sys
import time
import loggin... |
#!/usr/bin/env python3
# Copyright 2019 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... |
<gh_stars>0
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import os
import shutil
from builtins import map, str
from col... |
"""Generated message classes for videointelligence version v1.
Detects objects, explicit content, and scene changes in videos. It also
specifies the region for annotation and transcribes speech to text. Supports
both asynchronous API and streaming API.
"""
# NOTE: This file is autogenerated and should not be edited by... |
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------- #
# PAINEL DE ESTATÍSTICAS
import wx
import os
import wx.lib.scrolledpanel
#import wx.lib.agw.hyperlink as hl
import hyperlink_light as hl
import MIDI
import dic_acordes
import time
def ScaleBitm... |
from io import BytesIO
from tempfile import NamedTemporaryFile
from PIL import Image
from django.contrib.auth import get_user_model
from django.core.cache import cache
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test import TestCase, Client
from django.urls import reverse
from .models im... |
import orio.main.tuner.search.search
from orio.main.util.globals import *
import time
import itertools
import math
class Direct(orio.main.tuner.search.search.Search):
def __init__(self, params):
orio.main.tuner.search.search.Search.__init__(self, params)
# rate-of-change
self.K_roc = .5
... |
<filename>addons/openacademy/tests/test_openacademy1.py
import pytest
from datetime import datetime
from odoo import exceptions
from pytest_tr_odoo.fixtures import env
from pytest_tr_odoo import utils
@pytest.fixture
def openacademy_model(env):
return env['openacademy.openacademy']
@pytest.fixture
def os_model(... |
<filename>utils.py<gh_stars>10-100
import numpy as np
import cv2
import random
from scipy.ndimage.filters import gaussian_filter
from scipy.ndimage.interpolation import map_coordinates
def shuffle_set(image, label):
'''
function to shuffle the image and label simultaneously
'''
per = np.random.permuta... |
# -*- coding: utf-8 -*-
"""
/dms/export_dms/utils.py
.. enthaelt Hilfefunktionen fuer den Export
Django content Management System
<NAME>
<EMAIL>
Die Programme des dms-Systems koennen frei genutzt und den spezifischen
Beduerfnissen entsprechend angepasst werden.
0.01 29.11.2007 Beginn der Arbeit
0.02 30.... |
<gh_stars>1-10
#!/usr/bin/env python
import rospy
import sys, os, time
from geometry_msgs.msg import Twist
from geometry_msgs.msg import WrenchStamped
from std_msgs.msg import Empty
from sensor_msgs.msg import LaserScan
from sensor_msgs.msg import Image
from nav_msgs.msg import Odometry
from std_msgs.msg import String
... |
import pytest
from fv3gfs.util.buffer import send_buffer, recv_buffer, Buffer, BUFFER_CACHE
from fv3gfs.util.utils import is_contiguous, is_c_contiguous
@pytest.fixture
def contiguous_array(numpy, backend):
if backend == "gt4py_cupy":
pytest.skip("gt4py gpu backend cannot produce contiguous arrays")
a... |
<reponame>search5/peterboy
import io
import os
import xml
import xml.dom.minidom
import paginate
from dateutil.parser import parse
from flask import Flask, jsonify, request, render_template, url_for, redirect, \
abort
from flask.views import MethodView
from flask_login import LoginManager, login_required, current... |
#
# Dice Rolling Tool
#
# Author: <NAME>
# Date: July 10, 2021
#
# Allows for rolling various configurations of dice.
#
import argparse
import random
import re
''' Parser Configuration
'''
parser = argparse.ArgumentParser(description='Rolls some dice...')
parser.add_argument("rolls", type=str, help="Rolls the specif... |
<reponame>vishalbelsare/baikal
import pickle
import tempfile
from contextlib import contextmanager
from typing import List, Dict
import joblib
import numpy as np
import pytest
import sklearn.ensemble
import sklearn.linear_model
from numpy.testing import assert_array_equal, assert_allclose
from pytest import fail
from ... |
"""Creates pointclouds from rgb and depth images of real data (has pairs for transparent and opaque objects)
Can create pointclouds colored either in original RGB or Surface Normals.
Surface Normals can either be estimated from point cloud, or passed in as a file
"""
import argparse
import os
import glob
import fnmatch... |
"""
Django settings for saltdash project.
Generated by 'django-admin startproject' using Django 2.0.1.
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 logg... |
from otree.api import (
models,
widgets,
BaseConstants,
BaseSubsession,
BaseGroup,
BasePlayer,
Currency as c,
currency_range,
)
author = 'Your name here'
doc = """
Your app description
"""
class Constants(BaseConstants):
name_in_url = 'inst_tnoex'
player... |
<gh_stars>1-10
import io
import PySimpleGUI as sg
import cv2
from PIL import Image
from auto_splitter.capture import Capture
from auto_splitter.variables import get_coordinates
from auto_splitter.coordinates import Coordinates
def list_ports():
current_port = 0
is_working = True
working_ports = []
avai... |
<filename>scripts/communication.py
#!/usr/bin/env python
"""Module for managing communication lines
Include class for Java and ROS communication
"""
import abc
from socket import socket, timeout
from threading import Thread
import sys
import time
from std_msgs.msg import String
from sonia_msgs.msg import filterchain_... |
<filename>synapse/util/async.py<gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2014-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/... |
<gh_stars>1-10
from django.contrib.auth.models import Permission
from django.test import TestCase
from rest_framework.test import APIClient
from usersmanagement.models import Team, TeamType, UserProfile
from usersmanagement.serializers import (
TeamTypeDetailsSerializer,
TeamTypeSerializer,
)
class TeamTypeTe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.