input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
##############################################################################
# MIT License
#
# Copyright (c) 2020-2021 Her Majesty the Queen in Right of Canada, as
# represented by the President of the Treasury Board
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this softwa... | |
{}
cols = ('x', 'y')
for col, scaled_t in zip(
cols,
tf.unstack(
tft.scale_by_min_max_per_key(
tf.stack([inputs[col] for col in cols], axis=1),
inputs['key'],
output_min=-1,
output_max=1,
elementwise=False),
axis=1)):
outputs[col + '_scaled'] = scaled_t
return outputs
input_data = [{
'x': 4,
'y': 8,
'... | |
<gh_stars>1-10
import logging
import math
from dataclasses import dataclass
from typing import Union, Tuple, Optional, Collection
import torch
from torch import nn
import torch.nn.functional as F
from common.config_utils import prepare_config
from models.components.fc import SequenceMLP
from models.components.utils i... | |
<filename>detonar/new_arima_ids.py
# Python modules
import pandas as pd
import numpy as np
import math
import os
import glob
import random
from random import randint
import time as tm
from statsmodels.tsa.stattools import adfuller
from statsmodels.tsa.arima_model import ARIMA
import pmdarima as pm
from sklearn.metrics ... | |
<reponame>deeptimittal12/python-neo<filename>neo/io/blackrockio_v4.py
"""
Module for reading data from files in the Blackrock format.
This module is an older implementation with old neo.io API.
A new class Blackrock compunded by BlackrockRawIO and BaseFromIO
superseed this one.
This work is based on:
* <NAME> - firs... | |
when converting to strings.
Returns
-------
ndarray[str]
"""
raise AbstractMethodError(self)
def _formatter(self, boxed=False):
# TODO: Remove Datetime & DatetimeTZ formatters.
return "'{}'".format
# ----------------------------------------------------------------
# Array-Like / EA-Interface Methods
@pro... | |
import logging
import requests
import xml.etree.ElementTree as elementtree
from flask import Flask
from flask_ask import Ask, statement, question, session
import datetime
import time
import unidecode
troubleshooting = False
if troubleshooting: print("Troubleshooting mode is on. Additional infos to will be printed into... | |
# -*- coding: utf-8 -*-
"""
vcin_vdt_configure_from_vsphere is a script which will configure the full vCenter tree of Datacenters, Clusters and Hosts into the Nuage vCenter Integration Node and the Nuage vCenter Deployment Tool. It is also capable of configuring the ESXi hosts with the correct Agent VM settings.
This ... | |
<reponame>intel/RAAD
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# *****************************************************************************/
# * Authors: <NAME>, <NAME>
# *****************************************************************************/
"""
bufdata implements interface(s) for working with Twidl b... | |
# -*- coding: utf-8 -*-
"""
tarbell.cli
~~~~~~~~~
This module provides the CLI interface to tarbell.
"""
import codecs
import glob
import imp
import jinja2
import os
import pkg_resources
import sh
import shutil
import socket
import sys
import tempfile
import webbrowser
# Import readline without breaking process bac... | |
"""
Machine Learning Flappy Bird by <NAME> (10/23/19)
-Learns using genetic algorithms.
"""
import math, pygame, time, sys, random, numpy as np
from pprint import pprint
pygame.init()
random.seed()
randTime = int(time.time() // 1)
np.random.seed(randTime)
metersToPixels = 50
globalXVelocity = 8
class Network:
... | |
<gh_stars>1-10
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
'''IMPORTS'''
import requests
from datetime import datetime
'''GLOBAL VARS'''
PARAMS = demisto.params()
USE_SSL = not demisto.params().get('unsecure')
TENANT_ID = PARAMS.get('tenant_id')
TOKEN = PARAMS.... | |
"""Copyright [2020] [<NAME> & <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, softwa... | |
SuccessData
If the method is called asynchronously,
returns the request thread.
"""
all_params = ["rule_name", "delete_rule_data_flag"] # 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 = ... | |
Task.query.filter_by(is_delete=True,
org_id=redis_client.hget(RedisKey.user(g.gitee_id),
'current_org_id')).order_by(
Task.update_time.desc(), Task.id.asc())
def page_func(item: Task):
item_dict = TaskRecycleBinInfo(**item.__dict__).dict()
item_dict['originator'] = UserBaseSchema(**User.query.get(item.creator_id... | |
self.db_mock.commit.call_count)
self.assertEqual(1, self.db_mock.close.call_count)
expected_execute_calls = [
call(select_elements_to_drop_sql)
]
self.assertEqual(expected_execute_calls, self.cursor_mock.execute.mock_calls)
self.assertEqual(1, self.cursor_mock.close.call_count)
def test_it_should_stop_process... | |
spf=syspostfix.replace("__", "")), 100, -pi, pi),
"{fj}_phi_jet{n}".format(fj=fillJet, n=x+1), wgtVar))
defineNodes[processName][decayChannel].append( (("{proc}___{chan}___{cat}___Jet_DeepCSVB_jet{n}_{spf}"\
.format(proc=processName, n=x+1, chan=decayChannel, cat=categoryName, spf=syspostfix),
"Jet_{n} (p_{{T}} sor... | |
<filename>src/pyconmech/frame_analysis/stiffness_checker.py
"""
Python interface class for the stiffness checker backend.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import json
import warnings
from collections import defaultdi... | |
1
self.B1N2Vindx = False #Axial induced wind velocity at Blade 1, Node 2
self.B1N3Vindx = False #Axial induced wind velocity at Blade 1, Node 3
self.B1N4Vindx = False #Axial induced wind velocity at Blade 1, Node 4
self.B1N5Vindx = False #Axial induced wind velocity at Blade 1, Node 5
self.B1N6Vindx = False #... | |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'about_dialog.ui'
#
# Created: Fri Mar 30 02:47:54 2018
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
import sys
try:
_fromUtf8 = QtCore.QString.fromUtf8
excep... | |
<gh_stars>0
# Copyright 2015-2106 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 applicable law or agre... | |
<filename>spock/mcmap/mapdata.py
#Shamelessly stolen/adapted from Mineflayer
biomes = {
0: {
'display_name': 'Ocean',
'temperature': 0.5,
},
1: {
'display_name': 'Plains',
'temperature': 0.8,
},
2: {
'display_name': 'Desert',
'temperature': 2,
},
3: {
'display_name': 'Extreme Hills',
'temperature': 0.2,... | |
<reponame>svenkreiss/daft<filename>daft.py
# -*- coding: utf-8 -*-
from __future__ import division, print_function
__all__ = ["PGM", "Node", "Edge", "Plate"]
__version__ = "0.0.4-dev"
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
from matplotlib.patches import FancyArrow
from matplotlib.patc... | |
mask in cross row:
y_image = np.where(inter_order_mask[i, :] == 1)[0]
# Perform fitting with sigma-clipping:
while 1:
# Make polynomial fit:
coefs = np.polyfit(y_image, y_mean[y_image], poly_order_y)
xfit = np.polyval(coefs, y_image)
# Find sigma:
sigma = (y_mean[y_image] - xfit) / np.std(y_mean[y_image] - xf... | |
id: (required)
:param DeviceDataSourceInstanceGroup body: (required)
:return: DeviceDataSourceInstanceGroup
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['device_id', 'device_ds_id', 'id', 'body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_htt... | |
{
border-color: #aaaaaa;
background-color: #fff;
/* 2 */
text-decoration: none;
/* 3 */
outline: none;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
/* Caption
========================================================================== */
.uk-thumbnail-caption {
padding-top: 4px;
text-align: center;
color: #444... | |
# Copyright (c) Microsoft Corporation and contributors.
# Licensed under the MIT License.
import unittest
from math import sqrt
import networkx as nx
import numpy as np
import pytest
from numpy.testing import assert_equal
from graspologic.utils import remap_labels
from graspologic.utils import utils as gus
class T... | |
<gh_stars>1000+
#
# Copyright (c) 2020-2021, NVIDIA 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 required by applicab... | |
# 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.
from typing import Optional, Tuple
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq.modules... | |
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import nemo
from tqdm import tqdm
import numpy as np
import pathlib
from config import *
in_data_dir = cache_dir+'/kws_keras'
pathlib.Path(cache_dir).mkdir(parents=True, exist_ok=True)
cache_dir += '/ai_ne... | |
# -*- coding: utf-8 -*-
## Copyright 2015-2021 PyPSA Developers
## You can find the list of PyPSA Developers at
## https://pypsa.readthedocs.io/en/latest/developers.html
## PyPSA is released under the open source MIT License, see
## https://github.com/PyPSA/PyPSA/blob/master/LICENSE.txt
"""
Functionality for contin... | |
# Copyright 2017 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 required by applicable law or agreed to in writing... | |
"""
Various column classes
@author: <NAME>, <NAME>
@organization: Space Telescope - European Coordinating Facility (ST-ECF)
@license: Gnu Public Licence
@contact: <EMAIL>
$LastChangedBy: mkuemmel $
$LastChangedDate: 2008-07-03 10:27:47 +0200 (Thu, 03 Jul 2008) $
$HeadURL: http://astropy.scipy.org/svn/astrolib/trunk/as... | |
<reponame>biblecoin/pybiblecoin
####### dev hack flags ###############
verify_stack_after_op = False
# ######################################
import sys
sys.setrecursionlimit(10000)
import copy
from rlp.utils import encode_hex, ascii_chr
from biblecoin import utils
from biblecoin.abi import is_numeric
from biblecoi... | |
<reponame>kkkkv/tgnms
#!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
import asyncio
import logging
import time
from contextlib import suppress
from datetime import datetime
from typing import Any, Dict, Iterable, List, NoReturn, Optional, Set, Tuple
from croniter import croniter
from s... | |
to remove (if is member).
:return bool `True` if the user has been removed.
"""
admin = self.remove_admin(user)
user = self.remove_user(user)
return admin or user
def remove_user(self, user):
"""
Remove the regular member `user` from the group.
:param user: The user to remove (if is user).
:return bool `T... | |
<gh_stars>0
#!/usr/bin/python
# -*- coding: utf8 -*-
import matplotlib
matplotlib.use('Agg')
import numpy as np # noqa
import pandas as pd # noqa
import pandas_ml.util.testing as tm # noqa
import pandas_ml as pdml # noqa
from pandas_ml import ConfusionMatrix # noqa
from collections import OrderedDict # noqa
# =====... | |
allSqls = {
'activate_user': '''
update "TraceUser"
set "isActive" = true
where uid = %s
returning "id"
''',
'change_pwd': '''
update "TraceUser"
set "hash" = %(hash)s
where uid = %(uid)s
returning "id"
''',
'change_uid': '''
update "TraceUser"
set "uid" = %(newUid)s
where uid = %(oldUid)s
returni... | |
983658,
-1,
78321500,
983659,
78577663,
78319456,
983662,
-1,
78450528,
983663,
78644403,
77726534,
-1,
-64335,
78590836,
983733,
-64334,
78649180,
983730,
-1,
78709574,
983723,
78906549,
78590836,
983726,
-1,
78852980,
983727,
79037623,
78848842,
983731,
-1,
78979914,
983732,
79168697... | |
return self.galaxy_interactor.delete(route, data=data, admin=admin)
class DatasetPopulator(GalaxyInteractorHttpMixin, BaseDatasetPopulator):
def __init__(self, galaxy_interactor):
self.galaxy_interactor = galaxy_interactor
def _summarize_history(self, history_id):
self.galaxy_interactor._summarize_history(histo... | |
<gh_stars>1-10
import copy
import argparse
import time
import math
import numpy as np
import os
from collections import OrderedDict
import torch
import torch.optim as optim
import torch.nn as nn
import model
import utils
import dataset
# for google colab reload
import importlib
importlib.reload(model)
importlib.reloa... | |
material can be used multiple times.
materials (list of Material): a list of materials
time (convertible to float, optional): Positive integer defining the time at which the supplied parameters
correspond to.
Returns:
(Usd.Stage)
Example:
>>> vertices = torch.rand(3, 3)
>>> faces = torch.tensor([[0, 1, 2]])
>... | |
E.local_integral_model((P1,P2))
Elliptic Curve defined by y^2 + (-i)*x*y + (-25*i)*y = x^3 + 5*i*x^2 + 125*i*x + 3125*i over Number Field in i with defining polynomial x^2 + 1
"""
if len(P)==1: P=P[0]
if isinstance(P,(tuple,list)):
E=self
for Pi in P: E=E.local_integral_model(Pi)
return E
ai = self.a_invariants... | |
data and image number indexes
with PathManager.open(data_file, encoding='utf-8') as f:
self.data = json.load(f)
if len(self.data) > 0 and self.image_id_key not in self.data[0]:
# Data doesn't have a "image_id" like field so add the index in the file to the data
for idx, d in enumerate(self.data):
d[self.image_id... | |
"""Datastore model definitions and utility functions."""
import bisect
import collections
import itertools
import logging
import re
import StringIO
import sys
import time
from google.appengine.api import memcache
from google.appengine.ext import db
class Error(Exception):
pass
class InvalidExpression(Error):
pa... | |
<filename>1.0.0/hp/data.py
'''
Created on Jun 17, 2018
@author: cef
basic commands for data analyis/manipulation
most commands lie in hp.pd
here we mostly are housing the worker object
'''
#===============================================================================
# IMPORT STANDARD MODS
#=========... | |
<filename>cell_annotator/build/lib/cell_annotator/_segmentation.py<gh_stars>0
import numpy as np
import os
from skimage.filters.thresholding import threshold_otsu,threshold_local
from scipy.ndimage.morphology import binary_fill_holes, binary_closing
from skimage.morphology import remove_small_objects
from skimage.... | |
the "storage" dict, but not
# implemented yet.
},
# Possibly other service dicts, not implemented yet.
}
One can also include an "X-Auth-New-Token: true" header to
force issuing a new token and revoking any old token, even if
it hasn't expired yet.
:param req: The swob.Request to process.
:returns: swob.Resp... | |
<reponame>Walt-H/TelloPy<gh_stars>100-1000
"""
tellopy sample using joystick and video palyer
- you can use PS3/PS4/XONE joystick to controll DJI Tello with tellopy module
- you must install mplayer to replay the video
- Xbox One Controllers were only tested on Mac OS with the 360Controller Driver.
get it here -> ... | |
dtype:', I.dtype)
print('my length:', self._length)
raise Exception('error in fits_table indexing')
def copy(self):
rtn = tabledata()
for name,val in self.__dict__.items():
if name.startswith('_'):
continue
if np.isscalar(val):
#print('copying scalar', name)
rtn.set(name, val)
continue
if type(val) in [np.... | |
0, 0],
[0, 0, 0, 1, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0]], bool)
out = ndimage.binary_fill_holes(data)
assert_array_almost_equal(out, expected)
def test_binary_fill_holes03(self):
expected = numpy.array([[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0],
[0, 1, 1, 1, 0, 1, 1, 1],
[0, 1, 1, 1, 0, 1, 1, 1],
... | |
import numpy as np
import sys, os, os.path, time, gc
from astropy.table import Table, vstack, join
import matplotlib.pyplot as plt
from astropy import units as u
from scipy.optimize import curve_fit, minimize
from astropy.time import Time
import astropy.coordinates as coords
from astropy.stats import sigma_clip
from ma... | |
"""The main processing unit for all notifications
This module contains the core functions in the sms queue
"""
import csv
import re
import datetime
import uuid
import pytz
import random
import json
from dateutil.relativedelta import relativedelta
from datetime import date
from django.conf import settings
from django.... | |
<reponame>haojunqiu/mini-maze-solver
"""CSC111 final project, main module
Descriptions
===============================
This module include the class _Cell and BinaryTreeMaze.
Copyright and Usage Information
===============================
All forms of distribution of this code, whether as given or with any changes,... | |
from copy import deepcopy
from data.core import CoreData as cd
from data.equipment import EquipmentData as ed
from data.spells import SpellData as sd
from .dice import roll_dice, roll_stats
from math import floor
from random import choice, randint, randrange
import func.tools as t
# Assign stats based on pr... | |
<reponame>CDAGaming/CraftPresence-Wow-Edition
#!/usr/bin/env python
import os
import sys
def assert_compatibility(required_version=0):
"""
Determine whether the current python version matches required_version, and if not throws an exception.
"""
if sys.version_info[0] < required_version:
raise Exception("Pytho... | |
FSF filename then SaveFile without populating optFileHeader.
"""
print("\n===================================================="
"\nTestFSFSaveFile (test_fsf_014_03) : "
"\nInstantiate FSF using write utility with valid FSF filename then SaveFile "
"without populating optFileHeader.")
# Instantiate FSF Write util... | |
<gh_stars>10-100
# -*- coding: utf-8 -*-
# Copyright (C) 2004-2018 by
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# All rights reserved.
# BSD license.
#
# Author: <NAME> <<EMAIL>>
"""
Shortest path algorithms for unweighted graphs.
"""
import cynetworkx as nx
__all__ = ['bidirectional_shortest_path',
's... | |
"""Functions for multiobjective tabu search."""
import json
import numpy as np
np.set_printoptions(precision=3, linewidth=np.inf)
def hj_move(x, dx):
"""Generate a set of Hooke and Jeeves moves about a point.
For a design vector with M variables, return a 2MxM matrix, each variable
having being perturbed by elem... | |
<reponame>Prathamesh-01/Machine-Learning-Projects<gh_stars>0
# -*- coding: utf-8 -*-
"""Booston Housing.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1M5rG3LUVGLrkX9RpRC8_2iSwcgUQj6KD
---
# ***Boston Housing Project***
---
## Data Exploration
""... | |
% self.gds_format_integer(self.maxDate, input_name='maxDate'))
if self.date is not None and 'date' not in already_processed:
already_processed.add('date')
outfile.write(' date="%s"' % self.gds_format_integer(self.date, input_name='date'))
if self.minuteInterval is not None and 'minuteInterval' not in already_proces... | |
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.patch_netscan_with_http_info(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param int id: (required)
:param Netscan body:
:param str reason:
:return: ... | |
res = df.groupby(col_name)[first_col_name].count()
res = pd.DataFrame(res)
res.columns = ["count"]
res.sort_values(["count"], ascending=False, inplace=True)
res = res.append(
pd.DataFrame([df.shape[0]], index=["Total"], columns=["count"])
)
res["pct"] = (100.0 * res["count"]) / df.shape[0]
# Format.
res["count... | |
<filename>tests/unit/fileserver/test_gitfs.py
# -*- coding: utf-8 -*-
'''
:codeauthor: <NAME> <<EMAIL>>
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import copy
import errno
import os
import shutil
import tempfile
import textwrap
import tornado.ioloop
import loggin... | |
and events on it (optional)
:param must_match: A JSON hash of study field names and values that must match before showing the study as approved and running routing and events on it (optional)
"""
request_data = {
'must_match': must_match,
'uuid': uuid,
'delay': delay,
}
errors_mapping = {}
errors_mapping['DE... | |
create file button
title='Setting file:'
sttip=wx.StaticText(self.panel,-1,title,pos=(10,yloc),size=(90,18))
sttip.SetToolTipString('Select setting name(file,*setting)')
self.cmbfil=wx.ComboBox(self.panel,wx.ID_ANY,"",pos=(100,yloc-2),size=(200,hcb))
self.cmbfil.Bind(wx.EVT_COMBOBOX,self.OnSetFile)
self.cmbfil.... | |
density profiles matching your input.")
return matched_prods
def get_hydrostatic_mass_profiles(self, temp_prof: GasTemperature3D = None, temp_model_name: str = None,
dens_prof: GasDensity3D = None, dens_model_name: str = None,
radii: Quantity = None) -> Union[HydrostaticMass, List[HydrostaticMass]]:
"""
A get m... | |
escape_character: :class:`str <python:str>`
:param line_terminator: The character used to mark the end of a line.
Defaults to ``\r\n``.
:type line_terminator: :class:`str <python:str>`
:param config_set: If not :obj:`None <python:None>`, the named configuration set
to use. Defaults to :obj:`None <python:None>`.
... | |
% self.y_min
@pyqtSignature("")
def on_DefaultNodesRadioButton_clicked(self):
"""Sets x_nodes and y_nodes global variables to the default set by user in the options menu, or 25 if unchanged"""
areaselection = QMessageBox.question(self, "SOSim - Model Node Setting",
"Please confirm that the current grid resolutio... | |
<reponame>zjiayao/pyTracer
"""
material.py
Model materials
Created by Jiayao on Aug 3, 2017
"""
from __future__ import absolute_import
import os
from abc import (ABCMeta, abstractmethod)
from pytracer import *
import pytracer.geometry as geo
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from pytracer.texture im... | |
__all__ = [
"Dataset",
"forgiving_true",
"load_config",
"log",
"make_tdtax_taxonomy",
"plot_gaia_density",
"plot_gaia_hr",
"plot_light_curve_data",
"plot_periods",
]
from astropy.io import fits
import datetime
import json
import healpy as hp
import matplotlib.pyplot as plt
import numpy as np
import pandas as ... | |
the present"""
return self._wildfire_current_assessment
@property
def predicted_wildfire(self):
"""Expected fire propagation in the future"""
return self._wildfire_future_propagation
@property
def elevation(self):
"""Elevation map"""
return self._environment.raster.slice("elevation")
@property
def elevati... | |
+ " "
value = cnos.checkSanityofVariable(
deviceType, "maxpath_numbers", bgpAFArg3)
if(value == "ok"):
command = command + bgpAFArg3
else:
retVal = "Error-199"
return retVal
else:
retVal = "Error-290"
return retVal
elif(bgpAFArg1 == "network"):
command = command + bgpAFArg1 + " "
if(bgpAFArg2 == "synchron... | |
<filename>agents/agent.py
#
# Copyright (c) 2017 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 required by applic... | |
= numpy.arctan2(v1[0], -v1[1])
if abs(a1 - a0) > numpy.pi:
if a1 > a0:
a0 += 2 * numpy.pi
else:
a1 += 2 * numpy.pi
da = 0.5 * abs(a1 - a0)
d = r * numpy.tan(da) / (v0[0] ** 2 + v0[1] ** 2) ** 0.5
np = max(
2,
1
+ int(
da
/ numpy.arccos(
1 - self.tolerance / (r + 0.5 * self.widths[0, ii])
)
+ 0.5
),
)
... | |
<reponame>j-rheinheimer/HackCovid
# Programa principal, onde fica a programaรงรฃo da interface do aplicativo
from Usuarios import *
from tkinter import *
from Ficha import *
import pandas as pd
import matplotlib.pyplot as plt
import sqlite3
import csv
class Application:
def __init__(self, master=None):
self.fonte =... | |
else:
return proba[:, :, 0]
class DecisionTreeClassifier(BaseDecisionTree, ClassifierMixin):
"""A decision tree classifier.
Parameters
----------
criterion : string, optional (default="gini")
The function to measure the quality of a split. Supported criteria are
"gini" for the Gini impurity and "entropy" for ... | |
* uk_20
+ 4895 * uk_21
+ 12375 * uk_22
+ 4675 * uk_23
+ 6084 * uk_24
+ 6630 * uk_25
+ 4056 * uk_26
+ 6942 * uk_27
+ 17550 * uk_28
+ 6630 * uk_29
+ 78 * uk_3
+ 7225 * uk_30
+ 4420 * uk_31
+ 7565 * uk_32
+ 19125 * uk_33
+ 7225 * uk_34
+ 2704 * uk_35
+ 4628 * uk_36
+ 11700 * uk_37
+ 4420 * uk_38
+ 7921... | |
required parameter 'product_id' is set
if ('product_id' not in params) or (params['product_id'] is None):
raise ValueError("Missing the required parameter `product_id` when calling `get_product_cover_image`")
collection_formats = {}
resource_path = '/products/{product_id}/cover'.replace('{format}', 'json')
path... | |
def sort_list(self, field, reverse=True):
"""Sort the Mol_List according to <field>."""
self.sort(key=lambda x: _key_get_prop(x, field, reverse=reverse), reverse=reverse)
def order_props(self, order="default"):
"""Arrange the display order of the properties."""
order_props(self, order)
def sample_random(self,... | |
"build_env.bat"),
'build_drmemory-rel-32\\bin\\drmemory', '-dr_ops',
'-msgbox_mask 0 -stderr_mask 15', '-results_to_stderr', '-batch',
'-suppress', api.path["checkout"].join(
"tests", "app_suite", "default-suppressions.txt"), "--",
api.path["slave_build"].join("tsan", 'unittest', 'bin',
'racecheck_unittest-window... | |
step ์์ฑ
a = slice(5, 50, 2)
print(a.start, a.stop, a.step)
# - indices(size) ๋ฉ์๋ ์ฌ์ฉ
s = 'HelloWorld'
print(a.indices(len(s)))
for i in range(*a.indices(len(s))):
print(s[i])
# 1.12 ์ํ์ค์ ๊ฐ์ฅ ๋ง์ ์์ดํ
์ฐพ๊ธฐ
# โฃ ๋ฌธ์ : ์ํ์ค์ ๊ฐ์ฅ ๋ง์ด ๋ํ๋ ์์ดํ
์ ์ฐพ๊ณ ์ถ๋ค.
# โฃ ํด๊ฒฐ : collections.Counter ํด๋์ค์ most_common() ๋ฉ์๋๋ฅผ ์ฌ์ฉํ๋ค.
words = ['look', 'int... | |
<filename>pydent/models/plan.py
"""Models related to plans, plan associations, and wires."""
import json
from warnings import warn
from pydent.base import ModelBase
from pydent.exceptions import AquariumModelError
from pydent.marshaller import add_schema
from pydent.models.crud_mixin import DeleteMixin
from pydent.mod... | |
"""Core pandera schema class definitions."""
# pylint: disable=too-many-lines
import json
import copy
import warnings
from functools import wraps
from pathlib import Path
from typing import Callable, List, Optional, Union, Dict, Any
import pandas as pd
from . import errors, constants, dtypes
from .checks import Chec... | |
<filename>App/softwares_env/wizard/vars/defaults.py
# coding: utf-8
# Defaults Python module
import os
_reg_key_ = "SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Wizard"
_infos_file_lk_ = "https://storage.googleapis.com/wizard-files.com/beta/INFOS.json"
_wizard_url_ = 'http://www.wizard-files.... | |
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
from __future__ import absolute_import
import awkward as ak
np = ak.nplike.NumpyMetadata.instance()
def to_buffers(
array,
container=None,
partition_start=0,
form_key="node{id}",
key_format="part{partition}-{form_key}-{att... | |
#!/usr/bin/env python3
# Copyright 2013 The Meson development 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 applicab... | |
"TZzV96edNvEcv3w7BsHMPrpegN2kF37knmEZjwFgCBgA8rH/CYcOYZjnB/stE3uUv1t9Nu04"
"Cl6HpzYm/f5hld9vzNBmDLDvYZsGQyBsG2fnsyk/vONH7h8UX/oVP/rsgJUHegBAN48RsI/A"
"uO+qLz5mzuCdruCR7h/QNdQD4D2ECTBB0Qsg4IQSHwIqLg2NwAunaMIgLwvElQXFw3nM8sS3"
"9NoRBrUn/rUtfoVhcaA91Vsd0fFDD1Pg8pU3ftpafb0PeD2/fHNcegYpgxY/8eooX4ZkWdV5"
"GJ0y1wOg+Lz3ovD... | |
import copy
import csv
import numpy as np
import traceback
import requests
import json
import time
import boto
import alog
import logging
from boto.s3.key import Key
from StringIO import StringIO
from datetime import datetime
from django.db.utils import IntegrityError
from firecares.utils.arcgis2geojson import arcgis2g... | |
%s %s" % (p[5], p[1], p[2], p[6], p[5])
face2 = "%s %s %s %s %s" % (p[6], p[2], p[3], r[1], p[6])
face3 = "%s %s %s %s %s" % (r[1], p[3], p[0], r[0], r[1])
if openings:
holes, opns = wallOpeningOrganiser(openings)
else:
holes = None
opns = None
if embrasure and openings:
embO = embrasuresGeometry(openings, p... | |
<gh_stars>10-100
#!/usr/bin/env python3
# -*- coding:utf-8; mode:python3; indent-tabs-mode:nil; tab-width:4; -*-
""" Cached JSONized ATS files retrieved as JSON objects.
JSON data may also be returned to stdout, for use from the command line.
"""
import json
import os
import subprocess
import sys
from . import env... | |
<reponame>sforazz/nipype
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import pickle
import os.path as op
import numpy as np
import nibabel as nb
import networkx as nx
from ... import logging
from ...utils.filemanip import spl... | |
"SystemKey" / Int32ul
)
@declare(guid=guid("a0b7550f-4e9a-4f03-ad41-b8042d06a2f7"), event_id=2114, version=0)
class Microsoft_WindowsPhone_CoreUIComponents_2114_0(Etw):
pattern = Struct(
"unParam" / Int32ul
)
@declare(guid=guid("a0b7550f-4e9a-4f03-ad41-b8042d06a2f7"), event_id=2115, version=0)
class Microsoft_W... | |
to match phase with constant freq
corr_phase_0 = np.remainder( 2 * np.pi * f1 / beta, 2 * np.pi )
omega_sweep_t = ( 2 * np.pi * f1 ) / beta * np.exp( beta * tvec ) - corr_phase_0
freq_sweep = np.sin( omega_sweep_t )
if sweep_direction == 0:
freq_sweep = np.flip(freq_sweep)
y = freq_sweep
return y
def gen_... | |
"""
author: <NAME>
created: 11/13/2016
execution.py is concerned with the compilation and execution of C++ and Java files on the fly (the output of the program is returned as a string, but compiled and/or object files are deleted upon completion). Since using VMs would be too slow for our purposes, the code is execute... | |
<reponame>equitensor/EquiTensor_2021<gh_stars>1-10
# Downstream: bikeshare prediction
# two modes:
# --- No exogenous data
# --- Oracle network
# The model consists of a 3d cnn network that uses
# historical ST data to predict next hour bike demand
# users can choose not to use any features, or
# to use arbitrary numb... | |
<reponame>mwregan2/MiriTE
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Module amplifier_properties - Defines the properties of the MIRI SCA
detector readout amplifiers.
The properties are stored in a list of Python dictionaries.
NOTE: This legacy module is not currently used by SCASim. It may be used
in the fut... | |
# -*- coding: utf-8 -*-
#
# <NAME>
# orthologue
# (c) 1998-2020 all rights reserved
#
# externals
import re
import operator
import collections
from .. import patterns
# my base class
from .SymbolTable import SymbolTable
# declaration
class Hierarchical(SymbolTable):
"""
Storage and naming services for algebraic n... | |
<reponame>jtbr/tv-news-quality
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created Oct 2018
@author: Justin
#
# Adjudicate.py can be used to do various things with the labeled snippets for given batches in the mongo database snippetlabels
# (you choose by commenting/uncommenting in main())
#
# 1) Show label pai... | |
array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
"""
return pulumi.get(self, "values")
def _translate_property(self, prop):
return _tables.CAM... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.