text stringlengths 957 885k |
|---|
import random as r
import math as m
import numpy as np
import matplotlib.pyplot as plt
import os
#Make more elegant
base_path = "/Users/gregoryionovichpage/Desktop/" #change to your own path
filenameJ = "ts5p1J.txt" #absolute path to mathematica outputs for ts=5.1 !!
filenameH = "ts5p1H.txt"
filenameMsq = "Var5p1.tx... |
<filename>cupydo/manager.py
#!/usr/bin/env python
# -*- coding: latin-1; -*-
'''
Copyright 2018 University of Liège
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/lice... |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import os
import json
import shutil
from crds.bestrefs import BestrefsScript
from crds.tests import test_config
"""
Bestrefs has a number of command line parameters which make it operate in different modes.
... |
#!/usr/bin/env python3
import os
import sys
import argparse
import json
from lib.expression_tree import *
from patterns import *
from lib.util import *
class ExpressionManager(object):
"""
NOTE-1: the same column can appear in multiple expression nodes; this is
because it has multiple patterns; in this case, ch... |
# ===============================================================================
# NAME: InstanceTopologyHVisitor.py
#
# DESCRIPTION: A visitor responsible for the generation of component
# base class source code file.
#
# AUTHOR: reder
# EMAIL: <EMAIL>
# DATE CREATED : Feb 5, 2007
#
# Copyright 2013, C... |
<filename>pseudoc/parser.py<gh_stars>1-10
# PseudoC-IR - Simple Program Analysis/Compiler Intermediate Representation
#
# Copyright (c) 2020-2021 <NAME>
#
# The MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softwa... |
import copy
import logging
from itertools import product
from functools import wraps
import numpy as np
import matplotlib.pyplot as plt
# Own imports
from spike_swarm_sim.register import neuron_models, synapse_models, learning_rules
from spike_swarm_sim.utils import increase_time, merge_dicts, remove_duplicates... |
# Copyright (C) 2020 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This progr... |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# -*- coding: utf-8 -*-
# AUTHOR: RaNaN
import os
import pprint
import time
import traceback
from sys import exc_info
from threading import Thread
from types import MethodType
class PluginThread(Thread):
"""
abstract base class for thread types.
"""
# ------------------------------------------------... |
<reponame>dchabot/ophyd_hkl<filename>tests/test_device.py
import time
import logging
import unittest
from ophyd import (Device, Component, FormattedComponent)
from ophyd.signal import Signal
from ophyd.utils import ExceptionBundle
logger = logging.getLogger(__name__)
class FakeSignal(Signal):
def __init__(self,... |
# -*- coding: utf-8 -*-
import numpy as np
import os
import argparse
import time
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torchvision.transforms as trn
import torchvision.datasets as dset
import torch.nn.functional as F
from tqdm import tqdm
from models.allconv import AllConvNet
fr... |
import pandas as pd
import requests
import json
import elasticsearch.helpers
from elasticsearch import Elasticsearch
from elasticsearch.helpers import bulk
class UNSDapi():
# https://unstats.un.org/sdgapi/swagger/#!/GeoArea/V1SdgGeoAreaListGet. Consider this link for Indicators code and areacodes .
def __in... |
<filename>examples/simon_speck/speck.py
from __future__ import print_function
class SpeckCipher:
# valid cipher configurations stored:
# block_size:{key_size:number_rounds}
__valid_setups = {32: {64: 22},
48: {72: 22, 96: 23},
64: {96: 26, 128: 27},
... |
import numpy as np
def get_vectors(all_sentences, word_2_vec):
random_vec = np.mean(np.vstack(word_2_vec.values()).astype('float'), axis=0)
all_OOV_words = []
all_sentences_vecs = []
for sentence in all_sentences:
sentence_vecs = []
for word in sentence:
if word not in ... |
import numpy as np
from collections import Counter
from railrl.exploration_strategies.count_based.compute_obs_mean_std import compute_obs_mean_std
from railrl.misc.np_util import bin2int, softmax
class CountExploration:
def __init__(self,
env,
hash_dim=16,
observ... |
<reponame>jpfxgood/dashboard
# Copyright 2017 <NAME> unicode curses based graphics package
""" module that implements a graphics package using block graphics on curses window """
import locale
locale.setlocale(locale.LC_ALL,"")
import curses
import curses.ascii
import sys
import os
import math
def angle_point(x0,y0,a,... |
import os
import numpy as np
import matplotlib.pyplot as plt
from . import helper_generic as hlp
from . import helper_site_response as sr
from . import helper_signal_processing as sig
from PySeismoSoil.class_frequency_spectrum import Frequency_Spectrum as FS
from PySeismoSoil.class_Vs_profile import Vs_Profile
class... |
'''
compare MC and TD using the blackjack exmaple
state space: Tuple(Discrete(32), Discrete(11), Discrete(2))
player's current sum {0, ... , 31}
dealer's face up {1, ... , 10}, aces can either count as 11 or 1
whether the player has usebale ace {0, 1}
action space: Discrete(2)
stick = 0, hit = 1
Deta... |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from restclients_core import models
class Event(models.Model):
DRAFT_STATE = "0"
TENTATIVE_STATE = "1"
CONFIRMED_STATE = "2"
SEALED_STATE = "3"
DENIED_STATE = "4"
CANCELLED_STATE = "99"
STATE_CHOICES =... |
<reponame>piotrwinkler/breast_density_classifier<gh_stars>0
import argparse
import glob
import os
import numpy as np
import torch
from sklearn.metrics import accuracy_score
import models_torch as models
import utils
EXPERIMENT_DATA_DIR = "/tmp/mgr"
def inference(parameters, verbose=True) -> int:
# resolve de... |
import click
import configparser
import glob
import logging
import os
import sched
import MySQLdb
from jog import JogFormatter
from prometheus_client import start_http_server
from prometheus_client.core import REGISTRY
from .metrics import gauge_generator
from .parser import parse_response
from .scheduler import sche... |
<reponame>posm/posm-opendronemap-api
# coding=utf-8
from datetime import datetime
import json
import shutil
from StringIO import StringIO
import subprocess32 as subprocess
import os
import uuid
from cachetools.func import lru_cache
from celery import Celery
from flask import Flask, redirect, request, send_from_direct... |
<filename>Twitter_Crawler/developer_keys_tokens.py
"""
@author: Team18(member details are as follows)
Name(Firstname Surname) | Username | StudentID | City
---------------------------------------------------------------------
<NAME> | chuangw | 791793 | Melbourne
<NAME> | honglongz ... |
from convex_adversarial.dual_network import robust_loss, RobustBounds
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
import numpy as np
import time
import copy
import os
DEBUG = False
## standard training
def train_baseline(loader, model, opt, epoch, log1, log2, ve... |
<filename>models/net_wrapper.py<gh_stars>1-10
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
from helpers.utils import warpgrid, get_ctx
from .synthesizer_net import InnerProd, Bias, Transformer
from .audio_net import Unet
from .vision_net import ResnetFC, ResnetDilated
from .cri... |
# coding: utf-8
"""
Cloudsmith API
The API to the Cloudsmith Service
OpenAPI spec version: v1
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import sys
import os
import re
# python 2 and python 3 compatibility libra... |
<filename>9_mh_server/__init__.py
""" MH Server plugin entry-point. See the load() and unload() functions.
"""
import gui3d, gui
import mh
from core import G
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from server import ServerThread
########################################################################... |
<gh_stars>10-100
#!/usr/bin/env python3
# Handbrake processing of dvd/bluray
import sys
import os
import logging
import subprocess
import re
import shlex
# Added for sleep check/ transcode limits
import time # noqa: F401
import datetime # noqa: F401
import psutil # noqa: F401
from arm.ripper import utils
from arm.... |
#!/usr/bin/env python
# Copyright (c) 2018-2019 Intel Labs.
# authors: <NAME> (<EMAIL>), <NAME> (<EMAIL>)
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Module to manipulate the routes, by making then more or less dense (Up to a certain parame... |
<reponame>LiyuanLucasLiu/LD-Net
from __future__ import print_function
import datetime
import time
import torch
import torch.nn as nn
import torch.optim as optim
import codecs
import pickle
import math
from model_word_ada.LM import LM
from model_word_ada.basic import BasicRNN
from model_word_ada.ldnet import LDRNN
from... |
<gh_stars>1-10
# coding=utf-8
# METEOR 算法 + 转述不变词 + 字符重叠
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import copy
import os
from collections import namedtuple
import argparse
import numpy as np
import codecs
import re
from nltk.corpus import wordnet as w... |
<reponame>CharLee674/rvisa_lightlab
from . import VISAInstrumentDriver
from lightlab.equipment.abstract_drivers import Configurable
from lightlab.laboratory.instruments import Keithley
import numpy as np
import time
from lightlab import logger
class Keithley_2400_SM(VISAInstrumentDriver, Configurable):
''' A Kei... |
from __future__ import unicode_literals
import copy
from dateutil.relativedelta import relativedelta
import six
from dash.utils import get_month_range
from django import forms
from django.forms.forms import DeclarativeFieldsMetaclass
from django.utils import timezone
from django.utils.translation import ugettext_l... |
"""Sun2 Binary Sensor."""
from datetime import timedelta
import logging
import voluptuous as vol
try:
from homeassistant.components.binary_sensor import BinarySensorEntity
except ImportError:
from homeassistant.components.binary_sensor import BinarySensorDevice
BinarySensorEntity = BinarySensorDevice
from... |
# Super7SegStockTicker.py
#
# Demo of Maniacal Labs Super 7 Seg Display
#
# Uses Alpha Vantage API to obtain current prices for
# stock and cryptocurrencies, then displays the prices
# to the Super7Seg display connected to the specified COM port
#
# Alpha Vantage API documentation: https://www.alphavantage.co/documen... |
<reponame>revnav/sandbox
# coding: utf-8
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licens... |
import datetime
import logging
import pytz
import os
import random
import re
import time
from pathlib import Path
import logzero
import pandas as pd
import torch
import torch.nn as nn
import numpy as np
from sklearn.metrics import roc_auc_score
from torch.utils.data import DataLoader
from logzero import logger
from ... |
<gh_stars>100-1000
from django.conf import settings
from django.conf.urls import url
from django.contrib import admin
from django.http import Http404, HttpResponseForbidden
from django.urls import include, path
from django.urls.converters import register_converter
from django.views.defaults import page_not_found, permi... |
"""Tests for working with the rules database."""
import base64
import sqlite3
import tempfile
from unittest.mock import Mock, create_autospec, patch
import pytest
import urllib3
from pywemo.exceptions import HTTPException, RulesDbQueryError
from pywemo.ouimeaux_device.api import rules_db
from pywemo.ouimeaux_device.... |
<gh_stars>10-100
# # Copyright (c) ShanghaiTech PLUS Lab. All Rights Reserved.
# import bisect
# import copy
import logging
# import torch.utils.data
from plusseg.utils.comm import get_world_size
from plusseg.utils.imports import import_file
# from . import datasets as D
from . import samplers
# from .transforms imp... |
#PYTHON MODULE: ISSUE
import mysql.connector
from mysql.connector import errorcode
from datetime import date
from mysql.connector import (connection)
import os
def clrscreen():
print('\n' * 5)
def SearchIssuedBooks():
try:
os.system('cls')
cnx = mysql.connector.connect(user='r... |
# Author: <NAME>, <NAME>, <NAME>
#
# License: BSD 3 clause
"""
Multi-class / multi-label utility function
==========================================
"""
from collections.abc import Sequence
from itertools import chain
from scipy.sparse import issparse
from scipy.sparse.base import spmatrix
from scipy.spa... |
#!/usr/bin/env python3
import signal
import gpiozero
from time import sleep
from subprocess import run, PIPE
from urllib.request import urlopen
from urllib.error import URLError
from json import load
from json.decoder import JSONDecodeError
from display import Display
STOPPED = 0
STARTING = 1
INITIALISING = 2
RUNNI... |
<filename>TweetParser.py<gh_stars>0
import numpy as np
from sklearn.pipeline import Pipeline
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.svm import LinearSVC
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.multiclass import OneVsRestClassifier
import sys
import jso... |
<reponame>fno2010/rucio
# -*- coding: utf-8 -*-
# Copyright CERN since 2015
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
import datetime
import random
from flask import request, render_template, current_app, url_for
from flask_login import login_user, current_user, logout_user, login_required
from sqlalchemy import text
from werkzeug.security import check_password_hash, generate_password_hash
from werkzeug.utils import redirect
from mo... |
"""root-editorconfig-required hook tests."""
import contextlib
import io
import os
import tempfile
import pytest
from hooks.root_editorconfig_required import check_root_editorconfig
@pytest.mark.parametrize(
"quiet",
(True, False),
ids=("quiet=True", "quiet=False"),
)
@pytest.mark.parametrize(
"cre... |
"""
New schemas for behavioral training criteria
<NAME>, CSHL, 2019
"""
import pandas as pd
import numpy as np
import sys, os, time
import matplotlib.pyplot as plt
import datajoint as dj
from IPython import embed as shell # for debugging
import datetime
# import wrappers etc
from ibl_pipeline import reference, subjec... |
# encoding: utf-8
"""
File: conftest.py
Author: <NAME>
Email: <EMAIL>
Github: https://github.com/mdrohmann
Description: pytest configuration file with standard tests for server modules.
"""
import re
import copy
import pytest
import random
from twisted.application import service
from twisted.python.reflect import na... |
from math import ceil
import pandas as pd
import numpy as np
import torch
import torch.utils.data as tud
import os
import sys
sys.path.append('..')
from utils import config as cfg
class HarmonixDataset(tud.Dataset):
'''Harmonix dataset object.
To follow the idea of the original paper, each chunk is aligned w... |
import copy
import distributions
import kmeans
import numpy as np
import matplotlib.pyplot as plt
import sys
from matplotlib.mlab import bivariate_normal
from numpy import newaxis as nax
from numpy.linalg import det, inv
from IPython.core.debugger import Tracer
def log_likelihood(X, obs_distr, pi):
N = X.shape[0]... |
<reponame>ZeitOnline/zeit.content.modules
from zeit.cms.browser.widget import RestructuredTextDisplayWidget
from zope.cachedescriptors.property import Lazy as cachedproperty
import UserDict
import grokcore.component as grok
import lxml.objectify
import zeit.cms.content.property
import zeit.cms.content.reference
import ... |
from __future__ import unicode_literals
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from django.urls import reverse
from django.utils.encoding import python_2_unicode_compatible
from taggit.managers import TaggableManager
from extras.models import CustomFieldModel
from ... |
<reponame>mchestr/pycbc<gh_stars>0
import json
import pytest
import requests
from pycbc.client import WebBookingClient
@pytest.fixture
def client(mock_responses):
return WebBookingClient()
def test_service_search(client, service_search_stub, service_search_json):
data = client.services_search()
assert... |
import sys
import os
current_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.append(os.path.join(current_dir, ".."))
import numpy as np
from lib import generate
def test__crossover():
population_01 = [1, 2, 3]
population_02 = [3, 2, 1]
crv_point = 1
population_01_left = population_01[:cr... |
#!/usr/bin/env python
from __future__ import with_statement
import numpy
import HTSeq
import re
import itertools
try:
from six.moves import xrange
except ImportError:
pass
def add_dict(error, dic):
if error not in dic:
last_element = len(dic)
for i in xrange(last_element, error + 1):
... |
"""ping.py
NXOS parsers for the following show commands:
* ping {addr}
* ping {addr} source {source} count {count}
* ping {addr} vrf {vrf} count {count} size {size}
"""
# Python
import re
# Metaparser
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import (Any,
Opti... |
<gh_stars>0
# coding: utf-8 # noqa: E902
#!/usr/bin/python3 # noqa: E265
"""
Manage efriends front end.
Module: views.py
Class: Views/0 inherits object
Author: PQ <pq_rfw @ pm.me>
"""
import tkinter as tk
from dataclasses import dataclass
from os import path
from pprint import pprint as pp # noqa: F4... |
<reponame>bastianwegge/pants<filename>src/python/pants/backend/go/util_rules/embedcfg.py
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import json
from dataclasses import dataclass
from typing impor... |
<reponame>atssada/deeplearning4j
import math
from matplotlib.pyplot import hist, title, subplot, scatter, plot
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
import seaborn # improves matplotlib look and feel
import sys
import time
'''
Optimization Methods Visualalization
Graph tools to help... |
<gh_stars>0
from .widgets.form import *
from .psql.Database_builder import *
import re
def check_invalid_letters(text, mode):
name_checked = re.match("([_a-z0-9])+", text)
if not name_checked or len(name_checked.group()) < len(text):
messagebox.showinfo('Wrong letters', 'Your ' + mode + ''' name contains invalid... |
# Commented out IPython magic to ensure Python compatibility.
# %tensorflow_version 2.x
import tensorflow as tf
print("Tensorflow version " + tf.__version__)
try:
tpu = tf.distribute.cluster_resolver.TPUClusterResolver() # TPU detection
print('Running on TPU ', tpu.cluster_spec().as_dict()['worker'])
except Value... |
<gh_stars>0
import time
import boto3
import requests
import gym
import numpy as np
from time import gmtime,strftime
from gym.spaces import Discrete, Box
cloudwatch_cli = boto3.client('cloudwatch',region_name='us-west-2')
class GameServerEnv(gym.Env):
def __init__(self, env_config={}):
print ("in __init_... |
"""
Algorithm:
Also called as Partition Exchange sort.
Developed by <NAME> in 1959 and published in 1961
When implemented well it can be about 2 or 3 times faster than the its main competitor merge sort and heap sort.
Quick Sort:
1. Comparison Sort
2. In_place sort (it may required more memory)
3. Unstable sort
4. Rec... |
<filename>massl_pretrain.py
# 2022 Tran_Nhiem, <NAME> (SSL Team)
# Pre-training Partially Inherence from 2021 solo-learn team development.
# 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 wit... |
#!/usr/bin/env python
# --------------------------------------------------------
# 3D object detection train file
#
# -------------------------------------------------------
import pdb, traceback
import argparse
import math
import h5py
import numpy as np
import tensorflow as tf
import socket
import time
import os
impo... |
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.python.ops import array_ops
from artifice.log import logger # noqa
from artifice import utils
from artifice import sparse
from artifice import conv_utils
from artifice import img, vis
NEG_INF = np.finfo(np.float32).min
class P... |
"""
REST filters for Rate APIs
"""
from django.db import models
from django.db.models import OuterRef, Subquery, QuerySet
from django_filters import rest_framework as filters
from .models import Rate
class RateFilter(filters.FilterSet):
"""
Rate object filter
"""
user = filters.BooleanFilter(
... |
# -*- coding: utf-8 -*- #
# Copyright 2019 Google LLC. 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 requir... |
import pyarrow
import rpy2.rinterface as rinterface
import rpy2.robjects as robjects
import rpy2.robjects.conversion as conversion
import rpy2.robjects.packages as packages
import typing
import warnings
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import rpy2.robjects
rarrow = packages.importr('arrow')
TARG... |
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... |
# -*- coding: utf-8 -*-
"""
<NAME>, <NAME>, <NAME>
Sandia National Laboratories
February 26, 2020
Sudoku Board solvers.
- logical puzzle solvers, which simply apply logical operators
- heuristic cell selectors
"""
import random
import operators
import config_data
import board_update_descriptions
import board
... |
<filename>deprecated/TNSAgent/tns/testneighbormodel.py
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
# Copyright (c) 2017, Battelle Memorial Institute
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided t... |
import argparse
import json
from torch.utils.data import DataLoader
from models.doepd_net import *
from utils.datasets import *
from utils.utils import *
from utils.parse_config import *
def test(
data,
weights=None,
batch_size=16,
img_size=416,
conf_thres=0.001,
... |
# coding: utf-8
# Copyright 2009-2014 <NAME>
# License: BSD (see file COPYING for details)
"""This fixture adds all known countries of the world to your
database.
Unlike the official `ISO 3133 <http://www.iso.org/iso/country_codes>`_
it features more languages, and it creates also codes for countries
that no longer e... |
<filename>scrapy/downloadermiddlewares/robotstxt.py
"""
This is a middleware to respect robots.txt policies. To activate it you must
enable this middleware and enable the ROBOTSTXT_OBEY setting.
"""
import logging
import sys
import re
from twisted.internet.defer import Deferred, maybeDeferred
from scrapy.exceptions ... |
<reponame>jakekrafczyk/restauraunt_ranker<filename>scrape_restauraunts.py
from selenium import webdriver
from bs4 import BeautifulSoup
import requests
import pandas as pd
import re
import random
import time
# optional first step, define the driver, ie chrome or Brave
driver = webdriver.Chrome('./chromedriver') # <... |
<reponame>siscia/Facepager
import json
import os,sys,platform
import lxml
import lxml.html
import StringIO
def getResourceFolder():
if getattr(sys, 'frozen', False) and (platform.system() != 'Darwin'):
folder = os.path.dirname(sys.executable)
elif getattr(sys, 'frozen', False) and (platform.system() ... |
<reponame>zhaoshiyu/DNLP
# -*- coding: utf-8 -*-
import os
import collections
import numpy as np
import pickle
class Transfer(object):
def __init__(self, data_dir, seq_length, label_data=None, vocab_corpus_file=None):
self.seq_length = seq_length
self.vocab_labels_file = os.path.join(data_dir, '... |
#!/usr/bin/python
#
# Copyright 2016 Google 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 ag... |
<reponame>rcsb/py-rcsb_utils_io
##
# File: IoUtil.py
#
# Updates:
# 2-Feb-2018 jdw add default return values for deserialize ops
# 3-Feb-2018 jdw pickle -> pickle - make default return {} if not specified
# 14-Feb-2018 jdw add fix for the new location of XmlToObj module
# 20-May-2018 jdw move to this module
... |
<filename>2_term/made_2021_computer_vision/homeworks/02/inference_utils.py<gh_stars>1-10
import logging
import cv2
import numpy as np
import torch
def get_logger(filename: str) -> logging.Logger:
logger = logging.getLogger()
logger.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s %(messag... |
import unittest
from pathlib import Path
from unittest.mock import patch
from typer.testing import CliRunner
from adk.exceptions import ApplicationNotFound, ExperimentDirectoryNotValid
from adk.command_list import app, applications_app, experiments_app, retrieve_application_name_and_path, \
... |
<gh_stars>1-10
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distri... |
<filename>texbox/cli_tables.py
import argparse
import secrets
from functools import partial
from pathlib import Path
import pandas as pd
from .constants import (
ABBREVIATION_TEMPLATE,
BEGIN_LANDSCAPE_MACRO,
BEGIN_TABLE_MACRO,
BEGIN_TABLE_PARAMS_MACRO,
BREAK_COLUMN_HEADING_TEMPLATE,
CITE_MACRO... |
<filename>games/necrowar/tile.py
# Tile: A Tile in the game that makes up the 2D map grid.
# DO NOT MODIFY THIS FILE
# Never try to directly create an instance of this class, or modify its member variables.
# Instead, you should only be reading its variables and calling its functions.
from typing import List, Optiona... |
<filename>src/utility.py
import pickle
from typing import Tuple
from src.model import Piece, Board, State
from src.constant import ShapeConstant, GameConstant
def dump(obj, path):
"""
[DESC]
Function to dump Object
[PARAMS]
obj: Object -> objects you want dump
"""
pickle.dump(obj... |
#pip install pysqlite3
# создаем базу
class Sql_modul():
def __init__(self, db_name, config_db):
self.db_name = db_name
self.config_db = config_db
def create_db(self):
import sqlite3 as lite
import sys
connect = None
try:
connect = lite.connect(sel... |
"""
Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
"""
C13815920 - Appropriate component dependencies are automatically added to node entities
C13767842 - All Gra... |
<filename>google/ads/google_ads/v2/proto/resources/ad_group_label_pb2.py
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads_v2/proto/resources/ad_group_label.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from g... |
import torch
import torch.nn as nn
from torch.nn.utils import weight_norm
from pytorch_sound.models import register_model, register_model_architecture
from typing import List
#
# Make blocks
#
def weights_init(m):
classname = m.__class__.__name__
if classname.find("Conv") != -1:
m.weight.data.normal_(... |
# encoding: utf-8
from __future__ import unicode_literals
import copy
import unittest
from datetime import datetime
from io import BytesIO
from threading import Thread
from mock import Mock
import pdef
from pdef.rpc import *
from pdef.tests.messages.protocol import *
from pdef.tests.interfaces.protocol import *
c... |
<gh_stars>1-10
from scipy.integrate import RK45, BDF
import numpy
class Block:
def __init__(self, name = "Block"):
self.dimension = {"A": 0, "U": 0, "O": 0}
self.name = name
self.inputs = []
self.outputs = []
def state(self, t, y, u):
raise Exception("state method shoul... |
<filename>recsys19_hybridsvd/hybrids.py
import scipy as sp
import numpy as np
from scipy.sparse.linalg import LinearOperator
from sksparse import __version__ as sk_sp_version
from sksparse.cholmod import cholesky as cholesky_decomp_sparse
assert sk_sp_version >= '0.4.3'
SPARSE_MODE = True
from polara import SVDModel
... |
<gh_stars>0
# -*- coding=utf-8 -*-
import metadata_parser
try:
from urllib.parse import urlparse
# from urllib.parse import urlencode
except ImportError:
from urlparse import urlparse
# from urllib import urlencode
import unittest
import six
if False:
import logging
l = logging.getLogge... |
import feedparser
import numpy
import time
import os
import sys
from git import Repo
from datetime import datetime
shows_list = []
old_shows_list = []
h2 = "## "
h3 = "### "
dblel = "\n\n"
hoz_sep = "|"
vert_head = "|Show|Total Length|Number of Shows|Average Length|Average Gap|Standard Deviation|Shows Per Year|Monthl... |
<reponame>riju-pal/QCoDeS_riju<filename>qcodes/instrument_drivers/Keysight/N9030B.py
import numpy as np
from typing import Any, Tuple, Dict, Union
from qcodes import (
VisaInstrument, InstrumentChannel, Parameter, ParameterWithSetpoints
)
from qcodes.instrument.parameter import ParamRawDataType
from qcodes.utils.v... |
# -*- coding: utf-8 -*-
from configparser import ConfigParser
from flask import Flask, jsonify, request
import logging.handlers
import logging
from bin.ram import RAM
from bin.cpu import CPU
from bin.network import Network
from bin.load_avg import LoadAvg
from bin.boot_time import BootTime
from bin.disk import Disk
... |
"""TEST ENVIRONMENT UTILITIES"""
import collections
import json
import tempfile
from pathlib import Path
from mldock.platform_helpers import utils
from mldock.platform_helpers.mldock.configuration.environment.base import (
BaseEnvironment,
)
class TestBaseEnvironment:
"""Collection of tests to test base envi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.