id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
4906044 | <reponame>sMedX/facenet
"""Train facenet classifier.
"""
# MIT License
#
# Copyright (c) 2020 SMedX
import click
from tqdm import tqdm
from pathlib import Path
import tensorflow as tf
import numpy as np
from facenet import config, facenet, faceclass, ioutils
class ConfusionMatrix:
def __init__(self, embeddings... | StarcoderdataPython |
3352415 | <reponame>T-Cube-AI/Time-dependent-SEIRD-Model-API
#!/usr/bin/python3
import json
import re
from computeInsightsFunction import computeInsights
PREDICTIONS_DIR = './Predictions/US'
DATASETS_DIR = './Datasets/US'
INSIGHTS_DIR = './Insights/US'
usStatesPopulationFile = "./US-population.json"
usStatesPopulation = json.... | StarcoderdataPython |
11255196 | <reponame>harry-consulting/SAEF1<gh_stars>0
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import path
from . import views
app_name = "saef"
urlpatterns = [
path('ajax/update_notifications/', views.update_notifications, name='update_notifications')
]
urlpatterns += staticfil... | StarcoderdataPython |
5187276 | from antarest.core.jwt import JWTUser, JWTGroup
from antarest.core.roles import RoleType
from antarest.login.model import Group, User
def test_is_site_admin():
jwt = JWTUser(
id=0,
impersonator=0,
type="users",
groups=[JWTGroup(id="admin", name="admin", role=RoleType.ADMIN)],
)... | StarcoderdataPython |
8141012 | # -*- coding:utf-8 -*-
"""File I/O related operations, such as list files, import/export or remove files/folder."""
__author__ = "<NAME>"
import os
import shutil
import json
import pickle
import zipfile
import urllib
import wget
DependencyFlag = False #Check if dependencies are satisfied. If not, some... | StarcoderdataPython |
88838 | <reponame>alsbi/docker_rest_service
# -*- coding: utf-8 -*-
__author__ = 'alsbi'
import json
class ApiError(Exception):
def __str__(self):
return json.dumps({'error': self.error, 'message': self.message}, indent = 4)
class ExecutionError(ApiError):
def __init__(self, error=None, message=None):
... | StarcoderdataPython |
171242 | N = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
print(sum(a[1::2][:N]))
| StarcoderdataPython |
3566503 | #librarys for video
import os
import shutil
import time
import sys
if not os.path.exists(str(sys.argv[1])):
os.makedirs(str(sys.argv[1]))
#start recording
src = "../live"
dest = "./"+str(sys.argv[1])
src_files = os.listdir(src)
for file_name in src_files:
full_file_name = os.path.join(src, file_name)
if o... | StarcoderdataPython |
9724148 | <reponame>AlexanderHurst/AlgoFinalProject<gh_stars>1-10
from collections import deque
# returns the longest substring in n*n time
# algorithm idea credit to <NAME>
# from stack overflow modified to include substring locations
# this was rendered obsolete for determining key length by
# coincidence index and is no long... | StarcoderdataPython |
4964844 | import rhinoscriptsyntax as rs
import math
import System
# created on 9th Jan 2015
# this class defines a single floorPanel or Tile as an Object with neccessary functions to control it
class floorPanel:
h1 = 0
h2 = 0
h3 = 0
p1 = None
p2 = None
slv = None
panelID = None
def __init__(self,panel1, panel2, sle... | StarcoderdataPython |
1741743 | import pymongo
from pymongo import MongoClient
from config import DATABASE_CONNECTION_STRING
cluster = MongoClient(DATABASE_CONNECTION_STRING)
db = cluster['telegram_db']
collection = db['telegram_db']
def test():
print(cluster.list_database_names())
if __name__ == '__main__':
test() | StarcoderdataPython |
8085990 | # this file is needed for at least setup.py
__author__ = "<NAME>" | StarcoderdataPython |
1970999 | import torch
from lanenet.model import HNetLoss
def test_hnet():
gt_labels = torch.tensor([[[1.0, 1.0, 1.0], [2.0, 2.0, 1.0], [3.0, 3.0, 1.0]],
[[1.0, 1.0, 1.0], [2.0, 2.0, 1.0], [3.0, 3.0, 1.0]]],
dtype=torch.float32).view(6,3)
transformation_coffec... | StarcoderdataPython |
11299451 | from datetime import datetime, timedelta
from django.db import models
from domain.models.base_model import BaseModel
def get_default_expiration_date():
return datetime.now() + timedelta(days=365)
class UrlBank(BaseModel):
actual_url = models.CharField(max_length=3000)
expiration_date = models.DateTimeF... | StarcoderdataPython |
3299250 | class Event:
def __init__(self, msg, task, time):
self.msg = msg
self.task = task
self.time = time
def get_message(self):
return self.msg
def get_task(self):
return self.task
def get_time(self):
return self.time
def update_time(self, _time):
... | StarcoderdataPython |
1970321 | <filename>playground/addressbook.py
"""
Class to represent an address book with multiple contacts.
"""
class AddressBook:
"""This will provide you with contact information about your friends."""
def __init__(self,contacts=[]):
self.contact_list = contacts
#...
def addentry(self,name,phone_nu... | StarcoderdataPython |
1887327 | from django.apps import AppConfig
class CollaborationConfig(AppConfig):
name = "api.collaboration"
| StarcoderdataPython |
9791760 | <reponame>Jin-Tao-208/web_science_coursework<gh_stars>0
from collections import OrderedDict
import json
from math import exp
import os
from BurstySegmentExtractor import BurstySegmentExtractor
from Segment import Segment
from TimeWindow import SubWindow
from TweetSegmenter import SEDTWikSegmenter
from utils.pyTweetClea... | StarcoderdataPython |
1629596 | import os
from selene import config
from selene.browser import set_driver, driver
from tests.acceptance.helpers.helper import get_test_driver
from tests.examples.order.app_model.order_widgets import Order
def setup_function(m):
config.timeout = 4
set_driver(get_test_driver())
config.app_host = 'file://' ... | StarcoderdataPython |
1693920 | """ CSeq C Sequentialization Framework
scope-based variable renaming module
written by <NAME>, University of Southampton.
"""
VERSION = 'varnames-0.0-2015.07.08'
#VERSION = 'varnames-0.0-2014.12.24' # CSeq-1.0beta
#VERSION = 'varnames-0.0-2014.10.26' # CSeq-Lazy-0.6: newseq-0.6a, newseq-0.6c, SVCOMP15
#VERS... | StarcoderdataPython |
4961953 | <reponame>sisoe24/Nuke-Python-Stubs
from numbers import Number
from typing import *
import nuke
from . import *
class String_Knob(Knob):
"""
A knob which holds a string value. Appears as a text entry field in a Node panel.
"""
def __hash__(self, ):
"""
Return hash(self).
"""
... | StarcoderdataPython |
11278377 | <reponame>GitHK/CarND-Advanced-Lane-Lines
import logging
from collections import deque
import cv2
import numpy as np
logger = logging.getLogger(__name__)
Y_ARRAY_INDEX_OF_BOTTOM_ELEMENT = 0
class LaneInfo:
def __init__(self):
self.left_fit = None
self.right_fit = None
self.left_fitx = ... | StarcoderdataPython |
1690175 | import sublime
import json
import codecs
import os
is_sublime_text_3 = int(sublime.version()) >= 3000
if is_sublime_text_3:
from .settings import Settings
else:
from settings import Settings
class ProcessCache():
_procs = []
last_task_name = None
@classmethod
def get_from_storage(cls):
... | StarcoderdataPython |
11399533 | #!/usr/bin/python
# Copyright (c) 2020, 2021 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.TXT for d... | StarcoderdataPython |
8124340 | """
Runs AuTuMN apps
You can access this script from your CLI by running:
python -m autumn db --help
"""
import click
@click.group()
def db():
"""Database utilities"""
@db.command("fetch")
def download_input_data():
"""
Fetch input data from external sources for input database.
"""
from a... | StarcoderdataPython |
3500499 | from typing import Any, List, Tuple, Union
from pathlib import Path
import os
import unittest
from pandas import DataFrame
from schematics.types import ListType, IntType, StringType
import numpy as np
import skimage.io
from hidebound.core.specification_base import SpecificationBase
import hidebound.core.traits as tr... | StarcoderdataPython |
9730653 | <filename>K_Mathematical_Modeling/Section 2/solutionODEsExercise10.py
from IPython.display import display, Latex, Math
print("Yes it is a linear system. In matrix form it can be written:")
display(Latex('$ dY/dt = A*Y+Y_0$'))
print("Where Y is the vector formed by the two unknown, time-dependent concentrations A... | StarcoderdataPython |
9739856 | # -*- coding: utf-8 -*-
# putcall
# -------
# Collection of classical option pricing formulas.
#
# Author: sonntagsgesicht, based on a fork of Deutsche Postbank [pbrisk]
# Version: 0.2, copyright Wednesday, 18 September 2019
# Website: https://github.com/sonntagsgesicht/putcall
# License: Apache License 2.0 (see... | StarcoderdataPython |
8192631 | from aioconsole.stream import aprint
import discord
from discord import AutoShardedClient
from discord.ext import commands
from .channel import CLIChannel
from aioconsole import ainput
from .utils import fancy_print, Response
import sys, asyncio, time
class CLI(commands.Bot):
def __init__(self, command_prefix, des... | StarcoderdataPython |
3567906 | #!/usr/bin/python3
# This 'recreates' the prior version from the Wikipedia pages incase file lost
import csv
import os
import re
import sys
import traceback
from mwclient import Site
#
# Configuration
#
if 'WIKI_WORKING_DIR' not in os.environ:
sys.stderr.write('ERROR: WIKI_WORKING_DIR environment variable not ... | StarcoderdataPython |
1661230 | <reponame>reinforcementdriving/cvat
import json
import base64
from PIL import Image
import io
from model_loader import ModelLoader
import numpy as np
import yaml
def init_context(context):
context.logger.info("Init context... 0%")
functionconfig = yaml.safe_load(open("/opt/nuclio/function.yaml"))
labels... | StarcoderdataPython |
1761812 | <gh_stars>0
from django.contrib import admin
from app.models import TopSecret
# Register your models here.
admin.site.register(TopSecret)
| StarcoderdataPython |
132679 | # -*- coding: utf-8 -*-
from __future__ import print_function
import pytest
import random
import numpy as np
import pandas as pd
from pandas.compat import lrange
from pandas.api.types import CategoricalDtype
from pandas import (DataFrame, Series, MultiIndex, Timestamp,
date_range, NaT, IntervalIn... | StarcoderdataPython |
155193 | <reponame>a-harrison/repinger
#!/usr/bin/env python
import sys
import logging
import getpass
from optparse import OptionParser
import json
import os
import ConfigParser
# Dependencies
import sleekxmpp
from slack_message_client import SlackMessageClient
if sys.version_info < (3, 0):
reload(sys)
sys.setdefau... | StarcoderdataPython |
1654822 | <gh_stars>0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Author: <NAME>
# @Date: Monday, February 18th 2019, 1:46:37 pm
import logging
import struct
import sys
import serial
import iblrig.params as params
log = logging.getLogger('iblrig')
def main(comport: str, command: int):
if not comport:... | StarcoderdataPython |
6622374 | import random
import sys
from os import path
import tensorflow as tf
import numpy as np
import pandas as pd
from Bio.Seq import Seq
import threading
import pybedtools
import os
import glob
from maxatac.architectures.dcnn import get_dilated_cnn
from maxatac.utilities.constants import BP_RESOLUTION, BATCH_SIZE, CHR_POO... | StarcoderdataPython |
4983917 | <filename>src/auth.py
"""
Copyright (c) 2020 Cisco and/or its affiliates.
This software is licensed to you under the terms of the Cisco Sample
Code License, Version 1.1 (the "License"). You may obtain a copy of the
License at
https://developer.cisco.com/docs/licenses
All use of the material herein mus... | StarcoderdataPython |
6691793 | # Download data from tidepool
# See http://support.tidepool.org/article/37-export-your-account-data
import requests
from requests.auth import HTTPBasicAuth
import json, flatten_json, sys, csv
TIDEPOOL_LOGIN_URL="https://api.tidepool.org/auth/login"
TIDEPOOL_API_URL="https://api.tidepool.org/data/{userid}"
TIDEPOOL_TO... | StarcoderdataPython |
1767377 | """Post-process the HTML produced by Sphinx.
Some modifications can be done more easily on the finished HTML.
This module defines a simple pipeline:
1. Read all HTML files
2. Parse them with `BeautifulSoup`
3. Perform a chain of actions on the tree in place
See the `_modify_html()` function for the list of
transfor... | StarcoderdataPython |
6462839 | <gh_stars>0
import foreverbull.data.stock_data # noqa: F401
from foreverbull.data.data import Database
__all__ = [Database]
| StarcoderdataPython |
6629057 | <reponame>jczaja/Paddle
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
#
# 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
#
#... | StarcoderdataPython |
1653228 | <reponame>YZNIU/Cirq
# Copyright 2018 The Cirq Developers
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | StarcoderdataPython |
1949287 | <reponame>csaid/bokeh
from os.path import abspath
import webbrowser
from . import settings
def get_browser_controller(browser=None):
browser = settings.browser(browser)
if browser is not None:
if browser == 'none':
class DummyWebBrowser(object):
def open(self, url, new=0,... | StarcoderdataPython |
6559142 | import asyncio
class It:
def __iter__(self):
print("It.__iter__")
yield self # !!! this __iter__ itself is a generator
return None
def f():
it = It()
print("before yield from iterator obj")
yield from it
fut = asyncio.Future()
print("before")
res = yield from fu... | StarcoderdataPython |
6566190 | from math import gcd
def gcdi(a, b):
return gcd(a, b)
def lcmu(a, b):
return abs(a*b//gcd(a, b))
def som(a, b):
return a+b
def maxi(a, b):
return max(a, b)
def mini(a, b):
return min(a, b)
def oper_array(fct, arr, init):
res=[fct(arr[0], init)]
for i in range(1, len(arr)):
res.appen... | StarcoderdataPython |
3466520 | <reponame>EladGabay/pulumi-oci
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence,... | StarcoderdataPython |
4968823 | <gh_stars>10-100
from typing import Tuple, List
from nltk import wordpunct_tokenize
def tokenize_and_clean_text(text: str) -> str:
return ' '.join([token.lower() for token in wordpunct_tokenize(text)
if token.isalpha() and token.lower()])
def clean_formatting(text: List[str]) -> str:
r... | StarcoderdataPython |
4852091 | #from flask import Flask, request
from flask.ext.restful import Api
from penguicontrax import app
#api modules
import submissions
import tags
import tracks
import users
import presenters
#import json for date encoder
import json
#override for json encoder to handle datetime objects
class DateEncoder(json.JSONEncode... | StarcoderdataPython |
8172794 | # -*- coding: utf-8 -*-
"""
flaskext.session
~~~~~~~~~~~~~~~~
Adds server session support to your application.
:copyright: (c) 2014 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
__version__ = '0.3.0'
import os
from .sessions import NullSessionInterface, RedisSessionInterface, \
... | StarcoderdataPython |
4880876 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import sys
import types
from contextlib import contextmanager
import six
try:
import numpy
except ImportError:
numpy = None
ignore_vars = [
"__ipy_scope__", # Added by nbtutor to the calling frame globals
... | StarcoderdataPython |
11358684 | <gh_stars>0
import json
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt
def process_text(request):
print("Received request")
text = json.loads(request.body)["text"]
return JsonResponse({"response": "You said: %s" % text}) | StarcoderdataPython |
8152498 | # Author: <NAME>
# E-mail: <EMAIL>
# Author: <NAME>
# E-mail: <EMAIL>
# Author: <NAME>
# E-mail: <EMAIL>
# imports
try:
from .packages.preprocessing import pad_batches, process_raw_data
from .packages.preprocessing import load_embedding, TSVDataset
from .packages.preprocessing import RNNDataset, collate... | StarcoderdataPython |
3370847 | <filename>problemas-resolvidos/neps-academy/programacao-basica-competicoes-c++/python/Exercicio-28-Titulo.py<gh_stars>0
frase = input().split()
def maiuscula(s):
saida = ''
for i in s:
temp = i.lower()
saida = saida + temp.capitalize() + " "
return (saida)
print(maiuscula(frase))
| StarcoderdataPython |
4893382 | #!/usr/bin/env python
"""
Base class / functionality for an (illumination) amplitude control device.
Hazen 04/17
"""
from PyQt5 import QtCore
import storm_control.hal4000.halLib.halMessage as halMessage
import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModule
class AmplitudeWorker(hardwareModu... | StarcoderdataPython |
1882383 | import subprocess
def get_git_repo_head_branch(repo):
"""
A helper method to get the reference of the HEAD branch of a git remote repo.
https://stackoverflow.com/a/41925348
"""
out = subprocess.check_output(
["git", "ls-remote", "--symref", repo, "HEAD"]
).decode()
head_branch = ou... | StarcoderdataPython |
1836383 | <gh_stars>10-100
from sacrerouge.datasets.nytimes.subcommand import NYTimesSubcommand | StarcoderdataPython |
3329400 | <filename>src/run_locally.py<gh_stars>1-10
"""
Start a simulation
"""
import compile_erl
import clean_state
from lib_run import *
def main():
compile_erl.compile_all()
clean_state.clear()
ip_addr = get_ip_addr()
args = sys.argv
n_cars = string_to_int(args[1]) if len(args) == 2 else 1
# Run... | StarcoderdataPython |
8047392 | <reponame>tantalum7/manf
class Index(object):
def __init__(self, app):
# Store ref to top level app and database
self._app = app
self._db = app.database
def fetch(self, id=None, EPN=None):
pass
def search(self, query):
pass
def list_all(self, filter=No... | StarcoderdataPython |
1909445 | <reponame>jshulkinVSA/VSA-Challenges<gh_stars>0
# Name:
# Date:
# proj07: Word Game
import random
import string
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
HAND_SIZE = 7
SCRABBLE_LETTER_VALUES = {
'a': 1, 'b': 3, 'c': 3, 'd': 2, 'e': 1, 'f': 4, 'g': 2, 'h': 4, 'i': 1, 'j': 8, 'k':
5, 'l': 1, '... | StarcoderdataPython |
63416 | from Xlib import X, display
def lock_screen(display: display.Display, screen_nb: int):
screen = display.screen(screen_nb)
root = screen.root
display_width = screen.width_in_pixels
display_height = screen.height_in_pixels
window = root.create_window(0, 0, display_width, display_height,
... | StarcoderdataPython |
1682372 | # Copyright 2020 Adap GmbH. 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 law or ag... | StarcoderdataPython |
6496346 | <reponame>h77h7/tvm-04.26<gh_stars>10-100
# 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, Ve... | StarcoderdataPython |
8122778 | '''
测试文件以test_开头(以_test结尾也可以)
测试类以Test开头,并且不能带有 init 方法
测试函数以test_开头
断言使用基本的assert即可
'''
#! /usr/bin/env python
#coding=utf-8
import random
import pytest
def bubble_sort(nums):
for i in range(len(nums)-1):
for j in range(len(nums)-i-1):
if nums[j] > nums[j+1]:
nums[j], nums[j+... | StarcoderdataPython |
3510341 | import torch as t
class Config:
model_path = None# 预训练模型,None表示重新训练
model = 'SqueezeNet1_0'#加载的模型,模型名必须与models/__init__.py中的名字一致
'''
ShuffleNetV2,MobileNetV2,SqueezeNet1_0,SqueezeNet1_1
VGG11,VGG13,VGG16,VGG19
ResNet18,ResNet34,ResNet50
'''
lr = 0.0005 #学习率
use_gpu = True #是否使用gpu
... | StarcoderdataPython |
8193711 | <filename>zaza/openstack/charm_tests/charm_upgrade/tests.py
#!/usr/bin/env python3
# Copyright 2020 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | StarcoderdataPython |
6630111 | """
(Testing FPS)
Pixel Difference Networks for Efficient Edge Detection (accepted as an ICCV 2021 oral)
See paper in https://arxiv.org/abs/2108.07009
Author: <NAME>, <NAME>
Date: Aug 22, 2020
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import print_function
from... | StarcoderdataPython |
3340422 | from typing import List
from nameko.standalone.rpc import ClusterRpcProxy
import logging
import time
from isharp.evalengine.core import Evaluator,EvalMethod
from isharp.datahub.core import DatahubTarget
logger = logging.getLogger(__name__)
def remote_config(net_location: str):
return {
'serializer': 'pick... | StarcoderdataPython |
1816037 | from gevent import monkey
monkey.patch_all()
from flask import Flask, render_template, session, request
from flask.ext.socketio import SocketIO, emit, join_room, leave_room, \
close_room, disconnect
from crontab import CronTab
from datetime import datetime
# cron = CronTab(user=True)
# # get already created cr... | StarcoderdataPython |
11209519 | import numpy as np
import pickle
import os
SEA_MONSTER = np.array(
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
[1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1],
[0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0],
],
dtype=np.bool,
)
def p... | StarcoderdataPython |
8103024 | # Copyright 2016 Semaphore Solutions, Inc.
# ---------------------------------------------------------------------------
from ._internal import WrappedXml, FieldsMixin, ClarityElement
from ._internal.props import subnode_property, subnode_element_list, attribute_property, subnode_link
from s4.clarity.file import File
... | StarcoderdataPython |
6677571 | <reponame>qmeeus/Object-detection
import os, os.path as p
import sys
from time import sleep, time
import numpy as np
import ffmpeg
import subprocess
from queue import PriorityQueue
from multiprocessing import Pool, log_to_stderr
from realtime_object_detection.detection import ObjectDetection
from realtime_object_detec... | StarcoderdataPython |
5002002 | # Modified from https://github.com/yenchanghsu/out-of-distribution-detection/blob/master/methods/ood_detection.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
import numpy as np
from sklearn import metrics
import copy
import os
from metrics.ood import... | StarcoderdataPython |
1763878 | from enum import Enum
import matplotlib.pyplot as plt
from simalia.data import index
class PlotTypes(Enum):
LINE = 1
BAR = 2
PIE = 3
DONUT = 4
class Plot:
def __init__(self, title="", legend=False):
self.title = title
self.legend = legend
self.type = None
self.... | StarcoderdataPython |
4930099 | print('='*10, 'Desafio 62', '='*10)
primeiro = int(input('Digite o primeiro termo da PA: '))
razão = int(input('Digite a razão da PA: '))
cont = 1
termo = primeiro
total = 0
mais = 10
while mais != 0:
total = total + mais
while cont <= total:
print('{} → '.format(termo), end=' ')
termo += razão
... | StarcoderdataPython |
9725374 | <gh_stars>0
from flask_wtf import FlaskForm
from wtforms import BooleanField
from wtforms import PasswordField
from wtforms import StringField
from wtforms import SubmitField
from wtforms.validators import DataRequired
class LoginForm(FlaskForm):
username = StringField('Username', validators=[DataRequired()])
... | StarcoderdataPython |
1782852 | <gh_stars>1-10
# Import cars data
import pandas as pd
cars = pd.read_csv('cars.csv', index_col = 0)
# Import numpy, you'll need this
import numpy as np
# Create medium: observations with cars_per_cap between 100 and 500
cpc = cars['cars_per_cap']
between = np.logical_and(cpc > 10, cpc < 80)
medium = cars[between]
... | StarcoderdataPython |
12824952 | import json
from mysystem import *
from utils import trans2json
import pull_global_vars as gv
from pull_util import *
from hash import Hash
#from redis_oper import write2redis
import base64
import time
MEDIA_REQ_TIMEOUT = 3
def query_hash(data):
result_hash_list = []
start_time=time.time()
if data['param... | StarcoderdataPython |
5171507 | # -*- coding: utf-8 -*-
"""
Progress component
"""
from bowtie._component import Component
class Progress(Component):
"""This component is used by all visual components and
is not meant to be used alone.
By default, it is not visible.
It is an opt-in feature and you can happily use Bowtie
withou... | StarcoderdataPython |
6547037 | <gh_stars>1-10
import tensorflow as tf
import tensorflow.contrib.slim as tfslim
mobilenetv3_large = {
'kernel': [3, 3, 3, 5, 5, 5, 3, 3, 3, 3, 3, 3, 5, 5, 5],
'expand':
[16, 64, 72, 72, 120, 120, 240, 200, 184, 184, 480, 672, 672, 672, 960],
'output':
[16, 24, 24, 40, 40, 40, 80, 80, 80, 80, 112, 1... | StarcoderdataPython |
297048 | """
Shows how to receive a file over OBEX.
"""
import lightblue
# bind the socket, and advertise an OBEX service
sock = lightblue.socket()
try:
sock.bind(("", 0)) # bind to 0 to bind to a dynamically assigned channel
lightblue.advertise("LightBlue example OBEX service", sock, lightblue.OBEX)
# Rec... | StarcoderdataPython |
9769821 | '''
Author : <NAME>
Mail : <EMAIL> @ g<EMAIL>.com
'''
num = float(input("Enter your number :"))
if num >= 80.00:
print("Your grade is A+.")
elif num >= 70.00:
print("Your grade is A.")
elif num >= 60.00:
print("Your grade is A-.")
elif num >= 50.00:
print("Your grade is B.")
elif num >= 40.00:
... | StarcoderdataPython |
12851004 | """empty message
Revision ID: 783682226c9b
Revises: <KEY>
Create Date: 2019-10-19 10:07:14.923441
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "<KEY>"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | StarcoderdataPython |
3408945 | <reponame>Aquarium1222/Electricity-Forecasting
import pandas as pd
import numpy as np
import torch.utils.data as data
from sklearn.preprocessing import MinMaxScaler
import config
class ElectricDataset(data.Dataset):
def __init__(self, preprocessor):
const = config.Constant
hp = config.Hyperparame... | StarcoderdataPython |
302470 | <gh_stars>0
from datetime import datetime
from typing import NewType, TypeVar
PythonType = TypeVar('PythonType')
UUID = NewType('UUID', str)
String = NewType('String', str)
Boolean = NewType('Boolean', bool)
Integer = NewType('Integer', int)
Float = NewType('Float', float)
Text = NewType('Text', str)
LongText = NewTy... | StarcoderdataPython |
3236305 | """
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs.html#SQS.Client.send_message
"""
from pprint import pprint
import boto3
import time
def send_message(queueu_url: str, region_name: str, message: str):
sqs_client = boto3.client("sqs", region_name=region_name)
response = sqs_cl... | StarcoderdataPython |
215968 | <reponame>guillp/binapy
from binapy import binapy_checker, binapy_decoder, binapy_encoder
@binapy_decoder("hex")
def decode_hex(bp: bytes) -> bytes:
return bytes.fromhex(bp.decode())
@binapy_encoder("hex")
def encode_hex(bp: bytes) -> bytes:
return bp.hex().encode()
@binapy_checker("hex")
def is_hex(bp: b... | StarcoderdataPython |
1928462 | # -*- coding: utf-8 -*-
# Copyright 2021, CS GROUP - France, http://www.c-s.fr
#
# This file is part of EODAG project
# https://www.github.com/CS-SI/EODAG
#
# 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... | StarcoderdataPython |
3317813 | import os
import sys
from os.path import join, isdir, realpath, exists
from shutil import rmtree
NODE_MODULES = "node_modules"
test = False
repoRoot = sys.argv[1]
rootPath = realpath(repoRoot)
if not exists(rootPath):
print("'{0}' does not exist. Exiting.").format(rootPath)
sys.exit(1)
if len(sys.argv) >= 3... | StarcoderdataPython |
12840566 | <filename>058.py
from random import randint, choice
from time import sleep
print('_' * 40)
print('Vou pensar em um número entre 0 e 10.\n')
print('PROCESSANDO...')
sleep(3)
print('pronto!')
sleep(0.5)
n = int(input('Em que número eu pensei? '))
print('-' * 80)
sleep(2)
x = randint(0, 10)
cont = 0
while n != x:
if... | StarcoderdataPython |
11397487 | <filename>test_app/forms.py<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from thecut.ordering.forms import OrderMixin
from django.forms import ModelForm
from .models import OrderingTestModel
class OrderingTestNoOrderFieldForm(OrderMixin, ModelForm):
# A class to provi... | StarcoderdataPython |
3343974 | import argparse
from utils import process_config
def get_eval_config():
parser = argparse.ArgumentParser("Visual Transformer Evaluation")
# basic config
parser.add_argument("--n-gpu", type=int, default=1, help="number of gpus to use")
parser.add_argument("--model-arch", type=str, default="b16", help=... | StarcoderdataPython |
288886 | import abc
from pydnameth.config.experiment.types import Task
from pydnameth.infrastucture.load.cpg import load_cpg
from pydnameth.infrastucture.load.table import load_table_dict
class LoadStrategy(metaclass=abc.ABCMeta):
@abc.abstractmethod
def load(self, config, configs_child):
pass
class CPGLoad... | StarcoderdataPython |
107954 | #
# Copyright (C) 2018 The Android Open Source Project
#
# 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 la... | StarcoderdataPython |
3583362 | import requests
#api_key='<KEY>'
api_key='<KEY>'
#url = 'http://172.17.0.3:9002//api/external/all-mooring/'+api_key+'/?mooring_specification=private'
url = 'https://mooring-api-dev-oim01.dbca.wa.gov.au/api/external/vessel-create-update/'+api_key+'/'
myobj = {'rego_no': 'D8888','vessel_size': 1.1, 'vessel_draft': 1.2, ... | StarcoderdataPython |
1884658 | def display_board(board):
"""显示棋盘"""
print("\t{0} | {1} | {2}".format(board[0], board[1], board[2]))
print("\t—-+-—-+-—")
print("\t{0} | {1} | {2}".format(board[3], board[4], board[5]))
print("\t—-+-—-+-—")
print("\t{0} | {1} | {2}".format(board[6], board[7], board[8]))
def legal_moves(board):... | StarcoderdataPython |
4937867 | # -*- coding: utf-8 -*-
import csv
import codecs
import decimal
path_pomodone_log = 'pomodone-log.csv'
path_trello_archived = 'Archived trello.csv'
path_trello = 'trello.csv'
path_output = 'output.csv'
rfile_pomodone_log = codecs.open(path_pomodone_log, 'rb', encoding="utf-8")
rfile_trello_archived = codecs.open(
... | StarcoderdataPython |
1878168 | import sys
import os.path
# sys.path.insert(0, os.path.abspath("./simple-dnn"))
import tensorflow as tf
import numpy as np
import tensorflow.contrib.slim as slim
import scipy.misc
import time
class BaseGAN(object):
""" Base class for Generative Adversarial Network implementation.
"""
def __init__(self,
... | StarcoderdataPython |
6523447 | from django.core.cache import cache
def get_cache_key(document, revision):
cache_key = "discussion_length_{}_{}".format(document.pk, revision)
return cache_key
def get_discussion_length(revision):
"""Get the number of remarkes on a revision.
This is a helper method to return a cached value. Setting... | StarcoderdataPython |
3543450 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from itertools import product
from unittest.mock import MagicMock
import numpy as np
from ax.models.model_utils import best_observed_point, check_duplicate
from ax.utils.common.testutils import TestCase
class ModelUtilsTe... | StarcoderdataPython |
11273721 | <gh_stars>0
"""
This module contains constants representing the kinds of user that can be logged in, based on their roles and permissions.
"""
from .role_kinds import ADMIN # noqa F401
from .role_kinds import ASSIGNABLE_COACH # noqa F401
from .role_kinds import COACH # noqa F401
LEARNER = 'learner'
SUPERUSER = 'superu... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.