id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
87147
<filename>nba_project/users/migrations/0002_user_department.py # Generated by Django 2.0.9 on 2018-10-28 09:08 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('main', '__first__'), ('u...
StarcoderdataPython
85384
<filename>old_officers.py # @author: <NAME>, <NAME>, <NAME> (for add_users) from __future__ import (division, absolute_import, print_function, unicode_literals) from hknlib.election.settings import ELECTION_SPREADSHEET_ID, NEW_OFFICER_RANGE from hknlib.election.cred import get_credentials fro...
StarcoderdataPython
4812503
# coding: utf-8 from __future__ import annotations from datetime import date, datetime # noqa: F401 import re # noqa: F401 from typing import Any, Dict, List, Optional # noqa: F401 from pydantic import AnyUrl, BaseModel, EmailStr, validator # noqa: F401 from acapy_wrapper.models.attach_decorator_data1_jws import...
StarcoderdataPython
3355357
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import argparse from hashlib import sha256 from typing import Optional, Tuple, List from PIL import Image last_hash: Tuple[str, str] = None def calc_image_hash(im: Image.Image, f: str) -> Optional[str]: if im.mode != "RGB": print("rgb...
StarcoderdataPython
3314962
import ClassPointer as Pointer import General import GlobalData # Perform Specific Room Assignment Process def assign(acceptedRequests = [], excludeStudents = [], excludeRooms = []): village = Pointer.getVillageById(7) if not village['active']: return acceptedRequests, excludeStudents, excludeRooms for...
StarcoderdataPython
1647368
<gh_stars>1-10 # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models def carga_atributos_visores(apps, schema_editor): """Carga el nombre y slug de los visores existentes.""" VisorTv = apps.get_model('app_reservas', 'VisorTv') # Recorre todos los visores...
StarcoderdataPython
1696194
""" Unit tests for numpy backend. """ import warnings import geomstats.backend as gs import geomstats.tests from geomstats.geometry.special_orthogonal_group import SpecialOrthogonalGroup @geomstats.tests.np_only class TestBackendNumpy(geomstats.tests.TestCase): def setUp(self): warnings.simplefilter('ig...
StarcoderdataPython
3279709
<reponame>benknoll-umn/biomedicus3<filename>python/biomedicus/palliative/coalesce_themes.py # Copyright 2021 Regents of the University of Minnesota. # # 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 L...
StarcoderdataPython
1763331
<gh_stars>0 #!/usr/bin/snimpy """Disable port ingress filtering on Nortel switch (also known as filter-unregistered-frames).""" from __future__ import print_function import sys load("SNMPv2-MIB") load("Q-BRIDGE-MIB") s = M(host=sys.argv[1], community=sys.argv[2]) if "Ethernet Routing Switch 55" not in s.sysDescr:...
StarcoderdataPython
109041
import tkinter as tk from ttkbootstrap import Style from random import choice root = tk.Tk() root.minsize(500, 500) style = Style('superhero') def new_theme(): theme = choice(style.theme_names()) print(theme) style.theme_use(theme) btn = tk.Button(root, text='Primary') btn.configure(command=new_theme) b...
StarcoderdataPython
137972
<reponame>SidneyCodes/textgames<gh_stars>0 import urllib.request import json import os # Set the api endpoint to the OWM url url = "https://the-one-api.herokuapp.com/v1/character" # Make our request and get the decoded data read from the request req = urllib.request.Request(url) req.add_header("Authorization", "Bear...
StarcoderdataPython
4820879
<gh_stars>1-10 #!/usr/bin/env python3 # # Copyright (c) 2019 GhostBSD import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk import os import os.path from partition_handler import bios_or_uefi # Folder use pr the installer. tmp = "/tmp/.gbi/" installer = "/usr/local/lib/gbi/" query = "sh /usr/local...
StarcoderdataPython
3392795
<reponame>le-michael/mcp-starter-pack<filename>solutions/rust_murderer/sol.py<gh_stars>10-100 # Written by: le-michael t = int(raw_input()) for a0 in range(t): n,m = map(int,raw_input().split()) graph = {} for a1 in range(m): getIn = lambda x : int(x) - 1 x,y = map(getIn,raw_input().split()...
StarcoderdataPython
1703214
<reponame>pingjuiliao/cb-multios #!/usr/bin/env python from cStringIO import StringIO from generator.actions import Actions import random import struct SAMPLE_RATE = 8000.0 SAMPLE_MAX = 0x7FFFFFFF SAMPLE_MIN = -0x80000000 # *$!@ this #%*! def c_div(num, denom): neg = -1 if num < 0 else 1 if num < 0: n...
StarcoderdataPython
124898
from sys import argv, exit import sys import numpy as np from os import path from scipy.sparse import csr_matrix from cPickle import dump sys.path.append(path.abspath(path.join(path.dirname(__file__), ".."))) from LDA import TCVB0 #this demo is assumed to work with famous 20-newsgroups-dataset #get this version http...
StarcoderdataPython
1653609
"""Setup the file structure for the software. Specifies several folders: software_dir: path of installation """ import inspect import os import warnings from socket import getfqdn import pandas as pd from immutabledict import immutabledict import typing as ty import dddm import numpy as np export, __all__ = dddm.exp...
StarcoderdataPython
1666514
<reponame>syahperdana/BIGTIDE #!/usr/bin/env python import io import os #import sys from glob import glob from setuptools import find_packages, setup here = os.path.abspath(os.path.dirname(__file__)) #if sys.version_info >= (3, 0): try: with io.open(os.path.join(here, 'README.rst'), encoding='utf-8') as f: ...
StarcoderdataPython
20783
#!/usr/bin/env python """ File Description: File used for definition of State Class. """ # ****************************************** Libraries to be imported ****************************************** # from copy import deepcopy # ****************************************** Class Declaration Start *****...
StarcoderdataPython
3340651
"""Implementation of the Rastrigin function as in the link below. The number of problem dimensions is arbitrary, as well as the bounds. https://www.sfu.ca/~ssurjano/rastr.html """ from .function import Function import math import torch class Rastrigin(Function): def __init__(self, env_params): super(Rastri...
StarcoderdataPython
3237081
<filename>1_generateImage.py # coding: utf-8 import random from PIL import Image from PIL import ImageDraw from PIL import ImageFont import sys import os # how many pictures to generate num = 10 if len(sys.argv) > 1: num = int(sys.argv[1]) def genline(text, font, filename): ''' generate one line '''...
StarcoderdataPython
3376712
<filename>search.py from googlesearch import search class searchRecipe: def __init__(self, searchFor): self.searchFor = searchFor def searchResults(self): # devide string to list # search for every combination return search(" recipes " + self.searchFor, 5)
StarcoderdataPython
3238323
<reponame>arunma/Python_DataScience<filename>linalg/Vectors.py<gh_stars>1-10 from __future__ import division def vector_add(v, w): return [vi + wi for vi, wi in zip(v, w)] def vector_subtract(v, w): return [vi - wi for vi, wi in zip(v, w)] def vector_sum(vectors): result = vectors[0] for vect in vec...
StarcoderdataPython
113294
<filename>POO_II/atividade2/teste.py from src.conta import Conta, Client # importa a classe do diretorio src cc = Client("Saul", "Rocha", "1111") c1c = Client("Romuere", "Silva", "2222") c = Conta("123", cc, 300) c1 = Conta("321", c1c, 1000) res = True res = c1.saca(10) if res == True: print("OK!\n\n\n") else: ...
StarcoderdataPython
3327271
<reponame>TiMMaTTiee/bramsplanter """removed column. Revision ID: 848636aa4b59 Revises: Create Date: 2021-10-26 21:33:54.067953 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = None branch_labels = None depends_on = None def upgrade():...
StarcoderdataPython
1618100
<filename>inventree/part.py # -*- coding: utf-8 -*- import os import logging import re import inventree.base import inventree.stock import inventree.company import inventree.build class PartCategory(inventree.base.InventreeObject): """ Class representing the PartCategory database model """ URL = 'part/cate...
StarcoderdataPython
48847
from helpers import * from discord.ext import commands from discord.ext.commands import Cog, Bot, command, Context import database as db import discord import asyncio def setup(bot): bot.add_cog(Commands(bot)) class Commands(Cog): def __init__(self, bot: Bot): self.bot = bot # List spread acros...
StarcoderdataPython
3205929
# -- coding: utf-8 -- from os import times import cv2 import numpy as np import time from ctypes import * import sys from numpy.lib.type_check import imag sys.path.append("C:\Program Files (x86)\MVS\Development\Samples\Python\MvImport") from MvCameraControl_class import * class HHV: def __init__(se...
StarcoderdataPython
3387913
# Generated by Django 2.2.2 on 2019-06-15 09:57 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('library', '0005_book_rating'), ] operations = [ migrations.AlterField( model_name='book', name='rating', ...
StarcoderdataPython
3202221
# -*- coding: utf-8 -*- """ Created on Fri Nov 11 21:09:02 2016 @author: alisazhila """ import dataset_generator as gd import random import quadprog as qp import numpy as np import cvxopt from sklearn.svm import SVC import scipy.optimize #import sys #sys.exit() TINY_ADD = np.power(10.0, -13) #np.testing.assert_arr...
StarcoderdataPython
3375387
#Python script to analyze the data collected by the datacollector script import urllib, sys, jsonpickle, time, os import simplejson as json from time import sleep from geoip import geolite2 url = "https://blockchain.info/unconfirmed-transactions?format=json" transactions = [] #variable that holds all unique transactio...
StarcoderdataPython
82574
# --- # jupyter: # jupytext: # metadata_filter: # cells: # additional: all # notebook: # additional: all # text_representation: # extension: .py # format_name: percent # format_version: '1.2' # jupytext_version: 0.8.6 # kernelspec: # display_name: Pyth...
StarcoderdataPython
1770436
from setuptools import setup, find_packages with open("README.md", "r") as readme_file: readme = readme_file.read() requirements = ["pillow"] setup( name="generatedateimage", version="0.0.4", author="<NAME>", author_email="<EMAIL>", description="A package which creates an image which shows th...
StarcoderdataPython
96133
import data def main(): vScore = 0 iScore = 0 total = 0 lower = float(input('Enter the lowest score possible: ')) upper = float(input('Enter the highest score possible: ')) max = lower min = upper #print comments are to check if data is being read correctly. infile = op...
StarcoderdataPython
1662813
<gh_stars>0 import streamlit as st import requests, uuid, json import pandas as pd import numpy as np import pydeck as pdk st.title("Divvy Bikes - Chicago") # #df = pd.DataFrame( # np.random.randn(1000, 2) / [50, 50] + [41.9, -87.7], # columns=['lat', 'lon']) json_data = 'https://azradls.blob.core.windows.net...
StarcoderdataPython
29925
from rest_framework import serializers from ..models import Term, Meaning, Comment, Example class CommentSerializer(serializers.ModelSerializer): class Meta: model = Comment fields = '__all__' # class TranslatorsChatSerializer(serializers.ModelSerializer): # class Meta: # model = Tra...
StarcoderdataPython
1603286
<filename>Week2/Lecture3/fexes/l2f1.py # 1) iteration = 0 count = 0 while iteration < 5: #will iterate 5 times from 0 to 4 # the variable 'letter' in the loop stands for every # character on the string, including spaces and commas! for letter in "hello, world": count += 1 #For each character in ...
StarcoderdataPython
1691761
<reponame>DonQueso89/mongoengine # -*- coding: utf-8 -*- from decimal import Decimal import pytest from mongoengine import * from tests.utils import MongoDBTestCase class TestDecimalField(MongoDBTestCase): def test_validation(self): """Ensure that invalid values cannot be assigned to decimal fields. ...
StarcoderdataPython
3363754
import time import random import sklearn from pylab import * from transformers import AutoTokenizer from torch.nn import functional import spacy from spacy.lang.en import English def init(): pass def run(input_data): # time.sleep(10) def _subfunction(a): return a + 1 value = random.random() ...
StarcoderdataPython
1778703
# -*- encoding: utf-8 -*- from django.contrib.syndication.views import Feed from django.utils.feedgenerator import Rss201rev2Feed from pdl.models import Proyecto from pdl.utils import convert_string_to_time class CorrectMimeTypeFeed(Rss201rev2Feed): mime_type = 'application/xml' class LatestEntriesFeed(Feed): ...
StarcoderdataPython
90133
<reponame>napoler/tkit-bentoml-frameworks-expand # -*- coding: utf-8 -*- """ 作者: terrychan Blog: https://terrychan.org # 说明: """ import bentoml from bentoml import web_static_content from bentoml.adapters import DataframeInput from bentoml.frameworks.sklearn import SklearnModelArtifact # @save_to_dir("test.py") # 测试保...
StarcoderdataPython
192883
<filename>src/rank.py<gh_stars>1-10 from __future__ import print_function,division import os,sys,subprocess,pysam,collections,time,gc,math,json,copy import scipy.stats,operator,itertools import multiprocessing as mp from utils import * import numpy as np from global_vars import * import linecache class CandSplitM...
StarcoderdataPython
93729
<reponame>josephyaconelli/VAEs-in-Economics import tensorflow.keras as keras keras.__version__ from tensorflow.keras import layers from tensorflow.keras import regularizers from tensorflow.keras import backend as K from tensorflow.keras.models import Model from tensorflow import set_random_seed from numpy.random impo...
StarcoderdataPython
31084
description = 'Verify the user can add an action to the teardown' pages = ['common', 'index', 'tests', 'test_builder'] def setup(data): common.access_golem(data.env.url, data.env.admin) index.create_access_project('test') common.navigate_menu('Tests') tests.create_access_ra...
StarcoderdataPython
1721191
<gh_stars>0 from django.shortcuts import render, redirect from django.http import HttpResponseRedirect, HttpResponse from django.urls import reverse from django.contrib.auth import login, logout, authenticate # from django.contrib.auth.forms import UserCreationForm from django.contrib.sites.shortcuts import get_curren...
StarcoderdataPython
3238528
<reponame>2019-fall-csc-226/t01-choose-your-own-adventure-frankb-maynardb ###################################################################### # Author: <NAME> # <NAME> # <NAME> # Username: frankb, maynardb, mastriyanag # # Assignment: T01: Choose Your Own Adventure # # Purpose: To create a choo...
StarcoderdataPython
105681
import numpy as np import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers def f(x): return x[0]+x[1]*x[2]+np.sin(x[3]) def gettestdata(f,n=1000): x=np.random.normal(0,1,(n,4)) y=np.array([[f(xx)] for xx in x]) return x,y def traindensemodel(datax,datay,hidden,lr=0.001,batch...
StarcoderdataPython
3277901
#!/usr/bin/env python # -*- encoding: utf-8 -*- from replace_ip import get_all_records if __name__ == '__main__': for (domain_id, domain) in get_all_records().items(): print 'Domain: `%s`' % (domain['name'], ) for (record_id, record) in domain['records'].items(): print ' => [%s] [%s] %s.%s - %s' % (r...
StarcoderdataPython
1765071
<reponame>TreeberryTomato/3D-RecGAN-pytorch from __future__ import print_function import argparse import torch import torch.utils.data import torch.nn as nn import torch.optim as optim from torch.autograd import Variable from torchvision import datasets, transforms import torch.nn.functional as F import os import rand...
StarcoderdataPython
1700503
import pytest @pytest.fixture def lab_base(testapp): item = { 'title': 'Other lab', 'name': 'other-lab', } return testapp.post_json('/lab', item, status=201).json['@graph'][0]
StarcoderdataPython
1626684
import glob import pathlib import re import torch from torch import nn, optim from torch.utils.data import (Dataset, DataLoader, TensorDataset) import tqdm from statistics import mean remove_marks_regex = re.compile("[,\.\(\)\[\]\*:;]|<.*?>") shift_marks_reg...
StarcoderdataPython
3275122
<reponame>sealter/python-junior #/usr/bin/python3 flag = True if flag: print("It is true") i = 0 if i == 1 : print("It is 1") elif i == 0 : print("It is 0") else : print("It is not 1 or 0") print("***************** while ****************") i = 0 while True: if i >= 10: break; i ...
StarcoderdataPython
4818653
<reponame>MrZilinXiao/Fighting-Meme-python-wechaty import string import random from abc import ABC from flask import Flask, request, jsonify, views from backend.response.dispatcher import RequestDispatcher from backend.utils import ConfigParser import os import base64 from orm import History import hashlib class Web...
StarcoderdataPython
95585
import json import numpy as np from flightsim.shapes import Cuboid class World(object): def __init__(self, world_data): """ Construct World object from data. Instead of using this constructor directly, see also class methods 'World.from_file()' for building a world from a saved .j...
StarcoderdataPython
1600492
<reponame>mottosso/mitx-6.00.1x """COUNTING BOBS""" def count_bob(s): """Return number of occurrences of `bob` Including partial occurrences, like "bobob" which is 2. """ count = 0 for i in xrange(max(0, len(s) - 2)): count += s[i:i + 3] == 'bob' print 'The number of times bob occurs is: %i' % count retur...
StarcoderdataPython
1628535
from output.models.nist_data.atomic.g_month_day.schema_instance.nistschema_sv_iv_atomic_g_month_day_max_inclusive_4_xsd.nistschema_sv_iv_atomic_g_month_day_max_inclusive_4 import NistschemaSvIvAtomicGMonthDayMaxInclusive4 __all__ = [ "NistschemaSvIvAtomicGMonthDayMaxInclusive4", ]
StarcoderdataPython
3382174
<filename>wordvecs/wordvecs.py #!/usr/bin/env python # coding=utf-8 # Author: <NAME> <<EMAIL>> KTH 2018 from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from __future__ import division, absolute_import, print_function f...
StarcoderdataPython
154161
from tkinter import N import os import numpy as np from .main import DataLoader from .timeseriesDLs import GridDataGenPyTorch class TimeSeriesDataLoader(DataLoader): def __init__( self, path: str, file_ext: str, recursive: bool, iw_params: dict, ow_params=None, ...
StarcoderdataPython
1635524
from flask import Flask, render_template, request app = Flask(__name__) @app.route('/') def index(): return render_template("index.html") @app.route('/signup_form') def signup_form(): return render_template('form.html') @app.route('/thank_you') def thank_you(): first = request.args.get('first') la...
StarcoderdataPython
4824236
<filename>svhn_full_numbers_cnn.py import os import sys import json import h5py import tarfile import numpy as np import pandas as pd import seaborn as sns from tqdm import tqdm import matplotlib.pyplot as plt from PIL import Image, ImageDraw from unpacker import DigitStructWrapper from scipy.ndimage import imread from...
StarcoderdataPython
3265299
<filename>final/backend/chat/migrations/0011_auto_20180422_1309.py # Generated by Django 2.0.3 on 2018-04-22 05:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('chat', '0010_message_username'), ] operations = [ migrations.RenameField(...
StarcoderdataPython
1638629
import random import pytest import concurrent.futures from deepdiff import DeepDiff from fast_autocomplete.lfucache import LFUCache class TestLFUcache: @pytest.mark.parametrize("items, size, expected_results", [ (['a', 'a', 'b', 'a', 'c', 'b', 'd'], 3, [('a', 2), ('b', 1), ('d', 0)]), (['a', 'a',...
StarcoderdataPython
1751947
# Copyright 2021 <NAME> # # 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, copy, modify, merge, publish, distribute...
StarcoderdataPython
1643290
<filename>classes/variant.py class Variant: def __init__(self, size, sku, stock): self.size = size self.sku = sku self.stock = stock
StarcoderdataPython
169204
<filename>reports_module/notifications.py import time import traceback from reports_module import settings from reports_module.reportslib.database_manager import DatabaseManager from reports_module.reportslib.logger_manager import LoggerManager from reports_module.reportslib.mongodb_handler import MongoDBHandler from ...
StarcoderdataPython
1763423
<reponame>deroux/longitudinal-analysis-cowrie #!/usr/bin/python import os, sys, argparse import json from pathlib import Path from Helpers import get_files_from_path, split_data_by_events, write_to_file global MAX_ROBOT_TIME, LOG_FILE_PATH try: with open("config.json") as json_data_file: data = json.load...
StarcoderdataPython
1639524
from numba import njit import numpy as np def det1(A): """Compute the determinants of a series of 1x1 matrices. Parameters ---------- A : nx1x1 array_like Arrays to compute determinants of Returns ------- dets : array of length n Matrix determinants """ return A.f...
StarcoderdataPython
1759840
from conans import ConanFile class SvdDataConan(ConanFile): name = "svd-data" version = "0.1" license = "MIT" author = "<NAME> <<EMAIL>>" url = "https://github.com/matt1795/svd-data" description = "Collection of SVD files for different MCUs" topics = ("embeded", "mcu", "svd") exports_so...
StarcoderdataPython
1601391
<gh_stars>10-100 import abc class Peleador(metaclass=abc.ABCMeta): @abc.abstractmethod def prepararseluchar(self): pass class PeleadorDistancia(metaclass=abc.ABCMeta): @abc.abstractmethod def atacaquedistacia(self): pass class PeleadorCuerpoCuerpo(metaclass=abc.ABCMeta): @abc.abst...
StarcoderdataPython
63001
<filename>openGaussBase/testcase/TOOLS/INTERNAL_TOOLS/gs_dropnode/Opengauss_Function_Tools_gs_dropnode_Case0021.py """ Copyright (c) 2022 Huawei Technologies Co.,Ltd. openGauss is licensed under Mulan PSL v2. You can use this software according to the terms and conditions of the Mulan PSL v2. You may obtain a copy of ...
StarcoderdataPython
3270433
n = int(input("Digite um número: ")) print("O dobro do número é {},\n o seu tripo é {},\n e a sua raiz quadrada é: {:.2f}".format(n*2, n*3, n**(1/2)))
StarcoderdataPython
1766494
import numpy as np from datetime import datetime from .routine import get_fix_string, get_fix_list from .routine import get_equal_strings, get_equal_lists from .models.base_model import MODEL_NAME_LENGTH UP_END = "┌" DOWN_END = "└" MIDDLE = "├" LAST = "┤" EMPTY = "│" START_END = "┐" SPACE = " " USELESS_SUBKEYS = { ...
StarcoderdataPython
1761284
SENSOR_IDS = '../METRLA/metr_ids.txt' DISTANCES = '../METRLA/distances_la_2012.csv' WEEK = 2 DAY = 1 HOUR = 2
StarcoderdataPython
133885
# globals: assrt # empty classes are allowed class Blank: pass blank = Blank() assrt.ok(isinstance(blank, Blank)) # basic class class Human: HAIRS = 23 def __init__(self, name): self.name = name def greet(self): return "Hello, I'm " + self.name @staticmethod def getTypicalW...
StarcoderdataPython
1696727
import numpy as np import utilities as util import astropy.units as u # ------------------------------------------------------------------------- # Derived Units # ------------------------------------------------------------------------- cm3 = u.cm**3 dm3 = u.dm**3 m3 = u.m**3 g_cm3 = (u.g / cm3) molar = u.mol / dm3 ...
StarcoderdataPython
155385
<gh_stars>0 import pandas as pd import numpy as np import scipy as sp from io import StringIO import warnings from statsmodels.iolib.table import SimpleTable from scipy.stats import chi2 import statsmodels.api as sm from ..utils.Forg import forg from ..utils.TableFormat import gen_fmt, fmt_2 #function generate instr...
StarcoderdataPython
117489
<reponame>indranaut/3DCNNs<gh_stars>1-10 import os os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION']='python' import tensorflow as tf from google.protobuf import text_format from builders.network_builder import * from protos import network_pb2 from nets.i3d import Inception3D import numpy as np class NetworkBuilde...
StarcoderdataPython
1700409
<filename>sed_endtoend/optimizer.py from keras.optimizers import Optimizer from keras.legacy import interfaces from keras import backend as K class Adam_Multipliers(Optimizer): """Adaptation of Adam optimizer (keras implementation) to apply different multipliers to learning rate """ def __init_...
StarcoderdataPython
3375678
import logging from typing import TYPE_CHECKING, List, Optional from pysqlcipher3 import dbapi2 as sqlcipher from rotkehlchen.accounting.structures.base import HistoryBaseEntry from rotkehlchen.assets.asset import Asset from rotkehlchen.constants import ZERO from rotkehlchen.constants.limits import FREE_HISTORY_EVENT...
StarcoderdataPython
25482
<filename>helper/cLog.py from helper.cTime import MyDate # ------------------ [ elog() ] ------------------ # # Logs the error message into the "error_log.log" file # States what file, call and exception created the error log def elog(ex, stk): fs = open("./logs/error_log.log", "a") frame = str(stk[0][...
StarcoderdataPython
1703560
<filename>snakemake_workflow_template/release_modules/data_uploader/__main__.py import json import os import logging from data_uploader import arguments from data_uploader.uploader import Uploader def get_data(directory): collection_data = {} for filename in os.listdir(directory): if os.path.isdir(os...
StarcoderdataPython
4830607
""" Copyright (c) 2015 Red Hat, Inc All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. To have everything for a build in dist-git you need to fetch artefacts using 'fedpkg sources'. This plugin should do it. """ import os import s...
StarcoderdataPython
3231056
<filename>plugins/holland.lib.common/tests/test_compression.py import os import shutil from nose.tools import * from tempfile import mkdtemp from holland.core.exceptions import ArgumentError from holland.lib import compression global tmpdir, config, plugin def setup_func(): global tmpdir tmpdir = mkdtemp() ...
StarcoderdataPython
1623831
<gh_stars>1-10 """ Run all tests with: nosetests -w tests/ """ import unittest import numpy.testing as tc import numpy as np from nara_wpe import wpe from nara_wpe.test_utils import retry class TestWPE(unittest.TestCase): def setUp(self): self.T = np.random.randint(100, 120) self.D = np.rando...
StarcoderdataPython
182803
<gh_stars>0 # O(n) time | O(n) space # Iterative solution 2 def spiralTraverse(array): result = [] startRow, endRow = 0, len(array) - 1 startCol, endCol = 0, len(array[0]) - 1 while startRow <= endRow and startCol <= endCol: for col in range(startCol, endCol + 1): result.append(arra...
StarcoderdataPython
157807
<reponame>alfred-liu96/DL-Predict-Steering #!/usr/bin/env python # coding=utf-8 # __author__='Alfred' import csv import os import matplotlib.pyplot as plt import numpy as np from sklearn.model_selection import train_test_split from sklearn.utils import shuffle class SteeringDataLoader(object): def __init__(self,...
StarcoderdataPython
62042
<gh_stars>10-100 # This Software (Dioptra) is being made available as a public service by the # National Institute of Standards and Technology (NIST), an Agency of the United # States Department of Commerce. This software was developed in part by employees of # NIST and in part by NIST contractors. Copyright in portion...
StarcoderdataPython
1725485
from django.db import models from django.core.validators import MaxValueValidator, MinValueValidator from datetime import datetime from django.utils.timezone import now from users.models import Base, Employee CLASSIFICATION = (("Verde", "Verde"), ("Amarelo", "Amarelo"), ("Vermelho", "Vermelho"), ("...
StarcoderdataPython
1604674
<gh_stars>0 import os import json import urllib import locale import time import random import yaml import logging from logging.handlers import RotatingFileHandler from prometheus_client import start_http_server, Gauge logger = logging.getLogger(__name__) formatter = logging.Formatter('%(asctime)s %(name)-12s %(leveln...
StarcoderdataPython
3350996
from django.conf import settings from django.contrib import admin from django.contrib.auth import get_user_model from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.utils.translation import ugettext_lazy as _ from hijack_admin.admin import HijackUserAdminMixin from paypal.standard.ipn.admin im...
StarcoderdataPython
4828915
<filename>opencv_load_image_bonus.py # HOW TO RUN # python3 opencv_load_image_bonus.py --image images/floppy_disk.jpg --output output.jpg # python3 opencv_load_image_bonus.py --image images/floppy_disk.jpg # import the necessary modules import argparse import cv2 # initialize the argument parser and establish the arg...
StarcoderdataPython
3213620
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import scipy as sp from scipy import sparse def print_k(K): ''' print iteration every K steps ''' def pk(**kwargs): ''' callback function to save the updated solution at each step Parameters -------...
StarcoderdataPython
142236
<reponame>andreztz/mysite """ WSGI config for mysite project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/ """ import os import sys from django.core.wsgi import get_wsgi_application f...
StarcoderdataPython
36220
import os import zipfile from typing import List, Tuple, Dict import numpy as np import pandas as pd import requests import structlog import matplotlib.pyplot as plt from sklearn.ensemble import RandomForestClassifier from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.model_selection import train...
StarcoderdataPython
3280666
<reponame>Bleyddyn/malpi<gh_stars>1-10 # Plot results of a VAE training run or show samples from a trained VAE or MDRNN. import os import numpy as np import matplotlib.pyplot as plt def __add_ext( path, ext ): fname, pext = os.path.splitext( path ) if not ext.startswith('.'): ext = '.' + ext retur...
StarcoderdataPython
40197
from decouple import config import heroku3 import uuid HEROKU_API_KEY = config("HEROKU_API_KEY") heroku_conn = heroku3.from_key(HEROKU_API_KEY) def footprint_walt(): appy = heroku_conn.create_app(name=f"footprint-{uuid.uuid4().hex[:8]}") appy.create_build(f'{config("GIT_URL")}/tarball/master') appy.conf...
StarcoderdataPython
1705387
from .exceptions import MoveError, CreateError class Directory: def __init__(self, imi_data, imi): self._imi = imi self.id = imi_data['id'] self.name = imi_data['name'] self.parent_id = imi_data['parentID'] def assign(self, profile): end_of_url = 'profiles/{id}/assignm...
StarcoderdataPython
4806352
<filename>test/test_encrypter.py import base64 from uuid import uuid4 from Crypto.Cipher import AES def encrypt_string(plaintext, encryption_key): salt = str(uuid4())[:16] cipher = AES.new(encryption_key, AES.MODE_CBC, IV=salt) encrypted = cipher.encrypt(plaintext) return salt + base64.b64encode(encry...
StarcoderdataPython
1644637
# MenuTitle: Delete This in All Layers # -*- coding: utf-8 -*- __doc__ = """ Deletes whatever is selected in all other layers. """ Glyphs.clearLog() # Glyphs.showMacroWindow() l = Glyphs.font.selectedLayers[0] g = l.parent def delete_component(source_component, target_l, c_index=None): c_names = [c.name for c i...
StarcoderdataPython
185223
<filename>__init__.py print("v advasdva")
StarcoderdataPython
1620234
#! /usr/bin/env python # ============================================================================ # Copyright (c) 2011-2012 University of Pennsylvania # Copyright (c) 2013-2014 <NAME> # All rights reserved. # # See COPYING file for license information or visit # http://opensource.andreasschuh.com/cmake-basis/downl...
StarcoderdataPython