text stringlengths 3.07k 22.1k |
|---|
import asyncio
import contextlib
import logging
import os
import re
import sys
from dataclasses import dataclass, field
from http.cookies import Morsel # noqa
from pathlib import Path
from types import SimpleNamespace
from typing import (
Any,
Awaitable,
Dict,
Iterator,
List,
Mapping,
Optio... |
"""Objects modelling VM state. (Frames etc.)."""
import logging
from pytype.pytd import cfg
log = logging.getLogger(__name__)
class FrameState(object):
"""Immutable state object, for attaching to opcodes."""
__slots__ = ["block_stack", "data_stack", "node", "exception", "why"]
def __init__(self, data_stac... |
# zettelkasten/cli.py
# type: ignore[attr-defined]
"""Module aggregating the command line interface."""
import configparser
import logging
import os
import platform
import subprocess
from pathlib import Path
import typer
from rich.console import Console
from rich.prompt import IntPrompt
from rich.prompt import Prompt
... |
'''
pytorch implementation: https://github.com/Merofine/DenseUnet_BraTs/blob/master/denseUnet.py
'''
import jittor as jt
from jittor import init
from jittor import nn
class Single_level_densenet(nn.Module):
def __init__(self, filters, num_conv=4):
super(Single_level_densenet, self).__init__()
self... |
import math
from gem import vector
from gem import plane
class CSG(object):
def __init__(self):
self.polygons = []
def clone(self):
newCSG = CSG()
for i in range(len(self.polygons)):
newCSG.polygons.append(self.polygons[i].clone())
return newCSG
def fromPolygon... |
import matplotlib.pyplot as plt
import pandas as pd
import FINE as fn
import numpy as np
from pyomo.opt import SolverStatus, TerminationCondition
import warnings
def dsm_test_esM():
"""
Generate a simple energy system model with one node, two fixed generators and one load time series
for testing demand s... |
"""
Copyright (c) 2015-present, Philippine-California Advanced Research Institutes-
The Village Base Station Project (PCARI-VBTS). All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
"""
from datetime import datetime
from ... |
import pygame
import math
import numpy as np
import random
import time
def checkpattern(col, row):
if row % 2:
if col % 2: #If unequal
return True
else: #if equal
return False
else:
if col % 2: #If unequal
return False
else: #if equal
... |
# ================================================================================
# Copyright: (C) 2021, SIRRL Social and Intelligent Robotics Research Laboratory,
# University of Waterloo, All rights reserved.
#
# Authors:
# <NAME> <<EMAIL>>
#
# CopyPolicy: Released under the terms of the BSD 3-Clause Lic... |
#
# ============LICENSE_START==========================================
# org.onap.vvp/engagementmgr
# ===================================================================
# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
# ===================================================================
#
# Unless ... |
# -*- coding: utf-8 -*-
# Copyright 2020 The PsiZ Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import os
import time
import copy
import json
import numpy as np
import torch
from dataset.dataset_zoo import dataset_zoo
from dataset.eval... |
from __future__ import print_function, division, absolute_import
import numpy as np
from collections import OrderedDict
# ==================== Predefined datasets information ==================== #
nist15_cluster_lang = OrderedDict([
['ara', ['ara-arz', 'ara-acm', 'ara-apc', 'ara-ary', 'ara-arb']],
['zho', [... |
import util
import numpy as np
import pandas as pd
# model_1 = pd.read_csv('fold1_boostdt.csv')
# model_1 = pd.read_csv('small_boostdt.csv')
model_2 = pd.read_csv('~/Desktop/predictions_stiebels/full/predictions_xgboost_fold1.csv', names = ["pred"])
model_1 = pd.read_csv('~/Desktop/predictions_stiebels/full/prediction... |
import glob
import http.client
import logging
import time
import concurrent.futures
import pandas as pd
from GNS3.router_types import *
from GNS3 import send_request
from GNS3.router_types_config import interface_name, get_interfaces, get_router_id, adapter_offset, \
get_hostname, get_config_type, config_extension... |
import logging
import os
import azure.functions as func
import certifi
from azure.identity import ClientSecretCredential
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
from azure.mgmt.containerinstance.models import (
Container,
ContainerGroup,
ContainerGroupRestartPolicy,
E... |
# Copyright 2021 DeepMind Technologies 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 applicable law or agree... |
# bchhun, {2020-03-22}
import csv
import natsort
import numpy as np
import os
import xmltodict
from xml.parsers.expat import ExpatError
import xml.etree.ElementTree as ET
import pandas as pd
import math
import array_analyzer.extract.constants as constants
"""
functions like "create_<extension>_dict" parse files of <e... |
import pandas as pd
from pandas.tseries.holiday import USFederalHolidayCalendar as calendar
from pandas.tseries.offsets import CustomBusinessDay
import numpy as np
import datetime
def make_baseline(x_days, pivot, name="Temperature", freq="15min"):
baseline=pivot[pivot.index.isin(x_days)].mean(axis=0)
baseline_... |
"""
Written by DaehwaKim
>> daehwa.github.io
"""
import numpy as np
import cv2
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from load_param import cap, cap2, frame_from, frame_to, rs_offset, opti_offset
plt.ion()
fig = plt.figure(figsize=(8, 8))
ax = fig.add_subplot(111, projection='3d') # A... |
'''Run halla on console environment
'''
import argparse
import sys
import numpy as np
from os.path import join, basename, splitext, isdir
import pkg_resources
from halla import HAllA, AllA
def parse_argument(args):
parser = argparse.ArgumentParser(
description='HAllA: Hierarchical All-against-All signifi... |
#!/usr/bin/env python3
# Copyright (C) 2015 <NAME> <<EMAIL>>
# All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the ... |
"""
Basic API for serving the processed graph.
"""
import json
import pymongo
import collections
from typing import Dict, List
from fastapi import FastAPI, Query
from fastapi.staticfiles import StaticFiles
# Use this to serve a public/index.html, see https://github.com/tiangolo/fastapi/issues/130
from starlette.resp... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers import BertPreTrainedModel, BertModel, AutoConfig
from bojone_snippets import DataGenerator, sequence_padding
from bojone_tokenizers import Tokenizer
from configuration.config import *
from opt import create_optimizer_and_scheduler
fr... |
from __future__ import print_function
from __future__ import absolute_import
from past.builtins import basestring
import numpy as np
import astropy
from astropy import units as u
from astropy.time import Time
from astropy.coordinates import SkyCoord, EarthLocation, Longitude, Latitude, Angle
import moby2
import moby2.... |
import logging
import math
from datetime import datetime, timezone
from typing import List
import boto3
import libgeohash
from boto3.dynamodb.types import TypeDeserializer
from dynamodb_geo import GeoTableConfiguration
from dynamodb_geo.configuration import StatisticsConfiguration
from dynamodb_geo.model import Statis... |
import json, os, sys
from pprint import pprint as print
from datetime import datetime
from datetime import date
from collections import Counter
from collections import OrderedDict
import pandas as pd
import lh3.api as lh3
client = lh3.Client()
chats = client.chats()
FRENCH_QUEUES = [
"algoma-fr",
"clavardez... |
# importing modules
import numpy as np
import pandas as pd
###ETL reddit data
#----------------------------------------------------------------------------------------------------------------------------------------
def pq (names, subredits='allstocks', sort='relevance', date='all', comments=False):
#importing r... |
#!/usr/bin/env python3
# semantics_types.py ---
#
# Filename: semantics_types.py
# Author: <NAME>
# Created: Mon Aug 31 17:00:48 2015 (-0400)
#
#
# Copyright (c) 2015, <NAME>, University of Pennsylvania
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are per... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from collections import Counter
from sklearn.ensemble import RandomForestClassifier, AdaBoostClassifier, GradientBoostingClassifier, ExtraTreesClassifier, VotingClassifier
from sklearn.discriminant_analysis import LinearDiscr... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import time
import os
import mozinfo
class TestContext(object):
""" Stores context data about the test """
a... |
#!/usr/bin/env python3
import sqlite3
import glob, os
import argparse
class Event:
def __init__(self, name, thread_id, start, end):
self._name = name
self._thread_id = thread_id
self._start = start
self._end = end
class SummaryItem:
def __init__(self):
self._time_excl... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
from matplotlib.cbook import flatten
import numpy as np
import cv2 as cv
import torch
device = 'cuda:0' if torch.cuda.is_available() else 'cpu'
def image(path: str, encoding='srgb', gamma=2.2):
if encoding not in ['srgb', 'gamma', 'linear']:
raise RuntimeError("encoding must be one of 'srgb','gamma','lin... |
from lxml import html
import requests, re, math
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
import os
import glob
import csv
import matplotlib.pyplot as plt
plt.style.use('ggplot')
def scrape_team_abbrev():
page = "https://en.wikipedia.org/wiki/Wikipedia:WikiProject_National_Basketball_Ass... |
"""
Create a metadata lookup table for ALL existing npy files
Or just the MRNs for the project """
import os
import pandas as pd
import numpy as np
import time
import lz4.frame
#import pdb;pdb.set_trace()
#%% files and paths
cfr_data_root = os.path.normpath('/mnt/obi0/andreas/data/cfr')
meta_date = '201215'
location... |
import concurrent.futures
import timeit
from logging import DEBUG, INFO, WARN
from typing import List, Optional, Tuple, cast
from datetime import datetime, timedelta
import numpy as np
from flwr.common import (
Disconnect,
EvaluateIns,
EvaluateRes,
FitIns,
FitRes,
ReadIns,
ReadRes,
Reco... |
'''
Module for fast morphological operations for binary images
'''
__all__ = ['binary_dilation', 'binary_erosion', 'binary_closing', 'binary_opening']
import numpy as np
def binary_dilation(image, selem=None, out=None):
'''Apply a binary-dilation operation to an image using a structuring element
This functi... |
#Ref: <NAME>
"""
Training and testing for semantic segmentation (Unet) of mitochondria
Uses standard Unet framework with Jacard for loss.
Dataset info: Electron microscopy (EM) dataset from
https://www.epfl.ch/labs/cvlab/data/data-em/
Patches of 256x256 from images and labels
have been extracted (via separate prog... |
import logging
import time
from typing import Any, Dict, List
import httpx
from django.contrib.auth import get_user_model
from django.http import HttpRequest
from django.urls import resolve
from . import settings as app_settings
from .utils import get_client_ip, get_user_agent
try:
from django.contrib.gis.geoip2... |
import os
import json
import pkg_resources
import shutil
import qiime2
import q2templates
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
import skbio
TEMPLATES = pkg_resources.resource_filename('q2_comp', '_denoise')
#def merge_df(filenames, metadata=N... |
#!/usr/bin/env python
import math, csv, os, time, traceback
from contextlib import closing
WGS84_A = 6378137.0
WGS84_F = 1.0/298.257223563;
WGS84_B = WGS84_A * (1 - WGS84_F)
WGS84_ECC_SQ = 1 - WGS84_B * WGS84_B / (WGS84_A * WGS84_A)
WGS84_ECC = math.sqrt(WGS84_ECC_SQ)
ABSOLUTE_MAXIMUM_RANGE = 500000.0
def dtor(d):... |
import datetime
import json
import os
import pathlib
import shutil
import sys
import time
from distutils.dir_util import copy_tree
from typing import Dict, List, Tuple
from .cache_sources import fetch_package_sources, get_pkg_cache_dir, is_cached, dwn_file
from .index import add_to_index, augment_to_index, create_pkg_... |
# SDT2PrintMarkdown.py
#
# Print SDT2 to markdown
from .SDT2Classes import *
hideDetails = False
tables = False
pageBreakBeforeMCandDevices = False
pageBreakToken = '\n<!--BREAK-->'
# tabulator level
tab = 0
def incTab():
global tab
tab += 1
def decTab():
global tab
if (tab > 0):
tab -= 1
def ... |
""" This module cleans the patient-level data containing COVID vaccination dates and other relevant information"""
# Import statements
import pandas as pd
import numpy as np
import os
# Errors
from errors import DataCleaningError
def load_data(input_file='input_delivery.csv.gz', input_path="output"):
"""
T... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import functools
import argparse
from functools import reduce
###########################
# deal with CLI arguments #
###########################
# parser = argparse.ArgumentParser(description='This is a word segmentation program.')
# parser.add_argument('-i', '--input... |
from flask import Blueprint, jsonify
from models import *
from unidecode import unidecode
from datetime import datetime
import requests
import os
from operator import attrgetter
import json
api = Blueprint('api', __name__, url_prefix='/api')
BEARER_TOKEN_TWITTER = os.getenv('BEARER_TOKEN')
# Token que autoriza a busc... |
import sys
import os
import numpy as np
import torch
import torch.nn as nn
import argparse
from torch.utils.data import DataLoader
import random
import pickle
from scipy import signal
from scipy.ndimage.filters import convolve
proj_root = '.'
sys.path.insert(0, proj_root)
data_root = 'data'
model_root = 'models'
from... |
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Runs apkanalyzer to parse dex files in an apk.
Assumes that apk_path.mapping and apk_path.jar.info is available.
"""
import collections
import logging
i... |
import argparse
import datetime
import json
from typing import Optional, Union, List
import requests
def attempt_post(token: str, where: str, expected: Union[int, List[int]], params: Optional[dict] = None,
data: Optional[str] = None) -> Union[dict, bool]:
if type(expected) is int:
legal:... |
import synapseclient
import synapseutils
from synapseclient import File, Folder
from .utilities import load_json, save_json, calc_content_md5, recursivedict
from pathlib import Path
import os
from tqdm import tqdm
from multiprocessing.dummy import Pool as ThreadPool
import json
from asciitree import LeftAligned
from as... |
# Copyright 1999-2019 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
"""
Utilities for working with the local dataset cache.
This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp
Copyright by the AllenNLP authors.
"""
import os
import json
import tempfile
import shutil
import hashlib
import logging
import sys
from pathlib import Path
from tqdm import tq... |
import time
import hashlib
from sqlalchemy.exc import IntegrityError
from flask import current_app
from . import utils
from .models import User, UserUpdateSignal
from .extensions import db, redis_store
def _get_user_verification_code_failures_redis_key(user_id):
return 'vcfails:' + str(user_id)
def _register_us... |
# -*- coding: utf-8 -*-
"""
__init__.py
~~~~~~~~~~~~~~
Project Init.
:copyright: (c) 2016 by fengweimin.
:date: 16/6/11
"""
import logging
import os
import re
import socket
from datetime import datetime
from logging.handlers import SMTPHandler, TimedRotatingFileHandler
from bson.objectid import ... |
"""
Routines for geographically re-sampling regional electricity demand.
Electricity demand is reported by a variety of entities, pertaining to many
different geographic areas. It's often useful to be able to estimate how
demand reported for one geography maps onto another. For instance, taking the
total hourly electr... |
"""
This script is handles the merging of two molecules and cleans up
the molecule.
"""
import __future__
import copy
import rdkit
from rdkit import Chem
# Disable the unnecessary RDKit warnings
rdkit.RDLogger.DisableLog("rdApp.*")
import smilesmerge.operators.convert_files.gypsum_dl.gypsum_dl.MolObjectHandling as M... |
#!/usr/bin/env python
import os
import re
import json
import argparse
import operator
import logging
from pathlib import Path
import numpy as np
from tensorboard.backend.event_processing.plugin_event_multiplexer import EventMultiplexer
import matplotlib.pyplot as plt
from yarll.misc.utils import ge
from yarll.misc.exc... |
import scipy.linalg as linalg
import numpy as np
from numpy.linalg import inv
import ddp_types
#Dynamic = ddp_types.LinearDynamic
Dynamic = ddp_types.NonlinearDynamic
class QuadraticCost:
def __init__(self, mean, hessian):
self.mean = mean
self.hessian = hessian
def eval(self, x):
... |
"""This script combines multiple different zarr stores with some very strong
assumptions.
Note that this was developed to work alongside `nwp_grib_to_zarr.py` so that
that script could be run in parallel and uploaded to different GCS zarr files.
This is then meant to combine the resulting zarr stores.
I therefore as... |
import pickle
import numpy
from tqdm import tqdm
from ShapeEmbedding import get_vocab, text_to_char_index, COMP_WIDTH, MAX_WORD_LENGTH
from keras.preprocessing.sequence import pad_sequences, skipgrams
from keras.utils.np_utils import to_categorical
from keras.models import Model
from keras.layers import Embedding, Inpu... |
# 微博模拟登录
# 作者: David
# Github: https://github.com/HEUDavid/WeiboSpider
import base64
import binascii
import json
import random
import re
import time
from urllib.parse import quote_plus
import requests
import rsa
class WeiboLogin:
def __init__(self, username, password):
self.usernam... |
import hashlib
import hmac
import json
import logging
import time
from json.decoder import JSONDecodeError
from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Tuple
from urllib.parse import urlencode
import requests
from rotkehlchen.accounting.ledger_actions import LedgerAction
from rotkehlchen.acco... |
from hermes1d.fekete.fekete import Mesh1D, Function
def test1():
m = Mesh1D((-5, -4, 3, 10), (1, 5, 1))
def test2():
eps = 1e-12
func = lambda x: x**2
f = Function(func, Mesh1D((-5, -4, 3, 10), (2, 5, 2)))
for x in [-5, -4.5, -4, -3, -2, -1, 0, 0.01, 1e-5, 1, 2, 3, 4, 5, 6, 7, 10]:
assert ... |
# -*- coding: utf-8 -*-
from gevent import monkey
monkey.patch_all(socket=False, subprocess=True, ssl=False)
import os
import imp
import pytest
import random
import shutil
import time
import copy
from unittest import TestCase
import test.unit.agent.common.config.app
from amplify.agent.common.util import configreade... |
from dd.cudd import BDD
from bdd_provider import make_bdd
from graphviz import Source
# Parity class which is a slightly altered version of the one used by Sanchez et al:
# <NAME>., <NAME>., & <NAME>. (2018). BDD-based parity game solving: a comparison of
# Zielonka's recursive algorithm, priority promotion and fixpoi... |
# -*- coding: utf-8 -*-
"""
Produces satellite orbit data. Orbit is simulated using
Two Line Elements (TLEs) and ephem. Satellite position is coupled
to several space science models to simulate the atmosphere the
satellite is in.
Properties
----------
platform
'missions'
name
'ephem'
tag
None supported
ins... |
"""Test suite for TVRegex
"""
import unittest
from tvregex import tvregex
# Program will take command line arguments:
# -> File (required)
# -> -s / --silent = Fail silently if matching fails
# ----> Normal behaviour is to ask for show name
# Program uses regex to parse file name
# Program finds match for show name
... |
import curses
import curses.textpad
import curses.ascii
import os
from interactive import *
import log
import random
from datetime import datetime
log = log.logger
NUMBERS = [ ord("0"), ord("1"), ord("2"), ord("3"), ord("4"), ord("5"), ord("6"), ord("7"), ord("8"), ord("9") ]
VIM_DIRECTIONS = [ ord("j"), ord("k"), or... |
#!/usr/bin/env python3
# Copyright 2019 The GraphicsFuzz Project Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
#!/usr/bin/python3
import os
import sys
from time import gmtime, strftime, localtime
from datetime import datetime, date, timedelta
import LitMimic as lm
import smtplib
import shutil
import time
import subprocess as sp
import shlex
import struct, fcntl
class TimeService:
DateTimeFormat = "%Y%m%d_%H-%M-%S"
def ... |
# sys.path.append("/Users/tamarervin/CH_Project/CHD")
import numpy as np
import h5py as h5
import numpy.random as random
import matplotlib.pyplot as plt
import tensorflow as tf
import analysis.ml_analysis.ch_detect.ml_functions as ml_funs
from tensorflow.keras.optimizers import Adam
from sklearn.model_selection import... |
import math
import time
from math import radians
b = 1.0
c = 1.0
wheelbase = 1.0 + 1.0 # b + c
h = 1.0
mass = 1500.0
inertia = 1500.0
length = 3.0
width = 1.5
wheellength = 0.7
wheelwidth = 0.3
position_wc = (0, 0)
velocity_wc = (0, 0)
angle = 0.0
angularvelocity = 0.0
# input
steerangle = 0
throttle = 0.0
brake = ... |
import argparse
import random
import numpy as np
from sklearn.model_selection import train_test_split
import torch
import torch.nn as nn
from torch import optim
from torch.utils.data import Dataset, DataLoader
import dataLoader as loader
import preprocessing as pproc
import models
device = torch.device("cuda" if torch... |
from __future__ import print_function
import argparse
import csv
import hashlib
import os
import pytsk3
import pyewf
import sys
from tqdm import tqdm
"""
MIT License
Copyright (c) 2017 <NAME>, <NAME>
Please share comments and questions at:
https://github.com/PythonForensics/PythonForensicsCookbook
or email <... |
from utils import *
from db import *
import sqlite3 as lite
import threading
import requests
import logging
import rfc6266
import shutil
import time
import sys
import os
from file import *
from utils import *
from widgets import *
import urllib.parse as parse
from multiprocessing import Pool
from PyQt5.QtWidgets i... |
import re
import pandas as pd
from datetime import datetime
import configparser
from sodapy import Socrata
DATASET = 'tg4x-b46p'
CONFIG_FILE = 'configs.ini'
PERMIT_TYPE = 'Shooting Permit'
SPECIAL_CASES = {
'brooklyn bridge boulevard': 'adams street - brooklyn bridge boulevard',
'laguardia place': 'la guardi... |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
# CODE NAME HERE
# CODE DESCRIPTION HERE
Created on 2019-03-23 at 13:01
@author: cook
"""
import numpy as np
from apero import core
from apero import lang
from apero.core import constants
from apero.core.core import drs_database
from apero.io import drs_fits
from ap... |
#!/usr/bin/env python3
# JOBE - the git batch job runner
# This file is designed to run as a git post-receive hook in a bare repository
# The accompanying makefile can be used to setup a repository.
# Alternatively, create a bare git repository, add this file as post-receive
# to the hooks directory, clone the repo ... |
import requests
import lxml.html
import rdflib
import sys
wiki_prefix = "http://wikipedia.org"
UN_nations = "https://en.wikipedia.org/wiki/List_of_countries_by_population_(United_Nations)"
project_prefix = "http://project.org/"
def get_countries(url):
"""
input: the url for the UN nations page
re... |
from __future__ import print_function
import os
import sys
import glob
import logging
import subprocess
from builtins import str as text
from pyclibrary import CParser
__all__ = ['MID','CC','MSG']
class MessageIDDB(object):
"""Message ID Database"""
def __init__(self):
self._fw = {}
self.... |
import json
import numpy as np
import argparse
from pathlib import Path
import logging
from logging.config import fileConfig
import cv2
from typing import List, Tuple
import deeptennis.utils as utils
def mask_image(img: np.ndarray, pts: np.ndarray, dilate=False) -> np.ndarray:
"""
Zero out the irrelevant par... |
# to run mmt server : cf. https://docs.python.org/3/library/subprocess.html
import subprocess
import time
import threading
import os
# TODO ask dennis on whether and how to delete modules
# to do http requests
# http://docs.python-requests.org/en/master/user/quickstart/
import requests
from requests.utils import quote... |
# -*- coding: utf-8 -*-
# The data in '_relative_atomic_masses' is licensed under the CC-SA license
# https://en.wikipedia.org/wiki/Standard_atomic_weight#List_of_atomic_weights
_elements = (
# [Symbol, Name, Relative atomic mass, uncertainty]
["H", "Hydrogen", 1.008, 0.0],
["He", "Helium", 4.002602, 2e-0... |
from .models import Museo, Usuario, Comentario, MuseoLike
from django.contrib.auth.models import User
from django.template.loader import get_template
from django.template import Context
from django.db import IntegrityError
from xml.sax import make_parser
from urllib import request, error
from xml.sax.handler import Co... |
##############################################################################
#
# Copyright (c) 2008 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
import argparse
import importlib
import time
import sys
import os
import subprocess
import traceback
import pytest
import yaml
from yamlmaker import Text
from yamlmaker import generate
from yamlmaker import panic
CCK_DEFAULTS = """
# The default concourse target to use
concourse_target: concourse
# When Setting a ... |
# Copyright (C) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# This work is made available under the Nvidia Source Code License-NC.
# To view a copy of this license, check out LICENSE.md
"""Config utilities for yml file."""
import collections
import functools
import os
import re
import yaml
from imag... |
# -*- coding: utf-8 -*-
# ==============================================================================
#
# Authors: <NAME> <<EMAIL>>
#
# Copyright (c) 2017 <NAME> . All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# f... |
from typing import Callable, List, Optional, Union
from collections import defaultdict
import numpy as np
from numpy.random import multivariate_normal
from scipy import stats
from rule_surrogate.core import ModelBase, ModelInterface
from rule_surrogate.utils.io_utils import save_file, get_path, load_file
sample_cac... |
#!/usr/bin/python
# -*- coding:utf-8 -*-
from __future__ import print_function
import os
import os.path as osp
import argparse
import sys
import h5py
import time
import datetime
import numpy as np
from tabulate import tabulate
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
from torch.optim imp... |
# Copyright (c) 2017 Civic Knowledge. This file is licensed under the terms of the
# MIT License, included in this distribution as LICENSE
"""
"""
from functools import lru_cache
from functools import reduce
from pathlib import Path
from warnings import warn
import h5py
import numpy as np
import pandas as pd
from r... |
from django.shortcuts import render
from core.forms import *
from core.models import *
def list_usuario(request):
if request.method == 'POST':
search = request.POST.get('nome_usuario')
lista_usuario = Usuario.objects.filter(nome__contains=search)
if search == "":
search = req... |
import torch, copy
import torch.nn as nn
class LocalLinear(nn.Module):
def __init__(self, num_features, kernel_size, init_val=1.0, bias=True):
super(LocalLinear, self).__init__()
self.kernel_size = kernel_size
self.num_features = num_features
if init_val is None:
self.... |
################################################################################
# Hypergraph 2 Vec Weighting Schemes #
# This module is responsible for computing weights for hypergraph node-edges #
# Each function maps a hypergraph to two dictionaries, node2weight and ... |
import tensorflow as tf
from examples.crystal_volume import optimize_crystal_volume as ocv
from tensorflow.keras import layers
from rlmolecule.crystal.builder import CrystalBuilder
from rlmolecule.crystal.crystal_state import CrystalState
from rlmolecule.crystal.preprocessor import CrystalPreprocessor
from rlmolecule.... |
import io
import os
import struct
from datetime import datetime
from enum import Enum
import numpy as np
import pandas as pd
import soundfile as sf
from PIL import Image
from dataclasses import dataclass
from .classifiers.classifier import Classifier
class DataType(Enum):
EMOTIONS = 1
EMOTIONS_FROM_RAW_DATA... |
import argparse
import torch.utils.data
from train_test_functions import prepare_train, custom_transforms
from imageio import imsave
import os
from train_test_functions.utils import tensor2array
import torch
from train_test_functions.sequence_folders_list import SequenceFolder_Inference
import numpy as np
parser = arg... |
# @ Copyright Inria, Ecole Polytechnique
# Shared under the MIT license https://opensource.org/licenses/mit-license.php
# This file contains all the functions that are used to explore the SDMX metadata file
# These functions (to get the dimensions, the codelists...) are used elsewhere in the code when we want to int... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.