id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1745885
<gh_stars>10-100 def test_fill(dbs, TestModelA): obj = dbs.create(TestModelA, title="Remember") obj.fill(title="lorem ipsum") dbs.commit() updated = dbs.first(TestModelA) assert updated.title == "lorem ipsum"
StarcoderdataPython
1788964
# stdlib import json # third party from aiortc import RTCSessionDescription from aiortc.contrib.signaling import object_from_string from nacl.signing import SigningKey import nest_asyncio import pytest # syft absolute from syft.core.node.common.service.repr_service import ReprMessage from syft.core.node.domain.domain...
StarcoderdataPython
19082
<reponame>TimSC/PyFeatureTrack from __future__ import print_function import math, numpy as np from PIL import Image from klt import * from error import * from convolve import * from klt_util import * import goodFeaturesUtils class selectionMode: SELECTING_ALL = 1 REPLACING_SOME = 2 KLT_verbose = 1 #***************...
StarcoderdataPython
74296
<filename>src/yaabook/action_controller_search.py import logging import npyscreen class ActionControllerSearch(npyscreen.ActionControllerSimple): def create(self): self.add_action('^/.*', self.set_search, True) def set_search(self, command_line, widget_proxy, live): logging.debug('searching...
StarcoderdataPython
3260
# -*- coding: utf-8 -*- import pickle import numpy as np from rdkit import Chem from rdkit.Chem import AllChem,DataStructs def get_classes(path): f = open(path, 'rb') dict_ = pickle.load(f) f.close() classes = sorted(dict_.items(), key=lambda d: d[1],reverse=True) classes = [(x,y) fo...
StarcoderdataPython
3264083
import redis from prometheus_client import Counter, Histogram from dotenv import load_dotenv from pipeline import ProcessorSettings, Processor, Command, CommandActions, Definition from apihub.utils import Result, Status, RedisSettings, DEFINITION from apihub import __worker__, __version__ load_dotenv() class Resul...
StarcoderdataPython
3274365
<gh_stars>1-10 # Crie um programa onde 4 jogadores joguem um dado e tenham resultados aleatórios. Guarde esses resultados em um dicionário em Python. # No final, coloque esse dicionário em ordem, sabendo que o vencedor tirou o maior número no dado. from random import randint from time import sleep from operator import...
StarcoderdataPython
138187
# Implemente uma aplicação que utilize uma pilha para conversão de expressões da notação tradicional (infixa), para a notação polonesa reversa (pós-fixada).
StarcoderdataPython
108132
res=0 for i in range(1,1001): res += i**i res=str(res) #res='nursyahjaya' print(res[len(res)-10:])
StarcoderdataPython
3324524
import numpy as np def standardize(x_test, x_train): """ standardizes the train and test data matrices input: x_test: matrix which contains test data x_train: matrix which contains train data return: standardized matrices x_test, x_train """ for i in range(x_tes...
StarcoderdataPython
1658252
from libfuturize.fixes.fix_raise import FixRaise
StarcoderdataPython
191850
<filename>solver.py def exact_cover(X, Y): X = {j: set() for j in X} for i, row in Y.items(): for j in row: X[j].add(i) return X, Y def select(X, Y, r): cols = [] for j in Y[r]: for i in X[j]: for k in Y[i]: if k != j: ...
StarcoderdataPython
169972
<reponame>aliabd/cos-cvae from __future__ import print_function import os import random import numpy as np import torch import argparse from torch.utils.data import Dataset, DataLoader import itertools from tqdm import tqdm import pickle import json import sys sys.path.insert(0,'./data') from build_vocab_coco import Vo...
StarcoderdataPython
1720025
<filename>pydelta/mutators_boolean.py from . import options from .semantics import * NAME = 'boolean' MUTATORS = ['de-morgan', 'double-negations', 'eliminate-false-eq', 'eliminate-implications', 'negate-quant'] def is_quantifier(node): return has_name(node) and get_name(node) in ['exists', 'forall'] class DeMorg...
StarcoderdataPython
161652
<reponame>shuigedeng/taotao-cloud-paren<gh_stars>10-100 #!/usr/bin/env python # -*- coding:utf-8 -*- import os import json import time import hashlib import requests from src import plugins from lib.serialize import Json from lib.log import Logger from config import settings from concurrent.futures import ThreadPoolEx...
StarcoderdataPython
3294597
<reponame>Simonll/tools #!/opt/anaconda3/bin/python3.4 import sys import re import numpy as np if (len(sys.argv) != 2): print("exec <phylip>") sys.exit(0) file = sys.argv[1] def compute_dinuc(puz): nuc = {"A" : 0, "C":1, "G":2, "T":3} f = open(puz,"r") lines = f.readlines() f.close...
StarcoderdataPython
3233498
<gh_stars>0 #!/usr/bin/env python from __future__ import print_function import argparse import os from six.moves import cPickle from six import text_type import tensorflow as tf from model import Model def sample(args, prime): with open(os.path.join(args.save_dir, 'config.pkl'), 'rb') as f: saved_arg...
StarcoderdataPython
68442
import concurrent.futures import os import os.path as osp import pathlib import shutil import urllib.parse from .connection import download_image from .data import PageContent from .utils import escape_path OUTPUT_PATH = pathlib.Path('data/') OUTPUT_TEXT_FILENAME = 'article.txt' def save_text(post_text: str, output...
StarcoderdataPython
1764765
<filename>models/trigger.py<gh_stars>1-10 from plugins.splunk.includes import splunk from core.models import trigger from core import logging, auth, db, helpers class _splunkSearch(trigger._trigger): splunkJob = str() splunkHost = str() splunkPort = int() splunkUsername = str() splunkPassword = s...
StarcoderdataPython
1604035
<filename>xcalc/interpreter.py from ufl.corealg.traversal import traverse_unique_terminals from ufl.conditional import (LT, GT, LE, GE, EQ, NE, AndCondition, OrCondition, NotCondition) from dolfin import (Function, VectorFunctionSpace, interpolate, Expression, as_vector,...
StarcoderdataPython
3302597
<filename>tests/tensorflow2/utils.py<gh_stars>0 # Standard Library # Third Party import tensorflow.compat.v2 as tf from packaging import version def is_tf_2_2(): """ TF 2.0 returns ['accuracy', 'batch', 'size'] as metric collections. where 'batch' is the batch number and size is the batch size. But TF...
StarcoderdataPython
71322
import logging import os import re import sys from enum import Enum import click from Bio import SeqIO from Bio.Seq import Seq from tqdm import tqdm tqdm.pandas() import pandas as pd import numpy as np logger = logging.getLogger(__name__) sys.path.append("..") from utils.clustering_utils import ClusteringUtils cl...
StarcoderdataPython
3269352
<filename>products/migrations/0004_auto_20151124_1628.py<gh_stars>0 # -*- coding: utf-8 -*- # Generated by Django 1.9c1 on 2015-11-24 16:28 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('products', '0003_auto_201...
StarcoderdataPython
55328
from asgard.app import app from asgard.handlers import http app.run()
StarcoderdataPython
1689080
""" Blink1 class/lib for blink1-tool and device see tests.py for examples """ import os import time class Blink1(): """Blink1""" blink1_tool_file_path = 'lib/blink1-tool' quite_mode = True command_output = '' def blink(self, number_of_blinks, rgb_color=None, hex_color=None): if rgb_...
StarcoderdataPython
1693730
<reponame>RDC4Smart-Mobility/UniSim # -*- coding: utf-8 -*- from __future__ import division, print_function, absolute_import, unicode_literals from unisim.RESTserver import app, Flask_DB from datetime import datetime import sys if __name__ == "__main__": Flask_DB.dbpath = sys.argv[1] Flask_DB.conne...
StarcoderdataPython
3364965
<reponame>sammylev/Capstone from flask_script import Manager from flask_migrate import Migrate, MigrateCommand from app import APP from models import db migrate = Migrate(APP, db) manager = Manager(APP) manager.add_command('db', MigrateCommand) if __name__ == '__main__': manager.run()
StarcoderdataPython
136425
<filename>osrefl/theory/BAGISANS.py from numpy import * import numpy as np class bornWavefunction: def __init__(self, kz, SLDArray, sigmax = 1e6, sigmaz=1e3): if not isinstance(kz, ndarray): kz = array([kz], dtype=complex) #kz = array([kz]).flatten().astype(complex) se...
StarcoderdataPython
1686430
""" Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. The Universal Permissive License (UPL), Version 1.0 """ import os from shutil import copy2 import unittest from java.io import File from java.lang import String from java.lang import System from oracle.weblogic.deploy.encrypt import Encr...
StarcoderdataPython
3358407
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @File : 1_request_method.py @Time : 2021-02-23 @Author : EvilRecluse @Contact : https://github.com/RecluseXU @Desc : 常用的请求方法GET, POST, PUT, DELETE, HEAD, OPTIONS ''' # here put the import lib import httpx # 常用的请求方法GET, POST, PUT, DELETE, HEAD, OP...
StarcoderdataPython
1642576
<filename>osdria/views/data_input_dialog_view_ui.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'data_input_dialog_view.ui', # licensing of 'data_input_dialog_view.ui' applies. # # Created: Fri Feb 15 10:17:15 2019 # by: pyside2-uic running on PySide2 5.12.1 # # WARNING! All chan...
StarcoderdataPython
3205529
<gh_stars>0 '''Train CIFAR10 with PyTorch 测试 benign acc 和 robust acc(mean acc 随 epoch 的变化情况) 绘制成图 ''' import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torch.backends.cudnn as cudnn import torchvision import torchvision.transforms as transforms import os import argp...
StarcoderdataPython
1779794
<reponame>peteeckel/netbox-dns<filename>netbox_dns/forms/nameserver.py from django.forms import CharField from netbox.forms import ( NetBoxModelBulkEditForm, NetBoxModelFilterSetForm, NetBoxModelCSVForm, NetBoxModelForm, ) from utilities.forms import TagFilterField from netbox_dns.models import NameS...
StarcoderdataPython
3333317
#!/usr/bin/env python import unittest from ssl_announcer import listener class TestListener(unittest.TestCase): def test_add(self): value = 1 actual = listener.add_two(value) expected = 3 self.assertEqual(expected, actual) if __name__ == "__main__": unittest.main()
StarcoderdataPython
4842938
option_button = ['About', 'Eligible Modules', 'Exam Info', 'Details', 'Go back'] goodbye = ['See you soon!', 'Have a nice day :)', 'Have a great day!', 'See you later!', 'Goodbye for now!', 'See you later!', 'Goodbye :)'] welcome_message = "Welcome to NUS Timetable Reminders!* 📆\ \n...
StarcoderdataPython
1611908
"""Logging and Profiling """ from . import settings from datetime import datetime from time import time as get_time from platform import python_version _VERBOSITY_LEVELS_FROM_STRINGS = {'error': 0, 'warn': 1, 'info': 2, 'hint': 3} def info(*args, **kwargs): return msg(*args, v='info', **kwargs) def error(*ar...
StarcoderdataPython
1705876
<reponame>projectcalico/layer-etcd-proxy<filename>lib/etcdctl.py from charmhelpers.core.hookenv import log from subprocess import CalledProcessError from shlex import split from subprocess import check_output import os class EtcdCtl: ''' etcdctl modeled as a python class. This python wrapper consumes and expo...
StarcoderdataPython
1647681
<reponame>ajfar-bem/wisebldg<filename>DeviceAPI/API_SmartThings.py # -*- coding: utf-8 -*- ''' Copyright (c) 2016, Virginia Tech All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of sou...
StarcoderdataPython
181354
<gh_stars>10-100 import numpy as np import h5py debug = False termination = h5py.File('./termination.h5', 'r').get('data') reward = h5py.File('./reward.h5', 'r').get('data') activations = h5py.File('./activations.h5', 'r').get('data') actions = h5py.File('./actions.h5', 'r').get('data') qvals = h5py.File('./qvals.h5'...
StarcoderdataPython
70880
<gh_stars>10-100 import os import sys import numpy as np import random import scipy import torch class Policy(object): def __init__(self, taxonomy_id, path_max_length, right_node_reward): self.taxonomy_id = taxonomy_id self.right_node_reward = right_node_reward self.wrong_node_reward = ...
StarcoderdataPython
3230922
<reponame>ZhiHaoi/autonetkit<filename>autonetkit/design/routing.py from autonetkit.design.utils import filters from autonetkit.network_model.network_model import NetworkModel from autonetkit.network_model.topology import Topology from autonetkit.network_model.types import DeviceType def _build_igp_base(network_model:...
StarcoderdataPython
169387
<filename>prediction.py<gh_stars>0 import numpy as np from tensorflow.keras import Sequential from tensorflow.keras.layers import Dense, LSTM, Dropout """ Original Code https://github.com/INVESTAR/StockAnalysisInPython/blob/master/09_Deep_Learning_Prediction/ch09_09_RNN_StockPrediction.py modified by s-jun...
StarcoderdataPython
1714727
<filename>setuz/parsers/brand.py<gh_stars>1-10 from ..schemes.brand import BrandListSchema, BrandSchema def brand_parser(response) -> BrandListSchema: data = response.json() brands: list = [] for result in data['results']: brands.append(BrandSchema( id=result['id'], name=r...
StarcoderdataPython
91473
# Course: EE551 Python for Engineer # Author: <NAME> # Date: 2021/05/04 # Version: 1.0 # Defines routes for the front-end from flask import render_template, url_for, flash, redirect, request, send_from_directory, send_file from image_processor.forms import ImageProcessForm from image_processor import app from image_pro...
StarcoderdataPython
3285766
<reponame>MattiasFredriksson/py-c3d<gh_stars>0 ''' Classes used to represent the concept of a parameter in a .c3d file. ''' import struct import numpy as np from .utils import DEC_to_IEEE, DEC_to_IEEE_BYTES class ParamData(object): '''A class representing a single named parameter from a C3D file. Attributes ...
StarcoderdataPython
48326
__all__ = ['Database']
StarcoderdataPython
3253053
from lib.modules.DetectionModule import * class Module(DetectionModule): def __init__(self, name, event_json): super().__init__(name=name, event_json=event_json) def run(self): self.logger.debug('Running the {} detection module'.format(self.name)) # Loop over each sandboxed sample in...
StarcoderdataPython
3226679
<filename>tests/nn/data_parallel/test_fsdp_overlap.py # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. # pylint: disable=missing-module-docstring # pylint: disable=missin...
StarcoderdataPython
143016
class Response: def __init__(self, inst): self.instance = inst @property def id(self): return self.instance['status'] @property def status(self): return self.instance['status']
StarcoderdataPython
54636
<filename>src/run_sign.py #!/usr/bin/env python # SPDX-License-Identifier: Apache-2.0 # # The OpenSearch Contributors require contributions made to # this file be licensed under the Apache-2.0 license or a # compatible open source license. import sys from sign_workflow.sign_args import SignArgs from sign_workflow.si...
StarcoderdataPython
148430
<filename>hostel_project/hostel_webapp/migrations/0001_initial.py # Generated by Django 2.2 on 2020-08-05 14:27 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ] operations...
StarcoderdataPython
3364728
<reponame>jmeppley/py-metagenomics<filename>screen_table.py<gh_stars>1-10 #!/usr/bin/env python """ Take list of reads (or any names) from file. Remove these (or all but these) from each of a list of text tables (e.g. m8 files). Table to screen can also be piped through STDIN. To identify reads hitting specific seque...
StarcoderdataPython
12285
<reponame>Brownc03/python-api-challenge # OpenWeatherMap API Key weather_api_key = "ae41fcf95db0d612b74e2b509abe9684" # Google API Key g_key = "<KEY>"
StarcoderdataPython
3396776
<gh_stars>10-100 #! /usr/bin/env python # -*- coding: utf-8 -*- import pkgutil import six from nose.tools import ( assert_equal, assert_not_equal, assert_raises, assert_is_instance, raises) import url from url.url import StringURL, UnicodeURL def test_bad_port(): def test(example): assert_raise...
StarcoderdataPython
41689
import html from enum import Enum from .errors import HttpError, ApiError, InternalError, AppLaunchError, NoFocusedTextFieldError, \ ErrorCode, get_error_message, EncryptionError from .util import coalesce_none_or_empty class AppFeature(Enum): ''' Describes which features are supported by the current app....
StarcoderdataPython
3254105
# Copyright (c) 2019 Works Applications Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
StarcoderdataPython
25067
# Generated by Django 3.0.10 on 2020-09-10 13:16 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0003_user_mobile_phone'), ] operations = [ migrations.AlterField( model_name='user', name='mobile_phone', ...
StarcoderdataPython
1729606
<filename>bitwise.py #!/Applications/anaconda/envs/Python3/bin def main(): '''Bitwise Operators and Examples''' x, y, allOn = 0x55, 0xaa, 0xff print("x is: ", end="") bitPrint(x) print("y is: ", end="") bitPrint(y) print("allOn is: ", end="") bitPrint(allOn) # Bitwise OR: | p...
StarcoderdataPython
3363006
<filename>back-end/main.py<gh_stars>0 # uvicorn main:app --reload from products import delete_product, select_product, insert_product, product_model from users import delete_user, insert_user, select_user, user_model from start_app import * app = start_app() @app.get("/") async def root(): return "Api básica pa...
StarcoderdataPython
1692757
''' Example of MBEANN in Python solving XOR. ''' import multiprocessing import os import pickle import random import time import numpy as np from examples.xor.settings import SettingsEA, SettingsMBEANN from mbeann.base import Individual, ToolboxMBEANN from mbeann.visualize import visualizeIndividual def evaluateIn...
StarcoderdataPython
1656067
from os import path, getcwd from classifier.application import create_app settings_file = path.join(getcwd(), "settings.py") app = create_app(settings_file)
StarcoderdataPython
3326225
<reponame>odinn13/comb_spec_searcher-1 """ The constructor class contains all the method, and logic, needed to get the enumeration, generate objects, and sample objects. The default constructors implemented are: - CartesianProduct - DisjointUnion - Empty Currently the constructors are implemented in one variable, nam...
StarcoderdataPython
181491
# Generated by Django 2.2.7 on 2019-11-06 23:28 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Todo', fields=[ ('id', models.AutoField(aut...
StarcoderdataPython
161821
import serial import time import sys import os #------------------------------------------------------------------------------- # !!! START USER UPDATE !!! COM_PORT = 'COM3' # Windows COM port # the Teensy is connected to BAUD_RATE = 1...
StarcoderdataPython
124384
<filename>ex47_tests.py from nose.tools import * from ex47.game import Room def test_room(): gold = Room("GoldRoom", """This room has gold in it you can grab. There's a door to the north.""") assert_equal(gold.name, "GoldRoom") assert_equal(gold.paths, {}) def test_room_paths(): ...
StarcoderdataPython
1747462
#!/usr/bin/env python3 ################ mylis: Tiny Scheme Environment in Python 3.10 ## Additional runtime support by <NAME> for lis.py by ## <NAME> (c) 2010-18; See http://norvig.com/lispy.html import functools as ft import itertools as it import operator as op import math import readline # "unused" import to ena...
StarcoderdataPython
198302
from flask import jsonify from api import app import logging as logger from api.controllers import responseListOfCoinsSimulation as request_simulation_list_coins response = request_simulation_list_coins.response_list() @app.route('/api/v1/simulationlist/', methods=['GET']) def simulation_list(): logger.debug("I...
StarcoderdataPython
4808007
<reponame>cognitiaclaeves/sam-python-slackapp-template<filename>src/app.py """ Slack chat-bot Lambda handler. Modified from: https://github.com/Beartime234/sam-python-slackapp-template """ # Module Imports import os import logging import json import time import hmac import hashlib import json import urllib.parse impor...
StarcoderdataPython
2799
from math import pi from numpy import array, ndarray, divide, sqrt, argsort, sort, diag, trace from numpy.linalg import eig, norm class HartreeFock(): zeta = array([38.474970, 5.782948, 1.242567, 0.298073]) num_aos = len(zeta) num_mos = 0 energy_tolerance = 0.0001; density_tolerance = 0.001 ...
StarcoderdataPython
1717210
# coding=utf-8 # Copyright 2018 The Hypebot Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requir...
StarcoderdataPython
1741799
'''OpenGL extension VERSION.GLX_1_3 This module customises the behaviour of the OpenGL.raw.GLX.VERSION.GLX_1_3 to provide a more Python-friendly API The official definition of this extension is available here: http://www.opengl.org/registry/specs/VERSION/GLX_1_3.txt ''' from OpenGL import platform, constant, arrays...
StarcoderdataPython
131997
<reponame>toddrme2178/pyccel #$ header metavar print=True from pyccel.stdlib.internal.fitpack import bispev #$ header function bispev2(double[:] , int, double[:], int, double[:], int, int, double[:], int, double[:], int, double[:,:], int) def bispev2(tx, nx, ty, ny, c, kx, ky, x, mx, y, my, z, ierr): from nump...
StarcoderdataPython
4812494
from cca.Rule import Rule class RuleCollection(object): def __init__(self, default_check = None): self.default_check = default_check self.rules = [] def add_rules(self, rules): self.rules.extend(rules) return self def add(self, verb_noun, msg_or_msg_func, check = None, mut...
StarcoderdataPython
1618171
<reponame>Stienvdh/statrick # (c) 2016 Red Hat Inc. # # This file is part of Ansible # # Ansible 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...
StarcoderdataPython
99545
import unittest # from threatnote.main import active_reports class active_reports(unittest.TestCase): def test_list_reports(self): """ Test that it can sum a list of integers """ data = [1, 2, 3] result = 6 self.assertEqual(result, 6) if __name__ == '_...
StarcoderdataPython
4814606
<filename>leetcode/L00234.py class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def isPalindrome(self, head: ListNode) -> bool: if not head or not head.next: return True full = half = copy = head rvsd = None...
StarcoderdataPython
3223676
<reponame>zahraahhajhsn/automatic-student-counter<filename>AuroraAppCode/screenshots.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'screenshots.ui' # # Created by: PyQt5 UI code generator 5.15.0 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run...
StarcoderdataPython
162551
<gh_stars>0 # Filename: BotGlobals.py # Author: mfwass # Date: January 8th, 2017 # # The Legend of Pirates Online Software # Copyright (c) The Legend of Pirates Online. All rights reserved. # # All use of this software is subject to the terms of the revised BSD # license. You should have received a copy of this licens...
StarcoderdataPython
47243
from jinja2 import Environment, FileSystemLoader, Template, TemplateNotFound import collections import os import yaml from os.path import dirname, basename from .env import environ from ..log import logger def reader(fn): logger.debug('loading', f=fn) try: tmplenv = Environment(loader=FileSystemLoader(...
StarcoderdataPython
1626247
<gh_stars>0 from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.keys import Keys import time from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by ...
StarcoderdataPython
1759227
# -*- coding: utf-8 -*- """ @author: WZM @time: 2021/1/2 19:50 @function: 对某一文件夹中的图片进行判断,并将结果写入到txt文件中 """ import os import sys import numpy as np import torch import argparse from model_timer import Timer # from net.ouy_net import Network from evaluate_model import evaluate_model import scipy.io as sio import time ...
StarcoderdataPython
3215524
#!/usr/bin/env python import re import json import ipaddress class IfConfig(object): """ ifconfig parser class """ def __init__(self, output): """ :param output: ifconfig text output """ self.interfaces = [] # loop over blocks for block in output.split('\n\n'):...
StarcoderdataPython
4837938
import os def run(dataset_name, idx, save_op): if dataset_name == 'YUD': index_file = '/n/fs/vl/xg5/Datasets/YUD/label/index_' + str(idx) + '.txt' img_type = 'jpg' elif dataset_name == 'ScanNet': index_file = '/n/fs/vl/xg5/Datasets/ScanNet/label/index_' + str(idx) + '.txt' img_...
StarcoderdataPython
1777466
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('tfg_webapp', '0002_reportsettings_info_blocks'), ] operations = [ migrations.AddField( model_name='reportsettings', name='la...
StarcoderdataPython
1666411
<filename>intro/part07-11_screen_time/src/screen_time.py # Write your solution here from datetime import datetime, time, timedelta filename = input("Filename: ") with open(filename, "w") as time_file: date_input = input("Starting date: ") no_of_day = int(input("How many days: ")) date_list = date_input.spli...
StarcoderdataPython
3310422
import json import keras import numpy as np import keras.backend as K from data.vocab import TextEncoder from transformer.embedding import Embedding from keras.layers import Conv1D, Dropout, Add, Input from transformer.layers import MultiHeadAttention, Gelu, LayerNormalization class MultiHeadSelfAttention: def __...
StarcoderdataPython
154371
<filename>gear/prfanalyze/base/run.py #! /usr/bin/env python from __future__ import print_function import json, os, sys, csv, pimms import nibabel as nib output_dir = '/flywheel/v0/output' input_dir = '/flywheel/v0/input' config_file = os.path.join(input_dir, 'config.json') bids_dir = os.path.join(input_dir, '...
StarcoderdataPython
1644077
#!/bin/python3 import os # Complete the repeatedString function below. def repeatedString(s, n): num = 0 for i in range(len(s)): if s[i] == "a" and i <= n: num += 1 if (n - len(s)) > 0: num *= int(n / len(s)) if (n % len(s)) != 0: for i in (s[:(n % len(s))]...
StarcoderdataPython
116886
<reponame>chib0/asd-winter2019 import click from . import get_consumer @click.group() @click.option("-h", "--host", default="localhost") @click.option("-p", "--port", default="8000", type=int) @click.pass_context def cli(ctx, host, port): ctx.ensure_object(dict) #we're setting ctx.obj to match the signature o...
StarcoderdataPython
3211537
<reponame>olgam4/design3 import cv2 from vision.domain.iCamera import ICamera from vision.domain.iCameraFactory import ICameraFactory from vision.infrastructure.fallbackCamera import FallbackCamera from vision.infrastructure.openCvCamera import OpenCvCamera class OpenCvCameraFactory(ICameraFactory): def __init__...
StarcoderdataPython
1600186
<filename>src/pasio/dto/intervals.py from collections import namedtuple from ..utils.gzip_utils import open_for_read class ScoredInterval( namedtuple('ScoredInterval', ['start', 'stop', 'mean_count', 'log_marginal_likelyhood']) ): @property def length(self): return self.stop - self.start class Bedgrap...
StarcoderdataPython
38639
<reponame>xnchu/PyTplot<gh_stars>10-100 import pytplot import numpy as np def split_vec(tvar, new_name=None, columns='all', suffix=None): """ Splits up 2D data into many 1D tplot variables. .. note:: This analysis routine assumes the data is no more than 2 dimensions. If there are more, they may ...
StarcoderdataPython
1797982
import requests from kibitzr.checker import Checker def test_server_is_alive(target): """Sanity check, that test environment is properly setup""" response = requests.get("http://{0}:{1}/index.html".format(*target)) assert response.status_code == 200 def test_simple_fetcher_with_pretty_json(target, json_...
StarcoderdataPython
1623908
import logging import copy import json import pytest from inspect import getmembers, isfunction from collections import defaultdict from tests.common.plugins.sanity_check import constants from tests.common.plugins.sanity_check import checks from tests.common.plugins.sanity_check.checks import * from tests.common.pl...
StarcoderdataPython
1626203
from lenses import lens parse_json = lens.Json() new_food = lens.Get('food') if __name__ == '__main__': comb = parse_json & new_food print(comb.get()('{"food": {"dinner": []}}'))
StarcoderdataPython
3258339
#! /usr/bin/python2.7 ''' This package takes care of training of our model on tweets data. ''' import nltk import numpy as np import matplotlib as plt import time from copy import deepcopy from collections import Counter import pandas as pd from tqdm import tqdm from sklearn.model_selection import train_tes...
StarcoderdataPython
51864
<gh_stars>1-10 class BaseCloudController: pass
StarcoderdataPython
3350300
<reponame>esra-sengul/hazelcast-python-client import typing from hazelcast.protocol.codec import ( transactional_multi_map_get_codec, transactional_multi_map_put_codec, transactional_multi_map_remove_codec, transactional_multi_map_remove_entry_codec, transactional_multi_map_size_codec, transact...
StarcoderdataPython
3345138
#!/usr/bin/python3 __author__ = "yang.dd" """ example 072 """ if __name__ == '__main__': num = [] for i in range(3): num.append(int(input("请输入一个数字:"))) print(num)
StarcoderdataPython
1675275
#!/usr/bin/env python3 # 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. r""" Batch Knowledge Gradient (KG) via one-shot optimization as introduced in [Balandat2019botorch]_. For broader discu...
StarcoderdataPython