id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
47181
<filename>apimodule/auctionhouse.py import requests def getDumpFile(apiKey): requestUri = "https://eu.api.battle.net/wow/auction/data/azjol-nerub?locale=en_US&apikey=%s" % apiKey r = requests.get(requestUri); jsonData = r.json() try: fileData = jsonData["files"][0] return fileData...
StarcoderdataPython
3261542
#Ingresando datos print("Ingrese los kilometros recorridos con su motocicleta:") km=float(input()) print("Ingrese la cantidad de litros que consumió durante su recorrido:") lt=float(input()) print(f"Kilometros rescorridos: {km}") print(f"Litros de combustible gastados: {lt}") print("El consumo por kilometro es d...
StarcoderdataPython
1740043
<reponame>PillarDevelopment/sto import binascii import calendar import datetime from logging import Logger from typing import Optional from eth_account import Account from eth_utils import from_wei, to_bytes from web3 import Web3, HTTPProvider from sto.ethereum.utils import check_good_node_url, check_good_private_key,...
StarcoderdataPython
3323597
__author__ = '(Multiple)' __project__ = "Food-Pantry-Inventory" __creation_date__ = "06/03/2019" from django.test import TestCase from fpiweb.forms import \ BuildPalletForm,\ NewBoxForm from fpiweb.models import Box, BoxType class NewBoxFormTest(TestCase): fixtures = ('BoxType', 'Constraints') de...
StarcoderdataPython
3352272
# -*- coding:utf-8 -*- class DocumentTraceFile(object): """ """ def __init__(self, tracing_file_path, is_index_file=False): if tracing_file_path: self.file_path = tracing_file_path self.is_index_file = is_index_file else: raise Exception("tracing_file_...
StarcoderdataPython
169622
<filename>lib/fama/gene_assembler/contig.py """This module describes Contig class""" from collections import defaultdict class Contig: """Contig objects stores data about an assembled contig: sequence, number of mapped reads, list of aligned reads, sizes of alignment etc. Attributes: contig_id (s...
StarcoderdataPython
1623122
<filename>src/data_processing/plot/__main__.py #!/usr/bin/python import sys, os sys.path.append('/home/karim/workspace/vscode-python/ADNI_Data_processing/src/data_processing') import config.config_read as rsd import services.tools as tls import io_data.data_acces_file as daf import matplotlib.pyplot as plt import nu...
StarcoderdataPython
1637837
<filename>geometry.py # -*- encoding=utf8 -*- __author__ = "<NAME>" import math def calc_degrees(point1, point2): """ 计算角度 :param point1: :param point2: :return: """ if point1[1] == point2[1]: return 0 if point1[0] == point2[0]: return 90 if point1[0] < point2[0]...
StarcoderdataPython
4804929
import scipy.interpolate import numpy as np import xarray as xr import os import matplotlib.pyplot as plt from regrid import get_ease_coords def read_mask(): """ Returns Northern hemisphere high resolution LOCI mask """ diri = '/oldhome/apbarret/projects/ancillary/masks' fili = 'Nh_loci_land...
StarcoderdataPython
3332429
<reponame>parada3desu/deepcomparer.py import unittest from deepcomparer import deep_compare class TestCompareTuple(unittest.TestCase): def test_empty_tuple(self): """ Test empty tuple """ data1: tuple = () data2: tuple = () result = deep_compare(data1, data2) ...
StarcoderdataPython
120390
from django.db.models import IntegerChoices, TextChoices from django.utils.translation import gettext_lazy as _ class WinterStorageMethod(TextChoices): ON_TRESTLES = "on_trestles", _("On trestles") ON_TRAILER = "on_trailer", _("On a trailer") UNDER_TARP = "under_tarp", _("Under a tarp") class Applicatio...
StarcoderdataPython
1706183
<filename>BGWpy/core/__init__.py from . import util from .writable import * from .F90io import * from .runscript import * from .task import * from .workflow import *
StarcoderdataPython
3229517
import os import json from django.apps import AppConfig import torch from . import AI class MainConfig(AppConfig): name = 'main' @staticmethod def get_rating(sentence): return AI.get(sentence)
StarcoderdataPython
4815057
<reponame>decached/taylr<filename>lib/exceptions.py class APIException(Exception): """API Exception, which is to be used for all failed responses.""" def __init__(self, code, msg, details=None): self.code = code self.msg = msg self.details = details def __str__(self): return...
StarcoderdataPython
3397530
#!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt def main(): L = 10. ne = 30 a = 1. cfl = 0.5 Dmax = L/2. tmax = Dmax/a x = np.linspace(0., L, ne+1) dx = x[1]-x[0] u1 = np.zeros(len(x)) u2 = np.zeros(len(x)) line, = plt.plot...
StarcoderdataPython
3341672
i = int(input()) for x in range(i): n = int(input()) a = map(int,input().split(' ')) a.sort() ans = 0 cur = 1 for y in range(len(a)): if (a[y] >= cur): ans += 1 cur += 1 print("Case #"+str(x+1),ans)
StarcoderdataPython
4835010
from unittest import TestCase class TestSendReceive(TestCase): pass
StarcoderdataPython
125280
from tests.base import DBTestCase from tests.example_app.tables import Manager class TestToDict(DBTestCase): def test_to_dict(self): """ Make sure that `to_dict` works correctly. """ self.insert_row() instance = Manager.objects().first().run_sync() dictionary = ins...
StarcoderdataPython
3398657
import importlib def python_module_exists(module_name: str) -> bool: spam_spec = importlib.util.find_spec(module_name) return spam_spec is not None
StarcoderdataPython
34714
<gh_stars>0 #!/usr/bin/env python3 import os import sys from shutil import copyfile, move import argparse from glob import glob sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) from Metronome import distributed_execution def generate_astar_configs(domain_paths, domain_type): config_...
StarcoderdataPython
4821915
<filename>app/models/order.py # -*- encoding: utf-8 -*- """ @File : order.py @Time : 2020/4/24 13:53 @Author : Tianjin @Email : <EMAIL> @Software: PyCharm """ from lin.interface import InfoCrud as Base from sqlalchemy import Column, Integer, ForeignKey, Float, Boolean class Order(Base): __tablename__ = ...
StarcoderdataPython
1690591
<reponame>martincochran/score-minion #!/usr/bin/env python # # Copyright 2015 <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
StarcoderdataPython
1781884
from datetime import datetime, timedelta import os import uuid import jwt import json import requests from functools import wraps from urlparse import parse_qs, parse_qsl from urllib import urlencode from flask import Flask, g, send_file, request, redirect, url_for, jsonify, send_from_directory, Response from requests_...
StarcoderdataPython
3253383
''' Test the trajectory optimization procedures. ''' import tensorflow as tf class TestTrajOpt(tf.test.TestCase): ''' Test the trajectory optimization procedures. ''' def test_naive_trajopt(self): ''' Test the naive_trajopt function. ''' pass if __name__ == '__main__': tf.tes...
StarcoderdataPython
1694212
<reponame>incuna/incuna-groups from crispy_forms.bootstrap import FormActions, StrictButton from crispy_forms.helper import FormHelper from crispy_forms.layout import Layout from django import forms from django.core.urlresolvers import reverse_lazy from . import models class BaseAddCommentForm(forms.ModelForm): ...
StarcoderdataPython
33401
<reponame>celord/mealprep from django import forms from django.forms import ModelForm from .models import Plan class DateInput(forms.DateInput): input_type = "date" class AddPlanForm(ModelForm): class Meta: model = Plan # fields = fields = '__all__' fields = [ "date", ...
StarcoderdataPython
144621
import pytest import torch from torch import nn from daceml.pytorch import DaceModule from daceml.testing import torch_tensors_close @pytest.mark.gpu def test_dropout_fwd_training(): p = 0.5 module = nn.Dropout(p=p).cuda().train() dace_module = DaceModule(module, dummy_inputs=...
StarcoderdataPython
3245897
# MIT License # # Copyright (c) 2018 Image & Vision Computing Lab, Institute of Information Science, Academia Sinica # # 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, inc...
StarcoderdataPython
4812275
<gh_stars>0 from ast import arg from wifipumpkin3.core.common.terminal import ExtensionUI from wifipumpkin3.core.utility.printer import ( setcolor, display_messages, display_tabulate, ) # This file is part of the wifipumpkin3 Open Source Project. # wifipumpkin3 is licensed under the Apache 2.0. # Copyrigh...
StarcoderdataPython
1684945
import socket from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_OAEP import json import logging from ery4z_toolbox.utils import get_random_string, AESCipher class Client: """General purpose client usable with the provided server class. It support RSA and AES encryption depending on th...
StarcoderdataPython
3283866
# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE). # 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 2 of the License, or (at your option) any later # version. # # This program...
StarcoderdataPython
143065
# -*- coding: utf-8 -*- import os.path as op import psutil def _abspath(path): return op.abspath(op.expanduser(path)) def gather_notebooks(): """ Gather processes of IPython Notebook Return ------ notes : list of dict each dict has following keys: "pid", "cwd", and "port" Raises ...
StarcoderdataPython
3371443
import httpx from fastapi import APIRouter, HTTPException from fastapi.requests import Request from fastapi.responses import JSONResponse, Response from httpx import HTTPError from app.log import logger from settings import conf router = APIRouter() timeout = httpx.Timeout(30) client = httpx.AsyncClient(timeout=timeo...
StarcoderdataPython
1648691
"""Pack the modules contained in the controller directory.""" from typing import Tuple, Dict, List, Any, Union ResponseTuple = Tuple[Union[Dict[str, List[Dict[str, Any]]], str, Dict[str, Any]], int]
StarcoderdataPython
107937
<filename>dbcut/sqlalchemy_utils.py # -*- coding: utf-8 -*- # This module comes from the sqlalchemy-utils package # These functions have been slightly patched to support sqlalchemy 1.4+ import os from copy import copy import sqlalchemy as sa from sqlalchemy.engine.interfaces import Dialect from sqlalchemy.engine.url i...
StarcoderdataPython
3335873
from flask import render_template, request, current_app, g, redirect, url_for from maintain_frontend.decorators import requires_permission from maintain_frontend.constants.permissions import Permissions from maintain_frontend.view_modify_lon.validation.cancel_lon_validator import CancelLonValidator from maintain_fronte...
StarcoderdataPython
1642931
<filename>proj_issues/mcbv/edit.py<gh_stars>1-10 from django.forms import models as model_forms from django.core.exceptions import ImproperlyConfigured from django.http import HttpResponseRedirect from django.utils.encoding import force_text from django.db import models from django.contrib import messages from django....
StarcoderdataPython
1637738
from pkg_resources import get_distribution __version__ = get_distribution('behave_http').version
StarcoderdataPython
1769795
_auther_ = 'Harry' _date_ = '2/1/2018 9:56 PM'
StarcoderdataPython
3233416
<reponame>Tapawingo/FreeTakServer<filename>FreeTAKServer/model/Enumerations/connectionTypes.py ####################################################### # # connectionTypes.py # Python implementation of the Enumeration connectionTypes # Generated by Enterprise Architect # Created on: 07-Dec-2021 7:23:24 PM # Origin...
StarcoderdataPython
3323416
<reponame>MuriloChaves/prova-de-conceito # -*- coding: utf-8 -*- # Importa bibliotecas necessárias from PIL import Image import os def main(): ''' Função principal que, realiza todo o escopo de código da conversão. ''' # Abre a imagem e realiza a conversão imagem = Image.open('./data/doguinho.png...
StarcoderdataPython
23885
<gh_stars>1-10 #!/usr/bin/env python import sys import matplotlib import numpy as np import random import itertools import socket import sklearn.metrics from scipy.optimize import minimize from scipy.optimize import Bounds from sklearn import preprocessing from sklearn.preprocessing import OneHotEncoder from sklearn....
StarcoderdataPython
1741899
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from datetime import datetime from dateutil.relativedelta import relativedelta from psycopg2 import IntegrityError from odoo import fields from odoo.exceptions import AccessError, ValidationError, UserError from odoo.t...
StarcoderdataPython
3320746
<gh_stars>0 from abc import ABC, abstractmethod from django.conf import settings from django.core.cache import cache class BaseExcelClass(ABC): """ Base excel class will be use as abstract class for making interface between the excel and csv file(flat file) to update into server data base as dja...
StarcoderdataPython
133084
from py_pdf_term._common.data import Term from py_pdf_term.tokenizer import Token from py_pdf_term.tokenizer.langs import JapaneseTokenClassifier from ..base import BaseJapaneseCandidateTermFilter class JapaneseProperNounFilter(BaseJapaneseCandidateTermFilter): def __init__(self) -> None: self._classifie...
StarcoderdataPython
1798426
# -*- coding: utf-8 -*- from django.db import models from django.conf import settings from tinymce.models import HTMLField EnhancedTextField = HTMLField if 'tinymce' in settings.INSTALLED_APPS else models.TextField
StarcoderdataPython
65804
import pytest from tests.common.helpers.assertions import pytest_require from tests.common.fixtures.conn_graph_facts import conn_graph_facts,\ fanout_graph_facts from tests.common.ixia.ixia_fixtures import ixia_api_serv_ip, ixia_api_serv_port,\ ixia_api_serv_user, ixia_api_serv_passwd, ixia_api, ixia_testbed f...
StarcoderdataPython
3335672
<reponame>UbiOps/command-line-interface import ubiops as api from datetime import datetime, timedelta from ubiops_cli.utils import init_client, get_current_project from ubiops_cli.src.helpers.formatting import print_item, format_logs_reference, format_logs_oneline, parse_datetime, \ print_list, format_json, format...
StarcoderdataPython
1672847
<gh_stars>0 import pandas as pd import argparse import sys parser = argparse.ArgumentParser(description='Reformats a met-office weather data file. Input data has one row per year and one column per month. Output data has a date column and a value column.') parser.add_argument('data_file',metavar='DATA_FILE', help...
StarcoderdataPython
3253754
import b class C(object): def foo(self): b = B()
StarcoderdataPython
1789082
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Sat May 25 14:23:16 2019 @author: Sikander """ import numpy as np import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap from dateutil.relativedelta import relativedelta from datetime import datetime import pickle from scipy.spatial.distance imp...
StarcoderdataPython
3319676
<gh_stars>0 """Create Flask application object. This module creates the Flask appliaction object so that each module can import it safely and the __name__ variable will always resolve to the correct package. """ from flask import Flask from flask_cors import CORS, cross_origin APP = Flask(__name__) CORS(APP) APP.conf...
StarcoderdataPython
3289351
from .fplEntity import FplEntity class FplDailyUsageSensor(FplEntity): def __init__(self, coordinator, config, account): super().__init__(coordinator, config, account, "Daily Usage") @property def state(self): data = self.getData("daily_usage") try: self._state = data...
StarcoderdataPython
1678476
<filename>terrascript/chef/r.py # terrascript/chef/r.py import terrascript class chef_acl(terrascript.Resource): pass class chef_client(terrascript.Resource): pass class chef_cookbook(terrascript.Resource): pass class chef_data_bag(terrascript.Resource): pass class chef_data_bag_item(terrascr...
StarcoderdataPython
1745839
<reponame>jhanley634/changepoint #! /usr/bin/env python # Copyright 2021 <NAME>. MIT licensed. from numpy.polynomial import Polynomial from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_absolute_error from sklearn.preprocessing import PolynomialFeatures import matplotlib.pyplot as plt ...
StarcoderdataPython
3314037
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param: A: an integer array @return: A tree node """ def sortedArrayToBST(self, A): return self.buildTree(A,0,len(A)-1) ...
StarcoderdataPython
3274505
<filename>extraction.py<gh_stars>0 from flask_wtf import FlaskForm from wtforms import SubmitField from flask import make_response import mysql.connector import pandas as pd import time from pprint import pprint class DownloadCSVData: def __init__(self): try: mydb = mysql.connector.c...
StarcoderdataPython
40489
from unittest import TestCase from src.stack import StackWithMaxValue class TestStackWithMaxValue(TestCase): def test_push(self): stack = StackWithMaxValue() stack.push(1) stack.push(2) stack.push(3) self.assertEqual([1, 2, 3], stack.as_list()) def test_pop(self): ...
StarcoderdataPython
4832375
<reponame>canance/signpi-server<filename>frontend/urls.py # Author: <NAME> <<EMAIL>> # Revision: 6 February 2016 # # Copyright 2016 Coastal Carolina University # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy...
StarcoderdataPython
4814641
import torch.utils.data as data import numpy as np import os, sys BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) import data_transforms from .io import IO import json from .build import DATASETS # References: # - https://github.com/hzxie/GRNet/blob/master/utils/data_loaders.py @DATASET...
StarcoderdataPython
160534
from django.shortcuts import render from django.http import HttpResponse from .forms import SubscribeForm from products.models import * # Create your views here. def landing_view(request): name = "landing_view" form = SubscribeForm(request.POST or None) if request.method == "POST" and form.is_valid(): ...
StarcoderdataPython
1618798
<reponame>BupyeongHealer/SAMSUNG_SAIDALAB_RLCustom # Copyright (C) 2019 SAMSUNG SDS <<EMAIL>> # # This code is distribued under the terms and conditions from the MIT License (MIT). # # Authors : <NAME>, <NAME>, <NAME>, <NAME> from core.common.agent import Agent from core.common.util import * import math class PPOAg...
StarcoderdataPython
1799631
<gh_stars>0 # -*- coding: utf-8 -*- # # Copyright 2015-2020 BigML # # 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
4833156
<gh_stars>0 # -------------------------------------------------------------------------- # # MyCSPath # mycspath.py # author: <NAME> # # -------------------------------------------------------------------------- from flask import Flask, request, make_response, redirect, url_for from flask import render_template, sessi...
StarcoderdataPython
1722213
"""Kick off for training A3C agent training""" import argparse import datetime from stable_baselines.common.policies import MlpPolicy, FeedForwardPolicy from stable_baselines.common.vec_env import DummyVecEnv, SubprocVecEnv from stable_baselines import PPO2 from loveletter.env import LoveLetterEnv from loveletter.ar...
StarcoderdataPython
37182
<gh_stars>1-10 import math from pomagma.compiler.expressions import Expression_1 from pomagma.compiler.util import log_sum_exp, memoize_make, set_with def assert_in(element, set_): assert element in set_, (element, set_) def assert_not_in(element, set_): assert element not in set_, (element, set_) def as...
StarcoderdataPython
4815384
import psycopg2 from app import app from pgdatabase import PgDatabase @app.route('/') @app.route('/index') def index(): return "This is the Index Page" @app.route('/master') def mastercheck(): try: db = PgDatabase() my_list = db.query("SHOW transaction_read_only") my_string = ...
StarcoderdataPython
1787778
<filename>thelma/tools/parsers/rackscanning.py """ This file is part of the TheLMA (THe Laboratory Management Application) project. See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information. .. currentmodule:: thelma.entities.rack General ....... This parser deals with rack scanning output files. T...
StarcoderdataPython
1751872
import pytest @pytest.mark.bare def test_import(): from pytsammalex import clld from pytsammalex import lexibank assert clld and lexibank
StarcoderdataPython
141062
def rpn_eval(tokens): def op(symbol, a, b): return { '+': lambda a, b: a + b, '-': lambda a, b: a - b, '*': lambda a, b: a * b, '/': lambda a, b: a / b }[symbol](a, b) stack = [] for token in tokens: if isinstance(token, float): ...
StarcoderdataPython
3065
from setuptools import setup setup( name="greek-utils", version="0.2", description="various utilities for processing Ancient Greek", license="MIT", url="http://github.com/jtauber/greek-utils", author="<NAME>", author_email="<EMAIL>", packages=["greekutils"], classifiers=[ "D...
StarcoderdataPython
1763450
<reponame>MayborodaPavel/testPlatform from django.contrib.auth.models import AbstractUser from django.db import models from django.urls import reverse_lazy class User(AbstractUser): username = models.CharField(max_length=150, blank=True, null=True) email = models.EmailField(unique=True, max_length=255) do...
StarcoderdataPython
3270311
<filename>src/kdmukai/specterext/bitcoinreserve/client.py import json import logging import requests from decimal import Decimal from flask import current_app as app from werkzeug.wrappers import auth from kdmukai.specterext.bitcoinreserve.service import BitcoinReserveService logger = logging.getLogger(__name__) ...
StarcoderdataPython
85571
<filename>python/testData/paramInfo/NoArgsException.py<gh_stars>0 def function(param, param1): pass def result(): pass function(result<arg1>(), result())
StarcoderdataPython
36911
import logging from parsl.monitoring.handler import DatabaseHandler from parsl.monitoring.handler import RemoteHandler from parsl.utils import RepresentationMixin class NullHandler(logging.Handler): """Setup default logging to /dev/null since this is library.""" def emit(self, record): pass class M...
StarcoderdataPython
3384543
<gh_stars>0 from django.shortcuts import render from .models import Coins from rest_framework import viewsets from rest_framework import permissions, generics from .serializers import CoinsSerializer # Create your views here. class CoinViewSet(viewsets.ModelViewSet): queryset = Coins.objects.all() serializer_...
StarcoderdataPython
3213194
<gh_stars>1-10 import os import json import logging import numpy from osgeo import gdal from ground_surveyor import gsconfig def pick_best_pile_layer(pile_md_filename, selection_options): pile_md = json.load(open(pile_md_filename)) best_i = -1 best_value = 0 targe...
StarcoderdataPython
3316182
import math import numpy as np from .gazebo_env import GazeboEnv import logging logger = logging.getLogger("gymfc") class AttitudeFlightControlEnv(GazeboEnv): def compute_reward(self): """ Compute the reward """ return -np.clip(np.sum(np.abs(self.error))/(self.omega_bounds[1]*3), 0, 1) def sa...
StarcoderdataPython
136510
import logging, os logging.disable(logging.WARNING) os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" import tensorflow as tf from tensorflow.keras import models from tensorflow.keras import layers from tensorflow.keras.layers import BatchNormalization, Conv2D, UpSampling2D, MaxPooling2D, Dropout from tensorflow.keras.optimiz...
StarcoderdataPython
191302
<reponame>pulina/tastypie-queryset-client from decimal import Decimal from datetime import datetime #from django.conf import settings #settings.DEBUG = True from testcases import ( TestServerTestCase, get_client ) from django.core.management import call_command from .utils import id_generator def _getDateTime...
StarcoderdataPython
67763
<gh_stars>0 import sys from pathlib import Path path = str(Path(__file__).parents[1].resolve()) sys.path.append(path) import argparse import random import numpy as np import librosa import rospy from std_msgs.msg import UInt8MultiArray from imperio.sonorus.audio.utils import audio_int2float from imperio.robot.hr.li...
StarcoderdataPython
82082
<filename>samples/fn_functions.py #!/usr/bin/env python3 # The MIT License (MIT) # # Copyright (c) 2017 allancth # # 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, inclu...
StarcoderdataPython
3386682
<gh_stars>1-10 import tensorflow as tf class TextClassifierCNNModel(object): def __init__(self, seq_length=600, num_classes=10, vocab_size=5000, embedding_dim=64, num_filters=256, kernel_size=5, ...
StarcoderdataPython
3294610
from datetime import timedelta import arrow from django.conf import settings from django.contrib.auth import get_user_model from django.core.files.base import ContentFile from django.utils import timezone from model_bakery import baker from devilry.apps.core.deliverystore import MemoryDeliveryStore from devilry.apps....
StarcoderdataPython
3295258
<filename>db_tools/cli.py import click from datetime import datetime from pathlib import Path from captif_db_config import Config from db_tools import __version__ from db_tools.tools import ( generate_duplicate_database, dump_database, restore_database, ) @click.version_option(__version__, prog_name="db...
StarcoderdataPython
149286
<gh_stars>0 # MAKE_ENDS def make_ends(nums): return [nums[0], nums[0]] if len(nums)<2 else [nums[0], nums[len(nums)-1]]
StarcoderdataPython
4834876
# -*- coding: utf-8 -*- #------------------------------------------------------------------------------- # Name: ifields_methods.py # Purpose: store custom methods for wrapper class of IFields Interface # Licence: MIT License #------------------------------------------------------------------------------...
StarcoderdataPython
3266131
#FLM: Remove empty glyphs # Removes all empty glyphs from a font font = fl.font glyphs = font.glyphs namesToKeep = [ '.notdef', 'NULL', 'CR', 'space' ] # Find all the empty glyphs for glyph in reversed(glyphs): if not glyph.nodes and not glyph.components: if not glyph.name in namesToKeep: del glyphs[font.FindGl...
StarcoderdataPython
1674815
import smart_imports smart_imports.all() class GeneralTest(utils_testcase.TestCase): def setUp(self): super(GeneralTest, self).setUp() game_logic.create_test_map() self.account = self.accounts_factory.create_account() self.storage = game_logic_storage.LogicStorage() se...
StarcoderdataPython
3220056
# coding: utf-8 # /*########################################################################## # # Copyright (c) 2016-2021 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to d...
StarcoderdataPython
134110
import xlwt # 这是操作excel的库,需要安装这个库 命令: pip install xlwt import requests from lxml import etree # 上面这两行是需要装的库 # 目前只取了列表页店铺名和商品名和价格信息,评价数暂时拿不到 def get_lsf_info_from_jd(): """京东螺狮粉部分信息""" # 这是请求头信息 headers = { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KH...
StarcoderdataPython
1693687
from setuptools import setup setup( name='autodsp', version='0.0.1', description='Code to reproduce the 2021 WASPAA paper titled AUTO-DSP: LEARNING TO OPTIMIZE ACOUSTIC ECHO CANCELLERS.', author='<NAME>, <NAME>, <NAME>', author_email='<EMAIL>', url='https://github.com/jmcasebeer/autodsp', packages...
StarcoderdataPython
3201208
# coding: utf-8 from __future__ import absolute_import, unicode_literals from enum import Enum from six import text_type class TextEnum(text_type, Enum): def __repr__(self): return self._value_ # pylint:disable=no-member def __str__(self): return str(self.value) # pylint:disable=no-member
StarcoderdataPython
121992
"""Test module for the user profile endpoint""" import os import pytest from unittest.mock import Mock from tempfile import NamedTemporaryFile from django.urls import resolve, reverse from django.core.files.uploadedfile import SimpleUploadedFile from rest_framework.test import APIClient import cloudinary.uploader fr...
StarcoderdataPython
1665639
<gh_stars>1-10 import pytest from lamberthub.universal_solvers import izzo @pytest.mark.parametrize("M", [1, 2, 3]) def test_minimum_time_of_flight_convergence(M): ll = -1 x_T_min_expected, T_min_expected = izzo._compute_T_min( ll, M, maxiter=10, atol=1e-8, rtol=1e-10 ) y = izzo._compute_y(x_...
StarcoderdataPython
194371
#!/usr/bin/env python # generate a jsonl version of a small slice of a dataset that can be fed to megatron-lm preprocessor import sys from datasets import load_dataset dataset_name = "stas/openwebtext-10k" # subset to jsonlines n_samples = 1000 ds = load_dataset(dataset_name, split='train') ds_small = ds.select(ran...
StarcoderdataPython
1606690
<reponame>Django-Lessons/lesson-31-python-logging<gh_stars>1-10 class Disk(): def __init__(self): pass def free(self): return 0 def total(self): return 0
StarcoderdataPython
1765809
# Multiples of 3 and 5 # Find the sum of all the multiples of 3 or 5 def multiplesOf3and5(num): sums = sum(n for n in range(num) if n%3 == 0 or n%5 == 0) return sums
StarcoderdataPython
126900
<gh_stars>0 # -*- coding: utf-8 -*- from optparse import make_option import sys import traceback from django.conf import settings from django.core.management.base import NoArgsCommand from django.core.management.color import no_style from django.utils.datastructures import SortedDict from django.utils.importlib impor...
StarcoderdataPython
4812483
<filename>whampy/tests/test_load_SkySurvey.py import pytest import numpy as np import astropy.units as u from ..skySurvey import SkySurvey from ..skySurvey import directory # Set up the random number generator. np.random.seed(1234) # When running tests locally: filename = "/Users/dk/Data/WHAM/wham-ss-DR1-v161116-1...
StarcoderdataPython