id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
11365785 | <reponame>RealTimeWeb/Blockpy-Server<filename>controllers/admin.py
# Import built-ins
import os, sys
import json
from subprocess import call
import subprocess
import csv
import io
import os.path as op
# Import Flask
from flask_admin import Admin, BaseView, expose, form
from flask_admin.contrib.sqla import ModelView
fr... | StarcoderdataPython |
1965664 | <filename>data_collector/templates.py
# template version v1
| StarcoderdataPython |
5066394 | """
The function in this script creates a train, test and validation subset split.
The script can also be executed by itself with
python subset_split.py DATE LEVEL
with
DATE: date of sentinel-2 image in YYYYMMDD format
LEVEL: processing level of sentinel-2 image, either L1C or L2A
"""
import ... | StarcoderdataPython |
6673287 | from project.tests.base import BaseTestCase
from project.api.models import Topic
from project.api.models import Developer
from project import db
class TestDeveloperModel(BaseTestCase):
def test_add_developer(self):
topic = Topic(name="Python", description="", abbreviation="py")
developer = Deve... | StarcoderdataPython |
8009380 | <gh_stars>0
from deepimpute.deepImpute import MultiNet
import pandas as pd
def deepimp(path)
data = pd.read_csv(path, index_col=0) # dimension = (cells x genes)
NN_params = {
'learning_rate': 1e-4,
'batch_size': 64,
'max_epochs': 300,
'ncores': 5,
'sub_outputdim': 512,
... | StarcoderdataPython |
3438114 | <gh_stars>0
##########################################################################
#
# MRC FGU Computational Genomics Group
#
# $Id$
#
# Copyright (C) 2009 <NAME>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as publishe... | StarcoderdataPython |
360074 | from collections.abc import Callable
from functools import lru_cache
from typing import Any, TypeVar, overload
from valtypes import collection
from .controller import Controller
from .rule import Rule
__all__ = ["Collection"]
T = TypeVar("T")
T_Parser = TypeVar("T_Parser", bound=Callable[[Any, Any, Controller], A... | StarcoderdataPython |
9634682 | import sys
from pathlib import Path
import pickle
import argparse
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def create_cv_plots(experiment, unit, results_dict, figures_path):
for key in results_dict.keys():
print(f"cv plot: {key}")
unit_pm_qdata_model = results_dict... | StarcoderdataPython |
6635142 | <reponame>gesiscss/wikiwho_chobj<filename>example.py
from wikiwho_chobj import Chobjer, ChobjerPickle
from wikiwho_chobj.utils import Timer
from wikiwho import open_pickle
if __name__ == "__main__":
starting_revid = -1
#ids = [2161298, 1620389, 6187]
ids = ['2161298']
#ids = [6886]
#ids = [21612... | StarcoderdataPython |
5046663 | import asks
import random
import dns
import trio
from dns import asyncresolver
from dns import resolver
from dns import name
import defaults
from utils import success
async def fetch_url(url, results, limit, valid_status_codes, pbar=None):
params = dict(
follow_redirects=False,
timeout=defaults.... | StarcoderdataPython |
3205799 | <filename>mogan/tests/tempest/api/base.py
#
# Copyright 2016 Huawei Technologies Co., Ltd.
#
# 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
... | StarcoderdataPython |
9694720 | import re
import bs4
import requests
from six.moves.urllib import parse
from webedge.stop_words import ENGLISH_STOP_WORDS
from webedge.warnings import BADGES
from webedge.warnings import WARNINGS
from webedge.social_websites import SOCIAL_WEBSITES
from AnalyseSentiment.AnalyseSentiment import AnalyseSentiment
# REGEX ... | StarcoderdataPython |
1633818 | <filename>utils.py
import cv2
import numpy as np
from scipy import ndimage
from PyQt5 import QtGui
def bbox_iou(b1, b2):
'''
b: (x1,y1,x2,y2)
'''
lx = max(b1[0], b2[0])
rx = min(b1[2], b2[2])
uy = max(b1[1], b2[1])
dy = min(b1[3], b2[3])
if rx <= lx or dy <= uy:
return 0.
e... | StarcoderdataPython |
1954559 | <filename>src/tatch/game/entity/Entity.py
from game.matrix.Matrix import Matrix
from game.matrix.Vector import Vector
class Entity(object):
@staticmethod
def generateEntityToWorldMatrix(axes):
entityToWorldMatrix = Matrix.generateIdentity(4,4)
# x-axis
entityToWorldMatrix.values[0][0] ... | StarcoderdataPython |
1910312 | from typing import List
from pydantic import BaseModel
from app.schemas import BaseResponse
class Gender(BaseModel):
"""
性别
"""
male: str = ""
female: str = ""
class GenderRatioModel(Gender):
"""
性别比例 Model
"""
pass
class SarsNcovRatioModel(BaseModel):
"""
Sars Ncov 比... | StarcoderdataPython |
3251848 | import numpy as np
m = 2
n = 2
shape = (n + 1, m + 1)
grid = np.zeros(shape)
def count_right(array):
if array.shape[1] > 0:
array[0,:] += 1
print("\n{}".format(array))
count_down(array[1:,])
else:
return count_right(array[:-1,:])
def count_down(array):
if array.shape[0] >... | StarcoderdataPython |
9656602 | #
# This source file is part of the EdgeDB open source project.
#
# Copyright 2017-present MagicStack Inc. and the EdgeDB authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http... | StarcoderdataPython |
3358939 | <filename>parsi_io/modules/quranic_extractions.py
#In the name of Allah
import re
import pickle
import pandas as pd
import time
import zipfile
import os
from tqdm import tqdm
from tashaphyne.normalize import strip_tashkeel, strip_tatweel
from camel_tools.utils.normalize import normalize_alef_maksura_ar, normalize_teh_... | StarcoderdataPython |
293568 | <gh_stars>1-10
from django.apps import AppConfig
class PayULatamConfig(AppConfig):
name = 'payulatam'
verbose_name = "Django Payu Latam application"
| StarcoderdataPython |
19861 | def _doxygen_archive_impl(ctx):
"""Generate a .tar.gz archive containing documentation using Doxygen.
Args:
name: label for the generated rule. The archive will be "%{name}.tar.gz".
doxyfile: configuration file for Doxygen, @@OUTPUT_DIRECTORY@@ will be replaced with the actual output dir
... | StarcoderdataPython |
4807929 | <gh_stars>0
import unittest
import numpy as np
import tensorflow as tf
import torch
from fastestimator.op.tensorop.gradient import Watch
from fastestimator.test.unittest_util import is_equal
class TestWatch(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.tf_data = tf.Variable([1., 2., 4.])... | StarcoderdataPython |
3217645 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 4/20/21-16:49
# @Author : TuringEmmy
# @Email : <EMAIL>
# @WeChat : superior_god
# @File : VaritionalAutoEncoders.py
# @Project : 00PythonProjects
import argparse
import os
import numpy as np
import tensorflow as tf
from PIL import Image
from mat... | StarcoderdataPython |
1744409 | <reponame>Henil-08/Pi-Car
import cv2 as cv
import numpy as np
cap = cv.VideoCapture(0)
try:
while True:
_, frame = cap.read()
cv.imshow('OrgVid', frame)
key = 27
if(cv.waitKey(1) & 0xFF == key):
break
finally:
cap.release()
cv.destroyAll... | StarcoderdataPython |
5039068 | from functools import partial
import torch
import torch.nn as nn
import torch.nn.functional as F
def compute_kernel(x, y):
x_size = x.size(0)
y_size = y.size(0)
dim = x.size(1)
x = x.unsqueeze(1) # (x_size, 1, dim)
y = y.unsqueeze(0) # (1, y_size, dim)
tiled_x = x.expand(x_size, y_size, dim)
tiled_y = y.expa... | StarcoderdataPython |
1648069 | <filename>chess/pieces/knight.py
#!/usr/bin/python
# Author: @BlankGodd
# knight
from pieces.positions import Pos
class Knight:
def __init__(self,board):
self.position = Pos._positions
self.board = board
self.alpha = Pos._alpha
def move(self,p,ab,player):
pass | StarcoderdataPython |
183852 | <filename>jenkinscli/cli/main.py
import sys
import jenkins
from .parser import parser
# Tries to fetch configuration from the environment
try:
from . import DEFAULT_CONFIG
url, username, password = DEFAULT_CONFIG
except:
print("Cannot collect configuration from the environment")
exit(1)
def main():
... | StarcoderdataPython |
11392504 | <reponame>pupil-labs/realtime-python-api
import asyncio
import contextlib
from pupil_labs.realtime_api.discovery import Network, discover_devices
async def main():
async with Network() as network:
print("Looking for the next best device...\n\t", end="")
print(await network.wait_for_new_device(tim... | StarcoderdataPython |
1788935 | import itertools
from collections import OrderedDict
from django.conf import settings
import mock
from nose.tools import eq_, ok_
import mkt.site.tests
from mkt.constants.features import (APP_FEATURES, FeaturesBitField,
FeatureProfile)
MOCK_APP_FEATURES_LIMIT = 45
MOCK_APP_FEATU... | StarcoderdataPython |
6408888 | <filename>app/utils/mail.py
from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from app import mail
def _send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kwargs):
app = current_app._get_... | StarcoderdataPython |
8088809 | <reponame>StudyForCoding/BEAKJOON
import sys
T = int(sys.stdin.readline())
for i in range(T):
N = int(sys.stdin.readline())
cloth_dict = dict()
for j in range(N):
name, kind = sys.stdin.readline().split()
try:
cloth_dict[kind] += 1
except:
cloth_dict[kind] = 2
answer = 1
for c in list(cloth_dict.val... | StarcoderdataPython |
12844377 | <filename>packages/w3af/w3af/core/controllers/profiling/pytracemalloc.py
"""
pytracemalloc.py
Copyright 2015 <NAME>
This file is part of w3af, http://w3af.org/ .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundat... | StarcoderdataPython |
3509764 | <reponame>DarthSid12/VoiceAssistant
__version__='0.0.1-beta.2' | StarcoderdataPython |
1802995 | from Topsis-Kunal-101903371.101903371-Kunal import topsis | StarcoderdataPython |
4982916 | #!/usr/bin/env python
# coding=utf-8
from __future__ import print_function
from collections import defaultdict
import functools
import multiprocessing
# Three kinds of streams:
# 000LLLLL Literal string of L+1 bytes
# LLLaaaaa bbbbbbbb Backref of L+3 bytes
# 111aaaaa LLLLLLL... | StarcoderdataPython |
6602614 | from aiogram import Dispatcher, types
from aiogram.dispatcher.filters import IsReplyFilter, IDFilter
async def unsupported_admin_reply_types(message: types.Message):
"""
Хэндлер на неподдерживаемые типы сообщений, т.е. те, которые не имеют смысла
для копирования. Например, опросы (админ не увидит результа... | StarcoderdataPython |
4978106 | <gh_stars>100-1000
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
from .getrf import Getrf
from .getri import Getri
from .getrs import Getrs
from .potrf import Potrf
| StarcoderdataPython |
6677389 | import numpy as np
import tensorflow as tf
from tests.helper import assert_variables
from tests.layers.flows.helper import invertible_flow_standard_check
from tfsnippet.layers import FeatureShufflingFlow
class FeatureShufflingFlowTestCase(tf.test.TestCase):
def test_feature_shuffling_flow(self):
np.rand... | StarcoderdataPython |
3513511 | <filename>LaserBeamPosition.py<gh_stars>0
#!/usr/bin/env python
"""Active laser beam pointing stabilization.
Laser beam position measured on beam conditioning optics enclosure in
the 14IDB X-ray hutch.
Laser beam pointing corrected at the periscope mirror in the laser lab.
Calibration for PeriscopeH:
(7.612900 - 7.606... | StarcoderdataPython |
126279 | def jogador(nom="<desconhecido>", nG=0):
print(f'O jogador {nom} fez {nG} gol(s) no compeonato.')
# Programa principal:
print('-' * 30)
nome = str(input('Nome do jogador: ')).strip().capitalize()
nGols = str(input('Número de gols: ')).strip()
if nome == '' and not nGols.isnumeric():
jogador()
elif nome == '':... | StarcoderdataPython |
9624162 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import mock
import pytest
from pyramid.httpexceptions import HTTPNoContent, HTTPBadRequest
from h.views import api_groups as views
@pytest.mark.usefixtures('authenticated_userid', 'group_service')
class TestRemoveMember(object):
def test_it_remo... | StarcoderdataPython |
1730694 | from pathlib import Path
import shutil
def configure_pipeline(
project_dir: Path,
config_path: Path
) -> None:
pipeline_dir = project_dir / 'mne-bids-pipeline'
assert pipeline_dir.exists()
if config_path.exists():
raise FileExistsError(
f'😱 Oh no! The specified configuration ... | StarcoderdataPython |
1663640 | <filename>amatino/denomination.py
"""
Amatino API Python Bindings
Denomination Module
Author: <EMAIL>
"""
from amatino.internal.immutable import Immutable
class Denomination:
"""
Abstract class defining an interface for units of account. Adopted by
Custom Units and Global Units.
"""
def __init__(
... | StarcoderdataPython |
6546847 | <reponame>gabssanto/pizzaPy
from core.components.base_component import BaseComponent
from core.router import RouterNavigate
from core.hooks.state import State
class Button(BaseComponent):
def __repr__(self) -> str:
for child in self.children:
self.html = self.html + str(child)
string ... | StarcoderdataPython |
11265375 | # FIND CENTER RA DEC
# CREATED 2020.06.11 <NAME>
#============================================================
import os, glob, subprocess
import numpy as np
import matplotlib.pyplot as plt
from astropy.table import Table, vstack
from astropy.io import ascii
from astropy.io import fits
from astropy.time import Time
fro... | StarcoderdataPython |
5160199 | <reponame>LehmRob/od-conv<filename>gnosis/xml/pickle/test/test_numpy.py
import gnosis.xml.pickle as xml_pickle
import Numeric,array
import funcs
funcs.set_parser()
class foo: pass
f = foo()
f.a = Numeric.array([[1,2,3,4],[5,6,7,8]])
f.b = Numeric.array([1.2,2.3,3.4,4.5])
f.y = array.array('b',[1,2,3,4])
f.z = arra... | StarcoderdataPython |
9668977 | """
An example setting up multiple vehicles triggering on eachother and running in parallel
Some features used:
- AbsoluteLaneChangeAction
- TimeHeadwayCondition
"""
import os
from scenariogeneration import xosc, prettyprint
# create catalogs
catalog = xosc.Catalog()
catalog.add_catalog('VehicleCat... | StarcoderdataPython |
4886276 |
import numpy as np
import logging
import os
from .train_logger import set_up_logger
class EarlyStopping:
""" Stops the training early if the a specified metrix doesn't improve after a given patience."""
DEFAULT_PATIENCE = 7
DEFAULT_DELTA = 0
DEFAULT_VERBOSE = False
TYPE = "iou"
SUPPORTED_METR... | StarcoderdataPython |
4848269 | <filename>cnns/nnlib/pytorch_architecture/linear.py
import torch
import torch.nn as nn
import torch.nn.functional as F
class Linear(nn.Module):
def __init__(self, args, hidden_sizes=[512, 128, 64, 16]):
super(Linear, self).__init__()
self.args = args
self.input_size = args.input_size
... | StarcoderdataPython |
6428123 | <reponame>WisChang005/technews_watcher<filename>technews/crawlers/tech_orange.py
import time
import json
import hashlib
import logging
import requests
from bs4 import BeautifulSoup
class TechOrange:
def __init__(self):
self.url = "https://buzzorange.com/techorange/latest/"
self.headers = {
... | StarcoderdataPython |
100041 | # May 2018 xyz
import numpy as np
import numba
def Rx( x ):
# ref to my master notes 2015
# anticlockwise, x: radian
Rx = np.zeros((3,3))
Rx[0,0] = 1
Rx[1,1] = np.cos(x)
Rx[1,2] = np.sin(x)
Rx[2,1] = -np.sin(x)
Rx[2,2] = np.cos(x)
return Rx
def Ry( y ):
# anticlockwise, y: radi... | StarcoderdataPython |
6543511 | <filename>config/docker/configure.py
import os
ENV_VARS = [
"SERVERCONTEXTPATH",
"SERVERPORT",
"DBHOST",
"DBPORT",
"DBNAME",
"DBSCHEMA",
"DBUSER",
"DBPASSWORD",
"USESSL",
"AUTHSECRET"
]
DIR = "./config/docker/"
OUTPUT_FILE = DIR + "application.properties"
INPUT_FILE = OUTPUT_FI... | StarcoderdataPython |
6693883 | <reponame>mathijspieters/dagster
import itertools
import warnings
from typing import AbstractSet, Any, Dict, Mapping, Optional, Sequence, Tuple, Union, cast
from dagster import check
from dagster.core.definitions.config import ConfigMapping
from dagster.core.definitions.decorators.op import op
from dagster.core.defini... | StarcoderdataPython |
6527963 | <reponame>timmo001/aiogithubapi
"""Test graphql."""
# pylint: disable=missing-docstring
import pytest
from aiogithubapi import GitHubAPI
from tests.common import MockedRequests
@pytest.mark.asyncio
async def test_graphql(github_api: GitHubAPI, mock_requests: MockedRequests):
response = await github_api.graphql(... | StarcoderdataPython |
4815467 | <reponame>vallsv/pyFAI<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Project: Azimuthal integration
# https://github.com/silx-kit/pyFAI
#
# Copyright (C) 2015-2016 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: <NAME> (<EMAIL>)
#
# Permission is... | StarcoderdataPython |
11391542 | """Unit tests for Exponential Barycenter mean."""
import logging
import geomstats.backend as gs
import geomstats.tests
from geomstats.geometry.euclidean import Euclidean
from geomstats.geometry.special_euclidean import SpecialEuclidean
from geomstats.geometry.special_orthogonal import SpecialOrthogonal
from geomstats... | StarcoderdataPython |
12836820 | class Starter:
def start(self, notification_sender, server_actor_ref):
raise NotImplementedError
| StarcoderdataPython |
6493625 | import numpy as np
from sklearn.metrics.pairwise import pairwise_distances
import kmedoids
W0 = np.load("W0_10d.npy")
# distance matrix
D = pairwise_distances(W0, metric='euclidean')
# split into 60 clusters
M, C = kmedoids.kMedoids(D, 60)
C_label = np.zeros(35390) # 35390 = 17695*2 (number of genes from both network... | StarcoderdataPython |
6497311 | <reponame>Spotrix/spotrix<filename>spotrix/dashboards/commands/importers/dispatcher.py
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses th... | StarcoderdataPython |
3330678 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
"""Placeholder."""
# Make sure to import smepu before you import tqdm or any other module that
# uses tqdm.
#
# NOTE: depending on how you setup your favorite editor with formatter+isort,
# a few savings may be needed... | StarcoderdataPython |
9610646 | <filename>scripts/compile_template.py
#!/usr/bin/env python3
"""
Copyright (c) 2017, Cyberhaven
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 t... | StarcoderdataPython |
1956362 | '''
translator.py
Name: <NAME>
Collaborators:
Date: September 28th, 2019
Description: Translates from English numbers to Spanish (or your language of choice!).
'''
## Here are the Spanish numbers, spelled out from 0 to 9:
## cero uno dos tres cuatro cinco seis siete ocho nueve
# dictionary holding english and spanish... | StarcoderdataPython |
12856394 | #!/usr/bin/env python
# -*- coding= UTF-8 -*-
# Fad
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
# setup the empty canvas
from io import FileIO as file
from reportlab.platypus import Flowable
# from Common.pyPdf import PdfFileWriter, PdfFileReader
from PyPDF2 import PdfFileWriter, PdfFil... | StarcoderdataPython |
6561690 | from django.shortcuts import render,redirect
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth.models import auth,User
from . forms import RegisterForm
# Create your views here.
def home_page(request):
return render(request,'recruitment/homepage.html')
def post(request):
i... | StarcoderdataPython |
6479373 | import pandas as pd
# TODO: Set weight1, weight2, and bias
weight1 = 1.0
weight2 = 1.0
bias = -1.5
# DON'T CHANGE ANYTHING BELOW
# Inputs and outputs
test_inputs = [(0, 0), (0, 1), (1, 0), (1, 1)]
correct_outputs = [False, False, False, True]
outputs = []
# Generate and check output
for test_input, correct_output i... | StarcoderdataPython |
4898402 | # Copyright 2019 Xilinx Inc.
#
# 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, ... | StarcoderdataPython |
318557 | <reponame>iceihehe/flask-demos
# -*- coding = utf-8 -*-
from sqlalchemy import Column, Integer, String, Float, DateTime, TEXT, PrimaryKeyConstraint
from app.blueprint.tyfo.database import Base
class SingleUserProfile(Base):
__tablename__ = "single_usr_profile"
mb_id = Column(Integer, primary_key=True)
... | StarcoderdataPython |
1881451 | """
PoE対応 WebAPI K型熱電対アンプ API仕様
\"Try it out\"機能は、API仕様を製品と同一ネットワーク上のローカルPCにダウンロードしブラウザで開くことで利用できます。 # noqa: E501
The version of the OpenAPI document: 1.2.x
Generated by: https://openapi-generator.tech
"""
import unittest
import tc_kep100_client
from tc_kep100_client.api.temperature_api import Te... | StarcoderdataPython |
11350832 | import setuptools
from spym._version import __version__
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="spym",
version=__version__,
author="<NAME>",
author_email="<EMAIL>",
description="A python package for loading and processing Scanning Probe Microsco... | StarcoderdataPython |
8103306 | <gh_stars>1-10
from PIL import Image
import sys
import os
import tkinter as tk
import tkinter.filedialog as filedialog
def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n]
text = open('out.txt', mode='w', newline=None)
def send(msg):
text.write(msg)
def to565(color):
... | StarcoderdataPython |
4946101 | import asyncio
# To my future maintainers. I'm sorry for this function in particular, but
# I didn't have any other option. This thing makes unit-testing coroutines
# so much easier. Imagine having to write half of this in each unit-test.
# TODO: Write unittest for async_test.
def async_test(loop=None, timeout=None... | StarcoderdataPython |
3552242 | <reponame>ttiurani/rules_rust<filename>crate_universe/crates_deps.bzl
"""Transitive dependencies of the `cargo-bazel` Rust target"""
load("@crate_index//:defs.bzl", _repository_crate_repositories = "crate_repositories")
load("//crate_universe:crates.bzl", "USE_CRATES_REPOSITORY")
def crate_repositories():
if USE_... | StarcoderdataPython |
1963393 | #!/usr/bin/env python3
import cv2
import numpy as np
import sys
import os
import io
import open3d as o3d
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-n", "--npzfile", type=str,
help="Full path to data file", required=True)
options = parser.parse_args()
npzdata = np.... | StarcoderdataPython |
4820635 | <reponame>patsevanton/ansible-freeipa-server<filename>files/patches/fix-google-authenticator-qr-code-recognition-otptoken.py
--- a/usr/lib/python2.7/site-packages/ipaserver/plugins/otptoken.py
+++ b/usr/lib/python2.7/site-packages/ipaserver/plugins/otptoken.py
@@ -228,10 +228,10 @@
cli_name='algo',
... | StarcoderdataPython |
194848 | <reponame>iotile/iotile_cloud
from django.apps import AppConfig
class OrgtemplateConfig(AppConfig):
name = 'apps.orgtemplate'
| StarcoderdataPython |
12837464 | from .classification import *
from .conll import *
from .metric import *
from .transform import *
from .workspace import *
from .pattern import *
| StarcoderdataPython |
6688073 | <reponame>gyan42/rl_flappy_bird
import torch
from fb.nn.conv_net import NeuralNetwork
from fb.utils import resize_and_bgr2gray, image_to_tensor
def test(model: NeuralNetwork,
game_state):
# initial action is do nothing
action = torch.zeros([model.number_of_actions], dtype=torch.float32)
action[0]... | StarcoderdataPython |
21322 | <gh_stars>1-10
from sepal_ui import model
from traitlets import Any
class DmpModel(model.Model):
# inputs
event = Any(None).tag(sync=True)
username = Any(None).tag(sync=True)
password = Any(None).tag(sync=True)
| StarcoderdataPython |
6515561 | <reponame>endofsamsara/CMPS242
import codecs
class VectorWriter:
def __init__(self, filepath):
self.out = codecs.open(filepath, 'w', 'utf-8')
def __enter__(self):
return self
def __exit__(self, exc_type, exc_val, exc_tb):
self._end_write()
def write_row(self, label, vector):... | StarcoderdataPython |
5179614 | # -*- coding: utf-8 -*-
'''
In this excercise we model the MNIST dataset using only linear layers.
In this exercise we'll use the same logic laid out in the ANN notebook.
We'll reshape the MNIST data from a 28x28 image to a flattened 1x784 vector
to mimic a single row of 784 features.
We used nn.module and nn.linear, b... | StarcoderdataPython |
12808703 | from django.utils import unittest
import mock
from tests.utils.remote_firewall_control import RemoteFirewallControl
from tests.utils.remote_firewall_control import RemoteFirewallControlIpTables
from tests.utils.remote_firewall_control import RemoteFirewallControlFirewallCmd
from tests.integration.core.remote_operation... | StarcoderdataPython |
336439 | # -*- coding: utf-8 -*-
from django.apps import AppConfig
class TransitionAppConfig(AppConfig):
name = 'ralph.lib.transitions'
verbose_name = 'Transitions'
| StarcoderdataPython |
8184455 | # coding=utf-8
# Copyright (C) 2019 ATHENA AUTHORS; <NAME>; <NAME>; <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | StarcoderdataPython |
11352305 | <gh_stars>0
"""
The log module that is used entire application.
"""
import logging
from settings import LOGGER_NAME, LOG_LEVEL, FILENAME, FORMAT
def _get_logger():
logging.basicConfig(
filename=FILENAME,
level=logging.ERROR,
format=FORMAT
)
module_logger = loggin... | StarcoderdataPython |
3556823 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import annotations
import string
from typing import Dict, List, Sequence, Optional, Set
from mypy_extensions import TypedDict
from utils import read_input
Task = TypedDict("Task", {"name": str, "time": int, "pre_tasks": Set[str]})
class Worker(object)... | StarcoderdataPython |
4935105 | from copy import deepcopy
from itertools import chain
import numpy as np
import os
import pandas as pd
from pele_platform.Utilities.Helpers.yaml_parser import YamlParser
from pele_platform.Utilities.Parameters.parameters import Parameters
class PreEquilibrator:
def __init__(self, args: YamlParser, parameters: P... | StarcoderdataPython |
1737359 | <reponame>naveenbanda/Fire2017-NepalQuake-Tweets-Matching<filename>microblogs-crawl-directory/wriggler/twitter/stream.py
"""
Robust Twitter streaming API interface.
"""
import ssl
import httplib
from time import sleep
from requests_oauthlib import OAuth1
from wriggler import log
from wriggler.twitter import list_to_... | StarcoderdataPython |
5161544 | from django.db.models.signals import post_save
from django.dispatch import receiver
from .models import Course
from user.models import CreatorProfile
from django.core.mail import send_mail
from SULearn.settings import EMAIL_HOST_USER
from .models import Course
@receiver(post_save, sender=Course)
def send_post_mail(sen... | StarcoderdataPython |
6679125 | import discord
import sys
import os
client = discord.Client()
token = os.environ['token']
@client.event
async def on_ready():
print(f"We have logged in as {client.user}")
@client.event
async def on_message(message):
print(f"{message.channel}: {message.author}: {message.author.name}: {message.content}")
if "logou... | StarcoderdataPython |
6702922 | <filename>tests/cupy_tests/binary_tests/test_packing.py
import numpy
import unittest
import pytest
import cupy
from cupy import testing
@testing.gpu
class TestPacking(unittest.TestCase):
@testing.for_int_dtypes()
@testing.numpy_cupy_array_equal()
def check_packbits(self, data, xp, dtype):
# Note ... | StarcoderdataPython |
49964 | <filename>iceworm/trees/_antlr/__init__.py
from .IceSqlLexer import IceSqlLexer # noqa
from .IceSqlLexer import IceSqlParserConfig # noqa
from .IceSqlListener import IceSqlListener # noqa
from .IceSqlListener import IceSqlParserConfig # noqa
from .IceSqlParser import IceSqlParser # noqa
from .IceSqlParser import I... | StarcoderdataPython |
6564466 | """channelworm URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | StarcoderdataPython |
5072141 | <filename>hello4.10.py
#!/data/data/com.termux/files/usr/bin/python3
import requests, random, os, threading, sys, time, csv, datetime
#主界面函数
def advancedio():
#print(str(sys.argv)) #第0个一般是代码文件名本身
if len(sys.argv) == 1: #如果直接运行,进入main
newloginer(mode=0)
command = input()
if command == "... | StarcoderdataPython |
5068606 | <filename>tests/test_config.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from nose.tools import eq_
from nose.tools import raises
from locust_swarm.config import DEFAULT_CFG_FILEPATH
from locust_swarm.config import DEFAULT_MASTER_ROLE_NAME
from locust_swarm.config import DEFAULT_SLAVE_ROLE_NAME
from locust_swarm.c... | StarcoderdataPython |
6603229 | <reponame>Syhen/leet-code<gh_stars>0
# -*- coding: utf-8 -*-
"""
create on 2020-04-16 16:10
author @66492
"""
import numpy as np
def sigmoid(x):
"""
`sigmoid(x) = \frac{1}{1 + e^{-x}}`
:param x: number or vector.
:return: np.array.
"""
return 1 / (1 + np.exp(-x))
| StarcoderdataPython |
3598808 | <reponame>CypElf/Magic-maze
"""
This module includes all the game logic.
"""
from random import choice, choices
from operator import add
from time import time
from json import dump, load
from copy import deepcopy
from itertools import cycle
import src.game_state as gs
from src.timer import invert_timer, adjust_timer
f... | StarcoderdataPython |
3584436 | # -*- encoding: utf-8 -*-
'''
@File : gateway.py
@License : (C)Copyright 2017-2018, Liugroup-NLPR-CASIA
@Modify Time @Author @Version @Desciption
------------ ------- -------- -----------
2021/4/1 20:30 <NAME> 1.0 None
'''
from abc import ABC, abstractmethod
from typing... | StarcoderdataPython |
1637043 | #!/usr/bin/env python
# Requirements:
# pip install tk
# pip install pillow
#from Tkinter import *
#from PIL import Image
#from PIL import ImageTk
import numpy as np
import cv2, threading, os, time
from threading import Thread
from os import listdir
from os.path import isfile, join
import rospkg
import Queue
import w... | StarcoderdataPython |
4882955 | <reponame>pierredup/sentry
from __future__ import absolute_import
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from rest_framework import serializers
from sentry.api.serializers.rest_framework.base import (
CamelSnakeModelSerializer,
CamelSnakeSerializer,
con... | StarcoderdataPython |
378563 | #!/usr/bin/env python
'''
'''
import numpy as np
from .radar_controller import RadarController
class Tracker(RadarController):
'''Takes in ECEF points and a time vector and creates a tracking control.
'''
META_FIELDS = RadarController.META_FIELDS + [
'dwell',
'target',
]
... | StarcoderdataPython |
6535807 | <gh_stars>0
'''
Created on 16 de jul. de 2021
Conversor de Texto para Audio
@author: <NAME>
'''
# -*- encoding: utf-8 -*-
import pyttsx3
texto = "Olá tudo bem com vocês hoje iremos um programa diferente"
pyt = pyttsx3.init()
voices = pyt.getProperty('voices')
for voice in voices:
print(voice, voi... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.