text stringlengths 3.07k 12.6k |
|---|
import os
import numpy as np
import matplotlib.pyplot as plt
from argparse import ArgumentParser
from collections import namedtuple, defaultdict
from typing import List, Dict, Any, DefaultDict, Optional
from utils.file_utils import read_by_file_suffix
from plotting.plotting_utils import to_label, rename_dataset, FILL_... |
from frontpage.models import Article, Profile, Media, ArticleGroup
from frontpage.uitools import body
from django.http import HttpRequest
from frontpage.management.magic import get_current_user, get_article_pcs_free
from frontpage.management.form import Form, PlainText, SubmitButton, NumberField, TextField, CheckBox, C... |
# python 2 backwards compatibility
from __future__ import print_function
from builtins import object, super
from future import standard_library
from six import string_types
# package imports
from .base import ModelBase
from .intelligence_source import IntelligenceSource
class IndicatorSummary(ModelBase):
"""
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 1 21:45:45 2021
@author: n7
"""
import os
import pandas as pd
import subprocess
from datetime import datetime
parallelisms = [(7, 2, 1), (12, 7, 1), (17, 12, 1)]
datasizes = [4000, 8000, 16000]
repeats = 10
tms_count = 8
cfg_name = "config-12"
#... |
from typing import Union, Optional, List, Dict, Tuple, Set, Any
class DependencyNode():
def __init__(self, value, depends_on: Optional[List['DependencyNode']] = None):
self.__depends_on = []
self.__dependency_for = []
if depends_on:
for dependency in depends_on:
... |
# <NAME> @ IPVS
# 180928
# Reimplementation of this model with keras
# Some modification on the network structure
import keras
import tensorflow as tf
from keras.utils.vis_utils import plot_model
from keras.optimizers import RMSprop
from keras.models import Model, Sequential
from keras.layers import Input, Activation... |
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
# Funcao de ativacao sigmoide
def sigmoid(soma):
return 1 / (1 + np.exp(-soma))
# Derivada da funcao de ativaçao sigmoide
def sigmoidDerivada(sig):
return sig * (1 - sig)
def plotErrors(error_array):
n_erros = error_array.__len__(... |
import logging
import os
from functools import lru_cache
from typing import List
import tensorflow as tf
import tqdm
from transformers import (
AlbertTokenizer,
AutoConfig,
BertTokenizer,
BertTokenizerFast,
PretrainedConfig,
PreTrainedTokenizer,
)
from transformers.data.processors.squad import ... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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
fro... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ###... |
import abc
from unittest import TestCase
import numpy as np
from nose_parameterized import parameterized
from numpy.testing import assert_array_almost_equal
import convolutional.operators as op
class _BaseTest(TestCase, metaclass=abc.ABCMeta):
def setUp(self):
np.random.seed(0)
@parameterized.expan... |
"""
File Name: UnoPytorch/cell_line_dataframes.py
Author: <NAME> (xduan7)
Email: <EMAIL>
Date: 9/4/18
Python Version: 3.6.6
File Description:
This file takes care of all the dataframes related cell lines.
"""
import os
import loggin... |
# -*- encoding: utf8 -*-
# 这个脚本的原理是,用pip install下载好资源以后,把plugin.py的主文件丢到用户的plugins下
# 这个还没有完全改好
import idaapi
import os
import sys
from contextlib import contextmanager
import tempfile
import subprocess
import fileinput
import pkg_resources
import shutil
if not "ckxtraceviewer_PACKAGE_LOCATION" in dir():
ckxtrac... |
import numpy as np
import torch
from flows.utils import assert_mean_zero_with_mask, remove_mean_with_mask,\
assert_correctly_masked
from qm9.analyze import check_stability
def rotate_chain(z):
assert z.size(0) == 1
z_h = z[:, :, 3:]
n_steps = 30
theta = 0.6 * np.pi / n_steps
Qz = torch.tenso... |
from argparse import ArgumentParser
import pytorch_lightning as pl
import torch
class FasterRCNN(pl.LightningModule):
"""
PyTorch Lightning implementation of `Faster R-CNN: Towards Real-Time Object Detection with
Region Proposal Networks <https://arxiv.org/abs/1506.01497>`_.
Paper authors: <NAME>, <... |
from transformers import T5Model, T5ForConditionalGeneration, T5PreTrainedModel
from transformers import top_k_top_p_filtering
from torch import nn
import torch.nn.functional as F
import torch
class T5ValueHead(nn.Module):
"""The T5ValueHead class implements a head for T5 that returns a scalar for each output tok... |
import numpy as np
import cv2 as cv
import sys
import pandas as pd
import os
#img = cv.imread(r'C:\Users\shubh\Desktop\sample_images\Malignant'+'\\'+'M_3.jpg')
#imgGray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
#imgResize = cv.resize(img, (512,512))
def main():
start = None
end = None
print(start,... |
dictWeightsByNbrOfGames = {
0: (0.3, 0, 0),
5: (0.5, 0.01, 0.01),
10: (0.65, 0.02, 0.025),
15: (0.69, 0.05, 0.07),
20: (0.71, 0.08, 0.1),
25: (0.72, 0.1, 0.13),
30: (0.73, 0.15, 0.16),
35: (0.732, 0.166, 0.176),
}
def TSR(nShotsFor, nShotsAgainst):
if nShotsFor + nShotsAgainst ... |
#! /usr/bin/env python
import collections
import six
from six.moves import configparser
_KEY_TYPES = {
"output_file_namespace": str,
"config_xml_file": str,
"initialize_arg": str,
"mappers": list,
"ports": list,
"optional_ports": list,
"init_ports": list,
"port_queue_dt": float,
"t... |
import json
import os
import logging
from projectsystem import VLQDecoder
logger = logging.getLogger("SWI")
def get_sourcemap_file(file_name):
sourcemap_prefix = "//# sourceMappingURL="
map_file = ""
try:
with open(file_name, "r", encoding="utf8") as f:
# Read the last line of the fil... |
#
# Copyright 2020- IBM Inc. All rights reserved
# SPDX-License-Identifier: Apache2.0
#
"""
This module converts a file describing discovered connectivity in a K8s cluster into a set of k8s NetworkPolicies
"""
import argparse
from pathlib import Path
import sys
from dataclasses import dataclass, field
from typing impo... |
from __future__ import unicode_literals
import datetime
import logging
from sqlalchemy import (Column, Integer, String, Text,
DateTime)
from sqlalchemy import desc
from sqlalchemy.ext.declarative import declarative_base
from jobmanager.utils import parse_description
Base = declarative_base()
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2020 Sarubee
#
# 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
#
# Unle... |
import connexion
import psycopg2
import six
import os
from swagger_server.models.api_response import ApiResponse # noqa: E501
from swagger_server.models.data import Data # noqa: E501
from swagger_server import util
def data_delete(st_case=None): # noqa: E501
"""Delete a record from training data
# noqa:... |
""" This module parses the PES section of a MCTDH's operator file
to generate the corresponding SOP representaion. It can also be
used to generate geometries on different multidimensional grids
or with a Markov Chain Monte Carlo process"""
import itertools
import numpy as np
import scipy.constants as sc
imp... |
from engines import RandomEngine
from itertools import chain
from random import choice
class HitShip:
def __init__(self, coord):
self.coord = coord
self.knownSunk = False #Has to be sunk as a single boat type
self.sinkParty = -1 #The ship which was sunk when known
self.vagueSink = False #Unclear what type of ... |
import os, re
import os.path
import requests
from lxml import etree as ET
from catalog.models import Publication
from pgs_web import constants
class EuropePMCLinkage:
provider_id = '2090'
pgs_url = constants.USEFUL_URLS['PGS_WEBSITE_URL']
link_root = pgs_url+'publication/'
default_filename = 'PGSLink... |
import io
import json
import pytest
from cdc.core.parse import rollseries as rs
from cdc.lib.rollevent import RollEvent
def assert_unreached(msg=None):
if msg:
assert False, msg
else:
assert False, "Unreachable code path was reached"
def event_gen_from_str(s, starting_point=None):
fd = ... |
"Write out file with credit for all combinations of 8 inputs"
import os
import sys
import csv
# there are 8 pssible inputs. Here are their discrete values
FAMILY_COMPOSITION_OPTIONS = [1, 2]
FC_SINGLE = 1
FC_COUPLE = 2
# if one person in family, 1/2/3; if couple, 1/2/34/5/6 possible
CAPACITY_FOR_WORK_OPTIONS = [1,... |
"""Helper functions for injecting data and testing valid cases."""
from mittn.httpfuzzer.httptools import *
from mittn.httpfuzzer.dictwalker import *
from mittn.httpfuzzer.posttools import *
from features.authenticate import authenticate
import requests
import logging
from mittn.httpfuzzer.url_params import *
__copyri... |
import wandb
import tensorflow as tf
from tensorflow.keras.layers import Input, Dense
import gym
import argparse
import numpy as np
tf.keras.backend.set_floatx('float64')
wandb.init(name='PPO', project="deep-rl-tf2")
parser = argparse.ArgumentParser()
parser.add_argument('--gamma', type=float, default=0.99)
parser.... |
"""Testing for Discrete Fourier Transform."""
# Author: <NAME> <<EMAIL>>
# License: BSD-3-Clause
import numpy as np
import pytest
import re
from sklearn.feature_selection import f_classif
from pyts.approximation import DiscreteFourierTransform
rng = np.random.RandomState(42)
n_samples, n_timestamps = 5, 8
X_even = ... |
"""Methods related to generating internet related values."""
import random
import re
from fauxfactory.constants import SCHEMES, SUBDOMAINS, TLDS, VALID_NETMASKS
from fauxfactory.helpers import check_validation
from .choices import gen_choice
from .strings import gen_alpha
def gen_domain(name=None, subdomain=None, ... |
"""This file contains preprocessing related helper functions.
"""
import re
from collections import Counter
# ** exploratory data analysis
# Removes duplicate articles
def remove_duplicate_articles(articles, verbose=False):
"""Removes duplicate articles in the dataset.
:param articles: The dataset of wikipe... |
# -*- coding: UTF-8 -*-
import numpy as np
from pybulletgym.envs.roboschool.robots.robot_bases import MJCFBasedRobot
from pybulletgym.envs.roboschool.envs.env_bases import BaseBulletEnv
from pybulletgym.envs.roboschool.scenes.scene_bases import SingleRobotEmptyScene
from tasks.task import Task
class Reacher(Task):
... |
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
import operator
import logging
import time
from scaii.env.sky_rts.env.scenarios.city_attack import CityAttack
from scaii.env.explanation import Explanation as SkyExplanation, BarChart, BarGroup, Bar
from abp import HRAAdaptive
from abp.explanations import Saliency
logger = logging.getLogger('root')
def alter_q_va... |
from collections import defaultdict
import datetime
from pathlib import Path
import re
import time
import numpy as np
import pandas as pd
import torch
import torch.nn.functional as F
from torch import optim
from .dag_net import DagNet
from .data import load_data
def load_model(params_path: Path, cp_path: Path):
... |
#!/usr/bin/env python3
"""
https://github.com/xstaticxgpx/netsnmp-py3/
Examples:
SNMP GET
---
>>> with netsnmp.SNMPSession('archt01', 'public') as ss:
... ss.get(['.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.3.0', '.1.3.6.1.2.1.1.5.0'])
...
[('.1.3.6.1.2.1.1.1.0', 'STRING', '"Linux archt01 4.3.0-1-ck #1... |
# import demistomock as demisto
from CommonServerPython import * # noqa # pylint: disable=unused-wildcard-import
from CommonServerUserPython import * # noqa
from GSuiteApiModule import * # noqa: E402
''' IMPORTS '''
import urllib3
from typing import List, Dict, Any
# Disable insecure warnings
urllib3.disable_war... |
from bs4 import BeautifulSoup
from selenium import webdriver
import datetime
from modules.crawler.login import campuspick
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.ke... |
# author: <NAME>
# date: 12/29/21
"""
This script aims to evaluate the output of the best model and determine its most important features through SHAPing.
Usage: model_evaluation.py --processed_data_path=<processed_data_path> --results_folder_path=<results_path>
Options:
--processed_data_path=<processed_data_path>... |
# === Start Python 2/3 compatibility
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from future.builtins import * # noqa pylint: disable=W0401, W0614
from future.builtins.disabled import * # noqa pylint: disable=W0401, W0614
# === End Python 2/3 compatib... |
import click
import numpy as np
from scipy.optimize import curve_fit
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
SAMPLE_COUNT = 100
REGRESSION_FUNCTIONS = {
'O(1)': (lambda x, a: a, "{0:6f}"),
'O(log n)': (lambda x, a, b: a + b * np.lo... |
#!/usr/bin/env python3
#
# Copyright (C) 2018-2020 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
"""Usage: ./scripts/lint/set_copyright.py <files>"""
import re
import sys
import os
import datetime
import stat
import argparse
def is_banned(path):
"""Check if path is banned."""
banned_paths = [
... |
"""Pytest configuration which is partially borrowed from sphinx conftest.py.
"""
import copy
import logging
from logging.handlers import MemoryHandler
from typing import Optional, Dict, List
from unittest.mock import Mock
import pytest
import sphinx
from sphinx.application import Sphinx
from sphinx.testing.path impor... |
from selenium.webdriver.common.by import By
"""
Objects are Separated in this module
- ID is the preferable choice as it is unique in a web page
- XPATH is the next best alternative and is also unique but it is cumbersome to fix
if the there are any changes in the layout of the Web page.
- Add the Identifiers i... |
from csp import Variable
from csp.constraints.operator import Operator
from csp.constraints.all_diff import AllDiff
from csp.constraints.x_equals_k import XEqualsK
from csp.constraints.x_not_equal_k import XNotEqualK
from csp.constraints.x_less_or_equal_k import XLessOrEqualK
from csp.constraints.x_greater_... |
# Script show details of storage, i.e. utilization, version, ...
'''
tested with the following versions:
python: 3.7.2
Spectrum Protect Plus: 10.1.3 build 236
'''
from optparse import OptionParser
import sys
import requests
sys.path.insert(0, '..') # import local sppclient, do not use the... |
# See https://github.com/staturecrane/PyTorch-ES/blob/master/pytorch_es/examples/cartpole/train_pytorch.py
from env.tsp_env import TspEnv
from env import tsp_plots
import copy
import numpy as np
import torch
import torch.nn as nn
NUMBER_OF_CITIES = 10
# Set stopping conditions
MAXIMUM_ITERATIONS = 500
# ES paramet... |
#!/usr/bin/env python
# Copyright 2019, MontaVista Software, LLC
# SPDX-License-Identifier: MIT
import tuf
import tuf.scripts.repo
import tuf.formats
import tuf.roledb
import tuf.repository_tool as repo_tool
import time
import datetime
import iso8601
import os
import os.path
import shutil
year_seconds = 31556900
wee... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#===============================================================================
#
# Copyright 2020 (c) Scrapy developers. All rights reserved.
# https://github.com/scrapy/scrapy/blob/master/LICENSE
# Modifications copyright (C) 2020 Chatopera Inc, <https://www.chatopera.co... |
import argparse
import os
from importlib import import_module
from abp.configs import NetworkConfig, ReinforceConfig, EvaluationConfig
from abp.examples.pysc2.tug_of_war.device_handler import get_default_device, to_device, DeviceDataLoader
import torch
import numpy as np
import torch.nn as nn
from abp.adaptives impo... |
"""
This module perform computation related to Hilber-Schmidt Independence
Criterion. Hilber-Schmidt Independence Criterion is short for HSIC.
HISC is defined as $HSIC=\frac{1}{m}Tr(KHLH)$, where $kMat$ and $lMat$
are the kernel matrices for the data and the labels respectively.
$H=I-\frac{1}{m}\delta_{ij}$, where $m$... |
import re
import random
import itertools
import math
from collections import defaultdict
from src.utilities import *
from src import channels, users, debuglog, errlog, plog
from src.functions import get_players, get_all_players, get_main_role, get_reveal_role, get_all_roles, get_target, change_role
from src.decorators... |
from utils import *
from datasets import PascalVOCDataset
from tqdm import tqdm
from pprint import PrettyPrinter
import numpy as np
import matplotlib.pyplot as plt
torch.nn.Module.dump_patches=True
# Good formatting when printing the APs for each class and mAP
pp = PrettyPrinter()
# Parameters
data_folder = 'Conversio... |
#!/usr/bin/env python
# License: Apache-2.0
# Copyright (C) 2020 <NAME>
"""
The script accepts ClickHouse credentials, databases and tables, and produces
the PlantULM schema description. Optionally it could invoke `plantuml` and
create the graphical output.
"""
import logging
import sys
from argparse import (
A... |
# -*- coding: utf-8 -*-
import torch
import torch.nn.functional as F
from torch.nn import Linear, Embedding
from torch_geometric.nn import DNAConv
from torch_geometric.data import Data
from util import timeclass
import pandas as pd
import numpy as np
import random
import time
import copy
class DNA(torch.nn.Module):
... |
#!/usr/bin/env python3
# Created by Raf 5/2019
from cereal import tinkla
import os
import zmq
import datetime
from selfdrive.tinklad import tinklad
import time
## For helpers:
import traceback
from selfdrive.car.tesla.readconfig import CarSettings
from common.params import Params
LOG_PREFIX = "tinklad client: "
tin... |
import argparse
import sys
import re
from collections import defaultdict
from rdbtools3.parser import read_signature, read_version, parse_rdb_stream
from rdbtools3.exceptions import FileFormatError
from rdbtools3.consts import TYPE_NAMES
TYPES = sorted(set(TYPE_NAMES.values()))
PRINT_HEADLINE = '{db:>3} | {type:>6... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2017 <EMAIL>
# Licensed under the MIT license (http://opensource.org/licenses/MIT)
from __future__ import absolute_import, division, print_function, unicode_literals
import struct
from hexdump import hexdump
from keyplus.layout.parser_info import KeyplusParser... |
import numpy as np
from ._utils import move_axis_to_end, suppress_warnings
def brier_score(observations, forecasts):
"""
Calculate the Brier score (BS)
The Brier score (BS) scores binary forecasts $k \in \{0, 1\}$,
..math:
BS(p, k) = (p_1 - k)^2,
where $p_1$ is the forecast probability... |
import eventlet
from eventlet.event import Event
from mock import Mock, patch, call
from pyrabbit.http import HTTPError
import pytest
from nameko.constants import DEFAULT_MAX_WORKERS
from nameko.rpc import rpc
from nameko.testing.utils import (
AnyInstanceOf, get_dependency, get_container, wait_for_call,
reset... |
from collections import Counter
class store:
_type = 'store'
_subtype = None
# def __repr__(self) -> str:
# return "{}_{} {}\n".format(self._subtype,self._type, self._data.__repr__())
def __getstate__(self):
## used by pickle
return self._data
def __setstate__(self,data)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import os
import urllib.request
import re
import sys
from bs4 import BeautifulSoup
from requests import get
from find_the_treasure.ft_sqlite3 import UseSqlite3
class FTbot: # Find the Treasure
def __init__(self):
self.twitter_app_key = os.envi... |
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 26 14:17:04 2019
@author: verony
"""
'''
What happens if Som initialization is forgotten ?
=>UnboundLocalError: local variable 'Som' referenced before assignment
What can you expect if all the values are below zero ?
=>ZeroDivisionError: division by zero
'''
... |
# 2017.5.23 zhujian
# Hierarchical Clustering: initial points
# Kmeans: do clusting in [2,(n-1)]
#VRC: choose the best k and cluster based on the CH
import numpy as np
import random
import re
import getpass
class node:
def __init__(self, No, ip, speed):
self.No = No
self.ip = ip
self.speed ... |
# Copyright 2018 PerfKitBenchmarker 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 appli... |
# -*- coding: utf-8 -*-
# (C) 2015 <NAME>
import codecs
import re
from opentamiltests import *
from solthiruthi.heuristics import (
AdjacentVowels,
AdjacentConsonants,
RepeatedLetters,
BadIME,
)
from tamil import utf8
class AdjacentUyirgalTest(unittest.TestCase):
def test_word_in_error(self):
... |
"""IPython completer for adb commands.
To activate, pip-install and append the output of `ipython -m ipython_adbcompleter`
to `~/.ipython/profile_default/ipython_config.py`.
"""
import os
import re
import subprocess
try:
import _ipython_adbcompleter_version
except ImportError:
from pip._vendor import pkg_res... |
import sys
try:
from smbus import SMBus
except ImportError:
if sys.version_info[0] < 3:
sys.exit("This library requires python-smbus\nInstall with: sudo apt-get install python-smbus")
elif sys.version_info[0] == 3:
sys.exit("This library requires python3-smbus\nInstall with: sudo apt-get in... |
import functools
import numpy as np
import torch
import tensorflow as tf
class ImageDataHandler_TF():
def __init__(self, training_files, handler_params, dtype, validation_files=None):
self.data_type = dtype
self.train_files = training_files
self.val_files = validation_files
def load_da... |
# -*- coding: utf-8 -*-
#
# Copyright 2018 Microsoft 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
#
# Unless required by applicab... |
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.triggers.date import DateTrigger
import requests
import utils
from requests.auth import HTTPBasicAuth
import arrow
from pytz import UnknownTimeZoneError
import logging
logger = logging.getLogger(__name__)
try:
handoff_scheduler = Ba... |
#!/usr/bin/python
# -*- coding:utf-8 -*-
# Copyright (C) 2020 Inspur Inc. All Rights Reserved.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
---
module: edit_smt... |
# Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES
#
# SPDX-License-Identifier: BSD-3-Clause
import cupy as cp
import numpy as np
from cuquantum import custatevec as cusv
from cuquantum import cudaDataType, ComputeType
if cp.cuda.runtime.runtimeGetVersion() < 11020:
raise RuntimeError("memory_handler ex... |
from __future__ import division
import sqlite3
from flask import Flask, request, session, g, redirect, url_for, \
abort, render_template, flash
from contextlib import closing
import nltk, re, pprint
from nltk.corpus import gutenberg
from nltk.corpus import wordnet as wn
# configuration
DATABASE = '/tmp/webtext.... |
from mpl_toolkits import mplot3d
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# df = pd.read_csv("disparate_removed_german_discrimination.csv")
df = pd.read_csv("all_german_discm_data.csv")
def from_setting_find_model_count(perm, h1units, h2units, batch):
hyperparameter_setting = 0
... |
# MIT License
#
# Copyright (c) 2018, <NAME>
#
# 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, publ... |
"""Deprecators.
"""
__author__ = '<NAME> <<EMAIL>>'
__copyright__ = 'Copyright © <NAME> <https://github.com/neurobin/>'
__license__ = '[BSD](http://www.opensource.org/licenses/bsd-license.php)'
__version__ = '1.1.0'
import inspect
import traceback
import warnings
import functools
from packaging import version
from... |
import telepot
import string
import random
from django.db import models
from django.urls import reverse
from django.conf import settings
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth import get_user_model
from easy_cache im... |
# Copyright 2016-2019 The <NAME> at the California Institute of
# Technology (Caltech), with support from the Paul Allen Family Foundation,
# Google, & National Institutes of Health (NIH) under Grant U24CA224309-01.
# All rights reserved.
#
# Licensed under a modified Apache License, Version 2.0 (the "License");
# you ... |
# -*- coding: utf-8 -*-
#
# main.py
# AutoDMG
#
# Created by <NAME> on 2013-09-19.
# Copyright 2013-2014 <NAME>, University of Gothenburg. All rights reserved.
#
import os
import sys
import argparse
import traceback
import objc
import Foundation
objc.setVerbose(True)
from IEDLog import LogDebug, LogInfo, LogNot... |
import numpy as np
from multiprocessing.shared_memory import SharedMemory
from multiprocessing import Lock
from ptlib.core.job import JobSpec, Job
class BaseQueue:
""" Queue. *** COME BACK *** """
class Wait:
""" Flag for lock acquisition wait. """
class Empty:
""" Flag for emtpy queue.... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from nsepy import get_history
from datetime import datetime as dt
plt.style.use("seaborn")
start_date = dt(2000,1,1)
end_date = dt.now()
# df = get_history("Nifty",start_date,end_date,index=True)
# print(df.tail())
# df.to_csv("Nifty50.csv... |
# -*- coding: utf-8 -*-
"""line_notify_bot.py
Send messages, images, or stickers to a LINE group via LINE Notify.
This bot can't accept messages, i.e., is not interactive.
Access token can be obtrained from: https://notify-bot.line.me/ja/
Sticker and its package IDs can be chosen from: https://devdocs.line.me/files/... |
from flask import Flask,jsonify,request,make_response
import json
import requests
import os
import sys
from pixivpy3 import *
username = "<EMAIL>"
password = "<PASSWORD>"
aapi = AppPixivAPI()
aapi.login(username, password)
papi = PixivAPI()
papi.login(username, password)
class mod:
@staticmethod
def add_two... |
from django.utils import timezone
from djes.models import Indexable
from elasticsearch_dsl import aggs
from elasticsearch_dsl.filter import Term, Range, MatchAll, Nested, Missing
class Searchable(Indexable):
"""adds a `.search` class method to the model
"""
class Meta(object):
abstract = True
... |
"""
This file contain implimentations of the continuation and timesteppers developed for IEMIC,
but applicable to any code which implements the necessary methods.
"""
from math import isnan, sqrt
def newton(interface, x0, tol=1.e-7, maxit=1000):
x = x0
for k in range(maxit):
fval = interface.rhs(x)
... |
""" Manages HAProxy operations. """
import errno
import logging
import os
import pkgutil
import subprocess
import time
from tornado import gen
from appscale.common.appscale_info import get_private_ip
logger = logging.getLogger('appscale-admin')
# The directory that contains HAProxy config files.
CONFIG_DIR = os.pat... |
import pandas as pd
import numpy as np
import datetime as dt
from tqdm import tqdm
from ..utils.parralel import *
def getDailyVol(close, span0=100, days=1):
# daily vol reindexed to close
df0 = close.index.searchsorted(close.index - pd.Timedelta(days=days))
df0 = df0[df0 > 0]
df0 = pd.Series(close.in... |
# MIT License
#
# Copyright (c) 2021 <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
# to use, copy, modify, me... |
"""Module with collections
"""
import random, typing
import rapidjson as rjson
from .errors import *
def deep_merge(source: dict, destination) -> dict:
"""Deep merge for dictionaries
Args:
source (dict): Dict to merge
destination (Any): hm...
Returns:
dict: hm...
... |
from flask import Flask, request
import requests
import json
from twilio.twiml.messaging_response import MessagingResponse
from covid_countries import *
from covid_vaccination import *
from covid_news import *
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
@app.route('/bot', methods =... |
#!/usr/bin/env python3
"""Takes a file containing a list of directories under the PACS root, runs
through tar and then through 7za for AES256 encryption
"""
# TODO(rkm 2021-01-19) Thread-safe password file access/update
# TODO(rkm 2021-01-19) Allow specifying output directory
# TODO(rkm 2021-04-27) Re-add single-file m... |
'''
This submodule contains the scripts that the we used to sample the adsorption
structures.
Note that some of these scripts were taken from
[GASpy](https://github.com/ulissigroup/GASpy) with permission of author.
'''
__authors__ = ['<NAME>', '<NAME>', '<NAME>', '<NAME>']
__email__ = ['<EMAIL>']
import math
from co... |
"""A SignalGroup class that allows connecting to all SignalInstances on the class.
Note that unlike a slot/callback connected to SignalInstance.connect, a slot connected
to SignalGroup.connect does *not* receive the direct arguments that were emitted by a
given SignalInstance. Instead, the slot/callback will receive a... |
""" webserver with kami and mu calculus functionnalities"""
import os
import json
import networkx as nx
from flask import Flask, request
# from server_hierarchy import ServerHierarchy
from base.base_blueprint import app
from server.kami.kami_blueprint import kami_blueprint
from server.mu_calculus.mu_blueprint import m... |
#!/usr/bin/env python3
# coding: utf-8
"""
weegfx/tools/fontconv.py: Converts monospaced fonts to C header files suitable for weegfx.
Copyright (c) 2019 <NAME> <<EMAIL>>
Released under the 3-clause BSD license (see LICENSE)
"""
import os
import sys
from argparse import ArgumentParser
from typing import TextIO
import... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2021 Alibaba Group Holding 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-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.