id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3320857
# The MIT License (MIT) # # Copyright (c) 2019 <NAME> and <NAME> # for Adafruit Industries 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, includ...
StarcoderdataPython
3200185
""" <NAME> orientation.py Implement the keypoint gradient direction estimation technique based on the Lecture 9 notes /\ /**\ /****\ /\ / \ /**\ / /\ / \ /\ /\ /\ /\ /\/\/\ /\ / / \ / \ / \/\/...
StarcoderdataPython
1672622
#!/usr/bin/env python2.7 # coding=utf-8 """ Sopel - An IRC Bot Copyright 2008, <NAME>, inamidst.com Copyright © 2012-2014, <NAME> <<EMAIL>> Licensed under the Eiffel Forum License 2. https://sopel.chat """ from __future__ import unicode_literals, absolute_import, print_function, division import argparse import os imp...
StarcoderdataPython
895
<reponame>zsimic/sandbox import click import poyo import ruamel.yaml import runez import strictyaml import yaml as pyyaml from zyaml import load_path, load_string, tokens_from_path, tokens_from_string from zyaml.marshal import decode, default_marshal, represented_scalar from . import TestSettings class Implementati...
StarcoderdataPython
3373200
import tensorflow_datasets as tfds dataset = 'cityscapes' ds_info = tfds.builder(dataset).info dataset_name='cityscapes_corrupted/semantic_segmentation_gaussian_noise_2' builder = tfds.builder(dataset_name) builder.download_and_prepare() #%%
StarcoderdataPython
4800268
<filename>Veiculos.py from datetime import datetime class organizacao (object): def __init__(self): self.veiculo = [] self.prazos = [] def getVeiculos(self):#quantidade de veiculos cadastrados return len(self.veiculo) def getIndisponiveis(self):#quantidade de veiculos alu...
StarcoderdataPython
184103
# upload a pile of images from the given list. the given list has one path per # line, where each path points to a specific image to upload. it outputs the # uploaded image info into a comma separated list, where each line is # image_pk,status,path. from django.db import transaction from django.core.management.base i...
StarcoderdataPython
99147
<filename>plugins/lighthouse/ui/module_selector.py import os import logging from lighthouse.util import lmsg from lighthouse.util.qt import * from lighthouse.util.misc import human_timestamp from lighthouse.util.python import * logger = logging.getLogger("Lighthouse.UI.ModuleSelector") #-----------------------------...
StarcoderdataPython
3353364
<filename>hw1_code/scripts/evaluator.py<gh_stars>0 #!/bin/python2.5 import sys import os from sklearn.metrics import average_precision_score if __name__=="__main__": # load the ground-truth file list y_true_dir = sys.argv[1] y_pred_dir = sys.argv[2] event = y_pred_dir.split('/')[1].split('_')[0...
StarcoderdataPython
1721873
from app.core.crud import CrudRouter from .models import DataType from .serializers import DataTypeSerializer from .views import DataTypeView data_types_router = CrudRouter( model=DataType, serializer=DataTypeSerializer, view=DataTypeView, prefix="/api/v1/constructor/data-types", tags=["data-types...
StarcoderdataPython
1631567
from .algorithm1 import Algorithm from .cp_ortools import CPModel1 solvers = \ dict(default=Algorithm, ortools=CPModel1) # factory of solvers def get_solver(name='default'): return solvers.get(name)
StarcoderdataPython
1695426
# Copyright 2018 The TensorFlow Probability 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/licenses/LICENSE-2.0 # # Unless required by applicable law o...
StarcoderdataPython
1665851
<filename>wiseguy/__init__.py from translationstring import TranslationStringFactory _ = TranslationStringFactory('wiseguy') from wiseguy.schema import StrictSchema # API from wiseguy.schema import Url # API from wiseguy.schema import WSGIApp # API class WSGIComponent(object): def __init__(self, schema, factory):...
StarcoderdataPython
178081
import streamlit as st import numpy as np import pandas as pd from sklearn.datasets import load_iris from .generic import Tool iris = pd.DataFrame(load_iris()["data"]) df = pd.DataFrame( np.random.randn(50, 20), columns=('col %d' % i for i in range(20))) # st.dataframe(df) # Same as st.write(df) class Da...
StarcoderdataPython
1649952
#!/usr/bin/env python # coding: utf8 def cram(text, maxlen): """Omit part of a string if needed to make it fit in a maximum length.""" text = text.decode('utf-8') if len(text) > maxlen: pre = max(0, (maxlen-3)) text = text[:pre] + '...' return text.encode('utf8')
StarcoderdataPython
3293547
# Author : <NAME> # Email : <EMAIL> # # This file is part of LibNeuralArt ''' artistic oprs, used for creating arts ''' import numpy as np import tensorflow as tf def na_content_loss(inp, ref): n = ref.shape[1] * ref.shape[2] c = ref.shape[3] loss = (1. / (2. * n ** 0.5 * c ** 0.5)) * tf.reduce_sum(...
StarcoderdataPython
3381579
from enable.tools.viewport_zoom_tool import ViewportZoomTool from traits.api import DelegatesTo, Property class MappingZoomTool(ViewportZoomTool): """Zoom tool for a map viewport. self.component is the viewport self.component.component is the canvas """ zoom_level = DelegatesTo('component') ...
StarcoderdataPython
3210968
from stdnet.exceptions import * from structures import pipelines, Structure novalue = object() try: import cPickle as pickle except ImportError: import pickle #default_pickler = jsonPickler() default_pickler = pickle class NoPickle(object): def loads(self, s): return s ...
StarcoderdataPython
3374275
<gh_stars>0 from .client import * from .protocols import * from .server import * from .service import * from .utils import * from .common import * from .exceptions import *
StarcoderdataPython
4822171
def sanitize_tag(tag: str) -> str: """Clean tag by replacing empty spaces with underscore. Parameters ---------- tag: str Returns ------- str Cleaned tag Examples -------- >>> sanitize_tag(" Machine Learning ") "Machine_Learning" """ return tag.strip().rep...
StarcoderdataPython
3206325
<reponame>gavinshark/stayHungryStayFoolish #!/usr/bin/env python #-*- coding:utf-8 -*- import utilAlgorithm from numpy import * from logger import logger from utilfile import * from utilconfigration import cfg class utilAlg_Mean(utilAlgorithm.utilAlgorithm): def __init__(self): print('utilAlg_Mean __init_...
StarcoderdataPython
56904
import setuptools import os def get_files_in_dir(dirName): listOfFile = os.listdir(dirName) completeFileList = list() for file in listOfFile: completePath = os.path.join(dirName, file) if os.path.isdir(completePath): completeFileList = completeFileList + get_files_in_dir(comple...
StarcoderdataPython
28253
from Tkinter import * from Tkinter import filedialog, simpledialog from Tkinter import messagebox from editor.settings import backgroundcolor as bc from editor.settings import forgroundcolor as fc from editor.settings import back as b from editor.settings import fore as f from editor.settings import size from editor.se...
StarcoderdataPython
90006
from PyQt5.QtWidgets import * from PyQt5 import QtCore, QtWidgets, QtGui import BLL.ClientSocket import BLL.FileSystem # 登录界面 class LoginWin(QWidget): def __init__(self): super(LoginWin, self).__init__() # 设置窗口背景颜色为白色 pe = QtGui.QPalette() pe.setColor(pe.Background, QtGui.QColor(25...
StarcoderdataPython
3321151
<reponame>OakInn/ysLineidGen # SL_Common_Test.py # python v3.6 at least (due to f-string) # Tests for SL Common class # Functionality tests - read file, backup file, write file,\ # list of file pathes found by extension import os from tempfile import gettempdir import unittest from SL_Common import Common class Commo...
StarcoderdataPython
3313743
<reponame>httpsgithu/mindspore # Copyright 2022 Huawei Technologies 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...
StarcoderdataPython
3349775
<reponame>denyingmxd/Torchssc<filename>model/sketch.nyu/resnet.py import sys from collections import OrderedDict from functools import partial import torch.nn as nn import functools class Bottleneck(nn.Module): expansion = 4 def __init__(self, inplanes, planes, stride=1, dilation=1, downsample=None, fist_dilat...
StarcoderdataPython
61103
#c.execute("CREATE TABLE aud(RollNO text, date integer, starttime integer,endtime integer)") def check(roll,date,starttime,endtime): import sqlite3 message="" conn=sqlite3.connect('aud.db') c=conn.cursor() tup=tuple([roll,date,starttime,endtime]) audopen=9 audclose=24 if int(starttim...
StarcoderdataPython
108220
<gh_stars>0 # -- LICENSE file in the root directory of this source tree. An additional grant # -- of patent rights can be found in the PATENTS file in the same directory. # -- # -- Author: <NAME> <<EMAIL>> # -- <NAME> <<EMAIL>> # -- <NAME> <<EMAIL>> # -- The utility tool box import random util = {...
StarcoderdataPython
3268549
<filename>main_gui.py from gui_displayer import MainMenuWindow main_menu = MainMenuWindow() main_menu.show()
StarcoderdataPython
124687
# -*- coding: utf-8 -*- """ Created on Fri Sep 18 12:51:14 2020 @author: apurv """ import os from os import listdir from os.path import isfile, join import pdfplumber import pyttsx3 ##Setting the current working directory os.chdir("C://Users//apurv//OneDrive//Documents//Projects//2020//pdf-to-audiofile") pdf_path ...
StarcoderdataPython
1620406
import sqlalchemy import os connection_name = os.environ["DB_CONN_NAME"] db_name = os.environ["DB_NAME"] db_user = os.environ["DB_USER"] db_password = os.environ["DB_PASS"] driver_name = 'postgres+pg8000' query_string = dict({"unix_sock": "/cloudsql/{}/.s.PGSQL.5432".format(connection_name)}) def create_engine(): ...
StarcoderdataPython
1717958
<gh_stars>1-10 """ Copyright (c) 2014-2015 F-Secure See LICENSE for details """ from datetime import datetime import unittest import mock from werkzeug.test import Client as HttpClient from resource_api.errors import ValidationError, DoesNotExist, Forbidden from resource_api.schema import DateTimeField, IntegerField...
StarcoderdataPython
1685158
#!/usr/bin/env python3 # Fix an (any) KHARMA restart file so that KHARMA can restart from it # this works around a bug in Parthenon w.r.t. mesh sizes import sys import numpy as np import h5py outf = h5py.File(sys.argv[1], "r+") # Parthenon records the full size here, # but pretty clearly expects the size without gh...
StarcoderdataPython
3218330
from . import deterministic as spectralPDE from . import stochastic as spectralSPDE from . import version spectralPDE = spectralPDE.setup_solver spectralSPDE = spectralSPDE.setup_solver
StarcoderdataPython
3276196
from struct import pack import sys def printPacket(packet, split): i = 0; for c in packet: sys.stdout.write("%02x" % ord(c)) sys.stdout.write(" ") i += 1 if i == split: i = 0 sys.stdout.write('\n') sys.stdout.write('\n\n') class RecordType: A...
StarcoderdataPython
1745805
<filename>tests/make_testing_data.py import rasterio as rio from rasterio import Affine import numpy as np import click def makehappytiff(dst_path, seams_path): kwargs = { 'blockxsize': 256, 'blockysize': 256, 'compress': 'lzw', 'count': 4, 'crs': {'init': u'epsg:3857'}, ...
StarcoderdataPython
3229893
# Copyright (C) 2015-2016 Regents of the University of California # # 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 app...
StarcoderdataPython
10953
<gh_stars>0 from tests.base import TestCase, main, assets from ocrd_models.ocrd_page import ( AlternativeImageType, PcGtsType, PageType, TextRegionType, TextLineType, WordType, GlyphType, parseString, parse, to_xml ) simple_page = """\ <PcGts xmlns="http://schema.primaresearch...
StarcoderdataPython
5755
<reponame>philippWassibauer/django-activity-stream from distutils.core import setup """ django-activity-stream instalation script """ setup( name = 'activity_stream', description = 'generic activity feed system for users', author = '<NAME>', author_email = '<EMAIL>', url='http://github.com/philipp...
StarcoderdataPython
1765569
<filename>reverse-templating.py # https://github.com/pal03377/reverse-templating # reverse-templating.py # reverse-templating is licensed under MIT. # https://github.com/pal03377/reverse-templating/blob/master/LICENSE # author: <NAME> # 2018-01-05 # Reverse templating is a lib to reverse simple templates with {mustache...
StarcoderdataPython
1716680
<gh_stars>1-10 from typing import Optional, Set, Union import logging from overrides import overrides from allennlp.common.file_utils import cached_path from allennlp.data.dataset_readers.dataset_reader import DatasetReader from contexteval.contextualizers import Contextualizer from contexteval.data.dataset_readers i...
StarcoderdataPython
3266139
<filename>src/sensing/drivers/radar/umrr_driver/setup.py #!/usr/bin/env Python from distutils.core import setup from catkin_pkg.python_setup import generate_distutils_setup setup_args = generate_distutils_setup( packages=['smartmicro'], package_dir={'': 'src'} ) setup(**setup_args)
StarcoderdataPython
4826884
<filename>p1_basic/day08_15filefunction/day11/05_global和nonlocal.py # a = 10 # 全局变量本身就是不安全的, 不能随意修改, 闭包 # def func(): # global a # 1. 可以把全局中的内容引入到函数内部 , 2. 在全局创建一个变量 # #a = 20 # a += 10 # a = a+10 # print(a) # # func() # print(a) # a = 10 # def outer(): # def inner(): # 在inner中改变a的值 # n...
StarcoderdataPython
1673924
# Generated by Django 3.2.7 on 2021-09-20 08:27 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('store', '0004_address_subregion'), ] operations = [ migrations.RemoveField( model_name='address', name='city', ), ...
StarcoderdataPython
166397
import requests import ast """some modifactions to coinCommand to allow an easier way to test cli""" def cp(coin,currency): """gets coin price """ try: return cp_Request_to_Url(coin,currency) except Exception as err: return "coin or currency doesnt exist" def cp_Request_to_Url(coin,price): url="https:/...
StarcoderdataPython
1671433
from ctypes import * import math import random import os import cv2 import numpy as np import time import darknet # import threading import ini import datetime import json from Connserver import Connserver #### from time import sleep from threading import Thread ##from pynput import keyboard #wa """ def convertBack2(...
StarcoderdataPython
144999
from collections import defaultdict class Graph: def __init__(self,no_of_vertices,list_of_v): self.no_of_vertices = no_of_vertices self.graph = defaultdict(list) for v in list_of_v: self.graph[v] = [] def addEdge(self, u, v): self.graph[u].append(v) def isSink(self): keys = list(self...
StarcoderdataPython
149983
<reponame>buckets1337/UOMUMM # move.py # handles movement in the world def toRoom(server, player, command): ''' moves player from their currentRoom to newRoom ''' newRoom = None #print "cmd:" + str(command) #print "cmd0:" + str(command[0]) #print str(player.currentRoom.orderedExits) # args = <some int> if int...
StarcoderdataPython
4834811
#MoRequiem 2015 #The following line will make you insert the cost of your meal, not including taxes. meal = float(input("-What is the cost of the meal? \n")) #The tax is set on kenosha restaurant tax, edit if needed; also tip is 15 percent, later will add question for increase or decrease in tip tax = 0.055 tip = 0.15...
StarcoderdataPython
53572
<filename>tools/w3af/w3af/core/controllers/misc/decorators.py """ decorators.py Copyright 2011 <NAME> This file is part of w3af, http://w3af.org/ . w3af 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 version 2 ...
StarcoderdataPython
1635109
<gh_stars>0 # <NAME> # Data Structures and Algorithms in Python # Copyright 2018
StarcoderdataPython
3344446
<reponame>Wolfmarsh/mpf<filename>mpf/tests/test_AssetManager.py """Test assets.""" import time from mpf.tests.MpfTestCase import MpfTestCase class TestAssets(MpfTestCase): def get_machine_path(self): return 'tests/machine_files/asset_manager' def get_config_file(self): return 'test_asset_load...
StarcoderdataPython
3328470
import eel import traceback import HandPose import cv2 import win32gui, win32con start_flg = 0 #HandPose.py の開始フラグ、「1」で開始 end_flg = 0 #システム終了のフラグ、「1」で終了 #コンソールを消すときはここのコメントアウトを消してください。 #The_program_to_hide = win32gui.GetForegroundWindow() #win32gui.ShowWindow(The_program_to_hide , win32con.SW_HIDE) @eel.expose def...
StarcoderdataPython
105639
#!/usr/bin/python import console80v2 singleton = console80v2.singleIntValue() print "=== Singleton Time ===" print "" print singleton print "" print "Set a max number of items in history" singleton.setMaxHistoryLength(4) print singleton print "" print "Add 0 through 7 to history" for i in range(1,8): singleton.up...
StarcoderdataPython
1609503
<reponame>rthartley/reacombiner<gh_stars>1-10 #!/usr/bin/python3 # -*- coding: utf-8 -*- from string import Template import os, sys HEADER = """\ #!/usr/bin/python3 # -*- coding: utf-8 -*- # Created by: $created_by from distutils.core import setup import py2exe class Target(object): '''Target i...
StarcoderdataPython
30832
#!/usr/bin/env python3 from datetime import datetime, timezone, date import os import sys import boto3 import logging import json #setup global logger logger = logging.getLogger("SnapTool") #set log level LOGLEVEL = os.environ['LogLevel'].strip() logger.setLevel(LOGLEVEL.upper()) logging.getLogger("botocore").setLeve...
StarcoderdataPython
171931
<gh_stars>10-100 from datetime import datetime, timedelta import logging import re import boto3 from dart.util.s3 import get_bucket_name, get_key_name from dart.util.strings import substitute_date_tokens _logger = logging.getLogger(__name__) def data_check(s3_engine, datastore, action): """ :type s3_engine...
StarcoderdataPython
47215
def corpus_file_transform(src_file,dst_file): import os assert os.path.isfile(src_file),'Src File Not Exists.' with open(src_file,'r',encoding = 'utf-8') as text_corpus_src: with open(dst_file,'w',encoding = 'utf-8') as text_corpus_dst: from tqdm.notebook import tqdm text_co...
StarcoderdataPython
3252984
class Solution: def XXX(self, a: str, b: str) -> str: a_list,b_list=[],[] res=[] a_length=len(a) b_length=len(b) if(a_length>b_length): for i in range(a_length-b_length): b_list.append(0) else: for i in range(b_length-a_length):...
StarcoderdataPython
3201380
""" Data objects in group "energyplus" """ from collections import OrderedDict import logging from pyidf.helper import DataObject logger = logging.getLogger("pyidf") logger.addHandler(logging.NullHandler()) class LeadInput(DataObject): """Corresponds to IDD object `Lead Input`""" _schema = {'extensible-fi...
StarcoderdataPython
3244822
<filename>tests/test_validation.py """Test validation functions.""" # pylint: disable=missing-docstring from imaps.base.validation import ( validate_bam_file, validate_bed_file, validate_date, validate_integer, validate_string, ) from ngs_test_utils.testcase import NgsTestCase class TestValidation...
StarcoderdataPython
1786497
<gh_stars>0 import os import pytest @pytest.fixture def api_email(): return os.getenv('API_EMAIL') or 'mock-email' @pytest.fixture def api_key(): return os.getenv('API_KEY') or 'mock-key' @pytest.fixture def base_url(): return os.getenv('BASE_URL') or 'http://tuneapp.localhost/api'
StarcoderdataPython
4839584
""" Useful parameters for the model """
StarcoderdataPython
3201780
# Read three angles, which are given on separate lines, from the # input and print in the following format whether they form a # triangle: "The triangle is valid!" or "The triangle is not valid!" a = int(input()) b = int(input()) c = int(input()) print("The triangle is valid!" if a + b + c == 180 else "The triangle i...
StarcoderdataPython
1665358
from django.core import serializers from django.http import HttpResponse def export_as_json(modeladmin, request, queryset): response = HttpResponse(content_type="application/json") model_name = modeladmin.model._meta.model_name response["Content-Disposition"] = "attachment;filename={model_name}.json".form...
StarcoderdataPython
3393446
<reponame>vgoliber/points-on-maps<filename>map_viz.py import pandas as pd import matplotlib.pyplot as plt import geopandas as gpd from shapely.geometry import Polygon def viz_results(build_sites, existing_chargers, radius): street_map = gpd.read_file('data/dubai.shp') filename = "UAE_Emirate.geojson" fil...
StarcoderdataPython
77383
from detectron2.engine import DefaultTrainer, HookBase from detectron2.config import get_cfg from detectron2.data.datasets import register_coco_instances, load_coco_json from detectron2.modeling import build_model from detectron2.checkpoint import DetectionCheckpointer from detectron2.data import DatasetCatalog, Metada...
StarcoderdataPython
1629992
<gh_stars>100-1000 from office365.runtime.client_value import ClientValue class SimpleDataTable(ClientValue): pass
StarcoderdataPython
3262539
<filename>utils/draw_fit.py import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set_context("paper", rc={'font.sans-serif': 'Helvetica', 'font.size': 12}) df_green = pd.read_csv('~/Resources/Experiments/dcfnex-12/dcstfn-green/train/history.csv') df_red = pd.read_...
StarcoderdataPython
3277810
<reponame>dpalmasan/python-user-posts-microservice import logging import os from pathlib import Path from config import Config from db.session import create_db_session logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) ch = logging.StreamHandler() ch.setLevel(logging.INFO) # create formatter formatter...
StarcoderdataPython
1665508
<reponame>hkvh/sonata-archives #!/usr/bin/env python """ A module designed to render all lilypond files """ import glob import logging import os from typing import List from directories import DATA_DIR from general_utils.lilypond_utils import render_lilypond_png_into_app_directory log = logging.getLogger(__name__) ...
StarcoderdataPython
65710
import os import json def evaluation(results, all_res, bug_data, storage_path): map_value = 0 map_value_all = 0 ap_value = {} count = 0 for bug_id, bug_cont in bug_data.items(): temp1 = 0 temp2 = 0 ap_tmp = 0 all_ap_tmp = 0 truth_num = 0 file_pa...
StarcoderdataPython
100086
<reponame>naamara/blink # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import accounts.models class Migration(migrations.Migration): dependencies = [ ('accounts', '0001_initial'), ] operations = [ migrations.AddField( ...
StarcoderdataPython
3200301
<reponame>hsmtknj/programming-contest # a = ['a', 't', 'c', 'o', 'd', 'e', 'r'] # t = [chr(i) for i in range(97,97+26)] # tt = [i for i in range(97, 97+26)] # print(tt) # print(tt[0:3] + [100]) for i in reversed(range(10)): print(i)
StarcoderdataPython
71262
<filename>sdk/apis/market_service.py # -*- coding: utf-8 -*- # 服务市场服务 class MarketService: __client = None def __init__(self, client): self.__client = client def sync_market_messages(self, start, end, offset, limit): """ 同步某一段时间内的服务市场消息 :param start:开始时间 :param e...
StarcoderdataPython
110107
#!/usr/bin/env python3 import numpy as np M = np.array( ( [1, -1, 0, 0, 0, 0, 0, 0], [0.4, 0.4, 0, -1, 0, 0, 0, 0], [0.6, 0.6, -1, 0, 0, 0, 0, 0], [0, 0, 0, -0.75, 0, 1, 0, 0], [-1, 0, 0, 0, 1, 1, 0, 0], [0, -1, 0, 0, 0, 0, 1, 1], [0, 0, 0, -1, 0, 1, 0, 1], ...
StarcoderdataPython
8020
<reponame>cbeall123/E3SM """ Interface to the env_build.xml file. This class inherits from EnvBase """ from CIME.XML.standard_module_setup import * from CIME.XML.env_base import EnvBase logger = logging.getLogger(__name__) class EnvBuild(EnvBase): # pylint: disable=unused-argument def __init__(self, case_ro...
StarcoderdataPython
3270624
import matplotlib.pyplot as plt def plot(x, y, ind): '''Plots the original data with the peaks that were identified Parameters ---------- x : array-like Data on the x-axis y : array-like Data on the y-axis ind : array-like Indexes of the identified peaks ''' pl...
StarcoderdataPython
3306505
<gh_stars>10-100 import unittest import torch from allennlp.common.params import Params from torch.jit import Error from zsl_kg.knowledge_graph.kg import KG class TestKG(unittest.TestCase): def setUp( self, ): """creates an instance of KG with sample data.""" params = Params({"embeddi...
StarcoderdataPython
1729543
<filename>userbot/plugins/goodbyesahyri2.py from telethon import events import asyncio import os import sys import random from userbot.utils import admin_cmd @borg.on(admin_cmd(pattern="byeq ?(.*)")) async def _(event): if event.fwd_from: return await event.edit("@veryhelpful making goodbye ...
StarcoderdataPython
1754574
"""beerup_django URL Configuration """ from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('api/v1/', include('djoser.urls')), path('api/v1/', include('djo...
StarcoderdataPython
1624249
<gh_stars>0 """Additional NeuroDriver Components for ANTcircuits""" from .NoisyConnorStevens import NoisyConnorStevens from .OTP import OTP
StarcoderdataPython
1688228
<reponame>restlessankyyy/Python<gh_stars>0 import matplotlib .pyplot as pit x = [101,102,103] y= [5500,6000,4000] x1 = [101,102,103] y1=[5500,4800,1800] pit.plot(x,y,label="Salary for 2015",color= 'red') pit.plot(x1,y1,label="Salary for 2016") pit.xlabel("Employee ID") pit.ylabel("Salary in $s") pit.ti...
StarcoderdataPython
1609041
<gh_stars>0 # Encoding: UTF-8 # -- # Copyright (c) 2008-2021 Net-ng. # All rights reserved. # # This software is licensed under the BSD License, as described in # the file LICENSE.txt, which you should have received as part of # this distribution. # -- from nagare.renderers import rml def sample(output): r = rml...
StarcoderdataPython
3287916
# -*- coding: utf-8 -*- # # Copyright (c) 2017-2018 Spotify AB # # 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...
StarcoderdataPython
115577
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This module implements Deep QL with two networks: Q-network and target-network the DQL uses an MLP Q-network it is retrained only after 'episodes' iterations the training uses replay memory """ from copy import deepcopy import numpy as np import loggin...
StarcoderdataPython
1661649
from typing import Any, Dict, NoReturn from chaosplt_auth.storage.interface import BaseAuthStorage __all__ = ["MyAuthStorage"] class MyAuthStorage(BaseAuthStorage): def __init__(self, config: Dict[str, Any]): self.some_flag = True def release(self) -> NoReturn: self.some_flag = False
StarcoderdataPython
42372
import json def filePath(): """ ask for file path""" filepath = hou.ui.selectFile() return filepath def getData(filename): return eval(open(filename).read(), {"false": False, "true":True}) temp_data = getData(filePath()) for i in range(len(temp_data)): #print(dict[i]) data = temp_data[i...
StarcoderdataPython
3317423
<filename>phoenix/supervisor/views/supervisor.py from pyramid.view import view_config, view_defaults from pyramid.httpexceptions import HTTPFound from phoenix.views import MyView from phoenix.grid import CustomGrid @view_defaults(permission='admin', layout='default') class Supervisor(MyView): def __init__(self, ...
StarcoderdataPython
4808724
<reponame>roeap/flight-fusion import flight_fusion def test_import_flight_fusion(): assert flight_fusion.__name__ == "flight_fusion" def test_flight_fusion_python_version(): assert flight_fusion.__version__ > "0.0.0"
StarcoderdataPython
3213728
# -*- coding: UTF-8 -*- from nonebot.default_config import * #添加超级管理员 Q号-数值 例:SUPERUSERS.add(12345678) SUPERUSERS.add(12345) #nonebot的监听端口 HOST = '127.0.0.1' PORT = 9100 #SECRET = '' #ACCESS_TOKEN = '' #API_ROOT = 'http://127.0.0.1:5700' #nonebot的debug开关 DEBUG = False COMMAND_START = {'!','!'} NICKNAME = {'bot', 'bo...
StarcoderdataPython
1779653
<gh_stars>1-10 import numpy from datetime import datetime import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt plt.style.use('classic') from matplotlib.ticker import FormatStrFormatter from visuallib import candlestick2_ohlc def volume_analysis(client,market,num_hours): candles=numpy.array(clie...
StarcoderdataPython
3323134
<filename>larq_zoo/training/sota_experiments.py<gh_stars>0 import larq as lq import tensorflow as tf from zookeeper import ComponentField, Field, cli, task from larq_zoo.sota.quicknet import ( QuickNetFactory, QuickNetLargeFactory, QuickNetSmallFactory, ) from larq_zoo.training.learning_schedules import Co...
StarcoderdataPython
3227332
<reponame>sleepinhoo/Python # tip: a condição poderia ser escrita da forma reduzida >>> pr = dist * 0.50 if dist <= 200 else dist * 0.45 >>> use-a para códigos menores, caso contrário, use a versão tradicional, deixa o código mais bonito dist = float(input("QUal é a distância da sua passagem? ")) print(f"Você está pre...
StarcoderdataPython
3394001
<gh_stars>0 import click import sys import logging from config import init_logging from network.funcnet import FN init_logging() logger = logging.getLogger(__name__) @click.command() def make(): fn = FN() if __name__ == '__main__': make()
StarcoderdataPython
151865
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.conf.urls import url, include from appxs.account.views.role import list_role, edit_role, add_role, del_role from ..apps import app_name urlpatterns = [ url(r'^add/$', add_role, name='add'), url(r'^list/$', list_role, name...
StarcoderdataPython
73061
import bitmath import ipaddress import re from ipaddress import AddressValueError from insights.parsers.installed_rpms import InstalledRpm from kerlescan.constants import SYSTEM_ID_KEY from kerlescan.constants import SYSTEM_PROFILE_STRINGS, SYSTEM_PROFILE_INTEGERS from kerlescan.constants import SYSTEM_PROFILE_BOOLEA...
StarcoderdataPython
30688
<filename>torcharc/module/merge.py<gh_stars>1-10 from abc import ABC, abstractmethod from torch import nn from typing import Dict, List import torch class Merge(ABC, nn.Module): '''A Merge module merges a dict of tensors into one tensor''' @abstractmethod def forward(self, xs: dict) -> torch.Tensor: # p...
StarcoderdataPython
1640175
""" ! #1 BASICS @app.route("/user_teste/<name>") def user_test(name): return f"Hello {name}" @app.route("/admin") def admin(): return redirect(url_for("user", name="admin")) """ """ ! #2 HTML @app.route("/<text>") def home_page(text): names_list = ["lucas", "luana", "lukita", "luanita"] return rende...
StarcoderdataPython