id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
39089
<reponame>marcosamos/Python-tasks-and-proyects def main(): # Create and print a list named fruit. fruit_list = ["pear", "banana", "apple", "mango"] print(f"original: {fruit_list}") fruit_list.reverse() print(f"Reverse {fruit_list}") fruit_list.append("Orange") print(f"Append Orange {fruit_...
StarcoderdataPython
4817602
<filename>src/mbi/mixture_inference.py from mbi import Dataset, Factor, CliqueVector from scipy.optimize import minimize from collections import defaultdict import numpy as np from scipy.special import softmax from functools import reduce from scipy.sparse.linalg import lsmr """ This file is experimental. It is a clo...
StarcoderdataPython
3587780
class Secrets: def __init__(self, api): """ Manages secrets in Alooma. Secrets are Alooma's way of using Environment variables. :param api: The Alooma API client authentication """ self.api = api def set_secrets(self, secrets_dict): """ Sets the secrets in Alooma. ...
StarcoderdataPython
1715779
from datetime import datetime import logging import soap import config import scrape import mongo import util def get(code): db = mongo.get_db() variable = db.variables.find_one({'code': code}) if (not variable) or config.bool('reload'): logging.info("Variable %s not found, loading from SOAP...", c...
StarcoderdataPython
11267032
from functools import wraps from inspect import signature from types import UnionType from typing import Any, Callable, ParamSpec, Type, TypeVar P = ParamSpec('P') R = TypeVar('R') def assert_types(**type_mappings: Type | UnionType) -> Callable[[Callable[P, R]], Callable[P, R]]: def decorator(func: Callable[P, R]...
StarcoderdataPython
5141270
<filename>other_algorithms/hammond_distances.py import sys sys.path.insert(0, '../data_structures') from unionfind import UnionFind def toggle_bit(c): if c == '0': return '1' else: return '0' def update_singles(uf, code, count_bits): for i in range(count_bits): uf.union(code, code[...
StarcoderdataPython
5017082
<filename>79. Word Search.py # Scan through each word in grid. Where 1st char matches, perform dfs on it's neighbors. Replace a visited word by -1 to avoid visiting it again. Backtrack if needed. class Solution: def exist(self, board: List[List[str]], word: str) -> bool: self.m, self.n = len(board...
StarcoderdataPython
1899059
import os import json repoDir = os.path.dirname(os.path.abspath(__file__)) +"/cosmos" category = [] def dirParser(path): dirs = path.split("/") try: if dirs[-2]== "test" or dirs[-2] == "src": description = dirs[-3] + " " + dirs[-1] elif dirs[-1]== "test" or dirs[-1] == "src": ...
StarcoderdataPython
9655685
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. # A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "license...
StarcoderdataPython
11256486
<filename>src/apps/windower.py # -*- coding: utf-8 -*- """ICU (LEGO Island Configuration Utility). Created 2015 Triangle717 <http://le717.github.io/> Licensed under The MIT License <http://opensource.org/licenses/MIT/> """ from src.registry.registry import Registry __all__ = ("Windower") class Windower: de...
StarcoderdataPython
3385443
<reponame>camponogaraviera/qutip __all__ = ['berry_curvature', 'plot_berry_curvature'] from qutip import (Qobj, tensor, basis, qeye, isherm, sigmax, sigmay, sigmaz) import numpy as np try: import matplotlib.pyplot as plt except: pass def berry_curvature(eigfs): """Computes the discretized Berry curvatur...
StarcoderdataPython
1623208
<gh_stars>0 from pypict._version import __version__ from pypict.api import Task from pypict.capi import PAIRWISE_GENERATION
StarcoderdataPython
6473611
import discord import json import http.client, urllib.request, urllib.parse, urllib.error, base64 from datetime import datetime from discord.ext import commands from discord.ext.commands import Bot from discord_slash import SlashCommand, SlashContext def function(ctx, parameters): return "Hello, World!"
StarcoderdataPython
1984502
#!/usr/bin/python #coding=utf8 import test_pb2 testinfo = test_pb2.testinfo() testinfo.devtype = 100 testinfo.devid = 2 testinfo.unitid = 3 testinfo.chlid = 4 testinfo.testid = 250 testinfo.stepdata = b'abd' print("#"*50) print(testinfo, testinfo.devtype) # 打印 protobuf 结构的内容 out = testinfo.SerializeToSt...
StarcoderdataPython
6526638
# -*- coding: utf-8 -*- # # Copyright 2017 dpa-infocom GmbH # # 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...
StarcoderdataPython
11342317
<reponame>danielmarreirosdeoliveira/prototypes scene=[ { "robot": "ground.urdf", "position": (0, 0, 0), "part": { "display_as": "ground", } }, { "robot": "box.obj", "position": (-2, 2, 1) }, { "robot": "quad_plane_textured.obj", ...
StarcoderdataPython
5159838
<filename>ManagerManagement/models.py from django.db import models #from CompanyManagement.models import Company from EmployeeManagement.models import Employee from FormManagement.models import Form from PayslipManagement.models import Payslip # Create your models here. class Manager(models.Model): EmployeeID ...
StarcoderdataPython
376873
<gh_stars>1-10 """ The lightning training loop handles everything except the actual computations of your model. To decide what will happen in your training loop, define the `training_step` function. Below are all the things lightning automates for you in the training loop. Accumulated gradients ---------------------...
StarcoderdataPython
1835114
''' LEGB Local, Enclosing, Global, Built-in ''' for a in range(2): x = 'global {}'.format(a) def outer(): # x = 'outer x' for b in range(3): x = 'outer {}'.format(b) def inner(): # x = 'inner x' for c in range(4): x = 'inner {}'.format(c) print(x) ...
StarcoderdataPython
5009957
from io import BytesIO import typing import os from PIL import Image, ImageFile, ImageOps from selenium import webdriver ImageFile.LOAD_TRUNCATED_IMAGES = True def resize_image(image, width=800, height=800) -> Image.Image: """ 修改图片尺寸,如果同时有修改尺寸和大小的需要,可以先修改尺寸,再压缩大小 :param image: 能够 Image.open() 的对象 :p...
StarcoderdataPython
60603
''' Reporters output information about the state and progress of the program to the user. They handle information about the formatting of this output, as well as any additional processing which is required to support it, such as comunicating with a web or email server, for example. They are derived from the Base_Repo...
StarcoderdataPython
4930357
from subtraction_analyzer import * from addition_analyzer import * import sys class AnalyzerInterface: def __init__(self, target_address): self.target = target_address @staticmethod def get_operands(address, operand_type="BOTH"): if isinstance(address, str): address = int(addr...
StarcoderdataPython
3499015
from .torch_gpu import DOCKERFILE as TORCH_GPU
StarcoderdataPython
4822327
<gh_stars>0 from greenflow.dataframe_flow import Node, PortsSpecSchema from greenflow.dataframe_flow.portsSpecSchema import ConfSchema from greenflow.dataframe_flow.metaSpec import MetaDataSchema from greenflow.dataframe_flow.template_node_mixin import TemplateNodeMixin from ..node_hdf_cache import NodeHDFCacheMixin _...
StarcoderdataPython
336545
<reponame>SnabbCo/nova<filename>nova/virt/baremetal/vif_driver.py<gh_stars>1-10 # Copyright (c) 2012 NTT DOCOMO, INC. # 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 Lice...
StarcoderdataPython
6416266
<reponame>yoctocookbook2ndedition/buildhistory-web # buildhistory-web - model definitions # # Copyright (C) 2013-2015 Intel Corporation # # Licensed under the MIT license, see COPYING.MIT for details from django.db import models from datetime import datetime from django.contrib.auth.models import User class Build(mod...
StarcoderdataPython
1940564
# -*- coding: utf-8 -*- """ Source: https://github.com/awesto/django-shop/blob/c5fcbc543096ce09fd2320d24c5a100a53a3eb4b/shop/admin/delivery.py """ from __future__ import unicode_literals from django.conf.urls import url from django.contrib import admin from django.core.urlresolvers import reverse from django.db.models...
StarcoderdataPython
8000478
<filename>web_service/web_service/frontend/views.py from flask import Blueprint, Flask, jsonify, request, render_template from web_service.helpers import helpers from pdb import set_trace as bp import logging import traceback frontend_blueprint = Blueprint( 'frontend', __name__, template_folder='../templat...
StarcoderdataPython
5018896
from enum import Enum class HeaderKeys(str, Enum): correlation_id = "X-Correlation-ID" request_id = "X-Request-ID" date = "Date" forwarded_for = "X-Forwarded-For" user_agent = "User-Agent"
StarcoderdataPython
11310321
<filename>test/internal/xcodeproj_tests/xcodeproj_tests_tests.bzl<gh_stars>1-10 """Tests for xcodeproj_tests.""" load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest") load("//xcodeproj:testing.bzl", "xcodeproj_tests") def _from_fixture_test(ctx): env = unittest.begin(ctx) # Specify target actual...
StarcoderdataPython
3237600
<filename>nnrl/optim/kfac.py """ MIT License Copyright (c) 2018 <NAME>, <NAME> and Université de Montréal. 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 l...
StarcoderdataPython
5115759
<filename>article/1_introduction/mercury_viscosity.py # MIT License # # Copyright (c) 2021- <NAME> # # 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 ...
StarcoderdataPython
3427923
import os import unittest import django from test.test_deque import fail from tripapotamus.logic.AmazonRequestsHelpers import * from tripapotamus.logic.AmazonRequests import request_amazon_product """ This test parses AmazonResponse.xml. AmazonResponse.xml is a dummy file containing a list of five item entries: item...
StarcoderdataPython
4888978
import argparse import os import logging import sys import imp from rl_coach.core_types import EnvironmentEpisodes from rl_coach.base_parameters import TaskParameters from rl_coach.utils import short_dynamic_import # from markov.s3_boto_data_store import S3BotoDataStoreParameters, S3BotoDataStore import markov.enviro...
StarcoderdataPython
5141053
<gh_stars>0 from tuple_plot import * normal_tuple_data = "../../../experiments/tuples/normal_tuple_data.csv" normal_plot_path = "../plots/normal/" v_is_g_tuple_data = "../../../experiments/tuples/v_is_g_tuple_data.csv" v_is_g_plot_path = "../plots/v_is_g/" accuracy_plot_path = "../plots/accuracy/" normal_tuple_dat...
StarcoderdataPython
3572312
import asyncio import os import sysconfig import shlex import logging from find_libpython import find_libpython from collections.abc import Iterable from deltasimulator.build_tools import BuildArtifact, Environment from deltasimulator.build_tools.utils import multiple_waits log = logging.getLogger(__name__) class...
StarcoderdataPython
6459069
<filename>Proyecto_albergue_mascotas_local/Albergue_mascotas/pagina1app/resources.py from import_export import resources from .models import Contacto, Registro_mascota, Solicitud_adopcion class ContactoResource(resources.ModelResource): class Meta: model = Contacto
StarcoderdataPython
4899203
<reponame>maemo-leste-extras/lagrange<gh_stars>0 #!/usr/bin/env python3 """usage: ./gen-emoji-table.py emoji-data.txt Input file: * https://www.unicode.org/Public/UCD/latest/ucd/emoji/emoji-data.txt """ import sys from collections import OrderedDict import packTab if len (sys.argv) != 2: sys.exit (__doc__) f = op...
StarcoderdataPython
25402
<reponame>LeileiCao/SFD_Pytorch import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from layers import * import torchvision.transforms as transforms import torchvision.models as models import torch.backends.cudnn as cudnn import torch.nn.init as init import os class L...
StarcoderdataPython
4896013
<filename>tests/snuba/api/endpoints/test_organization_events_v2.py<gh_stars>0 from __future__ import absolute_import from datetime import timedelta from django.utils import timezone from django.core.urlresolvers import reverse from sentry.testutils import APITestCase, SnubaTestCase class OrganizationEventsTestBase...
StarcoderdataPython
4978775
<filename>parser/team06/TextLine.py import tkinter as tk class TextLineNumbers(tk.Canvas): def __init__(self, *args, **kwargs): tk.Canvas.__init__(self, *args, **kwargs) self.textwidget = None def attach(self, text_widget): self.textwidget = text_widget def redraw(self, *args): ...
StarcoderdataPython
1655690
""" author: <EMAIL> usage: dump redis content """
StarcoderdataPython
3572921
'''---------------------------------------------------------------------------------------------- This contains the methods to manage any Dynamo database operations ----------------------------------------------------------------------------------------------''' import boto3 import globals from json import dumps import...
StarcoderdataPython
9789591
import json import pathlib import altair as alt import pandas as pd import rbo import streamlit as st from tinydb import TinyDB, Query DL = "https://github.com/The57thPick/nba/releases/download/{year}-media-awards/{year}.zip" DB = TinyDB("db/db.json") YEARS = [ 2015, 2016, 2017, 2018, 2019, ...
StarcoderdataPython
3244160
<filename>examples/02 - Generators/main.py<gh_stars>0 from memory_profiler import profile import timeit import itertools NUMBER_OF_ELEMENTS = 100000 NUMBER_OF_LOOPS = 3 def good_generator(): return (x * 2 for x in range(NUMBER_OF_ELEMENTS)) @profile def good_generator_memory(): for loop_count in good_gener...
StarcoderdataPython
6514541
<reponame>arthurian/visualizing_russian_tools<filename>visualizing_russian_tools/settings/aws.py import requests from .base import * # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.environ['DJANGO_SECRET_KEY'] # SECURITY WARNING: don't run with debug turned on in production! DEBUG ...
StarcoderdataPython
9689456
<reponame>vincentalbouy/mi-prometheus #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright (C) IBM Corporation 2018 # # 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
3247950
# -*- coding: utf-8 -*- # # This class was auto-generated from the API references found at # https://epayments-api.developer-ingenico.com/s2sapi/v1/ # from ingenico.connect.sdk.data_object import DataObject from ingenico.connect.sdk.domain.definitions.amount_of_money import AmountOfMoney from ingenico.connect.sdk.domai...
StarcoderdataPython
11247615
<filename>librarizer/__init__.py from . import librarizer __all__ = ["librarizer"]
StarcoderdataPython
26137
<gh_stars>100-1000 import datetime from unittest import TestCase from isc_dhcp_leases.iscdhcpleases import Lease6, utc from freezegun import freeze_time __author__ = '<NAME> <<EMAIL>>' class TestLease6(TestCase): def setUp(self): self.lease_time = datetime.datetime(2015, 8, 18, 16, 55, 37, tzinfo=utc) ...
StarcoderdataPython
3523578
<reponame>amitibo/pysparsetransforms import unittest import sparse_transforms as spt import numpy as np class TestGrids(unittest.TestCase): def setUp(self): self.Y = np.linspace(0, 2, 20) self.X = np.linspace(0, 2, 20) self.Z = np.linspace(0, 2, 20) ...
StarcoderdataPython
9637249
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Apr 28 13:24:45 2018 functions to go with strike-slip model dependencies: numpy, matplotlib author: <NAME> email: <EMAIL> """ ###-------------------------------------------------------------------------### #%% import modules ###-----------------------...
StarcoderdataPython
8036576
######## # autora: <EMAIL> # repositório: https://github.com/danielle8farias # Descrição: Programa retorna a previsão do tempo para cinco dias da localidade do usuário ######## import requests import json from time import sleep from datetime import datetime chave_api = '<KEY>' def pegar_coordenadas(): #mandano ...
StarcoderdataPython
3453118
<reponame>benety/mongo #!/usr/bin/env python # # Public Domain 2014-present MongoDB, Inc. # Public Domain 2008-2014 WiredTiger, Inc. # # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publish, use, compile, sell, or # distribute this software, either in sourc...
StarcoderdataPython
3589160
import os from os.path import join import numpy as np import matplotlib.pyplot as plt import seaborn as sns def main(): layer_n_lst = [1, 2, 3] n_tr_lst = [50, 100, 300, 1000] dct_palette = {1: sns.light_palette(color='darkorange', n_colors=5)[2:], 0: sns.light_palette(color='grey', n_...
StarcoderdataPython
1746591
from rest_framework import serializers class VerifyOTPSerializer(serializers.Serializer): otp_code = serializers.CharField(max_length=6) email = serializers.EmailField(max_length=200)
StarcoderdataPython
3317737
<filename>ros/src/tl_detector/light_classification/tl_classifier.py from styx_msgs.msg import TrafficLight import tensorflow as tf from numpy import expand_dims, squeeze, int32 from datetime import datetime from rospy import logdebug, loginfo CLASS_LABELS = {1: 'Green', 2: 'Red', 3: 'Yellow', 4: 'Unknown'} class TLCl...
StarcoderdataPython
3477232
#!/usr/bin/python # # update_disk_img.py # Script for updating a gem5 disk image with NPB binaries. # import os, subprocess, getopt, sys from utils import * import config ################################################################# ## General definitions, please change paths and names to the ## appropiate ones ...
StarcoderdataPython
1891335
import logging from datetime import datetime from PIL import ExifTags from ingestors.base import Ingestor from ingestors.support.ocr import OCRSupport from ingestors.support.image import ImageSupport from ingestors.support.plain import PlainTextSupport log = logging.getLogger(__name__) class ImageIngestor(Ingestor,...
StarcoderdataPython
4979259
#!usr/bin/env python #coding=utf-8 import tensorflow as tf BATCHSIZE = 5000 #参数初始化 X_train = tf.placeholder(tf.float32,shape=[None,2]) Y_train = tf.placeholder(tf.float32,shape=[None,1]) W = tf.Variable(tf.random_normal([2,1])) b = tf.Variable(tf.random_normal([1])) #sigmoid 假设函数 hypothesis = tf.sigmoid(tf.matmul...
StarcoderdataPython
6534735
<filename>src/sensor_omron/node/reader_coordinates.py<gh_stars>0 #!/usr/bin/env python3 import rospy import os from std_msgs.msg import String from datetime import datetime import telnetlib from sensor_omron.read_yaml_file import Read_Yaml_File class Reader_Coordinates : '''Classe Creata per acquisire Coordinate da ...
StarcoderdataPython
11233208
<filename>shop/apps/user/contains.py<gh_stars>0 # -*- coding: utf-8 -*- """ @Time : 2020/3/22 22:23 @Author : 半纸梁 @File : contains.py """ SMS_CODE_EXPIRE_TIME = 5*60 # 短信验证码有效时间 SMS_REPEAT_EXPIRE_TIME = 60 # 可重复发送短信的时间 SMS_TEMPLATE = 1 # 短信发送模板 SMS_CCP_EXPIRE_TIME = 5 # 云通讯短信有效时间 以分钟计算的 SESSION_EXPIR...
StarcoderdataPython
3411914
from django.db import models from django.db.models import ( get_model, Sum, Max, ) from django.db.models.query import QuerySet from .constants import * class SecurityQuerySet(QuerySet): @property def authorized(self): securities = self.select_related() return sum(filter( ...
StarcoderdataPython
5078108
#! /usr/bin/env python import roslib; roslib.load_manifest('jaco2_ral') import rospy import rospkg from util.util import * from jaco2_driver.pose_action_client import * import time if __name__ == '__main__': rospy.init_node('jaco2_pose_control') left_arm = Jaco2Pose('left') left_arm.set_cartesian([0, ...
StarcoderdataPython
3295334
<reponame>BayuDC/mofunami import nekos import random import functools from data import nekos as nekos_data def category_random() -> str: return category_aliases(random.choice(nekos_data.categories)) def category_summary() -> str: return functools.reduce(lambda result, category: f'{result}`{category_aliases...
StarcoderdataPython
6691467
<reponame>konrad2508/compilators-lab class Symbol(object): pass class SimpleSymbol(Symbol): def __init__(self, type): self.type = type class MatrixSymbol(Symbol): def __init__(self, type, x, y): self.type = type self.x = x self.y = y class SymbolTable(object): def _...
StarcoderdataPython
9658821
<reponame>JulyKikuAkita/PythonPrac<filename>cs15211/MaximumWidthOfBinaryTree.py<gh_stars>1-10 __source__ = 'https://leetcode.com/problems/maximum-width-of-binary-tree/' # Time: O(N) # Space: O(N) # # Description: Leetcode # 662. Maximum Width of Binary Tree # # Given a binary tree, write a function to get the maximum ...
StarcoderdataPython
296175
def configure(ctx): ctx.env.has_mpi = False mpiccpath = ctx.find_program("mpicc") if mpiccpath: ctx.env.has_mpi = True envmpi = ctx.env.copy() ctx.setenv('mpi', envmpi) ctx.env.CC = [mpiccpath] ctx.env.LINK_CC = [mpiccpath] envmpibld = envmpi = ctx.env.copy() ...
StarcoderdataPython
1722064
<reponame>thefarwind/clock import datetime import imp import unittest clock = imp.load_source('clock', './clock') class TestDateParse(unittest.TestCase): def test_month_day(self): expect = datetime.date(datetime.date.today().year, 10, 31) result = clock.date_parse("10-31") self.assertEqu...
StarcoderdataPython
3507284
<reponame>mateuschwarz/poker-eval """ holdem_range.py """ from itertools import combinations # --- class HoldemRange(list): """ Creates a dictionary with every possible no order combination of every two cards as keys and assigns a frequency value to every one of them. Arguments: :freq:...
StarcoderdataPython
1768503
<gh_stars>0 #!/usr/bin/env python3 from __future__ import print_function import sys import os import math import pprint import re import doctest import itertools import collections import logging from collections import defaultdict from functools import reduce # create absolute mydir mydir = os.path.abspath(os.path.d...
StarcoderdataPython
8119796
<filename>src/kedro_tutorial/pipelines/data_science/nodes.py import logging from typing import Dict, Tuple import pandas as pd from sklearn.linear_model import LinearRegression from sklearn.metrics import r2_score from sklearn.model_selection import train_test_split def split_data(data: pd.DataFrame, parameters: Dic...
StarcoderdataPython
3215551
from flask import request, jsonify, g from sqlalchemy import or_ from sqlalchemy.exc import IntegrityError from actor_libs.database.orm import db from actor_libs.errors import ParameterInvalid, ReferencedError, APIException from app import auth from app.models import DictCode, Message from . import bp @bp.route('/me...
StarcoderdataPython
288292
<gh_stars>1-10 # -*- coding: utf-8 -*- # @Author : LG """ 执行用时:88 ms, 在所有 Python3 提交中击败了46.93% 的用户 内存消耗:23.3 MB, 在所有 Python3 提交中击败了5.02% 的用户 解题思路: 动态规划 """ class Solution: def maxSubArray(self, nums: List[int]) -> int: n = len(nums) if n == 0: return 0 dp = [[] for _ in ra...
StarcoderdataPython
3393710
<gh_stars>0 """ Players module. This module provides routes for viewing and performing actions on players. """ import os import uuid from http import HTTPStatus from flask import jsonify, request from flask.views import MethodView from scorecard.models.player import Player, PlayerSchema from scorecard.services.messa...
StarcoderdataPython
6571486
<gh_stars>0 # -*- coding: utf-8 -*- from __future__ import division, print_function from .move import Move from .mh import MHMove from .gaussian import GaussianMove from .red_blue import RedBlueMove from .stretch import StretchMove from .walk import WalkMove from .kde import KDEMove from .de import DEMove from .de...
StarcoderdataPython
8028433
<gh_stars>1-10 # -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Prototype' db.create_table('achievements_prototype', ( ('object_p...
StarcoderdataPython
12846202
########################################################################## # # Copyright 2008-2010 VMware, Inc. # All Rights Reserved. # # 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 withou...
StarcoderdataPython
8095676
<reponame>georgeAccnt-GH/daks<filename>fwiio.py import io import h5py from azureio import blob_from_bytes, load_blob_to_hdf5 def load_shot(num, container="shots"): filename = "shot_%d.h5" % num with load_blob_to_hdf5(Blob(container, filename)) as f: data = f['data'][()] src_coords = f['src_co...
StarcoderdataPython
5193935
import random f = open("./testcase.txt", "w") n = int(input("Number of tips > ")) m = int(input("Number of fruits > ")) f.write("%d %d\n"%(n, m)) l1 = [] l2 = [] l3 = [] i = 0 while i < m: x = random.randint(0, 999) y = random.randint(1, 1000) if((x in l3)): continue; i += 1 l3.append(x) ...
StarcoderdataPython
6526882
<reponame>Team-Vadim/virtual_person from os import path from pydub import AudioSegment import requests import speech_recognition import urllib.request import json # files src = "dece9e8301.ogg" # Путь к файлу, который надо конвертировать dst = "audios.wav" # Путь к итоговому файлу sound = AudioSegment.from_ogg(src)...
StarcoderdataPython
1748992
from myenv.envs.env_spolf import *
StarcoderdataPython
1925044
<reponame>terjekv/Stack-Lifecycle-Deployment from pydantic import BaseModel, EmailStr, Field, ValidationError, validator, SecretStr, constr from typing import Optional, List class UserBase(BaseModel): username: constr(strip_whitespace=True) class UserCreate(UserBase): fullname: constr(strip_whitespace=True)...
StarcoderdataPython
5086868
<filename>DynamicProgramming/jumpingJacks/test_runner.py def run_test(solution): print("Testing for an array of size 11 with +5 jumps forward, -2 jumps backward, up to 9 moves") print("Output: " + str(solution([0 for _ in range(11)], 5, 2, 9))) print("Expected: 7") print("~~~~~~~~~~~~~~~~~") print("Testing fo...
StarcoderdataPython
1885424
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in complianc...
StarcoderdataPython
1919930
""" TODO """ from .base import route_permutations, hashable_list from depend_test_framework.log import get_logger LOGGER = get_logger(__name__) try: from DL import LSTM except ImportError: LOGGER.info("Cannot import deep learning algorithms, need install tensorflow") LSTM = None
StarcoderdataPython
1843995
<gh_stars>100-1000 # -*- coding: utf-8 -*- # Copyright 2016 Yelp 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 a...
StarcoderdataPython
4899875
<reponame>shakenfist/shakenfist import time from shakenfist_ci import base class TestImages(base.BaseNamespacedTestCase): def __init__(self, *args, **kwargs): kwargs['namespace_prefix'] = 'images' super(TestImages, self).__init__(*args, **kwargs) def setUp(self): super(TestImages, se...
StarcoderdataPython
3218173
from typing import Any, TypeVar, Callable, List, Union import gym import ray from muzero.global_vars import GlobalVars from muzero.policy import Policy from muzero.rollout_worker import RolloutWorker TrainerConfigDict = dict EnvType = gym.Env class WorkerSet: """Represents a set of RolloutWorkers. There ...
StarcoderdataPython
11395580
<filename>openwisp_network_topology/tests/test_utils.py from django.test import TestCase from django_netjsongraph.tests import CreateGraphObjectsMixin from django_netjsongraph.tests.utils import TestUtilsMixin from openwisp_users.models import Organization from . import CreateOrgMixin from ..models import Link, Node,...
StarcoderdataPython
5192311
import json from collections import defaultdict from dataclasses import dataclass, field from functools import total_ordering from pathlib import Path from re import compile, search from typing import Any, DefaultDict, List from urllib.request import urlretrieve from bs4 import BeautifulSoup as Soup out_dir = Path("/...
StarcoderdataPython
9676579
<reponame>adamreeve/mlflow import warnings from typing import Union, Dict import numpy as np import tensorflow from tensorflow.keras.callbacks import Callback, TensorBoard import mlflow from mlflow.utils.autologging_utils import ExceptionSafeClass from mlflow.utils.autologging_utils import ( INPUT_EXAMPLE_SAMPLE_...
StarcoderdataPython
3426063
#!/usr/bin/env python3 # -*- encoding=utf-8 -*- # description: # author:jack # create_time: 2018/9/17 from dueros.directive.Display.tag.BaseTag import BaseTag from dueros.directive.Display.tag.TagTypeEnum import TagTypeEnum class CustomTag(BaseTag): def __init__(self, text): super(CustomTag, self).__in...
StarcoderdataPython
36447
from tkinter import * import os from datetime import datetime import webbrowser from tkinter import messagebox from tkinter import ttk import tkinter.filedialog import tkinter as tk import openpyxl from REPORTE import * datos = [] #reporte precios = [] #precios preciosmq=[] #precios mq subtotales = [] def CREAR_INTER...
StarcoderdataPython
8102565
from arcade import Sprite class Entity(Sprite): """Base class that all entities inherit from.""" def __init__( self, image_file: str, scale: float, center_x: float, center_y: float, flipped_horizontally: bool) -> None: """Initialize the Entity :param image_file: Path ...
StarcoderdataPython
67730
<filename>notebooks/_solutions/case2_observations32.py<gh_stars>0 fig, ax = plt.subplots(figsize=(6, 6)) n_species_per_plot.plot(kind="barh", ax=ax) ax.set_ylabel("Plot number");
StarcoderdataPython
8051095
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
StarcoderdataPython
1755048
import os import random import datetime import argparse import time import argparse import numpy as np from torchvision import models import torch.nn as nn import torch import random import dlib import cv2 import imutils from imutils.video import VideoStream from imutils import face_utils from moviepy.editor import *...
StarcoderdataPython
37766
""" -------------------------------------------------------------------------- The `self_paced_ensemble.canonical_resampling` module implement a resampling-based classifier for imbalanced classification. 15 resampling algorithms are included: 'RUS', 'CNN', 'ENN', 'NCR', 'Tomek', 'ALLKNN', 'OSS', 'NM', 'CC', 'SMOTE', ...
StarcoderdataPython
6499752
<reponame>cxrodgers/Rodgers2021<gh_stars>0 ## Plot performance for flatter shapes """ S1A, right PLOT_PERFORMANCE_BY_DIFFICULTY STATS__PLOT_PERFORMANCE_BY_DIFFICULTY Performance on flatter shapes """ import json import os import numpy as np import pandas import matplotlib.pyplot as plt import my import my....
StarcoderdataPython