id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
3288797
<gh_stars>1-10 from src.schema.question.crud import CreateQuestion, UpdateQuestion from src.schema.question.response_example import ( create_response_example, delete_response_example, get_by_id_response_example, get_multi_response_example, update_response_example, )
StarcoderdataPython
4832754
# Realiza un pequeño script en Python que lea dos números M y N a través de la consola, # y que para ellos genere una lista que contenga las primeras M potencias del número N # Crea dos versiones del mismo script, una utilizando ciclos normales, y la otra utilizando listas comprimidas # Versión 2 M = int(input("Valor...
StarcoderdataPython
44626
<reponame>sohje/__flask_psgr<gh_stars>0 import os from sqlalchemy import (create_engine, MetaData, Table, Column, Integer, Text, String, DateTime) from flask import Flask, request, jsonify, g from mock_session import session_info_retriever app = Flask(__name__) # config.DevelopmentConfig -> sqlite://testing.db #...
StarcoderdataPython
3221464
import pathlib from pathlib import Path import numpy as np import pandas from .mockers import CASING_DF, DIRTY_DF, SNAKE_CASED_COLS, generate_test_df TESTING_PATH = pathlib.Path(__file__).parent.absolute() def test_cleanup(): from sheetwork.core.cleaner import SheetCleaner clean_df_path = Path(TESTING_PAT...
StarcoderdataPython
1603624
<filename>using-modules/importing-modules.py # ------------------------------------------------------------------------------------ # Tutorial: importing modules # ------------------------------------------------------------------------------------ # What is a module ? # A module is a file which ends by .py. Very simpl...
StarcoderdataPython
9402
import paddle.fluid as fluid from paddle.fluid.initializer import MSRA from paddle.fluid.param_attr import ParamAttr class MobileNetV2SSD: def __init__(self, img, num_classes, img_shape): self.img = img self.num_classes = num_classes self.img_shape = img_shape def ssd_net(self, scale=...
StarcoderdataPython
3314675
import logging import datetime import parsedatetime from pymongo import MongoClient from .constants import * from .helpers import * from .skills import * class Message: ''' Input:: Message ID: Unique ID of the message User ID: User from whom message received Message: message as received Hookli...
StarcoderdataPython
75156
<gh_stars>0 import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import random as rnd from sklearn import preprocessing ###############파일불러오기 print("file_load...") df = pd.read_csv('AFSNT.csv', engine='python') #############전처리하기 print("pre-processing...") #널제거 #df = df.fillna("n...
StarcoderdataPython
1765778
<gh_stars>0 # coding=utf-8 """ @ license: Apache Licence @ github: invoker4zoo @ author: invoker/cc @ wechart: whatshowlove @ software: PyCharm @ file: text_rank_seg.py @ time: $18-8-14 上午11:48 """ import numpy as np from tool.logger import logger from tool.punct import punct import thulac import sys reload(sys) sys.se...
StarcoderdataPython
3314326
from conans import ConanFile, AutoToolsBuildEnvironment, tools class LibarciveConan(ConanFile): name = "libarchive" version = "3.3.3" license = "https://raw.githubusercontent.com/libarchive/libarchive/master/COPYING" author = "<NAME> <<EMAIL>>" url = "https://github.com/appimage-conan-community/co...
StarcoderdataPython
131452
<filename>test.py # coding: utf-8 f = open('input_names.txt', 'r', encoding='utf-8') content = f.read() f.close() from inference_helper import InferenceHelper infer_helper = InferenceHelper() infer_helper.init(model_path='models/NER_cn_names_artificial_data_0.9830_0.9821_14.h5', mode='name', timeit=False, mute=True) #i...
StarcoderdataPython
1774381
# Send out alerts based on a conditional statement # If there are over 100 potholes, create a message if streets_v_count > 100: # The message should contain the number of potholes. message = "There are {} potholes!".format(streets_v_count) # The email subject should also contain number of potholes subject = "La...
StarcoderdataPython
1635028
<gh_stars>0 ###################################### # Django 模块 ###################################### from django import forms ###################################### # 自定义模块 ###################################### # from .forms import * ###################################### # 用户登录表单 ################################...
StarcoderdataPython
3200693
from boa3.builtin import public from boa3_test.test_sc.import_test.FromImportUserModuleRecursiveImport import from_import_empty_list @public def empty_list() -> list: return from_import_empty_list()
StarcoderdataPython
4833669
<filename>libsortvis/algos/selectionsort.py def selectionsort(lst): for j in range(len(lst)-1, -1, -1): m = lst.index(max(lst[:j+1])) # No, this is not efficient ;) lst[m], lst[j] = lst[j], lst[m] if m != j: lst.log()
StarcoderdataPython
3367687
<filename>tests/layer1/test_layer1_uhd.py<gh_stars>1-10 import pytest @pytest.fixture def ixn_session(api): api.set_config(api.config()) ixn = api.assistant.Session.Ixnetwork return ixn @pytest.mark.l1_manual @pytest.mark.parametrize( "speed", [ "speed_100_gbps", "speed_40_gbps",...
StarcoderdataPython
3200401
<filename>tests/conftest.py<gh_stars>10-100 # -*- coding: utf-8 -*- import sys, os import pytest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from multiset import Multiset, FrozenMultiset @pytest.fixture(autouse=True) def add_default_expressions(doctest_namespace): ...
StarcoderdataPython
156441
<filename>tests/core/test_peers.py import random from pyslab.core.types import Cell from pyslab.core.peers import ( row_peer_cells, column_peer_cells, box_peer_cells, all_peer_cells, ) def test_correct_row_peers(): peer_cols = list(range(9)) random.shuffle(peer_cols) col = peer_cols.pop() ...
StarcoderdataPython
3327034
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Tue Nov 20 12:10:54 2018 @author: thiagoalmeida """ class TabelaGauss(): #fonte: http://www.profwillian.com/calcnum/Legendre.htm n2 = [ [-0.5773502691, 1.0000000000], [0.5773502691, 1.0000000000] ] n3 = [ [-0.7745966692, ...
StarcoderdataPython
3331674
import json from django.urls import reverse from django.contrib import messages from django.utils.encoding import force_text from django.contrib.auth import login, logout from django.utils.http import urlsafe_base64_decode from django.shortcuts import render, get_object_or_404 from django.contrib.auth.mixins import Lo...
StarcoderdataPython
1617530
# Copyright 2018/2019 The RLgraph authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
StarcoderdataPython
1660469
<filename>geoscript/style/color.py import string from java import awt, lang from geoscript.style.expression import Expression from geoscript import util _colors = {} _colors['aliceblue'] = awt.Color(240,248,255) _colors['antiquewhite'] = awt.Color(250,235,215) _colors['aqua'] = awt.Color(0,255,255) _colors['aquamarine...
StarcoderdataPython
1648189
<gh_stars>1-10 from django.db import models from django.utils.translation import gettext_lazy as _ from .types import OTHER_VALUE, Detector, Filter, Method class MethodBooleanField(models.BooleanField): method: Method def __init__(self, method: Method): self.method = method super().__init__(...
StarcoderdataPython
1618637
<reponame>MalikJordan/pyPOM1D # params_pombfm h = 150.0 # Depth [m] # dti = 100.0 # timestep [s] dti = 3600. alat = 45.0 # latitude [degrees] idiagn = 1 # switch between prognostic (idiagn = 0) and diagnostic (idiagn = 1) mode idays = 3600 # length of run [days] # idays = 366 s...
StarcoderdataPython
1793710
<gh_stars>0 import cv2 import mediapipe as mp # FOR CHECKING THE FRAME RATE import time # CREATE A VIDEOCAPTURE OBJECT cap = cv2.VideoCapture(0); # TO DETECT HAND mpHands = mp.solutions.hands # WE HAVE CREATED A MEDIAPIPE 'HANDS' OBJECT, THUS DETECTING HAND WITH HELP OF THE 21 GIVEN POINTS) # PARAMS :...
StarcoderdataPython
1754819
""" Utilities for courses/certificates """ import logging from requests.exceptions import HTTPError from rest_framework.status import HTTP_404_NOT_FOUND from django.conf import settings from django.db import transaction from courses.constants import PROGRAM_TEXT_ID_PREFIX from courses.models import ( CourseRunGrad...
StarcoderdataPython
3320752
from rest_framework import generics, permissions, authentication from . import serializers from . import models from core.permissions import IsAdmin class GetAllCategoriesView(generics.ListAPIView): serializer_class = serializers.MainCategoryListSerializer queryset = models.MainCategory.objects.all().order_b...
StarcoderdataPython
3343392
#!/usr/bin/python3 # coding: utf-8 # This source code is based on japanmap: https://github.com/SaitoTsutomu/japanmap import codecs from cv2 import imread, cvtColor, COLOR_BGR2RGB import json #import matplotlib.pyplot as plt #import matplotlib.dates as dates #import matplotlib.cm as cm import numpy as np import pandas ...
StarcoderdataPython
3300847
<gh_stars>100-1000 # *************************************************************************************** # Title: LabAdvComp/parcel # Author: <NAME> # Date: May 26, 2016 # Code version: 0.1.13 # Availability: https://github.com/LabAdvComp/parcel # ********************************************************************...
StarcoderdataPython
52065
# pylint: disable=no-name-in-module,import-error """ Copyright 2017-2018 ARM 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 Unless required ...
StarcoderdataPython
152715
<filename>simplemathcaptcha/utils.py from __future__ import absolute_import from __future__ import unicode_literals from random import randint, choice from hashlib import sha1 from django.conf import settings from django.utils import six MULTIPLY = '*' ADD = '+' SUBTRACT = '-' CALCULATIONS = { MULTI...
StarcoderdataPython
1610497
import os from setuptools import setup setup( name="words", version="0.0.1", description=("Code Styles Python starter",), license="MIT", keywords="Python", packages=['words'], setup_requires=[ 'pytest-runner', ], tests_require=[ 'pytest', ] )
StarcoderdataPython
185742
<reponame>Ganasagar/migration-tools-repo<gh_stars>0 import base64 import math import os import json import logging as log RACK_TOPOLOGY_TEMPLATE = """ - rack: {} rackLabelValue: {}""" NODE_TOPOLOGY_TEMPLATE = """ - datacenter: {} datacenterLabels: failure-domain.beta.kubernetes.io/region: {}...
StarcoderdataPython
4808108
<gh_stars>100-1000 import argparse import jsonlines parser = argparse.ArgumentParser() parser.add_argument('--dataset', type=str, required=True) parser.add_argument('--include-nei', action='store_true') parser.add_argument('--output', type=str, required=True) args = parser.parse_args() dataset = jsonlines.open(args.d...
StarcoderdataPython
1605846
from spanet.network.jet_reconstruction import JetReconstructionModel
StarcoderdataPython
3282402
<filename>autoattack/fab_pt.py # Copyright (c) 2019-present, <NAME> # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # from __future__ import absolute_import from __future__ import division from __future__ import print_func...
StarcoderdataPython
3350202
# Copyright 2019- Robot Framework Foundation # # 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...
StarcoderdataPython
1687002
import requests from .config import config_value class Github: def __init__(self): self.token = config_value('github', 'token') self.user = config_value('github', 'user') self.email = config_value('github', 'email') self.name = config_value('github', 'name') # https://docs.gith...
StarcoderdataPython
1663751
<reponame>elbuco1/AttentionMechanismsTrajectoryPrediction<filename>src/models/helpers/helpers_evaluation.py from sklearn.preprocessing import OneHotEncoder from scipy.spatial import distance_matrix,distance from scipy.stats import norm from scipy.spatial.distance import euclidean from scipy.stats import wasserstein_di...
StarcoderdataPython
3391832
<filename>ninjadog/utils.py from functools import partial from json import dumps jsonify = partial(dumps, skipkeys=True, default=lambda _: '', ensure_ascii=False)
StarcoderdataPython
670
<reponame>StateOfTheArt-quant/transformerquant #!/usr/bin/env python3 # -*- coding: utf-8 -*- import torch.nn as nn from .single import attention class MultiHeadedAttention(nn.Module): def __init__(self, d_model, nhead, dropout=0.1): super().__init__() assert d_model % nhead ==0 ...
StarcoderdataPython
1743268
<reponame>atac-bham/c10-tools from contextlib import suppress from urllib.parse import urlparse import os from termcolor import colored import click import s3fs from c10_tools.common import C10, FileProgress, fmt_number, fmt_size, \ fmt_table, walk_packets TYPES = ( 'Computer Generated', 'PCM', 'Ti...
StarcoderdataPython
1770285
<gh_stars>0 # # @lc app=leetcode id=90 lang=python3 # # [90] Subsets II # # @lc code=start class Solution: def gen_recur(self, leading_sets: List[List[int]], ns: List[List[int]]) \ -> List[List[int]]: if not ns: return leading_sets all_sets = leading_sets[:] n, c = n...
StarcoderdataPython
35681
<gh_stars>0 """Allow users to access the function directly.""" from egcd.egcd import egcd
StarcoderdataPython
1776493
import numpy as np from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister from qiskit import BasicAer, execute backend1 = BasicAer.get_backend('dm_simulator') backend2 = BasicAer.get_backend('qasm_simulator') options = {} def generator(k): return (np.pi*2)/(2**k) num_of_qubits = 5 q = QuantumRegis...
StarcoderdataPython
1674946
import copy import logging import os from collections import Counter, defaultdict from timeit import default_timer as timer from typing import Any, Dict, List, Tuple import pandas as pd import pyprind import six import torch import torch.nn as nn from sklearn.decomposition import TruncatedSVD from torchtext import dat...
StarcoderdataPython
1681325
import copy from cv2 import log import numpy as np import torch from utils.Fed import FedAvg,FedAvgGradient, FedAvgP from core.mm_fmnist.SGDClient_fm import SGDClient from core.mm_fmnist.SVRGClient_fm import SVRGClient from core.mm_fmnist.Client_fm import Client from core.ClientManage import ClientManage class Clie...
StarcoderdataPython
51573
<filename>crop_type_mapping/ml_crop_cli/ml_crop/utils_data.py import geopandas as gpd import numpy as np import rasterio from rasterio.features import rasterize from rasterstats.io import bounds_window from sklearn.model_selection import train_test_split def crop_classes(train_geo): training_vectors = gpd.read_f...
StarcoderdataPython
3222799
<reponame>luxbe/sledo from typing import Dict import pytest from schema import SchemaError import yaml from sledo.generate.config import validateConfig base_config: Dict = {} with open("tests/resources/config.yaml") as f: base_config = yaml.load(f, Loader=yaml.BaseLoader) def test_validation_no_keys(): wi...
StarcoderdataPython
1670600
import adsk import adsk.core import adsk.fusion import traceback from collections import defaultdict, namedtuple from typing import List from .Fusion360Utilities.Fusion360Utilities import get_app_objects from .Fusion360Utilities.Fusion360CommandBase import Fusion360CommandBase from .Fusion360Utilities import Fusion36...
StarcoderdataPython
1711803
<reponame>tsingqguo/AttackTracker # Copyright (c) SenseTime. All Rights Reserved. from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np import torch import visdom from pysot.core.config import cfg import m...
StarcoderdataPython
62152
<filename>run_evaluation.py<gh_stars>10-100 import sys def append_to_pythonpath(paths): for path in paths: sys.path.append(path) append_to_pythonpath(['/home/koehlp/Dokumente/JTA-MTMCT-Mod/deep_sort_mc/clustering', '/home/koehlp/Dokumente/JTA-MTMCT-Mod/deep_sort_mc', ...
StarcoderdataPython
3395949
<reponame>Delhpi/gittest<filename>main.py import sys print(sys.executable) #再修改一 下 1547现在错误的
StarcoderdataPython
34110
<reponame>monroid/openvino # Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import unittest import numpy as np from extensions.ops.sparse_reshape import SparseReshape from mo.front.common.partial_infer.utils import int64_array from mo.graph.graph import Node from unit_tests.utils.gra...
StarcoderdataPython
57528
# coding=utf-8 import sys import petsc4py petsc4py.init(sys.argv) from pyvtk import * import numpy as np from scipy.io import loadmat from src import stokes_flow as sf from src.stokes_flow import problem_dic, obj_dic from src.geo import * def main_fun(): matname = 'around' if matname[-4:] != '.mat': ...
StarcoderdataPython
3223688
<reponame>falleco/sample-websockets<filename>socketio_django/runserver.py<gh_stars>0 from gevent import monkey monkey.patch_all() import os # from psycogreen.gevent import patch_psycopg os.environ.setdefault("DJANGO_SETTINGS_MODULE", "socketio_django.settings") # patch_psycopg() from django.core.wsgi import get_wsg...
StarcoderdataPython
3249005
# Generated by h2py from /usr/include/sys/fcntl.h O_RDONLY = 0 O_WRONLY = 1 O_RDWR = 2 O_NDELAY = 0x04 O_APPEND = 0x08 O_SYNC = 0x10 O_DSYNC = 0x40 O_RSYNC = 0x8000 O_NONBLOCK = 0x80 O_PRIV = 0x1000 O_CREAT = 0x100 O_TRUNC = 0x200 O_EXCL = 0x400 O_NOCTTY = 0x800 F_DUPFD = 0 F_GETFD = 1 F_SETFD = 2 F_GETFL = 3 F_SETFL =...
StarcoderdataPython
3287041
<reponame>seanmanson/euler import math daysInMonthLeap = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] def isLeapYear(year): return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) curYear = 1901 curMonth = 1 curDay = 1 curWeekday = 2 #tuesd...
StarcoderdataPython
3247332
import os from setuptools import setup # allow setup.py to be run from any path os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) setup( name='tech-inventory-update', version='0.1', author="<NAME>", author_email="<EMAIL>", install_requires=[ 'requests', ...
StarcoderdataPython
192924
<filename>farmbeats-server/soilmoisture.py from grove import adc class SoilMoistureSensor: def __init__(self, pin:int): self.__pin = pin self.__adc = adc.ADC() self.__moisture = -1 def capture_values(self) -> None: self.__moisture = self.__adc.read(self.__pin) @property ...
StarcoderdataPython
1644995
from collections import defaultdict, namedtuple, Counter, deque import csv import collections Player = collections.namedtuple('Stats', 'player, team, position, height, weight, age, pc') baseball_csv = './baseball.csv' fifa_csv = './fifa.csv' def get_baseball_stats(path=baseball_csv): with open(path, encoding='...
StarcoderdataPython
105819
<filename>setup.py #!/usr/bin/env python import setuptools __author__ = "<NAME>" with open("README.md", "r") as f: README = f.read() setuptools.setup( name="sea_nwautomation_meetup_oct_2019", version="2019.09.15", author=__author__, author_email="<EMAIL>", description="Check out some cool no...
StarcoderdataPython
1699961
<gh_stars>0 from flask import request from flask_restful import Resource from flask_jwt_extended import jwt_required, create_access_token, get_jwt_identity, get_raw_jwt from app.utils import str2uuid from app.api.user.models import User, CoffeeHistory from app.api.system.models import SystemSetting from app.security ...
StarcoderdataPython
136118
<gh_stars>1-10 import receive import send def main(): while True: def choice(): ans = input("\tC: Create network\n\tJ: Join network\n\tE:Exit\nPlease enter your choice (C/J/E):") if ans == "C" or ans == "c": send.create_network() elif ans == "J" or ans =...
StarcoderdataPython
1755864
from jira import JIRA import csv import codecs import datetime options = {'server': '*'} jira = JIRA(options, basic_auth=("*", "*")) projects = jira.projects() # list containing all projects # loop to print all of the projects for i in projects: print(i) print("") # Clears the CSV file befo...
StarcoderdataPython
4831006
# Generated by Django 2.1.7 on 2019-05-13 08:38 from django.db import migrations, models import uuid class Migration(migrations.Migration): dependencies = [ ('blog', '0017_auto_20190513_0836'), ] operations = [ migrations.AlterField( model_name='article', name='u...
StarcoderdataPython
1793754
<gh_stars>0 import sub.p13 print('name:' + __name__) # NoneType也属于False print('package:' + (__package__ or 'no package')) print('doc:' + (__doc__ or 'no doc')) print('file:' + __file__) # 被导入的模块 # name:sub.p13 # package:sub # doc: # this is sub.p13 # file:D:\SourceCode\python\zsq.LearningPython\class-py\sub\p13....
StarcoderdataPython
3245935
#!/usr/bin/python # -*- coding: utf-8 -*- import logging # from django.utils.decorators import available_attrs from functools import WRAPPER_ASSIGNMENTS, wraps from django.core.cache import cache as dj_cache from drf_cache.cache_helper import RedisCacheVersion from drf_cache.cache_key import DefaultKeyGenerator lo...
StarcoderdataPython
3363142
<filename>Learner/cvx_learner.py import time import os import sys import torch from torch import optim from Learner.base_learner import BaseLearner from CustomOptimizer.cvx import CVXOptimizer class CVXLearner(BaseLearner): def __init__(self, model, time_data,file_path, configs): super(CVXLearner,self).__in...
StarcoderdataPython
3381548
## ____ _ ____ ## / ___|__ _ ___| |_ _ _ ___ / ___|__ _ _ __ _ _ ___ _ __ ## | | / _` |/ __| __| | | / __| | | / _` | '_ \| | | |/ _ \| '_ \ ## | |__| (_| | (__| |_| |_| \__ \ | |__| (_| | | | | |_| | (_) | | | | ## \____\__,_|\___|\__|\__,_|___/ \____\__,_|_| |_|\__, |\___/|...
StarcoderdataPython
84741
# -*- coding: utf-8 -*- import re import json from pprint import pformat from pynetworking.Feature import Feature try: from collections import OrderedDict except ImportError: # pragma: no cover from ordereddict import OrderedDict class ats_interface(Feature): """ Interface feature implementation for ...
StarcoderdataPython
1603144
#!/usr/bin/env python """ KDE_parse: parse out KDEs for certain taxa Usage: KDE_parse [options] <kde> <taxa> KDE_parse -h | --help KDE_parse --version Options: <kde> Pickled KDE object. ('-' if input from STDIN) <taxa> List of taxa used for parsing (one name per line). ...
StarcoderdataPython
1719956
from threading import Lock from mesh.standard import OperationError, ValidationError from scheme import Boolean, Text from scheme.supplemental import ObjectReference from sqlalchemy import MetaData, Table, create_engine, event from sqlalchemy.engine.reflection import Inspector from sqlalchemy.exc import NoSuchTableEr...
StarcoderdataPython
3270455
<gh_stars>0 from collections import OrderedDict import torch import torch.nn as nn import torch.distributed as dist from openselfsup.utils import print_log from . import builder from .registry import MODELS from openselfsup.datasets import viz_utils import random import wandb # TODO(cjrd) use this across all classes...
StarcoderdataPython
61238
# -*- encoding:utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals
StarcoderdataPython
141077
from __future__ import absolute_import import unittest import os import torch from torchvision import transforms from data import data from data import dataloaders class test_data(unittest.TestCase): def setUp(self): self.path=os.getcwd() + '/data' self.name='cifar10' self.trans= tra...
StarcoderdataPython
3306184
from __future__ import absolute_import from require.require import *
StarcoderdataPython
3212587
<reponame>gitter-badger/LendIt # -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-08-13 16:27 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('website', '0002_remove_lendit...
StarcoderdataPython
1642063
<reponame>FJOQWIERMDNKFAJ/khaiii import json from khaiii import KhaiiiApi target_tags = ['NNG', 'NNP'] def parse(s): api = KhaiiiApi() gen = api.analyze(s) for word in gen: if hasattr(word, 'morphs'): morphs = word.morphs for morph in morphs: yield [morph...
StarcoderdataPython
1665780
from flask import Blueprint, jsonify, make_response, request from flask import current_app from wlan_api.generate import generate_vouchers shop = Blueprint('shop', __name__) # https://pythonise.com/series/learning-flask/working-with-json-in-flask @shop.route('/', methods=["GET"]) def example(): return jsonify...
StarcoderdataPython
3227019
<gh_stars>0 class Solution: # @param s, a string # @return an integer def numDecodings(self, s): codes = {i for i in range(1, 27)} if not s or s[0] not in codes: return 0 s = "0" + s prev, current, nxt = 1, 1, 0 print s for i in range(1, len(s)): ...
StarcoderdataPython
1758269
import time from threading import Lock from .base_metric import BaseMetric from ..stats.moving_average import ExpWeightedMovingAvg class Meter(BaseMetric): """ A meter metric which measures mean throughput and one-, five-, and fifteen-minute exponentially-weighted moving average throughputs. """ ...
StarcoderdataPython
145496
<reponame>gold-standard-phantoms/asldro """ Test data for test_resampling.py """ import numpy as np ROT_X_TEST_DATA = ( ( 0.00, np.array( ( (1.000000, 0.000000, 0.000000, 0.000000), (0.000000, 1.000000, -0.000000, 0.000000), (0.000000, 0....
StarcoderdataPython
1752625
<reponame>drunkwater/leetcode # DRUNKWATER TEMPLATE(add description and prototypes) # Question Title and Description on leetcode.com # Function Declaration and Function Prototypes on leetcode.com #796. Rotate String #We are given two strings, A and B. #A shift on A consists of taking string A and moving the leftmost ch...
StarcoderdataPython
1626942
<gh_stars>0 # -*- coding: utf-8 -*- from __future__ import print_function, absolute_import, division import os import shutil import tempfile import logging import moto from mock import patch, Mock from unittest2 import TestCase import ultimate_source_of_accounts.cli as cli class UploadTest(TestCase): """Test t...
StarcoderdataPython
153735
#!/usr/bin/python3 """Platform for light integration.""" import logging # Import the device class from the component that you want to support from datetime import timedelta from typing import Any, List import homeassistant.util.color as color_util from homeassistant.components.light import ( ATTR_BRIGHTNESS, ...
StarcoderdataPython
73579
<filename>recipes/Python/578637_Wigle_wifi/recipe-578637.py from uuid import getnode import re import requests class WigleAgent(): def __init__(self, username, password): self.agent(username, password) self.mac_address() def get_lat_lng(self, mac_address=None): if mac_ad...
StarcoderdataPython
3290749
<reponame>msabramo/ibehave from behave import given, when, then class BlackHole(object): pass @given('we have {number:d} black holes') def given_blackholes(context, number): context.response = tuple(BlackHole() for _ in range(number)) context.collided = False @given('a big L') def given_big_l(context)...
StarcoderdataPython
1634497
import sys sys.setrecursionlimit(2 ** 8) read = sys.stdin.readline n = int(read()) # 빈 배열을 생성한다. # 초기 값은 빈 공간으로 준다. pattern = [[' '] * n for _ in range(n)] # 시작 점 (0, 0, n)을 준다. # -- recursion 함수 -- # 매개변수 (x, y, multiple) # multiple : 3의 배수 def recursion(cur_x, cur_y, cur_n): # 만약, multiple가 1이라면 현재 위치는 *를 찍...
StarcoderdataPython
33368
class Pattern_Twenty_Six: '''Pattern twenty_six *** * * * * *** * * * * *** ''' def __init__(self, strings='*'): if not isinstance(strings, str): strings = str(strings) for i in range(7): if i i...
StarcoderdataPython
97285
<reponame>chrhenning/posterior_replay_cl<filename>probabilistic/prob_cifar/train_utils.py #!/usr/bin/env python3 # Copyright 2020 <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 # # ...
StarcoderdataPython
3251121
<reponame>honeyhugh/PythonCurso t = 'pedra', 'papel', 'tesoura', 'garrafa', 'mouse', 'livro' for pos in range(0, len(t)): print(f'\nNa palavra {t[pos].upper()} as vogais são: ', end='') for v in t[pos]: if v in 'aeiou': print(v, end=' ')
StarcoderdataPython
1745597
<reponame>iRomi14/drmlib # -*- coding: utf-8 -*- """ Performs some pre-release checks """ import pytest from tests.conftest import perform_once def test_changelog_and_version(accelize_drm): """ Checks if Version match with Git tag and if changelog is up to date. """ perform_once(__name__ + '.test_chan...
StarcoderdataPython
1732299
<reponame>WebPowerLabs/django-trainings<gh_stars>0 from functools import wraps from profiles.models import InstructorProfile from django.http.response import Http404, HttpResponseRedirect from courses.models import Course, Content from lessons.models import Lesson from resources.models import Resource from django.core....
StarcoderdataPython
138660
<filename>blackScreen.py import cv2 from matplotlib import image import numpy as np video = cv2.VideoCapture(0) image = cv2.imread("me.jpeg") while True: ret,frame = video.read() print(frame) frame = cv2.resize(frame,(640,480)) image = cv2.resize(frame,(640,480)) u_black = np.array([104,153,70])...
StarcoderdataPython
3260110
<gh_stars>100-1000 __all__ = ['ttypes', 'constants', 'ReadOnlyScheduler', 'AuroraSchedulerManager', 'AuroraAdmin']
StarcoderdataPython
4804536
<reponame>blakermchale/robot-control #!/usr/bin/env python3 from enum import IntEnum, auto from ament_index_python.packages import get_package_share_directory # Get relative package directories ROBOT_CONTROL_PKG = get_package_share_directory("robot_control") # API's and the simulators they work with API_PAIRS = { ...
StarcoderdataPython
4840761
import hmac import json from base64 import b64encode from hashlib import sha256 from django.conf import settings from django.core.serializers import serialize from django.http import Http404, HttpResponse from django.http.response import JsonResponse from django.shortcuts import render from django.views.generic.base i...
StarcoderdataPython
1646994
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def str2tree(self, s: str) -> TreeNode: def buildTree(s): # find the first left...
StarcoderdataPython
164485
<filename>Python/natas15-chars.py # brute forcing password of natas 15 import requests characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" username = "natas15" password = "<PASSWORD>" user_exists = "This user exists." char_exists = "" for char in characters: url = 'http://natas15.n...
StarcoderdataPython