id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
9007
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2020 Alibaba Group Holding 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-...
StarcoderdataPython
40186
import string def onlyletters(s): s1 = [] for i in s: if i not in string.punctuation: # проверяем посимвольно, есть ли в списке пунктуационных знаков s1.append(i) s2 = ''.join(s1) # соединяем массив символов в слово return s2 words = (input().lower()).split() # преобразуем сло...
StarcoderdataPython
1676732
import pytest @pytest.fixture() # This set of wallet words corresponds to a 256-bit entropy value with all zeros def zero_wallet_words(): return 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon a...
StarcoderdataPython
48881
import plotly.plotly as py import plotly.graph_objs as go import plotly.offline as offline import sys, os from .CreateTableFromDatabase import getRankingsFromDatabase # Using the plotly API creates a few plots def createAndUploadPlots(table, plotName): # Read plotly username and API key from file (to avoid acci...
StarcoderdataPython
1665850
from django.http import HttpResponse from django.shortcuts import render, redirect from django.core.urlresolvers import reverse from django.contrib.auth.decorators import login_required import simplejson as json import re from django.db import transaction import time import datetime import operator import numpy from d...
StarcoderdataPython
3302451
LDR_LEN = 19 class InvalidMarcError(Exception): pass def from_file(f): """ Parse MARC file into tuples. Parameters: arg1 Name of the MARC file to be parsed. Returns: An iteratorof tuples, each representing a single MARC record. """ with open(f, "rb") as file: offset = 0 ...
StarcoderdataPython
89077
import rdkit.Chem as Chem import numpy as np import os ''' This script is meant to split the Tox21 train dataset into the individual target datasets for training single-task models. ''' if __name__ == '__main__': # Read SDF suppl = Chem.SDMolSupplier( os.path.join( os.path.dirname(os.path.dirname(__file__)...
StarcoderdataPython
70282
<filename>mcci_catena_provision_ttn.py #!/usr/bin/env python3 ############################################################################## # # Module: mcci_catena_provision_ttn.py # # Function: # Provision a catena device through TTN cli # # Copyright and License: # This file copyright (c) 2021 by...
StarcoderdataPython
1695085
# coding=utf8 import pandas as pd import sqlalchemy class Account: """ 账户类,在账本上注册账户 """ STOCKS_COLUMNS = ["stock_code", "stock_name", "current_amount", "enable_amount"] def __init__(self, book): self.book = book self.name = "" self.path = "" # 可以使用的交易账户,有优先级 ...
StarcoderdataPython
1752777
#!/usr/bin/python import sys import os includeos_src = os.environ.get('INCLUDEOS_SRC', os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))).split('/test')[0]) print 'includeos_src: {0}'.format(includeos_src) sys.path.insert(0,includeos_src) from subprocess import call ...
StarcoderdataPython
32417
import random import string def test_append(lst): ret_val = [] for w in lst: ret_val.append(w.lower( )) return ret_val def test_map(lst): ret_val = map(str.lower, lst) return ret_val def run_tests(n): for i in range(n): tst = ''.join(random.choices(string.ascii_uppercase + str...
StarcoderdataPython
3251356
#!/usr/bin/env python __author__ = '<NAME>' __date__ = '07 Jan 2021' __version__ = '1.1.0' from Item import Item class City(object): """ This class is used to represent a city in the problem """ def __init__(self, idx: int, x: float, y: float) -> None: self.idx = idx self.x = x ...
StarcoderdataPython
3293280
from scipy.io import loadmat import gsw import numpy as np import matplotlib.pyplot as plt from src import Config, Section from src import grid_field, SA_CT_from_sigma0_spiciness0 plt.ion() cf = Config() sec4 = Section() z = sec4.lvls.copy()[0, :, :] spice = sec4.lvls.copy()[1, :, :] plot_i = [37, 40, 48] #fig, ax...
StarcoderdataPython
1603944
<filename>luwu/core/models/text_classifier/transformers.py # -*- coding: utf-8 -*- # @Author : AaronJny # @LastEditTime : 2021-06-13 # @FilePath : /LuWu/luwu/core/models/text_classifier/transformers.py # @Desc : import os os.environ["TF_KERAS"] = "1" import json import random from collections import ...
StarcoderdataPython
134696
<gh_stars>100-1000 #!/usr/bin/env python # iccp # # International Color Consortium Profile # # Tools for manipulating ICC profiles. # # An ICC profile can be extracted from a PNG image (iCCP chunk). # # # Non-standard ICCP tags. # # Apple use some (widespread but) non-standard tags. These can be # displayed in Apple'...
StarcoderdataPython
3376216
import vamp import librosa import numpy as np import pretty_midi import jams import os import argparse def rough_midi(args): # gets a rough midi trasncription using pYin Note from inpath.wav to outpath.mid if os.path.exists(args.outpath): print('file already exist') return 0 #check if o...
StarcoderdataPython
3333393
__author__ = 'ehonlia' import pika import json import logging import semantics from constants import ID, METADATA HOST = 'honnix-ws' EXCHANGE_TYPE = 'topic' STREAM_EXCHANGE = 'topic_stream' VIRTUAL_STREAM_EXCHANGE = 'topic_virtual_stream' SEMANTIC_STREAM_EXCHANGE = 'topic_semantic_stream' SEMANTIC_VIRTUAL_STREAM_EXC...
StarcoderdataPython
4820554
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test REST interface # from test_framework import BitcoinTestFramework from util import * import auxpow i...
StarcoderdataPython
118215
""" models.py 定义数据库模型 - db.DateTime :在数据库模型中,有DateTime字段,该字段的值是Python 的datetime 类型。需要注意的是,我们在设置datetime时, 要做好时区的选择。 关于时间和日期的操作,请参考 iSurvey/test/time_oper.py """ from datetime import datetime from flask_sqlalchemy import SQLAlchemy from werkzeug.security import generate_password_hash, check_password_hash db = SQLAl...
StarcoderdataPython
19768
# Imports para o Carla import glob import os import sys try: sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % ( sys.version_info.major, sys.version_info.minor, 'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0]) except IndexError: pass import carla try: sys.path...
StarcoderdataPython
3207034
# 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 # "License"); you may not u...
StarcoderdataPython
86684
<filename>src/submanager/thread/creation.py """Perform the tasks necessary to create a new thread and deprecate the old.""" # Future imports from __future__ import ( annotations, ) # Standard library imports import contextlib import re import time # Third party imports import praw.models.reddit.submission import...
StarcoderdataPython
54384
<filename>sphinxcontrib/traceables/utils.py import re from sphinx.util.texescape import escape # ============================================================================= # Node visiting utilities. def visit_passthrough(translator, node): pass def depart_passthrough(translator, node): pass passthroug...
StarcoderdataPython
1782219
# Person example main program using getters and setters from Person import * oPerson1 = Person('<NAME>', 90000) oPerson2 = Person('<NAME>', 99000) # Get the salaries using getter and print print(oPerson1.getSalary()) print(oPerson2.getSalary()) # Change the salaries using setter oPerson1.setSalary(100000) oPerson2....
StarcoderdataPython
48956
<gh_stars>100-1000 """Tests for ConnectedDriveVehicle.""" import unittest from unittest import mock from test import load_response_json, BackendMock, TEST_USERNAME, TEST_PASSWORD, TEST_REGION, \ G31_VIN, F48_VIN, I01_VIN, I01_NOREX_VIN, F15_VIN, F45_VIN, F31_VIN, TEST_VEHICLE_DATA, \ ATTRIBUTE_MAPPING, MISSING_...
StarcoderdataPython
3257592
# Copyright © 2019 National Institute of Advanced Industrial Science and Technology (AIST). All rights reserved. from pathlib import Path import json from injector import singleton import werkzeug from tempfile import TemporaryDirectory from qlib.utils.logging import get_logger, log from ..across.exception imp...
StarcoderdataPython
3263144
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from Gerenciador import Gerenciador class Token: tipoToken = None linhaTabela = None def __init__(self, palavra, linha): g = Gerenciador() self.linhaTabela = linha self.tipoToken = g.getTipoToken(palavra) def __str__(self): ...
StarcoderdataPython
1660472
<gh_stars>0 from typing import List from django.core import mail from django.urls import reverse from django_dynamic_fixture import G from rest_framework import status from rest_framework.test import APITestCase from apps.authentication.models import Email, OnlineUser from apps.inventory.models import Item from apps....
StarcoderdataPython
3356906
<gh_stars>0 import os from librgb.reader import Reader class FileReader(Reader): def __init__(self, source_path): super(FileReader, self).__init__() self.path = source_path with open(source_path, 'rb') as handle: handle.seek(0, os.SEEK_END) self._max_address = handl...
StarcoderdataPython
1613597
<gh_stars>1-10 """Prototype to play with HTML bokeh elements""" import bokeh.plotting import bokeh.models import bokeh.layouts import datetime as dt from functools import wraps class throttle(object): def __init__(self, milliseconds=0, seconds=0): self.period = dt.timedelta(milliseconds=milliseconds, ...
StarcoderdataPython
1692533
<filename>single/run_qlnn.py #--------- Training ---------# # metrics for each episode time_steps = [] # number of time steps in total epsilons = [] # epsilon at the end of each episode greedy = [] # the ratio of greedy choices coverage = [] # the ratio of visited cells at the end speed = [] # number of time steps to ...
StarcoderdataPython
1612749
# -*- coding: utf-8 -*- """ This plugin has been developed for login through a third party application that uses 'WordPress OAuth Server' plugin: https://wordpress.org/plugins/miniorange-oauth-20-server """ from urllib.parse import urljoin import jwt import requests from ...core import HTTP, URL, redirect from . im...
StarcoderdataPython
1747367
from django.utils.translation import gettext_lazy as _ from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from djangocms_bootstrap5.helpers import concat_classes from .models import Bootstrap5Badge class Bootstrap5BadgePlugin(CMSPluginBase): """ Components > "Badge" Plugin ...
StarcoderdataPython
37610
def solve(): n = int(input()) k = list(map(int,input().split())) hashmap = dict() j = 0 ans = 0 c = 0 for i in range(n): if k[i] in hashmap and hashmap[k[i]] > 0: while i > j and k[i] in hashmap and hashmap[k[i]] > 0: hashmap[k[j]] -= 1 ...
StarcoderdataPython
1623282
<reponame>2658Labs/Rangebi import os import re from setuptools import setup, find_packages setup( name='Rangebi', author="2658 labs", version="0.0.1", url="https://github.com/2658labs/Rangebi", description="A mixed wrapper over coloroma, halo and pretty tables for building beautiful python cli ap...
StarcoderdataPython
1763162
<reponame>dgerod/more-dmps import numpy as np from cs import CanonicalSystem class TdwFormulation(object): def __init__(self, ay=None, by=None): # Parameters as defined in Schaal 2012 if ay is None: ay = 25. self.ay = ay if by is None: by = ay/4. self.by = by de...
StarcoderdataPython
60100
from typing import Any, Dict, Mapping, Type from vial.errors import ErrorHandlingAPI, MethodNotAllowedError, NotFoundError from vial.json import Json, NativeJson from vial.loggers import LoggerFactory from vial.middleware import CallChain, MiddlewareAPI, MiddlewareChain from vial.parsers import ParserAPI from vial.req...
StarcoderdataPython
1627934
""" Runner for the BigBoat API tests. Copyright 2018 ICTU 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 agree...
StarcoderdataPython
4809067
<filename>staging/versions/85890168227d_.py """empty message Revision ID: 85890168227d Revises: <PASSWORD> Create Date: 2020-05-23 10:55:45.677118 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = '85890168227d' down_revi...
StarcoderdataPython
3232752
#!/usr/bin/env python import sqlite3 import glob import os, sys reg_type = sys.argv[1] registries=glob.glob(sys.argv[2]) outfile=sys.argv[3] tmp_registry="./tmp_registry.sqlite3" if os.path.exists(outfile): os.system('cp %s %s'%(outfile, tmp_registry)) os.system('cp %s %s'%(outfile, outfile+'_bak')) else: ...
StarcoderdataPython
3220691
<reponame>PawelPeczek/Abdomen-CT-Image-Segmentation import matplotlib from nnunet.training.network_training.network_trainer import NetworkTrainer from nnunet.network_architecture.neural_network import SegmentationNetwork from batchgenerators.utilities.file_and_folder_operations import * from nnunet.utilities.nd_softmax...
StarcoderdataPython
3311415
# -*- coding: utf-8 -*- """Fast Fourier Transform, CPU parallelization, and GPU execution tests: - multi-thread CPU & GPU outputs match that of single-thread CPU - batched (multi-input) outputs match single for-looped - `ssqueezepy.FFT` outputs match `scipy`'s - unified synchrosqueezing pipelines outputs ma...
StarcoderdataPython
1780518
#!/usr/bin/env python3 import argparse import datetime import gzip import multiprocessing import os import subprocess import sys import tarfile import urllib.request import about import check import shared import tax def parse_arguments(): date = str(datetime.datetime.now().date()) parser = argparse.Ar...
StarcoderdataPython
3323413
<gh_stars>0 from tensorflow.keras.datasets import mnist from tensorflow.keras.utils import to_categorical from tensorflow.keras import models, layers (train_images, train_labels), (test_images, test_labels) = mnist.load_data() train_images = train_images.reshape((-1, 28, 28, 1)).astype('float32') / 255 x_val = train_i...
StarcoderdataPython
45713
# Copyright (c) <NAME>, TU Delft. # All rights reserved. # See COPYRIGHT for details. # added -fpermissive to CMAKE_CXX_FLAGS to workaround g++ 4.3 compile # problem on the included CPT code. We were getting "changes meaning # of" errors as documented in # http://stupefydeveloper.blogspot.com/2008/11/c-name-lookup-c...
StarcoderdataPython
1638550
<reponame>TheWardoctor/wardoctors-repo import requests import re import xbmc from ..common import clean_title, clean_search from ..scraper import Scraper requests.packages.urllib3.disable_warnings() s = requests.session() User_Agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Ge...
StarcoderdataPython
1771264
"""pbs_map test suite.""" import unittest import random import sys import pbs_map as ppm print """ Note: If jobs are accepted to by the batch system but not executed, this test suite will hang. """ # TODO: Use showstart to identify hanging submissions class IdentityWorker(ppm.Worker): def do_work(self, x):...
StarcoderdataPython
3231004
## Copyright 2015-2019 <NAME>, <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 obtain a copy of the License at ## http://www.apache.org/licenses/LICENSE-2.0 ## Unless required by applicable law or agreed to i...
StarcoderdataPython
107301
######################### # 装饰器:一般的装饰器 ######################### import time def time_track(func): # args为了保证可以接收不定参数的调用 # kwargs为了保证可以装饰 **kwargs的函数调用 def wrapper(*args, **kwargs): start = time.time() print("call function %s at %f" % (func.__name__, start)) result = func(*args, *...
StarcoderdataPython
4820297
<gh_stars>1-10 import lsltools.sim as sim # github.com/bwrc/lsltools def stream_ecg(): print("Streaming started...") # Start the ECG stream (with default parameters) ecg = sim.ECGData('/home/jtorniai/ecgsyn_c/ecgsyn', stream_name='ecg_data') ecg.start() # Simple UI to change the heart rate ...
StarcoderdataPython
3380429
from django.contrib import admin from django.urls import path, include from . import views from django.conf.urls.static import static from django.conf import settings from django.contrib.auth.views import PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView, PasswordResetCompleteView urlpatterns = [ ] + ...
StarcoderdataPython
53025
<reponame>willjp/vim-taskmage class ParserError(Exception): pass
StarcoderdataPython
1765813
<gh_stars>1-10 import subprocess import time import os import sysv_ipc sem = sysv_ipc.Semaphore(None, sysv_ipc.IPC_CREX, initial_value=1) print("Parent: created semaphore {}.".format(sem.key)) sem.acquire() # Spawn a child that will wait on this semaphore. path, _ = os.path.split(__file__) print("Parent: spawning c...
StarcoderdataPython
170383
from django.db import models from django.contrib.auth.models import AbstractUser from django.db.models.deletion import CASCADE from django.db.models.signals import post_save from django.dispatch import receiver class CustomUser(AbstractUser): user_type_data=(('1',"Manager"),('2',"Guard"),('3',"Customer")) user...
StarcoderdataPython
4807170
""" # Fixture helpers """ # Stdlib import os # 3rd party import pytool # Constants BASE_DIR = './fixtures' # Classes class FixtureLoader(object): def __init__(self, extension, mode='r', loader=lambda d: d): self.mode = mode self.extension = extension self.cache = {} self.loader...
StarcoderdataPython
1740232
<filename>src/loaders.py from functools import partial from itertools import product import multiprocessing as mp import os from attrdict import AttrDict import numpy as np import torch import torchvision.transforms as transforms from PIL import Image import pandas as pd from torch.utils.data import Dataset, DataLoade...
StarcoderdataPython
34092
# Generated by Django 2.2 on 2020-03-30 15:03 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='SeoUrl', fields=[ ('head_title', models.CharF...
StarcoderdataPython
1724192
<reponame>title848/ALPR from switchtest import * x = " " a = 'l' for i in range(3): x = x + a print(x)
StarcoderdataPython
3278975
<reponame>zhyever/SimIPU from mmdet.datasets.pipelines import Compose from .dbsampler import DataBaseSampler from .formating import Collect3D, DefaultFormatBundle, DefaultFormatBundle3D from .loading import (LoadAnnotations3D, LoadImageFromFileMono3D, LoadMultiViewImageFromFiles, LoadPointsFromFil...
StarcoderdataPython
32328
#!/usr/bin/python import twython, time, pprint, traceback, os, sys import config from twython import TwythonStreamer, TwythonError, TwythonRateLimitError import urllib, json, glob, re import thread queuelock = thread.allocate_lock() watchlock = thread.allocate_lock() import logging logging.basicConfig(filename='highea...
StarcoderdataPython
3291627
# Copyright 2011 Nexenta Systems, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
StarcoderdataPython
3323493
<reponame>naresh1205/Robotics-Automation-QSTP-2020 #!/usr/bin/env python import rospy from std_msgs.msg import Float32 from week2.srv import rad_ang_speed from geometry_msgs.msg import Twist def callback(rad): rospy.wait_for_service('compute_ang_vel') ang_speed = rospy.ServiceProxy('compute_ang_vel', rad_ang_sp...
StarcoderdataPython
113382
<reponame>manuelep/kilimanjaro<filename>kilimanjaro/dbutils/adapters/sqlite.py # -*- coding: utf-8 -*- import os import logging logger = logging.getLogger(__name__) def liteteardown(path, uris, **__): for uri, _ in uris: dbname = uri.split("/")[-1] fp = os.path.join(path, dbname) for file...
StarcoderdataPython
95319
<filename>backend/medico/urls.py from django.urls import include, path from rest_framework import routers from .views import MedicoViewSet, EspecialidadeViewSet router = routers.DefaultRouter() router.register(r'medicos', MedicoViewSet, basename='medicos') router.register(r'especialidades', EspecialidadeViewSet, basen...
StarcoderdataPython
1785877
<filename>pizza_home/bot_messages.py BOT_MESSAGES = { "Welcome": "Hi, welcome to Cal Pizza Delivery System! Please share your Order ID", "incorrect_order_id": "Oops, that looks like an invalid order id. Please enter a valid order id again.", "first_question": "How can I help you?<br>1. Expedite order proces...
StarcoderdataPython
150919
# Plugin made by @okay_retard && @hellboi_atul... # If Gonna kang then keep credits..don't edit/remove these lines... # else gay from telethon.tl.types import InputMessagesFilterMusic from userbot.utils import admin_cmd from telethon.tl.functions.messages import ImportChatInviteRequest from telethon.errors.rpcerrorlist...
StarcoderdataPython
1752497
<gh_stars>1-10 ################################################################################ # Copyright IBM Corporation 2021, 2022 # # 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 # # ...
StarcoderdataPython
3214352
<filename>server/utils.py import datetime as main_datetime from google.appengine.ext import ndb DATE_FORMAT = '%Y-%m-%d' DATE_TIME_FORMAT = '%Y-%m-%d %H:%M:%S' TIME_FORMAT = '%H:%M:%S' def date_to_str(date_time): if type(date_time) is main_datetime.date: return main_datetime.date.strftime(date_time, DATE_FORMAT) ...
StarcoderdataPython
1642954
# Copyright 2014, <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 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, soft...
StarcoderdataPython
3279033
<filename>test/generate_values.py #!/usr/bin/env python3 import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from siti_tools.file import read_container # noqa: E402 from siti_tools.siti import si, ti # noqa: E402 def main(): previous_frame_data = None f...
StarcoderdataPython
3271306
# Generated by Django 3.2.8 on 2022-01-24 14:46 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Product', ...
StarcoderdataPython
1766743
from . import exp_configs_infomax, exp_configs_vae EXP_GROUPS = {} EXP_GROUPS.update(exp_configs_infomax.EXP_GROUPS) EXP_GROUPS.update(exp_configs_vae.EXP_GROUPS)
StarcoderdataPython
1651524
<reponame>mengzaiqiao/TVBR DEFAULT_USER_COL = "col_user" DEFAULT_ITEM_COL = "col_item" DEFAULT_RATING_COL = "col_rating" DEFAULT_LABEL_COL = "col_label" DEFAULT_ORDER_COL = "col_order" DEFAULT_FLAG_COL = "col_flag" DEFAULT_TIMESTAMP_COL = "col_timestamp" DEFAULT_PREDICTION_COL = "col_prediction" DEFAULT_K = 10 DEFAULT...
StarcoderdataPython
1782332
<reponame>untitaker/watdo<filename>watdo/model.py # -*- coding: utf-8 -*- ''' watdo.model ~~~~~~~~~~~ This module provides datastructures to represent and helper functions to access data on the filesystem. :copyright: (c) 2013 <NAME> :license: MIT, see LICENSE for more details. ''' import date...
StarcoderdataPython
194751
class EventTypeFilter(TraceFilter): """ Indicates whether a listener should trace based on the event type. EventTypeFilter(level: SourceLevels) """ def ZZZ(self): """hardcoded/mock instance of the class""" return EventTypeFilter() instance=ZZZ() """hardcoded/returns an instance of the class""" ...
StarcoderdataPython
120568
<gh_stars>1-10 import random class Pj(object): "Définit le personnage jouable" def __init__(self): self.Pv = 30 self.Xp = 1 def dammage(self): # maxrange = 12 # pt_attack = random.randrange(maxrange) # Xp = 1 # we will work on that later # print(pt_attack...
StarcoderdataPython
1729137
<gh_stars>0 # [카카오 채용연계형 인턴십] 미로 탈출 import heapq INF = 987654321 def solution(n, start, end, roads, traps): distance = [[INF for _ in range(n + 1)] for _ in range(n + 1)] graph = [[INF for _ in range(n + 1)] for _ in range(n + 1)] for a, b, c in roads: graph[a][b] = min(graph[a][b], c) dijkst...
StarcoderdataPython
1632233
import pandas as pd import os path = '/Users/tithighosh/Library/Application Support/AirDroid/Downloads/article_data 2' data=pd.read_csv('data.csv', index_col=0) for lab, row in data.iterrows(): if not str(data.loc[lab, 'Text'])=='nan': continue file = data.loc[lab, 'id']+'.txt' wi...
StarcoderdataPython
39331
<gh_stars>0 """Tests for payment channel functionality.""" import time import codecs import pytest import collections import multiprocessing import two1.bitcoin.utils as utils from two1.bitcoin import Script, Hash from two1.bitcoin import PrivateKey from two1.bitcoin import Transaction, TransactionInput, TransactionOu...
StarcoderdataPython
3373710
<filename>AD.py import sys from HRGAT.data import * from HRGAT.model import * from HRGAT.gats import * from warnings import filterwarnings import dill from HRGAT.data import Graph filterwarnings("ignore") import dill as pickle import argparse parser = argparse.ArgumentParser(description='Training GNN on Aut...
StarcoderdataPython
3385667
<filename>td_to_acxiom_digital_graph.py<gh_stars>1-10 # Description ################################################################################################################# # This code to add the classes to the path is not needed in the workflow as the directory structure will be flat import sys, os file_path...
StarcoderdataPython
181352
# -*- coding: utf-8 -*- from django.db import models class CommentForListDestroyModelMixin(models.Model): email = models.EmailField() class Meta: app_label = 'tests_app'
StarcoderdataPython
3322451
<reponame>sbshrey/flask-caching<filename>flask_caching/backends/__init__.py # -*- coding: utf-8 -*- """ flask_caching.backends ~~~~~~~~~~~~~~~~~~~~~~ Various caching backends. :copyright: (c) 2018 by <NAME>. :copyright: (c) 2010 by <NAME>. :license: BSD, see LICENSE for more details. """ # fro...
StarcoderdataPython
1711364
#!/usr/bin/python3 # Author: <NAME> # Date: 2018.7.2 map_host = '0.0.0.0' from flask import Flask, render_template, redirect, url_for, request import essence, settings app = Flask(__name__) @app.route('/', methods=['GET']) def index(): return redirect(url_for('EssenceMap')) @app.route('/EssenceMap', meth...
StarcoderdataPython
198514
<reponame>youdiaozi/cinema4d_py_sdk_extended<gh_stars>1-10 """ Copyright: MAXON Computer GmbH Author: <NAME> Description: - Creates a swatch group and adds rainbow colors to it. Class/method highlighted: - c4d.modules.colorchooser.SwatchData - c4d.modules.colorchooser.SwatchGroup - maxon.ColorA Compa...
StarcoderdataPython
110482
import os import json from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser def main(parse_args): merged_splits = {} for splits_path in parse_args.splits_paths: with open(splits_path, 'r') as f: splits = json.load(f) for split_key in splits: if not split_...
StarcoderdataPython
1697669
<reponame>afdaniele/run-and-retry<filename>rretry/__init__.py<gh_stars>0 import logging __version__ = '0.1.2' # define logger logging.basicConfig() rrlogger = logging.getLogger('rretry') rrlogger.setLevel(logging.INFO) from .main import run
StarcoderdataPython
1717027
<gh_stars>0 from datetime import date print('Vamos descobrir a qual categoria de natação você pertence: ') anonasc = int(input('Digite o ano em que nasceu: ')) anoatual = date.today().year idade = anoatual - anonasc print('Você possui {} anos.'.format(idade)) if idade <= 9: print('Sua categoria é: Mirim') elif id...
StarcoderdataPython
182715
default_app_config = 'centralauth.provider.apps.ProviderConfig' # noqa
StarcoderdataPython
109314
<filename>examples/annotations.py<gh_stars>1-10 # Created byMartin.cz # Copyright (c) <NAME>. All rights reserved. import numpy import pero import perrot # prepare data x_data = numpy.linspace(-2*numpy.pi, 2*numpy.pi, 100) y_data = numpy.sin(x_data) x_data /= numpy.pi # init chart plot = perrot.Plot( title_tex...
StarcoderdataPython
115324
<reponame>leelasd/molfunc import numpy as np import os from molfunc.exceptions import * class Atom: def __repr__(self): x, y, z = self.coord return f'[{self.label}, {x:.3f}, {y:.3f}, {z:.3f}]' def translate(self, vec): """Shift the atom in 3D space by a vector (np.ndarray) length 3""...
StarcoderdataPython
3217715
<filename>tests/test_middleware.py import pytest import time from prometheus_client import REGISTRY from starlette.applications import Starlette from starlette.testclient import TestClient from starlette.responses import JSONResponse, PlainTextResponse from starlette.routing import Mount, Route, Router from starlette.e...
StarcoderdataPython
3257116
<filename>coco-dst/train_coco.py<gh_stars>10-100 """ Copyright (c) 2020, salesforce.com, inc. All rights reserved. SPDX-License-Identifier: BSD-3-Clause For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause """ import argparse import glob import logging impor...
StarcoderdataPython
1683432
<filename>tests/test_collections.py import warnings import pytest from astropy import units as u from astropy.utils.data import get_pkg_data_filename import matplotlib.pyplot as plt import numpy as np from numpy.testing import assert_array_equal from lightkurve.lightcurve import LightCurve, KeplerLightCurve, TessLigh...
StarcoderdataPython
1770613
import os from setuptools import setup, find_packages here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, "README.md"), "r") as f: long_description = f.read() with open(os.path.join(here, "requirements.txt"), "r") as f: INSTALL_REQUIRES = f.read().splitlines() about = {} with open...
StarcoderdataPython
189619
#from django.shortcuts import render from rest_framework import viewsets # Create your views here. from todo.models import Todo from todo.serializers import TodoSerializer #from django.conf import settings class TodoViewSet(viewsets.ModelViewSet): queryset = Todo.objects.all().order_by('-created') serializer_...
StarcoderdataPython
138725
<gh_stars>0 # Copyright 1999-2017 Alibaba Group Holding 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 appl...
StarcoderdataPython
1774258
<reponame>YifanQie/Deep_Learning_for_Manufacturing<filename>model_selection/dl_models.py<gh_stars>10-100 class DL_BM_Arch: """ Deep Learning Model Class :param model_type: Type of model to be used for training 3D CNN with MSE loss, 3D CNN with hetreoskedastic aleatoric loss, 3D CNN with a mixture density networ...
StarcoderdataPython
3216507
<gh_stars>1-10 # The MIT License (MIT) # # Copyright (c) 2019 <NAME> for Capable Robot Components # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limi...
StarcoderdataPython
1747809
""" Module with ctypes bindings for the high-level FUSE 3.x API. These are based on the following libfuse headers: * fuse/fuse.h * fuse/fuse_common.h * fuse/fuse_opt.h Currently the implementation assumes an x86-64 system. """ import ctypes import ctypes.util from enum import Enum # # Helpers # def struct_to_dic...
StarcoderdataPython