id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
1973334
<filename>arm_prosthesis/external_communication/core/communication.py<gh_stars>1-10 import logging import os import time import traceback from queue import Queue from arm_prosthesis.config.configuration import Config from arm_prosthesis.external_communication.core.connectors.mqtt_connector import MqttConnector ...
StarcoderdataPython
331067
from django.conf.urls.defaults import * from lifeflow.models import * urlpatterns = patterns('lifeflow.editor.views', (r'^$', 'overview'), (r'^comments/$', 'comments'), (r'^blogroll/$', 'blogroll'), (r'^files/$', 'files'), (r'^authors/$', 'authors'), (r'^authors/create/$', 'create_author'), ...
StarcoderdataPython
4983597
<filename>utils/dataloader_bg.py from torch.utils.data import DataLoader from prefetch_generator import BackgroundGenerator class DataLoaderX(DataLoader): def __iter__(self): return BackgroundGenerator(super().__iter__())
StarcoderdataPython
4886957
<filename>coordinator.py import threading import time from datetime import datetime from operation.os_operations import LinuxOperator from util import MonitorUtility as Mu from util import MonitorConst as Mc from util import KafKaUtility as Ku from util import InfoType class MonitorCoordinator(threading.Thread): ...
StarcoderdataPython
170366
import re from collections import Counter from difflib import unified_diff from typing import List, Optional, Tuple, Union from bx_django_utils.dbperf.query_recorder import SQLQueryRecorder from bx_django_utils.stacktrace import StacktraceAfter def counter_diff(c1, c2, fromfile=None, tofile=None): def pformat(co...
StarcoderdataPython
11242642
from defiwar.dex.aave import Aave from defiwar.dex.compound import Compound from defiwar.dex.dydx import DyDx from defiwar.dex.one_inch import OneInch from defiwar.dex.radar_relay import RadarRelay from defiwar.dex.uniswap import Uniswap from defiwar.dex.zero_x import ZeroX from web3 import Web3, HTTPProvider from def...
StarcoderdataPython
11244847
<filename>treeopt/treeOpt.py import numpy as np import os from pathlib import Path import scipy.optimize as sk_optimize # Import of treeopt submodules import treeopt.sampling as sampling import treeopt.optimize as optimize import treeopt.metamodel as metamodel import treeopt.visualize as visualize class least_squar...
StarcoderdataPython
155479
<reponame>coderlongren/PreliminaryPython #!/usr/bin/python3 # -*- coding: UTF-8 -*- import os print(os.name) # print(os.uname()) windows 上不存在次函数 print(os.environ) print(os.environ.get("PATH")) print(os.environ.get("JAVA_HOME"))
StarcoderdataPython
12810693
x = input("ingrese un numero: ") x = int(x) if x > 0: print("el numero es positivo ") else: print("el numero es negativoN ")
StarcoderdataPython
11372705
from flask import Flask, request, jsonify import pandas as pd from sklearn.neighbors import NearestNeighbors from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.neighbors import NearestNeighbors def recommendation(ingredient_list, calorie, health): # processed dataset df = pd.read_csv("rec...
StarcoderdataPython
3379239
<reponame>linneyr8/1A-Flood-risk-project #determining the N rivers with the greatest number of monitoring stations # from floodsystem.geo import rivers_with_station # From floodstystem.geo import stations_by_river from floodsystem.geo import rivers_by_station_number from floodsystem.stationdata import build_station_l...
StarcoderdataPython
9718419
<reponame>shell2/BIGREST """ BIGREST SDK tests Delete objects created during tests for BIG-IP """ # External Imports # Import only with "import package", # it will make explicity in the code where it came from. import getpass import os # Internal imports # Import only with "from x import y", to simplify the code. fro...
StarcoderdataPython
8066622
# DP(貰うDP) N, K, *h = map(int, open(0).read().split()) dp = [0] * N for i in range(1, N): dp[i] = min(dp[j] + abs(h[i] - h[j]) for j in range(max(0, i - K), i)) print(dp[N - 1])
StarcoderdataPython
11232253
# -*- coding: utf-8 -*- import logging import random from spaceone.core.manager import BaseManager from spaceone.plugin.error import * from spaceone.plugin.manager.supervisor_manager.supervisor_state import * from spaceone.plugin.model.supervisor_model import Supervisor __all__ = [ 'SupervisorManager', 'Pe...
StarcoderdataPython
3278557
<filename>URI onJudge/1017.py # Gasto de Combustível h=int(input()) v=int(input()) print('{:.3f}'.format((h*v)/12))
StarcoderdataPython
1919276
<filename>spotify_net/hit_endpoint_03.py # AUTOGENERATED! DO NOT EDIT! File to edit: 03_hit_endpoint.ipynb (unless otherwise specified). __all__ = ['load_s3', 'prep_frame', 'make_request', 'p_dict', 'cred', 'add_tracks', 'delete_tracks'] # Cell import pandas as pd import requests import boto3 import base64 import jso...
StarcoderdataPython
10567
from jogo import desenha_jogo from random import randint import sys def input_cria_usuario(): usuario = dict() usuario['nome'] = input('Informe o seu nome: ') usuario['pontos'] = 0 usuario['desafiado'] = False return usuario def comeco(j1, j2): j1 = 1 j2 = 2 n= randint(j1,j2) ...
StarcoderdataPython
1652517
<reponame>tditrani/ChallengeProject<filename>twitter_search.py #!/usr/bin/env python import twitter #Get the term to search for search_term = raw_input("Term to search for: ") #Initilize the Api with the necisary info api = twitter.Api(consumer_key='uNzYbptRPxMLQnoZ73daQuPHw', consumer_secret='<KE...
StarcoderdataPython
11303833
def main(): # input N = int(input()) SPs = [list(input().split()) for _ in range(N)] for i in range(N): SPs[i][1] = (-1) * int(SPs[i][1]) # compute SPs_sorted = sorted(SPs, key=lambda x: (x[0], x[1])) for i in range(N): SPs_sorted[i][1] = str((-1)*SPs_sorted[i][1]) name_and_number = [] for i ...
StarcoderdataPython
11315542
""" reimport comments that import-mt.py missed pipenv run python3 -m migrations.import-mt-specific ~/Desktop/beesbuzz_mt.db beesbuzz.biz.db """ import sqlite3 import app import sys from publ import model, entry from pony import orm import arrow mt = sqlite3.connect(sys.argv[1]) isso = sqlite3.connect(sys.argv[2]) ...
StarcoderdataPython
3420955
<filename>tests/types/test_list.py import sys from typing import List, Optional import pytest import strawberry def test_basic_list(): @strawberry.type class Query: names: List[str] definition = Query._type_definition assert definition.name == "Query" assert len(definition.fields) == 1...
StarcoderdataPython
199639
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by <NAME> # Copyright (c) 2016 <NAME> # # License: MIT # """This module exports the PhpCsFixer plugin class.""" from SublimeLinter.lint import Linter, util import pprint class PhpCsFixer(Linter): """Provides an i...
StarcoderdataPython
135929
''' @author: deyan @desc: 获取价格, 计算涨跌幅 ''' import api.stock as st # 获取平安银行的行情数据 日K data = st.get_single_price(code='000001.XSHE', time_frequency='daily', start_date='2020-01-01', end_date='2020-02-01' ) # print(...
StarcoderdataPython
185670
"""Store the classes and fixtures used throughout the tests.""" from pathlib import Path from typing import Any from typing import Callable from typing import Dict from typing import Optional import pytest import toml @pytest.fixture(name="create_tmp_file") def create_tmp_file_fixture(tmp_path: Path) -> Callable[......
StarcoderdataPython
11218208
<reponame>ShenQianwithC/HistomicsTK #!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright 2013 Kitware Inc. # # Licensed under the Apache License, Version 2.0 ( the "License" ); # you may not use this file except in compliance with ...
StarcoderdataPython
318583
# -*- coding:utf-8 -*- from requests import get from requests import codes from time import strftime from time import sleep from time import localtime from crawler import insert_collection def fetch(task_id, keyword, start=1, end=5): """ 通过http://m.weibo.cn/page/pageJson接口获取微博的关键查询结果,并保存结果至mongodb中 :param...
StarcoderdataPython
233609
<gh_stars>0 import unittest import math from search.gradient_descend_optimization import gradient_descend as gd from search.simulated_annealing_optimization import simulated_annealing as sa def costfunc1(config): return sum(config) def costfunc2(config): return math.sin(1.0 / sum(config)) class Test_opti...
StarcoderdataPython
9670256
<filename>index.py #!/usr/bin/env python3 import os from pprint import pprint, pformat from flask import Flask, request, url_for, redirect import spotipy import spotipy.util from spotipy.oauth2 import SpotifyOAuth from redis import StrictRedis from redis_collections import Dict app = Flask(__name__) SCOPE = "user...
StarcoderdataPython
6542122
<filename>src/errors.py class GloboBlockingException(Exception): pass
StarcoderdataPython
5102971
<gh_stars>1-10 # Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. from __future__ import absolute_import from contextlib import contextmanager import sys # Find the best implementation available try: from cStringIO import StringIO except ImportError: from StringIO import StringIO import moc...
StarcoderdataPython
11382217
<filename>bin.py import os import sys import itertools """ Shall deal with Built In functions as Python is a batteries-included language! There are 70+ built in functions """ def oddFilter(x): if x %2 == 0: return False return True def lowFilter(x): if x.islower(): return True return ...
StarcoderdataPython
9688204
from __future__ import absolute_import from __future__ import unicode_literals from django.conf.urls import patterns, url from .views import StripeCheckoutView, StripeSuccessView urlpatterns = patterns( '', url(r'checkout/(?P<pk>\d+)/$', StripeCheckoutView.as_view(), name='assopy-stripe-checkout'), url(r...
StarcoderdataPython
6630505
<filename>Hotel_Management_System_python/Registration.py import Hotel_Management_Software class Registration: def main(self): print("") print("\t\t\t\t\t\t\t\t\tRegistration") print("\t\t\t\t\t\t\t\t\t************") print("") ob=Hotel_Management_Software() g=0...
StarcoderdataPython
3470549
import socket import time from io import BytesIO from random import randint from unittest import TestCase, skip from block import BlockHeader from helper import ( double_sha256, encode_varint, int_to_little_endian, little_endian_to_int, bytes_to_ip, ip_to_bytes, read_varint, ) TX_DATA_TYP...
StarcoderdataPython
5090325
<gh_stars>1-10 def fbx_template_def_bone(scene, settings, override_defaults=None, nbr_users=0): props = OrderedDict() if override_defaults is not None: props.update(override_defaults) return FBXTemplate(b"NodeAttribute", b"LimbNode", props, nbr_users, [False])
StarcoderdataPython
279847
<reponame>parichitran/py-hw<filename>2468_Triangle.py n=raw_input("Enter the value\n") n=int(n) x=0 for i in range(2,n+2): for j in range(1,i): x=x+2 print x, print ""
StarcoderdataPython
3467915
import logging from tin2dem.xml_parser import parse_xml log = logging.getLogger("TIN model") class Surface: def __init__(self): self.min_vertex = [None, None, None] self.max_vertex = [None, None, None] self.vertices = list() self.faces = list() self.surfaces = 0 def ...
StarcoderdataPython
6501671
<reponame>Crouchu/projectDjango from bs4 import BeautifulSoup from bs4 import SoupStrainer import requests import time from decimal import Decimal from statistics import mean # # links =['https://proline.pl/gainward-geforce-rtx-3060-pegasus-12gb-gddr6-471056224-2454-p8077709'] # # c = '' # # if c: # print('es') # d...
StarcoderdataPython
30221
<reponame>mengelhard/cft import numpy as np import pandas as pd import tensorflow as tf import itertools import datetime import os from sklearn.metrics import roc_auc_score from model import mlp, lognormal_nlogpdf, lognormal_nlogsurvival from model_reddit import load_batch from train_reddit import get_files from trai...
StarcoderdataPython
3208121
from spatula import HtmlPage, HtmlListPage, CSS from ..models.committees import ScrapeCommittee class CommitteeDetail(HtmlPage): example_source = "https://www.ncleg.gov/Committees/CommitteeInfo/SenateStanding/1162" def get_role(self, text): if text.endswith("s"): text = text[:-1] ...
StarcoderdataPython
6622780
<reponame>junaidrahim/kiitwifi-speedtest #!/usr/bin/python3 # this is the main script to run the speedtest every 5 minutes import subprocess from datetime import datetime import time while True: timestamp = datetime.now() f = open("/home/junaid/code/other/kiitspeedtest/data.txt", "a") result = subpr...
StarcoderdataPython
9739874
<filename>scripto/__init__.py<gh_stars>0 """ Simple flask application to monitor daily script execution """ from flask import Flask from flask import render_template from flask_sqlalchemy import SQLAlchemy from flask_restless import APIManager from .momentjs import momentjs app = Flask(__name__) # We'll just use SQ...
StarcoderdataPython
11238825
<reponame>impastasyndrome/DS-ALGO-OFFICIAL # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def postorderTraversal(self, root): """ :type root: TreeNode ...
StarcoderdataPython
8004211
<reponame>dzubke/speech-lite # standard library import audioop # third party libraries import numpy as np import pytest # project libraries from speech.utils.signal_augment import tempo_gain_pitch_perturb from speech.utils.wave import array_from_wave from tests.pytest.utils import get_all_test_audio def test_tempo_a...
StarcoderdataPython
9672640
class Event: def __init__(self, transaction): self.timestamp = transaction.header.timestamp self.activity = transaction.method self.args = ";".join(transaction.actions[0].input_["args"][1:]) self.actor = transaction.actions[0].creator self.tx_id = transaction.header.tx_id ...
StarcoderdataPython
8185719
from .recipient import Recipient from .peer import Peer from .bot import Bot from .peer_user import PeerUser __all__ = [ Recipient, Peer, PeerUser, Bot ]
StarcoderdataPython
248801
<reponame>Lexseal/cube-solver import cv2 import numpy as np import os """ Very patchy code to read the colors of a rubics cube into a string of 54 characters. """ colors = np.load("calibration.npy") #print(colors) def match_color(H, S, V): this_color = np.array([H, S, V]) best_match = 0 lowest_diff = 3*25...
StarcoderdataPython
6529637
import logging from FacebookAutomater import * from AudioProcessor import * from SpeechHandling import * import requests import json import pyttsx3 import gi from detect import * from get_posts import * from telegram.ext import Updater, CommandHandler, MessageHandler, Filters flag = 0 # Enable logging logging.basicCon...
StarcoderdataPython
4895920
<reponame>jackie840129/CF-AAN # encoding: utf-8 from .build import build_transforms_ST
StarcoderdataPython
5113346
<reponame>tddawson/conference-tracker # This should be a one-time fix to the LDS.org links #Set up the Django enviornment and import the data models import urllib2 import json import logging import sys import sys, os sys.path.append('app/') os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' from tracker.models import ...
StarcoderdataPython
9762654
<reponame>apollocarlos/our-memories from django.contrib import admin from .models import Location, Photo admin.site.register(Location) admin.site.register(Photo)
StarcoderdataPython
5050421
import sys sys.path.insert(0,'/data/OBlog') from OBlog import app from werkzeug.contrib.fixers import ProxyFix if __name__=='__main__': app.wsgi_app = ProxyFix(app.wsgi_app) app.run(debug=False,threaded=True)
StarcoderdataPython
1602954
''' Created on 2016/01/24 @author: _ '''
StarcoderdataPython
1705578
<reponame>fish-bundles/fish-bundles-web<gh_stars>0 """create bundle and bundle files tables Revision ID: 22377ea227db Revises: <PASSWORD> Create Date: 2014-08-13 22:05:58.835932 """ # revision identifiers, used by Alembic. revision = '22377ea227db' down_revision = '4<PASSWORD>' from alembic import op import sqlalch...
StarcoderdataPython
9776904
<gh_stars>0 # Copyright (c) 2017, <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 law or agreed to i...
StarcoderdataPython
3576814
""" FL Server """ from Model.ModelWrapper import ModelWrapper from ServerClient.FLClientManager import FLClientManager from ClientSelection.ClientSelectionBase import ClientSelectionBase class FLServer: def __init__(self, *, model_name: str, dataset_name: str, client_manager: FLClientManager): """ FL...
StarcoderdataPython
8110383
from __future__ import absolute_import from sentry import analytics class AlertCreatedEvent(analytics.Event): type = 'alert.created' attributes = ( analytics.Attribute('user_id', required=False), analytics.Attribute('default_user_id'), analytics.Attribute('organization_id'), ...
StarcoderdataPython
1745518
<gh_stars>10-100 # Copyright (c) 2012-2018, University of Strathclyde # Authors: <NAME> (Tech-X UK Ltd) # License: BSD-3-Clause import numpy,tables,os,sys from scipy.signal import hilbert import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec #Check input is correct def getMagPhase(h5,xi,yi,component)...
StarcoderdataPython
11334974
<filename>src/extract.py import logging import requests import threading from bs4 import BeautifulSoup from urllib.parse import urljoin from src.fetch import fetch_metadata_from_soup, fetch_urls_from_page logging.basicConfig(filename='app.log', filemode='w', format='%(name)s - %(levelname)s - %(message)s') base_url ...
StarcoderdataPython
3381664
<gh_stars>1-10 # -*- coding: utf-8 -*- #------------------------------------------------------------------------------ # file: $Id$ # auth: <NAME> <<EMAIL>> # date: 2015/12/01 # copy: (C) Copyright 2015-EOT Cadit Inc., All Rights Reserved. #------------------------------------------------------------------------------ ...
StarcoderdataPython
1665106
<filename>cosivina/KernelFFT.py<gh_stars>0 from cosivina.base import * from cosivina.auxiliary import * from cosivina.Element import Element, elementSpec # element implemented without numba, since numba does not currently # offer fft functions class KernelFFT(Element): ''' Connective element performing convolutio...
StarcoderdataPython
6407458
# Copyright 2014 Hewlett-Packard Development Company, L.P. # Copyright 2020-2021 Hewlett Packard Enterprise Development LP # # 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....
StarcoderdataPython
1919540
#!/usr/bin/env python """Optuna Game Parameter Tuner Game parameter tuner using optuna framework. The game can be a chess or chess variants. Parameters can be piece values for evaluations or futility pruning margin for search.""" __author__ = 'fsmosca' __script_name__ = 'Optuna Game Parameter Tuner' __version__ = ...
StarcoderdataPython
8011476
<reponame>cia05rf/async-scrape import asyncio import nest_asyncio import aiohttp import sys import logging import contextlib import pandas as pd from time import sleep from aiohttp.client_exceptions import ServerDisconnectedError, ClientConnectionError from .base_scrape import BaseScrape class AsyncScrape(BaseScra...
StarcoderdataPython
3417112
import os from django.core.management.base import BaseCommand, CommandError from browser.models import * from browser.dataimport.annotator import Annotator class Command(BaseCommand): help = 'For protein sequences from selected genomes uploaded to Django database, this program runs hmmsearch with PFAM and TIGRFAM ...
StarcoderdataPython
4986773
import logging from oaipmh.client import Client from oaipmh.metadata import MetadataRegistry, oai_dc_reader from oaipmh.error import NoRecordsMatchError from .oaiore.reader import oai_ore_reader class OAIPMHClient(object): def __init__(self, url, use_ore=False): self.client = self._initialise_client(url...
StarcoderdataPython
5064652
<gh_stars>0 import os import sys import unittest sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from lcd.display import Display class TestDisplay(unittest.TestCase): def setUp(self) -> None: self.s = Display.unic[Display.space] self.lv = Display.unic[Display.l...
StarcoderdataPython
3281393
<reponame>bellrichm/weather """ The uploader """ # pylint: disable=invalid-name # pylint: enable=invalid-name import json import sys import time import jwt import weewx.restx #from weeutil.weeutil import to_int #import six from six.moves import urllib try: # Python 2 from Queue import Queue except ImportError...
StarcoderdataPython
1857658
# Auto generated configuration file # using: # Revision: 1.19 # Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v # with command line options: Hydjet_Quenched_MinBias_5020GeV_cfi --conditions auto:phase1_2018_realistic --scenario HeavyIons -n 1 --era Run2_2018 --eventcontent RAWSIM...
StarcoderdataPython
1631566
import cv2 trainedDataset=cv2.CascadeClassifier('haarcascade_frontalface_default.xml') video=cv2.VideoCapture('video/WhatsApp Video 2021-08-16 at 6.26.50 PM.mp4') while True: success,frame = video.read() if success==True: gray_v = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) faces = traine...
StarcoderdataPython
117269
<reponame>tonyin/flask-base<filename>app/models/__init__.py from app import db class TimestampMixin(object): created_at = db.Column(db.DateTime, default=db.func.now()) last_updated = db.Column(db.DateTime, server_default=db.func.now(), onupdate=db.func.now()) def get_or_create(model, **kwargs): instance =...
StarcoderdataPython
3321803
<reponame>grubert65/rdb.client #!/usr/bin/env python """The setup script.""" import codecs import os from setuptools import setup, find_namespace_packages ################################################################### DESCRIPTION="Abstract Sql class to be subclassed by drivers" KEYWORDS = [ 'rdb.client',...
StarcoderdataPython
1690364
<filename>examples/plot_incr_kmeans.py<gh_stars>10-100 """ Incremental KMeans ================== In an active learning setting, the trade-off between exploration and exploitation plays a central role. Exploration, or diversity, is usually enforced using coresets or, more simply, a clustering algorithm. KMeans is there...
StarcoderdataPython
3419576
import re class NameString: """Class to generate strings of various cases NameString stores the input string in components. The components are detected by splitting up the input name by single capital letters and underscores. An irregular plural version can be supplied; otherwise an 'es' or 's' ...
StarcoderdataPython
4833053
# -*- coding: utf-8 -*- ''' This code generates Fig. 2 Spatial distribution of climatic and economic impacts introduced by anthropogenic aerosol emissions. by <NAME> (<EMAIL>) ''' import numpy as np import pandas as pd import matplotlib.pyplot as plt from netCDF4 import Dataset from mpl_toolkits.basemap import B...
StarcoderdataPython
1657918
from JumpScale import loadSubModules loadSubModules(__file__, 'JumpScale.baselib')
StarcoderdataPython
3292661
# -*- coding: utf-8 -*- import os import struct import subprocess import shlex from xTool.misc import USE_MAC, USE_WINDOWS, USE_LINUX, USE_CYGWIN def ioctl_GWINSZ(fd): try: import fcntl import termios cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, '1234')) return cr ...
StarcoderdataPython
12849425
<reponame>Apollo-o/Whistle<filename>Tools/Recon/Profile/Phone_Number/atheris.py<gh_stars>0 # Author: O-O # Date: 6/23/2019 # Description: A Simple Reverse Lookup Program. import webbrowser # Generates URLS. # Precondition: A String. # Postcondition: Web-Browser Controller (Opens URLS) def generate_urls(phone_number):...
StarcoderdataPython
4924812
<filename>src/algoritmia/datastructures/sets/intset.py from algoritmia.datastructures.sets import ISet from algoritmia.datastructures.lists import IList class IntSet(ISet): #[intset def __init__(self, it: "Iterable<int>"=[], capacity: "int"=0): if not isinstance(it, IList): it = tuple(it) if ...
StarcoderdataPython
8017342
# coding=utf-8 # /usr/bin/python3 """ 相机标定 """ import cv2 import numpy as np import glob ## 1.找棋盘角点 print("1.找棋盘角点") # 设置寻找亚像素角点的参数,采用的停止准则是最大循环次数30和最大误差容限0.001 criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001) # 阈值 # 棋盘角点数 w = 9 # 宽度方向 10 - 1 h = 6 # 高度方向 7 - 1 # 世界坐标系中的棋盘角点的索引,例如(0,0,0)...
StarcoderdataPython
4824500
# Copyright 2019 DeepMind Technologies 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 by applicable law or agr...
StarcoderdataPython
214228
#!/usr/bin/env python # #---------------------------------------------------------------------- #---------------------------------------------------------------------- # # Generate a signal for testing the # Quick Rolling Spectral Transform (QRST) algorithm. # # Created by <NAME>, author of "The Creative Problem Sol...
StarcoderdataPython
3461541
<gh_stars>1-10 # -*- coding: utf-8 -*- def main(): n, y = map(int, input().split()) for i in range(n + 1): for j in range(n - i + 1): if 9 * i + 4 * j == y // 1000 - n: print(i, j, n - (i + j)) exit() print(-1, -1, -1) if __name__ == '...
StarcoderdataPython
6581257
from typing import Dict, Any, Union, Tuple import tensorflow as tf import tensorflow_hub as hub import numpy as np from .seq_encoder import SeqEncoder from utils.tfutils import write_to_feed_dict, pool_sequence_embedding ## Define constants for hyperparameters ## Embedding Type ELMO = 'elmo' LSTM1 = 'lstm1' LSTM2 =...
StarcoderdataPython
9746872
# Generated by Django 3.1.3 on 2020-11-06 01:21 import django.contrib.postgres.indexes from django.contrib.postgres.operations import BtreeGinExtension from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("crawler", "0003_rssentry"), ] operations = [...
StarcoderdataPython
5171743
<reponame>webbers/dongle.net<gh_stars>1-10 import sys, os def include( file ): file = os.path.abspath( os.path.join( os.path.dirname( __file__ ), file ) ) sys.path.insert( 0, file ) include( '../libs/StLibsPy' )
StarcoderdataPython
9782251
""" Dir Archive """ import os import shutil import logging import subprocess LOG = logging.getLogger(__name__) class DirArchive(object): """ Read, write, access directory archives. Treats a directory like an archive. """ def __init__(self, path, mode=None): """ Initialize a DirA...
StarcoderdataPython
3256549
<reponame>explabs-ai/projectaile<gh_stars>1-10 # Structured def log_(): return def square_(): return def mean_norm(): return def feature_scale(): return
StarcoderdataPython
4954249
# Copyright (c) 2021 PaddlePaddle 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
5164907
from wxpy import * import os import cv2 import dlib import numpy as np import time bot = Bot(console_qr = 1, cache_path = True) myFriend = bot.friends() hat_img = cv2.imread("hat2.png",-1) def add_hat_func(img,hat_img): # 分离rgba通道,合成rgb三通道帽子图,a通道后面做mask用 r,g,b,a = cv2.split(hat_img) rgb_hat = cv2.merge(...
StarcoderdataPython
5173106
import re def isValid(s): brackets = ['{', '}'] for i in brackets: if s.count(i) > 0 or s.count(':') == 0: return False return True if __name__ == '__main__': for i in range(int(input())): s = input() if isValid(s): [print(i) for i in re...
StarcoderdataPython
6565991
""" monodromy/volume.py Helper routines for efficiently calculating the volume of a `Polytope`, presented as a union of `ConvexPolytope`s. """ from monodromy.utilities import bitcount, bit_iteration, bitscatter def bitmask_iterator(mask, determined_bitmask, total_bitcount, negative_bitmasks): """ Yields bit...
StarcoderdataPython
1962785
import glob import json import os from xml.etree import ElementTree import xmltodict from src import find_cardinality from src.utils.file_manipulation import PATH table = [] folder = PATH def run(folder): if os.path.exists(PATH + "\\first_output.xml"): os.remove(PATH + "\\first_output.xml") else: ...
StarcoderdataPython
5006959
<reponame>jayxio/AdvBox<filename>advbox/defences/thermometer_encoding.py #coding=utf-8 # Copyright 2017 - 2018 Baidu Inc. # # 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.a...
StarcoderdataPython
6472904
<reponame>EntySec/HatSploit<gh_stars>100-1000 #!/usr/bin/env python3 # # MIT License # # Copyright (c) 2020-2022 EntySec # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction...
StarcoderdataPython
1780789
<filename>project-video/project1/controllers/manual_wall_following/manual_wall_following.py from controller import Robot def calculate_motor(signal): return (signal/100)*6.28 def run_robot(robot): timestep = 64 #define sensor sensor = [] sensor_name =['ps0', 'ps1', 'ps2'] for i in range(3...
StarcoderdataPython
3487940
''' Leia 2 valores inteiros (A e B). Após, o programa deve mostrar uma mensagem "Sao Multiplos" ou "Nao sao Multiplos", indicando se os valores lidos são múltiplos entre si. Entrada A entrada contém valores inteiros. Saída A saída deve conter uma das mensagens conforme descrito acima. Exemplo de Entrada Exemplo de Saíd...
StarcoderdataPython
3438394
from manim import * class Kinetics(Scene): def construct(self): GREY_BLACK = "#a9a9a9" SILVER = "#C0C0C0" silver_coord= [0,-2,0] silver_size= 0.15 split_width=.1 slit_annot= VGroup(Square(fill_opacity=0.3).set_color(BLACK), Square(0.4, fill_color=WHITE, fill_opacity=...
StarcoderdataPython
186704
from copter import * import sys if (len(sys.argv) < 2): print("Usage: echo_test.py <serial device>") sys.exit(1) buf = "Test string".encode('ascii') c = Copter(sys.argv[1]) c.sendCommand('t', buf) print "Sent", buf while True: cmd = c.recvCommand() if (cmd != None): print cmd.buf.decode('ascii') break ...
StarcoderdataPython
6479133
<reponame>billy1125/THSR_time_space_diagram import json import pandas as pd # 引用套件並縮寫為 pd import numpy as np #自訂class與module import basic_data #處理所有車站基本資訊(Stations.csv) stations = basic_data.stations() #時間轉換(Locate.csv) time_loc = basic_data.time_loc() #找出每一個車次 def find_trains(data, train_no): trains = [] ...
StarcoderdataPython