id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3350479 | from rest_framework.routers import DefaultRouter
from . import views
router = DefaultRouter()
router.register(r'sprints', views.SprintViewSet)
router.register(r'tasks', views.TaskViewSet)
router.register(r'users', views.UserViewSet)
| StarcoderdataPython |
1781536 | <reponame>GabrielMarquesss/Exercicios-Python
#Programa que le dois numeros e diz se:
#O primeiro valor é maior
#O segundo valor é maior
#Não existe valor maior já que os dois são iguais
n1 = int(input('Digite um número: '))
n2 = int(input('Digite outro número: '))
if n1 > n2:
print('O número {} é maior que {}!'.f... | StarcoderdataPython |
1669800 | <reponame>savannahghi/mycarehub-backend<gh_stars>1-10
from django import forms
from phonenumber_field.formfields import PhoneNumberField
from mycarehub.authority.forms import get_role_choices
from mycarehub.clients.forms import get_facility_choices, validate_date_past
from mycarehub.users.models import GenderChoices
... | StarcoderdataPython |
65986 |
def find_paths(out_dir, files_ID, time_instances, month_id):
import json
from collections import defaultdict
import networkx as nx
for instance in time_instances['id']:
with open(out_dir + 'data_traffic_assignment_uni-class/'+ files_ID + '_net_' + month_id + '_full_' + instance + '.txt') as M... | StarcoderdataPython |
3207770 | <reponame>TheRealDarkCoder/writeup_RedPwn2021<filename>pwn/SOLVED_printf-please/ape.py
from pwn import * #Pwn Tools
import time # Sometimes the connection would time out a lot, using time.sleep reduced the timeouts.
context.log_level = 'critical' # Pwn tools config to tell us everything
lines = [] # Empty array whi... | StarcoderdataPython |
38010 | # import speech_recognition as sr
# import sys
#
# # read filename from arguments
# filename = ("C:\\Users\\utkar\\Downloads\\crowd.mp3")
#
# # initialize the recognizer
# r = sr.Recognizer()
#
# # open the file
# with sr.AudioFile(filename) as source:
# # listen for the data (load audio to memory)
# audio_data... | StarcoderdataPython |
1610222 | <gh_stars>0
def test():
assert Span.has_extension(
"wikipedia_url"
), "As-tu déclaré l'extension du span?"
ext = Span.get_extension("wikipedia_url")
assert ext[2] is not None, "As-tu défini correctement le getter ?"
assert (
"getter=get_wikipedia_url" in __solution__
), "As-tu as... | StarcoderdataPython |
1627303 | <filename>modules/sshRcmd_client.py<gh_stars>1-10
<KEY>
| StarcoderdataPython |
3381231 | <filename>kolibri/core/public/utils.py<gh_stars>0
import datetime
import hashlib
import logging
import platform
import random
import requests
from django.core.management import call_command
from django.core.urlresolvers import reverse
from django.utils import timezone
from morango.models import InstanceIDModel
from re... | StarcoderdataPython |
1710871 | <gh_stars>0
from PIL import Image
import re
import glob
files = glob.glob("./img/*.png")
files = [re.sub(r'\\', '/', file) for file in files]
for file in files:
input_im = Image.open(file)
rgb_im = input_im.convert('RGB')
rgb_im.save(re.sub('.png', '', file) + ".jpg",quality=90)
| StarcoderdataPython |
3229668 | import os
import numpy as np
from utils.UCF_utils import two_stream3_generator, two_stream18_generator
from models.two_stream import two_stream_model
from utils.OF_utils import stack_optical_flow
import cv2
import random
from scipy.misc import imresize
from keras.applications.imagenet_utils import preprocess_input
N_C... | StarcoderdataPython |
1708214 | <reponame>polytechnique-ease/blockcompass
from abc import ABC, abstractmethod
class Database(ABC):
def __init__(self, connection_string):
self.connection_string = connection_string
@abstractmethod
def get_database(self):
pass
@abstractmethod
def inset_to_database(self,item):
... | StarcoderdataPython |
1641651 | <filename>lib/preprocess.py
import collections
import math
import random
import numpy as np
from PIL import Image, ImageFilter
from scipy.ndimage.interpolation import map_coordinates
from scipy.ndimage.filters import gaussian_filter
try:
import accimage
except ImportError:
accimage = None
def _is_pil_image(... | StarcoderdataPython |
1757687 | <reponame>thejungwon/boostcamp_project_mask
import random
#이 부분에 모델을 적용시켜주세요!
def infernece(img):
print(img)
print(type(img))
ans = [random.randint(0,17)]
return ans
| StarcoderdataPython |
89241 | <gh_stars>0
import torchvision.transforms as transforms
import tensorflow as tf
import numpy as np
import cv2 as cv
import torch
from Detection.yolov5.utils.general import non_max_suppression
def run():
return
def to_numpy(tensor):
return tensor.detach().cpu().numpy() if tensor.requires_grad else tensor.cp... | StarcoderdataPython |
1777525 | """
A set of functions needed for DataCarousel app
"""
import random
import logging
import json
import time
import datetime
import numpy as np
import pandas as pd
from sklearn.preprocessing import scale
import urllib.request as urllibr
from urllib.error import HTTPError
import cx_Oracle
from django.core.cache imp... | StarcoderdataPython |
33897 | <reponame>sirosen/globus-sdk-python
import json
from collections import namedtuple
from unittest import mock
import pytest
import requests
from globus_sdk.response import GlobusHTTPResponse, IterableResponse
_TestResponse = namedtuple("_TestResponse", ("data", "r"))
def _response(data=None, encoding="utf-8", heade... | StarcoderdataPython |
3205527 | # kivy and python with pdf
# command to make atlas
#python -m kivy.atlas data/images/images 600 data/images/*
import kivy
from kivy import platform
from kivy.uix.button import Button
from kivy.uix.screenmanager import Screen, ScreenManager
from kivy.uix.behaviors import DragBehavior
from kivy.uix.gridlayout import Gri... | StarcoderdataPython |
3313102 | # im_pos
# im_rgb
import numpy as np
from skimage.measure import label, regionprops
from skimage.morphology import binary_opening, binary_erosion
import skimage.morphology as mo
from skimage.draw import polygon
from sklearn.utils import check_array
from sklearn.cluster import KMeans
from sklearn.svm import LinearSVC... | StarcoderdataPython |
4818762 | <filename>migrations/versions/e72e5d4d71f2_.py
"""Add Approved Column for CM and TS
Revision ID: e72e5d4d71f2
Revises: 65943c537c84
Create Date: 2017-01-21 16:28:25.498369
"""
# revision identifiers, used by Alembic.
revision = 'e72e5d4d71f2'
down_revision = '65943c537c84'
from alembic import op
import sqlalchemy a... | StarcoderdataPython |
66648 | <reponame>Robert-Ma/Python_Exercises
"""
Exercise 08: Write a Python program to sort a list of elements
using quick sort algorithm.
"""
def quickSort(alist):
"""
Quick sort algrithm, In-place version.
"""
def partition(alist, left, right):
pivot = alist[right - 1]
i = left - 1
... | StarcoderdataPython |
3268892 | import logging
import json
from django.core.files.base import ContentFile
from django.shortcuts import render, redirect
from django.utils import timezone
from django.conf import settings
from requests import request, HTTPError
from social.pipeline.partial import partial
from users.contrib.user_handler import usernameEx... | StarcoderdataPython |
1667462 | <reponame>GabeCordo/python_node_tor
###############################
# quickscmp imports
###############################
from quickscms.sockets.node import Node
from quickscms.bitstream import advanced
from quickscms.utils import errors, enums, containers
###############################
# main code
#############... | StarcoderdataPython |
3310982 | <reponame>panyuan5056/tm<gh_stars>0
default_app_config = 'desen.apps.DesenConfig'
| StarcoderdataPython |
194189 | import copy
import logging, os
import gettext as _gettext
from gettext import NullTranslations, GNUTranslations
import warnings
import tg
from tg.util import lazify
from tg._compat import PY3, string_type
log = logging.getLogger(__name__)
class LanguageError(Exception):
"""Exception raised when a problem occurs ... | StarcoderdataPython |
3210950 | <gh_stars>1-10
from numba import jit
import numpy as np
import math
import time
@jit('f4[:,:](i2,f4[:,:])')
def ra_numba(doy, lat):
M, N = lat.shape
ra = np.zeros_like(lat)
Gsc = 0.0820
# math.pi doesnt work?
# NumbaError: 11:31: Binary operations mul on values typed object_ and obje... | StarcoderdataPython |
1717070 | """ Tests hash-checking functions.
Run with:
nosetests test_data.py
"""
from __future__ import absolute_import, division, print_function
import tempfile
import sys
import os
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
sys.path.append(os.path.join(os.path.di... | StarcoderdataPython |
173079 | <filename>NeuralNetwork/nn.py
import numpy as np
import scipy.special
class NeuralNetwork:
# Initialize neural network
def __init__(self, inputnodes, hiddennodes, hiddenlayers, outputnodes, lr):
self.inodes = inputnodes
self.hlayers = [hiddennodes]*hiddenlayers
# 1 hidden layer hard codded, given that the mul... | StarcoderdataPython |
171696 | # # arr1 = [100,100,200,300,300,400,400]
# # arr2 = [14,90,100,100,200,200,450,450,0,0,0,0,0,0,0]
# # arr1 = [1,3,5]
# # arr2 = [2,4,6,0,0,0]
# arr1 = [1,1,1,1,1,1]
# arr2 = [12,1,1,1,1,1,2,0,0,0,0,0,0]
# # arr1_ptr, arr2_ptr = 0,0
# # while arr2_ptr <= len(arr1) - 1:
# # if arr2[arr2_ptr] <= arr1[arr1_ptr]:
# # ... | StarcoderdataPython |
3399937 | """Test GP sampling and uncertainty propagation."""
import pytest
from numpy.testing import assert_allclose
try:
import torch
import gpytorch
_has_ssm_pytorch = True
import safe_exploration.ssm_pytorch as mps
from safe_exploration.ssm_pytorch import sample_trajectories_independent
except:
_h... | StarcoderdataPython |
1757789 | # Generated by Django 3.2.8 on 2021-10-08 06:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('orders', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='order',
name='total_price',
... | StarcoderdataPython |
1705153 | <reponame>MishaFrenkman/GithubCrawler<filename>crawler.py
#!/usr/bin/python
import json
import requests
import time
import database
'''
Github unsecured API crawler
@author <NAME>
@version 0.1
'''
githubURL = "https://api.github.com/repositories?since="
def checkReset():
url = "https://api.github.com/rate_limit"... | StarcoderdataPython |
3347973 | #
# Copyright (C) 2020 IBM. All Rights Reserved.
#
# See LICENSE.txt file in the root directory
# of this source tree for licensing information.
#
import random
from math import cos, isnan, pi, sin, sqrt
from typing import Dict, List, Optional, Tuple
import numpy as np
import portion
import torch
from PIL import Imag... | StarcoderdataPython |
147363 | # -*- coding: utf-8 -*-
import re
from ..base.downloader import BaseDownloader
class YesPornPleaseCom(BaseDownloader):
__name__ = "YesPornPleaseCom"
__type__ = "downloader"
__version__ = "0.02"
__status__ = "testing"
__pyload_version__ = "0.5"
__pattern__ = r"https?://(?:www\.)?yespornpleas... | StarcoderdataPython |
147405 | <reponame>Helarga/geojson-modelica-translator<gh_stars>0
"""
****************************************************************************************************
:copyright (c) 2019-2021 URBANopt, Alliance for Sustainable Energy, LLC, and other contributors.
All rights reserved.
Redistribution and use in source and b... | StarcoderdataPython |
3284627 | <reponame>ashwinn-v/ai-research-mamo-framework<filename>tests/unit/test_mamo_dataset.py
"""Copyright © 2020-present, Swisscom (Schweiz) AG.
All rights reserved.
This test doesn't need any custom library or any data loading.
To run them just execute 'pytest'.
"""
from dataloader.mamo_dataset import MamoDataset
import p... | StarcoderdataPython |
1707738 | from World.Object.model import Object
from World.Object.Constants.UpdateObjectFields import ObjectField
from World.WorldPacket.UpdatePacket.Constants.ObjectUpdateType import ObjectUpdateType
from World.WorldPacket.UpdatePacket.Builders.UpdatePacketBuilder import UpdatePacketBuilder
from DB.Connection.RealmConnection im... | StarcoderdataPython |
71334 | # ------------------------------------------------------------------------------
# Program: The LDAR Simulator (LDAR-Sim)
# File: methods.deployment.GHGSat1
# Purpose: GHGSat1 company specific deployment classes and methods
#
# Copyright (C) 2018-2021 Intelligent Methane Monitoring and Management System... | StarcoderdataPython |
3264664 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# @Author : chq_N
# @Time : 2020/8/26
import numpy as np
import torch.utils.data as tordata
class SoftmaxSampler(tordata.sampler.Sampler):
def __init__(self, dataset, batch_size):
self.dataset = dataset
self.batch_size = batch_size
w = (np.asarra... | StarcoderdataPython |
4819513 | class Pres:
def __init__(self, _):
def qotp(block, key):
"""
Quantum One Time Pad Encryption/Decryption
Qubit Iterable -> Integer Iterable -> Qubit Iterable
Applies Quantum One Time Pad to an iterable of qubits and a iterable of ints in 0..3 (0=I, 1=X, 2=Z,... | StarcoderdataPython |
3201938 | WEIGHTS_FILE_NAME = "dev"
WEIGHTS_DIR_NAME = "weights"
NUM_RESULTS_TO_SHOW = 100
| StarcoderdataPython |
1737217 | #
# Copyright (C) 2020 Arm Mbed. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
"""Command to launch a serial terminal to a connected Mbed device."""
from typing import Any, Optional
import click
from mbed_tools.devices import get_connected_devices, find_connected_device
from mbed_tools.devices.exceptio... | StarcoderdataPython |
3352137 | <reponame>SobrinhoSergio/minha-faculdade<gh_stars>0
#NúmeroPar
numero=int(input('Digite um número: '))
if numero%2==0:
print(True)
else:
print(Fals) | StarcoderdataPython |
1683650 | # pylint: disable=protected-access,redefined-outer-name
"""Test to verify that Beward library works."""
from datetime import datetime
from unittest import TestCase
import requests_mock
from requests import ConnectTimeout
from beward import BewardCamera
from beward.const import ALARM_MOTION
from . import function_ur... | StarcoderdataPython |
3306165 | """
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... | StarcoderdataPython |
1615686 | import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_is_terraform_user_created(host):
user = host.user("terraform")
assert user.name == "terraform"
assert "terraform" in user.g... | StarcoderdataPython |
178939 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
#define X 0
#define Y 1
#define Z 2
__device__ __forceinline__ void add3d(float *a, float *b, float* ret)
{
ret[X] = a[X] + b[X];
ret[Y] = a[Y] + b[Y];
ret[Z] = a[Z] + b[Z];
}
"""
import numpy as np
import pycuda.driver as drv
import pycuda.autoinit
from pycuda... | StarcoderdataPython |
1714909 | <filename>Sets_in_Python.py
# File: Sets_in_Python.py
# Description: Creating and using Sets in Python
# Environment: PyCharm and Anaconda environment
#
# MIT License
# Copyright (c) 2018 <NAME>
# github.com/sichkar-valentyn
#
# Reference to:
# [1] <NAME>. Creating and using Sets in Python // GitHub platform [... | StarcoderdataPython |
3393396 | <filename>Machine_Learning/Multiple_Linear_Regression.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 9 18:19:26 2017
@author: gaulbg
"""
#Import Libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
#Import Dataset
dataset = pd.read_csv("50_Startups.csv")
x = dat... | StarcoderdataPython |
116737 | import json
import os
from django.conf import settings
from django.core.management import call_command
from django.db.models import base
from django.test import TestCase
from wagtail_wordpress_importer.management.commands import (
import_atlas_case_studies, import_blogs, import_categories,
import_documents, im... | StarcoderdataPython |
1676589 | <reponame>muhammadyaseen/pydoop
#!/usr/bin/env python
# BEGIN_COPYRIGHT
#
# Copyright 2009-2018 CRS4.
#
# 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/LIC... | StarcoderdataPython |
4803511 |
#coding:utf8
##added by heen
from .. import *
from VulnerabilityVector import VulnerabilityVector
class OpenPortCheck(VulnerabilityVector):
def __init__(self,context):
self.context = context
def analyze(self):
#Openport checking:
"""
find open ... | StarcoderdataPython |
3353850 | # coding: utf-8
from __future__ import absolute_import, division, print_function
import numpy as np
from scitbx.array_family import flex
def plot_coords(coords, labels=None, key="cosym_coordinates"):
coord_x = coords[:, 0:1].as_1d()
coord_y = coords[:, 1:2].as_1d()
assert coord_x.size() == coord_y.size(... | StarcoderdataPython |
1717090 | <filename>soloq_reports.py<gh_stars>1-10
# coding: utf-8
from config.constants import MONGODB_CONN, API_KEY, LEAGUES_DATA_DICT, EXCEL_EXPORT_PATH, SOLOQ, WORK_DIR
from pymongo import MongoClient
import pandas as pd
from riotwatcher import RiotWatcher
from classes.entities import Player
from classes.enums import Account... | StarcoderdataPython |
166428 | <reponame>brianbruggeman/ves<filename>scripts/tests/test_pypi_upload.py
from dataclasses import asdict, dataclass, field
from pathlib import Path
from typing import Dict
import pytest
@dataclass
class Counts:
"""Stores call counts of various api methods and contains methods
to help capture and validate call ... | StarcoderdataPython |
1240 | <gh_stars>0
import io
import unittest
import numpy as np
class TestGraphicalLasso(unittest.TestCase):
"""Basic test cases."""
def _getTarget(self):
from pyanom.structure_learning import GraphicalLasso
return GraphicalLasso
def _makeOne(self, *args, **kwargs):
return self._getTar... | StarcoderdataPython |
124483 | from .dragonnet import DragonNet
| StarcoderdataPython |
1683518 | <gh_stars>0
#!/usr/bin/env python
import rospy
from success_ros_msgs.msg import (
pollySpeechAction,
pollySpeechGoal,
pollySpeechResult
)
import boto3
from botocore.exceptions import BotoCoreError, ClientError
import actionlib
from contextlib import closing
import struct
import rospkg
import os
from maste... | StarcoderdataPython |
1775329 | <reponame>TolyaTalamanov/open_model_zoo
"""
Copyright (c) 2018-2022 Intel Corporation
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 requir... | StarcoderdataPython |
3225889 | <reponame>reshift/armstrong.esi
def esi(request):
if getattr(request, '_esi', None) is None:
request._esi = {'used': False}
return {'_esi': request._esi}
| StarcoderdataPython |
188404 | <reponame>alecmeade/nlp_final_project<filename>speech2image/util.py
import math
import random
import re
import numpy as np
import torch
from torch import nn, autograd, optim
from torch.nn import functional as F
from torch.utils import data
import torch.distributed as dist
from torchvision import transforms, utils
from ... | StarcoderdataPython |
3248135 | <filename>tests.py<gh_stars>0
<<<<<<< HEAD
from django.test import TestCase
# Create your tests here.
=======
class Test:
@staticmethod
def static_call(word):
print 'calling static method: {}'.format(word)
if __name__ == '__main__':
t = Test()
t.static_call('hello')
>>>>>>> a1c36b07fbdd3d2c91... | StarcoderdataPython |
3329642 | <gh_stars>10-100
# https://leetcode.com/problems/total-hamming-distance/
#
# algorithms
# Medium (48.59%)
# Total Accepted: 43,815
# Total Submissions: 90,167
# beats 65.29% of python submissions
class Solution(object):
def totalHammingDistance(self, nums):
"""
:type nums: List[int]
:rt... | StarcoderdataPython |
1786333 |
from flask import Flask, render_template,request
import numpy as np
import keras.models
import re,sys,os
from scipy.misc import imread, imresize
from keras.models import model_from_json
import tensorflow as tf
from PIL import Image
import io
from keras.preprocessing import image
APP_ROOT = os.path.dirname(os.pa... | StarcoderdataPython |
3375886 | from time import sleep
import numpy as np
from kaudio.app.nodes.base_nodes import StereoNode
from kaudio.app.utils.sounddevice_handler import device_map, open_stream
from kaudio.nodes.base import BaseNode as KBaseNode
from kaudio.nodes.util import (
InputNode as InputNodeImpl,
OutputNode as OutputNodeImpl
)
... | StarcoderdataPython |
133295 | import libyang
from jinja2 import Template
import unittest
import yangvoodoo
import yangvoodoo.stublydal
"""
This set of unit tests uses the stub backend datastore, which is not preseeded with
any data.
"""
class test_new(unittest.TestCase):
def setUp(self):
self.maxDiff = None
self.stub = yangv... | StarcoderdataPython |
3380802 | <reponame>akretion/esociallib<filename>esociallib/v2_04/evtAfastTemp.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated Tue Oct 10 00:42:20 2017 by generateDS.py version 2.28b.
# Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]
#
# Command line options:
# ('--no-process-includes', '')... | StarcoderdataPython |
3326495 | <gh_stars>10-100
import chainer
import numpy as np
from chainer_chemistry.dataset.preprocessors import GGNNPreprocessor
from rdkit import Chem
from data import transform_qm9
from data.transform_zinc250k import one_hot_zinc250k, transform_fn_zinc250k
from graph_nvp.models.model import GraphNvpModel
def load_model(sna... | StarcoderdataPython |
1703370 | from insights.parsr.examples.multipath_conf import loads
EXAMPLE = """
# This is a basic configuration file with some examples, for device mapper
# multipath.
#
# For a complete list of the default configuration values, run either
# multipath -t
# or
# multipathd show config
#
# For a list of configuration options wi... | StarcoderdataPython |
4800218 | # -*- coding: utf-8 -*-
def main():
a, b, c = map(int, input().split())
if a % 2 == 0 or b % 2 == 0 or c % 2 == 0:
print(0)
else:
print(min(a * b, b * c, c * a))
if __name__ == '__main__':
main()
| StarcoderdataPython |
102621 | #!/usr/bin/env python
#
# Copyright (c) 2013 In-Q-Tel, Inc/Lab41, 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... | StarcoderdataPython |
3243717 | from .base import BaseFormat
from .bbox import BBoxLike
from .seq import SeqLike
| StarcoderdataPython |
3209559 | <filename>project euler/q16.py<gh_stars>0
s=0
d=1
while s<1000:
s=s+1
d=d*2
s=str(d)
h=0
for ch in s:
f=int(ch)
h=h+f
print h | StarcoderdataPython |
1798732 | import torch
from torch import nn
from clinicadl.utils.network.vae.base_vae import BaseVAE
from clinicadl.utils.network.vae.vae_utils import (
DecoderLayer3D,
EncoderLayer3D,
Flatten,
Unflatten3D,
VAE_Decoder,
VAE_Encoder,
)
class VanillaDenseVAE(BaseVAE):
def __init__(
self,
... | StarcoderdataPython |
159047 | """
Yelp Scraper Part 1
This module utilizes the Yelp Fusion API to find businesses
within a geographic area centered on a city.
"""
from yelpapi import YelpAPI
from decouple import config
import os
import numpy as np
import pandas as pd
from app_global import g
#########################
### Environment Set... | StarcoderdataPython |
3393935 | # Hack 1: InfoDB lists. Build your own/personalized InfoDb with a list length > 3, create list within a list as illustrated with Owns_Cars
InfoDb = []
# List with dictionary records placed in a list
InfoDb.append({
"FirstName": "Ben",
"LastName": "Holland",
"Residence": "San Diego",
"Owns_Shoes":["... | StarcoderdataPython |
182553 | def test_init():
from wals3.scripts import initializedb
assert initializedb
| StarcoderdataPython |
3209572 | <gh_stars>0
def main():
cases=[
[vec(0,0),vec(2,2),vec(1,0),vec(0,1), True],
[vec(0,0),vec(2,2),vec(1,1),vec(3,3), True], # colinear and intersecting
[vec(0,0),vec(2,2),vec(1,2),vec(3,4), False], # parallel and offset
[vec(0,0),vec(0,1),vec(0,3),vec(0,.5), True], # colinear and inter... | StarcoderdataPython |
1682516 | <filename>test/loopvectorize.py<gh_stars>100-1000
from llvm.core import *
from llvm.passes import *
from llvm.ee import *
import llvm
from llvm.tests.support import TestCase
from os.path import dirname, join as join_path
import unittest
import re
class TestLoopVectorizer(TestCase):
def test_loop_vectorizer(self)... | StarcoderdataPython |
1608530 | import sys
import os
import json
from os import path, mkdir, listdir, rename, environ, rmdir
class OrganiseDesktop():
"""
Contains desktop organisation helper functions
"""
extensions = {}
separator = '/'
desktopdir = ''
Alldesktopdir = None
def __init__(self, extensions):
... | StarcoderdataPython |
97835 | import json
import os
import random
import numpy as np
from math import ceil
import bottle
from bottle import HTTPResponse
# import time
from timeit import default_timer as timer
from grid_data_maker import *
from util_fns import *
# my_moves
delta = [[-1, 0], # go up
[0, -1], # go left
[1, 0], #... | StarcoderdataPython |
3205564 | from seatsio.domain import EventObjectInfo, Channel, SocialDistancingRuleset
from tests.seatsioClientTest import SeatsioClientTest
from tests.util.asserts import assert_that
class BookObjectsTest(SeatsioClientTest):
def test(self):
chart_key = self.create_test_chart()
event = self.client.events.c... | StarcoderdataPython |
149668 | #!/usr/bin/env python3
# coding: utf-8
#libraries
import keras
import tensorflow as tf
from keras import backend as K
import cv2
import os
import numpy as np
from keras.optimizers import Adam
from keras.models import model_from_json, load_model
from keras.layers import Input, Dense
from keras.models import Model,Seque... | StarcoderdataPython |
1738607 | """
Base Class to Support Method Decorators
AUTHOR:
- <NAME> (2009-05): inspired by a conversation with and code by <NAME>
"""
from sage.structure.sage_object import SageObject
class MethodDecorator(SageObject):
def __init__(self, f):
"""
EXAMPLE::
sage: from sage.misc.method_decorat... | StarcoderdataPython |
4809736 | '''input
15
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
9
5 4 3 2 1 2 3 4 5
YES
5
3 1 4 1 5
3
5 4 3
YES
7
100 200 500 700 1200 1600 2000
6
100 200 500 700 1600 1600
NO
1
800
5
100 100 100 100 100
NO
'''
# -*- coding: utf-8 -*-
# CODE FESTIVAL 2017 A
# Problem B
if __name__ == '__main__':
from collections import Counter
... | StarcoderdataPython |
163220 | <reponame>wonsokoh1019/faqbot16
#!/bin/env python
# -*- coding: utf-8 -*-
"""
get a account external key.
"""
__all__ = ['get_account_info']
import tornado.gen
from faq_bot.common.utils import auth_post
from faq_bot.constant import API_BO, OPEN_API
import logging
import json
@tornado.gen.coroutine
def get_account_... | StarcoderdataPython |
1643943 | <filename>lisp_interpreter/list.py
from atom import parse_atom
from constants import whitespaces
def is_list(text):
itter = 0
left_brackets_number = 0
right_brackets_number = 0
for char in text:
if char == '(':
left_brackets_number += 1
elif char == ')':
right_br... | StarcoderdataPython |
47799 | # List of the training runs for the different target dataset sizes
TRAINING_RUNS = [
'large_dataset/20200616_090434',
'medium_dataset/20200616_214425',
'small_dataset/20200617_143139'
]
| StarcoderdataPython |
3218186 | <reponame>Gh0stlyy/GearBot
import asyncio
import datetime
import time
import traceback
from concurrent.futures import CancelledError
import discord
from discord.ext import commands
from discord.ext.commands import BadArgument
from Util import Permissioncheckers, Configuration, Utils, GearbotLogging, Pages, Infraction... | StarcoderdataPython |
3223490 | ###########################
#
# #161 Triominoes - Project Euler
# https://projecteuler.net/problem=161
#
# Code by <NAME>
#
###########################
| StarcoderdataPython |
42681 | <gh_stars>0
import http.client
import json
from urllib.parse import urlencode
class ApiMixin(object):
API_STATUS = {
'success': 200,
'moved_permanently': 301,
'bad_request': 400,
'unauthorized': 401,
'forbidden': 403,
'not_found': 404
}
def _server_request(... | StarcoderdataPython |
3325379 | <gh_stars>0
# init file of the top accounts project
| StarcoderdataPython |
138137 | from setuptools import setup, find_packages
import torch
from torch.utils.cpp_extension import CppExtension, CUDAExtension, CUDA_HOME
ext_modules = [
CppExtension('sym3eig_cpu', ['cpu/sym3eig.cpp']),
]
cmdclass = {'build_ext': torch.utils.cpp_extension.BuildExtension}
if CUDA_HOME is not None:
ext_modules += ... | StarcoderdataPython |
133909 | <reponame>wendy2003888/kagglepipe
from absl import app
from absl import flags
from typing import Text
import os
import tensorflow as tf
import tensorflow_model_analysis as tfma
from tfx.components import CsvExampleGen, StatisticsGen, SchemaGen, Trainer, Transform, Evaluator, Pusher, ResolverNode, BulkInferrer
from tfx... | StarcoderdataPython |
194233 | <reponame>thomaserlang/tbot
from tbot.twitch_bot.var_filler import fills_vars
from tbot import utils
@fills_vars('user.stream_watchtime', 'user.stream_watchtime_percent')
async def stream_watchtime(bot, channel_id, user_id, args, **kwargs):
if len(args) > 0:
user_id = await utils.twitch_lookup_user_id(bot.... | StarcoderdataPython |
3355001 | #!/usr/bin/env python3
# -*- coding=utf-8 -*-
import cv2 as cv
"""
二值阈值寻找算法 - OTSU
OTSU算法适合对直方图具有两个峰的图像,对于只有一个峰的图像,该算法的阈值获取并不是十分理想。
在cv.threshold中使用将type指定为 THRESH_OTSU即可
"""
def main():
src = cv.imread("../../pic/money.jpg")
cv.imshow("src", src)
gray = cv.cvtColor(sr... | StarcoderdataPython |
3277790 | <gh_stars>0
# -*- coding: utf-8 -*-
from knitter import datadriver, log
from demoprj.page import KnitterDemo
def TestCase001_NormalInputTest():
#### Name ###
KnitterDemo.Name.Title.Select("Mr.")
KnitterDemo.Name.Name.Set("Henry.Wang")
### Gender ###
KnitterDemo.Gender.Male.Click()
... | StarcoderdataPython |
1604418 | import gym
from softmax import PolicyGradient
import matplotlib.pyplot as plt
import retro
import numpy as np
import cv2
class SonicDiscretizer(gym.ActionWrapper):
"""
Wrap a gym-retro environment and make it use discrete
actions for the Sonic game.
"""
# B is do nothing
# down
# def __i... | StarcoderdataPython |
3336517 | import time
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from particle_swarm import *
NUM_RUNS = 20
SWARM_SIZE = 100
MAX_GEN = 50
if __name__ == "__main__":
features, labels = load_dataset('data_banknote_authentication.txt')
train_x, test_x, train_y, test_y = train_te... | StarcoderdataPython |
1635087 | <filename>build/lib/example_pkg/__init__.py<gh_stars>1-10
name="example_pkg"
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.