id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3269487
<reponame>dewoolkaridhish4/C104 import csv with open("height-weight.csv",newline="") as f: reader=csv.reader(f) filedata=list(reader) filedata.pop(0) newdata = [] for i in range(len(filedata)): n_num=filedata[i][1] newdata.append(float(n_num)) n=len(newdata) total=0 for x in newdata: total+=x m...
StarcoderdataPython
11368
#!/usr/bin/env python3 import logging import torch.nn as nn from fairseq import checkpoint_utils from fairseq.models import BaseFairseqModel, register_model from pytorch_translate import rnn from pytorch_translate.rnn import ( LSTMSequenceEncoder, RNNDecoder, RNNEncoder, RNNModel, base_architectur...
StarcoderdataPython
4814897
#!/usr/bin/env python # coding: utf-8 from multiprocessing import Pool from tqdm import tqdm import numpy as np test_num = 500000000 output_path = "feature_output" base_dir = "dataset" prob_dir = output_path val_t_correct_index = np.load( base_dir + "/wikikg90m_kddcup2021/processed/val_t_correct_index.npy", ...
StarcoderdataPython
1670405
<reponame>codebyravi/otter """Code related to gathering data to inform convergence.""" import re from functools import partial from effect import catch, parallel from effect.do import do, do_return from pyrsistent import pmap from toolz.curried import filter, groupby, keyfilter, map from toolz.dicttoolz import assoc...
StarcoderdataPython
3329307
<reponame>koshiishide/calendar from django import template import datetime register = template.Library() #0,1,2 @register.simple_tag @register.filter def test2(day): tmp=day.weekday() if ((tmp==5)or(tmp==6)): return 1 else: return 0 @register.simple_tag @register.fil...
StarcoderdataPython
1600854
from copy import copy from random import Random import numpy as np class SimulationPolicy(object): def __init__(self, random_state, **kwargs): self.local_random = Random() self.local_random.setstate(random_state) def get_random_state(self): return self.local_random.getstate() class ...
StarcoderdataPython
1605477
<gh_stars>0 import pytorch_lightning as pl from {{cookiecutter.project_name}} import models parser = ArgumentParser(description="{{cookiecutter.project_name}} model training script") parser.add_argument( "--epochs", type=int, default=50, metavar="N", help="number of epochs to train (default: 50)...
StarcoderdataPython
135701
<filename>examples/02_decoding/plot_haxby_space_net.py """ Decoding with SpaceNet: face vs house object recognition ========================================================= Here is a simple example of decoding with a SpaceNet prior (i.e Graph-Net, TV-l1, etc.), reproducing the Haxby 2001 study on a face vs house disc...
StarcoderdataPython
1720210
# # 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 under the Apache License, Version 2.0 (the # "License"); you may not...
StarcoderdataPython
3321106
import logging from typing import List from bson.objectid import ObjectId from pymongo import ReturnDocument from core.config import ( DOCTYPE_CONTRACT, ERROR_MONGODB_DELETE, ERROR_MONGODB_UPDATE, ) from db.mongo import get_collection from models.contract import Contract, ContractCreate, ContractInDB, Con...
StarcoderdataPython
55786
from typing import List import torch import torch.nn as nn import torch.nn.functional as F from . import pointnet2_utils class StackSAModuleMSG(nn.Module): def __init__(self, *, radii: List[float], nsamples: List[int], mlps: List[List[int]], use_xyz: bool = True, pool_method='max_pool'): ...
StarcoderdataPython
3290530
<gh_stars>1-10 # -*- coding: utf-8 -*- """ test_karnickel ~~~~~~~~~~~~~~ Test for karnickel, AST macros for Python. :copyright: Copyright 2010, 2011 by <NAME>. :license: BSD, see LICENSE for details. """ import ast from textwrap import dedent from karnickel import * def raises(exc, func, *args...
StarcoderdataPython
1669790
from fcapsy import Context from bitsets import bitset from tests import load_all_test_files import os import pytest import json import pandas as pd TEST_DATA_DIR_FIMI = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'fimi', ) @pytest.mark.parametrize("data_file, json_file", ...
StarcoderdataPython
3223811
#!/usr/bin/env python from functools import reduce from google.cloud.monitoring_v3 import MetricServiceClient from google.cloud.monitoring_v3.types import LabelDescriptor, MetricDescriptor, TimeSeries from os import environ import psutil as ps import requests from signal import signal, SIGTERM from sys import stderr f...
StarcoderdataPython
4820049
<filename>ALGOs/RNN/helper.py import math import random # 1D dot def dot(a, b): ans = [ a[i]*b[i] for i in range(len(a)) ] return [sum(ans)] # 2D random array def dot_2D(a, b): matrix = [] for i in range(len(a)): row = [] for j in range(len(b[0])): element = sum( [a[i][k]*b[k][j] for k in range(len(a[0]))]...
StarcoderdataPython
132042
<gh_stars>0 from leapp.actors import Actor from leapp.libraries.common.rpms import has_package from leapp.models import InstalledRedHatSignedRPM from leapp.reporting import Report, create_report from leapp import reporting from leapp.tags import ChecksPhaseTag, IPUWorkflowTag class CheckGrep(Actor): """ Check...
StarcoderdataPython
3224284
example_grid = [ [5,0,0,0,0,7,0,0,0] ,[9,2,6,5,0,0,0,0,0] ,[3,0,0,8,0,9,0,2,0] ,[4,0,0,0,2,0,0,3,5] ,[0,3,5,1,0,4,9,7,0] ,[8,6,0,0,5,0,0,0,4] ,[0,4,0,3,0,8,0,0,2] ,[0,0,0,0,0,5,6,9,3] ,[0,0,0,6,0,0,0,0,7]] def print_grid(grid): for row in g...
StarcoderdataPython
4812346
<gh_stars>1-10 ############################################################################### # # 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 l...
StarcoderdataPython
3393254
from forked.cli import main def test_main(): """Worst test ever.""" main([])
StarcoderdataPython
1615361
for _ in range(int(input())): d = {} s = input() i = 0 while i < len(s): try: d[s[i]] +=1 except: d[s[i]] = 1 if d[s[i]] == 3: if i+1 <len(s) and s[i+1] == s[i]: d[s[i]] = 0 i+=1 else: ...
StarcoderdataPython
1721103
from discord import Embed import requests from datetime import datetime, timezone from ..bases import Definition, Webhook TIMEFILE = "chunks.sqlite" class DiscordWebhook(Webhook): url: str link: str def _construct_embed(self, defi: Definition) -> Embed: embed = Embed(title="Map updated!", url=...
StarcoderdataPython
3293138
<filename>tests/__main__.py #!/usr/bin/env python """ Runs all the tests for every type of gym environment. Tests for the screen environment will only be run if the screen environment was registered in the gym registry """ from gym import envs import unittest from tests.grid_env_test import GridGymTest # from tests.r...
StarcoderdataPython
1741257
""" A unit test for the train.py script """ import os import pylearn2 from pylearn2.scripts.train import train def test_train_cmd(): """ Calls the train.py script with a short YAML file to see if it trains without error """ train(os.path.join(pylearn2.__path__[0], "scripts/...
StarcoderdataPython
154285
<filename>src/algoritmia/datastructures/trees/boundedaritytree.py from algoritmia.datastructures.trees.interfaces import IRootedTree class BoundedArityTree(IRootedTree): #[bounded def __init__(self, arity: "int"=0, seq: "Iterable<T>"=[], bounded_arity_tree: "BoundedArityTree<T>"=None, root_i...
StarcoderdataPython
34305
from collections import defaultdict from .common import IGraph ''' Remove edges to create even trees. You are given a tree with an even number of nodes. Consider each connection between a parent and child node to be an "edge". You would like to remove some of these edges, such that the disconnected subtrees that rem...
StarcoderdataPython
1692665
import numpy as np import gym import itertools as it from dqn.dqn_agent import DQNAgent from tensorboard_evaluation import * from dqn.networks import NeuralNetwork, TargetNetwork from utils import EpisodeStats def run_episode(env, agent, deterministic, do_training=True, rendering=False, max_timesteps=1000): """ ...
StarcoderdataPython
3258366
<filename>Operators/ExampleFaceDetectOperator/FaceDetectOperator.py from abc import ABC import cv2 import numpy as np from Operators.DummyAlgorithmWithModel import DummyAlgorithmWithModel from Operators.ExampleFaceDetectOperator.PostProcessUtils import get_anchors, regress_boxes from Utils.GeometryUtils import center...
StarcoderdataPython
154764
""" Count the number of ways to tile the floor of size n x m using 1 x m size tiles Given a floor of size n x m and tiles of size 1 x m. The problem is to count the number of ways to tile the given floor using 1 x m tiles. A tile can either be placed horizontally or vertically. Both n and m are positive integers and 2...
StarcoderdataPython
3205052
import logging import os import shutil from tempfile import mkdtemp from service_buddy.ci.ci import BuildCreator from service_buddy.ci.travis_build_creator import TravisBuildCreator from service_buddy.service import loader from service_buddy.service.service import Service from service_buddy.util import pretty_printer ...
StarcoderdataPython
3204169
#!/usr/bin/env python kingdoms = ['Bacteria', 'Protozoa', 'Chromista', 'Plantae', 'Fungi', 'Animalia'] print(kingdoms[-6]) print(kingdoms[-1]) print(kingdoms[-6:-3]) print(kingdoms[-4:-1]) print(kingdoms[-2:])
StarcoderdataPython
34980
from pageobject import PageObject from homepage import HomePage from locatormap import LocatorMap from robot.api import logger class LoginPage(): PAGE_TITLE = "Login - PageObjectLibrary Demo" PAGE_URL = "/login.html" # these are accessible via dot notaton with self.locator # (eg: self.locator.usernam...
StarcoderdataPython
157945
import pygame from data.clip import clip def load_tileset(path): tileset_img = pygame.image.load(path + 'tileset.png').convert() tileset_img.set_colorkey((0, 0, 0)) width = tileset_img.get_width() tile_size = [16, 16] tile_count = int((width + 1) / (tile_size[0] + 1)) images = [clip(tileset_img...
StarcoderdataPython
1773067
import math import os from decimal import Decimal from django import template from django.utils import timezone from djmoney.money import Money from app import settings from app.enums import FileStatus from app.utils import get_site_url from event.enums import ApplicationStatus, DietType, TshirtSize, CompanyTier from...
StarcoderdataPython
98177
<reponame>TylerPham2000/zulip<gh_stars>1000+ import time from unittest import TestCase, mock from scripts.lib.check_rabbitmq_queue import CRITICAL, OK, UNKNOWN, WARNING, analyze_queue_stats class AnalyzeQueueStatsTests(TestCase): def test_no_stats_available(self) -> None: result = analyze_queue_stats("na...
StarcoderdataPython
20307
# Princess No Damage Skin (30-Days) success = sm.addDamageSkin(2432803) if success: sm.chat("The Princess No Damage Skin (30-Days) has been added to your account's damage skin collection.")
StarcoderdataPython
3273254
#!/usr/bin/env python """ Example script that processes the servers of a server or group nickname. """ import sys import os from pprint import pprint import easy_server def main(): """Main function""" if len(sys.argv) < 2: print("Usage: {} SERVERFILE [NICKNAME]".format(sys.argv[0])) sys.exit...
StarcoderdataPython
3301842
<gh_stars>0 from pathlib import Path import sys import platform import os import time import datetime def readIgnores(): with open("ignore.txt") as file: ignoreLines = file.readlines() ignorePaths = {} for line in ignoreLines: ignorePaths[line.rstrip()] = True return(ignorePat...
StarcoderdataPython
1703623
import numpy as np def diamondarray(dimension=1,fill=1,unfill=0): """ Create a diamond array using a square dimension. Fill and unfill values can be integer or float. """ nullresult=np.zeros(1) #// verify inputs try: if not isinstance(dimension, (int, np.integer)): dimesion=int...
StarcoderdataPython
44472
<filename>enhancements/predict.py import numpy as np from sklearn.preprocessing import StandardScaler import scipy.io import tensorflow as tf tf.random.set_seed(10) import os import sys sys.path.append('../') from csen_regressor import model import argparse from sklearn.model_selection import train_test_split # INITI...
StarcoderdataPython
9851
<reponame>csisarep/groundwater_dashboard # Generated by Django 2.2 on 2021-09-11 04:58 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('waterApp', '0010_auto_20210911_1041'), ] operations = [ migrations.AlterField( model_name...
StarcoderdataPython
3309924
#!/usr/bin/env python3 import socket HOST = "127.0.0.1" PORT = 65431 def send(s, cmd): s.sendall(cmd.encode("utf-8")) data = s.recv(1024) print("Received", repr(data)) def get_val(s, key): cmd = "get {}".format(key) s.sendall(cmd.encode("utf-8")) data = s.recv(1024) print("Received", r...
StarcoderdataPython
3252853
<filename>Aspect_Extraction/model.py import logging import keras.backend as K from keras.layers import Dense, Activation, Embedding, Input from keras.models import Model from my_layers import Attention, Average, WeightedSum, WeightedAspectEmb, MaxMargin from w2v_emb_reader import W2VEmbReader as EmbReader logging.ba...
StarcoderdataPython
3219377
<reponame>zeroam/TIL """read_write_data.py 구글 스프레드 시트 문서에 데이터 입력 및 접근하기 """ import ezsheets ss = ezsheets.createSpreadsheet("My SpreadSheet") sheet = ss[0] # 첫번째 시트에 접근 print(sheet.title) # '시트1' # 데이터 입력 sheet["A1"] = "Name" sheet["B1"] = "Age" sheet["C1"] = "Favorite Movie" print(sheet["A1"]) # Name print(sheet...
StarcoderdataPython
74560
<gh_stars>0 import logging import pytest from math import isclose import numpy as np from haystack.modeling.infer import QAInferencer from haystack.modeling.data_handler.inputs import QAInput, Question @pytest.fixture() def span_inference_result(bert_base_squad2, caplog=None): if caplog: caplog.set_level...
StarcoderdataPython
3266502
<filename>poly_classifier/rooted_poly_decider.py # assumptions: δ = 2 # configurations = [(root,child_1,child_2),...] # labels = set([label_1,label_2,...]) import math import networkx from rooted_tree_classifier.log_decider import isFlexible def get_labels(configurations): labels = set() for conf in configur...
StarcoderdataPython
1624238
<gh_stars>0 # -*- coding: utf-8 -*- """ This plugin is 3rd party and not part of p2p-streams addon Sopcast.ucoz """ import sys,os current_dir = os.path.dirname(os.path.realpath(__file__)) basename = os.path.basename(current_dir) core_dir = current_dir.replace(basename,'').replace('parsers','') sys.path.append(core...
StarcoderdataPython
42106
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Created by techno at 25/04/19 #Feature: #Enter feature name here # Enter feature description here #Scenario: # Enter scenario name here # Enter steps here """ tokenizing a string and counting unique words""" text = ('this is sample text with several words different...
StarcoderdataPython
3378554
# coding: utf-8 import sys sys.path.append(".") from workshop.en.z_1 import * reportErrors = True """ - when 'True', the validity of the values are checked upstream. - when 'False', no check; if errors, Python exceptions are displayed. """ def solveFirstDegreeEquation(a, b, c): solution = (c-b)/...
StarcoderdataPython
3282405
import sys import logging import argparse import shutil from collections import OrderedDict import git import yaml import torch import torch.optim as optim from baselines.common.atari_wrappers import EpisodicLifeEnv, FireResetEnv OPTS = OrderedDict({None: None, 'adam': optim.Adam, ...
StarcoderdataPython
1683566
import duckdb from decimal import Decimal import pytest def initialize(con): con.execute("Create Table bla (i integer, j decimal(5,2), k varchar)") con.execute("insert into bla values (1,2.1,'a'), (2,3.2,'b'), (NULL, NULL, NULL)") return con.table('bla') def munge(cell): try: cell = round(flo...
StarcoderdataPython
3283302
<reponame>ysharma12/Food-Name-Classification-and-Ingredients-Prediction from imports import* import utils class dai_image_csv_dataset(Dataset): def __init__(self, data_dir, data, transforms_ = None, obj = False, minorities = None, diffs = None, bal_tfms = None): super(dai_image_csv...
StarcoderdataPython
1737529
<reponame>Capping-WAR/API import connexion import six from swagger_server.models.request_info import RequestInfo # noqa: E501 from swagger_server.models.rule import Rule # noqa: E501 from swagger_server import util from swagger_server.__globals__ import _globals def add_rule(Rule): # noqa: E501 """Add a Rule ...
StarcoderdataPython
3373764
<reponame>arpancodes/pyre-check # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import dataclasses import json import logging from pathlib import Path from typing import TextIO from .. impo...
StarcoderdataPython
35862
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division, print_function, unicode_literals from time import strftime, gmtime from email.header import make_header from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from .utils import strip_tags, for...
StarcoderdataPython
1789830
import json import random import glob import os import string from collections import OrderedDict questions = {} user_answers = OrderedDict() current_question = None current_solution = None formatted_solution = None possible_solutions = None requires = ['db'] def start_quiz(bot, c, e, args): # TODO: I assume ...
StarcoderdataPython
3215920
#!/usr/bin/python3 __version__ = '0.0.8' # Time-stamp: <2021-09-14T10:47:01Z> ## Language: Japanese/UTF-8 """Simulation Buddhism Prototype No.3 - Death 死亡関連 """ ## ## Author: ## ## JRF ( http://jrf.cocolog-nifty.com/statuses/ (in Japanese)) ## ## License: ## ## The author is a Japanese. ## ## ...
StarcoderdataPython
4826286
<gh_stars>10-100 import numpy as np from scipy.signal import butter from sklearn.pipeline import FeatureUnion, Pipeline from sklearn.preprocessing import FunctionTransformer from classification.features.constants import ( FREQ_BANDS_ORDERS, FREQ_BANDS_RANGE, NYQUIST_FREQ, ) from classification.features.pi...
StarcoderdataPython
3261933
from __future__ import annotations from typing import List from reamber.base.lists.notes.HoldList import HoldList from reamber.bms.BMSHold import BMSHold from reamber.bms.lists.notes.BMSNoteList import BMSNoteList class BMSHoldList(List[BMSHold], HoldList, BMSNoteList): def _upcast(self, objList: List = None) ...
StarcoderdataPython
3390068
<gh_stars>0 from sensormodule import isSensorLeft, isSensorRight from directions import forward, left_forward,right_forward while True: if isSensorLeft() == True: right_forward() elif isSensorRight() == True: left_forward() else: forward()
StarcoderdataPython
84012
<reponame>trackuity/jinx import os import json import bsddb3 import struct class Indexer: def __init__(self, name, key_field, prefix_fields=None): self._key_field = key_field self._prefix_fields = prefix_fields self._file = open(name, 'r') self._db = bsddb3.hashopen(name + '.jinx'...
StarcoderdataPython
1695773
<reponame>steinnymir/sytools<filename>sytools/pes/dld.py<gh_stars>0 # -*- coding: utf-8 -*- """ @author: <NAME> Copyright (C) 2018 <NAME> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundat...
StarcoderdataPython
51639
<gh_stars>10-100 from hooks.pre_gen_project import check_valid_email_address_format import pytest # Define test cases for the `TestCheckValidEmailAddressFormat` test class args_invalid_email_addresses = ["hello.world", "foo_bar"] args_valid_email_addresses = ["<EMAIL>", "foo@bar"] class TestCheckValidEmailAddressFor...
StarcoderdataPython
106999
from functools import lru_cache from dataclasses import dataclass from typing import List from translator.translator import _ @dataclass class Product: name: str friendly_name: str description: str extended_description: str picture: str technical: List[str] hilights: List[str] products =...
StarcoderdataPython
196037
import os import subprocess import tempfile import uuid import graphviz from IPython.display import display, Image from IPython.core.magic import Magics, cell_magic, magics_class from IPython.core.magic_arguments import argument, magic_arguments, parse_argstring from common import helper compiler = 'iverilog' yosys_ru...
StarcoderdataPython
1639011
<filename>train/lr_schedule.py import os import math import numpy as np import torch def set_lr_scheduler(optimizer, cfg): r"""Sets the learning rate scheduler """ if cfg.lr_scheduler == 'step': lr_scheduler = torch.optim.lr_scheduler.StepLR(optimizer, cfg.step_size, cfg.step_gamma) elif cfg...
StarcoderdataPython
3303140
<reponame>juanjnc/TGBot from telegram import Update, ChatAction from telegram.ext import CallbackContext def start(update: Update, context: CallbackContext): """Envía un mensaje cuando se manda el comando /start.""" context.bot.sendChatAction(chat_id=update.message.chat_id, action=ChatAction.TYPING, timeout=1...
StarcoderdataPython
3325022
import copy import ast class ReadableFields: """ This class is responsible for getting all fields from the constructors of the classes that inherity from it """ def __init__(self): """ This constructor makes impossible to create a class without a __init__ mehtod. """ ...
StarcoderdataPython
1797487
<reponame>Trustmega/luxatray import os import hid from gi.repository import Gtk as gtk, AppIndicator3 as appindicator def main(): indicator = appindicator.Indicator.new("luxatray", "starred-symbolic", appindicator.IndicatorCategory.APPLICATION_STATUS) indicator.set_s...
StarcoderdataPython
1627645
import sys from .config import COLORS def prompt(message): if sys.version_info.major == 3: action = input(message) else: action = raw_input(message) return action def default(message): print(message) def success(message): print('{}{}\033[1;m'.format(COLORS['SUCCESS'], message)) ...
StarcoderdataPython
1774123
<reponame>henriquekirchheck/Curso-em-video-Python # Escreva um programa que leia um número N inteiro qualquer e mostre na tela os N primeiros elementos de uma Sequência de Fibonacci tt = 0 t = int(input('Digite o numero de termos da sequência de Fibonacci: ')) n1 = 0 n2 = 1 print(f'\n{n1} -> ', end='') while(tt != (...
StarcoderdataPython
17390
# The MIT License (MIT) # # Copyright © 2021 <NAME>, <NAME>, <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...
StarcoderdataPython
3230336
from direct.distributed import DistributedObjectAI from direct.directnotify import DirectNotifyGlobal from toontown.toonbase import ToontownGlobals from otp.otpbase.PythonUtil import nonRepeatingRandomList import DistributedGagAI, DistributedProjectileAI from direct.task import Task import random, time, Racer, RaceGlob...
StarcoderdataPython
111932
<reponame>opencomputeproject/HWMgmt-DeviceMgr-PSME """ * @section LICENSE * * @copyright * Copyright (c) 2015-2017 Intel Corporation * * @copyright * 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...
StarcoderdataPython
1734682
<gh_stars>0 def announce(f): def wrapper(): print("Starting function") f() print("Function completed execution") return wrapper @announce def hello(): print("Hello, world!") hello()
StarcoderdataPython
1699739
<filename>sistemas_rpg/ficha.py sistema_ficha ='''『🗃️- ° } F̶i̶c̶h̶a̶ P̶e̶r̶s̶o̶n̶a̶g̶e̶m̶ { ° -🗃️』 →: Identificação do Player ╘ N̶o̶m̶e̶ o̶u̶ N̶i̶c̶k̶ ↝: ╘ N̶ú̶m̶e̶r̶o̶ T̶e̶l̶e̶f̶o̶n̶e̶ ↝: ╘ R̶e̶c̶r̶u̶t̶a̶d̶o̶ P̶o̶r̶.̶.̶.̶ ↝: →: Identificação Do Personagem ╘ N̶o̶m̶e̶ ↝: ╘...
StarcoderdataPython
3201648
import os import time import math import asyncio import requests if bool(os.environ.get("WEBHOOK", False)): from sample_config import Config else: from config import Config from script import script headers = { "User-Agent":"Mozilla/5.0 (Windows NT 6.1; rv:80.0) Gecko/20100101 Firefox/80.0", "Refer...
StarcoderdataPython
3228149
import os import threading import time import unittest import subprocess import signal if "CI" in os.environ: def tqdm(x): return x else: from tqdm import tqdm # type: ignore import cereal.messaging as messaging from collections import namedtuple from tools.lib.logreader import LogReader from selfdrive.test...
StarcoderdataPython
79693
<filename>config.py<gh_stars>0 # -*- coding: utf-8 -*- import os import yaml basedir = os.path.abspath(os.path.dirname(__file__)) # Load ACL Action file _ACL_ACTIONS = None with open(basedir + '/acl-actions.yaml') as _f: _ACL_ACTIONS = yaml.load(_f.read()) class Config(object): ADMIN_USERNAME ...
StarcoderdataPython
4834724
<gh_stars>0 import unittest2 as unittest from Products.CMFCore.utils import getToolByName from isaw.policy.testing import ISAW_POLICY_INTEGRATION_TESTING from isaw.policy import config class TestInstallation(unittest.TestCase): layer = ISAW_POLICY_INTEGRATION_TESTING def setUp(self): self.app = sel...
StarcoderdataPython
3368095
<reponame>draustin/otk import numpy as np from otk.sdb import * def test_transforms(): m = orthographic(-2, 3, -4, 5, 6, 7) assert np.allclose(np.dot([-2,-4,-6,1], m), [-1.0, -1.0, -1.0, 1.0]) assert np.allclose(np.dot([3,5,-7,1], m), [1.0, 1.0, 1.0, 1.0]) assert np.allclose(lookat([1.0, 3.0, -1.0], [...
StarcoderdataPython
1664898
# coding: utf-8 from .request import Request class UserGetRequest(Request): def __init__(self): self.fields = None # 查询字段:User数据结构的公开信息字段列表,以半角逗号(,)分隔 self.nick = None # 用户昵称,多个以半角逗号(,)分隔,最多40个 self.method = 'taobao.user.get' self.p = {} def set_nick(self, nick): self....
StarcoderdataPython
4812446
# -*- coding: utf-8 -*- # Uncomment the import only for coding support # import numpy # import pandas # import geopandas # import torch # import torchvision # import tensorflow # import tensorboard # from shapely.geometry import Point from openeo_udf.api.feature_collection import FeatureCollection from openeo_udf.api....
StarcoderdataPython
1788425
# # Copyright (C) 2020 Arm Mbed. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # from unittest import TestCase from mbed_build._internal.mbed_tools.configure import configure from mbed_build import mbed_tools class TestExport(TestCase): def test_aliases_export(self): self.assertEqual(mbed_to...
StarcoderdataPython
3216139
<reponame>Himusoka/Beatmap-gen_Thesis import os import random from collections import deque import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.utils.data import Dataset, DataLoader import numpy as np from sklearn.metrics import f1_score, precision_recall_curve im...
StarcoderdataPython
1642530
<reponame>amcclead7336/Enterprise_Data_Science_Final # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code gen...
StarcoderdataPython
28306
# # Copyright © 2021 United States Government as represented by the Administrator # of the National Aeronautics and Space Administration. No copyright is claimed # in the United States under Title 17, U.S. Code. All Other Rights Reserved. # # SPDX-License-Identifier: NASA-1.3 # """Generate a grid of pointings on the sk...
StarcoderdataPython
1701076
<reponame>ardila/python-docs-samples #!/usr/bin/env python # # Copyright 2020 Google LLC # # 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
3229192
import uuid from datetime import datetime from sentry_sdk._types import MYPY from sentry_sdk.utils import format_timestamp if MYPY: from typing import Optional from typing import Union from typing import Any from typing import Dict from sentry_sdk._types import SessionStatus def _minute_trunc(t...
StarcoderdataPython
3322090
<filename>plots/midterm/activity.py<gh_stars>1-10 import time import copy import os from multiprocessing import Pool import numpy as np import matplotlib.pyplot as plt from matplotlib import gridspec from matplotlib.animation import FuncAnimation import matplotlib.animation as animation import flowrect from flowrect...
StarcoderdataPython
3212888
# file: insertSort_p3.py # Example of InsesrSort program # that is not inputted by user def insertSort(array): length = len(array) i = 0 while(i < length - 1): j = i + 1 tmp = array[j] while( (j > 0) & (tmp > array[j - 1]) ): array[j] = array[j - 1] ...
StarcoderdataPython
5661
<reponame>scwolof/doepy<gh_stars>1-10 """ MIT License Copyright (c) 2019 <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...
StarcoderdataPython
179136
n = int(input('Digite um número para ver sua tabuada: ')) print('____________ \n' '{} x 1 = {} \n' '{} x 2 = {} \n' '{} x 3 = {} \n' '{} x 4 = {} \n' '{} x 5 = {} \n' '{} x 6 = {} \n' '{} x 7 = {} \n' '{} x 8 = {} \n' '{} x 9 = {} \n' '{} x...
StarcoderdataPython
150932
<reponame>kanesoban/pulmonary_fibrosys<gh_stars>0 import numpy as np import tensorflow as tf def laplace_log_likelihood(y_true, y_pred): uncertainty_clipped = tf.maximum(y_pred[:, 1:2] * 1000.0, 70) prediction = y_pred[:, :1] delta = tf.minimum(tf.abs(y_true - prediction), 1000.0) metric = -np.sqrt(2....
StarcoderdataPython
4833413
from .cky import CKY from .deptree import DepTree from .linearchain import LinearChain from .semimarkov import SemiMarkov from .semirings import LogSemiring, MaxSemiring, StdSemiring, SampledSemiring import torch from hypothesis import given, settings from hypothesis.strategies import integers, data, sampled_from smin...
StarcoderdataPython
1605440
#coding: utf-8 import os __all__ = [ "UTILS_DIR", "MODULE_DIR", "REPO_DIR", "DATA_DIR", "SAMPLE_LIST_PATH", ] UTILS_DIR = os.path.dirname(os.path.abspath(__file__)) #: path/to/TeiLab-BasicLaboratoryWork-in-LifeScienceExperiments/teilab/utils MODULE_DIR = os.path.dirname(UTILS_DIR) #: ...
StarcoderdataPython
78515
<gh_stars>0 # This file is part of the Extra-P software (http://www.scalasca.org/software/extra-p) # # Copyright (c) 2020, Technical University of Darmstadt, Germany # # This software may be modified and distributed under the terms of a BSD-style license. # See the LICENSE file in the base directory for details. impor...
StarcoderdataPython
1627589
from seleniumwire.thirdparty.mitmproxy.addons import core from seleniumwire.thirdparty.mitmproxy.addons import streambodies from seleniumwire.thirdparty.mitmproxy.addons import upstream_auth def default_addons(): return [ core.Core(), streambodies.StreamBodies(), upstream_auth.UpstreamAuth...
StarcoderdataPython
178441
<reponame>ardihikaru/mlsp<gh_stars>0 # Source: https://github.com/ninpnin/isomap/blob/master/isomap.py import numpy as np from scipy import sparse from scipy.sparse.csgraph import connected_components from scipy import spatial from scipy.spatial import distance_matrix import matplotlib.pyplot as plt import pandas imp...
StarcoderdataPython
1741296
<reponame>DO-Ui/grabble-bot def RemoveFromList(thelist, val): return [value for value in thelist if value != val] def GetDic(): try: dicopen = open("wordlist.txt", "r") dicraw = dicopen.read() dicopen.close() diclist = dicraw.split("\n") diclist = RemoveFromList(diclist...
StarcoderdataPython
1768768
<reponame>TingwenH/Project # AUTO GENERATED FILE - DO NOT EDIT from dash.development.base_component import Component, _explicitize_args class Row(Component): """A Row component. Row is one of the core layout components in Bootstrap. Build up your layout as a series of rows of columns. Row has arguments for contr...
StarcoderdataPython