id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1779931
A, B = map(int, input().split()) if A == 1: A += 13 if B == 1: B += 13 if A > B: print("Alice") elif A < B: print("Bob") else: print("Draw")
StarcoderdataPython
1753667
from seed.utils.crypto import AESCipher def test_aes_cipher_encrypt_and_decrypt(): aes_cipher = AESCipher() encrypted = aes_cipher.encrypt('foobar') assert aes_cipher.decrypt(encrypted) == 'foobar'
StarcoderdataPython
1753692
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 sampleInput = """{ "data": [ { "type": "checks", "id": "ccc:AccountId:S3-001:S3:us-east-1:S3Bucket", "attributes": { "region": "us-east-1", "status": "FAILURE", "risk-lev...
StarcoderdataPython
3378671
<gh_stars>0 """Test logging functionality""" import logging from unittest.mock import MagicMock from atkinson.logging import logger def test_gets_default_logger(): """ GIVEN we request a logger with the default atkinson logger WHEN we specify the root log level THEN we get back a default python logge...
StarcoderdataPython
3208862
<reponame>j-pettit/pfinance import nox @nox.session def lint(session): targets = ['pfinance', 'tests', 'noxfile.py'] session.install('flake8') session.run('flake8', *targets) @nox.session def tests(session): session.install('pytest') session.run('pytest', '-v')
StarcoderdataPython
191967
class Board: ''' A 3x3 board for TicTacToe ''' __board = '' __print_board = '' def __init__(self): self.__board = [['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9']] self.make_printable() def __str__(self): self.make_printable() return self.__print_board ...
StarcoderdataPython
3292233
import ROOT import numpy as np from threeML.minimizer.minimization import LocalMinimizer, FitFailed, CannotComputeCovariance from threeML.io.dict_with_pretty_print import DictWithPrettyPrint # These are the status returned by Minuit # status = 1 : Covariance was made pos defined # status = 2 : Hesse is ...
StarcoderdataPython
3311769
# coding: utf-8 from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from swagger_server.models.base_model_ import Model from swagger_server.models.beacon_concept_detail import BeaconConceptDetail # noqa: F401,E501 from swagger_server i...
StarcoderdataPython
3374321
<filename>ds4_graph.py class Graph: def __init__(self,gdict=None): if gdict is None: gdict = [] self.gdict = gdict # Get the keys of the dictionary def get_vertices(self): return list(self.gdict.keys()) def edges(self): return self.find_edges() # Find t...
StarcoderdataPython
1758842
""" File: quadratic_solver.py Name:張文銓 ----------------------- This program should implement a console program that asks 3 inputs (a, b, and c) from users to compute the roots of equation: ax^2 + bx + c = 0 Output format should match what is shown in the sample run in the Assignment 2 Handout. """ import math def m...
StarcoderdataPython
3241362
<reponame>jagt/bde-tools # -*- coding: utf-8 -*- # # BDE Tools documentation build configuration file, created by # sphinx-quickstart on Tue Apr 7 14:46:25 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this ...
StarcoderdataPython
930
# Copyright (c) Facebook, Inc. and its affiliates. import base64 import logging import os import sys from tensorboardX import SummaryWriter from pythia.utils.distributed_utils import is_main_process from pythia.utils.general import (ckpt_name_from_core_args, foldername_from_config_ov...
StarcoderdataPython
3329995
import numpy as np from TorchTSA.model import ARMAGARCHModel from ParadoxTrading.Chart import Wizard from ParadoxTrading.Fetch.ChineseFutures import FetchDominantIndex from ParadoxTrading.Indicator import LogReturn from ParadoxTrading.Indicator.TSA import ARMAGARCH fetcher = FetchDominantIndex() market = fetcher.fet...
StarcoderdataPython
3291642
<gh_stars>1-10 import dace import sys import time print(time.time(), 'loading') a = dace.SDFG.from_file(sys.argv[1]) print(time.time(), 'propagating') dace.propagate_memlets_sdfg(a) print(time.time(), 'strict transformations') a.apply_strict_transformations() print(time.time(), 'saving') a.save('strict.sdfg') print(ti...
StarcoderdataPython
3287237
<gh_stars>0 from .command_base import CommandBase from .context_base import ContextBase
StarcoderdataPython
3298404
# Sample response taken from Outlook REST API docs sample_message = { "@odata.context": "https://outlook.office.com/api/v2.0/$metadata#Me/Messages/$entity", "@odata.id": "https://outlook.office.com/api/v2.0/Users('ddfcd489-628b-40d7-" "b48b-57002df800e5@1717622f-1d94-4d0c-9d74-709fad664b77')/Me...
StarcoderdataPython
163628
import distutils.cmd from setuptools import setup, find_packages import setuptools.command.build_py import ib_tws_server.codegen.main import os.path class CodegenCommand(distutils.cmd.Command): def initialize_options(self): pass def finalize_options(self): pass def run(self): dir ...
StarcoderdataPython
78850
<gh_stars>0 """ Comparing ints and strings """ import support if -1 > 'a': raise support.TestError("-1 > 'a'") if not -1 < 'a': raise support.TestError("-1 < 'a'") if 4 > 'a': raise support.TestError("4 > 'a'") if not 4 < 'a': raise support.TestError("4 < 'a'") if -2 > 'a': raise support.TestError...
StarcoderdataPython
1771477
<reponame>saurabh1002/Computer_Vision_Python<filename>TemporalAverage.py from PIL import Image import numpy as np from matplotlib import pyplot as plt from GrayScale import GrayScale from CaptureVideo import CaptureVideo import cv2 def TemporalAverage(video_handle): """ Finds the average pixel values for set o...
StarcoderdataPython
4805792
import pytest from typing import Dict, Any from ml_gym.io.config_parser import YAMLConfigLoader from ml_gym.blueprints.component_factory import Injector import json class TestInjector: @pytest.fixture def example_config(self) -> Dict[str, Any]: return YAMLConfigLoader.load("pytest/blueprints/component...
StarcoderdataPython
88545
import torch import torch.nn as nn from torch.utils.data import DataLoader, Dataset, Subset from torch.cuda import amp import numpy as np import logging import time import os from os import mkdir, listdir, getcwd from os.path import join, exists from copy import deepcopy class EarlyStopping(object): ''' Per...
StarcoderdataPython
1724689
<reponame>Deepaksujay/Readit-Website-OOP-lab-project-<gh_stars>0 from django import forms # class Sign_Up(forms.Form): # name = forms.CharField(max_length = 50,label = '')
StarcoderdataPython
3319603
import data_pre.transform_pool as bio_transform import SimpleITK as sitk import numpy as np class Transform(object): def __init__(self,option, dim=3): self.transform_seq = [] self.dim = dim self.option = option self.patch_size =option[('patch_size',[128, 128, 32], 'patch size')] ...
StarcoderdataPython
140565
import librosa import os import random from cyolo_score_following.utils.data_utils import SAMPLE_RATE from multiprocessing import get_context from pathlib import Path from scipy.signal import convolve # filter some impulse responses that produce a weird distorted sound FILTER_LIST = [ "1a_marble_hall.wav", "...
StarcoderdataPython
1713279
'''dialogs'''
StarcoderdataPython
28157
import os import numpy as np import pytest from spectrum_overload import Spectrum from mingle.utilities.spectrum_utils import load_spectrum, select_observation @pytest.mark.parametrize("fname", ["HD30501-1-mixavg-tellcorr_1.fits", "HD30501-1-mixavg-h2otellcorr_1.fits"]) def test_load_spectrum(fname): fname = os...
StarcoderdataPython
2171
# coding: utf-8 from __future__ import unicode_literals import re from .adobepass import AdobePassIE from ..compat import compat_str from ..utils import ( fix_xml_ampersands, xpath_text, int_or_none, determine_ext, float_or_none, parse_duration, xpath_attr, update_url_query, Extrac...
StarcoderdataPython
3357646
<filename>rainbodl.py import argparse import os import random import stat import sys import tempfile import tweepy import yaml from PIL import Image, ImageColor import ffz class ConfNotValid(Exception): pass def get_conf(): try: with open(conf_file, 'r') as f: return yaml.safe_load(f) ...
StarcoderdataPython
91096
<reponame>jirapoc/mycodes print("Hello Paevee") print("Hello Paevee") print("Hello Paevee")
StarcoderdataPython
1756140
<filename>backups/python-howtos/typing-test/tt_dosomething.py<gh_stars>0 ''' Created on Nov 13, 2019 @author: froske ''' import typing mystring = '''{{"production": {{ "totalCount": {} }} , "test": {{ "totalCount" : {} }} }}'''.format(21, 42...
StarcoderdataPython
157587
# description: scan motifs and get motif sets (co-occurring motifs) back import os import json import h5py import glob import logging from tronn.datalayer import H5DataLoader from tronn.interpretation.inference import run_inference from tronn.util.h5_utils import add_pwm_names_to_h5 from tronn.util.h5_utils import co...
StarcoderdataPython
4820926
<reponame>yifengyou/learn-pagure<filename>src/files/api_key_expire_mail.py #!/usr/bin/env python from __future__ import print_function, absolute_import import os import argparse from datetime import datetime, timedelta from sqlalchemy.exc import SQLAlchemyError import pagure.config import pagure.lib.model as model i...
StarcoderdataPython
1777077
from .extractor import Extractor # noqa: F401 from .transformer import Transformer # noqa: F401 from .loader import Loader # noqa: F401 from .clickhouse_manager import ClickManager # noqa: F401
StarcoderdataPython
1786547
""" The goal of this exercise is to convert a string to a new string where each character in the new string is "(" if that character appears only once in the original string, or ")" if that character appears more than once in the original string. Ignore capitalization when determining if a character is a duplicate. Ex...
StarcoderdataPython
1693205
# Todo replace this with normal python config read from file config = { 'url': 'https://issues.redhat.com', 'username': 'me', 'password': '<PASSWORD>', } config['url'] = 'https://issues.stage.redhat.com'
StarcoderdataPython
1680927
from django.urls import path from . import views urlpatterns = [ path('', views.index, name='home'), path('about/', views.about, name='about'), path('contact/', views.contact, name='contact'), path('privacy/', views.privacy, name='privacy'), path('terms/', views.terms, name='terms'), ]
StarcoderdataPython
129273
<reponame>akrause2014/defoe<gh_stars>10-100 """ Segementation of images for keywords and groups by word. """ from defoe import query_utils from defoe.fmp.query_utils import get_article_matches, segment_image import yaml import os def do_query(archives, config_file=None, logger=None, context=None): """ Crops ...
StarcoderdataPython
187544
#exercicío que cria uma espécie de Menu em um restaurante tecnológico lanche = ['Hamburguer R$ 9,50', 'Hot-Dog R$ 7,00', 'Bauru R$ 25,00', 'Pizza R$ 22,00']; bebida = ['Refrigerante R$ 5,00', 'Suco R$ 6,00', 'MilkShake R$ 8,00'] print ("COMITECH\n") for i in lanche: print (i) print ("\n\nBEBITECH\n") for i in bebida...
StarcoderdataPython
1700372
<reponame>dnouri/cloud-custodian # Copyright 2019 Microsoft Corporation # Copyright The Cloud Custodian Authors. # SPDX-License-Identifier: Apache-2.0 import logging from .azure_common import BaseTest, arm_template from .azure_common import cassette_name from c7n_azure.session import Session from mock import mock, pat...
StarcoderdataPython
137036
<filename>Gen.py<gh_stars>1-10 import os from os import system import httpx from base64 import b64encode from colorama import init, Fore, Style from random import choice from threading import RLock, Thread from time import time, sleep import websocket import base64 from concurrent.futures import ThreadPoolExecutor impo...
StarcoderdataPython
3280279
from __future__ import absolute_import from typing import Callable, TypeVar from returns.interfaces.specific.future import FutureLikeN from returns.primitives.hkt import Kinded, KindN, kinded _FirstType = TypeVar(u'_FirstType') _SecondType = TypeVar(u'_SecondType') _ThirdType = TypeVar(u'_ThirdType') _UpdatedType = T...
StarcoderdataPython
1747713
from .kuo import * from .akyuz import *
StarcoderdataPython
3370911
<gh_stars>1-10 # -*- coding: utf-8 -*- from __future__ import ( absolute_import, division, print_function, unicode_literals, ) from yodapy.utils.creds import set_credentials_file __all__ = ["conn", "creds", "files", "meta", "parser"]
StarcoderdataPython
3212499
<reponame>yvsdrop/UnityPy from enum import IntEnum class SerializedPropertyType(IntEnum): kColor = 0 kVector = 1 kFloat = 2 kRange = 3 kTexture = 4
StarcoderdataPython
1600148
<reponame>coderMaruf/leetcode-1 ''' Description: Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target is not found in the array, return [-1, -1]. Example 1: Inpu...
StarcoderdataPython
96852
<reponame>heolin123/funcrowd import pytest from django.test import Client from modules.achievements.tests.conftest import compare_without_fields from users.models import EndWorker @pytest.mark.django_db def test_ranking_top_view(task_annotations): client = Client() # test basic top ranking response = cl...
StarcoderdataPython
1712058
<filename>yourwaytologin.py #Don't forget to install pygame if you don't have the module you are not going to be able to import it. # --> pip install pygame import pygame pygame.mixer.init() pygame.mixer.music.load("question.mp3") pygame.mixer.music.play(1) def main(): password = "<PASSWORD>" answer = input(...
StarcoderdataPython
83161
<filename>fmcapi/api_objects/object_services/siurlfeeds.py from fmcapi.api_objects.apiclasstemplate import APIClassTemplate import logging class SIUrlFeeds(APIClassTemplate): """ The SIUrlFeeds Object in the FMC. """ VALID_JSON_DATA = [ "id", "name", "type", "checksumU...
StarcoderdataPython
130052
<reponame>Apostolos-Delis/printc<filename>setup.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ setup script for installing printc on a computer """ from distutils.core import setup import printc setup( name='printc', version=printc.__version__, author='<NAME>', author_email='<EMAIL>', desc...
StarcoderdataPython
3255855
<reponame>PythonForChange/NQS from nqs.developer.run import run from nqs.core.kernel import compile from eggdriver.resources.extensions import nqa from eggdriver.resources.console import display, get, sleep from eggdriver.resources.constants import * def developerDisplay(name: str): content = nqa.read(name)...
StarcoderdataPython
154421
from pathlib import Path from typing import Tuple import numpy as np import pandas as pd import torch import torch.nn.functional as F import torchaudio from constants import INPUT_SAMPLE_RATE, TARGET_SAMPLE_RATE from torch.utils.data import DataLoader, Dataset from tqdm import tqdm class SegmentationDataset(Dataset)...
StarcoderdataPython
61262
<reponame>matthias-jaeger-net/coding-sessions<gh_stars>1-10 # Example 1 def setup(): # Set to the same size as the source image # https://unsplash.com/photos/mGy1Jjr2e6M size(900, 600) # Load and display and position the image image(loadImage("file.jpg"), 0, 0)
StarcoderdataPython
1653105
# -*- coding: utf-8 -*- from __future__ import unicode_literals import logging, time from django.utils import timezone from django.db import models from django.contrib.auth.models import User, Group from benchmark.models import Task from sentinel.configurations import alarm_conf, notify_conf logger = logging.getL...
StarcoderdataPython
83069
<reponame>texuf/myantname import index import myname import species
StarcoderdataPython
182849
from tkinter import * from tkinter.font import Font from ttk import * from tkinter.scrolledtext import ScrolledText from tkinter import messagebox import tensorflow as tf import numpy as np import re import seq2seq # preprocessed data import Final_data import data_utils # load data from pickle and npy files metadat...
StarcoderdataPython
1607461
<reponame>mrmotallebi/pytorch_geometric import re import inspect from collections import OrderedDict from typing import Dict, List, Any, Optional, Callable, Set from .typing import parse_types class Inspector(object): def __init__(self, base_class: Any): self.base_class: Any = base_class self.par...
StarcoderdataPython
1678756
<filename>ch10_5_number_writer.py import json numbers=[1,3,5,7,9,11] filename="numbers.json" with open(filename,'w') as f: json.dump(numbers,f)
StarcoderdataPython
3275626
<filename>las/plans.py import time import math import numpy as np from scipy import stats import bluesky.plan_stubs as bps from bluesky.preprocessors import (run_decorator, stage_decorator) import logging #from pswalker.plans import measure_centroid, measure_average, measure #from pswalker.las_plans import point_center...
StarcoderdataPython
1630841
<filename>dn1/trajekt_test.py __author__ = '<NAME> <<EMAIL>>' import unittest from jadrolinija import Trajekt, Vozilo, KolonaVozil class TrajektTest(unittest.TestCase): def test_init(self): t = Trajekt(2000) self.assertEqual(t.stanje, 0) self.assertEqual(t.leva_kolona.max_dolzina, 2000) ...
StarcoderdataPython
3298371
def aumentar(preço, taxa): """ :param preço: Preço normal :param taxa: Taxa que deseja aumentar o valor :return: Total do valor """ resp = preço + (preço * taxa/100) return resp def diminuir(preço, taxa): """ :param preço: Preço normal :param taxa: Taxa que deseja diminuir ...
StarcoderdataPython
150024
from ddexreader import ern382 import pyxb def open_ddex(path): """ Open an XML from a path and parse it into a DDEX data structure. This script automatically finds which ERN version to use. Args: path (str): path to the XML file. Returns: A DDEX data structure. The type depends ...
StarcoderdataPython
3366869
import unittest import random import string from app import * class QueryUnitTests(unittest.TestCase): def test_find_address(self): address = find_address_or_create('1015 Folsom Street', 'San Francisco', 'CA') self.assertTrue(address) self.assertEqual(address.name, '1015 Folsom Street') ...
StarcoderdataPython
3338732
import math while True: try: n = int(input()) print(str(int(math.log2(n) + 1))) except EOFError: break
StarcoderdataPython
4800689
from django.db import models from apps.registro.models.Departamento import Departamento class Localidad(models.Model): departamento = models.ForeignKey(Departamento) nombre = models.CharField(max_length=50) class Meta: app_label = 'registro' ordering = ['nombre'] unique_together =...
StarcoderdataPython
164815
<reponame>cahirwpz/python-amidev #!/usr/bin/env python3 import logging import sys from amidev.binfmt import ar def main(): logging.basicConfig() for path in sys.argv[1:]: print('%s:' % path) for num, entry in enumerate(ar.ReadFile(path), start=1): print('%5d:' % num, entry.name,...
StarcoderdataPython
1638887
<filename>tabular_benchmarks/nas_cifar10.py<gh_stars>0 import os import ConfigSpace import numpy as np from nasbench import api from nasbench.lib import graph_util MAX_EDGES = 9 VERTICES = 7 class NASCifar10(object): def __init__(self, data_dir): self.dataset = api.NASBench(os.path.join(data_dir, 'nas...
StarcoderdataPython
3213636
<filename>manipulator_learning/learning/utils/tf/general.py """ Various utilities that don't fit under other headers. """ import tensorflow as tf import numpy as np import random def set_training_seed(s): tf.random.set_seed(s) np.random.seed(s) random.seed(s) print("Random seed for tf, np, and random ...
StarcoderdataPython
1756489
<gh_stars>10-100 # coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** from enum import Enum __all__ = [ 'ScanConfigTargetPlatformsItem', 'ScanConfigUserAgent', 'ScanRunExecutionState', 'S...
StarcoderdataPython
3387598
def bonoantiguedad(): #definir variables bonoA=100 #datos de entrada añosX=int(input("ingrese su antiguedad:")) #proceso if añosX==1: montoB=bonoA elif añosX==2: montoB=bonoA*2 elif añosX==3: montoB=bonoA*4 elif añosX==4: montoB=bonoA*7 elif añosX>=5: montoB=bonoA*10 #datos de ...
StarcoderdataPython
1619571
<reponame>traitor6789/osm-tile-server #! /usr/bin/env python # # # Brute-force dump of single row from WKT Raster table as GeoTIFF. # This utility is handy for debugging purposes. # # WARNING: Tha main purpose of this program is to test and # debug WKT Raster implementation. It is NOT supposed to be an # efficient perf...
StarcoderdataPython
4817577
<filename>ZillowTransform.py # -*- coding: utf-8 -*- """ Created on Mon Apr 2 21:44:35 2018 @author: Wilson """ import csv #import urllib class MedianRent: zipcode = "" year = 0 month = 0 mrent = 0.0 sizerank = 0 fileLst = ["", "Zip_MedianListingPrice_AllHomes...
StarcoderdataPython
4823204
<gh_stars>1-10 """ Creating a simple GUI to scriptify VBA """ from gooey import Gooey, GooeyParser import time from core.pull_vba import create_vba_projects @Gooey(dump_build_config=True, program_name="Scriptify Excel VBA files") def main(): desc = "Convert VBA scripts embedded in Excels into folder structure" ...
StarcoderdataPython
1780510
# --- Usage and testing BIP39 --- if __name__ == "__main__": import os.path import json from btc.bip39 import BIP39 bip39 = BIP39( os.path.join(os.path.dirname(os.path.realpath(__file__)), 'english.txt') ) # Check the right values in vectors.json test_vectors...
StarcoderdataPython
3386293
<gh_stars>0 from PyQt5 import QtCore, QtWidgets, QtGui from utils import configs class card(): def __init__(self, rank, suit): self.rank = rank self.suit = suit def display(self, layout): label = QtWidgets.QLabel() if self.rank == '?' and self.suit == '?': path = '....
StarcoderdataPython
165593
<reponame>steinermg/ion-functions<gh_stars>1-10 #!/usr/bin/env python """ @package ion_functions.data.obs_functions @file ion_functions/data/obs_functions.py @author <NAME> @brief Module containing Ocean Bottom Seismometer instrument related functions """ import numexpr as ne def obs_bb_ground_velocity(raw, gain=3.2,...
StarcoderdataPython
3306635
<reponame>rahulgupta9202/ColossalAI<filename>colossalai/communication/p2p.py #!/usr/bin/env python # -*- encoding: utf-8 -*- import torch import torch.distributed as dist from colossalai.context.parallel_mode import ParallelMode from colossalai.core import global_context as gpc from colossalai.utils import get_curren...
StarcoderdataPython
165698
from common import * from data import * DATA_DIR = '/root/share/project/kaggle/2019/chest/data' class XrayDataset(Dataset): def __init__(self, split, csv, folder, mode, augment=None,): self.split = split self.csv = csv self.folder = folder self.mode = mode self.augment = ...
StarcoderdataPython
4818416
<gh_stars>1-10 # Generated by Django 2.1.7 on 2019-04-14 18:32 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ('fadderanmalan', '0015_auto_20190414_0856'), ] operations = [ migrations.Crea...
StarcoderdataPython
70600
__author__ = 'jers'
StarcoderdataPython
179
<filename>syntax/func.py # code.... a = 1 b = 2 c = 3 s = a+b+c r = s/3 print(r) # code.... ''' def average(): a=1 b=2 c=3 s=a+b+c r=s/3 print(r) average() ''' ''' #input #parameter #argument def average(a,b,c): s=a+b+c r=s/3 print(r) average(10,20,30) ''' def average(a, b, c): ...
StarcoderdataPython
1730940
<reponame>ludovicurbain/SWIFT-RIDE # Copyright 2008-2015 Nokia Networks # Copyright 2016- Robot Framework Foundation # # 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://w...
StarcoderdataPython
1772235
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # from ._utils import _C from maskrcnn_benchmark import _C soft_nms = _C.soft_nms # soft_nms.__doc__ = """ # This function performs Soft Non-maximum suppresion (https://arxiv.org/abs/1704.04503)"""
StarcoderdataPython
3362081
# Lint as: python3 # Copyright 2020 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
StarcoderdataPython
173618
from __future__ import absolute_import, print_function import os from unittest import skipIf, TestCase from click.testing import CliRunner from kms_vault.scripts.kms_vault import cli from .utils import not_live class TestKMSCommands(TestCase): def setUp(self): self.runner = CliRunner() @skipIf(not_...
StarcoderdataPython
4836691
<filename>finder.py import ConfigParser import os import logging import fw_logging import sys import shelve def finder(hostname,target): #set up logging name = 'finder' logger = fw_logging.getLogger(logging.DEBUG,name,hostname,target) #Parse out config file config = ConfigParser.Conf...
StarcoderdataPython
3330443
import cv2 cap = cv2.VideoCapture('/dev/video10') width = 1280 ret = cap.set(3, width) height = 720 ret = cap.set(4, height) fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v') out = cv2.VideoWriter('out.mp4', fourcc, 20, (width, height)) while cap.isOpened(): ret, frame = cap.read() if ret is True: ou...
StarcoderdataPython
18318
from django.contrib import admin from lms_app.models import Professor admin.site.register(Professor) # Register your models here.
StarcoderdataPython
174855
<filename>vindauga/widgets/gauge.py<gh_stars>1-10 # -*- coding: utf-8 -*- from vindauga.constants.option_flags import ofFramed from vindauga.misc.util import clamp from .param_text import ParamText class Gauge(ParamText): FILL_CHAR = '█' BACK_CHAR = ' ' # Partial 1/8 fills FILL_CHARS = '▏▎▍▌▋▊▉' ...
StarcoderdataPython
30374
<reponame>jcchin/Hyperloop_v2<filename>src/hyperloop/Python/tests/test_magnetic_drag.py """ Test for magnetic_drag.py. Uses test values and outputs given by the laminated sheet experiment in [1]. """ import pytest from hyperloop.Python.pod.magnetic_levitation.magnetic_drag import MagDrag import numpy as np from openmd...
StarcoderdataPython
3270846
import random import sympy as sp class Particle: def __init__( self, func, x0: list, aCognitive: float = 2, aSocial: float = 2, inertia: float = 0.1, dataset=None, ): # DEBUG self.coordinatesX = [] self.coordinatesY = [] s...
StarcoderdataPython
3273755
<gh_stars>0 # -*- coding: utf-8 -*- class RawDataHandler(): def __init__(self): # input self.msExperiment = None self.chromatogram_map = None self.trafo = None self.swath = None # output self.featureMap = None self.meta_data = {"sample_name": "", "fil...
StarcoderdataPython
44574
# Copyright (c) 2022, alantechnologies and Contributors # See license.txt # import frappe import unittest class TestChickenCoPacking(unittest.TestCase): pass
StarcoderdataPython
166057
<filename>bnutils.py import torch def freeze_weights(model): for name, module in model._modules.items(): if isinstance(module, (torch.nn.Conv2d, torch.nn.Linear)): module.weight.requires_grad = False model._modules[name] = module if len(list(module.children())) > 0:...
StarcoderdataPython
1644330
<filename>homework-01.3.py from math import sqrt x1, y1 = [int(n) for n in input("Введите координаты вершины A через запятую: ").split(',')] x2, y2 = [int(n) for n in input("Введите координаты вершины B через запятую: ").split(',')] x3, y3 = [int(n) for n in input("Введите координаты вершины C через запятую: ").spli...
StarcoderdataPython
71723
import numpy as np import math from ..miniworld import MiniWorldEnv, Room from ..entity import Box from ..params import DEFAULT_PARAMS from gym import spaces class OneRoom(MiniWorldEnv): """ Environment in which the goal is to go to a red box placed randomly in one big room. """ def __init__(self,...
StarcoderdataPython
79355
<reponame>Saknowman/django-rest-todo-api<gh_stars>1-10 # Generated by Django 2.2.6 on 2019-11-04 03:25 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappab...
StarcoderdataPython
3224597
<gh_stars>1-10 import datetime as dt import decimal import json class JsonEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, dt.datetime): return str(obj) if isinstance(obj, decimal.Decimal): obj_str = str(obj) if "." in obj_str: ...
StarcoderdataPython
1665839
import sys import os import pickle import cv2 import numpy as np CAFFE_PYTHON_PATH = os.path.join(os.path.dirname(__file__), "../python") sys.path.insert(0, CAFFE_PYTHON_PATH) import caffe from Dataset import GetDataset from ACT_utils import * from copy import deepcopy K = 6 IMGSIZE = 300 MEAN = np.array([[[104, 117...
StarcoderdataPython
3376019
<filename>data/preprocess_data.py<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Prior to this script, archives files from the Ist-Daten from the SBB (Swiss Federal Rails) need to be downloaded. The data is described here in german : https://opentransportdata.swiss/dataset/istdaten The archived files can...
StarcoderdataPython
3251799
<gh_stars>1-10 import sys import socket import requests from datetime import datetime import netifaces # ip foundation #netifaces.ifaddresses('wlp3s0') #ipp = netifaces.ifaddresses('wlp3s0')[netifaces.AF_INET][0]['addr'] ipp = requests.get('https://api.ipify.org').text target=ipp # Define our tergat manually if we...
StarcoderdataPython