id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
177356
<reponame>bird-house/malleefowl<filename>malleefowl/processes/wps_workflow.py import os import yaml from pywps import Process from pywps import ComplexInput from pywps import ComplexOutput from pywps import Format, FORMATS from pywps.app.Common import Metadata from malleefowl.workflow import run import logging LOGGE...
StarcoderdataPython
131241
############################################################################# #Replace with the persons name that you were texting leftName = "Bob" #Replace with your name rightName = "John" #############################################################################
StarcoderdataPython
1733247
from django.apps import AppConfig class TangtocConfig(AppConfig): name = 'tangtoc'
StarcoderdataPython
3225223
<reponame>LanceLiang2018/NovelPublisher<gh_stars>0 import requests import pymongo class DataBase: def __init__(self): self.client = None self.db = None self.col = None self.connect_init() def connect_init(self): # 下面这个是哪个数据库来着??? # self.client = pymongo.MongoCl...
StarcoderdataPython
19778
import json from configserver import ConfigServer, get_postgres_db from configserver.errors import InvalidRouteUUIDError from flask.testing import FlaskClient import pytest from peewee import SqliteDatabase import logging from uuid import uuid4 import functools from typing import Iterable @pytest.fixture(autouse=True...
StarcoderdataPython
45492
<reponame>kkeya1/FCPH #%% # Main source = Deep hit model, 'https://github.com/chl8856/DeepHit' #%% ''' This provide time-dependent Concordance index and Brier Score: - Use weighted_c_index and weighted_brier_score, which are the unbiased estimates. See equations and descriptions eq. (11) and (12) of the...
StarcoderdataPython
1680019
#!/usr/bin/env python # -*- coding: utf-8 -*- import itertools import logging import os import tempfile import struct import signal import time import threading import webbrowser from collections import defaultdict from functools import wraps import click import plexapi from lomond import WebSocket from lomond.persi...
StarcoderdataPython
3256544
# # Copyright(c) 2019-2020 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause-Clear # import base64 import math import textwrap from datetime import datetime from aenum import IntFlag, Enum from core.test_run import TestRun from test_tools.dd import Dd from test_utils.size import Size, Unit class Permissio...
StarcoderdataPython
3293848
<filename>PyXAB/algos/VPCT.py # -*- coding: utf-8 -*- """Implementation of VPCT (Li et al. 2021) """ # Author: <NAME> <<EMAIL>> # License: MIT import numpy as np from PyXAB.algos.Algo import Algorithm from PyXAB.algos.VHCT import VHCT from PyXAB.algos.GPO import GPO class VPCT(Algorithm): def __init__(self, numa...
StarcoderdataPython
3388989
# 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. # -----------------------------------------------------...
StarcoderdataPython
103192
import numpy as np import cv2 from iPERCore.tools.utils.visualizers.visdom_visualizer import VisdomVisualizer visualizer = VisdomVisualizer( env="test_train", ip="http://localhost", # need to be replaced. port=8097 # need to be replaced. ) mask0 = cv2.imread("/media/Diskf/Datasets/iper/primitives/006/1/...
StarcoderdataPython
139946
<gh_stars>0 import matplotlib.pyplot as plt from sklearn.metrics import confusion_matrix, plot_confusion_matrix import numpy as np def confus_matrix(signalflag , prediction , model=False ,X_test=False,y_test=False ,plot=False , test=True): ''' #cm.confus_matrix(actual_results,predictions,model,<test data(or new_d...
StarcoderdataPython
19459
<filename>lib/JumpScale/tools/cuisine/solutions/CuisineCockpit.py from JumpScale import j base = j.tools.cuisine._getBaseClass() class CuisineCockpit(base): def __init__(self, executor, cuisine): self._executor = executor self._cuisine = cuisine def configure(self): C = """ ...
StarcoderdataPython
8204
<reponame>yogeshprasad/spa-development<gh_stars>0 # Generated by Django 2.0.6 on 2018-11-02 09:44 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('pages', '0003_coachingcourse'), ] operations = [ migrations.AlterField( model_...
StarcoderdataPython
110229
<gh_stars>1-10 import os import pexpect import shutil import tarfile from django.conf import settings from django.db import connection from . import settings as local_settings from .models import Dump def dump_database(dump): db_host = settings.DATABASES['default']['HOST'] db_port = settings.DATABASES['defa...
StarcoderdataPython
191734
<gh_stars>0 # Licensed under a MIT style license - see LICENSE.rst # -*- coding: utf-8 -*- """ digestor.sdss ============= Convert SDSS SQL (MS SQL Server) table definitions to Data Lab SQL (PostgreSQL). """ import os import re import sys import time # from datetime import datetime from argparse import ArgumentParser ...
StarcoderdataPython
56561
<filename>practicioner_bundle/ch15-neural_style/style_transfer.py # -*- coding: utf-8 -*- """Neural Style Transfer Driver Script Example: $ python style_transfer.py """ from keras.applications import VGG19 from pyimagesearch.nn.conv import NeuralStyle # initialize the settings dictionary SETTINGS = { # initia...
StarcoderdataPython
3210845
<gh_stars>1-10 # --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- # Miscellaneous DEFAULT_ENDPOINT = "core.windows.net" HTTPS = "https" HTTP = "http" DEFAULT_AUTHORITY_URL = "https://login.m...
StarcoderdataPython
154530
#!/usr/bin/env python from panda.api.activity_log import ActivityLogResource from panda.api.category import CategoryResource from panda.api.data import DataResource from panda.api.datasets import DatasetResource from panda.api.data_uploads import DataUploadResource from panda.api.exports import ExportResource from pan...
StarcoderdataPython
3281418
<filename>lab-3/prediction.py import matplotlib.pyplot as plt import glob from sklearn.ensemble import RandomForestClassifier from constants import * def predict(train_data, train_labels): clf = RandomForestClassifier(n_estimators=NUM_TREES, random_state=SEED, n_jobs=-1) clf.fit(train_data, train_labe...
StarcoderdataPython
1627338
# dummy script
StarcoderdataPython
102568
#!/usr/bin/python from utils import jsonclass from dataclasses import dataclass from typing import List @jsonclass('JsonClass.json') @dataclass class Cleanup: name: str age: int array: List[int] if __name__ == '__main__': # c1 = Cleanup(name='John', age=25, array=[12, 20]) # c1.save() c2 = C...
StarcoderdataPython
1797722
<reponame>Enny1991/sep_eval<filename>sep_eval/tests/test_sep_eval.py from __future__ import print_function from unittest import TestCase import numpy as np import soundfile as sf import warnings from sep_eval.sep_eval import pesq, stoi, sdr, bss_eval warnings.simplefilter(action='ignore', category=FutureWarning) cl...
StarcoderdataPython
47513
#Decorator Pattern def my_decorator(func): def wrap_func(*args, **kwargs): print("**********") func(*args, **kwargs) print("**********") return wrap_func @my_decorator def hello(greeting,emoji, withLove="your love"): print(greeting,emoji, withLove) hello('yo yo', '<3')
StarcoderdataPython
3275985
from numpy.testing import TestCase, assert_array_equal, \ assert_array_almost_equal, assert_almost_equal import numpy as np import os from parameterized import parameterized from .. import environments from ..auction_data import AuctionData, moment_matrix, FilterTies from ..analytics import ( IsNonCompetitive,...
StarcoderdataPython
1791667
#!/usr/bin/python import sys NUMERIC_OUTPUT = True try: filename = sys.argv[1] except: print "Usage:", sys.argv[0], "<filename>" raise SystemExit try: inFile = file(filename) except: print "Error when opening", filename raise SystemExit # code is kept as a list of voices, each voice a strin...
StarcoderdataPython
1656585
from flask import Blueprint bp = Blueprint('index', __name__, url_prefix='') @bp.route('/', methods=['GET']) def index() -> str: return "The server is runing!"
StarcoderdataPython
1686421
<filename>thonny/plugins/micropython/api_stubs/ujson.py def dump(): pass def dumps(): pass def load(): pass def loads(): pass
StarcoderdataPython
1615365
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Imports for spiegelib core """
StarcoderdataPython
178957
<filename>pytorch_research/cv_utils.py """CV Utils from Torchbearer. https://github.com/pytorchbearer/torchbearer/blob/d2b21b8ffcabde5b505cb1c736e05af6ee4276ca/torchbearer/cv_utils.py MIT License Copyright (c) 2018 <NAME>, <NAME> and <NAME> Permission is hereby granted, free of charge, to any person obtaining a co...
StarcoderdataPython
3338933
import unittest import os import sys # This makes it easy to import the needed files sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")) from src.recruiter_class import Recruiter from src.sql_class import SQL from src.constants import TEST_DB class TestRecruiter(unittest.TestCase): ...
StarcoderdataPython
3399595
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Last edited 2021-02-10 Anisotropic polycrystal multiphase field: model problem formulation, adapted from phase_field_composites by <NAME>, https://zenodo.org/record/1188970 This file is part of phase_field_polycrystals based on FEniCS project (https://fenicsproject....
StarcoderdataPython
1668696
import numpy as np import osmnx as ox import networkx as nx from sklearn.neighbors import KDTree import folium import matplotlib.pyplot as plt sorth_street = (30.207238, 120.204248) G = ox.graph_from_point(sorth_street, distance=500) ox.plot_graph(G, fig_height=10, fig_width=10, edge_color='green') route = nx.shortes...
StarcoderdataPython
3361724
<gh_stars>100-1000 from .GSLcython_rt import *
StarcoderdataPython
3327357
""" OpenTMI module """ # Internal imports from opentmi_client.utils.Base import BaseApi from opentmi_client.utils.decorators import setter_rules from opentmi_client.api.testcase.Skip import Skip class Execution(BaseApi): """ Execution class """ def __init__(self): """ Constructor for Execution """ ...
StarcoderdataPython
1738240
<reponame>rebeccaserramari/polyploid-potato-assembly<gh_stars>0 import sys import numpy as np from matplotlib import pyplot as plt import seaborn as sns import pandas as pd import copy from collections import defaultdict def write_clusters_to_file(clusters, outfile): with open(outfile, 'w') as outf: for key,nodes ...
StarcoderdataPython
111056
"""This py describe the class the could be accessed by other.""" __author__ = "<NAME>" __copyright__ = "CASA" __version__ = "1.0.1" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __status__ = "Development"
StarcoderdataPython
1774011
<gh_stars>0 import argparse from .router_client import RouterClient def apply_action(url, password, action, **kwargs): client = RouterClient(url, password) func = getattr(client, action) return func(**kwargs) def main(): parser = argparse.ArgumentParser(add_help=False) parser.add_argument("--ur...
StarcoderdataPython
3264687
<reponame>termsofservice212/django-tinymce4-lite<gh_stars>100-1000 from django.contrib import admin from .models import TestModel, TestChildModel class ChildInline(admin.StackedInline): model = TestChildModel extra = 1 @admin.register(TestModel) class TestModelAdmin(admin.ModelAdmin): inlines = [ChildIn...
StarcoderdataPython
40945
<filename>chapter07/address_book_import.py class AddressBook: person_list = [] def add(self, person): self.person_list.append(person) def show_all(self): for person in self.person_list: print(person.lastname + " " + person.firstname) def search(self,keyword): for ...
StarcoderdataPython
3208859
# Enter script code import re winClass = window.get_active_class() isGoogleChrome1 = re.search("google-chrome\.[g|G]oogle-chrome", winClass) isGoogleChrome2 = re.search("Google-chrome-stable\.Google-chrome-stable", winClass) isTerminalWin = re.search("x+terminal.*", winClass) isKonsole = re.search("konsole\\.konsole", ...
StarcoderdataPython
1718854
from behave import * from cylinder import cylinder from ray import ray from tuple import normalize, point, vector from util import equals @given(u"cyl ← cylinder()") def step_impl(context): context.cyl = cylinder() @given(u"direction ← normalize(vector(0, 1, 0))") def step_impl(context): context.direction ...
StarcoderdataPython
3310450
<gh_stars>0 import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torchvision import datasets from torchvision import transforms from torch.utils.data import DataLoader from torch.utils.data import TensorDataset from torch.utils.data.dataset import Dataset import sys i...
StarcoderdataPython
96797
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from abc import abstractmethod import datetime from mozprocess import ProcessHandlerMixin import multiprocessing import ...
StarcoderdataPython
3375970
<reponame>ArnaudCrl/pywellcad import unittest import pathlib import wellcad.com from ._extra_asserts import ExtraAsserts class TestFossilItem(unittest.TestCase, ExtraAsserts): @classmethod def setUpClass(cls): cls.app = wellcad.com.Application() cls.borehole = cls.app.new_borehole() cl...
StarcoderdataPython
4804435
<reponame>SaahilMahato/X3PO from Tasks import OpenApp from Tasks import SystemControl from Tasks import YouTubeDownloader from Tasks import CreateProject import Assistant import pygame class DeduceInput(Assistant.Interact): def __init__(self, user_input): super().__init__() self.user_input = user_...
StarcoderdataPython
3236521
""" Unit tests for the QVM simulator device. """ import logging import re import networkx as nx import pytest import re import pennylane as qml from pennylane import numpy as np from pennylane.operation import Tensor from pennylane.circuit_graph import CircuitGraph from pennylane.wires import Wires from pyquil.quil ...
StarcoderdataPython
1617003
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. # # Copyright (c) 2014-2019, <NAME> <EMAIL> """ Interface for GHDL simulator """ from __future__ import print_function ...
StarcoderdataPython
1612553
def simple(): spam = 'ni' def action(): print(spam) # name maps to enclosing function return action act = simple() # make and return nested function act() # then call it: prints 'ni' def normal(): def action(): return spam ...
StarcoderdataPython
1637517
from pathlib import Path import os from securefile_handler._erase_helpers import shred_file def shred(filepath: Path, chunk_size=4 * 1024): """ Function, that securely shreds file. File operation exceptions are not handled. :param filepath: Path class with filepath :param chunk_size: Size of chu...
StarcoderdataPython
1677742
<reponame>silvanmelchior/WebSafeCracker # Generated by Django 3.0.4 on 2020-03-30 13:41 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('safecracker', '0005_task_points'), ] operations = [ migrations.AddField( model_name='set...
StarcoderdataPython
92927
<gh_stars>0 from SpacerCorePy import *
StarcoderdataPython
3275947
<filename>utils/preprocess.py import os import logging import time import warnings import numpy as np import cv2 from PIL import Image def normalize(img, mode=None): if mode == 'tf': img = img / 127.5 - 1.0 # img = img / 255. elif mode == 'torch': # tensorflow img /= 255. mea...
StarcoderdataPython
1733413
# Copyright (c) 2022. LESCLAZ. # # # 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 Foundation, either version 3 of the License, or # (at your option) any later version. # # # This program is distrib...
StarcoderdataPython
3342460
<reponame>lynnsoerensen/SpatialAttention_sDCNN_2020 from asn.conversion.utils import predict_model_length def set_attn_param(layer_idx= None, Ax1=None, Ax2=None, AxWidth1=None, AxWidth2=None, Apeak=2, Abase=1, Ashape='oval', exponent=None, IxWidth=0, InputGain=0...
StarcoderdataPython
1675677
""" Scrapper implementation """ from datetime import datetime import json import re import shutil from pathlib import Path import requests from bs4 import BeautifulSoup from constants import ASSETS_PATH, CRAWLER_CONFIG_PATH, HEADERS from core_utils.article import Article class IncorrectURLError(Exception): """ ...
StarcoderdataPython
3325035
from sqlmodel import SQLModel, Field import uuid as uuid_pkg from typing import Optional class FilesBase(SQLModel): name: str class Files(FilesBase, table=True): id: int = Field(default=None, primary_key=True) uuid: uuid_pkg.UUID = Field( default_factory=uuid_pkg.uuid4, index=True, ...
StarcoderdataPython
183186
<filename>test/test_haplotype.py<gh_stars>1-10 from mhcgnomes import Haplotype, parse, Species, Parser from nose.tools import eq_ def test_H2_a_in_species_haplotypes_dictionary(): species = Species.get("H2") assert species is not None assert "a" in species.haplotypes def test_get_H2a_haplotype(): pars...
StarcoderdataPython
1761997
<gh_stars>10-100 # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import numpy as np import os import logging import torch from tqdm.auto import tqdm from torch.nn.parallel import DistributedDataParallel as DDP import torch.multiprocessing as mp from LanguageModels.SpeedyModel import SpeedyMod...
StarcoderdataPython
4827449
#! /usr/bin/env python # A Pyrelval Wrapper import optparse import sys import os import re import Configuration.Applications from Configuration.Applications.ConfigBuilder import ConfigBuilder, defaultOptions import traceback from functools import reduce def checkOptions(): return def adaptOptions(): re...
StarcoderdataPython
3286485
import FWCore.ParameterSet.Config as cms from Configuration.Generator.Pythia8CommonSettings_cfi import * from Configuration.Generator.MCTunes2017.PythiaCP5Settings_cfi import * generator = cms.EDFilter("Pythia8ConcurrentGeneratorFilter", pythiaPylistVerbosity = cms.untracked.int32(0), pythiaHepMCVerbosity = cm...
StarcoderdataPython
3350485
<reponame>evencatt/with_tutor<gh_stars>0 from django.contrib import admin from django.urls import path, include from django.conf import settings from django.conf.urls.static import static from . import views urlpatterns = [ path('', include('about.urls', namespace='about')), path('vocabulary/', include('vocab...
StarcoderdataPython
27682
<reponame>brunobg/spaczz """Module for regex components.""" from .regexconfig import RegexConfig __all__ = ["RegexConfig"]
StarcoderdataPython
108790
import requests import json import sys import os from hashlib import sha1 import time import pickle class JsonRPCClient(object): def __init__(self, host, port=8080, user="", password="", cache_duration=60*60*24): self.host = host self.port = port self.user = user self.password = pa...
StarcoderdataPython
141377
""" author: <NAME> (https://github.com/akshaychawla) TEST:rs Test convert.py's ability to handle Deconvolution and Crop laye by converting voc-fcn8s .prototxt and .caffemodel present in the caffe/models/segmentation folder """ # import os # import inspect # import numpy as np # import keras.caffe.convert as convert # f...
StarcoderdataPython
23173
<reponame>anthony-walker/me499<filename>types/integers.py<gh_stars>10-100 #!/usr/bin/env python3 if __name__ == '__main__': # Python can represent integers. Here are a couple of ways to create an integer variable. Notice the truncation, # rather than rounding, in the assignment of d. a = 5 b = int()...
StarcoderdataPython
196517
<reponame>ChuckNorrison/Meshtastic-python import meshtastic import time interface = meshtastic.SerialInterface() # By default will try to find a meshtastic device, otherwise provide a device path like /dev/ttyUSB0 interface.sendText("hello mesh") interface.close()
StarcoderdataPython
3333095
<reponame>ThomasYeoLab/Standalone_He2022_MM #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Written by <NAME> and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md """ import os import time import random import argparse import numpy as np import scipy.io as sio from sklearn.model_s...
StarcoderdataPython
1738523
from __future__ import with_statement import os import sys import types import unittest import functools def ensure_in_path(path): """ Ensure that a given path is in the sys.path array """ if not os.path.isdir(path): raise RuntimeError('Tried to add nonexisting path') def _samefile(x, y)...
StarcoderdataPython
1754769
<gh_stars>100-1000 """ OTE parameters validation tests helpers """ import numpy as np from ote_sdk.entities.annotation import ( Annotation, AnnotationSceneEntity, AnnotationSceneKind, ) from ote_sdk.entities.dataset_item import DatasetItemEntity from ote_sdk.entities.datasets import DatasetEntity from ote...
StarcoderdataPython
1771566
import click from isitfit.cli.click_descendents import IsitfitCommand, isitfit_group @isitfit_group(help="Manage migrations for local files (useful for debugging)", invoke_without_command=False, hidden=True) @click.pass_context def migrations(ctx): # FIXME click bug: `isitfit command subcommand --help` is calling th...
StarcoderdataPython
3287878
from .criterion import * from .models import *
StarcoderdataPython
1729165
<gh_stars>0 import matplotlib.pyplot as plt from sklearn import datasets from sklearn import metrics from sklearn import svm from sklearn.cross_validation import train_test_split from sklearn.grid_search import GridSearchCV from sklearn.manifold import Isomap digits = datasets.load_digits() X_train, X_test, y_train, y...
StarcoderdataPython
4814851
<filename>test_geo.py from floodsystem.stationdata import build_station_list from floodsystem.geo import stations_by_distance, stations_within_radius, rivers_with_station, stations_by_river, rivers_by_station_number #1B test def test_stations_by_distance(): # Build list of stations stations = build_station_li...
StarcoderdataPython
60358
<reponame>merkys/aiida-nwchem # -*- coding: utf-8 -*- import os import shutil from aiida.orm.calculation.job import JobCalculation from aiida.orm.data.parameter import ParameterData from aiida.orm.data.structure import StructureData from aiida.common.datastructures import CalcInfo, CodeInfo from aiida.common.exception...
StarcoderdataPython
3350596
# DO NOT EDIT -- GENERATED BY CMake -- Change the CMakeLists.txt file if needed bigtable_client_integration_tests = [ "admin_integration_test.cc", "admin_async_integration_test.cc", "admin_async_future_integration_test.cc", "data_async_integration_test.cc", "data_integration_test.cc", "filters_i...
StarcoderdataPython
1730601
from flask import g from . import database as db from OBlog import app from .blueprint.posts.main import getPostForShow from .blueprint.admin.main import getSiteConfigDict import re def getSite(): if not hasattr(g, 'getSite'): res = getSiteConfigDict() from .blueprint.pages.main import ge...
StarcoderdataPython
181221
''' @File: dirty_demo.py @Description: Demo @Author: leon.li(<EMAIL>) @Date: 2020-02-11 15:33:59 ''' import requests import json from dingdinghelper import DingDingHelper if __name__ == "__main__": ding = DingDingHelper() ding.corpid = 'ding428c9b6bb8962a4d35c2f4657eb6378f' ding.corpsecret = '<KEY>' ding.msgu...
StarcoderdataPython
1697694
<reponame>MiracleWong/PythonBasic<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'MiracleWong' # 超实用的 30 段 Python 案例 # 地址:https://mp.weixin.qq.com/s/_q1eJPXZYL7r6VAyjt7Jag import sys import time import random from collections import Counter from iteration_utilities import deepflatten # 1.检查重复...
StarcoderdataPython
1791402
# Copyright 2021 VMware, Inc. # SPDX-License-Identifier: Apache-2.0 import logging import os import uuid from enum import Enum from airflow.exceptions import AirflowException from airflow.providers.http.hooks.http import HttpHook from taurus_datajob_api import ApiClient from taurus_datajob_api import Configuration fro...
StarcoderdataPython
1744723
<filename>projman/settings/util.py # -*- coding: utf-8 -*- from django.core.exceptions import ImproperlyConfigured import os def get_env_setting(setting): try: return os.environ[setting] except KeyError: raise ImproperlyConfigured( "Could not find setting '{}' in the environment."....
StarcoderdataPython
3379955
"""Initializers for PRESS layers.""" from typing import Union, Optional, List import tensorflow as tf import numpy as np def _get_predictive_state_means_init( init_value: Union[float, np.ndarray], n_states: int, units: int ) -> tf.Tensor: """Gets initial weights for predictive state means.""" ones = np...
StarcoderdataPython
1655862
import typing from .channel import detect_used_env_var, env_var_normalize if typing.TYPE_CHECKING: from pytest import MonkeyPatch def test_detect_used_env_var(monkeypatch: "MonkeyPatch") -> None: monkeypatch.setenv("AKEY", "a") monkeypatch.setenv("ATOKEN", "a") monkeypatch.setenv("A", "a") ass...
StarcoderdataPython
1714596
from pathlib import PurePath def part1(l: list[int]) -> int: counts = {} lowest, highest = float('inf'), float('-inf') for num in l: counts[num] = counts.get(num, 0) + 1 lowest = min(lowest, num) highest = max(highest, num) best = -1 best_cost = float('inf') for pos in r...
StarcoderdataPython
57600
<reponame>rishidevc/stkovrflw def func3(a): a/0; def func2(a, b): func3(a); def func1(a, b, c): func2(a, b); if __name__ == "__main__": func1(12, 0, 89)
StarcoderdataPython
1706450
#!/usr/bin/env python # -*- coding: utf-8 -*- # pretty print import pprint pp = pprint.PrettyPrinter(indent=2) import Bookmark def getDepth(item): if 'depth' in item: return item['depth'] return '' def getPath(item): if 'path' in item: return item['path'] return '' def getChildren(item): if 'childr...
StarcoderdataPython
3285224
<filename>test/nlp/test_autohf_multichoice_classification.py import sys import pytest @pytest.mark.skipif(sys.platform == "darwin", reason="do not run on mac os") def test_mcc(): from flaml import AutoML import requests import pandas as pd train_data = { "video-id": [ "anetv_fruim...
StarcoderdataPython
4834701
from .context_block import ContextBlock2d,TemporalContextBlock,TemporalContextBlockshort,TemporalContextBlockshort_max __all__ = [ 'ContextBlock2d','TemporalContextBlock','TemporalContextBlockshort','TemporalContextBlockshort_max' ]
StarcoderdataPython
126541
#!/usr/bin/env python # coding=utf-8 ''' @Author: wjm @Date: 2019-10-13 23:07:03 @LastEditTime: 2020-07-13 16:45:30 @Description: file content ''' import os, torch, time from utils.utils import draw_curve_and_save, save_config from data.dataset import data from data.data import get_data from torch.utils.data import Da...
StarcoderdataPython
3354622
<filename>io_import_rbsp/bsp_tool/branches/ritual/moh_allied_assault.py # https://github.com/zturtleman/spearmint/blob/master/code/qcommon/bsp_mohaa.c # TODO: finish copying implementation import enum from typing import List from .. import base from .. import shared from ..id_software import quake from . import fakk2 ...
StarcoderdataPython
158546
from abc import ABCMeta, abstractmethod import random from environment import Environment class GridMap(object): def __init__(self, agent_pos_default, reward_pos_default): self.data = None self.ylen = -1 self.xlen = -1 self.agent_pos_default = agent_pos_default self.agen...
StarcoderdataPython
3362905
from pathlib import Path EXAMPLES_ABS_ROOT = Path(__file__).parent
StarcoderdataPython
123729
<filename>magellan_models/model_generator/generate_from_spec.py<gh_stars>1-10 """ Main entry point for Parser and model generator """ from typing import Tuple import inflection from magellan_models.config import MagellanConfig from .openapi_parser import ( get_resource_mapping, parse_resource_names_and_othe...
StarcoderdataPython
3374616
#!/usr/bin/python3 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # ##### #### #### #### # This file is managed by juju. Do not make local changes. # Copyright (C) 2009, 20...
StarcoderdataPython
1719688
<gh_stars>10-100 import pandas as pd from glob import glob import matplotlib.pyplot as plt filenames = glob('data/raw/data_for_november_2019_evaluation/south_sudan_data/Humanitarian Data Exchange/201*.xlsx') dfs = list() for filename in filenames: df = pd.read_excel(filename) df.drop(df.index[0],inplace=True...
StarcoderdataPython
1690359
STATES = ( ('AK', 'Alaska'), ('AL', 'Alabama'), ('AR', 'Arkansas'), ('AZ', 'Arizona'), ('CA', 'California'), ('CO', 'Colorado'), ('CT', 'Connecticut'), ('DC', 'District of Columbia'), ('DE', 'Delaware'), ('FL', 'Florida'), ('GA', 'Georgia'), ('HI', 'Hawaii'), ('IA', '...
StarcoderdataPython
76945
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import concurrent.futures import os import tempfile import zipfile from bs4 import BeautifulSoup from furigana4epub import yomituki from furigana4epub.version import version def unzippen(filename, dst_path): input_file = zipfile.ZipFile(filename, 'r') input_file...
StarcoderdataPython
1705345
import os import simur import sys #------------------------------------------------------------------------------- # #------------------------------------------------------------------------------- def usage(): print(f'{sys.argv[0]} vcs reporoot relpath revision') print(f' e.g. {sys.argv[0]} svn https://barb...
StarcoderdataPython
3354279
# -*- coding: utf-8 -*- """ ZenMaxBuilder Copyright © 2021 darkmaster@grm34 https://github.com/grm34 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/l...
StarcoderdataPython
1686868
#!/usr/bin/env python # encoding: utf-8 """ HUGIN (.net) Bayesian network format reader. Author: <NAME> Using code written by <NAME> """ from __future__ import print_function import sys import re import argparse from bayes_net import Node, Potential, BayesNet, findnode netregex = re.compile("net[\s\n]*{(\n|.)*}") no...
StarcoderdataPython