id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
1802467 | # ACKERMANN FUNCTION
# Definition: A function of two parameters whose value grows very fast.
# Formal Definition:
# A(0, j)=j+1 for j ≥ 0
# A(i, 0)=A(i-1, 1) for i > 0
# A(i, j)=A(i-1, A(i, j-1)) for i, j > 0
# In 1928, <NAME> observed that A(x,y,z),
# the z-fold iterated exponentiation of x with y,
# is ... | StarcoderdataPython |
8126595 | import os
import argparse
from os.path import expanduser
import numpy as np
import configparser
import shutil
def get_file_names(dataset_path):
"""
get_file_names(str) -> list of HGG files , LGG files
It return the paths of the LGG and HGG files present in BraTS dataset
"""
lgg_dir = []
hgg_... | StarcoderdataPython |
5131425 | # -*- coding: utf-8 -*-
"""Top-level package for utilities for bootcamp."""
from .na_utils import *
from .bioinfo_dicts import *
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__version__ = '0.0.1'
| StarcoderdataPython |
4942424 | #!/usr/bin/env python3
"""
Copyright (C) 2019-2021 by
The Salk Institute for Biological Studies and
Pittsburgh Supercomputing Center, Carnegie Mellon University
Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
"""
import os
i... | StarcoderdataPython |
3342244 | <gh_stars>0
C, N = map(int, input().split(' '))
while True:
first = input()
second = input()
cipher = {}
for i in range(C):
cipher[second[i].lower()] = first[i].lower()
for i in range(C):
cipher[first[i].lower()] = second[i].lower()
for i in range(N):
phrase = input()... | StarcoderdataPython |
1695188 |
from logging import Logger
from logging import getLogger
from metamenus.Singleton import Singleton
class Configuration(Singleton):
DEFAULT_INDENTATION: str = 2 * ' '
DEFAULT_MENU_BAR_PREFIX: str = 'OnMB_'
DEFAULT_MENU_PREFIX: str = 'OnM_'
DEFAULT_VERBOSE_WARNINGS: bool = True
def... | StarcoderdataPython |
391321 | import pandas as pd
import numpy as np
from scipy.stats import truncnorm
from patsy import dmatrix
from collections import OrderedDict
from hddm.simulators.basic_simulator import *
from hddm.model_config import model_config
from functools import partial
# Helper
def hddm_preprocess(
simulator_data=None,
subj_i... | StarcoderdataPython |
6435061 | # <NAME>
# 8/16/2017
# Solution to UCF 2017 Locals Problem: Rotating Cards
def main():
numCases = int(input(""))
# Process each case.
for loop in range(numCases):
# Get the current stack and store a reverse look up.
toks = input("").split()
n = int(toks[0])
... | StarcoderdataPython |
11288297 | <gh_stars>0
import subprocess
from os.path import join, exists
import requests
from requests.exceptions import Timeout
from enum import IntEnum
from tempfile import gettempdir
import youtube_dl
import pafy
class StreamStatus(IntEnum):
OK = 200
DEAD = 404
FORBIDDEN = 401
ERROR = 500
SLOW = 666 # e... | StarcoderdataPython |
364178 | <reponame>Guilhem74/STI_Robotic_Competition_Software
import cv2
import numpy as np
import math
#import picamera
import io
from IPython.display import Image
import time
import glob
import math
import re
import cv2
import numpy as np
from matplotlib import pyplot as plt
def findCenter(x1,x2,y1,y2,a1,a2,a3,boundaries,cen... | StarcoderdataPython |
347202 | <reponame>black-shadows/LeetCode-Solutions
# Time: O(n^2)
# Space: O(n)
class Solution(object):
def lenLongestFibSubseq(self, A):
"""
:type A: List[int]
:rtype: int
"""
lookup = set(A)
result = 2
for i in xrange(len(A)):
for j in xran... | StarcoderdataPython |
3471668 | # save Keeper vault as generic csv file for Bitwarden
import json
import csv
from typing import Dict, List, Optional, Union, Set
import pprint
from io import StringIO
import sys, os
# import pyvim
# sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import logging
logger = logging.getLogger(__name__)
fr... | StarcoderdataPython |
3455039 | <gh_stars>0
from django.test import TestCase
# Create your tests here.
class JournalViewsTestCase(TestCase):
def setUp(self):
pass
def test_list_view(self):
pass
def test_list_view_ranges(self):
pass
def test_delete_view(self):
pass
def test_add_view(self):
... | StarcoderdataPython |
1610931 | QC_HOST = 'qualichain.epu.ntua.gr'
CURR_DESIGNER_PORT = '8080'
KBZ_HOST = 'knowledgebizvpn.ddns.net'
CAREER_ADVISOR_PORT = '8000' | StarcoderdataPython |
112374 | '''
functions to add derived metrics to the dictionaries of metrics
please use the examples to add more
Existing list of prewritten metrics:
add_IPC(metrics) - Instructions per Cycle
add_CPI(metrics) - Cycles per instruction
add_VIPC(metrics) - vector instructions per cycle... | StarcoderdataPython |
4972721 | <reponame>DamieFC/chromium
#!/usr/bin/env python
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A tool for interacting with .pak files.
For details on the pak file format, see:
https://dev.chromium.or... | StarcoderdataPython |
29065 | import glob
import os
import numpy as np
import nibabel as nb
import argparse
def get_dir_list(train_path):
fnames = glob.glob(train_path)
list_train = []
for k, f in enumerate(fnames):
list_train.append(os.path.split(f)[0])
return list_train
def ParseData(list_data):
'''
Creates a... | StarcoderdataPython |
9086 | <gh_stars>1-10
import os
import numpy as np
import tensorflow as tf
from nas_big_data.combo.load_data import load_data_npz_gz
from deephyper.nas.run.util import create_dir
from deephyper.nas.train_utils import selectMetric
os.environ["CUDA_VISIBLE_DEVICES"] = ",".join([str(i) for i in range(4)])
HERE = os.path.dirna... | StarcoderdataPython |
3276646 | """Copyright Amazon.com, Inc. or its affiliates. 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 ap... | StarcoderdataPython |
6651875 | class Licnost:
def kaziZdravo(self):
print("Zdravo, kako si?")
L = Licnost()
L.kaziZdravo()
#ovaj kratak primjer moze bii napisan i kao Licnost().kaziZdravo()
| StarcoderdataPython |
5046277 | import pytest
from kbbq.gatk import applybqsr
from kbbq import compare_reads as utils
from kbbq import recaltable
import numpy as np
import filecmp
from pandas.util.testing import assert_frame_equal
import io
import pysam
@pytest.fixture
def small_report(report, tmp_path):
t = """#:GATKReport.v1.1:5
#:GATKTable:2:... | StarcoderdataPython |
392545 | from rest_framework import generics
from rest_framework.generics import get_object_or_404
from rest_framework import generics
from basic.models.course import Course
from basic.serializers import CourseSerializer
class CoursesListCreateAPIView(generics.ListCreateAPIView):
"""
List and Create -> GET, POST ... | StarcoderdataPython |
8169719 | <gh_stars>0
import model
import offlinedata
import train
ai = model.load_model('klingon_v1')
batch_size = 64
valid_batch_size = 64
train_gen = offlinedata.get_data_generator(offlinedata.df, offlinedata.train_idx, for_training=True, batch_size=batch_size)
valid_gen = offlinedata.get_data_generator(offlinedata.df, ... | StarcoderdataPython |
11282878 | # Write a program that outputs 100 lines, numbered 1 to 100, each with your name on it. The output should look like the output below.
# 1 Your name
# 2 Your name
# 3 Your name
# 4 Your name
# 100 Your name
for i in range(100):
print(i+1, '--- <NAME>')
| StarcoderdataPython |
1980162 | from pyface.qt.QtScript import * # noqa
| StarcoderdataPython |
34755 | import numpy as np
import random
import matplotlib.pyplot as plt
from load_data import loadLabel,loadImage
def der_activation_function(x,type):
if type==1:
return 1 - np.power(np.tanh(x), 2)
elif type==2:
return (1/(1+np.exp(-x)))*(1-1/(1+np.exp(-x)))
else:
x[x<=0]=0.25
x[x>... | StarcoderdataPython |
4801982 | <reponame>tomoyaf/mjai-server
from flask import Blueprint, request, abort, jsonify
import json
from model import ActorCritic
app = Flask(__name__)
replay_buffer = []
max_buffer_size = 100
config = {}
actor_critic = ActorCritic(config)
is_new_policy_available = True
def serialize_model_parameter(m):
return json.d... | StarcoderdataPython |
5035417 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may ob... | StarcoderdataPython |
326506 | <filename>rw_bootcamp/__init__.py<gh_stars>0
"""Top-level package for utilities for bootcamp."""
from .na_utils import *
from .bioinfo_dicts import *
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__version__ = '0.0.1' | StarcoderdataPython |
1944517 | <reponame>frenchmatthew/voxelmorph<filename>scripts/tf/train_synthmorph.py<gh_stars>0
#!/usr/bin/env python3
# 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:
#
# https://www.apache.org/license... | StarcoderdataPython |
5118782 | """
KinsCat
Kinematic Scattering Theory
Copyright by <NAME>
The University of Tennessee, Knoxville
Department of Materials Science & Engineering
Sources:
Scattering Theory:
Zuo and Spence, "Advanced TEM", 2017
Spence and Zuo, Electron Microdiffraction, Plenum 1992
Atomic Form Factor:
Kirkland: Ad... | StarcoderdataPython |
9685576 | <reponame>yogeshwaran01/Mini-Projects
import requests
API = "https://web-series-quotes.herokuapp.com/"
def get_random_web_series_quotes(series_name: str, no_of_quotes="1") -> str:
url = API + series_name + "/" + no_of_quotes
res = requests.get(url)
return res.json()
if __name__ == "__main__":
a = in... | StarcoderdataPython |
32729 | import numpy as np
import torch
import anndata
from celligner2.othermodels.trvae.trvae import trVAE
from celligner2.trainers.trvae.unsupervised import trVAETrainer
def trvae_operate(
network: trVAE,
data: anndata,
condition_key: str = None,
size_factor_key: str = None,
n_epoch... | StarcoderdataPython |
1907894 | API_ENDPOINT = 'https://api.wit.ai/speech'
wit_access_token = 'your-access-token'
from AudioProcessor import *
from FacebookAutomater import *
import requests
import json
import pyttsx3
import gi
import os
def RecognizeSpeech(AUDIO_FILENAME, num_seconds = 10):
# record audio of specified length in specified au... | StarcoderdataPython |
1969348 | n = int(input())
counts = list(map(int,input().split()))
count = sum(counts)
no_of_ways = 0
after_count = count%(n+1)
for i in range(1,6):
if (count+i)%(n+1) != 1:
no_of_ways += 1
print(no_of_ways) | StarcoderdataPython |
6632020 | <reponame>loljoho-old/ainu
#!/usr/bin/env python
#
# Copyright 2013 Facebook
#
# 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... | StarcoderdataPython |
1684436 | <reponame>my-devops-info/cloudrail-knowledge
import functools
import logging
import re
from typing import Optional
from arnparse import arnparse
from botocore.utils import InvalidArnException, ArnParser
@functools.lru_cache(maxsize=None)
def are_arns_intersected(resource_arn: str, target_arn: str):
try:
i... | StarcoderdataPython |
4820557 | from Mechanics import *
from Ship import Ship
class Bot(Ship):
def __init__(self, image, x, y, picked_ship='tick'):
super().__init__(image, x, y,
bolt=State.ship_types[picked_ship]['bolt'],
missile=State.ship_types[picked_ship]['missile'],
... | StarcoderdataPython |
8108367 | <reponame>abandre/abandre.github.io<filename>soa/lab1.py
import random as rnd
def inicializa(tamanho):
memoria=[]
node = {'tipo':'H','inicio':0,'tamanho':tamanho,'pid':-1}
memoria.append(node)
return memoria
def inicializaAleatorio(tamanho):
posicao=0
memoria=[]
i=0
p=1
while posicao<tamanho:
tam=rnd.rand... | StarcoderdataPython |
3354421 | """Define a fake kvstore
This kvstore is used when running in the standalone mode
"""
from .. import backend as F
class KVClient(object):
''' The fake KVStore client.
This is to mimic the distributed KVStore client. It's used for DistGraph
in standalone mode.
'''
def __init__(self):
self... | StarcoderdataPython |
1989526 | <gh_stars>10-100
class InfluenceDiagram:
def __init__(self, chance_factors, utility_factors):
self.chance_factors = chance_factors
self.utility_factors = utility_factors
| StarcoderdataPython |
1776092 | import numpy as np
class numpy_list_data:
def __init__(self, path):
self.featlist = open(path,'r').read().splitlines()
def get_float_list(self, iL):
assert(len(iL) == 1)
y = np.load(self.featlist[iL[0]])['x']
return y.reshape((y.shape[0],-1)).T
| StarcoderdataPython |
74593 | """<NAME>., 2019 - 2020. All rights reserved.
This file process the IO for the Text similarity """
import math
import os
import datetime
import shutil
import time
import pandas as pd
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import cosine_similarity
im... | StarcoderdataPython |
6645079 | <reponame>blester125/quick_knn
import os
import time
import pickle
import random
import argparse
import numpy as np
from quick_knn import LSH, RandomHyperplanes
GLOVE_LOC = "data/glove.6B.300d.txt"
def read_glove(file_name):
vocab = []
vectors = []
with open(file_name) as f:
for line in f:
... | StarcoderdataPython |
4918982 | <filename>filter.py
import argparse
import os
from peekaboo import *
import praw
import time
def get_subreddits(args):
subreddits = ""
subreddits_path = "subreddits.txt"
if args.path:
subreddits_path = os.path.join(path, subreddits_path)
with open("subreddits.txt", "r") as f:
lines = f... | StarcoderdataPython |
6644130 | import unittest
from livecli.plugins.perviykanal import PerviyKanal
class TestPluginPerviyKanal(unittest.TestCase):
def test_can_handle_url(self):
regex_test_list = [
"https://media.1tv.ru/embed/ctcmedia/ctc-che.html?start=auto",
"https://media.1tv.ru/embed/ctcmedia/ctc-dom.html?s... | StarcoderdataPython |
9728845 | <filename>solvebio/test/test_object.py<gh_stars>10-100
from __future__ import absolute_import
import uuid
import mock
from .helper import SolveBioTestCase
from solvebio.test.client_mocks import fake_object_create, fake_object_save
from solvebio.test.client_mocks import fake_dataset_create
class ObjectTests(SolveBi... | StarcoderdataPython |
1795625 | <filename>LX200simulator/julianday.py<gh_stars>0
import math
import datetime
def getjulianday(DT):
m = DT.month
y = DT.year
d = DT.day
minute = DT.minute
second = DT.second
hour = DT.hour
if (m < 3):
y = y-1
m = m+12
A = math.floor(y/100)
B = 2 -A + math.floor(A/4)
JD = math.floor(365.25*(y+4716))+math.f... | StarcoderdataPython |
3335722 | import inspect
import itertools
import uuid
from dataclasses import dataclass
from typing import Type, List
from src.competitors.competitor_models import Competitor, tSNE
from src.datasets.datasets import DataSet, SwissRoll
from src.evaluation.config import ConfigEval
from src.models.loss_collection import Loss
from s... | StarcoderdataPython |
5189265 | <gh_stars>0
import numpy
"""
Variables for the problem
"""
"""
States
"""
#|0> state
s0 = np.matrix([[1],[0]])
#|1> state
s1 = np.matrix([[0],[1]])
"""
Gates
"""
H = (1/np.sqrt(2))*(np.matrix([[1.1].[1,-1]]))
#CZ = ??
#Rz(theta) = ??
| StarcoderdataPython |
4997369 | <gh_stars>0
_base_ = './detectors_cascade_mask_r50_1x_coco.py'
classes = ('Cargo vessel','Ship','Motorboat','Fishing boat','Destroyer','Tugboat','Loose pulley','Warship','Engineering ship','Amphibious ship','Cruiser','Frigate','Submarine','Aircraft carrier','Hovercraft','Command ship')
data_root = '/data2/pd/sdc/multi... | StarcoderdataPython |
1956904 | import pysam
import argparse
import sys
import logging
from collections import OrderedDict
DEBUG = True
NOT_DEBUG= not DEBUG
parser = argparse.ArgumentParser(description="Get read count in chromosomes",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-i',... | StarcoderdataPython |
374645 | <gh_stars>0
#!/usr/bin/env python
## import
import numpy as np
import matplotlib.pyplot as plt
import sys
## argin
if len(sys.argv) != 6:
print("Sytnax error! Usage: ");
print(sys.argv[0], "../log_video_output/left_fit.txt ../log_video_output/left_fit_estimate.txt ../log_video_output/right_fit.txt ../log_video... | StarcoderdataPython |
3366725 | <reponame>cx921003/UPG-GAN
import torch
import torch.nn as nn
from torch.nn import init
import functools
from torch.autograd import Variable
from torch.optim import lr_scheduler
import torch.nn.functional as F # for cross entropy loss
import numpy as np
from torch.nn.modules.utils import _pair, _quadruple
#############... | StarcoderdataPython |
6421967 | <gh_stars>0
# ========================================================================= #
# WGU - Udacity: Data Wrangling
# OpenStreetMap - ATX
# Functions for addr:city
# ========================================================================= #
city_dict = {
'Wells Branch': 'Austin',
'Barton Creek': '... | StarcoderdataPython |
5081461 | <reponame>anku94/themis_tritonsort<filename>src/scripts/themis/generate_disk_path_tuples.py
#!/usr/bin/env python
import os, sys, argparse, struct
sys.path.append(os.path.join(os.path.abspath(
os.path.dirname(__file__)), os.pardir))
from disks.dfs.node_dfs import dfs_get_local_paths, dfs_mkdir
def gener... | StarcoderdataPython |
6410019 | import candidates_listing as cl
import findDocuments as fd
import json
import numpy as np
import os
import preprocessing as prep
import rnn_compare_twotext as rc
from keras.models import Model, Sequential, load_model
from keras.layers import Input, Dense, LSTM, Multiply, Subtract, Dropout, GRU, Masking, Concatenate
fr... | StarcoderdataPython |
1951844 | <reponame>SWuchterl/cmssw
# Unpack digis from raw data and dump them
# --------------------------------------------------
# This config examines the digis using CSCDigiDump (in CSCDigitizer).
# Global/CRUZET data 03.07.2009
import FWCore.ParameterSet.Config as cms
process = cms.Process("CSCRawToDigiDump")
process.l... | StarcoderdataPython |
8178851 | <gh_stars>0
import aiohttp_cors
import aioredis
from aiohttp import web
from aioredis import ConnectionsPool
from jauth.config import config
from jauth.external.token.apple import AppleToken
from jauth.external.token.facebook import FacebookToken
from jauth.external.token.google import GoogleToken
from jauth.external... | StarcoderdataPython |
6436119 | <gh_stars>0
"""
TWLight email sending.
TWLight generates and sends emails using https://bameda.github.io/djmail/ .
Any view that wishes to send an email should do so using a task defined here.
Templates for these emails are available in emails/templates/emails. djmail
will look for files named {{ name }}-body-html.ht... | StarcoderdataPython |
3111 | <reponame>CRE2525/open-tamil<filename>tamilmorse/morse_encode.py
## -*- coding: utf-8 -*-
#(C) 2018 <NAME>
# This file is part of Open-Tamil project
# You may use or distribute this file under terms of MIT license
import codecs
import json
import tamil
import sys
import os
#e.g. python morse_encode.py கலைஞர்
CURRDIR ... | StarcoderdataPython |
1939967 | <reponame>Klupamos/py-authorize
from authorize.configuration import Configuration
from authorize.xml_data import prettify
from unittest import TestCase
CREDIT_CARD = {
'customer_type': 'individual',
'card_number': '4111111111111111',
'card_code': '456',
'expiration_month': '04',
'expiration_year':... | StarcoderdataPython |
4810390 | <filename>Iris-Flask-App/app/app.py
import numpy as np
from flask import Flask, request, render_template, redirect
import pickle
# define Flask app
app = Flask(__name__)
# load machine learning model
model = pickle.load(open("../iris-model.pkl", "rb"))
# define initial route and returns the index.html page
# aswell as... | StarcoderdataPython |
1902021 | from random import randint
import pytest
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from tests.functional.pages import Task302Page
from tests.functional.utils import screenshot... | StarcoderdataPython |
4806509 | <filename>app.py
''' COLOUR PALETTE APP
----------------------
@author: <NAME>, 2021
CEO & Founder at Saoi Tech Solutions
Follow us on LinkedIn: https://www.facebook.com/saoitech
Follow me on Github: https://github.com/javiermunooz
----------------------
@description: This simple ... | StarcoderdataPython |
6430242 |
from django.conf.urls import url
from birthdays.views import birthdays_plugin_overview
urlpatterns = [
url(r'^birthdays/$', birthdays_plugin_overview, name='birthdays_plugin_overview'),
]
| StarcoderdataPython |
4862867 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vi: set ft=python :
"""
Parses the json formatted output of a process and format it in a more readable way
usage:
json_log_formatter.py <command>
e.g.
json_log_formatter.py "uxfp -f <stream> --json" # no filter
json_log_formatter.py "uxf... | StarcoderdataPython |
8024797 | <filename>karrot/reporters/cloudwatch/models.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import datetime
import boto3
from botocore.exceptions import ClientError, ParamValidationError, NoCredentialsError
from structlog import get_logger
from flask import current_app as app
from prometheus_client impor... | StarcoderdataPython |
162487 | <reponame>idlesign/django-sitegate<filename>sitegate/signin_flows/remotes/yandex.py
from django.http import HttpResponseRedirect, HttpRequest
from django.utils.translation import gettext_lazy as _
from .base import Remote, UserData
if False: # pragma: nocover
from django.contrib.auth.models import User # noqa
... | StarcoderdataPython |
5032316 | <gh_stars>1-10
from ._version import get_versions
from .core import etuple
from .dispatch import apply, arguments, etuplize, operator, rands, rator, term
__version__ = get_versions()["version"]
del get_versions
| StarcoderdataPython |
31239 | <gh_stars>10-100
from typing import Optional
from datetime import datetime
from sqlite3.dbapi2 import Cursor
from ..config import config
from .. import schema
class CRUDUser():
model = schema.User
def create(
self,
db: Cursor,
qq: int,
code: str
) -> None:
user_di... | StarcoderdataPython |
3337158 | <filename>hnjobs/__init__.py<gh_stars>0
name = "hnjobs" | StarcoderdataPython |
4863653 | <gh_stars>0
import multiprocessing
import threading
import datetime
import time
import os
from multiprocessing import Process
import numpy as np
import pynvml
from pycode.tinyflow import Scheduler as mp
from pycode.tinyflow import ndarray
class GPURecord(threading.Thread):
def __init__(self, log_path, suffix="... | StarcoderdataPython |
376336 | <reponame>informatics-isi-edu/betacell-consortium
import argparse
from attrdict import AttrDict
from deriva.core import ErmrestCatalog, get_credential, DerivaPathError
import deriva.core.ermrest_model as em
from deriva.core.ermrest_config import tag as chaise_tags
from deriva.utils.catalog.manage.update_catalog import ... | StarcoderdataPython |
1826326 | import paramiko
import time
from functools import wraps
def verbose(func):
print("Декорируем функцию")
@wraps(func)
def inner(*args, **kwargs):
if isinstance(args[0], BaseSSH):
repr_args = ("self",) + args[1:]
print(
f"Вызываю функцию {func.__name__}, " f"args {rep... | StarcoderdataPython |
12850329 | <reponame>siemens/python-cybox<gh_stars>0
# Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from cybox.common import ExtractedFeatures
from cybox.test import EntityTestCase
# Need to do this so the binding class is registered.
import cybox.binding... | StarcoderdataPython |
186525 | #!/usr/bin/env python3
import random
def main():
"""Terminal上でポーカーを再現。ダブルアップはなし。
"""
poker = Poker()
# test()
"""
標準入出力を利用して、ゲームを行う
ループで回せばいい
終了の文字も指定する
ゲームの流れは、
スタート->dealされた札が5枚表示される->holdする札を選択する->
->再びdealする->役を判定->ゲームの結果処理->スタートに戻る
ユーザーができることは、
holdする札を選ぶ。結果表示後... | StarcoderdataPython |
8082152 | """
10-3 字符集
"""
import re
s = 'abc, acc, adc, aec, afc, ahc'
# 找出单词中间字符是c或者是f的单词
# 用字符集
r = re.findall('a[cf]c', s)
print(r)
# 找出单词中间不是c或者f的单词
r = re.findall('a[^cf]c', s)
print(r)
#如果匹配的字符太多,可以利用字符的顺序,来省略中间的字符。
# 匹配c到f
r = re.findall('a[c-f]c', s)
print(r) | StarcoderdataPython |
3386553 | <gh_stars>1-10
""" Relative imports of all services """
from .async_rcp_client import AsyncRcpClient, RcpHttpException
| StarcoderdataPython |
5184069 | N = int(input())
A = list(map(int, input().split()))
f = 0
r = 0
while(1):
for i in range(N):
if (A[i] % 2) != 0:
f = 1
if f:
break
for j in range(N):
A[j] = A[j] / 2
r += 1
print(r)
| StarcoderdataPython |
276228 | '''Independent-running GSAS-II based auto-integration program with minimal
GUI, no visualization but intended to implement significant levels of
parallelization.
'''
# Autointegration from
# $Id: GSASIIimgGUI.py 3926 2019-04-23 18:11:07Z toby $
# hacked for stand-alone use
#
# idea: select image file type & set filte... | StarcoderdataPython |
3200688 | <filename>__mimic/util/tests/patch_test.py
# Copyright 2012 Google Inc. 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 |
8043109 | <gh_stars>1-10
def insertionsort(a):
for j in range(len(a) - 1, - 1, - 1):
value = a[j]
hole = j
while hole < (len(a) - 1) and a[hole+1] > a[hole]:
a[hole] = a[hole + 1]
hole = hole + 1
a[hole] = value
print(a)
print ("Sorted array: ")
a = [3,45,3... | StarcoderdataPython |
3356911 | import numpy as np
import sklearn.datasets
import matplotlib.pyplot as plt
import matplotlib
import sklearn.linear_model
from neuralnetnumpy.neuralnet import NeuralNet
def dataScale(X):
mean_ = np.nanmean(X, axis = 0)
scale_ = np.nanstd(X, axis = 0)
print(scale_.shape)
X -= mean_
scale_[scale_ =... | StarcoderdataPython |
8120750 | import pytest
from app_name.cls_sample.dog import Dog
from app_name.cls_sample.owner import Owner
class TestDog:
@pytest.fixture()
def dog1(request):
owner = Owner("Zagitova", 17, "rusia")
return Dog("Masaru", owner)
def test_show(self, dog1: Dog):
dog1.show()
assert dog1.... | StarcoderdataPython |
9695104 | import itertools
import os
import re
import inflect
import spacy
import unittest
from unittest.mock import patch
from generativepoetry.lexigen import *
from generativepoetry.pdf import *
from generativepoetry.poemgen import *
from generativepoetry.utils import *
from generativepoetry.decomposer import *
spacy_nlp = sp... | StarcoderdataPython |
5025457 | <gh_stars>1-10
from django.conf.urls import patterns, include, url
from gamecraft.gamecrafts import feeds
from gamecraft.gamecrafts import ical_feeds
urlpatterns = patterns('gamecraft.gamecrafts',
url(r'^$', 'views.list_gamecrafts', name='list_gamecrafts'),
url(r'^rss/$', feeds.GameCraftRSSFeed(), name="gamec... | StarcoderdataPython |
8117869 | import chess
__all__ = ['Pawn', 'Rook', 'Bishop', 'Queen', 'Knight']
class Piece(object):
def __init__(self):
self.board = None
self.team = None
self.position = None
self.type = None
self.name = None
self.repr = None
def is_valid_move(self, pos):
pass
... | StarcoderdataPython |
6453436 | <filename>tests/test_hawkular.py
# -*- coding: utf-8 -*-
"""Unit tests for Hawkular client."""
import json
from urlparse import urlparse
import os
import pytest
from mgmtsystem import hawkular
from mock import patch
from random import sample
from mgmtsystem.hawkular import CanonicalPath
def fake_urlopen(c_client, ur... | StarcoderdataPython |
3584491 | <reponame>gaybro8777/osf.io
from django.apps import apps
from rest_framework import serializers as ser
from django.core.exceptions import ValidationError
from api.base.serializers import (
JSONAPISerializer,
LinksField,
TypeField,
IDField,
)
from api.base.exceptions import InvalidModelValueError
clas... | StarcoderdataPython |
1867366 | <filename>ironstubs/process_stubs.py
""" Stub Generator for IronPython
Extended script based on script developed by <NAME> at:
gitlab.com/reje/revit-python-stubs
This is uses a slightly modify version of generator3,
github.com/JetBrains/intellij-community/blob/master/python/helpers/generator3.py
Iterates thr... | StarcoderdataPython |
11214826 | <filename>challenge-4/server.py
#!/usr/bin/env python3
import http.server
import logging
import socketserver
PORT = 8083
logging.basicConfig(level=logging.INFO)
class GetHandler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
print(self.headers)
header_ok = ""
for h in self.hea... | StarcoderdataPython |
5019859 | <reponame>revsys/django-beta<gh_stars>1-10
from django import forms
from django.conf import settings
from beta.models import BetaSignup
class BetaSignupForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(BetaSignupForm, self).__init__(*args, **kwargs)
self.capture_first = getattr(... | StarcoderdataPython |
184468 | # -*- coding: utf-8 -*-
"""Implementacao do 'Lagged Fibonacci generator'"""
import random
import sys
class lfg:
"""Classe que constroi o gerador de numeros pseudo-aleatorios
Atributos:
lags: tupla de dois valores que irao representar os 'lags' da formula
exponent: expoente que ira na potenci... | StarcoderdataPython |
8039231 | import ctypes
import numpy
import sys
import os
import os.path
from numpy.compat import asbytes, asstr
def _generate_candidate_libs():
# look for likely library files in the following dirs:
lib_dirs = [os.path.dirname(__file__),
'/lib',
'/usr/lib',
'/usr/local/l... | StarcoderdataPython |
5188837 | import yaml
import os
import socket
import logging
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
with open(ROOT_DIR + '/config.yaml') as f:
try:
config = yaml.safe_load(f)
except yaml.YAMLError as exc:
print(exc)
for k, v in config.get('path').items():
edited_value = v.replace('.'... | StarcoderdataPython |
3278119 | from tkinter import *
from PIL import Image, ImageTk
from constants import bg_color
class BusTimeSchedule(Frame):
def __init__(self, parent, *args, **kwargs):
Frame.__init__(self, parent, bg=bg_color)
self.title = "셔틀버스운행시간표"
image = Image.open("assets/BusTimeSchedule.png") # 원본 해상도: 12... | StarcoderdataPython |
6430162 | from hypo2.base.basef import BaseHIObj
import numpy as np
from hypo2.base.cache import Cache
from IPython.display import clear_output
from hypo2.preprocessor import Preprocessor
from hypo2.addit.functions import Functional as F
class Dataset(BaseHIObj):
def __init__(self, cfg):
self.cfg = cfg.copy... | StarcoderdataPython |
1729744 | import numpy as np
def generate_random_policy(env):
n_states = env.observation_space.n
n_actions = env.action_space.n
policy = np.ones([n_states, n_actions]) / n_actions
policy[0, :] = 0
policy[n_states - 1, :] = 0
return policy
def policy_evaluation(policy, env, V=None, gamma=1, theta=1e-8,... | StarcoderdataPython |
3317603 | # -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/Claim
Release: R5
Version: 4.5.0
Build ID: 0d95498
Last updated: 2021-04-03T00:34:11.075+00:00
"""
from pydantic.validators import bytes_validator # noqa: F401
from fhir.resources import fhirtypes # noqa: F401
from fhir.resources import clai... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.