text stringlengths 957 885k |
|---|
# coding: utf-8
import re
__author__ = "<NAME>"
_SUBSTITUTIONS = [
('&', ' AND '),
("INTL", 'INTERNATIONAL'),
("INTN'L", "INTERNATIONAL")
]
_PREFIXES = [
'SAME AS CONSIGNEE',
'AGENCJA CELNA',
'AGENCJA TRANSPORTOWA',
'OOO',
'BY ORDER OF',
'BY ORDER TO',
'BY ORDER',
'FHU',
... |
from __future__ import print_function
import math
import torch
import torch.nn as nn
from torch.nn.modules.loss import _Loss
from torch.nn import functional as F
class HMTLoss(nn.Module):
def __init__(self, weight_g=1, weight_r=1, weight_a=2):
super(HMTLoss, self).__init__()
self.weight_g = we... |
<reponame>shapeshift-legacy/watchtower<gh_stars>0
import os
import json
from django.db.models.signals import pre_save, post_save, pre_delete, post_delete
from django.dispatch import receiver
from tracker.models import Account, Address
from common.services.rabbitmq import RabbitConnection, EXCHANGE_UNCHAINED
from comm... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Pitch-tracking and tuning estimation"""
import warnings
import numpy as np
from .spectrum import _spectrogram
from . import time_frequency
from .._cache import cache
from .. import util
__all__ = ["estimate_tuning", "pitch_tuning", "piptrack"]
def estimate_tuning(
... |
<filename>reachweb/migrations/0001_initial.py<gh_stars>0
# Generated by Django 2.2.5 on 2019-11-01 13:12
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swapp... |
<reponame>PaccMann/paccmann_chemistry<filename>paccmann_chemistry/models/stack_rnn.py<gh_stars>1-10
"""Stack Augmented GRU Implementation."""
import logging
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from ..utils import get_device
logger = logging.getLogger... |
from __future__ import division, print_function
from itertools import islice
import numpy as np
from numpy.linalg import norm
import spatial
import sphere
class Snake3D(object):
def __init__(self, contour, image,
step=0.2,
scale=1.0,
tension... |
#!/usr/bin/env python
#
# MIT License
#
# Copyright (c) 2017 <NAME> <<EMAIL>>
#
# 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
# ... |
<reponame>Hieronymus98/Distributed-Batteryless-Microphone
from inspect import currentframe, getframeinfo
import numpy as np
import matplotlib.pyplot as plt
import json
plt.style.use('seaborn-ticks')
#-----------------------------------------------------------------
###### ####### # ... |
<gh_stars>0
# coding=utf-8
""" dummyF.py
"""
from __future__ import print_function
import xml.etree.ElementTree as ET
import sys, re,codecs
dandas = {'hk':'|','slp1':'.','deva':'।'}
ddandas = {'hk':'||','slp1':'..','deva':'॥'}
dandaregexes= {'hk':r'([|]+)', 'slp1':r'([.]+)', 'deva': r'([।॥])'}
def get_L_from_D(line)... |
<gh_stars>1-10
"""
Reference. https://gist.github.com/jakemmarsh/8273963
"""
outputdebug = False
def debug(msg):
if outputdebug:
print(msg)
class Node(object):
def __init__(self, val):
self.val = val
self.leftChild = None
self.rightChild = None
def get... |
# COS738 Assignment 3
# <NAME>, 3869003
import numpy as np
from numpy.fft import fft2, ifft2
import tifffile
from PIL import Image
class StegCrypt(object):
"""
Information Hiding with Data Diffusion using Convolutional
Encoding for Super-encryption. Hides an image, the 'Plaintext',
in a chosen camoufl... |
# Gigawhat Website Minecraft server util.
# Copyright 2022 Gigawhat Programming Team
# Written by <NAME>, 2020 - 2022.
#
# 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 3 of... |
from typing import Dict, Type, Any, Union, List, cast, TypeVar
import typing
import abc
import enum
import json
from dataclasses import dataclass, fields, MISSING
from datetime import datetime, timezone
Props = Dict[str, str]
def as_list(data: Union[str, List[str]]) -> List[str]:
if not isinstance(data, str):
... |
<gh_stars>10-100
"""Tests for era5cli utility functions."""
import unittest.mock as mock
import pytest
import era5cli.cli as cli
import era5cli.inputref as ref
def test_parse_args():
"""Test argument parser of cli."""
argv = ['hourly', '--startyear', '2008',
'--variables', 'total_precipitation',... |
<filename>tests/test_faust_processor.py
from utils import *
BUFFER_SIZE = 1
def test_faust_passthrough():
DURATION = 5.1
engine = daw.RenderEngine(SAMPLE_RATE, BUFFER_SIZE)
data = load_audio_file("assets/575854__yellowtree__d-b-funk-loop.wav", duration=DURATION)
playback_processor = engine.make_playback_proces... |
import numpy as np
from pyapprox.univariate_polynomials.orthonormal_polynomials import \
gauss_quadrature
from pyapprox.univariate_polynomials.orthonormal_recursions import \
jacobi_recurrence, hermite_recurrence
def clenshaw_curtis_rule_growth(level):
"""
The number of samples in the 1D Clenshaw-Cur... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/11/17 15:49
# @Author : Dengsc
# @Site :
# @File : ansible.py
# @Software: PyCharm
import os
import time
import logging
import datetime
from celery import shared_task
from django.conf import settings
from utils.ansible_api_v2.runner import AdHocR... |
<reponame>DrewHans555/Kana2Romaji-File-Renamer<gh_stars>0
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import sys
_num_files_ignored: int = 0
_num_rename_success: int = 0
_num_rename_failure: int = 0
_filenames_failed = []
_KANA_DIGRAPH_DICT = {
# map digraph hiragana to romaji
"きゃ": "kya", "きゅ": ... |
'''
NOTICE
This module was solely developed under MITRE corporation internal funding project code 10AOH630-CA
Approved for Public Release; Distribution Unlimited. Public Release Case Number 20-1780.
(c) 2020 The MITRE Corporation. ALL RIGHTS RESERVED.
Licensed under the Apache License, Version 2.0 (the "License")... |
import requests
import json
import os
# import related models here
from djangoapp.models import CarDealer, DealerReview
from requests.auth import HTTPBasicAuth
import dotenv
dotenv.load_dotenv()
# Create a `get_request` to make HTTP GET requests
# e.g., response = requests.get(url, params=params, headers={'Content-Ty... |
<reponame>norips/visual-navigation-agent-pytorch<gh_stars>1-10
import json
import math
import os
import re
import GPUtil
def find_restore_point(checkpoint_path, fail=True):
checkpoint_path = os.path.abspath(checkpoint_path)
# Find latest checkpoint
restore_point = None
if checkpoint_path.find('{chec... |
<gh_stars>0
#!/usr/bin/env python3
# AUTHOR:
#
# <NAME>, DANS, NL, <EMAIL>
#
# USAGE
#
# ./selective-harvest.py --help
#
# or
#
# python3 selective-harvest.py --help
#
# will show complete usage information.
#
# Shortest form:
#
# ./selective-harvest.py
#
# assuming that the config file is in config.xml
#
# Usual form... |
"""
重要的事情说三遍
这是一份参考协议声明,即后端根据这份协议生成出对应的配置
"""
class FieldType:
STRING = 'string'
TEXT = 'text'
RICHTEXT = 'richtext'
BOOL = 'bool'
INTEGER = 'integer'
FLOAT = 'float'
DECIMAL = 'decimal'
DATE = 'date'
DATETIME = 'datetime'
TIME = 'time'
IMAGE = 'image'
FILE = 'file'
... |
<filename>src/rl_addons/renderPM/pfm.py
import struct
from types import StringType
class _BUILDER:
'''Virtual base helper class for structured file scanning'''
def _get_struct_fmt(self,info):
fmt = '<'
for f, _, _ in info:
fmt += f
return fmt
def _scan_from_file(self,f,info):
fmt = self._get_s... |
<filename>src/sage/combinat/tableau_tuple.py
r"""
TableauTuples
A :class:`TableauTuple` is a tuple of tableaux. These objects arise naturally
in representation theory of the wreath products of cyclic groups and the
symmetric groups where the standard tableau tuples index bases for the ordinary
irreducible representati... |
<filename>spar_python/circuit_generation/ibm/ibm_circuit_test.py
# *****************************************************************
# Copyright 2015 MIT Lincoln Laboratory
# Project: SPAR
# Authors: SY
# Description: IBM TA2 circuit class test
#
# Modifications:
# Date N... |
<reponame>burningmantech/ranger-ims-server
##
# See the file COPYRIGHT for copyright information.
#
# 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/LICENS... |
<reponame>JoleProject/Jole<gh_stars>0
#!/usr/bin/env python3
"""
This is an example to train a task with DDPG algorithm.
Here it creates a gym environment InvertedDoublePendulum. And uses a DDPG with
1M steps.
Results:
AverageReturn: 250
RiseTime: epoch 499
"""
import gym
import tensorflow as tf
from garage.... |
#!/usr/bin/env python
# Copyright (c) 2009, <NAME>'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
A clone of 'ifconfig' on UNIX.
$ python scripts/ifconfig.py
lo:
stats : speed=0MB, duplex=?, mtu=65536, up=yes
incoming ... |
#Chapter 4 - Analyzing time series and images
#-------------------------------------------------------------------------------------------#
#Multiple time series on common axes
# Import matplotlib.pyplot
import matplotlib.pyplot as plt
# Plot the aapl time series in blue
plt.plot(aapl, color='blue', label='AAPL')
# ... |
"""
Extract drums MIDI files. Some drum tracks are split into multiple separate
drum instruments, in which case we try to merge them into a single instrument
and save only 1 MIDI file.
VERSION: Magenta 1.1.7
"""
import argparse
import copy
import os
import random
import shutil
import timeit
from itertools import cycl... |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.13.7
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# %% [markdown] slideshow={"slide_type":... |
<reponame>cad106uk/market-access-api
import datetime
from datetime import timezone
import itertools
import random
from django.conf import settings
from django.core.management import BaseCommand
from api.barriers.models import PublicBarrier
from api.barriers.public_data import public_release_to_s3
from api.metadata.co... |
"Test moving window functions."
from nose.tools import assert_true
import numpy as np
from numpy.testing import (assert_equal, assert_array_almost_equal,
assert_raises)
import bottleneck as bn
from .util import arrays, array_order
def test_move():
"test move functions"
for func in ... |
import os
import cv2 as cv
import numpy as np
import torch
from torchvision import transforms
from tqdm import tqdm
from config import device
from data_gen import data_transforms
from utils import ensure_folder, compute_mse, compute_sad, draw_str
IMG_FOLDER = 'alphamatting/input_lowres'
ALPHA_FOLDER = 'alphamatting... |
<reponame>JedersonLuz/jusrisfai_challenge
from bs4 import BeautifulSoup
from requests_html import HTMLSession
class ScrapingRules(object):
def find_titulo(self, soup):
title = soup.find_all('table')
title = title[-1].find_all('p')
return title[-1].get_text().strip()
def find_a... |
<reponame>kustodian/aerospike-admin<gh_stars>0
# Copyright 2013-2018 Aerospike, 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 ... |
from rlstudio.agent import base as agent_base
from rlstudio.environment import base as env_base
from rlstudio.experiment import base as exp_base
from rlstudio.stats import base as stats_base
from rlstudio.typing import RunId
import numpy as np
from typing import List
class Experiment:
"""Defines an experiment."""
... |
"""
Regression evaluation.
| Copyright 2017-2021, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
import logging
import itertools
import numbers
import numpy as np
import sklearn.metrics as skm
from tabulate import tabulate
import eta.core.utils as etau
import fiftyone.core.evaluation as foe
import fift... |
from .. import conf
from ..gen_utils import layout_comment as layout
from ..helpers import snippet_str_help
@snippet_str_help()
def lambda_advice(snippet, *, repeat=False, **_kwargs):
"""
Look for use of lambda and give general advice on when / how to use.
"""
if not 'lambda' in snippet:
return... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 1 11:16:43 2021
@author: <NAME>
"""
"""
Experiment for comparing the performance of the network as a fucntion of numbers of neuron.
The code is for system of differential equations with two unknowns.
"""
# use the outgrad backage for the coputat... |
import logging
import signal
import os
import json
import subprocess
import re
import boto3
import requests
os.environ['PATH'] = os.environ['PATH'] + ":" + os.environ.get('LAMBDA_TASK_ROOT', '.') + '/bin'
LOGGER = logging.getLogger()
LOGGER.setLevel(logging.INFO)
SUCCESS = "SUCCESS"
FAILED = "FAILED"
EXIT_SUCCESS =... |
#! /usr/bin/env python
#################################################################################
# File Name : IPADS_GraphX_Plot.py
# Created By : xiaodi
# Creation Date : [2014-08-13 08:46]
# Last Modified : [2014-08-14 22:04]
# Description ... |
"""
Code to generate a Python model from a database or differences
between a model and database.
Some of this is borrowed heavily from the AutoCode project at:
http://code.google.com/p/sqlautocode/
"""
import sys
import logging
import six
import sqlalchemy
import migrate
import migrate.changeset
log = logging.get... |
<reponame>klecknerlab/muvi
#!/usr/bin/python3
#
# Copyright 2021 <NAME>
#
# 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 ... |
"""
The MIT License (MIT)
Copyright (c) 2017-2021 TwitchIO
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... |
# -*- coding: utf-8 -*-
"""
============================================================
© 2018 北京灵汐科技有限公司 版权所有。
* 注意:
以下内容均为北京灵汐科技有限公司原创,
未经本公司允许,不得转载,否则将视为侵权;
对于不遵守此声明或者其他违法使用以下内容者,
本公司依法保留追究权。
© 2018 Lynxi Technologies Co., Ltd. All rights reserved.
* NOTICE:
All information contained here is,
and remains the prope... |
from tokens import *
from memory import *
import tokens
class Parser:
############## init code ###############
def __init__(self, toks):
self.toks = toks
self.current = 0
def parse(self):
stmts = []
self._match(Terminator)
while not self._isAtEnd():
try... |
<filename>trade/tests/test_views.py
import json
import os
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.staticfiles import finders
from django.core.files import File
from django.test import TestCase
from django.urls import reverse
# 물품 모델 테스트
from trade.forms impo... |
import asyncio
import importlib
import logging
from json import JSONDecodeError
from typing import Callable, List
from urllib.parse import urljoin
import aiohttp
import aioredis
import sentry_sdk
from aio_pika import Connection, ExchangeType, IncomingMessage
from aio_pika import Message as AMQPMessage
from aio_pika im... |
#!/usr/bin/env python
# Importing libraries
import os, sys, cv2, argparse
import numpy as np
import matplotlib.pyplot as plt
sys.path.append(os.path.join(".."))
from utils.imutils import jimshow
from utils.imutils import jimshow_channel
def main(inpath, startpoint, endpoint):
# Loading image
image = cv2.imrea... |
import numpy as np
from matplotlib import pyplot as plt
import pylab as P
# computes precision@k for the multi class case
def precision_at_k(y, y_hat, k=5):
count = 0.0
for item in y:
t = np.argmax(item)
for i in range(k):
if t == y_hat[i]:
count += 1.0
... |
<filename>iptv_scan.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 26 07:00:33 2016
@author: pavel
"""
import concurrent.futures
import time
from urllib.request import urlopen
from ipaddress import IPv4Network
TIMEOUT = 2 #seconds
SLEEP_TIME=1
BYTES_TO_READ = 200
NUM_WORKERS = 3 #threads
UDPXY... |
<filename>src/execute_flexible_search.py
#!/usr/bin/env python3
# ExecuteFlexibleSearchException: Received HTTP500 error doesn't mean you won't know why it happened
# To figure out what's wrong with flexible search enable verbose errors and execute flexible search query in groovy:
# setparametertemporary flexible.sear... |
<reponame>rikkt0r/firewall-rule-generator
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django.conf import settings
import mongoengine as me
# from mongoengine.queryset import CASCADE
from fw_common.validators import validate_ip, validate_netmask
class Interface(me.... |
import re
import logging
import decimal
import pickle
from datetime import datetime
from celery.task import task
from celery import group, chord
from celery.execute import send_task
from celery.signals import celeryd_after_setup
from robotice.conf import setup_app
from robotice.utils.database import get_db_values
from... |
import os
from random import choice
import bpy
from src.loader.LoaderInterface import LoaderInterface
from src.utility.Config import Config
class RockEssentialsRockLoader(LoaderInterface):
"""
Loads rocks/cliffs from a specified .bled Rocks Essentials file.
Example 1: Load two rocks from the specified ... |
<gh_stars>100-1000
#!/usr/bin/env python
#
# GrovePi Example for using the Grove GPS Module http://www.seeedstudio.com/depot/Grove-GPS-p-959.html?cPath=25_130
#
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
#
# Have a question... |
from __future__ import unicode_literals
import json
from datetime import timedelta
from django.shortcuts import redirect
from django.forms.models import model_to_dict
from django.urls import reverse_lazy
from django.views.generic import ListView, DetailView, View, CreateView, UpdateView, DeleteView
from django.contri... |
###########################################################################
# Copyright 2014-2015 <NAME>
#
# 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/... |
from __future__ import absolute_import, division, print_function
from xfel.ui import master_phil_scope
from dxtbx.format.FormatXTC import locator_scope
from xfel.ui.command_line.plot_run_stats import phil_scope as rs_scope
def get_help(path, scope = master_phil_scope):
return scope.get(path).objects[0].help
toolti... |
import operator
from unittest import TestCase
from shared.BaseUnitTest import BaseUnitTest
from shared.products import get_products
from shared.users import get_users
import cProfile
import pstats
from streams.Stream import Stream
class TestStream(BaseUnitTest):
def test_create(self):
re... |
from functools import wraps
from unittest.mock import patch, Mock, mock_open
from rekcurd_dashboard.apis import RekcurdDashboardException
from rekcurd_dashboard.models import db, ServiceModel, DataServerModel, DataServerModeEnum
from test.base import (
BaseTestCase, TEST_PROJECT_ID, TEST_APPLICATION_ID, TEST_SERV... |
# Copyright (C) 2011 Philter Phactory Ltd.
#
# 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, publi... |
# -*- coding: utf8 -*-
import os
import os.path
from contextlib import contextmanager
from django.contrib.sites.models import Site
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.core import mail
from django.urls import reverse
from selenium.webdriver.firefox.webdriver import WebD... |
import logging
import os
from typing import Any, Dict, Optional
from pathlib import Path
from ray.experimental.internal_kv import _internal_kv_initialized
from ray._private.runtime_env.utils import RuntimeEnv
from ray._private.runtime_env.context import RuntimeEnvContext
from ray._private.runtime_env.packaging import ... |
<filename>heat/core/tests/test_types.py<gh_stars>0
import numpy as np
import torch
import heat as ht
from .test_suites.basic_test import TestCase
class TestTypes(TestCase):
def assert_is_heat_type(self, heat_type):
self.assertIsInstance(heat_type, type)
self.assertTrue(issubclass(heat_type, ht.da... |
import os
class UbuntuInstaller:
def __init__(self, myenv):
self._my = myenv
self._tools = myenv.tools
def do_all(self, prebuilt=False, pips_level=3):
self._tools.log("installing Ubuntu version")
self._my.installers.ubuntu.ensure_version()
self._my.installers.ubuntu.b... |
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-TSF-msctf
GUID : 4fba1227-f606-4e5f-b9e8-fab9ab5740f3
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp import Sid
from etl.p... |
<gh_stars>0
import argparse
import cv2 as cv
import datetime
import json
import numpy as np
import pyautogui
import random
import sys
import time
import os
import math
from PIL import Image
from pynput import mouse
from matplotlib import pyplot as plt
from matplotlib import cm
from PIL import ImageGrab
from functools... |
"""
Form types.
"""
try:
import decimal
haveDecimal = True
except ImportError:
haveDecimal = False
from zope.interface import implements
from twisted.internet import defer, task
from formal import iformal, validation
class Type(object):
implements( iformal.IType )
# Name of the instance
na... |
<reponame>scottwedge/OpenStack-Stein<filename>searchlight-6.0.0/searchlight/common/config.py
#!/usr/bin/env python
# Copyright 2011 OpenStack Foundation
# 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. Yo... |
"""
Pre-train expert for distiller
Author: <NAME> (https://github.com/vectominist)
"""
from easydict import EasyDict as edict
import yaml
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from pretrain.distiller.dataset import OnlineWaveDataset
from upst... |
<reponame>Novodes/notepad2
# Script to check that headers are in a consistent order
# Canonical header order is defined in a file, normally scripts/HeaderOrder.txt
import sys
import pathlib
def IsHeader(x):
return x.strip().startswith("#") and \
("include" in x or "import" in x) and \
"dllimport" ... |
"""
Test module for context subscriptions and notifications
"""
import unittest
from pydantic import ValidationError
from filip.clients.ngsi_v2 import ContextBrokerClient
from filip.models.ngsi_v2.subscriptions import \
Http, \
HttpCustom, \
Mqtt, \
MqttCustom, \
Notification, \
Subscription
fr... |
"""
Properties
==========
Every model in Experimentor has a set of properties that define their state. A camera has, for example, an exposure
time, a DAQ card has a delay between data points, and an Experiment holds global parameters, such as the number of
repetitions a measurement should take.
In many situations, th... |
"""
Created by catzoo
Description: Discord.py role checks
"""
import os
import asqlite
import env_config
class NoDatabase(Exception):
"""Used for Checks.connection being None"""
pass
# noinspection PyRedundantParentheses
class Checks:
"""
This is used for discord.py checks
Use:
- develop... |
<filename>src/data_frame_creator.py
import datetime
import os
from src import management_departure_indexer
from src.tickers import TICKERS
current_file_dir_path = os.path.dirname(os.path.realpath(__file__))
def _get_relevant_eps_data(filing_date, eps_list):
for eps_date, eps_surprise_percentage in eps_list:
... |
<filename>old_scripts/relative_with_interpolation.py
import numpy as np
import cv2
import matplotlib.pyplot as plt
num_points_to_track = 200
x_coord_start = 200
x_coord_stop = 1720
frame_list = []
manifold_data = []
show_video_images = False
cap = cv2.VideoCapture("data/rope_two_hands.mp4")
if not cap.isOpened():
... |
import unittest
import os
import sys
from mx.DateTime import DateTime
from StringIO import StringIO
import csv
import shutil
# just to make sur we can launch it
# from the top folder
curdir = os.path.dirname(__file__)
topdir = os.path.realpath(os.path.split(curdir)[0])
bz2_file = os.path.join(curdir, 'stats.bz2')
s... |
<filename>example.py
import json
from dataclasses import asdict, fields
from dataclass_tools.tools import (
DeSerializerOptions,
PrintMetadata,
deserialize_dataclass,
serialize_dataclass,
)
from pylatex import NoEscape, PageStyle
from gl_hsc_scantling.composites import PlyStack
from gl_hsc_scantling.... |
<reponame>CrystalPea/pytest-easyread<gh_stars>1-10
# -*- coding: utf-8 -*-
pytest_plugins = "pytester"
import pytest
class TestEasyTerminalReporter(object):
def setup_method(self, method):
self.conftest = open("./pytest_easyread.py", "r")
def test_list_of_tests_items_formatted_correctly(self, testdi... |
<filename>run-tests.py
"""
Copyright (c) 2019 <NAME>. All rights reserved.
SPDX-License-Identifier: MIT
This script attempts to compile every test source + header generated by the
run-build.py script.
Usage:
python3.8 run-tests.py [--keep] COMPILER_PATH [COMPILER_FLAGS]
Where the optional `--keep` flag prevent... |
import argparse
import copy
import json
import pickle
import pprint
import os
import sys
from tqdm import tqdm
from typing import *
from my_pybullet_envs import utils
import numpy as np
import torch
import math
import my_pybullet_envs
from system import policy, openrave
import pybullet as p
import time
import inspe... |
<gh_stars>1-10
from django.contrib.comments.forms import CommentForm
from django.contrib.contenttypes.models import ContentType
from django.template import Template, Context
from regressiontests.comment_tests.models import Article, Author
from regressiontests.comment_tests.tests import CommentTestCase
class CommentTem... |
# goal
import actionlib
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal
import rospy
from geometry_msgs.msg import Vector3, Twist, PoseStamped
from nav_msgs.msg import Odometry
class newGoal():
def __init__(self, x=0, y=0, z=0):
self.curr_vel = Twist()
self.mean_vel = []
self.... |
# Copyright 2015-2016 Yelp 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 to in writin... |
# -*- coding: utf-8 -*-
"""
Multi-lib backend for POT
The goal is to write backend-agnostic code. Whether you're using Numpy, PyTorch,
or Jax, POT code should work nonetheless.
To achieve that, POT provides backend classes which implements functions in their respective backend
imitating Numpy API. As a convention, we ... |
<filename>cmdb_sdk/api/instance_tree/instance_tree_search_pb2.py
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: instance_tree_search.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 _descr... |
import math
from os import path, listdir
from typing import Callable
import cv2
class TimeData:
"""
Class for storing parsed time data
"""
seconds: int = 0
minutes: int = 0
hours: int = 0
def __init__(self, hours, minutes, seconds):
self.seconds = seconds
self.minutes = ... |
<reponame>nanmat/A_New_Mixed_Method<filename>3. Sentiment Analysis.py
# load libaries
import pandas as pd
import os
import numpy as np
from nltk.tokenize import sent_tokenize
import random
from danlp.models import load_bert_emotion_model, load_bert_tone_model,load_spacy_model
import operator
import plotly.graph_object... |
import torch
from torch import nn
from torch.nn import functional as F
from nsflow import utils
# # Projection of x onto y
# def proj(x, y):
# return torch.mm(y, x.t()) * y / torch.mm(y, y.t())
#
#
# # Orthogonalize x wrt list of vectors ys
# def gram_schmidt(x, ys):
# for y in ys:
# x = x - proj(x, y)
# ... |
import networkx as nx
from networkx.readwrite import json_graph
import pandas as pd
import plotly.express as px
from flask_caching import Cache
import plotly.graph_objects as go
import json
import glob
import os
import itertools
#set root directory for data files
#ROOTBEER = '/home/ubuntu/housing_equity/sandbox-single... |
<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Copyright 2021 The Dapr 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 appli... |
<reponame>vd1371/XProject<filename>outlier_detection/MultivariateGaussian.py
import pandas as pd
import numpy as np
import os, sys
parent_dir = os.path.split(os.path.dirname(__file__))[0]
sys.path.insert(0,parent_dir)
from Reporter import *
from scipy.stats import multivariate_normal
from sklearn.preprocessing import... |
<filename>API/utility.py
from __future__ import print_function
import math
import numpy
import glob
import torch
import torchvision
from torchvision import datasets, transforms
import matplotlib.pyplot as plt
import io
import glob
import os
from shutil import move, copy
from os.path import join
from os imp... |
<reponame>sleepsonthefloor/openstack-dashboard<filename>django-nova/src/django_nova/views/securitygroups.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Lic... |
<reponame>lopp2005/HiSpatialCluster
# -*- coding: utf-8 -*-
"""
Calculate Density Tool
Created on Fri Apr 28 11:21:21 2017
@author: cheny
"""
from arcpy import Parameter
import arcpy
from multiprocessing import cpu_count
import numpy.lib.recfunctions as recfunctions
import sys
class CalculateDensityTool(object):
... |
import numpy as np
import pandas as pd
from aslib_scenario.aslib_scenario import ASlibScenario
from ConfigSpace import Configuration
from ConfigSpace.conditions import EqualsCondition, InCondition
from ConfigSpace.configuration_space import ConfigurationSpace
from ConfigSpace.hyperparameters import (
CategoricalHyp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.