id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
4833018
# Copyright 2013 Novo Nordisk Foundation Center for Biosustainability, # Technical University of Denmark. # # 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/LI...
StarcoderdataPython
3206500
try: from os import makedirs from shutil import copyfile from os.path import join, exists except ImportError as err: exit(err) if __name__ == "__main__": # The path to the directory where the original # dataset was uncompressed original_dataset_dir = "C:/Users/e_sgouge/Documents/Etienne/Pyt...
StarcoderdataPython
166937
<filename>tests/b901.py """ Should emit: B901 - on lines 9, 36 """ def broken(): if True: return [1, 2, 3] yield 3 yield 2 yield 1 def not_broken(): if True: return yield 3 yield 2 yield 1 def not_broken2(): return not_broken() def not_broken3(): return ...
StarcoderdataPython
1641456
from django.test import TestCase, SimpleTestCase from django.test.client import Client from django.urls import reverse, resolve from .views import * from .models.productModel import Product, ProductReviewModel # uso SimpleTestCase per verificare l'uguaglianza di due url class TestUrls(SimpleTestCase): def test_i...
StarcoderdataPython
3268157
<filename>djangostripe/customer_service/apps.py from django.apps import AppConfig class CustomerServiceConfig(AppConfig): name = 'customer_service'
StarcoderdataPython
3201161
""" Module that contains the code to replace the long forms by short forms in the corpus. """ import os from typing import List, Tuple import random import string from collections import OrderedDict import pandas as pd from engine.utils.preprocessing import Preprocessor from engine.utils.preprocess_utils import delete...
StarcoderdataPython
3238950
#!/usr/local/bin/python3 # -*- coding: utf-8 -*- import sys from PyQt5.QtWidgets import QWidget, QApplication from PyQt5.QtGui import QPainter, QPainterPath class Example(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): # position self.setGeo...
StarcoderdataPython
1727450
import os import sys import urllib import urllib2 from bs4 import BeautifulSoup, Tag, NavigableString, Comment import collections import math import csv import codecs import json import inspect import urlparse import argparse import traceback import time import datetime import openpyxl import Main_E...
StarcoderdataPython
133749
import glob import multiprocessing as mp import os import time from argparse import ArgumentParser from pathlib import Path import tensorflow as tf import numpy as np from tqdm import tqdm from data.preprocess import generate_flying_things_point_cloud, get_all_flying_things_frames from data.preprocess import preproces...
StarcoderdataPython
1608935
<reponame>xuyongzhi/Scan-to-BIM<filename>configs/strpoints/bev_strpoints_r50_fpn_1x_r.py<gh_stars>1-10 ''' # pedding num_outs assigner img_norm_cfg transform_method ''' TOPVIEW = 'VerD' # better #******************************************************************************* from configs.common import DIM_PARS...
StarcoderdataPython
1772395
<reponame>RainMark/python-progress-bar<filename>setup.py # -*- coding:utf-8 -*- from __future__ import print_function from setuptools import setup, find_packages from glob import glob import pyprobar with open(glob('requirements.*')[0], encoding='utf-8') as f: all_reqs = f.read().split('\n') install_requires = [x...
StarcoderdataPython
1636628
#!/usr/bin/env python ''' Original Training code made by <NAME> <<EMAIL>> Moded by <NAME> <<EMAIL>> Visit our website at www.theconstructsim.com ''' import gym import time import numpy import random import maddpg_training.common.tf_util as U from maddpg_training.trainer.maddpg import MADDPGAgentTrainer i...
StarcoderdataPython
1603762
<reponame>holub008/skiscraper<gh_stars>0 import requests from HTMLParser import HTMLParser import mysql.connector import urllib2 from configs import Configs from RaceResults import RaceResult, StructuredRaceResults, RaceInfo, UnstructuredPDFRaceResults config = Configs() DB_USER = config.get_as_string("DB_USER") DB_P...
StarcoderdataPython
23529
<filename>app/request.py from app import app import urllib.request,json from .models import source from .models import article Source = source.Source Article = article.Article # Getting api key api_key = app.config['NEWS_API_KEY'] # Getting the source base url base_url = app.config["SOURCE_API_BASE_URL"] article_ur...
StarcoderdataPython
117410
<reponame>yanshengjia/algorithm<gh_stars>10-100 """ TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns a short URL such as http://tinyurl.com/4e9iAk. Design the encode and decode methods for the TinyURL service. There is no restriction on how y...
StarcoderdataPython
1673604
from queue import Queue class FizzBuzz: def __init__(self, n: int): self.n = n self.fizz_continue = Queue(1) self.buzz_continue = Queue(1) self.fizzbuzz_continue = Queue(1) self.number_continue = Queue(1) self.number_continue.put(True) @classmethod def ...
StarcoderdataPython
158496
# -*- coding: utf-8 -*- ################################################################################### # Copyright (C) 2019 SuXueFeng # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software ...
StarcoderdataPython
1790380
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import json from requests import Response from typing import Any, Optional, Mapping Headers = Optional[Mapping[str, str]] class RequestError(Exception): """ Error que se genera cuando hay un fallo accediendo al servidor""" def __init__(self, url: str, headers...
StarcoderdataPython
3354060
"""Functions to check the status of an existing game on BGA.""" import datetime import logging from logging.handlers import RotatingFileHandler from bga_account import BGAAccount from bga_game_list import get_game_list from bga_game_list import update_games_cache from creds_iface import get_discord_id from utils impor...
StarcoderdataPython
3259540
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Apr 26 13:35:57 2018 @author: cham """ # %% #%pylab qt5 import numpy as np from ruby import get_isochrone_grid, IsoGrid # from ruby import isoc_interp, ezinterp # from ezpadova.parsec import get_one_isochrone, get_photometry_list from astropy.table imp...
StarcoderdataPython
3332180
from enum import Enum, auto from autorepr import AutoRepr from birdway import Unary, Type, Binary class Token: def __init__(self, line=None, **attributes): self._line = line for attr in dir(self): if not attr.startswith("_"): if attr in attributes: s...
StarcoderdataPython
3394838
import keras from keras.applications.vgg16 import VGG16 from keras.applications.vgg19 import VGG19 from keras.applications.resnet50 import ResNet50 from keras.applications.densenet import DenseNet121 from keras.applications.densenet import DenseNet169 from keras.applications.densenet import DenseNet201 from keras.appli...
StarcoderdataPython
1752802
<filename>populus/utils/formatting.py from eth_utils import ( to_bytes, to_text, is_bytes, ) def is_prefixed(value, prefix): return value.startswith( to_bytes(prefix) if is_bytes(value) else to_text(text=prefix) ) def is_dunderscore_prefixed(value): return is_prefixed(value, '__') ...
StarcoderdataPython
3218729
<reponame>dpfranke/qtt<filename>qtt/tests/test_zi_hdawg8.py import unittest from unittest.mock import MagicMock, call from qtt.instrument_drivers.virtualAwg.awgs.ZurichInstrumentsHDAWG8 import ZurichInstrumentsHDAWG8 from qtt.instrument_drivers.virtualAwg.awgs.common import AwgCommonError class TestZurichInstruments...
StarcoderdataPython
1636547
<filename>py/test/pytests/countdown.py # Copyright 2012 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """A count down monitor for better user interface in run-in tests. Description ----------- Count down and display ...
StarcoderdataPython
3221542
import constant import os from time import gmtime, strftime import getpass import socket from lazagne.config.header import Header from lazagne.config.color import bcolors from lazagne.config.constant import constant import logging import json # --------------------------- Functions used to write ----------------------...
StarcoderdataPython
3216394
<gh_stars>100-1000 # encoding: utf8 from __future__ import unicode_literals from unittest import TestCase from alex.applications.PublicTransportInfoCS.hdc_slu import PTICSHDCSLU from alex.applications.PublicTransportInfoCS.preprocessing import PTICSSLUPreprocessing from alex.components.asr.utterance import Utterance, ...
StarcoderdataPython
3227407
# coding: spec from _pytest.pytester import Testdir as TD, LineMatcher from contextlib import contextmanager from textwrap import dedent import subprocess import tempfile import asyncio import socket import signal import pytest import shutil import sys import py import os this_dir = os.path.dirname(__file__) @conte...
StarcoderdataPython
106300
# -*- coding: utf-8 -*- """Test user registration endpoint.""" from flask import url_for from servicedesk.user.models import User from tests.factories import UserFactory def test_can_register(user, testapp): """Register a new user.""" old_count = len(User.query.all()) # Goes to homepage res = testapp...
StarcoderdataPython
3203095
from itertools import combinations from fcapsy.decorators import metadata from fcapsy import Concept, Context @metadata(name='RiceSiffConcepts', short_name='RSConcepts') def concept_subset(context: Context, similarity_measure) -> list: """ Experimental implementation of Rice, <NAME>., and <NAME>. "Cluste...
StarcoderdataPython
3367146
<reponame>kiv-box/redis<filename>ansible/lib/ansible/modules/core/network/junos/junos_config.py<gh_stars>0 #!/usr/bin/python # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Fou...
StarcoderdataPython
1609723
import fitbit from django.contrib.auth.models import Group from django.db import Error from django.db.models import Q from requests import get from my_life_rest_api.settings import ML_URL from .constants import * from .models import * from .serializers import * from .utils import * def add_user(data, is_admin=False)...
StarcoderdataPython
1641041
<reponame>nlantau/Codewars_2020_2021 # nlantau, 2021-11-03 filter_string=lambda a:int("".join(filter(str.isdigit, a))) print(filter_string("123"))
StarcoderdataPython
1662013
<filename>kafka_influxdb/reader/kafka_python.py<gh_stars>100-1000 # -*- coding: utf-8 -*- import logging from kafka import KafkaConsumer from kafka.common import ConsumerTimeout, KafkaUnavailableError from kafka_influxdb.encoder.errors import EncoderError from kafka_influxdb.reader.reader import ReaderAbstract class...
StarcoderdataPython
1682390
from OpenGL.GL import glBindTexture, glTexParameteri, GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, \ GL_TEXTURE_WRAP_T, GL_REPEAT, GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER, GL_LINEAR,\ glTexImage2D, GL_RGBA, GL_UNSIGNED_BYTE from PIL import Image # for use with GLFW def load_texture(path, texture): glBindTextur...
StarcoderdataPython
1615359
<filename>setup.py from setuptools import setup import setuptools setup(name="rubikenv", version="0.1", description="Gym env for rubik cube", author="<NAME>", author_email="<EMAIL>", packages=setuptools.find_packages(), package_dir={"rubikenv": "rubikenv"}, install_requires=[]...
StarcoderdataPython
115213
#!/usr/bin/python ''' https://docs.python.org/2/reference/datamodel.html ''' class Empty: pass #base class is object class BankAccount(object): #__doc__ next string becomes doc """ Bank acount class """ # static variable class_variable="bank" #__new___?? #default args def __init__(self, initia...
StarcoderdataPython
1735973
import sys import os import torch import torch.distributed as dist import torch.nn as nn from torch.utils.data import DataLoader import torch.multiprocessing as mp from torch.nn.parallel import DataParallel from datetime import datetime from pepper_variant.modules.python.models.dataloader_predict import SequenceDatase...
StarcoderdataPython
50985
#<NAME> #Linguagem: Python #Exercício 13 do site: https://wiki.python.org.br/EstruturaSequencial #Entra com a altura altura = float(input("Qual sua altura? ")) #Realiza os cálculos pesoIdealHomem = (72.7*altura)-58 pesoIdealMulher = (62.1*altura)-44.7 #Imprime o resultado print("Seu peso ideal caso você seja homem é...
StarcoderdataPython
195937
<reponame>clayne/mdec<filename>backend/ghidra/dump.py from ghidra.app.decompiler import DecompInterface import traceback out = open('out.c', 'w') for f in currentProgram.getFunctionManager().getFunctions(True): try: di = DecompInterface() di.openProgram(currentProgram) out.write(di.decompileFunction(f, 0...
StarcoderdataPython
1702299
import torch import torch.optim as optim from torch.optim.lr_scheduler import ReduceLROnPlateau, StepLR import numpy as np import pandas as pd from collections import Counter import time, os, platform, sys, re import torch.backends.cudnn as cudnn def metric(probability, truth, threshold=0.5, reduction='none'): ''...
StarcoderdataPython
1676441
import math from tqdm import tqdm class VerboseMixin(object): def _progress(self, iterator): if self.verbose: return tqdm(iterator, desc=self.__class__.__name__) else: return iterator def _log(self, message): if self.verbose: print(f"[{self.__class...
StarcoderdataPython
1783716
<reponame>Cipahi/explore_australia """ file: rotation.py (explore_australia) author: <NAME>, @jesserobertson date: Thursday, 03 January 2019 description: Rotation of geographic points """ from scipy.linalg import expm, norm import numpy as np from shapely.geometry import Polygon, MultiPolygon, Multi...
StarcoderdataPython
4830340
<filename>LinearSVCKfold.py import pandas from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics import accuracy_score from sklearn.model_selection import KFold from sklearn.svm import LinearSVC import utils targetClass = 2 data = utils.getDataset(targetClass) data = utils.MapLabels(targetCl...
StarcoderdataPython
1647380
<reponame>backwardn/practical_cryptography_engineering #!/usr/bin/env python3 # coding=utf-8 """ This is a simple example of using the cryptography module to securely encrypt and decrypt data with AES in GCM mode. GCM (Galois Counter Mode) is a mode of operation for block ciphers. An AEAD (authenticated encryption wit...
StarcoderdataPython
127445
from django import forms class ClientErrorForm(forms.Form): msg = forms.CharField(max_length=1024, required=False) url = forms.CharField(max_length=256, required=False) line = forms.CharField(max_length=4, required=False)
StarcoderdataPython
120701
<filename>desktop_local_tests/macos/test_macos_packet_capture_disrupt_reorder_services.py<gh_stars>100-1000 from desktop_local_tests.local_packet_capture_test_case_with_disrupter import LocalPacketCaptureTestCaseWithDisrupter from desktop_local_tests.macos.macos_reorder_services_disrupter import MacOSDNSReorderServices...
StarcoderdataPython
1605243
<filename>google-spiders/g4spiders-4in2-run-from-script/google_email_spider_4in2/google_email_spider_4in2/spiders/__init__.py<gh_stars>1-10 # This package will contain the spiders of your Scrapy project # # Please refer to the documentation for information on how to create and manage # your spiders. import os ROOT_DIR...
StarcoderdataPython
150054
<reponame>noisy/-python-social-auth-steemconnect from setuptools import setup, find_packages setup( name='social-auth-steemconnect', version='0.0.3', packages=find_packages(), author='Krzysztof @noisy Szumny', author_email='<EMAIL>', description='SteemConnect backend for python-social-auth.', ...
StarcoderdataPython
1671046
<gh_stars>0 # 使用[]提取字符 """ 通过在字符串名字后面添加[] 来指定偏移量从而提取该字符 """ letter = "Hello World" print(letter[0]) ### 注意事项:字符串是不可以变的 letter[0] = 'G' print(letter)
StarcoderdataPython
1787311
import os import sys import requests as r import time import json from signal import signal, SIGINT import threading from datetime import datetime import math import subprocess import multiprocessing from multiprocessing import Manager, Value from ctypes import c_char_p from cryptography.hazmat.primitive...
StarcoderdataPython
3379272
#################################### ## batch code for WF simulation #################################### import sys, array, os, getpass from subprocess import call import subprocess as subp import time import math as math from subprocess import Popen, PIPE if len(sys.argv)<2: print("========= Syntax ========") ...
StarcoderdataPython
3250114
<gh_stars>0 # All rights reserved by forest fairy. # You cannot modify or share anything without sacrifice. # If you don't agree, keep calm and don't look at code bellow! __author__ = "VirtualV <https://github.com/virtualvfix>" __date__ = "13/10/17 20:54" from config import CONFIG from optparse import OptionGroup fro...
StarcoderdataPython
168673
""" This plugin adds support for the "Ashata Relay Board" family of USB controlled relay boards as a device. This device can then be accessed by the ufotest system through the device manager. Relay channels can be switched on and off individually. The Ashata Relay Boards are compatible with linux by using the system li...
StarcoderdataPython
3322375
<reponame>nhtoshiaki/Infeed # Generated by Django 2.2 on 2019-05-07 19:38 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('feed', '0004_auto_20190429_2010'), ] operations = [ migrations.CreateModel( ...
StarcoderdataPython
3259453
"""Tests for the :mod:`campy.graphics.gevents` module.""" from campy.graphics.gevents import GEvent, GMouseEvent, EventType, EventClassType def test_create_empty_event(): event = GEvent() assert event.event_class == EventClassType.NULL_EVENT assert event.event_type is None def test_mouse_clicked_event()...
StarcoderdataPython
143612
import os import torch import torch.nn as nn from torch.nn import CrossEntropyLoss, MSELoss from reformer.model import ReforBertLM, Reformer from finetuning.pretrained_model import ReforBertPreTrainedModel class ReforBertForQA(ReforBertPreTrainedModel): def __init__( self, config): super().__init__(config...
StarcoderdataPython
3296178
# Copyright (c) 2018, <NAME>. All rights reserved. # ISC License (ISCL) - see LICENSE file for details. name = "pyrap" from .pyrap import chkdir from .pyrap import process
StarcoderdataPython
179050
# Copyright (c) 2013 <NAME> <<EMAIL>> # # This file is part of OctoHub. # # OctoHub is free software; you can redistribute it and/or modify it under the # terms of the GNU General Public License as published by the Free Software # Foundation; either version 3 of the License, or (at your option) any later # version. im...
StarcoderdataPython
1657189
<reponame>dheera/termgraphics from setuptools import setup setup( name='termgraphics', version='1.0.1', install_requires=['numpy'], py_modules=['termgraphics'] )
StarcoderdataPython
3366451
t=int(input()); for i in range(t): s=input().split(' ') a=int(s[0]) b=int(s[1]) a=a**65 if(a%b==0): print("Yes") else: print("No")
StarcoderdataPython
1647619
# Apache License Version 2.0 # # Copyright (c) 2021., Redis Labs Modules # All rights reserved. # from redisbench_admin.utils.remote import ( PERFORMANCE_RTS_HOST, PERFORMANCE_RTS_PORT, PERFORMANCE_RTS_AUTH, PERFORMANCE_RTS_USER, REDIS_SOCKET_TIMEOUT, REDIS_HEALTH_CHECK_INTERVAL, REDIS_AU...
StarcoderdataPython
89261
# coding=utf-8 import datetime import logging import traceback from config import config def parse_frequency(s): if s == "never" or s is None: return None, None kind, num, unit = s.split() return int(num), unit class DefaultScheduler(object): queue_thread = None scheduler_thread = None ...
StarcoderdataPython
1624221
<reponame>sapphirecat/hashsum # vim:fileencoding=utf-8 # Python 3.4+ import argparse import hashlib import sys from traceback import print_exc def hash_file (name, algo): h = hashlib.new(algo) with open(name, 'rb') as f: h.update(f.read()) return h.hexdigest() def create_arg_parser (**kwargs): ...
StarcoderdataPython
1758593
from collections import OrderedDict import numpy as np def get_vocab(text): """Get all tokens""" vocab = OrderedDict() i = 0 for word in text: if word not in vocab: vocab[word] = i i += 1 return vocab def get_token_pairs(window_size, text): """Build token_pai...
StarcoderdataPython
57483
#!/usr/bin/env python # coding: utf-8 # In[2]: # import matplotlib.pyplot as plt # from scipy import interpolate import numpy as np # step = np.array([12, 6, 4, 3, 2]) # MAP5 = np.array([0.6480, 0.6797, 0.6898, 0.6921, 0.6982]) # step_new = np.arange(step.min(), step.max(), 0.1) # # step_new = n...
StarcoderdataPython
1630528
from mlpractice.stats.stats_utils import print_stats, _update_stats from mlpractice.utils import ExceptionInterception try: from mlpractice_solutions.\ mlpractice_solutions.linear_classifier_solution import softmax except ImportError: softmax = None from scipy.special import softmax as softmax_sample ...
StarcoderdataPython
111494
from numba.pycc import CC from numpy import zeros cc = CC('UnsatStor_inner_compiled') @cc.export('UnsatStor_inner', '(int64,int64[:,::1],float64,float64,float64[:,:,::1],float64[:,:,::1])') def UnsatStor_inner(NYrs, DaysMonth, MaxWaterCap, UnsatStor_0, infiltration, DailyET): unsatstor = zeros((NYrs, 12, 31)) ...
StarcoderdataPython
1633432
<filename>prometheus/serverboards-prometheus.py #!env/bin/python3 import serverboards_aio as serverboards import sys import asks import time import json import urllib import curio from serverboards_aio import print from pcolor import printc asks.init('curio') IGNORE_METRIC_NAMES = set(['instance', 'job']) td_to_s_mu...
StarcoderdataPython
3267336
from __future__ import print_function from __future__ import unicode_literals import time import re from tiny_test_fw import DUT, App, TinyFW from ttfw_bl import BL602App, BL602DUT @TinyFW.test_method(app=BL602App.BL602App, dut=BL602DUT.BL602TyMbDUT, test_suite_name='sdk_app_pwm_tc') def sdk_app_pwm_tc(env, extra_da...
StarcoderdataPython
3316538
""" Test suite for Application. """ import unittest try: from unittest.mock import Mock except ImportError: from mock import Mock import os import sys #pylint: disable=line-too-long,wrong-import-position sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../src'))) from application i...
StarcoderdataPython
1720726
<reponame>rochus/transitionscalespace #!/usr/bin/env python import random import numpy as np #try: # import ujson as json #except: import json def dist(X, Y, dist_type='angle'): # compute distance between particle and some input if dist_type == 'angle': # this computes the angular distance betwee...
StarcoderdataPython
1743780
"""Policies which use NumPy as a numerical backend.""" from garage.np.policies.fixed_policy import FixedPolicy from garage.np.policies.policy import Policy from garage.np.policies.scripted_policy import ScriptedPolicy __all__ = [ 'FixedPolicy', 'Policy', 'ScriptedPolicy', ]
StarcoderdataPython
1669502
import psutil print(psutil.virtual_memory().percent) print(psutil.cpu_percent(1,True))
StarcoderdataPython
3215043
<filename>moduledev/module.py<gh_stars>0 import os import shlex import shutil from abc import ABCMeta, abstractmethod from glob import glob from . import util _modulefile_template = """#%%Module1.0 set MODULENAME [ file tail [ file dirname $ModulesCurrentModulefile ] ] set MODULEVERSION [ file tail $ModulesCurrentMod...
StarcoderdataPython
1751524
<reponame>lcgong/dpillars<filename>domainics/json.py # -*- coding: utf-8 -*- import json import datetime from .domobj import DSetBase, DObject from .db.dtable import dsequence from decimal import Decimal def loads(s): """Deserialize s to a python object""" return json.loads(s) def dumps(obj): return json.dumps...
StarcoderdataPython
1797234
# Copyright 2021 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 by applicable law or agreed to...
StarcoderdataPython
3217213
''' ''' import keras import tensorflow as tf from keras.models import Model from keras import backend as K from keras.layers import Input, merge, Conv2D, ZeroPadding2D, UpSampling2D, Dense, concatenate, Conv2DTranspose from keras.layers.pooling import MaxPooling2D, GlobalAveragePooling2D, MaxPooling2D from keras.lay...
StarcoderdataPython
151772
""" Given two sorted linked lists, merge them so that the resulting linked list is also sorted. Consider two sorted linked lists and the merged list below them as an example. Click here to view the solution in C++, Java, JavaScript, and Ruby. head1 -> 4 -> 8 -> 15 -> 19 -> null head2 -> 7 -> 9 -> 10 -> 16 -> null hea...
StarcoderdataPython
3267178
<gh_stars>0 import logging import pathlib from django.test import SimpleTestCase from bbapp.loader import Load, log as loaderlog from bbapp.models import Player, Batting log = logging.getLogger(__name__) root_level = logging.getLogger().getEffectiveLevel() class SimpleLoaderTest(SimpleTestCase): def setUp(sel...
StarcoderdataPython
176293
#!/usr/bin/env python # Copyright (c) 2015-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. import getpass import json import os import socket import StringIO import sys import tempfile import unitt...
StarcoderdataPython
41400
import os import sys import tkinter as tk from configparser import ConfigParser from tkinter import filedialog # for Python 3 from tkinter import messagebox from config.Dialogs import Dialogs from UI.helpers.open_folder import open_folder # https://stackoverflow.com/questions/31170616/how-to-access-a-method-in-one-...
StarcoderdataPython
3284152
from django.contrib.auth.mixins import LoginRequiredMixin from django.shortcuts import render, redirect from django.views import View from django import http import re,json,logging from django.db import DatabaseError from django.urls import reverse from django.contrib.auth import login, authenticate, logout from django...
StarcoderdataPython
144341
from click.testing import CliRunner import time import pytest import json from calm.dsl.cli import main as cli from calm.dsl.cli.constants import APPLICATION from calm.dsl.tools import get_logging_handle LOG = get_logging_handle(__name__) BP_FILE_PATH = "tests/cli/runtime_helpers/ahv/blueprint.py" LAUNCH_PARAMS = "te...
StarcoderdataPython
4817862
<reponame>CFWLoader/supreme-bassoon<gh_stars>0 from sklearn import tree from sklearn.datasets import load_iris import graphviz import os dir_path = os.path.dirname(os.path.realpath(__file__)) iris_data = load_iris() clf = tree.DecisionTreeClassifier(criterion="gini") clf = clf.fit(iris_data.data, iris_data.target) ...
StarcoderdataPython
1671946
<filename>simple_salesforce/api.py """Core classes and exceptions for Simple-Salesforce""" # has to be defined prior to login import DEFAULT_API_VERSION = '52.0' import base64 import json import logging import re from collections import OrderedDict, namedtuple from urllib.parse import urljoin, urlparse import request...
StarcoderdataPython
56199
<reponame>RTUITLab/Energomach-Hack-2021-RealityGang # Generated by Django 3.2 on 2021-05-22 10:50 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('main_app', '0004_auto_20210522_1349'), ] operations = [ migrations.RenameField( model_...
StarcoderdataPython
1753001
<filename>setup.py import os.path from distutils.core import setup def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='pygments-lexer-solidity', version='0.3.1', description='Solidity lexer for Pygments', long_description=read('README.rst'), license...
StarcoderdataPython
1753922
<reponame>Akashdawari/Classifying-Classifiers-<filename>iris_dataset_classifiers.py<gh_stars>0 # -*- coding: utf-8 -*- """Iris_dataset_classifiers.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1De9mW9xFR0sMiAQvc08IzTQxe2_htH8J """ from sklearn....
StarcoderdataPython
189176
#!/usr/bin/env python import hashlib import itertools import struct import time import multiprocessing from ctypes import cdll nbits = 19 mask = (1<<nbits)-1 #0x7ffff tot_values = pow(2,nbits) def process_killer(): cdll['libc.so.6'].prctl(1,9) def _left_rotate(n, b): """Left rotate a 32-bit integer n by b...
StarcoderdataPython
1602243
<reponame>stat-kwon/notification<filename>src/spaceone/notification/manager/identity_manager.py import logging from spaceone.core.manager import BaseManager from spaceone.core.connector.space_connector import SpaceConnector _LOGGER = logging.getLogger(__name__) class IdentityManager(BaseManager): def __init__(...
StarcoderdataPython
52002
<gh_stars>1-10 import numpy as np import sys, traceback import cv2 device_id = 0 def nothing(x): pass cv2.namedWindow('ESF_preview') cv2.namedWindow('Trackbars') cv2.createTrackbar('ACC_RATE','Trackbars',80,100,nothing) cv2.createTrackbar('MIN_GRAY','Trackbars',10,255,nothing) cv2.createTrackbar('MI...
StarcoderdataPython
1733349
# -*- coding: utf-8 -*- """ Created on Wed Sep 9 08:41:17 2015. @author: mje """ import numpy as np import numpy.random as npr import os import socket import mne # import pandas as pd from mne.connectivity import spectral_connectivity from mne.minimum_norm import (apply_inverse_epochs, read_inverse_operator) # Pe...
StarcoderdataPython
3235642
<filename>tensorflow/python/ops/ragged/ragged_batch_gather_with_default_op.py # Copyright 2018 The TensorFlow 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 # #...
StarcoderdataPython
3378687
# -*- coding: utf-8 -*- from qcloudsdkcore.request import Request class UpgradeRedisRequest(Request): def __init__(self): super(UpgradeRedisRequest, self).__init__( 'redis', 'qcloudcliV1', 'UpgradeRedis', 'redis.api.qcloud.com') def get_memSize(self): return self.get_params().get...
StarcoderdataPython
3387512
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jan 7 14:43:27 2018 @author: hfwittmann """ import numpy as np # objective tests from nim_perfect_play.nim_perfect_play import findWinningMove class Accuracy: def __init__(self, maxHeapSize = 7, numberOfHeaps = 3, nofPositions = 1000): ...
StarcoderdataPython
3348627
<gh_stars>1-10 from __future__ import absolute_import from __future__ import division from __future__ import print_function import cv2 import numpy as np from progress.bar import Bar import time import torch import torch.nn.functional as F from models.model import create_model, load_model from utils.image import get_a...
StarcoderdataPython
85590
<filename>sdk/python/pulumi_aws/secretsmanager/outputs.py<gh_stars>100-1000 # 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 ty...
StarcoderdataPython
1648357
from . import vec
StarcoderdataPython
1795757
from django.test import TestCase from staff import models class ModelTest(TestCase): def test_department_str(self): '''Test string representation of dept''' dept = models.Department.objects.create( name='Accounting' ) self.assertEqual(str(dept), dept.name)
StarcoderdataPython