id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3352412
""" Auhtor : <NAME> """
StarcoderdataPython
3384502
<reponame>ShamanthNyk/wcep-mds-dataset<filename>experiments/baselines.py import utils import random import collections import numpy as np import networkx as nx import warnings from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity from sklearn.cluster import M...
StarcoderdataPython
3303184
<filename>pyxadapterlib/pyxadapterlib/xroadclient.py """ Base class of a X-road SOAP client Author: <NAME> """ import string from random import Random import os import httplib2 import socket from datetime import datetime import re import stat from lxml import etree from lxml.builder import ElementMaker import logging...
StarcoderdataPython
148500
"""Makes event-attribution schematics for 2019 tornado-prediction paper.""" import numpy import pandas import matplotlib matplotlib.use('agg') import matplotlib.pyplot as pyplot from descartes import PolygonPatch from gewittergefahr.gg_utils import storm_tracking_utils as tracking_utils from gewittergefahr.gg_utils im...
StarcoderdataPython
126431
from .fc_ping import FCPing def setup(bot): bot.add_cog(FCPing(bot))
StarcoderdataPython
80415
<reponame>42jaylonw/rrc_2021_three_wolves import pickle class EpisodeData: """ The structure in which the data from each episode will be logged. """ def __init__(self, joint_goal, tip_goal): self.joint_goal = joint_goal self.tip_goal = tip_goal self.joint_positions = [] ...
StarcoderdataPython
3258401
<reponame>jsjaskaran/createblockchain<gh_stars>0 # Create a Blockchain # importing libraries import datetime import hashlib import json from flask import Flask, jsonify # Part 1 - Building a Blockchain class Blockchain: def __init__(self): self.chain = [] self.create_block(proof = 1, prev_hash = '0') # create ...
StarcoderdataPython
1683780
<filename>client/paddleflow/pipeline/dsl/io_types/artifact.py #!/usr/bin/env python3 """ Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at ...
StarcoderdataPython
136900
<filename>haul3/haul/platforms/webos/__init__.py<gh_stars>1-10 __all__ = [ 'builder_webos', ]
StarcoderdataPython
171286
import pygame pygame.init() pygame.mixer.music.load('E.mp3') pygame.mixer.music.play() pygame.event.wait() print('boa musica ne?')
StarcoderdataPython
78441
from django import template from django.template.loader import get_template register = template.Library() @register.simple_tag(takes_context=True) def activity_item(context, item): template_name = f"barriers/activity/partials/{item.model}/{item.field}.html" try: item_template = get_template(template_...
StarcoderdataPython
3258647
from django.urls import path from .views import ServiceCreate, ServiceList, ServiceDetail, ServiceUpdate, ServiceDelete, getService, \ acceptRequest, declineRequest, addRequest, addFeedback, checkCredits urlpatterns = [ path('create/', ServiceCreate.as_view(), name='create-service'), path('', ServiceList....
StarcoderdataPython
3248249
from penaltymodel.maxgap.generation import * from penaltymodel.maxgap.interface import * from penaltymodel.maxgap.package_info import *
StarcoderdataPython
3363578
<filename>examples/acados_template/python/soft_constraints/generate_c_code.py # # Copyright 2019 <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <NAME>, <NAME> # # This file is part of acados. # # The 2-Clause BSD License # # Redistribution and use i...
StarcoderdataPython
1692998
<reponame>annetrose/xparty<filename>server/view/tags/library.py from server.view import custom_templates from google.appengine.ext.webapp import template import os register = template.create_template_register() @register.filter def init_activity_types_js(tmp=None): # TODO: Filters require at least 1 variable to b...
StarcoderdataPython
157997
<reponame>devkral/spkbspider<filename>spkcspider/apps/spider/urls.py from django.contrib.auth.decorators import login_required from django.urls import path from .views import ( OwnerTokenManagement, ComponentCreate, ComponentIndex, ComponentPublicIndex, ComponentUpdate, ConfirmTokenUpdate, ContentAccess, C...
StarcoderdataPython
1681174
import sys import json send_message_back = { 'arguments': sys.argv[1:], # mistype "sys" as "sy" to produce an error 'message': """Hello, This is my message. To the world""" } print(json.dumps(send_message_back))
StarcoderdataPython
1738254
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright © 2020 <NAME> """Post processing functions for Zemax import .. Created on Mon Aug 10 18:17:55 2020 .. codeauthor: <NAME> """ import numpy as np import rayoptics.seq.medium as mdm import rayoptics.elem.profiles as profiles import rayoptics.elem.surface as surf...
StarcoderdataPython
1611030
class AAShadow: color: str offsetX: float offsetY: float opacity: float width: float def colorSet(self, prop: str): self.color = prop return self def offsetXSet(self, prop: float): self.offsetX = prop return self def offsetYSet(self...
StarcoderdataPython
1727754
import argparse import os student_number = 1155114481 home_dir = "/home/" + str(student_number) + "/" servers = ['proj5', 'proj6', 'proj7', 'proj8', 'proj9', 'proj10'] ssh_cmd = ( "ssh " "-o StrictHostKeyChecking=no " ) # [clone]: # python3 batch_ops.py -o clone -u https://github.com/RickAi/minips.git # # [...
StarcoderdataPython
3394077
<filename>misc/log.py import argparse import os from datetime import datetime from dateutil import tz log_dir = None reg_log_dir = None LOG_FOUT = None inited = False def setup_log(args): global LOG_FOUT, log_dir, inited, start_time, reg_log_dir if inited: return inited = True config = args....
StarcoderdataPython
1779206
<reponame>Saad-Shaikh/COVID19-Count-Notifier #!/usr/bin/env python3 import credentials as cred import details as det import utils import smtplib import schedule import time def send_via_email(): """ Send an email to every person in the email list """ count_list = utils.get_count_list(det.states_and_ci...
StarcoderdataPython
1672754
<filename>Graphics/MessageBox.py from tkinter import * from tkinter import messagebox root = Tk() root.title("Buttons") root.geometry("300x300") root.iconbitmap("assets/favicon.ico") def info_box(): messagebox.showinfo("Info Box","This is an Info Box") # First Arg is title, Second Arg is the info. def error_bo...
StarcoderdataPython
1715480
import enum class MailTag(enum.Enum): SUBSCRIBE = "subscribe" VERIFY = "verify" INVOICE = "invoice" class FileType(enum.IntEnum): INVOICE = 0 LETTER = 1 class FileStatus(enum.IntEnum): VALID = 0 DEPRECATED = 1 INVALID = 2 class FileVerificationStatus(enum.IntEnum): SUCCESS = ...
StarcoderdataPython
3240553
<reponame>svetasmirnova/mysqlcookbook<filename>recipes/tblmgmt/uniq_name.py #!/usr/bin/python3 # uniq_name.py: show how to use PID to create table name #@ _GENERATE_NAME_WITH_PID_1_ import os #@ _GENERATE_NAME_WITH_PID_1_ pid = os.getpid() print("PID: %s" % pid) #@ _GENERATE_NAME_WITH_PID_2_ tbl_name = "tmp_tbl_%d" %...
StarcoderdataPython
1613215
<reponame>greck2908/gamification-engine<gh_stars>100-1000 import sys import os import json from gengine.base.settings import get_settings from gengine.base.util import lstrip_word from pyramid.settings import asbool def includeme(config): config.add_static_view(name='admin/jsstatic', path='gengine:app/jsscripts/b...
StarcoderdataPython
1624120
<reponame>polde-live/python-mich-3<gh_stars>0 import socket import re conStr = raw_input('URL to be searched:') host = re.findall('http://(.+?)/', conStr) try: mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) mysock.connect((host[0], 80)) mysock.send('GET %s HTTP/1.0\n\n' % conStr) while Tr...
StarcoderdataPython
1690460
<reponame>gorshok-py/TerminalTelegramBOT<filename>cmdwin.py from aiogram import Bot, types from aiogram.dispatcher import Dispatcher from aiogram.utils import executor from subprocess import check_output bot = Bot(token='<PASSWORD>') dp = Dispatcher(bot) user_id = 157191657 @dp.message_handler(content_type...
StarcoderdataPython
1655263
<filename>AEME/AEME.py # Class to generate Autoencoder Meta Embeddings (AEME) # File: AEME.py # Author: <NAME> import torch import torch.nn as nn from torch.utils.data import TensorDataset, RandomSampler, DataLoader from sklearn.preprocessing import LabelEncoder import time import numpy as np import gc from DAE import...
StarcoderdataPython
62397
<reponame>Aneesh540/python-projects """How to extract data from Fraction class(is is not callable) but __mul__ method is defined >>> Fractions(1,2)*Fractions(3,4) >>> Fractions(3,8) >>> print(Fraction(6,8)) >>> 3/4 >>> t=Fraction(1,2) >>> t.numerator >>> 1 >>> t.denominator >>> 2 """ from fractions import Fracti...
StarcoderdataPython
3355710
<reponame>DrEricEbert/fpga101-workshop<filename>tutorials/11-Computer/rom.py import binascii import sys def split_every(n, s): return [ s[i:i+n] for i in xrange(0, len(s), n) ] filename = sys.argv[1] with open(filename, 'rb') as f: content = f.read() list = split_every(2, binascii.hexlify(content...
StarcoderdataPython
1696929
<reponame>prashantramnani/nn_likelihoods<gh_stars>1-10 #from .de_crossover_mcmc_parallel import DifferentialEvolutionCrossover from .de_mcmc_one_core import DifferentialEvolutionSequential #from .de_mcmc_parallel import DifferentialEvolutionParallel #from .mh_mcmc_parallel import MetropolisHastingsParallel #from .mh_mc...
StarcoderdataPython
3303840
<filename>o365spray/core/handlers/enumerator.py<gh_stars>100-1000 #!/usr/bin/env python3 """ Based on: https://bitbucket.org/grimhacker/office365userenum/ https://github.com/Raikia/UhOh365 https://github.com/nyxgeek/onedrive_user_enum/blob/master/onedrive_enum.py https://github.com/gremwe...
StarcoderdataPython
124630
import json import logging import csv from datetime import date from StringIO import StringIO from zipfile import ZipFile from django import forms from django.core import mail from django.core.urlresolvers import reverse from django.utils.unittest import skip from vumi.message import TransportUserMessage import go.b...
StarcoderdataPython
3304450
<filename>zerowka/zestaw2/zad2.py import matplotlib.pyplot as plt import numpy as np import pandas as pd data = pd.read_excel('ceny2.xlsx') print(data.groupby(['Rodzaje towarów'])['Wartość'].mean()) lata = data.Rok.unique() nazwy = data['Rodzaje towarów'].unique() ryz_wartosci = data[data['Rodzaje towarów']...
StarcoderdataPython
3242734
<gh_stars>10-100 import pytest import numpy as np from copulae.special.clausen import clausen from numpy.testing import assert_almost_equal @pytest.mark.parametrize('x, exp, dp', [ (np.arange(-2, 4.1, 0.4), [-0.727146050863279, -0.905633219234944, -1.0...
StarcoderdataPython
3334784
<reponame>hspsh/pythonhacking-flask import time import pytest from flask import url_for def test_add_car(client): resp = client.get(url_for('some_json')) assert resp.status_code == 200 assert len(resp.json) == 2 epoch = int(resp.json['epoch_time']) assert time.time() == pytest.approx(epoch, abs=...
StarcoderdataPython
3356650
#!/usr/bin/env python3 # # consumption.py """ Class to represent consumption data. """ # # Copyright © 2020 <NAME> <<EMAIL>> # # 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 res...
StarcoderdataPython
3370950
<reponame>vohoaiviet/PyReID<gh_stars>10-100 __author__ = 'luigolas' import os from package.image import Image from package.utilities import ImagesNotFoundError, NotADirectoryError class ImageSet(object): def __init__(self, folder_name, name_ids=2): self.path = ImageSet._valid_directory(folder_name) ...
StarcoderdataPython
40645
import django # Now this is ugly. # The django.db.backend.features that exist changes per version and per db :/ if django.VERSION[:2] == (2, 2): has_sufficient_json_support = ('has_jsonb_agg',) if django.VERSION[:2] == (3, 2): # This version of EasyDMP is not using Django's native JSONField # implementatio...
StarcoderdataPython
3357770
<filename>tests/library/codelibnode_test.py # Copyright 2019-2020 ETH Zurich and the DaCe authors. All rights reserved. import dace from dace.data import Array from dace.properties import Property, make_properties from dace.libraries.standard.nodes import CodeLibraryNode from dace.codegen.targets.cpp import cpp_offset_...
StarcoderdataPython
3222505
# Copyright (C) 2020-2021 Intel Corporation # # SPDX-License-Identifier: MIT from ..contexts.project import build_validate_parser as build_parser from ..contexts.project import get_validate_sensitive_args as get_sensitive_args __all__ = [ 'build_parser', 'get_sensitive_args', ]
StarcoderdataPython
100689
# -*- coding: utf8 -*- import os import unittest import das # pylint: disable=import-error class TestCase(unittest.TestCase): TestDir = None InputFile = None OutputFile = None @classmethod def setUpClass(cls): cls.TestDir = os.path.abspath(os.path.dirname(__file__)) cls.InputFile = cls.Test...
StarcoderdataPython
42333
<gh_stars>100-1000 import consus c1 = consus.Client() t1 = c1.begin_transaction() t1.commit() c2 = consus.Client(b'127.0.0.1') t2 = c1.begin_transaction() t2.commit() c3 = consus.Client('127.0.0.1') t3 = c1.begin_transaction() t3.commit() c4 = consus.Client(b'127.0.0.1', 1982) t4 = c1.begin_transaction() t4.commit(...
StarcoderdataPython
1731386
<filename>modules/log.py from datetime import datetime def log(function): def wrapper(): with open('./Logs/log.txt', 'a') as log: log.writelines( f'Function {function.__name__} initialized at' f' {datetime.now()} \n' ) return function return wrapper()
StarcoderdataPython
1709741
<reponame>dapqa/dapqa-fast-mf<filename>dfmf/model/_SVD.py import numpy as np from numba import jit, types from sklearn.base import BaseEstimator, RegressorMixin from sklearn.utils import check_X_y, check_array @jit( types.Tuple(( types.Array(types.float64, 2, 'C'), types.Array(types.float...
StarcoderdataPython
1730848
# Copyright 2014 CloudFounders NV # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
StarcoderdataPython
20468
<filename>pydocteur/actions.py import json import logging import os import random import time from functools import lru_cache from github import Github from github import PullRequest from pydocteur.github_api import get_commit_message_for_merge from pydocteur.github_api import get_trad_team_members from pydocteur.pr_...
StarcoderdataPython
60268
# -*- coding: utf-8 -*- class Pessoa: """Implementação de uma classe que modela uma pessoa""" temDeficiencia = False # atributo de classe def __init__(self, *filhos, nome=None, idade=0): self.nome = nome self.idade = idade self.filhos = list(filhos) def cumprimentar(self):...
StarcoderdataPython
141141
<reponame>corona10/dc_cnu class Queue(object): def __init__(self): self.q = [] def size(self): return len(self.q) def empty(self): if len(self.q) is 0: return True return False def put(self, data): self.q.append(data) def get(self): ...
StarcoderdataPython
3324313
import requests import time, csv hashes = [ 'QmSQfLsPDKaFJM3SPKZYU971XSCArXKVCAWcEzQaKgtxQp', # file_hash 1.3KB 'QmUTcaZg3UVqKxM8GvjEVjtNaFDCsG3EAQAU4nzmdi7Vis', # image_hash 3.6MB 'QmbvdTQ5eCS7MqBfqv93Pdhy74p95XHuLh5nzSmaQiu6wk' #video_hash 153.3MB ] gateway_providers = [ { 'provider': 'Prot...
StarcoderdataPython
1659851
from django.db import models from django.db.models import F, Q, Sum, Case, When, Value as V from django.db.models.functions import Coalesce from django.contrib.auth import get_user_model # Create your managers here. class InventoryQuerySet(models.QuerySet): def shipping(self): return self.filter(type__ex...
StarcoderdataPython
170412
""" Tests for dit.rate_distortion. """
StarcoderdataPython
40654
<reponame>dastra/hargreaves-sdk-python import logging from requests_tracker.session import WebSessionFactory from requests_tracker.storage import ICookieStorage from ..config.models import ApiConfiguration from ..utils.cookies import HLCookieHelper from ..session.shared import LoggedInSession logging.getLogger(__nam...
StarcoderdataPython
3268334
<reponame>cosmodesi/desi-dlas """ Code to build/load/write DESI Training sets""" ''' 1. Load up the Sightlines 2. Split into samples of kernel length 3. Grab DLAs and non-DLA samples 4. Hold in memory or write to disk?? 5. Convert to TF Dataset ''' import itertools import numpy as np from desidlas.dla_cnn.spectra_...
StarcoderdataPython
3342198
import argparse import numpy from keras.models import load_model import utils from settings import TEST_DIR def calculateSSE(exp_results, giv_results): if len(exp_results) != len(giv_results): return False length = len(exp_results) sum = 0 for i in range(length): ...
StarcoderdataPython
1631690
# -*- coding: utf-8 -*- from sst_unittest import * from sst_unittest_support import * import os ################################################################################ # Code to support a single instance module initialize, must be called setUp method module_init = 0 module_sema = threading.Semaphore() def...
StarcoderdataPython
23150
<reponame>Jiaolong/gcn-parking-slot """Universal network struture unit definition.""" import torch import math from torch import nn import torchvision from torch.utils import model_zoo from torchvision.models.resnet import BasicBlock, model_urls, Bottleneck def define_squeeze_unit(basic_channel_size): """Define a ...
StarcoderdataPython
3229874
class Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ unsorted = len(nums) for i in nums: index = nums.index(i) if i in nums[index:] and index != len(nums)-1: ...
StarcoderdataPython
172885
# Copyright (c) 2017 LINE Corporation # These sources are released under the terms of the MIT license: see LICENSE from unittest import mock from requests.exceptions import RequestException from django.test import override_settings from promgen import models, rest, tests from promgen.notification.webhook import Not...
StarcoderdataPython
4806091
<reponame>allenai/relation_extraction import json from sklearn.metrics import precision_recall_curve from scipy.interpolate import spline import matplotlib.pyplot as plt with open('scripts/PR_curves.json') as f: x = json.load(f) plt.step(x['belagy_et_al_best'][0], x['belagy_et_al_best'][1], where='post') plt.step...
StarcoderdataPython
1780476
<gh_stars>0 from mesh.generic.commandMsg import CommandMsg from mesh.generic.command import Command from mesh.generic.cmds import NodeCmds, PixhawkCmds, TDMACmds from mesh.generic.cmdDict import CmdDict from struct import calcsize from mesh.generic.nodeHeader import headers from unittests.testCmds import testCmds cmds...
StarcoderdataPython
66209
<filename>authentik/events/migrations/0002_auto_20200918_2116.py<gh_stars>10-100 # Generated by Django 3.1.1 on 2020-09-18 21:16 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("authentik_events", "0001_initial"), ] operations = [ migrat...
StarcoderdataPython
157273
import numpy as np import numba as nb from pymcx import MCX def create_props(spec, wavelen): layers = spec['layers'] lprops = spec['layer_properties'] ext_coeff = {k: np.interp(wavelen, *itr) for k, itr in spec['extinction_coeffs'].items()} media = np.empty((1+len(layers), 4), np.float32) media[0]...
StarcoderdataPython
6080
# Copyright 2020 XAMES3. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
StarcoderdataPython
82711
# @Time : 8/20/21 18:00 PM # @Author : <NAME> # @Affiliation : Nanyang Technological University # @Email : <EMAIL> # @File : download_and_extract_noise_file.py """ dataset: MUSAN noise subdataset Usage: python download_and_extract_noise_file.py \ --data_root <absolute path to where the data should be st...
StarcoderdataPython
1711332
<filename>design/water_channel_mechanics/src/water_channel_mechanics/slider_mount_plate.py """ Copyright 2010 IO Rodeo Inc. 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.or...
StarcoderdataPython
3282995
import numpy as np import cmath from random import random class Polynomial: def __init__(self, a): """ Define the polynomial 'p = a[0] + a[1]*x + a[2]*x^2 + ... + a[n]*x^n'. Params: - a array with the coefficients of the polynomial """ self._a = a se...
StarcoderdataPython
105127
<gh_stars>0 print("Mon premier") print("programme") print("est affiche")
StarcoderdataPython
1751858
# # File : ihex2hex.py # Autor : <NAME>. # Data : 2019.03.04 # Language : Python # Description : This is script for converting ihex format to hex # Copyright(c) : 2018 - 2019 <NAME>. # import sys pars_file = open("program_file/program.ihex" , "r") out_...
StarcoderdataPython
1720372
#!/usr/bin/python r""" This is a test docstring. """ import subprocess as sb_pr import fire def subprocess_execute(command_list): """Subprocess_execute executes the command on host OS, then dumps the output to STDOUT. Arguments: command_list: This is a list of string making the command to be exe...
StarcoderdataPython
1781097
<gh_stars>1-10 from flask import Flask, render_template, request, redirect, url_for import jinja2 import difflib import pandas import cPickle as pickle import json from recommendation_functions import * from amazon_api_image import * from titlecase import titlecase import time class Data: """ This loads the book l...
StarcoderdataPython
172498
<filename>NewsCrawler/spiders/eastmoney.py from json import loads from random import random from re import match from time import time import scrapy from requests import get from NewsCrawler.items import NewsItem from NewsCrawler.utils.call_nav_map import nav_map from NewsCrawler.utils.validate_published import valid...
StarcoderdataPython
126498
from django.urls import include, path from . import views urlpatterns = [ path('confirm-email/<str:key>/', views.UserConfirmEmailView.as_view(), name='confirm_email'), path('social/signup/', views.SocialUserSignupView.as_view(), name='socialaccount_signup'), path('', include('allauth.urls')), ]
StarcoderdataPython
3237685
<reponame>fusion-jena/BiodivOnto from Tutorial.clustering_manger import ClusteringManager from os.path import realpath, join import pandas as pd from vector_manager import VectorManager from dfs_clustering import RecursiveClustering from vis_manager import Visualizer def init_vectors(): data_path = join(realpath('...
StarcoderdataPython
1653617
<filename>lemmatized_text/forms.py from django import forms from ckeditor.widgets import CKEditorWidget class LemmatizedTextEditForm(forms.Form): title = forms.CharField() text = forms.CharField(widget=CKEditorWidget(config_name="hedera_ckeditor"))
StarcoderdataPython
3357400
# -*- coding: utf-8 -*- import os import warnings warnings.filterwarnings("ignore") os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import sys from comet.models import download_model def cal_comet(file_can, file_ref, num, model): """ Calculate COMET score Args: file_can: the path of candidate file ...
StarcoderdataPython
187110
<gh_stars>1-10 from raven.contrib.transports.zeromq.raven_zmq import ZmqPubTransport
StarcoderdataPython
3361043
# Copyright 2018 The Simons Foundation, Inc. - All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by appli...
StarcoderdataPython
1799752
<reponame>19-1-skku-oss/2019-1-OSS-L1 def setup_function(function): print("setting up %s" % function) def test_func1(): assert True def test_func2(): assert False
StarcoderdataPython
1658647
<filename>bayespy/inference/vmp/nodes/dirichlet.py ################################################################################ # Copyright (C) 2011-2012,2014 <NAME> # # This file is licensed under the MIT License. ################################################################################ """ Module for the...
StarcoderdataPython
3391265
<filename>sf3_rtsc_combine.py<gh_stars>1-10 #!/usr/bin/env python3 #Imports import argparse import sf3libs.sf3io as sfio #Functions def merge_rtsc(rtsc_lyst): '''Takes a list of <.rtsc> files, returns a dictionary that is sum of the RT stops''' all_stops= {} for rtsc in sorted(rtsc_lyst): data = s...
StarcoderdataPython
3382739
""" this pattern seems to be the best bet to make 2.7 code forward compatible, the unicode import caused bugs """ from __future__ import absolute_import, division, print_function # makes code Python 2 and 3 compatible mostly
StarcoderdataPython
3329964
<reponame>dksifoua/NMT<filename>nmt/train/trainer.py import os import tqdm import numpy as np import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchtext.data import Dataset, Field from torchtext.data.metrics import bleu_score from torcht...
StarcoderdataPython
127616
<filename>css/index.py<gh_stars>0 #declaro una lista #lista = ["cadena", 1, False, "nombre", 20, [1, 3, 2 , 4]] #listaMultiple = ["cadena", ["cadena dentro", "de otra cadena"]] #listaEnteros = [2, 3, 1] ​ #Insertar en listas #lista.append(["agregado", "otro mas"]) #print (lista) ​ # #tuplas #tupla = (1, "hola", True) ​...
StarcoderdataPython
1631029
from je_auto_control import size print(size())
StarcoderdataPython
1630075
<gh_stars>0 import os import shutil import pathlib import warnings import exdir from . import exdir_object as exob from .group import Group from .. import utils class File(Group): """Exdir file object.""" def __init__(self, directory, mode=None, allow_remove=False, name_validation=None, plu...
StarcoderdataPython
3342654
from flopz.util.integer_representation import representable, build_immediates def test_build_immediates(): assert(build_immediates(0xF1C, ["[11|4|9:8|10|6|7|3:1|5]", "[5:3]"]) == [1996, 3]) def test_representable(): assert(representable(12, 5, signed=False, shift=2)) assert(representable(-2, 3)) ass...
StarcoderdataPython
3363018
from setuptools import __version__, setup if int(__version__.split(".")[0]) < 41: raise RuntimeError("setuptools >= 41 required to build") setup( use_scm_version={"write_to": "src/virtualenv/version.py", "write_to_template": '__version__ = "{version}"'}, setup_requires=[ # this cannot be enabled u...
StarcoderdataPython
3204665
<gh_stars>10-100 # https://leetcode.com/problems/exam-room/ # # algorithms # Medium (36.69%) # Total Accepted: 11,241 # Total Submissions: 30,636 # beats 67.77% of python submissions class ExamRoom(object): def __init__(self, N): self.N, self.L = N, [] def seat(self): N, L = self.N, self....
StarcoderdataPython
48178
<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- from os.path import dirname, join from setuptools import setup import doctest def test_suite(): return doctest.DocTestSuite('undervolt') setup( name='undervolt', version='0.2.9', description='Undervolt Intel CPUs under Linux', long_des...
StarcoderdataPython
1616378
<reponame>code-intenssive/library-management-system import os import sys from tkinter import messagebox as _msgbox from tkinter import filedialog import tkinter as tk from utils import center_window, get_current_date, show from tkinter import ttk from backends import BaseManager from constants import * from datetime im...
StarcoderdataPython
139977
#!/bin/env python2.7 VERSION = '2.1.2' PROGRAMS = 'readCounts.py LoH.py RNA2DNAlign.py exonicFilter.py snv_computation.py' INCLUDES = 'common ReadCounts' if __name__ == '__main__': import sys print(eval(sys.argv[1]))
StarcoderdataPython
161447
# # Copyright 2019 FMR LLC <<EMAIL>> # # SPDX-License-Identifier: MIT # """CLI and library to concurrently execute user-defined commands across AWS accounts. ## Overview `awsrun` is both a CLI and library to execute commands over one or more AWS accounts concurrently. Commands are user-defined Python modules that imp...
StarcoderdataPython
3370032
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import kl_divergence, Normal use_cuda=True device = torch.device("cuda" if (use_cuda and torch.cuda.is_available()) else "cpu") # recon loss function with 2 reconstruction loss and two KL-divergence loss def...
StarcoderdataPython
1739617
<gh_stars>10-100 import itertools import numpy as np from numpy.linalg import inv from numpy.testing import (assert_array_almost_equal, assert_almost_equal, assert_array_equal, assert_equal) from scipy.spatial.transform import Rotation from tadataka.camera import CameraParameters from tad...
StarcoderdataPython
65367
#def divisor is from: #https://www.w3resource.com/python-exercises/basic/python-basic-1-exercise-24.php def divisor(n): for i in range(n): x = len([i for i in range(1, n+1) if not n % i]) return x nums = [] i = 0 while i < 20: preNum = int(input()) if(preNum > 0): nums.append([diviso...
StarcoderdataPython
3215931
<filename>opensearch_stac_adapter/models/search.py from stac_pydantic.api import Search from typing import Optional from stac_pydantic.api.extensions.fields import FieldsExtension class AdaptedSearch(Search): """Search model""" token: Optional[str] = None field: Optional[FieldsExtension] = None
StarcoderdataPython
1726400
<reponame>perphyyoung/python-charts import matplotlib.pyplot as plt import numpy as np x = np.arange(0.0, 5.0, 0.2) # red dashes and black solids plt.plot(x, x, 'r--', x, x**1.5, 'k-') # blue squares and green triangles plt.plot(x, x**2, 'bs', x, x**3, 'g^') plt.show()
StarcoderdataPython
173722
import jwt import datetime import os import requests from flask import jsonify, request, make_response from flask_restful import Resource from sqlalchemy.orm.exc import NoResultFound from ...api.controllers import format_response from ..models import OAuthClient, OAuthToken from ...api.models import User from ... imp...
StarcoderdataPython