id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
314212 | <reponame>davidryanshay/AIT-Core
# Advanced Multi-Mission Operations System (AMMOS) Instrument Toolkit (AIT)
# Bespoke Link to Instruments and Small Satellites (BLISS)
#
# Copyright 2013, by the California Institute of Technology. ALL RIGHTS
# RESERVED. United States Government Sponsorship acknowledged. Any
# commercia... | StarcoderdataPython |
4859441 | <filename>lndmanage/lib/lncli.py
"""
Handling lncli interaction.
"""
import os
import subprocess
import json
from pygments import highlight, lexers, formatters
from lndmanage import settings
import logging
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
class Lncli(object):
def __i... | StarcoderdataPython |
5135940 | <gh_stars>0
from .user import User
from .token import Token
from .client import Client
from .authorizationcode import AuthorizationCode
| StarcoderdataPython |
52873 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from enum import Enum
class THOST_TE_RESUME_TYPE(Enum):
TERT_RESTART = 0
TERT_RESUME = 1
TERT_QUICK = 2
class TThostFtdcExchangePropertyType(Enum):
"""交易所属性类型"""
THOST_FTDC_EXP_Normal = 48
"""正常"""
THOST_FTDC_EXP_GenOrderByTrade = 49
... | StarcoderdataPython |
9652490 | """
Interface module to the business logic
"""
from app.logic.model_manager import ModelLoader, ModelsIndex
import numpy as np
# Initialize db for docker.csv
db = ModelsIndex('docker.csv', path_to_cache=0)
# Init db for local
#db = ModelsIndex('fixture.csv', path_to_cache=1)
class OperationController:
def __in... | StarcoderdataPython |
5005685 | import requests
from functools import partial
from datetime import datetime, timedelta
import calendar
import math
import nanome
import utils
from nanome.util import Logs
class Calendar:
def __init__(self, _plugin, container):
self._plugin = _plugin
menu = nanome.ui.Menu.io.from_json('components/... | StarcoderdataPython |
5033046 | # Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
# Author (©): <NAME>
import logging
import math
from mcpi.vec3 import Vec3
import mcpi.block
from mcthings.utils import size_region, find_min_max_cuboid_vertex
class BlockMemory:
def __init__(self, block_id, block_data, pos):
self... | StarcoderdataPython |
71099 | <reponame>alexmlamb/blocks_rl_gru_setup<gh_stars>0
from .device import Device
from .log import Logger
from .sample import sample_indices
| StarcoderdataPython |
3417166 | <reponame>asterfusion/sonic-swss-1<filename>neighsyncd/restore_neighbors.py
#!/usr/bin/env python
""""
Description: restore_neighbors.py -- restoring neighbor table into kernel during system warm reboot.
The script is started by supervisord in swss docker when the docker is started.
It does not do anything in ... | StarcoderdataPython |
1622751 | def selection_sort(input_list):
if not isinstance(input_list, list):
raise TypeError('input needs to be a list')
def find_lowest_value_index(start_index):
lowest_value_index = start_index
for i, x in enumerate(input_list[start_index:]):
if x < input_list[lowest_value_index]:... | StarcoderdataPython |
4881952 | <gh_stars>10-100
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. impor... | StarcoderdataPython |
1632018 | # Copyright (c) 2021 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 |
5079236 | # coding: utf-8
# Copyright (c) <NAME>. MIT license.
import os
import sys
import json
import logging
import tornado
import tornado.web
import tornado.ioloop
import tornado.options
import tornado.httpserver
from tornado.options import define, options
from centrifuge.log import logger
from centrifuge.utils import named... | StarcoderdataPython |
3240710 | expected_output = {
'inventory_item_index': {
0: {
'description': 'cisco c1111-8pltela chassis',
'name': 'chassis',
'pid': 'C1111-8PLTELA',
'sn': 'FGL221190VF',
'vid': 'V01',
},
1: {
'description': 'external power supply... | StarcoderdataPython |
124306 | <reponame>obespoir/echecs<gh_stars>10-100
# coding=utf-8
import random
from db.desk import Desk as DBDesk
from service.room.common_define import DeskType
from service.room.handlers.basehandler import BaseHandler, RegisterEvent
from service.room.models.room_desk import RoomDesk
from service.room.models.roomdesk_manage... | StarcoderdataPython |
1825963 | <gh_stars>1-10
import time
from threading import Timer
from zone_api import platform_encapsulator as pe
from zone_api.core.device import Device
from zone_api import time_utilities
class Switch(Device):
"""
Represents a light or fan switch. Each switch contains an internal timer.
When the switch is turned... | StarcoderdataPython |
5071176 | <reponame>joaompinto/kubesh
import io
import yaml
import pkgutil
import importlib
from os.path import dirname
from pathlib import Path
import inspect
import traceback
from wasabi import TracebackPrinter
from .mapper import table_from_list
# https://packaging.python.org/guides/creating-and-discovering-plugins/
class ... | StarcoderdataPython |
9626294 | import numpy as np
from itertools import permutations
def calc(list1):
p = [c for c in permutations(list1, 4)]
symbols = ["+", "-", "*", "/"]
list2 = [] # 算出24的排列组合的列表
flag= False
for n in p:
one, two, three, four = n
for s1 in symbols:
for s2 in symbols:
... | StarcoderdataPython |
118747 | r"""
*****
Array
*****
.. autofunction:: is_all_equal
.. autofunction:: is_all_finite
.. autofunction:: is_crescent
"""
from numpy import asarray, isfinite, mgrid, prod, rollaxis
from numpy import sum as _sum
from numpy import unique as _unique
try:
from numba import boolean, char, float64, int32, int64, jit
... | StarcoderdataPython |
53977 | <reponame>Dan-Patterson/Tools_for_ArcGIS_Pro<gh_stars>10-100
d e f s t r i p _ c o n c a t e n a t e ( i n _ f l d s , s t r i p _ l i s t = [ " " , " , " , N o n e ] ) :
" " " P r o v i d e t h e f i e l d s a s a l i s t i e [ a , b , c ] t o s t r i p s p a c e s
... | StarcoderdataPython |
4954176 | <reponame>chinasaur/bokeh
from __future__ import absolute_import, print_function
import pytest
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from bokeh.io import save
from bokeh.plotting import figure
from tests.integration.utils import has_no_console... | StarcoderdataPython |
11252336 | import nltk
import random
import igraph as ig
import matplotlib.pyplot as plt
from gensim.models import Doc2Vec
from gensim import utils
from plot_chat_path import plot_sentiment, plot_temporal_cluster_using_path, load_tsne_coordinates_from
class ConversationGraph:
def __init__(self, conversation_file, edges_fi... | StarcoderdataPython |
9694470 | <filename>super_sac/nets/cnns.py
import math
import numpy as np
import torch
import torch.nn.functional as F
from torch import distributions as pyd
from torch import nn
from . import weight_init
def compute_conv_output(
inp_shape, kernel_size, padding=(0, 0), dilation=(1, 1), stride=(1, 1)
):
"""
Compute... | StarcoderdataPython |
8135806 | <filename>set_cases_single.py
from singlezone_diss import main
import os
import pandas as pd
print('FIM DA IMPORTACAO')
def set_cases(N_CLUSTERS):
FOLDER = 'sobol'
NAME_STDRD = 'sobol'
os.system('mkdir '+FOLDER)
for i in range(N_CLUSTERS):
os.system('mkdir '+FOLDER+'/clu... | StarcoderdataPython |
9738489 | <filename>gym-sigmoid/gym_sigmoid/envs/sigmoidworld_env.py
import gym
from gym import spaces
from gym import utils
import numpy as np
import logging
import numpy.random as rn
import math
from itertools import product
logger = logging.getLogger(__name__)
class SigmoidWorldEnv(gym.Env, utils.EzPickle):
metadata... | StarcoderdataPython |
1821848 | from django.urls import re_path
from .views import ServeMediaView
app_name = 'gridfs_storage'
urlpatterns = [
re_path(r'^(?P<file_path>.*)/$', ServeMediaView.as_view(), name='media_url')
]
| StarcoderdataPython |
6572944 | from functools import reduce
import random
from collections import defaultdict
from MiniFlow.nn.core import Placeholder
def topological(graph):
graph = graph.copy()
sorted_node = []
while graph:
all_nodes_have_inputs = reduce(lambda a, b: a + b, list(graph.values()))
all_nodes_have_outputs... | StarcoderdataPython |
1672301 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2013-2020 CERN
#
# 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... | StarcoderdataPython |
1659687 | <filename>scripts/addons/auto_mirror_ex.py<gh_stars>1-10
# b2.80~ update by Bookyakuno
####################################################################
# Quickly set up mirror modifiers and assist mirror modifiers
# Detailed authorship:
# Bookyakuno(Current support b2.80~)
# Lapineige(AutoMirror ~b2.79),
# <NAME... | StarcoderdataPython |
92449 |
class UIColors:
"color indices for UI (c64 original) palette"
white = 2
lightgrey = 16
medgrey = 13
darkgrey = 12
black = 1
yellow = 8
red = 3
brightred = 11
| StarcoderdataPython |
3440108 | <filename>software/pynguin/pynguin/setup/testcluster.py
# This file is part of Pynguin.
#
# Pynguin is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option)... | StarcoderdataPython |
6459048 | from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
setup_args = generate_distutils_setup(
packages=['coord_transforms', 'xpc', 'traj_x', 'xplane_ros_utils'],
package_dir={'':'src'}
)
setup(**setup_args) | StarcoderdataPython |
68910 | <reponame>alibaba/FederatedScope
import logging
from collections import deque
from federatedscope.core.worker import Server, Client
from federatedscope.core.gpu_manager import GPUManager
from federatedscope.core.auxiliaries.model_builder import get_model
logger = logging.getLogger(__name__)
class FedRunner(object)... | StarcoderdataPython |
9737548 | <reponame>MartinKondor/leap-of-time
import pygame
from pygame.locals import *
import sys, os, traceback
if sys.platform in ["win32","win64"]: os.environ["SDL_VIDEO_CENTERED"]="1"
import PAdLib.occluder as occluder
import PAdLib.particles as particles
import PAdLib.shadow as shadow
pygame.display.init()
pygame.font.in... | StarcoderdataPython |
4947171 | import sublime
import sys
from imp import reload
# get all modules of OpenSees present
reload_mods = []
for mod in sys.modules:
if mod.startswith("OpenSees") and sys.modules[mod] != None:
reload_mods.append(mod)
# define order of dependencies for proper reloading
mods_load_order = [
"lib",
"lib.he... | StarcoderdataPython |
3444803 | """
Copyright 2019 Trustees of the University of Pennsylvania
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 ... | StarcoderdataPython |
6545469 | """
Created on Mon October 02 11:02:10 2017+5:30
@author: <NAME>
Code uses Python 2.7, packaged with Anaconda 4.4.0
Code developed on Elementary OS with Ubuntu 16.04 variant, with a Linux 4.10.0-33-generic as the Kernel.
Project 4:
-- Steps:
1.Create a csv file with a list of all presidents, their parties from 1920 ... | StarcoderdataPython |
9663822 |
from ..utils import (
update_url_query,
int_or_none
)
from ..utilsEX import url_result
from ..extractor.pluralsight import PluralsightCourseIE as Old
class PluralsightCourseIE(Old):
def _real_extract(self, url):
course_id = self._match_id(url)
# TODO: PSM cookie
course = self.... | StarcoderdataPython |
336230 | """
Test that you can set breakpoint and hit the C++ language exception breakpoint
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestCPPExceptionBreakpoint (TestBase):
mydir = TestBa... | StarcoderdataPython |
11280957 | <gh_stars>0
""" (Sample) workload definition file.
"""
WORKLOAD = []
# replace the paths with your input file paths on stampede
for tj in range(1, 51):
task = {
"runtime" : 60, # minutes per task
"nmode" : "/home1/00988/tg802352/MMPBSASampleDATA/nmode.5h.py",
"com" : "/home1/00988/... | StarcoderdataPython |
4989485 | <reponame>dhermes/hvplot
from distutils.version import LooseVersion
from . import patch, _hv
try:
import intake.plotting # noqa
patch('intake', extension='bokeh')
except:
import intake
if LooseVersion(intake.__version__) <= '0.1.5':
patch('intake', extension='bokeh')
patch('intake', 'p... | StarcoderdataPython |
1680223 | import pytest
from plenum.common.constants import DOMAIN_LEDGER_ID
from plenum.common.txn_util import reqToTxn
from plenum.test.helper import sdk_signed_random_requests
NUM_BATCHES = 3
TXNS_IN_BATCH = 5
def create_txns(looper, sdk_wallet_client):
reqs = sdk_signed_random_requests(looper, sdk_wallet_client, TXNS... | StarcoderdataPython |
6525477 | import types
class MyClass:
def __init__(self):
l = {}
s = '''
def func(self, x):
print(self, ".", x)
'''
exec(s, globals(), l)
self.func = types.MethodType(l['func'], self)
MyClass().func('test')
| StarcoderdataPython |
3385921 | <gh_stars>0
__pdoc__ = {}
__pdoc__['setup'] = False
__pdoc__['initialize_db_script'] = False
__pdoc__['test'] = False | StarcoderdataPython |
8113498 | # Copyright 2021 NREL
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distri... | StarcoderdataPython |
5034561 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import argparse
import websocket
import logging
import time
import requests
import threading
from tornado import gen
from tornado.httpclient import AsyncHTTPClient, HTTPRequest
def handle_request(response):
logging.info("handle_request")
def run_socket(*args):
loggi... | StarcoderdataPython |
4917616 | <gh_stars>0
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | StarcoderdataPython |
201826 | <filename>predictor1.py
import requests
import math
import http.client
import json
from pprint import pprint
from firebase import firebase,FirebaseAuthentication
firebase_db = firebase.FirebaseApplication('https://nbasort.firebaseio.com/', authentication=None)
##GET TEAMS PLAYING
result = firebase... | StarcoderdataPython |
9646177 | from typing import Protocol
from app.core.models import ProductCategory
class CategoriesService(Protocol):
async def get_all(self) -> list[ProductCategory]:
...
| StarcoderdataPython |
5109918 | <reponame>Magicboomliu/Vowe-Format-Detection
__author__ = "<NAME>"
#encoding="utf-8"
import os
import numpy as np
import librosa
import glob
from explore_data import PixelShiftSound
if __name__ == "__main__":
'''
datatype = 0 : 10 only :frame length is 10ms, No frame shift, sample rate is 16K
datatype =... | StarcoderdataPython |
5155879 | test_cases = int(input().strip())
for t in range(1, test_cases + 1):
N = int(input().strip())
sentence = input().strip()
check = ('!', '?', '.')
idx = 0
result = []
# my name is <NAME>. my id is Rhs0266. what your id Bro?
for i in range(len(sentence)):
# 문장 쪼개기
if not sente... | StarcoderdataPython |
3209610 | <filename>scripts/discovery_tests_with_setup.py
# Need to import path to test/fixtures and test/scripts/
# Ex : export PYTHONPATH='$PATH:/root/test/fixtures/:/root/test/scripts/'
#
# To run tests, you can do 'python -m testtools.run tests'. To run specific tests,
# You can do 'python -m testtools.run -l tests'
# Set th... | StarcoderdataPython |
11340355 | #
# lines.py
#
# purpose: Reproduce LineCurvature2D.m and LineNormals2D.m
# author: <NAME>
# e-mail: <EMAIL>
# web: http://ocefpaf.tiddlyspot.com/
# created: 17-Jul-2012
# modified: Mon 02 Mar 2015 10:07:06 AM BRT
#
# obs:
#
import numpy as np
def LineNormals2D(Vertices, Lines):
r"""This function calc... | StarcoderdataPython |
5038260 | def areSimilar(a, b):
swap = list()
if a == b:
return True
if sorted(a) == sorted(b):
for i in range(len(a)):
if a[i] != b[i]:
swap.append(a[i])
if len(swap) == 2:
return True
else:
return False
else:
return Fal... | StarcoderdataPython |
3360378 | <filename>tests/caos/internal/utils/test_yaml.py
import os
import sys
import shutil
from io import StringIO
import unittest
from caos._internal.utils.working_directory import get_current_dir
from caos._internal.utils.yaml import get_virtual_environment_from_yaml, get_dependencies_from_yaml, get_tasks_from_yaml
class ... | StarcoderdataPython |
1849685 | <reponame>abhabongse/aoc2020
from __future__ import annotations
import collections
import itertools
import os
import more_itertools
def main():
this_dir = os.path.dirname(os.path.abspath(__file__))
input_file = os.path.join(this_dir, 'input.txt')
adapters = read_input_files(input_file)
# Part 1: ad... | StarcoderdataPython |
1754652 | <filename>vimms_gym/agents.py
import numpy as np
from vimms.Agent import AbstractAgent
class DataDependantAction():
def __init__(self):
self.mz = None
self.rt = None
self.original_intensity = None
self.scaled_intensity = None
self.ms_level = 1
self.idx = None
... | StarcoderdataPython |
9699563 | <filename>SimPPS/PPSPixelDigiProducer/test/testDigi3.py<gh_stars>1-10
import FWCore.ParameterSet.Config as cms
process = cms.Process("testDigi")
# Specify the maximum events to simulate
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(-1)
)
process.load('FWCore.MessageService.MessageLogger_cfi... | StarcoderdataPython |
1861181 | import unittest
from src.aws.response_handler import ResponseHandler as AWSResponseHandler
from tests.common.constants import AWS_TEST_RESOURCES_LOCATION, \
TEST_CONFIDENCE_THRESHOLD, TRANSCRIBE_ITEMS_SUSPICIOUS_AWS, \
TRANSCRIBE_ITEMS_NOT_SUSPICIOUS_AWS
class TestAWSResponseHandler(unittest.TestCase):
@... | StarcoderdataPython |
3510983 | <gh_stars>100-1000
from pygears.lib import reduce, drv, check
from pygears.typing import Queue, Uint
(drv(t=Queue[Uint[8]], seq=[[0, 1, 0, 1, 0, 1, 0]]),
drv(t=Uint[8], seq=[1])) \
| reduce(f=lambda x, y: (x << 1) | y) \
| check(ref=[0xaa])
| StarcoderdataPython |
1931179 | <reponame>xlab-si/iac-scan-runner
from typing import Optional
import iac_scan_runner.vars as env
from iac_scan_runner.check import Check
from iac_scan_runner.check_output import CheckOutput
from iac_scan_runner.check_target_entity_type import CheckTargetEntityType
from iac_scan_runner.utils import run_command
from pyd... | StarcoderdataPython |
5001718 | <reponame>multimodalspectroscopy/hvapy
from .HVA import network_optim
| StarcoderdataPython |
3283361 | """
Code to run all the post-processing jobs for a forecast day.
It is designed only to run for a single day.
Testing on mac:
python driver_post.py -gtx cas6_v3_lo8b -r backfill -d 2019.07.04 -ro 2 -test True
To run for real on apogee
python driver_post.py -gtx cas6_v0_u0kb -r forecast -ro 0 < /dev/null > post.log ... | StarcoderdataPython |
1838929 | # Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
""" This provides a management command to django's manage.py called
create_consumer that will generate a oauth key and secret based on the consumer
name.
"""
from optparse import make_option
import hashlib
import random
import strin... | StarcoderdataPython |
3280560 | from django.utils.translation import gettext_lazy as _
CUIT_REGEX = r'^(20|23|24|27|30|33|34)-[0-9]{8}-[0-9]$'
# Permissions codenames to create groups, asign, and test.
CAN_CLOSE_SPONSORING_CODENAME = 'close_sponsoring'
CAN_VIEW_EVENT_ORGANIZERS_CODENAME = 'view_event_organizers'
CAN_VIEW_ORGANIZERS_CODENAME = 'view... | StarcoderdataPython |
188444 | <filename>mobile/tests/utils/test_cache_helper.py
from unittest.mock import MagicMock
from django.core.cache import cache
from django.test import override_settings
from common.tests.core import SimpleTestCase
from mobile.utils.cache_helper import CacheHelper, get_or_set
@override_settings(CACHES={
'default': {
... | StarcoderdataPython |
6500511 | <filename>imagenet-dataset-downloader.py
#!/usr/bin/env python
# TODO: find the proper way to acknowledge that this is based on https://github.com/itf/imagenet-download
import argparse
import urllib.request, urllib.error, urllib.parse
from socket import timeout as TimeoutError
from socket import error as SocketError
... | StarcoderdataPython |
1863921 | #/usr/bin#/python
import boto3
from elasticsearch import Elasticsearch
from datetime import datetime, timezone, timedelta
# Enviar cada linha do CSV para uma fila SQS
def open_file(file_path):
lines = None
with open(file_path, "r+", encoding='utf-8-sig') as file:
lines = file.readlines()
ret... | StarcoderdataPython |
6645014 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 11 19:22:53 2020
@author: mavroudo
"""
import outlierDistanceActivities,outlierPairsCurveFitting, outlierPairWise
logFile="../BPI_Challenge_2012.xes"
with open("tests.txt","w") as f:
f.write("Neighbors Threshold Hits Misses\n")
#for neighbor... | StarcoderdataPython |
3456347 | <reponame>Aledan862/core<gh_stars>0
"""The Smart Life Comfort integration."""
import asyncio
import logging
import socket
import requests
import sys
import homeassistant.helpers.config_validation as cv
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAs... | StarcoderdataPython |
3503152 | """
Login/Logout APIs
"""
from flask import request, jsonify, abort
from flask_jwt_extended import jwt_required
from .. import app
from ..auth import authenticate, get_user
@app.route('/api/login', methods=['POST'])
def login():
"""
Authenticate user and return token
"""
data = request.get_json()
... | StarcoderdataPython |
4910357 | <filename>io_scene_vrm/importer/gltf2_addon_importer_user_extension.py<gh_stars>10-100
import secrets
import string
from collections import abc
from typing import Any, Optional
import bpy
class Gltf2AddonImporterUserExtension:
__current_import_id: Optional[str] = None
@classmethod
def update_current_imp... | StarcoderdataPython |
11264078 | from hamcrest.core.base_matcher import BaseMatcher
from hamcrest.core.core.isequal import IsEqual
from pyhamcrest_toolbox.multicomponent import MatcherPlugin
class MatcherPluginWrapper(MatcherPlugin):
"""This class allows turning good old matchers into matcher plugins
that can be used in MulticomponentMatche... | StarcoderdataPython |
12848430 | __author__ = 'shuai'
class Solution:
# @param {integer[]} nums
# @return {string}
def largestNumber(self, nums):
ret = ""
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
str_i = str(nums[i])
str_j = str(nums[j])
if st... | StarcoderdataPython |
336634 | <filename>common_utils.py
'''This file contains utilities common to all type of files and associated with the editor'''
from tkinter import *
from threading import *
from utils import *
def TellPos(command, editor, count, activity_log, code_input):
'''
Tells the current position of the cursor
'''
pos ... | StarcoderdataPython |
6451008 | import os
def find_file_above(file_to_find: str, path: str = None):
starting_directory = path or os.getcwd()
tree = FileTree(starting_directory)
while not tree.is_at_filesystem_root:
if file_to_find in tree.current_files:
return f"{tree.current_directory}/{file_to_find}"
tree... | StarcoderdataPython |
4996441 | """
With these settings, tests run faster.
"""
from dj_easy_log import load_loguru
from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key
SECRET_KEY = env(
"DJANG... | StarcoderdataPython |
158565 | <filename>src/scopes/nonlocal.py
# Lexical scoping in Python and an interesting scenario with resolving value in class.
# Author: <NAME>
# Test suite 1
def test1():
"""
Try to change a nonlocal variable of a parent frame.
"""
def noeffect():
# Uncomment the following line to show that local v... | StarcoderdataPython |
135144 | from typing import List
class TestResult:
def __init__(self, name, kind, type_name, method, duration, result, exception_type, failure_message, stack_trace,
skip_reason, attachments):
"""
:type name: unicode
:type kind: unicode
:type type_name: unicode
:typ... | StarcoderdataPython |
1844955 | #!/usr/bin/python
########################################################################################################################
#
# Copyright (c) 2014, Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permi... | StarcoderdataPython |
324177 | from typing import TYPE_CHECKING
from groupy.client import Groupy
from itests.setup import api_server
if TYPE_CHECKING:
from py.path import LocalPath
from tests.setup import SetupTest
def test_get_permissions(tmpdir, setup):
# type: (LocalPath, SetupTest) -> None
with setup.transaction():
s... | StarcoderdataPython |
3320691 | <filename>data/test/python/bf5d2878ae4d4260ba7cffcc0ed4562278239decurls.py
from django.conf.urls import patterns, include, url
from django.contrib import admin
from tastypie.api import Api
from progress.apps.food import api
admin.autodiscover()
v1_api = Api(api_name='1.0')
v1_api.register(api.DayResource())
v1_api.r... | StarcoderdataPython |
361612 | <gh_stars>0
from django.db import models
from django.test import TestCase
from hashlookup.querysets import gen_hash
from models import HashLookupTestModel
TEST_URL = 'https://test.com/help/about/article?date=2016-02-14&tool=main&from=producthunt'
class HashLookupTestCase(TestCase):
def setUp(self):
Hash... | StarcoderdataPython |
3596228 | #
# Copyright (c) SAS Institute Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | StarcoderdataPython |
3417715 | <gh_stars>1-10
from setuptools import setup
import os
root = os.path.dirname(os.path.abspath(__file__))
about = {}
with open(os.path.join(root, 'shadow_loop', '__version__.py'), 'r') as f:
exec(f.read(), about)
readme = ''
with open(os.path.join(root, 'README.md')) as f:
readme = f.read()
setup(name=about['... | StarcoderdataPython |
9767035 | <gh_stars>0
import os.path
import sys
from PyQt5.QtCore import QUrl, pyqtSignal
from PyQt5.QtGui import QShowEvent, QCloseEvent, QTextCursor
from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QPushButton, QTextEdit
from PyQt5.QtWidgets import QVBoxLayout, QHBoxLayout, QSizePolicy
from PyQt5.QtWebEngineWidg... | StarcoderdataPython |
1884121 | '''
done
'''
import _thread
import time
class PenampungThread:
def __init__(self, threadName):
self.name = threadName
def run(self, delay):
ctr = 0
while 1:
time.sleep(delay)
print ("%s: %s" % (self.name, str(ctr)))
ctr+=1
th1 = PenampungThread("thr... | StarcoderdataPython |
11248823 | from adaptador import MeuTaxi
from datetime import datetime
import gym
env = gym.make("Taxi-v3").env
def test_1():
state = env.reset()
state = env.encode(3, 2, 1, 0)
env.render()
inicio = datetime.now()
result = MeuTaxi(env.desc, env.decode(state))
fim = datetime.now()
print(fim - inicio... | StarcoderdataPython |
4875956 | <gh_stars>1-10
from django.urls.conf import include, re_path
from core.tests.api import Api, NoteResource, UserResource
api = Api()
api.register(NoteResource())
api.register(UserResource())
urlpatterns = [
re_path(r'^api/', include(api.urls)),
]
| StarcoderdataPython |
3305351 | # type: ignore
# -*- coding: utf-8 -*-
#
# ramstk.analyses.milhdk217f.models.inductor.py is part of the RAMSTK Project
#
# All rights reserved.
# Copyright since 2007 Doyle "weibullguy" Rowland doyle.rowland <AT> reliaqual <DOT> com
"""Inductor MIL-HDBK-217F Constants and Calculations Module."""
# Standard Libra... | StarcoderdataPython |
1943829 | <filename>yolov4_1.py
import tensorflow as tf
import matplotlib.pyplot as plt
import cv2
import numpy as np
from fastnms import fastnms
import colorsys
import random
import time
def draw(image, boxes, scores, classes, all_classes, colors):
image_h = image_w = 416
for box, score, cl in zip(boxes, scores, class... | StarcoderdataPython |
3213823 | '''
config.py
Holds severals datastructures for configs of Editing UI, Hugo and IPFS
Author: <NAME>
eMail: <EMAIL>
GPG-Key-ID: <KEY>
GPG-Fingerprint: A757 5741 FD1E 63E8 357D 48E2 3C68 AE70 B2F8 AA17
License: MIT License
'''
import json
import toml
import logging
import os, os.path
logger = logging.getLogger("Libr... | StarcoderdataPython |
12817730 | """!
@brief Running an experiment with the improved version of SuDoRmRf on
universal source separation with multiple sources.
@author <NAME> {<EMAIL>}
@copyright University of Illinois at Urbana-Champaign
"""
import os
import sys
current_dir = os.path.dirname(os.path.abspath('__file__'))
root_dir = os.path.abspath(os... | StarcoderdataPython |
3375939 | # -*- coding: utf-8 -*-
import os
import sys
import json
import tccli.options_define as OptionsDefine
import tccli.format_output as FormatOutput
from tccli import __version__
from tccli.utils import Utils
from tccli.exceptions import ConfigurationError, ClientError, ParamError
from tencentcloud.common import credential... | StarcoderdataPython |
1787779 | <gh_stars>1-10
"""
Lost_unfound
"""
import logging
import time
from tasks import ceph_manager
from tasks.util.rados import rados
from teuthology import misc as teuthology
from teuthology.orchestra import run
log = logging.getLogger(__name__)
def task(ctx, config):
"""
Test handling of lost objects on an ec po... | StarcoderdataPython |
3372100 | from .ev_charging_env import EVChargingEnv
| StarcoderdataPython |
3570283 | #!/usr/bin/env python
from okdataset import ChainableList, Context, Logger
logger = Logger("sum example")
context = Context()
logger.info("Building list")
l = ChainableList([ x for x in xrange(1, 30) ])
logger.info("Building dataset")
ds = context.dataSet(l, label="sum", bufferSize=1)
logger.info("Calling reduce")... | StarcoderdataPython |
1668972 | from rubygems_utils import RubyGemsTestUtils
class RubyGemsTestrubygems_aws_sdk_networkmanager(RubyGemsTestUtils):
def test_gem_list_rubygems_aws_sdk_networkmanager(self):
self.gem_is_installed("aws-sdk-networkmanager")
def test_load_aws_sdk_networkmanager(self):
self.gem_is_loadable("aws-sdk... | StarcoderdataPython |
5113635 | import numpy
def check_nd(denoiser):
shape = (17, 7, 13, 9)
for ndim in range(1, 5):
image = numpy.zeros(shape[:ndim])
try:
denoiser(image)
assert True
except Exception:
assert False
| StarcoderdataPython |
324889 | <filename>tests/playbook/test_num_blocks_error_handling__count.py
import pytest
from ansiblemetrics.playbook.num_blocks_error_handling import NumBlocksErrorHandling
script_0_1 = '- name: disable the server in haproxy\n\tshell: echo "disable server myapplb/{{ inventory_hostname }}" ' \
'| socat stdio /var/... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.