id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
9603925
<filename>roleutils/autorole.py import logging from typing import Union import discord from redbot.core import commands from redbot.core.bot import Red from .abc import MixinMeta from .converters import FuzzyRole from .utils import is_allowed_by_hierarchy, is_allowed_by_role_hierarchy log = logging.getLogger("red.ph...
StarcoderdataPython
1664
add_library('pdf') import random from datetime import datetime tileCount = 20 def setup(): global savePDF, actStrokeCap, actRandomSeed, colorLeft, colorRight, alphaLeft, alphaRight savePDF = False actStrokeCap = ROUND actRandomSeed = 0 colorLeft = color(197, 0, 123) colorRight = color(87, 35,...
StarcoderdataPython
6571969
<reponame>Samples-Playgorunds/Samples.Python<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- # https://realpython.com/python-statistics/ #import math #import statistics #import numpy as np #import scipy.stats import pandas as pd data = pd.read_csv("/Users/katodix/Projects/HolisticWare.Core.Math.Statistics....
StarcoderdataPython
3249753
# -*- coding: utf-8 -*- """ Created on Fri Jan 26 16:55:10 2018 @author: bryan.nonni """ import os from selenium import webdriver # Chrome Location, combines webshots folder to the chrome driver chrome_location = os.path.join('.', 'chromedriver.exe') print(chrome_location) options = webdriver.ChromeOptions() #optio...
StarcoderdataPython
11207605
from yunionclient.common import base class ServerSku(base.ResourceBase): pass class ServerSkuManager(base.StandaloneManager): resource_class = ServerSku keyword = 'serversku' keyword_plural = 'serverskus' _columns = ['ID', 'Name', 'Instance_type_family', 'Instance_type_category', 'Cp...
StarcoderdataPython
5108842
<reponame>Leviathan321/ChessDiagramRecognition ################################################################################ # Print number of files for each dataset ################################################################################ from squares_ids import get_squares_ids_absolute_paths from relative_t...
StarcoderdataPython
1845304
<reponame>ucsd-field-lab/namuti-webapp-template<filename>backend/nameforyourprojectbackend/nameforyourprojectbackend/settings/base.py import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', ...
StarcoderdataPython
4877275
from algos.ddpg import DDPG from algos.td3 import TD3 from algos.sac import SAC import locale, os, random, torch, time import numpy as np from util.env import env_factory, eval_policy, train_normalizer from util.log import create_logger from torch.nn.utils.rnn import pad_sequence class ReplayBuffer(): def __init...
StarcoderdataPython
1612426
# Lint as: python3 # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
StarcoderdataPython
5135402
"""blogアプリで主に使用するフィルタ・タグ by_the_timeタグ 人に優しい表現で、文字列を返す(n時間前) <span class="badge badge-danger badge-pill">{% by_the_time recomment.created_at %}</span> のようにして使います。 url_replaceタグ キーワード検索をした際等の、他GETパラメータと?page=のページングを両立させる場合に使います。 <a href="?{% url_replace request 'page' page_obj.previous_page_number %}" aria-label="Pre...
StarcoderdataPython
9753713
import sqlite3 import os db_abs_path = os.path.dirname(os.path.realpath(__file__)) + '/globomantics.db' print("Options: (items, comments, categories, subcategories, all)") table = input("Show table: ") conn = sqlite3.connect(db_abs_path) c = conn.cursor() def show_items(): try: items = c.execute("""SELE...
StarcoderdataPython
1773244
<gh_stars>1-10 import time import json from flask import session, request, g, flash from app import app import config logfile = open(config.logfilename, 'a') def log(dictionary): logfile.write(json.dumps(dictionary) + '\n') logfile.flush() id_prefix = str(int(time.time())) id_counter = 0 def get_new_id()...
StarcoderdataPython
9721952
import pytest from mock import mock from snipssonos.entities.device import Device from snipssonos.use_cases.speaker_interrupt import SpeakerInterruptUseCase from snipssonos.use_cases.request_objects import SpeakerInterruptRequestObject from snipssonos.exceptions import NoReachableDeviceException @pytest.fixture def ...
StarcoderdataPython
9627937
<filename>thirdparty/g2opy/python/examples/sba_demo.py # https://github.com/RainerKuemmerle/g2o/blob/master/g2o/examples/sba/sba_demo.cpp import numpy as np import g2o from collections import defaultdict import argparse parser = argparse.ArgumentParser() parser.add_argument('--noise', dest='pixel_noise', type=float...
StarcoderdataPython
4916081
<gh_stars>0 from tarfile import ENCODING from xml.etree.ElementTree import Element, SubElement, Comment, tostring from xml.etree import ElementTree from xml.dom import minidom import codecs def prettify(elem): """Return a pretty-printed XML string for the Element. """ rough_string = ElementTree.tostring(el...
StarcoderdataPython
1972128
import datetime import time import logging import json from uuid import UUID import os from django.conf import settings import requests from threading import Thread from .utils import _get_request class SplunkEvent(object): _key = None _timestamp = None _request = None _user = None _auth = None ...
StarcoderdataPython
1821740
import api.fanyi as fanyi api = { 'fanyi': { 'google': fanyi.google_fanyi_query, 'tencent': fanyi.tencent_fanyi_query, 'youdao': fanyi.youdao_fanyi_query, 'baidu': fanyi.baidu_fanyi_query } } def api_call(action, param): if action == 'fanyi': vender = param['vender...
StarcoderdataPython
3545047
import numpy as np import matplotlib.pyplot as plt import os, random import json import torch from torch import nn from torch import optim import torch.nn.functional as F import torchvision from torchvision import datasets, transforms, models from collections import OrderedDict from PIL import Image import time import ...
StarcoderdataPython
6434111
# Third party code # # The following code are copied or modified from: # https://github.com/google-research/motion_imitation """The inverse kinematic utilities.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import typing _IDENTITY_...
StarcoderdataPython
8160585
#coding=utf-8 import tensorflow as tf from tensorflow.python.ops import array_ops from tensorflow.python.ops import control_flow_ops from tensorflow.python import pywrap_tensorflow import wml_utils as wmlu import os import numpy as np import logging import wsummary import basic_tftools as btf from tfop import set_value...
StarcoderdataPython
6639556
import os import posixpath from enum import Enum from fastapi import Path, HTTPException from utils import security class UploadPath(str, Enum): default = "default" UPLOAD_PATH_DICT = { UploadPath.default: "default/" } def get_upload(upload_key: UploadPath = Path(..., description="上传文件块位置")): """ ...
StarcoderdataPython
5064406
<filename>hammer.py import glob import gzip import os import shutil from subprocess import Popen, PIPE destination_directory = None """ Tools """ class colors: DEBUG = '\033[92m' WARNING = '\033[93m' ERROR = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' def debug_log(logs...
StarcoderdataPython
3255872
#!/usr/bin/python3 import sys import os import mod_path import template from headers import * print_headers() navbar = template.get("navbar") print(template.get('contacts').format(**locals()))
StarcoderdataPython
261150
<filename>huxley/core/admin/registration.py # Copyright (c) 2011-2021 Berkeley Model United Nations. All rights reserved. # Use of this source code is governed by a BSD License (see LICENSE). import csv from django.conf import settings from django.conf.urls import url from django.contrib import admin from django.urls...
StarcoderdataPython
399285
<reponame>rinceyuan/WeFe # Copyright 2021 <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 # # Unless require...
StarcoderdataPython
11252771
<filename>rabidmongoose/worker.py<gh_stars>0 ''' rabid.mongoose worker follows the Paranoid Pirate Pattern from ZeroMQ ''' from random import randint import time import zmq from rabidmongoose.handlers import MongoHandler from rabidmongoose.config import MONGOR, TIMEOUT, FLUENT, LOGTAG, \ ...
StarcoderdataPython
6420759
from thicket import files def test_import(): assert files
StarcoderdataPython
3542027
""" 85 / 85 test cases passed. Runtime: 156 ms Memory Usage: 15.7 MB """ class Solution: def minDeletionSize(self, strs: List[str]) -> int: n = len(strs[0]) rec = set() for i in range(1, len(strs)): for j in range(n): if j not in rec and strs[i][j] < strs[i - 1][j...
StarcoderdataPython
4955893
<reponame>ChrisQiqiang/allocation<filename>example/tensorflow/tensorflow2_mnist_bps_MirroredStrategy.py<gh_stars>1000+ import tensorflow as tf import numpy as np import json import os import sys import argparse import byteps.tensorflow as bps from byteps.tensorflow.distribute import MirroredStrategy parser = argparse...
StarcoderdataPython
9694366
<gh_stars>1-10 import os import pygame from pygame.locals import * from definitions import MAPS_DIR from game_state_machine.GameState import GameState from utils import sound_path class MapSelection(GameState): def __init__(self): super().__init__() self.button_size = 50, 30 # Cores uti...
StarcoderdataPython
5138522
<gh_stars>0 from .district import District from .district_detail import DistrictDetail
StarcoderdataPython
8151982
n=int(input()) ans=0 for i in range(1,n+1): if n%i==0: ans+=i print(ans*5-24)
StarcoderdataPython
5039148
from oeda.databases import db from oeda.log import * from oeda.analysis.two_sample_tests import Ttest, TtestPower, TtestSampleSizeEstimation from oeda.analysis.one_sample_tests import DAgostinoPearson, AndersonDarling, KolmogorovSmirnov, ShapiroWilk from oeda.analysis.n_sample_tests import Bartlett, FlignerKilleen, Kru...
StarcoderdataPython
4834118
import json import numpy as np from datetime import datetime import pandas as pd from matplotlib import pyplot as plt from pandas.plotting import register_matplotlib_converters from .abstract_data_loading_strategy import dataLoadingStrat class fileLoadingRaw(dataLoadingStrat): """ concrete data loading strat...
StarcoderdataPython
8039005
from datetime import datetime, timezone import sqlalchemy.types class DateTime(sqlalchemy.types.TypeDecorator): """ Custom DateTime, to make sure we always have aware datetime instances at the python side, and always store timestamps in the database in UTC. This is necessary, as MariaDB, contrary to...
StarcoderdataPython
11383883
<reponame>allaparthi/monorail # Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import json import sys # pylint: disable=line-too-long d = json.load(sys.stdin) if not d['issue_url']: print >> sys.stderr,...
StarcoderdataPython
8016600
<reponame>APPFL/APPFL import os import time import json import torch from appfl.config import * from appfl.misc.data import * from models.cnn import * import appfl.run_serial as rs import appfl.run_mpi as rm from mpi4py import MPI DataSet_name = "Coronahack" num_clients = 4 num_channel = 3 # 1 if gray, 3 if color nu...
StarcoderdataPython
1786880
<gh_stars>10-100 import typing Flake8Error = typing.NamedTuple( 'Flake8Error', [ ('line_number', int), ('offset', int), ('text', str), ('checker_cls', type), ] ) AAAError = typing.NamedTuple('AAAError', [ ('line_number', int), ('offset', int), ('text', str), ]) cl...
StarcoderdataPython
116939
import unittest from rdflib import RDFS, Namespace from funowl.annotations import Annotation from funowl.class_axioms import SubClassOf, EquivalentClasses, DisjointClasses, DisjointUnion, HasKey from funowl.class_expressions import ObjectIntersectionOf, ObjectSomeValuesFrom, ObjectUnionOf from funowl.dataproperty_exp...
StarcoderdataPython
4804858
from redis_ratelimit.decorators import ratelimit
StarcoderdataPython
3201418
import json import subprocess from . import collectors class CompletedProcessMock: def __init__(self, stdout='', stderr=''): self.stdout = stdout self.stderr = stderr blame_text = """\ aacd7f517fb0312ec73f882a345d50c6e8512405 1 1 1 author <NAME> ... filename file.txt line one 4cbb5a68de251bf42e...
StarcoderdataPython
1728791
from flask import abort, jsonify, session from app.util import request_helper from app.services import reddit_service from app.db.models.raffle import Raffle from app.db.models.user import User @request_helper.require_login def get_user_submissions(): """ Return the user's Reddit submissions that are not already...
StarcoderdataPython
188691
<gh_stars>1-10 class Node: def __init__(self, data): self.data = data self.next = None self.arb=None class Solution: def cloneList(self, head): clone_head = clone_last = None current_node = head while current_node: if clone_head == None: ...
StarcoderdataPython
8199977
<reponame>magostin/coronavirus import pandas as pd def add_calc(x): d = {} d['nuovi_deceduti'] = x.deceduti.diff() d['nuovi_tamponi'] = x.tamponi.diff() d['nuovi_casi_testati'] = x.casi_testati.diff() d['incremento'] = 100.0 * x['nuovi_positivi'] / x['totale_positivi'] d['percentu...
StarcoderdataPython
248290
<gh_stars>1-10 # -*- coding: utf-8 -*- # # Copyright (C) 2016 Red Hat, 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 b...
StarcoderdataPython
3422121
from __future__ import absolute_import, unicode_literals import re import asteval import yaml VAR_RE = r"[_a-zA-Z][a-zA-Z0-9_]*" EXPRESSION_RE = r"[\[\]():.a-zA-Z0-9_]*" PRINT_RE = r"{{ *(.+?) *}}" START_BLOCK_RE = r"{% *(if|for) +(.+?) *%}" END_BLOCK_RE = r"{% *end(for|if) *%}" FOR_RE = r"{{% *for +({varname}) +in ...
StarcoderdataPython
4887397
""" Execution of fft.py """ import math import gc from pyske.core import PList, par from pyske.core import Timing from pyske.examples.list import util from pyske.examples.list.fft import fft # -------------- Execution -------------- def _is_power_of_2(num: int) -> bool: return num == round(2 ** (math.log2(num))...
StarcoderdataPython
251844
from ElevatorBot.database.database import getGrandmasterHashes # from https://data.destinysets.com/ # raids from ElevatorBot.backendNetworking.event_loop import get_asyncio_loop spirePHashes = [3213556450] spireHashes = [119944200] eaterPHashes = [809170886] eaterHashes = [3089205900] # there is a hash for each levi...
StarcoderdataPython
4889446
<reponame>amaclean199/salt<filename>tests/unit/modules/test_s3.py # -*- coding: utf-8 -*- ''' :codeauthor: :email:`<NAME> <<EMAIL>>` ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt Testing Libs from tests.support.mixins import LoaderModuleMockMixin fr...
StarcoderdataPython
9726649
<reponame>max-belichenko/Django-Polls-API from rest_framework import serializers from .models import ( Poll, Question, Choice, Answer, ) class PollSerializer(serializers.ModelSerializer): def update(self, instance, validated_data): instance.title = validated_data.get('title', instance.tit...
StarcoderdataPython
1656998
<filename>data/test/python/d6dad40da08cf800232fb8d8603b68e5c856631c__init__.py from flask import Flask from flask.ext.restful import Api app = Flask(__name__) api = Api(app) app.config.from_object('emonitor.config.Config') from emonitor.modules.api.job import JobListApi from emonitor.modules.api.job import JobApi f...
StarcoderdataPython
6543856
from django.contrib import admin from .models import DesafioInovacao from .models import InovacaoAberta from .models import ReuniaoGrupoPesquisa from .models import ReuniaoEmpresa from .models import AtendimentoEmpreendedor admin.site.register(DesafioInovacao) admin.site.register(InovacaoAberta) admin.site.register(Re...
StarcoderdataPython
5047948
<gh_stars>0 # Generated by Django 4.0.1 on 2022-02-11 12:01 from django.db import migrations, models import django.db.models.deletion import uuid class Migration(migrations.Migration): dependencies = [ ('users', '0003_profile_location_skill'), ] operations = [ migrations.CreateModel( ...
StarcoderdataPython
160153
<filename>example/helloworld/test.py import unittest import grpc from homi.test_case import HomiTestCase from .app import app from .helloworld_pb2 import HelloRequest, _GREETER class GreeterTestCase(HomiTestCase): app = app def test_hello_say(self): server = self.get_test_server() name = "t...
StarcoderdataPython
6587552
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
StarcoderdataPython
1783592
<gh_stars>1-10 # -*- coding: utf-8 -*- r"""An interaction model $f:\mathcal{E} \times \mathcal{R} \times \mathcal{E} \rightarrow \mathbb{R}$ computes a real-valued score representing the plausibility of a triple $(h,r,t) \in \mathbb{K}$ given the embeddings for the entities and relations. In general, a larger score in...
StarcoderdataPython
3577595
<reponame>richard-clifford/GoKeyBruter<filename>GoKeyBruter.py<gh_stars>0 import threading import subprocess import argparse counter = 0 def brute_realm(args, password): password = password.strip() with open(args.realm_list) as realm_list: for r in realm_list: r = r.strip() if(args.v): print "[*] Trying...
StarcoderdataPython
4981524
<filename>ext/youtube.py<gh_stars>0 import discord import os import concurrent.futures import urllib.request import json from discord.ext import commands, tasks from utils._errors import SocialAlreadyImplemented, SocialNotFound, SocialDoesNotExist from sqlite3 import IntegrityError from datetime import datetime class...
StarcoderdataPython
11218943
<gh_stars>0 import torch import collections class Classifier(torch.nn.Module): def __init__(self, conv_layer_info, dense_layer_info, batch_norm = False): super(Classifier, self).__init__() conv_layers = collections.OrderedDict() prev_channels = 3 cur_side = 32 for i, (chan...
StarcoderdataPython
9781329
import os from telegram.ext import Filters, MessageHandler, Updater import bot_config from data import data import model WHITELIST = '0123456789abcdefghijklmnopqrstuvwxyzабвгдеёжзийклмнопрстуфхцчшщъыьэюя ' # space is included in whitelist BLACKLIST = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~\'' seq2seq, sess = None, None ...
StarcoderdataPython
1813538
<gh_stars>0 import ordered_set from typing import Iterable SLICE_ALL = ordered_set.SLICE_ALL # monkey patching the OrderedSet implementation def insert(self, index, key): """Adds an element at a dedicated position in an OrderedSet. This implementation is meant for the OrderedSet from the ordered_set pa...
StarcoderdataPython
1620315
<gh_stars>1-10 from haystack import indexes from nuremberg.photographs.models import Photograph class PhotographId(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) highlight = indexes.CharField(model_attr='description') material_type = indexes.CharField(de...
StarcoderdataPython
9619552
import requests class News(): apikey = "8a6b8c7a93c04c969ee984d8dc2d196f" base_url = "https://newsapi.org/v2/" def make_request(url,q="",country=""): p={ 'apiKey':News.apikey, } if country!="": p['country']=country if q!="": p['q']=q try: r=requests.get(url,params=p) except requests.except...
StarcoderdataPython
5172563
# coding: utf-8 """ Astropy coordinate class for the Sagittarius coordinate system """ from __future__ import division, print_function # Third-party import numpy as np import astropy.units as u import astropy.coordinates as coord from astropy.coordinates import frame_transform_graph from astropy.coordinates.matrix...
StarcoderdataPython
215515
<reponame>melfm/robosuite """ Script to showcase domain randomization functionality. """ import robosuite.utils.macros as macros from robosuite.controllers import load_controller_config from robosuite.utils.input_utils import * from robosuite.wrappers import DomainRandomizationWrapper, GymImageDomainRandomizationWrapp...
StarcoderdataPython
4883933
<gh_stars>10-100 # # This particular test was coded for the GHI Electronics G30 Development # Board: https://www.ghielectronics.com/catalog/product/555 # import pyb from rtttl import RTTTL import songs # G30DEV buz_tim = pyb.Timer(3, freq=440) buz_ch = buz_tim.channel(1, pyb.Timer.PWM, pin=pyb.Pin.board.BUZZER, pulse_...
StarcoderdataPython
4983669
# Métodos: Envelhercer, engordar, emagrecer, crescer. Obs: Por padrão, a cada ano que nossa pessoa envelhece, # sendo a idade dela menor que 21 anos, ela deve crescer 0,5 cm. class Pessoa: def __init__(self, nome, idade, peso, altura): self.nome = nome self.idade = idade self.peso = peso ...
StarcoderdataPython
1888393
<reponame>niklub/NeMo<filename>tests/collections/asr/numba/rnnt_loss/utils/test_rnnt_helper.py # Copyright (c) 2021, NVIDIA CORPORATION. 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...
StarcoderdataPython
9694242
<reponame>CybercentreCanada/assemblyline-v4-p2compat import logging import os from assemblyline_v4_p2compat.common.log import init_logging from assemblyline_v4_p2compat.common import forge def test_logger(): config = forge.get_config() config.logging.log_to_console = False config.logging.log_to_file = Tr...
StarcoderdataPython
6481496
"""Imports for Python API. This file is MACHINE GENERATED! Do not edit. Generated by: tensorflow/tools/api/generator/create_python_api.py script. """ from tensorflow.python.ops.sets import set_difference from tensorflow.python.ops.sets import set_intersection from tensorflow.python.ops.sets import set_size from tensor...
StarcoderdataPython
4816641
from django.urls import path from core.projects.views.members import MemberApi, MembersApi from core.projects.views.projects import ProjectsApi, ProjectApi from core.projects.views.roles import RolesApi, RoleApi from core.projects.views.settings import ProjectSettingsApi from core.projects.views.tasks import ProjectTa...
StarcoderdataPython
3246433
<reponame>radomd92/botjagwar<filename>test/unit_tests/test_parsers/test_adjective_form_parsers.py<gh_stars>1-10 from unittest import TestCase from api.parsers.functions import parse_el_form_of from api.parsers.functions import parse_inflection_of from api.parsers.functions import parse_lv_inflection_of from api.parser...
StarcoderdataPython
9725968
import numpy as np from fedot.api.main import Fedot from fedot.core.data.data import InputData from fedot.core.data.data_split import train_test_data_setup from fedot.core.data.supplementary_data import SupplementaryData from fedot.core.repository.dataset_types import DataTypesEnum from fedot.core.repository.tasks imp...
StarcoderdataPython
11262061
import json from json import JSONDecodeError from os.path import exists from typing import Optional, Tuple, List, Dict import torch from omegaconf import DictConfig from torch.utils.data import Dataset from utils.common import LABEL, AST, SOURCE, CHILDREN, TOKEN, PAD, NODE, SEPARATOR, UNK, SOS, EOS, SPLIT_FIELDS from...
StarcoderdataPython
8179149
import click import serial @click.command() @click.argument('baud_rate', type=int) def serial_loop(baud_rate): with serial.Serial('/dev/ttyACM0', baud_rate, timeout=None) as ser: while True: val = input("> ") ser.write(val.encode('ascii')) ser.flush() if __name__ == "_...
StarcoderdataPython
375621
<filename>tests/factory/data_factory.py from requests import Response from .helper import json_helper def mock_success_spotify_token_response(): response = Response() response.status_code = 200 response._content = json_helper.get_json_mock('spotify_token_response_success.json') return response def ...
StarcoderdataPython
9748077
<gh_stars>1-10 import sys import os sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))) from net.dstg import * if __name__ == '__main__': graph_args = { 'layout':'openpose', 'strategy':'spatial' } model = DSTG(graph_args,depth=16) for name,para ...
StarcoderdataPython
8128613
#!/usr/bin/env python # This file is only used if you use `make publish` or # explicitly specify it as your config file. import os import sys sys.path.append(os.curdir) from pelicanconf import * SITEURL = "https://musard.com" RELATIVE_URLS = False FEED_DOMAIN = SITEURL FEED_ALL_ATOM = "feeds/all.atom.xml" DELETE_...
StarcoderdataPython
12827658
<filename>src/siamese_network_bw/graph.py import re import matplotlib.pyplot as plt import matplotlib.patches as mpatches from matplotlib.font_manager import FontProperties import constants def plot_results(training_details, validation_details, note=None): """ Generates a combined training/validation graph. ...
StarcoderdataPython
9666962
#!/usr/bin/env python """ @package ion.agents.platform.rsn.simulator.logger @file ion/agents/platform/rsn/simulator/logger.py @author <NAME> @brief Logger configuration for the OMS simulator. """ __author__ = '<NAME>' class Logger(object): log = None @classmethod def set_logger(cls, log): ...
StarcoderdataPython
1740116
<gh_stars>0 from guet.git.hook_present import hook_present def any_hooks_present(git_path: str): pre_commit_present = hook_present(git_path, 'pre-commit') post_commit_present = hook_present(git_path, 'post-commit') commit_msg_present = hook_present(git_path, 'commit-msg') return pre_commit_present or...
StarcoderdataPython
6638282
<reponame>shaswat01/MoodZen<filename>src/search_song.py from spotify_api import * client_id = "718bb5e6caca403c942c2a292492ae64" client_secret = "4980e48cec984e9aad21b60205c3f01b" spotify = SpotifyAPI(client_id, client_secret) def search_new_song(song_name, artist_name = '', DIR = 'src/data/'): search_result = ...
StarcoderdataPython
11268612
<filename>python_api/libInteractive.py #!/usr/bin/python3 # built-ins import os import time import subprocess # import traceback ''' Web Interface API Related ''' def update_firmware(dpt): ''' update firmware interface ''' dpt.info_print( 'Please make sure you have charged your battery befor...
StarcoderdataPython
6417975
<reponame>aarora08/nasa-apod-scraper import asyncio import re from dataclasses import InitVar, dataclass, field from datetime import date, datetime from pathlib import Path from typing import Dict import aiofiles from aiohttp import ClientSession, client_exceptions, web from bs4 import BeautifulSoup from faker import ...
StarcoderdataPython
96855
<reponame>Kamaradeivanov/pulumi-scaleway # coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** 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 Union from . import uti...
StarcoderdataPython
3421152
class Solution(object): def halvesAreAlike(self, s): """ :type s: str :rtype: bool """ self.vowels = set(['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']) halve = len(s) // 2 return self.count_vowel(s[:halve]) == self.count_vowel(s...
StarcoderdataPython
1905854
from abc import abstractmethod class EntityBase: @abstractmethod def __str__(self, prefix=""): """Return a textual representation of this entity :param prefix: must be output at the start of each line out output :return: a string example: def __str__(self, prefix=""...
StarcoderdataPython
197639
<filename>ch07/list_stack.py """ Stack Data Type implemented using linked lists. """ from algs.node import Node class Stack: """ Implementation of a Stack using linked lists. """ def __init__(self): self.top = None def is_empty(self): """Determine if queue is empty.""" retu...
StarcoderdataPython
5188441
<reponame>zmcneilly/animated-journey import argparse import re import os import ssh_config import paramiko import getpass from pathlib import Path from ssh_config.hosts import ping def prompt_for_input(prompt: str="Continue? [y/n]"): resp = input(prompt).lower().strip() if resp[0] == "y": return True...
StarcoderdataPython
4811560
from __future__ import annotations from ._version import version as __version__ __all__ = ["__version__"]
StarcoderdataPython
3369495
from requests.exceptions import HTTPError from unittest.mock import Mock requests = Mock() def get_users(): r = requests.get('http://demo/api/users') if r.status_code == 200: return r.json() return None if __name__ == '__main__': requests.get.side_effect = HTTPError try: get_users...
StarcoderdataPython
3447477
import os import shutil import sys import pytest import torch from torch.utils.data.dataloader import DataLoader from torchvision import models, transforms torchfuel_path = os.path.dirname( os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) ) sys.path.append(torchfuel_path) from torchf...
StarcoderdataPython
365483
""" This script is part of a Windows Shell Extension that allows you to run executable files in a sandboxed environment using the right click menu. Note that the script maps the entire parent directory of the executable, this is done in order to preserve potential local dependencies. """ import sys import argparse imp...
StarcoderdataPython
229718
<filename>maze-solver/decoder.py #! /usr/bin/python import argparse import numpy as np parser = argparse.ArgumentParser() class MazeMDPSolver: def __init__(self, grid, value_policy): self.numStates = 0 self.numActions = 4 self.start = 0 self.end = 0 maze, coordinate_to_st...
StarcoderdataPython
6421840
import tkinter as tk import tkinter.ttk as ttk from tkinter.messagebox import showerror import subprocess from src.ui.text_area_modal import TextAreaModal class DiffViewDialog(TextAreaModal): def __init__(self, diff_left_path, diff_right_path, *args, **kwargs): super().__init__(*args, **kwargs) ...
StarcoderdataPython
3249382
from numlab.lang.type import Instance, Type nl_function = Type.get("function") @nl_function.method('__new__') def nl__new__(func): _inst = Instance(nl_function) _inst.set('func', func) return _inst @nl_function.method('__call__') def nl__call__(self, *args, **kwargs): return self.get("func")(*args, *...
StarcoderdataPython
3569170
#!/usr/bin/env python3 import ipdb #ipdb.set_trace() import configparser import os, sys from matplotlib import pyplot as plt import xarray as xr thisDir = os.path.dirname(os.path.abspath(__file__)) parentDir = os.path.dirname(thisDir) sys.path.insert(0,parentDir) from metpy.calc import * from metpy.units import units ...
StarcoderdataPython
9619361
<filename>src/p3d/pandaManager.py import logging import os import weakref logger = logging.getLogger(__name__) class PandaManager: PANDA_BEHAVIOUR_INIT = 'PandaBehaviourInit' PANDA_BEHAVIOUR_START = 'PandaBehaviourStart' PANDA_BEHAVIOUR_STOP = 'PandaBehaviourStop' PANDA_BEHAVIOUR_DEL = 'PandaBe...
StarcoderdataPython
5168691
<reponame>floroe1988/xzceb-flask_eng_fr from ibm_cloud_sdk_core import ApiException from translator import englishToFrench, frenchToEnglish import unittest class TestFrenchTranslation(unittest.TestCase): def test_frenchToEnglish_assertNotEqual(self): self.assertNotEqual(frenchToEnglish("Bonjour"), "") ...
StarcoderdataPython
11226303
import socket def handle_client(client_socket): import subprocess while True: client_socket.send(b'> ') request = client_socket.recv(1024)[:-1].decode('ascii') # print( f"[*] Received: {request}") res = subprocess.run(request.split(' '), capture_output=True) client_socket...
StarcoderdataPython