id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
12809458 | # -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from datetime import date
from datetime import timedelta
import pandas as pd
import os
import matplotlib.pyplot as plt
import numpy as np
path = os.path.abspath('.')
path += '\\data\\new_stock\\hk_new_stock.csv'
hk_new_stock = pd.read_csv(path,index_col=0,encoding='gbk')... | StarcoderdataPython |
15184 | <filename>projects/ide/sublime/src/Bolt/api/inspect/highlighting.py
import sublime
from ui.read import settings as read_settings
from ui.write import write, highlight as write_highlight
from lookup import file_type as lookup_file_type
from ui.read import x as ui_read
from ui.read import spots as read_spots
from ui.read... | StarcoderdataPython |
12820834 | <gh_stars>0
from flask import render_template
from . import main
@main.app_errorhandler(404)
def fo_o_fo(error):
return render_template('fo_o_fo.html'),404 | StarcoderdataPython |
9697983 | from pact_testgen.generator import generate_tests
from pact_testgen.dialects.django import Dialect
def test_django_test_generator_output_is_parsable(testfile):
test_file, _ = generate_tests(testfile, Dialect())
compile(test_file, "<string>", "exec")
def test_output_includes_expected_test_cases(testfile):
... | StarcoderdataPython |
8148397 | from data.indicator.GT2.preprocess import config | StarcoderdataPython |
4929852 | <filename>PythonAPI/carissma_project/lib/python3.5/site-packages/pandas/tests/tslibs/test_normalize_date.py<gh_stars>1000+
# -*- coding: utf-8 -*-
"""Tests for functions from pandas._libs.tslibs"""
from datetime import date, datetime
import pytest
from pandas._libs import tslibs
@pytest.mark.parametrize("value,exp... | StarcoderdataPython |
192059 | <reponame>fkmclane/MCP
import logging
import multiprocessing
import os
import os.path
import select
import subprocess
import sys
import time
import traceback
import mcp.config
import mcp.error
import mcp.common.env
import mcp.common.daemon
import mcp.model.server
log = logging.getLogger('mcp')
class Script(object)... | StarcoderdataPython |
4990675 | ## You Can't Code Under Pressure #1
## 8 kyu
## https://www.codewars.com//kata/53ee5429ba190077850011d4
def double_integer(i):
return i * 2 | StarcoderdataPython |
5005977 | <filename>generator.py
import numpy as np
import trimesh
import random
import pyglet
import h5py
def save_h5(h5_filename, data, label, data_dtype='uint8', label_dtype='uint8'):
h5_fout = h5py.File(h5_filename)
h5_fout.create_dataset(
'data', data=data,
compression='gzip', compression_op... | StarcoderdataPython |
5160584 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import glob
import torch
import itertools
import numpy as np
from fairseq import metrics, options, utils
from fairse... | StarcoderdataPython |
11366442 | # -*- 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 agreed to in writing, software
... | StarcoderdataPython |
1729634 | from GridProperties import GridProperties
class DTGridProperties(GridProperties):
def __init__(self):
super().__init__()
def init_grid(self):
self.grid_dict = {
'max_depth': [2, 4, 6, 8]
} | StarcoderdataPython |
49472 | <filename>lifegame.py<gh_stars>0
# from machine import I2C,Pin
# from ssd1306 import SSD1306_I2C#I2C的oled选该方法
# i2c=I2C(0,sda=Pin(0), scl=Pin(1), freq=400000)
# oled = SSD1306_I2C(128, 64, i2c) #你的OLED分辨率,使用I2C
# import ujson as json
# oled.fill(1) #清空屏幕
# oled.show()
# oled.fill(0)
# oled.show()
import jso... | StarcoderdataPython |
557 | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
import frappe
from frappe.utils import set_request
from frappe.website.serve import get_response
test_dependencies = ["Blog Post"]
class TestWebsiteRouteMeta(unittest.TestCase):
def test_m... | StarcoderdataPython |
3363756 | <filename>app/productdb/validators.py
import json
from django.core.exceptions import ValidationError
import app.productdb.models
def validate_json(value):
"""a simple JSON validator
:param value:
:return:
"""
try:
json.loads(value)
except:
raise ValidationError("Invalid format... | StarcoderdataPython |
9604453 | '''Train CaPE with PyTorch.'''
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
import numpy as np
import torchvision
import torchvision.transforms as transforms
import os
import argparse
import pickle
from sklearn.metrics import log_l... | StarcoderdataPython |
9719744 | # Generated by Django 3.1.4 on 2021-02-24 19:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('rthl_site', '0046_auto_20210224_2100'),
]
operations = [
migrations.AlterField(
model_name='mat... | StarcoderdataPython |
327320 | import os
from tempfile import SpooledTemporaryFile
from storages.backends.s3boto3 import S3Boto3Storage
class CustomS3Boto3Storage(S3Boto3Storage):
"""
This is our custom version of S3Boto3Storage that fixes a bug in
boto3 where the passed in file is closed upon upload.
https://github.com/boto/b... | StarcoderdataPython |
6703114 | <reponame>andela/ah-backend-dojo<gh_stars>1-10
from django.contrib import admin
from .models import Article, FavoriteArticle, ReadingStats
# Register your models here.
admin.site.register(Article)
admin.site.register(FavoriteArticle)
admin.site.register(ReadingStats)
| StarcoderdataPython |
1843100 | <reponame>4mYHime/tls-sig-api-python
import base64
import zlib
import json
import time
# python ecdsa 开发库请到 https://github.com/warner/python-ecdsa
# 或者 tls 技术支持分享的链接 http://share.weiyun.com/24b674bced4f84ecbbe6a7945738b9f4
# 下载,下载完毕之后进入其根目录,运行下面的命令进行安装,
# python setup.py install
# 下面是转换私钥格式命令
# openssl ec -outform PE... | StarcoderdataPython |
11228165 | <reponame>Tahmid04/ExplainaBoard
import sys
import argparse
import numpy
import sys
# sys.path.append("./src")
# from src.utils import *
# from src.errorAnalysis import *
from ..src.errorAnalysis import *
def get_chunk_type(tok):
"""
Args:
tok: id of token, ex 4
idx_to_tag: dictionary {4: "B-PER", ...}
Returns... | StarcoderdataPython |
6619048 | <filename>mindhome_alpha/erpnext/erpnext_integrations/doctype/mpesa_settings/mpesa_settings.py
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from json import loads, dumps
import frappe
from ... | StarcoderdataPython |
12801525 | <gh_stars>1-10
from bot_manager import TelegramBot
bot_mgr = TelegramBot()
if bot_mgr.is_initialized:
bot_mgr.run()
| StarcoderdataPython |
8060086 | <gh_stars>1-10
from .S2Location import S2Location
from .terms import SBOL2
class S2Range(S2Location):
def __init__(self, g, uri):
super(S2Range, self).__init__(g, uri)
@property
def start(self):
return self.get_integer_property(SBOL2.start)
@property
def end(self):
retur... | StarcoderdataPython |
11324892 | <reponame>biologioholic/sktime<filename>sktime/transformations/panel/signature_based/tests/test_method.py
# -*- coding: utf-8 -*-
"""Tests for signature method."""
import numpy as np
import pytest
from sktime.transformations.panel.signature_based import SignatureTransformer
def test_generalised_signature_method():
... | StarcoderdataPython |
9647070 | import logging
import os
from abc import ABCMeta
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn.preprocessing import LabelEncoder
from sklearn.utils import check_random_state
from pycsca.utils import print_dictionary
from .constants import LABEL_COL, MISSING_... | StarcoderdataPython |
3441859 | <reponame>RandomKiddo/ProjectEuler
data = open('daysixdata.txt').read().split('\n\n')
total = 0
for sheet in data:
answers = sheet.split('\n')
people = []
for answer in answers:
person = []
for _ in answer:
person.append(_)
people.append(person)
similarity = people[0]... | StarcoderdataPython |
5031346 | <gh_stars>10-100
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from yandex.cloud.access import access_pb2 as yandex_dot_cloud_dot_access_dot_access__pb2
from yandex.cloud.operation import operation_pb2 as ya... | StarcoderdataPython |
6431809 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright © 2017 <NAME> <<EMAIL>>
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See the COPYING file for more details.
#
# This program is free... | StarcoderdataPython |
390306 | import numpy
import numpy.linalg
from naive_bayes import gaussian
def distance_matrix(data):
"""Returns a matrix with the Euclidean distance between each data line
"""
D = numpy.zeros( (data.shape[0], data.shape[0]) )
for i in xrange(data.shape[0]):
for j in xrange(i):
D[i,j] = nump... | StarcoderdataPython |
4838301 | name = 'EMBL2checklists'
__all__ = ['ChecklistOps', 'globalVariables', 'EMBL2checklistsMain', 'PrerequisiteOps']
| StarcoderdataPython |
396306 | <filename>so/labs/lab4/lock.py
from threading import Thread
from threading import RLock
import time
import random
g = 0
lock = RLock()
def incrementa():
global g
lock.acquire()
tmp = g # le valor
tmp += 1 # incrementa
lock.acquire()
time.sleep(random.randrange(0, 2))
lock.release()
g = tmp # escr... | StarcoderdataPython |
3545350 | <reponame>damshenas/aws-cdk-examples
#!/usr/bin/env python3
from aws_cdk import App
from api_sqs_lambda.api_sqs_lambda_stack import ApiSqsLambdaStack
app = App()
ApiSqsLambdaStack(app, "ApiSqsLambdaStack")
app.synth()
| StarcoderdataPython |
9625080 | # !/usr/bin/env python
# -*- coding: utf-8 -*-
# created by restran on 2016/1/2
from __future__ import unicode_literals, absolute_import
from datetime import timedelta
"""
Django settings for test_project project.
Generated by 'django-admin startproject' using Django 1.9.
For more information on this file, see
htt... | StarcoderdataPython |
5013477 | def hello():
return "Hello Python!"
| StarcoderdataPython |
6642985 | <filename>section2/oop_goral.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 17 10:52:55 2020
@author: tgoral
"""
# OBJECT ORIENTED PROGRAM
print("OBJECT ORIENTED PROGRAMMING")
class Student:
def __init__(self, name, grades):
self.name = name
self.grades = grades
def average_grade... | StarcoderdataPython |
6618354 | #!/usr/bin/env python3
from ncclient import manager
conn = manager.connect(
host='192.168.178.142',
port=22,
username='admin',
password='<PASSWORD>',
hostkey_verify=False,
device_params={'name': 'nexus'},
look_for_keys=False
)
for value in conn.server_capabilities:
print(value)
conn.close_session()
#Here is the ou... | StarcoderdataPython |
8161701 | from .utils import get_asset_path, render_from_layout
import matplotlib.pyplot as plt
import numpy as np
NUM_OBJECTS = 9
EMPTY, TILE1, TILE2, TILE3, TILE4, TILE5, TILE6, TILE7, TILE8 = range(NUM_OBJECTS)
def generate_tile_token(tile_num):
if tile_num is None:
return plt.imread(get_asset_path('slidetile_e... | StarcoderdataPython |
1602348 | <gh_stars>0
from blox.modules.module import module
from blox.exceptions import *
import urllib2,base64,logging
logger = logging.getLogger( 'blox.url' )
class url(module):
def input(self, params):
logger.debug('getting data from url: %s'%params['url'])
request = urllib2.Request( params['url'] )
if 'proxy... | StarcoderdataPython |
4964907 | <gh_stars>1-10
"""Support for toggling Amcrest IP camera settings."""
import logging
from homeassistant.const import CONF_NAME, CONF_SWITCHES, STATE_OFF, STATE_ON
from homeassistant.helpers.entity import ToggleEntity
from . import DATA_AMCREST, SWITCHES
_LOGGER = logging.getLogger(__name__)
async def async_setup_p... | StarcoderdataPython |
8031199 | <reponame>lileiigithub/PetdogRecognition
# -*- coding: utf-8 -*-
from PIL import Image
class ProcessImg(object):
size = (224, 224)
def __init__(self,_path):
self.img_path = _path
def resize(self):
try:
im = Image.open(self.img_path)
x = im.siz... | StarcoderdataPython |
1927400 | from asl._utils import load_heroes_dataset
| StarcoderdataPython |
11367684 | <gh_stars>10-100
import pytest
from luracoin.pow import proof_of_work
@pytest.mark.skip(reason="WIP")
def test_proof_of_work(): # type: ignore
assert False
| StarcoderdataPython |
8165123 | <filename>rlexperiments/common/tf_util.py
import os
import sys
import multiprocessing
import numpy as np
import tensorflow as tf
def create_session(cuda_visible_devices='0', gpu_memory_fraction=0.5):
ncpu = multiprocessing.cpu_count()
if sys.platform == 'darwin': ncpu //= 2
os.environ["CUDA_VISIBLE_DEVICES... | StarcoderdataPython |
286454 | <filename>steam/ext/dota2/protobufs/dota_client_enums.py
# Generated by the protocol buffer compiler. DO NOT EDIT!
# sources: dota_client_enums.proto
# plugin: python-betterproto
import betterproto
class ETournamentTemplate(betterproto.Enum):
NONE = 0
AutomatedWin3 = 1
class ETournamentGameState(betterpro... | StarcoderdataPython |
11343384 | from src.extractor.outlook_extractor import OutlookExtractor
def test_extract_data():
messages = OutlookExtractor().extract_data()
length = len(messages)
assert messages[length - 1].SenderEmailAddress == "<EMAIL>"
| StarcoderdataPython |
6694516 | string = input("Enter the string: ")
str = string.split()
str = list(reversed(str))
print("Reversed String :"," ".join(str))
| StarcoderdataPython |
3252864 | <reponame>sharechanxd/Risk-Index-Covid19
dict_iso={'afghanistan': 'Afghanistan',
'albania': 'Albania',
'algeria': 'Algeria',
'andorra': 'Andorra',
'angola': 'Angola',
'antigua-and-barbuda': 'Antigua and Barbuda',
'argentina': 'Argentina',
'armenia': 'Armenia',
'aruba': 'Aruba',
'australia': 'Australia',
'aust... | StarcoderdataPython |
3312144 | <filename>epregressions/builds/makefile.py
import os
from epregressions.builds.base import BaseBuildDirectoryStructure
from epregressions.ep_platform import exe_extension
class CMakeCacheMakeFileBuildDirectory(BaseBuildDirectoryStructure):
def __init__(self):
super(CMakeCacheMakeFileBuildDirectory, self... | StarcoderdataPython |
6404592 |
def Calculator():
while True:
print("\t\t\t\t WELCOME TO JOE'S CALCULATOR")
print("1. Addition")
print("2. Subtraction")
print("3. Multiplication")
print("4. Division")
print("5. Modulo")
choice = int(input("Enter your choice: "))
var1 = int(input("... | StarcoderdataPython |
3468762 | from pylab import *
import postgkyl
style.use('postgkyl.mplstyle')
def calcMeanSpect(fn, lo, up):
d = postgkyl.GData("%s_00%d.bp" % (fn, lo))
s = d.getValues()
g = d.getGrid()
dx = g[0][1]-g[0][0]
gc = linspace(g[0][0]+0.5*dx, g[0][-1]-0.5*dx, g[0].shape[0]-1)
for i in range(lo+1, up+1):
... | StarcoderdataPython |
6538437 | from ocli import sub, Main, Base
from .cli import decrypt, encrypt, keygen, pick
# @sub(
# {
# "decrypt": decrypt.Decrypt,
# "encrypt": encrypt.Encrypt,
# "keygen": keygen.KeyGen,
# "pick": pick.Pick,
# },
# help="select sub command",
# required=True,
# )
# class Top(Ma... | StarcoderdataPython |
1836387 | <filename>IntegratedFireControl.py
'''
Created on 2022/01/23
@author: sa
'''
import numpy as np
from .MyUtil import *
from ASRCAISim1.libCore import *
S_TIMEOUT = 1200
MPS_MINIMUM_LIVE_MISSILE_VELOCITY = 500
S_MISSILE_ACL_TIME = 4.0
MPS_MAXSPEED = 500
M_RADAR_RANGE = 100000
M_SPLASH_RANGE = 300
M_ABREAST_CRITERIA =... | StarcoderdataPython |
1805907 | #!/usr/bin/env python
"""
Freight
=======
A deploy service.
:copyright: (c) 2015 Functional Software Inc.
:license: Apache 2.0, see LICENSE for more details.
"""
from __future__ import absolute_import
import os.path
from setuptools import setup, find_packages
# Hack to prevent stupid "TypeError: 'NoneType' object... | StarcoderdataPython |
3441653 | test = {
'name': 'bluedog',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
sqlite> SELECT * FROM bluedog;
blue|dog
blue|dog
blue|dog
blue|dog
blue|dog
blue|dog
blue|dog
blue|dog
bl... | StarcoderdataPython |
6466879 | <filename>app_folder/blueprints/users/views.py
from crypt import methods
from os import abort
from flask import redirect, render_template, request, url_for, flash , current_app, jsonify
from app_folder.blueprints.users import user
from app_folder.blueprints.users.model import User
from flask_login import login_required... | StarcoderdataPython |
4954320 | # -*- coding: utf-8 -*-
# Time : 2021/12/16 16:10
# Author : QIN2DIM
# Github : https://github.com/QIN2DIM
# Description:
from .core import EmailRelay, Chrome
def get_verification_code(
link: str,
chromedriver_path: str = None,
driver: Chrome = None,
silence: bool = True... | StarcoderdataPython |
180391 | import os
import sys
import logging
import wyze_sdk
from wyze_sdk import Client
from wyze_sdk.errors import WyzeApiError
if len(sys.argv) < 5 :
sys.stdout = sys.stderr
print(f"USAGE: {sys.argv[0]} wyze_email wyze_password robovac_nickname roomname [roomname...]")
quit(1)
rooms2clean = []
num_rooms2clean = len(s... | StarcoderdataPython |
8119259 | from typing import List
class Solution:
def medianSlidingWindow(self, nums: List[int], k: int) -> List[float]:
left, right = 0, k
lenN = len(nums)
medians = []
while right <= lenN:
window = sorted(nums[left:right])
median = k // 2
if (right - lef... | StarcoderdataPython |
3349569 | <filename>test/operations/test_crossover.py
"""
"Genyal" (c) by <NAME>.
"Genyal" is licensed under a
Creative Commons Attribution 4.0 International License.
You should have received a copy of the license along with this
work. If not, see <http://creativecommons.org/licenses/by/4.0/>.
"""
import random
import string
imp... | StarcoderdataPython |
64626 | import os, sys
import numpy as np
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
percentages = [0.01, 0.1, 0.2, 0.4, 0.5, 0.6]
for percentage in percentages:
data = []
save_path = '../logs/SOM_weights_MNIST_noise_{}.npy'.format(percentage)
wts = np.load(save_path).reshape(-1, 784)
print ("===... | StarcoderdataPython |
131580 | <filename>test/test_fillgaps_lowpass_2d.py
import unittest
import numpy as np
from numpy.testing import assert_almost_equal
import gridtools.gapfilling as gtg
GAP = np.nan
KERNEL = np.ones((3, 3), dtype=np.float64)
class FillgapsLowpass2d(unittest.TestCase):
def _test_fillgaps(self, src, desired_out, desired_... | StarcoderdataPython |
267821 | import torch
import torch.nn as nn
from .utils.summary import summary as model_summary
from tensornet.engine.learner import Learner
class BaseModel(nn.Module):
def __init__(self):
"""This function instantiates all the model layers."""
super(BaseModel, self).__init__()
self.learner = None... | StarcoderdataPython |
1676392 | def luas_segitiga (a, t):
return a * t * 0.5
def luas_trapesium (a, b, t):
return (a + b) * t * 0.5
def mulai ():
print( "Pilih menu berikut:" )
print( "[1] <NAME>" )
print( "[2] <NAME>")
print( "inputkan pilihan (1, 2, atau 3):" )
inp = input()
if inp == 1 :
print( ... | StarcoderdataPython |
1830613 | from flask_restful import Resource, reqparse
from server.controllers.tickets import *
from server.controllers.users import *
from server.api.v1 import return_failure, return_success, require_login
from typing import cast
CREATE_PARSER = reqparse.RequestParser(bundle_errors=True)
CREATE_PARSER.add_argument('data',
... | StarcoderdataPython |
6438750 | <filename>housing_affordability_18/apps.py
from django.apps import AppConfig
class HousingAffordability18Config(AppConfig):
name = 'housing_affordability_18'
| StarcoderdataPython |
1840212 | import os
import re
import numpy
from ObjectDetectionParser import ObjectDetectionParser
# from ObjectDetectionParser import ImageRaw
from SupportClasses import PrecisionAndRecall
from SupportClasses import GoldContent
from SupportClasses import Rectangle
class FasterRcnnParser(ObjectDetectionParser):
# __iteratio... | StarcoderdataPython |
1831370 | <gh_stars>0
from django.http import JsonResponse
from django.core import serializers
from django.shortcuts import render
from api.data.ioe_crawler import run_spider
import json
# runs spider - save first page of exam.ioe.edu.np to new_notices.json
def get_new_notifications(request):
run_spider()
notification... | StarcoderdataPython |
4927647 | # Miracle Cube Fragment
FRAGMENT = 2430112
POT_SCROLL = 2049401
ADV_POT_SCROLL = 2049400
q = sm.getQuantityOfItem(FRAGMENT)
if q >= 10:
if sm.canHold(ADV_POT_SCROLL):
sm.giveItem(ADV_POT_SCROLL)
sm.consumeItem(FRAGMENT, 10)
else:
sm.systemMessage("Make sure you have enough space in your inventory..")
elif q ... | StarcoderdataPython |
6463814 | from api import app
from api.database import db
from api.models import User, Group, App, Log, Note, ComponentUser, Component, Invite
from flask_restless import APIManager, ProcessingException
from flask_login import current_user, login_fresh
from flask import session
from flask_cors import CORS
cors = CORS(app, resour... | StarcoderdataPython |
301861 | from django.contrib import admin
from django.contrib import admin
from django.urls import path, include
from tv import views
urlpatterns = [
path('postComment', views.postComment, name="postComment"),
path("", views.tvHome, name='tvHome'),
path("<str:slug>", views.tvPost, name='tvPost'),
] | StarcoderdataPython |
4985032 | import tensorflow as tf
# You'll generate plots of attention in order to see which parts of an image
# our model focuses on during captioning
#import matplotlib.pyplot as plt
# Scikit-learn includes many helpful utilities
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
import r... | StarcoderdataPython |
4974 | from waiter.action import process_kill_request
from waiter.util import guard_no_cluster, check_positive
def kill(clusters, args, _, __):
"""Kills the service(s) using the given token name."""
guard_no_cluster(clusters)
token_name_or_service_id = args.get('token-or-service-id')
is_service_id = args.get... | StarcoderdataPython |
3294096 | <reponame>alexmgr/pdbfile<gh_stars>1-10
#!/usr/bin/python
# coding: utf-8
# Copyright (c) 2016 Mountainstorm
#
# 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... | StarcoderdataPython |
3346434 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
All necessary for feature
"""
import tensorflow as tf
# model preprocess
model_preprocess = {
"DenseNet": tf.keras.applications.densenet.preprocess_input,
"EfficientNet": tf.keras.applications.efficientnet.preprocess_input,
"NasNet": tf.keras.applications.nasnet.... | StarcoderdataPython |
12824567 | # Space Invaders
# Created by <NAME>
# Adapted by <NAME>
# !/usr/bin/env python
from pygame import *
import pygame.draw
from nave import Ship
from tiro import Bullet
from inimigo import Enemy
from barreira import Blocker
from ufo import Mystery
from explosao import Explosion
from vida import Life
from texto import Tex... | StarcoderdataPython |
1836071 | from conans import ConanFile, CMake, tools
import os
required_conan_version = ">=1.43.0"
class FlatbuffersConan(ConanFile):
name = "flatbuffers"
license = "Apache-2.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "http://google.github.io/flatbuffers"
topics = ("flatbuffers", ... | StarcoderdataPython |
6415946 | <filename>timm/models/layers/__init__.py
from .activations import *
from .adaptive_avgmax_pool import \
adaptive_avgmax_pool2d, select_adaptive_pool2d, AdaptiveAvgMaxPool2d, SelectAdaptivePool2d
from .blur_pool import BlurPool2d
from .classifier import ClassifierHead, create_classifier
from .cond_conv2d import... | StarcoderdataPython |
11298309 | # Title: dataset.py - Create dataset for face recognition
# Author: <NAME>
# Copyright (c) 2017 Linaro Limited
#
################################################################
# Import OpenCV library
import cv2,os
import numpy as np
from PIL import Image
import os
f = os.popen("ls -lrt /dev/video*")
for line in f.... | StarcoderdataPython |
11377432 | #Copyright (c) 2020 Ocado. All Rights Reserved.
import numpy as np
class Cost:
def __init__(self, value, blocked=False):
self.value = value
self.blocked = blocked
def to_float(self):
if self.blocked : return np.inf
return self.value
def __add__(self, other):
if i... | StarcoderdataPython |
6532722 | import json
import phantom.app
import py42.sdk
from py42.response import Py42Response
from py42.services.users import UserService
from pytest import fixture
from requests import Response
from code42_connector import Code42Connector
TEST_USER_UID = "TEST_USER_UID"
MOCK_ALERT_DETAIL_RESPONSE = {
"alerts": [
... | StarcoderdataPython |
1603557 | #!/usr/bin/env python3
from bottle import Bottle, route, request, app
import keras
from DeepSPADE import data_helpers
app = Bottle()
@app.route('/')
def index():
return 'The main HTTP API is a POST request on /spam with JSON {"body": "text"}'
@app.route('/spam')
def spam():
body = request.query.body
fi... | StarcoderdataPython |
3480121 | # Copyright (C) 2014 Universidad Politecnica de Madrid
#
# 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 la... | StarcoderdataPython |
272270 | import numpy as np
import matplotlib.pyplot as plt
import time
from IPython import display
# Implemented methods
methods = ['DynProg', 'ValIter'];
# Some colours
LIGHT_RED = '#FFC4CC';
LIGHT_GREEN = '#95FD99';
BLACK = '#000000';
WHITE = '#FFFFFF';
LIGHT_PURPLE = '#E8D0FF';
LIGHT_ORANGE = '#FAE0C3';
... | StarcoderdataPython |
4892562 | # Generated by Django 2.2.6 on 2019-12-07 14:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('personas', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Person',
... | StarcoderdataPython |
2702 | <filename>ucsmsdk/mometa/adaptor/AdaptorMenloQStats.py
"""This module contains the general information for AdaptorMenloQStats ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class AdaptorMenloQStatsConsts:
MENLO_QUEUE_COMPO... | StarcoderdataPython |
277919 | from mock import patch
from pretend import stub
from .util import V1TestCase, writeable_settings_stub
# Tests for both tests and tasks as they are the same code path
def make_thing(name, num, status_name, status_order):
return stub(
Name='{0}-{1}'.format(name, num),
url='http://example.com/{0}'.... | StarcoderdataPython |
6452196 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 19 11:16:04 2017
@author: <NAME> (<EMAIL>)
@brief: MSTD is a generic and efficient method to identify multi-scale topological domains (MSTD)
from symmetric Hi-C and other high resolution asymmetric promoter capture Hi-C datasets
@version 0.0.... | StarcoderdataPython |
12847479 | <gh_stars>1-10
#!/usr/bin/python
import re
import sys
import cgi
import _mysql
import mysql.connector
from thememetro import *
from cloudNG import *
con=mysql.connector.connect(user='brewerslab',password='<PASSWORD>',database="brewerslab")
form=cgi.FieldStorage()
theme=webTheme()
theme.bgcolor="#ffffff"
if theme.local... | StarcoderdataPython |
386541 | __doc__ = "DRF library to operate resource's properties as a dictionary"
__version__ = '1.1.0'
__url__ = 'https://github.com/yola/drf-madprops'
| StarcoderdataPython |
11319047 | # Add toor dir of the src tree to the syspath, so that we can use absolute import
import sys
from pathlib import Path # if you haven't already done so
file = Path(__file__).resolve()
parent, root = file.parent, file.parents[1]
sys.path.append(str(root))
import threading
from bgwork.exceptions import NullHandlerError... | StarcoderdataPython |
9724055 | from .structs import (
OrderSide, OrderStatus, OrderType, Pair, Period, Candle,
MarketTrade, Coin, PrivateTrade
)
from .market import Exchange
from .private import Account
from .api import ApiError, ApiProvider
__all__ = [
'OrderSide', 'OrderStatus', 'OrderType', 'Pair', 'Coin',
'Period', 'Candle', 'Ma... | StarcoderdataPython |
6684447 | <gh_stars>1-10
#!/usr/bin/env python3
import subprocess
import sys
if __name__ == '__main__':
args = sys.argv
cid = args[1]
command = args[2:]
retcode = subprocess.call(['lxc-attach', '-n', cid, '--'] + command)
sys.exit(retcode)
| StarcoderdataPython |
6679782 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of inenv.
# https://github.com/pnegahdar/inenv
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT-license
# Copyright (c) 2015, <NAME> <<EMAIL>>
from setuptools import setup, find_packages
from inenv.version import __version__
... | StarcoderdataPython |
12804248 | <reponame>ccrndn/labelbox-python
from typing import Any, Dict, List, Union
import pytest
from labelbox import LabelingFrontend
from labelbox.exceptions import InconsistentOntologyException
from labelbox.schema.ontology import Tool, Classification, Option, \
Ontology, OntologyBuilder
_SAMPLE_ONTOLOGY = {
"too... | StarcoderdataPython |
8071569 | <reponame>elick007/IBMRedirection<gh_stars>1-10
import os
from time import sleep
from getpass import getpass
from random import choice
from sys import exit as exit_cmd
from webbrowser import open_new_tab
from cloud189.api import Cloud189
from cloud189.api.models import FileList, PathList
from cloud189.api.token import... | StarcoderdataPython |
8090327 | # -*- coding: utf-8 -*-
import re
import six
import warnings
from functools import wraps
from collections import Iterable
import pandas as pd
def get_forward_returns_columns(columns):
syntax = re.compile("^period_\\d+$")
return columns[columns.astype('str').str.contains(syntax, regex=True)]
def convert_t... | StarcoderdataPython |
6702489 | <reponame>flosincapite/HackingNeuralNetworks<filename>utils.py<gh_stars>0
import numpy as np
from skimage import io
def read_image(fname):
image = io.imread(fname)
result = np.zeros(shape=[1, 28, 28, 1], dtype=np.float32)
for yy in range(28):
for xx in range(28):
result[0][xx][yy][0] =... | StarcoderdataPython |
210183 | <filename>pytest_headlock/plugin_headlock_debug.py
"""
This plugin creates a CMakeLists file, that contains all testsetups of the
first (failed) test.
To avoid overwriting this File the "--keep-first-failed-pytest" command line
option can be set.
The content of this file is used by testlibs/debug_failed.py
to run only... | StarcoderdataPython |
1641787 | <gh_stars>1-10
import corpusTools
def Test1():
# stolen from ConferenceCorpusIntro
cc = corpusTools.ConferenceCorpusIntro() # initializes the corpus
cc.printCacheFile() # prints where the cached file is located
# cc.printAvailableDatasourceIds() ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.