id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
1674846
@foo def f(): pass @foo.bar def f(): pass @foo(bar) def f(): pass @foo @bar def f(): pass
StarcoderdataPython
5011448
# -*- coding: utf-8 -*- # # © 2016 Krux Digital, Inc. # # # Standard libraries # # # Third party libraries # import requests # # Internal libraries # from krux.logging import get_logger from krux.stats import get_stats from krux.cli import get_parser, get_group NAME = 'krux-kafka-manager' def get_kafka_manager...
StarcoderdataPython
4917383
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # imports. from ssht00ls.classes.config import * from ssht00ls.classes import utils import os, sys, json, subprocess, pexpect # check default errors.. def check_errors(output): for i in [ "\nrsync: ", "\nrsync error: ", "\nssh: ", "\nssh error: ", "\nsshfs: "...
StarcoderdataPython
6415581
import seaborn.utils as utils import seaborn as sns import matplotlib as mpl import seaborn.rcmod as rcmod from core.utils.Singleton import Singleton class TrackFontScale(metaclass=Singleton): font_scale = -1 def __init__(self): rcmod.plotting_context = self.save_font_size(rcmod.plotting_context) ...
StarcoderdataPython
3526769
<reponame>Howardhuang98/Blog<filename>LC_problems/386.py #!/usr/bin/env python # -*- encoding: utf-8 -*- """ @File : 386.py @Contact : <EMAIL> @Modify Time : 2022/4/18 12:54 ------------ """ from typing import List class Solution: def lexicalOrder(self, n: int) -> List[int]: res = []...
StarcoderdataPython
6549218
<reponame>jborean93/pykinit<filename>src/krb5/__init__.py # Copyright: (c) 2021 <NAME> (@jborean93) <<EMAIL>> # MIT License (see LICENSE or https://opensource.org/licenses/MIT) from krb5._ccache import ( CCache, cc_cache_match, cc_default, cc_default_name, cc_destroy, cc_get_name, cc_get_pr...
StarcoderdataPython
390253
<reponame>caiyongji/tf2.3.1-py3.7.9-full-built<filename>Lib/site-packages/pyglet/media/drivers/directsound/interface.py # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 <NAME> # Copyright (c) 2008-2020 pyglet contributors # All rights reserved. # # Redist...
StarcoderdataPython
11207323
################################################################################ # 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...
StarcoderdataPython
6678206
""" Copyright 2017 Neural Networks and Deep Learning lab, MIPT 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 a...
StarcoderdataPython
3464194
import logging import subprocess from contextlib import contextmanager from typing import Callable, Dict from laituri import settings from .errors import DockerLoginFailed log = logging.getLogger(__name__) @contextmanager def docker_v1_credential_manager( *, image: str, registry_credentials: Dict, ...
StarcoderdataPython
112214
import os from django.core import serializers def read_testdata(): fixture_filename = os.path.join(os.path.dirname(__file__), 'testdata/countries.json') with open(fixture_filename) as f: for obj in serializers.deserialize("json", f.read()): obj.save()
StarcoderdataPython
8121822
<filename>ManagementAPI/ManagementTenant/how_to_update_tenant_pricing.py """ @date 30.08.2019 @author Faeel.Zarip<EMAIL> @details :copyright: 2003–2019 Acronis International GmbH, Rheinweg 9, 8200 Schaffhausen, Switzerland. All rights reserved. """ import os import sys import requests sys.path.append(os.path.abspat...
StarcoderdataPython
6705636
from pymarkdownlint.tests.base import BaseTestCase from pymarkdownlint.options import IntOption, RuleOptionError class RuleOptionTests(BaseTestCase): def test_int_option(self): # normal behavior option = IntOption("test-name", 123, "Test Description") option.set(456) self.assertEq...
StarcoderdataPython
6585205
<filename>share_euro_ticker.py<gh_stars>1-10 #!/usr/bin/env python3 ''' Calculate share price and convert to Euros. ''' import argparse import requests def parse_args(): '''Parse command line arguments''' parser = argparse.ArgumentParser() parser.add_argument('--symbol', require...
StarcoderdataPython
153598
from asyncio import set_event_loop_policy from aiogram import Bot, Dispatcher, types from aiogram.contrib.fsm_storage.redis import RedisStorage2 from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore from apscheduler.schedulers.asyncio import AsyncIOScheduler from sqlalchemy.ext.declarative import declarative...
StarcoderdataPython
11344089
<reponame>croquemadame/quantumGS ################################################## # Import libraries ################################################## #import os #os.environ['OPENBLAS_NUM_THREADS'] = '1' #from threadpoolctl import threadpool_limits import numpy as np import matplotlib.pyplot as plt #from mpl_toolkit...
StarcoderdataPython
3341341
# General utilities for forcefields from openforcefield.utils.utils import * from openforcefield.utils.toolkits import *
StarcoderdataPython
3491428
#!/usr/bin/python # coding: utf-8 # Copyright (c) 2013 Mountainstorm # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, ...
StarcoderdataPython
1861234
import requests from bs4 import BeautifulSoup as bs import getpass header = {"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5)\ AppleWebKit 537.36 (KHTML, like Gecko) Chrome", "Accept":"text/html,application/xhtml+xml,application/xml;\ q=0.9,imgwebp,*/*;q=0.8"} do_url = "https://do.sejong.ac.kr/ko/...
StarcoderdataPython
4916904
class NoSampleError(Exception): """Raise when the number of samples is zero""" pass
StarcoderdataPython
384587
<reponame>arnaudj/wagmi<gh_stars>10-100 import pytest import json from .ftx import FTXExchange class TestFTXExchange: @pytest.mark.parametrize( "side,expected,test_input", [ ( "buy", 49483, '{"bid": 49483.0, "ask": 49484.0, "priceIncremen...
StarcoderdataPython
1678820
<reponame>posl/kuramoto-msr2022 from re import T import my_log import os import glob from tqdm import tqdm from datetime import datetime as dt import ast import csv import sys import math csv.field_size_limit(sys.maxsize) def main(): wd = os.getcwd() repos = glob.glob(f"{wd}/out/out_for_issue/*") # ファイル操作オ...
StarcoderdataPython
4852620
from django.contrib.auth import get_user_model from chat.utils.helpers import generate_56_hash_code from django.db.models.signals import post_save from chat.utils.encrypt import symmetric_encrypt User = get_user_model() def user_created(sender, instance, created, **kwargs): if created: random_hash = gen...
StarcoderdataPython
9796710
<filename>aioarangodb/tests/test_foxx.py from __future__ import absolute_import, unicode_literals import json import os import pytest from six import string_types from aioarangodb.exceptions import ( FoxxServiceGetError, FoxxServiceListError, FoxxServiceCreateError, FoxxServiceUpdateError, FoxxSe...
StarcoderdataPython
6404698
# Here we will attempt best practics in merging all previous scripts written to unify functionality # The attempt is to create a tool that will allow us to create any primitive with defined paramters import maya.cmds as cmds class MR_Window(object): # constructor def __init__(self): ...
StarcoderdataPython
3241838
<gh_stars>1-10 import pymysql import json def output(): db_url = 'localhost' db_user = 'root' db_pwd = '' db_name = 'flood' js_path = './js/' db = pymysql.connect(db_url, db_user, db_pwd, db_name) cursor = db.cursor() raw_data = [] try: sql = "SELECT * FROM `waterLevel` ORDER BY datetime"...
StarcoderdataPython
1676607
<reponame>varunofficial2509/HMS-1 # Generated by Django 3.0.8 on 2020-08-02 07:19 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Home', '0043_auto_20200801_1241'), ] operations = [ migrations.AddField( model_name='appeal', ...
StarcoderdataPython
11308581
<reponame>Anirudh-Swaminathan/coco-caption #from bleu.bleu_scorer import BleuScorer from bleu.bleu import Bleu import re a = dict() b = dict() test_cap = "This is a test caption" ref_cap1 = "This is ref cap 1" ref_cap2 = "Reference caption 2 right here" a[1] = [] b[1] = [] #a[1].append(re.sub(r'[^a-zA-Z0-9 ]+', ''...
StarcoderdataPython
6633524
#!/usr/bin/env python3 import os import subprocess import sys from collections import defaultdict res = subprocess.check_output(['grep " --output" docs/*.md'], shell=True) test_files = defaultdict(set) for line in res.decode("utf-8").split("\n"): if not line.split(): continue fname = line.split()[0][5:-1] ou...
StarcoderdataPython
8165320
# -*- coding: utf-8 -*- '''Routes and Views for the Bookmark Manager''' from flask import render_template, request, redirect, url_for, abort, Markup, jsonify from flask_security import login_required, current_user from crestify import app, redis, hashids from crestify.models import Bookmark, User, Tag, db, Tab from cre...
StarcoderdataPython
6418584
import numpy as np def pairwise_distances(p, q): first_term = np.einsum('ij->i', p ** 2) # sum along dimension second_term = np.einsum('ij->i', q ** 2) # sum along dimension third_term = np.einsum('ik,jk->ij', p, q) # pairwise product squared_distances = first_term[:, None] + second_term square...
StarcoderdataPython
1752798
<filename>train_main_tl.py ['''Train CIFAR10 with PyTorch.'''] import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torch.backends.cudnn as cudnn import torchvision import torchvision.transforms as transforms import os import argparse import numpy as np from models im...
StarcoderdataPython
328580
from flask import Blueprint auth_blueprint = Blueprint('auth', __name__) from . import views
StarcoderdataPython
1720904
<filename>p3.py #! python import math from file_in import load def process_input(i): t = [l.rstrip() for l in load(i)] return t if __name__ == '__main__': i = process_input('i3') tree_counts = [] for slope in [(1,1), (3,1), (5,1), (7,1), (1,2)]: x = 0 count = 0 for y in r...
StarcoderdataPython
248006
from django.shortcuts import render, redirect from django.views.generic import View from django.http import HttpResponse from django.contrib.auth import get_user_model from django.contrib import messages from django.db.models import Q from user.forms import UserEditForm from core.models import Follow # Create your vie...
StarcoderdataPython
330200
from datetime import datetime, time from Simulation.stock_snapshot import StockSnapshot __author__ = 'raymond' class StockSnapshotHelper: def __init__(self, stock_snapshot: StockSnapshot): self.stock_snapshot = stock_snapshot self._closing_time = time(16, 0, 0) def get_mid_price(self): return (self.stock_sn...
StarcoderdataPython
8070458
<filename>monitor_grades.py #! /usr/bin/env python3 # -*- coding: utf-8 -*- # @Author : 张旭 # @Email : <EMAIL> # @Blog : https://zhangxu3486432.github.io # @FileName: monitor_grades.py # @Time : 2020/2/4 import time from http import cookiejar import requests from bs4 import BeautifulSoup from settings impor...
StarcoderdataPython
4889636
a = 4 condition = a > 5 print(condition) print(type(condition)) example_list = [1, 2] # mutable example_tuple = (1, 2) # immutable example_list.append(3) print(example_list) topic = "dataTypes" class ComplexNumber: real: float = 0.0 imaginary: float = 0.0 def __init__(self, realValue: float, imag...
StarcoderdataPython
6512037
import setuptools setuptools.setup( name="tfdataflow", version="1.0", install_requires=[], packages=setuptools.find_packages(), )
StarcoderdataPython
4900095
<reponame>EvilFlowersCatalog/EvilFlowersCatalog<filename>apps/api/filters/users.py import django_filters from apps.core.models import User class UserFilter(django_filters.FilterSet): id = django_filters.UUIDFilter() email = django_filters.CharFilter(lookup_expr='icontains') name = django_filters.CharFilt...
StarcoderdataPython
4903723
import re from requests import get from datetime import datetime from time import sleep from bs4 import BeautifulSoup now = datetime.now() time = datetime.strftime(now, "\n%d-%B-%Y\t%H:%M:%S:%f\n") types = { "dollar": { "name": "DOLAR", "path": "/serbest-piyasa/amerikan-dolari", "tag": "di...
StarcoderdataPython
1978786
from smqtk_classifier.classification_element_factory import ClassificationElementFactory from smqtk_classifier.impls.classification_element.memory import MemoryClassificationElement # Default classifier element factory for interfaces. DFLT_CLASSIFIER_FACTORY = ClassificationElementFactory( MemoryClassificationEle...
StarcoderdataPython
312331
import unittest from prediction_models import ( LastValueModel, ProphetModel, ) from forecast import ( importDataFrame, makeTrainDF, makeValidationDF, makeEmptyPredictionDF, ) from loss_functions import MAE, RMSE class NewTest(unittest.TestCase): def setUp(self): self.DATA_LOCA...
StarcoderdataPython
84206
import delorean from django.db.utils import IntegrityError from faker import Faker from accounts.models import User def generate_user(is_superuser=False, password=<PASSWORD>, save=True): fake = Faker() while True: first_name = fake.first_name() last_name = fake.last_name() simple_pro...
StarcoderdataPython
4806836
# 094 # Display an array of five numbers. Ask the user to select one # of the numbers. Once they have selected a number, display the # position of that item in the array. If they enter something that # is not in the array, ask them to try again until they select # a relevant item. import array as ar import numpy as np...
StarcoderdataPython
4979847
<reponame>Dachshund77/FlaskEwatson # Endpoint for co2 route from flask_json import json_response as res from flask import request as req from flask import abort from datetime import datetime from model.historic.HistoricCO2Model import HistoricCO2Model import logging import time import mariadb from flask import Blueprin...
StarcoderdataPython
9611776
<gh_stars>10-100 """ usage: add this 2 lines in MongoDB.py and run: with open(POSITION_OF_THIS_FILE+"update01.py","r") as f: exec(f.read()) fix the issue that some people are thought of interpretation man by judgement process incorrectly.(About 50%) Now their threshord (number of danmaku of being thought of interp...
StarcoderdataPython
6401043
import os import tempfile import yaml import jetstream from unittest import TestCase TESTS_DIR = os.path.dirname(os.path.abspath(__file__)) TEST_PIPELINES = os.path.join(TESTS_DIR, 'pipelines') jetstream.settings.clear() jetstream.settings.read(user=False) class PipelineCreation(TestCase): def set...
StarcoderdataPython
11311267
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2014 OpenERP SA (<http://www.openerp.com>) # # This program is free software: you can redistribute it and/or modify # it under the terms of...
StarcoderdataPython
8146339
# Americanadian # October 20, 2018 # By <NAME> consonants = "bcdfghjklmnpqrstvwxz" words = [] while True: word = input() if word!="quit!": words.append(word) else: break for word in words: if len(word) > 4: if consonants.count(word[-3]): if word[-2...
StarcoderdataPython
1631994
from design import * from config import * from PyQt5.QtWidgets import QDialog, QMainWindow, QApplication, QDialogButtonBox from PyQt5.QtCore import QSettings import sys import json import random class PassGenerador(QMainWindow, Ui_MainWindow): def __init__(self, parent=None): super().__init__(parent) ...
StarcoderdataPython
4810457
# for dot acess # arg = {'name': 'jojonki', age: 100} # conf = Config(**arg) # print(conf.name) ==> 'jojonki' class Config(object): def __init__(self, **entries): self.__dict__.update(entries)
StarcoderdataPython
8112195
<gh_stars>100-1000 # @copyright@ # Copyright (c) 2006 - 2019 Teradata # All rights reserved. Stacki(r) v5.x stacki.com # https://github.com/Teradata/stacki/blob/master/LICENSE.txt # @copyright@ import stack.mq import socket import os import json class Producer(stack.mq.producers.ProducerBase): """ Produces a messa...
StarcoderdataPython
12861570
<gh_stars>0 #--- Day 2: Bathroom Security --- from typing import List def parse(input_data: str) -> List[List[str]]: lines = input_data.strip().split() directions = [list(line) for line in lines] return directions def move1(x, y, direction): if direction == 'U': y -= 1 elif direction == ...
StarcoderdataPython
3378144
#Aula 109 #Desafio: ''' '''
StarcoderdataPython
9637166
<gh_stars>1-10 import random _mutateMIN = -100 _mutateMAX = 100 _mutationProbability = 0.3 class FormulaVariable: def __init__(self, ident): self.ident=ident def __repr__(self): return self.ident def evolveValue(self): #No values to mutate in a variable return False class FormulaInte...
StarcoderdataPython
324160
<reponame>Icemaush/BinCalc<gh_stars>0 import tkinter # Creates window. window = tkinter.Tk() window.title("BinCalc") # Creates frames inside window. top_frame = tkinter.Frame(window) top_frame.pack() mode_frame = tkinter.Frame(window) mode_frame.pack() entry_frame = tkinter.Frame(window) entry_frame.pack(...
StarcoderdataPython
99919
# Copyright 2017 Telstra Open Source # # 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 agre...
StarcoderdataPython
1690549
import torch import MinkowskiEngine as ME from torch.utils.tensorboard import SummaryWriter from typing import List from collections import defaultdict from models.transition_model import TransitionModel from utils.pad import unpack, get_gt_values from utils.util import timeit, downsample from utils.scheduler import In...
StarcoderdataPython
1739727
<gh_stars>0 """ Various year form """ from crispy_forms.bootstrap import FormActions from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout, Submit, HTML, Field from django import forms from django.forms.widgets import ClearableFileInput from django.utils.translation import ugettext as _ fro...
StarcoderdataPython
310865
# tests for continuous integration of the model import unittest import pickle class ModelTestcase(unittest.TestCase): def setUp(self): """Called before every test case.""" with open('ci_artifacts.pkl', 'rb') as f: ci_artifacts = pickle.load(f) self.text_original = ci_artifac...
StarcoderdataPython
9670500
<reponame>CourierKyn/GLOW-tf2 import tensorflow as tf import math import numpy as np DATASET = "cifar10" # dataset to train on LOAD_WEIGHT = True # model parameter SQUEEZE_FACTOR = 4 K_GLOW = 16 L_GLOW = 3 IMG_SIZE = 32 # better to be mult of SQUEEZE_FACTOR CHANNEL_SIZE = 3 ACTIVATION = tf.nn.relu6 KERNEL_INITIALIZ...
StarcoderdataPython
119747
<filename>Base Algorithms/spectrize_slow.py<gh_stars>0 from PIL import Image import math import soundfile as sf import numpy as np def getData(volume, freq, sampleRate, index): return int(volume * math.cos(freq * 6.28 * index /sampleRate)) def image_to_audio(filepath,sample_rate=44100,audio_duration=3): im = ...
StarcoderdataPython
8115642
<gh_stars>0 from uk_geo_utils.helpers import Postcode from data_importers.base_importers import BaseCsvStationsCsvAddressesImporter from data_importers.addresshelpers import ( format_residential_address, format_polling_station_address, ) class Command(BaseCsvStationsCsvAddressesImporter): council_id = "E0...
StarcoderdataPython
6539041
#!/usr/bin/python3 # -*- coding: utf-8 -*- SECURITY_TYPE_NONE = "NONE" SECURITY_TYPE_TRADE = "TRADE" #Endpoint requires sending a valid API-Key and signature. SECURITY_TYPE_MARGIN = "MARGIN" #Endpoint requires sending a valid API-Key and signature. SECURITY_TYPE_USER_DATA = "USER_DATA" #Endpoint requires sending a val...
StarcoderdataPython
9748115
<reponame>diegofregolente/30-Days-Of-Python<filename>12_Day_Modules/1_2.py import string import secrets def random_user_id(): char = string.ascii_letters + string.digits id = ''.join(secrets.choice(char) for i in range(6)) return id def user_id_gen_by_user(): char = string.ascii_letters + string.digit...
StarcoderdataPython
6480917
import subprocess import sys import textwrap def test_imports() -> None: # In a separate python process from pytest, import some common parts of # determined and ensure that no expensive imports are imported as side-effects. script = """ import sys import re import importlib ...
StarcoderdataPython
11369658
<filename>util/__init__.py # # 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 ...
StarcoderdataPython
1635337
import cv2 import os save_path=r"H:/03_1" #存储的位置 path = r"H:/03/" #要截取视频的文件夹 filelist = os.listdir(path) #读取文件夹下的所有文件 for item in filelist: if item.endswith('.mp4'): #根据自己的视频文件后缀来写,我的视频文件是mp4格式 try: src = os.path.join(path, item) vid_cap = cv2.VideoCapture(src) ...
StarcoderdataPython
4846296
# coding: utf-8 import pychatwork.api.model.Room import pychatwork.api.model.Message from pychatwork.api import errors class Room: def __init__ (self, chatwork, room=None): self.chatwork = chatwork self.room = None if isinstance(room, pychatwork.api.model.Room.Room): self.room = room def list (self): r...
StarcoderdataPython
3202654
<filename>MAPLEAF/Rocket/AeroFunctions.py<gh_stars>10-100 ''' Functions to calculate parameters relevant to aerodynamic calculations - Mach/Reynolds numbers, AOA, local frame air velocity etc... Used throughout the aeordynamics functions ''' import math from MAPLEAF.Motion import (AeroParameters, ForceMomentSys...
StarcoderdataPython
1725301
<reponame>kasanchez519/python-binaryaudit import unittest from binaryaudit import util class UtilTestSuite(unittest.TestCase): def test_no_sn(self): sn = "" fn = "/some/path/to/myexe" adir = "/hello/buildhistory/packages/cortexa57-poky-linux/somepkg/binaryaudit/abixml" exp...
StarcoderdataPython
1842024
<filename>aula17_modulo_de_divisao.py # resto da divisão: % exemplo: 6 / 2 = 0; 3 / 2 = 1. '''print(3%2) print(4%2) print(7%3.1) print(900%100==0)''' num1 = float(input("Digite um número: ")) num2 =float(input("Digite outro número: ")) divisao = num1 / num2 resto = num1 % num2 print() print(num1, "dividido por", nu...
StarcoderdataPython
9798134
<filename>tests/rest_users_unittest.py import os import sys sys.path.append(os.path.abspath(os.path.join('..'))) from models.users import User from wsgi import app import unittest app.app_context().push() ADMIN_LOGIN = User.query.get(1).login ADMIN_PASSWORD = User.query.get(1).password class FlaskTestCases(unitte...
StarcoderdataPython
1815759
<reponame>pecimuth/synthia from flask import Blueprint, request, g from jwt import ExpiredSignatureError, InvalidTokenError from sqlalchemy.exc import IntegrityError from core.facade.user import UserFacade from core.model.user import User from core.service.auth.password import PasswordService from web.controller.util ...
StarcoderdataPython
12834634
<gh_stars>1-10 from scripts import custom def test_map_priority(): raw_input_1 = "0" output_1 = custom.map_priority(raw_input_1) assert output_1 == "stat" raw_input_2 = 0 output_2 = custom.map_priority(raw_input_2) assert output_2 == "stat" raw_input_3 = "1" output_3 = custom.map_pr...
StarcoderdataPython
9642942
<filename>pulumi-aks-private/__main__.py """An Azure RM Python Pulumi program""" import pulumi from pulumi_azure_native import storage from pulumi_azure_native import resources from pulumi_azure_native import network from pulumi_azure_native import containerservice from pulumi_azure_native import compute # Setting up...
StarcoderdataPython
1642910
<reponame>nauhc/visfa # load model import torch from torch.utils.data import DataLoader from .biLSTM_multi_to_one import biLSTM_multi_to_one from parameter import HIDDEN_SIZE, NUM_LAYERS, FEATURE_SIZE, SEQ_SIZE, OUT_SIZE, USE_GPU class biLSTM_inference: def __init__(self, filepath, time, epoch, accuracy): ...
StarcoderdataPython
6694895
<filename>mkt/api/tests/test_fields.py # -*- coding: utf-8 -*- from nose.tools import eq_ from amo.tests import TestCase from mkt.api.fields import TranslationSerializerField from mkt.site.fixtures import fixture from mkt.webapps.models import Webapp from translations.models import Translation class TestTranslationS...
StarcoderdataPython
1937174
import random import re import sys import time import urllib import xml.etree.ElementTree import time import pdb import validators __author__ = "<NAME>" __copyright__ = "Copyright (C) 2018 <NAME>" __license__ = "MIT" __version__ = "2.2" __email__ = "<EMAIL>" """ Supporting methods. See docs in fea...
StarcoderdataPython
3418842
# https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/ import math class Solution: def searchRange(self, nums: List[int], target: int) -> List[int]: val = -1 L, R = 0, len(nums) while (L != R): index = math.ceil((L + R) // 2) if n...
StarcoderdataPython
8110359
<reponame>tiagotda/anime-dl<filename>anime_dl/Anime_dl.py #!/usr/bin/env python # -*- coding: utf-8 -*- try: from urllib.parse import urlparse except ImportError: from urlparse import urlparse import sites from sys import exit '''First, the honcho returns the website name and after that, the corresponding m...
StarcoderdataPython
4877512
<gh_stars>0 import os import autolnp import autolnp.log as log import autolnp.util as util valid_platforms = ('linux', 'mac', 'windows') def create(name, module, platforms, dest): platforms = list(set(platforms)) platforms.sort() invalid_platforms = list(filter(lambda p: p not in valid_platforms, platforms...
StarcoderdataPython
6467036
import chryslercan from values import CAR from selfdrive.can.packer import CANPacker from cereal import car VisualAlert = car.CarControl.HUDControl.VisualAlert AudibleAlert = car.CarControl.HUDControl.AudibleAlert import unittest class TestChryslerCan(unittest.TestCase): def test_checksum(self): self.assertE...
StarcoderdataPython
9681380
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-10-15 05:31 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('awwwards', '0012_awwwardscriteria'), ] operations = [ migrations.DeleteModel( ...
StarcoderdataPython
1719904
<filename>data_update_ui.py #!usr/bin/env python #-*- coding:utf-8 _*- """ @version: author:Sleepy @time: 2017/08/08 @file: data_update.py @function: @modify: """ import copy import traceback import threading from PyQt5.QtCore import QTimer, pyqtSignal from PyQt5.QtWidgets import QHeaderView from Utiltity.common impo...
StarcoderdataPython
3433468
import os import re from contextlib import contextmanager from typing import Union, Type from pathlib import Path from timefred.config import config from timefred.store import Work, Day, store from timefred.time import XArrow from time import time_ns @contextmanager def assert_raises(exc: Type[Exception], match: Uni...
StarcoderdataPython
12826770
from aoc.day04.cell import Cell class Board: def __init__(self, raw_board: list[str]): self.board_state = [ [Cell(int(d)) for d in r.split()] for r in raw_board ] def mark(self, number: int): for row in self.board_state: for cell in row: ...
StarcoderdataPython
9773053
#!/usr/bin/env python def fizzbuzz(number): answer = [] if number % 3 == 0: answer.append('fizz') if number % 5 == 0: answer.append('buzz') if not answer: answer.append(str(number)) return ' '.join(answer) if __name__ == '__main__': import sys if len(sys.argv) != ...
StarcoderdataPython
9742263
<gh_stars>0 from __future__ import print_function, absolute_import, unicode_literals, division # Tree Node with different things that helps to build the AVL Tree class TreeNode(): # It instantiates the class def __init__ (self, val): self.val = val self.place = 0 self.height = 1 ...
StarcoderdataPython
5119779
<filename>books_library/users/apis/serializers.py<gh_stars>1-10 # Serializers define the API representation. from rest_framework import serializers from ..models import User class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = User fields = ('username', 'email', 'image...
StarcoderdataPython
182694
<gh_stars>0 from django.shortcuts import render, redirect from shop.models import Product from .models import Cart, CartItem from django.core.exceptions import ObjectDoesNotExist def _cart_id(request): cart = request.session.session_key if not cart: cart = request.session.create() return cart def add_cart(reques...
StarcoderdataPython
9707557
import subprocess import shutil def execute(cmd, capture=False): """Execute a command. :arg cmd: Command. If ``cmd`` is a :class:`str`, the command would be invoked with shell. :type cmd: list or str :arg bool capture: If ``True`` then enter the capture mode: process output will be...
StarcoderdataPython
3522727
<gh_stars>1-10 from enum import Enum # PredictLabel() is an enum for BENIGN or ANOMALY prediction output of # ML models doing novelty detection. class PredictLabel(Enum): BENIGN = 1 ANOMALY = -1 # Column names for CICFlowMeter generated datasets. COLUMNS = ['Flow ID', 'Src IP', 'Src Port', 'Dst IP', 'D...
StarcoderdataPython
6536998
# Copyright (c) Microsoft Corporation # All rights reserved. # # MIT License # # Permission is hereby granted, free of charge, # to any person obtaining a copy of this software and associated # documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights...
StarcoderdataPython
1755229
<reponame>RLado/Aeropendulum-IOT #views.py #Flask app for the Aeropendulum_IOT project #8th October 2019 #<NAME> <<EMAIL>> from flask import Blueprint, render_template, Response #Camera from .camera_opencv import Camera #Chart modules from datetime import datetime import time import json #Serial comunications from mul...
StarcoderdataPython
5006706
import lldb from lldbsuite.test.lldbtest import * from lldbsuite.test.decorators import * class InvalidArgsCommandTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @no_debug_info_test def test_script_add(self): self.expect("command script add 1 2", error=True, subst...
StarcoderdataPython
6617340
import json import logging import pprint import urllib import requests from django.conf import settings from django.http import JsonResponse from jinja2 import Template from ew_common.email_service import EmailService from ew_common.input_validation import extract_phone_number, normalize_name from ew_common.mobile_co...
StarcoderdataPython
1653373
<reponame>PhillipKP/proper-models """Show phase and amplitude at key planes in the Habex PROPER model.""" # Copyright 2020, by the California Institute of Technology. ALL RIGHTS # RESERVED. United States Government Sponsorship acknowledged. Any # commercial use must be negotiated with the Office of Technology Transfer ...
StarcoderdataPython
9610649
# BSD 3-Clause License # # Copyright (c) 2020, <NAME> # All rights reserved. from gpa import signals from gpa.tools import GeometricalPhaseAnalysisTool from gpa import datasets __all__ = [ "datasets", "GeometricalPhaseAnalysisTool", "signals", ] __version__ = 0.1
StarcoderdataPython