text
string
size
int64
token_count
int64
#!/usr/bin/env python """Algorthims for function optimisation great_deluge() is a hillclimbing algorithm based on: Gunter Dueck: New Optimization Heuristics, The Great Deluge Algorithm and the Record-to-Record Travel. Journal of Computational Physics, Vol. 104, 1993, pp. 86 - 92 ga_evolve(...
5,579
1,535
import argparse import boto3 import json import logging import os from progressbar import ProgressBar import sys """ Collects IAM Policies Evaluates policies looking for badness (*.*, Effect:Allow + NotAction) Need to add more tests/use cases """ def get_policies(profile): session = boto3.session.Session(profi...
6,871
1,944
import json import os import re from testinfra.utils.ansible_runner import AnsibleRunner import util testinfra_hosts = AnsibleRunner(os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('agent-integrations') def _get_key_value(tag_list): for key, value in (pair.split(':', 1) for pair in tag_list): yield ke...
3,556
1,130
import os import sys from contextlib import contextmanager from invoke import UnexpectedExit def git_commit(c, addstr, msg): try: c.run("git config --get user.email") c.run("git config --get user.name") except UnexpectedExit: c.run('git config --local user.email "ci@cd.org"') ...
589
214
# -*- coding:utf-8 -*- from ais_sdk.utils import encode_to_base64 from ais_sdk.utils import decode_to_wave_file from ais_sdk.distortion_correct import distortion_correct_aksk from ais_sdk.utils import init_global_env import json if __name__ == '__main__': # # access moderation distortion correct.post data by a...
1,263
443
# Generated by Django 2.2.6 on 2019-10-25 16:24 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('exercise', '0015_exerciseemailproperties_date_received'), ] operations = [ migrations.AlterField( ...
527
186
class GeomCombinationSet(APIObject, IDisposable, IEnumerable): """ A set that contains GeomCombination objects. GeomCombinationSet() """ def Clear(self): """ Clear(self: GeomCombinationSet) Removes every item GeomCombination the set,rendering it empty. """ pass ...
3,504
1,168
from rainbow.cloudformation import Cloudformation from base import DataSourceBase __all__ = ['CfnOutputsDataSource', 'CfnResourcesDataSource', 'CfnParametersDataSource'] class CfnDataSourceBase(DataSourceBase): def __init__(self, data_source): super(CfnDataSourceBase, self).__init__(data_source) ...
1,527
459
import redis from bundle_config import config from django.core.management.base import NoArgsCommand class Command(NoArgsCommand): help = 'Flushes all keys in redis.' def handle_noargs(self, **options): r = redis.Redis(host=config['redis']['host'], port=int(config['redis']['port']), password=config['r...
401
117
#!/usr/bin/env python # Copyright 2020 Stanford University, Los Alamos National Laboratory # # 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 ...
2,338
782
"""This plugin extends Gaphor with XMI export functionality.""" import logging from gaphor.abc import ActionProvider, Service from gaphor.core import action, gettext from gaphor.plugins.xmiexport import exportmodel from gaphor.ui.filedialog import FileDialog logger = logging.getLogger(__name__) class XMIExport(Ser...
1,414
386
import contextlib import os import pathlib import subprocess import sys import tempfile @contextlib.contextmanager def chdir(path): cwd = os.getcwd() try: os.chdir(path) yield finally: os.chdir(cwd) def prepare_files(files): for f in files: path = pathlib.Path(f['path...
2,278
795
import os commit_string = "选择data的前多少个维度参与训练" not_add = ['results', 'data', 'weights'] for item in os.listdir(): if item in not_add: # print(item) continue else: os.system(f"git add {item}") os.system(f'git commit -m "{commit_string}"') os.system("git push origin main")
303
120
from src.cmp.pycompiler import Grammar from src.ast_nodes import ( ProgramNode, ClassDeclarationNode, FuncDeclarationNode, AttrDeclarationNode, IfNode, WhileNode, LetNode, CaseNode, IsvoidNode, AssignNode, VarDeclarationNode, CaseItemNode, NotNode, ...
6,523
2,581
# For @UniBorg # courtesy Yasir siddiqui """Self Destruct Plugin .sd <time in seconds> <text> """ import time from userbot import CMD_HELP from telethon.errors import rpcbaseerrors from userbot.utils import admin_cmd import importlib.util @borg.on(admin_cmd(pattern="sdm", outgoing=True)) async def selfdestruct(des...
1,599
506
import os class Template: template_name = '' context = None def __init__(self, template_name='', context=None, *args, **kwargs): self.template_name = template_name self.context = context def get_template(self): template_path = os.path.join(os.path.join(os.path.dirname(os.path.abspath(__file__)), '...
1,101
357
#Basics a = "hello" a += " I'm a dog" print(a) print(len(a)) print(a[1:]) #Output: ello I'm a dog print(a[:5]) #Output: hello(index 5 is not included) print(a[2:5])#Output: llo(index 2 is included) print(a[::2])#Step size #string is immutable so you can't assign a[1]= b x = a.upper() print(x) x = a.capitalize() prin...
793
327
# -*- coding: utf-8 -*- """ test_01_accept_time_get_headers ~~~~~~~~~~~~~~ The 2GIS API Test Check time get headers :author: Vadim Glushkov :copyright: Copyright 2019, The2GIS API Test" :license: MIT :version: 1.0.0 :maintainer: Vadim Glushkov :email: plussg@yandex.ru :status: Development """ import pytest import a...
2,950
1,032
"""Returns the string length of categorical values""" from h2oaicore.transformer_utils import CustomTransformer import datatable as dt import numpy as np class MyStrLenEncoderTransformer(CustomTransformer): @staticmethod def get_default_properties(): return dict(col_type="any", min_cols=1, max_cols=1,...
541
173
""" Subpackage containing EOTasks for geometrical transformations """ from .utilities import ErosionTask, VectorToRaster, RasterToVector from .sampling import PointSamplingTask, PointSampler, PointRasterSampler __version__ = '0.4.2'
235
72
"""User Model.""" # Django from django.db import models from django.contrib.auth.models import AbstractUser # Utilities from .utils import ApiModel class User(ApiModel, AbstractUser): email = models.EmailField( 'email', unique = True, ) USERNAME_FIELD = 'email' REQUIRED_FIELDS = [...
1,152
367
from collections import namedtuple import json from asynctest.mock import patch import pytest from ethereumd.server import RPCServer from ethereumd.proxy import EthereumProxy from aioethereum.errors import BadResponseError from .base import BaseTestRunner Request = namedtuple('Request', ['json']) class TestServe...
3,993
1,145
# This file is part of NEORL. # Copyright (c) 2021 Exelon Corporation and MIT Nuclear Science and Engineering # NEORL is free software: you can redistribute it and/or modify # it under the terms of the MIT LICENSE # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # ...
973
364
from scipy.io import wavfile import numpy as np import pingouin as pg import pandas as pd _,data = wavfile.read('wav//ed//mp3baked.wav') _,data1 = wavfile.read('wav//ing//ingeating.wav') i= data.shape[0]-1 j = data1.shape[0]-1 index_1 = -1 index_2 = -1 try: data.shape[1] except IndexError: ...
1,330
666
from textwrap import dedent import pytest from pylox.lox import Lox TEST_SRC = dedent( """\ /* This is a multiline block comment */ """ ) EXPECTED_STDOUTS: list[str] = [] def test_block_comment_at_eof(capsys: pytest.CaptureFixture) -> None: interpreter = Lox() interpreter.run(TEST_SRC)...
495
182
from mlbase.utils.misc import lazy tensorflow = lazy("tensorflow") numpy = lazy("numpy") gensim = lazy("gensim")
114
37
import re import setuptools README_FILENAME = "README.md" VERSION_FILENAME = "observed.py" VERSION_RE = r"^__version__ = ['\"]([^'\"]*)['\"]" # Get version information with open(VERSION_FILENAME, "r") as version_file: mo = re.search(VERSION_RE, version_file.read(), re.M) if mo: version = mo.group(1) else: ...
1,082
349
import os import json import numpy as np import pickle from typing import Any from pycocotools.coco import COCO from torch.utils.data import Dataset class DetectionMSCOCODataset(Dataset): def __init__(self, annotation_file: str, image_dir: str): self._annotation_file = annotation_file self._imag...
3,536
1,132
import sys import operator sys.stdin = open('input.txt') fact = [1, 1] for i in range(2, 15): fact.append(fact[-1] * i) while True: try: n, k = map(int, raw_input().split()) coef = map(int, raw_input().split()) except: break print fact[n] / reduce(operator.mul, [fact[c] for c in...
328
125
from django.contrib.auth.models import User from django.db import models from django.urls import reverse # Create your models here. class Post(models.Model): title = models.CharField(max_length=255) slug = models.SlugField(max_length=255,unique=True) #meusite.com/blog;introducao-ao-django author = mo...
702
226
#!/usr/bin/python # ***************************************************************************** # # 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 A...
7,538
2,184
# -*- coding: utf-8 -*- """ helper function: convert Hz to Bark scale Args: fInHz: The frequency to be converted, can be scalar or vector cModel: The name of the model ('Schroeder' [default], 'Terhardt', 'Zwicker', 'Traunmuller') Returns: Bark values of the input dimension """ import numpy as np imp...
1,527
619
# Copyright 2019 The Magenta 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 ...
16,560
6,138
# usr/bin/env python """Functions to cluster using UPGMA upgma takes an dictionary of pair tuples mapped to distances as input. UPGMA_cluster takes an array and a list of PhyloNode objects corresponding to the array as input. Can also generate this type of input from a DictArray using inputs_from_dict_array function....
6,034
1,812
#this code will generate the structural verilog for a single entry in the register file #takes in the output file manager, the entry number, the number of bits, the number of reads, and the width of the #tristate buffers on the read outputs #expects the same things as make_store_cell, ensure code is valid there #Matt...
881
306
"""API for AVB""" import json import sys import requests def actualite_found (): osm = "https://opendata.bruxelles.be/api/datasets/1.0/search/?q=" data = { "nhits":0, "parameters":{ "dataset":"actualites-ville-de-bruxelles", "timezone":"UTC", "q":"actualite", "langu...
1,007
365
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # (C) British Crown Copyright 2017-2021 Met Office. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the ...
7,782
2,084
#Copyright (c) 2017 Andre Santos # #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...
58,644
15,200
from django.contrib.auth.models import User from rest_framework import viewsets, status from rest_framework.response import Response from rest_framework.permissions import IsAuthenticated, IsAdminUser from api.serializers import TODOListSerializer from api.models import TODOList class TODOListViewSet(viewsets.ModelVi...
737
203
# ProgramB.py print('Hello World')
35
13
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion def copy_existing_referrals_into_new_field(apps, schema_editor): Pledge = apps.get_model('donation', 'Pledge') Referral = apps.get_model('donation', 'Referral') reason...
1,541
497
def is_even(i: int) -> bool: if i == 1: return False elif i == 2: return True elif i == 3: return False elif i == 4: return True elif i == 5: ... # Never do that! Use one of these instead... is_even = lambda i : i % 2 == 0 is_even = lambda i : not i & 1 is_o...
350
129
#!/usr/bin/env python # # Wordpress Bruteforce Tool # # By @random_robbie # # import requests import json import sys import argparse import re import os.path from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) session = requests.Se...
8,886
3,492
import heapq import time from os import path from math import floor class Heap: def __init__(self): self.size = 0 self.array = [] self.v2index_map = {} def __get_parent_index(self, idx): return int(floor((idx - 1) / 2)) def __get_left_child_index(self, idx): retur...
5,626
2,179
import warnings from collections import Counter, Mapping, Sequence from numbers import Number from typing import Dict, List import numpy as np import torch from mmdet.core.mask.structures import BitmapMasks from torch.nn import functional as F _step_counter = Counter() def list_concat(data_list: List[list]): if...
4,345
1,469
# -*- coding: utf-8 -*- """Test the terminaltables output adapter.""" from __future__ import unicode_literals from textwrap import dedent import pytest from cli_helpers.compat import HAS_PYGMENTS from cli_helpers.tabular_output import terminaltables_adapter if HAS_PYGMENTS: from pygments.style import Style ...
2,422
1,148
#! /usr/bin/env python # encoding: utf-8 # harald at klimachs.de import re from waflib import Utils,Errors from waflib.Tools import fc,fc_config,fc_scan from waflib.Configure import conf from waflib.Tools.compiler_fc import fc_compiler fc_compiler['aix'].insert(0, 'fc_xlf') @conf def find_xlf(conf): """Find the xlf...
1,642
736
#!/usr/bin/python3 # -*- coding:utf-8 -*- # __author__ = '__MeGustas__' from django.test import TestCase from django.db import connection from tutorials.create_table.models import * # Create your tests here. class TestHealthFile(TestCase): def setUp(self): cursor = connection.cursor() # Popul...
9,119
3,445
import copy from web3 import Web3 from .utils import utils as hero_utils CONTRACT_ADDRESS = '0x5f753dcdf9b1ad9aabc1346614d1f4746fd6ce5c' ABI = """ [ {"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"addres...
31,822
10,249
# -*- coding: utf-8 -*- from __future__ import unicode_literals from tipi import tipi as _tipi tipi = lambda s: _tipi(s, lang='fr') def test_double_quotes(): assert tipi('''"brutal" "quote's"''') == ( '''«brutal» «quote's»''' ) def test_single_quotes(): assert tipi("""'brutal' 'quote's'""") ...
364
157
from django.db import models VEHICLE_CHOICES = ( ('OASISSB', 'OASIS Small Business'), ('OASIS', 'OASIS Unrestricted') ) STATUS_CHOICES = ( ('P', 'In Progress'), ('C', 'Completed'), ('F', 'Cancelled') ) class Vendor(models.Model): name = models.CharField(max_length=128) duns = models.C...
2,878
1,020
""" Contains the QuantumCircuit class boom. """ class QuantumCircuit(object): # pylint: disable=useless-object-inheritance """ Implements a quantum circuit. - - - WRITE DOCUMENTATION HERE - - - """ def __init__(self): """ Initialise a QuantumCircuit object """ pass def add_ga...
610
176
import sys sys.path.append("..") # change environment to see tools from make_hydrodem import bathymetricGradient workspace = r"" # path to geodatabase to use as a workspace snapGrid = r"" # path to snapping grid hucPoly = r"" # path to local folder polygon hydrographyArea = r"" # path to NHD area feature class...
602
200
# This is the OpenGL context for drawing flow calculation lines from Context import * from primitives import Vector2, Segment from OpenGL.GL import * from copy import deepcopy class GLFlowSegment( Segment ): '''The OpenGL representation of a flow line. Basically a segment with a direciton indicator. The dire...
9,799
2,787
from .interval_collectors import *
35
10
# -*- coding: utf-8 -*- # @Time: 2020/11/8 23:47 # @Author: GraceKoo # @File: test.py # @Desc: from threading import Thread import time def print_numbers(): time.sleep(0.2) print("子线程结束") if __name__ == "__main__": t1 = Thread(target=print_numbers) t1.setDaemon(True) t1.start() # print("主线程结...
324
152
""" Django settings for massenergize_portal_backend project. Generated by 'django-admin startproject' using Django 2.1.4. For more information on this file, see https://docs.djangoproject.com/en/2.1/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.1/ref/setting...
5,894
2,124
import asyncio # from aiorpcgrid.client import Client from aiorpcgrid.task import AsyncTask, State class AsyncClient: _provider = None _method = None _requests: dict = {} _running = True _request_queue: asyncio.Queue = asyncio.Queue() _loop = None def __init__(self, provider, loop=None):...
2,657
686
# Copyright 2020, OpenTelemetry 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 i...
4,093
1,273
# Generated by Django 4.0.2 on 2022-04-01 16:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('instructors', '0020_alter_user_description_alter_user_title'), ] operations = [ migrations.AlterField( model_name='user', ...
471
163
import numpy as np import torch import random from .odenet_mnist.layers import MetaNODE def fix_seeds(seed=502): np.random.seed(seed) random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed_all(seed) torch.set_printoptions(precision=10) torch.backends.cudnn.deterministic = Tr...
1,348
468
""" Module: 'ubinascii' on esp32 1.10.0 """ # MCU: (sysname='esp32', nodename='esp32', release='1.10.0', version='v1.10 on 2019-01-25', machine='ESP32 module with ESP32') # Stubber: 1.2.0 def a2b_base64(): pass def b2a_base64(): pass def crc32(): pass def hexlify(): pass def unhexlify(): pass
319
158
""" @author : Spencer Lyon """ from __future__ import division import sys import unittest from nose.plugins.skip import SkipTest from jv import JvWorker from quantecon import compute_fixed_point from quantecon.tests import get_h5_data_file, write_array, max_abs_diff # specify params -- use defaults A = 1.4 alpha = 0...
3,141
1,126
"""Config This module is in charge of providing all the necessary settings to the rest of the modules in excentury. """ import os import re import sys import textwrap import argparse from collections import OrderedDict from excentury.command import error, trace, import_mod DESC = """Edit a configuration file for ex...
9,820
3,005
# -*- coding: utf-8 -*- ''' Created on Thu Nov 19 20:52:33 2015 @author: SW274998 ''' from nseta.common.commons import * import datetime import unittest import time from bs4 import BeautifulSoup from tests import htmls import json import requests import six from nseta.common.urls import * import nseta.common.urls as ...
4,696
1,756
from django import forms from .models import Account from common.models import Comment, Attachments from leads.models import Lead from contacts.models import Contact from django.db.models import Q class AccountForm(forms.ModelForm): def __init__(self, *args, **kwargs): account_view = kwargs.pop('account'...
3,207
917
# # Copyright 2018 PyWren 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 in writing...
2,408
709
import os import random inputDirectory = "./original" outputDirectory = "./processed" #probability parameters TopLevel = 0.6 SecondLevel = 0.5 ThirdLevel = 0.4 FourAndAbove = 0.2 pickInside = 0.5 pickOutside = 0.25 topics = [] siteLevel = [] fileStructure = [] count = 0 def findPossibleIndex(toParse): toRetu...
4,160
1,171
#!/usr/bin/env python # -*- coding: utf-8 -*- # This file is part of the Kramers-Kronig Calculator software package. # # Copyright (c) 2013 Benjamin Watts, Daniel J. Lauk # # The software is licensed under the terms of the zlib/libpng license. # For details see LICENSE.txt """This module implements the Kramers-Kronig...
13,616
5,451
from PIL import ImageDraw, Image from math import cos,sin,radians from random import randint import sys a = "a0A1b2B3c4C5d6D7e8E9f!F,g.G/h?H<i>I:j;J'k\"K\\l|L/m M\nn\tN@o#O$p%P^q&Q*r(R)s_S-t+T=u{U}v[V]w W x X y Y z Z" if len(a) > 128: print("TOO MANY CHARACTERS") sys.exit(1) # for i in a: # print("%s -> %...
1,884
992
import math from collections import defaultdict from typing import List, Dict, Any from nonebot import on_command, on_message, on_notice, on_regex, get_driver from nonebot.log import logger from nonebot.permission import Permission from nonebot.typing import T_State from nonebot.adapters import Event, Bot from nonebot...
16,626
6,835
# Copyright 2021 Research Institute of Systems Planning, 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 applica...
1,853
528
from thkc_disrank import *
28
11
import torch import torch.nn as nn import torch.nn.functional as F import dgl.function as fn """ GIN: Graph Isomorphism Networks HOW POWERFUL ARE GRAPH NEURAL NETWORKS? (Keyulu Xu, Weihua Hu, Jure Leskovec and Stefanie Jegelka, ICLR 2019) https://arxiv.org/pdf/1810.00826.pdf """ class GINLayer(nn.Module):...
4,854
1,543
""" *mus . it . dia* The simple diatonic intervals. """ from .second import MinorSecond from .second import MajorSecond from .third import MinorThird from .third import MajorThird from .fourth import PerfectFourth from .fifth import Tritone from .fifth import PerfectFifth from .sixth import MinorSixth from .s...
673
249
# this file holds some common testing functions from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By depurl = "localhost:3000" def getElement(driver, xpath): return WebDriverWait(driver, 10).until(EC....
760
241
#-- coding: utf-8 -- import sys reload(sys) sys.setdefaultencoding('utf-8') import os import time import collections from PIL import Image, ImageOps, ImageDraw, ImageFont code_2_icono = collections.defaultdict(lambda : '38') kor_2_eng = collections.defaultdict(lambda : 'UNKNOWN') code_2_icono['SKY_O00'] = ['38'] ...
4,783
1,955
from .catchment import regime, flow_duration_curve from . import indices
72
19
# # (C) Copyright 1996- ECMWF. # # This software is licensed under the terms of the Apache Licence Version 2.0 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. # In applying this licence, ECMWF does not waive the privileges and immunities # granted to it by virtue of its status as an intergovernme...
1,256
400
# Copyright (C) 2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause """Assistant utility for automatically load network from network description.""" import torch class Assistant: """Assistant that bundles training, validation and testing workflow. Parameters ---------- net : torch.nn.Mo...
7,683
1,975
""" Inspired by example from https://github.com/Vict0rSch/deep_learning/tree/master/keras/recurrent Uses the TensorFlow backend The basic idea is to detect anomalies in a time-series. """ import matplotlib.pyplot as plt import numpy as np import time from keras.layers.core import Dense, Activation, Dropout from keras.l...
5,961
2,095
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime class Migration(migrations.Migration): dependencies = [ ('historias', '0006_auto_20150413_0001'), ] operations = [ migrations.AlterField( model_name='hist...
1,309
520
__title__ = 'har2case' __description__ = 'Convert HAR(HTTP Archive) to YAML/JSON testcases for HttpRunner.' __url__ = 'https://github.com/HttpRunner/har2case' __version__ = '0.2.0' __author__ = 'debugtalk' __author_email__ = 'mail@debugtalk.com' __license__ = 'Apache-2.0' __copyright__ = 'Copyright 2017 debugtalk'
315
123
import os from pathlib import Path from data_utils import get_data_path, get_image_data_path, get_image_extension def app_id_to_image_filename(app_id, is_horizontal_banner=False): image_data_path = get_image_data_path(is_horizontal_banner) image_filename = image_data_path + str(app_id) + get_image_extension...
2,160
769
#!/usr/bin/env python import boto3 import random import os BUCKET=os.environ.get('EXPORT_S3_BUCKET_URL') if (BUCKET != None): s3 = boto3.client('s3') with open("maze.txt", "rb") as f: s3.upload_fileobj(f, BUCKET, "maze"+str(random.randrange(100000))+".txt") else: print("EXPORT_S3_BUCKET_URL was not ...
348
148
import sys from typing import Any from argparse import ArgumentParser from zerver.models import Realm from zerver.lib.management import ZulipBaseCommand class Command(ZulipBaseCommand): help = """List realms in the server and it's configuration settings(optional). Usage examples: ./manage.py list_realms ./man...
2,790
763
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2009, Eucalyptus Systems, Inc. # All rights reserved. # # 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 res...
8,892
2,633
# coding: utf-8 """ DocuSign REST API The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501 OpenAPI spec version: v2.1 Contact: devcenter@docusign.com Generated by: https://github.com/swagger-api/swagger-codegen.gi...
8,761
2,725
from django.apps import AppConfig from django.core.checks import register from . import checks class RouteConfig(AppConfig): """The AppConfig for conman routes.""" name = 'conman.routes' def ready(self): """Register checks for conman routes.""" register(checks.polymorphic_installed) ...
407
116
""" Get all TM1 transactions for all cubes starting to a specific date. """ import configparser config = configparser.ConfigParser() config.read('..\config.ini') from datetime import datetime from TM1py.Services import TM1Service with TM1Service(**config['tm1srv01']) as tm1: # Timestamp for Message-Log parsin...
627
198
import logging import numpy as np from scipy.stats import entropy from patteRNA.Transcript import Transcript from patteRNA import filelib logger = logging.getLogger(__name__) class Dataset: def __init__(self, fp_observations, fp_sequences=None, fp_references=None): self.fp_obs = fp_observations s...
6,019
1,911
import library import json @library.export def init(args): model = [[9.2, 0.21, 0.21], [8.2, 0.22, 0.21], [7.2, 1.21, 2.41], [1.2, 2.21, 0.29]] library.put("model", model) ROUND = 0 library.put("ROUND", ROUND) alpha = 0.2 library.put("alpha", alpha) @libr...
3,118
945
from molecule import api def test_driver_is_detected(): driver_name = __name__.split(".")[0].split("_")[-1] assert driver_name in [str(d) for d in api.drivers()]
172
64
import numpy as np from coffeine.covariance_transformers import ( Diag, LogDiag, ExpandFeatures, Riemann, RiemannSnp, NaiveVec) from coffeine.spatial_filters import ( ProjIdentitySpace, ProjCommonSpace, ProjLWSpace, ProjRandomSpace, ProjSPoCSpace) from sklearn.compose impor...
12,361
3,424
from games import Game from math import nan, isnan from queue import PriorityQueue from copy import deepcopy from utils import isnumber from grading.util import print_table class GameState: def __init__(self, to_move, position, board, label=None): self.to_move = to_move self.position = position ...
11,516
4,035
import os import df2img import disnake import numpy as np import pandas as pd from menus.menu import Menu from PIL import Image import discordbot.config_discordbot as cfg from discordbot.config_discordbot import gst_imgur, logger from discordbot.helpers import autocrop_image from gamestonk_terminal.stocks.options imp...
4,797
1,570
#%% import packages import numpy as np import pandas as pd import multiprocessing from time import time import json from premiumFinance.constants import ( MORTALITY_TABLE_CLEANED_PATH, PROCESSED_PROFITABILITY_PATH, ) from premiumFinance.financing import calculate_lender_profit, yield_curve mortality_experien...
2,312
831
# Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Caches processed query results in memcache and datastore. Memcache is not very reliable for the perf dashboard. Prometheus team explained that memcache is...
5,700
1,820
# -*- coding:utf-8 -*- """ """ import cudf from hypergbm import make_experiment from hypernets.tabular import get_tool_box from hypernets.tabular.datasets import dsutils def main(target='y', dtype=None, max_trials=3, drift_detection=False, clear_cache=True, **kwargs): tb = get_tool_box(cudf.DataFrame) asse...
2,241
812
def pictureInserter(og,address,list): j=0 for i in og: file1 = open(address+'/'+i, "a") x="\ncover::https://image.tmdb.org/t/p/original/"+list[j] file1.writelines(x) file1.close() j=j+1
252
103