id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3480816 | #!/usr/bin/env python
'''
Description: this function translates, speaks, and records a user-specified number of secrets from a file
Author: <NAME>
'''
import os, sys
import json
import collections
import random
import utils
from pprint import pprint
from playsound import playsound
import datetime
from six import stri... | StarcoderdataPython |
8148683 | <filename>Project/Test.py
import unittest
import numpy as np
from unittest.mock import patch
import Transformation as my
atolerance, rtolerance = 0.01, 0.01
class TestPolygon(unittest.TestCase):
# P1 is the square and P2 a pentagon
inp = np.array([[1.0, 1.0, 1.0], [1.0, 5.0, 1.0],
[5.0, 5... | StarcoderdataPython |
9646962 | <gh_stars>10-100
from digideep.environment.common.vec_env import VecEnvWrapper
class VecRandomState(VecEnvWrapper):
def __init__(self, venv):
VecEnvWrapper.__init__(self, venv)
def step_wait(self):
return self.venv.step_wait()
def reset(self):
return self.venv.reset()
... | StarcoderdataPython |
11207850 | <filename>python/ray/tests/test_projects.py
import jsonschema
import os
import pytest
import subprocess
import yaml
from click.testing import CliRunner
import sys
from unittest.mock import patch, DEFAULT
from contextlib import contextmanager
from ray.projects.scripts import (session_start, session_commands,
... | StarcoderdataPython |
3349224 | # -*- 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 under the Apache License, Version 2.0 (the
#... | StarcoderdataPython |
8178994 | <filename>src/example/graph_test.py
import os,sys
sys.path.extend("../")
from lib_piglet.domains import graph
from lib_piglet.expanders.graph_expander import graph_expander
from lib_piglet.search.tree_search import tree_search
from lib_piglet.search.graph_search import graph_search
from lib_piglet.utils.data_structure ... | StarcoderdataPython |
3278412 | import LibraryTT.txt2array as conversion
a=conversion.txt2array()
conversion.imprimir3D(a) | StarcoderdataPython |
1991576 | <reponame>texttheater/tbsp<gh_stars>1-10
import clf
import pathlib
import quantities
import sys
import unittest
class QuantityTestCase(unittest.TestCase):
def setUp(self):
gold_path = (pathlib.Path(__file__).parent.parent / 'data' /
'pmb-2.2.0' / 'gold' / 'train.txt')
silver_... | StarcoderdataPython |
161840 | import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import tensorflow as tf
import time
import numpy as np
import os
root_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
import sys
sys.path.append(root_dir)
from adversarial_robustness.cnns import *
from adversarial_robustness.da... | StarcoderdataPython |
3518579 | from evaluation import Metric, Accuracy, Precision, Recall, F1, FalseAlarm, \
AOD, EOD, SPD, DI, FR, D2H, MAR, SA, SD, SDAR, EFFECTSIZE, MMRE, MdMRE, PRED25, PRED40
from map import DatabaseNoClass
from evaluation.formulas import mar, mdar, sa, effect_size
metric_db = DatabaseNoClass(
{
# Generic
... | StarcoderdataPython |
9768701 | import re
from random import randint, uniform
from collections import defaultdict
r_alphabet = re.compile(u'[а-яА-Я0-9-]+|[.,:;?!]+')
def gen_lines(path):
data = open(path, encoding='utf-8')
for line in data:
yield line.lower()
def gen_tokens(lines):
for line in lines:
for to... | StarcoderdataPython |
8112579 | <filename>Intermediate/filter_function.py
# filter function nr4
def add7(x):
return x + 7
def isOdd(x):
return x % 2 != 0
a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# b = list(filter(isOdd, a))
c = list(map(add7, filter(isOdd, a)))
print(c)
| StarcoderdataPython |
8098795 | <gh_stars>1-10
import matplotlib.pyplot as plt
# Read the stats as string from all three input files
f = open("stats_serv_time_optimal.csv","r") # optimal scheduler
f1 = open("stats2.csv","r") # deadline scheduler
f2 = open("stats_serv_time_cfq.csv","r") #CFQ scheduler
s = f.read()
s1 = f1.read()
s2 ... | StarcoderdataPython |
6579318 | <filename>kornia/geometry/calibration/__init__.py<gh_stars>1000+
from kornia.geometry.calibration.distort import *
from kornia.geometry.calibration.pnp import *
from kornia.geometry.calibration.undistort import *
| StarcoderdataPython |
5191019 | <reponame>mattkirby/zfs-py
#!/usr/bin/env python
"""
Synchronize file systems with zfs send and receive
Gather information about zfs file systems locally and remotely in
order to facilitate synchronizing data across multiple systems.
"""
import os
import subprocess
import sys
import atexit
class ZfsSend:
"""
... | StarcoderdataPython |
4890403 | <reponame>akifoezkan/Halide-HLS<gh_stars>10-100
#!/usr/bin/python3
# to be called via nose, for example
# nosetests-3.4 -v path_to/tests/test_basics.py
from halide import *
def test_types():
t0 = Int(32)
t1 = Int(16)
assert t0 != t1
assert t0.is_float() == False
assert t1.is_float() == False
... | StarcoderdataPython |
1783326 | from telegram import Update, ReplyKeyboardRemove
from telegram.ext import ConversationHandler, CallbackContext
from main import db as db, logger, facts_to_str, bot, ADMIN
from keyboards import *
from steps import CHOOSING_ACTION, CHOOSING_KIND, TYPING_REPLY_FREE_SUGGEST, CHOOSING_GAME_GENRE, CHOOSING_GENRE, \
CHOO... | StarcoderdataPython |
9736882 | from pytest import raises
from metadata_driver_interface.driver_interface import DriverInterface
from metadata_driver_interface.utils import parse_config
def test_driver_expects_plugin():
from metadata_driver_interface.data_plugin import AbstractPlugin
with raises(TypeError):
AbstractPlugin()
def t... | StarcoderdataPython |
1794310 | """Convert a yaml file to bib."""
__version__ = "0.1.4.dev0"
from yaml2bib._yaml2bib import yaml2bib
__all__ = ["yaml2bib"]
| StarcoderdataPython |
1847411 | # Model for Sign Language Recognition
# Importing all the libraries
from keras.models import Sequential
from keras.layers import Conv2D, MaxPooling2D, Flatten, Dense, Dropout
# Initialising the CNN
classifier = Sequential()
# Step 1 - Convolution
classifier.add(Conv2D(16, kernel_size=3, activation='relu', input_shap... | StarcoderdataPython |
4814150 | <reponame>datadavev/noaa
from noaa_sdk.noaa import NOAA
from noaa_sdk.util import UTIL
from noaa_sdk.accept import ACCEPT
| StarcoderdataPython |
6635097 | <reponame>NehaKeshan/nanomine-graph
import rdflib
from . import ingest_tester, template
file_under_test = "L256_S3_Potschke_2004"
class IngestTestRunner(template.IngestTestSetup):
first_run = bool()
@classmethod
def setUpClass(cls):
cls.file_under_test = file_under_test
super().setUpClass... | StarcoderdataPython |
9620154 | <reponame>svfat/ls-geofiller
#!/usr/bin/env python
# coding: utf-8
import MySQLdb
import requests
from time import sleep
import json
from difflib import SequenceMatcher
import pickle
import os
HOST = "localhost"
USER = "********"
PASSWORD= "*********"
DB = "***********"
USER_TABLE = "prefix_user"
GEOTARGET_TABLE = "p... | StarcoderdataPython |
12802813 | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
A basic test of compiling assembler files.
"""
import sys
import TestGyp
if sys.platform != 'win32':
# TODO(bradnelson): get this wo... | StarcoderdataPython |
6429970 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sq
import fp
import os
if(os.path.isfile('/home/zhao/sw/v.txt')):
os.remove('/home/zhao/sw/v.txt')
if(os.path.isfile('/home/zhao/sw/adj.txt')):
os.remove('/home/zhao/sw/adj.txt')
if(os.path.isfile('/home/zhao/sw/adv.txt')):
os.remove('/home/zh... | StarcoderdataPython |
9611594 | '''
This is an empty file :)
'''
print "The comment is a lie!!"
TEST_CONST_100 = 100
TEST_CONST_101 = 101
TEST_CONST_102 = 102
alist = [TEST_CONST_100, TEST_CONST_101, TEST_CONST_102]
alist[0] = 103
print alist
print TEST_CONST_100
print TEST_CONST_101
print TEST_CONST_102 | StarcoderdataPython |
9607159 | from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import QRect
from PyQt5.QtWidgets import QMessageBox, QDesktopWidget, QCheckBox
from SQL_functions import *
from search_genius import *
class Ui_Filters(QtWidgets.QWidget):
switch_window = QtCore.pyqtSignal(list)
switch_window2 = QtCore.pyqtSign... | StarcoderdataPython |
3420935 | # Django settings for alertspusher project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
SITE_ID = 1
ADMINS = (
# ('<NAME>', '<EMAIL>'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'alertspusher'
DATABASE_USER = 'root'
DATABASE_PASSWORD = ''
DATABASE_HOST = '' ... | StarcoderdataPython |
4893729 | import argparse
import pathlib
import os
import sys
import gym
import time
import platform
import random
import pickle
import torch
import torch.nn.functional as F
import torch.utils.data as data_utils
from torch import nn
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from my_util... | StarcoderdataPython |
11201697 | <reponame>VladimirZubavlenko/ikaf42-app
import jwt
from datetime import datetime
from datetime import timedelta
from django.conf import settings
from django.db import models
from django.core import validators
from django.contrib.auth.models import AbstractBaseUser
from django.contrib.auth.models import PermissionsMix... | StarcoderdataPython |
1973096 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.ActivityLimitationDTO import ActivityLimitationDTO
from alipay.aop.api.domain.FullDiscountDTO import FullDiscountDTO
from alipay.aop.api.domain.FullGiftDTO import... | StarcoderdataPython |
9721426 | #!/usr/bin/env python3
# copy_pins_for_duino.py 26.4.2021/pekka
# Copies pins library files needed for PlatformIO Arduino build
# into /coderoot/lib/arduino-platformio/pins directory.
# To make this look like Arduino library all .c and .cpp
# files are copied to target root folder, and all header
# files info subfolder... | StarcoderdataPython |
9781629 | <filename>starthinker/task/traffic/landing_page.py
###########################################################################
#
# 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 ... | StarcoderdataPython |
5095912 | import torch
from torch_geometric.nn import knn
from torch_scatter import scatter_add
def knn_interpolate(x, pos_x, pos_y, batch_x=None, batch_y=None, k=3):
r"""The k-NN interpolation from the `"PointNet++: Deep Hierarchical
Feature Learning on Point Sets in a Metric Space"
<https://arxiv.org/abs/1706.024... | StarcoderdataPython |
1863442 | class Solution:
"""
@param a: a string
@param b: a string
@return: a string representing their multiplication
"""
def complexNumberMultiply(self, a, b):
# Write your code here
ra, ia = map(int, a[:-1].split('+'))
rb, ib = map(int, b[:-1].split('+'))
return '{}+{}i... | StarcoderdataPython |
1716284 | <filename>NeuroMechFly/sdf/units.py
"""
-----------------------------------------------------------------------
Copyright 2018-2020 <NAME>, <NAME>
Copyright 2018 BioRobotics Laboratory, École polytechnique fédérale de Lausanne
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file ex... | StarcoderdataPython |
3478066 | <gh_stars>1-10
import os
import sys
import urllib
from urlparse import parse_qs
import xbmc
import xbmcaddon
import StorageServer
class SettingsValue(object):
"""
Contains value obtained from settings.
"""
def __init__(self, name, value):
"""
:param str name: Value name. It is not c... | StarcoderdataPython |
6546024 | <filename>audit/middleware.py
from django.db.models.signals import post_init
from django.utils.functional import curry
from audit.signals import pass_audit_user
class AuditMiddleware(object):
"""Middleware that registers a post init handler for all models to ensure the actor of a model change is logged
proper... | StarcoderdataPython |
9752098 | <filename>teledump/settings/ChatDumpMetaFile.py
""" This Module contains classes related to Metadata Files"""
import codecs
import errno
import json
import logging
import os.path
from . import ChatDumpSettings
from ..exceptions import MetaFileError
class ChatDumpMetaFile:
""" Metadata file CRUD """
key_vers... | StarcoderdataPython |
3273380 | """Nonholonomic vehicle system."""
import gym
from gym_socks.envs.dynamical_system import DynamicalSystem
import numpy as np
from scipy.integrate import solve_ivp
class NonholonomicVehicleEnv(DynamicalSystem):
"""Nonholonomic vehicle system.
Bases: :py:class:`gym_socks.envs.dynamical_system.DynamicalSyste... | StarcoderdataPython |
3498466 | <reponame>pkyIntelligence/FasterRCNN
from .evaluator import DatasetEvaluator, inference_on_dataset
from .testing import print_csv_format, verify_results
__all__ = [k for k in globals().keys() if not k.startswith("_")]
| StarcoderdataPython |
9692910 | <filename>examples/AutomotiveCybersecurity/notebooks/_build/jupyter_execute/Summary & Further Resources.py
# Summary & Further Resources
That was a long tutorial! But hey, when was the last time you've seen a non-trivial one?
To recap, the H1ST.AI principles & ideas we've learned:
* Leverage use-case analysis to de... | StarcoderdataPython |
9641799 | comanda = ""
while comanda != "quit":
comanda = input("> ").lower()
if comanda == "start":
print("Masina a pornit")
elif comanda == "stop":
print("Masina sa oprit")
elif comanda == "help":
print('''
Start - Masina porneste
Stop - Masina se opreste
quit - A iesi
... | StarcoderdataPython |
9723012 | # Modified by Augmented Startups & <NAME>
# October 2020
# Facial Recognition Attendence GUI
# Full Course - https://augmentedstartups.info/yolov4release
# *-
import sys
from PyQt5.uic import loadUi
from PyQt5 import QtWidgets
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QApplication, QDialog
... | StarcoderdataPython |
1796964 | <filename>setup.py
"""
Copyright 2016 Load Impact
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... | StarcoderdataPython |
258517 | # -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'range_pop.ui'
##
## Created by: Qt User Interface Compiler version 6.1.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
#################... | StarcoderdataPython |
3391642 | def f(a, b):
a += b
return a
# 数字没变化
x = 1
y = 2
print(f(x, y))
print(x, y)
# 列表参数发生变化
a = [1, 2]
b = [3, 4]
print(f(a, b))
print(a, b)
# 元组参数没变化
t = (10, 20)
u = (30, 40)
print(f(t, u))
print(t, u) | StarcoderdataPython |
4927861 | <filename>src/aiodynamo/utils.py
import base64
import datetime
import decimal
import logging
from collections import abc as collections_abc
from functools import reduce
from typing import Any, Callable, Dict, Mapping, Tuple, Union
from .types import SIMPLE_TYPES, AttributeType, DynamoItem, Item
logger = logging.getLo... | StarcoderdataPython |
12833323 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | StarcoderdataPython |
4948681 | <reponame>sara-nl/data-exchange
import sys
from collections import Counter
file = open(sys.argv[1], "rt")
data = file.read()
words = data.split()
most_common = Counter(words).most_common(3)
print('Three most common words are :', most_common)
print('Number of words in text file :', len(words))
| StarcoderdataPython |
283405 | <reponame>Beit-Hatfutsot/mojp-dbs-pipelines
from datapackage_pipelines_mojp.common.processors.post import Processor
from .clearmash.test_convert import get_clearmash_convert_resource_data
from .test_sync import assert_sync_processor
from .common import (given_empty_elasticsearch_instance, get_mock_settings, assert_dict... | StarcoderdataPython |
8136072 | from tfidf import *
import re
import tempfile
from collections import Counter
def test_get_text():
tmpdir = tempfile.gettempdir()
xml = \
"""<?xml version="1.0" encoding="iso-8859-1" ?>
<newsitem itemid="99" id="root" date="1996-10-21" xml:lang="en">
<title>Cats Do Hip Hop</title>
... | StarcoderdataPython |
1716828 | <reponame>dianapei/SC-projects
"""
SC101 Baby Names Project
Adapted from <NAME>'s Baby Names assignment by
<NAME>.
This program will show the rank line chart of the names from 1900 to 2010 searched by user
"""
import tkinter
import babynames
import babygraphicsgui as gui
FILENAMES = [
'data/full/baby-1900.txt', ... | StarcoderdataPython |
362969 | <reponame>runjerry/alf
# Copyright (c) 2019 Horizon Robotics. 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
#
# Unle... | StarcoderdataPython |
3418195 | <gh_stars>1-10
"""validate.py.
Validates a WE1S manifest schema. Arguments can be file paths, urls, or dicts.
Usage:
python validate.py PATH_TO_SCHEMA PATH_TO_DATA
"""
# Python imports
import argparse
import json
import jsonschema
import requests
from jsonschema import Draft7Validator, FormatChecker, validate
# Va... | StarcoderdataPython |
3595866 | import numpy as np
from robosuite_extra.env_base import make
from robosuite_extra.wrappers import EEFXVelocityControl, GymWrapper, FlattenWrapper
from sim2real_policies.final_policy_testing.network_loading import load, load_model
import os
from sim2real_policies.final_policy_testing.epi_utils import EPIpolicy_rollout
i... | StarcoderdataPython |
49027 | <filename>Provinces and Gold/prov.py
"""https://open.kattis.com/problems/provincesandgold"""
from collections import OrderedDict
vic, tres = OrderedDict(), OrderedDict()
vic = {"Province": 8, "Duchy": 5, "Estate": 2}
tres = {"Gold": 6, "Silver": 3, "Copper": 0}
inp = list(map(int, input().split()))
money = inp[0] * 3... | StarcoderdataPython |
6695062 | <filename>newsCrawler/crawler/spiders/crawler.py<gh_stars>0
# This file defines Crawler for News Website.
import scrapy
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from crawler.items import NewsItem
import json, os, logging, re
class NewsSpider(CrawlSpider):
... | StarcoderdataPython |
3452759 | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 1 08:38:30 2019
@author: dordoloy
"""
import os
import pika
import config
import time
count = 0
def callback(ch, method, properties, body):
##
#Function that print the received message and count the number of message received
#Args:
# @param ch
... | StarcoderdataPython |
5160114 | from plugins.folio.login import folio_login
def test_folio_login():
assert folio_login
| StarcoderdataPython |
1673718 | import copy
import logging
import random
logging.getLogger('transformers').setLevel(level=logging.WARNING)
from nltk.tokenize import sent_tokenize
import torch
import tqdm
from transformers import BertForMaskedLM, BertTokenizer, AdamW, get_linear_schedule_with_warmup
from utils import (
BertInput,
Defaults,
... | StarcoderdataPython |
1837436 | class Solution:
def threeSumClosest(self, nums: List[int], target: int) -> int:
ans = nums[0] + nums[1] + nums[2]
nums.sort()
for i in range(len(nums) - 2):
if i > 0 and nums[i] == nums[i - 1]:
continue
l = i + 1
r = len(nums) - 1
while l < r:
sum = nums[i] + nums... | StarcoderdataPython |
9616363 | <filename>MONFG.py
import time
import argparse
import numpy as np
import pandas as pd
from utils import *
from games import *
from no_com_agent import NoComAgent
from comp_action_agent import CompActionAgent
from coop_action_agent import CoopActionAgent
from coop_policy_agent import CoopPolicyAgent
from optional_com_... | StarcoderdataPython |
5049828 | <reponame>leeh8911/ML-From-Scratch
from __future__ import print_function, division
from sklearn import datasets
import math
import matplotlib.pyplot as plt
import numpy as np
import progressbar
from sklearn.datasets import fetch_mldata
from mlfromscratch.deep_learning.optimizers import Adam
from mlfromscratch.deep_le... | StarcoderdataPython |
3341489 | <reponame>Daniel-Vital/magicroot
"""
This file contains the functions used to compute useful values for predetermined dataframe structures
"""
from . import format
from datetime import timedelta
import numpy as np
import pandas as pd
def duration(df, dt_begin, dt_end, computed_column='duration', days=False, *args, *... | StarcoderdataPython |
11209506 | <reponame>a-sk/templet-python
import re
import ast
from setuptools import setup
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('{{ PROJECT_NAME }}/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
setup(
name='{{ PROJE... | StarcoderdataPython |
4998784 | from setuptools import setup
setup(
name = 'enginemonitor',
version = '1.0.0',
license = 'license name, e.g. MIT',
description = '',
author = '<NAME>',
author_email = '<EMAIL>',
package_dir={'':'src'},
install_requires=[
'psutil',
'pymongo',
'wmi'
],
classifiers=[
'Development Status ... | StarcoderdataPython |
6483806 | <gh_stars>0
from motor.motor_asyncio import AsyncIOMotorClient
from odmantic import AIOEngine
connection_details = "mongodb://mongodb:27017"
client = AsyncIOMotorClient(connection_details)
engine = AIOEngine(motor_client=client, database="guestbook") | StarcoderdataPython |
6546712 | <gh_stars>10-100
import sys
import os
stage='/Users/Shared/Jenkins/Home/workspace/Test1/'
stage1='/Users/Shared/Jenkins/Home/workspace/Test2/'
sys.path.append(stage)
sys.path.append(stage1)
import time
import numpy as np
import pandas as pd
from datetime import datetime as dt
import matplotlib
matplotlib.use('TkAgg')
i... | StarcoderdataPython |
3501762 | <filename>{{cookiecutter.application_name}}/{{cookiecutter.application_name}}/factory.py
# -*- coding: utf-8 -*-
'''The app module, containing the app factory function.'''
from flask import Flask, render_template
from {{cookiecutter.application_name}}.extensions import (
oauth
#add others as needed
)
# -*- co... | StarcoderdataPython |
1730341 | <gh_stars>0
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import sugartensor as tf
num_blocks = 3 # dilated blocks
num_dim = 128 # latent dimension
#
# logit calculating graph using atrous/dilated convolution
#
def get_logit(x, voca_size):
# residual block
... | StarcoderdataPython |
1968323 | # import os
# import cv2
# import numpy as np
#
# INPUT_VIDEO = 'test.mp4'
# OUTPUT_IMG = 'out_my_video'
# os.makedirs(OUTPUT_IMG, exist_ok=True)
#
#
# def print_image(img, frame_diff):
# """
# Place images side-by-side
# """
# new_img = np.zeros([img.shape[0], img.shape[1] * 2, img.shape[2]]) # [heigh... | StarcoderdataPython |
3246871 | <filename>tests/plugins/test_liveme.py
from streamlink.plugins.liveme import LiveMe
from tests.plugins import PluginCanHandleUrl
class TestPluginCanHandleUrlLiveMe(PluginCanHandleUrl):
__plugin__ = LiveMe
should_match = [
"http://www.liveme.com/live.html?videoid=12312312312312312312",
"http:/... | StarcoderdataPython |
1701350 | import signal
import subprocess
import sys
import time
import atexit
import os
class DelayedKeyboardInterrupt(object):
def __enter__(self):
self.signal_received = False
self.old_handler = signal.signal(signal.SIGINT, self.handler)
def handler(self, sig, frame):
self.signal_received = ... | StarcoderdataPython |
9678872 | from __future__ import print_function
"""
Dec 23, 2014
to robertlugg
Hello Robert,
please accept my big excuses for distrubance but simply I did not found answer on google, no one to ask. I want to make
simple GUI program to make things easier (my job is microcontrollers and electronic). Even I`m not so young neither... | StarcoderdataPython |
8048740 | class Solution:
def findLengthOfLCIS(self, nums: List[int]) -> int:
maxIncLength = 1
lengthCounter = 1
for i in range(1,len(nums)):
if nums[i] > nums[i-1]:
lengthCounter += 1
if lengthCounter > maxIncLength:
maxIncLength = lengt... | StarcoderdataPython |
8197711 | # -*- coding: utf-8 -*-
import datetime
from unittest import skipIf
from django.test import TestCase, override_settings
from django.core import mail
from django.core.management import call_command
from django.utils import timezone
from django.core.files.uploadedfile import SimpleUploadedFile
from django.urls import r... | StarcoderdataPython |
98956 | <filename>src/toja/tasks/search.py
import dramatiq
import hashlib
from sqlalchemy import and_
from .middleware import DBSessionMiddleware
from ..config import SOURCE_METADATA, JOKE_METADATA, ANNOTATIONS
from ..models import Image
from ..search import Joke, Autosuggest
from ..util import extract_text, extract_annotati... | StarcoderdataPython |
3466618 | import itertools
from pathlib import PosixPath
from typing import Generator, List
import ants
import numpy as np
import torch
import torchio as tio
from omegaconf.dictconfig import DictConfig
from rich.progress import track
from hsf.augmentation import get_augmented_subject
from hsf.engines import InferenceEngine
d... | StarcoderdataPython |
11344551 | <gh_stars>0
import tensorflow as tf
import numpy as np
from skimage import filters, transform
import matplotlib.pyplot as plt
import math
from setup_cifar import CIFAR, CIFARModel
from setup_mnist import MNIST, MNISTModel
def eval(label, arr):
print(label + " count ", arr.shape[0], " max ", np.max(arr), " min ",... | StarcoderdataPython |
9658870 | <reponame>vponomaryov/manila<filename>manila_tempest_tests/tests/api/test_share_groups.py
# Copyright 2016 <NAME>
# 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 ... | StarcoderdataPython |
4956546 | """
Routines to analyze the data from the COSMOS program.
TO DO:
- persistence correction
"""
import threedhst
import astropy
from astropy.io import fits
from astropy.table import Table as table
import drizzlepac
from drizzlepac import astrodrizzle
import os
import glob
import numpy as np
def split_IMA(root='icxe15... | StarcoderdataPython |
3513678 | from wordcloud_fa import WordCloudFa
wodcloud = WordCloudFa(include_numbers=False, regexp=r"\w[\w']+")
text = ""
with open('english-example.txt', 'r') as file:
text = file.read()
wc = wodcloud.generate(text)
image = wc.to_image()
image.show()
image.save('english-example.png')
| StarcoderdataPython |
3525100 | <filename>iv/Arrays/coverpoints.py<gh_stars>1-10
class Points():
"""
Path Traversed
"""
def coverpoints(self, A, B):
"""
Function to find steps traversed
A is list of x coordinates
B is list of y coordinates
"""
# A = [0, 1, 1]
# B = [0, 1, 2]
... | StarcoderdataPython |
4835030 | <filename>buildall/core.py
import datetime
from pathlib import PosixPath as PythonPathClass
from subprocess import Popen as PythonPopenClass
# TODO: find a better value
END_OF_TIME = datetime.datetime(2100, 1, 1)
BEGINNING_OF_TIME = datetime.datetime(1970, 1, 1)
class BaseTask:
_indent_level = 0
silent = Fal... | StarcoderdataPython |
5085935 | #!/usr/bin/env python
# Copyright (c) 2015 <NAME>
# 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
#
# ... | StarcoderdataPython |
5123325 | <reponame>thorwhalen/ut<filename>semantics/scrap.py
__author__ = 'thor'
from ut.util.decorators import autoargs
class A(object):
@autoargs()
def __init__(self, foo, path, debug=False):
pass
a = A('rhubarb', 'pie', debug=True)
assert(a.foo == 'rhubarb')
assert(a.path == 'pie')
assert(a.debug == True)
... | StarcoderdataPython |
5146380 | from typing import Optional
from pydantic import BaseModel, EmailStr, Field, HttpUrl, SecretStr
# Shared properties
class UserBase(BaseModel):
email: Optional[EmailStr] = Field(None, example="<EMAIL>")
username: Optional[str] = Field(None, example="perryshari")
bio: Optional[str] = None
image: Option... | StarcoderdataPython |
6557342 | <gh_stars>0
print('Load trained simple AE..')
model_name = '20200302_firstAE_model.pt'
model_fn = os.path.join(model_bib_path, model_name)
print(model_fn)
from models.SimpleAutoEncoder import SimpleAutoEncoder
torch.manual_seed(42)
num_inpus = len(df_data_anormal.columns)
val_lambda = 42 * 0.01
model = SimpleAutoEnco... | StarcoderdataPython |
3417828 | <filename>imageInImage.py
from utils.display import display_image
from utils.manipulateImage import rotate_image_by
from utils.processImage import match_templates
from sound.notificationSounds import play_audio_file
from sound.notificationSounds import text_to_speech
# the image filepath
filepath_main = './images/Rasp... | StarcoderdataPython |
3533019 | <filename>tests/test_distmatrix.py
import numpy as np
import os
import unittest
from alfpy import word_distance
from alfpy.utils import distmatrix
from . import utils
class TestDistMatrix(unittest.TestCase):
def setUp(self):
id_list = ['seq1', 'seq2', 'seq3']
data = np.array([[0, 0.3531587, 0.3... | StarcoderdataPython |
1676235 | <gh_stars>1-10
# -*- coding: utf-8 -*-
__author__ = "<NAME>"
__date__ = "17 Nov 2018"
# !!! SEE CODERULES.TXT !!!
from silx.gui import qt
from ..core import singletons as csi
from ..core import commons as cco
from .propWidget import QLineEditSelectRB, PropWidget
# from . import propsOfData as gpd
class ColumnFormat... | StarcoderdataPython |
17332 | <reponame>Aoi-hosizora/NER-BiLSTM-CRF-Affix-PyTorch
import argparse
import json
import matplotlib.pyplot as plt
import numpy as np
import pickle
import time
import torch
from torch import optim
from typing import Tuple, List, Dict
import dataset
from model import BiLSTM_CRF
import utils
def parse_args():
parser ... | StarcoderdataPython |
1686251 | from pgdrive.component.map.base_map import BaseMap, MapGenerateMethod
from pgdrive.envs.pgdrive_env import PGDriveEnv
if __name__ == "__main__":
def get_image(env):
env.vehicle.image_sensors[env.vehicle.config["image_source"]].save_image()
env.engine.screenshot()
env = PGDriveEnv(
{
... | StarcoderdataPython |
6474320 | <filename>surreal/envs/env.py
# Copyright 2019 ducandu GmbH, All Rights Reserved
# (this is a modified version of the Apache 2.0 licensed RLgraph file of the same name).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtai... | StarcoderdataPython |
1974699 | '''
python evaluate.py \
--gt_path ../datasets/nyu_data/test_depth \
--split indoor --eigen_crop \
--min_depth 0.1 --max_depth 10.0 --normalize_depth 10.0 \
--predicted_depth_path ./results/[] \
python evaluate.py \
--gt_path ../datasets/kitti_data/ \
--split eigen --garg_crop \
--min_depth... | StarcoderdataPython |
78111 | from unittest.mock import patch
import pytest
import requests
from scenario_player.exceptions.services import (
BrokenService,
ServiceReadTimeout,
ServiceUnavailable,
ServiceUnreachable,
)
from scenario_player.services.utils.interface import ServiceInterface, SPaaSAdapter
from scenario_player.utils.co... | StarcoderdataPython |
6506179 | import random
import string
import sys
import os
from datetime import date
import datetime
print("(1Loop = 6TokenType)")
Loop = input("How many Tokens loop?: ")
print("\n\n")
count = 0
path = os.path.dirname(os.path.realpath(__file__))
while(int(count)<int(Loop)):
Gen1 = random.choice(string.ascii_letters).upper()+... | StarcoderdataPython |
115496 | # Copyright 2021 Axis Communications AB.
#
# For a full list of individual contributors, please see the commit history.
#
# 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.apac... | StarcoderdataPython |
1618297 | from typing import Deque
from random import sample
from matplotlib import pyplot as plt
import numpy as np
from torch import nn
class ReplayBuffer:
def __init__(self, capacity: int) -> None:
self.buffer = Deque([], maxlen=capacity)
def save(self, obs):
self.buffer.append(obs)
def get_bat... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.