input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
= yt
stopFlag = True
if 'temp' in tags or 'cir_centr' in tags or 'a_centr' in tags:
tip_p = None
stopFlag = False
xi=x
yi=y
elif 'priv' in tags and 'cir' in tags:
xy = self.c.coords(i)
priv_coord_list.append((xy,'cir'))
xc,yc,R = self.coord_circle(xy[0],xy[1],xy[2],xy[3])
if abs(x - xc)<=self.snap_s:
if ... | |
# -*- coding: utf-8 -*-
import json
import os
import sys
from glob import glob
from os.path import dirname, exists, join, realpath
import numpy as np
import pandas as pd
from astropy import units as u
from astropy.coordinates import AltAz, EarthLocation
from astropy.io import fits
from astropy.time import Time
from ca... | |
events if e not in old_vnode.ktraces])
return BscLink(events, old_vnode.path, new_vnode.path, serialize_result(events[-1]))
def handle_unlink(parser, events):
vnode = parser.parse_vnode(events)
return BscUnlink(events, vnode.path, serialize_result(events[-1]))
def handle_chdir(parser, events):
vnode = parser.pa... | |
bd=0, highlightthickness=0,
xscrollcommand=self.hdrHscrollbar.set)
self.bodyCanvas = Canvas(self, bd=0, highlightthickness=0,
yscrollcommand=self.bodyVscrollbar.set,
xscrollcommand=self.bodyHscrollbar.set)
self.grid(row=0, column=0, sticky=(N,S,E,W))
self.tblHdrInterior = Frame(self)
self.tblHdrInterior.grid(row... | |
"""
__M6ThenClausePart2Complete_MDL.py_____________________________________________________
Automatically generated AToM3 Model File (Do not modify directly)
Author: gehan
Modified: Thu Oct 24 14:51:32 2013
_______________________________________________________________________________________
"""
from stickylink impo... | |
1 more request for bount volume
else:
mp1=mp+1 # allow 1 more request for bount volume
Trace.trace(self.trace_level+3,"client_host_busy_for_mounted mp_1 %s" %(mp,))
args[-1]=mp1
args.append(host_from_ticket)
Trace.trace(self.trace_level+3,"client_host_busy_for_mounted args_1 %s" %(args,))
if ((w['work'] == "rea... | |
designs.append(u"<br /><br />")
designs.append(u"</body>")
designs.append(u"</html>")
except Exception as e:
print('contruct design error: %s' % str(e))
else:
try:
# save to file
f = open('%s/%s' % (self.__path, self.__filename_design), 'w')
f.write(self.__safestr2(datas=designs))
f.close()
except Exception... | |
from os.path import join
import pytest
import torch
from stpredictions.datasets.load_data import load_bibtex_train_from_arff, load_bibtex_test_from_arff
from stpredictions.models.DIOKR import IOKR
from stpredictions.models.DIOKR import cost
from stpredictions.models.DIOKR import estimator
from stpredictions.models.DI... | |
<filename>packager/app/test/packager_test.py
#!/usr/bin/python
#
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""Tests utilizing the sample packager ... | |
li.invoice_rectification = ir
li.save()
else:
raise Exception(_('Line not found'))
invoice.lock = True
invoice.save()
context['alir'] = alir
context['lir'] = li.pk
context['url'] = "{}#/{}".format(reverse("CDNX_invoicing_invoicerectificationsaless_list"), ir.pk)
except Exception as e:
context['error'] = e
e... | |
"""
This module defines functions to start and stop the sync daemon and retrieve proxy
objects for a running daemon.
"""
from __future__ import annotations
# system imports
import inspect
import sys
import os
import time
import signal
import enum
import threading
import fcntl
import struct
import argparse
import re
i... | |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
import keras
keras.__version__
# # Introduction to generative adversarial networks
#
# This notebook contains the second code sample found in Chapter 8, Section 5 of [Deep Learning with Python](https://www.manning.com/books/deep-learning-with-python?a_aid=keras&a_bid... | |
these rapid outbursts, so we don't know when exactly each burst faded
by 2 mags.
:return:
"""
if ax == None:
ax = pl.gca()
t2, logLpk = measure_LBV_decline_times(showplots=False)
t2err = np.ones(len(t2))*3
ax.errorbar(t2, logLpk, xerr=t2err, xuplims=True,
color='darkorange', marker='d', ls=' ',
ms=rcParams['l... | |
np.random.random(in_shp).astype('float32')
mask_in = np.ones((num_batch, seq_len), dtype='float32')
# need to set random seed.
lasagne.random.get_rng().seed(1234)
l_lstm_precompute = LSTMLayer(
l_inp, num_units=num_units, precompute_input=True,
mask_input=l_mask_inp)
lasagne.random.get_rng().seed(1234)
l_lstm_... | |
def checkedAction(*args, **kwargs):
pass
def isEnabled(*args, **kwargs):
pass
def isExclusive(*args, **kwargs):
pass
def isVisible(*args, **kwargs):
pass
def removeAction(*args, **kwargs):
pass
def setDisabled(*args, **kwargs):
pass
def setEnabled(*args, **kwargs):
pass
def... | |
"""Functions operating on the PEtab parameter table"""
import numbers
import pandas as pd
import numpy as np
from collections import OrderedDict
from typing import Iterable, Set, List, Tuple, Dict, Union
import libsbml
from . import lint, core, measurements, conditions, observables
from .C import * # noqa: F403
de... | |
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify,... | |
<filename>GTanalysis.py<gh_stars>1-10
##############################################################################
# Created by <NAME>
# Graphical User Interface for Data Analysis
# Created at Northern Arizona University
# for use in the Astrophysical Ice Laboratory
# Advisors: <NAME>, <NAME>, <NAME>
# <EMAIL>
######... | |
<filename>PieSpy/pyPie.py
###
# Copyright (c) 2010, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list ... | |
plan entry to database
meta = dict([(f, form.cleaned_data[f])
for f in ('planNumber', 'planVersion')])
meta['creator'] = request.user.username
importer = planImporter.BlankPlanImporter()
planSchema = models.getPlanSchema(form.cleaned_data['platform'])
# set the site
siteID = form.cleaned_data['site']
if siteID... | |
__version__ = '20210616' #yyyymmdd
__author__ = '<NAME> <<EMAIL>>, <NAME> <<EMAIL>>'
import os
from copy import copy
import warnings
#warnings.filterwarnings("ignore", message="numpy.dtype size changed")
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
import logging
from astropy.coordinates impo... | |
"""Utilities for configuration."""
from copy import copy, deepcopy
from collections import namedtuple
import dill
import inspect
import pickle
from vectorbt import _typing as tp
from vectorbt.utils import checks
from vectorbt.utils.docs import Documented, to_doc
class Default:
"""Class for wrapping default values.... | |
<gh_stars>1-10
'''
Implementation of parallel memoized variational algorithm for bnpy models.
'''
import numpy as np
import multiprocessing
import os
import learnalg. ElapsedTimeLogger as ElapsedTimeLogger
import scipy.sparse
from collections import defaultdict
from birthmove.BCreateManyProposals \
import makeSummar... | |
numpy as np
>>> from pprint import pprint
>>> struct = structure_np(2, 2)
>>> struct[0]
array([[0, 0],
[0, 0]])
>>> struct[1] #doctest: +NORMALIZE_WHITESPACE
[array([0, 0]), array([0, 0]), array([0, 0]), array([0, 0]),
array([0, 0]), array([0, 0])]
>>> pprint(struct[2]) #doctest: +SKIP
defaultdict(<class... | |
# -*- coding: utf-8 -*-
"""
File yolov3_loss.py
@author:ZhengYuwei
"""
import numpy as np
import tensorflow as tf
from tensorflow import keras
from yolov3.yolov3_decoder import YOLOv3Decoder
from yolov3.label_decoder import LabelDecoder
class YOLOv3Loss(object):
""" YOLOv3损失函数 """
def __init__(self, head_grid_size... | |
<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Run Monte Carlo simulation on resistance mismatch to obtain a distribution for VCCS output resistance"""
import matplotlib as mpl
import matplotlib.font_manager as fm
# mpl.rc('font', **{'family': 'serif', 'serif': ['Computer Modern']})
mpl.rcParams['fon... | |
for c in name:
index = index +1
if c== '$':
break
name2 = name2 + c
if not name == name2:
if not name[index].isdigit():
return None # no local class
jcls = loader.getclass(name2) #name2: name of outer clas
outer_clsref = vmobject_getClass_helper(jcls, loader)
method_cls = loader.getclass("java/lang/reflect/Me... | |
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: <EMAIL>
##
## This file is part of VisTrails.
##
## "Redistributio... | |
<reponame>mrbot-ai/deep_qa
from copy import deepcopy
from typing import Any, Dict, List, Tuple
import logging
import random
import dill as pickle
from keras import backend as K
from keras.layers import Dense, Dropout, Layer, TimeDistributed
from overrides import overrides
import numpy
from ..common.checks import Conf... | |
1, cellSize):
pygame.draw.line(screen, gridLines, (windowWidth/2 + widthBuffer, y), (windowWidth/2 + 9 * cellSize - 1 + widthBuffer, y))
for x in range(widthBuffer , widthBuffer + 9 * cellSize + 1, 3 * cellSize):
pygame.draw.line(screen, black, (windowWidth/2 + x, heightBuffer), (windowWidth/2 + x, 9 * cellSize - 1 ... | |
# coding: utf-8
from __future__ import print_function
from __future__ import division
import torch
import torch.nn as nn
import torch.nn.functional as F
from libcity.model.abstract_model import AbstractModel
from math import sin, cos, sqrt, atan2, radians
import numpy as np
def identity_loss(y_true, y_pred):
retur... | |
"""
Functions used by different endopoints.
- To do basic operations
- To parse the filters request
- To manage access resolution
"""
import ast
import logging
import yaml
import requests
from pathlib import Path
from ..api.exceptions import BeaconBadRequest, BeaconServerError, BeaconForbidden, BeaconUnauthorised... | |
or traitor turning
# Such events should also set stop_processing and prevent_default to True to force a re-calcuation
# 2 = win stealers not dependent on winners, such as succubus
# Events in priority 3 and 4 should check if a winner was already set and short-circuit if so
# it is NOT recommended that events in pri... | |
program writes its output in subdirectories under the directory given by
the command-line option -o (or /o on Windows). If the directory does not
exist, this program will create it. If no -o is given, the current directory
where eprints2bags is running is used. Whatever the destination is,
eprints2bags will create subd... | |
4*mbkin**2*q_cut**4 - 4*mckin**2*q_cut**4 + 5*q_cut**5)*(3*mbkin**4*
np.sqrt(0j + (mbkin**4 - 2*mbkin**2*mckin**2 + mckin**4 - 2*mbkin**2*q_cut -
2*mckin**2*q_cut + q_cut**2)/mbkin**4) + 8*mbkin**4*mckin*
np.sqrt(0j + (mbkin**4 - 2*mbkin**2*mckin**2 + mckin**4 - 2*mbkin**2*q_cut -
2*mckin**2*q_cut + q_cut**2)/mbk... | |
cervical leep concept
"""
leep_mention = mention.text
assert 'leep' in leep_mention
return [[leep_mention, 'loop electrosurgical excision']]
@staticmethod
def link_cervix_conization(mention):
"""
Link biopsy portio mention to conization concept
Params:
mention (spacy.tokens.span.Span): entity ment... | |
self.check_os_version()
self.check_os_bit()
self.check_os_disk()
self.check_os_cpu()
self.check_os_mem()
self.check_os_user()
self.check_os_port()
self.print_result("check")
# ============================ copy ========================
def get_exist_files(self):
"""
返回file_list中创建成功的目录
"""
exist_file = []
... | |
<reponame>henrikand/UIforETW
# Copyright 2015 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
#
# Unle... | |
# coding: utf-8
"""
Salt Edge Account Information API
API Reference for services # noqa: E501
OpenAPI spec version: 5.0.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility l... | |
"""Container for parameters (:mod:`fluiddyn.util.paramcontainer`)
=================================================================
.. currentmodule:: fluiddyn.util.paramcontainer
Provides:
.. autoclass:: ParamContainer
:members:
:private-members:
"""
import os
import re
from ast import literal_eval
from copy im... | |
<reponame>henriktao/pulumi-azure<gh_stars>0
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Option... | |
0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0],
[1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, ... | |
#!python
"""
This will connect to a device that is Cisco and attempt to get the config from that device
"""
import os
import sys
if "scan_mods" in os.listdir(os.getcwd()):
sys.path.append(os.getcwd())
else:
path = "../"
while True:
if "scan_mods" in os.listdir(path):
sys.path.append(path)
break
else:
path ... | |
the next
if len(line_poses) < 13:
while ((firstshift - offset) > 5.) or ((firstshift - offset) < -5.):
self.speak('doing an extra correlation {}: {}'.format(line_range, firstshift-offset))
currentmaxind = np.where(corrs == np.max(corrs))
# delete the correlation coefficient that is the maximum but is not providing... | |
from osbot_graphsv.demo.Demo_Data import Demo_Data
class Demo_Data_Import:
def __init__(self):
self.demo_data = Demo_Data()
self.graph_sv = self.demo_data.graph_sv
self.indexes = self.graph_sv.indexes
self.issues = self.graph_sv.issues
self._summaries = None
# helper methods
def add_if_new(self,issue_type_n... | |
"""
The table of all LL operations.
"""
from rpython.rtyper.extregistry import ExtRegistryEntry
class LLOp(object):
def __init__(self, sideeffects=True, canfold=False, canraise=(),
canmallocgc=False, canrun=False, tryfold=False):
# self.opname = ... (set afterwards)
if canfold:
sideeffects = False
# The ope... | |
<reponame>liuliuliu0605/Federated-Learning-PyTorch
import ns.core
import ns.network
import ns.internet
import ns.point_to_point
import ns.applications
import ns.mobility
import ns.netanim
import ns.flow_monitor
import ns.wimax
import ns.csma
import ns.uan
import ns.wave
import sys
import numpy as np
f... | |
msg = "{0}, tell them that they can go outside and play hide-and-go-fuck-themselves!".format(
relay)
elif lt > 0 and lR > 0 and ls == 0:
msg = "{0}, tell {1} that they can go outside and play hide-and-go-fuck-themselves.".format(
relay, target)
elif lt > 0 and lR > 0 and ls > 0:
msg = "{0}, tell {1} that they can... | |
<reponame>lukovnikov/funcparse
import re
from abc import ABC, abstractmethod, abstractproperty
from copy import deepcopy
from typing import Union, List, Dict
import qelos as q
import torch
from nltk import Tree
from funcparse.grammar import ActionTree
from funcparse.vocab import SentenceEncoder, FuncQueryEncoder
cl... | |
<filename>dataset.py
import datetime
import json
import os
import pickle
from multiprocessing import Pool
from pprint import pprint
from typing import Any, Callable, Dict, List, Optional
import numpy as np
import pandas as pd
import torch
import torch.nn.functional as F
from sklearn.model_selection import KFold
from s... | |
<filename>connectfour/agents/agent_student.py
from connectfour.agents.computer_player import RandomAgent
import random
class StudentAgent(RandomAgent):
def __init__(self, name):
super().__init__(name)
self.MaxDepth = 3
def get_move(self, board):
"""
Args:
board: An instance of `Board` tha... | |
[], # Beef, chuck, shoulder clod, top blade, steak, separable lean and fat, trimmed to 0" fat, choice, cooked, grilled
23043: [], # Beef, chuck, shoulder clod, top blade, steak, separable lean and fat, trimmed to 0" fat, select, raw
23044: [], # Beef, chuck, shoulder clod, top blade, steak, separable lean and fat, tr... | |
"""
Simulation environment modeling the stochastic energy consumption of an AEV
traversing the streets in a given region of interest. Requires energy
consumption and street network data as inputs
"""
import json
import time
import folium
import numpy as np
import networkx as nx
from folium import plugins
from fimdp.co... | |
[
(call_script,"script_store_vince_random_in_range",0,200,0), #Thunder dice roll
(assign,":thunder_roll",reg0),
(ge,"$g_thunder_strength",":thunder_roll"), #At highest value (100), 50% chance of thunder strike
(call_script,"script_store_vince_random_in_range",0,10000,0), #Thunder delay in ms
(assign,":thunder_dela... | |
lists of hosts specified in the yaml file
unique_hosts = {"servers": set(), "clients": set()}
for key, placeholders in find_yaml_hosts(yaml_file).items():
if key in SERVER_KEYS:
unique_hosts["servers"].update(placeholders)
elif key in CLIENT_KEYS:
# If no specific clients are specified use a specified server
key... | |
: list of filters.Filter
List of call-level filters to apply
"""
filter_list = []
# HipSTR call-level filters
if args.hipstr_max_call_flank_indel is not None:
filter_list.append(filters.HipSTRCallFlankIndels(args.hipstr_max_call_flank_indel))
if args.hipstr_max_call_stutter is not None:
filter_list.append(filt... | |
parameter 'body' is set
if self.api_client.client_side_validation and ('body' not in local_var_params or # noqa: E501
local_var_params['body'] is None): # noqa: E501
raise ApiValueError("Missing the required parameter `body` when calling `patch_service_account`") # noqa: E501
collection_formats = {}
path_params ... | |
# Copyright 2013 Openstack Foundation
# 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 l... | |
<reponame>anton-sidelnikov/openstacksdk
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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/LICEN... | |
"""
SPDX-License-Identifier: BSD-2
"""
import contextlib
import json
import logging
import os
import tempfile
from typing import Any, Callable, List, Optional, Tuple, Union
from ._libtpm2_pytss import lib
from .callbacks import Callback, CallbackType, get_callback, unlock_callback
from .fapi_info import FapiInfo
from ... | |
plt.subplots(nrows=number_rows, ncols=2, sharex='col', figsize=(8, 6), dpi=80)
# each axis has an error column
for plot_index, ax in enumerate(compare_axes.flat[:]):
for error_index,error_column in enumerate(error_columns[plot_index]):
error = np.array(calrep_model[error_column])
ax.plot(calrep_x, error, comparis... | |
<reponame>S-Lehmann/uppyyl-simulator<gh_stars>1-10
"""The implementation of an evaluator for Uppaal C code ASTs."""
from uppyyl_simulator.backend.data_structures.ast.ast_code_evaluator import (
ASTCodeEvaluator
)
from uppyyl_simulator.backend.data_structures.state.variable import UppaalVariable
from uppyyl_simulator.... | |
import os, sys, inspect, re
from datetime import datetime, timedelta
import traceback
try:
import __builtin__ as builtins
except:
import builtins
class ExecFileError(Exception): pass
def _A(o):
if o is None:
return []
elif isinstance(o, list):
return o
else:
return [o]
def _find(filenames, test=os.path.isfi... | |
0.0
)
@derivative_time.validator
def _validate_derivative_time(self, attribute, value):
assert (
isinstance(value, Scalar)
and value.GetCategory() == "time"
and value.GetValue("s") >= 0.0
)
@attr.s(slots=True, kw_only=True)
class NodeDescription:
"""
.. include:: /alfacase_definitions/NodeDescription.txt
... | |
# Lint as: python3
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | |
<filename>admin/pageaudit/report/models.py
import json
from urllib import parse
from django.contrib.postgres.fields import JSONField
from django.contrib.auth.models import User, Group
from django.db import models
from django.db.models import Avg, Max, Min, Q, Sum, F
from collections import namedtuple
from .helpers im... | |
return pulumi.get(self, "value")
@pulumi.output_type
class DeviceTag(dict):
def __init__(__self__, *,
key: str,
value: str):
"""
:param str key: The key name of the tag. You can specify a value that is 1 to 127 Unicode characters in length and cannot be prefixed with aws:. You can use any of the following charac... | |
= 100, label = None):
x = np.linspace(xmin, xmax, nPts)
y = np.vstack([f(np.matrix([[xi]])) for xi in x])
ax.plot(x, y, label = label)
plt.show()
def smooth(n, vals):
# Run a box filter of size n
x = sum(vals[0:n])
result = [x]
for i in range(n, len(vals)):
x = x - vals[i-n] + vals[i]
result.append(x)
retu... | |
<filename>hermes/factory.py
import re
from copy import deepcopy
from collections import OrderedDict
from hermes.grammar import *
from hermes.hermes_parser import Terminal as HermesTerminal
from hermes.hermes_parser import Ast, AstList
from hermes.hermes_parser import lex as hermes_lex
from hermes.hermes_parser import ... | |
# TODO(Magesh):Handle concurrency issues
free_ip = self._get_last_free_ip(context._plugin_context,
context.current['subnets'])
if not free_ip:
LOG.error("Reserving IP Addresses failed for Network "
"Service Policy. No more IP Addresses on "
"subnet")
return
# TODO(Magesh):Fetch subnet from PTG to which NSP is a... | |
I1IiiI . i11iIiiIii . OoooooooOO . I1IiiI . o0oOOo0O0Ooo
if ( lisp_rloc_probe_timer != None ) : lisp_rloc_probe_timer . cancel ( )
if 65 - 65: i11iIiiIii
i1iIII = lisp_process_rloc_probe_timer
II1 = threading . Timer ( interval , i1iIII , [ lisp_sockets ] )
lisp_rloc_probe_timer = II1
II1 . start ( )
return
if ... | |
#!/usr/bin/env python
"""
Copyright 2022 Open STEMware Foundation
All Rights Reserved.
This program is free software; you can modify and/or redistribute it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation; version 3 with attribution addendums as found in the
L... | |
val = math.degrees(val1)
return SExpresion(val, Expresion.DECIMAL)
elif isinstance(expresion, SFuncBinary):
if expresion.funcion.lower() == "length":
param = Interpreta_Expresion(expresion.param, tablaSimbolos, tabla)
val = len(param)
return SExpresion(val, Expresion.ENTERO)
elif expresion.funcion.lower() == "t... | |
False, None, 1)
(0, 0, False)
:param start: leftmost column or topmost row
:type start: int
:param end: rightmost column or bottommost row
:type end: int
:param resizing: flag if the selection is currently being resized
:type resizing: bool
:param boundary: total number of columns or rows (unused in retreat)
... | |
<gh_stars>0
import copy
import datetime
import os
import tempfile
import unittest
import urllib
from unittest.mock import MagicMock
from unittest.mock import patch
import errata
class GithubUserMock():
def __init__(self, login):
self.login = login
class GithubLabelMock():
def __init__(self, name):
self.name = ... | |
== NS(2, 17)
assert NS(2+Integral(log(2*cos(x/2)), (x, -pi, pi)), 20, chop=True) == NS(2, 20)
assert NS(2+Integral(log(2*cos(x/2)), (x, -pi, pi)), 22, chop=True) == NS(2, 22)
# Needs zero handling
assert NS(pi - 4*Integral('sqrt(1-x**2)', (x, 0, 1)), 15, maxn=30, chop=True) in ('0.0', '0')
# Oscillatory quadrature... | |
'''
if self._angel.is_decommissioned():
# Don't override this -- if a node is in-process of decomissioning, stop services underneath the decomissioning logic could be Very Bad.
print >>sys.stderr, "Error: can't stop services on a decomissioned node."
return -1
# Stop our supervisor process, which will in turn ru... | |
<reponame>codilime/contrail-controller-arch
#
# Copyright (c) 2013,2014 Juniper Networks, Inc. All rights reserved.
#
import gevent
import os
import sys
import socket
import errno
import uuid
import logging
import coverage
import cgitb
cgitb.enable(format='text')
import testtools
from testtools.matchers import Equals... | |
import numpy as np
from util.stats import *
# ====================================================================
# util.stats
# ====================================================================
def _test_mpca(display=False):
if display:
print()
print("-"*70)
print("Begin tests for 'mpca'")
GENERATE_APPROX... | |
of the :class:`~.WireCut` is unknown, we can use
:func:`~.find_and_place_cuts` to make attempts in automatically finding such a cut
given the device constraints. Using the same circuit as above but with the
:class:`~.WireCut` removed, a slightly different cut with identical cost can be discovered
and placed into th... | |
<reponame>ccassler/eutester
# Software License Agreement (BSD License)
#
# Copyright (c) 2009-2011, Eucalyptus Systems, Inc.
# All rights reserved.
#
# Redistribution and use of this software in source and binary forms, with or
# without modification, are permitted provided that the following conditions
# are met:
#
# ... | |
subtable'),
('Offset', 'Mark2Array', None, None, 'Offset to Mark2Array table for Mark2-from beginning of MarkMarkPos subtable'),
]),
('Mark2Array', [
('uint16', 'Mark2Count', None, None, 'Number of Mark2 records'),
('struct', 'Mark2Record', 'Mark2Count', 0, 'Array of Mark2 records-in Coverage order'),
]),
(... | |
# -*- coding: utf-8 -*-
from .CardInfo import CardInfo
from woodcutter.src.Card import *
from woodcutter.src.Action import Action
class RUINS(CardInfo):
names = ["Ruins", "Ruins", "a Ruins"]
types = [Types.ACTION, Types.RUINS]
cost = [0, 0, 0]
class KNIGHTS(CardInfo):
names = ["Knights", "Knights", "a Knights"]... | |
def __str__(self):
if self.reduced:
return "%15.6f %15.6f %15.6f %15.6f"%(self.K,
self.C0,
self.C1,
self.C2)
return "%28s %15.6f %15.6f %15.6f %15.6f"%(self.name, self.K,
self.C0, self.C1, self.C2)
class FourierSimple(object):
"""Potential defined as
E = K*[1 + c*cos(n*theta)]
Input parameters: K, c, n
"... | |
<filename>pycon_bot/modes/thunder.py
from __future__ import division
from .base import BaseMode
from ..models import Meeting, Group, TalkProposal, ThunderdomeVotes
from copy import copy
from datetime import datetime
from random import randint
import re
class Mode(BaseMode):
"""A mdoer for handling Thunderdome sessio... | |
<reponame>wiboticalex/pyuavcan
# Copyright (c) 2019 UAVCAN Consortium
# This software is distributed under the terms of the MIT License.
# Author: <NAME> <<EMAIL>>
import os
import sys
import time
import gzip
import typing
import pickle
import base64
import pathlib
import logging
import itertools
import dataclasses
i... | |
<filename>imagemodel/common/layers/multi_head_attention.py
# https://github.com/tensorflow/tensorflow/blob/v2.4.1/tensorflow/python/keras/layers/multi_head_attention.py
import collections
import math
import string
import numpy as np
import tensorflow as tf
from tensorflow.python.framework import tensor_shape
from tens... | |
import ast
from unittest import mock
from rattr.analyser.context import (
Builtin,
Class,
Context,
Func,
Import,
Name,
RootContext,
SymbolTable,
)
class TestContext:
def test_add(self):
# Test add
root = Context(None)
root.add(Name("var_one"))
child = Context(root)
child.add(Name("var_two"))
assert ... | |
"Shared Cockpit"),
(b'MAGNETO3_RIGHT', "Toggle engine 3 right magneto", "All aircraft"),
(b'MAGNETO3_LEFT', "Toggle engine 3 left magneto", "All aircraft"),
(b'MAGNETO3_BOTH', "Set engine 3 magnetos on", "Shared Cockpit"),
(b'MAGNETO3_START', "Set engine 3 magnetos on and toggle starter", "Shared Cockpit"),... | |
call last):
...
TypeError: 'w' parameter is positional only, but was passed as a keyword
You can use `_allow_partial` that will allow you, if
set to `True`, to underspecify the params of a function (in view of being
completed later).
>>> Sig(foo).extract_args_and_kwargs(x=3, y=2)
Traceback (most recent call la... | |
import pytest
import tempfile
import os
from time import sleep
import json
from hypothesis import given, settings
import hypothesis.strategies as hst
import numpy as np
import qcodes as qc
from qcodes.dataset.measurements import Measurement
from qcodes.dataset.experiment_container import new_experiment
from qcodes.te... | |
<filename>MetaScreener/external_sw/mgltools/MGLToolsPckgs/Pmv/seqDisplay.py
########################################################################
#
# Date: 2012 Authors: <NAME>
#
# <EMAIL>
#
# The Scripps Research Institute (TSRI)
# Molecular Graphics Lab
# La Jolla, CA 92037, USA
#
# Copyright: <NAME> and TSRI 2012... | |
"""
desmonddmsfile.py: Load Desmond dms files
Portions copyright (c) 2013 Stanford University and the Authors
Authors: <NAME>
Contributors: <NAME>, <NAME>, <NAME>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal ... | |
<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A polynomial vectorizer for The Cannon.
"""
from __future__ import (division, print_function, absolute_import,
unicode_literals)
__all__ = ["PolynomialVectorizer"]
import numpy as np
from collections import (Counter, OrderedDict)
from itertools impor... | |
<filename>Selenium_PhantomJS/source/boto3/s3/transfer.py
# Copyright 2015 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.a... | |
the OVF descriptor
needed = tar_entry_size(len(ET.tostring(self.root)))
# Account for the size of all the referenced files
manifest_size = 0
for href, file_ref in self.file_references.items():
# Approximate size of a manifest entry for this file
if self.ovf_version >= 2.0:
# SHA256(href)= <64 hex digits>
# so ... | |
== 'tab'):
return lol(f,opt)
# 1 dim list of blanksep items
if typ == 'l_txt':
return i_lol(f,sep='',frm='1d')
# 2 dim list
if typ == 'lol_txt':
return i_lol(f,sep=sep)
# d.t = [t] or [[on off]], d.lab = [label ...]
if typ == 'seg_lab':
return i_seg_lab(f)
if typ == 'key_val':
return i_keyVal(f,opt["sep"])
... | |
import os
import base64
import datetime
import binascii
import hashlib
from urllib.error import HTTPError
from mailmanclient import MailmanConnectionError, Client
import onetimepass
from app import db, login_manager, config
from sqlalchemy import desc
from sqlalchemy.dialects import mysql
from flask_sqlalchemy import B... | |
#!/usr/bin/env python
################################################################################
# Created by <NAME> #
# <EMAIL> #
################################################################################
import time, multiprocessing,numpy
from pointcloud import utils
# Module containing common code for ... | |
<gh_stars>0
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.utils.encoding import smart_str
from django.utils.translation import get_language, gettext, gettext_lazy as _
from rest_framework import fields, serializers
from olympia.amo.urlresolvers imp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.