id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
4929903
<filename>1_screen_pipeline/10_generate_ontology.py #!/usr/bin/env python # SPDX-License-Identifier: MIT # Copyright (c) 2016-2020 <NAME>, <NAME>, <NAME>, <NAME> from __future__ import print_function import gzip import os import sys import json import psycopg2 import argparse import StringIO import math from importl...
StarcoderdataPython
5145421
from .basic import Partial_Order_Models from .loss import Ranking from minder_utils.models.utils import Feature_extractor from minder_utils.dataloader import Partial_Order_Loader class Partial_Order(Feature_extractor): def __init__(self): super(Partial_Order, self).__init__() self.model = Partial_...
StarcoderdataPython
3347636
import re import types import os from time import time from collections import defaultdict from itertools import izip from nearpy.storage.storage import Storage from os.path import join as pjoin from nearpy.utils.utils import load_dict_from_json, save_dict_to_json class FileStorage(Storage): """ Storage using f...
StarcoderdataPython
26794
# (C) British Crown Copyright 2011 - 2018, Met Office # # This file is part of cartopy. # # cartopy is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option)...
StarcoderdataPython
4956910
<gh_stars>0 from django.shortcuts import render, redirect,get_object_or_404 from .models import Cliente from .forms import ClienteForm from django.contrib import messages from django.db.models import Q from django.core.paginator import Paginator # Create your views here. def lista_de_clientes(request): clientes ...
StarcoderdataPython
11233767
from resonator_tools import circuit from pathlib import Path from pandas import read_csv from numpy import float64 from pyqum.instrument.analyzer import curve import inspect pyfilename = inspect.getfile(inspect.currentframe()) # current pyscript filename (usually with path) MAIN_PATH = Path(pyfilename).parents[5] / ...
StarcoderdataPython
5197713
<gh_stars>1-10 import jupyter print(jupyter) print('Successful.')
StarcoderdataPython
27399
<gh_stars>1-10 import MagicPanels MagicPanels.panelMove("Xp")
StarcoderdataPython
56490
<gh_stars>0 # # @lc app=leetcode id=332 lang=python3 # # [332] Reconstruct Itinerary # # @lc code=start import collections class Solution: def findItinerary(self, tickets): graph = collections.defaultdict(list) city_counter = len(tickets) + 1 for pair in tickets: graph[pair[0]]...
StarcoderdataPython
6412804
import os def find_keytxts(): file_path = 'key_emotion' try: os.mkdir(file_path) print(file_path+'文件夹已经建立,请查看当前文件路径') except Exception as e: print('文件夹已经存在,请查看当前程序路径') # 基于字典的查找 key_words_list = [{'环境','周边','风景','空气','江景','小区','景点','夜景','街','周围','景区','声音','景色'}, ...
StarcoderdataPython
4894698
# -*- coding: utf-8 -*- from hcloud.core.client import ClientEntityBase, BoundModelBase, GetEntityByNameMixin from hcloud.core.domain import add_meta_to_result from hcloud.actions.client import BoundAction from hcloud.networks.domain import Network, NetworkRoute, NetworkSubnet class BoundNetwork(BoundModelBase): ...
StarcoderdataPython
11284918
<reponame>nasa/scrub<filename>scrub/scrub_cli.py import sys from scrub import scrubme from scrub.utils import diff_results from scrub.utils import scrub_utilities help_message = ('run\n' + scrubme.main.__doc__ + '\n\n' 'diff\n' + diff_results.diff.__doc__ + '\n\n' ...
StarcoderdataPython
1869145
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Dec 15 09:57:21 2017 @author: dalonlobo """ from __future__ import absolute_import, division, print_function import os import os.path as ospath import sys import subprocess import argparse import pandas as pd import scipy.io.wavfile as wav from timeit...
StarcoderdataPython
3437904
<filename>src/frr/tests/topotests/bgp_aggregator_zero/test_bgp_aggregator_zero.py #!/usr/bin/env python # # Copyright (c) 2021 by # <NAME> <<EMAIL>> # # Permission to use, copy, modify, and/or distribute this software # for any purpose with or without fee is hereby granted, provided # that the above copyright notice a...
StarcoderdataPython
12820269
<gh_stars>0 import os from configparser import ConfigParser from .database import Database from create_databases import GuildSettings class GuildSettingsModel(Database): def __init__(self): super().__init__() async def add(self, guild_id: int, server_name: str, region: str, owner_id: int): ne...
StarcoderdataPython
289547
<gh_stars>0 # Made by <NAME> # June 2016 # Python 3_5 import os import sys import csv import argparse as arg from lxml import etree from io import StringIO from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.common.exceptions ...
StarcoderdataPython
309127
<reponame>weiweitoo/easy21-rl # Easy21 Environment import numpy as np class Easy21(): ''' Environment Easy21 ''' def __init__ (self): self.dealer_threshold = 17; self.min_card_value, self.max_card_value = 1, 10; self.game_lower_bound, self.game_upper_bound = 1, 21; def drawCard (s...
StarcoderdataPython
389005
# -*- coding: utf-8 -*- """ dicom2nifti @author: abrys """ import os import shutil import tempfile import unittest import nibabel import numpy import tests.test_data as test_data import dicom2nifti.convert_ge as convert_ge from dicom2nifti.common import read_dicom_directory from tests.test_tools import assert_comp...
StarcoderdataPython
9682406
<gh_stars>0 from losoto.h5parm import h5parm import numpy as np if __name__ == '__main__': filename = 'debug_losoto.h5' solset = 'testSolset' H = h5parm(filename, readonly=False) pols = ['xx','yy'] dirs = ['a','b'] ants = ['c','d'] times = np.array([0.,1.]) vals = np.ones((2,2,2,2)) ...
StarcoderdataPython
19345
<gh_stars>0 # -*- coding: utf-8 -*- """ Demo for 2D Optimal transport between empirical distributions @author: rflamary """ import numpy as np import matplotlib.pylab as pl import ot #%% parameters and data generation n=20 # nb samples mu_s=np.array([0,0]) cov_s=np.array([[1,0],[0,1]]) mu_t=np.array([4,4]) cov_t=...
StarcoderdataPython
46404
<reponame>vishalnalwa/DAT210x-master---Old # -*- coding: utf-8 -*- """ Created on Mon Jun 19 17:14:36 2017 @author: m037382 """ import pandas as pd df = pd.read_html('http://www.espn.com/nhl/statistics/player/_/stat/points/sort/points/year/2015/seasontype/2') df1 = pd.concat(df) df1.columns = ['RK', 'PLAYER', 'TEAM'...
StarcoderdataPython
8125511
<filename>userbot/plugins/clock.py # (c) @UniBorg # Original written by @UniBorg edit by @INF1N17Y from telethon import events import asyncio from collections import deque from userbot.utils import admin_cmd @borg.on(admin_cmd(pattern=r"clock")) async def _(event): if event.fwd_from: return deq = deque(list("🕛�...
StarcoderdataPython
8054206
<gh_stars>0 def other_angle(a, b): return abs(a + b - 180)
StarcoderdataPython
3275875
<reponame>utkarshdeorah/sympy<gh_stars>1-10 from sympy.core.numbers import E from sympy.core.symbol import symbols from sympy.functions.elementary.exponential import log from sympy.functions.elementary.miscellaneous import sqrt from sympy.geometry.curve import Curve from sympy.integrals.integrals import line_integrate ...
StarcoderdataPython
4880143
""" Build file for cython extensions """ from distutils.core import Extension import numpy from Cython.Build import cythonize _EXTENSIONS = [ Extension("deepgrp.mss", sources=["deepgrp/_mss/pymss.pyx", "./deepgrp/_mss/mss.c"], include_dirs=[numpy.get_include()] + ["./deepgrp"]), Ext...
StarcoderdataPython
12859433
# generate data from bag images from PIL import Image from pathlib import Path import os, glob # manipulate file or directory import numpy as np class DataArrangement(object): def __init__(self): self.path = Path(__file__).parent self.current_directories = ['not_traking', 'traking'] self...
StarcoderdataPython
12853229
''' Test deleting SG with 2 attached NICs. @author: Youyk ''' import zstackwoodpecker.test_util as test_util import zstackwoodpecker.test_lib as test_lib import zstackwoodpecker.test_state as test_state import zstackwoodpecker.zstack_test.zstack_test_security_group as test_sg_header import zstackwoodpecker....
StarcoderdataPython
1902591
<filename>backend/apps/system/models.py from datetime import datetime from sqlalchemy import ( Table, Column, Integer, String, DateTime, ForeignKey, JSON ) from utils.database import metadata settings = Table( "system_settings", metadata, Column("id", Integer, primary_key=True), Column("label",...
StarcoderdataPython
6578828
<reponame>farhadinima75/FireHR<gh_stars>10-100 # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/02_models.ipynb (unless otherwise specified). __all__ = ['expand_filter', 'ChLin', 'FireHR', 'download_model_weights', 'load_pretrained_model'] # Cell import os, sys import requests from fastai.vision.all import * import Fi...
StarcoderdataPython
4854721
from __future__ import absolute_import from __future__ import print_function import veriloggen import dataflow_lut expected_verilog = """ module test ( ); reg CLK; reg RST; reg [32-1:0] xdata; reg xvalid; wire xready; reg [32-1:0] ydata; reg yvalid; wire yready; wire [32-1:0] zdata; wire zvalid;...
StarcoderdataPython
5041883
<reponame>rafaeldias98/python-customer-api<filename>api/migrations/0001_initial.py # Generated by Django 2.2.5 on 2019-10-06 20:45 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ ...
StarcoderdataPython
12824480
<reponame>cued-ia-computing/flood-jw2190-lk476 """tests geo.rivers_with_station function and station_by_river function""" from floodsystem.geo import rivers_with_station from floodsystem.geo import station_by_river from floodsystem.stationdata import build_station_list def run(): """Requirements for Task 1D""" ...
StarcoderdataPython
9624826
from inflection import camelize from twiml_generator.specificity.common import Language, rename_attr, to_bytes class Python(Language): _classes = {} @classmethod def clean(cls, generator) -> None: """Python library specificities which requires to change the TwiML IR. """ for verb...
StarcoderdataPython
5045871
# Copyright 2021 The sunds 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 or agreed to in wr...
StarcoderdataPython
12813350
''' Descripttion: Automatically generated file comment version: Author: Wesley Date: 2021-07-27 09:53:43 LastEditors: Wesley LastEditTime: 2021-08-13 15:34:36 ''' from ctypes import cdll, CFUNCTYPE, c_char_p, c_void_p, c_bool, POINTER, c_uint64, c_uint32 from wtpy.WtCoreDefs import BarList, TickList, WTSBarStruct, WTS...
StarcoderdataPython
11353690
import io import time import threading import queue import picamera class ImageProcessor(threading.Thread): def __init__(self, owner): super(ImageProcessor, self).__init__() self.terminated = False self.owner = owner self.start() def run(self): # This method runs in a s...
StarcoderdataPython
1898881
""" # Phase Noise JSON format :frequency (float): VCO/PLL frequency in Hz :offset (list of floats): phase noise offset frequency points :phase_noise (list of floats): phase noise points :tune_ppm_per_volt (float): tuning sensitivity in ppm per volt (optional) :tune_Hz_per_volt (float): tuning sensi...
StarcoderdataPython
6507498
<filename>LearnGUI.py<gh_stars>1-10 from tkinter import * from tkinter import messagebox, filedialog from Modules import PublicModules as libs from Modules import LSTM_Config as cf import cv2 import threading from PIL import Image from PIL import ImageTk from Modules.MyThreading import MyThreadingVideo WINDOWS_WIDTH ...
StarcoderdataPython
8142376
<filename>zooniverse/settings/test.py """ Distributed under the MIT License. See LICENSE.txt for more info. """ from .development import * DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', }, } TEST_OUTPUT_DIR = os.path.join(BASE_DIR, '..', 'test_output')
StarcoderdataPython
3271468
<filename>leetcode/1228_missing_number_in_arithmetic_progression.py<gh_stars>1-10 # -*- coding: utf-8 -*- class Solution: def missingNumber(self, arr): return ((arr[-1] + arr[0]) * (len(arr) + 1)) // 2 - sum(arr) if __name__ == '__main__': solution = Solution() assert 9 == solution.missingNumbe...
StarcoderdataPython
6418562
# Copyright 2020-2021 OpenDR European Project # # 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 agree...
StarcoderdataPython
12821861
from collections import Counter n = int(input()) a = list(map(int, input().split())) Q = int(input()) queries = [list(map(int, input().split())) for _ in range(Q)] ans = sum(a) A = Counter(a) for q in queries: ans += (q[1] - q[0]) * A[q[0]] A[q[1]] += A[q[0]] A[q[0]] = 0 print(ans)
StarcoderdataPython
11315778
<gh_stars>1-10 # throw.py # The CIL throw instruction # Copyright 2010 <NAME> - see LICENSE for details from Instruction import Instruction import unittest from Instructions.Instruction import register class throw(Instruction): def __init__(self, arguments): self.name = 'throw' self.target = '' ...
StarcoderdataPython
8090267
<gh_stars>1-10 #!/usr/bin/python from datetime import * import csv import sys import time log_file = open(sys.argv[1], 'rb') log_iter = csv.reader(log_file, delimiter=':') now = datetime.now() now = datetime.strptime(''.join([str(now.year), ' ', str(now.month), ' ', ...
StarcoderdataPython
4903423
<filename>xskillscore/tests/test_accessor_deterministic.py import pytest import xarray as xr from xarray.tests import assert_allclose from xskillscore.core.deterministic import ( effective_sample_size, mae, mape, me, median_absolute_error, mse, pearson_r, pearson_r_eff_p_val...
StarcoderdataPython
3314037
""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param: A: an integer array @return: A tree node """ def sortedArrayToBST(self, A): return self.buildTree(A,0,len(A)-1) ...
StarcoderdataPython
11376645
import os checkpoints_path = '/homedtic/lperez/parsing-as-pretraining/runs_constituency_parsing/run1/output' model_partial_name = 'pytorch_model' for (root, dirs, files) in os.walk(checkpoints_path): for file in files: if file.startswith(model_partial_name): model_path = root + '/' + file ...
StarcoderdataPython
8099817
import sys import time from dpa.app.server import AppServer from dpa.cli.action import CommandLineAction # ------------------------------------------------------------------------------ class ClApp(CommandLineAction): name = "clapp" # ------------------------------------------------------------------------...
StarcoderdataPython
6503206
from __future__ import absolute_import import io import os import sys import uuid import warnings import nbformat from dagster_graphql.implementation.context import ( DagsterGraphQLContext, DagsterSnapshotGraphQLContext, ) from dagster_graphql.implementation.pipeline_execution_manager import ( QueueingSub...
StarcoderdataPython
1883104
<filename>ipfs_lod.py # -*- coding: utf-8 -*- """Publishes LOD datasets over IPFS based on their W3C VoID descriptions. Assumptions (maybe not completely reasonable) ============================================= - Datasets are described in VoID documents. - Versioning can be discovered by looking at the dcterms:modifi...
StarcoderdataPython
4874652
<reponame>master-fufu/OpenATC<gh_stars>1-10 import timeit import requests import re from multiprocessing.dummy import Pool as ThreadPool from bs4 import BeautifulSoup as bs from getconf import * # TO DO: early link capability # Constants base_url = 'http://www.supremenewyork.com' # Inputs keywords_category = ['acces...
StarcoderdataPython
5067769
<reponame>compstorylab/covid19ngrams<gh_stars>0 import matplotlib.font_manager as fm fm._rebuild() noto = [f.name for f in fm.fontManager.ttflist if 'Noto Sans' in f.name] fonts = { 'Default': fm.FontProperties(family=["sans-serif"]), 'Korean': fm.FontProperties(family=["Noto Sans CJK KR", "Noto Sans CJK", "s...
StarcoderdataPython
1654666
<reponame>saripirala/file_compare<filename>setup.py<gh_stars>10-100 #!/usr/bin/env python3 import setuptools setuptools.setup()
StarcoderdataPython
8179652
""" Copyright (C) 2020-2021 <NAME> <...> """ import warnings from contextlib import contextmanager from typing import Any, Generator, List, Optional, Type, Union def _warns_repr(warns: List[warnings.WarningMessage]) -> List[Union[Warning, str]]: return [w.message for w in warns] @contextmanager def no_warning_c...
StarcoderdataPython
5198903
<filename>app.py #----------------------------------------------------------------------------# # Imports #----------------------------------------------------------------------------# from flask import Flask, render_template, request, flash, redirect, url_for # from flask.ext.sqlalchemy import SQLAlchemy import loggi...
StarcoderdataPython
1684811
<reponame>lindenmp/neurodev_long #!/usr/bin/env python # coding: utf-8 # # Preamble # In[1]: # Essentials import os, sys, glob import pandas as pd import numpy as np import nibabel as nib # Stats import scipy as sp from scipy import stats import statsmodels.api as sm import pingouin as pg # Plotting import seabor...
StarcoderdataPython
5178344
<reponame>Shadowalker1995/Tutorial-Resource import torch from torch import nn class AE(nn.Module): def __init__(self): super(AE, self).__init__() # [b, 784] => [b, 20] self.encoder = nn.Sequential( nn.Linear(784, 256), nn.ReLU(), nn.Linear(25...
StarcoderdataPython
1780843
""" Metadata """ from typing import Union, Dict Metadata = Union[str, Dict]
StarcoderdataPython
11269365
from flask_restx import Api from flask import Blueprint from .user.controller import api as user_ns # Import controller APIs as namespaces. api_bp = Blueprint("api", __name__) api = Api(api_bp, title="API", description="Main routes.") # API namespaces api.add_namespace(user_ns)
StarcoderdataPython
240597
<filename>auth/tests/test_generate_token.py from sage_utils.amqp.clients import RpcAmqpClient from sage_utils.constants import NOT_FOUND_ERROR, VALIDATION_ERROR from sage_utils.wrappers import Response from app.token.api.workers.generate_token import GenerateTokenWorker from app.users.documents import User REQUEST_Q...
StarcoderdataPython
8136004
<reponame>chrisfilo/NiMARE<filename>nimare/meta/ibma/base.py """ Image-based meta-analysis estimators """ from __future__ import division import numpy as np from sklearn.preprocessing import normalize from scipy import stats from ..base import MetaEstimator class IBMAEstimator(MetaEstimator): """Base class for ...
StarcoderdataPython
4956394
<gh_stars>0 # Copyright (c) 2018-2019, NVIDIA CORPORATION. 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 r...
StarcoderdataPython
11200293
from django.http import HttpResponse from django.shortcuts import render_to_response from monitor.util import preload from django.core.cache import cache from monitor.util import getResource as rs from dwebsocket.decorators import accept_websocket import os, time preload.loading() @accept_websocket def echo_log(requ...
StarcoderdataPython
1926031
<gh_stars>10-100 # Copyright (c) 2021, Xilinx, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # ...
StarcoderdataPython
6988
# -*- coding: utf-8 -*- def ordered_set(iter): """Creates an ordered set @param iter: list or tuple @return: list with unique values """ final = [] for i in iter: if i not in final: final.append(i) return final def class_slots(ob): """Get object attributes from...
StarcoderdataPython
3556674
<reponame>Gdls/CapsDecE2S import tensorflow as tf from tensorflow.python.ops import rnn #import my_rnn import pdb eps = 1e-6 def batch_norm(x, is_training=False): return tf.layers.batch_normalization(x, momentum=0.8, training=is_training) def sense_Global_Local_att(sense = None, context_repres = None, context_mas...
StarcoderdataPython
9713364
<gh_stars>0 import math import time import torch from codebase.engine.train_supernet import SpeedTester from codebase.engine.train_supernet_with_teacher import validate, set_running_statistics from codebase.third_party.spos_ofa.ofa.nas.efficiency_predictor import \ PreResNetFLOPsModel, Mbv3FLOPsModel from codebas...
StarcoderdataPython
9648278
<reponame>zarif007/Exp-Dashboard from django.urls import path from django.views.decorators.csrf import csrf_exempt from .views import RegistrationView, UsernameValidation, EmailValidation, \ PasswordValidation, VerificationView, LoginView, LogoutView urlpatterns = [ path('register', RegistrationView.as_view()...
StarcoderdataPython
11274880
<reponame>Kreidl/pymailtojira<gh_stars>0 import jira from jira import JIRA #Authentication Method def authenticate(username, password): basic_auth=(username, password) return basic_auth #Create a JIRA Object which can be used later on def createJIRAObject(jiraURL, username, password): jira = JIRA(server=j...
StarcoderdataPython
8189261
<reponame>Erernaen/ecchat<filename>urwidext.py<gh_stars>0 #!/usr/bin/env python3 # coding: UTF-8 import urwid ################################################################################ ## urwid extension classes ##################################################### #######################################...
StarcoderdataPython
8019149
<filename>fhir/resources/DSTU2/namingsystem.py #!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/NamingSystem) on 2019-05-14. # 2019, SMART Health IT. from . import (backboneelement, codeableconcept, contactpoint, domainresource, ...
StarcoderdataPython
328675
#!/usr/bin/env python """ Takes a cifti map ('dscalar.nii') and outputs a csv of results Usage: ciftify_statclust_report [options] <func.dscalar.nii> Arguments: <func.dscalar.nii> Input map. Options: --min-threshold MIN the largest value [default: -2.85] to consider for being a minimum --max-th...
StarcoderdataPython
5184344
""" Question Source: https://leetcode.com/problems/maximum-depth-of-binary-tree/ Level: Easy Topic: Tree Solver: Tayyrov Date: 14.02.2022 """ from typing import Optional class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.rig...
StarcoderdataPython
5138955
<filename>SimTracker/SiStripDigitizer/python/SiStripDigi_APVModePeak_cff.py raise RuntimeError("Do not import obsolete file SiStripDigi_APVModePeak_cff.py. Use 'SimGeneral.MixingModule.stripDigitizer_APVModePeak_cff.py_cff'")
StarcoderdataPython
4890208
#!/usr/bin/python3 import re import csv def perf_callback_factory(event_name, data_keys, remap=None): """ Return a specialized callback for perf event in bcc. TODO: add time offset to d['ts'] """ def decorator(func): # handle remapped guid key (inverse lookup) if remap is not None:...
StarcoderdataPython
3531914
#!/usr/bin/env python # -*- coding: utf-8 -*- # -*- Python -*- import sys import argparse import subprocess import logging import distutils.spawn class RtmdockerCleaner: ''' Utility class to operate OpenRTM on Docker This is utility class to operate OpenRTM on Docker. ''' def __init__(self): ...
StarcoderdataPython
6577741
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Mar 27 07:36:29 2020 @author: szekely """ from codes.helpers import load_wav, list_filenames import librosa import numpy as np import soundfile #%% in_folder = './mtm/mtm_split/' out_folder = './mtm/mtm/' files = list(list_filenames(in_...
StarcoderdataPython
8114114
from tkinter import Label , Button , Frame , StringVar , Radiobutton from tkinter.constants import TOP , RIGHT , YES from typing import Any import webbrowser as wb from random import randint as rd from typing import TypedDict class State(TypedDict): text: str error : str class Home(): ''' initi...
StarcoderdataPython
1632310
'''This module is used to define collector to collect data that need to be analyzed.''' class Collector(object): def __init__(self, conf): self._conf = conf def __del__(self): return def __enter__(self): return self def __exit__(self, *exe_info): return def open(self)...
StarcoderdataPython
200696
<filename>src/models/Function.py from enum import Enum from type_replacement import normalize_type from typing import List import numpy as np import re from models.CallingConvention import CallingConvention import ArgsExtract name_re = re.compile(r'(?:::|__)(~?\w+)') def extract_name_from_demangled(demangled_name : ...
StarcoderdataPython
6535255
from sys import stdin def isHan(n): bHan = False numList = list() while n: numList.insert(0, n % 10) n //= 10 if len(numList) == 1 or len(numList) == 2: bHan = True elif len(numList) == 3 and numList[2] - numList[1] == numList[1] - numList[0]: bHan = True return bHan def main(): cou...
StarcoderdataPython
9777731
from abc import abstractmethod from collections import namedtuple ThermalConfig = namedtuple('ThermalConfig', ['cpu', 'gpu', 'mem', 'bat', 'ambient']) class HardwareBase: @staticmethod def get_cmdline(): with open('/proc/cmdline') as f: cmdline = f.read() return {kv[0]: kv[1] for kv in [s.split('=')...
StarcoderdataPython
3564424
<filename>microbuild/__init__.py """ Lightweight Python Build Tool """ __author__ = "<NAME>" __license__ = "MIT License" __contact__ = "https://github.com/CalumJEadie/microbuild"
StarcoderdataPython
1667647
bl_info = { "name": "Pivot Menu: Key: '.'", "description": "Pivot Modes", "blender": (2, 78, 0), "category": "3d View" } import bpy from bpy.types import (Menu, Operator) class VIEW3D_PIE_pivot_of(Menu): bl_label = "Pivot" bl_idname = "view3d.pivot_of" def draw(self, context): lay...
StarcoderdataPython
8174035
<filename>numpy/distutils/intelccompiler.py<gh_stars>1-10 from __future__ import division, absolute_import, print_function import sys from distutils.unixccompiler import UnixCCompiler from numpy.distutils.exec_command import find_executable from numpy.distutils.ccompiler import simple_version_match class IntelCComp...
StarcoderdataPython
26093
<reponame>dan7267/1a-flood-risk-project-93 from floodsystem.stationdata import MonitoringStation from floodsystem.geo import rivers_by_station_number def run(): """Requirements for Task1E""" rivers_station_number = rivers_by_station_number(MonitoringStation, 9) print(rivers_station_number) if __name__ ==...
StarcoderdataPython
363540
import os class Object(): def __init__(self, objLines) -> None: labelLine = objLines[3] #always 'PASperson', saving it anyways self.label = labelLine.split(':')[0].split('"')[1] #always 'UprightPerson', saving it anyways self.labelPose = labelLine.split(':')[1].split('"')[1]...
StarcoderdataPython
220134
from .Attention import Attention from .PositionalEncoding import PositionalEncoding from .ScaledDotProductAttention import ScaledDotProductAttention from .LayerNormalization import LayerNormalization from .MultiHeadAttention import MultiHeadAttention
StarcoderdataPython
9673554
# -*- coding: utf-8 -*- from django.conf import settings from cms.tests.base import CMSTestCase from cms.utils.plugins import get_placeholders from cms.exceptions import DuplicatePlaceholderWarning import sys import warnings class _Warning(object): def __init__(self, message, category, filename, lineno): s...
StarcoderdataPython
1972566
# Autogenerated by configen, do not edit. # If encountering an error, please file an issue @ # https://github.com/romesco/hydra-lightning # fmt: off # isort: skip_file # flake8: noqa # Hydra + Lightning from dataclasses import dataclass, field from omegaconf import MISSING from typing import Any from typing import Dic...
StarcoderdataPython
1979736
<reponame>tklijnsma/toscript #!/usr/bin/env python import sys from get_toscript import ToGoer class Completer(object): """docstring for Completer""" def __init__(self): super(Completer, self).__init__() self.goer = ToGoer() def completion_hook(self, cmd, curr_word, prev_word): if ...
StarcoderdataPython
11200902
import argparse def get_params(): parser = argparse.ArgumentParser( description="Variable parameters based on the configuration of the machine or user's choice") parser.add_argument("--mem_size", default=100000, type=int, help="The memory size.") parser.add_argument("--env_name", default="Mountai...
StarcoderdataPython
8071455
from products.test.infrastructure import FakeUnitOfWorkManager from products.handlers import CreateProductCommand, CreateProductCommandHandler class When_creating_a_product: """ Now that we have a repository pattern and command handlers it becomes trivial to write unit tests that check that we perf...
StarcoderdataPython
5181802
<filename>appengine/findit/common/rotations.py # Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Utilities to get the sheriff(s) on duty. Currently only supports the Chrome Build Sheriff rotation.""" imp...
StarcoderdataPython
1843097
<gh_stars>0 # Copyright 2020 The SQLFlow 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 required by appl...
StarcoderdataPython
3551938
<reponame>anwarchk/quay<gh_stars>1-10 import json import pytest from jsonschema import validate from buildtrigger.customhandler import custom_trigger_payload from buildtrigger.basehandler import METADATA_SCHEMA from buildtrigger.bitbuckethandler import get_transformed_webhook_payload as bb_webhook from buildtrigger....
StarcoderdataPython
8075403
"""The london_underground component."""
StarcoderdataPython
45867
<gh_stars>0 #!/usr/bin/env python3 # imports go here import pika import multiprocessing import time import random import json import logging import datetime # # Free Coding session for 2015-03-12 # Written by <NAME> # logger = logging.getLogger(__name__) def get_temperatures(): return {'celcius': [random.rand...
StarcoderdataPython
6422769
from setuptools import setup, find_packages NAME = 'jewelry' URL = 'https://github.com/mgsosna/jewelry' REQUIRES_PYTHON = '>=3.7.0' REQUIREMENTS_FN = 'requirements.txt' def list_requirements(file_name=REQUIREMENTS_FN): with open(file_name) as f: return f.read().splitlines() setup( name=NAME, ve...
StarcoderdataPython
11352707
import unittest import numpy as np from src.viewpointdiversitydetection.model_evaluation_utilities import generate_markdown_table class ModelEvaluationUtilitiesTest(unittest.TestCase): def test_generate_markdown_table(self): parameters = {'C': 5, 'gamma': .0001, 'class w': 'balanced', ...
StarcoderdataPython