text stringlengths 2 999k |
|---|
#!/usr/bin/env python
import sys
import os.path
import re
import random
import math
ground_function = ""
def validate_ground_func_file():
global ground_function
with open(sys.argv[3], 'r') as file:
line = file.readline()
line = line.strip()
if line == 'NBF':
line = fil... |
import requests
import base64
import os
import json
import sys
class Imgur(object):
'''
Anonymous image upload on imgur.com with client_id
'''
def __init__(self,img_path):
self.img_path = os.path.expanduser(img_path)
try:
with open(self.img_path,'rb') as img:
... |
from tensorflow.keras.models import Model
from model_compression_toolkit import FrameworkInfo
from model_compression_toolkit.common.framework_info import ChannelAxis
from model_compression_toolkit.common.model_validation import ModelValidation
from model_compression_toolkit.keras.constants import CHANNELS_FORMAT, CHAN... |
from math import sin
import numpy as np
from mpi4py import MPI
class Task:
f = staticmethod(lambda x, y: x * y)
f_left = f1 = staticmethod(lambda y: y ** 2)
f_right = f2 = staticmethod(lambda y: sin(y))
f_bottom = f3 = staticmethod(lambda x: x ** 3)
f_top = f4 = staticmethod(lambda x: x ** 2)
c... |
from .preprocessing import *
from .analysis import * |
#!/usr/bin/env python3
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project_conf.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
|
"""blog URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vi... |
#!/usr/bin/python3
# Copyright 2021. FastyBird s.r.o.
#
# 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 re... |
#!/usr/bin/env python
# coding: utf-8
# # This notebook graphs the sales and expenditure data of OTC codeine for 31 countries
# In[1]:
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
#and make the plots appear in the notebook
get_ipython().run_line_magic('matplotlib', ... |
import torch
from torch_geometric.nn import ChebConv
class GConvGRU(torch.nn.Module):
r"""An implementation of the Chebyshev Graph Convolutional Gated Recurrent Unit
Cell. For details see this paper: `"Structured Sequence Modeling with Graph
Convolutional Recurrent Networks." <https://arxiv.org/abs/1612.0... |
from kinetics.reaction_classes.reaction_base_class import Reaction
""" Michaelis-Menten irreversible equations """
class Uni(Reaction):
def __init__(self,
kcat=None, kma=None, a=None, enz=None,
substrates=[], products=[]):
super().__init__()
self.reaction_substr... |
import argparse
import csv
import json
import os
import sys
from urs.utils import Export, Global
### Function names are pretty self-explanatory, so I will not be adding comments
### above the functions.
### Includes a total of 26 tests.
class MakeArgs():
"""
Making dummy args to test Export.py functions.
... |
from model.group import Group
import random
def test_delete_some_group(app,db,check_ui):
if len(db.get_group_list()) == 0:
app.group.create(Group(name="test"))
old_groups=db.get_group_list()
group=random.choice(old_groups)
app.group.delete_group_by_id(group.id)
new_groups=db.get_group_list(... |
import numpy as np
# exp_dist <-> f(x, beta) = (1/beta) * exp(-(1/beta) * x)
beta = 10
process_count = 20
a=np.round(np.random.exponential(scale=beta, size=(process_count,2)))
np.savetxt("process.csv", a, delimiter=",",fmt="%i")
# Generates Arrival time and burst time
|
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
#
# Testing DataSet
#
# Launch it by issuing:
# python3 -m unittest test_dataset -v
#
import os, sys; sys.path.append(os.path.dirname(os.path.realpath(__file__)))
import unittest
from schema import (
Schema,
#SchemaError,
#Use,
)
from dataset import DataSetRAM
from . import app, log, create_app
# creat... |
_base_ = [
'../_base_/datasets/coco_detection.py',
'../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py'
]
model = dict(
type='ATSS',
pretrained='torchvision://resnet50',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
... |
# Generated by Django 3.2.5 on 2021-08-31 08:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('data', '0048_auto_20210823_1451'),
]
operations = [
migrations.AddField(
model_name='taxon',
name='taieol_desc',
... |
#!/usr/bin/env python
# Copyright 2019 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... |
# Copyright (c) 2011-2015 Berkeley Model United Nations. All rights reserved.
# Use of this source code is governed by a BSD License (see LICENSE).
from rest_framework import serializers
from huxley.core.models import SecretariatMember
class SecretariatMemberSerializer(serializers.ModelSerializer):
class Meta:
... |
import sys
sys.path.append("..")
import os
from keras.models import Model
from keras.layers import Activation, Input, Flatten, Dense, Dropout, BatchNormalization, Conv2D, MaxPooling2D, AveragePooling2D, concatenate, GlobalAveragePooling2D, Lambda
from keras.layers.convolutional import Conv2D, MaxPooling2D, AveragePooli... |
# UGLY HACKY SCRIPT FOR CONVERTING JOHN's CSV OUTPUT TO MY CSV OUTPUT
import os
import argparse
import pandas as pd
# python2 merge_and_convert.py --mode M --inpath ./john_results/final_preds_mort.csv
# python2 merge_and_convert.py --mode M --inpath ./john_results/train_final_preds_mort.csv
# python2 merge_and_conve... |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test fee estimation code."""
from decimal import Decimal
import random
from test_framework.messages im... |
import warnings
from mock import patch
import numpy as np
import pandas as pd
from pandas.core.common import PerformanceWarning
from zipline import TradingAlgorithm
from zipline.finance.trading import SimulationParameters
from zipline.testing import (
MockDailyBarReader,
create_daily_df_for_asset,
create_... |
from tf_explain.core.vanilla_gradients import VanillaGradients
def test_should_explain_output(convolutional_model, random_data, mocker):
mocker.patch(
"tf_explain.core.vanilla_gradients.grid_display", side_effect=lambda x: x
)
images, labels = random_data
explainer = VanillaGradients()
gri... |
# (C) Copyright Artificial Brain 2021.
#
# 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 ... |
import os
from conans.client.graph.graph import RECIPE_CONSUMER, RECIPE_VIRTUAL
from conans.client.cache.remote_registry import Remote
from conans.errors import ConanException
from conans.model.manifest import FileTreeManifest
from conans.model.ref import PackageReference
from conans.paths.simple_paths import SimplePa... |
import csv
import re
import datetime
from programy.clients.client import BotClient
from programy.utils.files.filefinder import FileFinder
from programy.clients.events.console.config import ConsoleConfiguration
class TestQuestion(object):
def __init__(self, question, answers, topic=None, that=None):
self.... |
"""
Created on Wed May 20 15:52:47 2020
@author: Alberto
"""
import numpy as np
import scipy.stats as st
from nc_methods import NetCDFManager
import warnings
#------------------------------------------------------------------------------
class WIND(NetCDFManager):
kernels = {'op_sobel':np.array([[3,0,3], [... |
import sys
import os
from Octopus import Octopus
f = open(os.path.join(sys.path[0], './data.txt'), 'r')
lines = [l.rstrip() for l in f.readlines()]
def getOctopusNeighbors(grid, x, y):
neighbors = []
if x>0:
neighbors.append(grid[y][x-1])
if x<len(grid[0])-1:
neighbors.append(grid[y][x+1])... |
import tensorflow as tf
tf.compat.v1.disable_v2_behavior()
from src.datasets.toxic import Toxic
from src.datasets.util import splits
from src.models.cnn2 import getCNN2
from src.models.embedding import *
from src.models.predict import predict_mcdropout
import yaml
import pandas as pd
import tensorflow as tf
from ge... |
"""
Example of hyperparameter search in MLflow using simple random search.
The run method will evaluate random combinations of parameters in a new MLflow run.
The runs are evaluated based on validation set loss. Test set score is calculated to verify the
results.
Several runs can be run in parallel.
"""
from concur... |
# -*- coding: utf-8 -*-
import copy
import json
import os
import re
import shutil
import subprocess
import time
from requests_toolbelt import MultipartEncoder
from . import config
def download_video(
self,
media_id,
filename=None,
media=False,
folder="videos"
):
video_urls = []
if not me... |
from tests.fixtures.regressors.simple_gaussian_cnn_regressor import (
SimpleGaussianCNNRegressor)
from tests.fixtures.regressors.simple_gaussian_mlp_regressor import (
SimpleGaussianMLPRegressor)
from tests.fixtures.regressors.simple_mlp_regressor import (SimpleMLPRegressor)
__all__ = [
'SimpleGaussianCNNR... |
#!/usr/bin/env python
import rospy
import tf
from nav_msgs.msg import OccupancyGrid
_bot_count=3
_bot_ns="tb3_"
_base_link_frame="base_footprint"
_map_frame="map"
fsl=0.50 #footprint side length
def mainprocess(_map):
_width=_map.info.width
_height=_map.info.height
_resolution=_map.info.resolution
_m... |
import json
from sanic import Sanic, text
from sanic.log import LOGGING_CONFIG_DEFAULTS, logger
LOGGING_CONFIG = {**LOGGING_CONFIG_DEFAULTS}
LOGGING_CONFIG["formatters"]["generic"]["format"] = "%(message)s"
LOGGING_CONFIG["loggers"]["sanic.root"]["level"] = "DEBUG"
app = Sanic("FakeServer", log_config=LOGGING_CONFI... |
import os
from glob import glob
import shutil
from tqdm import tqdm
import dicom2nifti
import numpy as np
import nibabel as nib
from monai.transforms import(
Compose,
AddChanneld,
LoadImaged,
Resized,
ToTensord,
Spacingd,
Orientationd,
ScaleIntensityRanged,
CropForegroundd,
)
from mo... |
"""[Default values]
What happens at run time...
When modules are loaded: All the code is executed immediately.
Module Code
a = 10 the interger object 10 is created and a references it.
def func(a): the function object is created, and func references it.
print(a)
... |
"""
Copyright 2012 Illumina
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
d... |
import os
# toolchains options
ARCH='arm'
CPU='cortex-m4'
CROSS_TOOL='keil'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
# cross_tool provides the cross compiler
# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = ... |
import asyncio
import itertools
import os
import random
from functools import partial
from async_timeout import timeout
import youtube_dl as yt
import discord
from discord.ext import commands
from tools.locales import alias
ytdlopts = {
'format': 'bestaudio/best',
'restrictfilenames': True,
'noplaylist':... |
"""
Django settings for crm_agile project.
Generated by 'django-admin startproject' using Django 3.2.9.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
import dja... |
from __future__ import absolute_import
from sentry_sdk.hub import Hub
from sentry_sdk.integrations import Integration, DidNotEnable
from sentry_sdk.integrations._wsgi_common import RequestExtractor
from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware
from sentry_sdk.utils import capture_internal_exceptions, e... |
class CeilingType(HostObjAttributes,IDisposable):
""" Represents a ceiling type in Autodesk Revit. """
def Dispose(self):
""" Dispose(self: Element,A_0: bool) """
pass
def getBoundingBox(self,*args):
""" getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """
pass
def ReleaseUnmanagedResource... |
#! /usr/bin/python3
# -*- encoding: utf-8 -*-
"""latex2html.py - Converts LaTeX documents into HTML documents.
Copyright 2015 by Eckhart Arnold
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
... |
# Copyright 2010-2018 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... |
"""
Django settings for neighborhood project.
Generated by 'django-admin startproject' using Django 3.2.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
import ... |
def importCONFT(fobj):
CONFT = dict()
for i, v in enumerate(fobj):
if (i > 1) and (v.strip() != ""):
CodUTE = v[0:6].decode('utf-8').strip()
nome = v[6:20].decode('utf-8').strip()
ssis = v[20:26].decode('utf-8').strip()
exis = v[26:33].decode('utf-8').stri... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 9 19:22:34 2020
@author: arti
"""
import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('default')
df = pd.read_csv('./auto-mpg.csv', header=None)
df.columns = ['mpg', 'cylinders', 'displacement', 'horsepower', 'weight',
... |
from unittest.mock import patch
import datetime as dt
import os
import unittest
from nose.tools import assert_equals, assert_true, assert_false, assert_raises
import numpy as np
import numpy.testing as npt
import pandas as pd
import seaice.data as sid
import seaice.data.api as api
import seaice.data.errors as e
impor... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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, Optional, Sequence, Union, overload
from ... import _utilities
fro... |
from collections import defaultdict
from nose.tools import *
from nose import SkipTest
import networkx as nx
from networkx.algorithms.communicability_alg import *
class TestCommunicability:
@classmethod
def setupClass(cls):
global numpy
global scipy
try:
import numpy
... |
import graphene
from graphene_django.converter import convert_django_field
from grapple.utils import resolve_queryset
from modelcluster.contrib.taggit import ClusterTaggableManager
from taggit.models import Tag
from .structures import QuerySetList
@convert_django_field.register(ClusterTaggableManager)
def convert_... |
from textwrap import dedent
from setuptools import setup
setup(
version='1.2.0',
name='clingox',
description='Support library for clingo.',
long_description=dedent('''\
Please check the [API documentation](https://potassco.org/clingo/python-api/current/) on how to use this module.
'''),... |
from __future__ import annotations
import dataclasses
import logging
import time
from secrets import token_bytes
from typing import Any, Dict, List, Optional, Set, Tuple
from blspy import AugSchemeMPL, G2Element
from salvia.consensus.cost_calculator import calculate_cost_of_program, NPCResult
from salvia.full_node.b... |
# Copyright 2014 Rackspace Hosting
# 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... |
# Copyright 2018 The TensorFlow 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 applica... |
import sys
sys.path.append('../OpenMiChroM')
from ChromDynamics import MiChroM
from Optimization import FullTraining, CustomMiChroMTraining
from CndbTools import cndbTools
class testMichrom():
def runDefault(self):
a = MiChroM(name="test", temperature=1.0, time_step=0.01)
a.setup(platform=... |
def can_build(plat):
return (plat == "android")
def configure(env):
if env["platform"] == "android":
# Amazon dependencies
env.android_add_dependency("compile fileTree(dir: '../../../modules/godotamazon/android/lib/', include: ['*.jar'])")
env.android_add_java_dir("android/src")
... |
#!/usr/bin/env python
# Lint as: python3
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from absl.testing import absltest
from grr_response_core.lib.rdfvalues import osquery as rdf_osquery
class OsqueryTableTest(absltest.TestCase):
def testColumnEmp... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('invite_only', '0002_invitecode_invited_by'),
]
operations = [
migrations.AlterField(
model_name='invitecode',
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=12
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for... |
# Generated by Django 3.0.7 on 2020-08-17 18:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('staff', '0002_staff_status'),
]
operations = [
migrations.AddField(
model_name='staff',
name='comment',
... |
# -*- coding: utf-8 -*-
"""neighbourhoods.py
Scripts to extract the areal units where the different classes are
over-represented, and cluster the areal units that have common boundaries.
"""
from __future__ import division
import math
import shapely
import itertools
import networkx as nx
import marble as mb
from comm... |
# Copyright 2021-2022 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
"""
Custom Types.
"""
import copy
import logging
from typing import Any
from typing import Callable
from typing import Dict
from typing import Tuple
from typing import TYPE_CHECKING
import attr
from typing_extensions import Protocol
from pytests... |
# -*- coding: utf-8 -*-
class Singleton(type):
"""Base type of singletons, such as the main Quantarhei class Manager
Recipe "Creating a singleton in Python" from Stack Overflow.
Usage:
------
class MyClass(BaseClass, metaclass=Singleton)
"""
_instanc... |
# -*- coding: utf-8 -*-
# Copyright 2019 The Matrix.org Foundation C.I.C.
#
# 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... |
import os
import shutil
import yaml
import pytest
import doublenegative
from random import choice
from pathlib import Path
from string import ascii_uppercase
TEST_CONFIG_PATH = Path.cwd() / 'data' / 'test_config.yaml'
NUM_GENRES = 3
NUM_MP3S = 5
def random_str(length=5):
return ''.join(choice(ascii_uppercase) f... |
#! /usr/bin/env python3
def func1():
x = (1,2,3,4,5)
print(type(x))
print(x)
print("x[3]=", x[3])
print("x.index(3)=", x.index(3))
print("x.count(3)=", x.count(3))
def func2():
x = (1,2,3)
y = [1,2]
z = [x,y]
print(z)
print(x)
x += (4,5)
print(x)
print(y)
y+= [3,4]
print(y)
print... |
__all__ = [
"HistoryWindow"
]
from .branch_tree_view import (
BranchTreeview
)
from .gui_toplevel import (
GUIToplevel
)
from .scrollframe import (
add_scrollbars_native
)
from common import (
mlget as _
)
class HistoryWindow(GUIToplevel):
def __init__(self, gui_project_history_tracker, *arg... |
"""
Summary: GUI to interface with ToDo API
Author: John E Lutz
email: johnelutz@me.com
"""
import json
import PySimpleGUI as psg
import requests
def add(name, description, date, importance):
response = requests.get(
f"http://lutzejohn.pythonanywhere.com/v1/add?name={name}\
&descripti... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import threading
import socks
import socket
import time
import json
import string
import random
import os
from core.alert import *
from ftplib import FTP
from core.targets import target_type
from core.targets import target_to_host
from core.load_modules import load_file_pa... |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 13 13:57:03 2019
@author: RGB
"""
import cv2
import numpy as np
import os
from glob import glob
import matplotlib.pyplot as plt
def normalize_color_image(img_path):
'''
img = cv2.imread(img_path)
img_yuv = cv2.cvtColor(img, cv2.COLOR_RGB2YU... |
#!/usr/bin/env python3
from AnalyzeStatsArgs import args
from Analyses import Analyses
import analyze_config as anconf
import config as conf
from copy import deepcopy
import diag_utils as du
import logging
import logsetup
import multiprocessing as mp
import os
import StatisticsDatabase as sdb
_logger = logging.getLo... |
# -*- coding: utf-8 -*-
import sys
import os
reload(sys)
sys.setdefaultencoding("utf-8")
from sqlalchemy import Table
from yaml import load
try:
from yaml import CSafeLoader as SafeLoader
print "Using CSafeLoader"
except ImportError:
from yaml import SafeLoader
print "Using Python SafeLoader"
def importyaml(conn... |
from itertools import groupby
from pathlib import Path
def main() -> None:
code = Path("src", "input.txt").read_text()
instructions = map(str.split, code.splitlines())
# Condense instructions into an easier-to-parse form
condensed = []
for var, ops in groupby(instructions, lambda kv: kv[1]):
... |
import pygame
from core import Vector2D, Color
from .shape import Shape
class Rectangle(Shape):
def __init__(self, position: Vector2D, size: Vector2D, color: Color):
self._position = position
self.size = size
self.color = color
self.size_color = color[:]
self.rect = pygam... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: resource_metric_source.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from goog... |
import os
import cv2
from skimage import io
import sys
# import keras
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import argparse
from natsort import natsorted
# sys.path.append('../')
import segmentation_models_v1 as sm
from segmentation_models_v1 import Unet, Linknet, PSPNet, FPN, AtUne... |
# Generated by Django 3.1.5 on 2021-05-12 17:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("blogging", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="Category",
fields=[
(
... |
"""
Copyright (C) 2018-2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to i... |
r"""
Unique factorization domains
"""
#*****************************************************************************
# Copyright (C) 2008 Teresa Gomez-Diaz (CNRS) <Teresa.Gomez-Diaz@univ-mlv.fr>
#
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/licenses/
#**... |
# -*- coding: utf-8 -*-
"""Base exchange class"""
# -----------------------------------------------------------------------------
__version__ = '1.18.64'
# -----------------------------------------------------------------------------
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import NetworkEr... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
import numpy as np
from viztools.tools import generate_image
class Snapshot:
"""
Formalized view of the data saved in our database. This just cleans it up
and makes sure everything is correct before it can be used elsewhere.
"""
def __init__(self,
lats,
lons,
... |
from route53.xml_parsers.common_health_check import parse_health_check
def get_health_check_by_id_parser(root, connection):
"""
Parses the API responses for the
:py:meth:`route53.connection.Route53Connection.get_health_check_by_id` method.
:param lxml.etree._Element root: The root node of the etree pa... |
# Copyright (c) 2012 iQIYI Inc.
# Copyright (c) 2013 Tencent Inc.
# Copyright (c) 2014 Huahang Liu
#
# All rights reserved.
#
# Author: Jingxu Chen <chenjingxu@qiyi.com>
# Feng Chen <chen3feng@gmail.com>
# Huahang Liu <liuhuahang@zerus.co>
#
# Date: June 28, 2014
"""
A helper class to get the files... |
from .UploadAzureDriver import UploadAzureDriver |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Font(_BaseTraceHierarchyType):
# color
# -----
@property
def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000'... |
from time import perf_counter_ns as ns
class Solution:
def search(self, nums: list[int], target: int) -> int:
low, high = 0, len(nums) - 1
while low <= high:
if (nm := nums[mid := (low + high) // 2]) == target:
return mid
if (nl := nums[low]) <= target <= nm... |
# -*- coding: utf-8 -*-
# MIT License
# Copyright (c) 2018, Marco Marzetti <marco@lamehost.it>
# 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 limita... |
from __future__ import absolute_import
from __future__ import unicode_literals
import datetime
import logging
import operator
import re
from functools import reduce
import enum
import six
from docker.errors import APIError
from . import parallel
from .config import ConfigurationError
from .config.config import V1
fr... |
import codecs
with codecs.open('1-1000_de.txt','r','utf-8') as infile:
with codecs.open('1-1000_de2.txt','w','utf-8') as outfile:
for line in infile:
outfile.write(line.split('#')[0] + '\n')
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from koheron import command, connect
import time
import pdb
class SkyTrackerInterface(object):
def __init__(self, client):
self.client = client
# setter
@command()
def set_led_pwm(self, value):
return self.client.recv_bool()
... |
# Copyright 2018 The TensorFlow Probability 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 o... |
from django import template
import filters.forest as forest
import json
register = template.Library()
@register.simple_tag(takes_context=False)
def render_full(src, inp):
# load some json
obj = json.loads(inp)
# parse the source code
tree = forest.parse(src)
# make a layout with the given objec... |
import pyximport
from pyximport import install
import numpy as np
import os
sourcefiles = []
include_dirs = [np.get_include(), "./"]
dirname = "./"
if os.path.exists(dirname):
include_dirs.append(dirname)
setup_args = {"include_dirs": include_dirs}
build_dir = "./__X_build/"
# build_dir = None
PYXIMPORTCPP_FLAG ... |
"""Hydration from users ids to csv file
MIT License (MIT)
Copyright (c) 2015 Julien BLEGEAN <julien.blegean@aalto.fi>
"""
from datetime import datetime
import json
import math
import sys
import csv
import os
import time
import requests
from requests_oauthlib import OAuth1
from urlparse import parse_qs
# taken from
... |
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# THIS SOFTWARE IS PRO... |
import requests
from ebooks.provider.ebook import Ebook
from ebooks.provider.ebook_provider import EbookProvider
class WereadEbookProvider(EbookProvider):
def __init__(self):
self.url = 'https://weread.qq.com/web/search/global?' \
'keyword={}&maxIdx={}&count=20'
def get_ebooks(self... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.