id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
101380
import math import numpy as np def quaternion_to_rotation_matrix(q): # Original C++ Method defined in pba/src/pba/DataInterface.h qq = math.sqrt(q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3]) qw = qx = qy = qz = 0 if qq > 0: # NORMALIZE THE QUATERNION qw = q[0] / qq qx = q[1]...
StarcoderdataPython
3235175
<reponame>JacopoPan/leetcode-top100-liked-questions """ Runtime: 341 ms, faster than 63.77% of Python3 online submissions for Shuffle an Array. Memory Usage: 19.6 MB, less than 94.64% of Python3 online submissions for Shuffle an Array. """ from typing import List from typing import Optional from random import randint ...
StarcoderdataPython
3377168
from collections import defaultdict from dockerscan import SharedConfig, String class DockerImageInfoModel(SharedConfig): image_path = String() class DockerImageAnalyzeModel(SharedConfig): image_path = String() class DockerImageExtractModel(SharedConfig): image_path = String() extract_path = Stri...
StarcoderdataPython
4819906
#coding:utf-8 #coding:utf-8 import networkx as nx def load_edgelist(file_name): graph = nx.Graph() edges = [] with open(file_name) as file: for line in file: if line.startswith('#'): continue l = line.strip().split() if len(l)==2: ...
StarcoderdataPython
129462
<reponame>cojalvo/Map import os, os.path, datetime, string, errno from maperipy import * import GenIsraelHikingTilesLite # http://stackoverflow.com/questions/749711/how-to-get-the-python-exe-location-programmatically MaperitiveDir = os.path.dirname(os.path.dirname(os.path.normpath(os.__file__))) # App.log('MaperitiveD...
StarcoderdataPython
3224366
<gh_stars>0 from django.db import models from django.contrib.auth.models import User import datetime as dt # Create your models here. class Project(models.Model): title = models.CharField(max_length=30) image = models.ImageField(upload_to='images/') description = models.TextField() link = models.CharFi...
StarcoderdataPython
3384692
# # This software is delivered under the terms of the MIT License # # Copyright (c) 2009 <NAME> <<EMAIL>> # # 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 wi...
StarcoderdataPython
24163
# -*- coding: utf-8 -*- # # Copyright 2020 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
StarcoderdataPython
124529
<gh_stars>1-10 """ `EqualizeStrings <http://community.topcoder.com/stat?c=problem_statement&pm=10933>`__ """ def solution (s, t): out = "" for i in range(len(s)): x = s[i] y = t[i] diff = abs(ord(x) - ord(y)) if diff < 26 / 2: # values are close by, use minimum ...
StarcoderdataPython
1693224
<gh_stars>1-10 import json import requests import configparser class Spider(object): def __init__(self, auth_user, auth_pass, degree): self.step = degree self.cache = ['https://api.github.com/users/' + auth_user + '/followers'] self.auth = { 'user': auth_u...
StarcoderdataPython
3322507
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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 applicab...
StarcoderdataPython
3300582
''' Author: <NAME> Copyright (c) 2020 <NAME> ''' class PriceLookup: def __init__(self): self.prices = {} def add_price(self, ticker, price): if ticker in self.prices: raise Exception(f"Ticker '{ticker}' was already added") self.prices[ticker] = price def get_price(self...
StarcoderdataPython
4828971
<reponame>J3rome/python-uds #!/usr/bin/env python __author__ = "<NAME>" __copyrights__ = "Copyright 2018, the python-uds project" __credits__ = ["<NAME>"] __license__ = "MIT" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __status__ = "Development" from ... import Config from ... import CanTp #from ... import LinT...
StarcoderdataPython
1650624
<filename>rewards/snapshot/nft_snapshot.py from decimal import Decimal, DecimalException from typing import Dict from helpers.constants import BADGER from helpers.enums import BalanceType, Network from rewards.classes.Snapshot import Snapshot from rewards.utils.emission_utils import get_nft_weight from subgraph.querie...
StarcoderdataPython
1671188
# Standard Library import argparse import random import time import uuid # Third Party import mxnet as mx import numpy as np from mxnet import autograd, gluon, init from mxnet.gluon import nn from mxnet.gluon.data.vision import datasets, transforms # First Party from smdebug.mxnet import Hook, SaveConfig, modes def...
StarcoderdataPython
1642401
<filename>tests/test_search_boring.py """Module grouping tests for the boring search module.""" import datetime import pytest from owslib.fes import PropertyIsEqualTo from pydov.search.boring import BoringSearch from pydov.types.boring import Boring from pydov.util import owsutil from tests.abstract import ( Abst...
StarcoderdataPython
1788736
<reponame>pepincho/Python101-and-Algo1-Courses import sys def sum_numbers(): my_file = open(sys.argv[1], "r") numbers = my_file.read().split(' ') numbers_int = [int(x) for x in numbers] sum_numbers = sum(numbers_int) my_file.close() return sum_numbers def main(): print (sum_numbers()) i...
StarcoderdataPython
15448
import unittest from typing import Any from coiny.core import CoinPrice, CoinyQueue, CoinySession, price_now_url, price_task from coiny.utils import NullCoinPrice class HasJson: def __init__(self, data) -> None: self.data = data async def __aenter__(self): return self async def __aexit_...
StarcoderdataPython
89127
#!/usr/bin/env python # coding: utf-8 # In[3]: # DEMO OF WEAK TYPING in PYTHON # int age = 4 <-strongly typed variables, declare type along with id age = 4; # we CANNOT declare a type for variable age print(age) print(type(age)) age = ('calico','calico','himalyian') print(age) print(type(age)) # # Allegheny county...
StarcoderdataPython
15427
from typing import List class Solution: def findOcurrences(self, text: str, first: str, second: str) -> List[str]: ls = text.split() return [c for a, b, c in zip(ls, ls[1:], ls[2:]) if a == first and b == second]
StarcoderdataPython
1658813
class Solution: def fourSum(self, nums: List[int], target: int) -> List[List[int]]: return self.kSum(sorted(nums), target, 4) def kSum(self, nums: List[int], target: int, k: int) -> List[List[int]]: if not nums or nums[0] * k > target or target > nums[-1] * k: return [] if k == 2: retur...
StarcoderdataPython
141708
<filename>gpsr_command_understanding/models/command_predictor.py from typing import List from allennlp.common.util import JsonDict, sanitize from allennlp.data import Instance from allennlp.predictors.predictor import Predictor @Predictor.register('command_parser') class CommandParser(Predictor): """Predictor wr...
StarcoderdataPython
1718221
import argparse import os from pathlib import Path from GUM_Dispenser.GUM_Exceptions import InvalidSourcePathError, ConfigurationNotFoundError, PackageNotFoundError from GUM_Dispenser.GUM_Exceptions import SourceModuleNotFoundError, UserConfirmedInvalidSetup from GUM_Dispenser.GUM_setup_parser import parse_setup ...
StarcoderdataPython
3317796
from PyQt5.QtWidgets import QPushButton, QLineEdit, QMessageBox, QGridLayout, QLabel, QListWidget from PyQt5 import QtWidgets from PyQt5 import uic from src.controllers import MainController from src.assets.Label import Label class Setup(QtWidgets.QDialog): controller : MainController def __init__(self,...
StarcoderdataPython
183566
<gh_stars>0 from ex1.expense_app.models import Expense from ex1.profile_app.models import Profile def get_profile(): return Profile.objects.first() def get_budget_left(): user = Profile.objects.first() expenses = Expense.objects.all() result = user.budget - sum([ex.price for ex in expenses]) ret...
StarcoderdataPython
1742753
#!/usr/bin/env python3 # compare representations of versioned items in OCaml files in a Github pull request import os import sys import shutil import subprocess exit_code = 0 def run_comparison(base_commit, compare_script): cwd = os.getcwd() # create a copy of the repo at base branch if os.path.exists(...
StarcoderdataPython
132375
""" Book: Building RESTful Python Web Services Chapter 3: Improving and adding authentication to an API with Django Author: <NAME> - Twitter.com/gastonhillar Publisher: Packt Publishing Ltd. - http://www.packtpub.com """ from django.contrib.auth.models import User user = User.objects.create_user('kevin', '<EMAIL>', '<P...
StarcoderdataPython
1774232
from .action_scheme import ActionScheme, DTypeString, TradeActionUnion from .continuous_actions import ContinuousActions from .discrete_actions import DiscreteActions from .multi_discrete_actions import MultiDiscreteActions # 交易动作字典 _registry = { 'continuous': ContinuousActions, 'discrete': DiscreteActions, ...
StarcoderdataPython
1786811
<filename>pathutils/utils.py """utils.py Various utilities """ import operator import webbrowser import pandas as pd def sorted_dict_items(d, reverse=False): """Sorted (key, value) pairs by value. """ result = sorted(d.items(), key=operator.itemgetter(1)) if reverse: return result[::-1] ...
StarcoderdataPython
182058
<gh_stars>0 x = y = 0 x = int(input('number: ')) y = bin(x) print('Binary: ', y[2:])
StarcoderdataPython
12035
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from __future__ import division import os import numpy from io import BytesIO from matplotlib import pyplot import requests import torch from PIL import Image from maskrcnn_benchmark.config import cfg from predictor import COCODemo from maskrcnn...
StarcoderdataPython
3336043
<reponame>d4yvie/advent_of_code_2021<filename>Day23/organization_state.py from dataclasses import dataclass from aoc_types import VectorX Rooms = tuple[VectorX, ...] @dataclass(frozen=True) class OrganizationState: energy: int rooms: tuple hallway: tuple = (None,) * 11 def __lt__(self, other): ...
StarcoderdataPython
3398196
""" =========== NH2D fitter: ortho- and para- in the same file, but not modeled together =========== Reference for line params: New line parameters are taken from the recent laboratory work: Melosso et al. (2021) Journal of Molecular Spectroscopy, vol. 377, March 2021, 111431 https://doi.org/10.1016/j.jms.2021.111431...
StarcoderdataPython
1612843
command = input() company_dict = {} while not command == "End": company, user = command.split(" -> ") if not company in company_dict: company_dict[company] = [user] else: if not user in company_dict[company]: company_dict[company].append(user) command = input() ...
StarcoderdataPython
1746130
from .functions import divar_get_phone
StarcoderdataPython
1765416
<filename>generate.py ############################################################################### # Language Modeling on Penn Tree Bank # # This file generates new sentences sampled from the language model # ############################################################################### import argparse import tor...
StarcoderdataPython
3286349
<reponame>ramonakira/piclodio3<gh_stars>100-1000 from collections import OrderedDict from rest_framework import status from rest_framework.reverse import reverse from tests.test_views.test_alarm_clock_view.base import Base class TestList(Base): def setUp(self): super(TestList, self).setUp() self....
StarcoderdataPython
1616906
# -*- coding: utf-8 -*- """ Created on Wed Jun 26 18:29:41 2019 @author: <NAME> """ import cv2 from PIL import Image import matplotlib.pyplot as plt import tools import numpy as np from scipy import ndimage #from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img #%% #images #PS...
StarcoderdataPython
4833866
<reponame>mas-veritas2/veritastool """ Basic fairness measures specific to uplift models. Written by <NAME> and <NAME>, Gradient Institute Ltd. (<EMAIL>). Copyright © 2020 Monetary Authority of Singapore Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance wi...
StarcoderdataPython
114933
<gh_stars>0 #!/usr/bin/env python3 def main(): for i in range(1,11): for j in range(1,11): if(j==10): print(i*j) else: print(i*j, end=" ") if __name__ == "__main__": main()
StarcoderdataPython
55042
# coding=utf-8 # Copyright 2014-2017 F5 Networks 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.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
StarcoderdataPython
3296372
"""Base case, provide cluster specific assertion and cluster facilities to make test easy to read. """ import os import string from docker import errors from random import choice, randint from . import const from . import cluster class ClusterTestCase: def __init__(self): self.cluster = cluster.Cluster...
StarcoderdataPython
109165
""" Helper function: given a manager instance, automatically build a CLI that can be exposed as a package script """ import argparse from pprint import pprint as pp import sys import typing as ty from . import exceptions, manager class AssetCLI: def __init__(self, manager: manager.AssetManager): self._ma...
StarcoderdataPython
1663227
# SPDX-License-Identifier: Apache-2.0 # Copyright Contributors to the Rez Project from rezgui.objects.App import app from rezgui.windows.MainWindow import MainWindow import os.path import sys def get_context_files(filepaths): context_files = [] for path in filepaths: if os.path.exists(path): ...
StarcoderdataPython
3351888
#!/usr/bin/env python # -*- coding: utf-8 -*- from typing import List, Set, Mapping, Tuple, Sequence import pytest from fastapi import FastAPI from pydantic import BaseModel, ValidationError from starlette.testclient import TestClient from fastapi_contrib.db.models import MongoDBTimeStampedModel from fastapi_contrib...
StarcoderdataPython
1646794
<filename>apidemo/urls.py #coding:utf-8 from django.conf import settings from django.conf.urls import patterns, url import views # Uncomment the next two lines to enable the admin: # admin.autodiscover() urlpatterns = patterns('', url # media URL (r'^js/(?P<path>.*)$', 'django.views.static.serve', {'docu...
StarcoderdataPython
1711349
#!/usr/bin/env python3 from dhole.config import load_cfg from dhole.server import ServerV1 config_path = "./configs/demo.py" if __name__ == "__main__": cfg = load_cfg(config_path) server = ServerV1(cfg) server.run_containers() # remove containers # server.stop_containers() # server.remove_...
StarcoderdataPython
1681922
<gh_stars>0 #------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: Rajesh # # Created: 29-12-2019 # Copyright: (c) Rajesh 2019 # Licence: <your licence> #-------------------------------------------------------------------------------...
StarcoderdataPython
57151
<gh_stars>0 #!/usr/bin/env python3 import make_energy as me import make_instance as mi import solve_problem as sop import visualize_solution as vs if __name__ == '__main__': # set problem type_matrix, weak_matrix, resist_matrix, enemy, skill = mi.make_instance() # set costs & constraints model = me.m...
StarcoderdataPython
3265215
<gh_stars>0 #https://dojang.io/mod/quiz/review.php?attempt=1073791&cmid=2246 ''' 구구단 출력! number= int(input()) for i in list(range(1,10)): print(f'{number} * {i} ={number*i}') ''' # https://dojang.io/mod/quiz/review.php?attempt=1073809&cmid=2252 ''' account= int(input()) while account > 0: account -=1350 ...
StarcoderdataPython
185063
<gh_stars>0 from keras.layers import Layer import numpy as np import tensorflow as tf class Normalization(Layer): def call(self, x): return x/127.5 - 1.0
StarcoderdataPython
1787862
import requests import json import datetime import smtplib from email.message import EmailMessage #function to send email_alert def email_alert(subject, body, to): msg = EmailMessage() msg.set_content(body) msg['subject'] = subject msg['to'] = to user = "<EMAIL>" msg['from'] = user pwd = ...
StarcoderdataPython
199361
from flask import Blueprint,render_template,request,make_response,current_app from voice_api.blueprints.ext import Ext fs_api=Blueprint('fs_api',__name__,template_folder='templates') @fs_api.route('/api/auth-ext',methods=['POST']) def auth_ext(): r_token=request.args['tk'] if r_token in current_app.config['FS...
StarcoderdataPython
1669067
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import pytest from exoscale.api.compute import * class TestComputePrivateNetwork: def test_attach_instance(self, exo, privnet, instance): private_network = PrivateNetwork._from_cs(exo.compute, privnet()) instance = Instance._from_cs(exo.compute, inst...
StarcoderdataPython
3214106
<gh_stars>10-100 from django.core.management.base import BaseCommand from waldur_core.logging.loggers import event_logger BLANK_LINE = '\n\n' class Command(BaseCommand): def handle(self, *args, **options): print("# Events", end=BLANK_LINE) groups = sorted([(k, v) for k, v in event_logger.get_all...
StarcoderdataPython
4814560
<reponame>BachFive/GammaGo_3<gh_stars>0 #!/usr/local/bin/python2 from dlgo.gtp import GTPFrontend from dlgo.agent.predict import load_prediction_agent from dlgo.agent import termination import h5py model_file = h5py.File("agents/betago.hdf5", "r") agent = load_prediction_agent(model_file) strategy = termination.get("o...
StarcoderdataPython
83075
<filename>scraper/scraper/dbrouter.py class DBRouter(object): def db_for_read(self, model, **hints): if model._meta.app_label == 'panglao': return 'panglao' if model._meta.app_label == 'cheapcdn': return 'cheapcdn' if model._meta.app_label == 'lifecycle': ...
StarcoderdataPython
1722768
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-06-27 01:58 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('app', '0003_game_tilesposition'), ] operations = [ migrations.RenameField( ...
StarcoderdataPython
3330265
<reponame>HansGR/WorldsCollide text_value = { '<end>' : 0x00, '<line>' : 0x01, '!' : 0xbe, '?' : 0xbf, '/' : 0xc0, ':' : 0xc1, ...
StarcoderdataPython
1751523
<gh_stars>0 # Copyright 2020 by Chromation, Inc # All Rights Reserved by Chromation, Inc from microspeclib.datatypes import CommandNull from microspeclib.logger import CHROMASPEC_LOGGER as log import time # The intended difference between this and the Simple interface is to provide more # fine control, such as br...
StarcoderdataPython
44241
#! /usr/bin/env python3 import sh import click import re def real_git(*args, **kwargs): mock_git(*args, **kwargs) return sh.git(*args, **kwargs) def mock_git(*args, **kwargs): click.echo(sh.git.bake(*args, **kwargs), err=True) return "" def branch_exists(name): try: get_commit_hash(na...
StarcoderdataPython
12997
<reponame>reflectometry/osrefl from greens_thm_form import greens_form_line, greens_form_shape from numpy import arange, linspace, float64, indices, zeros_like, ones_like, pi, sin, complex128, array, exp, newaxis, cumsum, sum, cos, sin, log, log10 from osrefl.theory.DWBAGISANS import dwbaWavefunction class shape: ...
StarcoderdataPython
1665626
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import get_object_or_404, render_to_response, redirect from django.shortcuts import render from django.contrib.auth.decorators import login_required, user_passes_test from django.contrib.admin.views.decorators import staff_member_req...
StarcoderdataPython
3251905
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'firstQtDesignedWindow.ui' # # Created by: PyQt5 UI code generator 5.13.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): ...
StarcoderdataPython
1695527
import streamlit as st import numpy as np import pandas as pd import json from pathlib import Path p = Path().absolute() p_log=p/'logs' flns = list(p_log.glob('*json')) dfs = [] for file in flns: with open(file) as f: json_data = pd.json_normalize(json.loads(f.read())) dfs.append(jso...
StarcoderdataPython
143986
import turtle ninja = turtle.Turtle() ninja.speed(10) for i in range(180): ninja.forward(100) ninja.right(30) ninja.forward(20) ninja.left(60) ninja.forward(50) ninja.right(30) ninja.penup() ninja.setposition(0, 0) ninja.pendown() ninja.right(2) ...
StarcoderdataPython
4809306
<reponame>saiduc/Alexander-Bot import calendar import numpy as np from matplotlib.patches import Rectangle import matplotlib.pyplot as plt from datetime import datetime, timedelta plt.style.use("seaborn-dark") def plot_calendar(days, months): plt.figure(figsize=(9, 1.8)) # non days are grayed ax = plt.gc...
StarcoderdataPython
75419
<filename>clinicadl/clinicadl/svm/classification_utils.py # coding: utf8 import abc import os import pandas as pd from clinica.pipelines.machine_learning import base import clinica.pipelines.machine_learning.voxel_based_io as vbio import clinica.pipelines.machine_learning.ml_utils as utils from multiprocessing.pool im...
StarcoderdataPython
3297915
"""#General classification and regression explanations For examples and interpretation, see my notebooks on [general classification explanations](https://github.com/dsbowen/gshap/blob/master/classification.ipynb) and [general regression explanations](https://github.com/dsbowen/gshap/blob/master/regression.ipynb). """ ...
StarcoderdataPython
3220221
from .models import Dictionary from base.serializers import BaseHyperlinkedModelSerializer class DictionarySerializer(BaseHyperlinkedModelSerializer): class Meta(BaseHyperlinkedModelSerializer.Meta): model = Dictionary def create(self, validated_data): return Dictionary.objects.create(**valid...
StarcoderdataPython
136183
""" @author <NAME>, January 2020 @source Hivemind, https://github.com/compserv/hivemind @dataSource Open Computing Facility, https://www.ocf.berkeley.edu/ @dataMaintainers HKN's Computing Services Committee, https://hkn.eecs.berkeley.edu/about/officers """ import urllib.request, json, sys # To get extended o...
StarcoderdataPython
126192
from .text_based import CircleILTISROIData, PolygonILTISROIData from .tiff_based import SpatialFootprintROIData
StarcoderdataPython
54901
<filename>nature/benchmarks/protein_folding_problem_benchmark.py # This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache...
StarcoderdataPython
3207622
<gh_stars>1-10 import os i=0 while True: #write f = open('test0.txt', 'a') f.write(".") #Add os.system('git add .') os.system('git commit -m "1"') i=i+1 print(str(i)+':commits')
StarcoderdataPython
1795509
from __future__ import annotations from typing import TYPE_CHECKING, List, Optional from ._base import MutableTelegramObject if TYPE_CHECKING: # pragma: no cover from .keyboard_button import KeyboardButton class ReplyKeyboardMarkup(MutableTelegramObject): """ This object represents a custom keyboard w...
StarcoderdataPython
3322273
#!/usr/bin/python3.6 # created by cicek on 19.03.2019 00:17 import math print("Enter numbers: ") unsortedList = [int(item) for item in input().split()] """6 14 45 78 18 47 53 83 91 81 77 84 99 64 42""" print("unsorted list:\n" + str(unsortedList) + "\n") # def findMyParent(a: int): # if (unsortedList.index(a) ...
StarcoderdataPython
37790
""" A whole file dedicated to parsing __version__ in all it's weird possible ways 1) Only acts on source, no file handling. 2) some functions for *by line* 3) some functions for *by file* 4) Handle quotes 5) Handle whitespace 6) Handle version as tuple """ import ast import re from typing import Any, Optional, T...
StarcoderdataPython
66866
from simalia.math.numbers.integer import Integer from simalia.math.operators.sum import Sum from simalia.pymath import Variable class Pi(Sum, Variable): def __init__(self, iterations=11): self.__k = Variable("k", Integer(0)) super().__init__(iterations, self.__k, self.__formular) self.ite...
StarcoderdataPython
3295309
######################################################################## # # (C) 2015, <NAME> <<EMAIL>> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either versi...
StarcoderdataPython
3224973
import numpy as np from rlgym.utils import RewardFunction from rlgym.utils.common_values import CEILING_Z, BALL_MAX_SPEED, CAR_MAX_SPEED, BLUE_TEAM, BLUE_GOAL_BACK, \ BLUE_GOAL_CENTER, ORANGE_GOAL_BACK, ORANGE_GOAL_CENTER, BALL_RADIUS, ORANGE_TEAM from rlgym.utils.gamestates import GameState, PlayerData from rlgym....
StarcoderdataPython
163054
from setuptools import setup with open("README.md", "r") as f: long_description = f.read() setup( name="javaccflab", packages=["javaccflab"], entry_points={ "console_scripts": ['javaccflab = javaccflab.java_ccf:main'] }, version='0.1.12', description="JavaCCF is utility to fix styl...
StarcoderdataPython
4814619
# -*- coding: utf-8 -*- """ Created on Wed Jul 27 12:30:28 2016 test stuff test inverse rational function @author: sebalander """ # %% import cv2 import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from rational import inverseRational from rational import directRational # % D...
StarcoderdataPython
196521
# Copyright 1999-2021 Alibaba Group Holding Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
StarcoderdataPython
1756606
from turtle import* speed(11) shape("turtle") for count in range(4): forward(100) right(90) done()
StarcoderdataPython
3212068
from flask import Flask from flask_bootstrap import Bootstrap from flask_sqlalchemy import SQLAlchemy from flask_marshmallow import Marshmallow from flask_mail import Mail app = Flask(__name__) app.config.from_pyfile('config.py') app.config.from_pyfile('mail-config.py') db = SQLAlchemy(app) mail = Mail(a...
StarcoderdataPython
3260908
from django.shortcuts import render, redirect from .models import Article from django.http import HttpResponse from django.contrib.auth.decorators import login_required from . import forms from django.core.paginator import Paginator def article_list(request): articles = Article.objects.all().order_by('-date') pagin...
StarcoderdataPython
178893
# nrf52 bobble test in python import time from adafruit_ble import BLERadio from adafruit_ble.advertising.standard import ProvideServicesAdvertisement from adafruit_ble.services.nordic import UARTService ble = BLERadio() while True: while ble.connected and any( UARTService in connection for co...
StarcoderdataPython
3228822
<filename>pymath/coin_sums/__init__.py<gh_stars>1-10 def make_pounds(coins, bill): """ Find how many ways there are to make bill from the given list of coins :param coins List of coins :type coins list :param bill Coin/note to make change for :type bill int :return: Number of ways to make ch...
StarcoderdataPython
3385405
<gh_stars>1-10 #!/usr/bin/python from Bio import SeqIO import sys import os if len(sys.argv) < 2: print("USAGE: avg_lengths.py <infile>...") sys.exit(1) length_map = dict() for f in sys.argv[1:]: length_map[f] = [] for seq in SeqIO.parse(open(f), "fasta"): length_map[f].append(len(seq.seq)) longest_length = ...
StarcoderdataPython
1749397
from test_utils import run_query, redshift_connector import pytest def test_voronoi_lines_success(): fixture_file = open('./test/integration/voronoi_fixtures/in/wkts.txt', 'r') points = fixture_file.readlines() fixture_file.close() results = run_query( f"""SELECT @@RS_PREFIX@@processing.ST_VO...
StarcoderdataPython
67004
<reponame>waymanls/awx # Copyright (c) 2015 Ansible, Inc. # All Rights Reserved. # Python import dateutil import functools import html import logging import re import requests import socket import sys import time from base64 import b64encode from collections import OrderedDict from urllib3.exceptions import ConnectTi...
StarcoderdataPython
3301729
<reponame>yuriy-logosha/myutils from subprocess import Popen, PIPE def run(scr): try: command = ['osascript', '-e %s' % scr] lines = [] with Popen(command, stdout=PIPE, universal_newlines=True) as process: for line in process.stdout: lines.append(line) r...
StarcoderdataPython
1689794
<filename>pelita/utils/debug.py<gh_stars>0 # -*- coding: utf-8 -*- """Various helper methods.""" import threading import logging from pelita.utils import SuspendableThread _logger = logging.getLogger("pelita.utils") _logger.setLevel(logging.DEBUG) __docformat__ = "restructuredtext" class ThreadInfoLogger(Suspenda...
StarcoderdataPython
3220792
# 数据库连接配置(请将本文件修改后重命名为config.py) db_host = "数据库地址" db_user = "数据库用户名" db_passwd = "<PASSWORD>" db_dbname = '数据库名'
StarcoderdataPython
43393
# 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 applicable law or agreed to in writing, ...
StarcoderdataPython
173067
<gh_stars>10-100 """The type file for the collection Lab. moved out of __init.py__ in order to have lab specific acl that allows a lab member to edit their lab info at any time """ from pyramid.security import ( Allow, Deny, Everyone, ) from base64 import b64encode from snovault import ( collection, ...
StarcoderdataPython
4838162
from .alipay import alipay
StarcoderdataPython
1633474
<reponame>Alecto3-D/testable-greeter<gh_stars>1-10 # This file is part of Buildbot. Buildbot is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will...
StarcoderdataPython
44109
"""Constants used in Integer. """ MAX_INT = 2 ** 31 - 1 FAILED = -2147483646.0
StarcoderdataPython
76150
<gh_stars>1-10 import re from helper_methods import get_date class ImportTable: """ This class creates a table to help with importing data into the database Attributes ---------- table_name : str the file name of the imported CSV or XLSX file column_names : str column names ...
StarcoderdataPython