id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3567759 | <reponame>lyhue1991/Hypernets
from hypernets import hyperctl
params = hyperctl.get_job_params()
assert params
print(params)
| StarcoderdataPython |
4968505 | """
@author: Heerozh (<NAME>)
@copyright: Copyright 2019, Heerozh. All rights reserved.
@license: Apache 2.0
@email: <EMAIL>
"""
from typing import Optional, Sequence
from .factor import BaseFactor, CustomFactor
from .basic import MA, EMA
from .statistical import STDDEV
from .engine import OHLCV
from ..parallel import ... | StarcoderdataPython |
6421342 | <reponame>OmarThinks/graph_wrap
from __future__ import unicode_literals
import datetime
import json
from tastypie.test import ResourceTestCaseMixin
from django.test import TransactionTestCase
from tests.models import Author, Post, Media
class TestApi(ResourceTestCaseMixin, TransactionTestCase):
def setUp(self... | StarcoderdataPython |
6509234 | <reponame>avisionx/osaiiitd-backend<filename>core/models.py
from django.contrib.auth.models import AbstractUser
from django.db import models
class User(AbstractUser):
username_osa = models.CharField(max_length=150, unique=True)
is_verified = models.BooleanField(default=False)
class Meta:
verbose... | StarcoderdataPython |
3535792 | __version__='1.2'
__author__='<NAME>'
__email__='<EMAIL>'
__description__='Estimate postflash for WFC3/UVIS'
__code__='postflash'
from . import postflash
| StarcoderdataPython |
9703311 | from datetime import datetime
import psutil
import openloop as openloop
global cpu_hist
cpu_hist = []
def cpu_str():
val = psutil.cpu_percent()
if val == 0 or val == 100:
val = cpu_hist[len(cpu_hist)-1]
else:
cpu_hist.append(val)
return str(val)+"%"
class CPU_Temp:
def __init__(sel... | StarcoderdataPython |
1857531 | import wx
def on_get_uri_from_clipboard():
uri_from_clipboard = wx.TextDataObject()
uri = ""
if wx.TheClipboard.Open():
success = wx.TheClipboard.GetData(uri_from_clipboard)
wx.TheClipboard.Close()
if success:
uri = uri_from_clipboard.GetText()
return uri.strip() | StarcoderdataPython |
6592821 | <filename>src/modules/versionedModule/versionedModule.py<gh_stars>0
from logs import logDecorator as lD
import jsonref, pprint
config = jsonref.load(open('../config/config.json'))
logBase = config['logging']['logBase'] + '.modules.versionedModule.versionedModule'
configM = jsonref.load(open('../config/modules/... | StarcoderdataPython |
6476598 | <filename>AutoEncoders.py
import logging
log = logging.getLogger(__name__) # noqa: E402
import torch
import torch.nn as nn
import torch.nn.functional as func
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# MIXIN AUTOENCODER (to mix with nn.Mo... | StarcoderdataPython |
11285198 | <filename>benchmark/citation/gcn_diff.py
import argparse
import torch
import torch.nn.functional as F
from torch_geometric.nn import GCNConv
import torch_geometric.transforms as T
from gcn_conv_high import GCNConv_, GCNConv_random
import os
class GCNDiff(torch.nn.Module):
def __init__(self, data, dataset, hidden):
... | StarcoderdataPython |
3355736 | <filename>NAS/controller.py
import os
import datetime
import numpy as np
import tensorflow as tf
import tensorflow.keras as keras
if not os.path.exists('logs/'):
os.makedirs('logs/')
current_time = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
log_dir = 'logs/' + current_time
summary_writer = tf.summary.create... | StarcoderdataPython |
9619531 | <filename>taggercore/taggercore/scanner/region_scanner.py
#
# Copyright (c) 2020 it-eXperts IT-Dienstleistungs GmbH.
#
# This file is part of tagger
# (see https://github.com/IT-EXPERTS-AT/tagger).
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE f... | StarcoderdataPython |
37578 | # Programming for the Puzzled -- <NAME>
# You Will All Conform
# Input is a vector of F's and B's, in terms of forwards and backwards caps
# Output is a set of commands (printed out) to get either all F's or all B's
# Fewest commands are the goal
caps = ['F', 'F', 'B', 'B', 'B', 'F', 'B', 'B', 'B', 'F', 'F', 'B', 'F']... | StarcoderdataPython |
9645150 | <reponame>joyongjin/peb<gh_stars>0
def join_path(str1, str2):
if str1[-1] == '/':
if str2[0] == '/':
return str1 + str2[1:]
else:
return str1 + str2
else:
if str2[0] == '/':
return str1 + str2
else:
return str1 + '/' + str2
| StarcoderdataPython |
1746899 | # -*- coding: utf-8 -*-
import six
from ecl.tests.functional import base
class TestOperation(base.BaseFunctionalTest):
@classmethod
def setUpClass(cls):
super(TestOperation, cls).setUpClass()
mcics = list(cls.conn.connectivity.mcics())
cls.one_mcic = None
cls.one_operation ... | StarcoderdataPython |
1723785 | from setuptools import setup
setup(
name="guided-diffusion",
packages=["guided_diffusion"],
install_requires=["blobfile>=1.0.5", "torch", "tqdm", "mpi4py"],
)
| StarcoderdataPython |
5134466 | <filename>castle/client.py<gh_stars>1-10
from castle.api_request import APIRequest
from castle.commands.authenticate import CommandsAuthenticate
from castle.commands.filter import CommandsFilter
from castle.commands.log import CommandsLog
from castle.commands.risk import CommandsRisk
from castle.commands.start_imperson... | StarcoderdataPython |
50685 | """
Custom added maze tasks with dense rewards and progressively farther goals
For creating expert demonstrations
"""
from typing import Dict, List, Type, Tuple
import numpy as np
from mujoco_maze.custom_maze_task import (
GoalRewardLargeUMaze,
GoalRewardRoom3x5,
GoalRewardRoom3x10,
)
from mujoco_maze.t... | StarcoderdataPython |
8066290 | <gh_stars>0
#!/usr/bin/python
# Copyright (c) 2010, <NAME> <<EMAIL>>
# Copyright (c) 2015, <NAME>, TU Wien, Austria
#
#
# lp2txt is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License,... | StarcoderdataPython |
3274401 | <filename>Inverted-Pendulum-Cart/Model.py
import math
import numpy as np
from gym.utils import seeding
class CartPoleEnv():
"""
Description:
A pole is attached by an un-actuated joint to a cart, which moves along
a frictionless track. The pendulum starts upright, and the goal is to
prev... | StarcoderdataPython |
4892959 | <reponame>opendatalabcz/mapa-zdravi<filename>src/utils/parsing.py
import pandas as pd
import numpy as np
import os
from datetime import datetime
PATH_UNI = '../../data/raw/uni/'
###########################################################
##### GENERAL FUNCTIONS #####
###################... | StarcoderdataPython |
11313426 | <gh_stars>0
import logging
from argparse import ArgumentParser
logger = logging.getLogger(__name__)
class Task:
@staticmethod
def add_options(parser: ArgumentParser):
"""Add task-specific command line options"""
raise NotImplementedError
@classmethod
def setup_task(cls, args):
... | StarcoderdataPython |
4846348 | import numpy as np
import torch
from train.params import Params
from general_config import anchor_config, constants, classes_config, general_config
from data import dataloaders
from visualize import anchor_mapping
from utils.training import load_weigths_only, model_setup
from general_config.general_config import devic... | StarcoderdataPython |
3203733 | <reponame>JeronimoMendes/Tomatimer
from PyQt5.QtWidgets import QSystemTrayIcon, QAction, QMenu
from PyQt5.QtGui import QIcon
from timer import PomoTimer
from pypresence import Presence
class System_tray():
def __init__(self, tray, app, times, subject, pref_win):
self.times = times
self.ma... | StarcoderdataPython |
11356056 | <reponame>mobiletomb/trans
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
# 教师学生模型压缩损失,需要有训练好的教师模型
class DistillationLoss(nn.Module):
def __init__(self,
base_criterion,
teacher_model,
distillation_type,
... | StarcoderdataPython |
3489087 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from aif360.algorithms import Transformer
class DisparateImpactRemover(Transformer):
"""Disparate impact remover is a preprocessing technique th... | StarcoderdataPython |
1693079 | <reponame>adobe-dmeservices/user-sync-integration-test
import logging
import os
import platform
import re
from distutils.dir_util import copy_tree
from os.path import join
from subprocess import Popen, PIPE, STDOUT
import yaml
from pytest import fail
from ust_integration_test.resources import get_resource
from ust_in... | StarcoderdataPython |
3425719 | import torch
import pytest
import numpy as np
from greattunes import TuneSession
from scipy.stats import multivariate_normal
@pytest.mark.parametrize(
"max_iter, max_response, error_lim, model_type",
[
[10, 4.81856, 5e-2, "SingleTaskGP"],
[50, 6.02073, 1e-3, "SingleTaskGP"],
[50, 5.997... | StarcoderdataPython |
3469777 | <gh_stars>1-10
import argparse
import json
import random
import sys
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Harvests Watchtower SDK call execution time information from GAE backups.')
parser.add_argument('--file', '-f', dest='file', default=None)
parser.add_argument('--mock... | StarcoderdataPython |
8002138 | import time
import argparse
import numpy as np
from sklearn.metrics import confusion_matrix
import cv2
from models import TSN
from transforms import *
from ops import ConsensusModule
import pycuda.driver as cuda
from PIL import Image
from streaming import streaming
from threading import Thread, Event
from queue im... | StarcoderdataPython |
302116 | <gh_stars>0
from secret_santa.controller_service.email_service import EmailService | StarcoderdataPython |
1788754 | <filename>modelzoo/embedding-fusion/embedding_fusion_test.py
import tensorflow as tf
from tensorflow.contrib import layers
'''
[array([[ 0.09472656, -0.45898438, 0.56640625],
[-0.01525879, -0.7265625 , -0.12060547],
[-0.01525879, -0.7265625 , -0.12060547],
[ 0.12402344, -0.2578125 , 0.40039062]... | StarcoderdataPython |
1682357 | <reponame>JoyceBabu/SublimeLinter
import sublime
from concurrent.futures import ThreadPoolExecutor, wait, FIRST_EXCEPTION
from contextlib import contextmanager
from itertools import chain, count
from functools import partial
import hashlib
import json
import logging
import multiprocessing
import os
import time
import ... | StarcoderdataPython |
210829 | import multiprocessing
from psycogreen.gevent import patch_psycopg
timeout = 75
keepalive = 75
accesslog = "-"
errorlog = "-"
num_proc = multiprocessing.cpu_count()
worker_class = "gevent"
workers = (num_proc * 2) + 1
access_log_format = (
'{"message":"%(h)s %({x-forwarded-for}i)s %(l)s %(u)s %(t)s \'%(r)s\' %(s)... | StarcoderdataPython |
8073784 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-20 13:06
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migratio... | StarcoderdataPython |
1758506 | <reponame>mdelotavo/multitool<filename>multitool/verbose.py
import builtins
import http.client as http_client
import logging
import click
import requests
def verbose_callback(ctx, param, value):
builtins.MULTITOOL_TOGGLE_VERBOSE = value
http_client.HTTPConnection.debuglevel = value
logging.bas... | StarcoderdataPython |
1814148 | # Copyright 2017, Google, 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 at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | StarcoderdataPython |
4834007 | <reponame>Srijay-lab/segment2tissue<filename>CRAG/unet_data_maker.py
import glob
import os
from PIL import Image
import numpy as np
import random
masks_input_folder = "F:/Datasets/CRAG_LabServer/c1/Test/Grades/1/1436_cropped/binary_masks"
images_input_folder = "F:/Datasets/CRAG_LabServer/c1/Test/Grades/1/1436_cropped/... | StarcoderdataPython |
6647977 | # 22 Unpacking Operator
numbers = [1, 2, 3]
print(numbers)
print(*numbers) # with * operator we are unpacking the list and passign them as single elements to the print function
values = list((range(10)))
print(values)
values = [*range(10)] # With this operator we can unpack any iterables
print(values)
my_text = [*... | StarcoderdataPython |
117507 | <filename>P3/app/model.py
from pickleshare import *
db=PickleShareDB('miBD')
def checkUser(user):
return user in db
def getUser(user):
if checkUser(user):
return db[user]
return none
def addUser(user,data):
if not checkUser(user):
db[user]=data
def delUser(user):
del db[user]
| StarcoderdataPython |
6464629 | <reponame>roboception/rc_dynamics_python
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: roboception/msgs/imu.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _me... | StarcoderdataPython |
11233814 | <reponame>comay17/4_colors_game
from game_square import GameSquare
from random import randint
class GameBoard(object):
def __init__(self, rows: int, columns: int, number_of_values: int):
self.board = []
for i in range(rows):
self.board.append([])
for j in range(columns):
self.board[i].append(GameSquare... | StarcoderdataPython |
8113013 | <gh_stars>0
from multiprocessing import Process, Lock
from multiprocessing.sharedctypes import Value, Array
from ctypes import c_double
import pinocchio as pin
import numpy as np
import time
from example_robot_data.robots_loader import load
class NonBlockingViewerFromRobot():
def __init__(self,robot,dt=0.01):
... | StarcoderdataPython |
4897510 | from unittest import TestCase
from icon_extractit.actions.sha256_extractor import Sha256Extractor
from icon_extractit.actions.sha256_extractor.schema import Input, Output
class TestSha256Extractor(TestCase):
def test_extract_sha256_from_string(self):
action = Sha256Extractor()
actual = action.run(... | StarcoderdataPython |
283988 | class DistcoveryException(Exception):
def __init__(self, **kwargs):
super(DistcoveryException, self). \
__init__(self.template % kwargs)
class NoMoreAttempts(DistcoveryException):
template = 'Coudn\'t create unique name with %(length)d ' \
'digit%(length_suffix)s in %(limit)d... | StarcoderdataPython |
3491582 | <gh_stars>0
# HammerBotPython
# main
# bot.py
"""
The source code can be found at:
https://github.com/viktor40/HammerBotPython
bot.py is the main file for the bot.
This file contains task loops for bug and version reporting as well as the main bot loop.
In this file we will check for different discord events like on... | StarcoderdataPython |
9784936 | <gh_stars>0
import torch.nn as nn
import torch
from lanedet.models.registry import NET
from ..registry import build_backbone, build_aggregator, build_heads
@NET.register_module
class Detector(nn.Module):
def __init__(self, cfg):
super(Detector, self).__init__()
self.cfg = cfg
self.backbon... | StarcoderdataPython |
4920862 | import json
import pickle
_serializers = {}
def serialize(data, data_format) -> bytes:
"""
Serialize data using the specified format
:param data: the data to be serialized
:param data_format: the desired data format. Valid options are 'json', 'pickle'.
:return: a bytes-like object in the specifie... | StarcoderdataPython |
1640632 | <filename>models/official/detection/inference_pipeline.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import logging
sys.path.insert(1, "../efficientnet") # /tpu/models/official/efficientnet/
sys.path.insert(2, "../..") # /tpu/models... | StarcoderdataPython |
6661702 | <reponame>quanshengwu/PyChemia<gh_stars>1-10
from __future__ import print_function
import os
import itertools
import numpy as np
from pychemia.code.abinit import InputVariables
from ._population import Population
from pychemia import pcm_log
from pychemia.utils.mathematics import gram_smith_qr
class OrbitalDFTU(Popul... | StarcoderdataPython |
6539255 | import pygame
pygame.init()
main_window = pygame.display.set_mode((1120, 630))
DECREASE_RED_BY = 255
def decreased_red():
for x in range(0, pic.get_width()):
for y in range(0, pic.get_height()):
colour_to_change = pic.get_at((x, y))
if colour_to_change[0] < DECREASE_R... | StarcoderdataPython |
6426428 | # Generated by Django 3.2.3 on 2021-06-14 03:30
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('auctions', '0008_alter_bid_bid'),
]
operations = [
migrations.RemoveField(
model_name='bid',
... | StarcoderdataPython |
12813049 | <filename>05_convert_genotype_matrix_to_fastPHASE_format.py
'''
input1: genotype matrix with biallelic SNP or indel
'''
import sys,os,argparse
import pandas as pd
import numpy as np
def warn(*args, **kwargs):
pass
import warnings
warnings.warn = warn
def main():
parser = argparse.ArgumentParser(description='This co... | StarcoderdataPython |
1726914 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-13 10:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('catalog', '0002_auto_20160913_0311'),
]
operations... | StarcoderdataPython |
1788573 | month = "January"
quantity = 120
temperature = 45.6
valid = True
data = None
# print values from variables
print("Value of month :", month)
print("Value of quantity :", quantity)
print("Value of temperature :", temperature)
print("Value of valid :", valid)
print("Value of data :", data)
# print data type... | StarcoderdataPython |
1986115 | <gh_stars>0
#!/usr/local/bin/python3.7
# -*- coding: utf-8 -*-
import itertools
from typing import List
class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
"""
回溯算法与深度优先遍历:设计状态变量
https://leetcode-cn.com/problems/permutations/solution/hui-su-suan-fa-python-dai-ma-java-dai-... | StarcoderdataPython |
3216118 | <filename>serverMonitor/main.py
import firebase_admin
from firebase_admin import db
from firebase_admin import credentials
import datetime
from time import sleep
import codecs
from ghsTools import ghsTools
import database
import mail
from utils import datetime_utils
from utils.generic import clear_output
def main():... | StarcoderdataPython |
8107132 | <reponame>ScottSoren/ixdat
from .base_mpl_plotter import MPLPlotter
from .ec_plotter import ECPlotter
from .ms_plotter import MSPlotter
class ECMSPlotter(MPLPlotter):
"""A matplotlib plotter for EC-MS measurements."""
def __init__(self, measurement=None):
"""Initiate the ECMSPlotter with its default ... | StarcoderdataPython |
378186 | <reponame>nataliafonseca/flask-systrans
from app import db
from app.model.tables.person import Person
class Driver(Person):
__tablename__ = 'drivers'
id = db.Column(db.Integer, db.ForeignKey('people.id'), primary_key=True)
def __init__(self, cpf, name, birth_date, address):
self.cpf = cpf
... | StarcoderdataPython |
11270585 | <filename>nuage_neutron/db/migration/alembic_migrations/versions/newton/expand/c4fb5a76b195_add_switchport_mapping.py
# Copyright 2016 Nokia.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the Lic... | StarcoderdataPython |
4847437 | <filename>bincatalogs.py
import pdb
import six
import numpy as np
from astropy.io import fits
import astropy.units as u
from utils import bin_ndarray as rebin
from utils import gauss_kern
from utils import clean_nans
from utils import clean_args
from astropy import cosmology
from astropy.cosmology import Planck15 as co... | StarcoderdataPython |
3420782 | import torch
import torch.nn as nn
class RoundStraightThrough(torch.autograd.Function):
def __init__(self):
super().__init__()
@staticmethod
def forward(ctx, input):
rounded = torch.round(input, out=None)
return rounded
@staticmethod
def backward(ctx, grad_output):
... | StarcoderdataPython |
1659367 | <filename>clearing/utils/configuration.py
import os
import json
def load_config(filename):
if os.path.exists(filename):
try:
return json.load(open(filename, 'rb'))
except ValueError:
return {}
else:
return {}
def update_config(filename, cnf):
config = load... | StarcoderdataPython |
4904844 | from typing import List, Optional, Union
import tensorflow as tf
from merlin.models.tf.blocks.core.aggregation import ConcatFeatures, StackFeatures
from merlin.models.tf.blocks.core.base import Block
from merlin.models.tf.blocks.core.combinators import ParallelBlock
from merlin.models.tf.blocks.core.inputs import Inp... | StarcoderdataPython |
3501856 | import argparse
import textwrap
import string
import re
import random
import hashlib
from Patches import get_tunic_color_options, get_navi_color_options
class ArgumentDefaultsHelpFormatter(argparse.RawTextHelpFormatter):
def _get_help_string(self, action):
return textwrap.dedent(action.help)
# 32 charac... | StarcoderdataPython |
6474185 | # <NAME>
sent = ['The', 'dog', 'gave', 'John', 'the', 'newspaper']
result = [(word, len(word)) for word in sent]
print result
| StarcoderdataPython |
3562102 | <gh_stars>0
#!/usr/bin/python
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# This module is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opti... | StarcoderdataPython |
9657089 | <filename>tests/unit/features/data/testing.py
"""
# Copyright 2022 Red Hat
#
# 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 |
9681568 | <gh_stars>0
from flask import current_app
from flask import request, jsonify
from flask_restful import Resource
from operator import attrgetter
class IndexResource(Resource):
@staticmethod
def routes_command(sort='rule', all_methods=False):
reply = []
rules = list(current_app.url_map.iter_rul... | StarcoderdataPython |
1743742 | from datetime import datetime
import sqlalchemy as sa
from sqlalchemy.orm import relationship
from . import SQLAlchemyBase
from src.domain_logic.blog_domain import BlogDomain
class Blog(SQLAlchemyBase):
__tablename__ = "blogs"
id: int = sa.Column(sa.Integer, primary_key=True, autoincrement=True)
title: st... | StarcoderdataPython |
11383712 | <filename>jamon/scenes/waiting_room.py
# Scene for when player has clicked join_game and successfully joins
from urllib2 import urlopen
import json
from jamon.game.game import Scene, GameObject
from jamon.game.components.graphics import *
from jamon.game.widgets import *
from jamon.game.text import TextObject
from ja... | StarcoderdataPython |
4940864 | # coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from mcenter_server_api.models.base_model_ import Model
from mcenter_server_api import util
class DataViewIonStatus(Model):
"""NOTE: This class is auto generated ... | StarcoderdataPython |
1698525 | import socket,threading,time
def tcplink(sock,addr):
print('Accept new connection from %s:%s...' % addr)
sock.send(b'Welcome!')
while True:
data = sock.recv(1024)
time.sleep(1)
if not data or data.decode('utf-8') == 'exit':
break
sock.send(('Hello, %s!' % data.de... | StarcoderdataPython |
8003698 | <reponame>Nikokoli/harrastuspassi-backend
# -*- coding: utf-8 -*-
from django.urls import include, path, re_path
from rest_framework import routers
from harrastuspassi.api import (
BenefitViewSet,
HobbyViewSet,
HobbyCategoryViewSet,
HobbyEventViewSet,
OrganizerViewSet,
LocationViewSet,
Pro... | StarcoderdataPython |
3363051 | <filename>dev/regions_pyregion_comparison.py<gh_stars>10-100
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Compare DS9 parsing of the astropy regions package to pyregion
This scripts compares the DS9 parsing of the astropy regions package to
pyregion in two regards.
* speed : the time to parse a... | StarcoderdataPython |
1636338 | <reponame>lucaoflaif/pyCoinMarketCapAPI<gh_stars>1-10
"""Tests for the cache mechanism"""
import time
import secrets
import os
import sys
import unittest
import coinmarketcapapi
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
class CacheTestCase(unittest.TestCase):
"""Test class... | StarcoderdataPython |
11216938 | from django.shortcuts import render
from .models import Image, Location, Category
from django.http import Http404
# Create your views here.
def home(request):
images = Image.get_all_images()
return render(request, 'index.html', {'images': images})
def image(request, image_id):
try:
image = Image... | StarcoderdataPython |
316062 | <gh_stars>0
#!/usr/bin/env python3
from pprint import pprint
from collections import defaultdict
import PyPDF2
from os import listdir
from os.path import isfile, join
import pprint as pp
import nltk
from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
import extract
filename = "/... | StarcoderdataPython |
8148493 | from fastapi import FastAPI
import numpy as np
import xgboost as xgb
from sklearn.preprocessing import LabelEncoder
app = FastAPI()
# Load Model
bst = xgb.Booster({'nthread': 4}) # init model
bst.load_model('xgbboost_1.model') # load data
#Load Encoder
encoder = LabelEncoder()
encoder.classes_ = np.lo... | StarcoderdataPython |
5151202 | <reponame>kadr/nikolay-trofimov-test-task<filename>resources/service_request/service_request.py
from typing import List, Tuple
from aidboxpy import AsyncAidboxResource
from fhirpy.base.resource import AbstractResource
from aidbox_python_sdk.sdk import SDK
from resources.resource import Resource
class ServiceRequest... | StarcoderdataPython |
1950330 | # Copyright 2020 by <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>
# This software is distributed under the 3-clause BSD License.
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 8 11:49:24 2013
@author: dgade
edited by dlw Novemeber 2016 so there is one model for all instances
and a litle cleanup
"""
#
# Imports
#
fr... | StarcoderdataPython |
3282321 | """
Copyright 2019-2020 Amazon.com, Inc. or its affiliates. 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. A copy of
the License is located at
http://aws.amazon.com/apache2.0/
or in the "license" file accompany... | StarcoderdataPython |
3353506 | # -*- coding: utf-8 -*-
from sqlalchemy import Column, Integer, String, BLOB, DateTime, PickleType, Index, desc, create_engine, UniqueConstraint
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from datetime import datetime
from airflow import configuration as conf
import... | StarcoderdataPython |
11392184 | <reponame>XmlinX/Flask_cms<gh_stars>0
from flask import session,redirect,url_for
from functools import wraps
import config
def login_require(func):
@wraps(func)
def inner(*args,**kwargs):
if config.CmsUid in session:
return func(*args,**kwargs)
else:
return redirect(u... | StarcoderdataPython |
6612472 | <reponame>INYEONGKIM/BOJ
l=int(input());s=input();c=0
for i in s:
if i=='S': c+=1
x=c+(l-c)//2+1;print((x>l) and l or x)
| StarcoderdataPython |
3423021 | <filename>data.py
import os
import numpy
# Makes sure a certain folder exists
def make_folder(folder):
if not os.path.exists(folder):
os.makedirs(folder)
# Saves a Pandas DataFrame as a CSV file
def dataframe_to_csv(dataframe, path, index):
dataframe.to_csv(path, sep=';', decimal=',', index=index)
... | StarcoderdataPython |
3462827 | # Configuration file for the Sphinx documentation builder.
import os
import sys
sys.path.insert(0, os.path.abspath("."))
import sphinx_rtd_theme
import arkfunds
# -- Project information -----------------------------------------------------
project = "arkfunds-python"
copyright = "2021, <NAME>"
author = "<NAME>"
re... | StarcoderdataPython |
1710193 | from pyspark import SparkContext, SparkConf
from pyspark.sql import SparkSession
# set conf
conf = (
SparkConf()
.set("spark.hadoop.fs.s3a.fast.upload", True)
.set("spark.hadoop.fs.s3a.impl", "org.apache.hadoop.fs.s3a.S3AFileSystem")
.set('spark.hadoop.fs.s3a.aws.credentials.provider', 'com.amazonaws.auth.... | StarcoderdataPython |
9683491 | <gh_stars>0
import os
from invalid_format_error import InvalidFormatError
class ConversionDescriptor:
"""
Describes the parameters necessary for a conversion job.
"""
def __init__(self, src, target, fmt):
"""
Initializes the Conversion Descriptor
:param src: The absolute path ... | StarcoderdataPython |
8120014 | <reponame>Farhan-Malik/advance-hand-gesture
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: mediapipe/calculators/tflite/tflite_tensors_to_classification_calculator.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as... | StarcoderdataPython |
9729864 | <gh_stars>0
import copy
import functools
import numpy as np
import pandas as pd
import warnings
from scipy.stats import uniform
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import make_scorer
from sklearn.model_selection import RandomizedSearchCV, GridSearchCV, train_test_split
from xgboost ... | StarcoderdataPython |
1995922 | <gh_stars>0
a = int (raw_input())
b = int(raw_input())
print a+b,
print a*b,
print a/b,
print a-b
| StarcoderdataPython |
5035281 | # A function to convert degrees Fahrenheit to degrees Centigrade.
# See Exercise 1(a).
# Save file as F2C.py.
# Run the Module (or type F5).
def F2C():
F = int(input('Enter temperature in degrees Fahrenheit: '))
C = (F - 32) * 5 / 9
print('Temperature in degrees Centigrade is {} degrees C'.format(C))
| StarcoderdataPython |
3265221 | from django.apps import AppConfig
class LenderBooksAppConfig(AppConfig):
name = 'lender_books_app'
| StarcoderdataPython |
1991877 | from common import *
from trezor.utils import chunks
from trezor.crypto import bip32, bip39
from trezor.messages.SignTx import SignTx
from trezor.messages.TxInputType import TxInputType
from trezor.messages.TxOutputType import TxOutputType
from trezor.messages.TxOutputBinType import TxOutputBinType
from trezor.message... | StarcoderdataPython |
11382079 | from __future__ import print_function
from osvolbackup.osauth import get_session, VERSION
from keystoneauth1.exceptions.http import NotFound
from keystoneclient.v3 import client as keystone_client
from novaclient import client as nova_client
# References:
# https://ask.openstack.org/en/question/50087/list-all-server... | StarcoderdataPython |
5146716 | #/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2011-2014, <NAME>
#
# 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 requi... | StarcoderdataPython |
1814672 | <filename>code/lab_exercise_07/lab_exercise_07.py
#LAB EXERCISE 7
#Importing some required libraries:
import csv # You will use this one!
import operator # Don't worry about this.
#PROBLEM STATEMENT
# Scenario:
# You work for the US Department of Transportation.
# You are asked to determine the top TWO highl... | StarcoderdataPython |
3507196 | import pkgutil
import pytest
from altair.utils.execeval import eval_block
from altair import examples
def iter_example_filenames():
for importer, modname, ispkg in pkgutil.iter_modules(examples.__path__):
if ispkg or modname.startswith('_'):
continue
yield modname + '.py'
@pytest.m... | StarcoderdataPython |
3267602 | <reponame>roopeshvs/git-issues<filename>setup.py
from setuptools import setup
requirements = [
'click',
'certifi',
'urllib3',
'chardet',
'idna',
'requests',
'tabulate',
'timeago'
]
setup(
name='gitissues',
version='0.0.3',
description='Manage all your git issues at one plac... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.