id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
176699 | '''
Created on Apr 15, 2016
Evaluate the performance of Top-K recommendation:
Protocol: leave-1-out evaluation
Measures: Hit Ratio and NDCG
(more details are in: <NAME>, et al. Fast Matrix Factorization for Online Recommendation with Implicit Feedback. SIGIR'16)
@author: hexiangnan
'''
import math
... | StarcoderdataPython |
63188 | import numpy as np
def hermitegaussian(coeffs,x,sigma):
xhat = (x/sigma)
herms = np.polynomial.hermite.Hermite(coeffs)
return herms(xhat) * np.exp(-xhat**2)
def continuous_convolve(kernels,obj):
out = np.empty(obj.shape)
for i in range(kernels.shape[0]):
out[jj] = np.dot(obj[max(0,jj-cente... | StarcoderdataPython |
21267 | <filename>Server/prediction/admin.py<gh_stars>0
from django.contrib import admin
from prediction.models import product
from prediction.models import price
# Register your models here.
admin.site.register(product)
admin.site.register(price)
| StarcoderdataPython |
144073 | <gh_stars>0
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
from vk_api.keyboard import VkKeyboard, VkKeyboardColor
from vk_api.utils import get_random_id
from dotenv import load_dotenv
from unpacker import unpack_questions
import os
import random
import redis
import logging
logger = logging.getLogge... | StarcoderdataPython |
1711205 | <reponame>jihyunbak/rec_to_nwb
import numpy as np
from pynwb import NWBFile
from rec_to_nwb.processing.exceptions.missing_data_exception import MissingDataException
from rec_to_nwb.processing.nwb.components.mda.time.valid.fl_mda_valid_time_builder import FlMdaValidTimeBuilder
from rec_to_nwb.processing.tools.beartype.... | StarcoderdataPython |
3297115 | <gh_stars>0
from .health_check import query as health_check_resolvers
query = [
health_check_resolvers
]
| StarcoderdataPython |
3294363 | <filename>py/server/tests/test_kafka_consumer.py<gh_stars>0
#
# Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
#
import os
import unittest
from deephaven import kafka_consumer as ck
from deephaven.stream.kafka.consumer import TableType, KeyValueSpec
from tests.testbase import BaseTestCase
from deephav... | StarcoderdataPython |
1684386 | <reponame>sameer-d/open-ce-builder
#!/usr/bin/env python
"""
# *****************************************************************
# (C) Copyright IBM Corp. 2020, 2021. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... | StarcoderdataPython |
1726665 | from splinter import Browser
browser = Browser()
browser.visit('https://holland2stay.com/residences.html?available_to_book=179&p=2')
# browser.fill('q', 'splinter - python acceptance testing for web applications')
# browser.find_by_name('btnK').click()
if browser.is_text_present('1,050.00'):
print("Yes, the offic... | StarcoderdataPython |
171083 | <filename>2D/histogram.py
# This program will contain code related to map the probability distribution on a histogram
import matplotlib.pyplot as plt
import numpy as np
# generating 1000 randome values
# x = np.random.random(100)
# Getting normal distribution values
x = np.random.normal(0,1,400)
# plotting the proba... | StarcoderdataPython |
100687 | """
Given there is no order yet in the pool, the expected quantity is available
in at least two manufacturers:
when create an order via API
Verify order is in DB
Verify order is generated on kafka orders topic
Verify the fulfillment plan is updated with the new order
"""
import requests, unittest, os
try:
ORDER_... | StarcoderdataPython |
1776324 | <filename>ledsa/core/_led_helper_functions_s3.py
import os
import re
import numpy as np
import scipy.optimize
from ledsa.core.model import target_function
from ledsa.core.LEDAnalysisData import LEDAnalysisData
import time
sep = os.path.sep
def generate_led_analysis_data(conf, channel, data, debug, iled, img_filena... | StarcoderdataPython |
128198 | <filename>genix_backpack_example.py<gh_stars>10-100
import pygame as pg
import genix
pg.init()
win = genix.UIWindow()
win.set_title("Backpack Genix Example")
genix_main = genix.UIMain(win)
clock = pg.time.Clock()
class TabTooltip(genix.UIContainer):
def __init__(self, name=""):
super().... | StarcoderdataPython |
1719285 |
from FilesystemBase import FilesystemBase
from JumpScale import j
import os
class FilesystemVirtualRootList(FilesystemBase):
"""
basis for 1 level down eg spaces
"""
def __init__(self, cmd_channel, name2pathFunction, type, contentmanager):
root = type
FilesystemBase.__init__(self, ... | StarcoderdataPython |
3380315 | from django.urls import path
from . import views
from django.conf import settings
from django.conf.urls.static import static
# from .views import FoliumView
urlpatterns = [
path('', views.folium_map0, name='folium-map0'),
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=setting... | StarcoderdataPython |
3336027 | <filename>training/experimental/image_labeller.py
# Copyright 2018 Google LLC
#
# 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 |
1680860 | #Faça um programa em Python que gere 20 números aleatórios (entre 1 e 50),
#armazene-os em uma lista. Imprima os números e calcule a média apenas dos
#números pares.
from random import randint
L = []
soma = 0
par = 0
for i in range(20):
L.append(randint(1,50))
if L[i] % 2 == 0:
soma += L[i]
par... | StarcoderdataPython |
3362491 |
"""
Parser for Planetary Data System header files.
Original Author: <NAME> <<EMAIL>>
Addendum: <NAME> <<EMAIL>> - 24 Sept 2017
"""
import sys
import arm_position.camera.cahvor
def parse(filename):
"""Parse a PDS data file and return the labels contained in the file header.
Returns:
Data labels in a... | StarcoderdataPython |
1614042 | # coding: utf-8
"""
Prisma Cloud Compute API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: 21.04.439
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_impor... | StarcoderdataPython |
160518 | <filename>accelbyte_py_sdk/api/platform/wrappers/_fulfillment_script.py
# Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
#
# Code generated. DO NOT EDIT!
# template file: justice_py_sdk_co... | StarcoderdataPython |
180038 | import random
# Enemy Class
class Enemy():
def __init__(self, name, strength, defense, health, exp):
self.health = health
self.name = name
self.strength = strength
self.defense = defense
self.exp = exp
def attack(self, other):
# Roll For Enemy Attack
... | StarcoderdataPython |
3363796 | '''Fairly basic set of tools for real-time data augmentation on image data.
Can easily be extended to include new transformations,
new process methods, etc...
'''
#Code from https://github.com/oeway/keras/blob/extendImageDataGenerator/keras/preprocessing/image.py
#wfrom __future__ import absolute_import
from __future... | StarcoderdataPython |
1636036 | from .base import ResourceBase
from .archive import Archive
from .multivector import Multivector
from .instance import Instance
from .rawdata import RawData
from .vector import Vector
from .bound_resource import BoundResource
| StarcoderdataPython |
1758959 | <reponame>danielmohansahu/advent_of_code<gh_stars>0
import csv
import numpy as np
from itertools import product
import copy
def iterate_grid(grid):
""" Return a copy of the grid after applying iteration rules, e.g.:
- If a seat is empty (L) and there are no occupied seats adjacent to it, the seat becomes occ... | StarcoderdataPython |
1649214 | <reponame>AlexRogalskiy/splitgraph<gh_stars>0
"""
Command line routines generating example data / Splitfiles
"""
from hashlib import sha256
from typing import TYPE_CHECKING
import click
from splitgraph.commandline.common import RepositoryType
from splitgraph.core.types import TableColumn
if TYPE_CHECKING:
from s... | StarcoderdataPython |
145174 | <filename>3-Utils/visualize_data.py
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 8 23:39:50 2021
@author: talha
"""
import matplotlib.pyplot as plt
def visualize(original,augmented,no):
plt.figure(figsize=(10, 10))
fig = plt.figure()
plt.subplot(3,3,1)
plt.title('Original image')
plt.imshow(ori... | StarcoderdataPython |
1694349 | from pymongo import MongoClient
import os
import time
from collections import namedtuple
from gnn_benchmark.common.definitions import RunState, RunEntry, RunResults
DBPaths = namedtuple("DBPaths", "host database collection")
class RunsDB:
def __init__(self, db_path: DBPaths):
if not isinstance(db_path.co... | StarcoderdataPython |
109094 | from cartography.intel.azure import compute
from tests.data.azure.compute import DESCRIBE_DISKS
from tests.data.azure.compute import DESCRIBE_SNAPSHOTS
from tests.data.azure.compute import DESCRIBE_VM_DATA_DISKS
from tests.data.azure.compute import DESCRIBE_VMAVAILABLESIZES
from tests.data.azure.compute import DESCRIBE... | StarcoderdataPython |
3372976 | <gh_stars>10-100
import numpy as np
from sklearn.linear_model import LogisticRegression
from .base import TransformationBaseModel
class Reflective(TransformationBaseModel):
"""The class which implements the reflective approach.
+----------------+--------------------------------------------------------------... | StarcoderdataPython |
125131 | from django.apps import AppConfig
class ListchartsConfig(AppConfig):
name = 'admin_list_charts'
| StarcoderdataPython |
192463 | #!/usr/bin/python3
# -*- encoding: utf-8 -*-
'''
File:
ng_app.py
Description:
The main routine.
Change History:
2018-1-19 v0.1 created by github/zhenggao2
'''
import sys
from PyQt5.QtWidgets import QApplication
from ngmainwin import NgMainWin
app = QApplication(sys.argv)
mainWin = NgMainWin()
mainWi... | StarcoderdataPython |
160930 | <reponame>superdex/esignature-recipes-python
# DocuSign api_logging library
#
# Set encoding to utf8. See http://stackoverflow.com/a/21190382/64904
import sys; reload(sys); sys.setdefaultencoding('utf8')
import os, base64, json, requests, shutil, datetime, zipfile, StringIO
from app.lib_master_python import ds_recip... | StarcoderdataPython |
1637119 | <filename>examples/save_to_psd.py
"""Save your current active document as a .psd file."""
from photoshop import Session
with Session() as ps:
psd_file = "your/psd/save/file/path.psd"
doc = ps.active_document
options = ps.PhotoshopSaveOptions()
layers = doc.artLayers
doc.saveAs(psd_file, options, Tr... | StarcoderdataPython |
156710 | <gh_stars>10-100
"""管理员发送 清理僵尸+{可选加清理人数} 即可清理僵尸用户(要求机器人时管理员)"""
import time
from datetime import datetime
from botoy.collection import MsgTypes
from botoy.decorators import (
from_admin,
ignore_botself,
startswith,
these_msgtypes
)
from botoy.session import SessionHandler, ctx, session
zombie_handler ... | StarcoderdataPython |
1704179 | from django.core.management.base import BaseCommand
from notifications import utils
class Command(BaseCommand):
help = 'Test notifications'
def add_arguments(self, parser):
parser.add_argument('event_name', type=str, help='Event name')
parser.add_argument('message', type=str, help='Message')... | StarcoderdataPython |
123262 | #!/usr/bin/env python3
#-*- coding: utf-8 -*-
"""Majiro script tools library
"""
__version__ = '0.1.0'
__date__ = '2021-04-04'
__author__ = '<NAME>'
__credits__ = '''Original C# implementation by AtomCrafty - 2021
Converted to Python library by <NAME> - 2021
'''
###################################################... | StarcoderdataPython |
3378951 | <gh_stars>0
#!/usr/bin/env python3
"""Test the CheckData class in the infoset.cache.validate module."""
# Standard imports
import unittest
import copy
import os
import sys
# Try to create a working PYTHONPATH
_TEST_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
_LIB_DIRECTORY = os.path.abspath(os.path.join(_... | StarcoderdataPython |
1707148 | <reponame>Snackhole/PyFifth
from PyQt5 import QtCore
from PyQt5.QtWidgets import QDialog, QGridLayout, QSizePolicy, QPushButton, QSpinBox, QLabel
class GainCoinsDialog(QDialog):
def __init__(self, ParentWindow):
super().__init__(parent=ParentWindow)
# Store Parameters
self.ParentWindow = ... | StarcoderdataPython |
3289112 | <reponame>Owen-Cochell/chas
import selectors
import socket
import pkgutil
import inspect
import threading
from chaslib.socket_lib import CHASocket
class SocketClient:
def __init__(self, chas, host, port):
self.chas = chas # CHAS Instance
self.running = False # Value determining if the Socket ... | StarcoderdataPython |
152784 | import urllib.request
import urllib.error
import socket
from .base import ToshiHTTPClientBase, ToshiHTTPResponse
from io import BytesIO
import time
class ToshiHTTPClient(ToshiHTTPClientBase):
def fetch_impl(self, request):
req = urllib.request.Request(
request.url, method=request.method,
... | StarcoderdataPython |
1633044 | # coding: utf-8
# Copyright (c) 2021 AkaiKKRteam.
# Distributed under the terms of the Apache License, Version 2.0.
import numpy as np
from pymatgen.analysis.structure_analyzer import VoronoiConnectivity
from pymatgen.core import Structure
def min_dist_matrix(structure: Structure) -> float:
"""make minimum distan... | StarcoderdataPython |
4822764 | <filename>PythonClient/multirotor/gimbal.py
import setup_path
import airsim
import time
# connect to the AirSim simulator
client = airsim.MultirotorClient(ip="192.168.86.61")
client.confirmConnection()
client.enableApiControl(True)
client.armDisarm(True)
serverversion = client.getServerVersion()
print(serverversion)... | StarcoderdataPython |
1762851 | import logging
from typing import Optional, Union
from meross_iot.model.enums import Namespace, get_or_parse_namespace
from meross_iot.model.push.bind import BindPushNotification
from meross_iot.model.push.generic import GenericPushNotification
from meross_iot.model.push.unbind import UnbindPushNotification
_LOGGER =... | StarcoderdataPython |
3384179 | <gh_stars>0
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/text.symbols.ipynb (unless otherwise specified).
__all__ = ['symbols', 'symbols_with_ipa', 'DEFAULT_SYMBOLS', 'IPA_SYMBOLS', 'SYMBOL_SETS', 'symbols_to_sequence',
'arpabet_to_sequence', 'should_keep_symbol', 'symbol_to_id', 'id_to_symbol', 'curly_r... | StarcoderdataPython |
108175 | # Tower of Hanoi
def toh(n,A,B,C):
if n==0:
return
toh(n-1,A,C,B)
print("Moved Disk",n,"From Tower",A,"To Tower ",B)
toh(n-1,C,B,A)
no_of_disk = int(input())
not1 = input()
not2 = input()
not3 = input()
toh(no_of_disk,not1,not2,not3)
| StarcoderdataPython |
50073 | # coding=utf-8
import logging
import struct
SS0 = [
0x2989a1a8, 0x05858184, 0x16c6d2d4, 0x13c3d3d0, 0x14445054, 0x1d0d111c, 0x2c8ca0ac, 0x25052124,
0x1d4d515c, 0x03434340, 0x18081018, 0x1e0e121c, 0x11415150, 0x3cccf0fc, 0x0acac2c8, 0x23436360,
0x28082028, 0x04444044, 0x20002020, 0x1d8d919c, 0x20c0e0e0, 0x2... | StarcoderdataPython |
29348 | """Tests for the cursor module."""
from __future__ import absolute_import
from . import common
from bearfield import cursor, Document, Field, Query
class TestCursor(common.TestCase):
"""Test the Cursor class."""
class Document(Document):
class Meta:
connection = 'test'
index = Fie... | StarcoderdataPython |
4801383 | from .bucket_test import *
from .packet_test import *
from .request_test import * | StarcoderdataPython |
1788430 | import hashlib
import sys
salt = "<PASSWORD>" #"<PASSWORD>"
KEYS_LEFT = 64
def hash(counter, salt):
m = hashlib.md5()
m.update(salt.encode('utf-8'))
m.update(str(counter).encode('utf-8'))
return str(m.hexdigest())
def findTripplet(str):
i = 0
length = len(str) - 2
while i < length and (str[i] != ... | StarcoderdataPython |
3359957 | <reponame>projectitis/mac<filename>scripts/xm_to_h.py
from glob import glob
from os import path
from PIL import Image
###
### Compile XM module to c header files
###
# This code is available under the MIT license
# Copyright (c) 2018 <NAME> (Projectitis)
#
# Permission is hereby granted, free of charge, to any person... | StarcoderdataPython |
136263 | #!/usr/bin/env python
import argparse
import datetime
import os
import time
import urlparse
from selenium import webdriver
from har2stix import Har2Stix
def load_driver(extensions, mime_types, output_dir, download_dir):
profile = webdriver.FirefoxProfile()
for extension in extensions:
profile.add_e... | StarcoderdataPython |
198753 | <gh_stars>0
import itertools
import numpy as np
import torch
from util.image_pool import ImagePool
from . import networks
from .base_model import BaseModel
LAMBDA = 10
DIS_LAMBDA = 0.5
class AttentionMaskGANModel(BaseModel):
def name(self):
return 'AttentionMaskGANModel'
@staticmethod
def modi... | StarcoderdataPython |
88360 | import copy
from django.test import TestCase
from gnosis.eth.tests.ethereum_test_case import EthereumTestCaseMixin
from ..indexers import Erc20EventsIndexerProvider
from ..models import EthereumEvent, EthereumTx
from .factories import SafeContractFactory
class TestErc20EventsIndexer(EthereumTestCaseMixin, TestCase... | StarcoderdataPython |
32373 | <filename>src/main/resources/alm/CreateDefect.py
#
# Copyright 2021 XEBIALABS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use... | StarcoderdataPython |
116427 | <gh_stars>0
class ElectricalDemandFactorRule(Enum, IComparable, IFormattable, IConvertible):
"""
This enum describes the different demand factor rule types available to the application.
Within a demand factor a rule will be referenced and the user will have to enter values
corresponding to that rul... | StarcoderdataPython |
3205353 | <reponame>OttoWinter/esphomeyaml
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import sensor
from esphome.const import (
CONF_ID,
CONF_COMPONENT_ID,
)
from .. import nextion_ns, CONF_NEXTION_ID
from ..base_component import (
setup_component_core_,
CONFIG_S... | StarcoderdataPython |
3261998 | <filename>remove-broken-file/remove-template.py<gh_stars>1-10
# -*- coding: utf-8 -*-
import argparse
import json
import os
import re
import time
from datetime import datetime, timezone
import pymysql
os.environ["PYWIKIBOT_DIR"] = os.path.dirname(os.path.realpath(__file__))
import pywikibot
from config import config_... | StarcoderdataPython |
1692907 | <filename>ansible/modules/network/cloudengine/ce_mtu.py<gh_stars>1-10
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lice... | StarcoderdataPython |
1696902 | from __future__ import absolute_import
import sage.crypto.sbox
from sage.structure.sage_object import register_unpickle_override
register_unpickle_override('sage.crypto.mq.sbox', 'SBox', sage.crypto.sbox.SBox)
from sage.misc.lazy_import import lazy_import
lazy_import('sage.crypto.classical', ['AffineCryptosystem',
... | StarcoderdataPython |
196963 | <filename>databroker/assets/tests/test_mongo_details.py
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import pytest
from ..utils import install_sentinels
def test_double_sentinel(fs_mongo):
fs = fs_mongo
with pytest.raises(RuntimeError):
... | StarcoderdataPython |
4821846 | import moonleap.resource.props as P
from moonleap import create, create_forward, empty_rule, extend, kebab_to_camel, rule
from moonleap.resource.named_class import named
from moonleap.verbs import uses
from titan.api_pkg.item.resources import Item
from .resources import ItemList
@create("item~list")
def create_item_... | StarcoderdataPython |
138697 | <reponame>jhh67/chapel
#!/usr/bin/env python
""" A small program to compute checksums of LLVM checkout.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import hashlib
import logging
import re
import sys
from argparse import ArgumentParser
from project_tr... | StarcoderdataPython |
1740608 | import os
import bs4
import requests
import re
import time
# Todo: to scrape only English books
# Todo: to get book title
# Todo: to create folders separately in alphabetical way?
def main():
alphabetical_list = "a"
for char in alphabetical_list:
try:
url = "https://www.gutenberg.org/browse/titles/{}".format(c... | StarcoderdataPython |
3377145 | class Item:
# Set Item ID, Type and Name in initialization
def __init__(self, name, price):
self.__name = name
self.__price = price
# Return Item Name
def get_item_name(self):
return self.__name
# Return Item Price
def get_item_price(self):
return self.__price
... | StarcoderdataPython |
4841254 | <reponame>higs4281/cfgov-refresh
import itertools
import six
from unittest import TestCase
from v1.util.ref import (
categories, get_appropriate_categories, get_category_children
)
class TestCategories(TestCase):
if six.PY2:
assertCountEqual = TestCase.assertItemsEqual
def test_no_duplicate_slu... | StarcoderdataPython |
197226 | <gh_stars>0
from __future__ import absolute_import
from pants.backend.jvm.tasks.scalastyle import Scalastyle
from pants.goal.task_registrar import TaskRegistrar as task
from pants.base.exceptions import TaskError
class SoftErrorScalastyle(Scalastyle):
@classmethod
def register_options(cls, register):
super(Sof... | StarcoderdataPython |
1674353 | <filename>fc_layer.py<gh_stars>0
from layer import Layer
import numpy as np
# inherit from base class Layer
class FCLayer(Layer):
# input_size = number of input neurons
# output_size = number of output neurons
def __init__(self, input_size, output_size):
self.weights = np.random.rand(input_size, ... | StarcoderdataPython |
3305083 | <gh_stars>10-100
import wx
from gui.pref.prefcontrols import *
def panel(panel, sizer, newgroup, exithooks):
newgroup('Plugins',
PluginList(panel)
)
return panel
class PluginList(wx.VListBox):
pass | StarcoderdataPython |
3358142 |
from rj_ml_utils.package import details as pkg
import setuptools
print(pkg.include_package_data[0])
setuptools.setup(
name=pkg.name, # Replace with your own username
version=pkg.version,
author=pkg.author,
author_email=pkg.author_email,
description=pkg.description,
long_description=pkg.long_de... | StarcoderdataPython |
3289401 | <reponame>watanka/CRAFTS_implementation
from config import config
import torch
import torch.utils.data as data
import torchvision.transforms as transforms
import time, string
import re, random, itertools
from PIL import Image, ImageDraw
import scipy.io as scio
import Polygon as plg
from glob import glob
import matpl... | StarcoderdataPython |
1791339 | <reponame>tlpmit/scikit-robot
# flake8: noqa
from . import _pybullet as pybullet
from ._pybullet import PybulletRobotInterface
from .ros import *
| StarcoderdataPython |
4433 | <reponame>HPLegion/glue
import numpy as np
from numpy.testing import assert_allclose
from echo import CallbackProperty, ListCallbackProperty
from glue.core import Data, DataCollection
from .test_state import clone
from ..state_objects import (State, StateAttributeLimitsHelper,
StateAttri... | StarcoderdataPython |
3379126 | <reponame>NathanielDake/nathanieldake.github.io<gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
import theano
import theano.tensor as T
from Machine_Learning.hmm.utils import get_obj_s3, random_normalized
class HMM:
def __init__(self, M):
self.M = M
def fit(self, X, learning_rate=0.0... | StarcoderdataPython |
1780312 | <reponame>julianwachholz/archconfig
#!/usr/bin/env python
import os
import random
import click
import praw
import requests
from PIL import Image
MIN_WIDTH = 1920
MIN_HEIGHT = 1200
MAX_RETRIES = 25
SUBS = [
'wallpapers',
'wallpaper',
'earthporn',
'skylineporn',
'bigwallpapers',
# 'nocontext_wa... | StarcoderdataPython |
1790546 | <reponame>terrainthesky-hub/DS-Unit-3-Sprint-3-Productization-and-Cloud<filename>test/web_app/routes/tweet_routes.py
from flask import Blueprint, jsonify, request, render_template, redirect #, flash
from web_app.models import Twitter, parse_records, db
tweet_routes = Blueprint("tweet_routes", __name__)
@tweet_route... | StarcoderdataPython |
3395268 | '''
Number: 2
We use the functions in this Python file to preprocess the raw corpus.
It contains the following functions
- 'clean_text'
preprocess/clean a given string
- 'clean_text_source'
preprocess/clean all small text files associated with a given source (news, blogs, twitter)
'''
import re
import ... | StarcoderdataPython |
59205 | <filename>src/bratdb/term.py
import re
import string
from collections import defaultdict
from bratdb.nlp.stopwords import get_stopwords
class Segment:
STOPWORDS = get_stopwords()
def __init__(self, term, is_punct=False, ignore_stopwords=False,
add_stopwords=None):
self.term = term
... | StarcoderdataPython |
3381857 | from turtle import *
title("flag")
speed(5)
color("black")
pensize(3)
left(90)
fd(200)
backward(400)
fd(400)
right(90)
pensize(2)
color ("orange")
begin_fill ()
fd(200)
right(90)
forward(40)
right(90)
fd(200)
end_fill ()
color("white")
begin_fill ()
backward (200)
left(90)
fd(40)
right(90)
fd... | StarcoderdataPython |
3247768 | import random
import audiomate
from bench import resources
def run(source_corpus):
audiomate.Corpus.from_corpus(source_corpus)
def test_from_corpus(benchmark):
source_corpus = resources.generate_corpus(
200,
(5, 5),
(5, 5),
(4, 4),
(4, 4),
random.Random(x=23... | StarcoderdataPython |
1761026 | <reponame>constantinpape/torch_em
import os
from elf.io import open_file
from torch_em.data.datasets import get_bioimageio_dataset_id
from torch_em.util import (add_weight_formats, export_bioimageio_model,
get_default_citations, export_parser_helper,
get_training_s... | StarcoderdataPython |
1616673 | <filename>examples/transforms.py
import copy
from typing import List
import torch
import torchvision.transforms as transforms
import torchvision.transforms.functional as TF
from transformers import BertTokenizerFast, DistilBertTokenizerFast
from data_augmentation.randaugment import FIX_MATCH_AUGMENTATION_POOL... | StarcoderdataPython |
156839 | '''
Define a simple neural net in Keras that recognizes MNIST handwritten digits
'''
from __future__ import print_function
import numpy as np
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.core import Dense, Activation
from keras.optimizers import SGD
from keras.utils import np_u... | StarcoderdataPython |
3210100 | # Copyright 2022 The KerasCV Authors
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | StarcoderdataPython |
25158 | import unittest
import logging
import asyncio
import datetime
from pytz import timezone
import dscraper
from dscraper.utils import FrequencyController
logger = logging.getLogger(__name__)
from .utils import Test
EPS = 1e-6
class TestController(Test):
INVERTAL = 0.2
CONFIG_NONE = (0, 0, 0, EPS, None)
CO... | StarcoderdataPython |
1630920 | <gh_stars>0
# © 2020 지성. all rights reserved.
# <<EMAIL>>
# MIT License
from mrcnn import t_shirt as t
from mrcnn import model as modellib
import argparse
import os
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--mode', required=True)
parser.add_argument('--dataset', default='data/t... | StarcoderdataPython |
1715292 | #!/usr/bin/python
######################################################################
# Ascii TMS Viewer
#
#--------------------------------------------------------------------
# <NAME> | Initial Release
#--------------------------------------------------------------------
# ... | StarcoderdataPython |
57398 | ########
# Copyright (c) 2014 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... | StarcoderdataPython |
110355 | """ Unit Tests for Py-ART's config.py module. """
import pyart
from StringIO import StringIO
def test_debug_info():
# test to see that something is written when _debug_info is called
# we don't care what is written, just that something is.
buf = StringIO()
pyart._debug_info(buf)
assert buf.len > ... | StarcoderdataPython |
177154 | ## IMPORTANT: Must be loaded after `02-service-common.py
## announcement service
service_env = dict()
service_url = f'{hub_hostname}:{service_port}'
if c.JupyterHub.internal_ssl:
# if we are using end-to-end mTLS, then pass
# certs to service and set scheme to `https`
# TODO: Generate certs automatic... | StarcoderdataPython |
23152 | # Copyright 2021 The ML Collections Authors.
#
# 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... | StarcoderdataPython |
4808386 | # Copyright 2019 1QBit
#
# 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 ... | StarcoderdataPython |
145551 | import numpy as np
import pandas as pd
# list 1
a = [2, 3, 2.7, 3.2, 4.1]
# list 2
b = [10, 14, 12, 15, 20]
# storing average of a
av_a = sum(a)/len(a)
# storing average of b
av_b = sum(b)/len(b)
# making series from list a
a = pd.Series(a)
# making series from list b
b = pd.Series(b)
# covariance through pand... | StarcoderdataPython |
89097 | <gh_stars>1-10
# Program to work with file input / output (i/o)
# This is pulling the days.txt file in this directory in this repo
path = 'days.txt'
days_file = open(path,'r')
days = days_file.read()
new_path = 'new_days.txt'
new_days = open(new_path,'w')
title = 'Days of the Week\n'
new_days.write(title)
print(tit... | StarcoderdataPython |
1797972 | import attr
import inject
from picorss.src.application import repositories
from picorss.src.domain import entities
class AddingRssPageUseCase:
@attr.s
class InputDTO:
url: str = attr.ib()
_rss_page_repo = inject.attr(repositories.RssPageRepo)
def execute(self, input_dto: InputDTO) -> None:... | StarcoderdataPython |
1737962 | """
Support for Apple TV.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.apple_tv/
"""
import asyncio
import logging
from homeassistant.core import callback
from homeassistant.components.apple_tv import (
ATTR_ATV, ATTR_POWER, DATA_APPL... | StarcoderdataPython |
1636181 | import subprocess as sub
#import sys
import argparse
import datasetConfig
parser = argparse.ArgumentParser('Tasas for CER')
parser.add_argument('epochs', type=int, help='how many epochs')
parser.add_argument('flag', type=str, help='si/no with/without testing')
#parser.add_argument('folder', type=str, help='pred_logs_l... | StarcoderdataPython |
3390712 | __author__ = 'dbaskette'
# Read json file with info.... or just have everything as a parameter
import argparse
from boto.cloudformation import CloudFormationConnection
def cliParse():
VALID_ACTION = ["create", "delete"]
parser = argparse.ArgumentParser(description='Pivotal HD Cloud Creator')
subparser... | StarcoderdataPython |
3253530 | import secrets
from typing import Optional, Union
from .audio import Audio
from .base_vertex import BaseVertex
from .inline_query import InlineQuery
from .query import Query
from ...elasticsearch_models.base_document import SearchMetaData
class Hit(BaseVertex):
_vertex_name = 'hits'
rank: int
score: flo... | StarcoderdataPython |
1771335 | # uninhm
# https://atcoder.jp/contests/abc164/tasks/abc164_a
# simulation
s, w = map(int, input().split())
print("safe" if s > w else "unsafe")
| StarcoderdataPython |
128140 | <reponame>nragot/rox
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 19 21:53:17 2018
@author: nathan
"""
from classes.texFile import TexFile
class End (TexFile):
def __init__(self, parentTex, context):
TexFile.__init__(self, parentTex, context)
self.name = "end"
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.