id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1650641
<gh_stars>0 class IntegrationRouter: """ A router to control all database operations on models in the auth and contenttypes applications. """ call_center_models = { 'agent', 'audit', 'break', 'callattribute', 'callentry', 'callprogresslog', 'ca...
StarcoderdataPython
3249182
# Hysteresis model # http://eprints.lancs.ac.uk/1375/1/MFI_10c.pdf # Identification of Hysteresis Functions Using a Multiple Model Approach # Mihaylova, Lampaert et al import numpy as npy from scipy.optimize import root import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import copy #%% plt.close(...
StarcoderdataPython
1759116
<reponame>NicGobbi/age-of-empires-II-api from numpy import genfromtxt import os from db import db from api.models.factory import get_model def populate_db(): for filename in os.listdir(os.path.abspath('./data')): if not filename.endswith('.csv'): continue data = load_data('data/{}'.fo...
StarcoderdataPython
1454
# coding=utf-8 # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
StarcoderdataPython
118252
from tkinter import * from loadSettings import loadSettings root = Tk() root.geometry("500x500") #Menu code my_menu = Menu(root) root.config(menu=my_menu) root.title('Solmodoro Timer') # root.iconbitmap('C:\Users\Diana\Desktop\mywebsite\images\solmi.png') #File Menu file_menu = Menu(my_menu, tearoff=0) my_menu.add_c...
StarcoderdataPython
1637208
import lx, modo, lxifc, lxu.command, tagger CMD_NAME = tagger.CMD_SHADERTREE_CONSOLIDATE_BY_COLOR def color_convert(color): return [i*256 for i in color] class CommandClass(tagger.CommanderClass): #_commander_default_values = [] def commander_execute(self, msg, flags): all_masks = modo.Scene()....
StarcoderdataPython
4839125
from wikipedia2vec import Wikipedia2Vec import pickle import numpy as np import argparse parser = argparse.ArgumentParser() parser.add_argument('--dataset', default='robust04', help='dataset name: robust04/clueweb09') args = parser.parse_args() def save_obj(obj, name): with open(name + '.pkl', 'wb') as f: ...
StarcoderdataPython
3222327
from functools import partial import yaml from galaxy import model from galaxy.model import mapping from galaxy.security.idencoding import IdEncodingHelper from galaxy.util import bunch class MockTrans(object): def __init__(self): self.app = TestApp() self.sa_session = self.app.model.context ...
StarcoderdataPython
1763126
<filename>vbx/events/__init__.py<gh_stars>1-10 from .call import Call from .message import Message __all__ = ['Call', 'Message']
StarcoderdataPython
1689308
import numpy as np import scipy.special as ss from scipy.optimize import root_scalar from scipy import integrate from csr2d.core2 import psi_x0, psi_s, Es_case_B, Fx_case_B_Chris, Es_case_A, Fx_case_A, Es_case_C, Fx_case_C, Es_case_D, Fx_case_D, psi_s_case_E, Es_case_E from csr2d.core2 import alpha_exact_case_B...
StarcoderdataPython
1616100
#108 def metade(preco=0): res = preco/2 return res def dobro(preco=0): res = preco * 2 return res def aumentar(preco=0, taxa=0): res = preco + (preco*taxa/100) return res def diminuir(preco=0, taxa=0): res = preco - (preco*taxa/100) return res def moeda(preco = 0, moeda = 'R$'): ...
StarcoderdataPython
3379615
""" Validation of PacBio dataset XML (and referenced files) """ import xml.etree.ElementTree as ET from cStringIO import StringIO from urlparse import urlparse import xml.parsers.expat import traceback import itertools import argparse import logging import os.path import sys try: from pyxb import exceptions_ as ...
StarcoderdataPython
3283614
<reponame>SnowMasaya/python-viasualize import dataset db = dataset.connect('sqlite:///nobel_prize.db') wtable = db['winners'] winners = wtable.find() winners = list(winners) print(winners) # wtable.drop() wtable = db['winners'] winners = list(wtable.find()) print(winners)
StarcoderdataPython
3265197
from typing import Optional from gym.envs import register as gym_register _ENTRY_POINT_PREFIX = "airl_envs" # _ENTRY_POINT_PREFIX = "" def _register(env_name: str, entry_point: str, kwargs: Optional[dict] = None): entry_point = f"{_ENTRY_POINT_PREFIX}.{entry_point}" # entry_point = f"airl_envs.{entry_point}...
StarcoderdataPython
3298795
<gh_stars>1-10 import execjs import time import math import hashlib from functools import partial class JSTool: def __init__(self, file_path, func): self.js_file_path = file_path self.signature_js_func = func def get_js(self, js_file_path, mode='r'): """ :param data: @js_file_path: js脚本路径 @mode : ...
StarcoderdataPython
34990
# import discord # import asyncio # import json # from discord.ext import commands # from discord.utils import get # # from cogs.personalPoint import PersonalPoint # from main import client # from discord_ui import UI,Button # from functions.userClass import User,experiences,levelNames # from cogs.rank import getSorted...
StarcoderdataPython
3366781
<filename>DataPreprocessing/data_segmentation.py # coding=utf-8 import gc import wordsegment # import sys # sys.setrecursionlimit(10000) def word_segment(text, limit=250): next_text = wordsegment.clean(text) word_list = [] while len(next_text) > limit: current_text = next_text[:limit] nex...
StarcoderdataPython
103311
<gh_stars>0 """Moduł zawierający bazowe wartości dotyczące rozgrywki. Grafika: * www.flaticon.com * www.pexels.com """ import pygame WIN_WIDTH = 1200 #: Szerokość okna WIN_HEIGHT = 780 #: Wysokość okna # GAME VARIABLES RUN = True #: Warunek działania głównej pętli pygame. FP...
StarcoderdataPython
1614459
from pydeation.document import Document from pydeation.animation.animation import VectorAnimation, AnimationGroup from pydeation.animation.object_animators import Show, Hide from abc import ABC, abstractmethod from collections import defaultdict import c4d class Scene(ABC): """abstract class acting as blueprint f...
StarcoderdataPython
4592
<reponame>TeoZosa/pytudes """https://www.educative.io/courses/grokking-the-coding-interview/N7rwVyAZl6D Categories: - Binary - Bit Manipulation - Blind 75 See Also: - pytudes/_2021/leetcode/blind_75/linked_list/_141__linked_list_cycle__easy.py """ from pytudes._2021.utils.linked_list import ( Li...
StarcoderdataPython
1774927
<gh_stars>1-10 from fastapi import FastAPI, status app = FastAPI() # Sample endpoint to get a succesfull response @app.get("/success", status_code=status.HTTP_200_OK) def success(): return {"msg": "Success"} # Sample endpoint to get an error response @app.get("/error", status_code=status.HTTP_403_FORBIDDEN) def...
StarcoderdataPython
161650
<gh_stars>0 import pyautogui import time from pynput.mouse import Listener """ This scripts clicks forward surveys or courses that make you wait between pages for some seconds or till a video is finished """ idx, idy = 0, 0 def main(): print("Please fulscreen or don't move that window. Click on the posiion wher...
StarcoderdataPython
1738620
#!/usr/bin/env python # -*- coding: utf-8 -*- # Common Python library imports # Pip package imports import pytest from flask import url_for from flask_login import current_user # Internal package imports @pytest.mark.usefixtures('user') class TestLogin: def test_html_get_login(self, client, templates): r...
StarcoderdataPython
3214963
# wifi_controller.py/Open GoPro, Version 1.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro). # This copyright was auto-generated on Tue May 18 22:08:50 UTC 2021 """Manage a WiFI connection using native OS commands.""" # TODO This file needs to be cleaned up. import os import re import time import loggin...
StarcoderdataPython
3367400
<filename>tools/text_to_speech.py # Adapted from: # https://pythonprogramminglanguage.com/text-to-speech/ import pyttsx3 if __name__ == '__main__': # Initializes the engine engine = pyttsx3.init() # Says somethings engine.say('I like coconut.') # Produce audio engine.runAndWait()
StarcoderdataPython
11501
<reponame>brownaa/wagtail<gh_stars>1000+ from django.core.exceptions import PermissionDenied from django.shortcuts import get_object_or_404, redirect from django.template.response import TemplateResponse from django.urls import reverse from django.utils.translation import gettext as _ from wagtail.admin import message...
StarcoderdataPython
3309267
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Wed Dec 25 10:04:06 2019 @author: <NAME> """ import cv2 import numpy as np import pyzbar.pyzbar as pyzbar image = cv2.imread("25.png") decodedObjects = pyzbar.decode(image) for obj in decodedObjects: print("Type:", obj.type) print("Data: "...
StarcoderdataPython
25500
<reponame>torresxb1/aws-sam-cli<filename>tests/unit/local/lambdafn/test_config.py from unittest import TestCase from unittest.mock import Mock from parameterized import parameterized from samcli.lib.utils.packagetype import ZIP from samcli.local.lambdafn.config import FunctionConfig from samcli.commands.local.cli_com...
StarcoderdataPython
3271761
<filename>Kaggle Fisheries/fisheries_create_dataset.py ## Kaggle Project from __future__ import print_function from keras.datasets import cifar10 from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten from keras.layers...
StarcoderdataPython
3344177
<gh_stars>0 a = int(input()) b = int(input()) x = a + b print("X =", x)
StarcoderdataPython
106936
#! /opt/conda/bin/python3 """ File containing keras callback class to collect runstats of the training process """ # Copyright 2018 FAU-iPAT (http://ipat.uni-erlangen.de/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may ob...
StarcoderdataPython
151410
from django.apps import AppConfig class BookoneConfig(AppConfig): name = 'bookone'
StarcoderdataPython
3285583
<filename>scripts/mprime_tradeoff/generate_mprime_data.py import numpy as np import csv from itertools import product import pandas as pd import xarray as xr from graal_utils import Timer from hypergeo import hypinv_upperbound import os path = os.path.dirname(__file__) + '/data/' def compute_bound_data(k, m, delta=...
StarcoderdataPython
1661033
import paddle.fluid.dataloader as data import paddle from PIL import Image import os import os.path import numpy as np import random from numpy.random import randint from opts import parser args = parser.parse_args() class VideoRecord(object): def __init__(self, row): self._data = row @property d...
StarcoderdataPython
1736866
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.utils.spectral_norm as SpectralNorm class Nothing(nn.Module): def __init__(self): super(Nothing, self).__init__() def forward(self, x): return x def get_norm(norm_type, size): ...
StarcoderdataPython
3211613
<filename>nrm_analysis/fringefitting/subpix.py #! /usr/bin/env python import numpy as np def rotatevectors(vectors, thetarad): """ vectors is a list of vectors - e.g. nrm hole centers positive x decreases under slight rotation positive y increases under slight rotation """ c, s = (np.cos(theta...
StarcoderdataPython
4819601
# -*- coding:utf-8 -*- def cmdUrlMaker(): rServer = "192.168.0.19" dServer = "192.168.0.70:7575" serverSelect = input('Choose the number of the server. (1)192.168.0.19 (2)192.168.0.70:7575 : ') if serverSelect == 1: server = rServer else: server = dServer cmd = raw_in...
StarcoderdataPython
3281371
from PyInstaller.utils.hooks import collect_data_files, collect_submodules, \ copy_metadata datas = copy_metadata('chaostoolkit-humio', recursive=True) hiddenimports = ( collect_submodules('chaoshumio') )
StarcoderdataPython
1756514
import json import logging from django.conf import settings from django.utils.encoding import filepath_to_uri from rest_framework import viewsets from rest_framework.serializers import HyperlinkedModelSerializer, \ ReadOnlyField, Serializer from rest_framework.authentication import SessionAuthentication, BasicAut...
StarcoderdataPython
1683233
<gh_stars>1-10 #!/usr/bin/env python """ Classes representing parameters for 1D GeoClaw runs :Classes: - GeoClawData1D - GaugeData1D :Constants: - Rearth - Radius of earth in meters - DEG2RAD factor to convert degrees to radians - RAD2DEG factor to convert radians to degrees """ import os import numpy impo...
StarcoderdataPython
1723504
<reponame>binderwang/Implements-of-Reinforcement-Learning-Algorithms # coding=utf-8 import pandas as pd import numpy as np from base.maze import Maze class QLearning(object): def __init__(self, actions, env, alpha=0.01, gamma=0.9, epsilon=0.9): self.actions = actions self.env = env self....
StarcoderdataPython
3255626
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # test_maxsum.py # algorithms # # Created by <NAME> on 06/19/21 # Copyright © 2021 <NAME>. All rights reserved. # import pytest @pytest.mark.parametrize( "input,output", [ ([4, 4, 9, -5, -6, -1, 5, -6, -8, 9], (17, 0, 2)), ([8, -10, 10, -9, -6, ...
StarcoderdataPython
1678085
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2020-2022 F4PGA 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 the License at # # http://www.apache.org/licenses/LICE...
StarcoderdataPython
180278
import functools import flask_login import signals import inspect from mocha import (utils, abort, request, ) from mocha.core import apply_function_to_members from . import (is_authenticated, not_authenticated, ROLES_ADMIN, ...
StarcoderdataPython
3318348
<filename>imgsteg/__main__.py import argparse import sys from . import ui from .imgsteg import Imgsteg def blank_builder(parser): pass def extract_bits(args): if args.infile is None: raise Exception() imgsteg = Imgsteg(args.infile) channel_map = { 'r': imgsteg.RED, 'g': img...
StarcoderdataPython
3310139
<reponame>groboclown/petronia<gh_stars>10-100 """ OS Process control. """
StarcoderdataPython
3254674
<reponame>brunodccarvalho/competitive from decimal import * getcontext().prec = 30 for tc in range(int(input())): [N, R, G] = map(int, input().split()) win = map(Decimal, input().split()) win = sorted(win, reverse=True) zero = Decimal(0) first = [zero] for topK in range(1, N + 1): firs...
StarcoderdataPython
3205195
<reponame>PolPsychCam/Twitter-NLP-SNA<filename>data_collection_12_WordCounts.py """ data_collection_12_WordCounts.py 6 - preparation for word frequency analysis 7 - word frequency analysis 8 - calculations 9 - trying to understand why centrality is related to noun/propernoun use @author: lizakarmannaya """ ######...
StarcoderdataPython
94525
<reponame>cavayangtao/rmtt_ros #!/usr/bin/env python import rospy from geometry_msgs.msg import Twist from sensor_msgs.msg import RegionOfInterest as ROI from sensor_msgs.msg import Range from std_msgs.msg import UInt8 import smach import smach_ros import datetime import numpy as np # define state Tag_track class Tag...
StarcoderdataPython
160349
#!/usr/bin/env python """Write out the KL distance between two kmer models """ from __future__ import print_function import os, sys import numpy as np from vis_kmer_distributions import * from scipy.stats import entropy from scipy.spatial.distance import euclidean from itertools import product from argparse import Argu...
StarcoderdataPython
3344520
<reponame>bekou/evidence_aware_nlp4if import os import torch import numpy as np import json import re from torch.autograd import Variable def _truncate_seq_pair(tokens_a, tokens_b, max_length): """Truncates a sequence pair in place to the maximum length.""" # This is a simple heuristic which will always trun...
StarcoderdataPython
172622
# -*- coding: utf-8 -*- # Author: XuMing <<EMAIL>> # Brief: import time from multiprocessing import Pool def function(index): print('Start process: ', index) time.sleep(3) print('End process', index) if __name__ == '__main__': pool = Pool(processes=3) for i in range(14): pool.apply_asyn...
StarcoderdataPython
154980
from flask import Flask, render_template, request from recipe_scrapers import scrape_me import sqlite3 app = Flask(__name__) # create app instance @app.route("/") def index(): # Home page of the KitchenCompanion app return render_template('index.html', title = 'Home') @app.route("/view") # Connects...
StarcoderdataPython
3286945
<gh_stars>0 import types class TsvRecord(object): __slots__ = ('__keys', '__vals') def __init__(self, vals = None, keys = None): """ r = TsvRecord([1,2,3,4,5]) r.__vals == [1,2,3,4,5] r.__keys == None """ self.__vals = vals or [] if keys: assert len(keys) == len(vals) self.__keys = dict(zip(keys...
StarcoderdataPython
140506
#!/usr/bin/env python ############################################################## # $Id$ # Project: WGS pipeline for Nephele project # Language: Python 2.7 # Authors: <NAME>, <NAME>, <NAME> # History: July 2015 Start of development ############################################################## __author__ = ...
StarcoderdataPython
68154
<filename>python/image.py # -*- coding: utf-8 -*- """ image.py Converts an image into matrix.drawPixel commands for a 32x32 LED display """ from skimage import io, transform image = io.imread("q.png") image = transform.resize(image, [32,32]) io.imsave("q-sm.png", image) #uncomment to save 32x32 img print image[0][...
StarcoderdataPython
1609999
<reponame>icpac-igad/wagtail-leaflet-widget #!/usr/bin/env python import sys from django.conf import settings from django.core.management import execute_from_command_line if not settings.configured: params = dict( LOGGING={ 'version': 1, 'disable_existing_loggers': False, ...
StarcoderdataPython
85661
<reponame>Saumitra-Shukla/keras-bert from tensorflow.python.ops.math_ops import erf, sqrt __all__ = ['gelu'] def gelu(x): return 0.5 * x * (1.0 + erf(x / sqrt(2.0)))
StarcoderdataPython
1665459
<gh_stars>10-100 #------------------------------------------------------------------------------- # Name: servertoken # Purpose: Demo to show how to get a services list from a federated server # using a portal username and password # # Author: EsriNL DevTeam (MVH) # # Created: 20210709 ...
StarcoderdataPython
113673
import unittest from deckbuilder.Gloss import Gloss class TestGloss(unittest.TestCase): def test_gloss(self): gloss = Gloss() result = gloss.fetch_glosses('よく晴れた夜空') self.assertEqual(len(result), 3) def test_clean_gloss_front(self): gloss = Gloss() text1 = ' 夜空 【よぞら】 (...
StarcoderdataPython
3385075
# -*- coding: utf-8 -*- print(abs(-1)) # convert other collections to list print(list((1, 2, 3))) print(list({1, 2, 3})) print(list({'a': 1, 'b': 2})) print(list(range(100))) # data type of an object print(type({1, 2, 3})) print(type((1))) print(type((1,)))
StarcoderdataPython
4815069
<gh_stars>1-10 import pandas as pd import matplotlib.pyplot as plt import seaborn as sns ################################################################################ # GPU nvdia GTX970m df = pd.read_csv('results/results_gpu.csv') df['ActivFunc'] = 0 df.loc[range(12),['ActivFunc']] = 'ReLU' df.loc[range(12,19),['...
StarcoderdataPython
1678119
<gh_stars>0 from ..Qt import QtGui, QtCore, QtWidgets, USE_PYSIDE if not USE_PYSIDE: import sip from .GraphicsItem import GraphicsItem __all__ = ['GraphicsObject'] class GraphicsObject(GraphicsItem, QtWidgets.QGraphicsObject): """ **Bases:** :class:`GraphicsItem <pyqtgraph.graphicsItems.GraphicsItem>`, :cl...
StarcoderdataPython
1715057
<gh_stars>1000+ import pygtk,math,string pygtk.require('2.0') import gtk class mainwin(): def __init__(self): #This function autorun at assign object to class >> "win=mainwin()" self.mwin=gtk.Window() self.mwin.set_size_request(300,270) self.mwin.set_resizable(False) self.mwi...
StarcoderdataPython
3270934
<filename>Ano_1/LabI/Projeto Final - Moura/repositoryContent/ImageEditor/simpleImageEditor.py #encoding=utf-8 import sys from PIL import Image from ImageEditor.imageMenu import * from ImageEditor.effects import * from ImageEditor.filters import * menu = """ ---------------------------------------- Select the...
StarcoderdataPython
123345
<reponame>LawAlias/gisflask #coding:utf-8 import urllib,urllib2 from flask import flash,render_template,request,redirect,url_for from flask.views import MethodView from apis import app from flask_login import login_required, current_user from geomodule.utils import shp2geo_nowriter,geofunc,shp2wkt,geojson2wkt from main...
StarcoderdataPython
53300
# raider.io api configuration RIO_MAX_PAGE = 5 # need to update in templates/stats_table.html # need to update in templates/compositions.html # need to update in templates/navbar.html RIO_SEASON = "season-sl-3" WCL_SEASON = 3 WCL_PARTITION = 1 # config RAID_NAME = "<NAME>" # for heroic week, set this to 10 # aft...
StarcoderdataPython
41786
<reponame>Ricyteach/candemachine<filename>candemachine/exceptions.py<gh_stars>0 class CandeError(Exception): pass class CandeSerializationError(CandeError): pass class CandeDeserializationError(CandeError): pass class CandeReadError(CandeError): pass class CandePartError(CandeError): pass ...
StarcoderdataPython
3302113
<reponame>AstunTechnology/featureserver ''' Created on Oct 16, 2011 @author: michel ''' import os import sys from lxml import etree from lxml import objectify from copy import deepcopy from FeatureServer.WebFeatureService.Transaction.TransactionAction import TransactionAction class Transaction(object): tree ...
StarcoderdataPython
1713634
import inspect import re import itertools def _empty_func(): pass def set_signature(signature): def decorator(func): return wraps(_empty_func, expected=signature)(func) return decorator def get_function_body(func): source_lines = inspect.getsourcelines(func)[0] source_lines = itertools...
StarcoderdataPython
100141
from __future__ import print_function import tensorflow as tf import tensorflow.contrib.slim as slim from sklearn.utils import shuffle def wide_net(x): with slim.arg_scope([slim.fully_connected], activation_fn=tf.nn.relu, weights_initializer=tf.orthogonal_initializ...
StarcoderdataPython
1781737
from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit from django.contrib.auth.forms import AuthenticationForm class AuthForm(AuthenticationForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.helper = FormHelper() self.helper.add_i...
StarcoderdataPython
3253389
import logging import re # from discord.commands import Option import discord from alttprbot import models from alttprbot.alttprgen.smz3multi import generate_multiworld from discord.ext import commands from slugify import slugify PRESET_OPTIONS = { 'sm': [ discord.SelectOption(label="casual_full"), ...
StarcoderdataPython
3312278
<reponame>fabiommendes/capacidade_hospitalar from django.apps import AppConfig as DjangoAppConfig from django.utils.translation import gettext_lazy as _ class AppConfig(DjangoAppConfig): name = "hcap_geo" verbose_name = _("Geography")
StarcoderdataPython
115990
from . import DutchDraw from .DutchDraw import *
StarcoderdataPython
3292512
# coding=utf-8 """A little helper allowing to mock requests very effectively for tests""" from __future__ import unicode_literals import functools import json from contextlib import contextmanager import logging import requests from mock import patch, MagicMock @contextmanager def patch_requests(mapping=None, allo...
StarcoderdataPython
3209042
import os from django.conf import settings as project_settings from django.test.client import RequestFactory from django.utils.text import slugify from rest_framework.renderers import JSONRenderer from slackchatbakery.utils.aws import defaults, get_bucket from slackchatbakery.conf import settings class StaticsPublis...
StarcoderdataPython
1799810
# Copyright (c) 2021 <NAME> # This code is part of the pymscrape project import copy import tkinter as tk from tkinter import ttk from PIL import Image, ImageTk import numpy as np import cv2 as cv import random # Base tkinter scroll/zoom class based on # https://stackoverflow.com/questions/41656176/tkinter-canvas-zoo...
StarcoderdataPython
1623034
<filename>dassl/modeling/ops/mixup.py import torch def mixup(x1, x2, y1, y2, beta, preserve_order=False): """Mixup. Args: x1 (torch.Tensor): data with shape of (b, c, h, w). x2 (torch.Tensor): data with shape of (b, c, h, w). y1 (torch.Tensor): label with shape of (b, n). y2 (...
StarcoderdataPython
1633912
# -*- coding: utf-8 -*- import numpy import time import os import magdynlab.instruments import magdynlab.controllers import magdynlab.data_types import threading_decorators as ThD import matplotlib.pyplot as plt def Plot_IxV(Data): f = plt.figure('IxV Semi', (5, 4)) if not(f.axes): plt...
StarcoderdataPython
149705
<gh_stars>0 import os import bentoml def test_requirement_txt_env(tmpdir): req_txt_file = tmpdir.join("requirements.txt") with open(str(req_txt_file), 'wb') as f: f.write(b"numpy\npandas\ntorch") @bentoml.env(requirements_txt=str(req_txt_file)) class ServiceWithFile(bentoml.BentoService): ...
StarcoderdataPython
55791
<gh_stars>0 import asyncio import json import re from itertools import cycle from threading import Thread from time import sleep import serial from aiohttp import web from scipy import signal class Sensor: # Serial message patterns. re_patterns = [ r'(RPY) - Roll: (-?\d+) \| Pitch: (-?\d+) \| Yaw: (...
StarcoderdataPython
3381490
<reponame>bensternthal/lumbergh from funfactory.urlresolvers import reverse from nose.tools import eq_ from careers.base.tests import TestCase from careers.careers.tests import PositionFactory class CareersTest(TestCase): """Tests static pages for careers""" def test_position_case_sensitive_match(self): ...
StarcoderdataPython
1752648
<filename>setup.py from distutils.core import setup setup( name='juramote', version='0.1.0', author='<NAME>', author_email='<EMAIL>', packages=['juramote'], url='https://6xq.net/juramote/', license='LICENSE.txt', description='Remote control for Jura coffee maker.', long_description=...
StarcoderdataPython
3314817
<filename>vesper/mpg_ranch/nfc_bounding_interval_annotator_1_0/annotator.py """ Module containing NFC bounding interval annotator, version 1.0. An NFC bounding interval annotator sets values for the `Call Start Index` and `Call End Index` annotations for a clip containing a nocturnal flight call (NFC). If the annotati...
StarcoderdataPython
101923
<reponame>howaboutudance/pyloggerkinesis<gh_stars>0 from . import stand_dist import logging from pathlib import Path import argparse import os import time from aws_logging_handlers.Kinesis import KinesisHandler # Logging Configuratiion LOGGING_FORMATTER = ("%(asctime)s %(process)s:%(thread)d " + "%(levelname)s %(mo...
StarcoderdataPython
95753
def append_suppliers_list(): suppliers = [] counter = 1 supply = "" while supply != "stop": supply = input(f'Enter first name and last name of suppliers {counter} \n') suppliers.append(supply) counter += 1 suppliers.pop() return suppliers append_supplier...
StarcoderdataPython
107732
<reponame>elainehoml/Savu<gh_stars>10-100 # Copyright 2014 Diamond Light Source 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 # # Unl...
StarcoderdataPython
165899
<gh_stars>0 #!/usr/bin/env python3 # # Copyright 2018 Facebook # # 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...
StarcoderdataPython
1786934
n, k = map(int, input().split()) height = list(map(int, input().rstrip().split())) a, m = 0, max(height) if m > k: a = m - k print(a)
StarcoderdataPython
3224157
#!/usr/bin/env python # -*- coding: utf-8 -*- # File: Ampel-core/ampel/demo/DemoPlainT3Unit.py # License: BSD-3-Clause # Author: <NAME> <<EMAIL>> # Date: 17.12.2021 # Last Modified Date: 17.12.2021 # Last Modified By: <NAME> <<EMAIL>> from typing import Union ...
StarcoderdataPython
144092
<reponame>calebmarcus/awacs<filename>awacs/kinesisanalytics.py # Copyright (c) 2012-2013, <NAME> <<EMAIL>> # All rights reserved. # # See LICENSE file for full license. from aws import Action as BaseAction from aws import BaseARN service_name = 'Amazon Kinesis Analytics' prefix = 'kinesisanalytics' class Action(Bas...
StarcoderdataPython
4842166
# Determine common prefix in array of strings. # Problem has been split in two parts, easier to understand. # First function compare two strings. # Function to find common prefix between two strings # Result is common prefix. import profile def commonPrefix(str1, str2): result = ""; n1 = len(str1) ...
StarcoderdataPython
1746625
<reponame>tor-councilmatic/scrapers-ca from __future__ import unicode_literals from utils import CanadianScraper, CanadianPerson as Person import re COUNCIL_PAGE = 'http://www.lambtononline.ca/home/government/accessingcountycouncil/countycouncillors/Pages/default.aspx' class LambtonPersonScraper(CanadianScraper): ...
StarcoderdataPython
1722916
<reponame>materialsvirtuallab/m3gnet import unittest import numpy as np import tensorflow as tf from pymatgen.core import Lattice, Structure from m3gnet.graph import Index, MaterialGraph, RadiusCutoffGraphConverter class TestConverter(unittest.TestCase): @classmethod def setUpClass(cls) -> None: cls...
StarcoderdataPython
1649193
def data_range(x): return max(x)-min(x) x = [12,23,22,43,57,84,23,11,66,24] print(data_range(x))
StarcoderdataPython
3288196
<gh_stars>100-1000 # -*- coding: utf-8 -*- from __future__ import unicode_literals import mock from bravado.fido_client import FidoResponseAdapter def test_header_conversion(): fido_response = mock.Mock( name='fido_response', headers={ b'Content-Type': [b'application/json'], ...
StarcoderdataPython
1724968
from rest_framework import serializers from rest_framework.exceptions import PermissionDenied from api.profiles.serializers import ProfileUsernamePictureSerializer from apps.comments.models import Comment from apps.parties.models import Party class CommentSerializer(serializers.ModelSerializer): author = Profile...
StarcoderdataPython
110348
"""Unit test package for sentry_onboarding."""
StarcoderdataPython
4838016
from portfolio.base.views import HomeView, ResumeView import django import os os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'portfolio.settings') django.setup() from django.test import TestCase from django.urls import reverse, resolve class TestUrls(TestCase): def test_home_url_is_resolved(self): ...
StarcoderdataPython