id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1610080
"""Environment wrapper class for logging episodes. This can be used to record data from a subject playing the task. See ../../moog_demos/restore_logged_data.py for an example of how to read log files. Note: This logger records everything about the environment, which can be a lot of data (depending on the task). If yo...
StarcoderdataPython
93701
import os serenityff_C6 = os.path.dirname(__file__) + "/C6/" serenityff_C12 = os.path.dirname(__file__) + "/C12/"
StarcoderdataPython
3256401
<filename>src/pico_code/pico/explorer-base/ExplorerWorkout2.py # Physical Computing with Graphics on Pico Explorer # <NAME> 30th Jan 2021 # 10K Ohm potentiometer on ADC0 # LED with 470 Ohm resistor on GP4 import picoexplorer as display import utime, random, math from machine import Pin width = display.get_width() heigh...
StarcoderdataPython
40308
import frappe def after_migrate(): set_default_otp_template() def set_default_otp_template(): if not frappe.db.get_value("System Settings", None, "email_otp_template"): if frappe.db.exists("Email Template", "Default Email OTP Template"): # should exists via fixtures frappe.db.set_value("System Set...
StarcoderdataPython
3353888
<gh_stars>1-10 import copy import pytest from tempocli.cli import cli from tempocli.cli import ENVVAR_PREFIX from tests.helpers import write_yaml def test_tempocli(cli_runner): result = cli_runner.invoke(cli) assert result.exit_code == 0 assert 'Usage:' in result.output @pytest.mark.freeze_time('2018-...
StarcoderdataPython
15917
from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.mime.image import MIMEImage from email.header import Header from email.mime.base import MIMEBase from email import encoders import os import uuid import smtplib import re class CTEmail(object): def __i...
StarcoderdataPython
112306
<filename>common/responses.py<gh_stars>0 from flask import jsonify import common.logger as log def respondInternalServerError(message='Internal server error', error=None): '''Returns an object which flask will parse and transform into a 500 response''' log.info('Responding internal server error') log.info...
StarcoderdataPython
3293004
<reponame>Juan-Manuel-Diaz/UniNeuroLab<filename>GUI/Menu_principal.py #!/usr/bin/env python # coding: utf-8 # In[1]: from PyQt5.QtWidgets import (QApplication, QMainWindow, QVBoxLayout, QMenu, QLabel, QLineEdit, QPushButton, QWidget, QAction) from PyQt5.QtCore import Qt from PyQt5.QtGui im...
StarcoderdataPython
3380316
from controller.acoController import AcoController def main(): controller = AcoController() controller.solve() return if __name__ == '__main__': try: print('\n\t-- ACO Router --\n') main() print('\n----------------------------------\n') except Exception as err: p...
StarcoderdataPython
3204953
from shop.shopper_base import ShopperBase import datetime import os import time import math import random from typing import Dict, Tuple, Union, List, Callable import keyboard import numpy as np from screen import convert_screen_to_monitor, grab, convert_abs_to_monitor, convert_screen_to_abs, convert_monitor_to_scree...
StarcoderdataPython
1621732
# -*- coding: utf-8 -*- from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('open_humans', '0015_auto_20150410_0042'), ] operations = [ migrations.AlterModelManagers( name='member', managers=[ ], )...
StarcoderdataPython
89599
import sys from numpy import * nline = eval(sys.argv[1]) t = linspace(0., 1., nline) x = eval(sys.argv[2]) y = eval(sys.argv[3]) f = open(sys.argv[4], 'w') f.write('# vtk DataFile Version 4.2\n') f.write('vtk output\n') f.write('ASCII\n') f.write('DATASET UNSTRUCTURED_GRID\n') f.write('POINTS {} double\n'.format(nlin...
StarcoderdataPython
1628519
<filename>labs_final/lab3/viskit/frontend.py<gh_stars>1-10 #!/usr/bin/env python import os import flask from viskit import core import sys import argparse import json import numpy as np import plotly.offline as po import plotly.graph_objs as go class AttrDict(dict): def __init__(self, *args, **kwargs): ...
StarcoderdataPython
3395439
#!/usr/bin/env python3 # TODO: add cmdline options to suppress emailed reports if __name__ == '__main__': if __package__ is None: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) import settings from core.models.transaction imp...
StarcoderdataPython
3369985
<filename>bot/plugins/wideoidea.py<gh_stars>0 from __future__ import annotations import os import tempfile from bot.config import Config from bot.data import command from bot.data import format_msg from bot.message import Message from bot.util import check_call @command('!wideoidea', '!videoidea', secret=True) asyn...
StarcoderdataPython
90728
#!/usr/bin/env python # encoding: utf-8 from __future__ import (absolute_import, division, print_function, unicode_literals) import os, sys, re import logging import argparse import collections logging.basicConfig(stream=sys.stderr, level=logging.INFO) logger = logging.getLogger(__file__) de...
StarcoderdataPython
112924
<filename>resultScript/remove_polygons.py #!/usr/bin/env python # Filename: remove_polygons.py """ introduction: keep the true positive only, i.e., remove polygons with IOU less than or equal to 0.5. it can also be used to remove other polygons based on an attribute authors: <NAME> email:<EMAIL> add time: 26 February...
StarcoderdataPython
159174
<reponame>django-doctor/lite-api # Generated by Django 2.2.13 on 2020-06-16 08:37 from django.db import migrations, models import django.utils.timezone import model_utils.fields import uuid class Migration(migrations.Migration): initial = True dependencies = [ ("licences", "0005_auto_20200616_0837"...
StarcoderdataPython
1766760
#!/usr/bin/env python # -*- coding: utf-8 -*- class TestRailBaseError(Exception): def __str__(self): return "[TestRailAPI] %s || (%s) || %s" \ % (s...
StarcoderdataPython
3391157
from abc import ABC, abstractmethod from typing import Dict, Sequence, Generic, TypeVar from .eval_stats.eval_stats_clustering import ClusteringUnsupervisedEvalStats, \ ClusteringSupervisedEvalStats, ClusterLabelsEvalStats from .evaluator import MetricsDictProvider from ..clustering import EuclideanClusterer from ...
StarcoderdataPython
1630408
class Module3(object): pass
StarcoderdataPython
175315
<reponame>aryanshridhar/Ecommerce-Website<gh_stars>1-10 from django.db import models from django.contrib.auth.models import User import os class Profile(models.Model): user = models.OneToOneField(User , on_delete = models.CASCADE) image = models.ImageField(default='default.jpg' , upload_to='Ecommerce/images')...
StarcoderdataPython
35674
<reponame>e-koch/pyuvdata # -*- mode: python; coding: utf-8 -*- # Copyright (c) 2018 Radio Astronomy Software Group # Licensed under the 2-clause BSD License """Primary container for radio interferometer datasets.""" import os import copy from collections.abc import Iterable import warnings import threading import nu...
StarcoderdataPython
1781534
<gh_stars>0 # Generated by Django 3.2.6 on 2021-11-26 19:55 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('storehouse', '0001_initial'), ] operations = [ migrations.AddField( model_name='user', name='age', ...
StarcoderdataPython
99136
<gh_stars>0 # coding: utf-8 import os import sys import glob from pathlib import Path image_ext = ['.JPG', '.jpg', '.jpeg','.JPEG','.png','.bmp'] def create_match_file_list(image_path, match_folder_file, match_list_file): with open(match_list_file, "w") as fout: # fid.write(HEADER) # for _, cam in ...
StarcoderdataPython
3337397
<gh_stars>1-10 """ reset_db ======== Django command to drop and recreate a database. Useful when running tests against a database which may previously have had different migrations applied to it. This handles the one specific use case of the "reset_db" command from django-extensions that we were actually using. orig...
StarcoderdataPython
1601901
<filename>src/Hero.py #!/usr/bin/python class Hero(object): def __init__(self, Name): self.name = Name
StarcoderdataPython
1773105
""" Author: <NAME> Copyright: <NAME>, RCH Engineering, 2021 License: BSD Clear 3 Clause License All rights reserved """ import datetime import os import warnings import affine import geopandas as gpd import h5py import netCDF4 as nc import numpy as np import pandas as pd import rasterio.features as riof import request...
StarcoderdataPython
42171
# Problem Statement: https://leetcode.com/problems/climbing-stairs/ class Solution: def climbStairs(self, n: int) -> int: # Base Cases if n==1: return 1 if n==2: return 2 # Memoization memo_table = [1]*(n+1) # Initializati...
StarcoderdataPython
3255522
from tmeister import cron if __name__ == '__main__': cron.run()
StarcoderdataPython
1689145
<filename>Week3/02_Execucao-Condicional/Desafio_bhaskara.py import math a = float(input("Digite o valor de a: ")) b = float(input("Digite o valor de b: ")) c = float(input("Digite o valor de c: ")) delta = (b ** 2) - (4 * a * c) print(delta) if (delta == 0): x = (-b + math.sqrt(delta)) / 2 * a print("A única raiz...
StarcoderdataPython
168033
from django.contrib import admin from .models import Class, Studio # Register your models here. admin.site.register(Class) admin.site.register(Studio)
StarcoderdataPython
164871
<filename>src/utils/FastClassAI_cnn_models.py<gh_stars>1-10 # ********************************************************************************** # # # # Project: FastClassAI workbecnch #...
StarcoderdataPython
47804
# -*- coding: UTF-8 -*- # https://dormousehole.readthedocs.io/en/latest/config.html#config class Config(object): SECRET_KEY = 'e9d37baf44de4b11a76159c50820468f' SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://xingweidong:xingweidong&123@localhost/idss_stock' # 股票数据库,默认 ...
StarcoderdataPython
3386905
from src.config import MESSAGE_UNEXPECTED_ERROR from src.helper import log def make(error, message=None, response=None): response_dict = dict(error=error) if error: assert isinstance(message, str) response_dict['message'] = message else: assert isinstance(response, dict) re...
StarcoderdataPython
3316312
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Author: <NAME> <<EMAIL>> # Copyright (C) 2017 <NAME> <<EMAIL>> # Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html """ Automated tests for checking the poincare module from the models package. """ import logging import unittest import numpy as ...
StarcoderdataPython
3357116
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torchquantum as tq import copy from torchquantum.macro import C_DTYPE from torchpack.utils.logging import logger from typing import List, Dict, Iterable from torchpack.utils.config import Config from qiskit.providers.aer.noise...
StarcoderdataPython
3281535
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
StarcoderdataPython
4818136
<gh_stars>0 import pandas as pd #tech = ['sharpen','elasticdeformation','horizontalline','diagonalline','diagonalinverseline','verticalleftline','verticalrightline','severalrowsline', # 'severalcolsline', 'severalcolsrowsline', 'superpixel', 'gaussianblur', 'additivegaussiannoise','dropout','translation','rotation9...
StarcoderdataPython
1726666
<gh_stars>0 import jyx jyx.Jyx()
StarcoderdataPython
48397
import pandas as pd df = pd.DataFrame() files = pd.read_csv('grandtlinks.csv') try: files['status'] = files['status'].astype(str) header=False except KeyError: files['status'] = '' header=True for index, row in files.iterrows(): if row['status'] == 'parsed': continue filename = row['f...
StarcoderdataPython
3331858
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-09-11 21:35 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('resale', '0003_change_coords'), ] operations = [ migrations.AlterModelOptions( ...
StarcoderdataPython
3225249
<gh_stars>1-10 #!/usr/bin/env python3 """Creates records, similar to collections.namedtuple. Creates a record class like namedtuple, but mutable and with optional attributes. Optional attributes take a value or a callable (make sure to use a factory function otherwise the same object will be shared among all the reco...
StarcoderdataPython
1605749
#!/usr/bin/env python # -*- coding: utf-8 -*- """Provides managers specific to SSI / Trust Triangle roles. AgentConnectionManager (ACM) is a based on PySyft's DuetCredentialExchanger Class. The class helps to manage aries agents, send messages, and establish aries and duet connections. Specifically, active aries conne...
StarcoderdataPython
1623811
<gh_stars>0 from rest_framework import serializers from bestiary.models import Monster, Skill, LeaderSkill, SkillEffect, ScalingStat, Source, \ HomunculusSkillCraftCost, HomunculusSkill from herders.models import MonsterTag, RuneInstance, TeamGroup, Team, MonsterInstance, Summoner, ArtifactInstance # Read-only m...
StarcoderdataPython
1788969
amount = int(input()) sen = [0 for n in range(amount)] for i in range(amount): sen[i] = list(input()) cap = False for z in range(len(sen[i])): if sen[i][z].isalpha() == True: if cap == True: cap = False sen[i][z] = sen[i][z].upper() else: ...
StarcoderdataPython
1798648
<reponame>henrikstranneheim/chanjo-report # -*- coding: utf-8 -*- """ test_chanjo_report ---------------------------------- Tests for `chanjo-report` module. """ import pytest import chanjo_report class TestChanjoReport(object): @classmethod def set_up(self): pass def test_something(self): pass @cl...
StarcoderdataPython
3295052
<filename>bayes_optim/utils/utils.py import functools import os import random import re import string import time from copy import copy from typing import Callable, Dict, List, Union import numpy as np from ..solution import Solution from .exception import ConstraintEvaluationError def is_pareto_efficient(fitness, ...
StarcoderdataPython
12355
import json from grafana_backup.dashboardApi import create_snapshot def main(args, settings, file_path): grafana_url = settings.get('GRAFANA_URL') http_post_headers = settings.get('HTTP_POST_HEADERS') verify_ssl = settings.get('VERIFY_SSL') client_cert = settings.get('CLIENT_CERT') debug = setting...
StarcoderdataPython
1602787
from collections import Counter with open('./input_4.txt') as fp: num, add = 0, 0 for line in fp: num += Counter(line.split()).most_common(1)[0][1] == 1 add += Counter(''.join(sorted(w)) for w in line.split()).most_common(1)[0][1] == 1 print(num, add)
StarcoderdataPython
34209
<filename>Chapter05/restful_python_2_05/Django01/games_service/games/models.py from django.db import models class Game(models.Model): created_timestamp = models.DateTimeField(auto_now_add=True) name = models.CharField(max_length=200) release_date = models.DateTimeField() esrb_rating = models.CharField...
StarcoderdataPython
106776
#xyz Sep 2017 ''' Data preparation for datsets: stanford_indoor, scannet, ETH_semantic3D Core idea: store all the information in hdf5 file itself # The workflow to use this tool: Raw_H5f -> Sorted_H5f -> merge block to get new block size -> randomnly select n points -> Normed_H5f -> Net_Provider ## Raw_H5f store ...
StarcoderdataPython
3331588
<gh_stars>1-10 from django.db import models class Question(models.Model): question_text = models.CharField(max_length=200, unique=True, null=False) pub_date = models.DateTimeField() def __str__(self): return '问题: %s' % self.question_text class Choice(models.Model): choice_text = models.CharFi...
StarcoderdataPython
13791
# Generated by Django 3.1.5 on 2021-01-25 16:24 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('app', '0002_auto_20210124_0610'), ] operations = [ migrations.RenameModel( old_name='Parent', new_name='Account', ),...
StarcoderdataPython
3242023
from django.shortcuts import render from django.views.generic import View from .models import GoodsCategory from meiduo_mall.utils.category import get_category #分页 from django.core.paginator import Paginator # Create your views here. class ListView(View): def get(self, request, category_id, page_num): # 查询当...
StarcoderdataPython
1643679
<reponame>baviera08/romi-dashboard # import asyncio # import concurrent.futures # from rmf_task_msgs.msg import TaskSummary as RmfTaskSummary # from rmf_task_msgs.msg import TaskType as RmfTaskType # from rmf_task_msgs.srv import CancelTask as RmfCancelTask # from rmf_task_msgs.srv import SubmitTask as RmfSubmitTask ...
StarcoderdataPython
3331056
<filename>train_model.py import torch from torch import optim, nn from preprocess import preprocess_image from utils import save_model num_epochs = 10 log_step = 10 eval_step = 5 save_step = 5 # from vgg import model, feature_extracter # from image_loader import image_loader # loader = image_loader('/home/iacv/proj...
StarcoderdataPython
1658895
""" This code can help you to send automatic messages in Whatsapp. Provide a csv or xls* file containing phone numbers in a column to send an equal message to all of them. Make sure that the area/state code is informed in your numbers, otherwise the message will not be delivered. Note: The code takes some t...
StarcoderdataPython
3253510
<filename>ogip_spectra/__init__.py from .ogip_spectrum_dataset import * from .io_ogip import * from .models import * __all__ = [ "StandardOGIPDataset", "StandardOGIPDatasetReader", "XspecSpectralModel" ]
StarcoderdataPython
1606026
# memoryview.init() try: memoryview.init except: print("SKIP") raise SystemExit buf = b"12345" m = memoryview(buf, 1, 3) print(list(m)) m.init(buf, -1, 100) print(list(m)) m.init(buf, 200, -1) print(list(m))
StarcoderdataPython
155502
<reponame>egonrian/google-research # coding=utf-8 # Copyright 2020 The Google Research 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-...
StarcoderdataPython
3361984
<filename>examples/tutorial_1_stl.py #!/usr/bin/env python # coding: utf-8 r"""Tutorial 1 STL example""" import pygem as pg from pygem.utils import write_bounding_box # Parameters that DO modify the shape params = pg.params.FFDParameters() params.read_parameters(filename='./tutorial_1_stl/parameters_test_ffd_sphere....
StarcoderdataPython
1798608
<filename>bind/pypi_2.py<gh_stars>100-1000 # Decompiled by HTR-TECH | <NAME> # Github : https://github.com/htr-tech #--------------------------------------- # Source File : a.py # Time : Wed Sep 9 04:27:21 2020 #--------------------------------------- # uncompyle6 version 3.7.4 # Python bytecode 2.7 # Decompiled from...
StarcoderdataPython
1763675
<reponame>ashdnazg/toppy<gh_stars>0 import numpy as np from ..system_stat import MemoryStat from . import common from .animated import AnimatedAxes class MemoryPlotter(AnimatedAxes): def __init__(self, mem=None): self.mem = mem or MemoryStat() def setup(self, axes, x): self.mem.setup() ...
StarcoderdataPython
1709374
from argparse import ArgumentParser, Namespace def generate_words(language: str = 'english', count: int = 24) -> str: from mnemonic import Mnemonic mnemonic = Mnemonic(language) return mnemonic.generate(strength=int(count * 10.67)) def create_parser() -> ArgumentParser: from hathor.cli.util import c...
StarcoderdataPython
40662
<reponame>legitbee/pulumi-ovh<filename>sdk/python/pulumi_ovh/get_vps.py # coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing...
StarcoderdataPython
4841955
""" Author: <NAME>, 2018 Github: https://github.com/codewithsk/graph-cnn.mxnet The Ohio State University Graph Convolutional Network File: train.py Description: Training script for graph convolutional network """ import time import argparse import numpy as np import mxnet as mx from mxnet import autograd, gluon fr...
StarcoderdataPython
140362
<reponame>ReesaJohn/3D60 import argparse import sys import os import argparse import csv import itertools import cv2 import numpy import torch def parse_arguments(args): desc = ( "3D60 dataset statistics calculation." ) parser = argparse.ArgumentParser(description=desc) # paths parser....
StarcoderdataPython
86932
from ImageEmbeddings import ImageEmbeddings from celery import Task, Celery from cairosvg import svg2png from numpy import array from PIL import Image from pickle import load from base64 import b64encode from io import BytesIO from tempfile import NamedTemporaryFile def svg2array(bytestring=None, size=32, tran_color=...
StarcoderdataPython
163193
<reponame>Dexterp37/twitter_sentimap import json import logging import os logger = logging.getLogger(__name__) # How many tweets to put in a single JSON file? This # directly influences. ENTRIES_PER_FILE = 500 class SourceRecorder: """ Write the incoming data to a set of valid JSON files. The data is wri...
StarcoderdataPython
1711218
import pandas as pd import matplotlib.pyplot as plt import seaborn as sn import pickle from siuba import * from datetime import datetime as dt # Opening SHAP results with pickle infile = open("lgbm_dict", "rb") lgbm_dict = pickle.load(infile) asdas=pickle.load(infile) df_r2 = pd.DataFrame(columns=["ga...
StarcoderdataPython
3399444
<filename>Python tests/classes_objects.py lottery_player_dict = { 'name': 'Rolf', 'numbers': (5, 9, 12, 3, 1, 21) } class LotteryPlayer: def __init__(self, name): self.name = name self.numbers = (5, 9, 12, 3, 1, 21) def total(self): return sum(self.numbers) player_one = Lotter...
StarcoderdataPython
115070
# This script demonstrates changing the state of hardware # handshake lines. While the script is running, you can see # the DTR LED in the CoolTerm window blinking. # # Author: <NAME>, 04-30-2020 # CoolTerm version: 1.7.0 import sys import time import CoolTerm s = CoolTerm.CoolTermSocket() # Get the ID of the first o...
StarcoderdataPython
1708652
<reponame>zsiciarz/jamchemy import strawberry from .mutations import Mutation from .queries import Query from .subscriptions import Subscription schema = strawberry.Schema(query=Query, mutation=Mutation, subscription=Subscription)
StarcoderdataPython
190258
<filename>environment.py """The Environment class and its helper classes.""" import ipaddress from typing import Any, Dict, List import pulumi_vsphere as vsphere class Network: """Represents the IPv4 network being used in the environment.""" def __init__(self, network_id: str, subnet: ipaddress.IPv4Network,...
StarcoderdataPython
1754403
<filename>vdibroker/api/v1/views/session_view.py<gh_stars>10-100 # Copyright 2017 Cloudbase Solutions, SRL. # # 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/lice...
StarcoderdataPython
24810
<reponame>securedataplane/preacher class NEC: def __init__( self ): self.prompt = '(.*)' self.timeout = 60 def show(self, *options, **def_args ): '''Possible Options :[' access-filter ', ' accounting ', ' acknowledgments ', ' auto-config ', ' axrp ', ' cfm ', ' channel-grou...
StarcoderdataPython
10937
<filename>src/models/layers/feature.py import torch import torch.nn as nn class MLP(nn.Module): def __init__(self, num_features, hidden_sizes, dropout): super().__init__() self.layers = nn.ModuleList( [nn.Linear(num_features, hidden_sizes[0])] + [nn.Linear(hidden_sizes[i], h...
StarcoderdataPython
1747135
<filename>valentyusb/usbcore/cpu/usbwishbonebridge.py<gh_stars>10-100 from migen import * from migen.genlib.misc import chooser, WaitTimer from migen.genlib.record import Record from migen.genlib.fsm import FSM, NextState from litex.soc.interconnect import wishbone from litex.soc.interconnect import stream from ..pi...
StarcoderdataPython
1621438
import numpy as np def get_phaselc(t, p, data, v_num): return 1.+p.amp1[v_num]*np.cos(2.*np.pi*(t-p.theta1[v_num])/p.per[v_num]) + p.amp2[v_num]*np.cos(4.*np.pi*(t-p.theta2[v_num])/p.per[v_num])
StarcoderdataPython
3399460
# # @lc app=leetcode id=572 lang=python3 # # [572] Subtree of Another Tree # # @lc code=start # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def isSubtree(self, s, t): if not ...
StarcoderdataPython
3366877
<gh_stars>0 # -*- coding: utf-8 -*- import unittest import sys, os sys.path.append('../../') from etk.core import Core import json import codecs class TestExtractionsInputPaths(unittest.TestCase): def setUp(self): file_path = os.path.join(os.path.dirname(__file__), "ground_truth/1_content_extracted.jl") ...
StarcoderdataPython
161386
<filename>Leetcode/0429. N-ary Tree Level Order Traversal.py from collections import deque class Node: def __init__(self, val=None, children=None): self.val = val self.children = children class Solution: def levelOrder(self, root: Node) -> list[list[int]]: if not root: r...
StarcoderdataPython
12547
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os from spack import * class Cudnn(Package): """NVIDIA cuDNN is a GPU-accelerated library of primitives for d...
StarcoderdataPython
3246341
<reponame>Yappawu/qqqfome import os import sqlite3 import json import logging import datetime from zhihu import Author, ZhihuClient from . import common as c from . import strings as s L = logging.getLogger('qqqufome-db') def set_logger_level(level): c.check_type(level, 'level', logging.NOTSET) global L ...
StarcoderdataPython
3282169
import bpy def apply_render_settings(render_engine,resolution_x,resolution_y,resolution_percentage,pixel_aspect_x,pixel_aspect_y): bpy.context.scene.render.engine = render_engine bpy.context.scene.render.resolution_x = resolution_x bpy.context.scene.render.resolution_y = resolution_y bpy.context.scene....
StarcoderdataPython
1734060
#%% from functools import partial import jax import jax.numpy as np from jax import random, vmap, jit, grad from jax.experimental import stax, optimizers from jax.experimental.stax import Dense, Relu import matplotlib.pyplot as plt from tqdm.notebook import tqdm #%% # Use stax to set up network initialization and ...
StarcoderdataPython
54611
SEED = 1 TOPIC_POKEMONS = 'pokemons' TOPIC_USERS = 'users' GROUP_DASHBOARD = 'dashboard' GROUP_LOGIN_CHECKER = 'checker' DATA = 'data/pokemon.csv' COORDINATES = { 'GAUSS_LAT_MADRID': {'mu': 40.45, 'sigma': 0.2}, 'GAUSS_LON_MADRID': {'mu': -3.60, 'sigma': 0.4}, 'GAUSS_LAT_SEGOVIA': {'mu': 40.95, 'sigma': ...
StarcoderdataPython
1654332
<gh_stars>0 # -*- coding: utf-8 -*- from enum import Enum class Style(Enum): """ This class represent the text style in ShellColor. """ NONE = 0 BOLD = 1 LIGHT = 2 UNDERLINE = 4 BLINK = 5 INVERSE = 7 HIDDEN = 8
StarcoderdataPython
1796775
#!/usr/bin/env python3.6 # -*- coding: utf-8 -*- import geoip2.database reader = geoip2.database.Reader('./data/GeoLite2-Country_20190806/GeoLite2-Country.mmdb') def getCountryCode(ip: str): try: return reader.country(ip).country.iso_code except: return None
StarcoderdataPython
3359797
<gh_stars>1-10 # coding=utf-8 # Copyright 2022 The Fiddle-Config 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 require...
StarcoderdataPython
101055
<gh_stars>0 # Django imports from rest_framework.serializers import ModelSerializer, ReadOnlyField # Project imports from address.serializers import AddressSerializer from client.serializers import ClientSerializer from user_address.models import UserAddress from .models import User class UserSerializer(ModelSeriali...
StarcoderdataPython
3267213
<gh_stars>1-10 # -*- coding: utf8 -*- "Namespace-related models" from uuid import uuid4 from django.db import models class Namespace(models.Model): "Namespace model" uuid = models.UUIDField(primary_key=True, default=uuid4, editable=False) name = models.CharField(max_length=255) @property def gro...
StarcoderdataPython
1755976
import datetime from gw_utility.book import Book from gw_utility.logging import Logging def main(): Logging.line_separator("BOTH INCLUDE PUBLICATION DATES", 50, '+') # Create two Books with identical arguments. the_stand = Book("The Stand", "<NAME>", 1153, datetime.date(1978, 1, 1)) the_stand_2 = Boo...
StarcoderdataPython
4823678
from .venmo import Venmo def setup(bot): bot.add_cog(Venmo(bot))
StarcoderdataPython
1671337
__author__ = '<NAME>' import numpy as np from scipy.stats import spearmanr class QuestionBase: def __init__(self, filename): self.word1 = [] self.word2 = [] self.sims = [] iFile = open(filename) for line in iFile: self.word1.append(line.split(',')[0]) ...
StarcoderdataPython
5636
<filename>zerver/management/commands/list_realms.py<gh_stars>0 import sys from typing import Any from argparse import ArgumentParser from zerver.models import Realm from zerver.lib.management import ZulipBaseCommand class Command(ZulipBaseCommand): help = """List realms in the server and it's configuration sett...
StarcoderdataPython
3214258
<reponame>clean-code-craft-tcq-1/stream-bms-data-ParthasaradhiWinfo<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Thu Jun 24 02:25:37 2021 @author: VNO1COB """ import json def read_sender_inputs(): try: input_value = input() input_dict = json.loads(input_value) print(input_...
StarcoderdataPython
4831389
<filename>mopidy_iris/__init__.py from __future__ import unicode_literals import logging, os, json import tornado.web import tornado.websocket import handlers from mopidy import config, ext from frontend import IrisFrontend from handlers import WebsocketHandler, HttpHandler from core import IrisCore lo...
StarcoderdataPython
3357428
<reponame>WingsUpete/EEG2Age import dgl import torch import torch.nn as nn import torch.nn.functional as F class PwGaANLayer(nn.Module): def __init__(self, in_dim, out_dim, num_nodes, num_heads=1, gate=False): super(PwGaANLayer, self).__init__() self.in_dim = in_dim self.out_dim = out_dim ...
StarcoderdataPython