id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1727431
<gh_stars>0 import os import hashlib from PIL import Image from django.contrib.auth.models import User from django.db import models from django.utils.translation import ugettext_lazy as _ from django.conf import settings from resizeimage import resizeimage class Size(models.Model): CROP = 'CRP' COVER = 'CVR'...
StarcoderdataPython
3289417
<reponame>theGloves/ContractTool import app.CNF.LiteralPackage as lp class Clause: def __init__(self, s): self.literalSet = [] LiteralStr = s.split("||") if len(LiteralStr) == 0: return for i in range(len(LiteralStr)): if "Term" not in LiteralStr[i]:...
StarcoderdataPython
3347076
<filename>the_rack/core.py __all__ = ['Rack'] class CheckMixin: def check_key(self, key): if not isinstance(key, str): raise TypeError('Key must be a string.') def check_func_callable(self, func): if not callable(func): raise Exception('Func must be a callable.') d...
StarcoderdataPython
104645
import binascii import os from django.contrib.auth.models import AbstractUser from django.db import models from django.utils.translation import ugettext_lazy as _ from project.apps.user.managers import UserManager, ActionTokenManager from rest_framework.authtoken.models import Token from django.utils import timezone...
StarcoderdataPython
1640778
<gh_stars>1-10 import datetime import csv import six from six import StringIO from icalendar import Calendar, Event from pyramid.renderers import JSON from ode.models import icalendar_to_model_keys from ode.deserializers import data_list_to_dict from ode.models import Event as EventModel, Location class IcalRender...
StarcoderdataPython
107740
<filename>vtune/run_th.py<gh_stars>1-10 import demo import time import threading def slow_encode(input): return demo.Encoder(input).process_slow() def fast_encode(input): return demo.Encoder(input).process_fast() if __name__ == '__main__': input = 'a' * 10000000 # 10 millions of 'a' th1 =...
StarcoderdataPython
3250104
<reponame>henriktao/pulumi-azure # coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** 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, Sequenc...
StarcoderdataPython
82004
# Generated by Django 2.2.13 on 2021-02-04 10:09 import directory_validators.string import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models.deletion import django_extensions.db.fields class Migration(migrations.Migration): dependencies = [ ('exportpla...
StarcoderdataPython
3274554
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config(object): # ... SECRET_KEY = '<KEY>' SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URL') or \ 'sqlite:///' + os.path.join(basedir, 'app.db') SQLALCHEMY_TRACK_MODIFICATIONS = False UPLOAD_FOLD...
StarcoderdataPython
25823
<reponame>BradB111/galaxy_blizzard_plugin import asyncio import json import os import sys import multiprocessing import webbrowser from collections import defaultdict import requests import requests.cookies import logging as log import subprocess import time import re from typing import Union, Dict from galaxy.api.co...
StarcoderdataPython
175925
<filename>inspector/checks/engine/executors/python_executor.py from . import CheckExecutor from ...constants import CHECK_TYPES class PythonExecutor(CheckExecutor): supported_check_types = \ (CHECK_TYPES.NUMBER, CHECK_TYPES.STRING, CHECK_TYPES.DATE) def execute(self, check_logic): ...
StarcoderdataPython
1716115
<filename>qrCodeGenerator.py # pip install PyQRCode import pyqrcode import PIL from pyqrcode import QRCode generateData = input("enter text to convert :") imageName = input("enter image name to save :") imageNameResult = imageName + ".png" url = pyqrcode.create(generateData) url.png(imageNameResult, scale = 6)
StarcoderdataPython
3216521
<reponame>prz3m37/TightBinding<gh_stars>1-10 import pickle import numpy as np from typing import TextIO from tight_binding_base_connection import DataBaseConnection class DataManager(object): def __init__(self, helpers, settings): self.__helpers = helpers self.__settings = settings self._...
StarcoderdataPython
55683
from typing import Union import flask_restx import flask from keepachangelog._changelog import to_dict def add_changelog_endpoint( namespace: Union[flask_restx.Namespace, flask_restx.Api], changelog_path: str ): """ Create /changelog: Changelog endpoint parsing https://keepachangelog.com/en/1.0.0/ ...
StarcoderdataPython
3255811
<reponame>ludechu/DJevn from django.db import models # Create your models here. class apiManger(models.Manager): #自定义模型类,是公共的,其他模型类也可以引用 def get_queryset(self): return super(apiManger,self).get_queryset().filter(status=True,is_deleted=False) def create_api(self,Name): # 定义一个方法,用于添加数据 ...
StarcoderdataPython
12425
<filename>sizer.py<gh_stars>0 #!/usr/bin/python3 # Fetch torrent sizes # TODO: Report number of files before we go etc import os from torrentool.api import Torrent from fnmatch import fnmatch root = '/opt/radio/collections' pattern = "*.torrent" alltorrentsize = 0 print("Thanks for using The Librarian.") for path, ...
StarcoderdataPython
53348
from boa3.builtin.interop.runtime import invocation_counter def Main(example: int) -> int: invocation_counter = example return invocation_counter
StarcoderdataPython
1755812
# Uses python3 def edit_distance(s, t): """Edit distance between two strings. The edit distance between two strings is the minimum number of insertions, deletions, and mismatches in an alignment of two strings. Samples: >>> edit_distance("ab", "ab") 0 >>> edit_distance("short", "ports") ...
StarcoderdataPython
1649300
<reponame>RakaAndriawan/PortfolioAnalysis ## Package for Web App import streamlit as st import joblib, os import datetime import string ## Import Custom Functions from port_script import * ## Set Page Config st.set_page_config(page_title="Portfolio Anda", page_icon="🧊", layout="wide", initial_sidebar_state="expanded...
StarcoderdataPython
3216451
import esphome.codegen as cg import esphome.config_validation as cv from esphome import pins from esphome.const import (CONF_BIT_DEPTH, CONF_CLOCK_PIN, CONF_DATA_PIN, CONF_ID, CONF_NUM_CHANNELS, CONF_NUM_CHIPS) AUTO_LOAD = ['output'] my9231_ns = cg.esphome_ns.namespace('my9231') MY9231Output...
StarcoderdataPython
1603489
from kingfisher_scrapy.spiders.digiwhist_base import DigiwhistBase class GreeceDigiwhist(DigiwhistBase): name = 'greece_digiwhist' start_urls = ['https://opentender.eu/data/files/GR_ocds_data.json.tar.gz']
StarcoderdataPython
4841806
<filename>repository/ChartRepository.py import sys import requests from .Connection import Connection from .Repository import Repository class ChartRepository(Repository): def __init__(self) -> None: pass def getRemoteData(self) -> str: response = requests.get(Connection.FETCH_CHART_URL) ...
StarcoderdataPython
9765
<filename>features/cpp/simple/test.py<gh_stars>1-10 from regression_tests import * class TestBase(Test): def test_for_main(self): assert self.out_c.has_funcs('main') or self.out_c.has_funcs('entry_point') def test_check_main_is_not_ctor_or_dtor(self): for c in self.out_config.classes: ...
StarcoderdataPython
161532
import vcr @vcr.use_cassette def test_esearchresult(client): r = client.esearch(db="pubmed", term="hart rk[author]") assert 5 < r.count assert 0 == r.retstart assert isinstance(r.ids, list) assert 27814769 in r.ids
StarcoderdataPython
3269119
import unittest import exceptions from spidy.language import * from spidy.common import * class ScriptTest(unittest.TestCase): def test_script1(self): context = Context() sn = parse_file('tests/scripts/script1.sp', context) script_text = str(sn) self.assertEqual(script_text, '''l = [] if True: traverse...
StarcoderdataPython
1617580
<reponame>markv58/UDI-Ping #!/usr/bin/env python3 """ This is a NodeServer was created using template for Polyglot v2 written in Python2/3 by Einstein.42 (<NAME>) <EMAIL> v1.0.15 """ import polyinterface import sys import time import os import struct import array import fcntl import subprocess import logging LOGGER = ...
StarcoderdataPython
195837
<reponame>StuartIanNaylor/simple_audio-tensorflow<filename>Fft_sizes/simple_audio_mfcc_frame_length2048_frame_step512_fft_length2048.py<gh_stars>1-10 import os import pathlib #import matplotlib.pyplot as plt import numpy as np #import seaborn as sns import tensorflow as tf import time from tensorflow.keras.layers.exp...
StarcoderdataPython
54950
#!/usr/bin/env python3 import sys input = sys.stdin.readline ############ ---- Input Functions, coutery of 'thekushalghosh' ---- ############ def inp(): return(int(input())) def inlt(): return(list(map(int, input().split()))) def insr(): s = input() return(list(s[:len(s) - 1])) def invr(): ...
StarcoderdataPython
3366263
"""Central location for shared arparse convention definitions.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys import codecs import functools from absl import app as absl_app from absl import flags # This codifies help string conventions a...
StarcoderdataPython
1740806
#!/usr/bin/env python """generate_yml.py.py - auto-generated by softnanotools""" from softnanotools.logger import Logger import yaml logger = Logger('GENERATE YML.PY') A = { 1: {'enzymes': 10}, 2: {'enzymes': 20}, 3: {'enzymes': 30}, 4: {'enzymes': 40}, 5: {'enzymes': 50} } B = { 1: {'spring_l...
StarcoderdataPython
1604852
<reponame>elotgamu/libraryproject # from django.shortcuts import render from django.views.generic import ListView, TemplateView from .models import Book, Genre, Author # Create your views here. class Home(TemplateView): template_name = "pages/home.html" def get_context_data(self, **kwargs): context...
StarcoderdataPython
68366
# MIT License # # Copyright (c) 2019 SSL-Roots # # 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, pu...
StarcoderdataPython
1639664
h1 = ''' <!Doctype html> <html> <head> <title>单元测试报告</title> <style> body { width: 80%; margin: 40px auto; font-weight: bold; font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; fo...
StarcoderdataPython
3223170
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
StarcoderdataPython
197378
# -*- coding: utf-8 -*- # Copyright 2014, 2015 OpenMarket Ltd # # 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...
StarcoderdataPython
1601134
<reponame>leguiart/Machine-Learning<gh_stars>0 import numpy as np import pandas as pd from abc import ABCMeta, abstractmethod from hklearn.model import Model class _BaseModel(Model): def __init__(self, estimator = 'ML', alpha = 1.0): if isinstance(estimator, str) and estimator.lower() in ['m...
StarcoderdataPython
3345180
from typing import Tuple import gdsfactory as gf from gdsfactory.cell import cell from gdsfactory.component import Component from gdsfactory.components.rectangle import rectangle from gdsfactory.types import LayerSpec @cell def litho_calipers( notch_size: Tuple[float, float] = (2.0, 5.0), notch_spacing: floa...
StarcoderdataPython
148841
<filename>python/random_weighted.py """ Implements a random weighted choice function Functions: weight(collection) """ import random def weight(collection): """Choose an element from a dict based on its weight and return its key. Parameters: - collection (dict): dict of elements with weights as va...
StarcoderdataPython
3207699
# https://workat.tech/problem-solving/practice/implement-stack-array/ class Stack: arr = [] def __init__(self, capacity=0): self.t = -1 self.capacity = capacity self.arr = [-1]*self.capacity def isEmpty(self) -> bool: if(self.t==-1): return True return False def size(self) ->...
StarcoderdataPython
1749755
<filename>__init__.py from flask import Flask,render_template from flask_restful import Api from flask_sqlalchemy import SQLAlchemy from config import app_config import os app = Flask(__name__) db = SQLAlchemy() def create_app(config_name): app = Flask(__name__, instance_relative_config=True) app.config.from...
StarcoderdataPython
170751
<gh_stars>0 """ Contains classes and functions regarding Lectio Assignments. """ from urllib.parse import urlparse, parse_qs from dateutil import parser as dt_parser from .config import DEFAULT_TZ, DECIMAL_SEPARATOR from .types import AssignmentWaitingFor, AssignmentStatuses, LectioType from .utilities import percent...
StarcoderdataPython
1740519
<reponame>thmolena/Shapes_Assistant import math from PIL import Image, ImageDraw, ImageColor, ImagePath import random def draw_a_shape(number): img = Image.new("RGB", (128,128), "white") image = ImageDraw.Draw(img) a = random.randint(0,129) #The center is at (64,64) side = 3 ...
StarcoderdataPython
3209224
<reponame>sprout42/StarStruct<filename>starstruct/elementescaped.py """ The escaped NamedStruct element class. Can be used in multiple ways ways: 1: Variable Lengths, in terms of namedstruct elements .. code-block:: python ExampleMessage = Message('VarTest', [('x', 'B'), ('y', 'B')]) TestStruct ...
StarcoderdataPython
1761798
<reponame>igor-morawski/MFIR-AP<filename>testing/test_d00_paths.py import unittest import MFIRAP.d00_utils.paths as tested_module # functions are trivial, testing if import is succsesful is enough class TestDummy(unittest.TestCase): def test_Dummy(self): self.assertTrue(True)
StarcoderdataPython
4820100
<reponame>ajayiagbebaku/NFL-Model import pytest import altair as alt from altair.utils import AltairDeprecationWarning from altair.utils.deprecation import _deprecate, deprecated def test_deprecated_class(): OldChart = _deprecate(alt.Chart, "OldChart") with pytest.warns(AltairDeprecationWarning) as record: ...
StarcoderdataPython
4811205
import pandas as pd import datetime import matplotlib.pyplot as plt from Bio import SeqIO import argparse import os def process_dat(dat, groupby_var, max_date, datetime_fmt): # groups and sums dat = dat.groupby(groupby_var).agg('sum') # converts columns to datetime dat.columns = pd.to_datetime(dat.co...
StarcoderdataPython
3240930
<filename>src/gausskernel/dbmind/sqldiag/src/sql_template.py """ Copyright (c) 2020 Huawei Technologies Co.,Ltd. openGauss is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn...
StarcoderdataPython
192895
<filename>amromics/utils/command.py import os import logging logger = logging.getLogger(__name__) def run_command(cmd, timing_log=None): """ Run a command line, return the returning code of the command :param cmd: :param timing_log: :return: """ if timing_log is not None: cmd = '/usr...
StarcoderdataPython
3320333
import glob import os import pandas as pd from app.proto import MpsReceiveMsg def find_msgdata_in_directory(directory: str): matchings = glob.glob1(directory, 'msgData_*') if matchings: return os.path.join(directory, matchings[0]) else: raise FileNotFoundError(f'No msgdata file found in ...
StarcoderdataPython
4815795
<gh_stars>0 import torch import torch.nn as nn import numpy as np from torch.nn import init from bfutils import viz_datachunk import cv2 import flow_utils import matplotlib.pyplot as plt class UpsampleZero(nn.Module): def __init__(self): super().__init__() def forward(self, img, scale_factor):...
StarcoderdataPython
1681064
import asyncio import pytest import starkware.starknet.testing.objects from starkware.starknet.testing.starknet import Starknet from starkware.starkware_utils.error_handling import StarkException from tests.utils import Signer, str_to_felt, to_uint, uint FALSE, TRUE = 0, 1 signer = Signer(123456789987654321) NONEX...
StarcoderdataPython
3253068
import os from aiohttp import web from .db import init_db, setup_tables from .views import request_handler app = web.Application() app['config'] = { 'gino': { 'host': os.getenv('POSTGRES_HOST', 'localhost'), 'user': os.getenv('POSTGRES_USER', 'postgres'), 'password': os.getenv('<PASSWORD...
StarcoderdataPython
1659872
<filename>src/publish_conda_stack/__init__.py __version__ = "0.3.0dev7"
StarcoderdataPython
1823
<gh_stars>0 # urls.py from django.urls import path, register_converter from fiesta import converters from fiesta.views import views from rest_framework.urlpatterns import format_suffix_patterns # "http://django-sdmx.org/wsrest/" # "http://django-sdmx.org/ws/" register_converter(converters.ResourceConverter, 'res') ...
StarcoderdataPython
1776403
import os import torch, torchaudio import itertools from shutil import copyfile class BasePreprocessor: def __init__(self, data_dir, output_dir, overwrite_files, bulk_process, extensions = None): # organization self.data_dir = data_dir self.output_dir = output_dir self.overwrite_fi...
StarcoderdataPython
20233
import unittest import os.path import requests_mock import tableauserverclient as TSC TEST_ASSET_DIR = os.path.join(os.path.dirname(__file__), 'assets') SIGN_IN_XML = os.path.join(TEST_ASSET_DIR, 'auth_sign_in.xml') SIGN_IN_IMPERSONATE_XML = os.path.join(TEST_ASSET_DIR, 'auth_sign_in_impersonate.xml') SIGN_IN_ERROR_X...
StarcoderdataPython
1748802
<reponame>PmagPy/PmagPy-notebooks #!/usr/bin/env python from __future__ import print_function from builtins import range mylist = [42, 'spam', 'ocelot'] Indices = list(range(0, len(mylist), 1)) for i in Indices: print(mylist[i]) print('All done')
StarcoderdataPython
1768038
"""Rectangular and polar coordinates representation utility.""" from math import * from taurapoint import * def main(): test = "" ##### CREATING ##### # create passing x and y test = test = "create passing x and y" print("test:", test) p1 = Point2(0, 1) try: assert p1.x == 0 ...
StarcoderdataPython
130730
import os # Late setting of env so pywtk loads correctly pywtk_cache = os.path.join(os.environ['HOME'], 'dropbox', 'pywtk-data') os.environ['PYWTK_CACHE_DIR'] = pywtk_cache import pandas from pywtk.site_lookup import get_3tiersites_from_wkt from pywtk.wtk_api import get_nc_data, WIND_FCST_DIR, WIND_MET_NC_DIR if __n...
StarcoderdataPython
1758259
print('{:=^100}'.format(' DESAFIO 23-A ')) n = str(input('\nDigite um númeoro de 0 a 9999: ')) n = '{:0>4}'.format(n[:4]) unidade = n[3] dezena = n[2] centena = n[1] milhar = n[0] print('\nUnidade: {}\nDezena: {}\nCentena: {}\nMilhar: {}\n'.format(unidade, dezena, centena, milhar)) print('{:=^100}'.format(' FIM DESAFIO...
StarcoderdataPython
3357337
"""This module includes a series of test cases to confirm the validity of tool_box.py UnitTests(unittest.TestCase) -- this class is a unit test which includes 5 different test for tool_box.py """ import unittest import pandas as pd from covid_wa import tool_box import sys sys.path.append('..') data = pd.read_csv("da...
StarcoderdataPython
1765094
<reponame>kripken/intensityengine # Copyright 2010 <NAME> ('kripken'). All rights reserved. # This file is part of Syntensity/the Intensity Engine, an open source project. See COPYING.txt for licensing. from django import template from django.utils.safestring import SafeString from django.utils.html import escape r...
StarcoderdataPython
3320677
from datasets.census_dataloader import get_income_census_dataloaders from models.experiment_adaptation_pretrain_learner import FederatedDAANLearner from models.experiment_finetune_target_learner import FederatedTargetLearner from utils import get_timestamp, get_current_date, create_id_from_hyperparameters, test_classif...
StarcoderdataPython
3211755
<reponame>hawk-earnin/quickstatus from expiration import TimeFormatError from status import ( Expiration, print_statuses_list, clear_status, set_status, ) def add_default(config, status, time): try: s = config.statuses[status] except KeyError: print(f'{status} is not a vaild st...
StarcoderdataPython
1632245
<filename>run_pretrained.py import argparse import gym import matplotlib.pyplot as plt import torch from matplotlib import animation import algorithms import algorithms.dqn.trainer from algorithms.dqn.model import dqn_vanilla from utils import gym_utils def parse_args(): parser = argparse.ArgumentParser(descrip...
StarcoderdataPython
143620
import filecmp import os import pathlib from typing import Optional from approvaltests.core.namer import Namer from approvaltests.core.reporter import Reporter from approvaltests.core.writer import Writer def exists(path: str) -> bool: return os.path.isfile(path) class ReporterNotWorkingException(Exception): ...
StarcoderdataPython
159223
# -*- coding: utf-8 -*- """Controllers for the comcenter application."""
StarcoderdataPython
4820105
<reponame>KwatME/ccal<filename>kwat/constant/__init__.py from .DATA_DIRECTORY_PATH import DATA_DIRECTORY_PATH from .FLOAT_RESOLUTION import FLOAT_RESOLUTION from .GOLDEN_RATIO import GOLDEN_RATIO from .NUMBER_OF_CATEGORY import NUMBER_OF_CATEGORY from .RANDOM_SEED import RANDOM_SEED from .SAMPLE_FRACTION import SAMPLE_...
StarcoderdataPython
4828734
<gh_stars>1-10 from zipfile import ZipFile from time import sleep from glob import glob import shutil import gee import os def find(directory): ''' It returns the paths of files contained in a directory ''' names = [] for folder in glob(directory): names.append(folder) # It remov...
StarcoderdataPython
1724290
#!/usr/bin/env python import os from migrate.versioning.shell import main if __name__ == '__main__': db_url = os.environ.get('DATABASE_URL', 'postgresql://localhost:5432/beercalc') db_url = db_url.replace('postgres:', 'postgresql:', 1) main(url=db_url, debug='False', repository='db_repository')
StarcoderdataPython
3354542
import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sympy.solvers import solve from sympy import Symbol from matplotlib import patches import matplotlib.patches as mpatches import scipy.io as sio from numpy import linalg as LA # plotting configuration ratio = 1.5 figure_len, figure_width = 15...
StarcoderdataPython
1708469
<reponame>Ruide/ACES<gh_stars>10-100 import os import sys # Add this directory to the path in GDB so import will work path, filename = os.path.split(__file__) if not path in sys.path: sys.path.append(path) import gdb import gdb_helpers import gdb_measure_stacks as stack_measure import hexbox_app_support RESULTS_...
StarcoderdataPython
1690756
import sys import pytest import logging import warnings from multiprocessing.util import log_to_stderr def pytest_addoption(parser): parser.addoption("--loky-verbosity", type=int, default=logging.DEBUG, help="log-level: integer, SUBDEBUG(5) - INFO(20)") parser.addoption("--skip-high-memor...
StarcoderdataPython
3330436
def test(): #test \ x=1 for x in range(1,5): # \ #test \ \ print x print 3 #test # print 2 #
StarcoderdataPython
3248140
# -*- coding: utf-8 -*- ## \package globals.threads # # WARNING: Standard Python module 'threads' cannot be imported here # MIT licensing # See: docs/LICENSE.txt import threading from dbr.log import Logger thr = threading ## Standard thread class with renamed methods class Thread(thr.Thread): def __init__(se...
StarcoderdataPython
1691478
class Solution: def beautifulArray(self, N: int) -> List[int]: result = [1] while len(result) < N: result = [i * 2 - 1 for i in result] + [i * 2 for i in result] return [i for i in result if i <= N]
StarcoderdataPython
3251181
<gh_stars>10-100 from .es_utils import * from tqdm import tqdm from config import * from dataloader.utils import * import argparse import json import ipdb '''Generate the BM25 gray candidates: Make sure the q-q BM25 index has been built ''' def parser_args(): parser = argparse.ArgumentParser() parser.add_ar...
StarcoderdataPython
1759699
import json, os, inspect, shutil from phi.fluidformat import * class ControlScene: def __init__(self, path, mode="r", index=None): self.path = path self.index = index if mode.lower() == "r": with open(os.path.join(path, "description.json"), "r") as file: self.i...
StarcoderdataPython
3291968
<reponame>freelancing-solutions/Open-Sentencing-Model from server import app from flask import Response, request from prometheus_client import generate_latest, Counter from functools import wraps # route to display configured Prometheus metrics # note that you will need to set up custom metric observers for your app ...
StarcoderdataPython
3232858
<reponame>qqqqqie/bk-log # -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. BK-LOG 蓝鲸日志平台 is licensed under the MIT License. License for BK-LOG 蓝鲸日志平台: -----------------------...
StarcoderdataPython
1692681
#!/usr/local/bin/python3.5 -u factor0 = 6 factor1 = 7 print(factor0 * factor1)
StarcoderdataPython
3339866
<gh_stars>0 """Tests the plotting function developed as part of 2E""" # Imports from floodsystem.plot import plot_water_levels from floodsystem.datafetcher import fetch_measure_levels import datetime from floodsystem.station import MonitoringStation fictional_station = MonitoringStation("station_id", "measure_id", ...
StarcoderdataPython
1712242
def NumToCharList(num): return [i for i in str(num)] def solution(s): target = [] count = 1 for i,ch in enumerate(s): if i==len(s)-1: if count!=1: target+=ch target+=NumToCharList(count) break else: target+=...
StarcoderdataPython
199943
import torch from torch.utils.tensorboard import SummaryWriter from torch.nn.utils.clip_grad import clip_grad_norm_ from torch import distributions from boltzmann import protein from boltzmann.generative import transforms from boltzmann import nn from boltzmann import utils from boltzmann import training from sklearn.n...
StarcoderdataPython
51191
# 1일차 - 이진수2 test_cases = int(input()) # 10진수 -> 2진수 def dec_to_bin(decimal): binary = '' while decimal != 0: decimal *= 2 if decimal >= 1: decimal -= 1 binary += '1' else: binary += '0' if len(binary) >= 13: binary = 'overflow' ...
StarcoderdataPython
4841991
import sys import os # Add bin to sys path since splunk runs it within this context sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'bin')) sys.path.insert(3, "/usr/local/lib/python2.7/dist-packages") sys.path.insert(4, "/usr/lib/python2.7/dist-packages")
StarcoderdataPython
3373801
<filename>fedopt_guide/stackoverflow_transformer/transformer_models.py<gh_stars>100-1000 # Copyright 2021, 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.apac...
StarcoderdataPython
3202794
<reponame>G00dBye/YYMS<filename>scripts/npc/enterGreatElf.py if sm.getChr().getJob() >= 2300: sm.warp(910150100) # else:
StarcoderdataPython
3334698
<filename>Python/Tests/GlassTests/PythonTests/Python/StepNativeToPython/py_mod.py import cpp_mod def callback(): print('ok') cpp_mod.global_func(callback)
StarcoderdataPython
1779369
# Imports from 3rd party libraries import dash import dash_bootstrap_components as dbc import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import dash_table # Imports from this application from app import app from joblib import load # 1 column layout # ...
StarcoderdataPython
3221284
<reponame>Imperssonator/afm-cnn """ Database models for microstructure dataset """ import os from sqlalchemy import Column, Float, ForeignKey, Integer, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship from sqlalchemy import create_engine Base = declarative_base() ...
StarcoderdataPython
3232911
<reponame>LincolnBryant/htcondor<gh_stars>0 #!/usr/bin/env pytest import classad import htcondor import logging import os import time from ornithology import * logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) @standup def condor(test_dir): with Condor( local_dir=test_dir / "condor",...
StarcoderdataPython
1607371
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ Topic: 通过字符串调用方法 Desc : """ import math class Point: def __init__(self, x, y): self.x = x self.y = y def __repr__(self): # !r表示调用后面参数的__repr__()方法 return 'Point({!r:},{!r:})'.format(self.x, self.y) def distance(self, x...
StarcoderdataPython
122133
<filename>enthought/chaco/axis.py # proxy module from __future__ import absolute_import from chaco.axis import *
StarcoderdataPython
1732564
<reponame>Evgengrmit/course-project # Copyright 2020 <NAME> <EMAIL> from catboost import CatBoostClassifier, Pool from sklearn.model_selection import train_test_split from detector import Preprocess as pp from sklearn.metrics import roc_auc_score, accuracy_score import sys class CatBoostModel: def __init__(self)...
StarcoderdataPython
1674638
from matplotlib import pyplot as plt import numpy as np from model_overview import define, define_from_file definition = define_from_file() model = definition["model"] # for index, beam in enumerate(model.beams): # plt.clf() # plt.axis('off') # points = beam.points # edges = beam.edges # for i, ...
StarcoderdataPython
1727153
array([[3.06957962, 0.70322209], [3.21487456, 0.6941981 ], [3.36178869, 0.68840816], [3.50994615, 0.68517987], [3.65898274, 0.68379808], [3.80855501, 0.68351701], [3.95831501, 0.6835691 ], [4.10807562, 0.68362114], [4.25783491, 0.68367411], [4.40759492, 0.6...
StarcoderdataPython
1701770
import unittest import orca import os.path as path from setup.settings import * from pandas.util.testing import * def _create_odf_csv(data, dfsDatabase): # call function default_session() to get session object s = orca.default_session() dolphindb_script = """ login("admin", "<PASSWORD>") dbPath="d...
StarcoderdataPython
1721948
<gh_stars>0 from minpiler.std import M, L, use_object def find_player_by_name(name: str): M.unit.bind(M.at.UnitType.gamma) if M.at.const.unit.name != name: M.unit.bind(M.at.UnitType.beta) if M.at.const.unit.name != name: M.unit.bind(M.at.UnitType.alpha) if M.at.const.uni...
StarcoderdataPython
3213406
<reponame>Sehun0819/pytea<gh_stars>100-1000 import LibCall import torch from .distribution import Distribution class Bernoulli(Distribution): def __init__(self, probs=None, logits=None, validate_args=None): if probs is not None: self.is_scalar = isinstance(probs, float) or isinstance(probs, in...
StarcoderdataPython