id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3532316 | # import os
import time
import xml.dom.minidom
import pathlib
DAC_CONTEST = pathlib.Path('/home/xilinx/jupyter_notebooks/dac_sdc_2021/')
IMG_DIR = DAC_CONTEST / 'images'
RESULT_DIR = DAC_CONTEST / 'result'
# Return a batch of image dir when `send` is called
class Team:
def __init__(self, teamname, batch_siz... | StarcoderdataPython |
9702725 | <gh_stars>0
from django import forms
from osc_bge.student import models as student_models
class AccountingForm(forms.ModelForm):
class Meta:
model = student_models.StudentAccounting
fields = ('invoice',)
| StarcoderdataPython |
9746345 | <gh_stars>1-10
import open3d as o3d
import numpy as np
pcd = o3d.io.read_point_cloud("/home/ros2-foxy/uneven_2.pcd")
aabb = pcd.get_axis_aligned_bounding_box()
aabb.color = (1, 0, 0)
box_corners = np.asarray(aabb.get_box_points())
min_corner = box_corners[0]
max_corner = box_corners[4]
print(box_corners)
x_dist =... | StarcoderdataPython |
5092024 | <reponame>mcmk3/qiita
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# --------------------------... | StarcoderdataPython |
4806348 | <reponame>Hyrschall/Woz-U-Python-Class<filename>lesson_seven/main/lesson_seven_pages.py
# L7 Standard Library Testing
# Page 6
# import math, random
#
# my_random = random.random()*100
#
# square_root = math.sqrt(my_random)
# Page 8
# file = open('example.txt', 'w')
#
# print('File Name:', file.name)
# print('File Ope... | StarcoderdataPython |
8155961 | <filename>salter.py
#!/usr/bin/python
import os
import shutil
import subprocess
import time
from argparse import ArgumentParser
from paramiko import SSHClient, AutoAddPolicy
__version__ = 'SaltPY 0.1 Alpha'
__author__ = 'Riley - <EMAIL>'
# This is work in-progress.
# TODO: Finish SSH classes and start testing basic s... | StarcoderdataPython |
3371003 | <filename>sdks/apigw-manager/tests/apigw_manager/apigw/test_authentication.py<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
* TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-蓝鲸 PaaS 平台(BlueKing-PaaS) available.
* Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reser... | StarcoderdataPython |
6525078 | <reponame>pedaling/critics<gh_stars>10-100
# coding: utf-8
from collections import namedtuple
import json
import datetime
import logging
import os
import re
from time import mktime
import feedparser
import requests
from lxml import html, etree
from .compat import python_2_unicode_compatible
logger = logging.getLogg... | StarcoderdataPython |
4821261 | from django.conf import settings
from storages.backends.s3boto import S3BotoStorage
class MediaStorage(S3BotoStorage):
bucket_name = settings.AWS_MEDIA_STORAGE_BUCKET_NAME
class StaticStorage(S3BotoStorage):
bucket_name = settings.AWS_STATIC_STORAGE_BUCKET_NAME
| StarcoderdataPython |
5111871 | <filename>assignment_01/src/q1.py
#!/usr/bin/python
"""
author: <NAME>
author: 18998712
module: Applied Mathematics(Numerical Analysis) TW324
task : computer assignment 01
since : Friday-09-02-2018
"""
def question1a():
step, x = 1./10,1.0
print "=" * 64
for i in xrange(0,10):
E1 = (1-cos(x)) / p... | StarcoderdataPython |
1652730 | # Copyright 2019 The Forte Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | StarcoderdataPython |
6500589 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# By: <NAME>
# Standard libraries
# External libraries
# Internal libraries
from .pnet import PNet
from .rnet import RNet
from .onet import ONet
| StarcoderdataPython |
3419764 | studio = AStudio()
shape = RollingPolygon(width=200, N=10)
studio.append(shape)
studio.append(AImage(width=100, image='cat_exotic_shorthair.png'))
for i in range(200):
studio.render()
IPython.display.Image(studio.create_anime())
| StarcoderdataPython |
1662870 | <reponame>efargas/PyBBIO
# gpio.py
# Part of PyBBIO
# github.com/alexanderhiam/PyBBIO
# MIT License
#
# Beaglebone GPIO driver
import os, math, sysfs
from bbio.util import addToCleanup
from config import GET_USR_LED_DIRECTORY, GPIO, GPIO_FILE_BASE, INPUT,\
CONF_PULLUP, CONF_PULLDOWN, CONF_PULL_DISA... | StarcoderdataPython |
9626158 |
class Node:
def __init__(self, value, next_=None):
self.value = value
self.next = next_
class Queue:
def __init__(self, front=None, back=None):
self.front = front
self.back = back
def enqueue(self, value):
node = Node(value)
# is the list empty?
i... | StarcoderdataPython |
1746726 | """
This file registers pre-defined datasets at hard-coded paths, and their metadata.
We hard-code metadata for common datasets. This will enable:
1. Consistency check when loading the datasets
2. Use models on these standard datasets directly and run demos,
without having to download the dataset annotations
We hard... | StarcoderdataPython |
6537878 | from . import TransformFunction, string_to_tfarg_function, mime_type_based_transform
import htmlmth.mods.html
remove_html_comments = TransformFunction("",
"remove html comments",
mime_type_based_transform({
... | StarcoderdataPython |
3541441 | <filename>Python/09. Errors and Exceptions/002. Incorrect Regex.py<gh_stars>1-10
# Problem: https://www.hackerrank.com/challenges/incorrect-regex/problem
# Score: 20
import re
for _ in range(int(input())):
try:
print(bool(re.compile(input())))
except re.error:
print('False')
| StarcoderdataPython |
4937100 | from selenium import webdriver
import pandas as pd
import datetime
import time
import bs4
'''
This script requires an auto-switching VPN to work properly. If you run without regularly switching IP addresses
Angel List detects the scraper and throws up a captcha. Recommend Hide My Ass v2 or similar VPN.
'''
# Functio... | StarcoderdataPython |
1808016 | <gh_stars>1-10
import re
class Reader:
def __init__(self, string):
self.regex_separacao = re.compile(r'[ \t\n]+')
self.regex_excluir = re.compile(r'({[^}]+})|(/\*([\s\S]+?)\*/)')
# passando ponteiro file
# with open(string, 'r') as reader:
# self.dados = reader.r... | StarcoderdataPython |
141779 | from endochrone.classification.binary_tree import BinaryDecisionTree
from endochrone.classification.naive_knn import KNearest
from endochrone.classification.naive_bayes import NaiveBayes
__all__ = ['BinaryDecisionTree', 'KNearest', 'NaiveBayes']
| StarcoderdataPython |
8042801 | <reponame>brookisme/tfbox
from pprint import pprint
import tensorflow.keras as keras
from . import load
from . import blocks
from . import addons
import tfbox.utils.helpers as h
#
# Model: Parent class for TBox models/blocks
#
# a simple wrapper of keras.Model with the following additions:
#
# - an optional class... | StarcoderdataPython |
1725471 | <gh_stars>0
import logging
import rethinkdb as r
from datetime import datetime as dt
import emoji
import time
from tornado.gen import coroutine, Return
from relay_config import cfg
DB_NAME = cfg.db_name
WALKER_TABLE = cfg.walker_table
TEAM_TABLE = cfg.team_table
MIN_LAP_TIME = cfg.min_lap_time
MICROS_PER_SEC = 100000... | StarcoderdataPython |
9624467 | import argparse
import glob
import os
import sys
import subprocess
import configparser
import re
def clean_classes(directory):
for class_file in glob.glob(os.path.join(directory, "*.class")):
print(f"Cleaning class file {class_file}")
os.remove(class_file)
def clean_tests(directory):
for txt_file in glob.glob(o... | StarcoderdataPython |
327422 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
A simple tool to manipulate data from/to ascii files.
"""
import copy as cp
import numpy as np
import fnmatch as fnm
#-----------------------------------------------------------------------------------------
class AsciiTable():
def __init__(self, header=[]):
... | StarcoderdataPython |
4891809 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2020, XLAB Steampunk <<EMAIL>>
#
# Apache License v2.0 (see https://www.apache.org/licenses/LICENSE-2.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
"metadata_version": "1.1",
"status"... | StarcoderdataPython |
8025478 | <reponame>quintenroets/sysetup<gh_stars>0
import argparse
import cli
from . import env, files, git, installer
def setup():
env.setup()
files.setup()
installer.setup()
git.setup()
cli.run("reboot now", root=True)
def main():
parser = argparse.ArgumentParser(description="Setup OS")
parse... | StarcoderdataPython |
9759584 | """
Чтение навигационных файлов в формате RINEX
"""
import datetime
import logging
from abc import ABC, abstractmethod
from coordinates.exceptions import RinexNavFileError
LOGGER = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
def validate_epoch(epoch):
"""Check epoch and convert into dat... | StarcoderdataPython |
1633129 | print('\033[32m-=\033[m' * 30)
print('Analisador de Triângulos ')
print('\033[32m-=\033[m' * 30)
a = float(input('Primeiro segmento: '))
b = float(input('Segundo segmento: '))
c = float(input('Terceiro segmento: '))
if (b-c) < a < (b+c) and (a-c) < b < (a+c) and (a-b) < c < (a+b):
print('Os segmentos acima PODEM F... | StarcoderdataPython |
204380 | <gh_stars>1-10
#Defining a simple dictionary where key is "A" and its value is a list i.e. ["apple", "animal"]
myDict = {"A": ["apple", "animal"]}
print(myDict["A"]) | StarcoderdataPython |
8105623 | <gh_stars>10-100
#!/usr/bin/env python
# Copyright 2017 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://aws.amazon.com/apach... | StarcoderdataPython |
3590246 | <gh_stars>1-10
produtos = ('Lapis', 1.75,
'Borracha', 2,
'Caderno', 15.98,
'Estojo', 25,
'Transferidor', 4.20,
'Compasso', 9.99,
'Mochila', 120.32,
'Canetas', 22.30,
'Livros', 34.90)
print('-'*43)
print('{:^43}'.format('LIST... | StarcoderdataPython |
11284960 | import os
import signal
class SignalHandler(object):
"""Class to detect OS signals
e.g. detect when CTRL+C is pressed and issue a callback
"""
def __init__(self, sig=signal.SIGINT, callback=None, resignal_on_exit=False):
self.sig = sig
self.interrupted = False
self.release... | StarcoderdataPython |
8161674 | import random
banner = '''\nWelcome to connect, I hope you enjoy your dots.\n- <NAME>[ka-ne-ct]\n'''
chars = ['a', 'b' 'c' 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', '... | StarcoderdataPython |
6449868 | <filename>src/pathmagic.py
import os
import sys
def setup():
"""Add path to this file to sys.path"""
app_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(app_dir)
sys.path.insert(0, app_dir)
return app_dir
| StarcoderdataPython |
219334 | # Copyright (c) IMToolkit Development Team
# This toolkit is released under the MIT License, see LICENSE.txt
import os
import sys
import glob
import re
import time
import shutil
from scipy import special
import numpy as np
import itertools
from imtoolkit import *
def getHammingDistanceTable(MCK, indsdec):
# This ... | StarcoderdataPython |
3487872 | import pyimgur
from unsplash.api import Api
from unsplash.auth import Auth
IMGUR = pyimgur.Imgur("123")
DARK_SKY_API_KEY = "123"
UNSPLASH = Api(Auth("123", "123", ""))
LOG_DIR = "log"
SENDER_EMAIL = "123@123.123"
SENDER_PASSWORD = "<PASSWORD>"
| StarcoderdataPython |
6533590 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Module laying out basic functionality for reading and writing NITF files. This is **intended**
to represent base functionality to be extended for SICD, CPHD, and SIDD capability.
"""
import logging
from typing import List, Tuple
import re
import numpy
from .base import BaseChi... | StarcoderdataPython |
5016258 | import asyncio
import logging
from centimani.headers import Headers
_LOGGER = logging.getLogger(__name__)
REQUEST_METHODS = frozenset(
{"GET", "HEAD", "POST", "OPTIONS", "PUT", "PATCH", "DELETE"}
)
#======================================#
# HTTP Response and Request Structures #
#=============================... | StarcoderdataPython |
4879726 | """
BUFR - SYNOP Map
"""
# (C) Copyright 2017- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its ... | StarcoderdataPython |
1861746 | import time
import json
from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTShadowClient
#awshost you got from `aws iot describe-endpoint`
awshost = "a134g88szk3vbi.iot.us-east-1.amazonaws.com"
# Edit this to be your device name in the AWS IoT console
thing = "raspberry_pi2"
awsport = 8883
caPath = "/home/levon/iot_keys/... | StarcoderdataPython |
3426648 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | StarcoderdataPython |
8037563 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import gtk
import time
import appindicator
import httplib
import re
UPDATE_FREQ_IN_MINUTES = 15
APP_VERSION = "0.1.0"
APP_ID = "yandex-probki-indicator"
USER_AGENT = "{0}/{1} ({2})".format(
APP_ID, APP_VERSION,
"{0}/{1}".format("https://git... | StarcoderdataPython |
1776558 | <reponame>hp-storage/horizon-ssmc-link
# (c) Copyright [2015] Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | StarcoderdataPython |
1755377 | <reponame>jimit105/leetcode-submissions
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def diameterOfBinaryTree(self, root: Optional[TreeNode]) -> int:
... | StarcoderdataPython |
1966906 | <reponame>jafingerhut/dotfiles<filename>templates/python-3-template.py<gh_stars>1-10
#! /usr/bin/env python3
import os, sys
import re
#import argparse
#import collections
#import fileinput
#import glob
# To enable logging in a standalone Python program (as opposed to one
# that is part of pyATS, which seems to confi... | StarcoderdataPython |
6646820 | <reponame>imyhacker/yukabsen
#!bin/python
import os
#os.system('ifconfig');
def my_function():
print """
====================================
Laravel Helper With Python
Coded By AriKUN | IndoSec
====================================
1. Start Server | 6. Make:Midd
2. Make:Contrll | 7. Mak... | StarcoderdataPython |
12839689 | #!/usr/bin/env python
"""
Example of using the hierarchical classifier to classify (a subset of) the digits data set.
Demonstrated some of the capabilities, e.g using a Pipeline as the base estimator,
defining a non-trivial class hierarchy, etc.
"""
from sklearn import svm
from sklearn.decomposition import TruncatedS... | StarcoderdataPython |
112694 | # -*- coding: utf-8 -*-
import os
from icon.utils.in_memory_zip import InMemoryZip
def test_in_memory_zip():
parent_path: str = os.path.dirname(__file__)
path: str = os.path.join(parent_path, "data_to_zip")
mem_zip = InMemoryZip()
mem_zip.run(path)
with open("data.zip", "wb") as f:
f.w... | StarcoderdataPython |
5186888 | """
This is the sqlalchemy class for communicating with the database.
"""
from datetime import datetime
from sqlalchemy import Integer, Unicode, DateTime, Boolean
from sqlalchemy import Column as col
from sqlalchemy.orm import relationship
import models.base as base
from models.dependent import Dependent
class Cu... | StarcoderdataPython |
4866523 | import dataset
import matplotlib.pyplot as plt
from datetime import datetime
import pytz
date_min = datetime.min.replace(tzinfo=pytz.UTC)
date_max = datetime.max.replace(tzinfo=pytz.UTC)
def generate_plot(process_data):
hours, temps, labels = extract_temperature_hour(process_data)
for i, j, k in zip(hours, t... | StarcoderdataPython |
3200112 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.forms import widgets
from django.forms.fields import ChoiceField
from django.forms.models import ModelForm
from django.utils.html import format_html
from django.... | StarcoderdataPython |
3270355 | """
Antelope Interface Definitions
The abstract classes in this sub-package define what information is made available via a stateless query to an Antelope
resource of some kind. The interfaces must be instantiated in order to be used. In the core package
"""
from .interfaces.abstract_query import PrivateArchive, En... | StarcoderdataPython |
3587801 | <reponame>ygingras/mtlpyweb<gh_stars>1-10
from django.test import TestCase
from mtlpy import views
from mtlpy.models import Sponsor
class IntegrationTestCase(TestCase):
def setUp(self):
self.sponsor = Sponsor.objects.create(
name='test', slug='test', url='http://testserver.com', logo=None)
... | StarcoderdataPython |
3529497 | <filename>pf_constants.py
# Constants for use in the pynk_floyd project
# File path for training data
# TRAINING_DATA_PATH = "C:\\Users\\daeur\\PycharmProjects\\pynk_floyd\\Training Data\\darkside.txt"
TRAINING_DATA_PATH = "C:\\Users\\daeur\\PycharmProjects\\pynk_floyd\\Training Data\\pinkfloyd.txt"
EPOCHS = 20
# Lo... | StarcoderdataPython |
6472597 | <reponame>bobwol/subscribely<gh_stars>10-100
"""
Module to provide plug-and-play authentication support for Google App Engine
using flask-auth.
"""
from google.appengine.ext import db
from flaskext.auth import AuthUser
class User(db.Model, AuthUser):
"""
Implementation of User for persistence in Google's App ... | StarcoderdataPython |
6602838 | <reponame>TurtleSquad007/low-pressure<filename>ratecourse/api/migrations/0007_comments_user.py<gh_stars>0
# Generated by Django 3.2.9 on 2022-01-15 22:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0006_auto_20220115_1511'),
]
operat... | StarcoderdataPython |
18445 | <reponame>cptanalatriste/AttnGAN<gh_stars>0
from datetime import datetime
from typing import List
import dateutil
from datasets import TextDataset
from miscc.config import cfg_from_file, cfg
from torchvision.transforms import transforms
from attnganw.train import GanTrainerWrapper, BirdGenerationFromCaption
def get... | StarcoderdataPython |
33370 | from rest_framework import serializers
from ..models import Faculties, Departaments, StudyGroups, Auditories, Disciplines
class FacultiesSerializers(serializers.ModelSerializer):
"""Faculties API"""
class Meta:
fields = '__all__'
model = Faculties
class DepartamentsSerializers(serializers.M... | StarcoderdataPython |
5029880 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf.urls import *
from .views import like_set
urlpatterns = [
url(r'^like/$', like_set, name="like_set"),
] | StarcoderdataPython |
11344864 | import os
from pathlib import Path
from urllib.parse import urljoin
from datetime import datetime
from django.http import Http404
from django.core.exceptions import PermissionDenied
from django.utils.translation import ugettext_lazy as _
from django.http import JsonResponse
from django.conf import settings
from django.... | StarcoderdataPython |
11311208 | def binary_search(user_list, item):
""" Бинарный поиск элемент в списке
Функция получает отсортированный список и значение, которое необходимо найти.
Если значение присутствует в массиве, то функция возвращает его позицию.
Бинарный поиск работает только в том случае, если список отсортирован.
При б... | StarcoderdataPython |
6496135 | import sys
import importlib
from .backend import backend
__all__ = ["get_registry", "load_models"]
def _gen_missing_model(model, backend):
def _missing_model(*args, **kwargs):
raise ImportError(f"model {model} is not supported by '{backend}'."
" You can switch to other... | StarcoderdataPython |
4978902 | <filename>est8/backend/definitions.py
from dataclasses import dataclass
from enum import Enum, auto
from random import choice, shuffle
from typing import Tuple, Dict, Iterable, Optional, Generator
class ActionEnum(Enum):
"""Enum of possible card actions."""
bis = auto()
fence = auto()
park = auto()
... | StarcoderdataPython |
1935627 | from copy import deepcopy
from pystac.item import (Item, Asset)
from pystac import STACError
class EOItem(Item):
"""EOItem represents a snapshot of the earth for a single date and time.
Args:
id (str): Provider identifier. Must be unique within the STAC.
geometry (dict): Defines the full foo... | StarcoderdataPython |
3440039 | <filename>src/pyrin/database/bulk/component.py
# -*- coding: utf-8 -*-
"""
database bulk component module.
"""
from pyrin.application.decorators import component
from pyrin.application.structs import Component
from pyrin.database.bulk import DatabaseBulkPackage
from pyrin.database.bulk.manager import DatabaseBulkManag... | StarcoderdataPython |
4947293 | <reponame>EliahKagan/old-practice-snapshot
#!/usr/bin/env python3
from itertools import chain
import re
EMPLOYEE_REGEX = re.compile(r'(?P<name>\w+)\W+(?P<salary>\d+)')
def read_employees():
input() # don't need n
for match in EMPLOYEE_REGEX.finditer(input()):
yield match.group('name'), int(match.gro... | StarcoderdataPython |
3458171 | <reponame>vishalbelsare/cameo
# Copyright 2014 Novo Nordisk Foundation Center for Biosustainability, DTU.
#
# 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/license... | StarcoderdataPython |
1887676 | """
Unit tests for vmc_distributed_firewall_rules execution module
"""
from unittest.mock import patch
import pytest
import saltext.vmware.modules.vmc_distributed_firewall_rules as vmc_distributed_firewall_rules
from saltext.vmware.utils import vmc_constants
@pytest.fixture
def distributed_firewall_rules_data_by... | StarcoderdataPython |
94811 | <filename>validate_no_label.py<gh_stars>0
#!/usr/bin/env python
""" ImageNet Validation Script
This is intended to be a lean and easily modifiable ImageNet validation script for evaluating pretrained
models or training checkpoints against ImageNet or similarly organized image datasets. It prioritizes
canonical PyTorch... | StarcoderdataPython |
333773 | <filename>src/tests/test_merge.py
from unittest import TestCase
from merge import Merge3, merge3_lists
class TestThreeWayListMerge(TestCase):
def test_added_deleted(self):
x = ['Module1']
a = ['Module1', 'Module2']
b = ['Module1', 'Module3']
added, deleted, maybe_modified = me... | StarcoderdataPython |
11375130 | <filename>test/conftest.py
# Copyright 2021 Open Rise Robotics
#
# 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 applic... | StarcoderdataPython |
3495927 | class MondayCollection:
def __init__(self, client):
self.client = client
self.collection = {}
def __iter__(self):
yield from (self.collection.get(i) for i in self.collection)
def __len__(self):
return len(self.collection)
def __getitem__(self, item_id):
item = ... | StarcoderdataPython |
3443399 | import os, sys
tail -n +15 sys.argv[1] > sys.argv[1]
| StarcoderdataPython |
11345126 | <gh_stars>1000+
#!/usr/bin/env python3
#
# alloc_instrumentation.py
#
# This source file is part of the FoundationDB open source project
#
# Copyright 2013-2019 Apple Inc. and the FoundationDB project authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compl... | StarcoderdataPython |
4882216 | <reponame>qiwihui/django-event-system
from .TestDispatch import *
from .TestEvent import TestEventAndListener
from .TestDispatcherMock import TestDispatcherMock
from .TestUtils import TestUtils | StarcoderdataPython |
3301560 | import Block as bl
import time
class Blockchain:
DIFFICULTY = 4
def __init__(self):
self.chain = []
self.unconfirmed_transactions = [] # data not yet validated
def create_genesis_block(self):
genesis_block = bl.Block(0, [], 0, "0")
genesis_block.hash = genesis_block.c... | StarcoderdataPython |
101861 | from pathlib import Path
import pytest
import sys
import ssh2net
from ssh2net import SSH2Net
from ssh2net.exceptions import ValidationError, SetupTimeout
NET2_DIR = ssh2net.__file__
UNIT_TEST_DIR = f"{Path(NET2_DIR).parents[1]}/tests/unit/"
def test_init__shell():
test_host = {"setup_host": "my_device ", "aut... | StarcoderdataPython |
6442854 | <gh_stars>1-10
# Created by <NAME>, <NAME> Scientific
# import modules
from .lockable import Lockable
class EnumDataType(Lockable):
"""
The pyeds.EnumDataType class is used to hold all the information about a
specific enum type. It provide access to details of all defined elements as
well as convers... | StarcoderdataPython |
320346 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | StarcoderdataPython |
3470428 | # Modified version of Transformers compute metrics script
# Source: https://github.com/huggingface/transformers/blob/v2.7.0/src/transformers/data/metrics/__init__.py
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights ... | StarcoderdataPython |
227499 | <reponame>SELO77/django_template<gh_stars>0
# from core.urls import urlpatterns
# __all__ = [
# 'urlpatterns', ''
# ] | StarcoderdataPython |
385154 | <gh_stars>0
import numpy as np
import os.path, sys
import h5py
from scipy.interpolate import splev, splrep
from randoms import make_random_catalogue,make_Nrandom_catalogue
#############################
#
# Input ARGUMENTS
#
narg = len(sys.argv)
if(narg == 7):
mag_lim = float(sys.argv[1])
N_rand = int(sys.argv... | StarcoderdataPython |
6559432 | <reponame>ritchieyu/NeuroTechX-McGill-2021<filename>software/data_collection_platform/backend/dcp/models/data.py
from dcp.models.utils import auto_str
from dcp.models.collection import CollectionInstance
from dcp import db
@auto_str
class CollectedData(db.Model):
__tablename__ = "collected_data"
id = db.Col... | StarcoderdataPython |
270427 | import os
import json
import yaml
import copy
from collections import OrderedDict
from catalyst.utils.misc import merge_dicts
def load_ordered_yaml(
stream, Loader=yaml.Loader, object_pairs_hook=OrderedDict
):
"""
Loads `yaml` config into OrderedDict
Args:
stream: opened file with yaml
... | StarcoderdataPython |
220806 | import click
from flask import Flask
from dadd import server
from dadd.master.utils import update_config
# Set up the app object before importing the handlers to avoid a
# circular import
app = Flask(__name__)
app.config.from_object('dadd.master.settings')
import dadd.master.handlers # noqa
import dadd.master.api... | StarcoderdataPython |
9797213 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 8 10:50:50 2017
@author: atholon
"""
import time
import calendar
import string
import operator
import json
import csv
import tweepy
from Storage import Storage
from FrenchStemmer import FrenchStemmer
from creds import get_tweepy_api
... | StarcoderdataPython |
1739260 | <filename>fake_cifar10.py<gh_stars>100-1000
# Copyright 2016 Google 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.... | StarcoderdataPython |
5072881 | from flask import Flask, jsonify, render_template, request
from flask_mongoengine import MongoEngine, MongoEngineSessionInterface, DoesNotExist
from flask_debugtoolbar import DebugToolbarExtension
app = Flask(__name__)
app.config['MONGODB_SETTINGS'] = {
'db': 'house-hunt',
}
app.config['DEBUG_TB_PANELS'] = {
"... | StarcoderdataPython |
5177279 | <reponame>mchoi8739/incubator-mxnet<gh_stars>100-1000
# coding: utf-8
# Licensed to the Apache Software Foundation (ASF) 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 ... | StarcoderdataPython |
6640019 | <gh_stars>10-100
# Created by MechAviv
# Quest ID :: 17602
# [Commerci Republic] Neinheart's Request
sm.setNpcOverrideBoxChat(1540451)
sm.sendNext("According to intelligence reports, the people of Commerci are fiercely independent. The Empress means well, but in their eyes, any outreach might be thought an attempt to ... | StarcoderdataPython |
11342190 | <reponame>VitorNoVictor/Hebrew-Tokenizer
#!/usr/bin/env python
# encoding: utf-8
import sys
import os
print(os.path.abspath(os.getcwd()))
sys.path.append(os.path.abspath(os.getcwd()))
from hebrew_tokenizer.tokenizer import tokenizer
def tokenize(text, with_whitespaces=False):
tokenizer.with_whitespaces = with_whi... | StarcoderdataPython |
5054539 | # Import the abstract class that is the blueprint for implementing AUV dynamics
from .abstract_auv_dynamics import AbstractAUVDynamics
# Import the class that can implement a neutral buoyancy vehicle in an efficient manner
from .neutral_buoyancy_auv_dynamics import NeutralBuoyancyAUVDynamics
# Import the class where ... | StarcoderdataPython |
6487415 | <gh_stars>0
import os
import uuid
import hashlib
import boto3
from typing import List
def event_body(event: dict) -> dict:
body = event.get('body', {})
if body:
event = body
return event
def create_conversation_id(users: List[str]) -> str:
print('users for conversation_id:')
print(users... | StarcoderdataPython |
1663808 | from django import forms
from .models import Student
from django.core.validators import MaxValueValidator, MinValueValidator
class StudentForm(forms.ModelForm):
first_name = forms.CharField(max_length=100)
last_name = forms.CharField(max_length=100)
house = forms.CharField(
max_length=2,
w... | StarcoderdataPython |
3265907 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
import sys
import django
django.setup()
from djpersonnel.requisition.models import Operation as Requisition
from djpersonnel.transaction.models import Operation as Transaction
# env
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djpersonnel... | StarcoderdataPython |
6521691 | <reponame>T-Mac/Handle<filename>lib/network/__init__.py
from server import Server
from client import Client
from loader import loadNetwork | StarcoderdataPython |
3528231 | CAMERA_INDEX = 1
COLOR_BINARIZATION_THRESHOLD = 70 # change this value according to
# segmented mode
ITEM_DIMENSION = 80
ITEMS = [#{'name': 'carton',
# 'color': (20.0, 19.0, 16.0)},
#{'name': 'blue',
# 'color': (69.0, 108.0, 149.0)},
#{'name': '... | StarcoderdataPython |
1654747 | import os
from musurgia.pdf.text import PageText
from musurgia.pdf.positioned import Positioned
from prettytable import PrettyTable
from quicktions import Fraction
from musurgia.fractaltree.fractalmusicsquare import Module
from musurgia.timeline.timeline import TimeLine
path = os.path.abspath(__file__).split('.')[0]... | StarcoderdataPython |
3562203 | import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
from cmfsapy.dimension.fsa import fsa
from cmfsapy.data import gen_ncube
import os
save_path = "./"
ns = [2500]
colors = ['tab:blue', 'tab:orange', 'tab:green']
realiz_id = 100
my_d = np.arange(2, 81)
myk = 20
box = None
for l, n in enumer... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.