id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
84068
''' Created on 1.12.2016 @author: Darren '''''' Given n, generate all structurally unique BST s (binary search trees) that store values 1...n. For example, Given n = 3, your program should return all 5 unique BST s shown below. 1 3 3 2 1 \ / / / \ \ ...
StarcoderdataPython
1606557
''' 3. Faça um Programa que peça a temperatura em graus Farenheit, transforme e mostre a temperatura em graus Celsius. Dica: C = ( 5 ∗ ( F − 32 ) /9 )'''
StarcoderdataPython
74123
<reponame>Poppins001/Projects # -*- coding: utf-8 -*- """Order related definitions.""" definitions = { "OrderType": { "MARKET": "A Market Order", "LIMIT": "A Limit Order", "STOP": "A Stop Order", "MARKET_IF_TOUCHED": "A Market-if-touched Order", "TAKE_PROFIT": "A Take Profit...
StarcoderdataPython
3245469
#!/usr/bin/env python3 import BrickPi as bp import time bp.BrickPiSetup() # setup the serial port for communication color = bp.PORT_1 #col = [None , "Black","Blue","Green","Yellow","Red","White" ] #used for converting the color index to name bp.BrickPi.SensorType[color] = bp.TYPE_SENSOR_COLOR_RED bp.BrickPiSe...
StarcoderdataPython
1437
import os import numpy as np import pandas as pd from keras.utils import to_categorical from sklearn.model_selection import KFold, train_test_split def load_data(path): train = pd.read_json(os.path.join(path, "./train.json")) test = pd.read_json(os.path.join(path, "./test.json")) return (train, test) ...
StarcoderdataPython
147077
<filename>yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py ############################################################################## # Copyright (c) 2016 <NAME> and others # juan_ <EMAIL> # All rights reserved. This program and the accompanying materials # are made available unde...
StarcoderdataPython
3367726
import bisect class Solution: def recursive(self, nums): if not nums: return -2 if len(nums) == 1: return -1 if len(nums) == 2: if nums[0] > nums[1]: return 0 return -1 if nums[0] < nums[-1]: return -1 ...
StarcoderdataPython
4832384
#!/usr/bin/env python # # Copyright (c) 2001 - 2016 The SCons Foundation # # 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, including # without limitation the rights to us...
StarcoderdataPython
3266929
<gh_stars>0 from django.urls import path from . import views urlpatterns = [ path('', views.home, name='demo-home'), path('ajax/getArticle', views.getArticle, name="getArticle"), path('ajax/getArticlePredictions', views.getArticlePredictions, name="getArticlePredictions"), ]
StarcoderdataPython
3205573
<filename>clustering/centroidspace.py # clusterspace.py ''' Clustering algorithm. ''' # Things to fix ''' Nothing yet :) ''' # Importing dependencies import numpy as np # Code class centroid: def __init__(self, pos): self.pos = pos self.oldpos = [] self.reset() self.labels = [] ...
StarcoderdataPython
3378763
<gh_stars>0 from modeflip.valid_model import Object from modeflip.valid_model.descriptors import String, List, EmbeddedObject from modeflip.utils.valid_model_utils import Integer, Float from modeflip.models.designer import Picture class Garment(Object): gid = Integer(nullable=False) cid = Integer(nullable=False) ...
StarcoderdataPython
3308126
import pytest import raven from raven.models.rv import RV, RVI, Ost, RVFile, isinstance_namedtuple import datetime as dt from collections import namedtuple from .common import TESTDATA from pathlib import Path class TestRVFile: def test_simple_rv(self): fn = list(TESTDATA['raven-hmets'].glob('*.rvp'))[0]...
StarcoderdataPython
1789406
#!/usr/bin/env python import glob for name in glob.glob('grading/*.cl.out'): with open(name, 'r+') as file: text = file.read().replace('/usr/class/cs143/cool', '..') file.seek(0) file.write(text) file.truncate()
StarcoderdataPython
1667902
<reponame>machow/pins-python # flake8: noqa # Set version ---- from importlib_metadata import version as _v __version__ = _v("pins") del _v # Imports ---- from .cache import cache_prune, cache_info from .constructors import ( board_deparse, board_folder, board_temp, board_local, board_github, ...
StarcoderdataPython
3206275
import os tf_version = float(os.environ["TF_VERSION"][:3]) tf_keras = bool(os.environ["TF_KERAS"] == "True") tf_python = bool(os.environ["TF_PYTHON"] == "True") if tf_version >= 2: if tf_keras: from keras_adamw.optimizers_v2 import AdamW, NadamW, SGDW elif tf_python: from keras_adamw.optimiz...
StarcoderdataPython
3327363
<reponame>jkent/pybot # -*- coding: utf-8 -*- # vim: set ts=4 et import re from datetime import datetime from . import config message_re = re.compile( '^(?:' + ':(?P<prefix>' + '(?P<source>[^ !@]+)' + '(?:' + '(?:!...
StarcoderdataPython
4841759
<filename>src/pytest_alembic/plugin/fixtures.py<gh_stars>0 from typing import Any, Dict, Union import alembic.config import pytest import sqlalchemy import pytest_alembic from pytest_alembic.config import Config def create_alembic_fixture(raw_config=None): """Create a new fixture `alembic_runner`-like fixture. ...
StarcoderdataPython
4800109
from byteio import byteio import datetime import io import os import platform import time cloud_name = os.environ.get("CLOUD_NAME", "unknown") instance_type = os.environ.get("CLOUD_INSTANCE_TYPE", "unknown") try: with open('/etc/centos-release', 'r') as file: distro = file.read().replace('\n', '') except ...
StarcoderdataPython
3223893
<reponame>neewy/TinkoffInvestmentsAnalyser import datetime class Currency: RUB = 'RUB' USD = 'USD' EUR = 'EUR' class Operation: class Type: PAY_IN = 'PayIn' PAY_OUT = 'PayOut' BUY = 'Buy' BUY_CARD = 'BuyCard' # direct buy from the debit card SELL = 'Sell' ...
StarcoderdataPython
3214302
import os import sys import threading import socket import time parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, parentdir) import shadowysocket class echoserver(): def __init__(self): self.conn = socket.socket() self.conn.bind(("127.0.0.1", 12300)) ...
StarcoderdataPython
163966
# Program untuk menampilkan belah ketupat print('\n==========Belah Ketupat==========\n') obj_1 = 1 for row_1 in range(6, 0, -1): for col_1 in range(row_1): print(' ', end='') for print_obj_1 in range(obj_1): print('#', end='') obj_1+=2 if row_1 == 1: obj_2 = 9 print('')...
StarcoderdataPython
1723858
<reponame>NThakur20/DeepCT import numpy as np def subword_weight_to_word_weight(subword_weight_str, m, smoothing, keep_all_terms): fulltokens = [] weights = [] for item in subword_weight_str.split('\t'): token, weight = item.split(' ') weight = float(weight) token = token.strip() ...
StarcoderdataPython
3206124
<reponame>bdytx5/tsm import os import glob import sys import cv2 import shutil import argparse out_path = '' count = 0 def dump_frames(vid_path,num_of_videos): # def dump_frames(vid_path): # video = cv2.VideoCapture(vid_path) # vid_name = vid_path.split('/')[-1].split('.')[0] # out_full_path = os.path.joi...
StarcoderdataPython
3232335
<filename>pacote download/Exercicios/ex035-if_else_triangulo.py ''' CORRIGIDO Desenvolva um program que leia o comprimento de três retas e diga ao usuário se elas podem ou não formar um triângulo. Para construir um triângulo é necessário que a medida de qualquer um dos lados seja menor que a soma das medidas dos outros...
StarcoderdataPython
1694365
import numpy as np import matplotlib.pylab as pl ############################################################## # Minibatch related functions ############################################################## def mini_batch(data, weights, batch_size): """ Select a subset of sample uniformly at random without re...
StarcoderdataPython
1645050
<reponame>KingMikeXS/dl for crit in range(2,100): dmg = crit*0.7+100 if crit > 92: crit = 92 wpdmg = (crit+7)*0.85+100 print crit, dmg, wpdmg, wpdmg/dmg print '------------' for crit in range(2,100): dmg = crit*0.9+100 if crit > 92: crit = 92 wpdmg = (crit+7)*1.05+100 p...
StarcoderdataPython
190829
<gh_stars>0 import pygame from random import randint import os class cactus: models = [os.path.join('assets', 'cactusBig0000.png'), os.path.join( 'assets', 'cactusSmall0000.png'), os.path.join('assets', 'cactusSmallMany0000.png')] size = [(30, 60), (20, 40), (60, 40)] def __init__(self, posX, po...
StarcoderdataPython
3274050
<reponame>jlopez0591/SIGIA from import_export import resources from import_export.admin import ImportExportModelAdmin from django.contrib import admin from ubicacion.models import * class SedeResource(resources.ModelResource): class Meta: model = Sede class FacultadResource(resources.ModelResource): ...
StarcoderdataPython
3307979
# import sys import argparse import os from struct import * parser = argparse.ArgumentParser(description='Pack yq6500 image.') parser.add_argument('file', nargs='+') parser.add_argument('-d', dest='debug', action='store_true', default=False) parser.add_argument('-w', dest='binfile') args = parser.parse_args() BASE=0...
StarcoderdataPython
1606872
#!/usr/bin/env python3.6 # -*- coding=utf-8 -*- from contextlib import redirect_stdout import io from pecan import program from pecan.settings import settings def run_file(filename, expected_output): orig_quiet = settings.is_quiet() settings.set_quiet(True) f = io.StringIO() with redirect_stdout(f):...
StarcoderdataPython
39885
""" Unit test script for pyeto.thornthwaite.py """ import unittest import pyeto class TestThornthwaite(unittest.TestCase): def test_monthly_mean_daylight_hours(self): # Test against values for latitude 20 deg N from Bautista et al (2009) # Calibration of the equations of Hargreaves and Thornthw...
StarcoderdataPython
49834
from math import ceil from PySide2.QtCore import QRect, QSize, Qt, QAbstractTableModel, QMimeData, QByteArray from PySide2.QtGui import QPainter, QStandardItemModel, QStandardItem, QPen from PySide2.QtWidgets import * from models.constants import PropType, MimeType from views.draftbar_element_view_ui import Ui_DraftE...
StarcoderdataPython
81257
#!/usr/bin/python from __future__ import print_function from difflib import SequenceMatcher from collections import OrderedDict import dicom import sys import os import io try: import cPickle as pkl except ImportError: import pickle as pkl # Proprietary imports: from thicom.components import find_dcm, find_dcmd...
StarcoderdataPython
1799033
<reponame>Scopetta197/chromium #!/usr/bin/env python # Copyright (c) 2011 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from email.MIMEText import MIMEText import logging import os import re import smtplib import sys imp...
StarcoderdataPython
1750159
<reponame>jrStaff/pixiedust # ------------------------------------------------------------------------------- # Copyright IBM Corp. 2017 # # 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
60532
<gh_stars>0 # Generated by Django 3.2.5 on 2022-02-05 12:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('english', '0011_auto_20220204_0123'), ] operations = [ migrations.AddField( model_name='tag', name='root...
StarcoderdataPython
3342117
<reponame>threeguys/skynet-python # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
StarcoderdataPython
4800552
<reponame>Nuwanda7O/404-Final-assignment<filename>nodeW/intelligent/prediction2.0.py<gh_stars>0 import pandas as pd import os import matplotlib.pyplot as plt import numpy as np from sklearn.preprocessing import MinMaxScaler from sklearn.model_selection import train_test_split from tensorflow.keras.callbacks impor...
StarcoderdataPython
3252249
import bson from pymongo import ReturnDocument from pymongo.cursor import Cursor import numpy as np import pandas as pd from config import get_config from logger import get_logger from .db import configdb, metricdb logger = get_logger(__name__, log_level=("ANALYZER", "LOGLEVEL")) config = get_config() app_collect...
StarcoderdataPython
1679390
<reponame>popsonebz/aws-mlops-framework<gh_stars>0 # ##################################################################################################################### # Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # ...
StarcoderdataPython
1645231
<reponame>haltiamreptar/ATCA-Secondary-finder # A library to handle dealing with ATCA MoniCA points. from requests import Session import json from . import errors class monicaPoint: def __init__(self, info={}): self.value = None self.description = None self.pointName = None self.upd...
StarcoderdataPython
1666719
<filename>nn/util.py """ nn.util Utility class for working with t2t """ from tensor2tensor.data_generators import problem class SingleProcessProblem(problem.Problem): """ Mixin to mark a class as using a single process and therefore not needing to override num_generate_tasks or prepare_to_generate ""...
StarcoderdataPython
89038
import os import pytest import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') @pytest.mark.parametrize("installed_packages", [ ("httpd"), ("mod_ssl"), ]) def test_packages_installed(host, installed_pa...
StarcoderdataPython
3310129
__version__ = '0.2.18+affirm.2' from client import Client, require_access_token
StarcoderdataPython
3234177
<filename>.ipynb_checkpoints/render-checkpoint.py<gh_stars>1-10 import torch import os import argparse from im2scene import config from im2scene.checkpoints import CheckpointIO # 添加config和nocuda参数 parser = argparse.ArgumentParser( description='Render images of a GIRAFFE model.' ) parser.add_argument('config', type...
StarcoderdataPython
1668679
longest = "" with open(r'Question 51 - 60/file.txt','r') as lines: for line in lines: l = line.split() m = max(l,key=len) if(len(longest)<len(m)): longest = m print("the longest word in file is ",longest)
StarcoderdataPython
3343373
<reponame>mcopik/serverless-benchmarks<filename>sebs/gcp/function.py from typing import cast, Optional from sebs.faas.function import Function, FunctionConfig from sebs.gcp.storage import GCPStorage class GCPFunction(Function): def __init__( self, name: str, benchmark: str, code_p...
StarcoderdataPython
3349211
<gh_stars>0 import jax.random as random import jax.numpy as np import numpy import h5py import itertools from jax.api import jit, grad from jax.config import config from jax.experimental import optimizers from jax.experimental.optimizers import Optimizer # Generate Randomness def random_layer_params(m, n, key, scale=...
StarcoderdataPython
3373107
import cgi gg_admin_url = "http://gluu.local.org:8001" gg_proxy_url = "http://gluu.local.org:8000" oxd_host = "https://gluu.local.org:8553" ce_url = "https://gluu.local.org" api_path = "posts/1" # Kong route register with below host host_with_claims = "gathering.example.com" host_without_claims = "non-gathering.examp...
StarcoderdataPython
3298354
<gh_stars>1-10 """A class to abstract the usage of all endpoints. """ import types import builtins import pandas as pd import portiapy.specs as specs import portiapy.utils as utils import portiapy.axioms as axioms import portiapy.events as events import portiapy.phases as phases import portiapy.select as select impo...
StarcoderdataPython
1716969
<filename>tests/test_collections.py import pytest from mlconfig.collections import AttrDict def test_attrdict_init(): d = AttrDict(a=1, b=2) assert d.a == 1 assert d.b == 2 def test_attrdict_flat(): data = {'a': 0, 'b': {'c': 1, 'd': {'e': 2, 'f': 3}}} d1 = AttrDict(data).flat() d2 = {'a':...
StarcoderdataPython
3324791
<filename>server/ui_tabs/playlist_tab.py import wx class PlaylistEditFrame(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent) wx.StaticText(self, -1, "This page for editing/formatting playlists", (20, 20)) def update(self, args): """Input to this method is the json...
StarcoderdataPython
1740595
import sys import py from pypy.translator.test.snippet import try_raise_choose from pypy.rlib.rarithmetic import r_uint, ovfcheck, ovfcheck_lshift from pypy.rpython.test.test_exception import BaseTestException from pypy.translator.llvm.test.runtest import * class TestLLVMException(LLVMTest, BaseTestException): de...
StarcoderdataPython
3303512
<reponame>linshaoyong/leetcode<gh_stars>1-10 class Solution(object): def robotSim(self, commands, obstacles): """ :type commands: List[int] :type obstacles: List[List[int]] :rtype: int """ directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] x, y, m, di = 0, 0, 0, ...
StarcoderdataPython
3228257
#score_scraper.py #i'm not trying to pay for jacked transcriptions of liscenced works #Zoe, 2020 from bs4 import BeautifulSoup from PyPDF2 import PdfFileMerger import requests import cairosvg import img2pdf import re import os import sys if (len(sys.argv) == 1): score = input("Enter the musecore url for the sco...
StarcoderdataPython
3218368
<reponame>maximilianschaller/genforce # python3.7 """Contains the runner for StyleGAN.""" import os import sys from .base_gan_runner import BaseGANRunner sys.path.append(os.getcwd()) from idinvert_pytorch.utils.inverter import StyleGANInverter __all__ = ['FourierRegularizedStyleGANRunner'] class FourierRegularizedS...
StarcoderdataPython
1616301
from articleScraper import getElTiempoArticles newArticles = getElTiempoArticles() print("Title:\n%s\n" % newArticles[0]['title']) print("Text:\n%s\n" % newArticles[0]['text']) print("Summary:\n%s\n " % newArticles[0]['summary'])
StarcoderdataPython
92411
<filename>setup.py import zcov import os from setuptools import setup, find_packages # setuptools expects to be invoked from within the directory of setup.py, but it # is nice to allow: # python path/to/setup.py install # to work (for scripts, etc.) os.chdir(os.path.dirname(os.path.abspath(__file__))) setup( n...
StarcoderdataPython
95477
from . import benchmark from . import statistics
StarcoderdataPython
3201011
import logging from . import mixin from . import core from . import Constructs from .decorators import ( _display_or_return, _inplace_enabled, _inplace_enabled_define_and_cleanup, _manage_log_level_via_verbosity, ) logger = logging.getLogger(__name__) class Domain(mixin.FieldDomain, mixin.Contain...
StarcoderdataPython
47242
import os import struct def readFile(path): if not os.path.isfile(path): raise FileNotFoundError else: with open(path, 'r') as file: source = file.read() return source def cleaner(source): lines = source.split('\n') for i in range(len(lines)...
StarcoderdataPython
3382185
<filename>test/libcxx/test/target_info.py<gh_stars>1-10 import locale import platform import sys class TargetInfo(object): def platform(self): raise NotImplementedError def system(self): raise NotImplementedError def platform_ver(self): raise NotImplementedError def platform_...
StarcoderdataPython
1735035
<gh_stars>1-10 from customuser.tests.custom_user import *
StarcoderdataPython
1780885
<filename>rdtools/test/energy_from_power_test.py import pandas as pd import numpy as np from rdtools import energy_from_power import pytest @pytest.fixture def times(): return pd.date_range(start='20200101 12:00', end='20200101 13:00', freq='15T') @pytest.fixture def power(times): return pd.Series([1.0, 2.0...
StarcoderdataPython
84044
<filename>ku/gnn_layer/core.py from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf from tensorflow.python.keras import backend as K from tensorflow.python.keras.layers.merge import _Merge from tensorflow.python.keras.l...
StarcoderdataPython
3390039
import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from ._spider import spiderplot def format_data(mode, x, y): if mode=="arrays": return x, y else: d = y.shape[1] cols = ["case %02d"%i for i in range(d)] df = pd.DataFrame(y, index=x, co...
StarcoderdataPython
1654426
x = 1 answer = 'y' while answer == 'y': answer = input('Keep going?') x = x*2 print(x)
StarcoderdataPython
179754
<gh_stars>0 #!/usr/bin/env python3 # coding: utf-8 import argparse import os import pickle ''' Load specified pickled data object (produced by gp_baseline) and Get all non-obsolete terms for the specified tax_id. -n directory where the pickle files are -d data set prefix (e.g., 'egid') -t tax id; default...
StarcoderdataPython
1787545
<reponame>ad4529/Printer_Detection<filename>Training/correct_final_anns.py import os os.chdir('/home/abhisek/Desktop/keras-yolo3/model_data') with open('coco_reduced_v3.txt', 'r') as f: lines = f.readlines() f.close() lines = [l.strip('\n') for l in lines] cnt = 0 for i in lines: vals = i.split() vals = ...
StarcoderdataPython
3294438
<gh_stars>10-100 from os import mkdir from bottle import route, get, request, static_file, run from settings import PORT, DIR_CACHE, DIR_GRAPH from crypkograph import render_graph @route('/') @route('/index.html') def serve_html(): return static_file('index.html', '.') @route('/static/<filename:path>') def se...
StarcoderdataPython
1612168
<reponame>remicalixte/integrations-core # (C) Datadog, Inc. 2010-present # All rights reserved # Licensed under Simplified BSD License (see LICENSE) import pytest from datadog_test_libs.win.pdh_mocks import initialize_pdh_tests, pdh_mocks_fixture # noqa: F401 from datadog_checks.dotnetclr import DotnetclrCheck from d...
StarcoderdataPython
1770364
from scipy import signal from PIL import Image import cv2 import numpy import math import imageio # Locating the image. If the image is not same then change to relative address. usedImage = '../../Images/test.jpg' # Opening the image into an array img = numpy.array(Image.open(usedImage).convert("L")) imageio.imwrite(...
StarcoderdataPython
1776884
<reponame>AngelOnFira/megagame-controller from rest_framework import renderers from .views import TeamViewSet # team_list = TeamViewSet.as_view({ # 'get': 'list', # 'post': 'create' # }) # urlpatterns = format_suffix_patterns([ # path('', api_root), # path('snippets/', snippet_list, name='snippet-lis...
StarcoderdataPython
3276533
<filename>jsonclasses/modifiers/tocap_modifier.py """module for tocap modifier.""" from __future__ import annotations from typing import Any, TYPE_CHECKING from .modifier import Modifier if TYPE_CHECKING: from ..ctx import Ctx class ToCapModifier(Modifier): """capitalize string""" def transform(self, ctx...
StarcoderdataPython
170391
<gh_stars>0 #!/usr/bin/env python # addapted from gather_key_oauth2.py included with https://github.com/orcasgit/python-fitbit import cherrypy import os import sys import threading import traceback import webbrowser from base64 import b64encode from fitbit.api import FitbitOauth2Client from oauthlib.oauth2.rfc6749.er...
StarcoderdataPython
4834054
<filename>university_system/users/views.py from django.shortcuts import redirect, render from django.contrib import messages from .forms import RegisterForm, ChangePasswordForm, MyInfoForm from .decorators import check_login @check_login def register(request): if request.method == "POST": form = RegisterF...
StarcoderdataPython
74659
<gh_stars>1000+ import json from typing import Dict, Optional import logging from rich.logging import RichHandler from ciphey.iface import Checker, Config, ParamSpec, T, registry @registry.register class JsonChecker(Checker[str]): """ This object is effectively a prebuilt quorum (with requirement 1) of com...
StarcoderdataPython
1606276
<gh_stars>0 import numpy as np import matplotlib.pyplot as plt from matplotlib import image as mpimg from PIL import Image from PIL import ImageFilter from scipy.ndimage.interpolation import rotate import os import sys def dist(x1, y1, x2, y2): return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** (1/2) def add_dot(x, base...
StarcoderdataPython
40345
import logging from pyramid.httpexceptions import HTTPNotImplemented from pyramid.renderers import render, render_to_response log = logging.getLogger(__name__) class RestView(object): renderers = {} def __init__(self, request): self.request = request self.params = request.params se...
StarcoderdataPython
3353006
# -*- coding: utf-8 -*- """ Script to create user files (user-config.py, user-fixes.py) """ __version__ = '$Id$' import os, sys, codecs, re base_dir = '' console_encoding = sys.stdout.encoding if console_encoding is None or sys.platform == 'cygwin': console_encoding = "iso-8859-1" def listchoice(clist = [], me...
StarcoderdataPython
1773164
"""Main module to process the GrandPy Bot application. """ from app import app
StarcoderdataPython
36150
from sklearn.metrics import r2_score y_true = [3, -0.5, 2, 7] y_pred = [2.5, 0.0, 2, 8] r2=r2_score(y_true, y_pred) print(r2) y_true = [5,6,7,8] y_pred = [-100,524,-1,3] r2=r2_score(y_true, y_pred) print(r2) r2_
StarcoderdataPython
4814929
from bs4 import BeautifulSoup import urllib2,re, requests, os from prettytable import PrettyTable x = PrettyTable() html = urllib2.urlopen("https://app.wodify.com/Schedule/PublicCalendarListView.aspx?tenant=3920").read() soup = BeautifulSoup(html,"lxml") table = soup.find('table', attrs={'class': 'TableRecords'}) ...
StarcoderdataPython
3358624
import torch from torch import Tensor EPS = torch.tensor(1e-8) @torch.jit.script def dist_iou_ab(box_a: Tensor, box_b: Tensor, eps=EPS): """ Args: box_a: tensor of shape [batch_size, boxes_a, 4] box_b: tensor of shape [batch_size, boxes_b, 4] gamma: float eps: float Origi...
StarcoderdataPython
181428
<filename>src/tree/leetcode_tree_solution.py # -*- coding: utf-8 -*- import operator from collections import deque from sys import maxsize class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def isValidBST(self, root)...
StarcoderdataPython
3351072
MAX_CLIENTS = 500 RESPONSE_TIMEOUT = 2 BROADCAST_INTERVAL = 2 ENCODING = 'UTF-8' CATKIN_WS = '/root/catkin_ws' DISCOVERABLE_TIMEOUT = 0.2 LISTENER_PORT_PREFIX = 8222 BROADCASTER_PORT_PREFIX = 8111 STATIC_LISTENER_PORT = 8877 QUICK_WAIT_TIMER = 0.05 PUB_TOPIC = 'nearby_robots' SUB_TOPIC = 'coms_listening'
StarcoderdataPython
112918
<filename>at_tmp/model/FUNC/USERINFO/USER_OPT_INFO.py #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/10/31 10:41 # @Author : bxf # @File : USER_OPT_INFO.py # @Software: PyCharm from model.util.TMP_DB_OPT import * from model.FUNC.USERINFO.LOG_IN import * from model.util.TMP_MODEL import * ...
StarcoderdataPython
1689197
<reponame>madeso/build<filename>windows.py #!/usr/bin/env python3 """build script for windows for ride""" import os import subprocess import argparse import typing import json from collections.abc import Callable import buildtools.core as btcore import buildtools.deps as btdeps import buildtools.cmake as btcmake impo...
StarcoderdataPython
3217871
<reponame>Camiloasc1/AlgorithmsUNAL import sys def makeDLinkW(G, n1, n2, W, add = False): if n1 not in G: G[n1] = {} if add: if n2 not in G[n1]: G[n1][n2] = 0 G[n1][n2] += W else: G[n1][n2] = W if n2 not in G: G[n2] = {} return G def solve(G,...
StarcoderdataPython
1726335
#!/usr/bin/env python3 import os from navicatGA.xyz_solver import XYZGenAlgSolver from navicatGA.quantum_wrappers_xyz import geom2ehl from navicatGA.chemistry_xyz import get_alphabet_from_path, get_default_alphabet from chimera import Chimera # For multiobjective optimization we use chimera to scalarize chimera = Chim...
StarcoderdataPython
43711
import datetime import io import json import zipfile from pathlib import Path import pyrsistent import pytest import yaml from aiohttp import web from openapi_core.shortcuts import create_spec from yarl import URL from rororo import ( BaseSettings, get_openapi_context, get_openapi_schema, get_openapi_...
StarcoderdataPython
1735761
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
StarcoderdataPython
3239094
from operator import itemgetter from keras.models import load_model from config import siamese_config from input_handler import create_test_data from input_handler import word_embed_meta_data import pandas as pd path = "data\\combinations\\" true_data = pd.read_csv(path+"governors_true_match.csv",sep=";") false_data =...
StarcoderdataPython
3265264
from time import sleep from EDlogger import logger import json from pyautogui import typewrite, keyUp, keyDown from MousePt import MousePoint from pathlib import Path """ File: EDWayPoint.py Description: Class will load file called waypoints.json which contains a list of System name to jump to. Provides ...
StarcoderdataPython
3283499
from typing import Callable, Sequence, Union, Tuple, List, Optional import os import time import numpy as np import matplotlib import matplotlib.pyplot as plt from qcodes.dataset.measurements import Measurement from qcodes.instrument.base import _BaseParameter from qcodes.dataset.plotting import plot_by_id from qcode...
StarcoderdataPython
3277157
<gh_stars>0 """Holzworth HA7062D phase noise analyzer""" import re import sys import asyncio import itertools from dataclasses import dataclass from unyt import unyt_array from ha7000d.common import HA7000DBase, Subsystem PREFIXES = "YZEPTGMkh_dcmµnpfazy" FACTORS = { "Y": 10 ** 24, "Z": 10 ** 21, "E": 10 *...
StarcoderdataPython
178405
<reponame>welykPereira/pythonExerciciosFaculdade def soma(x1, y1): res = x1 + y1 print('O resultado da soma e {}'.format(res)) x = int(input('Digite um valor!')) y = int(input('Digite um outro valor!')) soma(x, y)
StarcoderdataPython
1638463
import time def sleeper(): while True: # Get user input num = input('How long to wait: ') # Try to convert it to a float try: num = float(num) except ValueError: print('Please enter in a number.\n') continue # Run our time.sle...
StarcoderdataPython
1622430
# Copyright 2017, OpenCensus 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 or agreed to in w...
StarcoderdataPython
1549
<reponame>bibinvasudev/EBI_Project # SCH1101.sh --> JB_SALES_HIERARCHY_FLAG_N_SR.py #************************************************************************************************************** # # Created by : bibin # Version : 1.0 # # Description : # 1. This script will load the data into 'S...
StarcoderdataPython