id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
18835 | <reponame>aws-samples/aws-cdk-for-emr-on-eks
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
from aws_cdk import aws_ec2 as ec2, aws_eks as eks, core, aws_emrcontainers as emrc, aws_iam as iam, aws_s3 as s3, custom_resources as custom, aws_acmpca as acmpca, aws_emr... | StarcoderdataPython |
3268372 | # -*- coding: utf-8 -*-
"""
Created on Sun May 28 09:02:02 2017
@author: andi
"""
def storageRequirements( N ):
if N < 2:
return N
else:
return N + storageRequirements( (N+1)//2 ) | StarcoderdataPython |
3242083 | <filename>api/serializers.py
# api/serializers.py
from rest_framework import serializers
from .models import BucketList
class BucketListSerializer(serializers.ModelSerializer):
"""Serialize Models to JSON"""
owner = serializers.ReadOnlyField(source='owner.username')
class Meta:
"""Meta class mapping model... | StarcoderdataPython |
3222395 | import warnings
from collections import namedtuple
import numpy as np
import h5py
from ecogdata.channel_map import ChannelMap
from ecogdata.trigger_fun import process_trigger
from .file2data import FileLoader
gain = {
'2t-as daq v1' : 10,
'2t-as daq v2' : 10
}
pitch_lookup = {
'actv_64' : 0.4,
'... | StarcoderdataPython |
60938 | <reponame>armijoalb/M-ster-Ciencias-de-Datos-UGR<gh_stars>0
import cv2 as cv
import numpy as np
from functions import loadImages
import time
class LBP:
def __init__(self):
self.window_width = 64
self.window_heigth = 128
self.block_width = 16
self.block_heigth = 16
self.desp_... | StarcoderdataPython |
157268 | <filename>setup.py
from distutils.core import setup
setup(name = 'RedditWallpaperScraper',
version = '0.0.1dev',
packages = 'reddit-wallpaper-scraper',
long_description=open('README.md').read()
)
| StarcoderdataPython |
144134 | <filename>topicnet/cooking_machine/cubes/controller_cube.py
"""
Allows to add `ControllerAgent` (with unknown parameters) to the model, which enables user to
change `tau` during the `_fit` method.
`parameters` is a dict with four fields:
Fields
------
reg_name: str
The name of regularizer. We want to change the ... | StarcoderdataPython |
1769374 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import factory
from faker import Factory
from factory.fuzzy import FuzzyChoice
from faker.providers import misc, lorem
from apps.accounts.models.choices import Platform
from apps.accounts.models.phone_device import PhoneDevice
faker = Factory.create()
faker.add_provider(misc)
f... | StarcoderdataPython |
1654275 | <gh_stars>10-100
from ecommercetools.transactions.transactions import get_transactions
| StarcoderdataPython |
27599 | <filename>ImGen.py
#!/usr/bin/env python
#BSD 3-Clause License
#Copyright (c) 2017, <NAME>
#############################################
# CHANGE THESE VARS AS NEEDED
size = 10 #size of squares in mils
invert = False #Color invert the image
image_name = "test.png" #name of the image, can be BMP, PNG or JPG... | StarcoderdataPython |
97597 | <reponame>loobinsk/customer_project<gh_stars>0
from time import sleep
from django.core.management.base import BaseCommand, CommandError
# from products.tasks import domain_check
# class Command(BaseCommand):
# help = 'Check few site'
#
# # def add_arguments(self, parser):
# # parser.add_argument('pol... | StarcoderdataPython |
3224946 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# (C) 2013-2015 <NAME>
#
# This file is part of 'open-tamil' package tests
#
# setup the paths
from opentamiltests import *
import tamil.utf8 as utf8
from tamil.tscii import TSCII
import codecs
if PYTHON3:
class long(int):
pass
class NumeralString... | StarcoderdataPython |
1643812 | <filename>sdk/python/pulumi_kubernetes_ingress_nginx/_inputs.py<gh_stars>1-10
# coding=utf-8
# *** WARNING: this file was generated by Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, M... | StarcoderdataPython |
112679 | def search(list, key):
pos = -1
for i in range(0,len(list)):
if list[i] == key:
pos = i + 1
break
if pos != -1:
print("\n\nThe value {} is found to be at {} position!".format(key,pos))
else:
print("\n\nThe value {} cannot be found!".format(key))
print("\nEnter the elements of ... | StarcoderdataPython |
17967 | # STL imports
import random
import logging
import string
import time
import datetime
import random
import struct
import sys
from functools import wraps
# Third party imports
import numpy as np
import faker
from faker.providers import BaseProvider
logging.getLogger('faker').setLevel(logging.ERROR)
sys.path.append('.'... | StarcoderdataPython |
1614066 | <reponame>ofersadan85/linode-cli
"""
This file is an example third-party plugin. See `the plugin docs`_ for more
information.
.. _the plugin docs: https://github.com/linode/linode-cli/blob/master/linodecli/plugins/README.md
"""
#: This is the name the plugin will be invoked with once it's registered. Note
#: that t... | StarcoderdataPython |
4807238 | # -*- coding: utf-8 -*-
# Librerias
import numpy as np
import pandas as pd
from pandas.tseries.holiday import USFederalHolidayCalendar as calendar
import tensorflow as tf
from sklearn.model_selection import train_test_split
import seaborn as sns
import os
from sklearn.metrics import r2_score, mean_absolute_error, mean_... | StarcoderdataPython |
1693904 | <filename>code/babymapping_1219/Data_zoo/vae_parents.py<gh_stars>1-10
import os
import glob
import imageio
import cv2
import torch
import numpy as np
#from base import BaseData #1
from Data_zoo.base import BaseData #2
import yaml
from easydict import EasyDict as edict
class Vae_parents(BaseData):
... | StarcoderdataPython |
1690192 | # -*- coding: utf-8 -*-
"""
@brief test log(time=2s)
"""
import unittest
from sklearn.ensemble import RandomForestClassifier
from pyquickhelper.pycode import ExtTestCase
from pymlbenchmark.benchmark.sklearn_helper import get_nb_skl_base_estimators
from pymlbenchmark.datasets import random_binary_classification
c... | StarcoderdataPython |
3384089 | <reponame>dn757657/please-delete-me<filename>setup.py
from distutils.core import setup
setup(name='ct_data',
version='0.1.1',
packages=['ct_data'],
license='MIT',
description = 'finance management tool',
author = 'Dan',
author_email = '<EMAIL>',
url = 'https://github.com/dn757... | StarcoderdataPython |
195969 | # -*- coding: utf-8 -*-
from mrjob.job import MRJob
class SalesRanker(MRJob):
def within_past_week(self, timestamp):
"""Return True if timestamp is within past week, False otherwise."""
...
def mapper(self, _, line):
"""Parse each log line, extract and transform relevant lines.
... | StarcoderdataPython |
3311291 | <filename>src/news.py
try:
from webdriver_manager.chrome import ChromeDriverManager
except: raise ImportError("'webdriver-manager' package not installed")
try:
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
except: raise ImportError("'selenium' package not installed")
from bs... | StarcoderdataPython |
3259035 | <filename>MITx/6.00.1x/Week 2/Lecture_3/strings.py<gh_stars>0
# String and Loops
s1 = "abcdefgh"
print('String is: ', s1)
print('String reversed is: ', s1[::-1])
# Code Sample
iteration = 0
count = 0
while iteration < 5:
# the variable 'letter' in the loop stands for every
# character, including spaces and... | StarcoderdataPython |
3255701 | <reponame>rbrady/os-migrate
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from pprint import pformat
import re
from ansible import errors
def stringfilter(items, queries, attribute=None):
"""Filter a `items` list according to a list of `queries`. Values from
`items`... | StarcoderdataPython |
4811477 | from flask_pymongo import PyMongo
from flask import Flask, render_template, redirect
import scrape_mars
app = Flask(__name__)
# Use flask_pymongo to set up mongo connection
app.config["MONGO_URI"] = "mongodb://localhost:27017/mission_to_mars_app"
mongodb = PyMongo(app)
# Create main page
@app.route("/")
def index():... | StarcoderdataPython |
3361986 | import math
import random
import time
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand
from django.db.models import Q
from movies.models import Movie, Score
from argparse import ArgumentParser
class Command(BaseCommand):
help = 'Create test scores'
def add_arg... | StarcoderdataPython |
3380912 | #!/usr/local/bin/python3.4
import os
import sys
import re
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "papersoccer.settings")
import django
django.setup()
from schemes.models import KurnikReplay
game_date = sys.argv[1]
start_id = int(sys.argv[2])
end_id = int(sys.argv[3])+1
for id in range(start_id,end_id):... | StarcoderdataPython |
1776865 | <reponame>UpperLEFTY/worldpay-within-sdk
import InterruptedException
import WPWithinWrapperImpl
import WWTypes
import time
def discoverDevices(): # throws WPWithinGeneralException {
devices = wpw.deviceDiscovery(8000)
if devices != None and len(devices) > 0:
print "{0} services found:\n".format(len(de... | StarcoderdataPython |
1606933 | # -*- coding:utf-8 -*-
import uuid
import pprint
from datetime import datetime
def DD(vars):
pprint.pprint(vars)
def get_uuid():
uuid_1 = uuid.uuid1()
uuid_4 = uuid.uuid4()
return '%s-%s' % (uuid_1, uuid_4)
def get_now_timestamp():
return datetime.now().strftime('%Y%m%d%H%M%... | StarcoderdataPython |
172855 | <gh_stars>10-100
"""Reproduce some plots from <NAME>'s arXiv:astro-ph/9905116v4
"""
from __future__ import absolute_import, division, print_function
import inspect
import numpy
import matplotlib.pyplot as pylab
import cosmolopy.distance as cd
import cosmolopy.constants as cc
def test_figure1():
"""Plot Hogg f... | StarcoderdataPython |
3305190 | <filename>stats/SumM3Thresholder.py
#!/usr/bin/env python
# coding=utf-8
#
# ITHI Kafka prototype, consume M3 analysis as they are produced, creates and updates SumM3 files
import sys
import codecs
import datetime
from enum import Enum
import copy
import traceback
import datetime
import math
import m3name
import m3summ... | StarcoderdataPython |
3343202 | <reponame>ArkGame/ArkGameFrame
#!/usr/bin/python
# encoding=utf-8
# author: NickYang
# date: 2019/04/02
from openpyxl import load_workbook
from openpyxl.styles import Border, Side, Font
import time
class my_excel(object):
def __init__(self, excelPath):
self.excelPath = excelPath
self.workbook = ... | StarcoderdataPython |
3223679 | import enum
import time
from datetime import timedelta
from uuid import uuid4
import boto3
from celery.decorators import periodic_task
from celery.schedules import crontab
from django.conf import settings
from django.core.files.storage import default_storage
from django.core.mail import EmailMessage
from django.templa... | StarcoderdataPython |
26687 | <reponame>HypoChloremic/fcsan
from analyze import Analyze
import argparse
# ap = argparse.ArgumentParser()
# ap.addargument("-f", "--folder")
# opts = ap.parse_args()
run = Analyze()
run.read()
files = run.files
def indexer():
with open("FACS_INDEX.txt", "w") as file:
for i in files:
run.read(i)
meta = run.... | StarcoderdataPython |
3394334 | <reponame>msbentley/pds4_utils<gh_stars>1-10
#!/usr/bin/python
"""
read.py
"""
from . import common
import os
from pathlib import Path
import pandas as pd
from pds4_tools import pds4_read
from pds4_tools.reader.table_objects import TableManifest
# only show warning or higher messages from PDS4 tools
import logging
pd... | StarcoderdataPython |
4841213 | import ui_common as uic
from django.shortcuts import redirect
import django.contrib.messages
import metadata
import ezid
import form_objects
import ezidapp.models
import re
import datacite_xml
import os.path
import userauth
from django.utils.translation import ugettext as _
"""
Handles simple and advanced ID creat... | StarcoderdataPython |
3285387 | <reponame>yaowenlong/clique
from pypai import PAI
# Create a PAI cluster
pai = PAI(username='ywl1918', passwd='<PASSWORD>')
# Submit job
pai.submit()
| StarcoderdataPython |
3249425 | <reponame>Pzqqt/MaoMiAV_Videos_Downloader<filename>m3u8_downloader.py
#!/usr/bin/env python3
# encoding: utf-8
import os
import re
import shutil
import tempfile
from time import sleep
from concurrent.futures import ThreadPoolExecutor
from argparse import ArgumentParser
import requests
REQ_HEADERS = {
"User-Agent... | StarcoderdataPython |
3299721 | <filename>PyRods/test/test_rodsInfo.py
# Copyright (c) 2013, University of Liverpool
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your optio... | StarcoderdataPython |
193505 | <filename>lib/vtk_opener.py
import os
import numpy as np
import scipy.misc
import vtk
from vtk import vtkStructuredPointsReader
from vtk.util import numpy_support as VN
from vtk.util.numpy_support import vtk_to_numpy
#%%
# load a vtk file as input
reader = vtk.vtkPolyDataReader()
reader.SetFileName("/home/tkdrlf9202/D... | StarcoderdataPython |
42804 | # ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.3
# kernelspec:
# display_name: Python 3
# name: python3
# ---
# + [markdown] id="view-in-github" colab_type="text"
# <a href="https://colab... | StarcoderdataPython |
3253431 | <gh_stars>0
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
class TypeOfMembership(models.Model):
membership_type = models.CharField(max_length=150)
#member_entry = models.CharField(max_l... | StarcoderdataPython |
61941 | import tensorflow as tf
import sys
from configs import DEFINES
# 엘에스티엠(LSTM) 단층 네트워크 구성하는 부분
def make_lstm_cell(mode, hiddenSize, index):
cell = tf.nn.rnn_cell.BasicLSTMCell(hiddenSize, name = "lstm"+str(index))
if mode == tf.estimator.ModeKeys.TRAIN:
# 트레이닝 모드에서 드랍아웃 추가
cell = tf.contrib.rnn.... | StarcoderdataPython |
1641682 | <filename>tools/auth/backends.py
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.backends import ModelBackend
class SingleUserBackend(ModelBackend):
"""
Authenticate against only one user defined in settings.LOGIN_USER.
"""
supports_inactive_user = True
def... | StarcoderdataPython |
3237179 | from __future__ import print_function
import sys
from pyc4 import c4
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def test_sum():
assert sum([1, 2, 3]) == 6, "Should be 6"
def test_encoding():
tests = [ { 'in': "", 'exp': "<KEY>" } ]
for test in tests:
actual = c4.Identify(test[... | StarcoderdataPython |
4812694 | <filename>src/octonote/core/format.py
import textwrap
import pastel
printer = pastel.Pastel(True)
printer.add_style("header", options=["bold"])
printer.add_style("location", "light_blue")
# printer.add_style("code", "white")
printer.add_style("notice", options=["bold"])
printer.add_style("warning", "yellow", options... | StarcoderdataPython |
1763334 | <filename>src/test/data_structure/dictionary_exercise_test.py
import unittest
from src.main.data_structure.dictionary_exercise import *
class DictTest(unittest.TestCase):
def test_add_element(self):
_dict = Dict({"a": 1, "b": 2, "c": 3})
self.assertEqual(_dict.add_element("d", 4), {"a": 1, "b": 2,... | StarcoderdataPython |
1677795 | <reponame>juliolugo96/projex-api
import json
from users.models import CustomUser
from api.models import *
from api.serializers import *
from .authBase import AuthBaseTestCase
class BoardTestCase(AuthBaseTestCase):
url = '/api/v1/assignees'
def setUp(self):
super().setUp() # Create 4 users(user,je... | StarcoderdataPython |
3208036 | <filename>flow/utils/trafficlights.py
import numpy as np
def get_phase(name, ts):
phases = all_phases[name]
for i, phase in enumerate(phases):
phase['duration'] = phase['minDur'] = phase['maxDur'] = str(ts[i % len(ts)])
return phases
def get_uniform_random_phase(name, means, noises, T=500):
i,... | StarcoderdataPython |
1623548 | <filename>tests/generate/test_generate_copy_without_render.py
"""Verify correct work of `_copy_without_render` context option."""
import os
import pytest
import tackle.utils.paths
from tackle.main import tackle
from tackle.utils.paths import rmtree
@pytest.fixture
def remove_test_dir():
"""Fixture. Remove the f... | StarcoderdataPython |
3225464 | '''
Statistical Computing for Scientists and Engineers
Homework 2
Fall 2018
University of Notre Dame
'''
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import expon
from sklearn.metrics import mean_squared_error
x = np.linspace(1,501,500)
print (x.shape)
main_MLE = []
main_MAP = []
for i in range (... | StarcoderdataPython |
1604001 | from django.contrib.contenttypes.models import ContentType
from django.contrib.gis.db.models import Union
from django.db.models import DurationField, Q
from django.db.models.functions import Cast
from django.utils.translation import ugettext_lazy as _
from enumfields.drf import EnumField, EnumSupportSerializerMixin
fro... | StarcoderdataPython |
3356401 | <gh_stars>10-100
"""
Clean HTML
"""
from relevanceai.operations_new.apibase import OperationAPIBase
from relevanceai.operations_new.processing.text.html_clean.base import (
CleanTextBase,
)
class CleanTextOps(CleanTextBase, OperationAPIBase):
"""
Clean text operations
"""
| StarcoderdataPython |
1611471 | <reponame>clembu/MenuCreator
# Mustard Menu Creator addon
# https://github.com/Mustard2/MenuCreator
bl_info = {
"name": "Menu Creator",
"description": "Create a custom menu for each Object. To add properties or collections, just right click on the properties and hit Add property to the Menu",
"author... | StarcoderdataPython |
1755689 | <reponame>Sahanduiuc/hrp
import numpy as np
def correlation_from_covariance(covariance):
# see https://gist.github.com/wiso/ce2a9919ded228838703c1c7c7dad13b
v = np.sqrt(np.diag(covariance))
return covariance / np.outer(v, v)
def bilinear(A, x):
return np.linalg.multi_dot((x, A, x))
def sub(A, idx)... | StarcoderdataPython |
1775445 | import torch
from torch.nn.utils.clip_grad import clip_grad_norm_, clip_grad_value_
from maml.utils import accuracy
def get_grad_norm(parameters, norm_type=2):
if isinstance(parameters, torch.Tensor):
parameters = [parameters]
parameters = list(filter(lambda p: p.grad is not None, parameters))
no... | StarcoderdataPython |
3302363 | #!/usr/bin/env python3
import argparse
from .helper import OpenShiftDeployHelper
class OpenShiftDeployCLI(object):
def __init__(self):
self.parser = argparse.ArgumentParser()
self.subparsers = self.parser.add_subparsers()
self.parent_parser = argparse.ArgumentParser(add_help=False)
... | StarcoderdataPython |
169482 | from aetherling.helpers.nameCleanup import cleanName
from magma import *
from magma.frontend.coreir_ import GetCoreIRBackend
from aetherling.modules.hydrate import Dehydrate, Hydrate
from mantle.coreir.memory import DefineRAM, getRAMAddrWidth
__all__ = ['DefineRAMAnyType', 'RAMAnyType']
@cache_definition
def DefineR... | StarcoderdataPython |
78254 | #!/usr/bin/env python
import re
import unittest
import mock
import pytest
from cachet_url_monitor.configuration import HttpStatus, Regex
from cachet_url_monitor.configuration import Latency
class LatencyTest(unittest.TestCase):
def setUp(self):
self.expectation = Latency({'type': 'LATENCY', 'threshold':... | StarcoderdataPython |
3243506 | """
models.py
App Engine datastore models
"""
from google.appengine.ext import ndb
class Report(ndb.Model):
created_at = ndb.DateTimeProperty('c', auto_now=True)
modified_at = ndb.DateTimeProperty('m', auto_now_add=True)
google_places_id = ndb.StringProperty('g', required=True)
crowd_level = ndb.StringProperty... | StarcoderdataPython |
1619013 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 1 13:57:09 2019
@author: Tom
"""
import smtplib
import configparser
import logging
def send_email(config_values, logger, body, subject='Test email'):
''' Send an email from a python script '''
#ascii_body = body.encode('ascii', 'ignore')... | StarcoderdataPython |
149070 | coco_file = 'yolo/darknet/coco.names'
yolo_cfg_file = 'yolo/darknet/yolov3-tiny.cfg'
yolo_weights_file = 'yolo/darknet/yolov3-tiny.weights'
img_size = (320,320)
conf_threshold = 0.5
nms_threshold = 0.3 | StarcoderdataPython |
4828330 | from replies import bot_reply, player_reply
class Mediator:
def __init__(self):
self.number_of_players = player_reply("number of players (1 or 2): ")
if self.number_of_players == 1:
self.human = input("select marker (X or O) : ").upper()
else:
self.human = ""
... | StarcoderdataPython |
3236968 | <reponame>osoco/better-ways-of-thinking-about-software
"""
Video player in the courseware.
"""
import logging
from bok_choy.javascript import js_defined, wait_for_js
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise # lint-amnesty, pylint: disable=unused-import
log = logging.get... | StarcoderdataPython |
3387043 | import wx
import wx.aui
from GraphicsCanvas import GraphicsCanvas
from TreeCanvas import TreeCanvas
from InputModeCanvas import InputModeCanvas
from PropertiesCanvas import PropertiesCanvas
from ObjPropsCanvas import ObjPropsCanvas
from Ribbon import Ribbon
from HeeksConfig import HeeksConfig
class Frame(wx.Frame):
... | StarcoderdataPython |
3323326 | <filename>twitter_credentials.py
ACCESS_TOKEN = "Enter your access token here"
ACCESS_TOKEN_SECRET = "Enter your access token secret here"
CONSUMER_KEY = "Enter your consumer key here"
CONSUMER_SECRET = "Enter your consumer secret here"
| StarcoderdataPython |
1736148 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyGeocube(PythonPackage):
"""Tool to convert geopandas vector data into rasterized xarray ... | StarcoderdataPython |
183053 | <reponame>sainjusajan/django-oscar
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class CommunicationsDashboardConfig(AppConfig):
label = 'communications_dashboard'
name = 'oscar.apps.dashboard.communications'
verbose_name = _('Communications dashboard')
| StarcoderdataPython |
3328465 | <reponame>johnnycakes79/pyops
"""
This module provides a series of time/date utilities.
"""
from __future__ import print_function
import spiceypy as spice
from datetime import datetime, timedelta
def oem_to_datetime(oem_time_string):
"""
converts oem datetime record to python datetime object
Args:
... | StarcoderdataPython |
1625609 | # Modified from open-mmlab/mmcv
import os
import cv2
from cv2 import VideoWriter_fourcc
from mmcv.utils import check_file_exist, mkdir_or_exist, scandir, track_progress
def frames2video(frame_dir,
video_file,
file_names,
fps=20,
fourcc='XVID',
... | StarcoderdataPython |
1654871 | <gh_stars>1-10
from fastdtw import fastdtw
from sklearn.metrics import euclidean_distances
import pandas as pd
import numpy as np
import pickle
class DtwKnn(object):
def __init__(self, n_neighbors=1, dist=euclidean_distances):
self.n_neighbors = n_neighbors
self.dist = dist
self.templates ... | StarcoderdataPython |
1725586 | <filename>python/cgp_generic_utils/python/__init__.py<gh_stars>1-10
"""
python management functions
"""
# imports local
from ._module import deleteModules, import_
__all__ = ['deleteModules', 'import_']
| StarcoderdataPython |
141334 | <filename>cqd/base.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
from torch import optim, Tensor
import math
from cqd.util import query_to_atoms
import cqd.discrete as d2
from typing import T... | StarcoderdataPython |
3330251 | <reponame>zama201bc/LanguageCards
import datetime
from LanguageDeck.models import Cards
"""Interface for Card and Deck objects. Contains the obvious observer, creator and mutator functions"""
def get_text(card):
return str(card.text)
def get_translations(card):
return card.translations
def get_score(sess... | StarcoderdataPython |
1726836 | class Regressor(object):
def __init__(self):
pass
def predict(X):
pass
def fit(X,Y):
pass
class TFRegressor(Regressor):
def __init__(self,x_plh,y_plh,output_op,train_op,session,copy_op=None):
self.x = x_plh
self.y = y_plh
self.output_op = output_op
... | StarcoderdataPython |
3308928 | <reponame>OdatNurd/HyperHelpAuthor
import sublime
import sublime_plugin
from ..linter_base import LinterBase
###----------------------------------------------------------------------------
class MissingHelpSourceLinter(LinterBase):
"""
Lint the help index to determine if the list of help files listed in th... | StarcoderdataPython |
1719274 | <reponame>exyi/ILSpy
# Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
#
# 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 r... | StarcoderdataPython |
3381953 | from django.apps import AppConfig
class ScrumboardConfig(AppConfig):
name = 'scrumboard' | StarcoderdataPython |
1651774 | import requests
import MySQLdb
import re
from bs4 import BeautifulSoup
from selenium.webdriver.support.select import Select
from selenium import webdriver
from time import sleep
import datetime
import os
class IfisScraping():
def __init__(self):
self.wadaiurl = "https://kabutan.jp/news/marketnews/?category... | StarcoderdataPython |
27054 | <gh_stars>1000+
# Copyright 2021 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 "licen... | StarcoderdataPython |
4813194 | <reponame>leerbennett/SMPAgentryEvent
#!/usr/bin/env python3
"""
Copyright (c) 2019 <NAME>
See the LICENSE file for license rights and limitations (MIT).
This script analyzes an Agentry event.log file.
The main goal is to determine the number of occurances of known error messages.
Key features implemented include:
* ... | StarcoderdataPython |
3246569 | import logging
from pathlib import Path
import os
import time
import pytest
import yaml
import re
from kubernetes import client, config
from kubernetes.client.rest import ApiException
from jinja2 import Template
log = logging.getLogger(__name__)
meta = yaml.safe_load(Path("metadata.yaml").read_text())
KUBECONFIG = o... | StarcoderdataPython |
1736224 | <filename>utils/file_util.py
import yaml
from simulator.card_defs import Card, Pip, Suit, PIP_CODE, SUIT_CODE
def load_deck_from_yaml(filename):
with open(filename, "r") as f:
t = yaml.safe_load(f)
# self.logger.debug(f"Loaded deck from file: {t}.")
deck = []
for c in t:
suit = next(key for key, val... | StarcoderdataPython |
32530 | # create this file
# rerouting all requests that have ‘api’ in the url to the <code>apps.core.urls
from django.conf.urls import url
from django.urls import path
from rest_framework import routers
from base.src import views
from base.src.views import InitViewSet
#from base.src.views import UploadFileForm
#upload stuf... | StarcoderdataPython |
185876 | <filename>terradactile/terradactile/app.py
import tempfile
from os.path import join, splitext, dirname
from os import listdir, mkdir, environ
import urllib.request
import io
import shutil
from math import log, tan, pi
from itertools import product
import sys
import boto3
import json
import uuid
import csv
from pyproj i... | StarcoderdataPython |
1692222 | # -*- coding: utf-8 -*-
"""
An Eye Tracker can get landmarks of the eyes from an image tensor.
"""
import cv2 as cv
import numpy as np
from config import ConfigOptionMetadata, ConfigOptionPackage
from tracking.eye_tracking import EyeTrackerInput
from tracking.eye_tracking.eye_tracking import EyeTracker
class Infrare... | StarcoderdataPython |
3360405 | <reponame>wgzhao/trino-admin
# -*- coding: utf-8 -*-
#
# 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 ag... | StarcoderdataPython |
3377537 | # NOTE: It is the historian's job to make sure that keywords are not repetitive (they are
# otherwise double-counted into counts).
from collections import defaultdict
from collections import OrderedDict
import os
import pandas as pd
import re
import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word... | StarcoderdataPython |
1666613 | <filename>setup.py<gh_stars>1-10
from setuptools import setup
setup(name='Linear_Congruential_Generator',
version='0.1.5',
description="""The random number generator.
""",
long_description="""
# Linear Congruential Generator |  
| StarcoderdataPython |
100774 | <filename>predictive/MLManager.py
import sys
import os
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from data.DataManager import DataManager
class MLManager:
@staticmethod
def logistic_regression(data):
... | StarcoderdataPython |
3284295 | from django.contrib import admin
from .models import User
@admin.register(User)
class UserAdmin(admin.ModelAdmin):
list_display = ('username', 'email', 'is_student', 'is_teacher')
fields = ['username', 'email', 'is_student', 'is_teacher']
| StarcoderdataPython |
4812612 | #!/usr/bin/env python
#
# MIT License
#
# Copyright (c) 2016 <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, co... | StarcoderdataPython |
1731473 | <gh_stars>10-100
""" Data objects in group "Zone Airflow"
"""
from collections import OrderedDict
import logging
from pyidf.helper import DataObject
logger = logging.getLogger("pyidf")
logger.addHandler(logging.NullHandler())
class ZoneInfiltrationDesignFlowRate(DataObject):
""" Corresponds to IDD object `Zon... | StarcoderdataPython |
161544 | <filename>code/visualize_zind_cli.py<gh_stars>10-100
# """CLI script to visualize & validate data for the public-facing Zillow Indoor Dataset (ZInD).
#
# Validation includes:
# (1) required JSON fields are presented
# (2) verify non self-intersection of room floor_plan_layouts
# (3) verify that windows/doors/opening... | StarcoderdataPython |
1629968 | <filename>csgogsi/constants.py
"""
Use these variable to easily compare the values of the payload
"""
NULL: int = -1
NOT_IMPLEMENTED_YET: Exception = NotImplemented
ROUND_WIN_T_BOMB: str = "t_win_bomb"
ROUND_WIN_T_ELIMINATIONS: str = "t_win_elimination"
ROUND_WIN_CT_DEFUSE: str = "ct_win_defuse"
ROUND_WIN_CT_ELIMINAT... | StarcoderdataPython |
42642 | <reponame>ictcubeMENA/Training_one
import main
import unittest
class testsheep(unittest.TestCase):
def testing(self):
array1 = [True, True, True, False,
True, True, True, True ,
True, False, True, False,
True, False, False, True ,
True, True... | StarcoderdataPython |
1761857 | import math
import numpy as np
import os
import datetime
import torch
import torch.optim as optim
import torch.nn.functional as F
# from tqdm import tqdm
from torchvision import transforms, datasets
from net import Net
from itertools import takewhile
import matplotlib.pyplot as plt
# MAX_SAVEPOINTS = 10
CLASSES = ('pl... | StarcoderdataPython |
3355393 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from econml._ortho_learner import _OrthoLearner, _crossfit
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression, LassoC... | StarcoderdataPython |
3387584 | #!/usr/bin/env/python
# -*- coding: utf-8 -*-
"""
This script defines some useful functions to use in data analysis and visualization
@ <NAME> (<EMAIL>)
"""
def dl_ia_utils_change_directory(path):
"""
path ='path/to/app/'
"""
import os
new_path = os.path.dirname(os.path.dirname(__file__))... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.