id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3370778
#---------------------------------------------------------------------------------- # Microsoft Developer & Platform Evangelism # # Copyright (c) Microsoft Corporation. All rights reserved. # # THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, # EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT...
StarcoderdataPython
3353062
<filename>predict.py #!/usr/bin/env python # Use existing model to predict sql from tables and questions. # # For example, you can get a pretrained model from https://github.com/naver/sqlova/releases: # https://github.com/naver/sqlova/releases/download/SQLova-parameters/model_bert_best.pt # https://github.com/na...
StarcoderdataPython
193511
#!/usr/bin/env python """Parse various Windows persistence mechanisms into PersistenceFiles.""" import re from grr.lib import artifact_lib from grr.lib import parsers from grr.lib import rdfvalue from grr.lib import utils class WindowsPersistenceMechanismsParser(parsers.ArtifactFilesParser): """Turn various persi...
StarcoderdataPython
1648948
<filename>djangomom/app/forms.py<gh_stars>0 from django import forms from .models import App from .utils import validate_name class AppForm(forms.ModelForm): class Meta: model = App fields = "__all__" def __init__(self, *args, **kwargs): from django.forms.widgets import HiddenInput ...
StarcoderdataPython
29789
<reponame>golly-splorts/golly-maps import os import unittest from golly_maps.patterns import ( get_patterns, get_pattern, get_pattern_size, get_grid_pattern, pattern_union, ) HERE = os.path.split(os.path.abspath(__file__))[0] ALL_PATTERNS = [ "78p70", "acorn", "airforce", "backrak...
StarcoderdataPython
18051
# Desafio 61 Curso em Video Python # By Rafabr from estrutura_modelo import cabecalho, rodape cabecalho(61, "Termos de uma Progressão Aritmética - II") while True: try: p0 = float(input('Digite o Termo inicial da PA: ')) r = float(input('Digite a razão da PA: ')) except ValueError: pr...
StarcoderdataPython
22641
<reponame>fulkgl/Flask_edu_1 #!/usr/bin/env python3 # coding: UTF-8 '''! module description @author <A href="email:<EMAIL>"><NAME></A> ''' __version__ = 0.01 def main(): '''! main description ''' print("Hello world") return 0 if __name__ == "__main__": # command line entry point main() ...
StarcoderdataPython
3317369
#!/usr/bin/env python import os, sys sys.path.insert(0, os.path.join('build', 'pymake2')) from pymake2 import * from pymake2.template.latex import pdflatex from pymake2.template.util import fswatcher @target(conf=pdflatex.conf) @depends_on('compile') def publish(conf): run_program('scp', [ 'bin/thesis.pdf', 'ph...
StarcoderdataPython
190211
# 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 u...
StarcoderdataPython
3266560
from __future__ import print_function from reader.parseStateProtoFile import * from .codegenbase import * import string class JavascriptVisitor (CodeGenVisitor): def __init__(self, parsedModel): CodeGenVisitor.__init__(self, parsedModel) def getAction(self, action): if action == None: ...
StarcoderdataPython
5735
<filename>Applications/FlaskApp/errorpages.py from flask import render_template # Error Pages ---------------------------------------------------------------- def page_not_found(e): # note that we set the 404 status explicitly return render_template('404.html.j2'), 404 def page_not_allowed(e): # note tha...
StarcoderdataPython
122522
<reponame>sebaacuna/bigcommerce-api-python<gh_stars>0 from .base import * class Orders(ListableApiResource, CreateableApiResource, UpdateableApiResource, DeleteableApiResource): resource_name = 'orders' def coupons(self, id=None): if id: return OrderCoupons.get(self.id, id, connection=sel...
StarcoderdataPython
4805008
<reponame>Barchid/lava-dl-lightning<gh_stars>1-10 import torch import torch.nn as nn import numpy as np class EventCounter(object): def __init__(self, net: nn.Module) -> None: if not hasattr(net, 'blocks'): raise ValueError( 'Network module has no "blocks" attribute containing...
StarcoderdataPython
70178
<filename>tests/test_labelhash.py # # This file is part of khmer, http://github.com/ged-lab/khmer/, and is # Copyright (C) Michigan State University, 2009-2013. It is licensed under # the three-clause BSD license; see doc/LICENSE.txt. # Contact: <EMAIL> # # pylint: disable=missing-docstring,protected-access import khme...
StarcoderdataPython
1663210
<filename>test_fibonacci_series.py import unittest from fibonacci_series import generate_fibonacci_series class FibonacciSeriesTest(unittest.TestCase): def test_fibonacci_nth_term_is_positive(self): self.assertRaises(ValueError, generate_fibonacci_series, -2) def test_fibonacci_returns_list_...
StarcoderdataPython
3245744
<reponame>delldu/Create """Model trainning & validating.""" # coding=utf-8 # # /************************************************************************************ # *** # *** Copyright {{create "author"}} {{create "date +%Y"}}, All Rights Reserved. # *** # *** File Author: {{ create "author" }}, {{ bash "date"...
StarcoderdataPython
3204318
import unittest from test.helpers import get_general_wrapper class Rule15Test(unittest.TestCase): def test_rule15_one_new_lines(self): context = """ FROM registry.a.com/acme/centos:7 LABEL maintainer="foo <<EMAIL>>" """ wrapper = get_general_wrapper(context) wrapp...
StarcoderdataPython
4840447
<filename>polog/forbid.py from polog.core.stores.registering_functions import RegisteringFunctions def logging_is_forbidden(func): """ Декоратор, запрещающий логирование функции. Запрет достигается через внесение id функции в реестр функций, который запрещено декорировать, через класс RegisteringFunctions. ...
StarcoderdataPython
3258987
<gh_stars>1-10 """ This module takes csv files containing DHS data extracted from SPSS datasets (in turn downloaded from the DHSProgram website), computes a range of health-related metrics, and aggregates the data at the highest possible administrative level (i.e. level 4). """ import pandas as pd import numpy as np ...
StarcoderdataPython
4835937
<reponame>visdata/UrbanMotionAnalysis #!/usr/bin/env python # -*- coding: utf-8 -*- # # Input Data Format # [clusterID, lng, lat, gid, gLng, gLat, from/to, speed, direction] # # Output Data Format # [gLng, gLat, gdirStr, speed, recordNum, dLng, dLat, seg] import os import math from math import sqrt, pow, acos, pi, c...
StarcoderdataPython
3320068
import testflows.settings as settings from testflows.core import * @TestStep(Given) def instrument_clickhouse_server_log(self, node=None, test=None, clickhouse_server_log="/var/log/clickhouse-server/clickhouse-server.log"): """Instrument clickhouse-server.log for the current test (default) by adding st...
StarcoderdataPython
3304049
<gh_stars>1-10 from .fmix import fmix from .mixup_input import cutmix, mixup, resizemix, saliencymix, smoothmix from .mixup_saliency import attentivemix, puzzlemix __all__ = [ 'cutmix', 'fmix', 'mixup', 'resizemix', 'saliencymix', 'smoothmix', 'attentivemix', 'puzzlemix', ]
StarcoderdataPython
1704378
<filename>tests/test_dataframe_mapper.py<gh_stars>1-10 import pytest from pkg_resources import parse_version # In py3, mock is included with the unittest standard library # In py2, it's a separate package try: from unittest.mock import Mock except ImportError: from mock import Mock from pandas import DataFram...
StarcoderdataPython
1689368
# from flask import Flask, jsonify, request # # # app = Flask(__name__) # # shoppinglist = [{ # "name_snacks": ["chocolates", ",ice cream", "chips"], # "qty_each": [5, "1L", 2] # }, # { # "name_veggies": ["potato", "onion", "chillies"], # "qty_each": ["2Kgs", "4Kgs", "300g"] # } # ] # # ...
StarcoderdataPython
3216009
# Copyright (c) 2022, <NAME> and Contributors # See license.txt # import frappe import unittest class TestLibraryMember(unittest.TestCase): pass
StarcoderdataPython
1659586
<gh_stars>1-10 """Unit test package for notificationapi_python_server_sdk."""
StarcoderdataPython
68189
<reponame>ZaiwangLi/SA-SSD import torch import torch.nn as nn import logging from mmcv.runner import load_checkpoint from .base import BaseDetector from .test_mixins import RPNTestMixin, BBoxTestMixin, MaskTestMixin from .. import builder from mmdet.core import (assign_and_sample, bbox2roi, rbbox2roi, bbox2result, mult...
StarcoderdataPython
1679349
<reponame>ISCAS-VDI/designate-base<gh_stars>0 # Copyright 2015 Hewlett-Packard Development Company, L.P. # # Author: <NAME> <<EMAIL>> # # 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
1693817
"""Test config file""" import yaml from bmi_topography import Topography CONFIG_FILE = "config.yaml" DEM_TYPE = "SRTMGL3" OUTPUT_FORMAT = "GTiff" def test_read_config(shared_datadir): with open(shared_datadir / CONFIG_FILE, "r") as fp: conf = yaml.safe_load(fp).get("bmi-topography", {}) assert conf[...
StarcoderdataPython
3274417
# https://app.codesignal.com/arcade/code-arcade/mirror-lake/BLbGNY3kEcvKjBCFC def numberOfClans(divisors, k): # A set of "hashes" of states found of numbers that determine the clan. # The hash will be a string "0,1,1,0..." depending on whether a number # is divided or not by the divisors in that same positi...
StarcoderdataPython
3245350
import os as _os def get_env(var_name, required=True): val = _os.getenv(var_name) if required: assert val is not None, \ "%s environment variable not found." % var_name return val if val is not None else ""
StarcoderdataPython
3329681
import json, re, logging, traceback, jieba, zlib, binascii, math import numpy as np from utils import clean_query, is_name, normal_qeury, n_gram_words, is_alphabet_string, SPECIAL_WORDS from seg_utils import Tokenizer t = Tokenizer() def get_info(origi_dict, key, *args, flag=False): res = [] try: ...
StarcoderdataPython
1718352
<reponame>Ekalaivanpj/codechef<gh_stars>1-10 n=int(input()) arr=[int(input()) for _ in range(n)] s=0 arr.sort() for i in range(n): s=max(s,arr[i]*(n-i)) print(s)
StarcoderdataPython
41266
<gh_stars>0 # Copyright (c) 2010-2011 Lazy 8 Studios, LLC. # All rights reserved. import re from front import Constants from front.lib import gametime, db from front.backend import notifications from front.tests import base from front.tests.base import points, rects, SIX_HOURS class TestLureAlerts(base.TestCase): ...
StarcoderdataPython
135643
<reponame>TwinIsland/CTD #encoding:utf-8 import os import pickle root = 'data' files = [] data = [] for parent,dirnames,filenames in os.walk(root): if dirnames == []: for i in filenames: print(parent + '\\' + i) files.append([i,parent]) # [file name,file addr n...
StarcoderdataPython
1614634
<gh_stars>100-1000 import simpy import threading import time import struct from wireless.services.trex_wireless_device_service import WirelessDeviceService from wireless.utils.utils import SynchronizedStore from scapy.contrib.capwap import CAPWAP_PKTS, capwap_result_codes class APService(WirelessDeviceService): "...
StarcoderdataPython
71737
<reponame>SkygearIO/py-skygear # Copyright 2015 Oursky Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
StarcoderdataPython
1766289
<reponame>hackkosice/registration from django.contrib import admin # Register your models here. from organizers import models class CommentAdmin(admin.ModelAdmin): list_display = ('application', 'author', 'text') list_per_page = 200 actions = ['delete_selected', ] date_hierarchy = 'created_at' clas...
StarcoderdataPython
3241139
#coding=utf-8 import tensorflow as tf from tensorflow.contrib import rnn from tensorflow.contrib import layers import numpy as np def length(sequence): used = tf.sign(tf.reduce_max( tf.abs(sequence), reduction_indices=2)) seq_len = tf.reduce_sum(used,reduction_indices=1) # 即每个句子的单词个数 return tf.cast(seq_l...
StarcoderdataPython
156285
# ---------------------------------------------- ML 20/04/2020 -----------------------------------------------------# # # Generate a sample of EV sessions data. # This file can be used to generate the sample of a data using the saved SDG model. # - User can choose between a default train...
StarcoderdataPython
3346891
from __future__ import print_function, absolute_import import torch.utils.data as data import os import numpy as np import cv2 class CCPD(data.Dataset): def __init__(self, config, is_train=True): self.root = config.DATASET.ROOT self.is_train = is_train self.inp_h = config.MODEL.IMAGE_SIZE....
StarcoderdataPython
1650880
<filename>tests/unit/core/compat_tests.py # -*- coding: utf-8 -*- import datetime from six.moves import cStringIO from django.test import TestCase from oscar.core.compat import UnicodeCSVWriter class TestUnicodeCSVWriter(TestCase): def test_can_write_different_values(self): writer = UnicodeCSVWriter(op...
StarcoderdataPython
3344420
<reponame>sumaxime/LIFAP1<filename>TD/TD2/Code/Python/7.py #!/usr/bin/python # Calculer les racines rééles d'un polymer du second degré from math import sqrt print('Donne moi trois entiers, un par un : ', end='') a = float(input()) b = float(input()) c = float(input()) d = b * b - 4 * a * c if d < 0: print('Pas ...
StarcoderdataPython
1600504
from algoritmia.datastructures.mergefindsets.naivemergefindset import NaiveMergeFindSet class PathCompressionMFset(NaiveMergeFindSet): #[path def __init__(self, sets: "Iterable<Iterable<T>>"=[], ** kw): super().__init__(sets, **kw) def find(self, x: "T"): r = x while r ...
StarcoderdataPython
90510
class View(dict): """A View contains the content displayed in the main window.""" def __init__(self, d=None): """ View constructor. Keyword arguments: d=None: Initial keys and values to initialize the view with. Regardless of the value of d, keys 'songs', 'artists' an...
StarcoderdataPython
3210597
# Copyright (c) 2017, Intel Research and Development Ireland Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
StarcoderdataPython
3232640
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
StarcoderdataPython
3296050
<gh_stars>10-100 import argparse import tools.find_mxnet import sys #sys.path.insert(0, "/home/fred/git//flexiv_sw/3rdparty//mxnet/python") import mxnet as mx import os import numpy as np from detect_recon.detector import Detector from symbol.symbol_factory import get_symbol import yaml import random import pickle fro...
StarcoderdataPython
3327903
<filename>data/sights_and_scopes.py import json import sys import os from decimal import Decimal from helpers import resource_path SIGHTS = {} SCOPES = {} sights_filename = resource_path("sights.json") scopes_filename = resource_path("scopes.json") if os.path.exists(sights_filename): with open(sights_filename, '...
StarcoderdataPython
1772640
import json import boto3 import os REGION_NAME = os.environ.get('region_id') dynamodb_resource = boto3.resource('dynamodb',region_name=REGION_NAME) def lambda_handler(event, context): try: table = dynamodb_resource.Table('CurrentPortfolioRows') scan = table.scan(ConsistentRead=True) except E...
StarcoderdataPython
13320
<filename>UI/test/ui_test.py import pygame_gui import pygame class colors: black = "#000000" dimgrey = "#696969" # lmao darkslategray = "#2F4F4F" TITLE = "TUNAPRO1234" BACKGROUND = colors.darkslategray WIDTH, HEIGHT = 1920, 1080 """ Hızlıca bir plan yapacağım Neural ağları kontrol edebileceğimiz küçü...
StarcoderdataPython
3286580
<gh_stars>0 # 计算工作路径 import sys import os curPath = os.path.abspath(os.path.dirname(__file__)) # print('Current path: '+curPath) rootPath = os.path.split(curPath)[0] rootPath = os.path.split(rootPath)[0] # print('Root path: '+rootPath) sys.path.append(rootPath) dataPath = os.path.split(rootPath)[0] dataPath = os.path....
StarcoderdataPython
3220256
<filename>my/fbmessenger/__init__.py<gh_stars>10-100 """ This is here temporarily, for backwards compatibility purposes It should be removed in the future, and you should replace any imports like: from my.fbmessenger import ... to: from my.fbmessenger.export import ... since that allows for easier overriding using name...
StarcoderdataPython
4829642
#!/usr/bin/env python3 # # Copyright (c) 2016-2020 Intel Corporation # # 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
1725760
''' Modify string ''' # Modify string value mod_str = 'Original string' mod_str = 'Modify string' print(mod_str) # Temprary replace string value rep_str = "Replace str value" print(rep_str.replace('str', 'string'))
StarcoderdataPython
62887
import argparse import ast class PrintStatementParser(ast.NodeVisitor): def __init__(self): self.print_nodes = [] def visit_Call(self, node): if not isinstance(node.func, ast.Name): return if node.func.id != 'print': return self.print_nodes.append(nod...
StarcoderdataPython
4827855
"""Utilities for processing raw json exports. """ import json import pandas as pd from src import utils def extract_results(raw): """Extract results from raw data JSON. Args: raw (list): Pages of raw elections JSON. Returns: list: Results extracted from all pages. """ results = [...
StarcoderdataPython
119384
#program to find files and skip directories of a given directory. import os print([f for f in os.listdir('/home/students') if os.path.isfile(os.path.join('/home/students', f))])
StarcoderdataPython
4811267
from django.contrib import admin admin.site.index_title = "Home"
StarcoderdataPython
115732
# Generated by Django 2.0.6 on 2018-06-03 04:49 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('main', '0004_auto_20180601_2005'), ] operations = [ migrations.AlterField( model_name='sharednotebook', name='create...
StarcoderdataPython
134876
from .internal_data import BaseInternalDataStorage, SqliteInternalDataStorage from .presence import BasePresenceStorage, SqlitePresenceStorage from .room_events import BaseEventStorage, SqliteEventStorage from .storage import StorageRepo
StarcoderdataPython
36012
<gh_stars>0 #!/usr/bin/env python3 """ Description: pyBirdcagebuilder is a program that calculates ideal capacitor values for birdcage coil designs. This program is based on the original Birdcage Builder program provided by PennState Health. (https://research.med.psu.edu/departments/center-for-nmr-research/sof...
StarcoderdataPython
3334531
<filename>nerodia/__init__.py from . import consumers, config, decorators, pollers, twitch __all__ = ["consumers", "config", "decorators", "pollers", "twitch"]
StarcoderdataPython
180451
__author__ = "<NAME>" __copyright__ = "Carnegie Mellon University" __license__ = "MIT" __maintainer__ = ["<NAME>", "<NAME>"] __credits__ = ["<NAME>", "<NAME>", "<NAME>"] __email__ = ["<EMAIL>", "<EMAIL>"] __status__ = "Production" import tempfile import os import random import string template_file = "rtfm.txt" templat...
StarcoderdataPython
124937
import unittest from unittest import mock from fate_of_dice.common.dice import Dice class TestDice(unittest.TestCase): def test_value(self): value: int = 20 dice = Dice(value) self.assertEqual(dice.value, value) self.assertEqual(int(dice), value) self.assertEqual(str(dic...
StarcoderdataPython
169836
<filename>instapp/migrations/0006_auto_20201122_1355.py # Generated by Django 3.1.3 on 2020-11-22 13:55 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('instapp', '0005_auto_20201122_1350'), ] operations = [ migrations.AlterField( ...
StarcoderdataPython
3291346
""" SALTS XBMC Addon Copyright (C) 2014 tknorris This program 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 option) any later version. T...
StarcoderdataPython
1756581
<gh_stars>1-10 import logging import sys import django.core.management.base class Command(django.core.management.base.BaseCommand): help = 'Print python logging configuration' def handle(self, **options): try: import logging_tree except ImportError as ie: raise djang...
StarcoderdataPython
1718888
<reponame>Farhan-hyd/CodingPractice<filename>ai/bfs.py<gh_stars>0 graph = { '0':['1','2','3'], '1':['4'], '2':[], '3':['5','6'], '4':[], '5':[], '6':[] } visited = [] # List for visited nodes. queue = [] # Initialize a queue source_node = '0' # Source node def bfs(visited, graph, node)...
StarcoderdataPython
122420
<gh_stars>1-10 def addFeatureDataStruc(data): data['LenCarName']=data['car name'].apply(lambda x: len(x.split())) newFeat=[ 'cylinders', 'displacement', 'horsepower', 'weight','acceleration','lrScore','LenCarName'] return data[newFeat],data[['mpg']]
StarcoderdataPython
1610588
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-10-29 13:28 from __future__ import unicode_literals import django.contrib.postgres.fields.jsonb from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('glue2_db', '0005_auto_20171027_2235'), ] ...
StarcoderdataPython
1787947
"""Hackerrank Problem: https://www.hackerrank.com/challenges/np-polynomials/problem Task You are given the coefficients of a polynomial P. Your task is to find the value of P at point x. """ import numpy P = numpy.array(list(map(float, input().split(' ')))) x = int(input()) print(numpy.polyval(P, x))
StarcoderdataPython
3218736
from copy import deepcopy from datetime import datetime, date from json import load as json_in_str from os.path import isfile, exists, join as path_join from random import choice from string import digits, ascii_letters from typing import Any, Type, Union from unittest import TestCase from marshmallow import Schema fr...
StarcoderdataPython
4803817
from collections import defaultdict import re import discord class Version: def __init__(self, bot, version, lines): self.bot = bot self.version = version self.lines = [x for x in lines.splitlines() if x] self.fields = defaultdict(str) self.description = '' self.p...
StarcoderdataPython
1767840
<reponame>valeriansaliou/waaave-web from django import template register = template.Library() def class_tag(context, pattern, class_value): """ Return the provided class tag """ import re if re.search(pattern, context['request'].path): return class_value return '' @register.simple_t...
StarcoderdataPython
1791061
<reponame>BApplB/rocket-nozzle-tools<filename>plot.py<gh_stars>1-10 #rocket-nozzle-tools __author__ = "<NAME>" __email__ = "<EMAIL>","<EMAIL>" __copyright__ = "Copyright 2019, <NAME>" from numpy import array from matplotlib import pyplot as plt def plotGraph(coordinates): data = array(coordinates) x,y = data....
StarcoderdataPython
150745
<filename>save/save.py #!/usr/bin/env python """Save sensor data.""" import os import sys import json from time import time import requests try: import redis legacy = True except ImportError: legacy = False headers = { 'Authorization': 'bearer {}'.format(os.environ['FARMWARE_TOKEN']), 'con...
StarcoderdataPython
60506
#!/usr/bin/python3 # -*- coding: utf-8 -*- # @Time : 2019/5/18 10:20 # @Author : chensw、wangwei # @File : model_fusion.py # @Describe: 标明文件实现的功能 # @Modify : 修改的地方 import pandas as pd # Step3:模型投票融合 # 读取5个模型输出的预测概率文件 predict_1_4 = pd.read_csv('../data/output/predict/prediction_1_4.csv') predict_2...
StarcoderdataPython
3281341
<gh_stars>1-10 from math import pi def area(radius: float) -> float: return pi * radius ** 2 def circumference(radius: float) -> float: return 2 * pi * radius async def home(): """Return webpage with area and circumference presented. Should have a form with an input for a measurement and a me...
StarcoderdataPython
3361534
from kivy.app import App from kivy.lang import Builder from kivy.core.window import Window import biskivy Window.size = (500, 500) Window.clearcolor = (.22, .22, .22, 1) root = Builder.load_string(""" FloatLayout: BoxLayout: orientation: "vertical" spacing: 5 size_hint: .5, None h...
StarcoderdataPython
160584
#!/usr/bin/env python import logging import sys from pathlib import Path from typing import Dict, Iterator, Optional, Tuple, Union import fire from benchmarker.cli.l5.common.utils import save_t5_kleister_cache from benchmarker.data.model.feature import Feature from benchmarker.data.reader import Corpus, qa_strategies...
StarcoderdataPython
186342
<filename>seed_noid/sort.py #! /usr/bin/env python # -*- coding: utf-8 -*- from os import name, wait import rospy import math import copy from rospy.impl.tcpros_service import wait_for_service import tf import moveit_commander import moveit_msgs.msg from std_msgs.msg import * from geometry_msgs.msg import Quaternion, ...
StarcoderdataPython
150019
<filename>todoapi/migrations/0017_note.py # Generated by Django 2.2.7 on 2020-02-17 19:28 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('todoapi', '0016_auto_20200217_2022'), ] operations = [ migrations.CreateModel( ...
StarcoderdataPython
3378723
<filename>tests/test_timeunits.py from gopro_overlay.timeunits import timeunits def test_simple_timeunits(): assert timeunits(seconds=1) == timeunits(seconds=1) assert timeunits(millis=1) == timeunits(millis=1) assert timeunits(micros=1) == timeunits(micros=1) def test_conversions(): assert timeunit...
StarcoderdataPython
1773563
<filename>app/courses/admin.py from django.contrib import admin from .models import Course, Lesson class LessonsInline(admin.TabularInline): model = Lesson @admin.register(Course) class CourseAdmin(admin.ModelAdmin): save_on_top = True inlines = LessonsInline, list_display = 'name', 'tutor' fi...
StarcoderdataPython
1695137
<filename>tests/snapshots/snap_test_holidata/test_holidata_produces_holidays_for_locale_and_year[hr_HR-2021] 1.py [ { 'date': '2021-01-01', 'description': 'Nova Godina', 'locale': 'hr-HR', 'notes': '', 'region': '', 'type': 'NF' }, { 'date': '2021-01-0...
StarcoderdataPython
1786118
<filename>src/optimModels/optimization/evolutionary_computation.py from random import Random from multiprocessing import cpu_count from inspyred import ec from optimModels.optimization import evaluators, generators, replacers, variators, observers from optimModels.utils.constantes import optimType class EAConfigurati...
StarcoderdataPython
3305231
<gh_stars>0 from __future__ import print_function import qt import shutil import sys import os import time import progressbar from constants import * import numpy as np znb = qt.instruments.create('ZNB20', 'RhodeSchwartz_ZNB20', address=ZNB20_ADDRESS, reset=True) znb.set_external_reference(True) znb.se...
StarcoderdataPython
151554
<reponame>alibaba/Elastic-Federated-Learning-Solution<gh_stars>10-100 # Copyright 2021 Alibaba Group Holding 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 # # ...
StarcoderdataPython
3375796
<reponame>ptrouillard/piwork import RPi.GPIO as GPIO import datetime from time import sleep # Definition des pins M1_En = 21 M1_In1 = 20 M1_In2 = 16 # Creation d'une liste des pins pour chaque moteur pour compacter la suite du code Pins = [[M1_En, M1_In1, M1_In2]] # Setup GPIO.setmode(GPIO.BCM) GPIO.setwarnings(Fals...
StarcoderdataPython
1659690
<filename>mainapp/migrations/0003_auto_20180811_0946.py # Generated by Django 2.1 on 2018-08-11 09:46 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('mainapp', '0002_request_dateadded'), ] operations = [ migrations.AlterField( ...
StarcoderdataPython
1677690
<filename>toontown/estate/FlowerPhoto.py from direct.directnotify import DirectNotifyGlobal from panda3d.core import * from direct.interval.IntervalGlobal import * from toontown.fishing import FishGlobals import GardenGlobals from direct.actor import Actor class DirectRegion(NodePath): notify = DirectNotifyGlobal....
StarcoderdataPython
3204138
from sklearn.base import BaseEstimator, TransformerMixin from itertools import product import numpy as np class MultiBinaryToMultiClass(BaseEstimator, TransformerMixin): def __init__(self): pass def fit(self, Y): _, self.n_cols = Y.shape self.mapping = list(product([0, 1], repeat=self...
StarcoderdataPython
3317419
even_words = list(filter(lambda x: len(x) % 2 == 0, input().split(" "))) print("\n".join(even_words))
StarcoderdataPython
3344719
<reponame>Yasumoto/tools """Single module to wrap command validation, security, and other business logic. A note for the future- we're currently using Fabric under the hood, but alternatives exist such as Ansible, spur, paramiko, or even shelling out to ssh directly. Ideally we stay with a higher-level library and don...
StarcoderdataPython
3353484
<filename>tests/test_math.py from redesigned_barnacle.math import scale, temp_ftoc from unittest import TestCase class TempFToCTest(TestCase): def test_convert(self): self.assertAlmostEqual(temp_ftoc(-50), -45.56, 2) self.assertAlmostEqual(temp_ftoc(-40), -40.00, 2) self.assertAlmostEqual(...
StarcoderdataPython
1747738
import unittest from comparisons import * class TestComparisons(unittest.TestCase): # Problem 1 def test_number_of_card(self): input_data = [ # input : card 'K', 'A' ] output_data = [10, "ace"] for input, output in zip(input_da...
StarcoderdataPython
1792139
<filename>tfimageutils/__init__.py from .imagefeeder import ImageFeeder
StarcoderdataPython
22826
<filename>Entities/element.py class Element: dependencies = [] def __init__(self, name): self.name = name def add_dependencies(self, *elements): for element in elements: if not self.dependencies.__contains__(element): self.dependencies.append(element) def r...
StarcoderdataPython
1730578
<reponame>zakmandhro/Algorithms from bfs import bfs graph = [ [False, True, True, False, False, False], [False, False, False, True, True, False], [False, True, False, True, False, False], [False, False, False, False, True, True], [False, False, False, False, False, True], [False, False, False,...
StarcoderdataPython