input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
from errors import *
import sys
sys.path.append("core/include")
sys.path.append("core/include/simplejson")
sys.path.append("include")
import time
import gui
import os
import pygame
pygame.font.init()
import random
import pickle
import re
import textutil
import registry
import zipfile
import simplejson as json
ImgFont =... | |
<gh_stars>0
# Copyright The PyTorch Lightning team.
#
# 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 agr... | |
<filename>tp5/Labyrinthe.py
# -*- coding: utf-8 -*-
import random
import math
#--------------------------------------------------------------
# n : entier
# retourne un booleen : True si n est impair et False autrement.
def estImpair(n):
return(n%2 != 0)
#-----------------------------------------------------------... | |
<reponame>caffery-chen/oopt-gnpy<filename>tests/test_spectrum_assignment.py
#!/usr/bin/env python3
# Module name: test_spectrum_assignment.py
# Version:
# License: BSD 3-Clause Licence
# Copyright (c) 2018, Telecom Infra Project
"""
@author: esther.lerouzic
"""
from pathlib import Path
from copy import deepcopy
impo... | |
k_trend > 0: # make this the polynomial trend order
trendorder = k_trend - 1
else:
trendorder = None
self.k_trend = k_trend
self.trendorder = trendorder
#TODO: deprecate coef_names
self.coef_names = self.exog_names = util.make_lag_names(names,
lag_order, k_trend)
self.params = params
# Initialize VARProcess... | |
<filename>src/test/rgw/rgw_multi/tests_ps.py
import logging
import json
import tempfile
from six.moves import BaseHTTPServer
import random
import threading
import subprocess
import socket
import time
import os
from random import randint
from .tests import get_realm, \
ZonegroupConns, \
zonegroup_meta_checkpoint, \
z... | |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""Tests for the package."""
import datetime
import json
import os
import re
import sys
from typing import Optional, Tuple, Union
import jwt
sys.path.insert(0, os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..")))
import asconn... | |
<gh_stars>0
import os
from datetime import datetime
import psutil
import win32serviceutil
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QCloseEvent, QShowEvent, QColor, QIcon
from PyQt5.QtWidgets import QMainWindow, QMessageBox, QTableWidgetItem, QApplication, QListWidget, QSizePolicy
from PyQt5 import uic
from... | |
<gh_stars>0
import os
import math
import sys
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as Func
from torch.nn import init
from torch.nn.parameter import Parameter
from torch.nn.modules.module import Module
import torch.optim as optim
from torch.utils.data import Dataset
from tor... | |
<filename>biothings/hub/databuild/builder.py
import sys, re, math
import os, glob
import json
import time
import copy
import importlib
import pickle
from datetime import datetime
from pprint import pformat
import asyncio
from functools import partial
import glob, random
import aiocron
from .mapper import TransparentMa... | |
global
'http://www.17u.net/',
# Why: #9434 in Alexa global
'http://www.enekas.info/',
# Why: #9435 in Alexa global
'http://www.trendsonline.mobi/',
# Why: #9436 in Alexa global
'http://www.hostinger.ru/',
# Why: #9437 in Alexa global
'http://www.navad.net/',
# Why: #9438 in Alexa global
'http://www.mysuperma... | |
<reponame>ajar98/todoist_bot
from flask import Flask
from flask import request, redirect
import json
import requests
import urllib
import requests.auth
import os
from client import TodoistClient
from uuid import uuid4
from pymongo import MongoClient
from dateutil.parser import parse
from datetime import timedelta, date... | |
<gh_stars>1-10
# DataTypes:
# SimpleLabelFile
# ClassLabelFile
#
# UnprocessedSignalFile
# _SignalFile_Impute
# _SignalFile_Merge
# _SignalFile_Normalize
# _SignalFile_Order
# _SignalFile_Annotate
# _SignalFile_Filter
# SignalFile
#
# IlluminaControlFile
#
#
# Modules:
# UnprocessedSignalFile
# convert_signal_to_tdf
# ... | |
of items available is more than the value specified in max-items then a ``NextToken`` will be provided in the output that you can use to resume pagination.
- **PageSize** *(integer) --*
The size of each page.
- **StartingToken** *(string) --*
A token to specify where to start paginating. This is the ``NextToken`` f... | |
{mso-style-parent:htmlxls2xlsx; text-decoration: line-through;}
small {mso-style-parent:htmlxls2xlsx; font-size: 0.75em;}
span {mso-style-parent:htmlxls2xlsx;}
strike {mso-style-parent:htmlxls2xlsx; text-decoration: line-through;}
strong {mso-style-parent:htmlxls2xlsx; font-weight: bold;}
table {display: table; border-... | |
<filename>asyncio_run_in_process/main.py<gh_stars>0
import asyncio
import concurrent
import logging
import os
import signal
import sys
from typing import (
TYPE_CHECKING,
Any,
AsyncContextManager,
AsyncIterator,
Callable,
Optional,
)
from async_generator import (
asynccontextmanager,
)
from . import (
constan... | |
"editnotices/page/artas, bethlehem":"warning",
"editnotices/page/artuf":"warning",
"editnotices/page/as-samu":"warning",
"editnotices/page/as-sawahira ash-sharqiya":"warning",
"editnotices/page/as-sawiya":"warning",
"editnotices/page/as-sura":"warning",
"editnotices/page/as\'ad abukhalil":"warning",
"editnotices... | |
#!/usr/bin/env python
"""
===========================================================================
Assignment 6: Text classification using Deep Learning (CNN models)
===========================================================================
This script builds a complex deep learning model by combining deep learn... | |
from __future__ import with_statement
import py
import sys
from rpython.rlib.parsing.tree import Nonterminal, Symbol, RPythonVisitor
from rpython.rlib.parsing.codebuilder import Codebuilder
from rpython.rlib.objectmodel import we_are_translated
class BacktrackException(Exception):
def __init__(self, error=None):
sel... | |
Union[str, None] = None,
) -> objects.Entitlement:
query_args = self._query_builder(
"mutation",
"updateEntitlement",
fields,
{"id": id, "input": input,},
_ARGUMENT_LEGENDS.update_entitlement,
False,
)
return objects.Entitlement(
self.api(headers=headers, token=token, **query_args)["data"][
"updateEntitleme... | |
#!/usr/bin/env python
#
###############################################################################
# Author: <NAME>
# Last Modified: 09/05/2019
###############################################################################
# BSD 3-Clause License
#
# Copyright (c) 2019, Texas Advanced Computing Center
# All right... | |
<filename>src/game/link.py
__author__ = 'brad'
import os
import src.engine as engine
import pygame
import effects
import random
import linksword
import specialtiles
from pygame.locals import *
RESOURCE_DIR = os.path.join(os.path.dirname(__file__),'../../resources/') + '/'
SPRITE_DIR = RESOURCE_DIR + 'sprite/'
SOUND_... | |
i in self.op_range(start, end):
op = code[i]
if op in instr:
if target is None:
return i
dest = self.get_target(i, op)
if dest == target:
return i
elif not exact:
_distance = abs(target - dest)
if _distance < distance:
distance = _distance
pos = i
return pos
def last_instr(self, start, end, instr, target... | |
decimal degrees
radius : float
Radius of the query, in arcmin
Returns
-------
table : `~astropy.table.Table`
Result of the query
"""
from astroquery.ukidss import Ukidss
coo = coord.SkyCoord(ra*u.deg, dec*u.deg)
table = Ukidss.query_region(coo, radius=radius*u.arcmin,
database=database, programme_... | |
#!/usr/bin/python3
'''
NAME:
lf_check.py
PURPOSE:
lf_check.py will tests based on .ini file or .json file.
The config file name can be passed in as a configuraiton parameter.
The json file may be copied from lf_check.json and updated. Currently all the parameters are needed to be set to a value
The --production fla... | |
a menu callback on a subthread, and then proceed to launch
others on other threads without having to wait.
----------
CheckOOFMenuItem:
A CheckOOFMenuItem is an OOFMenuItem that has a value, which can be 0
or 1. In GUI mode, a check box is drawn next to the menu item's name,
indicating the value. A CheckOOFMenuIte... | |
is called asynchronously,
returns the request thread.
"""
all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if ... | |
out += spop(r)
return out
def buildAmbiguousFunctionCall(self, fid, types):
pass
# load the parameters to call a function
def rawFNParameterLoad(self, fn, sseused, normused,
pcount, offset=False, types=None):
global rdx_functioncalls_inprogress, rcx_functioncalls_inprogress
paraminst = ""
# when parameters... | |
to_disk:
with open(statpath, 'w') as f:
print(statout, file=f)
# Print status to the terminal.
if display:
self.printStatus(ansi=ansi)
def printStatus(self, ansi="\x1b[93m"):
"""
Print calculation status to the terminal in a compact and legible way.
"""
if self.status.lower() == 'launch':
ansi = "\x1b[1;44;... | |
binnumber = scipy.stats.binned_statistic(
x = x_data,
values = weights,
statistic = 'sum',
bins = bins,
)
stat = weighted_sum / weights_sum
else:
assert weights is None, "weights only works with weighted_mean"
# Usual statistic
stat, bin_edges, binnumber = scipy.stats.binned_statistic(
x = x_data,
value... | |
<filename>mrpython/PyEditor.py
import os
import string
import platform
import tkinter.messagebox as tkMessageBox
import tkinter.simpledialog as tkSimpleDialog
from tkinter.font import Font, nametofont
from tkinter import *
from configHandler import MrPythonConf
from Search import SearchDialog
from Search import GrepDi... | |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2012 <NAME>
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""
NumPy Array Editor Dialog based on Qt
"""
# pylint: disable=C0103
# pylint: disable=R0903
# pylint: disable=R0911
# pylint: disable=R0201
from spyderlib.... | |
# -*- coding: utf-8 -*-
"""
Created on 28 Aug 28 2021
@author: <NAME>
"""
import copy as _copy
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable as _mal
import numpy as _np
import pandas as _pd
import scipy.stats as _sst
from . import stat_error_measure... | |
0.4, 0.0001, 0.273425, 749.8925],
[5, 0.9, 0.001, 0.38372, 346.818],
[5000, 0.6, 0.001, 0.24936, 672.644],
[1000000, 1, 0.001, 0.5, 241.932],
[5000, 0.5, 0.1, 0.26154, 119.208],
[800, 0.3, 0.1, 0.27096, 95.728],
[50, 0.6, 0.0001, 0.3492, 972.898],
[75, 0.8, 0.01, 0.32876, 189.114],
[900, 1.5, 0.0001, 0.2597, 16... | |
random subset of pixels
t0 = time.time()
if bkg_boxsize > 300:
index_stat = get_rand_indices((data_masked_reshaped.shape[2],))
__, mini_median, mini_std = sigma_clipped_stats (
data_masked_reshaped[:,:,index_stat].astype('float64'),
sigma=get_par(set_zogy.bkg_nsigma,tel), axis=2, mask_value=0)
if log is not None... | |
= [desktop, get_uptime()]
def set_desktop_count(self, *, count: int):
# pylint: disable=attribute-defined-outside-init,invalid-name
"""Assigns the number of desktops."""
LOGGER.debug("Assigning number of desktops to: %d", count)
self._NET_NUMBER_OF_DESKTOPS = [count]
def set_desktop_geometry(self, *, height: in... | |
<reponame>mumuwoyou/pytrader
# encoding: UTF-8
'''
本文件包含了CTA引擎中的策略开发用模板,开发策略时需要继承CtaTemplate类。
'''
import numpy as np
import talib
from cyvn.trader.vtConstant import *
from cyvn.trader.vtObject import VtBarData
from datetime import datetime, timedelta
import time
from .ctaBase import *
############################... | |
Required
Required data: cluster_name, network, num_nodes
Optional data and default values: org_name=None, ovdc_name=None,
rollback=True, template_name=None, template_revision=None
**telemetry: Optional
"""
data = kwargs[KwargKey.DATA]
# TODO default template for resizing should be control_plane's template
requi... | |
texCoordSet = str(fbxLayerElementUV.GetName())
if layerIdx == 0 or texCoordSet == '' or texCoordSet == 'default':
texCoordSet = 'st'
else:
texCoordSet = usdUtils.makeValidIdentifier(texCoordSet)
uvPrimvar = usdMesh.CreatePrimvar(texCoordSet, Sdf.ValueTypeNames.Float2Array, interpolation)
uvPrimvar.Set(uvs)
if l... | |
PROVIDERS.resource_api.delete_project,
root_project['id'],
cascade=True)
# Ensuring no project was deleted, not even project2
PROVIDERS.resource_api.get_project(root_project['id'])
PROVIDERS.resource_api.get_project(project1['id'])
PROVIDERS.resource_api.get_project(project2['id'])
def test_hierarchical_projec... | |
from __future__ import absolute_import, division, print_function
from ..components import Actor
import inspect
import itertools
import six
import collections
from ..logger import logger
__all__ = ['FuncActor', 'Switch', 'ShellRunner', 'Sink',
'DictionaryMerge', 'DictionaryExtract', 'LoopWhile',
'AnnotateIn... | |
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | |
# 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 use... | |
"""
Pre-training Bidirectional Encoder Representations from Transformers
=========================================================================================
This example shows how to pre-train a BERT model with Gluon NLP Toolkit.
@article{devlin2018bert,
title={BERT: Pre-training of Deep Bidirectional Transforme... | |
R_exact[:, :, src_i] = np.matmul(R_perturb, R_avg)
return R_exact
def _calc_coherency_rotation(self, inds=None):
"""
Calculate the rotation matrix to apply to the RA/Dec coherency to get it into alt/az.
Parameters
----------
inds: array_like, optional
Index array to select components.
Defaults to all compon... | |
<filename>main.py
import pygame as pyg
from pygame.locals import *
import os, random
from spritesheet.Sprites import *
clock = pyg.time.Clock()
FPS = 120
os.environ['SDL_VIDEO_CENTERED'] = '1'
pyg.init()
info = pyg.display.Info()
WINDOW_SIZE2 = [2000, 2000]
screen_width, screen_height = info.current... | |
""
def execute(self):
'''Main execution logic'''
try:
arcpy.CheckOutExtension("network")
#Get the properties for all network datasets from a propeties file.
self._getNetworkDatasetProperties()
#Select the travel mode
self._selectTravelMode()
#Get the values for big button tool parameters that are used as... | |
temperature (in K).
If only a scalar value provided, it will be assumed to be
identical for all the interferometers. Otherwise, it must be of
shape broadcastable to (nbl,nchan,ntimes). So accpeted shapes
can be (1,1,1), (1,1,ntimes), (1,nchan,1), (nbl,1,1),
(1,nchan,ntimes), (nbl,nchan,1), (nbl,1,ntimes), or
... | |
<gh_stars>1-10
# -*- coding: utf-8 -*-
# Simple Bot (SimpBot)
# Copyright 2016-2017, <NAME> (kwargs)
import time
import re
import os
import base64
import logging
logging = logging.getLogger('simpbot')
from six.moves import _thread
from six.moves import cPickle
from six import string_types
from six import PY3
from si... | |
# Copyright 2020 <NAME>
#
# 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
... | |
<reponame>ambrop72/aprinter
#! /usr/bin/env nix-shell
#! nix-shell -i "python2.7 -B" -p python27
#Name: DeTool
#Info: Postprocessor for APrinter firmware
#Depend: GCode
#Type: postprocess
#Param: sdcard_param(float:0) Compress for SD card printing
#Param: toolTravelSpeed(float:0) Tool change travel speed (mm/s)
#Param... | |
begin_unit
comment|'# Copyright 2014 Red Hat, Inc'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'# a copy of the License at'
nl|'\n'
comment|'#'
... | |
ConfigParser.SafeConfigParser()
config_parser.read(config_ini)
try:
user_name = config_parser.get('insightfinder', 'user_name')
license_key = config_parser.get('insightfinder', 'license_key')
token = config_parser.get('insightfinder', 'token')
project_name = config_parser.get('insightfinder', 'project_name')
pro... | |
"""Routines for calculating miller indices and diffractometer positions.
Module implementing calculations based on UB matrix data and diffractometer
constraints.
"""
from copy import copy
from itertools import product
from math import acos, asin, atan, atan2, cos, degrees, isnan, pi, sin, sqrt, tan
from typing import ... | |
<gh_stars>100-1000
"""
heatpumps
"""
from math import floor, log, ceil
import pandas as pd
from cea.optimization.constants import HP_DELTA_T_COND, HP_DELTA_T_EVAP, HP_ETA_EX, HP_ETA_EX_COOL, HP_AUXRATIO, \
GHP_AUXRATIO, HP_MAX_T_COND, GHP_ETA_EX, GHP_CMAX_SIZE_TH, HP_MAX_SIZE, HP_COP_MAX, HP_COP_MIN
from cea.cons... | |
<filename>boofuzz/boofuzz/sessions.py
from __future__ import absolute_import, print_function
import datetime
import errno
import itertools
import logging
import os
import pickle
import socket
import threading
import time
import traceback
import warnings
import zlib
from builtins import input
from io import open
impor... | |
<gh_stars>0
# This file is part of thymiodirect.
# Copyright 2020 ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE,
# Miniature Mobile Robots group, Switzerland
# Author: <NAME>
#
# SPDX-License-Identifier: BSD-3-Clause
"""
Communication with Thymio via serial port or tcp
Author: <NAME>, EPFL
"""
import asyncio
import thread... | |
import re
import csv
import unicodecsv
import xlrd
from bs4 import BeautifulSoup
from openelex.base.load import BaseLoader
from openelex.models import RawResult
from openelex.lib.text import ocd_type_id, slugify
from .datasource import Datasource
class LoadResults(object):
"""Entry point for data loading.
Determi... | |
version = "0.1.0.1",
sha256 =
"050bdade2c6f0122b1a04a3833ab7eea2399ffda8258bca6d93ba6614bb202f2",
),
"texmath":
struct(
version = "0.11.1.2",
sha256 =
"373f1281832c0f397976eec8f94117d2e298443ae2591f64a92e734631224cf1",
),
"text":
struct(
version = "1.2.3.1",
sha256 =
"8360624d5d01f278da320eebd16fd5d6f366b... | |
of session affinity to use. The default is NONE. Session affinity is
not applicable if the protocol is UDP.
Possible values are `NONE`, `CLIENT_IP`, `CLIENT_IP_PORT_PROTO`, `CLIENT_IP_PROTO`, `GENERATED_COOKIE`, `HEADER_FIELD`, and `HTTP_COOKIE`.
"""
return pulumi.get(self, "session_affinity")
@session_affinity.s... | |
<filename>qca.py
N0 = 1
N1 = 278
N2 = 5736
N3 = 26752
N4 = 32786
import states as ss
import matrix as mx
import measures as ms
import h5py
import numpy as np
from mpi4py import MPI
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
from matplotlib.backends.backend_pdf import ... | |
peg, 'Example'), pRef(peg, 'Rule'))
peg['Import'] = pSeq2(pNode(pSeq(pChar('from'), pRef(peg, 'S'), pRef(peg, '_'), pEdge('name', pOre2(pRef(peg, 'Identifier'), pRef(peg, 'Char'))), pOption(
pSeq(pRef(peg, '_'), pChar('import'), pRef(peg, 'S'), pRef(peg, '_'), pEdge('names', pRef(peg, 'Names'))))), 'Import', 0), pRef... | |
# moosic.server.support.py - classes and functions that support moosicd
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, comm... | |
"""
This is a custom time parsing that use a format like: 3d50m / 3h / 30 seconds / etc.
Created since I need a custom one for everything that use this kinda thing.
This module will convert a string of text into `:cls:`arrow.Arrow format
---
MIT License
Copyright (c) 2019-2021 naoTimesdev
Permission is hereby gran... | |
# -*- coding: utf-8 -*-
from django.core.mail import send_mail
from django.core.mail import mail_admins
from django.template.loader import render_to_string
from django.template import Context, Template
from django.conf import settings
from beauty_and_pics.consts import project_constants
from itertools import chain
imp... | |
<filename>rbkcli/base/tools.py
"""rbkcli tools module."""
from __future__ import print_function
import copy
import ipaddress
import json
import logging
import os
import sys
import socket
import time
from getpass import getpass
from logging.handlers import RotatingFileHandler
from uuid import UUID, uuid4
... | |
import datetime
import logging
from itertools import count
import progressbar
import tweepy
from pymongo.errors import DuplicateKeyError
import json
from indiff.utils import sentiment, split_text
def auth(consumer_key, consumer_secret, access_token, access_token_secret):
auth_ = tweepy.OAuthHandler(consumer_key, c... | |
<reponame>liangzhengkang/tencentcloud-sdk-python
# -*- coding: utf8 -*-
# Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. 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... | |
<filename>examples-master/python_examples/maths_module.py
#!/usr/bin/env python3
# maths_module.py
#------------------------------------------------------------------------------------------------#
# This software was written in 2016/17 #
# by <NAME> <<EMAIL>>/<<EMAIL>> #
# and <NAME> <<EMAIL>> ("the authors"), #
# to... | |
"""Stops playing song and clears the queue."""
ctx.voice_state.songs.clear()
# if not ctx.voice_state.is_playing:
ctx.voice_state.voice.stop()
await ctx.message.add_reaction('⏹')
# @cog_ext.cog_slash(name="stop")
# async def _stop_slash(self, ctx: SlashContext):
# """Stops playing song and clears the queue.""... | |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | |
<gh_stars>0
#-------------------------------------------------------------------------------
# Name: dash_project.py
# Purpose:
#
# Author: <NAME>
# <NAME>
#
# Created: 30/10/2021
# Copyright: (c) ASUS 2021
# Licence: Apache 2.0
#-------------------------------------------------------------------------------
... | |
<filename>tests/test_pyaps.py
# This Python module is part of the PyRate software package.
#
# Copyright 2017 Geoscience Australia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://w... | |
import io, re, codecs, sys, os.path
import pprint
REG = 0
SHFT = 1
CTRL = 2
ALT = 4
ALTGR = 6
COMPRESSED_OUTPUT=1
def get_kbd_layout(base_filename, load_patch = False):
filename_klc = base_filename
filename_changes = base_filename + 'patch'
f = io.open(filename_klc, mode="r", encoding="utf-8")
lines = f.readlin... | |
"""
对ats数据进行处理
"""
import json
import datetime
from collections import Counter, defaultdict
from pyspark import SparkContext, SparkFiles
import uuid
import re
import time
import traceback
def get_function_dict():
function_id2name_dict = {}
function_lvl4_to_lvl3 = {}
function_lvl3_to_lvl2 = {}
function_lvl2_to_lvl... | |
<filename>applications/popart/bert/bert.py
# Copyright 2019 Graphcore Ltd.
import time
import os
import sys
import math
import ctypes
import random
import datetime
from functools import reduce
from collections import deque
from collections import defaultdict
from itertools import chain
import logging
import socket
imp... | |
= 0
waveform_polarizations =\
self.waveform_generator.frequency_domain_strain(
self.parameters.copy())
if waveform_polarizations is None:
return np.nan_to_num(-np.inf)
for interferometer in self.interferometers:
log_l += self.log_likelihood_interferometer(
waveform_polarizations, interferometer)
return log_l.r... | |
################################################################################
# TLGProb: Two-Layer Gaussian Process Regression Model For
# Winning Probability Calculation of Two-Team Sports
# Github: https://github.com/MaxInGaussian/TLGProb
# Author: <NAME> (<EMAIL>)
#################################################... | |
Only useful when datums are being emitted to the same metric stream under different units. The default is to use all matric datums in the stream, regardless of unit, which is recommended in nearly all cases. CloudWatch does not honor this property for graphs. Default: - All metric datums in the given metric stream
'''... | |
current `DataLoader` used for iteration
# - `x`/`xb`: last input drawn from `self.dl` (potentially modified by callbacks). `xb` is always a tuple (potentially with one element) and `x` is detuplified. You can only assign to `xb`.
# - `y`/`yb`: last target drawn from `self.dl` (potentially modified by callbacks). `yb` i... | |
from railrl.data_management.simple_replay_pool import SimpleReplayPool
from railrl.predictors.dynamics_model import FullyConnectedEncoder, InverseModel, ForwardModel
import tensorflow as tf
import time
import numpy as np
from sandbox.rocky.tf.optimizers.penalty_lbfgs_optimizer import PenaltyLbfgsOptimizer
from railrl.m... | |
Evidence Lower Bound. It consists of the sum of two terms:
the expected negative log-likelihood, which we approximate via
Monte Carlo; and the KL divergence, which is added via regularizer
terms which are arguments to the layer.
"""
def __init__(
self,
units,
activation=None,
activity_regularizer=None,
train... | |
1]
- self._typed_nid_range[key][:, 0])
# This is used for homogeneous node ID lookup.
max_node_map = np.maximum(self._typed_nid_range[key][:, 1], max_node_map)
# This is a vector that indicates the last node ID in each partition.
# The ID is the global ID in the homogeneous representation.
self._max_node_ids = ma... | |
def RELOP(self):
return self.getToken(STQLParser.RELOP, 0)
def INT(self):
return self.getToken(STQLParser.INT, 0)
def enterRule(self, listener:ParseTreeListener):
if hasattr( listener, "enterFrameConstraintExpr" ):
listener.enterFrameConstraintExpr(self)
def exitRule(self, listener:ParseTreeListener):
if hasa... | |
beta_index = gamma_index = None
sigma_value = pi_value = rho_value = beta_value = gamma_value = None
if problem.K2 > 0:
sigma_index = (simulation.sigma.nonzero()[0][0], simulation.sigma.nonzero()[1][0])
sigma_value = unbounded_results.sigma[sigma_index]
if problem.D > 0:
pi_index = (simulation.pi.nonzero()[0][0],... | |
<filename>src/py_scripts/fc_phasing.py
from pypeflow.common import *
from pypeflow.data import PypeLocalFile, makePypeLocalFile, fn
from pypeflow.task import PypeTask, PypeThreadTaskBase, PypeTaskBase
from pypeflow.controller import PypeWorkflow, PypeThreadWorkflow
from falcon_kit.FastaReader import FastaReader
import... | |
import logging
from logging import Logger
from pymongo import MongoClient
from pymongo import errors as pymongoErrors
from pymongo.database import Database
from bson.objectid import ObjectId
from core_api import production
from core_api.conf import PUBLISHED_ASSETS, ASSET_BIN, SETTINGS, SHOTS, PROJECT_USERS
... | |
be quickly replayed. This results in faster drawing on most
# systems but requires extra memory to record the drawing operations. In the Visualization
# module, display lists are only used during view manipulations and then their use is
# subject to the setting of *viewManipDisplayListThreshold*.
displayLists: ... | |
# Copyright 2019 The FastEstimator Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | |
update_node_id
def update_node_by_node_id(self, node_id, node_labels, node_properties):
if not node_id in list(self.get_node_ids()):
return self.UNASSIGNED_NODE_ID
node_json = self.get_node_info_dict(node_id)
update_node_id = node_json[self.DEFAULT_KEY_NODE_ID]
update_node_properties = node_json[self.DEFAULT_KE... | |
# Copyright 2019, The TensorFlow Federated 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | |
<gh_stars>0
#_*_ coding:utf-8 _*_
import os
import base64
import time
import sys
import spotipy
import json
import datetime
import io
import shutil
import googleapiclient.discovery
from gtts import gTTS
from pydub import AudioSegment
from os import mkdir
from shutil import rmtree
from os.path import join , basename ... | |
import warnings
import numpy as np
import pint as pt
warnings.filterwarnings("ignore", category=pt.errors.UnitStrippedWarning)
def u_log_law(unit,
reference_speed,
reference_height,
height,
aerodynamic_roughness,
return_without_units=True,
debug=False):
'''
Take reference values, return wind speeds at given... | |
<filename>test/py/testutils/config_mock.py
#
#
# Copyright (C) 2013 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyr... | |
# -*- coding: utf-8 -*-
#Created on Sun Mar 22 15:46:24 2015
#author: <NAME>
import numpy as _np
from clearplot import utilities as _utl
import matplotlib as _mpl
import clearplot as _cp
class Axis_Label(object):
"""
Axis label class
"""
def __init__(self, ax, orient):
"""
Instantiates an axis label object
P... | |
reçoit",
"nous recevons", "vous recevez", "ils reçoivent", "elles reçoivent",),
"réduire": ("je réduis", "tu réduis", "il réduit", "elle réduit",
"nous réduisons", "vous réduisez", "ils réduisent", "elles réduisent",),
"rejoindre": ("je rejoins", "tu rejoins", "il rejoint", "elle rejoint",
"nous rejoignons", "vous... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Must still be recoded with some cleaner code.
"""
# imports.
from dev0s.classes.config import *
from dev0s.classes import utils
from dev0s.classes.defaults.color import color, symbol
from dev0s.classes import console
from dev0s.classes.defaults.exceptions import Excep... | |
c_e)
layers = [conc]
for c in c_e:
with tf.variable_scope('nml_rf2_e_%d' % (len(layers)), reuse=reuse):
nin_shape = layers[-1].get_shape().as_list()
net = slim.conv2d(layers[-1], c, [4, 4], 2, padding='SAME',
weights_initializer=initializers.xavier_initializer(),
weights_regularizer=None,
rate=1, normalizer_fn=... | |
"""
This module contains the `Desktop` class.
This module is used to initialize AEDT and Message Manager to manage AEDT.
You can initialize this module before launching an app or
have the app automatically initialize it to the latest installed AEDT version.
"""
from __future__ import absolute_import
import os
import... | |
<filename>docs/2dplots.py<gh_stars>0
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.3
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [raw] raw_mimetype="text/restructuredtext"
# .. _panda... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.