id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
230195
<filename>packages/jet_bridge_base/jet_bridge_base/settings.py import os import sys BASE_DIR = os.path.dirname(os.path.abspath(__file__)) CURRENT_MODULE = sys.modules[__name__] DEBUG = False READ_ONLY = False AUTO_OPEN_REGISTER = True PROJECT = None TOKEN = None ENVIRONMENT = None CORS_HEADERS = True BASE_URL = None ...
StarcoderdataPython
1994049
#!/usr/bin/env python3 import math def solution(x, y, jump_size): """ Returns the minimum number of times to add jump_size to x in order to reach y. Solution in O(1) for "Frog Jump". """ return math.ceil((y - x) / jump_size)
StarcoderdataPython
1635429
""" Script for saving the info of your members in a json file so that the identification process is carrying out smoothly Format for running this script there must be a folder - Database Inside it each identity photo must be there and the photo named as <that_person_name>.{any_format /png/jpeg/jpg} For example ...
StarcoderdataPython
3410852
from __future__ import absolute_import from lit36.formats.base import TestFormat, FileBasedTest, OneCommandPerFileTest from lit36.formats.googletest import GoogleTest from lit36.formats.shtest import ShTest
StarcoderdataPython
6597269
<gh_stars>1-10 from unittest import TestCase import requests import json #curl -H "Content-Type: application/json;charset=UTF-8 " -X POST -d '{"id":90,"asciimath":"", "mathml":"", "latex":"x \\lt y"}' http://host:port/latex_ to_asciimath class TestBatch(TestCase): def setUp(self): self.host = '172.16.58...
StarcoderdataPython
217598
from random import randint escolha = input('estou pensando em um numero entre 0 e 10 \nConsegue adivinhar? ') num = randint(0,10) while True: escolha = input('estou pensando em um numero entre 0 e 10 \nConsegue adivinhar? ') if escolha== num: print('é esse mesmo, você é bom msm') break else...
StarcoderdataPython
3339619
import random import tensorflow as tf from config.model_config import ModelConfig def color_augment(x: tf.Tensor, y: tf.Tensor): """Color augmentation Args: x: Images y: Labels """ x = tf.image.random_hue(x, 0.08) x = tf.image.random_saturation(x, 0.6, 1.6) x = tf.image.rando...
StarcoderdataPython
1852870
<reponame>Clonexy700/Shiro-DiscordBot import discord import asyncio import json from collections import OrderedDict import random import numpy as np from functools import partial from discord.utils import get from collections import namedtuple from discord.ext import commands class Marriage(commands.Cog): def __...
StarcoderdataPython
40698
<gh_stars>1-10 # -*- coding: utf-8 -*- import unittest import re from query import * def squeeze(value): value = value.replace('\r', '') value = value.replace('\n', '') return value class QueryTestCase(unittest.TestCase): def test_parse_names(self): self.assertEqual(None, parse_names(u'')) ...
StarcoderdataPython
6633565
""" Setuptools based setup module """ from setuptools import setup, find_packages import versioneer setup( name='pyiron_electrochemistry', version=versioneer.get_version(), description='pyiron_electrochemistry - module extension to pyiron.', long_description='http://pyiron.org', url='https://githu...
StarcoderdataPython
3246975
from collections import deque from itertools import combinations from advent.load import read_input def sum_window(numbers): return set(x + y for x, y in combinations(numbers, 2) if x != y) numbers = [int(x) for x in read_input()] window = deque(numbers[:25], 25) sums = sum_window(window) invalid = 0 for numb...
StarcoderdataPython
11384346
<filename>kslurm/cli/kpy.py from __future__ import absolute_import import importlib.resources as impr import os import re import shutil import subprocess as sp import sys import tarfile import tempfile from pathlib import Path from typing import Literal, Optional, cast, overload import attr from kslurm.args import S...
StarcoderdataPython
3356021
<filename>2020/src/day4.py<gh_stars>1-10 # advent of code # day4 import re keywords = ['byr', 'ecl', 'eyr', 'hcl', 'hgt', 'iyr', 'pid'] keywords.sort() valid_passport_count_a = 0 valid_passport_count_b = 0 with open("../input/day4.txt","r") as file: entries = file.readlines() # first puzzle given_keyw...
StarcoderdataPython
12823128
<reponame>lone17/deform-conv import keras import numpy as np import tensorflow as tf from keras import backend as K def weighted_binary_crossentropy(y_true, y_pred, class_weights=None): # Original binary crossentropy (see losses.py): # K.mean(K.binary_crossentropy(y_true, y_pred), axis=-1) # Calculate th...
StarcoderdataPython
29773
import grpc from concurrent import futures import time import sys sys.path.insert(0, 'service/') from service_spec import fake_news_pb2 from service_spec import fake_news_pb2_grpc import json import test class fake_news_classificationServicer(fake_news_pb2_grpc.fake_news_classificationServicer): def classify...
StarcoderdataPython
4811998
<reponame>kozistr/RAdam-tensorflow<filename>radam.py """RAdamOptimizer implementation `in Tensorflow.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import re import tensorflow as tf class RAdamOptimizer(tf.train.Optimizer): """Optimizer that impl...
StarcoderdataPython
9793826
from bot.helper.telegram_helper.message_utils import sendMessage from bot import AUTHORIZED_CHATS, SUDO_USERS, dispatcher, DB_URI from telegram.ext import CommandHandler from bot.helper.telegram_helper.filters import CustomFilters from telegram.ext import Filters from telegram import Update from bot.helper.telegram_hel...
StarcoderdataPython
4908362
class Solution: def minRemoveToMakeValid(self, s: str) -> str: left = [] right = [] for i in range(len(s)): if s[i] == '(': left.append(i) elif s[i] == ')': if len(left) > 0: left.pop() else: ...
StarcoderdataPython
1793208
# -*- coding:utf-8 -*- import json import math # 字母数 LETTERS = 5 def get_status(guess, actual): """ 根据猜测的单词和实际单词,获取状态码 :param guess: 猜测的单词 :param actual: 实际的单词 :return: 状态码 """ status = 0 base = 1 for i in range(len(guess)): c = guess[i] if c == actual[i]: ...
StarcoderdataPython
6654550
<reponame>shreejitverma/GeeksforGeeks<filename>Competitive Programming/Binary Trees/Top View of Binary Tree.py '''https://practice.geeksforgeeks.org/problems/top-view-of-binary-tree/1 https://www.geeksforgeeks.org/print-nodes-top-view-binary-tree/#:~:text=Top%20view%20of%20a%20binary,node%20at%20its%20horizontal%20dist...
StarcoderdataPython
257826
<gh_stars>1-10 import wx from gooey.gui import events from gooey.gui.pubsub import pub from gooey.gui.util import wx_util class Tabbar(wx.Panel): def __init__(self, parent, buildSpec, configPanels, *args, **kwargs): super(Tabbar, self).__init__(parent, *args, **kwargs) self._parent = parent ...
StarcoderdataPython
5015955
import numpy as np import timeit # ref import matplotlib.pyplot as plt from matlablib import * closefigures(plt) def gaussian(x, mu, sig): return np.exp(-np.power(x - mu, 2.) / (2 * np.power(sig, 2.))) # x0=np.arange(1, 100,10, dtype=float) N=1000; x0=np.linspace(-10, 10, N) x1=gaussian(x0, 0, .5) x2=np.heavis...
StarcoderdataPython
6631312
<filename>ticker.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- '''show scores of today's NHL games''' import datetime import json import os import platform import sys import time import requests from colorama import init, Fore, Style from pytz import reference # API purportedly updates every 60 seconds REFRESH_TI...
StarcoderdataPython
4986198
<filename>looking_for_group/rpgcollections/tasks.py from django.contrib.contenttypes.models import ContentType from django.db.models import Q from ..game_catalog.models import SourceBook, PublishedModule, GameSystem from . import models def recalc_library_content(library): """ For given library recalc all the...
StarcoderdataPython
11352520
from unittest import mock import constants from hackassembler import compiler def test__clean_line(): comment_line = ' FAKE=INSTRUCTION // Fake comment\n' only_comment_line = '// Fake comment\n' test_compiler = compiler.Compiler('fake_src') assert test_compiler._clean_line(comment_line) == 'FAKE=...
StarcoderdataPython
1706568
<reponame>htlcnn/ironpython-stubs<filename>release/stubs.min/System/Drawing/__init___parts/ImageConverter.py class ImageConverter(TypeConverter): """ System.Drawing.ImageConverter is a class that can be used to convert System.Drawing.Image objects from one data type to another. Access this class through the System...
StarcoderdataPython
8007387
from django.db import models from django.contrib.auth.models import User # Create your models here. # WILL USE THIS LATER IF/WHEN YOU CREATE USER ACCOUNTS - THIS MAY BE IN A DIFFERENT APP AS WELL!!!
StarcoderdataPython
4953803
<filename>Lib/test/test_trace.py # Testing the line trace facility. from test import test_support import unittest import sys import difflib import gc # A very basic example. If this fails, we're in deep trouble. def basic(): return 1 basic.events = [(0, 'call'), (1, 'line'), (1, ...
StarcoderdataPython
3242693
#!/bin/false # This file is part of Espruino, a JavaScript interpreter for Microcontrollers # # Copyright (C) 2013 <NAME> <<EMAIL>> # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.o...
StarcoderdataPython
1754868
<filename>mongodb_tryndx-master/app.py from re import template import config from flask import Flask from flask_pymongo import PyMongo as DB import controllers from flask_mail import * from random import * from flask_cors import CORS # from OpenSSL import SSL # context = SSL.Context(SSL.PROTOCOL_TLSv1_2) # context.use...
StarcoderdataPython
1876918
from datetime import time import unittest from term import Term from day import Day from lesson import Lesson from teacher import Teacher from timetable1 import Timetable1 from break_module import Break from timetable2 import Timetable2 class Test_Term(unittest.TestCase): # testy zad z zaj # def test_string...
StarcoderdataPython
6589395
<reponame>rland93/uciMAE107LabS21 import pandas as pd import numpy as np import scipy.stats as stats # length, visc., density L, mu, rho = 0.36, 0.0010016, 1000 data = pd.read_csv('./rawdata.csv') data['dp'] = data['p1 mm'] - data['p2 mm'] data['Q m3/s'] = data['vol mL'] / 1000000 / data['time s'] data['Q mL/s'] = da...
StarcoderdataPython
4862494
<filename>main_MetaAdaptModel_test.py """ @author : <NAME> # Adaptation model test for metaSCI # modified: <NAME>, 2021.6 Note: - Todo: """ import numpy as np from datetime import datetime import os import logging from os.path import join as opj from os.path import exists as ope import random import scipy.io as sc...
StarcoderdataPython
3232218
from scrapy.dupefilters import BaseDupeFilter, referer_str import logging import hashlib from scrapy.utils.python import to_bytes class MyRFPDupeFilter(BaseDupeFilter): """My Request Fingerprint duplicates filter""" def __init__(self, debug=False): self.fingerprints = set() self.logdupes = Tr...
StarcoderdataPython
9770408
<reponame>commandarmy/discord-event-manager<filename>api/mod_wow/region.py """Provides a wrapper around the WoW region system used in the API.""" from __future__ import annotations __LICENSE__ = """ Copyright 2019 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file ex...
StarcoderdataPython
9721709
from app.helpers.user import response def bad_request(e): ''' error 404 response ''' return response( 'failed', 'Request data cannot be executable', 400 ) def route_not_found(e): ''' error 404 response ''' return response( 'failed', 'Endpo...
StarcoderdataPython
8106145
"""Project settings""" # flake8: noqa from config.settings.components import * from config.settings.custom import * from config.settings.environments import * SETTINGS_EXPORT = [ "DEBUG", "LANGUAGE_CODE", ]
StarcoderdataPython
1782509
<reponame>martinell/django-carrot from django.views.generic import TemplateView class MessageList(TemplateView): template_name = 'carrot/index.vue'
StarcoderdataPython
6624215
# This file is useful during development and must never be checked in. import os # NB: do not set DEBUG here. Some settings depend on it and setting it here has # no effect. Edit an .env file and set it there. See # https://django-environ.readthedocs.io/en/latest/ for details. # Declare or redeclare variables here ...
StarcoderdataPython
1638858
<gh_stars>1-10 class RoutingRulesAdditionalFields: USERS = "users" CASE_TYPES = "case_types" FLAGS = "flags" COUNTRY = "country" choices = [ (USERS, "Users"), (CASE_TYPES, "Case Types"), (FLAGS, "flags"), (COUNTRY, "Country"), ] class StatusAction: DEACTIVA...
StarcoderdataPython
9730654
import sys sys.path.append("..") from tqdm import tqdm, trange import json import numpy as np import torch """ pretrain 데이터셋""" class PretrainDataSet(torch.utils.data.Dataset): """ 데이터로더에 사용하기 위한 데이터 셋 is_next: tokens_a와 tokens_b가 연속된 문장인지 여부 tokens: 문장들의 tokens segment: tokens_a(0)와 tokens_b(1)을 구분하기 위한 값 ...
StarcoderdataPython
3448706
from keras.layers import Input, merge, Dropout, Dense, Flatten, Activation from keras.layers.convolutional import MaxPooling3D, Conv3D from keras.layers.normalization import BatchNormalization from keras.models import Model from keras import backend as K from keras.utils.data_utils import get_file from keras import ...
StarcoderdataPython
6440062
<reponame>chickentuna/wapkg import hashlib from sys import stdout from urllib.request import urlopen class Downloader(object): def __init__(self, quiet=False): self.quiet = quiet self._last_path = None # URLError is thrown in case of errors def go(self, link, path, action=None): ...
StarcoderdataPython
225422
import unittest from pythonwarrior.units.archer import Archer class TestArcher(unittest.TestCase): def setUp(self): self.archer = Archer() def test_should_have_look_and_shoot_abilities(self): self.assertEqual({'shoot_', 'look'}, set(self.archer.abilities.keys())) def test_should_have_sh...
StarcoderdataPython
5120695
<filename>Toonland-2013-master/toonland/speedchat/TTChatInputSpeedChat.py ########################## THE TOON LAND PROJECT ########################## # Filename: TTChatInputSpeedChat.py # Created by: Cody/Fd Green Cat Fd (February 11th, 2013) #### # Description: # # Modifies the Speed Chat globals to contain some of ou...
StarcoderdataPython
6597894
from rest_framework.serializers import ModelSerializer from .models import Setting class SettingsSerializer(ModelSerializer): class Meta: model = Setting fields = ('active',)
StarcoderdataPython
5183065
"""authentik outposts app config""" from importlib import import_module from django.apps import AppConfig from structlog.stdlib import get_logger LOGGER = get_logger() class AuthentikOutpostConfig(AppConfig): """authentik outposts app config""" name = "authentik.outposts" label = "authentik_outposts" ...
StarcoderdataPython
9767444
<filename>source/ext/extref.py # # Copyright (c) 2021. JetBrains s.r.o. # Use of this source code is governed by the MIT license that can be found in the LICENSE file. # """A sphinx extension for inserting references in two formats - image or text. The ``extref`` directive do the all job. For example: .. code-block...
StarcoderdataPython
9639141
def heapify(arr,n,i): smallest = i l = 2*i+1 r = 2*i+2 if l<n and arr[l]<arr[smallest]: smallest = l if r < n and arr[r] < arr[smallest]: smallest = r if smallest != i: arr[i],arr[smallest] = arr[smallest],arr[i] heapify(arr,n,smallest) def heapSor...
StarcoderdataPython
268890
__________________________________________________________________________________________________ sample 48 ms submission import heapq as hq class Solution: def maxProfit(self, k: int, prices: List[int]) -> int: n = len(prices) if n == 0 or k == 0: return 0 if k > n // ...
StarcoderdataPython
173721
""" Mocsár Environment File name: envs/gmocsar.py Author: <NAME> Date created: 3/27/2020 """ from rlcard3 import models from rlcard3.envs.env import Env from rlcard3.games.mocsar.game import MocsarGame as Game from rlcard3.games.mocsar.utils import action_to_string, \ string_to_action, payoff_func...
StarcoderdataPython
1931151
<gh_stars>0 __author__ = "<NAME>" __copyright__ = "Copyright 2019, <NAME>" __version__ = "1.3.8" class PyngrokError(Exception): """ Raised when a general `pyngrok` error has occurred. """ pass class PyngrokNgrokInstallError(PyngrokError): """ Raised when an error has occurred while downloadi...
StarcoderdataPython
6668172
<gh_stars>0 # Copyright 2015 Cisco Systems # 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...
StarcoderdataPython
3370883
<filename>radpress/migrations/0001_initial.py # -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Tag' db.create_table('radpress_tag', ( ...
StarcoderdataPython
3370943
import cc_dat_utils #Part 1 input_dat_file = "data/pfgd_test.dat" #Use cc_dat_utils.make_cc_data_from_dat() to load the file specified by input_dat_file #print the resulting data if __name__ == '__main__': # Reading from input dat file dat_file = "data/pfgd_test.dat" result = cc_dat_utils.make_cc_data_...
StarcoderdataPython
6599958
import unittest from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.schema import Column from sqlalchemy.types import Integer, String from sqlalchemy import * from sqlalchemy.orm import mapper, sessionmaker from sqlalchemy.engine.reflection import Inspector import sqlite3 class TestSqlite3(unittest...
StarcoderdataPython
1867806
import sqlite3 #Load the data. conn = sqlite3.connect('rpg_db.sqlite3') #Write queries to explore the data. #1) How many total Characters are there? #Create a cursor object. curs1 = conn.cursor() #Write the query. query1 = 'SELECT COUNT(*) FROM charactercreator_character;' #Execute the query. curs1.execute(quer...
StarcoderdataPython
11311413
import time import json import datetime import RPi.GPIO as GPIO from IBMConnector import IBMConnector from Dallas import Dallas from DHT import DHT from SystemData import SystemData from Weather import Weather from CSVPersistor import C...
StarcoderdataPython
4959445
#! /usr/bin/env python """ Writes the distribution of halos from an SQL query. """ import sys import argparse import numpy from pat.utils import gioSqlite as gio_sqlite def load_sqlite_data(path, query, sqlite_file): """ Loads data using SQLite query. """ # load file print("Reading {}...".format(path...
StarcoderdataPython
8072396
<reponame>Staberinde/data-hub-api # used to calculate the quote expiry date, that is whichever is earliest of # [delivery date - QUOTE_EXPIRY_DAYS_BEFORE_DELIVERY days] OR # [date quote created + QUOTE_EXPIRY_DAYS_FROM_NOW days] QUOTE_EXPIRY_DAYS_BEFORE_DELIVERY = 21 QUOTE_EXPIRY_DAYS_FROM_NOW = 30
StarcoderdataPython
5069792
<filename>documentation/scripts/render_md.py #!/usr/bin/env python """ The script adds rendered images to all plantUML sections in the markdown files. Usage: 1. Include plantUML diagram picture to markdown: > render_md.py -i ABC.md -o XYZ.md --action render > render_md.py -i ABC.md -o XYZ.md 2. Inclu...
StarcoderdataPython
273680
<reponame>TirianShirley/learning_python #!/usr/bin/env python3 print('hello world")
StarcoderdataPython
4916284
from django.conf.urls import include, url from django.contrib import admin from django.views.generic import TemplateView from accounts.views import my_logout urlpatterns = [ # Examples: url(r'^$', 'shell.views.landing', name='landing'), url(r'^login/', 'accounts.views.login', name='login'), url(r'^log...
StarcoderdataPython
1947505
# # Copyright (c) 2021, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
StarcoderdataPython
5073539
from django.db import models from PIL import Image # Create your models here. class Imgcompress(models.Model): img = models.ImageField( upload_to="imgupload/compress/", blank=True) def save(self): super().save() # saving image first image = Image.open(self.img.path) #...
StarcoderdataPython
1827216
import setuptools with open("README.md") as fh: long_description = fh.read() with open("requirements.txt") as fh: requirements = fh.readlines() setuptools.setup( name="role-pattern-nlp", version="0.2.0", author="<NAME>", author_email="<EMAIL>", description=" Build and match patterns for s...
StarcoderdataPython
3420224
import random class ExampleGenerator(object): def __init__(self, M, N): self.L = M # label space dimension self.M = M # feature vector space dimension self.N = N # size of data set self.data_set = {} # data_set for p in range(N): random_size = random.randint(1,1...
StarcoderdataPython
3439965
from twine.cli import dispatch as twine_upload from .filesystem import find_files def upload(*globs, dry_run=False): files = find_files(globs, 'PyPI') if dry_run: print('NOTE: Skipping PyPI upload step since this is a dry run.') else: twine_upload(["upload", *files])
StarcoderdataPython
6657474
<filename>Spell Compendium/scr/tpModifiers/sp_unholy_storm.py<gh_stars>1-10 from templeplus.pymod import PythonModifier from toee import * import tpdp from utilities import * print "Registering sp-Unholy Storm" def unholyStormSpellOnConditionAdd(attachee, args, evt_obj): spellPacket = tpdp.SpellPacket(args.get_arg...
StarcoderdataPython
9792722
<filename>pyapprox/optimization.py import numpy as np from scipy.optimize import minimize, Bounds from functools import partial from scipy.stats import gaussian_kde as KDE from pyapprox.configure_plots import * import scipy.stats as ss from pyapprox.utilities import get_all_sample_combinations def approx_jacobian(func...
StarcoderdataPython
360574
<reponame>edchelstephens/django-rest-utils from exceptions.exceptions import *
StarcoderdataPython
5151692
from bs4 import BeautifulSoup import pandas as pd import re import requests from progress.bar import IncrementalBar from pathlib import Path from .cache import HttpCache, DataCache from urllib.parse import urljoin, urlparse, urlunparse import json def to_bar_message(s): return s[0:30].ljust(30) def parse_countr...
StarcoderdataPython
11291704
<reponame>lexndru/buildok<filename>buildok/statements/duckduckgo.py # Copyright 2018 <NAME> # # 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...
StarcoderdataPython
1913114
import unittest from mock import patch from starter.starter_helper import NullRequiredDataException from starter.starter_PMCDeposit import starter_PMCDeposit from tests.activity.classes_mock import FakeLogger from tests.classes_mock import FakeLayer1 import tests.settings_mock as settings_mock class TestStarterPMCDep...
StarcoderdataPython
3505269
<gh_stars>1-10 from multiprocessing.pool import Pool def cal_list(num): the_list = [1] st = 1 interval = 2 for i in range(num): for j in range(4): st += interval the_list.append(st) interval += 2 return the_list def cal_prime(num): for i in range(2, int...
StarcoderdataPython
11383014
# Copyright (c) 2017, MD2K Center of Excellence # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditio...
StarcoderdataPython
12843050
<gh_stars>1-10 # •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• # Copyright (c) 2018, <NAME>. This software is licensed under the BSD # 3-Clause License. Please see the LICENSE file in the project root directory. # •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••...
StarcoderdataPython
4987052
<reponame>aigarius/photoriver2 """Remotes implementation - state of a local folder""" import logging import os import shutil import requests from photoriver2.remote_base import BaseRemote IMAGE_EXTENSIONS = ("JPEG", "JPG", "HEIC", "CR2", "TIFF", "TIF") logger = logging.getLogger(__name__) def deconflict(path): ...
StarcoderdataPython
3282130
<filename>UnityEngine/RectTransform/__init__.py<gh_stars>0 from typing import overload from UdonPie import System from UdonPie import UnityEngine from UdonPie.Undefined import * class RectTransform: def __new__(cls, arg1=None): ''' :returns: RectTransform :rtype: UnityEngine.RectTransform...
StarcoderdataPython
11245967
<reponame>mantaspieza/IMDB-gross-profit-prediction-api import pandas as pd import pickle5 as pickle # file = open("model/One_Hot_Encoder.pkl", "rb") one_hot = pickle.load(open("model/One_Hot_Encoder.pkl", "rb")) def process_input(input_data): """ Function which One Hot Encodes input from API. :param inp...
StarcoderdataPython
96148
<reponame>dimithras/pandas<gh_stars>1-10 import numpy as np import pandas as pd from pandas import Series class TestSeriesAnalytics: def test_ptp(self): # GH21614 N = 1000 arr = np.random.randn(N) ser = Series(arr) assert np.ptp(ser) == np.ptp(arr) def test_is_monoton...
StarcoderdataPython
3454347
<reponame>Corymbia/nephoria from nephoria.testcontroller import TestController from cloud_utils.log_utils import get_traceback, eulogger, red from prettytable import PrettyTable import time from optparse import OptionParser import resource import signal import sys import __builtin__ openfiles = set() oldfile = __b...
StarcoderdataPython
308926
<reponame>michaelfranzl/pyglpainter """ pyglpainter - Copyright (c) 2015 <NAME> 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,...
StarcoderdataPython
3566533
import os import six import itertools from dftinputgen.data import STANDARD_ATOMIC_WEIGHTS from dftinputgen.utils import get_elem_symbol from dftinputgen.utils import get_kpoint_grid_from_spacing from dftinputgen.qe.settings import QE_TAGS from dftinputgen.qe.settings.calculation_presets import QE_PRESETS from dftinp...
StarcoderdataPython
1862097
""" Utilities for managing (local + remote) runs """ from . import managed, remote, calibration, powerbi, utils from .managed import ManagedRun
StarcoderdataPython
5126565
import unittest if __name__ == '__main__': suite = unittest.TestSuite() for test in ['connection', 'fields', 'queryset', 'dereference', 'document', 'dynamic_document', 'signals', 'django_compatibility']: suite.addTest(unittest.defaultTestLoader.loadTestsFromName(test))...
StarcoderdataPython
9710241
import numpy as np import torch from pymoo.factory import get_mutation from pymoo.core.mutation import Mutation from lambo import utils from lambo.tasks.chem.logp import prop_func from lambo.models.mlm import sample_tokens def get_mlm_mutation(mlm_obj, problem, cand_idx, res_idx): seqs = [problem.candidate_poo...
StarcoderdataPython
1793416
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn import time from ..builder import ALGORITHMS, build_backbone, build_head, build_neck, build_algorithm from mmcv.runner.checkpoint import load_checkpoint from .base import BaseModel import torch import torch.nn.functional as F from mmselfsup.models.al...
StarcoderdataPython
297772
from flask import Flask, request, jsonify from scholarly_wallet import orcid_api as orcid from scholarly_wallet import config from scholarly_wallet import mongo_access as mongo, github_api as github from scholarly_wallet import figshare_api as figshare from scholarly_wallet import zenodo_api as zenodo from flask_jwt_ex...
StarcoderdataPython
163528
# /usr/bin/env python3 # -*- coding: utf-8 -*- ############################################## ############## Importing ############### ############################################## import utility as _utility import docstrings as _docstrings import subprocess as _subprocess #####################################...
StarcoderdataPython
1644693
<filename>evaluateData/changeHSVSoThatMinCompareHist.py<gh_stars>1-10 import cv2 import matplotlib.pyplot as plt from changeBrightness import changeH, changeS, changeV def changeImage(img, s, v): return changeV(changeS(img, s), v) def findHSV(img, img2): hist = cv2.calcHist([img],[0],None,[256],[0,256]) h...
StarcoderdataPython
6420482
import pandas as pd from sqlalchemy.sql.functions import min def SaveToExcel(player1,player2,excelfilename): data={"name":[player1,player2]} index = ["player1", "player2"] df = pd.DataFrame(data, index) print(df) # df.to_excel(excelfilename) #0,1,2,3 def ReadFromExcel(excelfilename): df=pd....
StarcoderdataPython
6674561
from numpy import sum as npsum from numpy import zeros, abs, mean from CopMargSep import CopMargSep def SWDepMeasure(X, probs): # This function estimates the Schweizer and Wolff measure of dependence # between two random variables by means of Monte Carlo simulations # INPUTS # X : [matrix] (2...
StarcoderdataPython
6674614
from os.path import dirname, abspath, join, isfile, basename from os import listdir from importlib.util import spec_from_file_location, module_from_spec """ Structure typing: OneWireRegisterMap: (str, [OneWireRegisterEntry, ...], [OneWireRegisterEntry, ...]) OneWireRegisterEntry: (int, int, str, bool, int, int, str) ...
StarcoderdataPython
1941138
import argparse import torch from transformers import ElectraModel from tokenization_kocharelectra import KoCharElectraTokenizer # Get the model path parser = argparse.ArgumentParser() parser.add_argument("--model_name_or_path", default="monologg/kocharelectra-base-discriminator", type=str, help="...
StarcoderdataPython
216865
<filename>docs/examples/all_on_3.py<gh_stars>100-1000 from gpiozero import LED, Buzzer, Button from signal import pause button = Button(2) buzzer = Buzzer(3) red = LED(4) amber = LED(5) green = LED(6) things = [red, amber, green, buzzer] def things_on(): for thing in things: thing.on() def things_off():...
StarcoderdataPython
4974096
import json from pathlib import Path import appdirs from jambottle.bottles import Jam def getdatadir(): appname = "jambottle" appauthor = "<NAME>" datadir = Path(appdirs.user_data_dir(appname, appauthor)) return datadir conf_path = getdatadir() / "conf.json" class Config(): def __init__(self...
StarcoderdataPython
6431294
#!/usr/bin/env python # coding: utf-8 # <!--BOOK_INFORMATION--> # <img align="left" style="padding-right:10px;" src="images/book_cover.jpg" width="120"> # # *This notebook contains an excerpt from the [Python Programming and Numerical Methods - A Guide for Engineers and Scientists](https://www.elsevier.com/books/pyth...
StarcoderdataPython
6514561
<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- # stdlib import base64 import urllib import urllib2 import json import logging class EasyException(Exception): def __init__(self, code, code_explain, error, data): """ easyops的错误异常 :param code: 返回码 :param code_explain: 详细...
StarcoderdataPython
4807705
# encoding: utf-8 # Sample project fabfile.py (should be on the same level as manage.py, see README) from fabmanager import fabfile from fabmanager.fabfile import * # Environments WORKON_HOME = '/opt/python' GIT_REPO = '<EMAIL>:myproject.git' PROJECT = 'myproject' ENVS.update({ 'production': { 'ho...
StarcoderdataPython