id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1690587 | <filename>RL/algorithms/random.py<gh_stars>1-10
import wandb
from RL import argparser as p
from RL import register_algo
from RL.agents.console_print_agent import ConsolePrintAgent
from RL.agents.random_play_agent import RandomPlayAgent
from RL.agents.reward_scaling_agent import RewardScalingAgent
from RL.agents.seedin... | StarcoderdataPython |
3243528 | pi=3.14
raio=5
area=pi*raio
print(area)
| StarcoderdataPython |
3346265 | from flask import render_template, Blueprint
spelling_blueprint = Blueprint('spelling',__name__)
@spelling_blueprint.route('/')
@spelling_blueprint.route('/spelling')
def index():
return render_template("index.html")
| StarcoderdataPython |
149141 | from flask import make_response, g
from .....common.corpora_orm import CollectionVisibility
from .....common.entities import Collection
from .....common.utils.exceptions import ConflictException
from .....api_server.db import dbconnect
from .....common.utils.exceptions import ForbiddenHTTPException
from backend.corpo... | StarcoderdataPython |
3242637 | """
The basic processing unit in a :class:`~.pipeline.Pipeline`.
"""
from abc import ABCMeta, abstractmethod
class Stage(metaclass=ABCMeta):
"""
The basic processing unit in a :class:`~.pipeline.Pipeline`.
"""
@abstractmethod
def execute(self, context):
"""
Executes the task t... | StarcoderdataPython |
4819924 | <gh_stars>0
from django.shortcuts import render
from django.shortcuts import redirect
from InvManage.forms import *
from InvManage.models import *
from InvManage.filters import VendorFilter
from django.http import JsonResponse
from InvManage.serializers import VendorSerializer
from InvManage.scripts.filters import *
fr... | StarcoderdataPython |
92650 | from armulator.armv6.opcodes.abstract_opcodes.bkpt import Bkpt
from armulator.armv6.opcodes.opcode import Opcode
from bitstring import BitArray
class BkptA1(Bkpt, Opcode):
def __init__(self, instruction):
Opcode.__init__(self, instruction)
Bkpt.__init__(self)
def is_pc_changing_opcode(self):
... | StarcoderdataPython |
187290 | #!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "... | StarcoderdataPython |
1709353 | # SPDX-License-Identifier: MIT
# Copyright (C) 2021 <NAME>
from rapidfuzz.cpp_string_metric import (
levenshtein,
normalized_levenshtein,
hamming,
normalized_hamming
)
| StarcoderdataPython |
3383072 |
# coding: utf-8
# In[1]:
from sklearn import tree
# In[2]:
import pandas as pd
import numpy as np
# In[3]:
dataset = pd.read_csv("a.csv")
# In[4]:
X = dataset.drop(['TQ'] ,1)
Y = dataset[['TQ']]
# In[5]:
clf = tree.DecisionTreeClassifier()
# In[6]:
clf = clf.fit(X,Y)
# In[125]:
def pred(ar... | StarcoderdataPython |
49891 | <filename>molecule/resources/tests/all/test_common.py
import re
debian_os = ['debian', 'ubuntu']
rhel_os = ['redhat', 'centos']
def test_distribution(host):
assert host.system_info.distribution.lower() in debian_os + rhel_os
def test_repo_pinning_file(host):
if host.system_info.distribution.lower() in debi... | StarcoderdataPython |
3349013 | <reponame>michaeldayreads/f5-cccl<filename>f5_cccl/resource/ltm/test/test_pool_member.py
#!/usr/bin/env python
# Copyright 2017 F5 Networks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License a... | StarcoderdataPython |
95924 | import pytest
from traitlets import Any
from sepal_ui import sepalwidgets as sw
from sepal_ui.model import Model
class TestDatePicker:
def test_init(self):
# default init
datepicker = sw.DatePicker()
assert isinstance(datepicker, sw.DatePicker)
# exhaustive
datepicker =... | StarcoderdataPython |
3348997 | <filename>mmtbx/regression/model/tst_model_biomt_mtrix.py
from __future__ import absolute_import, division, print_function
import iotbx.pdb
import mmtbx.model
import time
"""
Test multiplication of hierarchy and SS annotations in different combinations
of MTRIX and BIOMT records presence.
"""
single_mtrix_txt = """
M... | StarcoderdataPython |
3325415 | from typing import Iterator, List, Tuple, Union
import random
import nltk # type: ignore
from nltk.grammar import ProbabilisticProduction # type: ignore
from nltk.grammar import Nonterminal # type: ignore
Symbol = Union[str, Nonterminal]
class PCFG(nltk.grammar.PCFG):
def generate(self, n: int) -> Iterator[st... | StarcoderdataPython |
1750545 |
someSongs = [("a large song", 60), ("a little song", 10), ("a bigger song", 20), ("a very short song", 2), ("a tiny song", 1)]
def CDSolve(songsToUse, space):
if not songsToUse or space <= 0: # base case; if song list empty or space less than or = to 0 return empty list and space
return [], space
op... | StarcoderdataPython |
1624369 | """Subset to List
.. helpdoc::
This widget performs subsetting into a list structure where each level of the list represents a subsetting of the data table by the selected index.
For example, the data frame;
a b c
'a' 7 8
'a' 8 9
'b' 8 9
'b' 30 ... | StarcoderdataPython |
4811983 | <reponame>Echeverrias/IE
from django import template
from django.forms.models import model_to_dict as m_to_d
register = template.Library()
@register.filter(name='model_to_dict')
def model_to_dict(model_instance):
return m_to_d(model_instance)
@register.filter(name='model_list_to_dict_list')
def model_list_to_dic... | StarcoderdataPython |
137611 | <gh_stars>0
from tkinter import Tk, StringVar, Frame, Label, Button
from main import Qobuz
from threading import Thread
class Window:
button_main = None
def __init__(self):
self.message = "программа готова"
def starting_main(self, string_msg):
self.button_main['state'] = "disabled"
... | StarcoderdataPython |
3347547 | import numpy as np
from pupper.ServoCalibration import MICROS_PER_RAD, NEUTRAL_ANGLE_DEGREES
from pupper.HardwareConfig import PS4_COLOR, PS4_DEACTIVATED_COLOR
from enum import Enum
# TODO: put these somewhere else
class PWMParams:
def __init__(self):
self.pins = np.array([[2, 14, 18, 23], [3, 15, 27, 24],... | StarcoderdataPython |
187160 | from .. import fields, model, namespace
ns_user = namespace('user')
#MODEL
user_model = model('model_user',{
'name': fields.String,
'id': fields.Integer,
'email': fields.String,
'music': fields.Nested(model('user styles', {
'styles':fields.List(fields.String)
}))
})
#RESPONSE
get_response ... | StarcoderdataPython |
3357229 | <reponame>qixinbo/imjoy-rpc
"""Test the hypha server."""
import pytest
from imjoy_rpc import connect_to_server
from . import SIO_SERVER_URL
import numpy as np
# All test coroutines will be treated as marked.
pytestmark = pytest.mark.asyncio
class ImJoyPlugin:
"""Represent a test plugin."""
def __init__(self... | StarcoderdataPython |
31052 | """add class of delete
Revision ID: <PASSWORD>
Revises: <PASSWORD>
Create Date: 2019-03-04 17:50:54.573744
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<PASSWORD>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
# ##... | StarcoderdataPython |
3248312 | # -*- coding: utf-8 -*-
"""
Utilities
=========
The module ``utils`` has a handfull of useful set of tools used in the audio analysis framework.
Visualization
-------------
.. autosummary::
:toctree: generated/
rand_cmap
crop_image
save_figlist
plot1d
plot_wave
plot_s... | StarcoderdataPython |
3300572 | from flask import Flask, render_template, request, jsonify
import requests
app = Flask(__name__)
@app.route('/')
def index():
return render_template("home.html")
@app.route('/provincias')
def provincias():
response=requests.get("http://127.0.0.1:5000/api/provincias")
return render_template('provincias.ht... | StarcoderdataPython |
1751507 | import numpy as np
import matplotlib.pylab as plt
import matplotlib.patches as patches
import os
import warnings
from scipy.interpolate import interp1d
import time
warnings.filterwarnings("ignore", category=FutureWarning)
def get_image_intensity(image):
intensity = 0
for row in image:
for pixel in row:... | StarcoderdataPython |
1713111 | """oilandrope URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-ba... | StarcoderdataPython |
1716338 | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import scriptcontext as sc
import compas_rhino
import IGS_edges_table_cmd
import IGS_edge_information_cmd
import IGS_form_inspector_control_cmd
import IGS_form_constraint_edge_inspect_cmd
import IGS_form_cons... | StarcoderdataPython |
1667297 | def bruteGen(tweet):
tweet = tweet.replace("indiavscorona", "india versus coronavirus")
tweet = tweet.replace("outbreakindia", "outbreak india")
tweet = tweet.replace("real”", "real")
tweet = tweet.replace("mutra", "urine")
tweet = tweet.replace("fakenews", "fake news")
tweet = tweet.replace("“o... | StarcoderdataPython |
1676413 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# https://github.com/pytorch/fairseq. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import torch
from torch import nn
fro... | StarcoderdataPython |
3371621 | <reponame>Infosecurity-LLC/unicon_v2<filename>connector.py
#!/usr/bin/env python3
import logging
import time
from logging.handlers import TimedRotatingFileHandler
import threading
import os
from raven.handlers.logging import SentryHandler
from raven.conf import setup_logging
import pymongo
from pymongo import errors
im... | StarcoderdataPython |
3332675 | <reponame>arturca/RasMAT<gh_stars>0
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from data.default_function_and_settings import *
import numpy as np
class Clock:
def __init__(self, previosus_time, previous_line, strip):
self.previous_time = previosus_time
self.previous_line = previous... | StarcoderdataPython |
3298842 | <reponame>Xamaneone/SoftUni-Intro<filename>Python-Advanced/lists_as_stacks_and_queues_exercise/crossroads.py
from _collections import deque
green_light = int(input())
free_window = int(input())
cars = deque()
crash = False
passed = 0
x = str(input())
while x != "END":
current_car = 0
current_car_name = ""
... | StarcoderdataPython |
3375070 | <reponame>mauriziokovacic/ACME<gh_stars>1-10
from .isscalar import *
from .size import *
from .prod import *
def numel(A):
"""
Returns the number of elements contained in the given Tensor
Parameters
----------
A : Tensor
a tensor/matrix
Returns
-------
int
the ... | StarcoderdataPython |
153993 | # -*- coding: utf-8 -*-
"""
Sphinx configuration file for clik-wtforms.
:author: <NAME> <<EMAIL>>
:copyright: Copyright (c) <NAME> and contributors, 2017-2019.
:license: BSD
"""
import os
import sys
root_path = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
src_path = os.path.join(root_path, 'src')
sys.... | StarcoderdataPython |
15443 | from typing import List
import matplotlib.pyplot as plt
class Mortgage:
"""
A mortgage overview of the total burden (incl. interest) and the monthly fees per fixed period
"""
def __init__(self, mortgage_amount, burden, periods, monthly_fees, name):
self.mortgage_amount = int(mortgage_amount)... | StarcoderdataPython |
129842 | <filename>TEE_faster_RCNN.py
from torchvision.ops.feature_pyramid_network import FeaturePyramidNetwork, LastLevelMaxPool
from typing import Dict
from torch import nn
import warnings
from torchvision.ops import misc as misc_nn_ops
from torchvision.models import resnet
from collections import OrderedDict
from torchvision... | StarcoderdataPython |
1662161 |
from kivy.lang.builder import Builder
from .ImageButton import ImageButton
Builder.load_string('''
<MultiImageButton>:
images_normal: '', ''
images_down: '', ''
image_set: 0
image_normal: self.images_normal[self.image_set]
image_down: self.images_down[self.image_set]
''')
class MultiImageButton... | StarcoderdataPython |
3395585 | from adventofcode.utils import open_input
def main():
data = open_input('adventofcode/_2021/day2/input.txt')
answer_1 = calculate_position(data)
answer_2 = calculate_position_with_aim(data)
print(answer_1, answer_2)
return answer_1, answer_2
def calculate_position(data: list[str]) -> int:
... | StarcoderdataPython |
3360992 | def TestOr2():
print 11
assert 0 == (0 or 0)
assert 1 == (0 or 1)
assert 1 == (1 or 0)
assert 1 == (1 or 1)
def TestOrNot2():
print 12
assert 1 == (not 0 or not 0)
assert 1 == (not 0 or not 1)
assert 1 == (not 1 or not 0)
assert 0 == (not 1 or not 1)
def TestOr3():
print 22... | StarcoderdataPython |
1768074 | <filename>raritan/rpc/usermgmt/__init__.py<gh_stars>0
# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.
#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libisys/src/idl/Role.idl"
#
... | StarcoderdataPython |
71448 | #!/usr/bin/env python
"""
emr_simulator.py
Part of Dooplicity framework
Runs JSON-encoded Hadoop Streaming job flow. FUNCTIONALITY IS IDIOSYNCRATIC;
it is currently confined to those features used by Rail. Format of input JSON
mirrors that of StepConfig list from JSON sent to EMR via RunJobsFlow. Any
files input to a ... | StarcoderdataPython |
1781413 | <gh_stars>0
import cv2
import numpy as np
filterCond = lambda cond: np.transpose(np.nonzero(cond > 0))
# Load the original groundtruth
groundtruth = cv2.imread('data/2018_IEEE_GRSS_DFC_GT_TR.tif', cv2.IMREAD_GRAYSCALE)
y = cv2.resize(groundtruth, (2384, 601), fx=0.5, fy=0.5, interpolation = cv2.INTER_NEAREST)
# Sav... | StarcoderdataPython |
1722639 | import pandas as pd
import pytest
from transformers import (
AutoConfig,
AutoModelForCausalLM,
AutoTokenizer,
)
from transformers.pipelines import pipeline
from ray.ml.preprocessor import Preprocessor
from ray.ml.predictors.integrations.huggingface import HuggingFacePredictor
prompts = pd.DataFrame(
... | StarcoderdataPython |
1747776 | #!/usr/bin/env python3
import unittest
import os
from rkd.api.testing import BasicTestingCase
from rkd.test import TestTask
from rkd.contract import ArgumentEnv
CURRENT_SCRIPT_PATH = os.path.dirname(os.path.realpath(__file__))
class TestTaskInterface(BasicTestingCase):
def test_table(self):
"""Simply t... | StarcoderdataPython |
126140 | <filename>fr/c.py
# coding: utf-8
import sys
sys.path.append(".")
from workshop.fr.c import *
DIVULGUER_MOT_SECRET = VRAI
"""
- 'motAuHasard': un mot aléatoire ;
- 'suggestion'; le contenu du champ texte du mot secret ;
utilisé seulement en mode 'dev'.
Retourne 'suggestion' si non vide, 'motAuHasar... | StarcoderdataPython |
4832857 | <gh_stars>10-100
from enum import Enum
class CoreMode(Enum):
up = 'up' # respond to everyone (within checks)
maintenance = 'maintenance' # respond to owners
down = 'down' # respond to no one
boot = 'boot' # respond to no one until the next boot
| StarcoderdataPython |
1755948 | #!/usr/env/python
# -*- coding: utf-8 -*-
'''
Script that processes a dataset of rated articles and checks each article's
talk page in order to verify how many templates with importance ratings are
on their talk pages.
Copyright (c) 2017 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a c... | StarcoderdataPython |
16485 | import numpy as np
import unittest
import coremltools.models.datatypes as datatypes
from coremltools.models import neural_network as neural_network
from coremltools.models import MLModel
from coremltools.models.neural_network.printer import print_network_spec
from coremltools.converters.nnssa.coreml.graph_pass.mlmodel_... | StarcoderdataPython |
1709601 | <gh_stars>10-100
#!/usr/bin/env python
import gym
import logging
import os
import sys
import gflags as flags
from baselines import bench
from baselines import logger
from baselines.logger import Logger, TensorBoardOutputFormat, HumanOutputFormat
from baselines.common import set_global_seeds
from baselines.common.vec_... | StarcoderdataPython |
132275 | <gh_stars>0
class Body(object):
def __init__(self, mass, position, velocity, name = None):
if (name != None):
self.name = name
self.mass = mass
self.position = position
self.velocity = velocity
| StarcoderdataPython |
1687791 | <gh_stars>0
from django.apps import AppConfig
class MoviepanelConfig(AppConfig):
name = 'towatch.apps.moviepanel'
verbose_name = 'moviepanel'
| StarcoderdataPython |
4838009 | """
Module supporting BirdVoxDetect NFC detectors.
When this module is imported, it dynamically creates a detector class
(a subclass of the `_Detector` class of this module) for each BirdVoxDetect
detector in the archive database and adds it to the detector extensions of
this Vesper server.
BirdVoxDetect (https://git... | StarcoderdataPython |
1659537 | import numpy as np
def atari_make_initial_state(state):
return np.stack([state] * 4, axis=2)
def atari_make_next_state(state, next_state):
return np.append(state[:,:,1:], np.expand_dims(next_state, 2), axis=2) | StarcoderdataPython |
1741535 | #!/usr/bin/env python 3
# -*- coding: utf-8 -*-
from functools import lru_cache
@lru_cache
def fib(n):
if n == 0 or n == 1:
return n
else:
return fib(n - 2) + fib(n - 1)
if __name__ == '__main__':
import timeit
print(timeit.timeit('fib(10)', setup="from __main__ import fib"))
| StarcoderdataPython |
1669040 | name = str(input('What is your name? ')).strip().split()
print(f'Nice to meet you! \n'
f'Your first name is {name[0]} \n'
f'Your last name is {name[len(name) - 1]}')
| StarcoderdataPython |
59617 | <reponame>ojarva/home-info-display
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('info_weather', '0006_auto_20150322_2310'),
]
operations = [
migrations.CreateModel(
... | StarcoderdataPython |
1739877 | # -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar... | StarcoderdataPython |
1681107 | #!/bin/env python3
import argparse
import esprima
import json
import logging
import os
import re
import sys
import traceback
logger = logging.getLogger(__name__)
err_context = 3
def get_req_body_elems(obj, elems):
if obj.type in ['FunctionExpression', 'ArrowFunctionExpression']:
get_req_body_elems(obj.... | StarcoderdataPython |
1721306 | # $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are
#met:
#
... | StarcoderdataPython |
3296476 | <reponame>eslickj/idaes-pse
#################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c... | StarcoderdataPython |
71658 | # -*- coding: utf-8 -*-
"""
Created on Sat May 1 18:26:28 2021
@author: abhay
version: 0.0.1
"""
import os,argparse
stack = []
'''
Stack is Used as a directory(folder/path) pointer due to its property of LIFO
It's last element is current directory Current Directory
'''
ipath = ''
'''
This is ... | StarcoderdataPython |
1673972 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation.
# 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.apac... | StarcoderdataPython |
165487 | from sys import path
import os
import subprocess
from shutil import copyfile
from shutil import copytree
from shutil import rmtree
from shutil import move
from os import scandir
from os import remove
from os import path
ROOT_PYTHON_PATH=os.path.dirname(os.path.abspath(__file__))
def splitLicencesYmlInAtomicElements()... | StarcoderdataPython |
38196 | import requests
"""
Delete a project version.
If there are no more versions available for a given project, that project will be deleted too.
"""
def delete_version(server, project, version):
url = "http://{}/delversion.json".format(server)
data = {
"project": project,
"version": version
}
with requests.Sess... | StarcoderdataPython |
3383091 | # Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... | StarcoderdataPython |
3217941 | <reponame>matthewpipie/vectra_api_tools
import json
import requests
import warnings
import html
import re
warnings.filterwarnings('always', '.*', PendingDeprecationWarning)
class HTTPException(Exception):
def __init__(self, response):
"""
Custom exception class to report possible API errors
... | StarcoderdataPython |
3362652 | import requests
REQUESTS_METHODS = {
'get': requests.get,
'post': requests.post,
'patch': requests.patch,
'put': requests.put,
'delete': requests.delete,
}
def make_request(method, *args, **kwargs):
return REQUESTS_METHODS[method]('https://www.google.com', *args, **kwargs)
| StarcoderdataPython |
104808 | <reponame>MetaBytez/bitbitbot<gh_stars>0
from enum import IntEnum
from typing import Optional
from pydantic import BaseModel
class Role(IntEnum):
BROADCASTER = 0
MODERATOR = 1
SUBSCRIBER = 2
VIEWER = 3
class TwitchTags(BaseModel):
display_name: str
color: Optional[str]
user_id: str
... | StarcoderdataPython |
3267452 | my_name = '<NAME>'
my_age = 35 # not a lie
my_height = 185 # cm
my_weight = 70 # kg
my_eyes = 'Green'
my_teeth = 'White'
my_hair = 'Brown'
my_height = my_height / 2
print(f"let's talk about {my_name}.")
print(f"he's {my_height} centimeters tall.")
print(f"He's {my_weight} kg heavy")
print("Actually that's not too hea... | StarcoderdataPython |
3295348 | import os
from cctbx import xray
from cctbx.sgtbx import space_group
from cctbx.sgtbx import space_group_symbols
from cctbx.uctbx import unit_cell
from cctbx.crystal import symmetry
import sys
if sys.version_info < (3, 0):
version = 2
def ersatz_pointgroup(spacegroup_name):
'''Guess the pointgroup for the s... | StarcoderdataPython |
3224073 | from prml.nn.array.array import Array
from prml.nn.config import config
import numpy as np
def ones(size):
return Array(np.ones(size, dtype=config.dtype))
| StarcoderdataPython |
3230887 | <reponame>scholarsmate/durasftp
import argparse
from durasftp.common.log import set_log_file_path
class LogFileAction(argparse.Action):
"""
This argparse action allows for a command line argument to specify a log file to write to:
Example:
python <script> --log-file <log-file-path>
"""
def ... | StarcoderdataPython |
3356569 | <reponame>LimePencil/baekjoonProblems
import sys
n = int(sys.stdin.readline().rstrip("\n"))
arr = list(map(int,sys.stdin.readline().rstrip("\n").split(" ")))
arr.sort()
minimum = float('inf')
a1 = 0
a2 = 0
a3 = 0
for i in range(n-2):
s = i+1
e = n-1
target = -1*arr[i]
while s<e:
se = arr[s]+arr... | StarcoderdataPython |
117900 | <gh_stars>1-10
'''
Created on May 1, 2016
@author: Drew
'''
PlayBtnPos = (0, 0, 0.0)
PlayBtnHidePos = (0, 0, -1.1)
OptionsBtnPos = (-.9, 0, -0.6)
OptionsBtnHidePos = (-.9, 0, -1.7)
DiscordBtnPos = (-.3, 0, -0.6)
DiscordBtnHidePos = (-.3, 0, -1.7)
CreditsBtnPos = (.3, 0, -0.6)
CreditsBtnHidePos = (.3, 0, -1.7)
Qui... | StarcoderdataPython |
1722246 | <gh_stars>0
from doab.tests.test_types import IntersectAcceptanceTest, TestManager, ReferenceParsingTest
from doab.parsing.reference_miners import (
BloomsburyAcademicMiner,
CambridgeCoreParser,
CitationTXTReferenceMiner,
SpringerMiner,
)
@TestManager.register
class PalgraveCUPIntersect(IntersectAccept... | StarcoderdataPython |
1613291 | #!/usr/bin/env python
# -*- coding: utf8 -*-
"""
Adds N number of rows of dummy data to the manifest table specified
"""
from __future__ import unicode_literals, print_function
import random
import boto3
import logging
import sys
import json
import time
from datetime import datetime
logger = logging.getLogger()
logg... | StarcoderdataPython |
100791 | <reponame>7wikd/R_Pi-Surveillance<filename>new.py
array = ['Welcome','to','Turing']
for i in array:
array.append(i.upper()) | StarcoderdataPython |
1669026 | <filename>saleor/rest/serializers/product/attribute_value.py
from django.apps import apps
from rest_flex_fields import FlexFieldsModelSerializer
__all__ = [
'AttributeValueSerializer',
]
AttributeValue = apps.get_model(*'product.AttributeValue'.split())
class AttributeValueSerializer(FlexFieldsModelSerializer)... | StarcoderdataPython |
1667550 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
"""Modelo de datos del programa.
Con esto se pretende abstraer toda la logica del programa para que sea mucho,
mas fácil encontrar en donde se encuentra cada parte del programa.
"""
# para crear clases con padres e hijos
from abc import ABC, abstractmethod
# para la reproducci... | StarcoderdataPython |
1785361 | import abc
import random
import six
from optinum.algorithm import base
from optinum.common import objects
__all__ = ['HCFirstImprovement', 'HCBestImprovement']
@six.add_metaclass(abc.ABCMeta)
class HillClimbing(base.Algorithm):
def __init__(self, name="HillClimbing", max_evaluations=50):
super(HillCli... | StarcoderdataPython |
3286596 | def on(self, event, handler):
self._events = self._events
handlers = self._events[event] = self._events[event] if event in self._events else []
handlers.append(handler)
def off(self, event, handler):
handlers = self._events[event] = self._events[event] if event in self._events else []
handlers.rem... | StarcoderdataPython |
1600665 | <reponame>sonucr7/PythonOOP
class DataScientist:
def __init__(self, name, age, level, salary):
self.name = name
self.age = age
self.level = level
self.salary = salary
#instance method
def code(self):
print(f"{self.name} is writing code.........")
role1 = Da... | StarcoderdataPython |
158973 | import sys
import argparse
from yolo import YOLO, detect_video
from PIL import Image
import glob
import os
from shutil import copyfile
src_dir="F:/比赛事宜/裂纹识别/复赛数据/challengedataset-semifinal/test/test"
dst_dir="F:/比赛事宜/裂纹识别/复赛数据/challengedataset-semifinal/test/seg"
k=0
file_1=open('result_11_24.txt')
file_2=open('resul... | StarcoderdataPython |
4823595 | <gh_stars>0
# namespace, pipe can use to share data between process
import multiprocessing
manager = multiprocessing.Manager()
namespace = manager.Namespace()
namespace.spam = 123
namespace.eggs = 456
| StarcoderdataPython |
1696308 | from huobi.constant.result import OutputKey
from huobi.impl.utils import *
from huobi.impl.utils.channelparser import ChannelParser
from huobi.impl.utils.timeservice import convert_cst_in_millisecond_to_utc
from huobi.model.constant import *
from huobi.model.candlestick import Candlestick
class CandlestickEvent:
... | StarcoderdataPython |
1736327 | if __name__ == "__main__":
# What I want to dispatch
from plunk.tw.py2py_front_example.simple_pycode import foo, bar, confuser
funcs = [foo, bar, confuser]
# My dispatching
from py2http import run_app
run_app(funcs, publish_openapi=True)
| StarcoderdataPython |
3268187 | import arcpy
# get passed in arguments
mapDoc = arcpy.GetParameterAsText(0)
wrkspc = arcpy.GetParameterAsText(1)
datasetName = arcpy.GetParameterAsText(2)
#wrkspc = r"C:\Data\OSM\Mxds\NewOSMDEV.sde\sde.SDE.TempTest08"
# set mxd
mxd = arcpy.mapping.MapDocument(mapDoc)
# change data source locations
for lyr in arcpy.m... | StarcoderdataPython |
3321995 | <filename>encryption_code.py
# 读入图片
def read_img():
import cv2
path = input("原图路径: ")
img = cv2.imread(path)
return img, img.shape
# 映射
def word_to_num(shape):
import json
words = list(input("需要加密的话(支持中、英及混合): "))
assert (shape[0] * shape[1]) / 2 > len(words), 'picture is too small'
wi... | StarcoderdataPython |
4834750 | #!/usr/bin/env python3
from setuptools import setup, find_packages
import gtabview_cli
# long description with latest release notes
readme = open('README.rst').read()
news = open('NEWS.rst').read()
long_description = (readme + "\n\nLatest release notes\n====================\n"
+ '\n'.join(news.spli... | StarcoderdataPython |
184704 | '''
Authors: <NAME> <<EMAIL>>, <NAME> <<EMAIL>>
If this code is useful to you, please cite the following paper:
<NAME>, <NAME>, and <NAME>. Learning topology from synthetic data for unsupervised depth completion.
In the Robotics and Automation Letters (RA-L) 2021 and Proceedings of International Conference on Robotics... | StarcoderdataPython |
3243609 | <gh_stars>0
from django.conf.urls import url
from . import views
app_name = 'analyze'
urlpatterns = [
url(r'^works/$', views.WorkAnalyze.as_view(), name='works_analyze'),
url(r'^data/$', views.get_datatables_data, name='get_data'),
url(r'^data-orig/$', views.get_datatables_data_orig, name='get_data_orig')... | StarcoderdataPython |
1672930 | # pylint: disable=no-member
from typing import Iterable, Union
import asyncpg
from fastapi import BackgroundTasks, Depends, HTTPException
from . import models, pagination, schemes, tasks, utils
from .db import db
async def user_count():
return await db.func.count(models.User.id).gino.scalar()
async def create... | StarcoderdataPython |
3388425 | import sys
from lark import Lark, Transformer, v_args
WHITE = 1
BLACK = -1
TOGGLE = -1
# FLIP_DIRECTIONS = dict(nw="se", ne="sw", e="w",
# se="nw", sw="ne", w="e")
def debug(m):
print(m)
grammar = """
start: direction+ -> finish
?direction: "nw"
| "ne"
| "sw"
... | StarcoderdataPython |
4843249 | <reponame>ChihHsuanLin/bevel
import pandas as pd
def pivot_proportions(df, groups, responses, weights=1):
"""
Pivot data to show the breakdown of responses for each group.
Parameters:
df: a pandas DataFrame with data to be aggregated
groups: the name of the column containing the groups to par... | StarcoderdataPython |
164162 | import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
import xml.etree.ElementTree as ET
from os.path import isfile, join
from os import getcwd
from scipy.spatial import distance
##############################
# MACROS
############################... | StarcoderdataPython |
1747443 |
"""
FNAME
Machine-generated model code
"""
class SFCModel(object):
"""
Model
Implements the following system of equations.
Endogenous variables and parameters
===================================
x = y + 2,
y = .5 * x,
where lagged variables are:
LAG_x(t) = x(t-1)
... | StarcoderdataPython |
1607434 | <filename>blackjack_rl/script/basic_strategy.py
from blackjack_rl.envs.eleven_ace import BlackjackEnv
import os, pickle
import datetime
# environment seed
seed = 3
# make_sample episode count
N_epoch = 10
# LSPI train count
N_episode = 10000
# Evaluation count per leaning
N_eval = 10000
# data dir
_base =... | StarcoderdataPython |
3327670 | from rest_framework.response import Response
from rest_framework import viewsets
class HelloworldView(viewsets.ViewSet):
def list(self, request, *args, **kwargs):
return Response("helloworld")
| StarcoderdataPython |
1663006 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2022 <NAME>.
#
# Invenio-App-RDM is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""Record migration script from InvenioRDM 7.0 to 8.0.
Disclaimer: This script is intended to be executed *only... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.