text stringlengths 957 885k |
|---|
<filename>csmserver/smu_utils.py
# =============================================================================
# Copyright (c) 2016, Cisco Systems, Inc
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condition... |
<gh_stars>1-10
"""
Toy data tf records cats vs dogs
"""
import tensorflow as tf
import imageio
import numpy as np
import sys
import glob
import param_gedi as param
import os
import cv2
import matplotlib.pyplot as plt
class Record:
def __init__(self, images_dir_A, images_dir_B, tfrecord_dir, split):
cats... |
<filename>gitissues/cli.py
import click
import configparser
from .utils import authenticate, get_config_path, get_token, get_repo_name
from tabulate import tabulate
from .classes import Github, GithubIssue
from .colour import COLOR
@click.group()
def cli():
"""
A command line interface to manage all your git ... |
import shutil
import tempfile
import os
import os.path
from django.core.management.base import BaseCommand
from django.core.files.storage import default_storage
from django.utils import timezone
from events.models import Expense
from utils import gdrive
# https://drive.google.com/drive/u/0/folders/1Kvfmz1eTNd9y2ZAqo... |
import typing as t
from .._internal import _encode_idna
from ..exceptions import SecurityError
from ..urls import uri_to_iri, url_quote
def host_is_trusted(hostname: str, trusted_list: t.Iterable[str]) -> bool:
"""Check if a host matches a list of trusted names.
:param hostname: The name to check.
:para... |
<reponame>VietDunghacker/VarifocalNet
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule
from ..builder import NECKS
@NECKS.register_module()
class SSDNeck(nn.Module):
"""Extra layers of SSD backbone to generate multi-scale feature maps.
Args:
in_channels (Sequence[... |
<reponame>dymaxionlabs/satlomas-back
import os
import shutil
from django.conf import settings
from eo_sensors.utils import run_otb_command
RESULTS_DIR = os.path.join(settings.BASE_DIR, "data", "images", "results")
RESULTS_SRC = os.path.join(RESULTS_DIR, "src")
RESULTS_FEAT = os.path.join(RESULTS_DIR, "feats")
MODEL_P... |
import smtplib
import os,sys
import time,random
import threading
import argparse
H = '\033[95m'
B = '\033[94m'
G = '\033[92m'
W = '\033[93m'
F = '\033[91m'
E = '\033[0m'
U = '\033[4m'
O = '\033[33m'
serv = None
port = 587
os.chdir('modules/')
parser = argparse.ArgumentParser(description="Framework Hunner")
parser.ad... |
<reponame>tomvothecoder/pcmdi_metrics<filename>pcmdi_metrics/enso/scripts_pcmdi/parallel_driver.py
#!/usr/bin/env python
"""
Usage example:
1. First realization per model
./parallel_driver.py -p my_Param_ENSO.py --mip cmip6 --modnames all --realization r1i1p1f1 --metricsCollection ENSO_perf
2. All realizations of indi... |
<filename>Gds/test/fprime_gds/common/testing_fw/api_unit_test.py
import math
import os
import sys
import threading
import time
import unittest
# these imports are needed to generate data objects.
from fprime.common.models.serialize.numerical_types import I32Type, U32Type
from fprime.common.models.serialize.time_type i... |
import logging
from datetime import datetime
from pathlib import Path
from bs4 import BeautifulSoup
from .. import utils
from ..cache import Cache
__authors__ = [
"zstumgoren",
"Dilcia19",
"stucka",
]
__tags__ = ["html"]
__source__ = {
"name": "Connecticut Department of Labor",
"url": "https://ww... |
#! /usr/bin/python3
import random
import datetime
import time
import fcntl
from IP.IPSocket import *
from tcp.TCPPacket import *
import threading
class TCPSocket:
def __init__(self):
self.socket = None
self.connected = False
self.src = (get_ip(), random.randrange(0, 1 << 16))
self... |
<filename>examples/create_statepoint_file_with_meshes_openmc_dagmc.py<gh_stars>0
# This minimal example makes a 3D volume and exports the shape to a stp file
# A surrounding volume called a graveyard is needed for neutronics simulations
import openmc
import openmc_dagmc_wrapper as odw
import openmc_plasma_source as op... |
from __future__ import annotations
import re
import inspect
import typing as t
from abc import ABC
import discord
from discord.ext import commands
import asyncio
import blurple.ui as ui
class Reply(ABC):
""" An abstract class for getting replies, to be extended.
If you are trying to get a reply from the... |
"""
Magic commands.
"""
from __future__ import print_function
from IPython.core.magic import Magics, magics_class, line_magic
@magics_class
class MyMagics(Magics):
@line_magic
def loadnpz(self, params=''):
"""Load a npz file into user namespace.
%loadnpz <filename.npz>
"""
i... |
<gh_stars>1-10
"""Make plots of the results of Dakotathon experiments."""
import os
import numpy as np
from scipy.interpolate import griddata
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
TRANGE = [10., 20.]
PRANGE = [ 1., 2.]
CSRANGE = [10., 45.0]
plt.rcParams['mathtext.default'] = 'regu... |
from __future__ import with_statement
from contextlib import contextmanager
import datetime
import faulthandler
import os
import re
import signal
import subprocess
import sys
import tempfile
import unittest
from textwrap import dedent
try:
import threading
HAVE_THREADS = True
except ImportError:
HAVE_THREA... |
# -*- coding: utf-8 -*-
from tests import msg
from uamobile import *
from uamobile.nonmobile import NonMobileUserAgent as NonMobile
def test_detect_fast():
assert detect_fast('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1') == 'nonmobile'
def test_empty_useragent():
... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Viterbi Equalization
# Generated: Sun Aug 4 08:48:02 2019
##################################################
if __name__ == '__main__':
import ctypes
import sys
if sys.p... |
<filename>exo_changelog/operations.py
from django.db.migrations.operations.base import Operation
from django.db import DEFAULT_DB_ALIAS, connections
class RunSQL(Operation):
"""
Runs some raw SQL. A reverse SQL statement may be provided.
Also accepts a list of operations that represent the state change e... |
import selenium
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from webdriver_manager.chrome import ChromeDriverManager
ratelimited=False
def login(username,password):
global browser
global ratelimited
browser = webdriver.Chrome(ChromeDriverManager().... |
"""
Written by <NAME> - 2017
models training on ImageNet
"""
import argparse
import os.path
import time
import tensorflow as tf
import tensorflow.contrib.eager as tfe
from models.alexnet import AlexNet
from data import ImageNetDataset
from config import Configuration
import utils as ut
tfe.enable_eager_execution()
c... |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( arr , n ) :
found = False
for i in range ( n - 1 ) :
s = set ( )
for j in range ( i + 1 , n... |
# Written by <NAME> <<EMAIL>>
#
# Version 1.0. Dec 4, 1998.
# Version 1.3 Nov 14, 2020. Made work with Python 3.*
from gcd_tools import *
# The following two classes are used to store the vertices of an edge
# path. The first is denoted <p/q> in the paper. I will try to
# insure that q is always > 0, and the g... |
"""Base Tests."""
from pathlib import Path
from unittest import mock
def test_imports():
import muffin
assert muffin.Request
assert muffin.Response
assert muffin.ResponseError
assert muffin.ResponseFile
assert muffin.ResponseHTML
assert muffin.ResponseJSON
assert muffin.ResponseRedir... |
#!/usr/bin/env python3
# coding: utf-8
"""
RedEdge Metadata Management Utilities
Copyright 2017 MicaSense, Inc.
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 with... |
<reponame>skunkwile/UW-Graphics<gh_stars>1-10
import display
from engine import *
from math import pi
import numpy as np
size = width, height = (1280 // 2, 960 // 2)
scene = Scene()
# mesh = Mesh([
# Vec3(-10, 0, 0),
# Vec3(0, 0, -5),
# Vec3(3, 0, 7),
# Vec3(4, 0, 1),
# ], [(0, 1, 2)])
# mesh = Mes... |
<filename>scripts/merge_csv_files.py
import argparse
import os
import glob
import time
import csv
from pathlib import Path
from collections import Counter
from tqdm.auto import tqdm
import pandas as pd
def main(csv_directory, out_directory):
csv_files = glob.glob(os.path.join(csv_directory, '*.csv'))
df_l... |
import numpy as np
import matplotlib.pyplot as plt
import gpflow
def dbtime(X):
x1 = X[:,0]
x2 = X[:,1]
return (x1/2-2)*(x1/2-2)+2 + 2*np.sin(x2)+2*np.sin(x2*2)+5+np.sin(x2/2)+2*np.sin(x2)+2*np.sin(x2*2)+5+np.sin(x2/2)
class Optimize():
def __init__(self, func, start_point, nb_param ):
... |
"""
colorLib.builder: Build COLR/CPAL tables from scratch
"""
import collections
import copy
import enum
from functools import partial
from typing import (
Any,
Dict,
Generator,
Iterable,
List,
Mapping,
Optional,
Sequence,
Tuple,
Type,
TypeVar,
Union,
)
from fontTools.mi... |
#!/usr/bin/env python3
"""
Main Script
"""
import argparse
import base64
import json
import hashlib
import os
import subprocess
import time
import rpyc
# It gets imported by base64 with the packing script
PACKED = "{{ script }}"
amd64_registers = [
'rax', 'rcx', 'rdx', 'rbx',
'rsi', 'rdi', 'rsp', 'rbp',
... |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
# 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... |
<filename>pKa/pKa_mutscan.py
#!/usr/bin/env python
#
# pKa - various programs and scripts for pKa value analysis, calculation and redesign
# Copyright (C) 2010 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fre... |
# vim: set encoding=utf-8
# Copyright (c) 2016 Intel 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 require... |
"""
Module for chess table items (board ...)
"""
import re
from chess.set import box
class Board:
"""Chess board composed of rank file positions, and pieces at play.
"""
def __init__(self):
self._positions = dict()
for file in range(ord('a'), ord('h') + 1):
for rank in range(1... |
<reponame>brezillon/opensplice<filename>testsuite/tests/stax/python/host.py
import os
import socket
from process import Process
from ospl import OSPL
from test_errors import TestError
#===============================================================================
class Host:
"""A machine and i... |
<reponame>Dive576/DIVE
from ._components.dive_manager import DIVEManager as _DIVEManager
import importlib as _importlib
import vispy as _vp
qt = _vp.app.use_app().backend_name
try:
_qtcore = _importlib.import_module('{}.QtCore'.format(qt))
_qtwidgets = _importlib.import_module('{}.QtWidgets'.format(qt))
... |
<gh_stars>1-10
from tests.unit.dataactcore.factories.staging import ObjectClassProgramActivityFactory
from tests.unit.dataactcore.factories.job import SubmissionFactory
from dataactcore.models.jobModels import PublishStatus
from dataactcore.models.lookups import PUBLISH_STATUS, PUBLISH_STATUS_DICT
from tests.unit.dataa... |
import argparse
def get_args():
parser = argparse.ArgumentParser(description='Continual')
# Arguments
parser.add_argument('--seed', type=int, default=0, help='(default=%(default)d)')
parser.add_argument('--experiment', default='', type=str, required=True,
choices=['mnist2',
... |
# -*- coding: utf-8 -*-
import pygame
from pygame.locals import *
from random import randint
# Initialize Pygame
pygame.init()
pygame.font.init()
fontLG = pygame.font.SysFont('Arial', 30)
fontSM = pygame.font.SysFont('Arial', 16)
clock = pygame.time.Clock()
# Globals
WHITE = (255, 255, 255)
ISDOWN = pygame.key.get_pr... |
<gh_stars>0
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
from google.appengine.ext.webapp import template
from google.appengine.api import mail
# Todo defines the data model for the ... |
import unittest
import os
from m2translate import *
__author__ = '<NAME> (<EMAIL>)'
# clear all translate files for json store connector
json_path = os.path.join('json_store')
def count_json_locales(path):
locales_cnt = 0
for f in os.listdir(path):
file_path = os.path.join(path, f)
if os.p... |
<reponame>sahyagiri/osm_roads
import h5py
import json
import ast
from geojson import LineString, Point, Feature
from turfpy.measurement import point_to_line_distance
import geohash
import osmium as osm
class OsmRoads(osm.SimpleHandler):
def __init__(self,hdf5_file_name:str,openstreetmap_pbf_file_name=None):
... |
import os
import toml
from typing import List
from datetime import datetime
from utils import persistence
class GlobalConfig:
"""
Main Config.
"""
def __init__(self, path: str) -> None:
"""
Config object constructor.
:param path: Path to scenario configuration TOML file
... |
"""
/*
* Copyright (c) 2021, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
This script is used to identify and separate summaries of the following kind from scrap... |
# coding:utf-8
# 推荐算法脚本,包括基于用户的协同过滤
import math
import operator
import time
from django.core.cache import cache
import MySQLdb
begin = time.time()
from django.db import connection
def get_default_train_dict():
"""
得到用于训练的user-item模型
:return:
"""
train_dict = dict()
cursor = connection.cursor()
... |
# -*- coding: utf-8 -*-
"""
Tagulous test: Tag models
Modules tested:
tagulous.models.models.BaseTagModel
tagulous.models.models.TagModel
tagulous.models.models.TagModelManager
tagulous.models.models.TagModelQuerySet
"""
import unittest
from django.db import IntegrityError
from django.test import Test... |
<reponame>VOlni/undictify
"""
undictify - Type-checked function calls at runtime
"""
import inspect
import sys
from functools import wraps
from typing import Any, Callable, Dict, List, Type, TypeVar, Union
VER_3_7_AND_UP = sys.version_info[:3] >= (3, 7, 0) # PEP 560
# pylint: disable=no-name-in-module
if VER_3_7_AN... |
import torchvision.models
from .resnext101_32x4d import resnext101_32x4d
from .inception_v4 import inception_v4
from .inception_resnet_v2 import inception_resnet_v2
from .wrn50_2 import wrn50_2
from .my_densenet import densenet161, densenet121, densenet169, densenet201
from .my_resnet import resnet18, resnet34, resnet5... |
#!/bin/env python
"""
Created on Thurs Mar 3 20:01:31 2016
@author: francinecamacho
"""
from Bio import SeqIO
import pandas as pd
import os
"""This script will take the tabular file as input to detect BGCs based on percent identity (95%)
and query coverage (95%) criteria to find the BGC taxa producer based on ref_... |
import glob as gl
from astropy.io import ascii
from astropy.table import Table
from astropy.io import fits
from astropy.time import Time
import os
import numpy as np
import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
import pandas as pd
# plotting the spectra, must be corrected :
def create_plo... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 2 12:30:22 2021
@author: Admin
"""
import torch
import torch.nn as nn
from torchsummary import summary
class InceptionNet(nn.Module):
def __init__(self, in_channels = 3, num_classes = 1000):
super(InceptionNet, self).__init__()
self.... |
import mock
import os
import pytest
from vulnpy.trigger import ssrf
from tests.trigger.base_test import BaseTriggerTest
class BaseSsrfTest(BaseTriggerTest):
"""All SSRF triggers catch their exceptions"""
@property
def exception_input(self):
return None
def test_exception(self):
pass... |
<filename>wayback.py
__author__ = "<NAME>"
__copyright__ = "Copyright 2017-2019, <NAME>"
__license__ = "apache-2.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
import re
import json
import os
import logging
import requests
import arrow
from time import sleep
import settings
logger = logging.getLogger("wayback")
l... |
# coding=utf-8
# Copyright 2021 Google Health Research.
#
# 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 la... |
<filename>test/test_stats.py
# Copyright 2016 F5 Networks 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 applica... |
import asyncio
import warnings
import re
import aiohttp
from .handler import FacebookHandler
from .types.send_api import Payload, Recipient, Message, Attachment, PersistentMenu
from .types.templates import Template
class MessengerWarning(UserWarning):
""""""
class Messenger(object):
def __init__(self, pa... |
<filename>ad_examples/classifier/svm.py
import numpy.random as rnd
from ..common.utils import *
from ..common.gen_samples import *
from ..common.sgd_optimization import sgdRMSProp
"""
Simple SVM implementations in primal form, solved with only gradient descent
and no other linear optimization libraries.
"""
class C... |
<reponame>Anita1017/nlp-recipes
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import argparse
import os
import sys
import time
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
# torch.set_printoptions(threshold=5000)
nlp_path = os.path.a... |
<filename>main.py
import random
from argparse import ArgumentParser
from enum import Enum, auto
class Turns(Enum):
RIGHT = 'right'
LEFT = 'left'
class Entries(Enum):
DIRECT = auto()
PARALLEL = auto()
TEARDROP = auto()
def get_reciprocal(degrees):
if degrees > 180:
return degrees - ... |
# Custom modules
from network import Network
from participant import Participant, CSV_Participant
from battery import Battery, Central_Battery
from tariffs import Tariffs
import util
from results import Results
# Required 3rd party libraries
import datetime
import pandas as pd
import numpy as np
import pprint
import... |
<filename>baselines/clip/zero_shot.py<gh_stars>1-10
# based on: https://github.com/haltakov/natural-language-image-search
from tqdm import tqdm
import json
from collections import defaultdict
from glob import glob
import os
import numpy as np
import clip
import torch
from PIL import Image
from pathlib import Path
impor... |
import numbers
from nilearn._utils.docs import fill_doc
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
from matplotlib.patches import FancyArrow
from matplotlib.lines import Line2D
from matplotlib.font_manager import FontProperties
from mpl_toolkits.axes_grid1.anchored_arti... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
<gh_stars>0
from pathlib import Path
from PyQt5 import QtCore, QtGui, QtWidgets
from . import _DatabaseWindow
import filetype
from ..database import Type
from .. import logger
from .QCustomObject import QTagEdit
class _Add(_DatabaseWindow):
"""Base class for every add window"""
def __init__(self, window):
... |
#
# Copyright (c) 2021, NVIDIA CORPORATION. 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 appl... |
from collections import defaultdict
from typing import Dict, List, Tuple
from src.python.review.common.language import Language
from src.python.review.inspectors.issue import BaseIssue, IssueType, Measurable
from src.python.review.quality.rules.boolean_length_scoring import LANGUAGE_TO_BOOLEAN_EXPRESSION_RULE_CONFIG
f... |
<filename>scripts/get_validated_rule_tracks.py<gh_stars>1-10
import os
import re
import sys
import glob
import json
import pandas as pd
import networkx as nx
def get_bed_from_nx_graph(
graph,
bed_file,
interval_key="active",
merge=True,
return_key="region"):
"""get BED ... |
<reponame>prijatelj/bayesian_eval_ground_truth-free
"""
All implemnetations of Dawid and Skene's EM algorithm, including the original,
hierarchial, and spectral.
"""
import math
import csv
import random
import sys
import numpy as np
from scipy.sparse import spmatrix # only necessary if the given sparse matrix need de... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from __future__ import print_function
__author__ = 'seelviz'
from plotly.offline import download_plotlyjs
from plotly.graph_objs import *
from plotly import tools
import plotly
import os
#os.chdir('C:/Users/L/Documents/Homework/BME/Neuro Data I/Data/')
import csv,gc # ga... |
<filename>base/views/tools/heritability.py
import io
import requests
import statistics as st
import numpy as np
import pandas as pd
from base.utils.data_utils import hash_it
from base.utils.gcloud import check_blob, upload_file
from base.config import config
from base.forms import heritability_form
from flask import... |
# app/chats/routes.py
from app import db, socketio
from app.chats import chats
from app.chats.models import Chat
from app.auth.models import User
from app.likes.models import Like
from app.blocks.models import Block
from app.notifications.models import Notification
from flask import render_template, redirect, url_for, ... |
<gh_stars>1-10
import io
import unittest
from pprint import pprint as pp
from zoa import *
def assert_roundtrip(v):
zoa = ZoaRaw.from_bytes(v)
b = zoa.serialize()
result_zoa = from_zoab(b)
pp(result_zoa.arr)
print()
result = result_zoa.to_py()
pp(v)
pp(result)
print(f'len: {len(v)} == {len(result)}')... |
<filename>mmaction/models/heads/cam_head.py<gh_stars>0
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import normal_init, kaiming_init
from ..builder import HEADS
from .base import BaseHead
from ...core import top_k_accuracy
import math
def obj_loc(score, threshold):
smax, sdis, ... |
<gh_stars>0
from Qt.gui import Ui_MainWindow
from PyQt5.QtWidgets import QMainWindow, QHeaderView, QTableWidgetItem, QShortcut, QListWidget, QTableView
from PyQt5.QtCore import QAbstractItemModel, Qt, QModelIndex, QVariant, QThread, QEvent, pyqtSignal, QAbstractTableModel, QSortFilterProxyModel
from PyQt5.QtGui import... |
<filename>archive/scripts/functions/generate_data.py
'''
Author: <NAME>
Date Created: 30 August 2019
Scripts to generate simulated data, simulated data with different numbers of experiments, permuted version of simulated data
'''
import os
import ast
import pandas as pd
import numpy as np
import random
import glob
im... |
<filename>cpm/plot_cpm.py
import Data as dt
import Client as client
import matplotlib.pyplot as plt
from matplotlib import gridspec
import vispy.plot as vp
import numpy as np
from vispy.color import ColorArray
from mpl_toolkits.mplot3d import axes3d
if __name__ == "__main__":
# load the data
# fields = ['... |
"""
CaesarCipherEncrypter v1.0
by 050644zf
Lisence: CC0
"""
upAlp=('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z')
loAlp=('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z')
alp=('A','B... |
# Compute the embedding
# ***************************************************************@
import numpy as np
from manifolder_helper import eigs_like_matlab
###
### Part I
###
## Configuration
m = 4000 # starting point for sequantial processing/extension
data = z_mean.T # set the means as the input set... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# # PyKOALA: KOALA data processing and analysis
# by <NAME> and <NAME>
# Extra work by <NAME> (MQ PACE student)
# Plus Taylah and Matt (sky subtraction)
from __future__ import absolute_import, division, print_function
from past.utils import old_div
version = "Version 0.72 - 13t... |
<filename>devlib/trace/ftrace.py
# Copyright 2015 ARM Limited
#
# 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 appl... |
<filename>submodules/ImageTools/SignatureInfo.py
import cv2
import numpy as np
import matplotlib.pyplot as plt
def get_contours_binary(img):
imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
print(type(imgray))
ret, thresh = cv2.threshold(imgray, 127, 255, 0)
thresh_white = 255 - thresh
# if your py... |
import sys
import logging
import requests.exceptions
import gazu
from Qt import QtCore
log = logging.getLogger(__name__)
def get_cgwire_data(data):
"""Return data from CG-Wire using `type` and `id`.
Args:
data (dict): Dictionary containing "type" and "id" of the query.
Returns:
dict: ... |
#!/usr/bin/env python
import click
from colorama import Fore, Style
import logging
import os
import systemd_watchdog
from typing import Tuple, Optional, List
from influxdb_logger import InfluxdbLogger
from pms7003 import PMS7003, PMSData, SearchResult
def get_aqi(pm25: float) -> str:
"""return the aqi for the pm... |
<reponame>haigdouzdjian/BeetBook
from entry import Entry
from addressBook import AddressBook
from utils import *
class App:
def __init__(self):
self.open_address_books = {}
self.address_book_count = 0
self.default_fields = []
self.filename = ''
def check_address_book_id(self,b... |
# Question: https://projecteuler.net/problem=120
# The coefficients of a^(odd) cancel out, so there might be a pattern ...
# n | X_n = (a-1)^n + (a+1)^n | mod a^2
#-----|----------------------------|--------
# 1 | 2a | 2a
# 2 | 2a^2 + 2 | 2
# 3 | 2... |
import os
import csv
import random
import configparser
import logging
import sys
import asyncio
from typing import Set, Any
from twitchio.ext import commands
logger = logging.getLogger('bot')
class IgnoreList:
_users: Set[str]
_filename: str
def __init__(self, filename: str = None):
self._filen... |
# Library for JSTest manifests.
#
# This includes classes for representing and parsing JS manifests.
import os, re, sys
from subprocess import *
from tests import TestCase
def split_path_into_dirs(path):
dirs = [path]
while True:
path, tail = os.path.split(path)
if not tail:
bre... |
# -*- coding: utf-8 -*-
"""
@author: Prabhu <<EMAIL>>
"""
import os
import torch
import torch.nn as nn
import torchvision.transforms as transform
from torch import optim
from torch.utils.data import DataLoader
import matplotlib.pyplot as plt
import torchvision.datasets as dset
import torchvision.utils as vutils
import ... |
<reponame>MrGreenTea/friendly
"""info_generic.py
Generic information about Python exceptions.
"""
from .my_gettext import current_lang, no_information
GENERIC = {}
def get_generic_explanation(exception_name):
"""Provides a generic explanation about a particular exception."""
if exception_name in GENERIC:
... |
<gh_stars>1-10
#!/usr/bin/env python
# encoding: utf-8
'''
monitor.collector -- shortdesc
monitor.collector is a description
It defines classes_and_methods
@author: Yi
@copyright: 2016 MY. All rights reserved.
'''
from subprocess import Popen
from subprocess import PIPE
import logging, time, re, copy
# loggi... |
<filename>pmu-tools-master/parser/elf.py<gh_stars>0
#!/usr/bin/env python
# resolve ELF and DWARF symbol tables using elftools
#
# Copyright (c) 2013-2014, Intel Corporation
# Author: <NAME>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General P... |
<filename>src/model.py
"""
Stitches submodels together.
"""
import numpy as np
import time, os
import itertools
from functools import partial
from collections import defaultdict, namedtuple
import torch
import torch.nn as nn
import torch.nn.functional as F
# Custom modules
from src import hyperprior
from src.loss im... |
<reponame>liona24/pokerv
from collections import defaultdict
from flask import Flask, render_template, request
from flask_socketio import SocketIO, emit, join_room,\
leave_room, close_room
from gameplay import Room, HumanPlayer, AiPlayer
import serialization as ser
app = Flask(__name__,
static_folder... |
<filename>checkers/gui/worker.py
import urllib.request
import cv2
import numpy as np
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, Qt
from PyQt5.QtGui import QImage
from checkers.image.board import detect_board, create_board_matrix
from checkers.image.pawn_colour import PawnColour, opposite
from checkers.lo... |
'''
_|_. _ _ | _. _ _
| || | ||<| || |_\
sublime text case-preserved multiple editing
author: <NAME>
contact: <EMAIL>
version: 0.1a
issues:
- undo is not working correctly
- probably destroys all other plugins in its wake
- needs tests and extensive testing
- it will delete your entire file if you sneeze
I accept... |
"""Gene Descriptions ETL."""
import copy
import logging
import os
import datetime
import re
import requests
from collections import defaultdict
from etl import ETL
from etl.helpers import Neo4jHelper
from genedescriptions.config_parser import GenedescConfigParser
from genedescriptions.descriptions_writer import Descr... |
from typing import Optional
from typing import List
from fastapi import APIRouter, Depends, Body
from models import User, Content, Node, Group, ExternalContent
from routers import get_current_user, admin_only
from schemas import NodeAdd, NodeEdit, NodeFind
#
router = APIRouter()
@router.post("/push_content")
async... |
#!/usr/bin/env python
#
# DLINTERFACE.PY -- Python interactive interface to the Data Lab services.
#
#from __future__ import print_function
__authors__ = '<NAME> <<EMAIL>>, <NAME> <<EMAIL>>, <NAME> <<EMAIL>>, \
<NAME> <<EMAIL>>, Data Lab <<EMAIL>>'
__version__ = '20170531' # yyyymmdd
"""
Pytho... |
"""
This file is part of the private API. Please do not use directly these classes as they will be modified on
future versions without warning. The classes should be accessed only via the transforms argument of Weights.
"""
from typing import Optional, Tuple
import torch
from torch import Tensor, nn
from . import fun... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.