id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
11350837
<gh_stars>0 # Title : Sort list by unique characters # Author : <NAME>. # Date : 16:10:2020 list1 = ['abc', 'ab', 'aaaaa', 'bababa', 1234, 1, 5, 'abcdeddd', 'aaaabbbbbcc', 'aaaaaabbbbbbb', 234, 567, 112211] def sort_by_unique_char(list_in): return len(set(str(list_in))) list1.sort(key=sort_by_uniqu...
StarcoderdataPython
12830489
<reponame>DavidMinarsch/ledger-api-py<gh_stars>10-100 import io from fetchai.ledger.serialisation.integer import encode, decode from .common import SerialisationUnitTest class IntegerSerialisationTests(SerialisationUnitTest): def test_small_unsigned_encode(self): buffer = io.BytesIO() encode(buff...
StarcoderdataPython
5190325
<reponame>MaxTurchin/pycopy-lib a = 1 # comment b = 2
StarcoderdataPython
9747859
<filename>interfaces/interface_messages.py from Utils import logs import shutil import traceback import os from services import config import datetime,uuid __DOCUMENT_TYPE = { 'document' : 'document', 'image' : 'image', 'video' : 'video', 'audio' : 'audio', 'ptt' : 'ptt', 'chat' : 'chat' } cl...
StarcoderdataPython
339662
import argparse import sys import tensorflow as tf parser = argparse.ArgumentParser() parser.add_argument('model', metavar='model', type=str, help='skipgram|cbow') parser.add_argument('--version', metavar='version', type=str, help='mm.dd-hh:mm:ss') args = parser.parse_args() if args.model != 'skipgram' and args.model...
StarcoderdataPython
6630530
# Generated by Django 2.0.13 on 2020-09-03 13:19 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('main', '0005_auto_20200903_2215'), ] operations = [ migrations.RemoveField( model_name='temp', name='date', ), ...
StarcoderdataPython
3511039
<gh_stars>0 #imports from tkinter import * from tkinter import ttk import threading import xlrd #module to read excel file from decimal import * #decimal module for precise floating point calculation import time #time module(used here for the 2 second wait) running = True #Thread terminator #data list and sum list ent...
StarcoderdataPython
5006365
#!/usr/bin/python3 import socket,select import urllib.parse Host = '' #symbolic name means all available interface Port =8989 fds={} user={} def server(host,port): s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)#allow port reuse s.bind((Host,Port)) s.listen(...
StarcoderdataPython
3359758
import numpy as np class KMedoids: def __init__(self, n_clusters, max_iter=100): self.n_clusters = n_clusters self.max_iter = max_iter self.idx_next_centroid = [] self.idx_centroid = [] self.centroid = [] self.labels_ = [] self.cost = 0 self.next_cost...
StarcoderdataPython
1604390
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def gif_repository(): maybe( http_archive, name = "gif", urls = ["https://downloads.sourceforge.net/project/giflib/giflib-5.2.1.tar.gz"], strip_prefix ...
StarcoderdataPython
5154335
<filename>emsapi/models/adi_ems_web_api_v2_dto_navigation_navigation_navaid_py3.py<gh_stars>0 # coding=utf-8 # -------------------------------------------------------------------------- # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # re...
StarcoderdataPython
11212018
import tensorflow as tf from tensorflow.python.ops import tensor_array_ops, control_flow_ops from avatar.relgan.utils.ops import * def generator(x_real, temperature, vocab_size, batch_size, seq_len, gen_emb_dim, mem_slots, head_size, num_heads, hidden_dim, start_token): start_tokens = tf.constant([s...
StarcoderdataPython
1730000
<gh_stars>0 # -*- coding: utf-8 -*- #------------------------------------------------------------------------------- # Name: test_myTLWE.py # Purpose: # # Author: <NAME> # # Created: 2022 Mar. 24 # Copyright: (c) sakamoto 2022 # Licence: <your licence> #---------------------------------------...
StarcoderdataPython
3525928
<filename>sample/sample.py # Once upon a time... class Vampire: def __init__(self, props): self.location = props['location'] self.birthDate = props['birthDate'] self.deathDate = props['deathDate'] self.weaknesses = props['weaknesses'] def get_age(self): return self.calc_age() def calc_age(s...
StarcoderdataPython
3337133
<reponame>sgaoshang/seeker<filename>app/component/routes.py from flask import render_template, flash, redirect, url_for, request, current_app, jsonify, session from flask_login import current_user, login_required from flask_babel import _, get_locale from app import db from app.models import Component from app.componen...
StarcoderdataPython
5162067
<filename>PoseEstimation/Script/Main/body_part_classification.py<gh_stars>0 # -*- coding: utf-8 -*- import time, cv2, os import numpy as np import multiprocessing as mp from scipy import stats import pandas as pd from sklearn.externals import joblib from sklearn.ensemble import RandomForestClassifier from Modules.data...
StarcoderdataPython
182420
from base64 import b64encode from io import BytesIO, StringIO import pytest from _pytest.monkeypatch import MonkeyPatch from sutta_publisher.shared import github_handler def test_generate_request_headers(bot_api_key: str) -> None: header = github_handler.__get_request_headers(bot_api_key) assert header["Au...
StarcoderdataPython
9612719
<filename>pyABC/Modified/visualization/walltime.py """Walltime plots""" import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import matplotlib.axes from matplotlib.ticker import MaxNLocator import datetime from typing import List, Union from ..storage import History from .util import to_lists, ...
StarcoderdataPython
9772607
<filename>PyObjCTest/test_nsdictionary.py<gh_stars>0 import types import objc import Foundation from PyObjCTest.testhelper import PyObjC_TestClass3 from PyObjCTools.TestSupport import TestCase, min_os_level class TestNSDictionarySubclassing(TestCase): # These tests seem to be specific for macOS def testExcep...
StarcoderdataPython
162527
<filename>src/Math2D.py<gh_stars>1-10 #!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sun May 5 14:55:49 2019 @author: luke """ import numpy as np def Grad2D(u): """ 2D gradient of a scalar basis function style: """ ur = Dr*u us = Ds*u ux = np.multiply(rx,ur) + \ ...
StarcoderdataPython
5149801
<reponame>Quant-Network/python-api-client<filename>quant_trading/models/__init__.py # coding: utf-8 # flake8: noqa """ Quant Trading Network API This API will use JSON. JSON looks like this: { \"key\": \"value\", \"anotherKey\": \"anotherValue\" } # noqa: E501 ...
StarcoderdataPython
308670
<filename>Ensemble_stress_dominated_1.py # -*- coding: utf-8 -*- """ Created on Wed May 12 13:37:09 2021 Triaxial test cases [deviatoric hardening(DH) model] Generating stress-strain sequence via DH model @author: <NAME> Note: Tensile normal stress is positive """ import numpy as np # import module impo...
StarcoderdataPython
1866358
<filename>papermill/tests/test_s3.py # The following tests are purposely limited to the exposed interface by iorw.py import os.path import pytest import boto3 import moto from moto import mock_s3 from ..s3 import Bucket, Prefix, Key, S3, split @pytest.fixture def bucket_no_service(): """Returns a bucket instanc...
StarcoderdataPython
3437856
<reponame>evelinacs/semantic_parsing_with_IRTGs #!/usr/bin/env python3 import sys import argparse from nltk.tree import ParentedTree parser = argparse.ArgumentParser(description = "Filters trees which contains subtrees that have more than 3 children. Also removes trace subtrees.") parser.add_argument("-s", "--sanitiz...
StarcoderdataPython
5127799
<gh_stars>1-10 import diskcache as dc from os.path import expanduser cache = dc.Cache(expanduser('~') + '/.opus_api') def clearCache(): """ Delete all items from the cache. """ cache.clear() def jcache(function): """ Decorator for caching API json results """ def wrapper(*args, **kw...
StarcoderdataPython
5154438
# Queue implementation using List in Python try: #try catch so that the program does not crash queue=[] while True: op = int(input("Press--> 1 to insert into queue | 2 to remove from queue | 3 to display values of queue | 4 to reverse the exisiting queue| 5 to exit ")) if op==1: ...
StarcoderdataPython
1877026
# Copyright 2015 - Mirantis, Inc. # Copyright 2015 - StackStorm, 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 # # Unl...
StarcoderdataPython
6510711
import os import inspect import json import pkgutil from flask import request import api from api.rest import config from api.rest.base import SecureResource, rest_resource from storage.common.base import divide_dict MODULES_PATH = 'api.rest.modules.' __dict__ = {} for importer, modname, ispkg in pkgutil.walk_package...
StarcoderdataPython
1763228
'''initialize''' from .nostalgicstyle import NostalgicstyleBeautifier
StarcoderdataPython
6686474
<filename>RecoParticleFlow/Configuration/python/RecoParticleFlow_cff.py import FWCore.ParameterSet.Config as cms from RecoParticleFlow.PFTracking.particleFlowTrack_cff import * #from RecoParticleFlow.PFTracking.particleFlowTrackWithDisplacedVertex_cff import * from RecoParticleFlow.PFProducer.particleFlowSimParticle...
StarcoderdataPython
11233184
<gh_stars>100-1000 from __future__ import division, absolute_import, print_function import yaml __all__ = [ 'ConfigError', 'NotFoundError', 'ConfigValueError', 'ConfigTypeError', 'ConfigTemplateError', 'ConfigReadError'] YAML_TAB_PROBLEM = "found character '\\t' that cannot start any token" # Exceptions. ...
StarcoderdataPython
4803373
# Copyright 2016 datawire. 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 applicable law or agr...
StarcoderdataPython
4968126
import torch import torchvision import torch.nn as nn import torch.nn.functional as F import re import sys from .functions import * import torch.fx grayscale = torchvision.transforms.Grayscale(num_output_channels=1) def convert_data_for_quaternion(batch): """ converts batches of RGB images in 4 channels for ...
StarcoderdataPython
1636222
<reponame>36000/cnn_colorflow<gh_stars>0 import numpy as np import sys import os from keras.models import load_model sys.path.append("../utilities") import constants from data import get_train_test from metrics import plot_n_roc_sic datasets_c = ['h_qq_rot_charged', 'h_gg_rot_charged', 'cp_qq_rot_charged', 'qx_qg_rot...
StarcoderdataPython
1763626
<filename>grafeas/models/vulnerability_occurrences_summary_fixable_total_by_digest.py # coding: utf-8 """ grafeas.proto No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: v1beta1 Generated by: https://github.c...
StarcoderdataPython
3395391
<filename>python_lambda_logging/lambda_logging.py """Lambda logging decorator to standarize logging.""" import logging def setup_lambda_logger(): r""" A utility function for configuring python logging for use in lambda functions using the format. %(levelname)s RequestId: %(aws_request_id)s\t%(message)s\n...
StarcoderdataPython
6484137
<gh_stars>1-10 import unittest import utils # Built-in string searching. class Solution: def rotateString(self, a, b): """ :type a: str :type b: str :rtype: bool """ if len(a) != len(b): return False a += a # See CPython fast search ...
StarcoderdataPython
5023270
<filename>cogs/todo.py import discord from discord.ext import commands doob_logo = "https://cdn.discordapp.com/avatars/680606346952966177/ada47c5940b5cf8f7e12f61eefecc610.webp?size=1024" class todo(commands.Cog): def __init__(self, client): self.client = client # Gives the todo list from GitHu...
StarcoderdataPython
6530126
''' Wrapper interface for the VDB Athena backend. All vdb operations use the following environment variable overrides: VDB_DB: your VDB database name (default: vdb) VDB_BUCKET: your VDB S3 endpoint (default: s3://spiral-vdb) You may also optionally set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_DEFAUL...
StarcoderdataPython
8095674
<reponame>rafarbop/Python<gh_stars>0 # Desafio 44 Curso em Video Python # By Rafabr import os,time,sys from estrutura_modelo import cabecalho,rodape cabecalho(44,"Valor de Produto com Diversas Meios de Pagamentos") try: valor_normal = float(input("Informe o preço normal do produto(Em R$ - Ex.: 20,44) : ").rep...
StarcoderdataPython
5127354
<filename>expression/extra/result/__init__.py<gh_stars>100-1000 from .catch import catch from .pipeline import pipeline from .traversable import sequence, traverse __all__ = ["catch", "sequence", "traverse", "pipeline"]
StarcoderdataPython
12856216
<reponame>moyogo/spacy<filename>spacy/tests/website/test_home.py from __future__ import unicode_literals import pytest import spacy import os try: xrange except NameError: xrange = range @pytest.fixture() def token(doc): return doc[0] @pytest.mark.models def test_load_resources_and_process_text(): ...
StarcoderdataPython
12836872
<filename>tests/conftest.py import pytest import factory import asyncio from cuve.order_service.db import transaction, tables from cuve.order_service.db.helpers import async_create_database from cuve.order_service.app import application_factory from cuve.order_service.config import load_config, ConfigSchema def pyte...
StarcoderdataPython
4977315
<reponame>Ascend/modelzoo #!/usr/bin/python #encoding=utf-8 # # BSD 3-Clause License # # Copyright (c) 2017 xxxx # All rights reserved. # Copyright 2021 Huawei Technologies Co., Ltd # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following condition...
StarcoderdataPython
4913436
#!/usr/bin/python import roslib roslib.load_manifest('PathTask') import rospy from std_msgs.msg import String import time from threading import Thread from Robosub.msg import HighLevelControl, ModuleEnableMsg from SubImageRecognition.msg import ImgRecObject class PathTask: MOTOR_COMMAND = 'Command' MO...
StarcoderdataPython
3292071
text = '[ Статистика ]<br>Система:<br>&#8195;Процессор:<br>' for idx, cpu in enumerate(psutil.cpu_percent(interval=1, percpu=True)): text += '&#8195;&#8195;Ядро №'+str(idx+1)+': '+str(cpu)+'%<br>' text += '&#8195;&#8195;Температура: '+str(int(open('/sys/class/thermal/thermal_zone0/temp','r').read())/1000)+' °С\n' mem ...
StarcoderdataPython
5078436
from .base import CMakeToolchainBase class CMakeAndroidToolchain(CMakeToolchainBase): pass
StarcoderdataPython
3415709
<reponame>miroslavkrysl/kiv-bit-rsa """Definition of signature.""" from __future__ import annotations from typing import Type from kiv_bit_rsa.hash import Hash from kiv_bit_rsa.rsa import Key, Rsa from kiv_bit_rsa.sign.signable import Signable class Signature: """An object signature. :py:class:`Signature` ...
StarcoderdataPython
377589
<filename>webauthn/helpers/bytes_to_base64url.py<gh_stars>100-1000 from base64 import urlsafe_b64encode def bytes_to_base64url(val: bytes) -> str: """ Base64URL-encode the provided bytes """ return urlsafe_b64encode(val).decode("utf-8").replace("=", "")
StarcoderdataPython
6468188
<gh_stars>1-10 from __future__ import absolute_import import numpy as np import morphs from morphs.data.derivative import ( f_poly, p0_poly, fit_derivative, _main, find_max_order, ) import pytest from click.testing import CliRunner @pytest.mark.run(order=0) def test_f_poly(): x = np.linspace(1...
StarcoderdataPython
5115971
<filename>Main_Window.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'Main_Window.ui' # # Created by: PyQt5 UI code generator 5.11.3 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets, QtSql from PyQt5.QtWidgets import QMainWindow, QFil...
StarcoderdataPython
4802275
from flask import g, request from app import ApiException, ApiResult, db from app.api import bp from app.api.auth import token_auth from app.data_service import DataServiceException, logs from app.models import Log, LogSchema # CREATE LOG @bp.route("/logs", methods=["POST"]) @token_auth.login_required def create_log...
StarcoderdataPython
339229
"""`get_entropy` code comes from https://github.com/paulbrodersen/entropy_estimators/blob/master/entropy_estimators/continuous.py""" import numpy as np from scipy.spatial import KDTree from scipy.special import gamma, digamma def get_entropy(x, k=1, norm='max', min_dist=0., workers=1): """ Code source: htt...
StarcoderdataPython
9610775
<reponame>fukuball/fuku-ml # encoding=utf8 import os import numpy as np import FukuML.Utility as utility import FukuML.MLBase as ml import FukuML.DecisionTree as decision_tree import FukuML.LinearRegression as linear_regression class Regression(ml.Learner): # too slow for high dimension data, can't do digits mu...
StarcoderdataPython
11225
<reponame>BarracudaPff/code-golf-data-pythpn problem_type = "segmentation" dataset_name = "synthia_rand_cityscapes" dataset_name2 = None perc_mb2 = None model_name = "resnetFCN" freeze_layers_from = None show_model = False load_imageNet = True load_pretrained = False weights_file = "weights.hdf5" train_model = True tes...
StarcoderdataPython
11272871
<gh_stars>0 from setuptools import setup with open("README.md", "r") as fh: readme = fh.read() setup(name='calculaHashDadosAbertos', version='0.0.5', url='https://github.com/masuta16/calculaHash', license='MIT License', author='<NAME>', long_description=readme, long_description_...
StarcoderdataPython
3373799
<gh_stars>0 """ These functions are used to keep the median element from a stream of numbers, here represented by a list on numbers using heaps. The function medianMaintenance always keep the median and also keeps the sum of all the medians whenever a new number is added. The two other functions are helper functions...
StarcoderdataPython
1728697
from rest_framework import permissions from ..utils import is_admin class ReadOnly(permissions.BasePermission): def has_permission(self, request, view): return request.method in permissions.SAFE_METHODS class IsAdminUserOrReadOnly(permissions.IsAdminUser): def has_permission(self, request, view): ...
StarcoderdataPython
1672432
from project.sports_car import SportsCar print(SportsCar()) sc = SportsCar() print(sc.drive())
StarcoderdataPython
12807751
<filename>dialogue_ope/airdialogue_model_transformer/models/modules.py # coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # htt...
StarcoderdataPython
6492970
#!/usr/bin/env python import os from setuptools import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup(name='django-adaptors', version='0.2.5', description='Convert CSV/XML files into python object or django model', author='<NAME>', author_e...
StarcoderdataPython
376417
import datetime import pandas as pd #uses a set name and data model of component attribute changes to generate set#attribute.xml based on template #string, Table -> Beautifulsoup def makeAttributeXML(currentSet,compmodel): from UserInterface.ProjectSQLiteHandler import ProjectSQLiteHandler from PyQt5 import Qt...
StarcoderdataPython
11281939
<filename>hearbeat_fritz.py # -*- coding: utf-8 -*- """ Created on Wed May 22 17:35:40 2019 @author: BIG1KOR """ from imageai.Detection import VideoObjectDetection #%% import os import cv2 #%% execution_path = os.path.join(os.getcwd()) #%% detector = VideoObjectDetection() detector.setModelTypeAsYOLOv3() detector.set...
StarcoderdataPython
3591903
#!/usr/bin/python """ Appendix E: Cell Methods To be imported into cf.py upon initialization of a CF Checker class. """ cell_methods16 = { "point", "sum", "mean", "maximum", "minimum", "mid_range", "standard_deviation", "variance", "mode", "median", "sum_of_squares", } cel...
StarcoderdataPython
4967266
<reponame>dokipen/trac-announcer-plugin<filename>announcer/subscribers/ticket_groups.py # -*- coding: utf-8 -*- # # Copyright (c) 2008, <NAME> # Copyright (c) 2009-2010, <NAME> # Copyright (c) 2010, <NAME> # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, ...
StarcoderdataPython
11364421
import argparse from displ.pwscf.parseScf import final_coordinates_from_scf def with_coordinates(pw_in_path, positions_type, atom_symbols, atom_positions): """Return a string giving a new input file, which is the same as the one at `pw_in_path` except that the ATOMIC_POSITIONS block is replaced by the one ...
StarcoderdataPython
4824620
<filename>PacoteDownload/Mundo 2 do curso/while/desafio 64.py x=int(input('digite seu número: ')) c=999 soma=0 n_entradas=0 while x!=999: if x != 999: soma = soma+x n_entradas += 1 x = int(input('digite seu número: ')) print('A soma é {} e foram {} entradas.'.format(soma,n_entradas))
StarcoderdataPython
3211194
<reponame>sampotter/pyvista import pytest import pyvista as pv def test_compare_images_two_plotters(sphere, tmpdir): filename = str(tmpdir.mkdir("tmpdir").join('tmp.png')) pl1 = pv.Plotter() pl1.add_mesh(sphere) arr1 = pl1.screenshot(filename) im1 = pv.read(filename) pl2 = pv.Plotter() pl...
StarcoderdataPython
4989757
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
StarcoderdataPython
189989
"""# Shoelace Widget Functionality Provides the ShoelaceWidget and ShoelaceWidgetGenerator """ from ..shoelace_component import ShoelaceComponent class ShoelaceWidget(ShoelaceComponent): # pylint: disable=too-few-public-methods """Your Shoelace Widgets should inherits this"""
StarcoderdataPython
269614
searcher = ix.searcher() from whoosh.qparser import QueryParser qp = QueryParser("title", schema=ix.schema) q = qp.parse(u"felipe") with ix.searcher() as s: results = s.search(q) len(results)
StarcoderdataPython
5062099
import os,sys # 将repostory的目录,作为根目录,添加到系统环境中。 VNPY_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..' )) if VNPY_ROOT not in sys.path: sys.path.append(VNPY_ROOT) print(f'append {VNPY_ROOT} into sys.path') import asyncio from vnpy.api.eastmoney_api.eastmoney import EastMon...
StarcoderdataPython
12855933
<reponame>rodrigoviannini/meus_Primeiros_Codigos<filename>007 - Intro List Comprehension.py/016 - Maior.py """ List Comprehension Aninhada OBJ: Encontrar o maior ou os maiores números de uma lista e imprimir outra lista """ listaGenerica = [1, 2, 3, 4, 1, 2, 3, 4, 10, 10, 10, 5, 3, -4] listaMaior = [x for x in listaG...
StarcoderdataPython
1742727
<gh_stars>0 """This module contains the general information for AdaptorEthInterruptProfile ManagedObject.""" from ...ucscentralmo import ManagedObject from ...ucscentralcoremeta import UcsCentralVersion, MoPropertyMeta, MoMeta from ...ucscentralmeta import VersionMeta class AdaptorEthInterruptProfileConsts(): MO...
StarcoderdataPython
8093962
<filename>others/solution/1620.py<gh_stars>0 n, m = map(int, input().split()) pokemon_dictonary1 = {} for i in range(n): pokemon_name = input() pokemon_dictonary1[pokemon_name] = f'{i+1}' pokemon_dictonary2 = {v:k for k, v in pokemon_dictonary1.items()} for j in range(m): problem = input() ...
StarcoderdataPython
11285365
SCALAR_ENTRY = 'scalar' SCALARS_ENTRY = 'scalars' IMAGE_ENTRY = 'image' PLOT_ENTRY = 'plot' LOG_ENTRY_TYPES = [] class LogEntry: def __init__(self, value, data_type): self.value = value self.data_type = data_type def __repr__(self): return 'LogEntry(\n %s\n)' % self.value.__repr__(...
StarcoderdataPython
3280349
<filename>test/integration_tests/test_models.py import torch from torchtext.models import ROBERTA_BASE_ENCODER, ROBERTA_LARGE_ENCODER, XLMR_BASE_ENCODER, XLMR_LARGE_ENCODER from ..common.assets import get_asset_path from ..common.parameterized_utils import nested_params from ..common.torchtext_test_case import Torchte...
StarcoderdataPython
164369
import time import logging from ..data_asset import DataAsset from ..dataset import Dataset from great_expectations.exceptions import GreatExpectationsError logger = logging.getLogger(__name__) class DataAssetProfiler(object): @classmethod def validate(cls, data_asset): return isinstance(data_asset,...
StarcoderdataPython
6523948
<gh_stars>0 """ Compress to show string and number behind """ def compressedString(message): # catch empty or single if len(message) <= 1: return message # use a stack and counter last_alpha = "" count = 1 return_string = "" for msg in message: if last_alpha != msg: ...
StarcoderdataPython
3504240
<filename>setup.py #!/usr/bin/env python3 # Copyright (C) 2020 <NAME> <<EMAIL>> # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVI...
StarcoderdataPython
5087818
class Solution: def maxSatisfaction(self, satisfaction: List[int]) -> int: satisfaction.sort() best,esum,total = 0,0,0 for x in reversed(satisfaction): esum += x total += esum if total>best: best = total elif esum<0: ...
StarcoderdataPython
9624009
from __future__ import absolute_import, division, print_function, unicode_literals from cechomesh import Color, ColorList, even_color_spread from echomesh.util.TestCase import TestCase class ColorListTest(TestCase): def setUp(self): self.cl = ColorList() def assertResult(self, s): self.asser...
StarcoderdataPython
1754788
import tensorflow as tf import sys import numpy as np from PIL import Image import cv2 import os, os.path # speicherorte fuer trainierten graph und labels in train.sh festlegen ## # Disable tensorflow compilation warnings os.environ['TF_CPP_MIN_LOG_LEVEL']='2' import tensorflow as tf image_path = sys.argv[1] # anga...
StarcoderdataPython
5191365
<filename>metriq/errors.py __all__ = ["MetriqError"] from tea_client.errors import TeaClientError MetriqError = TeaClientError
StarcoderdataPython
3373188
#!/usr/bin/env python import os from setuptools import setup, find_packages setup(name='fslks', version='0.0.1-SNAPSHOT', author='<NAME>, <NAME>', author_email='<EMAIL>', description='Implementation of Few-short Learning with the Kitchen Sink for Consumer Health Answer Generation', lice...
StarcoderdataPython
8016488
<reponame>jackton1/pyrollbar __all__ = ['add_to'] import logging import sys from typing import Callable, Optional, Type, Union from fastapi import APIRouter, FastAPI, __version__ from fastapi.routing import APIRoute try: from fastapi import Request, Response except ImportError: # Added in FastAPI v0.51.0 ...
StarcoderdataPython
11260213
#built in user_model in django. from django.contrib.auth import get_user_model #usercreationform is a built in library to create users by django. check docs. from django.contrib.auth.forms import UserCreationForm class UserCreateForm(UserCreationForm): class Meta: fields = ("username", "email", "<PASSWORD...
StarcoderdataPython
1935813
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2018 GEM Foundation # # OpenQuake is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, o...
StarcoderdataPython
5164900
<reponame>stanwood/traidoo-api import datetime import pytest from model_bakery import baker from items.models import Item from products.models import Product @pytest.mark.django_db def test_get_only_available_products(client_anonymous, traidoo_region): product_1 = baker.make(Product, region=traidoo_region) ...
StarcoderdataPython
4930850
import os from flask import Flask from api import blueprint as api_blueprint from client import blueprint as client_blueprint def create_app(testing: bool = False) -> Flask: app = Flask(__name__) app.register_blueprint(api_blueprint) app.register_blueprint(client_blueprint) app.secret_key = os.env...
StarcoderdataPython
6426338
from pypadre import _name, _version from pypadre.core.model.code.code_mixin import PipIdentifier PACKAGE_ID = PipIdentifier(pip_package=_name.__name__, version=_version.__version__)
StarcoderdataPython
4973993
<reponame>nagapavan525/nbdev_project<gh_stars>0 # AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified). __all__ = ['greetings'] # Cell def greetings(): return "Hello world"
StarcoderdataPython
3403533
import locale import os from pathlib import Path import click from tqdm import tqdm # type: ignore from kaleidoscope.gallery import generate_gallery_ini, generate_album_ini from kaleidoscope.generator import generate, DefaultListener from kaleidoscope.reader import read_gallery gallery_path = "." @click.group() @...
StarcoderdataPython
164337
<filename>tests/api/views/test_s3bucket.py import json from unittest.mock import patch from botocore.exceptions import ClientError from model_mommy import mommy import pytest from rest_framework import status from rest_framework.reverse import reverse from controlpanel.api.models import UserS3Bucket from tests.api.fi...
StarcoderdataPython
9717593
<filename>modules/gmaps.py from geopy.geocoders import Nominatim from geopy.distance import geodesic import openrouteservice from openrouteservice import convert from pyrogram import Client import time import json import sys sys.path.append(sys.path[0] + "/..") from utils.get_config import * from gtts import gTTS co...
StarcoderdataPython
4959965
# -*- coding: utf-8 -*- from collections import OrderedDict from gluon import current from gluon.storage import Storage def config(settings): """ Cumbria County Council extensions to the Volunteer Management template - branding - support Donations - support Assessments """ ...
StarcoderdataPython
34659
<reponame>DeadCodeProductions/dead #!/usr/bin/env python3 import copy import hashlib import logging import os import random import re import subprocess import sys import tempfile import time from multiprocessing import Pool from pathlib import Path from typing import Any, Dict, Optional, cast import requests import ...
StarcoderdataPython
9739942
<reponame>pagreene/grip from __future__ import absolute_import, print_function, unicode_literals import os import sys import imp from glob import glob import traceback BASE = os.path.dirname(os.path.abspath(__file__)) TESTS = os.path.join(BASE, "tests") GRIPQL = os.path.join(os.path.dirname(BASE), "gripql", "python")...
StarcoderdataPython
1688723
<reponame>multirotorsociety/SAFMC-19-D2-Autonomous-Drone from picamera.array import PiRGBArray from picamera import PiCamera import cv2 import time import numpy as np import imutils from PIL import Image def image_convert_to_perc_green(img): b_channel = np.array(img[:,:,0]).astype('float') g_channel = np.array(img...
StarcoderdataPython
8153068
import requests from bs4 import BeautifulSoup import sys import datetime number_of_listings = 5 simple = True # Args if (len(sys.argv) < 4): print("Usage : python strava.py jmeno heslo jidelna") sys.exit(1) # Start the session session = requests.Session() # Create the payload payload = {'uzivatel' : sys.arg...
StarcoderdataPython