id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
54229
""" LC 480 Given an array of numbers and a number ‘k’, find the median of all the ‘k’ sized sub-arrays (or windows) of the array. Example 1: Input: nums=[1, 2, -1, 3, 5], k = 2 Output: [1.5, 0.5, 1.0, 4.0] Explanation: Lets consider all windows of size ‘2’: [1, 2, -1, 3, 5] -> median is 1.5 [1, 2, -1, 3, 5] -> media...
StarcoderdataPython
63062
<reponame>princessmiku/Asuna-Scientist<filename>scientist/displayRecord.py """ A simple Class for display records """ # Own from .collection import Collection # python stuff import math class DRec: def __init__(self, _record, maxShows: int = 25): """ Init a display lib :param _recor...
StarcoderdataPython
91809
#!/usr/bin/env python import numpy as np def ltr_parts(parts_dict): # when we flip image left parts became right parts and vice versa. This is the list of parts to exchange each other. leftParts = [ parts_dict[p] for p in ["Lsho", "Lelb", "Lwri", "Lhip", "Lkne", "Lank", "Leye", "Lear"] ] rightParts = [ p...
StarcoderdataPython
1616651
import os import json import glob from flask import Flask, jsonify from flask_cors import cross_origin from skedulord.common import HEARTBEAT_PATH, SKEDULORD_PATH def create_app(): app = Flask(__name__, static_folder="templates", static_url_path="") @app.route("/") def static_file(): return app...
StarcoderdataPython
3231650
# @@@ START COPYRIGHT @@@ # # 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...
StarcoderdataPython
3398111
from flask_restful import Resource, reqparse, request from flask_restful import fields, marshal_with, marshal from .model import UserBook from app import db from app import api from utilities import responseSchema response = responseSchema.ResponseSchema() manga_parser = reqparse.RequestParser() manga_parser.add_argum...
StarcoderdataPython
3253978
<filename>api/database/models.py from tortoise import fields from tortoise.models import Model class Region(Model): id = fields.IntField(pk=True) name = fields.CharField(60, unique=True) dates: fields.ManyToManyRelation["Date"] = \ fields.ManyToManyField( "models.Date", related_name="...
StarcoderdataPython
3241032
import sys class tee(object): ''' A file-like object that duplicates output to two other file-like objects. Thanks to <NAME> for the implementation: http://shallowsky.com/blog/programming/python-tee.html ''' def __init__(self, _fd1, _fd2): self.fd1 = _fd1 self.fd2 = _fd2 ...
StarcoderdataPython
4801786
from jd.api.base import RestApi class StockForListBatgetRequest(RestApi): def __init__(self,domain='gw.api.360buy.com',port=80): RestApi.__init__(self,domain, port) self.sku = None self.area = None def getapiname(self): return 'biz.stock.forList.batget'
StarcoderdataPython
3252730
import json import django.test from .user import UserMixin class Client(django.test.Client): def patch_json(self, path, data=None, **kwargs): return self.patch(path, **self._json_kwargs(data, kwargs)) def post_json(self, path, data=None, **kwargs): return self.post(path, **self._json_kwarg...
StarcoderdataPython
32693
<reponame>savarin/algorithms lookup = [ (10, "x"), (9, "ix"), (5, "v"), (4, "iv"), (1, "i"), ] def to_roman(integer): # """ """ for decimal, roman in lookup: if decimal <= integer: return roman + to_roman(integer - decimal) return "" def main(): print...
StarcoderdataPython
112275
#!/usr/bin/env python # -*- coding:utf-8 -*- import time import unittest import uiautomator2 as u2 import uiautomator2.ext.ocr as ocr import random from utx import * class TestCase(unittest.TestCase): @classmethod def setUpClass(cls): cls.d = u2.connect() cls.d.set_orientation('natural') ...
StarcoderdataPython
3218647
# Instructions # Use the Airflow context in the pythonoperator to complete the TODOs below. Once you are done, run your DAG and check the logs to see the context in use. import datetime import logging from airflow import DAG from airflow.models import Variable from airflow.operators.python_operator import PythonOpera...
StarcoderdataPython
1652712
# Copyright 2015 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. import os from fetcher.dependency import Dependency, target_name_from_path class MojomFile(object): """Mojom represents an interface file at a given loc...
StarcoderdataPython
1742969
<reponame>asellappen/python-libarchive-c """ This is a modified version of <NAME>'s pure-Python implementation of PEP 383: the "surrogateescape" error handler of Python 3. This code is released under the Python license and the BSD 2-clause license Source: misc/python/surrogateescape.py in https://bitbucket.org/haypo/...
StarcoderdataPython
161895
<gh_stars>1-10 from sqlalchemy import create_engine engine = create_engine('sqlite:///todo.db?check_same_thread=False') from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String, Date from datetime import datetime Base = declarative_base() class task(Base): __tablenam...
StarcoderdataPython
42345
<gh_stars>1-10 from contextlib import contextmanager from warnings import warn from .conflict import ordering, ambiguities, super_signature, AmbiguityWarning import inspect import sys class Dispatcher(object): """ Dispatch methods based on type signature Use ``multipledispatch.dispatch`` to add implementatio...
StarcoderdataPython
3217739
<reponame>ver228/cell_localization<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Aug 17 16:46:42 2018 @author: avelinojaver """ #import multiprocessing as mp #mp.set_start_method('spawn', force=True) from ..flow import collate_simple from ..utils import save_checkpoint from ..evaluat...
StarcoderdataPython
199613
<reponame>Eve-ning/reamber_base_py<gh_stars>1-10 from __future__ import annotations from typing import List, Dict, Any import pandas as pd from reamber.base.Property import list_props from reamber.base.lists.notes.HitList import HitList from reamber.quaver.QuaHit import QuaHit from reamber.quaver.lists.notes.QuaNote...
StarcoderdataPython
71618
# ============================================================================ # Copyright 2021 The AIMM team at Shenzhen Bay Laboratory & Peking University # # People: <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, # <NAME>, <NAME>, <NAME>, <NAME>, <NAME> # # This code is a part of Cybertron-Code package. # # The Cyb...
StarcoderdataPython
194890
<reponame>guardian-network/hydra """ Classes in this file are standalone because we don't want to impose a false hierarchy between two classes. That is, inheritance may imply a hierarchy that isn't real. """ class Settings(object): kExactTestBias = 1.0339757656912846e-25 kSmallEpsilon = 5.684341886080802e-14...
StarcoderdataPython
88978
class ListView: __slots__ = ['_list'] def __init__(self, list_object): self._list = list_object def __add__(self, other): return self._list.__add__(other) def __getitem__(self, other): return self._list.__getitem__(other) def __contains__(self, item): return self....
StarcoderdataPython
1733710
from django import forms import json from ..models.reviewer import Reviewer from ..models.applicant import Applicant from ..models.review import Review from ..models.metric import Metric class ReviewForm(forms.Form): def __init__(self, *args, **kwargs): self.instance = kwargs.pop('instance') su...
StarcoderdataPython
1613934
<gh_stars>0 import shutil from pathlib import Path from tempfile import TemporaryDirectory from typing import Mapping import pytest from _pytest.capture import CaptureFixture from _pytest.tmpdir import TempdirFactory from freezegun import freeze_time from prance import ValidationError from datamodel_code_generator.__...
StarcoderdataPython
4818254
import os import sys import time # Create new process pid = os.fork() # Print text c = 'p' if pid == 0 else 'c' if pid == 0: sys.exit(0) while True: time.sleep(1) sys.stderr.write(c)
StarcoderdataPython
4828957
#!/bin/env python3 # coding=utf-8 from dns_restful.main import main if __name__ == '__main__': main(debug=True)
StarcoderdataPython
1664461
# buildifier: disable=module-docstring # buildifier: disable=function-docstring def exercise_the_api(): _var6 = configuration_field("foo", "bar") # @unused exercise_the_api() def transition_func(settings): """A no-op transition function.""" return settings my_transition = transition(implementation = tra...
StarcoderdataPython
3321713
from transformers import pipeline unmasker = pipeline('fill-mask', model='roberta-base') result = unmasker("Hello I'm from africa and <mask>.") print(result)
StarcoderdataPython
1696412
<filename>tests/test_client.py """Tests for clovek_ne_jezi_se.Client""" import builtins from copy import deepcopy from clovek_ne_jezi_se.client import Client from clovek_ne_jezi_se.agents import HumanPlayer from clovek_ne_jezi_se.game_state import ( MoveContainer, BoardSpace, EMPTY_SYMBOL ) class TestClient: ...
StarcoderdataPython
1662068
<reponame>bbfrederick/capcalc<filename>capcalc/utils.py #!/usr/bin/env python # # Copyright 2016-2019 <NAME> # # 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.apach...
StarcoderdataPython
84799
from beetl.task_datasets import BeetlSleepTutorial, BeetlSleepSource ds = BeetlSleepTutorial() path = ds.download() # Load all subject data X, y, info = ds.get_data() # Assume source group is subject 0-4, target group is subject 5-7, # and subject 8,9 are from target group for testing. X_source_train, y_source_trai...
StarcoderdataPython
3380511
<filename>02.py # Day 2: http://adventofcode.com/2016/day/2 inp = [ 'RLRLLLULULULUUDUULULRDDLURURDDLDUUDDLRDDUUUDDRUDLRRDDUDUUDULUDRDULRUDRULRDRUDLDDULRRDLDRLUDDLLDRDDDUDDLUDUDULDRLLDRLULRLURDLULRUUUDRULLUUDLRDLDDUDRRRLDLRUUURRLDDRRRURLLULDUULLDRLRDLLDURDLDDULLDDLDLUURRRURLRURLLRRDURLDUDDLULUUULULLLDRRRRRLULRDUDUR...
StarcoderdataPython
167321
from flask_testing import TestCase from unit_tests.utilities import Utilities from unittest.mock import MagicMock, patch from maintain_frontend import main from maintain_frontend.dependencies.session_api.session import Session from maintain_frontend.constants.permissions import Permissions from maintain_frontend.models...
StarcoderdataPython
149951
<reponame>HeliumEdu/platform from django import forms from django.contrib.admin import ModelAdmin from django.contrib.auth import admin, password_validation from django.contrib.auth import get_user_model from django.contrib.auth.forms import UserChangeForm, UserCreationForm from django.core import exceptions from rest_...
StarcoderdataPython
176311
from sklearn import tree; Test_data = [[]]
StarcoderdataPython
1715396
<reponame>synapticarbors/pysumma import os import re import json import pkg_resources from .option import BaseOption from .option import OptionContainer METADATA_PATH = pkg_resources.resource_filename( __name__, 'meta/decisions.json') with open(METADATA_PATH, 'r') as f: DECISION_META = json.load(f) clas...
StarcoderdataPython
1660582
import time from pyrazine.typing.lambda_client_context import LambdaClientContext from pyrazine.typing.lambda_cognito_identity import LambdaCognitoIdentity class LambdaContext(object): """ Models the context object passed to the function handler by AWS Lambda. To be used mainly for typing and testing pur...
StarcoderdataPython
3320688
"""Tests for the static document.""" import unittest from grow.documents import static_document from grow.pods import pods from grow import storage from grow.testing import testing class StaticDocumentTestCase(unittest.TestCase): """Test the static document.""" def setUp(self): self.dir_path = testi...
StarcoderdataPython
1798896
<gh_stars>0 #!/usr/bin/python import crypt import random import sys import getpass pwd = getpass.getpass() ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" chars = [] for i in range(16): chars.append(random.choice(ALPHABET)) salt = "".join(chars) print crypt.crypt(pwd, salt)
StarcoderdataPython
3334998
import os from invoke import task, Collection, run @task def info(c): """Prints info about the templating engine""" print("Welcome to qtemplate - https://github.com/QsonLabs/qtemplate")
StarcoderdataPython
1609009
<filename>pygem/massbalance.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 3 14:00:14 2020 @author: davidrounce """ # External libraries import numpy as np #import pandas as pd # Local libraries #from oggm import cfg #from oggm import utils from oggm.core.massbalance import MassBalanceModel...
StarcoderdataPython
4821278
<gh_stars>0 import flask_login as login from flask import Blueprint, Flask, Markup, redirect, request, url_for from redata.ui_admin.utils import ( BaseRedataView, JSONField, grafana_url_formatter_fun, table_details_link_formatter, ) class ChecksTableView(BaseRedataView): can_delete = False ca...
StarcoderdataPython
3371315
""" You are given an integer, N. Write a program to determine if N is an element of the Fibonacci Sequence. The first few elements of fibonacci sequence are 0,1,1,2,3,5,8,13.... A fibonacci sequence is one where every element is a sum of the previous two elements in the sequence. The first two elements are 0 and 1. ...
StarcoderdataPython
147741
"""Tests the `session` module in stand-alone mode.""" ######################################## # Dependencies # ######################################## import parent # noqa F401 import mph from fixtures import logging_disabled from pytest import raises from platform import system fr...
StarcoderdataPython
1772494
import pendulum class Clock(object): @classmethod def today(cls, tz="UTC"): return pendulum.today(tz=tz).date() @classmethod def now(cls, tz="UTC"): return pendulum.now(tz=tz)
StarcoderdataPython
31946
<reponame>Terence-Guan/Python.HackerRank<gh_stars>10-100 line = input() print(line)
StarcoderdataPython
3291058
<reponame>xNovax/RoomScout<gh_stars>10-100 from django.contrib.auth import get_user_model from django.test import TestCase from houses.models import House from utils.models import HouseImage from utils.streetview import load_house_image class StreetViewTestCase(TestCase): def setUp(self): User = get_use...
StarcoderdataPython
146057
<gh_stars>0 #!/usr/bin/env python3 '''djs setup file''' from setuptools import setup, find_packages from os.path import abspath, dirname, join from io import open root_dir = abspath(dirname(__file__)) short_description = '''A framework for varying model parameters and automating concurrent usage of the Wrf-hydro/Nat...
StarcoderdataPython
1620676
<filename>tracker/cli/setup.py from os import rename from os.path import exists from os.path import join from pathlib import Path from re import IGNORECASE from re import match from sys import exit from click import BadParameter from click import Choice from click import echo from click import option from click import...
StarcoderdataPython
40888
<filename>Kivy/gui/crud.py from kivy.app import App from kivy.uix.boxlayout import BoxLayout class Principal(BoxLayout): pass class Crud(App): def build(self): return Principal() Crud().run()
StarcoderdataPython
3209992
<filename>zookeeper/scripts/createServerList.py #!/usr/bin/python import argparse parser = argparse.ArgumentParser(prog='serverList') parser.add_argument('serverName', help='input the zookeeper server general name') parser.add_argument('serverNum', type=int, help='input the zookeeper servers number') parser.add_argume...
StarcoderdataPython
1617195
<reponame>cedadev/vulture # -*- coding: utf-8 -*- """Top-level package for vulture.""" from .__version__ import __author__, __email__, __version__ # noqa: F401 from .wsgi import application # noqa: F401 # Test that cfchecker and vulture versions are th same import cfchecker cf_checker_version = cfchecker.__vers...
StarcoderdataPython
4839309
<gh_stars>0 import numpy as np import torch import torch.nn as nn from skimage.transform import resize from tqdm import tqdm class RISE(nn.Module): """A RISE class that computes saliency maps with RISE. """ def __init__(self, model, input_size, N, p1, gpu_batch=100): super(RISE, self).__init__() ...
StarcoderdataPython
1639227
<reponame>Kyushi/pemoi """Index module. Render the index page.""" from flask import session as login_session, \ render_template from sqlalchemy import desc from pemoi import app from .database_setup import Item from .pmoi_db_session import db_session @app.route('/') @app.route('/index/') def index...
StarcoderdataPython
106181
import numpy as np import SimpleITK as sitk # https://itk.org/SimpleITKDoxygen/html/classitk_1_1simple_1_1CurvatureFlowImageFilter.html#details def curvatureFlowImageFilter(img, verbose=False): imgOriginal = img convertOutput = False if type(img) != sitk.SimpleITK.Image: imgOriginal = sitk.GetIma...
StarcoderdataPython
1730480
<reponame>oilshell/blog-code #!/usr/bin/env python3 """ powerset.py """ from __future__ import print_function import sys # Transcribing Rust code from # https://lobste.rs/s/khbbac/generate_all_things#c_xflsh6 def push_powerset(acc, n): if n == 0: print(acc) else: acc.append(True) push_powerset(acc, n...
StarcoderdataPython
1761399
import pymysql.cursors import itertools connection = pymysql.connect(host='localhost', user='root', password='', db='r2d2visualisation', charset='utf8mb4', cursorclass=pymys...
StarcoderdataPython
1788037
# -*- encoding=utf-8 -*- from elasticsearch import Elasticsearch # 设置索引 index = 'test-index' # 设置type type = 'test-type' # 设置实例 fields fields = ["name"] # 设置别名 name = "index-alias" # mapping 这儿为空,可以自定义设置 mapping = {} es = client = Elasticsearch("localhost:9200") # 创建索引 忽略400错误 es.indices.create(index, ignore=400) ...
StarcoderdataPython
1784415
<filename>answers/hackerrank/Interchange two numbers.py<gh_stars>1-10 #@result Submitted a few seconds ago • Score: 10.00 Status: Accepted Test Case #0: 0s Test Case #1: 0s Test Case #2: 0s Test Case #3: 0s Test Case #4: 0.01s Test Case #5: 0s Test Case #6: 0s Test Case #7: 0s Test Case #8: 0s Test Case #9: 0s # Enter...
StarcoderdataPython
4806354
<gh_stars>10-100 from dask.distributed import Client, LocalCluster import dask.dataframe as dd import dask.array as da import numpy as np import xgboost as xgb # Define the function to be executed on each worker def train(X, y): print("Start training with worker #{}".format(xgb.rabit.get_rank())) # ...
StarcoderdataPython
3331466
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('mail', '0013_auto_20151104_1154'), ] operations = [ migrations.CreateModel( name='AttachmentBlacklist', ...
StarcoderdataPython
3229542
import os import base64 from datetime import ( datetime, timedelta, ) from werkzeug.security import ( generate_password_hash, check_password_hash, ) from flask import url_for from app import db class PaginatedAPIMixin(object): @staticmethod def to_collection_dict(query, page, per_page, endpoin...
StarcoderdataPython
3333835
from __future__ import annotations from importlib.abc import Traversable from importlib.resources import files from logging import Logger, getLogger from typing import Iterator from ..instrset import InstructionSet from ..instrset_parser import parseInstrSet from . import defs def builtinInstructionSetPath(name: st...
StarcoderdataPython
1700398
# Author: <NAME> # Time: 2020-6-6 import torch.utils.data as tud import torch from ..utils import load_from_pickle, processing import cv2 as cv import numpy as np def get_dataset_from_pickle(pkl_path, transforms=None): img_path_list, target_list = load_from_pickle(pkl_path) return MyDataset(img_path_list, ta...
StarcoderdataPython
18889
import os import numpy from numpy import * import math from scipy import integrate, linalg from matplotlib import pyplot from pylab import * from .integral import * def get_velocity_field(panels, freestream, X, Y): """ Computes the velocity field on a given 2D mesh. Parameters --------- panel...
StarcoderdataPython
1744396
<reponame>omkumar01/seo-audit-tool def metaTags(page): meta_data = {} if page.find_all("meta"): tags = page.find_all("meta") for tag in tags: name = tag.get("name") prop = tag.get("property") if name == "viewport": meta_data["viewport"] = tag.g...
StarcoderdataPython
3306969
#!/usr/bin/env # -*- coding: utf-8 -*- """ Copyright 2017-2018 <NAME> 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 l...
StarcoderdataPython
1776806
<reponame>trunko/pirates-hijack # This is where you build your AI for the Pirates game. from joueur.base_ai import BaseAI from colorama import init, Fore, Back, Style from sys import platform import os # <<-- Creer-Merge: imports -->> - Code you add between this comment and the end comment will be preserved between C...
StarcoderdataPython
3313319
<gh_stars>1-10 from enum import Enum class CPUState(Enum): """ SARK CPU States """ DEAD = 0 POWERED_DOWN = 1 RUN_TIME_EXCEPTION = 2 WATCHDOG = 3 INITIALISING = 4 READY = 5 C_MAIN = 6 RUNNING = 7 SYNC0 = 8 SYNC1 = 9 PAUSED = 10 FINISHED = 11 CPU_STATE_12 = 12...
StarcoderdataPython
3224969
import logging import textwrap from datetime import datetime, timedelta from airflow import DAG # noqa from airflow import macros # noqa from airflow.operators.python_operator import PythonOperator # noqa from pyhocon import ConfigFactory from databuilder.extractor.hive_table_metadata_extractor import HiveTableMet...
StarcoderdataPython
1689985
<reponame>Tim232/Python-Things import tensorflow as tf layers = tf.contrib.layers arg_scope = tf.contrib.framework.arg_scope def lrelu(x, leak=0.2, name='lrelu'): return tf.maximum(x, leak*x) def BlockCLayers(inputs, L, in_filters, Growth): c = inputs filters = in_filters for idx in range(L): net = lrelu(layer...
StarcoderdataPython
4825318
import os import types import operator from functools import reduce from collections import OrderedDict from collections.abc import Sequence from ..compiler import Compiler from ..ref import DefnRef, TupleRef from ..compatibility import IntegerTypes from ..bit import Digital from ..clock import Clock, Enable, Reset fro...
StarcoderdataPython
3370960
<reponame>yugangzhang/GitTest # BlueskyMagics were imported and registered in 00-startup.py BlueskyMagics.detectors = [pilatus2M] BlueskyMagics.positioners = [smx,smy,sth,schi,sphi,srot,strans,strans2,stilt,stilt2, DETx,DETy,WAXSx,SAXSx,SAXSy, bsx,bsy,bsphi, camx,camy, armz,armx,armphi,army,armr, bim3y,fs3y,bim4y,bim...
StarcoderdataPython
1709537
# -*- coding: utf-8 -*- """ * Copyright 2015 Alibaba Group Holding Limited * * 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 * * Unl...
StarcoderdataPython
1665708
# Generated by Django 2.1.4 on 2018-12-13 18:20 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('data_sets', '0003_dataset_customer'), ] operations = [ migrations.RenameField( model_name='dataset', old_name='customer_id',...
StarcoderdataPython
188297
""" Lyapunov module ================= Module with the classes of multi-thread the computation of the various `Lyapunov vectors`_ and `exponents`_. Integrate using the `Runge-Kutta method`_ defined in the :mod:`~.integrators.integrate` module. See :cite:`lyap-KP2012` for more details on the Lya...
StarcoderdataPython
3363923
<filename>run.py import requests from PIL import Image, ImageDraw, ImageFont from clients.youtube_client import YouTubeClient IMAGE_INPUT_FILE = './trump_biden.png' IMAGE_OUTPUT_FILE = './trump_biden_generated.png' OPENSANS_FONT_FILE = './fonts/OpenSans-ExtraBold.ttf' YOUTUBE_DATA_API_CREDENTIALS_LOCATION = './creds/...
StarcoderdataPython
62542
from modules.attention import MultiHeadedAttention from modules.encoder import Encoder from modules.decoder import Decoder from modules.encoder_layer import EncoderLayer from modules.decoder_layer import DecoderLayer from modules.embedding import Embeddings from modules.positional_encoding import PositionalEncoding fro...
StarcoderdataPython
1798660
def tester(): print("Testing... 1 2 3....")
StarcoderdataPython
1753788
<reponame>snake-biscuits/bsp_tool_examples import mapcycle import os import struct TF2 = 'E:/Steam/SteamApps/common/Team Fortress 2/tf/maps/' official_maps = mapcycle.load_maplist() def filename_of(filepath): #handles folders with '.' in name but not double extensions e.g. '.bsp.old' if '.' not in filepath: ...
StarcoderdataPython
1643540
<filename>src/core/set.py #!/usr/bin/env python # # # The Social-Engineer Toolkit # Written by: <NAME> (ReL1K) # # import shutil import os import time import re import sys import socket from src.core.setcore import * from src.core.menu import text try: raw_input except: raw_input = input ipaddr = "" me = mod_...
StarcoderdataPython
1690578
''' Population functions. Code from https://github.com/cortex-lab/phylib/blob/master/phylib/stats/ccg.py by <NAME>. Code for decoding by <NAME> ''' import numpy as np import scipy as sp import types from itertools import groupby from sklearn.ensemble import RandomForestClassifier from sklearn.naive_bayes ...
StarcoderdataPython
1767245
class Solution: def busyStudent(self, startTime, endTime, queryTime): ans = 0 for s, e in zip(startTime, endTime): ans += s <= queryTime <= e return ans
StarcoderdataPython
169943
<reponame>sxfang32/meiduo_29<filename>meiduo_mall/meiduo_mall/apps/meiduo_admin/views/spu_view.py<gh_stars>1-10 from rest_framework.response import Response from rest_framework.viewsets import ModelViewSet from rest_framework.generics import ListAPIView from goods.models import SPU, GoodsCategory from meiduo_admin.seri...
StarcoderdataPython
136393
<reponame>huxian123/mindspore<filename>tests/st/probability/test_uncertainty.py # Copyright 2020 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.ap...
StarcoderdataPython
3352173
<reponame>liruifeng-01/nlp_xiaojiang """ 对SequenceToSequence模型进行基本的参数组合测试 Code from: QHDuan(2018-02-05) url: https://github.com/qhduan/just_another_seq2seq """ from utils.mode_util.seq2seq.data_utils import batch_flow_bucket as batch_flow from utils.mode_util.seq2seq.thread_generator import ThreadedGenerator from uti...
StarcoderdataPython
165246
<reponame>anivalogy/project_Anivalogy<gh_stars>0 from django.urls import path ,include from . views import * urlpatterns = [ path('port',port,name='port'), path('projects',projects,name='projects'), path('blog',blog, name='blog'), path('resume',resume, name='resume'), path('callus',callus, name='c...
StarcoderdataPython
4836632
from pathlib import Path from azureml.core import Run import argparse import os def main(args): output = Path(args.output) output.mkdir(parents=True, exist_ok=True) run_context = Run.get_context() input_path = run_context.input_datasets["train_10_models"] for file_name in os.listdir(input_path)...
StarcoderdataPython
1733192
from Puzzle.PuzzlePiece import * from Img.filters import angle_between from Img.Pixel import * import math import numpy as np def rotate(origin, point, angle): """ Rotate the pixel around `origin` by `angle` degrees :param origin: Coordinates of points used to rotate around :param angle: n...
StarcoderdataPython
68271
from django.db import models from django.contrib.auth import get_user_model from django.db.models.expressions import RawSQL from django.utils import timezone class NearbyShelterManager(models.Manager): def with_distance(self, lat: float, lon: float): """ Shelterクエリセットに対してdistanceカラムを追加する ...
StarcoderdataPython
1732415
<filename>Back-End/Python/External Libraries/Flask/Flask_website_examples/05 Question - Answer App/app_query.py # Q_001 # Function ---> Index get_all_qst = '''select questions.id as question_id, questions.question_text, questions.answer_text, askers...
StarcoderdataPython
3383449
import unittest from fearquantlib.wavelib import * class TestBarGreenWaveCnt(unittest.TestCase): def test_fun(self): code = "SH.600703" df = get_df_of_code(code, "2019-09-20", "2019-10-21", KLType.K_30M) df15 = __do_compute_df_bar(df) ct_4 = bar_green_wave_cnt(df15[:-4]) ...
StarcoderdataPython
3224893
<reponame>mjwestcott/pypokertools """ Translating PokerStove-style holecard notation to the 'individual cards' notation used for holecards in pokertools.py. In PokerStove notation (also used by PokerCruncher) Ace-King suited is represented as AKs. Queen-Jack offsuit is QJo. Simple examples: "66" -> ["6c 6d", "6c ...
StarcoderdataPython
1789483
# coding: utf-8 import os import pytest from pathlib import Path @pytest.fixture(scope='session') def root_path(app_root) -> Path: os.environ['project_root'] = str(app_root) return app_root
StarcoderdataPython
3329409
<filename>poopbox/shell/targets.py #!/usr/bin/env python from poopbox.shell.ssh import SSHShellTarget
StarcoderdataPython
1742214
class Biblioteca: def __init__(self,id_usuario,id_juego,nombre_juego,foto_juego): self.id_usuario = id_usuario self.id_juego = id_juego self.nombre_juego = nombre_juego self.foto_juego = foto_juego #MÉTODOS GET def getId_usuario(self): return self.id_usuario def getId_juego(self): return self.id_j...
StarcoderdataPython
3341777
from vk_bot.core.modules.basicplug import BasicPlug import random class Video(BasicPlug): doc = "Поиск видео" command = ("видео",) def main(self): text = " ".join(self.text[1:]) try: video = self.vk2.video.search(q=text, count=50) video = random.choice(video["items"])...
StarcoderdataPython
4821396
from . import PeriorTree import numpy as np def test(): N=int(1e4) ps = np.random.rand(N,3) rs= np.random.rand(N,3)*.05 bbox=np.stack([np.zeros(3),np.ones(3)]) t=PeriorTree(bbox) for i in range(N): p = ps[i] r = rs[i] t.add(p,r,i) pm=(bbox[0]+bbox[1])/2 rm=np.ones...
StarcoderdataPython
3382504
import base64 from Crypto.Cipher import AES from Crypto.Random import get_random_bytes from pkcs7 import PKCS7Encoder class Encrypter(): """Encrypting and decrypting strings using AES""" def __init__(self, key): self.key = key self.encoder = PKCS7Encoder() def get_verifier(self, iv=No...
StarcoderdataPython
1790082
<filename>docs/sphinxext/doxybridge/autosummary/c.py<gh_stars>1-10 """ doxybridge.autosummary.c ~~~~~~~~~~~~~~~~~~~~~~~~ Autosummary handler for c types :copyright: Copyright (c) 2011 The Department of Arts and Culture, The Government of the Republic of South Africa. :license: MIT, ...
StarcoderdataPython