id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
71775 | <reponame>fsadannn/nauta-cli
# -*- coding: utf-8 -*-
import sys
from cx_Freeze import setup, Executable
base = None
if sys.platform == 'win32':
base = 'Win32GUI'
base2 = None
if sys.platform == 'win32':
base2 = 'Console'
options = {
'build_exe': {
'includes': ['atexit', 'nauta'],
'package... | StarcoderdataPython |
6416425 | import pandas as pd
import anndata as ad
from bin.interpreting_sc.analyse_features import get_cell_weights
import scanpy as sc
from kme.tools.config import load_config
from bin.interpreting_sc.analyse_features import example_based, load_gene_names
def make_andata(config_path, markers_path):
df, labels, markers = ... | StarcoderdataPython |
11203873 | # ***************************************************************
# Copyright (c) 2021 Jittor. All Rights Reserved.
# Maintainers:
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>.
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
# *********... | StarcoderdataPython |
9784802 | from flask_restplus import Namespace, fields
class AuthorDto:
api = Namespace('author', description='Manage authors')
author = api.model('author', {
'id': fields.String(required=True, description='author id'),
'name': fields.String(required=True, description='author name')
})
| StarcoderdataPython |
8125287 | from fixture.session import SessionHelper
from steps.homepage_steps import HomepageActions
from steps.catalog_steps import CatalogActions
from steps.results_steps import ResultsPageActions
import webium.settings
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
import webium.setti... | StarcoderdataPython |
9643355 | #
# @lc app=leetcode.cn id=19 lang=python3
#
# [19] 删除链表的倒数第N个节点
#
# https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/description/
#
# algorithms
# Medium (32.36%)
# Total Accepted: 35.9K
# Total Submissions: 109.2K
# Testcase Example: '[1,2,3,4,5]\n2'
#
# 给定一个链表,删除链表的倒数第 n 个节点,并且返回链表的头结点。
#
# 示例:
... | StarcoderdataPython |
300377 | <gh_stars>1-10
from __future__ import division
import os.path
from .listdataset import ListDataset
import numpy as np
import random
import flow_transforms
import pdb
import glob
from tqdm import tqdm
from tqdm import trange
try:
import cv2
except ImportError as e:
import warnings
with warnings.catch_warn... | StarcoderdataPython |
9633697 | <filename>map_ops/walk.py<gh_stars>0
from typing import Any, Callable
__all__ = ["walk"]
def walk(
d1: dict,
d2: dict,
initializer: Callable[[dict, dict], dict] = None,
on_missing: Callable[[Any], Any] = None,
on_match: Callable[[Any, Any], Any] = None,
on_mismatch: Callable[[Any, Any], Any]... | StarcoderdataPython |
1679109 | import sys
def to_utf8(value):
"""
Converts value to string encoded into utf-8
:param value:
:return:
"""
if sys.version_info[0] < 3:
if not isinstance(value, basestring):
value = unicode(value)
if type(value) == str:
value = value.decode("utf-8", errors... | StarcoderdataPython |
4820947 | <gh_stars>1-10
"""
This is basically poached from
urbansim.scripts.cache_to_hdf5.py
But it makes it easier to load a few tables into a notebook without
having to copy/convert the entire cache into a h5 file.
"""
import glob
import os
import numpy as np
import pandas as pd
def opus_cache_to_df(dir_path):
"""... | StarcoderdataPython |
1717341 | <filename>src/maskers.py
#takes polygon coordinates and creates an image mask
import numpy as np
import mahotas
import Polygon, Polygon.IO, Polygon.Utils
from copy import deepcopy
def polymask(imgf,aoic,logger): #aoic list like [[x1,y1,x2,y2,x3,y3...],[x1,y1,x2,y2,x3,y3...]] or [x1,y1,x2,y2,x3,y3...]
logger.set... | StarcoderdataPython |
1652377 | from Const import Const
class Token(Const):
"""
The Token class represents tokens in the language.
For simple syntax analysis, a token object need only
include a code for the token’s type,
such as was used in earlier examples in this chapter.
However, a token can include other attributes,
such as an identifier... | StarcoderdataPython |
3348193 | <reponame>dmartinpro/microhomie
import settings
from homie.constants import FALSE, TRUE, BOOLEAN
from homie.device import HomieDevice
from homie.node import HomieNode
from homie.property import HomieNodeProperty
from machine import Pin
# reversed values for the esp8266 boards onboard led
ONOFF = {FALSE: 1, TRUE: 0, 1... | StarcoderdataPython |
11358248 | from datetime import date
import re
from invoke import task
from emmet import __version__
@task
def setver(c):
# Calendar versioning (https://calver.org/), with a patch segment
# for release of multiple version in a day (should be rare).
new_ver = date.today().isoformat().replace("-", ".")
if __vers... | StarcoderdataPython |
1972214 | def get_checkout_inlines():
from .admin import DiscountInline
return [DiscountInline]
def calculate_discounts(*args, **kwargs):
from .util import calculate_discounts
return calculate_discounts(*args, **kwargs)
def save_discounts(*args, **kwargs):
from .util import save_discounts
return save_... | StarcoderdataPython |
5019336 | <filename>api/jobs/batch.py
"""
Batch
"""
import bson
import copy
import datetime
from .. import config
from ..dao.containerstorage import AcquisitionStorage, AnalysisStorage
from .jobs import Job
from .queue import Queue
from ..web.errors import APINotFoundException, APIStorageException
from . import gears
log = con... | StarcoderdataPython |
3209344 | <gh_stars>1-10
from src.alert.messenger import TelegramMessenger
from src.record.microphone import audio_files
def run(messenger: TelegramMessenger, timeout: int):
"""
Records a bunch of non-silent samples for `timeout` minutes.
All of the non-silent samples will be saved in data/live/.
Notifies you ... | StarcoderdataPython |
319063 | <gh_stars>1-10
# @author: <NAME>
# @description: Utilities for hotspotd
# @license: MIT
import logging
import logging.config
import pickle
import socket
import subprocess
import sys
from os import path
import six
from .config import LOG_CONFIG
logging.config.dictConfig(LOG_CONFIG)
logger = logging.getLogger('hotspot... | StarcoderdataPython |
169339 | <filename>test/integration/test_command.py
import os.path
import re
from six import assertRegex
from . import *
class TestCommand(IntegrationTest):
def __init__(self, *args, **kwargs):
IntegrationTest.__init__(
self, os.path.join(examples_dir, '07_commands'), *args, **kwargs
)
de... | StarcoderdataPython |
1992414 | import pandas as pd
import datetime
today = datetime.date.today()
def load_today(db):
q = db.PaperDB.select().where(db.PaperDB.pubdate==today)
df = pd.DataFrame(list(q.dicts()))
return df
def load_this_week(db):
delta = (today+datetime.timedelta(days=1)) - datetime.timedelta(days=8)
q = db.PaperD... | StarcoderdataPython |
4900026 |
detected_emotions = ['Angry', 'Fear', 'Happy', 'Sad', 'Surprise', 'Neutral']
emotions_values = {'Angry': 0, 'Disgust': 1, 'Fear': 2, 'Happy': 3,
'Sad': 4, 'Surprise': 5, 'Neutral': 6}
model_weights_path = 'model/weights/fer2013_weights.h5'
verbose = True
| StarcoderdataPython |
255887 | import splunk.admin as admin
class ConfigApp(admin.MConfigHandler):
def setup(self):
if self.requestedAction == admin.ACTION_EDIT:
for arg in ['location', 'optimize', 'proxy']:
self.supportedArgs.addOptArg(arg)
def handleList(self, confInfo):
conf_dict = self.readC... | StarcoderdataPython |
200236 | <gh_stars>0
from setuptools import dist, setup, Extension
# bootstrap numpy; can we workaround this?
dist.Distribution().fetch_build_eggs(["numpy>=1.14.5"])
# should be fine now
import numpy as np
def readme():
with open("README.rst") as f:
return f.read()
setup(
name="egrm",
version="0.1",
... | StarcoderdataPython |
6560417 | '''
Test 1 preaccept, 1 sni, and 1 cert callback (with delay)
'''
# 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 this file
# to you... | StarcoderdataPython |
3413758 | #!/usr/bin/env python
'''
I was in the middle of implementing string-based binary long division,
then just tried it in the console. Feels like cheating, but the problem is
easy with the right tools, I guess.
'''
print sum(int(s) for s in "{}".format(2**1000))
| StarcoderdataPython |
8082942 | <filename>eepackages/utils.py
from ctypes import ArgumentError
from itertools import repeat
import multiprocessing
import os
from typing import Any, Callable, Dict, Optional
import requests
import shutil
from pathlib import Path
import math
import ee
import ee
from retry import retry
# /***
# * The script computes su... | StarcoderdataPython |
1810251 | <reponame>yuanchi2807/ray<filename>python/ray/data/impl/fast_repartition.py<gh_stars>1-10
import ray
from ray.data.block import BlockAccessor
from ray.data.impl.block_list import BlockList
from ray.data.impl.plan import ExecutionPlan
from ray.data.impl.progress_bar import ProgressBar
from ray.data.impl.remote_fn impor... | StarcoderdataPython |
17347 | <reponame>coblo/smartlicense<filename>smartlicense/settings/__init__.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Django settings for smartlicense project.
Generated by 'django-admin startproject' using Django 2.0.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For th... | StarcoderdataPython |
5048357 | class Json_Data():
#ACCEPTS A STRING
def search_results_json(item, function, result):
json_data = "[{\"function\": \""+ function +"\"}, {\"result\": \""+ str(result) +"\"}, "
if(function == "find"):
item = item.split(", \n")
for item_type in item:
json_data +=... | StarcoderdataPython |
6492967 | <filename>lib/Engine.py
from re import search
from requests import get
from github import Github
from time import time,sleep
from pybase64 import b64decode
from bs4 import BeautifulSoup
from termcolor import colored
from lib.Functions import shannon_entropy
from lib.Globals import hexchar, base64char, search_regex
fr... | StarcoderdataPython |
12824241 | # 装饰器作用:对已有函数进行额外功能扩展,本质上是一个闭包函数,也是一个函数嵌套
# 装饰器的执行时机:装饰器在加载代码时已经执行
# 装饰器特点:
# 1.不修改已有函数的源代码
# 2.不修改已有函数调用方式
# 3.给已有函数添加额外功能
def decorator(func): # 如果一个闭包函数有且仅有一个函数参数,那这个闭包函数称为装饰器
def inner():
# 在内部函数对已有函数进行调用
print("装饰器已经执行了") # 测试装饰器的执行时机:作为模块导入时,不用执行comment函数,装饰器在加载代码时已经执行
print("添加登录验证"... | StarcoderdataPython |
11605 | <reponame>BeltetonJosue96/Ejercicio3Python
class Ciclo:
def __init__(self):
self.cicloNew = ()
self.respu = ()
self.a = ()
self.b = ()
self.c = ()
def nuevoCiclo(self):
cicloNew = []
print(" ")
print("Formulario de ingreso de ciclos")
prin... | StarcoderdataPython |
348486 | <reponame>tirmisula/Hybrid-NN-Movie-Recommendation-System<gh_stars>0
import os
try:
os.environ["PYSPARK_PYTHON"]="/usr/local/Cellar/python3/3.6.3/bin//python3"
except:
pass
os.environ["PYSPARK_PYTHON"]="/usr/local/Cellar/python3/3.7.3/bin/python3"
import pyspark
import random
import pandas as pd
import math
imp... | StarcoderdataPython |
8193859 | <reponame>coproc/PolyPieces<gh_stars>0
#------------ CODE INIT ------------
# make sure imports from ../src work
import os, sys
FILE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(FILE_DIR, os.pardir, 'src'))
# simulate console output of expressions
_p_ = None
# print result of last expr... | StarcoderdataPython |
8070368 | <filename>train_procgen/test_select.py
"""
To run test: (default we do 50 batch rollouts)
$ python train_procgen/test_select.py --start_level 50 -id 0 --load_id 0 --use "randcrop"
$ python train_procgen/test_select.py --start_level 50 -id 0 --load_id 0 --use "cutout"
$
"""
import os
from os.path import join
import jso... | StarcoderdataPython |
5006186 | <reponame>rsmonteiro2021/execicios_python<gh_stars>1-10
filename = 'pi_million_digits.txt'
with open(filename) as file_object:
lines = file_object.readlines()
pi_string_v2 = ''
for line in lines:
pi_string_v2 += line.strip()
print(pi_string_v2[:52] + '...')
print(len(pi_string_v2))
birthday = input(... | StarcoderdataPython |
193638 | #!/usr/bin/env python
from __future__ import print_function
import os
import sys
from common import update
try:
data = {}
data['update_type'] = 'sample_dataset_transfer_status'
data['sample_dataset_ids'] = sys.argv[3].split(',')
data['new_status'] = sys.argv[4]
except IndexError:
print('usage: %s... | StarcoderdataPython |
11876 | <reponame>ZiegHailo/SMUVI
__author__ = 'zieghailo'
import matplotlib.pyplot as plt
# plt.ion()
def show():
plt.show()
plt.get_current_fig_manager().full_screen_toggle()
def plot_graph(graph):
# plt.ion()
x = [p.x for p in graph.points]
y = [p.y for p in graph.points]
plt.plot(x, y, 'b*')
... | StarcoderdataPython |
3413596 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | StarcoderdataPython |
64063 | <reponame>pandeykiran80/ref
import numpy as np
import toolbox
import pylab
from scipy.signal import butter, lfilter, convolve2d
from scipy.interpolate import RectBivariateSpline as RBS
from scipy.interpolate import interp2d
from scipy.interpolate import interp1d
from scipy.interpolate import griddata
import matplotlib... | StarcoderdataPython |
5126435 | # Generated by Django 2.1.5 on 2019-01-07 07:49
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('main', '0002_archivourl'),
]
operations = [
migrations.AddField(
model_name='url',
... | StarcoderdataPython |
87806 | <reponame>calebschmidt/superfluid<filename>tests.py
# Placeholder for now...
| StarcoderdataPython |
4829205 | # Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modif... | StarcoderdataPython |
1756301 | <reponame>ZaydH/ams230
import math
import os
import sys
from typing import List, Callable
import numpy as np
class TrustRegion:
UNIFORM_MIN = 10
UNIFORM_MAX = 1000
DELTA_0 = 1
DELTA_MAX = 10000
EPSILON = 10 ** -8
TOLERANCE = 10 ** -12
def __init__(self, n: int):
"""
... | StarcoderdataPython |
11321456 | <filename>icls/datasets/__init__.py
from .imagenet import ImagenetDataset
__all__ = ["ImagenetDataset"]
| StarcoderdataPython |
6406380 | <gh_stars>100-1000
from typing import Any, Sequence
from multimethod import multimethod
from visions.relations import IdentityRelation, TypeRelation
from visions.types.file import File
from visions.types.type import VisionsBaseType
class Image(VisionsBaseType):
"""**Image** implementation of :class:`visions.typ... | StarcoderdataPython |
5079043 | <reponame>Bfaschat/EduuRobot
import config
import urllib
bot = config.bot
def prints(msg):
if msg.get('text'):
if msg['text'].startswith('/print ') or msg['text'].startswith('!print '):
try:
bot.sendPhoto(msg['chat']['id'], f"https://api.thumbnail.ws/api/{config.keys['screensh... | StarcoderdataPython |
1722405 | """
【Python生成器】生成器小案例 2019/10/07 14:51
"""
# from collections import Iterable,Iterator
#TODO: 生成器中的return语句会触发StopIterator异常:
# def my_gen(start):
# while start < 10:
# yield start
# start += 1
# return 'hello world!'
# ret = my_gen(1)
# print(next(ret))
# try:
# next(ret)
# except E... | StarcoderdataPython |
3576714 | #!/usr/bin/python
# -*- coding:utf-8 _*-
# # FileName : book_urls
# # Author : <NAME> <<EMAIL>>
# # Created : 2018/2/7
# # Copyright : 2018-2020
# # Description :
import os
def getallfiles(path):
allfile = []
allname = []
for dirpath, dirnames, filenames in os.walk(path):
for name... | StarcoderdataPython |
6560019 | """
Shell Sort
Approach: Divide and Conquer
Complexity:
Best case -> O(nlogn)
Worst case -> O(n2)
"""
def swap(a, b, c):
t = a # a
a = b # b
b = c # c
c = t
def sort_quick_partition(input_arr, i, j, p):
if input_arr[i] > input_arr[p]:
temp = input_arr[i]
input_arr[i] = input... | StarcoderdataPython |
11271526 | '''
3-Crie um programa que leia dois números e mostre a soma entre eles.
'''
n1 = int(input("Primeiro numero: "))
n2 = int(input("Segundo numero: "))
soma = n1 + n2
print("A soma entre {} e {} = {}".format(n1, n2, soma))
| StarcoderdataPython |
5097167 | a = 1
b = 2
print(b)
print(A)
| StarcoderdataPython |
6580563 | <filename>SIR_models.py
import os
import numpy as np
import pandas as pd
from scipy.integrate import solve_ivp
from scipy.optimize import minimize
import matplotlib.pyplot as plt
from datetime import timedelta, datetime
import datetime as dt
yellow = (240/255, 203/255, 105/255)
grey = (153/255, 153/255, 153/255)
fad... | StarcoderdataPython |
8174881 | # Generated by Django 3.1 on 2021-02-28 10:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sample', '0018_auto_20210228_1023'),
]
operations = [
migrations.AlterField(
model_name='communityactivitymetadata',
n... | StarcoderdataPython |
6436038 | import os
import tempfile
from typing import List
import pytest
from bs4 import BeautifulSoup
from json_schema_for_humans.generate import generate_from_file_object, generate_from_schema
from tests.test_utils import _get_test_case_path
def _generate_case(
case_name: str, find_deprecated: bool = False, find_defau... | StarcoderdataPython |
1700125 | <reponame>maxiwoj/PostTruthDetector<filename>tests/test_sample.py<gh_stars>1-10
import unittest
from post_truth_detector import RestApiException, site_unreliability, \
fact_unreliability, count, google_search, sentiment_analysis
from post_truth_detector.learn.relativeness_learn import map_state
class TestRemotes... | StarcoderdataPython |
8153533 | """ Approach using NLTK and a predefined grammar based on ReVerb System (Fader et al. 2011)
* run POS tagger and entity chunker over each sentence
* for every verb chunk, find the nearest noun chunk to the left and the right of the verb
"""
import de_core_news_sm
import nltk
from nltk.tokenize import sent_tokenize
fr... | StarcoderdataPython |
4981100 | # Description
# 中文
# English
# Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings are grouped consecutively.
# Substrings that occur multiple times are counted the number of times they occur.
# s.length w... | StarcoderdataPython |
12845926 | survey_data = survey_data_unique.dropna(subset=['species']).copy() | StarcoderdataPython |
18714 | <filename>networkx/algorithms/tests/test_cuts.py
"""Unit tests for the :mod:`networkx.algorithms.cuts` module."""
import networkx as nx
class TestCutSize:
"""Unit tests for the :func:`~networkx.cut_size` function."""
def test_symmetric(self):
"""Tests that the cut size is symmetric."""
G = ... | StarcoderdataPython |
190576 | <gh_stars>0
X = 'spam'
Y = 'eggs'
# will swap
X, Y = Y, X
print((X, Y)) | StarcoderdataPython |
1739091 | # -*- coding: UTF-8 -*-
"""
Author:wistn
since:2020-10-05
LastEditors:Do not edit
LastEditTime:2021-03-04
Description:
"""
from .org_noear_siteder_models_PicModel import PicModel
from .org_noear_siteder_viewModels_ViewModelBase import ViewModelBase
from .org_noear_siteder_dao_engine_DdSource import DdSource
from .mytoo... | StarcoderdataPython |
1753181 | <reponame>insilichem/gpathfinder
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##############
# GPathFinder: Identification of ligand pathways by a multi-objective
# genetic algorithm
#
# https://github.com/insilichem/gpathfinder
#
# Copyright 2019 <NAME>, <NAME>,
# <NAME>, <NAME>,
# <NAME> and <NAME>
#
# Licensed und... | StarcoderdataPython |
1777472 | # test file for PFCandidate validation
# performs a matching with the genParticles collection.
# creates a root file with histograms filled with PFCandidate data,
# present in the Candidate, and in the PFCandidate classes, for matched
# PFCandidates. Matching histograms (delta pt etc) are also available.
import FWCo... | StarcoderdataPython |
6598441 | #! /usr/bin/env python3
""" command line utility to check virustotal for reports re a file or sha256 hash """
import argparse
import os
import sys
import pprint
import virustotal
def create_parse():
""" set up CLI parser """
parser = argparse.ArgumentParser(description="virustotal file report retriever")
... | StarcoderdataPython |
3442319 | #coding=utf8
import config
from base64 import urlsafe_b64encode
class Service:
"""
* QBox Resource Storage (Key-Value) Service
* QBox 资源存储(键值对)。基本特性为:每个账户可创建多个表,每个表包含多个键值对(Key-Value对),Key是任意的字符串,Value是一个文件。
"""
def __init__(self, conn, tblName=''):
self.Conn = conn
self.Table... | StarcoderdataPython |
12865491 | '''ResNet in PyTorch.
For Pre-activation ResNet, see 'preact_resnet.py'.
Reference:
[1] <NAME>, <NAME>, <NAME>, <NAME>
Deep Residual Learning for Image Recognition. arXiv:1512.03385
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
class BasicBlock(nn.Module):
expansion = ... | StarcoderdataPython |
4932303 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
@author: <NAME>
@email: <EMAIL>
@time: 8/19/21 5:32 PM
"""
import time
import numpy as np
import transforms3d as t3d
import open3d as o3
# from helpers import find_correspondences, get_teaser_solver, Rt2T
from helpers import find_correspondences, Rt2T
from vis import draw_regi... | StarcoderdataPython |
6530217 | <reponame>stormpath/stormpath-django
from django.conf.urls import url
from django.conf import settings
from django_stormpath import views
urlpatterns = [
url(r'^login/$', views.stormpath_id_site_login, name='stormpath_id_site_login'),
url(r'^logout/$', views.stormpath_id_site_logout, name='stormpath_id_site_... | StarcoderdataPython |
1908856 | <reponame>eprouty/the_wheel
import json
import logging
import os
import requests
import requests_cache
from datetime import datetime, timedelta
from flask import session, redirect, request, url_for
from flask.json import jsonify
from flask_login import login_required, current_user
from requests_oauthlib import OAuth2S... | StarcoderdataPython |
1922335 | <reponame>jasonsatran/duckrun<filename>tests/test_process_report.py
import unittest
from duckrun.process_report import ProcessReport
class MainTest(unittest.TestCase):
# is the relative path the path to this file or the path where python was started
def test_it_formats_seconds(self):
test_cases = [1... | StarcoderdataPython |
332514 | #!/usr/bin/env python
import sys
from frovedis.exrpc.server import FrovedisServer
from frovedis.linalg import eigsh
from scipy.sparse import coo_matrix
desc = "Testing eigsh() for coo_matrix: "
# initializing the Frovedis server
argvs = sys.argv
argc = len(argvs)
if argc < 2:
print ('Please give frovedis_server ... | StarcoderdataPython |
1622073 | from gtts import gTTS
from playsound import playsound
# Custome Modules
from remove_file import remove_file
def text_to_speech(text):
audio_file = "audio.mp3"
remove_file(audio_file)
language = 'en'
myobj = gTTS(text=text, lang=language, slow=False)
myobj.save(audio_file)
playsound(audio_fil... | StarcoderdataPython |
8128411 | <gh_stars>0
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
from sklearn.neighbors import KNeighborsClassifier
from sklearn.svm import SVC
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
import matplotlib.pyplot as plt
"""
Predicitve_Analytics.py
"""
... | StarcoderdataPython |
4960099 | <gh_stars>10-100
# Copyright 2021 The FastEstimator Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | StarcoderdataPython |
60631 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Routines related to the canonical Chandra ACA dark current model.
The model is based on smoothed twice-broken power-law fits of
dark current histograms from Jan-2007 though Aug-2017. This analysis
was done entirely with dark current maps scaled to -1... | StarcoderdataPython |
1984497 | <filename>staticgenerator/middleware.py
import re
from django.conf import settings
from staticgenerator import StaticGenerator
class StaticGeneratorMiddleware(object):
"""
This requires settings.STATIC_GENERATOR_URLS tuple to match on URLs
Example::
STATIC_GENERATOR_URLS = (
... | StarcoderdataPython |
286977 | <reponame>yage99/tensorflow
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | StarcoderdataPython |
12804601 | <reponame>jhkim-spa/CVNet
import copy
import numpy as np
import torch
from mmcv.cnn import ConvModule, build_conv_layer, kaiming_init
from mmcv.runner import force_fp32
from torch import nn
from mmdet3d.core import (circle_nms, draw_heatmap_gaussian, gaussian_radius,
xywhr2xyxyr)
from mmdet3d... | StarcoderdataPython |
5102723 | """ Implements exhaustive best subset regression for ESL."""
import numpy as np
import copy
import itertools as itr
from typing import List
from sklearn.linear_model import LinearRegression
from .esl_regressor import EslRegressor
class BestSubsetRegression(EslRegressor):
""" Exhaustive best subset regression for... | StarcoderdataPython |
1660496 | from scipy import linalg
import numpy as np
import matplotlib.cm as cm
from matplotlib.mlab import bivariate_normal
import matplotlib.pyplot as plt
# %matplotlib inline
# == Set up the Gaussian prior density p == #
Σ = [[0.3**2, 0.0], [0.0, 0.3**2]]
Σ = np.matrix(Σ)
x_hat = np.matrix([0.5, -0.5]).T
# == Define the m... | StarcoderdataPython |
4847475 | <reponame>ryankim5/burglar-alarm
from burglar_alarm import lcd, Keypad, wait, distance, buzzer
from datetime import datetime
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
# MatrixKeypad Settings
ROWS = 4
COLS = 4
KEYS = [
'1', '2', '3', 'A',
'4', '5', '6', 'B',
'7', '8', '9', 'C',
'*', '0', '#', 'D'... | StarcoderdataPython |
9610286 |
def render_template(gadget):
RN = "\r\n"
p = Payload()
p.header = "__METHOD__ __ENDPOINT__?cb=__RANDOM__ HTTP/1.1" + RN
p.header += gadget + RN
p.header += "Host: __HOST__" + RN
p.header += "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.... | StarcoderdataPython |
6559750 | <reponame>JeremySun1224/Algorithms-and-Data_Structures
# -*- coding: utf-8 -*-
# -*- author: JeremySun -*-
# -*- dating: 21/4/7 -*-
"""用树结构实现文件系统,树往往是通过链式结构存储的"""
class Node(object):
def __init__(self, name, type='dir'):
self.name = name
self.type = type
self.children = []
... | StarcoderdataPython |
1871009 | # Copyright (C) 2020 University of Glasgow
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following d... | StarcoderdataPython |
332577 | #!/usr/bin/env python3
import numpy as np
import os
import sys
from subprocess import run
from astropy.io import fits
import time
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('-n' ,'--nnodes', type=int, default=30,
help='Number of nodes to take up')
parser.add_... | StarcoderdataPython |
9621674 | from flask import Flask
from flask_cors import CORS
from flask_bcrypt import Bcrypt
from flask_jwt_extended import JWTManager, get_jwt
from flaskconfig import *
from util.logger import logger
app = Flask(__name__)
try:
app.config.from_object(configmap[app.config['ENV']]())
except KeyError:
logge... | StarcoderdataPython |
12859524 | #!/bin/usr/python
# -*- coding:utf-8 -*-
# 628.三个数的最大乘积
class Solution:
def maximumProduct(self, nums):
if len(nums) == 3:
return nums[0] * nums[1] * nums[2]
elif len(nums) < 3:
return None
else:
z_num, f_num = [], []
for i in nums:
... | StarcoderdataPython |
11284106 | import codecs
import os
import re
from setuptools import setup
HERE = os.path.abspath(os.path.dirname(__file__))
'''Next two functions borrowed from pip's setup.py'''
def read(*parts):
# intentionally *not* adding an encoding option to open
# see: https://github.com/pypa/virtualenv/issues/201#issuecomment-31... | StarcoderdataPython |
9641100 | <reponame>LeLocTai/keypirinha-currency
# Keypirinha launcher (keypirinha.com)
import keypirinha as kp
import keypirinha_util as kpu
import keypirinha_net as kpnet
from .exchange import ExchangeRates, UpdateFreq
import re
import json
import traceback
import urllib.error
import urllib.parse
from html.parser import HTM... | StarcoderdataPython |
5018053 |
a.insert(0, 'x')
b.append(a.pop())
del c[4]
| StarcoderdataPython |
5034003 | from output.models.nist_data.atomic.long.schema_instance.nistschema_sv_iv_atomic_long_min_exclusive_2_xsd.nistschema_sv_iv_atomic_long_min_exclusive_2 import NistschemaSvIvAtomicLongMinExclusive2
__all__ = [
"NistschemaSvIvAtomicLongMinExclusive2",
]
| StarcoderdataPython |
3237843 | <filename>volt_err_corr_sim_data.py
# -*- coding: utf-8 -*-
"""
Created by <NAME>
This script aims to reproduce the results shown in Fig.2 (open symbols)
from Ref. Specifically, currents generated from PKA-treated GluR6 receptors.
Simulated data are generated importing "exponential.py" and are corrected
following the ... | StarcoderdataPython |
11255939 | <reponame>hoppfull/Legacy-Python
import numpy as np
def myLinear_Regression(DATASETlinreg, parameters, iterations, learningrate = 0.1):
#Loading data into appropriate variables:
m = DATASETlinreg.shape[0] #Number of training examples
n = DATASETlinreg.shape[1] #Number of features
y_raw = np.... | StarcoderdataPython |
4992945 | """Blockly Games: Turtle/Movie to Reddit Submission
Copyright 2014 Google Inc.
https://github.com/google/blockly-games
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/licen... | StarcoderdataPython |
294742 | <filename>ibata/downloaders/TransactionDownloaderResolver.py
import sys
from ibata.downloaders.FioTransactionDownloader import FioTransactionDownloader
class TransactionDownloaderResolver:
"""
Class that resolves which TransactionDownloader should be used. If new TransactionDownloader is created
it must ... | StarcoderdataPython |
11303723 | <reponame>coderMaruf/leetcode-1
'''
Description:
Given an integer array arr, and an integer target, return the number of tuples i, j, k such that i < j < k and arr[i] + arr[j] + arr[k] == target.
As the answer can be very large, return it modulo 109 + 7.
Example 1:
Input: arr = [1,1,2,2,3,3,4,4,5,5], target = 8... | StarcoderdataPython |
149498 | <filename>utils/findpeaks/callfindpeaksdialog.py
from PyQt5.QtWidgets import QDialog
from PyQt5.QtCore import pyqtSlot, QUrl
from PyQt5.QtGui import QDesktopServices
from utils.findpeaks.findpeaksdialog import Ui_findpeaksdialog
from utils.findpeaks.lib import *
detect_peaks_help_url = "https://nbviewer.jupyter.org/g... | StarcoderdataPython |
1691367 | #!/usr/bin/env python3
#
# MIT License
#
# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
#
# 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 w... | StarcoderdataPython |
6579033 | '''
A simulated all-in-one site
'''
class simAllInOneSite:
def __init__(self, siteId, siteDevices, updateInterval):
self.sId = siteId
self.siteDevices = siteDevices
self.updateInterval = updateInterval
def setUpdateInterval (self, updateInterval):
self.updateInterv... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.