input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<reponame>Robor-Electronics/pigweed<filename>pw_console/py/pw_console/log_pane.py
# Copyright 2021 The Pigweed 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.o... | |
import time
from datetime import datetime
from os.path import join as path_join
from math import log, floor
import click
import matplotlib
import matplotlib.ticker as ticker
matplotlib.rcParams['font.family'] = 'serif'
matplotlib.rcParams['mathtext.fontset'] = 'cm'
import matplotlib.pyplot as plt
import matplotlib.p... | |
<reponame>abhish3k-11/Biomedical-research<filename>gui.py
# imports
from tkinter import *
# from Tkinter import messagebox
from PIL import Image, ImageTk
import datetime
import threading
from imutils.video import WebcamVideoStream
import cv2
import time
import numpy as np
import math
import socket
from pydr... | |
#
# Copyright (c) 2020, 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 applicable law or agreed to i... | |
# BSD 3-Clause License; see https://github.com/jpivarski/doremi/blob/main/LICENSE
from fractions import Fraction
from dataclasses import dataclass, field
from typing import List, Tuple, Dict, Optional, Union, Generator
import lark
import doremi.parsing
def is_rest(word: str) -> bool:
return all(x == "_" for x in ... | |
storage'],
'tivoli storage manager fastback center': ['tivoli storage'],
'tivoli storage manager fastback for bare': ['tivoli storage'],
'tivoli storage manager fastback for bare machine': ['tivoli storage'],
'tivoli storage manager fastback for bare machine recovery': [ 'tivoli '
'storage'],
'tivoli storage mana... | |
$DigitValue[text.charCodeAt(p)];
accum |= k << bits_in_accum;
bits_in_accum += bits_per_char;
if (bits_in_accum >= PyLong_SHIFT) {
this.ob_digit[pdigit] = accum & PyLong_MASK;
pdigit++;
accum >>>= PyLong_SHIFT;
bits_in_accum -= PyLong_SHIFT;
}
}
if (bits_in_accum) {
this.ob_digit[pdigit++] = accum;
}
while... | |
# Copyright 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://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying... | |
:return: string or None
"""
return self._get_aad_tenant_id(enable_validation=True)
def _get_aad_admin_group_object_ids(self, enable_validation: bool = False) -> Union[List[str], None]:
"""Internal function to obtain the value of aad_admin_group_object_ids.
This function supports the option of enable_validation. ... | |
if plan.to_date < from_dt or plan.from_date > to_dt:
plan = None
if qty:
if plan:
if not qty == plan.quantity:
if plan.from_date >= from_dt and plan.to_date <= to_dt:
plan.quantity = qty
plan.save()
else:
if plan.from_date < from_dt:
new_to_dt = from_dt - datetime.timedelta(days=1)
earlier_plan = ProductPlan... | |
= [0, 0]
for _ in sm.xrange(400):
observed = aug.augment_image(np.zeros((20, 20, 3), dtype=np.uint8))
sums = np.sum(observed, axis=2)
values = np.unique(sums)
all_values_found = all([(value in values) for value in [0, 1, 2, 3]])
if all_values_found:
seen[0] += 1
else:
seen[1] += 1
assert 150 < seen[0] < 250
... | |
<reponame>ArenaNetworks/dto-digitalmarketplace-supplier-frontend
# coding: utf-8
from __future__ import unicode_literals
import urllib2
from app.main.helpers.users import generate_supplier_invitation_token
from dmapiclient import HTTPError
from dmapiclient.audit import AuditTypes
from dmutils.email import generate_t... | |
1
self.to_be_inserted.append([iid, [the_focus, vout, 'collection']])
# self.qr.put(('PRINT', 'to be inserted ={}'.\
# format(self.to_be_inserted[-1])))
thisdir = iid
e_focus = self.trout.find(".//" + the_focus)
e_parent = etree.SubElement(e_focus, iid)
e_parent.text = 'collection'
# self.qr.put(('PRINT', 'e_focus ... | |
"""
ui.dialogs.race
Contains all the data and capabilities needed for race creation.
:author: <NAME>
:license: MIT, see LICENSE.txt for more details.
"""
from PySide.QtGui import QDialog
from PySide.QtGui import QBoxLayout
from PySide.QtGui import QLineEdit
from PySide.QtGui import QComboBox
from PySide.QtGui imp... | |
<reponame>edavalosanaya/SKORE<filename>Software/python/config_dialog.py
# General Utility Libraries
import sys
import os
import warnings
# PyQt5, GUI Library
from PyQt5 import QtCore, QtGui, QtWidgets
# Serial and Midi Port Library
import rtmidi
import serial
import serial.tools.list_ports
# SKORE Library
from lib_s... | |
<filename>tumor_seg.py
from PyQt5 import QtGui, QtWidgets
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QMainWindow, QFileDialog
import cv2 as cv
import os
from Ui_tumor import Ui_tumor_seg
import imageio
import numpy as np
import PIL.Image as Image
import torch
import torch.nn as nn
import time
from Py... | |
bits // 8)
print(" * encoded s({}) = {}{}{}".format(len(s_bin) * 8, color_green, xx(s_bin), color_norm))
assert sign == r_point_bin + encode_bigint_le(s, bits // 8)
pk_point = Ed25519Point.decode(public_key)
test_point = r_point + (pk_point * hash_for_s)
print(" * test point = B*r + Pubkey*hash: {}{}{}".format(col... | |
from datetime import datetime, date
from unittest import skipIf
from django.db.models.functions import Upper
from django.test import TestCase
from django.utils.timezone import now
from django_pg_bulk_update.clause_operators import InClauseOperator
from django_pg_bulk_update.compatibility import jsonb_available, hstor... | |
<reponame>nutofem/fenics_helpers<filename>fenics_helpers/rk.py
# -*- coding: utf-8 -*-
"""Runge Kutta methods."""
import numpy as np
from numpy import array
from numpy.lib.scimath import sqrt
import dolfin as d
import ufl
def _change_stepsize(h, err, q, f=0.8, fmin=0.1, fmax=5.0, stepMin=0, stepMax=np.Inf):
"""
Ar... | |
08:07:00,0.34,65.0,0.96
1482,6,28400.0,248,Work and Education,1970-01-01 08:08:00,38.5,2597.0,38.43
1483,10,27265.0,248,Leisure,1970-01-01 08:08:00,36.97,2484.0,36.76
1484,11,8355.0,248,Travel and Other,1970-01-01 08:08:00,11.33,687.0,10.17
1485,3,6159.0,248,Housework,1970-01-01 08:08:00,8.35,685.0,10.14
1486,4,33... | |
"""
# Controller for Line-Following Robot
# This runs on an Adafruit Feather M4, with a MiniTFT board.
# It drives a TB6612 to control 2 DC Motors (in blue servo case)
# and talks over I2C to an ItsyBitsy that interfaces a Pololu
# line following sensor
#
# Author(s): <NAME>
# Module: mode_config.py generates and man... | |
'A069330', 'A049120', 'A114810', 'A054040', 'A066670',
'A144960', 'A101490', 'A037330', 'A011790', 'A073110', 'A102710', 'A149950', 'A170920', 'A027580',
'A250930', 'A094970', 'A056700', 'A031330', 'A178780', 'A090740', 'A104830', 'A105330', 'A278280',
'A033640', 'A155650', 'A123860', 'A036830', 'A120110', 'A089010'... | |
93, 734, 929, 68)
model.createElement(80, 739, 740, 935, 934, 734, 735, 930, 929)
model.createElement(81, 740, 741, 936, 935, 735, 736, 931, 930)
model.createElement(82, 741, 742, 937, 936, 736, 737, 932, 931)
model.createElement(83, 742, 743, 938, 937, 737, 738, 933, 932)
model.createElement(84, 743, 172, 145, 938, 73... | |
def checkBlogforEVA(self, dt):
iss_blog_url = 'https://blogs.nasa.gov/spacestation/tag/spacewalk/'
def on_success(req, data): #if blog data is successfully received, it is processed here
logWrite("Blog Success")
soup = BeautifulSoup(data, "lxml")
blog_entries = soup.find("div", {"class": "entry-content"})
b... | |
frequencies = C.MICMat((1, 1, H, 2*(W/2 + 1))).offload_mic().fill_zeros()
pooled_frequencies = C.MICMat((1, 1, band_H, 2*(band_W/2 + 1))).offload_mic().fill_zeros()
inputs.fft(pooled_frequencies)
pooled_frequencies.wipe_out_irrelevant_entries()
frequencies.low_pass_filter_gradient(pooled_frequencies, band_H, band_... | |
+ "': for '" +
self.headopts.required_system + "', this system is '"
+ systemtype + "'")
return [ False, True ]
return [ True, False ]
def close(self, forcePreserve):
self.runfile.close()
if self.exedir and self.dircreated and \
not self.args.preserve and not forcePreserve:
os.chdir('..')
shutil.rmtree(self.... | |
# Copyright 2013-2014 <NAME> Licensed under the
# Educational Community 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.osedu.org/licenses/ECL-2.0
#
# Unless required by applicable law or agreed to in writi... | |
from operator import itemgetter
import collections
from collections import deque, Counter
import re
import fitz
from docx import Document
class DocumentParser:
@staticmethod
def fonts(doc, granularity=False):
"""
Extracts fonts and their usage in PDF documents
:param doc: PDF document to iterate through
:para... | |
parte'),
('G00.0', 'Meningite por Haemophilus'),
('G00.1', 'Meningite pneumocócica'),
('G00.2', 'Meningite estreptocócica'),
('G00.3', 'Meningite estafilocócica'),
('G00.8', 'Outras meningites bacterianas'),
('G00.9', 'Meningite bacteriana não especificada'),
('G01', ' *Meningite em doenças bacterianas classific... | |
stop=stop, delete=delete, delay=delay, overrides=overrides, info=info, snapshot=snapshot,
revert=revert, update=update)
return 0
def repo(args):
"""Create/Delete repo"""
repo = args.repo
delete = args.delete
url = args.url
update = args.update
baseconfig = Kbaseconfig(client=args.client, debug=args.debug)
if... | |
SymbolicConstant specifying the background style to be used for all viewport windows.
# Possible values are SOLID and GRADIENT. The default value is SOLID.If
# *backgroundStyle*=SOLID, the viewport background will appear as a solid color as
# specified by *backgroundColor*. If *backgroundStyle*=GRADIENT, the view... | |
# 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... | |
parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/relay-agent', defining_module='openconfig-relay-agent', yang_type='container', is_config=True)
except (TypeError, ValueError):
raise ValueError({
'error-string': """age... | |
from collections.abc import Container, Iterable, Mapping
from copy import deepcopy
from datetime import datetime
import json
import os
import shutil
import time
from fair_research_login import NativeClient
from globus_nexus_client import NexusClient
import globus_sdk
from globus_sdk.response import GlobusHTTPResponse
... | |
"2147483647",
"min_val": "64", "setting": "8192", "sourcefile": "/var/lib/pgsql/10/data/postgresql.auto.conf",
"unit": "kB", "vartype": "integer", "val_in_bytes": 4194304 } }
contains:
setting:
description: Current value of the parameter.
returned: always
type: str
sample: 49152
unit:
description: Implicit un... | |
"""#### GUI
Module gathers all functions, classes and methods necessary to create GUI. Its
parts are divided for separate blocks represented by classes `Search`, `Form`,
`Buttons` and `Image` where each of them extends `tkinter.Frame`. `Searchbox`
is extended `tkinter.Combobox` class to application needs. `Gui` connec... | |
#coding:utf-8
# Copyright (c) 2019 PaddlePaddle 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 require... | |
#!/usr/bin/env python3
#
# Copyright 2016 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 b... | |
= Var(within=Reals,bounds=(0,1),initialize=0)
m.x3157 = Var(within=Reals,bounds=(0,1),initialize=0)
m.x3158 = Var(within=Reals,bounds=(0,1),initialize=0)
m.x3159 = Var(within=Reals,bounds=(0,1),initialize=0)
m.x3160 = Var(within=Reals,bounds=(0,1),initialize=0)
m.x3161 = Var(within=Reals,bounds=(0,1),initialize=0)
m.x3... | |
the name for a variable index, making sure to replicate the new name with
a unique stringwhich corresponds to the variable, index combination.
Parameters
----------
value : str
Unique name of the node.
Returns
-------
self : Node
This node.
Raises
------
ValueError
If an node with `value` already exists... | |
# Mass transfer
0., # Always part of main galaxy
0., # CGM -> main galaxy -> CGM
])
expected = np.array([
1, # Merger, except in early snapshots
0, # Mass Transfer
0, # Always part of main galaxy
0, # CGM -> main galaxy -> CGM
]).astype( bool )
actual = self.classifier.identify_merger()
npt.assert_allclos... | |
import numpy as np
from matplotlib import rc
## for Palatino and other serif fonts use:
rc('font',**{'family':'serif','serif':['Computer Modern Roman']})
rc('text', usetex=True)
import matplotlib.pyplot as plt
import time
#NLL plotting
def nll_plot(nll_mean_list1,nll_var_list1,nll_mean_list2,nll_var_list2,nll_mean_li... | |
order to be converted lossless to Decimal.
:param step: Decimal|str, the (relative) step size to set
:param dynamic_stepping: bool, flag indicating the use of dynamic stepping (True) or
constant stepping (False)
"""
try:
step = D(step)
except TypeError:
if 'int' in type(step).__name__:
step = int(step)
elif ... | |
#!/usr/bin/env python
# coding: utf-8
import re
import operator
operators = {
'+': operator.add,
'-': operator.sub,
'*': operator.mul,
'/': operator.truediv,
}
op_precedences = [
# extract content between innermost parentheses - highest precedence
r'\(\s*([^()]+)\)',
# extract higher precedence operator (* o... | |
from copy import copy, deepcopy
from datetime import timedelta
from unittest import mock
import pytest
from ticts import TimeSeries
from ticts.utils import MAXTS, MINTS
from .conftest import CURRENT, HALFHOUR, ONEHOUR, ONEMIN
class TestTimeSeriesInit:
def test_with_dict(self, smalldict):
ts = TimeSeries(smalldic... | |
Union[str, Callable[[Tensor], Tensor]] = F.relu,
layer_norm_eps: float = 1e-6,
batch_first: bool = True,
norm_first: bool = True,
device=None,
dtype=None) -> None:
factory_kwargs = {'device': device, 'dtype': dtype}
super().__init__(
d_model,
nhead,
dim_feedforward=dim_feedforward,
dropout=dropout,
activati... | |
# This program was generated by "Generative Art Synthesizer"
# Generation date: 2021-11-28 02:06:28 UTC
# GAS change date: 2021-11-28 01:31:12 UTC
# GAS md5 hash: c291ffb9de6ad6dea37797c00163f591
# Python version: 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# For more informat... | |
<gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
from tqdm import trange
from htm.bindings.sdr import SDR
from htm.bindings.algorithms import TemporalMemory
from htm.bindings.algorithms import SpatialPooler
from itertools import product
from copy import deepcopy
import json
EPS = 1e-12
class Memory:... | |
<gh_stars>100-1000
# Copyright (c) 2018-2021, NVIDIA Corporation
# 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 copyright notice, this
... | |
# Copyright 2020 AstroLab Software
# Author: <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 agr... | |
__author__ = 'langoureaux-s'
import init
import os
import shutil
import unittest
class InitTestCase(unittest.TestCase):
"""Tests for `init.py`."""
#@classmethod
def setUp(self):
print("Settup unit test \n")
shutil.copytree("test/fixtures/", "test/tmp/conf/");
os.makedirs("test/tmp/bin/linux-x86-64")
shutil.c... | |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import torch
import torch.nn as nn
import numpy as np
import torch.optim as optim
import os
import six
from six.moves import cPickle
import pickle
bad_endings = ['with','in','on','of','a','... | |
<reponame>athenianco/athenian-api<filename>server/athenian/api/models/web/jira_epic_issue_common.py<gh_stars>1-10
from datetime import datetime, timedelta
from typing import Optional
from athenian.api.models.web.base_model_ import Model
class JIRAEpicIssueCommon(Model):
"""Common JIRA issue fields."""
openapi_typ... | |
60.92*m.x369 - 60.92*m.x378 - 60.92*m.x395 - 47.68*m.x406
- 47.68*m.x424 - 47.68*m.x438 - 47.68*m.x449 - 1.76*m.x460 - 1.76*m.x478 - 1.76*m.x495
- 1.76*m.x502 - 1.76*m.x511 - 1.76*m.x522 - 24.98*m.x543 - 24.98*m.x558 - 24.98*m.x566
- 24.98*m.x583 + 9.12*m.x604 + 9.12*m.x628 + 9.12*m.x635 + 9.12*m.x644 + 9.12*m.x655
... | |
{
"basetype" : "Enumeration",
"normal" : {
"nodetype" : "namednumber",
"number" : "0"
},
"immediate" : {
"nodetype" : "namednumber",
"number" : "1"
},
"fast" : {
"nodetype" : "namednumber",
"number" : "2"
},
},
},
"access" : "readwrite",
"description" :
"""""",
}, # column
"multicastPortLeaveTimeout... | |
],
[ [ SP(0x2BBC), M(0x2BBC,0xBC), M(0x2BBD,0x1B), F(0x00) ], [ 0xD0 ], 11, [ (PC == 0x1BBC), (SP == 0x2BBE) ], "RET NC (jump)" ],
[ [ SP(0x2BBC), M(0x2BBC,0xBC), M(0x2BBD,0x1B), F(0x01) ], [ 0xD0 ], 5, [ (PC == 0x0001), (SP == 0x2BBC) ], "RET NC (no jump)" ],
[ [ SP(0x2BBC), M(0x2BBC,0xBC), M(0x2BBD,0x1B), F(0x40) ... | |
<gh_stars>0
# -*- encoding: utf-8 -*-
"""
License: MIT
Copyright (c) 2019 - present AppSeed.us
"""
from django.contrib.auth.models import Group, User
from django.contrib.auth.decorators import login_required
from django.db import models
from django.shortcuts import render, get_object_or_404, redirect
from django.templ... | |
"""
if self._free_points == True and self.c_points:
if self.c_points.contents.alloc_points > 0:
#print("G_free(points) [%i]"%(self.c_points.contents.alloc_points))
libgis.G_free(self.c_points.contents.x)
libgis.G_free(self.c_points.contents.y)
if self.c_points.contents.z:
libgis.G_free(self.c_points.contents.z)
... | |
_url = "https://console.jumpcloud.com/api/systemusers/" + str(user_id)
response_json = get_response_json(_url)
return response_json
def get_systemusers_json():
"""return: json get_systemusers_json_multi."""
skip = 0
limit = 100
data = get_systemusers_json_multi(skip, limit)
totalcount = data['totalCount']
res... | |
<filename>susi/SOMEstimator.py
"""SOMEstimator class.
Copyright (c) 2019-2021 <NAME>.
All rights reserved.
"""
from abc import ABC, abstractmethod
from typing import List, Optional, Sequence, Tuple, Union
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.utils.validation import check_array, che... | |
weightings of each vector field towards the search, e.g. image\_vector\_ weights 100%, whilst description\_vector\_ 50%.
Advanced search also supports filtering to only search through filtered results and facets to get the overview of products available when a minimum score is set.
Args:
collection_name:
Name of... | |
# -*- coding: utf-8 -*-
"""
Find cuts of a page and annotate them based on the table separators
Copyright Naver Labs Europe 2018
<NAME>
Developed for the EU project READ. The READ project has received funding
from the European Union's Horizon 2020 research and innovation programme
under grant agreement... | |
<gh_stars>1-10
#!/usr/bin/env python
# coding: utf-8
# # **World Cup 2018 Prediction by <NAME>**
#
# The purpose of this is to try and predict the top 3 teams for World Cup 2018 using classification models coupled with poisson distribution to predict the exact results of the semi-finals, third place playoff and final... | |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'MFyolo\ui\YOLOdetect_2.0.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from asyncio.windows_events import NULL
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets impo... | |
< ind[i]):
var = np.abs(y_linear[j]-ds[i-1])
if var > tolerance*np.abs(ds[i-1]):
out=True
j +=1
# if one point is outside the interval, use zero interpolation
# for the segment
if out:
for j in range(last_ind+1, ind[i]):
y[j] = y_zero[j]
last_ind = ind[i]
return y
def combined_fixed_recon(ds, ind, threshold,... | |
Solutions Inc.",
"001D04": "Zipit Wireless, Inc.",
"001D05": "iLight",
"001D06": "HM Electronics, Inc.",
"001D07": "Shenzhen Sang Fei Consumer Communications Co.,Ltd",
"001D08": "JIANGSU YINHE ELECTRONICS CO., LTD",
"001D09": "Dell Inc",
"001D0A": "Davis Instruments, Inc.",
"001D0B": "Power Standards La... | |
from an edge from the graph and make them a dictionary.
node1 - The name of the first node.
node2 - The name of the second node.
"""
return self.graph.get_edge_data(node1, node2)
# attrList = self.graph.edge_attributes((node1, node2))
# for attr in attrList:
# if type(attr) == type({}):
# retval = attr
... | |
periods (yrs) of interest
nb_steps = 1000 # Enter discretization of the circle in the normal space (optional)
# Non-Parametric Clayton copula contour generation example
Hs_Return, T_Return = NonParaClayton46022.getContours(Time_SS, Time_r,nb_steps)
'''
self.time_ss = time_ss
self.time_r = time_r
self.n... | |
Algorithms: 文件压缩算法
gzip:指定 GZIP 压缩
brotli:指定Brotli压缩
注意:此字段可能返回 null,表示取不到有效值。
:type Algorithms: list of str
"""
self.Compress = None
self.FileExtensions = None
self.MinLength = None
self.MaxLength = None
self.Algorithms = None
def _deserialize(self, params):
self.Compress = params.get("Compress")
self.File... | |
<gh_stars>1-10
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from sqlalchemy.dialects.postgresql import ARRAY
f... | |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# ---------------------------------------------------------------------------
# ___ __ __ __ ___
# / | \ | \ | \ / Automatic
# \__ |__/ |__/ |___| \__ Annotation
# \ | | | | \ of
# ___/ | | | | ___/ Speech
#
#
# http://www.sppas.org/
#
# ------------------------------------... | |
"""Problems related to graphs such as Conway's 99 problem, finding
[cliques](https://en.wikipedia.org/wiki/Clique_(graph_theory)) of various sizes, shortest path (Dijkstra) """
from puzzle_generator import PuzzleGenerator
from typing import List
# See https://github.com/microsoft/PythonProgrammingPuzzles/wiki/How-to... | |
class Shield:
def __init__(self):
self.s7 = 0
self.s6 = 0
self.s5 = 0
self.s4 = 0
self.s3 = 0
self.s2 = 0
self.s1 = 0
self.s0 = 0
def tick(self, inputs):
depth7 = inputs[0]
depth6 = inputs[1]
depth5 = inputs[2]
depth4 = inputs[3]
depth3 = inputs[4]
depth2 = inputs[5]
depth1 = inputs[6]
k2 = inputs[7... | |
colours);
(3) ferrous-bearing carbonates (warm colours) potentially associated with metasomatic “alteration”;
(4) calcite/dolomite which are ferrous iron-poor (cool colours); and
(5) epidote, which is ferrous iron poor (cool colours) – in combination with FeOH content product (high).""",
# The WMS name for the laye... | |
# store nodes that have been visited
At = T # the node of current position in tracing
NodeColor[VrtxCmpnt[T]] = 1
while(not At in Branching and not At in Special):
Visited.append(At)
for Nbr in TreeNbr[At]:
if not Nbr in Visited: # search toward the mainstream
Trace.append((Nbr, At))
Previous = At # the node vi... | |
<reponame>EasternEdgeRobotics/2018<gh_stars>0
#!/usr/bin/python
import sys
import subprocess
import os.path
import math
#===============================================================================
def print_usage():
print \
"""
Usage: trim_map.py <infile> <outfile> <out-info-file> \\
-keep <bottom-lat> <top-la... | |
None
#: Security definitions from Security Definitions Object
#:
#: key: security name, value: SecurityDefinition object
security_definitions = None
#: Represents tag descriptions from Swagger Tag Object
#:
#: key: tag name, value: dict with keys ``description`` and ``externalDocs``
tag_descriptions = None
... | |
auto_download=auto_download,
),
WikidatedV1_0SortedEntityStreamsFile(
archive_path=dataset_dir / (prefix + "p43008825-p43151391.7z"),
page_ids=range(43008825, 43151392),
darus_id=94898,
sha1="0cf7f6075eb60646ca10b3bc7a35ee8f63bbc365",
size=265137675,
auto_download=auto_download,
),
WikidatedV1_0SortedEntitySt... | |
the setpoint.
Converts the requested energy to the real position of the alio,
and also converts that energy to eV and passes it along to
the vernier.
"""
pseudo_pos = self.PseudoPosition(*pseudo_pos)
energy = pseudo_pos.energy
alio = self.energy_to_alio(energy)
vernier = energy * 1000
return self.RealPosition... | |
# Copyright 2015, 2017 IBM Corp.
#
# 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 ... | |
+= '#EXTINF:-1 tvg-id="%s" tvg-name="%s" tvg-logo="%s/%s/%s.png" channel-id="%s" group-title="LIVE",%s\n' % (
chan_map[pos].channum, chan_map[pos].channame, SERVER_HOST, SERVER_PATH, chan_map[pos].channum,
chan_map[pos].channum,
prog.title)
new_playlist += '%s\n' % channel_url
except:
logger.ex... | |
assert(g.match(s, i, '('))
while i < n:
c = s[i]
if c == '(':
level += 1; i += 1
elif c == ')':
level -= 1
if level <= 0: return i
i += 1
elif c == '\'' or c == '"': i = g.skip_string(s, i)
elif g.match(s, i, "//"): i = g.skip_to_end_of_line(s, i)
elif g.match(s, i, "/*"): i = g.skip_block_comment(s, i)
els... | |
<gh_stars>0
import kivy
kivy.require('1.9.1') # replace with your current kivy version !
############
#per installare i garden components
#C:\Users\<NAME>\Downloads\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\Scripts
#https://docs.scipy.org/doc/numpy/f2py/index.html
#!python garden install nomefile
############
from... | |
"""
Reference tag taxonomy
======================
References are built up by tokens which come in four groups "axis", "value",
"general expression", and "named_entity"; i.e.
Each group has several possible tag-values
1) axis: Specifies the type of referred snippet.
Implemented by class RefAxis
E.g.: Article, Absatz,... | |
<gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# [Part I: On-policy learning and SARSA (3 points)](#Part-I:-On-policy-learning-and-SARSA-(3-points))
#
# [Part II: Experience replay (4 points)](#Part-II:-experience-replay-(4-points))
#
# [Bonus I: TD($ \lambda $) (5+ points)](#Bonus-I:-TD($\lambda$)-(5+-points))
#... | |
def stop_execution(self):
"""
Triggers the stopping of the object.
"""
if not (self._stopping or self._stopped):
for actor in self.owner.actors:
actor.stop_execution()
self._stopping = True
def is_stopping(self):
"""
Returns whether the director is in the process of stopping.
:return:
"""
return self._st... | |
base path while still using different user data directories for
# different channels (Stable, Beta, Dev). For existing users who only have
# chrome-profile, continue using CHROME_USER_DATA_DIR so they don't have to
# set up their profile again.
chrome_profile = os.path.join(CONFIG_DIR, "chrome-profile")
chrome_con... | |
import os
from datetime import datetime, timedelta, timezone, date
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from torch.utils.tensorboard import SummaryWriter
from src.loss import JointsMSELoss
from src.model import *
from src.dataset import *
from src.util import ... | |
2] + k[3, 2]
K[6 * i + 3, 6 * i + 3] = K[6 * i + 3, 6 * i + 3] + k[3, 3]
K[6 * i + 3, 6 * i + 4] = K[6 * i + 3, 6 * i + 4] + k[3, 4]
K[6 * i + 3, 6 * i + 5] = K[6 * i + 3, 6 * i + 5] + k[3, 5]
K[6 * i + 3, 6 * j] = K[6 * i + 3, 6 * j] + k[3, 6]
K[6 * i + 3, 6 * j + 1] = K[6 * i + 3, 6 * j + 1] + k[3, 7]
K[6 * i +... | |
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# %% [markdown]
# # How to use custom data and implement custom models and metrics
# %% [markdown]
# ## Building a simple, first model
# %% [markdown]
# For demonstration purposes we will choose a simple fully connected model. It take... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2020-2022 Barcelona Supercomputing Center (BSC), Spain
#
# 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/lic... | |
4.5],
[24.5, 68.0, 35.5, 112.0],
# [2, 4, 24.6, 8],
[-9.8, 0.5, 13.8, 7.5]
]) # (xmin, ymin, xmax, ymax)
boxlist2 = np.array([[1, 1, 5, 8, np.pi/16],
# [1, 1, 5, 8, np.pi/16 + np.pi/10]
# [1, 1, 10, 5, 0],
[30, 90, 12, 45, np.pi/10],
[5, 4, 26, 8.2, np.pi/2 + np.pi/10.]
])
polys2 = RotBox2Polys(boxlist2)
ta... | |
str(line)
p = locals()[name].predict(s)
predicted = np.append(predicted,p)
else:
s = dec.loc[i,'BPA_wind':]
s = np.reshape(s[:,None],(1,n))
name='dec_reg_NW' + str(line)
p = locals()[name].predict(s)
predicted = np.append(predicted,p)
NWPaths_p[:,line_index] = predicted
# Residuals
residuals = pred... | |
= 'pending'
def _full_parse(self, filepath=None):
"""
Fully parse the input pfile.
Attempts to import pfile version specific parser from pfile submodule. Full parse is
not possible without access to the pfile submodule.
Does not work if input file is a tgz. If NIMSPfile was init'd with a tgz input, the tgz can... | |
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
from pkg_resources import parse_version
import kaitaistruct
from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO
from enum import Enum
if parse_version(kaitaistruct.__version__) < parse_version('0.9'):
raise E... | |
'''
====================================================================
(c) 2003-2016 <NAME>. All rights reserved.
This software is licensed as described in the file LICENSE.txt,
which you should have received as part of this distribution.
====================================================================
w... | |
<reponame>bmdepesa/validation-tests
from common_fixtures import * # NOQA
logger = logging.getLogger(__name__)
def create_environment_with_dns_services(client,
service_scale,
consumed_service_scale,
port, cross_linking=False,
isnetworkModeHost_svc=False,
isnetworkModeHost_consumed_svc=False):
if not isnetworkMo... | |
properties[idx]["rms_force"] = force
properties[idx]["rms_displacement"] = rms_displacements[idx]
if extended_opt_info:
if idx < len(max_forces):
properties[idx]["max_force"] = max_forces[idx]
if idx < len(max_displacements):
properties[idx]["max_displacement"] = max_displacements[idx]
if idx < len(max_gradie... | |
<filename>srw_image_tools/__init__.py<gh_stars>0
import os
import warnings
import matplotlib.pyplot as plt
import numpy as np
import h5py
from pyCHX.chx_xpcs_xsvs_jupyter_V1 import *
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
def save_hdf5(data, filename='data.h5',... | |
import hashlib
from flask import request
from assemblyline.common.isotime import now_as_iso
from assemblyline.remote.datatypes.lock import Lock
from assemblyline_ui.api.base import api_login, make_api_response, make_subapi_blueprint
from assemblyline_ui.config import CLASSIFICATION, STORAGE
SUB_API = 'safelist'
safe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.