text stringlengths 957 885k |
|---|
import time
import matplotlib.pyplot as plt
import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
parser = argparse.ArgumentParser()
parser.add_argument('--tol', type=float, default=1e-3)
parser.add_argument('--adjoint', type=eval, default=False)
parser.add_argument('--lr',... |
<reponame>gradiuscypher/advent-of-code
#!/usr/bin/env python3
import copy
from pprint import pprint
import traceback
from sys import argv
filename = argv[1]
sea = [[0] * 1000 for _ in range(1000)]
def line_iterator(start, end):
path_list = []
# figure out whether x or y is changing
# this means x is ch... |
<gh_stars>0
from mpi4pyve import MPI
import mpiunittest as unittest
class TestErrorCode(unittest.TestCase):
errorclasses = [item[1] for item in vars(MPI).items()
if item[0].startswith('ERR_')]
errorclasses.insert(0, MPI.SUCCESS)
errorclasses.remove(MPI.ERR_LASTCODE)
def testGetEr... |
<reponame>JTarball/tetherbox
import datetime
from django.core import mail
from django.core.handlers.wsgi import WSGIRequest
from django.contrib.sessions.middleware import SessionMiddleware
from django.contrib.sites.models import Site
from django.test import TestCase, Client, RequestFactory
from django.conf import sett... |
<filename>src/sage/combinat/species/characteristic_species.py
"""
Characteristic Species
"""
#*****************************************************************************
# Copyright (C) 2008 <NAME> <<EMAIL>>,
#
# Distributed under the terms of the GNU General Public License (GPL)
#
# This code is distribute... |
from django.shortcuts import render, reverse, redirect
from SNI.check import check_tokens
from SNI.error import render_error
from SNI.esi import post_universe_names, get_corporations_corporation_id, ESI_SCOPES
from SNI.lib import global_headers
from utils import SNI_URL
import requests
from urllib.parse import urlenc... |
<gh_stars>1-10
import logging
import src.ServiceTools
from src.DebtorsRegister import DebtorsRegister
from src.EntrepreneursRegister import EntrepreneursRegister
from src.LegalEntitiesRegister import LegalEntitiesRegister
from src.LustratedPersonsRegister import LustratedPersonsRegister
from src.MissingPersonsRegister... |
# -*-coding:utf8-*-
#
# @autor:<EMAIL>
# ACO algorithm for K shortest path
#
# 研究问题:
# 针对北京市轨道交通的部分网络图,求解出O(起点站)-D(终点站)的K短路问题。本研究采用蚁群算法求解K短路的方案,
# 不仅考虑到蚁群算法的各种优越性,更在于其能很好解决该问题,并为诸多相关的问题研究提供一种可行的解决方案
# 考虑到所处理的问题的特殊性,为增强算法效率,本设计对地图进行了简化,但仍能保证正确的表述问题。
#
# 总体算法概述:
# 蚁群算法:
# 其是一种用来在图中寻找优化路径的机率型算法,一种模拟进化算法,具有一种新的... |
<filename>services/web/project/models.py<gh_stars>0
"""Database models."""
from . import db
from flask_login import UserMixin, _compat
from flask_login._compat import text_type
from werkzeug.security import generate_password_hash, check_password_hash
from functools import wraps
from flask_sqlalchemy import SQLAlchemy
f... |
<filename>tests/test_production.py
import unittest
from generative.lsystem.grammar import RuleMapping, Token
from generative.lsystem.production import RuleParser
class RuleParsingParser(unittest.TestCase):
def test_simple(self):
parser = RuleParser()
rule = "a -> ab"
result = parser._pars... |
<gh_stars>100-1000
import errno
import functools
import logging
import sys
import webbrowser
import os
import click
from flask_compress import Compress
from flask_cors import CORS
from server.default_config import default_config
from server.app.app import Server
from server.common.config.app_config import AppConfig
fr... |
load(
"//AvrToolchain:cc_toolchain/third_party.bzl",
"add_compiler_option_if_supported",
"get_cxx_inc_directories",
)
def _get_treat_warnings_as_errors_flags(repository_ctx, gcc):
# below flags are most certainly coding errors
flags_to_add = [
"-Werror=null-dereference",
"-Werror=re... |
from __future__ import annotations
import numpy as np
from numpy import ndarray as Array
from functools import total_ordering
from typing import List, Dict, Tuple, Iterable, Callable, NamedTuple, Union, Optional
class Point(NamedTuple):
"""
Position tuple
"""
x: int = 0
y: int = 0
def __add__... |
<gh_stars>1-10
# Created for aenea using libraries from the Dictation Toolbox
# https://github.com/dictation-toolbox/dragonfly-scripts
#
# Commands for interacting with Vim
#
# Author: <NAME>
# modified by: <NAME> # # Licensed under LGPL
from utility.vim_logic import lineJuggle_logic
from dragonfly import (
Dict... |
<filename>dammit/app.py
# Copyright (C) 2015-2018 <NAME>
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the BSD license. See the LICENSE file for details.
import argparse
import glob
import logging
import os
import sys
from dammit import annotate
from dammit import data... |
<filename>AssignmentCode/RedBlackBST_Starter.py
class RedBlackBST:
""" A Python Implementation of a Red-Black Binary Search Tree
"""
class RedBlackNode:
"""Basic node representing the Key/Value and color of a link/node.
"""
def __init__(self, key, value):
"""Returns a new... |
<filename>tracing_tool/debug_traces.py
import ast
import os
import sys
import glob
from colors import prGreen,prCyan,prRed
TRACES_DIR = './.fpchecker/traces'
TRACES_FILES = TRACES_DIR+'/'+'trace'
class TraceBackCommand:
def __init__(self):
pass
@staticmethod
def getFile(rawCommand):
files = glob.glob... |
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import print_function
import base64
import os.path
from contextlib import contextmanager
from threading import Thread
import colors
import pytest
from pex.cli.testing im... |
# coding: utf-8
"""
Jamf Pro API
## Overview This is a sample Jamf Pro server which allows for usage without any authentication. The Jamf Pro environment which supports the Try it Out functionality does not run the current beta version of Jamf Pro, thus any newly added endpoints will result in an error and sh... |
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
NbrOfNodes = 35
key200 = ' TIME: GANDRC STEP: 180.000 FRAME: 1.000'
#--------------------------------------------------------------------------
# File for gain parameter 01
#--------------------------------------... |
<reponame>JenDobson/blog<gh_stars>0
from sqlalchemy import Column, ForeignKey, Integer, Date, String
from sqlalchemy.orm import declarative_base, relationship, sessionmaker
from sqlalchemy import create_engine
from sqlalchemy import event
from sqlalchemy import select, update
Base = declarative_base()
'''
Last step:... |
<filename>floodsystem/stationdata.py
'''
This module provides interface for extracting station data from
JSON objects fetched from the Internet and
'''
# pylint: disable=relative-beyond-top-level
from itertools import groupby
try:
from .datafetcher import \
fetch_stationdata, fetch_latest_water_level_dat... |
"""
Script to determine focal mechanism of the InSight station.
Important: ssh-copy-id -i .ssh/id_rsa <EMAIL> (once)
"""
__author__ = "<NAME>"
import argparse
import toml
import instaseis
from os.path import join as pjoin
from os.path import exists as exist
import SS_MTI
def define_arguments():
helptext = "Dete... |
<filename>main.py
from PyQt5 import uic, QtWidgets
class UI_Window(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(UI_Window, self).__init__(parent)
uic.loadUi('base.ui', self)
self.actionLogin.triggered.connect(self.back_to_Login)
self.actionCadastrar_Usuario.trigge... |
#!/usr/bin/env python
try:
import json
except ImportError:
import simplejson as json
import urllib2
import urllib
import base64
from pagerduty.version import *
__version__ = VERSION
class SchedulesError(urllib2.HTTPError):
def __init__(self, http_error):
urllib2.HTTPError.__init__(self, http_err... |
#!/usr/bin/env python
from collections import defaultdict
from collections import OrderedDict
import copy
from intervaltree import IntervalTree
from ragoo_utilities.PAFReader import PAFReader
from ragoo_utilities.SeqReader import SeqReader
from ragoo_utilities.ReadCoverage import ReadCoverage
from ragoo_utilities.Con... |
<reponame>megsano/tfutils<filename>tfutils/model_tool_old.py
from __future__ import absolute_import, division, print_function
import inspect
from functools import wraps
from collections import OrderedDict
from contextlib import contextmanager
import copy
import tensorflow as tf
from tfutils.crossdevice_batchnorm impor... |
<gh_stars>10-100
import torch
import torch.nn as nn
from lib.modules.layers import FullyConnectedLayer
from network import Network
class FullyConnectedNetwork(Network):
"""
Fully-connected neural network, i.e. multi-layered perceptron.
Args:
network_config (dict): dictionary containing network co... |
<gh_stars>10-100
#
# Copyright (c) 2017 Red Hat
# Licensed under The MIT License (MIT)
# http://opensource.org/licenses/MIT
#
from rest_framework import serializers
from django.conf import settings as django_settings
import re
from datetime import datetime
import six
from pdc.apps.common.fields import ChoiceSlugField... |
"""
Example "Arcade" library code.
If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples.decorator_drawing_example
"""
# Library imports
import arcade
import random
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
SCREEN_TITLE = "Drawing With Decorators ... |
<reponame>sdrobert/pydrobert-speech
# pylint: skip-file
import os
from math import erf
import numpy as np
import pytest
from pydrobert.speech import util
@pytest.mark.parametrize("shift", [0, 1, 100, -100])
@pytest.mark.parametrize("dft_size", [1, 2, 51, 1000], ids=["l1", "l2", "l51", "l1000"])
@pytest.mark.para... |
"""
created matt_dumont
on: 6/02/22
"""
import datetime
import time
import pandas as pd
from pyqtgraph.Qt import QtGui, QtCore, QtWidgets
import numpy as np
from matplotlib.cm import get_cmap
from api_support.get_data import get_afk_data, get_window_watcher_data, get_manual, get_labels_from_unix, \
add_manual_dat... |
import subprocess
import sys
import matplotlib.pyplot as plt
import os
import pandas as pd
def get_file_bucket(file):
file_bucket = " ".join(str(subprocess.check_output("file {0}".format(file),
shell=True).strip()).split(":")[1].split(",")[0].strip().split(
... |
## This file is part of Scapy
## Copyright (C) 2007, 2008, 2009 <NAME>
## 2015, 2016, 2017 <NAME>
## This program is published under a GPLv2 license
"""
TLS server automaton. This makes for a primitive TLS stack.
Obviously you need rights for network access.
We support versions SSLv2 to TLS 1.2, along w... |
import csv
import logging
import typing as t
from collections import defaultdict
import discord
from discord.ext import commands
from bot.bot import Bot
from bot.constants import Categories, Channels, Emojis, Roles
log = logging.getLogger(__name__)
MAX_CHANNELS = 50
CATEGORY_NAME = "Code Jam"
TEAM_LEADERS_COLOUR = ... |
<filename>src/python/bezier/_plot_helpers.py<gh_stars>100-1000
# 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/LICENSE-2.0
#
# Unless required by applica... |
import pygame
import os
import random
import sys
import math
from pygame.locals import *
from gamestate import *
from battle import battle
from repair import repair
from events import events
from shop import shop
from gameover import game_over, game_win
from escape import Escape
LAST = -1
FIRST = 1
def get_rand():
... |
<reponame>czhang475/DEL_analysis
import copy
import argparse
import numpy as np
import pickle
def best_stereoisomer(sim_mat, stereo_groups, ref):
'''
Inputs
------
sim_mat : numpy array
matrix of 3D similarity scores to be modified
stereo_groups : dictionary
dictionary of compound i... |
# -*- coding: utf-8 -*-
'''
@Date: 2020/1/10
@Author: fanyibin
@Description: 央视网新闻爬虫
'''
from core.genius import Genius
from frame_library.common_library import timestr_to_timestamp, get_content_from_html, check_image
import re
class SpiderCctvNews(Genius):
name = 'cctv_news'
news_type = ('china', 'world', '... |
"""
Copyright 2018 Johns Hopkins University (Author: <NAME>)
Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from six.moves import xrange
import pytest
import os
import copy
import numpy as np
f... |
import csv
import datetime
import hashlib
import numpy
import json
import logging
import random
from itertools import chain
from functools import partial
import postgres_copy
import sqlalchemy
from retrying import retry
from sqlalchemy.orm import sessionmaker
from ohio import PipeTextIO
from triage.component.results_... |
<reponame>Mandy-77/MTCNN_Tucker2
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import torch
import numpy as np
from numpy import linalg as la
import torch.nn as nn
class Tkd2Conv(nn.Module):
def __init__(self, conv_nn_module, rc, rf):
def tucker2decomposition(conv_nn_module, rc, rf):
bias =... |
import random
import unittest
from simulator.helper.environment import get_mortalty_rate, get_hospitalization_rate, get_symptom_rate
from simulator.helper.simulation import get_infection_parameters
from simulator.helper.utils import invert_map_list, invert_map, flatten, reduce_multiply_by_key, choose_weight_order, \
... |
<reponame>adammacudzinski/libsbp
#!/usr/bin/env python
# Copyright (C) 2015 Swift Navigation Inc.
# Contact: https://support.swiftnav.com
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATI... |
<filename>loopy/transform/pack_and_unpack_args.py
from __future__ import division, absolute_import
__copyright__ = "Copyright (C) 2018 <NAME>, <NAME>"
__license__ = """
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to... |
# Copyright 2018 Jetperch 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 agreed to in writing,... |
# coding: utf-8
"""
.. _l-estim-sird-theory:
Estimation des paramètres d'un modèle SIRD
==========================================
On part d'un modèle :class:`CovidSIRD <aftercovid.models.CovidSIRD>`
qu'on utilise pour simuler des données. On regarde s'il est possible
de réestimer les paramètres du modèle à partir de... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from .. import utilities, tables
class PolicyAttachment(pulumi.CustomR... |
<gh_stars>1-10
"""Vanilla Policy Gradient (REINFORCE)."""
import collections
import copy
from dowel import tabular
import numpy as np
import torch
import torch.nn.functional as F
from garage import log_performance
from garage.np import discount_cumsum
from garage.np.algos import RLAlgorithm
from garage.torch import c... |
<reponame>masschallenge/impact-api
from datetime import (
datetime,
timedelta,
)
from pytz import utc
import calendar
from django.db import connection
from django.test.utils import CaptureQueriesContext
from django.urls import reverse
from accelerator_abstract.models.base_clearance import (
CLEARANCE_LEVE... |
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import models
from django.utils.translation import gettext_lazy as _
from django_resized import ResizedImageField
from martor.models import MartorField
from ..validators import file_size_validator, image_extension_validator
... |
#import copy
#import re, sys
from collections import defaultdict
#from Queue import Queue
from data_structures import CanonicalDerivation, Edge, RuleInstance
class CanonicalParser(object):
def __init__(self,s):
"""
Takes a sentence and learns a canonical derivation according to the simple grammar... |
<filename>thimbles/tests/utils.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Purpose: Utilities for Thimbles
# Author: <NAME>
# Date: Jan 18, 2014
# ########################################################################### #
# Standard Library
from collections import OrderedDict
# 3rd Party
import numpy as np... |
import tkinter
from collections import OrderedDict
from tkinter.messagebox import showwarning
from db.orm import Manager
from staff_info.gui_exceptions import TooManyItemsChecked
from .models import Employee, Result
from .views import GuiBuilder, ToplevelBuilder, gui_table_fields, gui_labels, add_employee_labels
cla... |
<filename>env/lib/python2.7/site-packages/MySQLdb/constants/ER.py<gh_stars>0
"""MySQL ER Constants
These constants are error codes for the bulk of the error conditions
that may occur.
"""
HASHCHK = 1000
NISAMCHK = 1001
NO = 1002
YES = 1003
CANT_CREATE_FILE = 1004
CANT_CREATE_TABLE = 1005
CANT_CREATE_DB ... |
<reponame>saulshanabrook/CrossHair
import collections
import copy
import dataclasses
import re
import sys
import unittest
from typing import *
from crosshair.core import make_fake_object
from crosshair.core_and_libs import *
from crosshair.test_util import check_ok
from crosshair.test_util import check_exec_err
from c... |
<gh_stars>10-100
#############################
#
# copyright 2016-2021 Open Interconnect Consortium, Inc. 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 sour... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import abc
import sys
import collections
import decimal
from itertools import permutations
import singledispatch as functoo... |
"""Load transformations from URDF files.
See :doc:`transform_manager` for more information.
"""
import os
import numpy as np
from bs4 import BeautifulSoup
from .transform_manager import TransformManager
from .transformations import transform_from, concat
from .rotations import active_matrix_from_extrinsic_roll_pitch_y... |
import time
#modes = {
# "VACANT", #There is no train in this block
# "ENTERING", #I'm still considered empty, but I should start moving to help train in previous block depart
# "APPROACHING", #Previous block is now empty, I own the train and am waiting to sense it
# "HOLDING", #I can sense the train and ... |
import re
from atavism.http11.content import Content
from atavism.http11.headers import Headers
from atavism.http11.range import Range
class BaseHttp(object):
""" Base class for other HTTP transactional classes. This class tries
to provide the core functionality for various classes.
"""
RANGE_re =... |
<reponame>sfpd/rlreloaded
from docutils import nodes
from docutils.parsers.rst import Directive, directives
import os.path as osp
import sys,traceback
from StringIO import StringIO
import codecs
NAMESPACE = {}
def eval_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
"""
:param name: The rol... |
<filename>PCN/PCN_main_train.py<gh_stars>0
################################################################################
# Copyright 2021 <NAME>
# See the LICENSE file for details.
# SPDX-License-Identifier: MIT
################################################################################
import os
import sys
sy... |
#!/usr/bin/python
import string
import re
import json
import sys
import os
# A set of type definitions: first element is regex to match, second is type converter
TYPES = {
#'float': (r'(?:\-)?[0-9]*(?:\.[0-9]*)?(?:[eE][\-\+]?[0-9]+)?|[0-9]+', float),
'float': (r'[-+]?[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?... |
<filename>Google/benchmarks/unet3d/implementations/unet3d-preview-JAX-tpu-v4-128/models/test_util.py
"""Test utilities."""
from absl import flags
import numpy as np
import torch
from REDACTED.mlperf.submissions.training.v1_0.models.unet3d.models import layers # pylint: disable=unused-import
FLAGS = flags.FLAGS
de... |
# Copyright (c) 2016-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import logging
import os
import shutil
import sys
import time
import traceback
from typing import List, Optional
from . import buc... |
from .mixins import ExtendCreateModelMixin, ExtendUpdateModelMixin
from .mixins import UserCreateModelMixin, UserUpdateModelMixin
from rest_framework import viewsets, mixins, filters
from django.shortcuts import get_object_or_404
class FilterViewSet(viewsets.GenericViewSet):
filter_backends = (filters.DjangoFilt... |
import base64
import os.path
from django.conf import settings
from django.core import mail
import mock
from nose import SkipTest
from nose.tools import eq_
import amo
from amo.tests import app_factory, TestCase
from mkt.comm.models import CommunicationThread, CommunicationThreadToken
from mkt.comm.tests.test_views ... |
<filename>project_reporter/replicon.py
from pathlib import Path
import pandas as pd
from xml.sax import ContentHandler, parse
import project_reporter.utilities as ut
class ExcelHandler(ContentHandler):
"""
Reference https://stackoverflow.com/questions/33470130/read-excel-xml-xls-file-with-pandas
""... |
<gh_stars>100-1000
import numpy as np
from scipy.ndimage import map_coordinates
from scipy.spatial.distance import pdist, squareform
from sklearn.decomposition import PCA
PI = float(np.pi)
def fuv2img(fuv, coorW=1024, floorW=1024, floorH=512):
'''
Project 1d signal in uv space to 2d floor plane image
''... |
<gh_stars>1-10
import pytest
from hexastore.ast import IRI, Variable
from hexastore.blank_node_factory import BlankNodeFactory
from hexastore.default_forward_reasoner import make_default_forward_reasoner
from hexastore.memory import InMemoryHexastore
A = IRI("http://example.com/A")
B = IRI("http://example.com/B")
C =... |
##########################################################################
##file: naturalLanguageProcessing.py
##Author: <NAME>
##Project: Blocks World and Agency
##
##Dependencies: nltk
##
##This file processes input for use in the AgentJBase class.
##
########################################################... |
import argparse
import numpy as np
MODEL_PATH_DICT = {
"cnn": {
"tf": "saved_models/BreastDensity_BaselineBreastModel/model.ckpt",
"torch": "saved_models/BreastDensity_BaselineBreastModel/model.p",
},
"histogram": {
"tf": "saved_models/BreastDensity_BaselineHistogramModel/model.ckp... |
<reponame>NinaWie/NeurIPS2021-traffic4cast<filename>data/dataset/dataset.py
# Copyright 2021 Institute of Advanced Research in Artificial Intelligence (IARAI) GmbH.
# IARAI licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the Li... |
from typing import Any, Dict, List, Tuple, Type
from dbnd._core.configuration.config_value import ConfigValue
from dbnd._core.parameter.parameter_definition import ParameterDefinition
from dbnd._core.utils.basics.text_banner import safe_string
class TaskParameters(object):
def __init__(self, task):
self.... |
#IN NEW VERSIONS of qtcreator:
# add this file in Options -> Debugger -> GDB -> Extra Dumper Files
#IN OLD VERSIONS, this is loaded via .gdbinit and you need the python and end flags!
#python
#import sys
#sys.path.insert(0, '/home/mtoussai/opt/qtcreator-4.2.0-rc1/share/qtcreator/debugger')
from dumper import *
... |
import torch.nn as nn
import torch
from . import config
from DLBio.pytorch_helpers import get_device
DEFAULT_BN = config.DEFAULT_BN
DEFAULT_1X1 = config.DEFAULT_1X1
class ResidualAdapter(nn.Module):
def __init__(self, block, relu_after_shortcut=False, use_1x1=False, in_dim=-1, out_dim=-1):
super(ResidualA... |
import warnings
warnings.filterwarnings("ignore")
import random
from AdaFairEQOP import AdaFairEQOP
from multiprocessing import Process, Lock
import pickle
import os
import matplotlib
from sklearn.model_selection import StratifiedKFold, ShuffleSplit, StratifiedShuffleSplit
from Competitors.SMOTEBoost import SMOTEBoost
... |
<reponame>jarryliu/queue-sim
#!/usr/local/bin/python3
import numpy as np
import matplotlib.pyplot as plt
from math import sqrt, floor, ceil
import scipy as sp
import scipy.stats
import scipy as sp
def mean_confidence_interval(a, k=1, confidence=0.99):
n = len(a)/k
m, se = np.mean(a), sp.stats.sem(a)
h = se * sp.... |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
This code implements the feature-vectors algorithm.
For a given dataset and a given tree-based model, it extracts a 2-D embedding vector for each feature and visualizes
the interaction among features.
- ``FeatureVec`` implements the feature-vectors algorithm and its outp... |
<reponame>nap-lab/apollo
#!/usr/bin/env python
###############################################################################
# Copyright 2017 The Apollo 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.... |
from casexml.apps.phone.dbaccessors.sync_logs_by_user import get_synclogs_for_user
from corehq.apps.change_feed import topics
from corehq.apps.change_feed.consumer.feed import KafkaChangeFeed, KafkaCheckpointEventHandler
from corehq.apps.receiverwrapper.util import get_version_and_app_from_build_id
from corehq.apps.use... |
<filename>src/test/shell/bazel/testdata/bazel_toolchain_test_data/tools/arm_compiler/cc_toolchain_config.bzl
#
# Copyright 2019 The Bazel 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 ... |
<gh_stars>1-10
#!/usr/bin/env python
"""
PGInteraction
"""
import csv
import psycopg2
import psycopg2.extras
import simplejson as json
from jsonschema import validate, ValidationError
from psycopg2 import errorcodes
from datacoco_db.helper.deprecate import deprecated
class InvalidJsonResult(Exception):
pass... |
<reponame>cy-Ajeesh-Anil/testproject
"""empty message
Revision ID: a09758231d3f
Revises:
Create Date: 2020-08-24 15:05:09.520261
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a09758231d3f'
down_revision = None
branch_labels = None
depends_on = None
def up... |
<gh_stars>1-10
import json
import os
import logging
import sys
from datetime import datetime
from dateutil.tz import gettz
from common import (common_const, line, utils, flex_message)
from validation.smart_register_param_check import SmartRegisterParamCheck
from common.channel_access_token import ChannelAccessToken
f... |
<reponame>misokg/Cornell-MOE
# -*- coding: utf-8 -*-
"""Tools to compute LCB and optimize the next best point(s) to sample using LCB through C++ calls.
This file contains a class to compute + derivatives and a functions to solve the q,p-KG optimization problem.
The :class:`moe.optimal_learning.python.cpp_wrappers.kno... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 18 13:39:00 2019
@author: isaaclera
"""
import simpy
import osmnx as ox
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import random
from matplotlib import colors
from shapely.ops import transform
from functools import par... |
<reponame>Impavidity/SearchEngine
#!/usr/bin/python
# -*- coding: utf-8 -*-
from nltk.tokenize import word_tokenize
import os
from nltk.corpus import stopwords
from nltk.stem.lancaster import LancasterStemmer
from nltk.stem import WordNetLemmatizer
from gensim import corpora, models, similarities
import loggi... |
#!/usr/bin/env python
# ephem_updater_sunrise.py
# Modules to import:
import datetime
import time
import ephem
import socket
import struct
import os
# CREATE RAM-DISK SUB-DIRECTORY IF DOES NOT EXIST
try:
os.makedirs ('/rex/data/ramdisk/sunrise')
except OSError:
if not os.path.isdir ('/rex/data/ramdisk/sunrise'... |
<gh_stars>1-10
import json
import attr
import falcon
import pytest
from ebl.bibliography.application.reference_schema import ReferenceSchema
from ebl.corpus.domain.manuscript import (
ManuscriptType,
Period,
PeriodModifier,
Provenance,
)
from ebl.fragmentarium.domain.museum_number import MuseumNumber
... |
<reponame>mglantz/insights-core<gh_stars>1-10
"""
SELinux
=======
Combiner for more complex handling of SELinux being disabled by any means
available to the users. It uses results of ``SEStatus``, ``Grub1Config``,
``Grub2Config``, ``Grub2EFIConfig`` and ``SelinuxConfig`` parsers.
It contains a dictionary ``problems``... |
# coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <<EMAIL>>"
# Third-party
import astropy.units as u
from astropy.coordinates.angles import rotation_matrix
import gary.coordinates as gc
import gary.integrate as gi
import gary.dynamics as gd
import numpy as np
from scipy.signal import... |
<filename>utils/eval_lex.py
#! /usr/bin/env python
# Copyright 2008, 2009, 2016, 2017, 2018 Google Inc. 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://w... |
# coding=utf-8
import logging
import numpy as np
from sklearn import metrics
from sklearn.cluster import KMeans
from sklearn.linear_model import LogisticRegression
from sklearn.multiclass import OneVsRestClassifier
from sklearn.preprocessing import LabelBinarizer
from sklearn.utils import shuffle
logging.basicConfig(... |
import matplotlib
matplotlib.use('Agg')
import pickle
import os
import pandas as pd
import matplotlib.pyplot as plt
# print(data)
import numpy as np
import os
from scipy import stats
from matplotlib.pyplot import figure
import glob
import numpy as np
import ipdb as pb
from pathlib import Path
#import explorE_delete a... |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 25 19:50:38 2022
@author: afadaei
"""
import numpy as np
import pandas as pd
import os
def Load_Valid_Stations(VALID_PATH):
Valid_Stations = np.load(VALID_PATH ,allow_pickle='TRUE').item()
return Valid_Stations
def update(valid, Station, data... |
<gh_stars>0
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import datetime
import discord
import os
import re
from typing import Callable, Dict, List, Set, Tuple
from cache import PssCache
import emojis
import pss_assert
import pss_core as core
import pss_crew as crew
import pss_dropship as dropship
import pss_entity ... |
# This file is part of JST.
#
# JST 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 the License, or
# (at your option) any later version.
#
# JST is distributed in the hope that it will be ... |
<reponame>ImadDabbura/ml-zoo
def multilabel_sample(y, size=1000, min_count=5, seed=None):
''' Takes a matrix of binary labels `y` and returns
the indices for a sample of size `size` if
`size` > 1 or `size` * len(y) if size =< 1.
The sample is guaranteed to have > `min_count` of
each ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.