id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1760061
import argparse, sys, os, time from mitopipeline.pipeline_builder import PipelineBuilder from mitopipeline.pipeline_runner import PipelineRunner class CommandLineParser(): def __init__(self, argv=sys.argv[1:]): self.__opts = self.parse_commands(argv) def parse_commands(self, argv=sys.argv[1:]): ...
StarcoderdataPython
145793
from django import forms class BaseBoostrapFormMixin: def __init__(self, **kwargs): super().__init__(**kwargs) for _, field in self.fields.items(): field_widget = field.widget field_widget.attrs.update({'tabindex': 1}) if field_widget.input_type != 'checkbox':...
StarcoderdataPython
3201170
<filename>neet/boolean/eca.py """ Elementary Cellular Automata ============================ The :class:`neet.automata.eca.ECA` class describes an `Elementary Cellular Automaton <https://en.wikipedia.org/wiki/Elementary_cellular_automaton>`_ with an arbitrary rule. .. rubric:: Examples """ import numpy as np from .net...
StarcoderdataPython
3259829
from nltk.corpus import stopwords from nltk.tokenize import word_tokenize from nltk.stem import WordNetLemmatizer from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences impor...
StarcoderdataPython
4815417
<filename>weather_where_you_are.py import location, requests, speech loc = location.reverse_geocode(location.get_location()) city_country = "{City},{Country}".format(**loc[0]) print(f"Weather in {city_country}:") APPID = "beb97c1ce62559bba4e81e28de8be095&q=" URL = f"http://api.openweathermap.org/data/2.5/weather?APPID...
StarcoderdataPython
1681080
#!/usr/bin/env python3 # coding: utf-8 # # duivesteyn // Python // bmdOilPriceFetch # https://github.com/duivesteyn/bmdOilPriceFetch # # Testing Scripts for BMD Oil Price Fetch. Code that gets data from Yahoo Finance # from bmdOilPriceFetch import bmdPriceFetch import logging def printOilPrice(): '''Get and Print ...
StarcoderdataPython
1662548
<gh_stars>1-10 from sqlalchemy import MetaData from sqlalchemy.orm import declarative_base # SQLite allows constraints to exist in the database that have no identifying name. This unnamed # constraints create problems for migration. Therefore, naming_convention is passed to declarative # base of SQLite: # https://docs...
StarcoderdataPython
1603634
from os.path import join, isdir import glob from subprocess import call import numpy as np from rastervision.common.utils import _makedirs from rastervision.common.settings import VALIDATION from rastervision.semseg.tasks.utils import ( make_prediction_img, plot_prediction, predict_x) from rastervision.semseg.mo...
StarcoderdataPython
1672074
import abc from copy import copy from dataclasses import dataclass, field import functools import multiprocessing from multiprocessing import synchronize import threading import time import typing as tp import stopit from pypeln import utils as pypeln_utils from . import utils from .queue import IterableQueue, Outpu...
StarcoderdataPython
3216201
#!/usr/bin/env python ############################################################################## # Imports ############################################################################## import rosdistro import catkin_pkg from rosjava_build_tools import catkin #####################################################...
StarcoderdataPython
195672
<reponame>umyuu/Sample<gh_stars>0 # -*- coding: utf-8 -*- from selenium import webdriver from selenium.webdriver.chrome.options import Options import sys def main(): import platform print(platform.architecture()) print(sys.version) options = Options() options.add_argument('--headless') options...
StarcoderdataPython
149134
import numpy as np from .. import Geometry, Line, LineSegmentMaterial class BoxHelper(Line): """A line box object. Commonly used to visualize bounding boxes. Parameters: size (float): The length of the box' edges (default 1). thickness (float): the thickness of the lines (default 1 px). ...
StarcoderdataPython
35713
from .cs_loader import CSPointDataset from .cs_class_loader import CSClassDataset from .cs_seed_loader import CSSeedDataset
StarcoderdataPython
116935
<gh_stars>1-10 import json import os from tqdm import tqdm import shapefile import us from geography.models import Division, Geometry from geography.utils.lookups import township_states class StateFixtures(object): def create_state_fixtures(self): SHP_SLUG = "cb_{}_us_state_500k".format(self.YEAR) ...
StarcoderdataPython
3371780
#!/usr/bin/python 3 #seup database import os import sys from sqlalchemy import Column, ForeignKey, Integer, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship from sqlalchemy import create_engine Base = declarative_base() # correspond to table in database #...
StarcoderdataPython
138340
""" MIT License Copyright (c) 2021 UltronRoBo 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, di...
StarcoderdataPython
57146
<reponame>dungdinhanh/datafreeinverse import numpy as np from sklearn.datasets import make_moons from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt import torch import torch.nn as nn from utils import setup_dir #%matplotlib inline print("Using PyTorch Version %s" %torch.__versi...
StarcoderdataPython
5174
import os.path from tron import g, hub from tron.Hub.Command.Encoders.ASCIICmdEncoder import ASCIICmdEncoder from tron.Hub.Nub.TCCShellNub import TCCShellNub from tron.Hub.Reply.Decoders.ASCIIReplyDecoder import ASCIIReplyDecoder name = 'tcc' def start(poller): stop() initCmds = ('show version', 'show us...
StarcoderdataPython
12152
<filename>app/admin.py from django.contrib import admin from .models import Placement_Company_Detail,Profile,StudentBlogModel,ResorcesModel admin.site.register(Placement_Company_Detail) admin.site.register(Profile) admin.site.register(StudentBlogModel) admin.site.register(ResorcesModel)
StarcoderdataPython
143492
<filename>server/cough2.py import librosa import pandas as pd import os from keras.callbacks import ModelCheckpoint from tensorflow.python.keras.models import load_model import numpy as np model = load_model('weights1109_4.best.basic_cnn.hdf5') featuresdf = pd.read_pickle("featuresdf.pkl") from sklearn....
StarcoderdataPython
3232879
<reponame>TuDatTr/P4STA<gh_stars>10-100 # Copyright 2019-present <NAME>, <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 # # Unless re...
StarcoderdataPython
3379077
<reponame>zacksoliman/conditional-image-generation<gh_stars>0 # Original Version: <NAME> (http://carpedm20.github.io) # Source: https://raw.githubusercontent.com/carpedm20/DCGAN-tensorflow/master/model.py # Modifications for image inpainting: <NAME> import os import scipy.misc import numpy as np from model import DCGA...
StarcoderdataPython
45749
<filename>api/utils/custom_jwt.py import datetime from rest_framework_jwt.settings import api_settings from api.serializers import UserSerializer def jwt_response_payload_handler(token, user=None, request=None): """ Custom response payload handler. This function controlls the custom payload after login or t...
StarcoderdataPython
16729
<reponame>shansb/boss_grabbing<filename>boss_grabbing/pipelines.py # -*- coding: utf-8 -*- # Define your item pipelines here # # Don't forget to add your pipeline to the ITEM_PIPELINES setting # See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html from boss_grabbing.sqlite import Sqlite class BossGrabbin...
StarcoderdataPython
117774
<reponame>delepoulle/rawls import shutil from setuptools import setup import distutils.command.check class TestCommand(distutils.command.check.check): """Custom test command.""" def run(self): # run tests using doctest import doctest # filters folder from rawls import...
StarcoderdataPython
1648559
# coding: utf-8 """ Cloudbreak API Cloudbreak is a powerful left surf that breaks over a coral reef, a mile off southwest the island of Tavarua, Fiji. Cloudbreak is a cloud agnostic Hadoop as a Service API. Abstracts the provisioning and ease management and monitoring of on-demand clusters. SequenceIQ's Cloud...
StarcoderdataPython
57498
#32. Faça um programa que leia um ano qualquer e mostre se ele é bissexto. import datetime def Main032(): hoje = int(input('Que ano gostaria de saber se é bissexto?')) #OU hoje = datetime.date.today().year if hoje % 4 == 0 and hoje % 100 != 0 or hoje % 400 == 0: print(f'O ano {hoje} é Bissexto!') ...
StarcoderdataPython
106875
<reponame>SHIVJITH/Odoo_Machine_Test<gh_stars>0 # -*- coding: utf-8 -*- from collections import defaultdict from odoo import models, fields, api, _ from odoo.exceptions import UserError class Base(models.AbstractModel): _inherit = 'base' def _valid_field_parameter(self, field, name): return name ==...
StarcoderdataPython
122657
<reponame>gwangyi/pygritia """Pavement for Pygritia""" import shlex import sys import paver.doctools # pylint: disable=unused-import import paver.virtual # pylint: disable=unused-import from paver.easy import * # pylint: disable=unused-wildcard-import,wildcard-import from paver.options import Bunch from paver.path i...
StarcoderdataPython
43248
from __future__ import print_function from numpy import pi, arange, sin, cos import numpy as np import os.path import time from bokeh.objects import (Plot, DataRange1d, LinearAxis, DatetimeAxis, ColumnDataSource, Glyph, PanTool, WheelZoomTool) from bokeh.glyphs import Circle from bokeh import session x = ara...
StarcoderdataPython
1715705
import torch from torch import nn import torch.nn.functional as F from BahdanauAttnDecoderRNN import BahdanauAttnDecoderRNN from CNNModels import CnnTextClassifier class CtrlGenModel(nn.Module): def __init__(self,config,vocab_size,batch_size,weights_matrix): super(CtrlGenModel,self).__init__() #64*1...
StarcoderdataPython
3220491
"""This module contains the general information for BiosVfCbsDfCmnDramNps ManagedObject.""" from ...imcmo import ManagedObject from ...imccoremeta import MoPropertyMeta, MoMeta from ...imcmeta import VersionMeta class BiosVfCbsDfCmnDramNpsConsts: VP_CBS_DF_CMN_DRAM_NPS_AUTO = "Auto" VP_CBS_DF_CMN_DRAM_NPS_NP...
StarcoderdataPython
190888
<filename>Fundamentals/Exercises/Data_Types_Variables_More/1_exchange_integers.py # Read two integer numbers and, after that, exchange their values. Print the variable values before and after the exchange, as shown below: a = int(input()) b = int(input()) print(f'Before:\na = {a}\nb = {b}') a, b = b, a print(f'Afte...
StarcoderdataPython
1775448
<reponame>cys3c/viper-shell<filename>application/modules/post/windows-priv-check/wpc/shares.py<gh_stars>1-10 from wpc.share import share import win32net import wpc.conf class shares: def __init__(self): self.shares = [] pass def get_all(self): if self.shares == []: resume ...
StarcoderdataPython
3351709
<filename>tests/urlpatterns_reverse/included_named_urls.py from django.conf.urls import include, url from .views import empty_view urlpatterns = [ url(r'^$', empty_view, name="named-url3"), url(r'^extra/(?P<extra>\w+)/$', empty_view, name="named-url4"), url(r'^(?P<one>[0-9]+)|(?P<two>[0-9]+)/$', em...
StarcoderdataPython
3336471
<gh_stars>0 ## LSDMap_VectorTools.py ##=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## These functions are tools to deal with vector data using shapely ##=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ## FJC ## 26/06/17 ##=-=-=-=-=-=-=-=-=-=-=-=-=-=-...
StarcoderdataPython
194617
""" MIT License Copyright (c) 2017 <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, distri...
StarcoderdataPython
179457
import cv2 import numpy as np def diff_density(image1, image2, x=0, y=0, w=-1, h=-1): #Gives how diff image1 is from image2 in a ROI (x,y,width,height) if(image1 is None or image2 is None): print("Input not compatible", image1, image2) exit() roi1 = image1[y:y+h, x:x+w] roi2 = image2[y:y+h, x:x+w] diff_array =...
StarcoderdataPython
57095
from wx.lib.mixins.listctrl import CheckListCtrlMixin, ListCtrlAutoWidthMixin import parser import subprocess import sys import wx from entrypoint2 import entrypoint class CheckListCtrl(wx.ListCtrl, CheckListCtrlMixin, ListCtrlAutoWidthMixin): def __init__(self, parent): wx.ListCtrl.__init__( ...
StarcoderdataPython
19958
class Solution(object): def _dfs(self,num,res,n): if num>n: return res.append(num) num=num*10 if num<=n: for i in xrange(10): self._dfs(num+i,res,n) def sovleOn(self,n): res=[] cur=1 for i in xrange(1,n+1): ...
StarcoderdataPython
61591
''' 任务调度器 给你一个用字符数组 tasks 表示的 CPU 需要执行的任务列表。其中每个字母表示一种不同种类的任务。任务可以以任意顺序执行,并且每个任务都可以在 1 个单位时间内执行完。 在任何一个单位时间,CPU 可以完成一个任务,或者处于待命状态。 然而,两个 相同种类 的任务之间必须有长度为整数 n 的冷却时间,因此至少有连续 n 个单位时间内 CPU 在执行不同的任务,或者在待命状态。 你需要计算完成所有任务所需要的 最短时间 。 提示: 1 <= task.length <= 10^4 tasks[i] 是大写英文字母 n 的取值范围为 [0, 100] ''' from typing import Lis...
StarcoderdataPython
1741170
<filename>pyauto/pyauto_correct.py """ Refer: https://github.com/PandaWhoCodes/pyautocorrect and https://github.com/phatpiglet/autocorrect/ and https://pypi.org/project/autocorrect/ Works in mappy2 env but might have to shift this to py3. WHat about Unicode? """ import pyautocorrect print(pyautocorrect.correct("this i...
StarcoderdataPython
1654702
from typing import List, Optional from sqlalchemy import desc, func from sqlalchemy.ext.asyncio.session import AsyncSession from sqlalchemy.sql.expression import select from app.database.dbo.mottak import Arkivuttrekk as Arkivuttrekk_DBO from app.domain.models.Arkivuttrekk import Arkivuttrekk async def create(db: A...
StarcoderdataPython
1715382
<gh_stars>1-10 # -*- coding: utf-8 -*- # SPDX-License-Identifier: MIT # Copyright © 2021 <NAME> from __future__ import print_function, unicode_literals from hpl.parser import property_parser from hplrv.rendering import TemplateRenderer def main(): p = property_parser() r = TemplateRenderer() text = [ ...
StarcoderdataPython
3357853
#!/usr/bin/python """ TCP Communications Module """ import asyncore import socket import cPickle as pickle from time import time as _time, sleep as _sleep from StringIO import StringIO from .debugging import ModuleLogger, DebugContents, bacpypes_debugging from .core import deferred from .task import FunctionTask, O...
StarcoderdataPython
128822
<reponame>Aghassi/rules_spa """A macro for creating a webpack federation route module""" load("@aspect_rules_swc//swc:swc.bzl", "swc") # Defines this as an importable module area for shared macros and configs def build_route(name, entry, srcs, data, webpack, federation_shared_config): """ Macro that allows e...
StarcoderdataPython
150970
# -*- coding: utf-8 -*- def main(): n = int(input()) ans = set() for i in range(n): ai, bi = map(int, input().split()) if ai > bi: ans.add((bi, ai)) else: ans.add((ai, bi)) print(len(ans)) if __name__ == '__main__': main()
StarcoderdataPython
1685480
#!/usr/bin/python # Copyright 2018 Google 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 ...
StarcoderdataPython
3289452
# Copyright 2020 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file acc...
StarcoderdataPython
1663428
<reponame>andela/waitress<gh_stars>1-10 def serialize_meal(payload): return dict( date=str(payload[0]), user_id=payload[2], first_name=payload[3], last_name=payload[4], breakfast=payload[6], lunch=payload[7], )
StarcoderdataPython
3256227
from tqdm import tqdm from itertools import chain from torch.nn import BCEWithLogitsLoss from torch_geometric.data import DataLoader from sklearn.metrics import roc_auc_score, average_precision_score from tensorboardX import SummaryWriter import os from models import DGCNN import argparse import os.path as o...
StarcoderdataPython
3295883
<reponame>Cli212/Lightweight-Language-Models-to-Generate<filename>prado/model.py import torch from typing import Any, Dict, List import math import warnings from functools import partial with warnings.catch_warnings(): warnings.filterwarnings("ignore") import numpy as np import pytorch_lightning as pl ...
StarcoderdataPython
3222127
<filename>vue/product_frames/new_product_frame.py from tkinter import * from vue.product_frames.product_formular_frame import ProductFormularFrame from exceptions import Error class NewProductFrame(ProductFormularFrame): def __init__(self, product_controller, master=None): super().__init__(master) ...
StarcoderdataPython
111296
<filename>ydlg/main.py from flask import Blueprint, render_template, request, Response,redirect,url_for import os from flask_login import login_user, login_required, current_user from .utils import * import youtube_dl main = Blueprint('main', __name__) default_download_directory = "" try: default_download_direct...
StarcoderdataPython
182057
<reponame>respeaker/mycroft_runner_simple from .runner import PreciseRunner, PreciseEngine, ReadWriteStream __version__ = '0.3.3'
StarcoderdataPython
1719064
from django.shortcuts import render # Create your views here. def landing(request): return render(request,'login/landing.html')
StarcoderdataPython
1777399
import pandas as pd from DataHandler.mongoObjects import CollectionManager from datetime import date from datetime import datetime as dt import datedelta import numpy as np features = ['Asset Growth', 'Book Value per Share Growth', 'Debt Growth', 'Dividends per Basic Common Share Growth', 'EBIT Growth', 'E...
StarcoderdataPython
1695747
<reponame>yuhaitao1994/LIC2019_Information_Extraction<gh_stars>10-100 # -*- coding:utf-8 -*- """ Subject and Object labeling with Bert + Pointer Net @author:yuhaitao """ import collections import os import numpy as np import tensorflow as tf import codecs import pickle import sys from sklearn import metrics sys.path.a...
StarcoderdataPython
1785672
<reponame>samarmohan/tutoring-api from django.urls import include, path from rest_framework import routers from .api import TutorAPI, TuteeAPI router = routers.DefaultRouter() router.register(r'tutors', TutorAPI) router.register(r'tutees', TuteeAPI) urlpatterns = [ path('', include(router.urls)), ]
StarcoderdataPython
3288475
<gh_stars>0 # Python import os import sys import traceback # Pycompss from pycompss.api.task import task from pycompss.api.parameter import FILE_IN, FILE_OUT # Adapters commons pycompss from biobb_adapters.pycompss.biobb_commons import task_config # Wrapped Biobb from biobb_vs.fpocket.fpocket import FPocket # Importin...
StarcoderdataPython
1653129
from finnhub_api.client import FinnHubClient
StarcoderdataPython
1606887
from typing import TYPE_CHECKING, Tuple if TYPE_CHECKING: from destiny_timelost.side import Side class Link: def __init__(self, *sides: Tuple["Side", ...]) -> None: self.sides = sorted(sides, key=lambda side: side.idx) @property def first_side(self) -> "Side": return self.sides[0] ...
StarcoderdataPython
3235797
<filename>app.py<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Tue Sep 22 11:40:09 2020 @author: Mansi """ import pygame import game_config as gc from pygame import display, event, image from time import sleep from animal import Animal def find_index_from_xy(x, y): row = y // gc.IMAGE_SIZE ...
StarcoderdataPython
1644194
<reponame>GEOS-ESM/mepo import argparse import textwrap class MepoConfigArgParser(object): def __init__(self, config): self.config = config.add_subparsers() self.config.title = 'mepo config sub-commands' self.config.dest = 'mepo_config_cmd' self.config.required = True self....
StarcoderdataPython
186963
import task_list_storage as storage import copy class TaskList: def __init__(self, listData): self.name = listData[0] self.__listData = listData self.tasks = listData[1:len(listData)-1:2] self.taskStatus = listData[2:len(listData):2] # print("PING", listData) # prin...
StarcoderdataPython
3360880
""" The :mod:`kavica.parser` module includes data file parsers. """ from .prvparse import (ControlCZInterruptHandler, ExtensionPathType, ParsedArgs, Parser) __all__ = ['ControlCZInterruptHandler', 'ExtensionPathType', 'ParsedAr...
StarcoderdataPython
4812173
<filename>pycave/__init__.py import logging import warnings from .core import NotFittedError # This is taken from PyTorch Lightning and ensures that logging for this package is enabled _root_logger = logging.getLogger() _logger = logging.getLogger(__name__) _logger.setLevel(logging.INFO) if not _root_logger.hasHandler...
StarcoderdataPython
1717029
import argparse import torch import torchmetrics from loguru import logger import head_segmentation.segmentation_pipeline as seg_pipeline import scripts.training.data_loading as dl def parse_args() -> None: # fmt: off parser = argparse.ArgumentParser("Evaluates segmentation maps predictions on full resoluti...
StarcoderdataPython
41686
a = 5 b = 10 my_variable = 56 any_variable_name = 100 string_variable = "hello" single_quotes = 'strings can have single quotes' print(string_variable) print(my_variable) # print is a method with one parameter—what we want to print def my_print_method(my_parameter): print(my_parameter) my_print_method(string_v...
StarcoderdataPython
1753459
<reponame>Sangarshanan/geopandas-view<filename>setup.py<gh_stars>10-100 import setuptools setuptools.setup( name="geopandas_view", version="0.0.1", author="<NAME>", author_email="<EMAIL>", python_requires=">=3.6", install_requires=["geopandas", "folium", "mapclassify", "matplotlib"], packag...
StarcoderdataPython
139714
<reponame>g4brielvs/usaspending-api<filename>usaspending_api/broker/management/commands/update_transactions.py import logging from datetime import datetime from usaspending_api.common.helpers.date_helper import fy from django.core.management.base import BaseCommand from django.db import connections, transaction as db_...
StarcoderdataPython
3303124
# coding: utf8 """Utility functions for managing the sdk.""" import logging import os import platform import subprocess import sys import urlparse import requests import semantic_version from grow.common import config from grow.common import utils from xtermcolor import colorize VERSION = config.VERSION RELEASES_API...
StarcoderdataPython
2881
import json import multiprocessing as mp import re from argparse import ArgumentParser from enum import Enum, auto import javalang from functools import partial PRED_TOKEN = 'PRED' modifiers = ['public', 'private', 'protected', 'static'] class TargetType(Enum): seq = auto() tree = auto() @staticmethod ...
StarcoderdataPython
4811179
# -*- coding:utf-8 -*- from apriori import Apriori import pickle import sys def main(): if len(sys.argv) != 2: print("USAGE python main.py [load_data|load_target]") sys.exit() mode = sys.argv[1] if mode == "load_data": c = Control() c.proc_load() elif mode == "load_target...
StarcoderdataPython
3239827
<reponame>oischinger/server """Custom API implementation using websockets.""" import asyncio import logging import os from base64 import b64encode from typing import Any, Dict, Optional, Union import aiofiles import jwt import ujson from aiohttp import WSMsgType, web from aiohttp.http_websocket import WSMessage from ...
StarcoderdataPython
1714508
from torch.utils.data import Dataset, DataLoader import pandas as pd import random from transformers import AutoTokenizer from tqdm import tqdm from utils.generic_utils import read class MMDialDataset(Dataset): def __init__(self, data, tokenizer): super().__init__() self.data = data self.t...
StarcoderdataPython
3314677
import torch from torch.utils import data from torch import nn import numpy as np from data.datasets import swiss_roll, double_circles, double_moons, Dataset from regularization.regularization import regularization from integrators.integrators import MS1, MS2, MS3, H1, H2, H2_sparse, Classification, get_intermediate_s...
StarcoderdataPython
16726
<reponame>Feng-XiaoYue/Reinforcement-learning-with-tensorflow-master import numpy as np import pandas as pd import random import time import sys if sys.version_info.major == 2: import Tkinter as tk else: import tkinter as tk class Cluster(tk.Tk, object): def __init__(self, state_init, server_attribute): ...
StarcoderdataPython
1725928
import datetime, json, os from cantools import config from cantools.util import log, write from cantools.web import fetch, send_mail from .actor import Actor try: import psutil except ImportError as e: pass # google crap engine (get it if you need it!) from six import with_metaclass class BotMeta(type): def __new__...
StarcoderdataPython
1624302
# Copyright (c) 2015 GigaSpaces Technologies Ltd. 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 ...
StarcoderdataPython
136896
<reponame>FuriousJulius/lg_ros_nodes #!/usr/bin/env python3 import rospy import unittest from lg_msg_defs.msg import AdhocBrowser from lg_common import AdhocBrowserPool PKG = 'lg_common' NAME = 'test_adhoc_browser_pool' class TestAdhocBrowserPool(unittest.TestCase): def setUp(self): self.pool = AdhocBr...
StarcoderdataPython
1764665
import os import pygame from labyrinth_generator import generate from random import randint from time import time, sleep import mazeFinder BLOCKSIZE = 16 WIDTH = 590 HEIGHT = 480 DELAY = 20 WHITE = (255, 255, 255) RED = (255, 0, 0) GREEN = (0, 255, 0) BLACK = (0, 0, 0) # Class for the orange dude class Player(obje...
StarcoderdataPython
1742982
# coding=utf-8 from __future__ import absolute_import import logging import datetime from urllib.parse import urlparse from kubernetes import watch from talos.common import cache from talos.core import config from talos.core.i18n import _ from wecubek8s.common import jsonfilter from wecubek8s.common import k8s from ...
StarcoderdataPython
52343
<filename>AMAO/apps/Avaliacao/Questao/models/filtro_questao.py # -*- coding: utf-8 -*- from django.db import models from tipo_questao import TipoQuestao from questao import Questao #from libs.uniqifiers_benchmark import f11 as uniqifier class FiltroQuestao(models.Model): """ Classe que ira gerar uma questao(Q...
StarcoderdataPython
3353424
bills = [7, 12, 22, 52, 102, 15, 25, 55, 105, 30, 60, 110, 70, 120, 150] count = 0 while True: N, M = map(int, input().split()) if N == 0 and M == 0: break for i in bills: if M - N == i: count = 1 break else: count = 0 if count == 1: pr...
StarcoderdataPython
192464
<reponame>opennode/waldur-ansible<filename>conftest.py from waldur_ansible.common.tests.integration import integration_tests_config def pytest_addoption(parser): parser.addoption(integration_tests_config.TEST_TAG_FLAG, action="append", help="specify what type of tests to run")
StarcoderdataPython
195036
# -*- coding: utf-8 -*- # This file is part of the Ingram Micro Cloud Blue Connect SDK. # Copyright (c) 2019 Ingram Micro. All Rights Reserved. import os import pytest from connect.config import Config conf_dict = { 'apiEndpoint': 'http://localhost:8080/api/public/v1/', 'apiKey': '<KEY>', 'products': ...
StarcoderdataPython
1681387
<gh_stars>10-100 """Genereate pseudo labels by softmax classifier. """ from __future__ import print_function, division import os import math import PIL.Image as Image import numpy as np import cv2 import torch import torch.nn.functional as F import torch.backends.cudnn as cudnn from tqdm import tqdm import spml.data....
StarcoderdataPython
3344059
<filename>utils/lib/periphery.py """ Small class to handle the periphery. """ import numpy as np import lib.kernels as kernels class Periphery(object): """ Small class to handle a single body. """ def __init__(self, location, orientation, reference_configuration, reference_normals, quadrature_weights)...
StarcoderdataPython
188558
import pandas as pd from pipedown.nodes.base.metric import Metric from pipedown.utils.urls import get_node_url class MeanSquaredError(Metric): CODE_URL = get_node_url("metrics/mean_squared_error.py") def run(self, y_pred: pd.Series, y_true: pd.Series): return ((y_pred - y_true).pow(2)).mean() d...
StarcoderdataPython
195732
# (C) Datadog, Inc. 2020-present # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) import json import requests import datadog_checks.dev.tooling.manifest_validator.common.validator as common from datadog_checks.dev.tooling.manifest_validator.common.validator import BaseManifestValid...
StarcoderdataPython
118380
<reponame>hairong-wang/XLNet_learn2learn<gh_stars>0 #!/usr/bin/env python # coding: utf-8 # Author: <NAME> import json import pandas as pd from nltk.translate.bleu_score import sentence_bleu INFILE = "path/to/input/file" class BleuScore: def __init__(self, infile): self._infile = infile def get_df(s...
StarcoderdataPython
4807411
<reponame>berylgithub/ppbap<gh_stars>1-10 # -*- coding: utf-8 -*- """ Created on Thu Dec 5 15:08:41 2019 @author: Saint8312 """ import numpy as np from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import train_test_split from sklearn.preprocessing import MinMaxScaler from sklearn.model_...
StarcoderdataPython
1731617
import cv2, os def flip_images(): gest_folder = "data/train" for g_id in os.listdir(gest_folder): for i in range(900): path = gest_folder + "/" + g_id + "/" + str(i) + ".jpg" new_path = gest_folder + "/" + g_id + "/" + str(i + 900) + ".jpg" print(path) i...
StarcoderdataPython
1769170
<filename>data/parse_recs.py<gh_stars>0 # Given a rec list from Tumblr like mine, trying to extract a list of links (fanfic recs). # Also trying to extract a header image given a blog name. import pytumblr from ao3 import AO3 from ao3.works import RestrictedWork import ffnet from notion.client import NotionClient a...
StarcoderdataPython
3335925
<reponame>go2starr/lshhdc<gh_stars>10-100 from lsh import Cluster, jaccard_sim from .utils import * def test_same_set(): """A set should be clustered with itself""" s = randset() cluster = Cluster() cluster.add_set(s) cluster.add_set(s) assert len(cluster.get_sets()) == 1 def test_similar_se...
StarcoderdataPython
3315879
def LimbLength(S,skel):
StarcoderdataPython
1671132
"""Feature extraction pipeline for sutter.""" import logging from feature_extractors.admission import AdmissionExtractor from feature_extractors.comorbidities import ComorbiditiesExtractor from feature_extractors.demographics import BasicDemographicsExtractor from feature_extractors.discharge import DischargeExtracto...
StarcoderdataPython
3357758
<reponame>pcaston/core<gh_stars>1-10 """The awair component.""" from __future__ import annotations from asyncio import gather from typing import Any from async_timeout import timeout from python_awair import Awair from python_awair.exceptions import AuthError from openpeerpower.const import CONF_ACCESS_TOKEN from op...
StarcoderdataPython
1761517
import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDHarvester import DQMEDHarvester segmentTest = DQMEDHarvester("DTSegmentAnalysisTest", detailedAnalysis = cms.untracked.bool(False), #Perform basic diagnostic in endLumi/EndRun ...
StarcoderdataPython