id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
4948989
# ----------------------------------------------------------------------------# # Imports # ----------------------------------------------------------------------------# from datetime import datetime import dateutil.parser import babel from flask import Flask, render_template, request, flash, redirect, url_for, jsonify...
StarcoderdataPython
5101507
def convolve(x, h): out_length = len(x) + len(h) - 1 out_signal = [] for i in range(0, out_length): sum = 0 for j in range(0, len(h) - 1): if i - j >= 0 and j < len(h) and i - j < len(x): #print("i={0} j={1}".format(i,j)) sum = sum + ...
StarcoderdataPython
155652
<reponame>LHerdy/People_Manager from django.contrib import admin from apps.overtime.models import Overtime admin.site.register(Overtime)
StarcoderdataPython
3472435
<filename>sphinx_packaging/__init__.py #!/usr/bin/env python3 # # __init__.py """ A collection of Sphinx utilities related to Python packaging. """ # # Copyright © 2021 <NAME> <<EMAIL>> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following c...
StarcoderdataPython
1905688
<reponame>harry19023/home_assistant_config<filename>appDaemon/apps/harmony.py import appdaemon.plugins.hass.hassapi as hass from paramiko import client class Harmony(hass.Hass): def initialize(self): self.globals = self.get_app('globals') self.computer_control = self.get_app('computer_control') self.min...
StarcoderdataPython
3375934
"""Sherlock: Supported Site Listing This module generates the listing of supported sites. """ import json from collections import OrderedDict with open("data.json", "r", encoding="utf-8") as data_file: data = json.load(data_file) sorted_json_data = json.dumps(data, indent=2, sort_keys=True) with open("data.json...
StarcoderdataPython
325981
<reponame>XiaoSanGit/talking-head-anime-landing import os import sys sys.path.append(os.getcwd()) import time import numpy as np import PIL.Image import PIL.ImageTk import cv2 import torch import dlib from poser.morph_rotate_combine_poser import MorphRotateCombinePoser256Param6 from puppet.head_pose_solver import He...
StarcoderdataPython
1803723
<reponame>evenh/azure-storage-azcopy import json import os import shutil import time import urllib from collections import namedtuple import utility as util import unittest import filecmp import os.path class Service_2_Service_Copy_User_Scenario(unittest.TestCase): def setUp(self): # init bucket_name ...
StarcoderdataPython
1920710
class A164: pass
StarcoderdataPython
11331984
# GENERATED BY KOMAND SDK - DO NOT EDIT import insightconnect_plugin_runtime import json class Input: API_KEY = "api_key" API_KEY_ID = "api_key_id" SECURITY_LEVEL = "security_level" URL = "url" class ConnectionSchema(insightconnect_plugin_runtime.Input): schema = json.loads(""" { "type"...
StarcoderdataPython
9669684
import os import json import itertools from flask import Blueprint, jsonify, request from nameko.standalone.rpc import ClusterRpcProxy from nameko.standalone.events import event_dispatcher news = Blueprint('news', __name__) BROKER_CONFIG = {'AMQP_URI': os.environ.get('QUEUE_HOST')} @news.route('/<string:news_type>...
StarcoderdataPython
1976036
import rinobot_plugin as bot import numpy as np import matplotlib import matplotlib.pyplot as plt matplotlib.rcParams['savefig.dpi'] = 2 * matplotlib.rcParams['savefig.dpi'] def main(): filepath = bot.filepath() data = bot.loadfile(filepath) x = data[:, 0] y = data[:, 1:] plt.plot(x, y) xmin ...
StarcoderdataPython
3353381
from dagster_aws.emr import emr_pyspark_step_launcher from dagster_aws.s3 import s3_plus_default_storage_defs, s3_resource from dagster_pyspark import DataFrame as DagsterPySparkDataFrame from dagster_pyspark import pyspark_resource from pyspark.sql import DataFrame, Row from pyspark.sql.types import IntegerType, Strin...
StarcoderdataPython
3230412
<filename>src/sentry/api/endpoints/relay_projectconfigs.py<gh_stars>0 from __future__ import absolute_import import six from rest_framework.response import Response from sentry_sdk import Hub from sentry_sdk.tracing import Span from sentry.api.base import Endpoint from sentry.api.permissions import RelayPermission f...
StarcoderdataPython
3450892
<gh_stars>0 from unittest.mock import MagicMock from kleat.evidence.do_bridge import do_fwd_ctg_lt_bdg, do_fwd_ctg_rt_bdg import kleat.misc.settings as S ################################################### # test different situations for do_fwd_ctg_lt_bdg # ################################################### def te...
StarcoderdataPython
6605272
import torch import torch.nn as nn import torch.nn.functional as F import math import numpy as np from .Util import * import torch.distributed as dist class ConvBlock_ablation(nn.Module): def __init__( self, inputSize, outputSize, hiddenSize, kernelSize...
StarcoderdataPython
12852883
<reponame>0lru/p3ui from p3ui import * import matplotlib.pyplot as plt import numpy as np def gradient_image(ax, extent, direction=0.3, cmap_range=(0, 1), **kwargs): phi = direction * np.pi / 2 v = np.array([np.cos(phi), np.sin(phi)]) X = np.array([[v @ [1, 0], v @ [1, 1]], [v @ [0, 0], ...
StarcoderdataPython
1699023
<filename>Medium/1079.LetterTilePossibilities.py ''' You have n tiles, where each tile has one letter tiles[i] printed on it. Return the number of possible non-empty sequences of letters you can make using the letters printed on those tiles. Example: Input: tiles = "AAB" Output: 8 ...
StarcoderdataPython
6688274
#! /usr/bin/env python3 import os ANGLER_API_BASE_URL = 'https://angler.heliohost.org/' ANGLER_BASE_URL = 'https://en.ff14angler.com' # Integer number of seconds ANGLER_DELAY_BETWEEN_REQUESTS_DURATION = 3 # Integer number of seconds ANGLER_PAGE_LOAD_WAIT_DURATION = 180 ANGLER_SPEARFISHING_BAIT_ITEM_ID = 17726 # Spe...
StarcoderdataPython
4810540
# Evaluate the expression that is guaranteed to have no parentheses def aoc_raw_eval(expression: str) -> int: S = expression.split('*') result = 1 for s in S: sm = map(int, s.split('+')) ss = sum(sm) result *= ss return result def aoc_eval(expression: str) -> int: new_expr...
StarcoderdataPython
1830525
""" The MIT License (MIT) Copyright (c) Serenity Software, LLC 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, modify, m...
StarcoderdataPython
222136
<gh_stars>0 from typing import Any, Dict, List, Optional, Tuple, Union, cast # NB: we cannot use the standard Enum, because after "class Color(Enum): RED = 1" # the value of Color.RED is like {'_value_': 1, '_name_': 'RED', '__objclass__': etc} # and we need it to be 1, literally (that's what we'll get from the clien...
StarcoderdataPython
6672548
import json import os from django.utils.translation import gettext_lazy as _ from . import BASE_DIR # Secret settings secret = json.loads(open(os.path.join(BASE_DIR, 'secret.json')).read()) SECRET_KEY = secret['SECRET_KEY'] ALLOWED_HOSTS = secret['ALLOWED_HOSTS'] DATABASES = secret['DATABASES'] DEBUG = secret['DEBU...
StarcoderdataPython
6572012
from setuptools import setup, find_packages with open("README.md", "r") as fh: long_description = fh.read() setup( name='PyGB', version='0.0.1', author= '<NAME> & <NAME>', author_email= '<EMAIL>', description= 'A command-line application to prepare GenBank sequence submission', ...
StarcoderdataPython
1698957
from torch.nn import functional as F from torch import nn import torch class _Scorer(nn.Module): def __init__(self, n_classes, soft=False, apply_softmax=True, skip_first_class=True, smooth=1e-7): super(_Scorer, self).__init__() self.register_buffer('eye', torch.eye(n_classes)) self.soft = ...
StarcoderdataPython
9662767
import re from collections import Counter ''' The flow is like the following : #1 - search errors and if any match with the main DB, write them to a new list file #2 - count matched errors #3 - print the matched error together with it's recommended action ''' # this dict keys contain errors and value contains actio...
StarcoderdataPython
5125967
<gh_stars>1-10 import logging import pickle import sqlite3 from cref.utils import Database logger = logging.getLogger('CReF') class TorsionAnglesDB(Database): """ Cache torsion angles calculation """ def create(self): parent = super(TorsionAnglesDB, self) parent.execute( ...
StarcoderdataPython
9697340
from .disease import Disease from .immunity import Immunity from .infection import Infection
StarcoderdataPython
11325371
import concurrent.futures import datetime import json import time from typing import Dict, Optional # noqa from sebs.gcp.gcp import GCP from sebs.faas.function import ExecutionResult, Trigger class LibraryTrigger(Trigger): def __init__(self, fname: str, deployment_client: Optional[GCP] = None): super()....
StarcoderdataPython
8029746
<gh_stars>0 #!/usr/bin/python3 __author__ = "<NAME>" __copyright__ = "Copyright 2021, National University of S'pore and A*STAR" __credits__ = ["<NAME>", "<NAME>", "<NAME>", "<NAME>"] __license__ = "MIT" # Import publicly published & installed packages import tensorflow as tf from numpy.random import seed import os, ti...
StarcoderdataPython
388778
from .endpoint import Endpoint, decorator, get_json class Policystore(Endpoint): def __init__(self): Endpoint.__init__(self) self.app = 'base' @decorator def policystoreReadMetadataRoles(self, args): self.method = 'GET' self.endpoint = '/policystore/metadataroles' s...
StarcoderdataPython
11368733
#!/usr/bin/env python # -*- coding: utf-8 -*- """Convenience wrapper for running backup.py directly from source tree.""" import sys from backup.backup import main if __name__ == '__main__': try: main() except KeyboardInterrupt: # Exit on KeyboardInterrupt # http://stackoverflow.com...
StarcoderdataPython
9759046
import subprocess, dotbot, json from os import path, remove from dotbot.util import module class Sudo(dotbot.Plugin): _directive = 'sudo' def can_handle(self, directive): return self._directive == directive def handle(self, directive, data): if directive != self._directive: ra...
StarcoderdataPython
1966028
""" SoftLayer.tests.CLI.modules.rwhois_tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :license: MIT, see LICENSE for more details. """ from SoftLayer.CLI import exceptions from SoftLayer import testing import json class RWhoisTests(testing.TestCase): def test_edit_nothing(self): result = se...
StarcoderdataPython
1946128
#!/bin/python # This script uses the Satellite API to generate different HTML reports like below example reports: # # * hosts_by_usergroup (You need to assign User Groups as owner to hosts for this) # * hosts_by_lifecycle_environment # * hosts_by_environment # * hosts_by_model # * hosts_by_domain # * hosts_by_o...
StarcoderdataPython
1705498
<filename>KAT7/observation/f_engine_phased_beamform_dualpol.py #!/usr/bin/python # Dual polarisation beamforming: Track target and possibly calibrator for beamforming. # The *with* keyword is standard in Python 2.6, but has to be explicitly # imported in Python 2.5 from __future__ import with_statement import time im...
StarcoderdataPython
4935158
from output.models.nist_data.atomic.id.schema_instance.nistschema_sv_iv_atomic_id_max_length_1_xsd.nistschema_sv_iv_atomic_id_max_length_1 import ( NistschemaSvIvAtomicIdMaxLength1, Out, ) __all__ = [ "NistschemaSvIvAtomicIdMaxLength1", "Out", ]
StarcoderdataPython
1808997
import datetime class FPS: def __init__(self): self._start = None self._end = None self._numFrames = 0 def start(self): self._start = datetime.datetime.now() self._numFrames = 0 return self def stop(self): self._end = datetime.datetime.now() return self def update(self): self._numFrames += 1 ...
StarcoderdataPython
3235983
''' SignInPage.py Lib Written By <NAME> Version 20190420v1 ''' # import buildin pkgs import os from flask_restful import Resource from flask_login import login_user, login_required from flask import redirect, request, \ render_template, Response, \ url_for, session ...
StarcoderdataPython
208388
import sys if int(sys.stdin.readline()) % 2 == 0: print "Bob" else: print "Alice"
StarcoderdataPython
9600459
<gh_stars>1-10 #!/usr/bin/env python # Copyright 2020 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
StarcoderdataPython
1649912
<reponame>maximilionus/telemonitor from sys import platform from logging import getLogger from os import path, remove from telemonitor.helpers import TM_Config, DEF_CFG, tm_colorama __version = 1 __logger = getLogger(__name__) # All relative paths are starting from root directory of module `telemonitor`, # Not from...
StarcoderdataPython
4866397
<filename>danceschool/core/management/commands/setup_invoicing.py<gh_stars>10-100 from django.core.management.base import BaseCommand from django.apps import apps from django.conf import settings from six.moves import input try: import readline except ImportError: pass class Command(BaseCommand): help =...
StarcoderdataPython
4940507
from http.cookies import SimpleCookie import pytest from tests.factories.tag import ( TagFactory, tag_instant_delayed, tag_instant_traceable, tag_instant_analytical, tag_instant_functional, ) from tests.factories.page import TaggableContentPageFactory from wagtail_tag_manager.models import Tag @...
StarcoderdataPython
6512326
#! /g/kreshuk/pape/Work/software/conda/miniconda3/envs/cluster_env37/bin/python import os import json import luigi from cluster_tools.downscaling import DownscalingWorkflow def downscale_raw(path, max_jobs=8, target='local'): """ Downscale raw data. Arguments: path [str] - path to raw data m...
StarcoderdataPython
12829565
from .base import loader
StarcoderdataPython
8166769
<reponame>maanavshah/movie-review-analysis<filename>sentiment_analysis/crawler.py import urllib.request from bs4 import BeautifulSoup import csv import signal import sys from subprocess import call import os signal.signal(signal.SIGINT, lambda x,y: sys.exit(0)) with open('data/urls.csv','r') as f: reader = csv.reade...
StarcoderdataPython
11263034
import logging import uuid from typing import List, Union from galaxy import model from galaxy.util import ExecutionTimer from galaxy.workflow import modules from galaxy.workflow.run_request import ( workflow_request_to_run_config, workflow_run_config_to_request, WorkflowRunConfig ) log = logging.getLogge...
StarcoderdataPython
9767089
<filename>backend_utils/permissions.py """ @copyright Copyright (c) 2013 @author <NAME> (@asullom) @package utils Descripcion: Componenetes para controlar los permisos por roles de los usuarios y los permisos a la información a la que ha sido asignado """ import logging log = logging.getLogger(__name__) ...
StarcoderdataPython
8059329
<gh_stars>10-100 # # Licensed to Elasticsearch under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not u...
StarcoderdataPython
8180225
from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_bcrypt import Bcrypt from werkzeug.security import generate_password_hash, check_password_hash from flask_login import UserMixin from app import application db = SQLAlchemy(application) bcrypt = Bcrypt(application) class User(UserMixin, db.Mo...
StarcoderdataPython
8170016
"""SA Connections Runner (SAIR) SAIR processes Data Connections in *_CONNECTION tables """ import fire from multiprocessing import Pool from datetime import datetime import importlib import json from types import GeneratorType import yaml from runners.helpers import db, log, vault from runners.config import RUN_ID...
StarcoderdataPython
1920702
a=input("left or right?") if(a=="right"): b=input("swim or wait? ") if(b=="swim"): c=input("colour = ") if(c=="yellow"): print("win") else: print("Game over") elif(b=="wait"): print("Game over") elif(a=="left"): print("Game over")
StarcoderdataPython
3551516
from gordon.utils_tests import BaseIntegrationTest, BaseBuildTest from gordon.utils import valid_cloudformation_name from gordon import utils class IntegrationTest(BaseIntegrationTest): def test_0001_project(self): self._test_project_step('0001_project') self.assert_stack_succeed('p') sel...
StarcoderdataPython
1968381
from covertutils.handlers import BufferingHandler from covertutils.orchestration import Orchestrator from covertutils.bridges import SimpleBridge from time import sleep from functools import wraps try : from queue import Queue except ImportError: from Queue import Queue def handlerCallbackHook( instance, on_chunk_...
StarcoderdataPython
4967809
import numpy as np import os fs = open('similary.txt', 'w') ff = open('featu.txt', 'w') xdat = np.load('xdat.npy') for x in xdat: for d in x[:512]: ff.write('%f '%d) ff.write('\n') for d in x[512:]: fs.write('%f '%d) fs.write('\n') fs.close() ff.close()
StarcoderdataPython
3213742
<gh_stars>0 #!/usr/bin/env python import os import sys from setuptools import Command, find_packages, setup BASE_DIR = os.path.dirname(os.path.abspath(__file__)) version_file = os.path.join( BASE_DIR, 'kata_test_framework/version.txt' ) class VersionCommand(Command): description = "generate version n...
StarcoderdataPython
4876297
from agent import Agent from board import Game # Allows a human to play against AlphaZero class HumanAgent(Agent): def update_board(self, board : Game): self.board = board def pick_move(self): valid_action = True try: action = int(input('C...
StarcoderdataPython
1690
<reponame>FreesiaLikesPomelo/-offer ''' 面试题37. 序列化二叉树 请实现两个函数,分别用来序列化和反序列化二叉树。 示例: 你可以将以下二叉树: 1 / \ 2 3 / \ 4 5 序列化为 "[1,2,3,null,null,4,5]" ''' # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # ...
StarcoderdataPython
1685681
# coding: utf-8 # # Copyright 2018 The Oppia 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 requi...
StarcoderdataPython
1884737
# -*- coding: utf-8 -*- # Disable doc-string warning for test files # pylint: disable=C0111 # pylint: disable=unused-import import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', r"src"))) import zipkintrace
StarcoderdataPython
9665205
from django.shortcuts import render # Create your views here. from django_redis import get_redis_connection from rest_framework import status from rest_framework.generics import RetrieveAPIView, ListAPIView from rest_framework.response import Response from rest_framework.views import APIView from goods.models import ...
StarcoderdataPython
3562296
# coding: utf-8 """ Transaction Management Bus (TMB) API No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 OpenAPI spec version: V3.2.0 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re ...
StarcoderdataPython
11250921
import sys from PyQt5 import QtWidgets as qtw from PyQt5 import QtCore as qtc # from PyQt5 import QtGui as qtg def crit_bonus(crit_rate: float, crit_dmg: float): return 1 + ((crit_rate / 100) * (crit_dmg / 100)) def defense(player_level: int, enemy_level: int, defense_drop: float = 1): return (100 + play...
StarcoderdataPython
11275012
from django.contrib import admin from mptt.admin import DraggableMPTTAdmin from .models import Products, Category, Image, Review import admin_thumbnails from fieldsets_with_inlines import FieldsetsInlineMixin class ProductImageInline(admin.TabularInline): model = Image readonly_fields = ('id',) extra = 3 ...
StarcoderdataPython
9628243
<filename>ampsim/tools/venner.py<gh_stars>0 """ (c) MGH Center for Integrated Diagnostics """ from __future__ import print_function from __future__ import absolute_import import re import os from collections import namedtuple import click import pandas as pd from pybedtools import BedTool import matplotlib.pyplot as p...
StarcoderdataPython
3576370
<reponame>avendesta/vulnhub<filename>flaskapp/blog.py from flask import Flask, request, jsonify, send_from_directory, redirect, url_for from flask_pymongo import PyMongo from forms import RegistrationForm, LoginForm, RequestForm from flask_jwt_extended import JWTManager, jwt_required, create_access_token,get_jwt_identi...
StarcoderdataPython
6619915
# encoding: utf-8 import numpy as np import model import utils import plot_data def exec_c3_1_a(X_a, X_b, init_w): """ plot 3 histogram of data projecting to difference vector w :param X_a: Gaussian data of class a :param X_b: Gaussian data of class b :param init_w: initial w vector to be project...
StarcoderdataPython
136614
# 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 # # Unless required by applicable law or agreed to in writing, ...
StarcoderdataPython
5010758
# elif myclass == "Barbarian": # #Barbarian strength build #Human Bonus Feat) Toughness #1) Power Attack #3) Improved Initiative #5) Endurance #7) Diehard #9) Improved Critical (main weapon) #11) Sickening Critical #13) Staggering Critical #15) Blinding Critical #17) Stunning Critical ...
StarcoderdataPython
8067554
<gh_stars>1-10 # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.core.management.base import BaseCommand from django.core.management import call_command from django.utils.six.moves import input # noqa class Command(BaseCommand): help = 'Pulls, make locales and pushes (in that order) t...
StarcoderdataPython
8184399
<gh_stars>1-10 import unittest unittest.defaultTestLoader.testMethodPrefix = 'should' import textwrap from clckwrkbdgr import tui from clckwrkbdgr.tui import widgets class TestKey(unittest.TestCase): def should_create_key(self): self.assertEqual(tui.Key(65).value, 65) self.assertEqual(tui.Key('A').value, 65) se...
StarcoderdataPython
1782886
<filename>python/test_result.py # Containing whole result of prediction class TestResultClass(object): # Class Name (ex: xxxx) name = None # Class Label (ex: 4) label = None # Class Score score = 0 # Class Box coodinate ([xmin, ymin, xmax, ymax]) box = None class TestResultImage(obj...
StarcoderdataPython
3292104
from __future__ import annotations from typing import Sequence from .typing import StyleOptions from .utils import is_oneliner # Codes can be combined, e.g.: # - "3;33": italic yellow # - "3;4;33": italic underlined yellow # # Some terminals support a 256-color extended color set: # - ansi pattern: "\033[38;5;{color...
StarcoderdataPython
91422
<reponame>ThebiggunSeeoil/VIS-MASTER from django.core import serializers from django.contrib.auth.decorators import login_required from django.shortcuts import render, get_object_or_404, redirect from django.template import loader from django.http import HttpResponse from django.http import JsonResponse from django imp...
StarcoderdataPython
3237221
<filename>cert_issuer/revoker.py<gh_stars>1-10 """ Base class for building blockchain transactions to issue Blockchain Certificates. """ import logging import json from pycoin.serialize import h2b from cert_issuer.errors import BroadcastError MAX_TX_RETRIES = 5 def ensure_string(value): if isinstance(value, st...
StarcoderdataPython
6642130
# coding:utf-8 import os import unittest import subprocess import json import socket import time from six.moves import queue from captain_comeback.restart.engine import restart from captain_comeback.restart.adapter import (docker, docker_wipe_fs, null) from captain_comeback.cgroup import Cgroup from captain_comeback.r...
StarcoderdataPython
3201236
from .entity import Entity from .entity_sets.log_record_set import LogRecordSet from .entity_providers.model_providers.log_record_provider import LogRecordProvider from .entity_fields import EntityField, RelatedEntityField, ReadOnlyField, ManagedEntityField, CurrentTimeManager from .entity_exceptions import EntityOpera...
StarcoderdataPython
11254988
#!/usr/bin/env python # ex:ts=4:sw=4:sts=4:et # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- """ class for handling configuration data files Reads a .conf file and obtains its metadata """ # Copyright (C) 2003, 2004 <NAME> # Copyright (C) 2003, 2004 <NAME> # # This program is free software...
StarcoderdataPython
86334
from ray.rllib.algorithms.apex_ddpg import ( # noqa ApexDDPG as ApexDDPGTrainer, APEX_DDPG_DEFAULT_CONFIG, )
StarcoderdataPython
6514231
<filename>addons/io_scene_gltf2/io/com/gltf2_io_color_management.py # Copyright 2019 The glTF-Blender-IO authors. # # 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...
StarcoderdataPython
9613559
<gh_stars>0 # # Copyright 2022- IBM Inc. All rights reserved # SPDX-License-Identifier: Apache2.0 # # Taken from https://github.com/icoz69/CEC-CVPR2021/blob/main/models/resnet20_cifar.py import torch.nn as nn import math import torch.utils.model_zoo as model_zoo import numpy as np def conv3x3(in_planes, ou...
StarcoderdataPython
11379305
<filename>generate_readme_rst.py import pypandoc long_description = pypandoc.convert('README.md', 'rst') f = open('README.txt','w+') f.write(long_description) f.close()
StarcoderdataPython
8120676
from lintreview.review import Problems from lintreview.review import Comment from lintreview.tools.flake8 import Flake8 from unittest import TestCase from nose.tools import eq_ class TestFlake8(TestCase): fixtures = [ 'tests/fixtures/pep8/no_errors.py', 'tests/fixtures/pep8/has_errors.py', ] ...
StarcoderdataPython
395393
<gh_stars>0 # -*- coding:uft-8 -*- from os import path from netCDF4 import Dataset, num2date from scipy.io import loadmat from yaml import full_load from RBR.ctd import convert2nc as conv2nc_rbr from RDI.util import gen_time from util import detect_brand def ctd_ref_data(adcp_path, time_offset, adcp_hgt): ext =...
StarcoderdataPython
1695484
<reponame>p2o-lab/planteye<filename>src/planteye_vision/shell/rest_api_shell.py from flask import Flask, request, jsonify import logging import threading from planteye_vision.shell.shell import Shell from planteye_vision.configuration.shell_configuration import RestAPIShellConfiguration from planteye_vision.configurat...
StarcoderdataPython
303255
<filename>src/fastapi_aad_auth/_base/state.py """Authentication State Handler.""" from enum import Enum import importlib import json from typing import List, Optional import uuid from itsdangerous import URLSafeSerializer from itsdangerous.exc import BadSignature from pydantic import Field, root_validator, validator f...
StarcoderdataPython
3374356
import hashlib from enum import Enum from django.core.cache import cache from django.db.models import Q from .models import Student class response_msg(Enum): MSG_ERROR = "请正确填写信息" MSG_NOT_FOUND = "没有查到你的信息" MSG_SYSTEM_ERROR = "系统错误请联系精弘客服" class index_type(Enum): Dorm = "寝室" Sid = "学号" class...
StarcoderdataPython
8120271
""" 1.1 Implement an algorithm to determine if a string has all unique charactors. What if you cannot use additional data structures? Examples -------- input: 'string' output: True input: 'unique' output: False """ # SOLUTION 1 - HASHTABLE # Efficiency # space: O(n) time: O(1) def unique_chars1(string): d = ...
StarcoderdataPython
1741848
<reponame>district10/snippet-manager<filename>snippets/rstrip.py from builtins import float class FormattedFloat(float): def __str__(self): return "{:.10f}".format(self).rstrip('0')
StarcoderdataPython
8030656
<reponame>AndrejOrsula/ecard<filename>ecard/launch/manipulation.launch.py import os import yaml from launch import LaunchDescription from launch_ros.actions import Node from ament_index_python.packages import get_package_share_directory def load_file(package_name, file_path): package_path = get_package_share_dire...
StarcoderdataPython
1639516
<gh_stars>0 # -*- coding: utf-8 -*- """ Tests for Bearer authentication class. """ import json import httpretty import mock from django.contrib.auth import get_user_model from django.test import RequestFactory, TestCase, override_settings from requests import RequestException from rest_framework.exceptions import Auth...
StarcoderdataPython
188548
<gh_stars>10-100 class Crc8(): """ Implements the 1-wire CRC8 checksum. (The polynomial should be X^8 + X^5 + X^4 + X^0) """ R1 = [0x00, 0x5e, 0xbc, 0xe2, 0x61, 0x3f, 0xdd, 0x83, 0xc2, 0x9c, 0x7e, 0x20, 0xa3, 0xfd, 0x1f, 0x41] R2 = [0x00, 0x9d, 0x23, 0xbe, 0x46, 0xdb, 0...
StarcoderdataPython
5177080
import copy import re from .common_func import modify_dict_result from .common_func import remove_root_duplicate from .key_monad import key_monad NFS_REGEX = r"^nfs://" NFS_REGEX_C = re.compile(NFS_REGEX, flags=re.IGNORECASE) NO_NFS_REGEX = r"^(?!nfs://).*$" NO_NFS_REGEX_C = re.compile(NO_NFS_REGEX, flags=re.IGNORECA...
StarcoderdataPython
5042133
<gh_stars>0 import random import itertools import numpy def permute_training_ex(training_ex): """ Takes an array of shape (num_channels, 12, 12), randomly shuffles each set of 3 rows and columns in each channel, and returns the resulting (num_channels, 12, 12) array. Params: training_ex: an array of shape (nu...
StarcoderdataPython
284084
from . import operation from oslo_versionedobjects import fields from oslo_versionedobjects import base class MessagingBase(operation.Operation): # Version 1.0: Initial version VERSION = "1.0" fields = { 'server': fields.StringField(nullable=True), 'topic': fields.StringField(), ...
StarcoderdataPython
3350215
<filename>molfunc-reaction/A200-sync-go-chebi-rels.py import os, json, argparse, sys, datetime, time import pronto, six """ grep ^in.*CHEBI /home/ralf/go-ontology/src/ontology/go-edit.obo |sed 's+ CHEB.*++g' |sort|uniq The relevant data to sync is in these lines in the Gene Ontology: intersection_of: PROPERTY CHEBI:...
StarcoderdataPython
3426363
<filename>codewar/Going to the cinema -7kyu/Going to the cinema.py #!/usr/bin/python3 # -*- coding: utf-8 -*- from math import pow, ceil debug = 1 #ceil AC # movie(500, 15, 0.9), 43 # movie(100, 10, 0.95), 24 def debug_print(flag, out): if debug: print("temp" + str(flag) + ":" + str(out)) def movie(c...
StarcoderdataPython
11359946
<reponame>rookuu/AdventOfCode-2015<gh_stars>0 #!/usr/bin/env python """ Solution to Day 3 - Puzzle 1 of the Advent Of Code 2015 series of challenges. --- Day 3: I Was Told There Would Be No Math --- <^v> determines what coordinate the pointer moves to. Count the amount of houses that the pointer visits at least once...
StarcoderdataPython
1716052
import xarray as _xr import copy as _copy import xgcm as _xgcm import numpy as _np import warnings as _warnings import sys as _sys from . import compute as _compute from . import plot as _plot from . import animate as _animate from . import utils as _utils from . subsample import _subsam...
StarcoderdataPython