id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3297807
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
StarcoderdataPython
4839425
<gh_stars>1-10 # coding: utf-8 # In[2]: def plot_halo_region(region, info, star, cell=None, npix=400, fn_save='region_map.png', show=True): import draw extent = (0, npix, 0, npix) star_map = draw.pp.den2d(star['x'],star['y'],star['z'],star...
StarcoderdataPython
658
""" Central configuration module of webstr selenium tests. This module provides configuration options along with default values and function to redefine values. """ # Copyright 2016 Red Hat # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Li...
StarcoderdataPython
1711911
<gh_stars>1-10 """empty message Revision ID: 258e46968404 Revises: None Create Date: 2016-09-23 09:18:52.689480 """ # revision identifiers, used by Alembic. revision = '258e46968404' down_revision = None from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql def upgrade(): ##...
StarcoderdataPython
170897
#!/usr/bin/env python3.8 import asyncio from lru import LRU from logger import log_access, get_access_log_file_descriptor import json import os from req_parser import get_request_object, HTTPError from req_handler import handle_request, handle_error from resp_sender import send_response import multiprocessing as mp SE...
StarcoderdataPython
114473
import numpy as np import h5py def get_lightcurve(toi:str): """ Extracts TOI light curves from h5 file. Args: toi (string): The TOI number (e.g., "101.01"). Returns: time (numpy array): The phase-folded time from the center-of-transit in days. flux (numpy array): The phase-folded normalized flux. """ hf_t...
StarcoderdataPython
1703650
<filename>mmcls/models/backbones/__init__.py # Copyright (c) OpenMMLab. All rights reserved. from .alexnet import AlexNet from .lenet import LeNet5 from .mobilenet_v2 import MobileNetV2 from .mobilenet_v3 import MobileNetV3 from .regnet import RegNet from .resnest import ResNeSt from .resnet import ResNet, ResNetV1d fr...
StarcoderdataPython
3360816
<reponame>goszpeti/app_grid_conan<filename>src/conan_app_launcher/ui/views/app_grid/__init__.py from typing import TYPE_CHECKING, List, Union import conan_app_launcher.app as app from conan_app_launcher.app.logger import Logger from conan_app_launcher.settings import APPLIST_ENABLED # using global module pattern from...
StarcoderdataPython
4814247
""" safe_test.py by Dalofeco Defines test cases for the provided pyutils_dalofeco package. """ from pyutils_dalofeco import Safe class TestSafe: @staticmethod def test_keys_in_dict(): # Define test dict test_dict = { 'unique': 2, 'other': 4, 'me': 'da', ...
StarcoderdataPython
1766424
import asyncio import secrets import time from discord.utils import get from helpers.exceptions import LevelingBlacklistedUserException, PromotingYourselfForbiddenException, \ PromoCodeNotFoundException, UnknownException from helpers.spark_module import SparkModule from .settings import SETTINGS from .web import ...
StarcoderdataPython
3397821
<filename>keg_elements/tests/test_views/test_views.py<gh_stars>1-10 from unittest import mock import flask import flask_webtest from pyquery import PyQuery from webgrid.extensions import RequestArgsLoader from kegel_app.model import entities as ents class TestDemoGrid: def setup(self): ents.Thing.delete...
StarcoderdataPython
3263418
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys from collegue import Collegue from constants import Constants class Unit(Collegue): """A class which has an infomation of a unit. And this class can calculate between units by a function which this class has. Attributes: ex_numer: A s...
StarcoderdataPython
3235152
<filename>led_matrix.py<gh_stars>1-10 class LEDMatrix(object): def __init__(self, microcontroller): self.mc = microcontroller self._turn_on() def _select_row(self, row): row = row % 8 if self.mc.smallBoard else row % 16 if row & 0x1: self.mc.A.value(1) e...
StarcoderdataPython
1644113
# PyGame > SDL2 > OpenCV import pygame from pygame.locals import DOUBLEBUF class Display(object): def __init__(self, W, H): pygame.init() self.screen = pygame.display.set_mode((W, H), DOUBLEBUF) self.surface = pygame.Surface(self.screen.get_size()).convert() def display2D(self, img): pygame.surfar...
StarcoderdataPython
1672892
<filename>tests/test_main.py """Test main utilities""" import os from collections import defaultdict import builtins from rever.activity import Activity from rever.main import (env_main, compute_activities_completed, compute_activities_to_run) from rever.logger import current_logger def test_...
StarcoderdataPython
3262247
<reponame>LuisCerdenoMota/SHERLOCK import math from sherlockpipe.search_zones.SearchZone import SearchZone from sherlockpipe.star.HabitabilityCalculator import HabitabilityCalculator from sherlockpipe.star.starinfo import StarInfo class NeptunianDesertSearchZone(SearchZone): def __init__(self): super().__...
StarcoderdataPython
1701051
<reponame>dema-software-solutions/paz-1<gh_stars>0 from tensorflow.keras.models import Model from tensorflow.keras.layers import ( Input, Conv2D, Activation, Dense, Reshape, Conv2DTranspose, Flatten, LeakyReLU, BatchNormalization, Concatenate) def encoder_convolution_block(x, filters, strides=(2, 2)): x =...
StarcoderdataPython
147683
<filename>polling_stations/apps/data_collection/management/commands/import_vale_of_white_horse.py from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter class Command(BaseXpressDemocracyClubCsvImporter): council_id = "E07000180" addresses_name = ( "local.2019-05-02/Version ...
StarcoderdataPython
1636349
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*- # vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8 # # Capriqorn --- CAlculation of P(R) and I(Q) Of macRomolcules in solutioN # # Copyright (c) <NAME>, <NAME>, and contributors. # See the file AUTHORS.rst for the full list ...
StarcoderdataPython
3379593
""" @author: <NAME> """ from PyQt5.QtCore import QSize from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QComboBox, QLineEdit, QPushButton, QDesktopWidget, QCheckBox, QMessageBox from PyQt5.QtGui import QPixmap, QIcon, QCursor from PyQt5 import Qt from PyQt5 import QtCore from Algorithms.LinearSear...
StarcoderdataPython
3251586
<reponame>tailhook/edgedb # # This source file is part of the EdgeDB open source project. # # Copyright 2019-present MagicStack Inc. and the EdgeDB authors. # # 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 t...
StarcoderdataPython
180974
#placeholder, not currently used here (see src/transmute)
StarcoderdataPython
4835098
<reponame>bninja/rump<filename>rump/upstream.py import collections import random class Server(collections.namedtuple('Server', ['protocol', 'location'])): """ An upstream server represented as a - protocol (e.g. 'http') - location (e.g. '127.0.0.1:5001') string, string pair. """ default...
StarcoderdataPython
41868
<filename>src/main/python/article_statistics.py #!/usr/bin/env python ####### ####### article_statistics.py ####### ####### Copyright (c) 2010 <NAME>. ####### # Counts and outputs various statistics about the articles in the # article-data file. from nlputil import * import process_article_data as pad #############...
StarcoderdataPython
1768878
<filename>authors/apps/articles/renderers.py import json from rest_framework import renderers class ArticleJsonRenderer(renderers.BaseRenderer): """ Renders an article into a list or single article """ media_type = 'application/json' format = 'json' charset = 'utf-8' def render(self, data...
StarcoderdataPython
3352841
<reponame>usamaahmadkhan/vpp<filename>extras/japi/java/jvpp/gen/jvppgen/jni_impl_gen.py #!/usr/bin/env python2 # # Copyright (c) 2018 Cisco and/or its affiliates. # 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 ...
StarcoderdataPython
1746080
import pygame class P2Paddle(): def __init__(self, ai_settings, screen): super(P2Paddle, self).__init__() self.screen = screen self.ai_settings = ai_settings # Load the paddle image and get its rect self.image = pygame.image.load('images/paddle.png') self.rect = ...
StarcoderdataPython
1669153
import logging from unittest.mock import patch from app.common.test import BaseApiTest from app.models.calculation_module import from_registration_string, list_cms CM_STRING_NO_INFO = "[CMName]" CM_STRING_BAD_JSON = "[CMName cm_info={]" CM_STRING0 = 'CMName [cm_info={"doc": "doc"}]' CM_STRING1 = 'CM Name [cm_info={"d...
StarcoderdataPython
93123
import argparse import glob import os import pickle import random from tqdm import tqdm def pickle_examples(image_paths, train_path, val_path, train_val_split): """ Compile a list of examples into pickled format, so during the training, all io will happen in memory """ with open(train_path, 'wb')...
StarcoderdataPython
175708
<gh_stars>0 # -*- coding: utf-8 -*- import numpy as np from random import normalvariate, randint import os from PIL import Image def resizeImg(**args): args_key = {'ori_img': '', 'dst_img': '', 'save_q': 100} arg = {} for key in args_key: if key in args: arg[key] = args[key] image ...
StarcoderdataPython
132738
"""Data getters for Glass business website data.""" import logging import pickle from pathlib import Path from typing import Dict import pandas as pd from metaflow import namespace from sg_covid_impact.utils.metaflow import flow_getter import sg_covid_impact OUTPUT_DIR = Path(f"{sg_covid_impact.project_dir}/data/in...
StarcoderdataPython
1700726
# Template from .mailings import Mailings from .brand import Brand from .template import Template from .mail import Mail # Mail from .postal_system import PostalSystem
StarcoderdataPython
122386
<reponame>dprelogo/SPax from functools import partial import jax import jax.numpy as jnp # def _dimension_check(x, y): # if x.shape != y.shape: # raise ValueError("x and y shapes are not the same") @jax.jit def _linear(x, y): return jnp.einsum("ij,ik->jk", x, y) @jax.jit def _rbf(x, y, gamma = 1.): ...
StarcoderdataPython
1744951
# Copyright 2020 <NAME>, <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 required by applicable law or agreed to in writing, ...
StarcoderdataPython
3272455
<reponame>ifrunistuttgart/RL_CrossCountrySoaring import numpy as np from numpy.core._multiarray_umath import ndarray class AgentParameters: """ In case of classical waypoint control, these params are only used for evaluation plots. Attributes ---------- TIMESTEP_CRTL: int Control up...
StarcoderdataPython
107982
# Copyright 2016 Hewlett Packard Enterprise Development LP # # 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 ...
StarcoderdataPython
1684256
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import os import sys import joern2sarif.lib.convert as convertLib from joern2sarif.lib.logger import LOG def build_args(): """ Constructs command line arguments for the vulndb tool """ parser = argparse.ArgumentParser( ...
StarcoderdataPython
3215858
<filename>python/phonenumbers/geodata/data18.py """Per-prefix data, mapping each prefix to a dict of locale:name. Auto-generated file, do not edit by hand. """ from ..util import u # Copyright (C) 2011-2014 The Libphonenumber Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not us...
StarcoderdataPython
65334
<gh_stars>1-10 # Copyright (c) 2011 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
StarcoderdataPython
3255110
# Transposition Cipher Encryption def main(): my_message = 'Common sense is not so common.' my_key = 8 cipher_text = encrypt_message(my_key, my_message) # Print the encrypted string in cipher_text to the screen, with # a | (called "pipe" character) after it in case there are spaces at # the en...
StarcoderdataPython
42882
<filename>application/mod_collage/col_controllers.py<gh_stars>1-10 from flask import Blueprint, render_template, session, redirect, url_for from flask_wtf import FlaskForm from wtforms import SelectField from application.mod_collage.photoManip import generateCollage from application.mod_auth.models import Landmark mo...
StarcoderdataPython
53561
################################################################################ # Copyright (c) 2020-2021, Berkeley Design Technology, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to ...
StarcoderdataPython
68894
""" Unit and regression test for the get_sequence_identity module of the molsysmt package on molsysmt MolSys molecular systems. """ # Import package, test suite, and other packages as needed import molsysmt as msm import numpy as np import math as math # Distance between atoms in space and time def test_get_sequence...
StarcoderdataPython
9708
import numpy as np import photon_stream as ps import photon_stream_production as psp import pkg_resources import os runinfo_path = pkg_resources.resource_filename( 'photon_stream_production', os.path.join('tests', 'resources', 'runinfo_20161115_to_20170103.csv') ) drs_fRunID_for_obs_run = psp.drs_run._drs_fRu...
StarcoderdataPython
3220756
<gh_stars>0 """Conversion tool from SQD to FIF RawKIT class is adapted from Denis Engemann et al.'s mne_bti2fiff.py """ # Author: <NAME> <<EMAIL>> # # License: BSD (3-clause) import os from os import SEEK_CUR from struct import unpack import time import numpy as np from scipy import linalg from ..pick import pick...
StarcoderdataPython
4841298
import pandas as pd from datetime import datetime, date, timedelta import math import pprint import plotly.express as px #from google.colab import drive #drive.mount('/content/drive') # caminho, url ou link dos arquivos que contem as posições dos veículos (posições) e do arquivo da localização das pois posicoes = '/...
StarcoderdataPython
1668642
from ns.mac.factory import mac_address_factory, BROADCAST_MAC_ADDRESS
StarcoderdataPython
1750757
from django.db import models from django.contrib.auth.models import User from django.template.defaultfilters import slugify import os from django.urls import reverse class standard(models.Model): name = models.CharField(max_length=100, unique=True) slug = models.SlugField(null=True,blank=True) descriptio...
StarcoderdataPython
58769
<reponame>ovgu-FINken/DrivingSwarm<gh_stars>0 #!/usr/bin/env python import rospy from core.srv import BehaviourStatus from core.msg import BehaviourGoal, BehaviourActionGoal print('started: '+rospy.get_namespace()+'/test.py') atest_ns = "turtlebook1" service_string = '/'+atest_ns+'/test_call' rospy.wait_for_servic...
StarcoderdataPython
1619856
<reponame>nbsafety-project/nbsafety # -*- coding: future_annotations -*- from .kernel import SafeKernel
StarcoderdataPython
1629474
#!/usr/bin/env python r""" This module provides many valuable functions such as my_parm_file. """ # sys and os are needed to get the program dir path and program name. import sys import os import ConfigParser import StringIO import re import socket import gen_print as gp import gen_cmd as gc robot_env = 1 try: ...
StarcoderdataPython
19942
<gh_stars>0 class VoiceClient(object): def __init__(self, base_obj): self.base_obj = base_obj self.api_resource = "/voice/v1/{}" def create(self, direction, to, caller_id, execution_logic, reference_logic='', ...
StarcoderdataPython
3291341
import pytest import requests import diskcache import tempfile import os import tarfile import shutil DATA_URL = 'https://data.kitware.com/api/v1/file' @pytest.fixture(scope="module") def test_state_file(tmpdir_factory): tmpdir = tmpdir_factory.mktemp('state') _id = '5dbca381e3566bda4b4f94f0' download_u...
StarcoderdataPython
3270503
from ball_possession.input_reader.reader import Reader #test reading all files from list reader = Reader() status = True while status: status, distance, relative_speed, ball_speed = reader.read_next_file() print('distance \n', distance) print('relative speed \n', relative_speed) print('ball speed \n',...
StarcoderdataPython
136972
<filename>metrilyx/dataserver/monitor.py import sys import resource from twisted.internet import reactor class ProcessMonitor(object): """ Monitor various metrics for the process """ def __init__(self, checkInterval, logger): self.checkInterval = checkInterval self.logger = logger def ...
StarcoderdataPython
51469
<reponame>shivrajkotkar/gmso import pytest from gmso.core.improper import Improper from gmso.core.improper_type import ImproperType from gmso.core.atom_type import AtomType from gmso.core.site import Site from gmso.tests.base_test import BaseTest from gmso.exceptions import GMSOError class TestImproper(BaseTest): ...
StarcoderdataPython
3290310
<reponame>nilsvu/spectre # Distributed under the MIT License. # See LICENSE.txt for details. import numpy as np def dg_package_data_mass_density( mass_density, momentum_density, energy_density, flux_mass_density, flux_momentum_density, flux_energy_density, velocity, specific_internal_energy, normal_covec...
StarcoderdataPython
1771500
# Copyright 2018 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 or at # https://developers.google.com/open-source/licenses/bsd """FLT task to be manually triggered to convert launch issues.""" from __future__ import print_...
StarcoderdataPython
1603299
"""Init""" try: from ._version import version as __version__ except ImportError: __version__ = "unknown" # Need to import to ensure that `napari_plot` is included in the auto-class generator from .utils import _register # isort:skip noqa from ._dock_widget import napari_experimental_provide_dock_widget # no...
StarcoderdataPython
4829540
<reponame>ADITYA727/Django_Naukari<filename>src/profiles/migrations/0009_auto_20191001_2136.py # Generated by Django 2.2.5 on 2019-10-01 16:06 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('profiles', '0008_profile_age'), ] operations = [ ...
StarcoderdataPython
63531
<filename>strategies/__init__.py from . import strategies
StarcoderdataPython
107050
<filename>setup.py from setuptools import setup, find_packages setup( name='custom_minigrid', version='0.1', description='Extension to gym-minigrid which supports simple custom generation of environments', packages=['custom_minigrid'], #['gym_minigrid', 'gym_minigrid.envs'], # packages=find_packages()...
StarcoderdataPython
3268316
<gh_stars>1-10 # Copyright 2017 BBVA # # 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 w...
StarcoderdataPython
3389605
<gh_stars>10-100 ##################################################### # # A restricted Boltzmann machine trained using the # constrastive divergence algorithm # # see: # # <NAME>, Training products of experts by # minimizing contrastive divergence, Journal Neural # Computation Vol. 14, No. 8 (2002), 1771--1800 # # ...
StarcoderdataPython
3267029
# -*- coding: utf-8 -*- ########################################################################## # NSAp - Copyright (C) CEA, 2021 # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html #...
StarcoderdataPython
38835
"""add-sign-hash-table Revision ID: b829c4a4c128 Revises: cc<PASSWORD> Create Date: 2021-05-25 16:04:18.028626 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'b829c4a4c128' down_revision = 'cc5dce03ad39' branch_labels = None depends_on = None def upgrade(): ...
StarcoderdataPython
1629734
#********************************************************************************# # # # нεℓℓσ,вαтεs! #...
StarcoderdataPython
1625068
<reponame>Tittoh/blog-API<filename>authors/apps/articles/tests/test_comments.py """ module to test comment feature """ import json from rest_framework import status from rest_framework.test import APITestCase from rest_framework.test import APIClient from django.urls import reverse from django.test import TestCase fr...
StarcoderdataPython
3243431
<reponame>jfreeman812/pyrax<gh_stars>0 # -*- coding: utf-8 -*- # Copyright (c)2013 Rackspace US, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # ...
StarcoderdataPython
36822
<reponame>TaoHuUMD/3D-Reconstruction import time import open3d from options.train_options import TrainOptions from data import CreateDataLoader from models import create_model from util.visualizer import Visualizer from config import * import os from torch.utils.tensorboard import SummaryWriter if __name__ == '__main...
StarcoderdataPython
4800187
<gh_stars>1-10 from typing import Optional, Dict, Any, TYPE_CHECKING from pathlib import Path from os import PathLike import logging import asyncio from .utils import to_list, unset, get_filename from .exceptions import ( AccessDenied, ServerError, ClientError, ResourceExistsError, ResourceNotFoundError, a...
StarcoderdataPython
1668565
#!/usr/bin/env python from __future__ import print_function import roslib import rospy import std_msgs import numpy from sensor_msgs.msg import BatteryState if __name__ == "__main__": rospy.init_node('battery_node') pub = rospy.Publisher("battery", BatteryState, queue_size=1) tinit = rospy.Time.now().to...
StarcoderdataPython
1756388
import pathlib import subprocess import time import os import sys import argparse import logging import threading from services import registry logging.basicConfig(level=10, format="%(asctime)s - [%(levelname)8s] - %(name)s - %(message)s") log = logging.getLogger("run_basic_service") def main(): parser = argpar...
StarcoderdataPython
1763615
<reponame>ArDrift/InfoPy_scripts #!/usr/bin/env python3 class Node: def __init__(self, valid=False, gyerek={}): self.valid = valid self.gyerek = gyerek def betesz(szo, fa, poz=0): if poz < len(szo)-1: if fa.gyerek.get(szo[poz], -1) == -1: fa.gyerek[szo[poz]] = Node() ...
StarcoderdataPython
3301005
import struct from typing import Tuple, Optional, Union from bxcommon.utils.blockchain_utils.ont.ont_object_hash import OntObjectHash from bxgateway import ont_constants from bxgateway.messages.ont.ont_message import OntMessage from bxgateway.messages.ont.ont_message_type import OntMessageType class GetDataOntMessag...
StarcoderdataPython
1746720
# -*- coding: utf-8 -*- """car_damage_detection.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1xINwPZHsF1euVtX3NVdY0fnrCxo3hbHM """ from google.colab import drive drive.mount('/gdrive') import numpy as np import pandas as pd import seaborn...
StarcoderdataPython
76043
<reponame>DongjunLee/kino-bot # -*- coding: utf-8 -*- import random import re import subprocess import time from .background import schedule from .nlp.ner import NamedEntitiyRecognizer from .skills.bus import Bus from .skills.feed import FeedNotifier from .skills.github import GithubManager from .skills.humor impor...
StarcoderdataPython
1650441
#!/usr/bin/python2.7 import commands import os import time def monitor(vips, intv): dupvips = [] for vip in vips: status, _ = commands.getstatusoutput('./arping2 %s -d -c3 -w%s' % ( vip, intv)) if status != 0: dupvips.append(vip) with open('./dupvips.dat', 'w+') as...
StarcoderdataPython
4833758
from application.resources import recommender, fileuploader
StarcoderdataPython
1616581
<reponame>Rose-Hulman-Rover-Team/Rover-2019-2020 import serial, string import time output = " " lon=0 lat=0 stringVal="" ser = serial.Serial('/dev/ttyUSB0',115200, 8, 'N',1, timeout = 1) #file = open("Save.csv", "w") while True: print("----") while output != "": output = (ser.readline().de...
StarcoderdataPython
1775383
import sys from pathlib import Path import pytest from easyprocess import EasyProcess from pyvirtualdisplay import Display from pyvirtualdisplay.smartdisplay import DisplayTimeoutError, SmartDisplay python = sys.executable def test_disp(): with Display(): d = SmartDisplay(visible=True).start().stop() ...
StarcoderdataPython
1695196
<filename>kornia/geometry/warp/depth_warper.py from typing import Union import torch import warnings from kornia.geometry.depth import ( DepthWarper as _DepthWarper, depth_warp as _depth_warp ) from kornia.geometry.camera import ( PinholeCamera, cam2pixel, pixel2cam ) __all__ = [ "depth_warp", "D...
StarcoderdataPython
1694979
<gh_stars>10-100 # pylint: disable=g-bad-file-header # Copyright 2021 DeepMind Technologies Limited. 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.apa...
StarcoderdataPython
3254064
# coding: utf-8 """ @author: csy @license: (C) Copyright 2017-2018 @contact: <EMAIL> @time: 2018/11/24 @desc: """ import os from flask import Flask, render_template app = Flask(__name__) @app.route("/") def index(): return "Hello World!" @app.route("/hello") def hello(): return render_template('hello.html...
StarcoderdataPython
3253994
from django.db import models # Create your models here. class Project(models.Model): name = models.CharField(max_length=50) description = models.CharField(max_length=200) creation_time = models.DateTimeField(auto_now_add=True) key = models.CharField( max_length=5, help_text="Unique project co...
StarcoderdataPython
8923
<reponame>NeonDaniel/lingua-franca # # Copyright 2017 Mycroft AI 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 ...
StarcoderdataPython
3279027
import os import shutil from django.conf import settings from django_dynamic_fixture import G from django_webtest import WebTest from icekit.utils import testing from icekit.tests.models import ImageTest from icekit.utils.sequences import slice_sequences from icekit.utils.pagination import describe_page_numbers, pars...
StarcoderdataPython
1622961
<reponame>aidtechnology/nephos-1 from copy import deepcopy from unittest.mock import call, patch, Mock import pytest from nephos.fabric.crypto import ( CryptoInfo, check_id, register_id, enroll_id, create_admin, admin_creds, copy_secret, msp_secrets, admin_msp, item_to_secret, ...
StarcoderdataPython
3372657
<reponame>gotling/bug-django2-autocomplete from django.db import models class Item(models.Model): name = models.CharField(max_length=100) class Category(models.Model): name = models.CharField(max_length=100) def __str__(self): return self.name class LineItem(models.Model): item = models.F...
StarcoderdataPython
3325758
<reponame>zyapguy/license-key-generator import random class LicenseKey: partLength = 0 #The length of each part, Defaults to 5 partAmount = 0 #The amount of parts, Defaults to 5 divider = '' #The string that divides parts, Defaults to "-" def __init__( self,pLength=5,pAmount=5,div='-'): #Set v...
StarcoderdataPython
1646068
<filename>core/management/commands/db_dump.py from django.db import DEFAULT_DB_ALIAS from ._base import DanubeCloudCommand, CommandError, CommandOption class Command(DanubeCloudCommand): args = '[DB name]' help = 'Create database dump.' default_verbosity = 2 options = ( CommandOption('-d', '-...
StarcoderdataPython
48253
from importlib.metadata import entry_points from setuptools import find_packages, setup with open("README.md", "r") as fh: long_description = fh.read() setup( name="flitton_fib_py", version=("0.0.1"), author=("KKK"), author_email=("<EMAIL>"), description="Calculates a Fibonacci number", lo...
StarcoderdataPython
183145
import cmd class Interface(cmd.Cmd): prompt = 'Command: ' def do_foo(self, arg): print(arg) interface = Interface() interface.cmdloop()
StarcoderdataPython
3310163
'''107 - Crie um módulo chamado moeda.py que tenha as funções incorporadas aumentar(), diminuir(), dobro() e metade(). Faça também um programa que importe esse módulo e use algumas dessas funções.''' import modulomoedas preco = float(input('Qual o valor da compra? R$')) print(f'Pagando no cartão temos um aumento de 1...
StarcoderdataPython
167202
from .agent import Agent from .gui import GUI from .world import World
StarcoderdataPython
3276680
import h5py import pickle import numpy as np def load_weights(): fff = h5py.File('Mybase/mask_rcnn_coco.h5','r') #打开h5文件 #print(list(f.keys())) mydict = {} mydict['global_step:0'] = 1000 ########res1######## dset = fff['conv1'] a = dset['conv1'] b = np.array(a['kernel:0'], dtype=np....
StarcoderdataPython
1676881
# -*- coding: utf-8 -*- from .types import Environment, DiyLangError, Closure, String from .ast import is_boolean, is_atom, is_symbol, is_list, is_closure, \ is_integer, is_string from .parser import unparse """ This is the Evaluator module. The `evaluate` function below is the heart of your language, and the foc...
StarcoderdataPython
1722812
<reponame>lucuma/moar<filename>moar/storage.py # coding=utf-8 """ Local file system storage. """ import errno from hashlib import md5 import io import os from ._compat import urlopen from .thumb import Thumb def make_dirs(path): try: os.makedirs(os.path.dirname(path)) except (OSError) as e: ...
StarcoderdataPython
1751938
from finrl_meta.env_stock_trading.env_stock_papertrading import AlpacaPaperTrading from test import test def trade(start_date, end_date, ticker_list, data_source, time_interval, technical_indicator_list, drl_lib, env, model_name, API_KEY, API_SECRET, APCA_API_BASE_URL, trade_mode='backtestin...
StarcoderdataPython
3215960
<reponame>wwwidonja/changed_plotly import _plotly_utils.basevalidators class IndicatorValidator(_plotly_utils.basevalidators.CompoundValidator): def __init__(self, plotly_name="indicator", parent_name="", **kwargs): super(IndicatorValidator, self).__init__( plotly_name=plotly_name, ...
StarcoderdataPython