id
stringlengths
2
8
text
stringlengths
16
264k
dataset_id
stringclasses
1 value
3445404
from django.contrib import admin from django.contrib import messages from rest_framework_api_key.models import APIKey class ApiKeyAdmin(admin.ModelAdmin): list_display = ('id', 'name', 'service', 'created', 'modified') fieldsets = ( ('Required Information', {'fields': ('name', 'service')}), (...
StarcoderdataPython
11327499
<filename>GUI/geo/__init__.py """ A module for gometry, goegebra is the past ! """ from GUI.geo.bezier import Bezier from GUI.geo.basics import Point, Rectangle
StarcoderdataPython
5193753
import cv2 as cv img = cv.imread('Photos/park.jpg') # cv.imshow("Original Image",img) #Gray scaling (B/W) #cv.imshow('Gray Scaled',cv.cvtColor(img,cv.COLOR_BGR2GRAY)) # BGR to HSV #cv.imshow('HSV color space(FULL)',cv.cvtColor(img,cv.COLOR_BGR2HSV_FULL)) # cv.imshow('HSV color space',cv.cvtColor(img,cv.COLOR_BGR2HSV...
StarcoderdataPython
6481538
from django import template register = template.Library() @register.simple_tag def greet_user(message, username): return "{greeting_message}, {user}!!!".format(greeting_message=message, user=username)
StarcoderdataPython
3395982
<gh_stars>10-100 from typing import List, Any import unittest from qtt.instrument_drivers.virtualAwg.settings import SettingsInstrument from qtt.instrument_drivers.virtualAwg.virtual_awg import VirtualAwg from unittest.mock import Mock, call class TestVirtualAwg(unittest.TestCase): def setUp(self) -> None: ...
StarcoderdataPython
3242941
import matplotlib matplotlib.rcParams['pdf.fonttype'] = 42 matplotlib.rcParams['ps.fonttype'] = 42 # matplotlib.rcParams['ps.useafm'] = True # matplotlib.rcParams['pdf.use14corefonts'] = True # matplotlib.rcParams['text.usetex'] = True matplotlib.use('Agg') import matplotlib.pyplot as plot import matplotlib.cm as cm # ...
StarcoderdataPython
6542447
<reponame>revensky/psion from starlette.requests import Request as StarletteRequest from starlette.responses import Response as StarletteResponse from psion.oauth2.models import Request, Response from .base import BaseProvider class StarletteProvider(BaseProvider): async def create_request(self, request: Starle...
StarcoderdataPython
1828091
<reponame>CornerCaseTechnologies/graphene-django-plus import datetime from django.contrib.auth.models import User from graphene_django.utils.testing import GraphQLTestCase from guardian.shortcuts import assign_perm from .schema import schema from .models import ( Project, Milestone, Issue, ) class BaseT...
StarcoderdataPython
11265093
import json import os import uuid import Rhino # type: ignore import rhinoscriptsyntax as rs import Rhino.Geometry as rg import scriptcontext as sc # type: ignore from compas.geometry import Cylinder, Polyhedron from compas.utilities import DataDecoder from compas_rhino.geometry import RhinoMesh from compas_rhino.u...
StarcoderdataPython
11306391
from utils.keypoints_selection import generate_model_kps if __name__ == '__main__': generate_model_kps(path=r'E:\1Downloaded\datasets\LINEMOD_from_yolo-6d\cat', model_name='cat')
StarcoderdataPython
184171
import importlib import os import shutil import logging import sys from pathlib import Path import numba.cuda import psutil import tensorflow as tf from slurmpie import slurmpie def create_directory(file_path, exist_ok=True): if not os.path.exists(file_path): os.makedirs(file_path, exist_ok=exist_ok) ...
StarcoderdataPython
169895
from collections import namedtuple from utils import lerp class RGB(namedtuple('RGB', 'r g b')): """ stores color as a integer triple from range [0, 255] """ class Color(namedtuple('Color', 'r g b')): """ stores color as a float triple from range [0.0, 1.0] """ def rgb12(self): r = int(self.r *...
StarcoderdataPython
4924531
<reponame>TianTcl/TheMatrix # Matrix Loves You : push/cramer.py # Imports from mLib import find, get, identify, var from packages import convert from fractions import Fraction as fnd # Functions def cInput(): print("\nPlease enter expressions below (Variables on the left, real numbers on the right. Only ...
StarcoderdataPython
4908970
def run(n, to): raised_to = n if raised_to == 0: raised_to += 1 run(raised_to, to) elif raised_to <= to: n = str(n) print('' + n + '\n') raised_to = raised_to * 2 run(raised_to, to) if __name__ == '__main__': print("Printing powers of 2 up to 1000") ...
StarcoderdataPython
5090230
<filename>Architecture.py # pylint: disable=missing-docstring from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import re import sys import tarfile from six.moves import urllib import tensorflow as tf import numpy as np import tensorflow.contrib.la...
StarcoderdataPython
8969
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 18 08:40:11 2020 @author: krishan """ def funny_division2(anumber): try: if anumber == 13: raise ValueError("13 is an unlucky number") return 100 / anumber except (ZeroDivisionError, TypeError): ...
StarcoderdataPython
6625869
# Copyright 2019, The TensorFlow Federated Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
StarcoderdataPython
82959
# -*- coding: utf-8 -*- import logging if __name__ == '__main__': logging.basicConfig() _log = logging.getLogger(__name__) import pyxb.binding.generate import pyxb.binding.datatypes as xs import pyxb.binding.basis import pyxb.utils.domutils import os.path xsd='''<?xml version="1.0" encoding="UTF-8"?> <xs:schema xm...
StarcoderdataPython
4862426
<gh_stars>1-10 def direction(from_cell, to_cell): """ Determine which direction to move\n @param from_cell -> Current cell occupied\n @param to_cell -> Destination cell\n @returns -> Direction to move\n """ dx = to_cell[0] - from_cell[0] dy = to_cell[1] - from_cell[1] if dx == 1: ...
StarcoderdataPython
11322232
<reponame>preranaandure/wildlifecompliance<gh_stars>1-10 # -*- coding: utf-8 -*- # Generated by Django 1.10.8 on 2018-03-26 02:29 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('wi...
StarcoderdataPython
1775473
import pytest from utils.helpers import assert_equals from starkware.starknet.compiler.compile import get_selector_from_name @pytest.mark.asyncio async def test_mint_NFTs(owner_factory, erc721_factory, minter_factory, game_factory): #starknet = get_starknet erc721 = erc721_factory admin = owner_factory ...
StarcoderdataPython
383271
# use part function of problem 290 class Solution: def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ def get_p(string): p = [] keys = [] for word in string: if len(keys) == 0: ...
StarcoderdataPython
11369786
#write a program to draw a pentagram import turtle wn = turtle.Screen() gardner = turtle.Turtle() gardner.shape("turtle") for i in range(5): gardner.forward(100) gardner.right(144) gardner.hideturtle() wn.mainloop()
StarcoderdataPython
6573230
#!/usr/bin/python import sys maximum=0 total = 0 Key1 = None name_path1="http://www.the-associates.co.uk" name_file="favicon.ico" for line in sys.stdin: mapping_data = line.strip().split("\t") if len(mapping_data) != 2: continue Key, fullPath = mapping_data if Key1 and Key1 !...
StarcoderdataPython
5074383
<gh_stars>1-10 """Creates and simulates a simple circuit. """ import cirq import numpy as np def main(): q0, q1 = cirq.LineQubit.range(2) circuit = cirq.Circuit(cirq.H(q0), cirq.CNOT(q0, q1), cirq.measure(q0, q1)) simulator = cirq.KnowledgeCompilationSimulator(circuit, dtype=np.complex64) for _ in ra...
StarcoderdataPython
11301125
from sqlalchemy.orm import Session from api import schemas,models from fastapi import HTTPException,status from api.hashing import Hash def create_admin(request:schemas.Admin,db:Session): new_admin = models.Admin(name=request.name,email=request.email,password=<PASSWORD>(request.password)) db.add(new...
StarcoderdataPython
5180235
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @Date : Jul-12-19 16:37 # @Author : <NAME> (<EMAIL>) # @Link : http://example.org import os def subset_binary(nums): """ 子集二进制数 最小的len(n)*0 都没有元素,空集 最小的len(n)*1 都有元素,该集合本身 0~2^n-1 根据二进制数,取集合中都元素 """ n = len(nums) ans = [] ...
StarcoderdataPython
3479263
import numpy as np from scipy.special import i0, k0, i1, k1 import time import pybie2d from pybie2d.kernels.high_level.modified_helmholtz import Modified_Helmholtz_Kernel_Apply, Modified_Helmholtz_Kernel_Form from pybie2d.misc.numba_special_functions import numba_k0, numba_k1 print('\n-- Testing numba special function...
StarcoderdataPython
8009923
import re import json import praw import requests import configparser class accountLookup: def __init__(self, username): self.username = username self.playerInfoApi = "https://playerdb.co/api/player/minecraft/" self.header = {'User-agent': f'This code is associated with the reddit bot /u...
StarcoderdataPython
5035820
<gh_stars>1-10 """ Face related processing class: 1. Face alignment 2. Face landmarks 3. ... """ import numpy as np import dlib from utils.proc_vid import parse_vid from utils.face_utils import shape_to_np from tqdm import tqdm class FaceProc(object): def __init__(self): # Set up dlib face detector and...
StarcoderdataPython
6442933
""" Functions and decorators supporting the {{app_name}} command line interface. """ from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter _ARGS = None PARSER = ArgumentParser() PARSER.add_argument("--log-level", type=str, help="level of detail during logging", ch...
StarcoderdataPython
6409582
""" Author: <NAME> Date: 09-18-2020 Description: Script for visualizing magnetic bottles. An assumption is made that bottles are driven by locations where Br changes sign. Current use case is to check coil-shifted DS map for GA requested changes. """ import os import numpy as np import pandas as pd import lmfit as lm i...
StarcoderdataPython
11386283
<reponame>w0rp/w0rpzone import json from io import BytesIO from unittest import mock from django.core.files.base import File from django.core.files.storage import FileSystemStorage from django.test import TestCase from django.urls import reverse as url_reverse from .util import create_author class UploadTestCase(Te...
StarcoderdataPython
9743047
<reponame>scil/sqlalchemy-mixins-for-starlette # noinspection PyPep8Naming class classproperty(object): """ @property for @classmethod taken from http://stackoverflow.com/a/13624858 """ def __init__(self, fget): self.fget = fget def __get__(self, owner_self, owner_cls): return ...
StarcoderdataPython
12802224
<filename>oschool/teachings/urls.py from django.urls import path from .views import ( SubjectCreateView, SubjectDetailView, SubjectDeleteView, SubjectListView, LessonListView, LessonCreateView, LessonDetailView, LessonDeleteView, ) app_name = 'teachings' urlpatterns = [ path("subjec...
StarcoderdataPython
162529
<filename>nlabel/importers/csv.py<gh_stars>1-10 import csv import mmap import codecs from nlabel import NLP, Slice from nlabel.nlp.core import Text from .base import Importer as AbstractImporter, Selection from cached_property import cached_property from pathlib import Path from tqdm import tqdm from typing import Li...
StarcoderdataPython
8060056
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
StarcoderdataPython
157827
<filename>crud-flask-demo/service/test/exception.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # 单元测试需要的异常 # wencan # 2019-04-23 from ..abcs import NoRowsAbstractException __all__ = ("NoRowsForTest") class NoRowsForTest(NoRowsAbstractException): '''not found''' pass
StarcoderdataPython
1722553
import unittest from deployment.research_field_classifier import ResearchFieldClassifier from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.linear_model import SGDClassifier class TestResearchFieldClassifier(unittest.TestCase): def test_load_embedding(self): classifier = ResearchFie...
StarcoderdataPython
6488361
# flake8: noqa from .common import ( is_array_like, is_bool, is_bool_dtype, is_categorical, is_categorical_dtype, is_complex, is_complex_dtype, is_datetime64_any_dtype, is_datetime64_dtype, is_datetime64_ns_dtype, is_datetime64tz_dtype, is_datetimetz, is_dict_like, is_dtype_equal, is_extension_arra...
StarcoderdataPython
5099577
# -*- coding: utf-8 -*- """ @date: 2020/11/21 下午3:15 @file: bottleneck.py @author: zj @description: """ from abc import ABC import torch.nn as nn from zcls.model.attention_helper import make_attention_block from zcls.model.layers.split_attention_conv2d import SplitAttentionConv2d """ from 《ResNeSt: Split-Attention...
StarcoderdataPython
3300858
"""Tests for the venstar integration.""" import requests_mock from homeassistant.components.climate.const import DOMAIN from homeassistant.const import CONF_HOST, CONF_PLATFORM from homeassistant.core import HomeAssistant from homeassistant.setup import async_setup_component from tests.common import load_fixture TE...
StarcoderdataPython
3215763
<reponame>simkovicha/virtool<gh_stars>0 # -*- coding: utf-8 -*- # snapshottest: v1 - https://goo.gl/zC4yUc from __future__ import unicode_literals from snapshottest import GenericRepr, Snapshot snapshots = Snapshot() snapshots['TestCreate.test[uvloop-none] 1'] = { 'all_read': True, 'all_write': True, 'c...
StarcoderdataPython
4882929
<filename>S6/CS334-NPL/002b_thread (004b).py # Python code to create threads import threading import time def dummy(): pass def main(): for i in range(5): tid = threading.Thread(target=dummy, args=[]) print (f'Created new thread {tid} {threading.get_ident()}') time.sleep(1) if __name__ == '__main__': main()...
StarcoderdataPython
8173357
from payroll import Payroll payroll_log = {1: Payroll(40, 10), 2:Payroll(30, 10), \ 3: Payroll(20, 10)} print('Hours', 'Rate', 'Pay\n') for p in payroll_log.values(): print(p.hours_worked, p.hourly_rate, p.calculate())
StarcoderdataPython
3342286
# Builtins import os import pathlib import unittest import datetime as dt from harvest.api.paper import PaperBroker from harvest.definitions import * from harvest.utils import * from _util import * class TestPaperBroker(unittest.TestCase): @delete_save_files(".") def test_account(self): """ ...
StarcoderdataPython
3599739
<reponame>savyasachi16/CVE-data-model from docopt import docopt from database import Database from download import Download from parser import Parser from config import GENERIC_FILEPATHS, RECENT_FILEPATH, MODIFIED_FILEPATH class Driver: def __init__(self): self.downloader = Download() self.parser ...
StarcoderdataPython
12828804
<filename>news_collector/news_collector/spiders/minutouno.py import datetime import newspaper import scrapy import locale import datetime locale.setlocale(locale.LC_ALL, "es_AR.utf8") BASE_URL = 'http://www.minutouno.com' class MinutoUnoSpider(scrapy.Spider): name = "m1" def start_requests(self): ...
StarcoderdataPython
4962088
#!/usr/bin/env python3 from bs4 import BeautifulSoup import requests, csv url = 'https://www.seek.co.nz/jobs/in-All-Auckland/full-time?daterange=14&keywords=%22devops%20engineer%22&salaryrange=150000-999999&salarytype=annual&sortmode=ListedDate' request = requests.get(url).text soup = BeautifulSoup(request, 'lxml') j...
StarcoderdataPython
1988719
<gh_stars>1-10 import sys import os import time import pandas as pd import numpy as np import coltools as ct import re def inflect(key): root = key[:-1] if key.endswith("o"): return [root + x for x in ["on", "oj", "ojn"]] elif key.endswith("a"): return [root + x for x in ["aj", "an", "ajn"...
StarcoderdataPython
11277095
"""Test that a Gene Ontology Enrichement Analysis can be run quietly""" import os from goatools.goea.go_enrichment_ns import GOEnrichmentStudyNS from goatools.anno.idtogos_reader import IdToGosReader from goatools.base import get_godag __copyright__ = "Copyright (C) 2010-present, <NAME> al., All rights reserved." RE...
StarcoderdataPython
8172709
<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- # ================================================== # @Time : 2019-06-20 22:59 # @Author : ryuchen # @File : critical.py # @Desc : # ================================================== class CuckooCriticalError(Exception): """Cuckoo struggle in a critic...
StarcoderdataPython
8001169
<gh_stars>1-10 # R_mouth_up_right_geo # R_mouth_down_left_geo # R_mouth_up_left_geo # R_mouth_down_right_geo # L_mouth_down_right_geo # L_mouth_up_right_geo # L_mouth_down_left_geo # L_mouth_up_left_geo # 1, rename current mouth corrective shapes and unparent from mouth_shapes group # 2, dial ctrl to max value(e.g.tx=...
StarcoderdataPython
92196
<gh_stars>0 # -*- coding: utf-8 -*- """Tests for aiida-openmx.""" import os TEST_DIR = os.path.dirname(os.path.realpath(__file__))
StarcoderdataPython
209682
<filename>sloth_toolkit/utilities/extend.py __doc__ = """ A module with the functionality to extend or modify an object.""" from slugify import slugify from . import verify, prope def validate_attribute_name(name): """ Modify a string to become a valid/legal lower case attribute """ name = slugify(name).replace(...
StarcoderdataPython
11346707
<gh_stars>1-10 import googleapiclient.discovery compute = googleapiclient.discovery.build('compute', 'v1') compute.instances().start(project='noqcks', instance='us-east-1-ping', zone='us-east1-c').execute() compute.instances().start(project='noqcks', instance='asia-east1-ping', zone='asia-east1-a').execute() compute....
StarcoderdataPython
12866047
#!/usr/bin/env python """ cc_plugin_eustace.eustace_global_attrs Compliance Test Suite: Check core global attributes in EUSTACE files """ import os from netCDF4 import Dataset # Import base objects from compliance checker from compliance_checker.base import Result, BaseNCCheck, GenericFile # Restrict which vocabs w...
StarcoderdataPython
5179244
<reponame>renovate-bot/sphinx-docfx-yaml # Copyright 2021 Google LLC # # 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...
StarcoderdataPython
9646863
from setuptools import setup, find_packages setup( name = "Milkman", version = "0.1", packages = find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), # Project uses reStructuredText, so ensure that the docutils get # installed or upgraded on the target machine install_requires =...
StarcoderdataPython
3489291
<reponame>xmdy/h9eNi8F5Ut from __future__ import absolute_import import os from celery import Celery os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'application.settings') app = Celery('application') app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks()
StarcoderdataPython
3220882
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class GmapGsnap(AutotoolsPackage): """GMAP: A Genomic Mapping and Alignment Program for m...
StarcoderdataPython
11249254
"""ppm cache get命令的处理.""" from pmfp.utils.remote_cache_utils import SourcePack from pmfp.utils.tools_info_utils import get_cache_dir from .core import cache_get @cache_get.as_main def get_sourcepack(source_pack_string: str) -> None: """从远程指定位置获取资源包. Args: source_pack_string (str): 描述资源包的字符串,格式为"[{hos...
StarcoderdataPython
12856137
# Faça um algoritmo que leia o preço de um produto e mostre o novo preço com um desconto. preco = float(input('Digite o preço atual do produto: R$ ')) desconto = float(input('Digite o valor do desconto (0.X): ')) novopreco = preco * desconto print('O novo preço é R$ {}.'.format(novopreco))
StarcoderdataPython
6584769
<reponame>ws2516/sportsbookProjects ''' Redditor: u/NInjas101 Ask: I want to be able to track a players points rebounds assists over time and come up with last 3 game average, last 5 game average etc ''' import requests import datetime DaysBack = 21 NumGameAverage = 5 tod = datetime.datetime.now() d = datetime....
StarcoderdataPython
5172597
<gh_stars>0 class SpaceAge: # Planet Years in seconds EARTH_YEAR = 31557600.0 MERCURY_YEAR_RATIO = 0.2408467 VENUS_YEAR_RATIO = 0.61519726 MARS_YEAR_RATIO = 1.8808158 JUPITER_YEAR_RATIO = 11.862615 SATURN_YEAR_RATIO = 29.447498 URANUS_YEAR_RATIO = 84.016846 NEPTUNE_YEAR_RATIO = 164....
StarcoderdataPython
8084144
from kgbase import Query import datetime import json # TODO # csv upload # raw import if __name__ == "__main__": # import requests # response = requests.post( # 'https://kgbase.com/kgbase-query', # headers={ # "Accept": "application/json", # "Content-Type": "ap...
StarcoderdataPython
287944
<reponame>entelecheia/eKorpKit<gh_stars>1-10 from .tokenizer.trainer import train_tokenizer
StarcoderdataPython
3322494
<reponame>odoochain/addons_oca from . import project_task from . import project_project
StarcoderdataPython
6532337
<gh_stars>0 """AccountReports API Version 1.0. This API client was generated using a template. Make sure this code is valid before using it. """ import logging from datetime import date, datetime from .base import BaseCanvasAPI from .base import BaseModel class AccountReportsAPI(BaseCanvasAPI): """AccountReports...
StarcoderdataPython
340675
<filename>preDeal/utils.py import datetime import scipy as sp from keras import backend as K def my_logloss(act, pred): epsilon = 1e-15 pred = K.maximum(epsilon, pred) pred = K.minimum(1 - epsilon, pred) ll = K.sum(act * K.log(pred) + (1 - act) * K.log(1 - pred)) ll = ll * -1.0 / K.shape(act)[0] ...
StarcoderdataPython
158541
<gh_stars>1-10 from coralillo.utils import parse_embed def test_parse_embed(): array = ['object'] output = [['object', None]] assert parse_embed(array) == output array = ['object.field'] output = [['object', ['field']]] assert parse_embed(array) == output array = ['object.field', 'foo', ...
StarcoderdataPython
11234931
<reponame>winkste/python_scripts #import from standard library import pprint #generate dictionaries or list d = {'Tim' : 1, 'Struppi' : 2, 'Any' : 3} l = [1,2,3,4,5,6] #prints the data object to the console pprint.pprint(l) pprint.pprint(d) # here the formated print with a variable name to console, could be # also a...
StarcoderdataPython
9673401
<filename>1247_min_swap_to_string_equal.py # You are given two strings s1 and s2 of equal length consisting of letters "x" and "y" only. Your task is to make these two strings equal to each other. # You can swap any two characters that belong to different strings, which means: swap s1[i] and s2[j]. # Return the minim...
StarcoderdataPython
4956175
<reponame>dauden1184/home-assistant """ Support for Tellstick switches using Tellstick Net. This platform uses the Telldus Live online service. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/light.tellduslive/ """ import logging from homeassistant.comp...
StarcoderdataPython
9621867
from __future__ import unicode_literals class DocumentException(Exception): """ Base documents warning """ pass
StarcoderdataPython
8076883
#Section 1: Import and declare variables ##Note, did not import os because I will just be reading the file locally. import re filename = ("raw_data/paragraph_1.txt") #self-explanatory lists wordList = [] #counter is equivalent to word count here counter = 0 ######################################## #Section 2: Rea...
StarcoderdataPython
5187051
<filename>Operators/ExampleFaceLivenessDetectOperator/__init__.py from Operators.ExampleFaceLivenessDetectOperator.FaceLivenessDetectOperator import GeneralMiniFASNetV1SE, \ GeneralMiniFASNetV2
StarcoderdataPython
3491837
# -*- coding: utf-8 -*- # # Copyright 2020 - Swiss Data Science Center (SDSC) # A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and # Eidgenössische Technische Hochschule Zürich (ETHZ). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compli...
StarcoderdataPython
63824
#!/usr/bin/env python # PostgreSQL doesn't allow ADDing columns to a table in a particular position - # because it doesn't really make sense in SQL - # but COPY from CSV **requires** the columns in a specific order # as the fields aren't specified in the source CSV file. # so specify /ALL/ of the fields to import. # ...
StarcoderdataPython
1691177
<reponame>DanielMabadeje/Artificial-Intelligence-Deep-Learning-Machine-Learning-Tutorials<gh_stars>1000+ import argparse from robosat.osm.parking import ParkingHandler from robosat.osm.building import BuildingHandler # Register your osmium handlers here; in addition to the osmium handler interface # they need to supp...
StarcoderdataPython
11312441
<filename>tests/tests.py """tests Provides functions to compile c++ files and for unit testing. """ import site import os.path as pth from nose.tools import eq_ from excentury.command import exec_cmd def build_cpp(name, debug=None): """Compile a file and place it in bin. """ root = site.getuserbase() i...
StarcoderdataPython
78744
<gh_stars>0 import json import tornado.httpclient class PushServerError(Exception): pass class PushServerClient: def __init__(self, *, url, username=None, password=<PASSWORD>): self.client = tornado.httpclient.AsyncHTTPClient() self.username = username self.password = password ...
StarcoderdataPython
5033991
from estimator import Estimator from utils import * class rgbEstimator(Estimator): def __init__(self, ): super().__init__() def fit(self, X, y=None): assert len(X.shape) == 4, RuntimeError("Expected RGB images") assert len(X.shape) == 4, RuntimeError("Expected RGB images") if ...
StarcoderdataPython
3358491
###################################################################################################################### # Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # ...
StarcoderdataPython
8183043
<filename>Python/7 - kyu/7 kyu - Binary Addition.py # https://www.codewars.com/kata/binary-addition/train/python # My solution def add_binary(a,b): return str(bin(a+b))[2:] # ... def add_binary(a,b): return '{0:b}'.format(a + b) # ... def add_binary(a, b): return format(a + b, 'b') # ... de...
StarcoderdataPython
9731115
import sys import traceback from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db.models import get_model class AppNotFoundError(Exception): pass class ClassNotFoundError(Exception): pass def get_class(module_label, classname): """ Dynamically imp...
StarcoderdataPython
6463421
# -*- coding: utf-8 -*- """ Module defines modifier that compresses a stream with lbzip2 """ from psutil import cpu_count from twindb_backup.modifiers.parallel_compressor import ParallelCompressor DEFAULT_THREADS = cpu_count() - 1 class Lbzip2(ParallelCompressor): """ Modifier that compresses the input_strea...
StarcoderdataPython
3355982
#!/usr/bin/env python import rospy from geometry_msgs.msg import PoseStamped from styx_msgs.msg import Lane, Waypoint from scipy.spatial import KDTree from std_msgs.msg import Int32, Bool import numpy as np import math import tf ''' This node will publish waypoints from the car's current position to some `x` distance...
StarcoderdataPython
11364354
<reponame>LegitStack/lazydata<filename>lazydata/config/config.py """ Class to read and manipulate the project's config file """ from pathlib import Path import yaml import os from lazydata.storage.hash import calculate_file_sha256 class Config: def __init__(self, init_dir=Path.cwd()): """ Objec...
StarcoderdataPython
5069216
import re from gwv.dump import Dump from gwv.kagedata import KageData from gwv.validators import Validator from gwv.validators import ErrorCodes error_codes = ErrorCodes( BLANK_LINE="0", # 空行 INVALID_CHAR="1", # 不正な文字 NOT_AN_INT="2", # 整数として解釈できない NONNORMALIZED_NUMBER_EXPRESSION="3", # 不正な数値の表現 )...
StarcoderdataPython
3579221
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 22 18:14:30 2022 @author: victor """ name = input("What's your name? ") print("Hello, " + name + "!")
StarcoderdataPython
5043983
# # Copyright (c) 2019 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # from oslo_log import log as logging from sysinv.common import exception from sysinv.common import utils from sysinv.helm import common from sysinv.helm import elastic LOG = logging.getLogger(__name__) class ElasticsearchHelm(e...
StarcoderdataPython
6412096
"""Instrument sqlite3 to report SQLite queries. ``patch_all`` will automatically patch your sqlite3 connection to make it work. :: from ddtrace import Pin, patch import sqlite3 # If not patched yet, you can patch sqlite3 specifically patch(sqlite3=True) # This will report a span with the default...
StarcoderdataPython
132871
# libraries and data import matplotlib.pyplot as plt import matplotlib.lines as mlines import matplotlib.patches as mpatches import numpy as np import pandas as pd import pprint from tabulate import tabulate def plot_line(X,Y,x_label,y_label,title,legend): # style plt.style.use('seaborn-darkgrid') # line ...
StarcoderdataPython
243357
__author__ = "JJ.sven" import sys import os import day_2.mod2 # from day_1 import var print(sys.path) # 环境变量 # print(sys.argv) # 参数 print(sys.argv[0]) cmd_res = os.system("ls") # 执行shell命令 print(cmd_res) # cmd_res 返回码 cmd_res = os.popen("ls").read() print(cmd_res)
StarcoderdataPython
5150340
""" Copyright 2020 Nvidia Corporation Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Re...
StarcoderdataPython
137451
from qqai.classes import * class DetectFace(QQAIFaceClass): """人脸检测与分析""" api = 'https://api.ai.qq.com/fcgi-bin/face/face_detectface' class DetectMultiFace(QQAIPicClass): """多人脸检测""" api = 'https://api.ai.qq.com/fcgi-bin/face/face_detectmultiface' class FaceCompare(QQAIClass): """人脸对比""" api ...
StarcoderdataPython
150953
<filename>lowest grade.py marksheet = [] scores = [] n = int(input()) for i in range(n): name = input() score = float(input()) marksheet += [[name, score]] scores += [score] li = sorted(set(scores))[1] for n, s in marksheet: if s == li: print(n)
StarcoderdataPython
4901946
import subprocess import os import pandas as pd import numpy as np from datetime import datetime import requests import json def get_john_hopkins(): git_pull = subprocess.Popen( "git pull", cwd = os.path.dirname('C:/Users/hosha/applied_data_science_covid19/data/raw/COVID-19/' ), ...
StarcoderdataPython
8136100
<gh_stars>0 """ File: boggle.py Name: 陳筱涵 ---------------------------------------- TODO: """ # This is the file name of the dictionary txt file # we will be checking if a word exists by searching through it import time FILE = 'dictionary.txt' # Global dictionary = [] word_dic = {} def main(): """ TODO: the user ...
StarcoderdataPython