id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
307060
<gh_stars>0 from __future__ import annotations from typing import List from fusionauth.fusionauth_client import FusionAuthClient from fusionauth.rest_client import ClientResponse from app.schemas.tokens import Token from app.schemas.users import UserRegistrationForm, UserInfo, RegistrationRequest, \ AppRegistrat...
StarcoderdataPython
3527889
<gh_stars>0 # # --- Disaster --- # # # # - Disasters and their effects # # # # --- --- --- --- from random import random, choice from Buildings import buildings class Disaster: def __init__(self, name, onTick, baseDuration): self.name = name self.onTick = onTick self.baseDuration = baseDu...
StarcoderdataPython
287960
#!/usr/bin/env python3 """ Solution to the challenge #20 of the "Advent of Code 2017" series. MIT License Copyright (c) 2017 <NAME> (<EMAIL>) 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 wit...
StarcoderdataPython
3512011
import pytest from pretix.base.models import Organizer event_urls = [ 'categories/', 'invoices/', 'items/', 'orders/', 'orderpositions/', 'questions/', 'quotas/', 'vouchers/', 'waitinglistentries/', ] event_permission_urls = [ ('get', 'can_view_orders', 'orders/', 200), ('...
StarcoderdataPython
176388
from django.db import models from NCPWD.apps.topics.models import Topic from datetime import datetime from NCPWD.apps.authentication.models import User class Comments(models.Model): author = models.ForeignKey(User, on_delete=models.CASCADE) topic = models.ForeignKey(Topic, on_delete=models.CASCADE) body =...
StarcoderdataPython
4876705
<filename>plato_fit_integrals/shared/unit_tests/utest_wflow_helpers.py #!/usr/bin/python3 import copy import unittest import plato_fit_integrals.shared.workflow_helpers as tCode class TestModOptDict(unittest.TestCase): def setUp(self): self.baseOptDict = {"addcorrectingppfrombdt":0, "addcorr...
StarcoderdataPython
7036
import os, json, inspect import mimetypes from html2text import html2text from RestrictedPython import compile_restricted, safe_globals import RestrictedPython.Guards import frappe import frappe.utils import frappe.utils.data from frappe.website.utils import (get_shade, get_toc, get_next_link) from frappe.modules impo...
StarcoderdataPython
9662530
#!/usr/bin/env python # ============================================================================================= # MODULE DOCSTRING # ============================================================================================= """ Class definitions to represent a molecular system and its chemical components .. ...
StarcoderdataPython
9630201
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib.patches import FancyArrowPatch from mpl_toolkits.mplot3d import proj3d import numpy as np from mpl_toolkits.mplot3d.art3d import Poly3DCollection import scipy as sp import matplotlib.colors as colors import cv2 from draw import * fr...
StarcoderdataPython
1655896
CONTRACT_ADDRESS = '0xE259e8386d38467f0E7fFEdB69c3c9C935dfaeFc'
StarcoderdataPython
8051482
from .layer_misc import ConvBNReLU, GraphAdjNetwork from .weight_init import constant_init, xavier_init, kaiming_init
StarcoderdataPython
1716867
<reponame>tamukou/Make-My-Fonts<filename>json_test.py import json write_f = open('ave_x_y.json','r+') try: json_dict = json.load(write_f) except: print('err') print(json_dict['丁'])
StarcoderdataPython
6703314
import typing def main() -> typing.NoReturn: # mathematical induction # if max distance is d_mx, # the count of i such that a_i = d_mx is more than or equal to 2 # and a_i = d_mx - 1 is also more than or equal to 2, and less than or equal to the count of i (a_i = d_mx) # except for tha min...
StarcoderdataPython
263182
<reponame>PrateekMunjal/TorchAL #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ResNe(X)t models.""" import torch.nn as nn #Importing here has no harm as it is a...
StarcoderdataPython
12829463
<reponame>timoast/sctools # -*- coding: utf-8 -*- #! /usr/bin/env python from __future__ import absolute_import from sctools import sctools, genotype, replace import pandas as pd import functools import time def log_info(func): """Decorator that prints function arguments and runtime """ @functools.wraps(...
StarcoderdataPython
12849457
# Generated by Django 3.1.7 on 2021-05-23 21:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('interest', '0001_initial'), ] operations = [ migrations.AlterField( model_name='interest', name='name', ...
StarcoderdataPython
6548332
#!/usr/bin/env python3 """Charm code for MongoDB service.""" # Copyright 2021 Canonical Ltd. # See LICENSE file for licensing details. import json import logging import subprocess from subprocess import check_call from typing import List, Optional from urllib.request import URLError, urlopen import ops.charm import ya...
StarcoderdataPython
1908003
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf from edward.util import dot class test_dot_class(tf.test.TestCase): def test_dot(self): with self.test_session(): a = tf.constant(np.arange(5, dtype=np...
StarcoderdataPython
1913688
# --- # jupyter: # jupytext: # formats: ipynb,py:percent # text_representation: # extension: .py # format_name: percent # format_version: '1.3' # jupytext_version: 1.11.4 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- # %% [ma...
StarcoderdataPython
4803348
<filename>pypy/module/test_lib_pypy/test_sqlite3.py """Tests for _sqlite3.py""" def test_list_ddl(): """From issue996. Mostly just looking for lack of exceptions.""" from sqlite3.dbapi2 import connect connection = connect(':memory:') cursor = connection.cursor() cursor.execute('CREATE TABLE foo (b...
StarcoderdataPython
8021007
from flask_admin import (BaseView, expose) class HomeView(BaseView): def is_visible(self): return False @expose('/', methods=('GET',)) def index(self): return self.render('home.html')
StarcoderdataPython
1809327
# Authors: # <NAME> # Google - defining ClientCertificateType # Google (adapted by <NAME>) - NPN support # <NAME> - Anon ciphersuites # <NAME> (Arcode Corporation) - canonicalCipherName # <NAME> (ported by <NAME>) - TLS 1.2 # # See the LICENSE file for legal information regarding use of this file. """Cons...
StarcoderdataPython
6460475
from . import AWSObject, AWSProperty from .compat import policytypes from .validators import boolean class CloudwatchAlarmAction(AWSProperty): props = { 'AlarmName': (str, True), 'RoleArn': (str, True), 'StateReason': (str, True), 'StateValue': (str, True), } class Cloudwatch...
StarcoderdataPython
5186548
<reponame>getnexar/VPE<gh_stars>10-100 import json from loader.gtsrb import gtsrbLoader from loader.gtsrb2TT100K import gtsrb2TT100KLoader from loader.belga2flickr import belga2flickrLoader from loader.belga2toplogo import belga2toplogoLoader def get_loader(name): return { 'gtsrb': gtsrbLoader, 'g...
StarcoderdataPython
205141
from uptime import boottime class BootTime: # get system boot time def get_boot_time(self): # datetime of boot return boottime().strftime('%x %X')
StarcoderdataPython
3370395
<reponame>aclarknet/aclarknet-database # -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-08-10 21:59 from __future__ import unicode_literals from django.db import migrations import multiselectfield.db.fields class Migration(migrations.Migration): dependencies = [ ('database', '0005_auto_20170...
StarcoderdataPython
9711023
def makefilter(keep): """ Return a functor that takes a string and returns a copy of that string consisting of only the characters in 'keep'. """ import string # make a string of all chars, and one of all those NOT in 'keep' allchars = string.maketrans('', '') delchars = ''.join([c for ...
StarcoderdataPython
6607269
# GENERATED BY KOMAND SDK - DO NOT EDIT import insightconnect_plugin_runtime import json class Component: DESCRIPTION = "Update an Automox group" class Input: COLOR = "color" GROUP_ID = "group_id" NAME = "name" NOTES = "notes" ORG_ID = "org_id" PARENT_SERVER_GROUP_ID = "parent_server_gro...
StarcoderdataPython
1602329
<filename>stix2arango/postgresql.py import ipaddress import copy from nis import match from typing import Dict from stix2arango.exceptions import InvalidObjectForOptimizer from stix2arango.utils import deep_dict_update import psycopg2 from psycopg2.errors import DuplicateTable import uuid type_map = { 'str' : 'T...
StarcoderdataPython
8173128
<reponame>LBJ-Wade/astrofunc_lensing_profile __author__ = 'sibirrer' import scipy.stats as stats from scipy.interpolate import interp1d import numpy as np class SkewGaussian(object): """ class for the Skew Gaussian distribution """ def pdf(self, x, e=0., w=1., a=0.): """ probability d...
StarcoderdataPython
3451247
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from polyaxon_lib.experiments.experiment import Experiment from polyaxon_lib.experiments.rl_experiment import RLExperiment from polyaxon_lib.experiments.utils import run_experiment
StarcoderdataPython
9784781
<filename>psych_metric/distrib/bnn/bnn_mcmc.py """The Class and related functions for a BNN implemented via MCMC.""" from copy import deepcopy import logging from functools import partial import tensorflow as tf from psych_metric.distrib import bnn_transform from psych_metric.distrib.simplex.euclidean import Euclidea...
StarcoderdataPython
8172838
import RPi_I2C_driver as lcd1602 from time import * while True: mylcd = lcd1602.lcd() mylcd.lcd_display_string("Hello World!",1) mylcd.lcd_display_string("Test LCD1602",2,3) sleep(3) mylcd.lcd_clear() sleep(1) mylcd.lcd_clear() sleep(1)
StarcoderdataPython
11211575
<filename>day2/netmiko_ex2.py<gh_stars>0 #!/usr/bin/env python """Exercises using Netmiko""" from getpass import getpass from netmiko import ConnectHandler def main(): """Exercises using Netmiko""" sw1_pass = getpass("Enter switch password: ") pynet_sw1 = { 'device_type': 'arista_eos', 'ip...
StarcoderdataPython
3438496
<reponame>datascopeanalytics/scrubadub<filename>tests/test_filth_organization.py import faker import unittest from scrubadub.filth import OrganizationFilth class OrganizationFilthTestCase(unittest.TestCase): def test_generate(self): class Faker: def company(self): return 'Brow...
StarcoderdataPython
4993801
<reponame>lukebranch/product_images from openerp.osv import osv, fields class product_template(osv.Model): _inherit = 'product.template' _columns = { 'x_secondpicture': fields.binary("Second Image", help="This field holds the second image used as image for the product, limited to 1024x...
StarcoderdataPython
8115760
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
StarcoderdataPython
3446815
<gh_stars>0 #!/usr/bin/env python import numpy as np from pyquaternion import Quaternion import rospy import tf from geometry_msgs.msg import Pose, PoseArray, PoseStamped from visualization_msgs.msg import Marker, MarkerArray from numpy import genfromtxt import os import matplotlib.pyplot as plt publisher_position_b...
StarcoderdataPython
1736552
<filename>tools/diff.py import click import filecmp import logging import subprocess import time @click.group() def main(): logger = logging.getLogger() logger.setLevel(logging.INFO) @main.command() @click.option('--gen', required=True) @click.option('--binary', required=True) @click.option('--good', default=...
StarcoderdataPython
4957324
from __future__ import annotations from typing import Optional, TYPE_CHECKING from spark_auto_mapper_fhir.fhir_types.list import FhirList from spark_auto_mapper_fhir.fhir_types.string import FhirString from spark_auto_mapper_fhir.extensions.extension_base import ExtensionBase from spark_auto_mapper_fhir.base_types.fh...
StarcoderdataPython
245407
<reponame>shawnduong/manimations<gh_stars>0 from manim import * class s03c_Object_Oriented_Programming(Scene): def construct(self): # Actors. title = Text("Object-Oriented Programming") point = Text("OOP is the idea that things can be represented abstractly\n" + "as classes, instantiated as objects, and in...
StarcoderdataPython
9644291
class Solution: def insertIntoBST(self, root, val): """ :type root: TreeNode :type val: int :rtype: TreeNode """ if root == None: return TreeNode(val) p = root while p: if val < p.val: if p.left: ...
StarcoderdataPython
8146990
<filename>nomadgram/images/admin.py from django.contrib import admin from nomadgram.images.models import Comment from nomadgram.images.models import Image from nomadgram.images.models import Like @admin.register(Image) class ImageAdmin(admin.ModelAdmin): list_display = ['id', 'file', 'location', 'caption', 'crea...
StarcoderdataPython
4903632
<filename>examples/jira/jira_issue_update_epic_link.py """ Update the Epic Link for issue(s) """ from atlassian.jira import Jira # the Issues which we want to place to a certain EPIC update_issues = ["ARA-1233", "ARA-1234"] def main(): jira = Jira(url="https://jira.example.com/", username="user", password=...
StarcoderdataPython
1868078
from automap.rmse import polynomial, predict import pythongis as pg import numpy as np ### mapp = 'burkina' #mapp = 'brazil_land_1977' #mapp = 'brazil_pol_1981' gcps = pg.VectorData('testmaps/{}_controlpoints.geojson'.format(mapp)) rast = pg.RasterData('testmaps/{}_georeferenced.tif'.format(mapp)) # estimate coef...
StarcoderdataPython
1944166
# -*- coding: utf-8 -*- """ Created on Mon Nov 23 21:29:10 2020 @author: ZongSing_NB """ from TMGWO import TMGWO import numpy as np import pandas as pd from sklearn.neighbors import KNeighborsClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score import functools im...
StarcoderdataPython
12806016
from socket import * # Message to send msg = '\r\nI love computer networks!' endmsg = '\r\n.\r\n' # Choose a mail server (e.g. Google mail server) and call it mailserver mailserver = 'webmail.inu.ac.kr' # Create socket called clientSocket and establish a TCP connection with mailserver clientSocket = socket(AF_INET, ...
StarcoderdataPython
3294825
# proxy module from pyface.ui.wx.progress_dialog import *
StarcoderdataPython
8160179
<filename>shenasm/serialise.py from . import log import string def write_out(instructions, path): """ takes a collection of instructions and writes them out to a file as specified by the path argument """ compressed_labels = {} labels = label_generator() output = open(path, 'w') for ...
StarcoderdataPython
392323
# -*- coding: utf-8 -*- import os import json import time from time import sleep from chaoslib.exceptions import FailedActivity from chaoslib.types import Configuration, Secrets from logzero import logger from .. import ansible_api_client # from ..types import SaltStackResponse #from .constants import OS_LINUX, O...
StarcoderdataPython
11365870
<reponame>nowage/penDetect<gh_stars>1-10 def f1(x,y): return x+y+1
StarcoderdataPython
4983229
<reponame>serrhini/CSIKit import numpy as np import pandas as pd from scipy import signal def lowpass(csi_vec: np.array, cutoff: float, fs: float, order: int) -> np.array: nyq = 0.5*fs normal_cutoff = cutoff/nyq b, a = signal.butter(order, normal_cutoff, btype="low", analog=False) return signal.filtfil...
StarcoderdataPython
1826178
<filename>helper.py<gh_stars>1-10 #!/usr/bin/python3 # # This file is part of libmempool. # Copyright (c) 2017, <NAME> <aaron.adams(at)nccgroup(dot)trust> # Copyright (c) 2017, <NAME> <cedric.halbronn(at)nccgroup(dot)trust> class logger: def logmsg(s, debug=True): if not debug: return i...
StarcoderdataPython
1693417
# Uses Python3 # Greatest divisor common import sys def GCDNaive(a, b): best = 0 if(b == 0 or a == 0): return 0 if(b > a): [a, b] = [b, a] for i in range(1, a + 1): if(a % i == 0 and b % i == 0): best = i return best # Euclidean Algorithm def EuclideanGCD(a, b):...
StarcoderdataPython
9729553
<reponame>martincss/iccpy<filename>simulations/gimic.py import os from tables import openFile from iccpy.utils import interp3d from numpy import float64, empty, array elements = ('Calcium', 'Carbon', 'Iron', 'Magnesium', 'Neon', 'Nitrogen', 'Oxygen', 'Silicon', 'Sulphur') helium_fracs = ('0.24', '0.25', '0.26', '0.27...
StarcoderdataPython
6435389
<reponame>rolando-contrib/scrapy from __future__ import print_function import sys, time, random, os, json from six.moves.urllib.parse import urlencode from subprocess import Popen, PIPE from twisted.web.server import Site, NOT_DONE_YET from twisted.web.resource import Resource from twisted.web.static import File from ...
StarcoderdataPython
1992682
def multiply(num1, num2): if num1 > 0 and num2 > 0: neg = False elif num1 < 0 and num2 < 0: neg = False else: neg = True ans = 0 for i in range(num2): ans += num1 if neg: actual = 0 for i in range(ans): actual + -1 ans = actual ...
StarcoderdataPython
6511661
<filename>kubedriver/kegd/model/deploy_task.py from .deploy_objects_action import DeployObjectsAction from .deploy_object_action import DeployObjectAction from .deploy_helm_action import DeployHelmAction from .exceptions import InvalidDeploymentStrategyError ACCEPTED_ACTIONS = { DeployHelmAction.action_name: Deplo...
StarcoderdataPython
3461834
<filename>unit_testing/messari_tests.py import unittest from messari.messari import Messari from typing import Dict import os import sys import pandas as pd import time API_KEY = os.getenv('MESSARI_API_KEY') if API_KEY is None: print('Please define MESSARI_API_KEY in your runtime enviornment') sys.exit() clas...
StarcoderdataPython
3313679
import discord, asyncio # imports the base discord package from discord.ext import ( commands, ) # imports discord.ext and it's commands wrapper, "commands"! import aiohttp # this is what we're going to use to make http requests to reddit! import json # this is how we will manupulate the json response of the re...
StarcoderdataPython
352653
""" gas_mixture: ------------ Gas mixture of ideal gases. The approach for the ideal gases may be Perfect or Semiperfect. MRodriguez 2020 """ import pyturb.utils.constants as cts from pyturb.gas_models.gas import Gas from pyturb.gas_models.perfect_ideal_gas import PerfectIdealGas from pyturb.gas_models.semiperfect_i...
StarcoderdataPython
3373007
<gh_stars>0 import collections import unittest import numpy import pandas from d3m import container, utils from d3m.metadata import base class TestContainerMetadata(unittest.TestCase): def test_update_with_generated_metadata(self): metadata = base.DataMetadata({ 'schema': base.CONTAINER_SCHE...
StarcoderdataPython
1738351
<reponame>AcckiyGerman/django_informixdb __version__ = '1.3.3'
StarcoderdataPython
12843911
<reponame>cloudant-labs/spark-cloudant #******************************************************************************* # Copyright (c) 2015 IBM Corp. # # 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 Lic...
StarcoderdataPython
6413240
<gh_stars>0 # -*- coding: utf-8 -*- ############################################################################## # # Copyright © 2013, 2016 OnlineGroups.net and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL shoul...
StarcoderdataPython
9676592
<filename>app/test_user_getter.py # Copyright 2016 Google Inc. 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 # # Unl...
StarcoderdataPython
1699987
<reponame>coordt/concrete-settings from concrete_settings import Settings, validate def test_validate_calls_validator(ValidatorMock): validator_1 = ValidatorMock() class AppSettings(Settings): AGE: int = 10 @ validate(validator_1) AppSettings().is_valid() assert validator_1.called_with_value...
StarcoderdataPython
6655598
import unittest from unittest.mock import patch, Mock class AddCommandTests(unittest.TestCase): @patch('pocketbook.address_book.AddressBook') def test_add(self, address_book): from pocketbook.commands.add import run_add args = Mock() args.name = 'foo' args.address = 'foo-addr...
StarcoderdataPython
9631228
<filename>model_prototype/run.py<gh_stars>0 # The main run file # command: python3 run.py --configs default --trainer default \ # --dataset default --model default --experiment 1 from comet_ml import Experiment from comet_ml import Optimizer import argparse import importlib from utils.utils import parse_comet_config ...
StarcoderdataPython
6675105
<gh_stars>0 from my_utils.tests import test_and_solve from collections import defaultdict DAY_NR = 12 def trim_state(state, nr_empties=5): first_full = state.index('#') last_full = state[::-1].index('#') first_idx = 0 if first_full >= nr_empties: first_idx = (first_full-nr_empties) s...
StarcoderdataPython
6457497
# -*- coding: utf-8 -*- # # Copyright (c) 2016 - 2022 -- <NAME> # All rights reserved. # # License: BSD License # """\ Test against issue #23. <https://github.com/heuer/segno/issues/23> """ from __future__ import unicode_literals, absolute_import import segno def test_boost_error_automatic(): qr = segno.make('htt...
StarcoderdataPython
1611494
def insertItem(collection, item): collection.items.append(item) return collection def editItem(collection, itemId, updatedItem): itemsIndex = 0; for item in collection.items: if int(item.id) == itemId: collection.items[itemsIndex].name = updatedItem.name collection.items...
StarcoderdataPython
6614114
# Copyright (c) 2021-present, <NAME> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of conditions and ...
StarcoderdataPython
3301797
import unittest from inferelator_ng import single_cell from inferelator_ng.single_cell_puppeteer_workflow import create_puppet_workflow import numpy as np import pandas as pd class SingleCellTestCase(unittest.TestCase): def setUp(self): self.expr = pd.DataFrame([[2, 28, 0, 16, 1, 3], [6, 21, 0, 3, 1, 3], ...
StarcoderdataPython
3344817
import os from setuptools import find_packages, setup with open('README.rst') as fh: readme = fh.read() description = 'Girder Worker tasks for Large Image.' long_description = readme def prerelease_local_scheme(version): """ Return local scheme version unless building on master in CircleCI. This f...
StarcoderdataPython
9687510
#!/usr/bin/python import spear.LPR.imageProcessing import spear.LPR.maskCreate import sys import time imagePath = str(sys.argv[1]) img = spear.SimpleCV.Image(imagePath) img = spear.LPR.imageProcessing.equalize(img) img = spear.LPR.imageProcessing.denoiseBilateralFilter(img) img.show() time.sleep(2) spear.LPR.mas...
StarcoderdataPython
8037735
n=int(input('Digite um valor:')) print(f'O dobro de {n} é {n*2}\nO Triplo é {n*3}\nA raiz é {n**(0.5):.3f}')
StarcoderdataPython
8049891
# -*- coding: utf-8 -*- """ message_media_lookups.controllers.lookups_controller. """ import logging from .base_controller import BaseController from ..api_helper import APIHelper from ..configuration import Configuration from ..http.auth.basic_auth import BasicAuth from ..models.lookup_a_phone_number_...
StarcoderdataPython
9650652
<gh_stars>1-10 from maskrcnn_benchmark.config import cfg from predictor import COCODemo from PIL import Image import numpy as np import matplotlib.pyplot as plt # config_file = "../configs/caffe2/e2e_mask_rcnn_R_50_FPN_1x_caffe2.yaml" config_file = "/home/SelfDriving/maskrcnn/maskrcnn-benchmark/configs/e2e_faster_rcnn...
StarcoderdataPython
8085846
""" 练习4:以面向对象思想,描述下列情景. 玩家攻击敌人,敌人受伤(根据玩家攻击力,减少血量,头顶爆字). --敌人还能攻击玩家,玩家受伤 (根据敌人攻击力,减少血量,闪现红屏). --敌人玩家血量没有时,都会死亡(播放死亡动画)  """ # 现状: # 两个类存在 完全相同的代码 # 部分相同的代码 class Player: def __init__(self, hp=0, atk=0): self.hp = hp self.atk = atk def attac...
StarcoderdataPython
4830101
<filename>python-algorithm/leetcode/problem_402.py """402. Remove K Digits https://leetcode.com/problems/remove-k-digits/ Given a non-negative integer num represented as a string,remove k digits from the number so that the new number is the smallest possible. Note: The length of num is less than 10002 and will b...
StarcoderdataPython
4874566
<gh_stars>0 class Node: def __init__(self, data): self.data = data self.next = None def rotateList(head, k): if k == 0 : return current = head while (current.next): current = current.next current.next = head ...
StarcoderdataPython
92883
<reponame>htlcnn/ironpython-stubs class HandledEventArgs(EventArgs): """ Provides data for events that can be handled completely in an event handler. HandledEventArgs() HandledEventArgs(defaultHandledValue: bool) """ @staticmethod def __new__(self,defaultHandledValue=None): """ __new__(cls:...
StarcoderdataPython
5010231
# https://programmers.co.kr/learn/courses/30/lessons/12937 def solution(num:int)->str: return 'Even' if num % 2 == 0 else 'Odd' # Test print(solution(60)) print(solution(15)) print(solution(3)) print(solution(4))
StarcoderdataPython
3262707
<filename>growspace/envs/spotlight.py<gh_stars>10-100 import os import random import sys from enum import IntEnum from random import sample import cv2 import gym import numpy as np import tqdm from numpy.linalg import norm from scipy.spatial import distance import random import torchvision from torchvision import data...
StarcoderdataPython
6419593
# -*- coding: utf-8 -*- """ Created on Fri Jun 7 12:25:03 2019 @author: Administrator """ class Solution: def uniquePathsWithObstacles(self, obstacleGrid: list) -> int: m = len(obstacleGrid) n = len(obstacleGrid[0]) a = [] for _ in range(m): a.append([0]*n) a[m...
StarcoderdataPython
3459301
<filename>testando/graficos.py import matplotlib.pyplot as plt import organizaemlistas listaComdataevalores = organizaemlistas.dados.listaCOVID#todos os dados doseUnica = organizaemlistas.totalu(listaComdataevalores) #lista com data e dados #a funcao totalu chama a organizaçao dos dado sobre doses unicas aplicadas v1...
StarcoderdataPython
8025241
x = int(input()) for i in range(x+1): if(i%2 != 0): print(i)
StarcoderdataPython
5030955
<gh_stars>0 ''' Первое и последнее вхождение ''' inp_str = input() first = -1 second = -1 first = inp_str.find('f') if (first != -1): second = inp_str[::-1].find('f') second = len(inp_str) - second - 1 if (second != len(inp_str) and abs(second - first) > 0): print(first, second, sep=' ') else: ...
StarcoderdataPython
8197871
<reponame>acheshkov/code2vec import time import multiprocessing as mp from argparse import ArgumentParser import re import os import random import subprocess import sys import pandas as pd import pickle import tempfile from typing import List, Tuple, Dict, Optional from enum import Enum, auto from utils import extract_...
StarcoderdataPython
12820197
""" Purpose: [1] To disambiguate the azimuthal component of the SDO/HMI vector magnetic field data (See Section 5 of Hoeksema et al. 2014 [open-access at https://link.springer.com/article/10.1007%2Fs11207-014-0516-8]) [2] To decompose the three components of the vector magnetic field -- field strength, dis...
StarcoderdataPython
6564370
# Copyright (C) 2017 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Provide commonly-used methods here. Don't use ``@when``, ``@given``, etc. here, as it will raise ``behave.step_registry.AmbiguousStep``, since this module is included in multiple steps/*.py modules. """ ...
StarcoderdataPython
3553779
import os import pandas import re import sys import types from collections import defaultdict from hyperloglog import HyperLogLog from crawlplot import CrawlPlot, PLOTDIR from crawlstats import CST, CrawlStatsJSONDecoder, HYPERLOGLOG_ERROR,\ MonthlyCrawl class CrawlSizePlot(CrawlPlot): def __init__(self): ...
StarcoderdataPython
4982292
<reponame>rainbow-studio-solution/wxwork # -*- coding: utf-8 -*- from odoo import _, api, fields, models class WxWorkMessageCancel(models.TransientModel): # 按模型取消重新发送通知 _name = "wxwork.message.cancel" _description = "Dismiss notification for resend by model" model = fields.Char(string="Model", requi...
StarcoderdataPython
280968
from django.contrib import admin # Register your models here. from .NFLmodels import NflSummary, NflStats, DefensiveSummary, DefensiveStats admin.site.register(NflSummary) admin.site.register(NflStats) admin.site.register(DefensiveSummary) admin.site.register(DefensiveStats)
StarcoderdataPython
210084
<filename>uptrends/models/dashboard.py # coding: utf-8 """ Uptrends API v4 This document describes Uptrends API version 4. This Swagger environment also lets you execute API methods directly. Please note that this is not a sandbox environment: these API methods operate directly on your actual Uptrends accoun...
StarcoderdataPython
9627331
import re import logging import math import sys # By default the root logger is set to WARNING and all loggers you define # inherit that value. Here we set the root logger to NOTSET. This logging # level is automatically inherited by all existing and new sub-loggers # that do not set a less verbose level. logging.basi...
StarcoderdataPython
1702496
<reponame>arthurfas123/Curso-De-Python<gh_stars>0 print('Mais sobre matriz!!!') print('=-=' * 15) matriz = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] par = scoluna = maior = 0 for l in range(0, 3): for c in range(0, 3): matriz[l][c] = int(input(f'Posição [{l}, {c}]: ')) for l in range(0, 3): for c in range(0, 3)...
StarcoderdataPython
5086014
<filename>src/interface/ui/uiMain.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'main.ui' # # Created by: PyQt5 UI code generator 5.15.2 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing...
StarcoderdataPython
8020583
from django.urls import path from recipes import views urlpatterns = [ path('', views.index, name='index'), path('recipes/<int:recipe_id>/', views.recipe_view, name='recipe_view'), path( 'recipes/<int:recipe_id>/edit/', views.recipe_edit, name='recipe_edit' ), path( 'recipes/<int:r...
StarcoderdataPython