text stringlengths 2 999k |
|---|
"""redwing URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
from import_export import resources
from import_export.admin import ImportExportModelAdmin
# from import_export.admin import ImportExportActionModelAdmin
from django.contrib import admin
from .models import TimePost, Client, Project
class TimePostResource(resources.ModelResource):
class Meta:
model = Tim... |
import asyncio
import json
import os
import sys
import multiprocessing
import webbrowser
import requests
import requests.cookies
import logging as log
import subprocess
import time
import re
from typing import Union, List, Dict
from galaxy.api.consts import LocalGameState, Platform
from galaxy.api.plugin import Plugin... |
import functools
from django_countries.serializers import CountryFieldMixin
from rest_framework import serializers
from rest_framework.reverse import reverse
from standards.models import Jurisdiction, UserProfile
from standards.models import ControlledVocabulary, Term
from standards.models import TermRelation
from s... |
from collections.abc import MutableMapping
from dask.utils import stringify
from .utils import log_errors
class PublishExtension:
"""An extension for the scheduler to manage collections
* publish_list
* publish_put
* publish_get
* publish_delete
"""
def __init__(self, scheduler):
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 31 16:29:33 2019
@author: jlee
"""
import time
start_time = time.time()
import numpy as np
import glob, os
import g0_init_cfg as ic
# ----- Importing IRAF from the root directory ----- #
current_dir = os.getcwd()
os.chdir(ic.dir_iraf)
from pyr... |
__author__ = 'sibirrer'
from lenstronomy.LensModel.Profiles.base_profile import LensProfileBase
from lenstronomy.LensModel.Profiles.cored_density import CoredDensity
from lenstronomy.LensModel.Profiles.cored_density_2 import CoredDensity2
from lenstronomy.LensModel.Profiles.cored_density_exp import CoredDensityExp
fro... |
# -*- coding: utf-8 -*-
"""IdentityServicesEngineAPI network_access_time_date_conditions API fixtures and tests.
Copyright (c) 2021 Cisco and/or its affiliates.
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... |
#-*- coding: utf-8 -*-
import six
import base64
import select
import logging
from hashlib import sha1
from wsgiref import util
import django
from django.core.wsgi import get_wsgi_application
from django.core.servers.basehttp import WSGIServer, ServerHandler as _ServerHandler, WSGIRequestHandler as _WSGIRequestHandler
f... |
import pathlib
from typing import Callable, Dict
import os
import logging
from snorkel.classification import cross_entropy_with_probs
import torch
from torch import Tensor
from torch.optim import SGD
from torch.optim.optimizer import Optimizer
from knodle.trainer.utils.utils import check_and_return_device, set_seed
... |
import unittest
import urllib2
from flask.ext.testing import LiveServerTestCase, TestCase
from tmb import app as tmbapp, db
from tmb.models import User
class TestTMB(TestCase):
def setUp(self):
db.create_all()
super(TestCase, self).setUp()
def tearDown(self):
db.session.remove()
... |
import pytest
import os
import math
import torch
@pytest.fixture
def image_size():
return 256
@pytest.fixture
def strides():
return [8, 16, 32, 64]
@pytest.fixture
def sample(image_size):
return (
torch.tensor([
[5, 11, 200, 210],
[149, 40, 227, 121],
[38, 118, 119, 180],
[190, 187, 230, 232]],... |
# Copyright 2017 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 accompa... |
def chain(*iters):
for l in iters:
yield from l
|
# Copyright 2015 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
import os
from django.test import TestCase
from django.core.files import File as DjangoFile
from filer.models.foldermodels import Folder
from filer.models.imagemodels import Image
from filer.models.clipboardmodels import Clipboard
from filer.admin.clipboardadmin import UploadImageFileForm
from filer.tests.helpers impo... |
from .bits import Reader
from .iab_tcf import base64_decode
class ConsentV1:
"""Represents a v1.1 consent with all the information extracted.
:param consent: The consent to process in bytes.
"""
def __init__(self, consent: bytes):
self._reader: Reader = Reader(consent)
self.version ... |
# -*- coding: utf-8 -*-
from ThymeBoost.trend_models.trend_base_class import TrendBaseModel
import numpy as np
import pandas as pd
class EwmModel(TrendBaseModel):
model = 'ewm'
def __init__(self):
self.model_params = None
self.fitted = None
def __str__(self):
return f'{self.mo... |
#!/usr/bin/env python3
# Copyright (c) 2019 The Zcash developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php .
'''
Test rollbacks on post-Heartwood chains.
'''
from test_framework.test_framework import BitcoinTestFramework
fr... |
"""Helps you output colourised code snippets in ReportLab documents.
Platypus has an 'XPreformatted' flowable for handling preformatted
text, with variations in fonts and colors. If Pygments is installed,
calling 'pygments2xpre' will return content suitable for display in
an XPreformatted object. If it's not instal... |
# Copyright (c) 2021 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... |
"""PBR renderer for Python.
Author: Matthew Matl
"""
import sys
import numpy as np
import PIL
from .constants import (RenderFlags, TextAlign, GLTF, BufFlags, TexFlags,
ProgramFlags, DEFAULT_Z_FAR, DEFAULT_Z_NEAR,
SHADOW_TEX_SZ, MAX_N_LIGHTS)
from .shader_program import... |
import numpy as np
import numpy.matlib
from matplotlib import cm
from tfc.utils import MakePlot
# Import the model from the auxillary folder
import sys
sys.path.append("aux")
from Navier_Stokes_DeepTFC_aux import myModel
# Set CPU as available physical device
#import tensorflow as tf
#my_devices = tf.config.experime... |
import os
import click
from flask_migrate import Migrate
from app import create_app, db
from app.models import User, Role
# haetaan FLASK_CONFIG .flaskenv-tiedostosta:
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
migrate = Migrate(app, db)
with app.app_context():
db.create_all()
@app.shell_context_... |
from __future__ import print_function, absolute_import
import numpy as np
from typing import List, Set
class FemSelection(object):
def __init__(self):
self._data = set() # type: Set[int]
def clear(self):
self._data.clear()
def set_data1(self, data):
# type: (int)->None
... |
import subprocess
from PIL import Image
from pathlib import Path
from time import sleep
from View import View
from utils import Vector2, TouchVector2, console
class EVABot(object):
def __init__(self, screenSize : tuple = (1920, 1080), ip_address : str = None, runFromDevice : bool = False):
self.runFromDev... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-28 07:50
from __future__ import unicode_literals
from django.db import migrations
def tidy_progress_range(apps, schema_editor):
"""
Tidies progress ranges because a bug had caused them to go out of range
"""
ContentSessionLog = apps.get... |
from typing import Any, Dict, List, Type, TypeVar
import attr
T = TypeVar("T", bound="IndyEQProofM")
@attr.s(auto_attribs=True)
class IndyEQProofM:
""" """
additional_properties: Dict[str, str] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
field_dict: Dict[str, Any]... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'HaiFeng'
__mtime__ = '2017/1/17'
"""
import os, sys
if __name__ == "__main__":
# 切换到 generate 目录下
pre_dir = os.getcwd()
os.chdir(os.path.dirname(os.path.abspath(__file__)))
# src_dir = '../ctp_20180109_x86'
# s... |
#===============================================================================
# Copyright 2021-2022 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apa... |
# Copyright 2012-2014 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agree... |
from django.conf.urls import url, include
from django.contrib import admin
from django.http import HttpResponseNotFound, HttpResponseServerError
from test_app import views
handler404 = lambda r: HttpResponseNotFound()
handler500 = lambda r: HttpResponseServerError()
admin.autodiscover()
urlpatterns = [
url(r'^... |
"""
Python 2/3 compatibility.
"""
#noinspection PyUnresolvedReferences
from requests.compat import (
is_windows,
bytes,
str,
is_py3,
is_py26,
)
try:
from urllib.parse import urlsplit
except ImportError:
from urlparse import urlsplit
|
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 - 2017 Björn Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of python-quilt for details.
import os
import os.path
from quilt.utils import Process, DirectoryP... |
# Copyright (c) 2014 The Bitcoin Core developers
# Copyright (c) 2014-2015 The Dash developers
# Copyright (c) 2015-2017 The Agon developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Helpful routines for regression te... |
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... |
#
# Copyright 2015 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
#Mostly Notes for now
#Start of main program loop
#Run every 0.25 seconds
#Get ORP (Odometry Robot Position) as (float,float) tuple
#Get ORH (Odometry Robot Heading) as 0-360 range, float
#Function - Check if ORP and ORH make sense
#This is probably quite complicated , so do be mindful
#Function - Take ... |
""" Unit tests for pipelines
"""
import logging
import sys
import unittest
import numpy
from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.wcs.utils import pixel_to_skycoord
from rascil.data_models.polarisation import PolarisationFrame
from rascil.processing_components.calibratio... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from celery.datastructures import LRUCache
from celery.exceptions import ImproperlyConfigured
from celery.utils import cached_property
from .base import KeyValueStoreBackend
_imp = [None]
def import_best_memcache():
if _imp[0] is None:
is_p... |
# Copyright 2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... |
from __future__ import print_function
import numpy as np
import time
"""
init:
state = 0
c = random(0,T)
step:
if(a neighbor flashed)
c = c + k * c
else
c = c + 1
if(c >= T)
state = 1
c = 0
else
state = 0
"""
class Oscillator(object):
def __init__(se... |
# ------------------------------------------------------------------------------
# Copyright 2020 Graz University of Technology
#
# 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... |
"""
GCP provides a set of services for Google Cloud Platform provider.
"""
from src.diagrams import Node
class _ICONS(Node):
_provider = "icons"
_icon_dir = "../resources/icons"
fontcolor = "#2d3436"
|
import os
import sys
import numpy as np
import networkx as nx
import pyomo.environ as en
from pyomo.opt import SolverFactory
from pyomo.opt import TerminationCondition, SolverStatus
path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.
abspath(__file__)... |
NOEXEC = 'noexec'
NOSUID = 'nosuid'
NODEV = 'nodev'
|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import redirect
from django.views.generic import TemplateView
from django.shortcuts import render
from .forms import CommentForm
# Create your views here.
class CommentView(TemplateView):
http_method_names = ['post']
templa... |
##############################################################################
#
# Copyright (c) 2000-2009 Jens Vagelpohl and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS S... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render, redirect, HttpResponse
from django.core.urlresolvers import reverse
from django.contrib import messages
from .models import User
# Create your views here.
def users(request):
context = {
'user_list' : User... |
import re, os, sys, shutil
from pathlib import Path
import pandas as pd
import numpy as np
def split_wnd(df):
unsplit = df['wnd'].str.split(',')
wnd_metrics = pd.DataFrame.from_dict(
dict(zip(df.index, unsplit)),
orient='index',
columns=[
'wnd_direction', # The angle, m... |
# 10 Quiz
# What are the primitive type in python?
# Strings
# Interger number
# Float numbers
# Booleans - True and False
# What will we see in the terminal
fruit = "Apple"
print(fruit[1])
# p
# What will we see in the terminal?
fruit = "Apple"
# when slicing a string the last caracter called is not inclued
print(f... |
# 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 the Li... |
##############################################################################
# Copyright 2017 Parker Berberian and Others #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# yo... |
"""
Given a list of integers nums, return the sum of a non-empty contiguous sublist with the largest sum.
Constraints
1 ≤ n ≤ 100,000 where n is the length of nums
https://binarysearch.com/problems/Largest-Sublist-Sum
"""
class Solution:
def brute(self, nums):
ans = float("-inf")
for i in range(l... |
# Generated by Django 2.0.2 on 2018-05-03 06:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Game',
fields=[
... |
#!/usr/bin/env python3
import sys, os.path
from modules.Engine import Engine
def print_usage():
print("\nUSAGE: ./run.py [app_name] [guest_port] [host_port]")
print("EXAMPLE: ./run.py xssstored 8888 80\n")
sys.exit(0)
if __name__ == "__main__":
if len(sys.argv[1:]) != 3:
print_usage()
ap... |
from typing import List, Dict
import os
import gc
import time
import shutil
from pathlib import Path
from datetime import datetime
import numpy as np
import logging
from torch.utils.data import DataLoader
from tensorboardX import SummaryWriter
from catalyst.utils.seed import set_global_seed, Seeder
from catalyst imp... |
#!/usr/bin/python3
import os
import re
import sys
import time
import json
import pytz
import utils
import yaml
import datetime
import argparse
import textwrap
import random
from mysql import connector
cwd = os.path.dirname(__file__)
os.chdir(cwd)
sys.path.append("../utils")
from pathlib import Path
from ConfigUtils ... |
''' Tests ability to read plausible values from software examples.
'''
import unittest
import test.verify as verify
from test.base import Base
class Sample00(verify.WithinRangeTest, Base):
''' Sample00 containing software file examples from:
https://www.c3d.org/sampledata.html
'''
ZIP = 'sample00... |
from typing import List, Dict, Callable, Tuple, Generator, Set, Sequence
import functools
import operator
from collections import defaultdict
import random
from tython import Program, TastNode, _RULES_BY_KIND, Rule, nt
from models.model import CandidateGenerator, reachable_rules_by_kind
from models import RegisterMode... |
# 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 u... |
# Copyright (c) 2016, Aaron Christianson
# 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 list of condition... |
"""
Script to pull the latest changes from the SerGIS Server git repository and
put them in the web directory.
The defaults here assume:
- IIS with iisnode
- SerGIS Socket Server service set up through NSSM
But it can be easily modified for a different environment.
Before running this, make sure to set the configur... |
import os
import subprocess
import sys
from ..base import BaseTestCase
def inject_sitecustomize(path):
"""Creates a new environment, injecting a ``sitecustomize.py`` module in
the current PYTHONPATH.
:param path: package path containing ``sitecustomize.py`` module, starting
from the ddt... |
# coding: utf-8
"""
FlashArray REST API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.11
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
import typing
from ... |
def findRightInterval(intervals):
"""
:type intervals: List[List[int]]
:rtype: List[int]
"""
indexedIntervals = [ intervals[i]+[i] for i in range(len(intervals)) ] #[[3, 4, 0], [2, 3, 1], [1, 2, 2]]
indexedIntervals.sort() #[[1, 2, 2], [2, 3, 1], [3, 4, 0]]
ans = [-1]*len(intervals)
for ... |
"""
Tools model definitions
"""
from cuid import cuid
import time
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied
from django.db import models
from django.db.models.signals import pre_delete
from django.dispatch.dispatcher import receiver
from django.conf.global_settings import LANGUA... |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Unit tests for the common.py file."""
import gyp.common
import unittest
import sys
class TestTopologicallySorted(unittest.TestCase):
... |
# slimDNS
# Simple, Lightweight Implementation of Multicast DNS
# Copyright 2018 Nicko van Someren
# 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... |
import bm
import utils
@bm.register
class FlaskSimple(bm.Scenario):
tracer_enabled = bm.var(type=bool)
profiler_enabled = bm.var(type=bool)
def run(self):
with utils.server(self) as get_response:
def _(loops):
for _ in range(loops):
get_response()
... |
"""
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... |
import datetime
from sqlalchemy import *
from migrate import *
from sqlalchemy.databases import mysql
metadata = MetaData(migrate_engine)
# New tables
tag_table = Table('tag', metadata,
Column('id', mysql.MSBigInteger(unsigned=True), autoincrement=True, primary_key=True, nullable=False),
Column('entry_id',... |
import os
import pytest
import yaml
import numpy as np
import pandas as pd
from collections import namedtuple
from datetime import datetime, timedelta, date
from unittest import mock
from prophet import Prophet
import mlflow
import mlflow.prophet
import mlflow.utils
import mlflow.pyfunc.scoring_server as pyfunc_scori... |
from django.db import models
from django.conf import settings
from django.dispatch import receiver
from django.db.models.signals import pre_delete, post_save, m2m_changed, post_delete
from django.utils.text import get_valid_filename
from sortedm2m.fields import SortedManyToManyField
from datetime import date, datetim... |
from yaetos.etl_utils import ETL_Base, Commandliner
class Job(ETL_Base):
def transform(self, some_events):
df = self.query("""
SELECT se.session_id, session_length, session_length*2 as doubled_length
FROM some_events se
""")
return df
if __name__ == "__main__"... |
# Based on Sphinx
# Copyright (c) 2007-2020 by the Sphinx team.
# | 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 a... |
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(os.path.join(ROOT_DIR, 'utils'))
sys.path.append(os.path.join(ROOT_DIR, 'tf_ops/sampling'))
sys.path.append(os.path.join(ROOT_DIR, 'tf_ops/grouping'))
sys.path.append(os.path.join(ROOT_DIR, 't... |
import pytest
from .base import TestBase
pytestmark = pytest.mark.asyncio
class TestReadOnly(TestBase):
async def test_select(self, imap_server):
transport = self.new_transport(imap_server)
transport.push_login()
transport.push_select(b'Trash', 1, 1, readonly=True)
transport.pu... |
# -*- coding: utf-8 -*-
import sys
sys.path.append("./voc")
from rnaudio import *
# 录音测试
rna = Rnaudio()
filename = rna.Record()
rna.Play_WAV(filename)
rna.Delete(filename)
|
import numpy as np
from numpy import linalg as LA
import matplotlib.pyplot as plt
# stock prices (3x per day)
# [morning, midday, evening]
APPLE = np.array(
[[1,5],[3,-2],[-1,-4],[-2,1]])
# midday variance
print(APPLE.mean(axis=0))
cov = np.cov(APPLE,rowvar=0)
print(cov)
w, v = LA.eig(cov)
print(w)
print(v)
orig... |
"""
main class responsible for obtaining results from the Event Registry
"""
import six, os, sys, traceback, json, re, requests, time, logging, threading
from eventregistry.Base import *
from eventregistry.ReturnInfo import *
from eventregistry.Logger import logger
class EventRegistry(object):
"""
the core ... |
'''
Script to sort out the tags imported from ca.ckan.net to thedatahub.org and
got mangled in the process.
'''
import re
from optparse import OptionParser
import copy
import ckanclient
from status import Status
def sort_out_tags(source_ckan_uri,
dest_ckan_uri, dest_api_key,
):
... |
from src.cli.commands import execute
def run():
execute()
if __name__ == "__main__":
run()
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from io import StringIO
# StringIO behaves like a file object
c = StringIO("0 1\n2 3")
print(np.loadtxt(c))
d = StringIO("M 21 72\nF 35 58")
np.loadtxt(d, dtype={'names': ('gender', 'age', 'weight'),
'formats': ('S1', 'i4', 'f4')}... |
# -*- coding: UTF-8 -*-#
from builtins import object
from builtins import str
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
from rest_framework.exceptions import APIException
from action.serializers import ActionSerializer
from dataops import ops, pandas_db
from table... |
"""
Created: 26 April 2018
Last Updated: 26 April 2018
Dan Marley
daniel.edison.marley@cernSPAMNOT.ch
Texas A&M University
-----
Base class for performing unfolding
"""
import json
import datetime
import uproot
import numpy as np
import pandas as pd
import util
from unfoldingPlotter import UnfoldingPlotter... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import copy
import logging
import numpy as np
import torch
from reagent.core import types as rlt
from reagent.core.types import PreprocessedRankingInput
from reagent.training.reward_network_trainer import RewardNetTrainer
... |
# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
#!/usr/bin/python
# Helper resources => {
# https://pillow.readthedocs.io/en/3.0.x/handbook/tutorial.html
# https://pythonexamples.org/python-pillow-get-image-size/
# https://realpython.com/working-with-files-in-python/#getting-file-attributes
# }
import os
import sys
import shutil
from PIL import Image
#pri... |
from .Regex import Regex
from typing import Union
class Quantifier(Regex):
"""Quantifier class."""
def __init__(self, regex: Union[str, int, Regex] = "", n: int = 0, m: int = 0, without_maximum: bool = False):
super().__init__(regex)
self._set_regex(self.quantifier(n, m, without_maximum))
|
import numpy as np
import justice.simulate as sim
def test_make_gauss():
gauss_fcn = sim.make_gauss([1.0, ])
xs = sim.make_cadence([np.arange(0.0, 1.0, 0.1), ], [0.])
ys = gauss_fcn(xs)
expected = [1.,
0.99501248,
0.98019867,
0.95599748,
... |
import os
import tempfile
from pathlib import Path
from unittest import mock
from unittest import TestCase
import numpy as np
import pytest
import yaml
from bigbang.analysis.listserv import ListservArchive
from bigbang.analysis.listserv import ListservList
from config.config import CONFIG
dir_temp = tempfile.gettem... |
from WebScrapy import AlonhadatSpider
from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings
import logging
from selenium.webdriver.remote.remote_connection import LOGGER
from urllib3.connectionpool import log
log.setLevel(logging.WARNING)
LOGGER.setLevel(logging.WARNING)
i... |
#!/usr/bin/python2.7
input_sequence = '1113222113'
for i in range(0,50):
same_char_count = 1
previous_character = input_sequence[0]
input_sequence = input_sequence[1:]
next_sequence = ''
for character in input_sequence:
if character == previous_character:
same_char_count += ... |
import logging
import os
from dxtbx.serialize import xds
from iotbx.xds import spot_xds
from scitbx import matrix
logger = logging.getLogger(__name__)
def dump(experiments, reflections, directory):
"""Dump the files in XDS format"""
if len(experiments) > 0:
for i, experiment in enumerate(experiments... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.conf import settings
class Migration(SchemaMigration):
def forwards(self, orm):
db.execute("DROP VIEW IF EXISTS o_v_itineraire;... |
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
APP = ['CiscoBuild.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True,
'iconfile': 'DDIcon.icns'}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
... |
# Copyright 2013 IBM Corp
#
# Author: Tong Li <litong01@us.ibm.com>
#
# 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 ... |
# Copyright (c) 2009, 2010, 2011, 2012, 2013, 2016 Nicira, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.