text stringlengths 2 999k |
|---|
"""An example script to run FASTPT
Initializes and calculates all quantities supported by FASTPT
Makes a plot for P_22 + P_13
"""
from time import time
import numpy as np
import matplotlib.pyplot as plt
import fastpt as fpt
from fastpt import FASTPT
#Version check
print('This is FAST-PT version', fpt.__version__)
#... |
from regression_tests import *
class TestBase(Test):
def test_c_contains_for_or_while_loop(self):
assert self.out_c.contains(r'(for|while) \(')
def test_c_contains_no_gotos(self):
assert not self.out_c.contains(r'goto .*;')
def test_c_contains_all_strings(self):
assert self.out_c.... |
"""
Functions to clean up a tenant within a fiware based platform.
"""
from functools import wraps
from requests import RequestException
from typing import Callable, List, Union
from filip.models import FiwareHeader
from filip.clients.ngsi_v2 import \
ContextBrokerClient, \
IoTAClient, \
QuantumLeapClient
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
import datetime
import re
from functools import partial
from urlpars... |
# Copyright 2021 TerraPower, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
#python process_data.py disaster_messages.csv disaster_categories.csv DisasterResponse.db
import sys
import numpy as np
import pandas as pd
from sqlalchemy import create_engine
def load_data(messages_filepath, categories_filepath):
'''
This function returns merged dataframe of input dataframes.
Parameters... |
# Sturges rule
import numpy as np
def createBins(df, column):
k = int(np.ceil(1+np.log2(len(df[f'{column}']))))
return k |
import logging
import multiprocessing
from queue import Full, Empty
from unittest import TestCase
from faster_fifo import Queue
import faster_fifo_reduction
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
log = logging.getLogger('rl')
log.setLevel(logging.DEBUG)
log.handlers = [] # No duplicated handlers
l... |
from running_modes.configurations.general_configuration_envelope import GeneralConfigurationEnvelope
from running_modes.configurations.logging.transfer_learning_log_configuration import TransferLearningLoggerConfig
from running_modes.transfer_learning.logging.base_transfer_learning_logger import BaseTransferLearningLog... |
import random
class animal:
# Position
positionX = 0
positionY = 0
# Stats
health = 0 # If reduced to 0, animal is dead
weight = 0 # Weight will be used to define the size of the animal
speed = 0 # Move speed of the animal
energy = 0 # Animal capacity to attack, if reduced to 0, a... |
from conans.client.build.cppstd_flags import cppstd_default
from conans.errors import ConanInvalidConfiguration, ConanException
def check_min_cppstd(conanfile, cppstd, gnu_extensions=False):
""" Check if current cppstd fits the minimal version required.
In case the current cppstd doesn't fit the minimal ... |
"""Calendar printing functions
Note when comparing these calendars to the ones printed by cal(1): By
default, these calendars have Monday as the first day of the week, and
Sunday as the last (the European convention). Use setfirstweekday() to
set the first day of the week (0=Monday, 6=Sunday)."""
import sys
import da... |
from adafruit_servokit import ServoKit
import board
import busio
import time
# On the Jetson Nano
# Bus 0 (pins 28,27) is board SCL_1, SDA_1 in the jetson board definition file
# Bus 1 (pins 5, 3) is board SCL, SDA in the jetson definition file
# Default is to Bus 1; We are using Bus 0, so we need to construct the bus... |
# Generated by Django 2.1.7 on 2019-10-19 06:30
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('main', '0014_subscriber'),
]
operations = [
migrations.AlterField(
model_name='subscriber',
... |
"""
MIT License
Copyright (c) 2020 Alejandro Daniel Noel
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, merge, ... |
# coding: utf-8
"""
Ed-Fi Operational Data Store API
The Ed-Fi ODS / API enables applications to read and write education data stored in an Ed-Fi ODS through a secure REST interface. *** > *Note: Consumers of ODS / API information should sanitize all data for display and storage. The ODS / API provides reas... |
from collections import defaultdict
__author__ = 'nekmo'
LISTS_TYPES = (tuple, list, set, frozenset)
class Mkv(object):
def __init__(self):
self.types_orders = defaultdict(lambda: 0)
self.arguments = []
def _normatize_input_options(self, elements):
if not isinstance(elements, LISTS_T... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Appcelerator Titanium Mobile
# Copyright (c) 2012 by Appcelerator, Inc. All Rights Reserved.
# Licensed under the terms of the Apache Public License
# Please see the LICENSE included with this distribution for details.
#
# Packages tools for delivery.
#
VERSION = "2.1.... |
def count_words(filename):
try:
with open(filename,encoding='utf-8') as f:
contents=f.read()
except FileNotFoundError:
print(f"Sorry, the file {filename} does not exist")
else:
words=contents.split()
num_words=len(words)
print(f"The file {filename} has about {num_words} words.")
filename='alic... |
#
# gdb helper commands and functions for Linux kernel debugging
#
# task & thread tools
#
# Copyright (c) Siemens AG, 2011-2013
#
# Authors:
# Jan Kiszka <jan.kiszka@siemens.com>
#
# This work is licensed under the terms of the GNU GPL version 2.
#
import gdb
from linux import utils
task_type = utils.CachedType(... |
# -*- coding: utf-8 -*-
import colorsys
import csv
import json
import math
import os
def distance(p0, p1):
return math.sqrt((p0[0] - p1[0])**2 + (p0[1] - p1[1])**2)
def distance3(p0, p1):
x = p1[0] - p0[0]
y = p1[1] - p0[1]
z = p1[2] - p0[2]
return math.sqrt(x**2 + y**2 + z**2)
def hex2hsv(hex):... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 3 08:48:30 2021
@author: Pooja3894
"""
__version__ = "0.1"
|
'''
Authors: Pratik Bhatu.
Copyright:
Copyright (c) 2021 Microsoft Research
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, co... |
import textwrap
import webbrowser
from pathlib import Path
import nox
nox.options.sessions = ["check", "generate"]
# Keep versions in sync with .github/workflows/check.yml
@nox.session(
python=["2.6", "2.7", "3.2", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9"]
)
def check(session):
"""Ensure that get-pip... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
@ Author : Administrator
@ date : 2019/7/13 17:53
@ IDE : PyCharm
@ GitHub : https://github.com/JackyPJB
@ Contact : pengjianbiao@hotmail.com
--------... |
"""Command line interface for rflink library.
Usage:
rflink [-v | -vv] [options]
rflink [-v | -vv] [options] [--repeat <repeat>] (on|off|allon|alloff|up|down|stop|pair) <id>
rflink (-h | --help)
rflink --version
Options:
-p --port=<port> Serial port to connect to [default: /dev/ttyACM0],
... |
from comment.messages import ExceptionError
try:
from rest_framework.exceptions import APIException
except ModuleNotFoundError:
APIException = Exception
class CommentBadRequest(APIException):
status_code = 400
default_detail = ExceptionError.BAD_REQUEST
def __init__(self, detail=None, status_cod... |
## Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
## SPDX-License-Identifier: Apache-2.0
import boto3
import logging
import os
import json
import time
import m2c2_protocol_converter as builder
import m2c2_utils as utils
import m2c2_globals as var
import m2c2_post_handler as post
logger = l... |
"""
``revscoring fetch_text -h``
::
Gets the text for a set of observations. Will create a new field called
"text" with the content corresponding to the "rev_id".
Usage:
fetch_text --host=<url>
[--deleted-1st]
[--login]
[--input=<path>] [--... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmocr.models.builder import DECODERS, build_decoder
from mmocr.models.textrecog.layers import RobustScannerFusionLayer
from .base_decoder import BaseDecoder
@DECODERS.register_module()
class RobustScannerDecoder(BaseDecoder):
def __init__(s... |
# -*- coding: utf-8 -*-
from fastNLP.modules import ConditionalRandomField, allowed_transitions
from modules.transformer import TransformerEncoder
from torch import nn
import torch
import torch.nn.functional as F
class StackedTransformersCRF(nn.Module):
def __init__(self, tag_vocabs, embed, num_layers, d_model, ... |
"""
CryptoAPIs
Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei... |
"""
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... |
from . import TestCase, setup_fixtures
from apps.surveys20.builder.tokenizer import Builder
class ModelTestCase(TestCase):
@classmethod
def setUpTestData(cls):
setup_fixtures()
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.string = "6700500100020101####林阿忠/本人#0912... |
#!/usr/bin/env python3
# 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 Any, Dict, List, Optional, Tuple, Type, TypeVar, Union
import numpy as np
import torch
T = TypeVa... |
# -*- coding: utf-8 -*-
import os
import sys
from setuptools import setup
project_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(project_dir, 'README.md'), 'r') as f:
long_description = f.read()
setup(
name='gooee-pyutils',
version='0.1.0',
packages=['gooee_utils'],
packa... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/rpc/code.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import messa... |
import numpy
from .base import sqrtm, invsqrtm, powm, logm, expm
###############################################################
# Means
###############################################################
def mean_riemann(covmats, tol=10e-9, maxiter=50, init=None):
"""Return the mean covariance matrix according to t... |
import pandas as pd
import numpy as np
import os
from sys import argv
import copy
import json
plot_angle = 0 # plot histogram of maxmimum angle between NN atom vectors.
class POSCAR:
theta = 90 # surface threshold in degree
ninfile = ''
lines = ''
line_list = []
com... |
"""Test MQTT humidifiers."""
import copy
from unittest.mock import patch
import pytest
from voluptuous.error import MultipleInvalid
from homeassistant.components import humidifier
from homeassistant.components.humidifier import (
ATTR_HUMIDITY,
ATTR_MODE,
DOMAIN,
SERVICE_SET_HUMIDITY,
SERVICE_SET_... |
import h5py
import numpy as np
def nxsinfo(filename):
f = h5py.File(filename)
ct = f["/entry/instrument/detector/count_time/"].value / 1000.0
nf = f["/entry/instrument/detector/data/"].shape
nf = nf[0]
f.close()
return float(ct), nf
|
# Logistic Regression on Diabetes Dataset
from random import seed
from random import randrange
from csv import reader
from math import exp
import time
import mmh3
import sys
HASH_SIZE = 2000
# result is a list of tuples (label, list of tuples (index, value))
# Load a CSV file
def load_csv_sparse_tab(filename):
data... |
"""Timeseries generation line plots.
This code creates generation non-stacked line plots.
@author: Daniel Levie
"""
import logging
import pandas as pd
import datetime as dt
import matplotlib.pyplot as plt
import marmot.config.mconfig as mconfig
from marmot.plottingmodules.plotutils.plot_library import SetupSubplot
... |
from django.contrib import admin
from .models import *
# Register your models here.
class PlatformAdmin(admin.ModelAdmin):
list_display = ('platform',)
list_link = ('platform',)
class WorkPairAdmin(admin.ModelAdmin):
list_display = ('work_id', 'platform', 'pair_name', 'status')
list_display_links = (... |
from argparse import ArgumentParser
from pathlib import Path
def getConfigPath(prog: str, description: str, srcDir: Path):
p = ArgumentParser(prog=prog, description=description)
p.add_argument(
"-c", "--config", default=srcDir / "config" / "config.json",
help="Path to JSON configuration file.", type=Path
)
res... |
"""Raspberry Pi Face Recognition Treasure Box
Face Detection Helper Functions
Functions to help with the detection and cropping of faces.
"""
import cv2
import config
haar_faces = cv2.CascadeClassifier(config.HAAR_FACES)
def detect_single(image):
"""Return bounds (x, y, width, height) of detected face in graysca... |
from PyQt5.QtCore import QObject, QThread, pyqtSignal
import requests
import traceback
class PvgisApiWorker(QObject):
started: pyqtSignal = pyqtSignal()
finished: pyqtSignal = pyqtSignal(dict)
def __init__(self, url: str, dr: str):
super(PvgisApiWorker, self).__init__()
self.url = url
... |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
#!/usr/bin/python3 -OO
# -*- coding: utf-8 -*-
# Copyright 2011-2019 The SABnzbd-Team <team@sabnzbd.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
name = 'title_finder'
token = ''
from html_telegraph_poster import TelegraphPoster
from .article import _getArticle, getTitle, getAuthor, getAlbum
from .common import _seemsValidText
from telegram_util import matchKey
from bs4 import BeautifulSoup
from telegram_util impo... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from .CParser import *
from .CLibrary import * |
from machin.auto.config import (
generate_algorithm_config,
generate_env_config,
generate_training_config,
launch,
)
import torch as t
import torch.nn as nn
class SomeQNet(nn.Module):
def __init__(self, state_dim, action_num):
super().__init__()
self.fc1 = nn.Linear(state_dim, 16... |
from __future__ import annotations
from dataclasses import dataclass
from functools import reduce
from typing import Literal
import numpy as np
from numpy.typing import NDArray
from chemex.configuration.data import RelaxationDataSettings
from chemex.configuration.experiment import CpmgSettings
from chemex.configurat... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-11-07 18:21
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('TooPath3', '0003_tracks'),
]
operations = [
migrations.RenameModel(
... |
#!/usr/bin/python
# Copyright (c) 2016-2018 Angelo Moura
#
# This file is part of the program pythem
#
# pythem is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your o... |
import abc
import copy
from collections import defaultdict
from typing import Dict
import torch
from torch import nn
from torch.nn.utils import parametrize
from .utils import FakeSparsity, module_to_fqn, fqn_to_module
SUPPORTED_MODULES = {
nn.Linear
}
class BaseSparsifier(abc.ABC):
r"""Base class for all ... |
#!/usr/bin/env python3
# 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.
"""
No externally useful functions here. Read the `run.py` docblock instead.
Converts structures from `args.py` into ... |
# Copyright (c) 2020 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 required by appli... |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
"""This module is for for sending alerts and monitoring stats to a slack channel"""
import json
import time
import traceback
import psutil
import requests
class Alerter:
"""Class for sending alerts and monitoring stats to a slack channel"""
@staticmethod
def send_alert(message:str, url:str, user_id:str=... |
#coding:utf-8
#!/usr/bin/python
import os
import io
import traceback
import time
import os.path
import shutil
from xml.etree.ElementTree import Element, SubElement, ElementTree
import xml.etree.ElementTree as ETS
ETS.register_namespace('', "http://peachfuzzer.com/2012/Peach")
from sqlalchemy import desc
from sqlalche... |
from dataclasses import dataclass, field
from typing import List
from bindings.csw.request_method_type import RequestMethodType
__NAMESPACE__ = "http://www.opengis.net/ows"
@dataclass
class Http:
"""Connect point URLs for the HTTP Distributed Computing Platform (DCP).
Normally, only one Get and/or one Post ... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
#!/usr/bin/env python3
"""PyTorch Inference Script
An example inference script that outputs top-k class ids for images in a folder into a csv.
Hacked together by / Copyright 2020 Ross Wightman (https://github.com/rwightman)
"""
import os
import time
import argparse
import logging
import numpy as np
import torch
from... |
# For each given array geometry, this program calculates the extinction cross section, differential scattering cross section (partially driven array), or multi donor-multi acceptor resonance energy transfer (RET) rate
import numpy as np
import matplotlib.pyplot as plt
import os
import sys
from scipy.constants import p... |
from __future__ import unicode_literals
from dvc.utils.compat import FileNotFoundError, urlparse
import io
import logging
import os
import posixpath
import re
from collections import deque
from contextlib import closing, contextmanager
import subprocess
from .base import RemoteBASE, RemoteCmdError
from .pool import g... |
import os
import batch
import preprocessing
import train
import predict
import pandas as pd
from matplotlib import pyplot as plt
from covidDataset import CovidDataset
from torch.utils.data import DataLoader
from transformers import BertForSequenceClassification, BertTokenizer
from sklearn.model_selection impo... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.14.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re... |
import logging
import json
import numpy as np
from collections import OrderedDict
from galaxy.utils import ontology
def clean_replace(s, r, t, forward=True, backward=False):
def clean_replace_single(s, r, t, forward, backward, sidx=0):
# idx = s[sidx:].find(r)
idx = s.find(r)
if idx == -1:... |
from random import choice
import matplotlib.pyplot as plt
import networkx as nx
from nxviz.plots import CircosPlot
G = nx.barbell_graph(m1=10, m2=3)
for n, d in G.nodes(data=True):
G.node[n]["class"] = choice(["a", "b", "c", "d", "e"])
c = CircosPlot(
G,
node_grouping="class",
node_color="class",
... |
class CellList:
"""Maintain a list of (x, y) cells."""
def __init__(self):
self.cells = {}
def has(self, x, y):
"""Check if a cell exists in this list."""
return x in self.cells.get(y, [])
def set(self, x, y, value=None):
"""Add, remove or toggle a cell in this list.""... |
from math import ceil
from marshmallow import fields
from .base import BaseSchema
def paginate(query, pagination):
page = pagination.get('Page', 0)
per_page = pagination.get('PerPage', 10)
offset = page * per_page
total = query.count()
totalPages = ceil(total / float(per_page))
data = query.... |
# Using array
class Stack:
def __init__(self):
self.__size = 0
self.__data = []
def size(self):
return self.__size
def is_empty(self):
return self.__size == 0
def push(self, val):
self.__data.append(val)
self.__size += 1
def pop(self):
if ... |
# -*- coding: utf-8 -*-
# Scrapy settings for TURF project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/latest/to... |
# Description: An implementation using iterator
# @Author: Oxel40
class FizzBuzzIterator:
def __iter__(self):
self.n = 1
return self
def __next__(self):
if self.n > 100:
raise StopIteration
out = ""
if self.n % 3 == 0:
out += "Fizz"
if s... |
# qubit number=4
# total number=35
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2
import numpy as np
import networkx as nx
def bitwise_... |
import torch
import argparse
from collections import defaultdict
import os
from transformers import T5Tokenizer
from tqdm import tqdm
from multiprocessing import Pool
import json
import re
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input_path', required=True)
parser.add_argument('-o', '--output_p... |
from designer.core.director import *
from designer.core.event import *
from designer.core.window import Window
from designer.core.internal_image import InternalImage
|
# Generated by Django 3.1.5 on 2021-05-29 14:38
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
('interviews', '0001_initial'),
]
operations = [
migrations.AlterField(... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Backbone modules.
"""
from collections import OrderedDict
import torch
import torch.nn.functional as F
import torchvision
from torch import nn
from torchvision.models._utils import IntermediateLayerGetter
from typing import Dict, List
from uti... |
# Copyright 2017 The Chromium Authors.
#
# 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.
"""This file defines the entry point for most external consumers of the Python
Codesearch library.
"""
from __fut... |
class Solution:
def singleNumber(self, nums: 'List[int]') -> 'int':
if not nums:
return 0
store = nums[0]
for number in nums[1:]:
store ^= number
return store
|
"""
Module: 'gc' on esp32_LoBo 3.2.9
"""
# MCU: (sysname='esp32_LoBo', nodename='esp32_LoBo', release='3.2.9', version='ESP32_LoBo_v3.2.9 on 2018-04-12', machine='ESP32 board with ESP32')
# Stubber: 1.1.2
def collect():
pass
def disable():
pass
def enable():
pass
def isenabled():
pass
def mem_alloc(... |
# Copyright (C) 2011 Atsushi Togo
# All rights reserved.
#
# This file is part of phonopy.
#
# 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
# notic... |
#!/usr/bin/sage
from sage.all import *
from Crypto.Util.number import getStrongPrime, bytes_to_long
from secret import flag
class PRNG256(object):
def __init__(self, seed):
self.mask = (1 << 256) - 1
self.seed = seed & self.mask
def _pick(self):
b = ((self.seed>>0)^(self.seed>>2)^(sel... |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 15 22:51:02 2020
@author: mofarrag
"""
import os
import numpy as np
import pandas as pd
import datetime as dt
from scipy.stats import gumbel_r
import matplotlib.pyplot as plt
import gdal
import zipfile
from statsmodels import api as sm
class Inputs():
def __init__(... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('petition', '0002_signature_telephone'),
]
operations = [
migrations.RemoveField(
model_name='signature',
... |
#!/usr/bin/env python3
# coding=utf-8
# ******************************************************************
# log4j-scan: A generic scanner for Apache log4j RCE CVE-2021-44228
# Original Author:
# Mazin Ahmed <Mazin at FullHunt.io>
# Modified by Megan Howell (CyberQueenMeg)
# Scanner provided by FullHunt.io - The Next-G... |
# Copyright 2009 by Peter Cock. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Runs a few EMBOSS tools to check our wrappers and parsers."""
import os
import sys
import unit... |
from aiohttp import web
import aiohttp_jinja2
from aiohttp_security import remember
from aiohttp_security import forget
from aiohttp_security import is_anonymous
from ..routes import routes
from .users import user_map
__all___ = ['login_page', 'login_handler', ]
@routes.get('/')
async def index_page(request: web.R... |
'''
Faça um programa que leia um numero qualquer e mostre o seu fatorial.
ex; 5! = 5 x 4 x 3 x 2 x 1 = 120
'''
'''from math import factorial
n = int(input('Digite um Numero pra calcular seu Factorial '))
f = factorial(n)
print('O factorial de {} é {}.'.format(n, f))'''
n = int(input('Digite um Numero pra calcular ... |
#!/usr/bin/env python
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ _|_ _|
# | |) | (_) | | .` | (_) || | | _|| |) | | ... |
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... |
import unittest
from urllib.error import HTTPError
from pystac import STAC_IO
from pystac.cache import CollectionCache
from pystac.serialization import (identify_stac_object, identify_stac_object_type,
merge_common_properties, STACObjectType)
from pystac.serialization.identify import ... |
def pascal_triangle(lineNumber):
list1 = list()
list1.append([1])
i = 1
while(i < lineNumber):
j = 1
l = []
l.append(1)
while(j < i):
l.append(list1[i - 1][j] + list1[i - 1][j - 1])
j = j + 1
l.append(1)
list1.append(1)
i = ... |
# -*- coding: UTF-8 -*-
from collections import OrderedDict
from itertools import groupby, product
from sympy import Basic, S
from sympy import Matrix, ImmutableDenseMatrix
from sympy.core.containers import Tuple
from sympde.expr import LinearForm
from sympde.expr import BilinearFor... |
from opera.parser.yaml.node import Node
from ..entity import Entity
from ..path import Path
from ..string import String
class ImportDefinition(Entity):
ATTRS = dict(
file=Path,
repository=String,
namespace_prefix=String,
namespace_uri=String,
)
DEPRECATED = {
"name... |
"""The AVE and GameLibrary classes that run AVE in a terminal."""
import os
import json
from . import config
from .exceptions import (AVEGameOver, AVEWinner, AVEToMenu, AVEQuit,
AVENoInternet)
from .game import Game
from .parsing.game_loader import (
load_game_from_file, load_library_json... |
class Solution:
def isBipartite(self, graph: List[List[int]]) -> bool:
def isPossible(curr_node, curr_color):
if color[curr_node]:
return color[curr_node] == curr_color
color[curr_node] = curr_color
for neighbor in graph[curr_node... |
# Generated by Django 3.2.5 on 2021-08-24 13:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('containers_app', '0029_auto_20210824_1432'),
]
operations = [
migrations.AddField(
model_name='building',
name='get_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.