text
string
size
int64
token_count
int64
from django.core.urlresolvers import resolve from django.urls import reverse from django.test import TestCase, RequestFactory from django.http import HttpRequest, Http404 from django.contrib.auth.models import User from unittest import skip from users.models import University, Faculty, Department, UserProfile from cms....
7,512
2,361
"""The present code is the Version 1.0 of the RCNN approach to perform MPS in 3D for categorical variables. It has been developed by S. Avalos and J. Ortiz in the Geometallurygical Group at Queen's University as part of a PhD program. The code is not free of bugs but running end-to-end. Any comments and further i...
4,903
2,268
import logging from typing import Dict from django.http import HttpRequest logger = logging.getLogger(__name__) class FeatureFlagProvider: def is_feature_enabled(self, feature_name: str, user_id: str = None, attributes: Dict = None): raise NotImplementedError("You must override FeatureFlagProvider.is_fe...
1,306
357
from sqlalchemy.ext.declarative import declarative_base Base = declarative_base()
82
26
# -*- coding: utf-8 -*- """Collection of functions for the manipulation of time series.""" from __future__ import absolute_import, division, print_function import itertools import os import warnings import mando import numpy as np import pandas as pd from mando.rst_text_formatter import RSTHelpFormatter from tstoolb...
34,227
10,523
from collections import OrderedDict import torch import torch.nn as nn from torch_geometric.data.batch import Batch class GNN(nn.Module): def __init__(self, mp_steps, **config): super().__init__() self.mp_steps = mp_steps self.update_fns = self.assign_update_fns() self.readout_fns...
2,255
653
import math import torch import torch.nn as nn from torch.nn.modules.module import Module from GNN.GCN_layer import GraphConvolution class GraphResConvolution(Module): """ Simple GCN layer, similar to https://arxiv.org/abs/1609.02907 """ def __init__(self, state_dim, name=''): super(GraphRes...
977
361
#!/usr/bin/env python3 from __future__ import print_function import os import re import sys from datetime import datetime from math import ceil from mtools.util.input_source import InputSource from mtools.util.logevent import LogEvent class LogFile(InputSource): """Log file wrapper class. Handles open file str...
28,569
7,683
""" SVG export test """ import test import pyqtgraph as pg app = pg.mkQApp() class SVGTest(test.TestCase): #def test_plotscene(self): #pg.setConfigOption('foreground', (0,0,0)) #w = pg.GraphicsWindow() #w.show() #p1 = w.addPlot() #p2 = w.addPlot() #p1.plot([1...
2,136
901
EVENT_SCHEDULER_STARTED = EVENT_SCHEDULER_START = 2 ** 0 EVENT_SCHEDULER_SHUTDOWN = 2 ** 1 EVENT_SCHEDULER_PAUSED = 2 ** 2 EVENT_SCHEDULER_RESUMED = 2 ** 3 EVENT_EXECUTOR_ADDED = 2 ** 4 EVENT_EXECUTOR_REMOVED = 2 ** 5 EVENT_JOBSTORE_ADDED = 2 ** 6 EVENT_JOBSTORE_REMOVED = 2 ** 7 EVENT_ALL_JOBS_REMOVED = 2 ** 8 EVENT_JO...
993
561
# 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 ...
25,166
8,754
"""This file contains functions for loading and preprocessing pianoroll data. """ import logging import numpy as np import tensorflow.compat.v1 as tf from musegan.config import SHUFFLE_BUFFER_SIZE, PREFETCH_SIZE LOGGER = logging.getLogger(__name__) # --- Data loader ----------------------------------------------------...
4,608
1,432
print(u"Olá mundo!")
20
10
from flask import Flask, app = Flask(__name__) @app.route("/") def homepage(): return "Paws Rescue Center 🐾" @app.route("/about") def about(): return """We are a non-profit organization working as an animal rescue center. We aim to help you connect with purrfect furbaby for you! The ani...
527
175
from __future__ import absolute_import from __future__ import division from __future__ import print_function from compas.geometry import bounding_box from compas.geometry import bounding_box_xy __all__ = [ 'mesh_bounding_box', 'mesh_bounding_box_xy', ] def mesh_bounding_box(mesh): """Compute the (axis...
1,780
682
from naive import NaiveSourceSelection from star_based import StarBasedSourceSelection from utils import AskSourceSelector, HybridSourceSelector, StatSourceSelector from charset_selector import CharSet_Selector
210
47
""" @Time : 201/21/19 10:47 @Author : TaylorMei @Email : mhy845879017@gmail.com @Project : iccv @File : base3_plus.py @Function: """
151
79
import math import time import numpy as np import numba as nb import quaternion # adds to numpy # noqa # pylint: disable=unused-import import sys import scipy from astropy.coordinates import SkyCoord from scipy.interpolate import RectBivariateSpline from scipy.interpolate import NearestNDInterpolator # from scipy.s...
48,787
19,579
import torch import torch.nn as nn import torch.nn.functional as F from .kernels import ( get_spatial_gradient_kernel2d, get_spatial_gradient_kernel3d, normalize_kernel2d ) def spatial_gradient(input, mode='sobel', order=1, normalized=True): """ Computes the first order image derivative in bo...
4,245
1,435
# -*- encoding: utf-8 -*- import gzip import io import glob from concurrent import futures def find_robots(filename): ''' Find all of the hosts that access robots.txt in a single log file ''' robots = set() with gzip.open(filename) as f: for line in io.TextIOWrapper(f, encoding='ascii'): ...
896
292
# ****************************************************************** # |docname| - Provide `docker_tools.py` as the script `docker-tools` # ****************************************************************** from setuptools import setup setup( name="runestone-docker-tools", version="0.1", install_requires=[...
421
111
from flask import Flask, render_template, request, jsonify,send_file, redirect,session, url_for from werkzeug import secure_filename import os import utilities, queries import logger from flask_cors import CORS, cross_origin from datetime import timedelta app = Flask(__name__) CORS(app) cors = CORS(app, resources={r"/*...
19,500
6,426
import os import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import numpy as np import matplotlib.pyplot as plt # local model import sys sys.path.append("../network") import Coral from lstm import LSTMHardSigmoid from AdaBN import AdaBN sys.path.append("../network/Aut...
13,634
5,989
"""Emmental model.""" import itertools import logging import os from collections import defaultdict from collections.abc import Iterable from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union import numpy as np import torch from numpy import ndarray from torch import Tensor, nn as nn from torch.nn i...
26,658
7,374
import asyncio, json from config import Config from soundpad_manager import SoundpadManager from version import BRIDGE_VERSION import websockets from sanic.log import logger # yes I know that it's very lazy to run a separate WS and HTTP server, when both could be run on the same port # I don't like sanics ...
4,578
1,723
#!/usr/local/bin/python # -*- coding: utf-8 -*- """ - LICENCE The MIT License (MIT) Copyright (c) 2016 Eleftherios Anagnostopoulos for Ericsson AB (EU FP7 CityPulse Project) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software...
18,565
6,375
from __future__ import absolute_import from __future__ import print_function from __future__ import division import unittest import pytest from tensorforce import TensorForceError from tensorforce.core.networks import LayeredNetwork from tensorforce.models import DistributionModel from tensorforce.tests.minimal_test ...
8,108
2,349
import random import messages_pb2 as msg def assign(x, y): x.a=y.a; x.b=y.b; x.c=y.c; x.d=y.d def isZero(x): return (x.a==0 and x.b==0 and x.c==0 and x.d==0) def setZero(x): x.a=0; x.b=0; x.c=0; x.d=0 def toStr(x): return "%08x-%08x-%08x-%08x" % (x.a, x.b, x.c, x.d) def toTuple(x): return (x.a,...
844
458
# In --strict mode, mypy complains about imports unless they're done this way. # # It complains 'Module has no attribute ABC' or 'Module "mango" does not explicitly export # attribute "XYZ"; implicit reexport disabled'. We could dial that back by using the # --implicit-reexport parameter, but let's keep things strict. ...
17,421
4,577
import lettercounter as lc #Books form Gutenberg Project: https://www.gutenberg.org/ebooks/author/69 lc.showPlots(text_directory_pathname="./Books/", title="Sir Arthur Conan Doyle's favourite letters", legend_label_main="in Doyle's stories")
259
88
from .bbItem import bbItem from ...bbConfig import bbData class bbTurret(bbItem): dps = 0.0 def __init__(self, name, aliases, dps=0.0, value=0, wiki="", manufacturer="", icon="", emoji=""): super(bbTurret, self).__init__(name, aliases, value=value, wiki=wiki, manufacturer=manufacturer, icon=icon, emoj...
1,017
376
from django.urls import path from what_can_i_cook.views import WCICFilterView, WCICResultView app_name = "wcic" urlpatterns = [ path("", WCICFilterView.as_view(), name="wcic-start"), path("results/", WCICResultView.as_view(), name="wcic-results"), ]
263
102
import ssg.utils def preprocess(data, lang): data["arg_name_value"] = data["arg_name"] + "=" + data["arg_value"] if lang == "oval": # escape dot, this is used in oval regex data["escaped_arg_name_value"] = data["arg_name_value"].replace(".", "\\.") # replace . with _, this is used in t...
436
144
import tensorflow as tf import os import contractions import tensorflow as tf import pandas as pd import numpy as np import time import rich from rich.progress import track import spacy from config import params #Preprocessing Text class preprocess_text(): def __init__(self): pass def remove_pa...
3,598
1,321
from setuptools import setup, find_packages from distutils.extension import Extension from distutils.command.sdist import sdist try: from Cython.Build import cythonize USE_CYTHON = True except ImportError: USE_CYTHON = False ext = 'pyx' if USE_CYTHON else 'c' extensions = [Extension( 'dsigma.precomput...
1,665
556
import cv2 import mediapipe as mp class FaceDetection(): # initialize the face detection class with arguments from https://google.github.io/mediapipe/solutions/face_detection.html def __init__(self, model_selection = 0, threshold = 0.5): self.model_selection = model_selection self.threshold = t...
1,967
661
import sys import logging # loggers_dict = logging.Logger.manager.loggerDict # # logger = logging.getLogger() # logger.handlers = [] # # # Set level # logger.setLevel(logging.DEBUG) # # # FORMAT = "%(asctime)s - %(levelno)s - %(module)-15s - %(funcName)-15s - %(message)s" # # FORMAT = "%(asctime)s %(levelno)s: %(modul...
5,585
1,882
# -*- coding: utf-8 -*- """ pyRofex.components.messages Defines APIs messages templates """ # Template for a Market Data Subscription message MARKET_DATA_SUBSCRIPTION = '{{"type":"smd","level":1, "entries":[{entries}],"products":[{symbols}]}}' # Template for an Order Subscription message ORDER_SUBSCRIPTION = ...
593
195
#!/usr/bin/env python3.4 from flask import Flask import requests from fibonacci import fibonacci as fib app = Flask(__name__) @app.route('/count/<key>') def count(key): return requests.get('http://127.0.0.1:8080/count/{}'.format(key)).text @app.route('/fibonacci/<n>') def fibonacci(n): return str(fib(int(...
405
173
# Future Imports for py2/3 backwards compat. from __future__ import (absolute_import, division, print_function, unicode_literals) from builtins import object from .xml_utils import get_attribute, get_content_of from future import standard_library standard_library.install_aliases() def fix_null...
3,613
1,143
from django.apps import AppConfig class SignupConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'signup'
144
47
# _*_ coding: utf-8 _*_ # @Time : 2021/3/29 上午 08:57 # @Author : cherish_peng # @Email : 1058386071@qq.com # @File : cmd.py # @Software : PyCharm from enum import Enum class EnumSubTitle(Enum): Request4e = 0x5400 # 请求 Request = 0x5000 # 应答 Respond = 0xD000 Respond4e = 0xD400 class EnumEndC...
768
513
from importlib.resources import path from jsonschema_typed import JSONSchema with path("sentry_data_schemas", "event.schema.json") as schema_path: EventData = JSONSchema["var:sentry_data_schemas:schema_path"]
214
66
# elsewhere... import pandas as pd from keras.models import model_from_json import random import sys import numpy as np maxlen = 15 step = 3 df = pd.read_pickle('articles.pandas') text = str.join(' ', df.text.tolist()) chars = set(text) print('total chars:', len(chars)) char_indices = dict((c, i) for i, c in enumer...
1,548
540
import unittest from simulation import container from simulation import person class ContainerTestCase(unittest.TestCase): def setUp(self) -> None: self.box = container.Container(100, 1000, 300, 1, 0.5) self.s_instance = person.Person(x=0, y=0, infection_probability=0.25, ...
4,200
1,224
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import pontoon.base.models class Migration(migrations.Migration): dependencies = [ ("base", "0006_auto_20150602_0616"), ] operations = [ migrations.AddField( model_name="...
1,403
418
# Copyright (c) 2014-present PlatformIO <contact@platformio.org> # # 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...
11,331
3,342
from . import send_message from . import receive_message
56
14
from django.conf import settings from django.contrib.auth import REDIRECT_FIELD_NAME from django.core.exceptions import PermissionDenied from django.http import HttpResponseForbidden, HttpResponseRedirect from django.utils.functional import wraps from django.utils.http import urlquote from django.db.models import Model...
6,830
1,777
from django import forms from django.forms import ModelForm from images.models import Image class ImageForm(ModelForm): class Meta: model = Image
160
41
# Copyright 2012-2013 Eric Ptak - trouch.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 applicable l...
8,749
2,994
# Copyright 2013 Nebula 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...
3,142
984
#!/usr/bin/env python3 import sys from os.path import dirname, abspath, join import subprocess # Note this does not resolve symbolic links # https://stackoverflow.com/a/17806123 FIREFOX_BINARY = join(dirname(abspath(__file__)), 'firefox') argvs = list(sys.argv) argvs[0] = FIREFOX_BINARY # geckdriver will run `firef...
1,134
387
import json import logging from collections import OrderedDict from decimal import ROUND_HALF_UP, Decimal from typing import Any, Dict, Union import pytz from django import forms from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.dispatch import receiver from django.fo...
37,177
9,422
from pysys.basetest import BaseTest from apama.correlator import CorrelatorHelper import os class PySysTest(BaseTest): def execute(self): corr = CorrelatorHelper(self, name='correlator') corr.start(logfile='correlator.log') corr.injectEPL(os.getenv('APAMA_HOME','') + '/monitors/ManagementImpl.mon') corr.injec...
633
238
from __future__ import absolute_import, division, print_function, unicode_literals from unittest import TestCase from beast.env.ReadEnvFile import read_env_file from beast.util import Terminal Terminal.CAN_CHANGE_COLOR = False JSON = """ { "FOO": "foo", "BAR": "bar bar bar", "CPPFLAGS": "-std=c++11 -frtti -fno...
1,231
485
import json from django.test import TestCase from django.contrib.auth.models import User from .models import CustomUser from django.apps import apps from .apps import SigninConfig class SignInTest(TestCase): def setUp(self): self.django_user = User.objects.create_user(username='testusername', password='t...
2,192
672
__author__ = 'Elias Haroun' class BinaryNode(object): def __init__(self, data, left, right): self.data = data self.left = left self.right = right def getData(self): return self.data def getLeft(self): return self.left def getRight(self): return self.r...
707
226
""" Main tokenizer. """ from itertools import * import sys, random import util import ply.lex as lex class Lexer: """ Lexer for boolean rules """ literals = '=*,' tokens = ( 'LABEL', 'ID','STATE', 'ASSIGN', 'EQUAL', 'AND', 'OR', 'NOT', 'NUMBER', 'LPAREN','RPAREN', 'COMMA'...
5,963
2,167
"""Unit tests for the InteractiveOption.""" from __future__ import absolute_import import unittest import click from click.testing import CliRunner from click.types import IntParamType from aiida.cmdline.params.options.interactive import InteractiveOption from aiida.cmdline.params.options import NON_INTERACTIVE cla...
14,736
4,144
""" Changes existing registered_meta on a node to new schema layout required for the prereg-prize """ import json import sys import logging from modularodm import Q from framework.mongo import database as db from framework.mongo.utils import from_mongo from framework.transactions.context import TokuTransaction from ...
3,195
882
""" Copyright (C) 2012 Alan J Lockett 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, publish, distribute,...
7,606
2,222
""" given a fully connected undirected graph(If no path exists between two cities, adding an arbitrarily long edge will complete the graph without affecting the optimal tour), find the path with the lowest cost in total for a salesman to travel from a given start vertex """ import time class Edge: def __init__(sel...
2,108
659
def moveBothTo(point): while hero.distanceTo(point) > 1: hero.move(point) hero.command(peasant, "move", point) peasant = hero.findNearest(hero.findFriends()) while True: hero.command(peasant, "buildXY", "decoy", peasant.pos.x + 2, peasant.pos.y) var nextPoint = {"x": hero.pos.x,...
620
243
# The isBadVersion API is already defined for you. # @param version, an integer # @return a bool # def isBadVersion(version): class Solution(object): def firstBadVersion(self, n): start = 1 end = n while start + 1 < end: mid = start + (end - start) / 2 if isBadVersi...
515
142
# Generated by Django 2.2.12 on 2020-05-01 03:34 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] op...
2,599
785
#!/usr/bin/env python # -*- coding: utf-8 -*- # -*- coding: gbk -*- # Date: 2019/2/22 # Created by 冰河 # Description 将生成的bindshell.exe提交到vscan.novirusthanks.org检测 # 用法 python check_virus.py -f bindshell.exe # 博客 https://blog.csdn.net/l1028386804 import re import httplib import time import os import optparse...
2,764
958
import asyncio from typing import Union import datetime import time from discord.ext import commands import yaml from cogs import checks import database import utils # Loads the repeating interval dictionary with open("conversions.yml", "r") as conversion_file: conversion_dict = yaml.load(conversion_file, Loade...
7,190
1,969
import setuptools from toraman.version import __version__ with open('README.md', 'r') as input_file: long_description = input_file.read() setuptools.setup( name='toraman', version=__version__, author='Çağatay Onur Şengör', author_email='contact@csengor.com', description='A computer-assisted t...
948
297
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('cms_pages', '0014_homepage_news_count'), ] operations = [ migrations.AlterField( model_name='newspage', ...
457
144
# Copyright The PyTorch Lightning 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 agreed to i...
4,112
1,360
# 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...
48,507
19,605
""" CTC-like decoder utilitis. """ from itertools import groupby import numpy as np def ctc_best_path_decode(probs_seq, vocabulary): """ Best path decoding, also called argmax decoding or greedy decoding. Path consisting of the most probable tokens are further post-processed to remove consecutive...
2,278
693
#!/usr/local/bin/python import json import socket import sys import asfgit.cfg as cfg import asfgit.git as git import asfgit.log as log import asfgit.util as util import subprocess, os, time def main(): ghurl = "git@github:apache/%s.git" % cfg.repo_name os.chdir("/x1/repos/asf/%s.git" % cfg.repo_name) tr...
827
297
from __future__ import absolute_import, division, print_function import contextlib import importlib import site import tempfile import shutil from rosimport import genrosmsg_py, genrossrv_py """ A module to setup custom importer for .msg and .srv files Upon import, it will first find the .msg file, then generate t...
9,598
2,641
import sys def color(text, color): if color == "blue": color = "0;34m" elif color == "green": color = "0;32m" elif color == "red": color = "0;31m" elif color == "yellow": color = "0;33m" else: return text return "\033[%s%s\033[0m\n" % (color, text) cla...
1,093
403
"""dbt_airflow_factory module.""" from setuptools import find_packages, setup with open("README.md") as f: README = f.read() # Runtime Requirements. INSTALL_REQUIRES = ["pytimeparse==1.1.8"] # Dev Requirements EXTRA_REQUIRE = { "tests": [ "pytest>=6.2.2, <7.0.0", "pytest-cov>=2.8.0, <3.0.0",...
1,491
579
# -*- coding: utf-8; -*- """Define error strings raised by the application.""" MISSING_CONFIG_VALUE = """ '{0}' is not specified or invalid in the config file! """.strip()
173
59
import numpy as np import pytest from karabo_bridge import serialize, deserialize from .utils import compare_nested_dict def test_serialize(data, protocol_version): msg = serialize(data, protocol_version=protocol_version) assert isinstance(msg, list) d, m = deserialize(msg) compare_nested_dict(data...
1,489
497
# This file is part of Indico. # Copyright (C) 2002 - 2021 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. import inspect from datetime import datetime import freezegun import pytest from sqlalchemy import DateTi...
2,029
602
#!/usr/bin/env python3 # encoding: utf-8 import os # 是否启用调试 若启用 将不再忽略检查过程中发生的任何异常 # 建议在开发环境中启用 在生产环境中禁用 DEBUG_ENABLE = False # SQLite 数据库文件名 SQLITE_FILE = "saved.db" # 日志文件名 LOG_FILE = "log.txt" # 是否启用日志 ENABLE_LOGGER = True # 循环检查的间隔时间(默认: 180分钟) LOOP_CHECK_INTERVAL = 180 * 60 # 代理服务器 PROXIES = "127.0.0.1:1080"...
704
466
from sqlalchemy import or_ from websdk.db_context import DBContext from libs.base_handler import BaseHandler from libs.pagination import pagination_util from models.hipaa_data import HipaaData, model_to_dict class HipaaDataHandler(BaseHandler): @pagination_util def get(self, *args, **kwargs): key = s...
1,692
530
#!/usr/bin/env python3 import rospy from std_msgs.msg import Int32 import time rospy.init_node('count') # ノード名「count」に設定 pub = rospy.Publisher('count_up', Int32, queue_size=1) # パブリッシャ「count_up」を作成 rate = rospy.Rate(10) # 10Hzで実行 n = 0 time.sleep(2) w...
567
226
# python version 1.0 DO NOT EDIT # # Generated by smidump version 0.4.8: # # smidump -f python ZYXEL-GS4012F-MIB FILENAME = "mibs/ZyXEL/zyxel-GS4012F.mib" MIB = { "moduleName" : "ZYXEL-GS4012F-MIB", "ZYXEL-GS4012F-MIB" : { "nodetype" : "module", "language" : "SMIv2", "organizat...
412,069
143,450
import logging from threading import Timer from datetime import timedelta from rx.core import Scheduler, Disposable from rx.disposables import SingleAssignmentDisposable, CompositeDisposable from .schedulerbase import SchedulerBase log = logging.getLogger("Rx") class TimeoutScheduler(SchedulerBase): """A sched...
2,028
570
import requests from bs4 import BeautifulSoup def Check(auth, mirrors): response = requests.get("https://www.x.org/releases/individual/proto/") html = response.content.decode("utf-8") parsedHtml = BeautifulSoup(html, "html.parser") links = parsedHtml.find_all("a") maxVersionMajor = -1 maxVers...
2,330
642
import os import string from collections import Counter from datetime import datetime from functools import partial from pathlib import Path from typing import Optional import numpy as np import pandas as pd from scipy.stats.stats import chisquare from tangled_up_in_unicode import block, block_abbr, categor...
11,781
4,035
# Author: Anurag Ranjan # Copyright (c) 2019, Anurag Ranjan # All rights reserved. # based on github.com/ClementPinard/SfMLearner-Pytorch from __future__ import division import torch from torch.autograd import Variable pixel_coords = None def set_id_grid(depth): global pixel_coords b, h, w = depth.size() ...
10,143
4,293
# Lint as: python2, python3 # Copyright 2020 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 # ...
7,853
2,540
# This file shows how to implement a single hidden layer neural network for # performing binary classification on the GPU using cudamat. from __future__ import division import pdb import time import numpy as np import cudamat as cm from cudamat import learn as cl import util # initialize CUDA cm.cublas_init() # load...
3,556
1,485
from __future__ import division import numpy as np from ..constants import molwt def regress(emissions, beta=np.array([2.8249e-4, 1.0695e-4, -9.3604e-4, 99.7831e-4])): """Calculates tropospheric ozone forcing from precursor emissions. Inputs: (nt x 40) emissions array Keywords: beta...
5,967
2,527
import uuid from invenio_indexer.api import RecordIndexer from invenio_pidstore.models import PersistentIdentifier, PIDStatus from invenio_records_draft.api import RecordContext from invenio_records_draft.proxies import current_drafts from invenio_search import RecordsSearch, current_search, current_search_client from...
3,530
1,112
import os import subprocess from collections import namedtuple import gi gi.require_version("Gst", "1.0") gi.require_version("Tcam", "0.1") from gi.repository import Tcam, Gst, GLib, GObject DeviceInfo = namedtuple("DeviceInfo", "status name identifier connection_type") CameraProperty = namedtuple("CameraProperty", ...
5,580
1,716
from typing import Dict, Any from yaml import load def get_config() -> Dict[str, Any]: try: return load(open('config/config.yml').read()) except Exception as e: raise Exception('ERROR: Missing config/config.yml file.') from e CONFIG = get_config()
274
83
# Author: Tillmann Falck <tf-raman@lucidus.de> # # License: BSD 3 clause # # SPDX-License-Identifier: BSD-3-Clause import collections from itertools import product import cvxpy as cp import numpy as np def sunsal_tv(A, Y, lambda_1, lambda_tv, sweep='prod', tv_type='iso', additional_constraint='none'): r""" S...
4,758
1,704
import pytest def test_stock(): assert(0 == 0)
53
22
# -*- coding: utf-8 -*- import json from TM1py.Objects.TM1Object import TM1Object class ElementAttribute(TM1Object): """ Abstraction of TM1 Element Attributes """ valid_types = ['NUMERIC', 'STRING', 'ALIAS'] def __init__(self, name, attribute_type): self.name = name self.attrib...
1,421
439
from sqlalchemy import exc from sqlalchemy.sql.expression import func from models import Watchlist, Portfolio, Activity from app import db import metric def buy_stock(ticker, units): unit_price = metric.get_price(ticker) total_price = units * unit_price max_id = db.session.query(func.max(Activity.activity...
4,011
1,329
bl_info = { "name": "ke_fit2grid", "author": "Kjell Emanuelsson", "category": "Modeling", "version": (1, 0, 2), "blender": (2, 80, 0), } import bpy import bmesh from .ke_utils import get_loops, correct_normal, average_vector from mathutils import Vector, Matrix def fit_to_grid(co, grid): x, y,...
3,175
1,024
import unittest from pyavl3 import AVLTree class AVLTreeUpdateTest(unittest.TestCase): def test_add_one(self): a = AVLTree() a.update({1:'a'}) self.assertEqual(len(a), 1)
201
75