id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
380092 | <reponame>KiraOldeen/ralph<gh_stars>1-10
class SingletonMeta(type):
_instance = None
def __call__(self):
if self._instance is None:
self._instance = super().__call__()
return self._instance
| StarcoderdataPython |
3283235 | <filename>algorithms/REINFORCE/evaluation.py
from __future__ import print_function
from __future__ import division
import argparse
import gym
import numpy as np
import tensorflow as tf
from agent import REINFORCE
from utils import *
def main(args):
def preprocess(obs):
obs = obs[35:195]
obs = o... | StarcoderdataPython |
1944925 | <filename>tests/test_axds.py
# from search.axdsReader import axdsReader
import numpy as np
import pandas as pd
import pytest
import xarray as xr
import ocean_data_gateway as odg
# slow tests: https://stackoverflow.com/questions/47559524/pytest-how-to-skip-tests-unless-you-declare-an-option-flag
# CHECK PARALLEL AND... | StarcoderdataPython |
1909149 | from os import write
import streamlit as st
import nltk
nltk.download("stopwords")
from nltk.corpus import stopwords
from nltk.cluster.util import cosine_distance
import numpy as np
import networkx as nx
#from transformers import pipeline
header = st.beta_container()
body = st.beta_container()
summary_co... | StarcoderdataPython |
9712319 | <reponame>antonyggvzvmnxxcx/xrpl-py
"""This method retrieves all of the NFTs currently owned by the specified account."""
from dataclasses import dataclass, field
from typing import Any, Optional
from xrpl.models.requests.request import Request, RequestMethod
from xrpl.models.required import REQUIRED
from xrpl.models.... | StarcoderdataPython |
1776114 | <reponame>paulfariello-syn/bip<filename>bip/hexrays/event.py<gh_stars>100-1000
import ida_hexrays
class HxEvent(object):
"""
Enum object for the hexrays event. This is documented in
https://www.hex-rays.com/products/decompiler/manual/sdk/hexrays_8hpp.shtml
https://www.hex-rays.com/product... | StarcoderdataPython |
9682567 | #!/usr/bin/env python3
import argparse
from typing import List, Tuple
from rsa import RSA
def read_key_file(name: str) -> List[int]:
"""
Schlüssel von Datei lesen.
"""
file = open(name, "r")
try:
lines = file.readlines()
return [int(line) for line in lines]
finally:
... | StarcoderdataPython |
5150960 | <gh_stars>1-10
# Copyright 2011-2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LI... | StarcoderdataPython |
3591004 | import asyncio
def bark(loop):
print('Woof!!!')
loop.stop()
async def might_time_out(loop, timeout=3):
delay = 1
while 1:
watchdog = loop.call_later(timeout, bark, loop)
await asyncio.sleep(delay)
watchdog.cancel()
print('Slept', delay, 'seconds')
delay *= 2
... | StarcoderdataPython |
6517272 | <gh_stars>1-10
from src.image_utils import load_image
import numpy as np
from numpy.linalg import norm
import matplotlib.pyplot as plt
from src.encoder import VAE
from src.net import build_vae_128 as net
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-size', '--image_size', default=128)
parser... | StarcoderdataPython |
1974027 | from __future__ import print_function
import torch
from torch.autograd import Variable
from .visual_evaluation import plot_images
from .load_data import load_dataset
from .distributions import log_Normal_diag
from .knnie import kraskov_mi as ksg_mi
import numpy as np
import time
import os
from sklearn.cluster impor... | StarcoderdataPython |
6648860 | <gh_stars>0
# 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, sof... | StarcoderdataPython |
5128424 | #!/usr/bin/env python
import os, sys
import subprocess
import ctypes
from subprocess import Popen, PIPE, STDOUT, call
#ctypes.windll.kernel32.SetConsoleTitleA("pushCast Console")
## Variable Defaults ##
myVer = 'v0.1'
myFreq=4
mediaPath="c:\users\<NAME>\downloads\media"
pyTivoPath="c:\pyTivo\pyTivoSer... | StarcoderdataPython |
1650056 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
import numpy as np
from keras.utils.generic_utils import Progbar
from six.moves import xrange
class Agent(object):
"""Base Agent class
Parameters
----------
model : :obj:`Model`
A learning model. E... | StarcoderdataPython |
384751 | #!/usr/bin/env python3
## You will have to implement a very primitive machine learning framework. The skeleton is given, you have to fill the
## blocks marked by "## Implement". The goal is to give you a little insight how machine learning frameworks work,
## while practicing the most important details from the class.... | StarcoderdataPython |
3426823 | <filename>skyfield/magnitudelib.py
# -*- coding: utf-8 -*-
"""Routines for computing magnitudes.
Planetary routines adapted from:
https://arxiv.org/pdf/1808.01973.pdf
Which links to:
https://sourceforge.net/projects/planetary-magnitudes/
Which has directories with three successive versions of their magnitude
compu... | StarcoderdataPython |
6606104 | <gh_stars>0
def som(getal1, getal2, getal3):
return getal1+getal2+getal3
print(som(8,3,5))
| StarcoderdataPython |
5070464 | from markov.metrics.constants import MetricsS3Keys
from markov.metrics.s3_metrics import EvalMetrics
from markov.virtual_event.constants import PAUSE_TIME_BEFORE_START
class VirtualEventEvalMetric():
"""
VirtualEventEvalMEtrics class
"""
def __init__(self,
agent_name,
... | StarcoderdataPython |
5156184 | ## Copyright 2002-2010 by PyMMLib Development Group (see AUTHORS file)
## This code is part of the PyMMLib distribution and governed by
## its license. Please see the LICENSE file that should have been
## included as part of this package.
"""Geometry hasing/fast lookup classes.
"""
from __future__ import generators
i... | StarcoderdataPython |
3456524 | <gh_stars>10-100
from collections import namedtuple
import numpy as np
import tensorflow as tf
from mvc.models.networks.base_network import BaseNetwork
from mvc.action_output import ActionOutput
from mvc.parametric_function import stochastic_policy_function
from mvc.parametric_function import value_function
from mvc.... | StarcoderdataPython |
6559144 | from hearsay import hearsay
import pickle
from sys import argv
import numpy as np
from matplotlib import pyplot as plt
from scipy import ndimage
import matplotlib.cm as cm
from mpl_toolkits.axes_grid1 import make_axes_locatable
import pandas as pd
####################################################
# Figura 3
######... | StarcoderdataPython |
3448756 | ## 191. 位1的个数
class Solution(object):
def hammingWeight(self, n):
"""
:type n: int
:rtype: int
"""
## 方法1
# count = 0
# while n > 0:
# count += 1
# n = n & (n - 1)
# return count
## 方法2
# count = 0
# w... | StarcoderdataPython |
1939000 | <filename>Module10/practice/Money/Money.py
from base64 import b64decode, b64encode
class Money:
def __init__(self, whole=0, fractional=0):
self.value = (whole * 100) + fractional
self.name = 'Рубль'
self.name_plural = 'Рубли'
def __str__(self):
return f'{self.name_plural} {self... | StarcoderdataPython |
1607605 | names = ['Christopher', 'Susan']
for name in names:
print(name)
# for index in range(0,2):
# print(index) # 0 1
index = 0
while index < len(names):
print(names[index])
index += 1 | StarcoderdataPython |
6490660 | import urllib.request
import urllib.parse
from exceptions import NoHeaders, NoPostData
import json
class DefaultRequest:
"""
class to represent html/js tags/variables.
"""
def __init__(self, url, headers=None, start=False, post_data=None):
self.url = url
self.req = None
self.h... | StarcoderdataPython |
4927855 | <filename>fine_tuning.py
import os
import time
import random
import numpy as np
import nibabel as nib
import tensorflow as tf
from ukbb_cardiac.common.cardiac_utils import get_frames
from ukbb_cardiac.common.image_utils import tf_categorical_accuracy, tf_categorical_dice
from ukbb_cardiac.common.image_utils import crop... | StarcoderdataPython |
6671500 | <filename>stock deep learning/5-3.ANN(xor).py
# XOR 예시
import tensorflow as tf
inputX = [[0, 0], [0, 1], [1, 0], [1, 1]] # input 데이터
outputY = [[1], [0], [1], [0]] # desired output 데이터
nInput = 2 # input layer의 neuron 개수
nHidden = 4 # hidden layer의 neuron 개수
nOutput = 1 # output layer의 neu... | StarcoderdataPython |
291545 | import asyncio
from aiohttp import web
@asyncio.coroutine
def index(request):
yield from asyncio.sleep(0.5)
return web.Response(body=b'<h1>Index</h1>')
@asyncio.coroutine
def hello(request):
yield from asyncio.sleep(0.5)
text = '<h1>hello, %s!</h1>' % request.match_info['name']
return web.Respons... | StarcoderdataPython |
6506445 | <reponame>vitordouzi/sigtrec_eval
import sys, os, subprocess, math, multiprocessing, random
import numpy as np
from numpy import nan
import pandas as pd
from scipy.stats.mstats import ttest_rel
from scipy.stats import ttest_ind, wilcoxon
from imblearn.over_sampling import RandomOverSampler, SMOTE
from collections impor... | StarcoderdataPython |
1936643 | <gh_stars>1-10
#!/usr/bin/env python3
import os
input_dir = './Shaders/glslify_raw'
output_dir = './Shaders/glslify_processed'
for filename in os.listdir(input_dir):
if filename.endswith('.vert') or filename.endswith('.frag'):
# print(os.path.join(raw_dir, filename))
input_path = os.path.join(input... | StarcoderdataPython |
6662062 | <reponame>ben-jones/facade
# used in buffers.py
BUFFER_SIZE = 2048
# used by frame.py
MAX_SEQ_NUM = 65535
MIN_SIZE_TO_PASS_UP = 512
MAX_SESSION_NUM = 256
| StarcoderdataPython |
6483950 | <gh_stars>1-10
import sys
import types
import sympy
from eqpy._utils import isdunder
class VarsModule(types.ModuleType):
__call__ = staticmethod(sympy.Symbol)
def __init__(self, self_module):
super(VarsModule, self).__init__(self_module.__name__)
self.__path__ = []
self._self_module_ ... | StarcoderdataPython |
3453065 | def make_new_word(R, S):
new_str = ''
for ch in S:
new_str += ch * R
return new_str
def main():
T = int(input())
P_list = []
for _ in range(T):
R, S = input().split()
R = int(R)
P = make_new_word(R, S)
P_list.append(P)
for i in range(len(P_list)):
... | StarcoderdataPython |
4962170 | <reponame>nbrass/DO288-apps
print("This line will be printed.")
| StarcoderdataPython |
5144119 | <reponame>jkellers/traffic-cam
"""
Counting persons with YOLO.
Based on: https://www.arunponnusamy.com/yolo-object-detection-opencv-python.html
"""
import numpy as np
from pathlib import Path
from traffic_cam import predictor
if __name__ == "__main__":
try:
predictor = predictor.Predictor()
imag... | StarcoderdataPython |
163548 |
#import director
from director import cameraview
from director import transformUtils
from director import visualization as vis
from director import objectmodel as om
from director.ikparameters import IkParameters
from director.ikplanner import ConstraintSet
from director import polarisplatformplanner
from director imp... | StarcoderdataPython |
6641324 | import requests
import rapidjson as json
import os
import sys
from dotenv import load_dotenv
from decimal import Decimal
from asyncio import sleep
from datetime import datetime
load_dotenv()
WALLET = os.getenv('PIPPIN_WALLET')
NODE_IP = os.getenv('PIPPIN_IP')
WORK_KEY = os.getenv('DPOW_KEY')
WORK_USER = os.getenv('D... | StarcoderdataPython |
3354560 | <gh_stars>1-10
import datetime
from django.contrib.auth.models import User
from django.test import TestCase, RequestFactory
from django.urls import reverse
from .models import Post
def create_post(title, text, date_increment=None, status="P"):
if date_increment is None:
date = datetime.datetime.now() + datetime... | StarcoderdataPython |
234892 | <reponame>lealoureiro/audio-downloader-api
from fastapi import FastAPI
from fastapi.logger import logger as fastapi_logger
import os
import api
app = FastAPI()
app.include_router(api.router)
api.library_dir = os.getenv("LIBRARY_DIR", '.')
api.home_assistant_notification = os.getenv("HOME_ASSISTANT_NOTIFI... | StarcoderdataPython |
1616676 | <reponame>private-forks/mega-linter
#!/usr/bin/env python3
"""
Use lintr to lint R files
https://github.com/jimhester/lintr
"""
import os
from shutil import copyfile
from megalinter import Linter
class RLinter(Linter):
# Build the CLI command to call to lint a file
def build_lint_command(self, file=None):
... | StarcoderdataPython |
6513157 | import os
from separate_constraints import main as separate_constraints
TEST_CASES = (
(
'Contactcontactorders_associationSalesOrder.sql',
'Contactcontactorders_associationSalesOrder-out.sql',
),
(
'SystemUserSet.sql',
'SystemUserSet-out.sql',
),
)
def test():
for n... | StarcoderdataPython |
8154783 | """
Daedalus module for creating and running 4G/5G environments with any
combination of simulation and real SDRs
"""
import argparse
import json
import logging
import os
import sys
import time
import docker as dclient
from daedalus import __file__
from daedalus import __version__
from daedalus.validators import IMSIVa... | StarcoderdataPython |
8057138 | <reponame>sjsafranek/GeoSkeletonServer<gh_stars>1-10
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import json
import configparser
class Config(object):
def __init__(self, config_file='config.ini'):
self._configFile = config_file
self.config = configparser.ConfigParser()
if not os.path.exists(self._conf... | StarcoderdataPython |
11301871 | <reponame>flavioUENP/aula1
sombrac=float(input("Digite o comprimento da sombra da caixa em metros,(EXEMPLO: 25, 26.4..): "))
sombrapessoa=float(input("Digite o comprimento da sua sombra metros,(EXEMPLO: 4, 4.5..): "))
altura=float(input("Digite sua altura,(EXEMPLO: 1.80..): "))
alturacaixa=altura*(sombrac/sombrapessoa)... | StarcoderdataPython |
8015852 | from tkinter import * # only import class
import pandas
import random
# Vars
BACKGROUND_COLOR = "#B1DDC6"
current_card = {}
to_learn = {}
# ----- Random cards ------ #
try:
data = pandas.read_csv("data/words_to_learn.csv")
except FileNotFoundError:
original_data = pandas.read_csv("data/french_words.csv")
... | StarcoderdataPython |
4878313 | import intake
import json
import random
import sys
from loaders.mappers import open_nudge_to_fine
data_path, output_train, output_test = sys.argv[1:]
mapper = open_nudge_to_fine(
data_path,
nudging_variables=["air_temperature", "specific_humidity", "x_wind", "y_wind", "pressure_thickness_of_atmospheric_layer"... | StarcoderdataPython |
1605134 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Third Party Stuff
import pytest
from django.core.urlresolvers import reverse
def test_root_txt_files(client):
files = ['robots.txt', 'humans.txt']
for filename in files:
url = reverse('root-txt-files', kwargs={'filename': filename})
... | StarcoderdataPython |
5041646 | <reponame>zainllw0w/skillbox<filename>lessons 21/HomeWork/task3.py<gh_stars>0
def f(n, k=1, i=1, my_list=[1]):
if i == n:
return my_list[-1]
my_list.append(k)
last_num = my_list[-2]
return f(n, k+last_num, i+1)
print(f(6)) | StarcoderdataPython |
8102991 | <gh_stars>10-100
#! /usr/bin/env python
#
# example1_qt.py -- Simple FITS viewer using the Ginga toolkit and Qt widgets.
#
import sys
from ginga.misc import log
from ginga.qtw.QtHelp import QtGui, QtCore
from ginga.qtw.ImageViewQt import CanvasView, ScrolledView
from ginga.util.loader import load_data
class FitsView... | StarcoderdataPython |
185044 | i=0
while 1:
a = int(input())
if a == 0 : break
i+=1
print "Case %d: %d" % (i, a)
| StarcoderdataPython |
6492106 | import numpy as np
# Add any constraint functions here
def g0(d: np.ndarray) -> np.ndarray:
return 20 - d
def g1(d: np.ndarray) -> np.ndarray:
return 30 - d
def g2(d: np.ndarray) -> np.ndarray:
return 40 - d | StarcoderdataPython |
1630076 | import argparse
import sys
import os
import shutil
import time
import numpy as np
from random import sample
from sklearn import metrics
import torch
from torch.optim.lr_scheduler import MultiStepLR
from torch.utils.tensorboard import SummaryWriter
from deepKNet.data import get_train_valid_test_loader
from deepKNet.mode... | StarcoderdataPython |
1803480 | <reponame>0rganizers/m.css
#
# This file is part of m.css.
#
# Copyright © 2017, 2018, 2019, 2020, 2021, 2022
# <NAME> <<EMAIL>>
#
# 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... | StarcoderdataPython |
5018370 | <reponame>bopopescu/sage
"""
Quadratic Forms Overview
AUTHORS:
- <NAME> (2007-06-19)
- <NAME> (2010-07-01): Formatting and ReSTification
"""
#*****************************************************************************
# Copyright (C) 2007 <NAME> and <NAME>
#
# This program is free software: you can redistrib... | StarcoderdataPython |
6563484 | <reponame>kundajelab/cut-n-run-pipeline<gh_stars>1-10
#!/usr/bin/env python
# ENCODE DCC bwa wrapper
# Author: <NAME> (<EMAIL>), <NAME>
import sys
import os
import argparse
from encode_lib_common import (
get_num_lines, log, ls_l, mkdir_p, rm_f, run_shell_cmd, strip_ext_fastq,
strip_ext_tar, untar)
from encod... | StarcoderdataPython |
1687827 | import torch.nn as nn
import torch
from collections import OrderedDict
from DNCNN.networks import basicblock as B
class UNet(nn.Module):
def __init__(self, in_nc=6, out_nc=3, nc=[64, 128, 256, 512], nb=2, act_mode='R', downsample_mode='strideconv', upsample_mode='convtranspose'):
super(UNet, self).__init_... | StarcoderdataPython |
12849913 | <filename>mediapub_extensions/ApiWrappers/Snowflake.py
import snowflake.connector as snowcon
import json
import getpass
import sys
class Snowflake():
"""
Handles connections and queries to Snowflake Computing
This class contains methods to connect to the Snowflake service and run
queries on it.
R... | StarcoderdataPython |
1601456 | # !/usr/bin/env python3
# -*- coding:utf-8 -*-
__author__ = '<NAME>'
__date__ = '2018/7/21 22:12'
import json
from pfmap import *
from taginfo import *
from pfmap import *
class LoginRequest(object):
def __init__(self, *, uname=None, json_info=None):
if json_info is None:
self.__msg_type = ... | StarcoderdataPython |
5097735 | # Calculadora...
#funções das operações:
import math
def soma(a, b):
return a + b
def resta(a, b):
return a - b
def multiplicacao(a, b):
return a * b
def divisao(a, b):
return a / b
def potencia(a, b):
return a**b
def raizquadrada(a):
return math.sqrt(a)
while True:
... | StarcoderdataPython |
11387925 | <filename>Reexec.py
import sublime, sublime_plugin
import os, sys, re
import threading
import subprocess
import functools
import time
import traceback
import posixpath
import difflib
def plugin_loaded():
"""This function checks settings for sanity."""
plugin_settings = sublime.load_settings("Reexec.sublime-set... | StarcoderdataPython |
9731168 | <reponame>raoulcollenteur/ehyd
import urllib
import os
import time
import numpy as np
# 329557
for i in range(329557, 329559): # too large range for one go
filename = 'GW_monatsmittel_{0}.csv'.format(i)
url = 'http://ehyd.gv.at/eHYD/MessstellenExtraData/gw?id={0}&file=4'.format(
i)
urllib.request.... | StarcoderdataPython |
9637750 | <reponame>sfu-natlang/HMM-Aligner<gh_stars>10-100
# -*- coding: utf-8 -*-
#
# IBM model 1 with alignment type implementation of HMM Aligner
# Simon Fraser University
# NLP Lab
#
# This is the implementation of IBM model 1 word aligner with alignment type.
#
import numpy as np
from collections import defaultdict
from l... | StarcoderdataPython |
11322222 | <reponame>openlattice/api-clients
# coding: utf-8
"""
OpenLattice API
OpenLattice API # noqa: E501
The version of the OpenAPI document: 0.0.1
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from openlattice.configuration impo... | StarcoderdataPython |
5119643 | from typing import Any, Dict, List
def extractFields(data: Dict[str, Any], fields: List[str], returnEmpty: bool = True) -> Dict[str, Any]:
"""
Extracts the Listed Params from the dict
"""
cleanedData = {}
for field in fields:
if field in data:
if returnEmpty is False and data[fi... | StarcoderdataPython |
1808201 | <reponame>prouast/deep-intake-detection
"""ResNet-SlowFast Model
Based on github.com/tensorflow/models/blob/master/official/resnet
Adapted into SlowFast network as described by:
SlowFast Networks for Video Recognition
https://arxiv.org/pdf/1812.03982.pdf
by <NAME>, <NAME>, <NAME>, <NAME>
Adapted for frame s... | StarcoderdataPython |
8087621 | <reponame>oboforty/geogine<gh_stars>0
import math
import itertools
from geoprocessing.core.Point import Point3, Point2
from geoprocessing.geometries.BufferGeometry import BufferGeometry
class HeraldGeometry(BufferGeometry):
def __init__(self, radius=1, segments=12, depth=0.05, **kwargs):
super().__init_... | StarcoderdataPython |
5044746 | <reponame>sveetch/Optimus
# -*- coding: utf-8 -*-
from click.testing import CliRunner
from optimus.cli.console_script import cli_frontend
def test_version_output(caplog):
"""
Just testing it simply works
"""
runner = CliRunner()
# Temporary isolated current dir
with runner.isolated_filesyste... | StarcoderdataPython |
6605671 | import torch
model_root = '/data/hongwei/FCOS/BACKBONE_0000000.pth'
BACKBONE = torch.load(model_root, )
print(BACKBONE) | StarcoderdataPython |
3272174 | # Cecilia | Gardener
# Rose Garden : Gardener's Spot
sm.sendSayOkay("I've had the chills for so long... It's very cold, as you know..") | StarcoderdataPython |
38092 | <filename>synth/__init__.py
import synth.timer
from synth.base import Function
from synth.dp_construction import DualProductConstruction
| StarcoderdataPython |
1944863 | <filename>src/friendlypins/board.py
"""Primitives for interacting with Pinterest boards"""
from datetime import datetime
from dateutil import tz
from friendlypins.pin import Pin
from friendlypins.utils.base_object import BaseObject
class Board(BaseObject):
"""Abstraction around a Pinterest board"""
@staticmet... | StarcoderdataPython |
1637295 | import collections
import functools
import json
import math
from dimagi.utils import parsing as dateparse
from datetime import datetime, timedelta
from casexml.apps.stock import const
from casexml.apps.stock.models import StockTransaction
from dimagi.utils.dates import force_to_datetime
DEFAULT_CONSUMPTION_FUNCTION = ... | StarcoderdataPython |
3553786 | #!/usr/bin/env python
#Copyright (C) 2013 by <NAME>
#
#Released under the MIT license, see LICENSE.txt
import os
import stat
from toil.job import Job
from cactus.pipeline.ktserverControl import runKtserver, blockUntilKtserverIsRunning, stopKtserver, \
blockUntilKtserverIsFinished
class KtServerService(Job.Servic... | StarcoderdataPython |
9748159 | import os
import requests
import tarfile
from rest_framework.authentication import TokenAuthentication
from django.conf import settings
from libs.api import get_service_api_url
from libs.permissions.authentication import InternalAuthentication
def safe_urlopen(
url,
method=None,
params=None,
data=N... | StarcoderdataPython |
8046448 | from dataclasses import dataclass
from typing import Iterator, List, Optional, Tuple
import loguru
from kaldi.asr import (LatticeRnnlmPrunedRescorer,
NnetLatticeFasterOnlineRecognizer)
from kaldi.fstext import SymbolTable
from kaldi.lat.sausages import MinimumBayesRisk
from kaldi.online2 import... | StarcoderdataPython |
6577283 | <filename>Z_gate.py
import projectq as pq
from projectq import MainEngine
from projectq.ops import All
from projectq.ops import H, X, Z, Measure, QubitOperator
import numpy as np
eng=MainEngine()
qb_array=eng.allocate_qureg(2)
X|qb_array[0]
All(Measure)|qb_array
eng.flush()
# exp=eng.backend.get_expectation_value(Z,... | StarcoderdataPython |
1948653 | <filename>handsfree_tutorials/script/2_base_control/radian_turn.py<gh_stars>100-1000
#!/usr/bin/env python
import tf
import math
import rospy
import geometry_msgs.msg
import tf.transformations
class RadianTurn(object):
def __init__(self):
self.frame_base = rospy.get_param('~base_frame', '/base_link')
... | StarcoderdataPython |
4940263 | #__LICENSE_GOES_HERE__
'''
builds Digsby's CGUI extension
'''
from __future__ import with_statement
import sys
sys.path.append('..') if not '..' in sys.path else None
from buildutil import cd, dpy
from os.path import isdir, abspath
import os
def build():
# find WX directory
from build_wx import WXDIR
wxdi... | StarcoderdataPython |
3441410 | <gh_stars>10-100
"""A TRF Factory for creating sites with positions from the NMA database
Description:
------------
Reads station positions through a web service. A time series of positions is available, so positions are given
according to the time series.
"""
# Standard library imports
from datetime import datetime... | StarcoderdataPython |
5170621 | <filename>trove/openstack/common/pastedeploy.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Red Hat, 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
#
# ... | StarcoderdataPython |
1610497 | import os
from setuptools import setup
setup(
name="words",
version="0.0.1",
description=("Code Styles Python starter",),
license="MIT",
keywords="Python",
packages=['words'],
setup_requires=[
'pytest-runner',
],
tests_require=[
'pytest',
]
)
| StarcoderdataPython |
5123518 | <gh_stars>10-100
from data_generator import PentominoGenerator
import time
import numpy
data_gen = PentominoGenerator(batch_size=500, use_patch_centers=True)
i=0
time_begin = time.time()
past = None
m_data = None
times = []
for data in data_gen:
print "Iteration... %d " % (i)
if i == 4:
break
futu... | StarcoderdataPython |
9749287 | list1 = [x*x for x in range(10)]
print(list1)
# list2 列表创建语句慎重执行,先注释
# list2 = [x*x for x in range(1000000000000000000000000)]
generator1 = (x*x for x in range(1000000000000000000000000))
print(generator1)
print(type(generator1))
generator2 = (x*x for x in range(3))
print(next(generator2))
print(next(gener... | StarcoderdataPython |
34203 | <filename>python/cc_emergency/functional/transforms/language_filter.py
#!/usr/bin/env python3
# vim: set fileencoding=utf-8 :
"""Language / domain filtering transforms."""
from functools import partial
import importlib
import inspect
import tldextract
from cc_emergency.functional.core import Filter
from cc_emergenc... | StarcoderdataPython |
127801 | import dense_graph as dg
import sparse_graph as sg
data = [[13,13],
[0,5],
[4,3],
[0,1],
[9,12],
[6,4],
[5,4],
[0,2],
[11,12],
[9,10],
[0,6],
[7,8],
[9,11],
[5,3]]
class Path(object):
def __init__(self, graph,... | StarcoderdataPython |
9633683 | <reponame>mmalki-neusta/hetida-designer
import pytest
from httpx import AsyncClient
from demo_adapter_python.webservice import app
@pytest.fixture
def async_test_client():
return AsyncClient(app=app, base_url="http://test")
| StarcoderdataPython |
8052001 | <reponame>Udolf15/recommedMeMovies
# Copyright (c) 2016 Rackspace, 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 req... | StarcoderdataPython |
5050039 | # Generated by Django 3.1.1 on 2020-11-24 14:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('good_delivery', '0039_auto_20201117_1248'),
]
operations = [
migrations.AddField(
model_name='gooddelivery',
name='p... | StarcoderdataPython |
6561142 | import target_driver
import target_io
import time
import Initialise
import sys
if __name__=="__main__":
args = sys.argv
outfile = str(args[1])
SleepTime = int(args[2]) / 119. # send trigger ~120 Hz
runID = int(args[3])
Vped = int((int(args[4]) - 21) / 0.6)
my_ip = "192.168.1.2"
bo... | StarcoderdataPython |
1824613 | import os
# got from the gist https://gist.github.com/JosefJezek/dc251a71cab6336f55bd
def profiles_dir():
if os.name == 'posix':
return '/opt/cisco/anyconnect/profile/'
elif os.name == 'nt':
return '%ProgramData%\\Cisco\\Cisco AnyConnect Secure Mobility Client\\Profile'
else:
rais... | StarcoderdataPython |
9738077 | # -*- coding: utf-8 -*-
from sqlalchemy.ext.declarative import declarative_base
from zvt.contract.register import register_schema
from zvt.factors.z.domain.common import ZFactorCommon
Stock1wkZFactorBase = declarative_base()
class Stock1wkZFactor(Stock1wkZFactorBase, ZFactorCommon):
__tablename__ = "stock_1wk_z... | StarcoderdataPython |
6611645 | import os
import unittest
# WFPadTools imports
from obfsproxy.transports.wfpadtools.util.testutil import STTest
from obfsproxy.transports.wfpadtools import const
class RunEnvTest(STTest):
"""Tests whether the extra dependency requirements are satisfied.
Eventually, these requirements could be added to obfsp... | StarcoderdataPython |
3392610 | #!/usr/bin/env python3
import re
s, n, *t = open(0)
s = s.split()
for i, j in enumerate(s):
for k in t:
if re.fullmatch(k.strip().replace("*","."), j):
s[i] = "*" * len(j)
print(*s) | StarcoderdataPython |
6430105 | <reponame>GitHubDiom/faas-sim
from dataclasses import dataclass
from enum import Enum
from typing import Dict
"""
Bins: | LOW | MEDIUM | HIGH | VERY_HIGH
Cores: | 1-2 | 4 - 8 | 16 - 32 | > 32
RAM: | 1-2 | 4 - 8 | 16 - 32 | > 32
CpuMhz: | <= 1.5 ... | StarcoderdataPython |
11313622 | <filename>pipeline_control/src/pipeline_control/service_layer/handlers/initiate_bulk_load_handler.py
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import logging
from pipeline_control.domain import commands
from pipeline_control.domain.model import JobStatu... | StarcoderdataPython |
3234217 | <gh_stars>1-10
# -*- encoding: utf-8 -*-
from sqlalchemy import (
Column,
Integer,
Unicode,
ForeignKey
)
from sqlalchemy.orm import relationship
from .base import Base
class EMail(Base):
__tablename__ = 'email'
id = Column(Integer, primary_key=True)
mail = Column(Unicode)
domain_id ... | StarcoderdataPython |
3235993 | import asyncio
import logging
import os
from pathlib import Path
from typing import Optional, TYPE_CHECKING
from hikcamerabot.common.video.tasks.ffprobe_context import GetFfprobeContextTask
from hikcamerabot.common.video.tasks.thumbnail import MakeThumbnailTask
if TYPE_CHECKING:
from hikcamerabot.camera import Hi... | StarcoderdataPython |
9677795 | <reponame>ska-telescope/sdp-prototype
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""PIP setup script for the SDP Subarray Device package."""
# pylint: disable=exec-used
import os
from setuptools import setup
RELEASE_INFO = {}
RELEASE_PATH = os.path.join('SDPSubarray', 'release.py')
exec(open(RELEASE_PATH).read(),... | StarcoderdataPython |
5088777 | <reponame>sohguanh/lion<filename>util/http/handler_util_bare.py
import logging
def startup_init(config, dbPool):
'''
ENTRY POINT: perform any pre-loading/caching of objects or anything else before server startup in here (if any)
'''
logging.info('startup init ...')
def shutdown_cleanup(config, dbPoo... | StarcoderdataPython |
11247254 | import unittest
import numpy as np
from keras import Model
from keras.layers import Input
import h5py
import platform
import tensorflow as tf
np.set_printoptions(threshold=np.inf)
class CustomLayerTests(unittest.TestCase):
def setUp(self):
BOXES_NAME = "FirstStageBoxPredictor_BoxEncodingPr... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.