id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
124927 | <gh_stars>1-10
import requests
import json
import sys
from datetime import datetime, timedelta
from .auth import getHeaders
from .parks import Park
from .pointsofinterest import PointOfInterest
class Entertainment(object):
def __init__(self, id = ''):
"""
Constructor Function
Gets all ent... | StarcoderdataPython |
4828040 | # -*- coding: utf-8 -*-
#!/usr/bin/python
##################################################
# AUTHOR : <NAME>
# CREATED_AT : 2015-09-15
# LAST_MODIFIED : 2015年11月14日 星期六 16时46分14秒
# USAGE : python core.py
# PURPOSE : TODO
##################################################
import mylogging
impor... | StarcoderdataPython |
3257097 | <filename>tests/test_views.py
import json
import urllib3
from unittest import mock
import pytest
@mock.patch('urllib3.poolmanager.PoolManager.urlopen')
def test_pass_through(mock_urlopen, client, settings):
mock_urlopen.return_value = urllib3.response.HTTPResponse(
headers={},
status=200,
)
... | StarcoderdataPython |
1709419 | <gh_stars>10-100
#!/usr/bin/env python3
"""Training and evaluation entry point."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
import argparse
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow.py... | StarcoderdataPython |
3243400 | <filename>api/nww_server_status.py
import string
import time
import requests
from bs4 import BeautifulSoup
import utils.resources as res
headers = {
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/91.0.4472.164 Safari/537.36",
}
def getserver():... | StarcoderdataPython |
152811 | <reponame>Itaybre/py-ios-device<filename>tools/kperfdata/kperfdata.py
from unicorn import *
from unicorn.x86_const import *
import re
from tools.kperfdata.kpmsg import messages
import struct
instruction_table = {
}
function_table = {
}
with open('kperfdata.s') as fp:
kperfdata_list = fp.read().split('\n\n')
de... | StarcoderdataPython |
3371076 | #!/usr/bin/env python
import random
import timeit
from functools import reduce
import grapheme
import numpy as np
random.seed(0)
def main():
longstring = "".join(random.choices("ABCDEFGHIJKLM", k=20))
functions = [
(list_comprehension, "list_comprehension", longstring),
(reverse_func, "reve... | StarcoderdataPython |
90853 | def includeme(config):
# config.add_static_view('static', 'static', cache_max_age=3600)
config.add_route('home', '/')
config.add_route('hitori_boards', r'/hitori_boards')
config.add_route('hitori_board', r'/hitori_boards/{board_id:\d+}')
config.add_route('hitori_board_solve', r'/hitori_boards/{boar... | StarcoderdataPython |
28563 | <filename>mestopy/mestopy.py
from scipy.signal import oaconvolve
from pyfar import Signal
# Class to generate ref-Objects, that can bei part of the MeasurementChain
class Device(object):
"""Class for device in MeasurementChain.
This class holds methods and properties of a device in the
'MeasurementChain'... | StarcoderdataPython |
1702644 | <reponame>Near32/Archi<filename>Archi/tests/test_model.py<gh_stars>0
import Archi
import yaml
def test_model_loading():
try:
config = yaml.safe_load(
open("./model_test_config.yaml", 'r'),
)
except yaml.YANNLError as e:
print(e)
from Archi import load_model
model... | StarcoderdataPython |
3240393 | <gh_stars>0
"""
This module provides functions and classes that manage the creation
of the global static masks.
For `staticMask`, the user interface function is :py:func:`createMask`.
:Authors: <NAME>, <NAME>, <NAME>, <NAME>
:License: :doc:`LICENSE`
"""
from __future__ import absolute_import, division, print_funct... | StarcoderdataPython |
3272418 | <reponame>MATTHEWFRAZER/pavo_cristatus<filename>pavo_cristatus/tests/interactions_tests/test_pavo_cristatus_result_monad.py
from pavo_cristatus.interactions.pavo_cristatus_result_monad.pavo_cristatus_result_monad import PavoCristatusResultMonad
class TestPavoCristatusResultMonad:
def test_left_identity(self):
... | StarcoderdataPython |
173498 | from time import time;
from math import floor;
# Supporting class to collect timing information.
class Timer:
# A constant for state management indicating that the timer is stopped.
STOPPED = 0;
# A constant for state management indicating that the timer is running.
RUNNING = 1;
# Initializes the timer to ... | StarcoderdataPython |
1666401 | <filename>tests/test_ple.py
#!/usr/bin/python
"""
This tests that all the PLE games launch, except for doom; we
explicitly check that it isn't defined.
"""
import nose
import numpy as np
import unittest
NUM_STEPS=150
class NaiveAgent():
def __init__(self, actions):
self.actions = actions
def pi... | StarcoderdataPython |
83230 | import uuid
import datetime
from typing import List, Union, Dict
from plugins.adversary.app.engine.database import EncryptedDictField
from plugins.adversary.app.engine.objects import Log
from plugins.adversary.app.util import tz_utcnow
version = 1.1
class Operation(dict):
def __init__(self):
super().__i... | StarcoderdataPython |
3296688 | from .token import Token
single_operators = {
"+": "add",
"-": "sub",
"*": "mul",
"/": "div",
"^": "pow",
"%": "mod",
"(": "lparens",
")": "rparens",
"[": "lbracket",
"]": "rbracket",
"{": "lcurly",
"}": "rcurly",
":": "colon",
".": "dot",
",": "comma",
... | StarcoderdataPython |
110672 | from django.db import models
from .base_workflow import Ticket, TicketHistory
class ServiceRequest(Ticket):
AC_STATUS = (
('aog', 'AOG'),
('mtx', 'Scheduled Maintenance'),
('other', 'Other (Provide in Description)')
)
CERTS = (
('far91', 'FAR 91'),
('far121', 'F... | StarcoderdataPython |
1785369 | # -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function, unicode_literals
from collections import defaultdict
from django.utils import six
from .util import DoesNotExist
from .mappings import OldValues
from .descriptors import _inject_descriptors
__all__ = ('SaveTheChange', 'Upda... | StarcoderdataPython |
3205753 | # -*- coding: utf-8 -*-
# Copyright (c) 2018, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import json
from frappe import throw, msgprint, _
def get_post_json_data():
if frappe.request.method != "POST":
throw(_("Request Method Must... | StarcoderdataPython |
1719009 | """
In this pretrain-finetune example, we do the following:
epoch 1 - 10: pretrain a ResNet9 model on Cifar100
epoch 11-12: freeze the backbone, use a new classification head and finetune on cifar10 data
"""
import tempfile
import fastestimator as fe
import torch
import torch.nn as nn
import torch.nn.functional as fn... | StarcoderdataPython |
1669251 | <gh_stars>1-10
import numpy as np
import cv2
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
filename = 'KA.AN1.39.tiff'
img = cv2.imread(filename)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
for (x,y,w,h) in faces:
cv2.rectangle(im... | StarcoderdataPython |
129854 | <reponame>gbroques/numerical-tic-tac-toe
from .action import Action
from .numerical_tic_tac_toe import GameState
from .numerical_tic_tac_toe import NumericalTicTacToe
from .player import Max
from .player import Min
| StarcoderdataPython |
1641436 | import great_expectations as ge
context = ge.data_context.DataContext()
suite = context.create_expectation_suite(
expectation_suite_name="check_raw_data",
overwrite_existing = True
)
batch_kwargs = {
'path': 'data/raw/train.csv',
'datasource': 'data_dir',
'data_asset_name': 'train',
'reader_m... | StarcoderdataPython |
143529 | <gh_stars>1000+
try:
import distutils
from distutils import sysconfig
from distutils.command.install import install
from distutils.core import setup, Extension
except:
raise SystemExit, "Distutils problem"
prefix = "__PREFIX__"
inc_dirs = [prefix + "/include"]
lib_dirs = [prefix + "/lib"]
libs = ["... | StarcoderdataPython |
9409 | <filename>pykuna/errors.py
class KunaError(Exception):
pass
class AuthenticationError(KunaError):
"""Raised when authentication fails."""
pass
class UnauthorizedError(KunaError):
"""Raised when an API call fails as unauthorized (401)."""
pass
| StarcoderdataPython |
100552 | <reponame>tudinfse/intel_mpx_explained
"""
Preparation stage: how results are averaged and aggregated
TODO: this file is in urgent need of cleaning and refactoring
"""
import os
from collections import defaultdict, OrderedDict
from pandas import read_csv, DataFrame, Categorical, Series
import numpy as np
import loggi... | StarcoderdataPython |
1748783 | <reponame>Polidea/SiriusObfuscator
#!/usr/bin/python
#----------------------------------------------------------------------
# This module will enable GDB remote packet logging when the
# 'start_gdb_log' command is called with a filename to log to. When the
# 'stop_gdb_log' command is called, it will disable the loggi... | StarcoderdataPython |
4826986 | <reponame>Turing311/CDCN<filename>FAS_challenge_CVPRW2020/Track1 Multi-modal/model3_tensorflow/data.py
""" Code for loading data. """
import numpy as np
import cv2
import random
import tensorflow as tf
from tensorflow.python.platform import flags
import os
import pwd
FLAGS = flags.FLAGS
def random_float(f_min, f_... | StarcoderdataPython |
1747804 | <reponame>kmcm0/stacki
from unittest.mock import create_autospec, ANY, patch, call
import pytest
from stack.commands import DatabaseConnection
from stack.commands.set.firmware.model.version_regex import Command
from stack.exception import CommandError
from stack.commands.set.firmware.model.version_regex.plugin_basic im... | StarcoderdataPython |
1777746 | <gh_stars>0
# imports for examples
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from model import TCNPredictor
from torchtest import test_suite
batch_size, horizon, seq_len, features, n_nodes = 1, 12, 12, 1, 325
inputs = Variable(torch.randn(batch_size, feature... | StarcoderdataPython |
1690942 | <reponame>snosrap/spaCy
from spacy import require_gpu
require_gpu()
| StarcoderdataPython |
1626735 | <gh_stars>0
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -------------------------------------------------------------------------... | StarcoderdataPython |
3329892 | class Solution:
def distanceBetweenBusStops(self, distance, start, destination):
if len(distance) == 1:
return distance[0]
if start > destination:
start, destination = destination, start
total = sum(distance)
clockwise = sum(distance[start:destination])
... | StarcoderdataPython |
3346826 | <filename>goprocam/GoProCamera.py<gh_stars>0
import base64
import datetime
import http
import json
import math
import re
import socket
import ssl
import struct
import subprocess
import sys
import time
import urllib.request
from socket import timeout
from urllib.error import HTTPError, URLError
from goprocam import con... | StarcoderdataPython |
153850 | # -*- coding: utf-8 -*-
"""
author: <NAME> (github Boyne272)
Last updated on Wed Aug 28 08:46:31 2019
"""
import sys
import time as tm
import random
import torch
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
def percent_print(i, i_max, interval=1, length=50):
"""
... | StarcoderdataPython |
3279714 | """
This module provides a class library for a GUI label field widget bound to an Epics PV. The PV is monitored
and the field is updated when the PV changes
Author: <NAME>
Created: Apr. 20, 2014
Modifications:
"""
from epics import PV
from PyQt5 import QtGui, QtCore, QtWidgets
import t... | StarcoderdataPython |
30089 | # Copyright © 2021 Ingram Micro Inc. All rights reserved.
from dj_cqrs.constants import SignalType
from dj_cqrs.controller.consumer import route_signal_to_replica_model
from dj_cqrs.mixins import ReplicaMixin
import pytest
def test_bad_model(caplog):
route_signal_to_replica_model(SignalType.SAVE, 'invalid', {}... | StarcoderdataPython |
1611468 | <reponame>jgomezc1/SOLIDSPy_DYN
# -*- coding: utf-8 -*-
"""
Element subroutines
-------------------
Each UEL subroutine computes the local stiffness matrix for a given
finite element.
New elements can be added by including additional subroutines.
"""
from __future__ import division, print_function
import numpy as np
... | StarcoderdataPython |
3389428 | <reponame>PinkRoccade-Local-Government-OSS/PinkWave<gh_stars>1-10
#!/usr/bin/python
"""
The Macro class can be used to load macro scripts written in Python
"""
import os
from os.path import isfile
import importlib
from time import sleep
import sys,os
from os.path import dirname,abspath
from os import walk
# Importin... | StarcoderdataPython |
1774496 | <filename>script/plot_batch_results.py
import rospy
from victim_localization.msg import IterationInfo
from numpy import mean, array, hypot, diff, convolve, arange, sin, cos, ones, pi, matrix, isfinite
import time
import signal
import sys
import csv
import os
import glob
import subprocess
import shutil
import rospkg
fro... | StarcoderdataPython |
4807042 | <gh_stars>0
# Generated by Django 3.2.13 on 2022-05-05 16:59
from django.db import migrations
from metagrid.projects.migrations.scripts.import_functions import (
insert_data,
reverse_insert_data,
)
class Migration(migrations.Migration):
dependencies = [("projects", "0001_initial")]
operations = [
... | StarcoderdataPython |
48954 | <reponame>svenbuder/GALAH_DR3<gh_stars>1-10
#!/usr/bin/env python
# coding: utf-8
# # Actions and Orbit caluclation with MC sampling for GALAH DR3 after Gaia eDR3
#
# ## Author: <NAME>
#
# ### History:
# 201204 SB Created
#
# # What information you need
#
# ra, dec, pmra, pmdec from Gaia eDR3
#
# distance: ... | StarcoderdataPython |
105965 | import openerp.addons.website_sale.controllers.main as main
from odoo.http import request
class WebsiteSaleBirthdate(main.WebsiteSale):
def checkout_values(self, data=None):
values = super(WebsiteSaleBirthdate, self).checkout_values(data)
current_user = request.env.user
# if user is ac... | StarcoderdataPython |
19633 | # @lc app=leetcode id=16 lang=python3
#
# [16] 3Sum Closest
#
# https://leetcode.com/problems/3sum-closest/description/
#
# algorithms
# Medium (46.33%)
# Likes: 3080
# Dislikes: 169
# Total Accepted: 570.4K
# Total Submissions: 1.2M
# Testcase Example: '[-1,2,1,-4]\n1'
#
# Given an array nums of n integers and ... | StarcoderdataPython |
3267472 | <reponame>diegocostacmp/gestao_rh<filename>apps/departamento/urls.py
from django.urls import path
from .views import (
DepartamentoList,
DepartamentoCreate,
DepartamentoUpdate,
DepartamentoDelete,
)
urlpatterns = [
path("list", DepartamentoList.as_view(), name="list_departamento"),
path("novo/"... | StarcoderdataPython |
3215678 | # Generated by Django 3.2.3 on 2021-07-15 23:44
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
("oauth_app", "0001_initial"),
]
operations = [
migrations.AddField(
"SlackBot", "bot_refresh_token", models.... | StarcoderdataPython |
1699828 | <reponame>okskmk2/flaskstarter<filename>baeun/__init__.py
#-*- coding: utf-8 -*-
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/board')
def board():
name=u'이은성'
return render_template('board.html',name=name)... | StarcoderdataPython |
161130 | #!/usr/bin/env python
# Copyright 2014 IIJ Innovation Institute 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:
# * Redistributions of source code must retain the above copyright
# n... | StarcoderdataPython |
1617159 | #!/usr/bin/env python
"""
Written by <NAME>
Github: https://github.com/whereismyjetpack
Email: <EMAIL>
Script to add a Hard disk to an existing VM
This is for demonstration purposes only.
I did not do a whole lot of sanity checking, etc.
Known issues:
This will not add more than 15 disks to a VM
To do that the VM nee... | StarcoderdataPython |
1617666 | <reponame>vicwer/sense_classification<filename>prepare_data/gen_tf_records.py
# encoding: utf-8
import numpy as np
import tensorflow as tf
import os
import cv2
from tqdm import tqdm
import re
import sys
sys.path.append('..')
from config import cfg
def load_file(file_path):
'''
load imgs_path, classes and labe... | StarcoderdataPython |
1725879 | from itertools import chain
from django import forms
from django.contrib.auth import get_user_model
from django.forms import models
from django.forms.fields import MultipleChoiceField
from ..categories.models import Category
from .models import Moderator, ModeratorEvent, ModeratorQuerySet
User = get_user_model()
#... | StarcoderdataPython |
35462 | #!/usr/bin/env python
import os
import sys
dbSet = []
with open('other_allmut_HD.txt',"r") as beds:
for bed in beds:
bed = bed.strip()
bed = bed.split('\t')
item = bed[15] + '\t' + bed[16] + '\t' + bed[17] + '\t' + bed[17] + '\t' + bed[17] + '\t' + bed[17] + '\t' + 'https://www.ncbi.nlm.ni... | StarcoderdataPython |
1600416 | # coding: utf-8
class Solution:
# @param candidates, a list of integers
# @param target, integer
# @return a list of lists of integers
def combinationSum(self, candidates, target):
# write your code here
self.ret = []
self.target = target
candidates.sort()
self._... | StarcoderdataPython |
3388801 | import unittest
from system_config import SystemConfig
from pages import Pages
class PagesTest(unittest.TestCase):
def __init__(self, method_name):
super().__init__(method_name)
self._toc = Pages(SystemConfig.pages_path())
def test_page_filename(self):
self.assertEqual(Pages.page_fi... | StarcoderdataPython |
65440 | # 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-2.0
#
# Unless required by applicab... | StarcoderdataPython |
3210500 | # Generated by Django 3.1.7 on 2021-07-02 10:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('product', '0009_auto_20210630_0423'),
]
operations = [
migrations.RemoveField(
model_name='productcart',
name='product',
... | StarcoderdataPython |
1798439 | <reponame>jihyungSong/plugin-aws-trustedadvisor
from spaceone.inventory.connector.trusted_advisor import TrustedAdvisorConnector
| StarcoderdataPython |
3224797 | # (ノ◕ヮ◕)ノ*:・゚✧ @SeanJxie
PORT = 1024
MOVE_RESULT_MESSAGE_SIZE = 1
MOVE_COORDS_MESSAGE_SIZE = 2
CONFIRM_MESSAGE_SIZE = 2
MSG_CLIENT_CONF = bytearray(map(ord, "CC"))
MSG_SERVER_CONF = bytearray(map(ord, "SC"))
| StarcoderdataPython |
4809344 | <gh_stars>0
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle, TA_CENTER
class Styles:
@staticmethod
def compile():
styles = getSampleStyleSheet()
styles.add(ParagraphStyle('h1T', parent=styles['Heading1'], fontSize = 18, leading=10,))
styles.add(ParagraphStyle('h2T', parent=styles['Head... | StarcoderdataPython |
1739962 | <filename>spark/p3b.py
from pyspark.sql.types import StructType, StructField, IntegerType, StringType
spark = SparkSession.builder.getOrCreate()
# For escuelasPR.csv file
school_schema = StructType([
StructField("school_region", StringType(), True),
StructField("school_district", StringType(), True),
Stru... | StarcoderdataPython |
3252566 | <filename>experiments/scott/Idealhashtrie/trie_v2.3.py
#Simple Trie implementation
#Can specify a hash function to hash the keys first
#Includes reference counting, but for simplicity only saving 1 value per node
class Node:
def __init__(self):
self.children = dict()
self.count = 0
self.val... | StarcoderdataPython |
1746873 | # Generated by Django 2.1.7 on 2019-06-06 18:37
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0003_auto_20190605_1528'),
]
operations = [
migrations.CreateModel(
name='H... | StarcoderdataPython |
1773499 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2017-01-16 17:12
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('helpdesk', '0007_ticket_submitting_room'),
... | StarcoderdataPython |
86964 | import os
from setuptools import setup, Extension
try:
from Cython.Build import cythonize
except ImportError:
cythonize = None
USE_CYTHON = bool(int(os.getenv("USE_CYTHON", 0))) and cythonize is not None
MODULES = (
{'mod': 'tkvdb.errors', 'files': ["errors"]},
{'mod': 'tkvdb.params', 'files': ["par... | StarcoderdataPython |
124183 | # coding=utf-8
# *** WARNING: this file was generated by crd2pulumi. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
__all__ = [
'... | StarcoderdataPython |
27006 | ''' The most basic way to use the Private API. I recommend renaming the file .env
to .env and filling out the gemini api key information. The dotenv package loads the .env (or .env)
file and the os.environ() function reads the values from the file.ß
'''
import os
import robin_stocks.gemini as g
from dotenv import load... | StarcoderdataPython |
160596 | #from __future__ import unicode_literals
# Create your models here.
from django.contrib.auth.models import User
from django.core.validators import MinLengthValidator
from django.db import models
class Idea(models.Model):
idea_title = models.CharField(max_length=50, validators=[MinLengthValidator(3, message='Leng... | StarcoderdataPython |
130233 | # 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 |
3343411 | <reponame>abey79/aoc2021
import sys
from pathlib import Path
from typing import Callable
import aocd
from rich.console import Console
from rich.traceback import install
install(show_locals=True)
console = Console()
DAY = int("".join(s for s in Path(__file__).name if s.isdigit()))
TEST_DATA: str = """00100
11110
1011... | StarcoderdataPython |
39454 |
from .users import User
__all__ = [
'User']
| StarcoderdataPython |
3370829 | <filename>meiduo_mell/meiduo_mell/apps/oauth/views.py
from QQLoginTool.QQtool import OAuthQQ
from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
import logging
from . import constants
from .models import OauthQQUser... | StarcoderdataPython |
147598 | # Copyright 2010-2011 <NAME> <<EMAIL>>
#
# This file is part of Poezio.
#
# Poezio is free software: you can redistribute it and/or modify
# it under the terms of the zlib license. See the COPYING file.
"""
Starting point of poezio. Launches both the Connection and Gui
"""
import sys
import os
import signal
import l... | StarcoderdataPython |
1788696 | """Create comment table.
Revision ID: 461756447c4f
Revises: <KEY>
Create Date: 2020-04-16 12:33:33.874180
"""
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from alembic import op
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "<KEY>"
branch_labels = None
depends_on ... | StarcoderdataPython |
158146 | <gh_stars>0
from typing import List
class Solution:
def combine(self, n: int, k: int) -> List[List[int]]:
ans = []
if k > n:
return ans
def backtrack(path: List[int], index: int) -> None:
if len(path) == k:
ans.append(path)
ret... | StarcoderdataPython |
1768733 | from dotenv import load_dotenv
from .application import *
from .config import load_configuration
def new_application(**kws):
'''
新建应用。
'''
load_dotenv(verbose=False, override=True)
cmn = kws.get('config_module', 'config')
config = load_configuration(cmn)
appcnf = config['app']
appcnf[... | StarcoderdataPython |
3291195 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json,os
from django.shortcuts import render,HttpResponse
import models
# Create your views here.
from django.contrib.auth.decorators import login_required
import Queue,time
from django.core.cache import cache
GLOBAL_MQ={}
@login_required
def dashbo... | StarcoderdataPython |
38330 | #! /usr/bin/env python
# Copyright (c) 2018 - 2019 <NAME> <<EMAIL>>
#
# 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 |
111048 | <reponame>iii-org/devops-system
"""add_table_server_type
Revision ID: d68db624b8cf
Revises: <PASSWORD>
Create Date: 2021-09-30 17:35:53.022107
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd68db624b8cf'
down_revision = '<PASSWORD>'
branch_labels = None
depen... | StarcoderdataPython |
4833260 | # Generated by Django 2.1.15 on 2021-06-17 09:49
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0009_alter_user_last_name_max_length'),
]
operations ... | StarcoderdataPython |
1712205 | <filename>pascal.py<gh_stars>0
#!/usr/bin/python3
#coding: utf8
import os
from discord.ext import commands
from voice import Voice
from temp import Temp
from rss import Rss
from vote import Vote
from radio import Radio
class Pascal(commands.Bot):
async def on_ready(self):
print('Now connected as {0.user.n... | StarcoderdataPython |
39980 | from datetime import datetime, timezone
from flask import abort
from flask_unchained import BundleConfig
from http import HTTPStatus
from .forms import (
LoginForm,
RegisterForm,
ForgotPasswordForm,
ResetPasswordForm,
ChangePasswordForm,
SendConfirmationForm,
)
from .models import AnonymousUser... | StarcoderdataPython |
1713990 | """
Created on Tue May 14 14:32:00 2018
@Author: <NAME>
"""
from emulator.operation import Operation
class transpose(Operation):
def __init__(self, a):
super(transpose, self).__init__([a,b])
self.shape = a.get_shape()
def compute(self, var_a):
pass | StarcoderdataPython |
1690728 | import vmArithmetic
import vmPushPop
def translateVMCommand(text, symbol):
stackPoint = '256'
index = 0
asmCommand = []
asmCommand += _setStackPoint(stackPoint)
arithmeticFunction = {
'add': vmArithmetic.add,
'sub': vmArithmetic.sub,
'neg': vmArithmetic.neg,
'eq': ... | StarcoderdataPython |
3230092 | from django.urls import path
from .views import EnterUrlView, ResultView, ResultAjaxView
app_name = "check"
urlpatterns = [
path("", EnterUrlView.as_view(), name="enterurl"),
path("result/", ResultView.as_view(), name="result"),
path("result_ajax/", ResultAjaxView.as_view(), name="result_ajax"),
]
| StarcoderdataPython |
3274332 | <gh_stars>0
from http import HTTPStatus
from unittest.mock import MagicMock
import jwt
from pytest import fixture
from app import app
from api.errors import INVALID_ARGUMENT
from tests.unit.payloads_for_tests import PRIVATE_KEY
@fixture(scope='session')
def client():
app.rsa_private_key = PRIVATE_KEY
app.t... | StarcoderdataPython |
4811838 | <reponame>u8621011/similarity_sounds
import numpy as np
import csv
feature_names = ['cons',
'son',
'syll',
'labial',
'round',
'coronal',
'ant',
'distrib',
'dorsal',
'... | StarcoderdataPython |
1747289 | """
6 11
0 1 32
0 2 31
0 5 60
0 6 51
1 2 21
2 4 46
2 6 25
3 4 34
3 5 18
4 5 40
4 6 51
"""
import math
def prim():
curV = 0
D[curV][0] = 0
while len(U) <= N:
# D의 key 값이 최소인 정점을 구한다
# 이 정점은 U에 포함되지 않아야 한다
minV = math.inf
for i in range(N + 1):
if i in U: continu... | StarcoderdataPython |
318 | print('222')
| StarcoderdataPython |
3278899 | <reponame>pierrerappolt/rekall
import unittest
from rekall import Interval, IntervalSet, IntervalSetMapping
from rekall.bounds import Bounds3D
from rekall.runtime import (Runtime, get_forked_process_pool_factory,
get_spawned_process_pool_factory, RekallRuntimeException)
class TestRuntime(unittest.TestCase):
... | StarcoderdataPython |
1695106 | <gh_stars>0
lista = []
c = 0
while True:
n = int(input('Digite um número: '))
if c == 0 or n < lista[-1]:
lista.append(n)
else:
pos = 0
while pos < len(lista):
if n >= lista[pos]:
lista.insert(pos, n)
break
pos += 1
c += 1
... | StarcoderdataPython |
3316286 | <filename>FLASH4.2.1_save/tools/scripts/setup_compact_app/Makefile.py
#!/usr/bin/env python
import re, shutil, glob, os, sys
class UnitMakefile:
def __init__(self):
self.objList = []
self.dependencies = {}
#Preprocessor sections are only copied and pasted. This should
#be OK for no... | StarcoderdataPython |
3374152 | <filename>tests/test_prepare.py<gh_stars>100-1000
import random
import string
def test_prepare(iamport):
amount = 12000
mid = ''.join(
random.choice(string.ascii_uppercase + string.digits)
for _ in range(10)
)
result = iamport.prepare(merchant_uid=mid, amount=amount)
assert result[... | StarcoderdataPython |
1704760 | <filename>course/p_161/index.py
# mudule
import tool
print(__name__)
print(tool.add(1, 2))
| StarcoderdataPython |
1760350 | <filename>neurokit2/misc/__init__.py
"""Submodule for NeuroKit."""
from .expspace import expspace
from .find_closest import find_closest
from .listify import listify
from .type_converters import as_vector
__all__ = ["listify", "find_closest", "as_vector", "expspace"]
| StarcoderdataPython |
4833282 | #!/usr/bin/env python3
# Author: <NAME>, M.S.
import warnings
warnings.filterwarnings('ignore')
import numpy as np
np.random.seed(9999)
import pandas as pd
from collections import Counter
from scikitplot.metrics import plot_roc
import matplotlib.pyplot as plt
import seaborn as sns
from imblearn.combine import S... | StarcoderdataPython |
3358931 | <reponame>abhaikollara/tensorflow<filename>tensorflow/python/grappler/hierarchical_controller.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... | StarcoderdataPython |
3248665 | import numpy as np
import torch
from models.pwlinear_regression import pwlr
from scripts.test_reconstruction_mlode import compute_rnfl_error_base, compute_vft_error_base, create_vft_mask
from train_multimodal_latentodegru_sync import MultimodalTimeSeriesData
GPU = 0
device = torch.device('cuda:' + str(GPU) if torch... | StarcoderdataPython |
3284838 | <reponame>ewanlee/mackrl
import torch as th
from torch import nn
from components.transforms import _to_batch, _from_batch
class EntropyRegularisationLoss(nn.Module):
def __init__(self):
super(EntropyRegularisationLoss, self).__init__()
pass
def forward(self, policies, tformat):
_pol... | StarcoderdataPython |
147011 | """Unit test for RemoteValueString objects."""
import asyncio
import unittest
from xknx import XKNX
from xknx.dpt import DPTArray, DPTBinary
from xknx.exceptions import ConversionError, CouldNotParseTelegram
from xknx.remote_value import RemoteValueString
from xknx.telegram import GroupAddress, Telegram
class TestRe... | StarcoderdataPython |
117052 | <reponame>sparkslabs/kamaelia_orig
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.