id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3350324
<reponame>zahidaliayub/BitcoinUnlimited #!/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. # # Run Regression Test Suite # import os import sys import subproces...
StarcoderdataPython
1640205
from __future__ import division import numpy as np from menpo.math import pca, ipca, as_matrix, pcacov from menpo.model import PCAVectorModel from menpo.model.vectorizable import VectorizableBackedModel from menpo.visualize import print_dynamic from menpo.base import doc_inherit import scipy.linalg as la class Robust...
StarcoderdataPython
1771849
<reponame>tiefenauer/ip7-python import collections from bs4 import Comment from src.preprocessing import preproc from src.preprocessing.preprocessor import Preprocessor NON_HUMAN_READABLE_TAGS = ['script', 'noscript', 'meta', 'link', 'style', 'iframe', 'input', 'img'] class HTMLPreprocessor(Preprocessor): """p...
StarcoderdataPython
108841
from django.db import models from django.utils.translation import ugettext_lazy as _ from django.utils import timezone from django.contrib.contenttypes.models import ContentType from django.contrib.flatpages.models import FlatPage from django.contrib.postgres.fields import JSONField from mptt.models import MPTTModel, T...
StarcoderdataPython
3384015
<gh_stars>1-10 import random from tqdm import tqdm import gym import gym_numberworld env = gym.make('numberworld-v0', grid_size=10, # pass environment arguments to gym.make n_objects=10, removed_objects=[('red', '3')]) # red 3 will not appear in environment env.seed(1) ...
StarcoderdataPython
3333811
<filename>flask-back/src/Cron.py<gh_stars>0 from core.definitions import FIRST_DAY_MONTH_SPANISH, LAST_DAY_MONTH_SPANISH, FIRST_DAY_MONTH_CRON, LAST_DAY_MONTH_CRON from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() class Cron(db.Model): __tablename__ = 'Cron' id = db.Column(db.Integer, primary_key=Tr...
StarcoderdataPython
3300186
<reponame>mwk0408/codewars_solutions<filename>5 kyu/Josephus Permutation.py def josephus(items,k): count=k result=[] while len(items)!=0: while count>len(items): count-=len(items) result.append(items[(count-1)]) del items[(count-1)] count+=k-1 return resu...
StarcoderdataPython
3323075
<gh_stars>1-10 CONFIG = { 'FACEBOOK_TOKEN' : "", 'VERIFY_TOKEN' : "<PASSWORD>", 'SERVER_URL' : "https://hailbot.herokuapp.com/" } config = { "apiKey": "", "authDomain": "highonbot-fee46.firebaseapp.com", "databaseURL": "https://highonbot-fee46.firebaseio.com", "storageBucket": "highonbot-fee46.apps...
StarcoderdataPython
25586
<filename>tests/cell_fabric/test_rect.py from align.cell_fabric.transformation import Rect def test_toList(): r = Rect( 0, 0, 1, 1) assert r.toList() == [0, 0, 1, 1] def test_canonical(): r = Rect( 1, 1, 0, 0) assert r.canonical().toList() == [0, 0, 1, 1] def test_repr(): r = Rect( 0, 0, 1, 1) ...
StarcoderdataPython
3203671
import numpy as np from numpy import random as rnd import random from matplotlib import pyplot as plt import seaborn as sns import pandas as pd import progressbar from PopulationClasses import Population # defining constant integers to make labeling easy SUS = 0 # susceptible INF = 1 # infected REC = 2 # recovered DE...
StarcoderdataPython
3224890
<filename>zvt/recorders/emquantapi/finance/china_stock_finance_debtpayingability.py # -*- coding: utf-8 -*- from zvt.domain import FinanceDebtpayingAbility from zvt.recorders.emquantapi.finance.base_china_stock_finance_recorder import EmBaseChinaStockFinanceRecorder from zvt.utils.utils import add_func_to_value, first_...
StarcoderdataPython
3359504
<gh_stars>10-100 # Generated by Django 3.2a1 on 2021-02-06 09:42 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("audit", "0004_auto_20201017_1016"), ] operations = [ migrations.RunSQL( """ UPDATE audit_logged_actions SET row_dat...
StarcoderdataPython
1728075
import random def outputtemplate (random1,yourguess, result): outputtemplate_1=""" The target was {}. Your guess was {}. That's under by {}. """.format(random1,yourguess, result) return outputtemplate_1 def outputtemplate2 (random1, yourguess, result): outputtemplate_2=""" The target was {}. Your guess was {}. ...
StarcoderdataPython
175988
# # Copyright (c) 2022, 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 the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
StarcoderdataPython
3391965
from __future__ import absolute_import from copy import copy from bokeh.properties import String from ._models import CollisionModifier from ._data_source import DataOperator class Stack(CollisionModifier): """Cumulates elements in the order of grouped values. Useful for area or bar glyphs. """ na...
StarcoderdataPython
184267
# Evaluacion ## Dataset #Explicar ### Estaciones #### Objetivo #'21057060': PAICOL target = '21057060-WL_CAL_AVG' #### Predictoras # PAICOL preds_cod = ['21017060', '21017040' ,'21087080', '21057050', '21057060'] # Removed PTE balseadero (Data hasta el 2015) 21047010 ### Variables #--NOT-- PR_CAL_ACU -> Precipitacion a...
StarcoderdataPython
3361233
<filename>tests/bitly/test_bitly_history.py<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import ecstasy import os import pytest import requests import time from collections import namedtuple import tests.paths import lnk.bitly.history VERSION = 3 API = 'https:...
StarcoderdataPython
87728
''' Applying Stochastic Gradient Descent for Linear Regression ''' import numpy as np import matplotlib import matplotlib.pyplot as plt X = 2 * np.random.rand(100,1) y = 4 + 3 * X + np.random.randn(100,1) X_b = np.c_[np.ones((100,1)), X] eta = .1 m = 100 n_epochs = 50 # Learning schedule hyperparameters t0, t1 = 5...
StarcoderdataPython
3231449
from rest_framework import permissions from rest_framework import viewsets from .models import SiteConfiguration from .serializers import SiteConfigurationSerializer class SiteConfigurationViewSet(viewsets.ModelViewSet): queryset = SiteConfiguration.objects.all() serializer_class = SiteConfigurationSerializer...
StarcoderdataPython
3235296
<gh_stars>0 import sys import os import os.path import tempfile import numpy as np from numpy import sqrt,log,pi,cos,arctan import scipy.optimize from matplotlib import pyplot as pl pl.rc('text', usetex=True) # Support greek letters in plot legend from crackclosuresim2 import solve_shearstress from crackclosuresim2...
StarcoderdataPython
130417
import os import shutil import sys from setuptools import setup, find_packages def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() dst = 'debian/openstackx/var/lib/nova/' os.system('rm -rf %s' % dst) shutil.copytree('extensions', '%s/extensions' % dst) requirements = ['httplib2'] ...
StarcoderdataPython
1677474
# -*- coding: utf-8 -*- """ Created on July 2017 @author: JulienWuthrich """ import pandas as pd def isDateTime(row): try: row.hour return True except Exception: return False def colDateType(df): date = [] date_time = [] for col in df.columns: row = df[col].iloc...
StarcoderdataPython
89432
# -*- coding: UTF-8 -*- import arcpy import re import os import codecs #ツール定義 class FeatureToWKTCSV(object): def __init__(self): self.label = _("Feature To UTF-8 WKT CSV") self.description = _("Creates a UTF-8 WKT CSV from specified features.") self.category = _("DataManagement") self.canRunInBac...
StarcoderdataPython
3347726
""" sentry.models.dsymfile ~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2016 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import import re import os import six import uuid import time import errno import shutil import hashlib import...
StarcoderdataPython
1749621
<filename>fleet/infrastructure/persistence/fleet_memory_repository.py import uuid from fleet.domain.shared.fleet_ids import FleetId from fleet.domain.fleet.fleet import FleetRepository, Fleet class FleetInMemoryRepository(FleetRepository): def __init__(self): self.fleets = {} def store(self,...
StarcoderdataPython
1734974
<reponame>AndreyLev/py_vk_bot_api_fix from .api import api from .exceptions import mySword from .session import session as ses from requests import post class upload(object): def __init__(self, session): if not isinstance(session, ses): raise mySword("invalid session") self.vk = api(se...
StarcoderdataPython
120459
import threading # Notices: 1. The correctness is relied on GIL # 2. Iterator is not thread-safe, so don't access by different threads in the same time class _SimplePrefetcherIterator: def __init__(self, iterable, low_limit: int, high_limit: int): super(_SimplePrefetcherIterator, self).__init__() ...
StarcoderdataPython
3343945
<reponame>angelyhch/sayhello # -*- coding: utf-8 -*- """ :author: <NAME> (李辉) :url: http://greyli.com :copyright: © 2018 <NAME> <<EMAIL>> :license: MIT, see LICENSE for more details. """ import click from sayhello import app, db from sayhello.models import Message @app.cli.command() @click.option('--...
StarcoderdataPython
3390679
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class RubyWalk(RubyPackage): """Directory tree traversal tool inspired by python os.walk""" homepage = "https://...
StarcoderdataPython
1645765
# Copyright (c) 2019 Red Hat, 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 requi...
StarcoderdataPython
196419
<filename>app/main.py<gh_stars>0 from ariadne import load_schema_from_path, snake_case_fallback_resolvers from ariadne.asgi import GraphQL from ariadne.contrib.federation import make_federated_schema from graphql import GraphQLSchema from .resolvers import mutation, query, user type_defs: str = load_schema_from_path(...
StarcoderdataPython
1741780
from deck import Deck Suits = ('Hearts', 'Diamonds', 'Spades', 'Clubs') Ranks = ('Ace','Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Jack', 'Queen', 'King') Values = {'Ace':1,'Two':2, 'Three':3, 'Four':4, 'Five':5, 'Six':6, 'Seven':7, 'Eight':8, 'Nine':9, 'Ten':10, 'Jack':10, 'Q...
StarcoderdataPython
1605645
<gh_stars>0 import socket import sys if __name__ == '__main__': if len(sys.argv) < 3: print("./{} addr port".format(sys.argv[0])) sys.exit(1) addr = (sys.argv[1], int(sys.argv[2])) print(addr) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(addr) sock.send(...
StarcoderdataPython
1646485
<gh_stars>1-10 from typing import List from fastapi.encoders import jsonable_encoder from sqlalchemy.orm import Session # this will allow you to declare the type of the db parameters and have better type checks and completion in your functions. from sqlalchemy import asc from app.crud.base import CRUDBase from app.mod...
StarcoderdataPython
169945
<filename>zeenode/zeenode/config.py class config: global auth; auth = "<PASSWORD>" # Enter your discord token for Auto-Login. global prefix; prefix = "$" # Enter your prefix for selfbot. global nitro_sniper; nitro_sniper = "true" # 'true' to enable nitro sniper, 'false' to disable. global giveaway_s...
StarcoderdataPython
166967
from tokenizer.quotes import tokenize_double_quotes from tokenizer.particles import particle_group_to_big_size TOKENIZER_METHODS = [ # tokenize_method_name # create_fuzzed_particle_group, tokenize_double_quotes, ] def create_tokenized_messages(original_message: str, tokens_to_ignore: list, methods: list ...
StarcoderdataPython
4817195
<reponame>ProfJust/Ruhr-TurtleBot-Competition-RTC-<filename>nodes/p2_wasd_turtlesim/Vorgabe_rtc_p02_zurtlesim_wasd_publisher.py<gh_stars>0 #!/usr/bin/env python3 # --- rtc_p02_turtlesim_wasd_publisher.py ------ # Version vom 30.9.2021 by OJ # ----------------------------- import rospy from geometry_msgs.msg import Twis...
StarcoderdataPython
1775464
def Count(file='Weird.txt'): f=open(file,'r').readlines() lst=[] done={} for x in f: lst+=x.split(' ') for x in lst: if x not in done.keys(): done[x]=lst.count(x) return done print(Count())
StarcoderdataPython
4837944
<gh_stars>0 # Generates a few tests from os import sys import jsonparser def getNumericStrings(): good_numbers = [ '0.,', '.0,', '123123.,', '.1213,', '1213.3232,', '313123,', '123e+80,', '67456234}', '1,', '0}', ] bad_...
StarcoderdataPython
1790670
""" """ import pytest from bitvector import BitVector, BitField, ReadOnlyBitField from itertools import combinations def test_bitfield_create_no_args(): with pytest.raises(TypeError): BitField() @pytest.mark.parametrize("offset", list(range(0, 128))) def test_bitfield_create_with_offset(offset: int):...
StarcoderdataPython
171537
from fastapi import APIRouter, Depends, HTTPException from db.crud import get_db import schemas from sqlalchemy.orm import Session from db import crud, models from verify import get_current_user router = APIRouter() @router.post('/', response_model=schemas.Comment) async def email_subscribe(comment: schemas.Comment...
StarcoderdataPython
99488
<reponame>musaibnazir/MixedPy print("Leap Year Range Calculator: ") year1=int(input("Enter First Year: ")) year2 = int(input("Enter Last Year: ")) while year1<=year2: if year1 % 4 == 0 : print(year1,"is a leap year") year1= year1 + 1
StarcoderdataPython
3241614
<gh_stars>1-10 import os from setuptools import setup, find_packages with open(os.path.join(os.getcwd(), 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( name = "pycobb", version = "0.0.4", author = "<NAME>", author_email = "<EMAIL>", keywords = "baseball savant saberme...
StarcoderdataPython
3215943
<filename>src/gw_viterbi/development-settings.py from .base import * INSTALLED_APPS += ('corsheaders', ) CORS_ORIGIN_ALLOW_ALL = True MIDDLEWARE.append('corsheaders.middleware.CorsMiddleware') SITE_URL = "http://localhost:3000" EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' try: from .local i...
StarcoderdataPython
3251641
<reponame>xiaohan2012/rl-search<gh_stars>1-10 class SamplerRepository(object): ################ # The following are the samplers ################ @classmethod def get(cls, sampler_id): return None @classmethod def get_samplers_from_str(cls, s): """ Get a list o...
StarcoderdataPython
68349
from multiprocessing import Process, Value, Array, Queue, Pipe import time from datetime import datetime import cv2 import numpy import RPi.GPIO as GPIO import Iothub_client_functions as iot import picamera from picamera.array import PiRGBArray import picamera.array def f(n, a): n.value = 3.1415927 ...
StarcoderdataPython
119587
"""This module is a Crazyflie Checker""" import logging import sys import cflib.crtp import colorama from prompt_toolkit import prompt from prompt_toolkit.history import FileHistory from prompt_toolkit.shortcuts import checkboxlist_dialog from prompt_toolkit.completion import WordCompleter from prompt_toolkit.valida...
StarcoderdataPython
1778160
from utils import * from sklearn.metrics import auc def parse_args(): import argparse parser = argparse.ArgumentParser(description='Benchmark methods') parser.add_argument('method', type=str, help='Benchmarking method to use') parser.add_argument('virus', type=str, ...
StarcoderdataPython
4839610
<filename>Hackerrank/Divisible Sum Pairs.py import math import os import random import re import sys def divisibleSumPairs(n, k, ar): count = 0 i = int(0) for i in enumerate(ar): j=i for j in enumerate(ar): if ar[i] < ar[j] and (ar[i]+ar[j]) % k == 0: count += ...
StarcoderdataPython
3238432
import threading from threading import Thread from twisted.internet import reactor, endpoints, defer from logging import getLogger from thingsboard_gateway.twisted.usr.usr_protocol_factory import UsrProtocolFactory from pymodbus.framer.ascii_framer import ModbusAsciiFramer from pymodbus.framer.binary_framer import Mo...
StarcoderdataPython
1635688
#! /usr/bin/env python """compare float array files.""" import argparse import os import numpy as np import glob parser = argparse.ArgumentParser(description='compare .float binary files') parser.add_argument('dir1', help='path to directory containing .float files') parser.add_argument('dir2', help='path to another di...
StarcoderdataPython
141850
<gh_stars>0 # -*- coding: utf-8 -*- import tkinter as tk import pandas as pd from support_modules import support as sup from extraction import pdf_finder as pdf from extraction.user_interface import dist_manual_edition_ui as me class InterArrivalEvaluator(): """ This class evaluates the inter-arrival times ...
StarcoderdataPython
3231021
<gh_stars>1000+ # -*- coding: utf-8 -*- from torch import nn from torch.ao.sparsity import WeightNormSparsifier from torch.ao.sparsity import BaseScheduler, LambdaSL from torch.testing._internal.common_utils import TestCase import warnings class ImplementedScheduler(BaseScheduler): def get_sl(self): if s...
StarcoderdataPython
1670787
<filename>storage.py import json from abc import ABC, abstractmethod from mongo import MongoDatabase class StorageAbstract(ABC): @abstractmethod def store(self, data, *args): pass def load(self): pass def update_flag(self, data): pass class MongoStorage(StorageAbstract): ...
StarcoderdataPython
3253959
from __future__ import annotations from parasut_cli.utils.receiver import Receiver from parasut_cli.utils.command import Command class RunCommand(Command): def __init__( self, receiver: Receiver, repo_name: str, ) -> None: self._receiver: Receiver = receiver self._repo...
StarcoderdataPython
138652
<reponame>sibonyves/amuse<filename>src/amuse/community/bonsai2/interface.py import os.path from amuse.community import * from amuse.community.interface.gd import GravitationalDynamicsInterface, GravitationalDynamics class Bonsai2Interface(CodeInterface, LiteratureReferencesMixIn, GravitationalDynamicsInterface, ...
StarcoderdataPython
3341183
#!/usr/bin/env python from bottle import route, run, get, post, request, response import bottle bottle.debug(True) import os.path MAIN = os.path.join(os.path.dirname(__file__),"form.html") HERE = os.path.dirname(__file__) from add_extra_rels import extra_deps import sys sys.path.append(os.path.join(HERE,"easyfirst"))...
StarcoderdataPython
1785806
<filename>shift64/__main__.py from coding import * from mods import * import sys print(Decode(Encode(Encode("Hello","1234"),"1234"),"1234")) if len(sys.argv) < 2: print("Usage: shift64 [0/1] <message>") else: mode = sys.argv[1] inpmod = False if int(mode) == 0: inpmod = True else: print("Enter the key:") k...
StarcoderdataPython
3356373
<gh_stars>0 # Given a linked list l: # 1) Remove all duplicates # 2) Remove all duplicates without buffer import sys sys.path.append("../../LinkedList") from LinkedList import LinkedList from LinkedList import Node # with buffer def removeDuplicates(ll): prev = None items = [] if ll.head: temp ...
StarcoderdataPython
10611
<reponame>VulturARG/charla_01<filename>codigo/hexagonal/app/adapter/light_bulb_repository.py from codigo.hexagonal.app.domain.switchable_repository import Switchable class LightBulb(Switchable): def turn_on(self) -> bool: print("Connecting with the device...") print("The light is on") retu...
StarcoderdataPython
133737
<filename>HandwrittenDigitRecognition/digit_predict.py """ # @Time : 2020/9/7 # @Author : <NAME> """ from sklearn.neural_network import MLPClassifier from sklearn.model_selection import train_test_split from sklearn.datasets import load_digits from sklearn.preprocessing import StandardScaler # 减去平均值再除以方差 from sk...
StarcoderdataPython
31092
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- try: import base64 import binascii import codecs import random except ImportError as import_fail: print(f"Import error: {import_fail}") print("Please install this module.") raise SystemExit(1) class utils(object): def enc...
StarcoderdataPython
3398410
<gh_stars>0 from django.contrib.auth.models import AbstractUser from django.db.models import CharField, DateField from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from django_countries.fields import CountryField class User(AbstractUser): # First Name and Last Name do not co...
StarcoderdataPython
7918
<filename>euler/py/project_019.py # https://projecteuler.net/problem=19 def is_leap(year): if year%4 != 0: return False if year%100 == 0 and year%400 != 0: return False return True def year_days(year): if is_leap(year): return 366 return 365 def month_days(month, year): ...
StarcoderdataPython
7586
# Generated by Django 3.1.5 on 2021-02-17 11:04 from django.db import migrations import saleor.core.db.fields import saleor.core.utils.editorjs def update_empty_description_field(apps, schema_editor): Category = apps.get_model("product", "Category") CategoryTranslation = apps.get_model("product", "CategoryT...
StarcoderdataPython
152228
<filename>egs/aishell/s10/chain/inference.py #!/usr/bin/env python3 # Copyright 2019 Mobvoi AI Lab, Beijing, China (author: <NAME>) # Apache 2.0 import logging import os import sys import math import torch from torch.utils.dlpack import to_dlpack import kaldi from common import load_checkpoint from common import ...
StarcoderdataPython
1636975
<filename>documenter/document/api/__init__.py # coding: utf-8 from document.api.topic import TopicViewSet from document.api.project import ( SimpleProjectListView, ProjectListView, ProjectDetailView ) from document.api.chapter import ChapterListView, ChapterDetailView __all__ = [ 'TopicViewSet', 'SimpleP...
StarcoderdataPython
4829494
<reponame>snazari/Pyto """ Classes from the 'MaterialKit' framework. """ try: from rubicon.objc import ObjCClass except ValueError: def ObjCClass(name): return None def _Class(name): try: return ObjCClass(name) except NameError: return None MTVisualStyling = _Class("MTVisua...
StarcoderdataPython
1673242
<filename>pacote-download/Aula19.py<gh_stars>0 pessoas = {'nome' : 'Gustavo','sexo' : 'M','idade' : 22} print(pessoas.items()) for k in pessoas.keys(): print(k) for v in pessoas.values(): print(v) for k,v in pessoas.items(): print(f'{k} = {v}') del pessoas['sexo'] print(pessoas) pessoas['nome'] = 'Lean...
StarcoderdataPython
1770075
from os.path import dirname, realpath, join from pathlib import Path class Config: BASE_DIR = Path(realpath(join(dirname(realpath(__file__)), ".."))) DATA_DIR = Path(join(BASE_DIR, "data")) RUNS_DIR = Path(join(BASE_DIR, "runs")) GLOVE_DIR = Path(join(DATA_DIR, "glove.6b")) GLOVE_FILE = Path(join(G...
StarcoderdataPython
3346849
volume = 20 * floz volume_floz = volume / floz volume_l = volume / liter
StarcoderdataPython
14093
#!/usr/bin/env python # -*- coding: utf-8 -*- """temp_convert.py: Convert temperature F to C.""" # initialize looping variable, assume yes as first answer continueYN = "Y" while continueYN.upper() == "Y": # get temperature input from the user, and prompt them for what we expect degF = int(raw_input("Enter te...
StarcoderdataPython
3362441
import itertools import numpy as np from progressbar import progressbar import torch import torch.nn.functional as f import torch.optim as optim from core.co_evaluate import CoEvaluate from module.torch import metrics from module.torch.logger import Logger import params class CoAdapt(CoEvaluate): def __init__(...
StarcoderdataPython
4810350
<filename>logger.py """ This file implements the logging manager that is used to create / print logs throughout all the program """ import logging from enum import Enum class LoggingLevel(Enum): DEBUG = 10 INFO = 20 WARNING = 30 ERROR = 40 class Logger: _instance = None _LOG = None def...
StarcoderdataPython
1621093
<reponame>james-flynn-ie/covid-bot<gh_stars>1-10 ## Adapted on 14-March-2021 from: https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/python/11.qnamaker # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from botbuilder.ai.qna import QnAMaker, QnAMakerEndpoint...
StarcoderdataPython
1688307
from rest_framework.routers import APIRootView from devices.filters import PlatformFilterSet from devices.models import Platform from peering_manager.api.views import ModelViewSet from .serializers import PlatformSerializer class DevicesRootView(APIRootView): def get_view_name(self): return "Devices" ...
StarcoderdataPython
134692
import file_helper import shutil import os import re import yaml import json # # The `specification` folder in the azure-rest-api-specs repo contains the folder hierarchy for the swagger specs # # specification # |-service1 (e.g. `cdn` or `compute`) # | |-common # | |-quickstart-tem...
StarcoderdataPython
3348179
def decompress(data_in, destlen): positions = [0] * 256 cpage_out = bytearray([0] * destlen) outpos = 0 pos = 0 while outpos < destlen: value = data_in[pos] pos += 1 cpage_out[outpos] = value outpos += 1 repeat = data_in[pos] pos += 1 backoffs...
StarcoderdataPython
3334982
import json from functions.objects import userObject import discord from lib.bot import bot class bank(): def __init__(self, client : bot, guildid, memberID): self.user = None self.member = memberID self.client = client if str(memberID) in client.users_: self.user = ...
StarcoderdataPython
87221
<filename>verification/verify_results.py<gh_stars>0 """Documentation for verify_results.py This script processes class data in order to calculate accuracy, sensitivity etc. on the overall class. This should match results given in our report. The script prints these values out to screen. """ import os import sys ...
StarcoderdataPython
3328590
# coding: utf-8 from __future__ import annotations from datetime import date, datetime # noqa: F401 import re # noqa: F401 from typing import Any, Dict, List, Optional # noqa: F401 from pydantic import AnyUrl, BaseModel, EmailStr, validator # noqa: F401 from acapy_wrapper.models.indy_non_revoc_proof import IndyN...
StarcoderdataPython
16710
<reponame>kinghuang/sentry # -*- coding: utf-8 -*- from __future__ import absolute_import import six from sentry.api.serializers import serialize from sentry.api.serializers.models.alert_rule import DetailedAlertRuleSerializer from sentry.incidents.logic import create_alert_rule, create_alert_rule_trigger from sentr...
StarcoderdataPython
3209197
<reponame>akuala/REPO.KUALA #coding: utf-8 #Vstream https://github.com/Kodi-vStream/venom-xbmc-addons from resources.lib.handler.requestHandler import cRequestHandler from resources.lib.parser import cParser from resources.hosters.hoster import iHoster # from resources.lib.aadecode import AADecoder from resources.lib.j...
StarcoderdataPython
3377067
from django.shortcuts import render from .author import AuthorListView, AuthorDetailView from .models import Post class PostListView(AuthorListView): queryset = Post.objects.active_posts() template_name = "posts/post_list.html" class PostDetailView(AuthorDetailView): queryset = Post.objects.activ...
StarcoderdataPython
4856
# coding: utf-8 # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c...
StarcoderdataPython
4807978
import sys, os import params #This sets the path in our computer to where the eyetracker stuff is located #sys.path.append('/Users/Preetpal/desktop/ubc_4/experimenter_platform/modules') #sys.path.append('E\\Users\\admin\\Desktop\\experimenter_platform\\modules') sys.path.append(os.path.join(sys.path[0],'Modules')) sys...
StarcoderdataPython
3241039
#!/usr/bin/env python """ A simple script that copies all the cubes and everything into the right places This has not been well set up to work universally. It's only been tested on one setup """ import os, shutil from TAP_Setup import setup TAPViewerDir = os.path.join(setup.RootDir, setup.TAPViewerPath) #Check if ...
StarcoderdataPython
3360778
<reponame>bcgov/foi-reporting """dimRequesterTypes Revision ID: ee51cc25ee98 Revises: Create Date: 2022-01-26 17:07:24.717227 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'ee51cc25ee98' down_revision = '<PASSWORD>' branch_labels = None depends_on = None d...
StarcoderdataPython
3293439
# test basic capability to start a new thread # # MIT license; Copyright (c) 2016 <NAME> on behalf of Pycom Ltd try: import utime as time except ImportError: import time import _thread def foo(): pass def thread_entry(n): for i in range(n): foo() _thread.start_new_thread(thread_entry, (10,))...
StarcoderdataPython
1649331
from django.urls import path from twitter import views urlpatterns = [ path('', views.SampleView.as_view(), name="sample_view"), ]
StarcoderdataPython
3230057
from conans.model.conan_file import ConanFile from conans import CMake import os #This easily allows to copy the package in other user or channel channel = os.getenv("CONAN_CHANNEL", "testing") username = os.getenv("CONAN_USERNAME", "sunside") class DefaultNameConan(ConanFile): name = "DefaultName" version = ...
StarcoderdataPython
57950
import pandas as pd import scipy.io import os filenames = [] for filename in os.listdir('.'): if '.mat' in filename: filenames.append(filename) for filename in filenames: print(f'Processing file: {filename}') mat = scipy.io.loadmat(filename) headings = [ 'Timestamp', '...
StarcoderdataPython
1766192
# Copyright (c) 2004-2011 Simplistix Ltd # Copyright (c) 2001-2003 New Information Paradigms Ltd # # This Software is released under the MIT License: # http://www.opensource.org/licenses/mit-license.html # See license.txt for more details. from MailingLogger import MailingLogger from SummarisingLogger import S...
StarcoderdataPython
3201678
<filename>endGame.py<gh_stars>0 #Import required Modules: import sys import pygame import constants from screenState import ScreenState #This function is designed to generate the game's end screen def show(screenState: ScreenState): end_game = True while end_game: #Event lis...
StarcoderdataPython
1619334
#!/usr/bin/env python # coding: utf-8 # ## TH_EventReader # # This code will load TH events using cmlreaders and then find the missing path data using the log files. import os import warnings import numpy as np import pandas as pd from matplotlib import pyplot as plt from cmlreaders import CMLReader, get_data_index ...
StarcoderdataPython
3368732
from pathlib import Path from typing import Tuple, Union import numpy as np import pytest from _utils import CONFIG_FILE from pydantic import BaseModel import btrack def _random_config() -> dict: rng = np.random.default_rng(seed=1234) return { "max_search_radius": rng.uniform(1, 100), "updat...
StarcoderdataPython
18255
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ Topic: 处理html和xml文本 Desc : """ import html def html_xml(): s = 'Elements are written as "<tag>text</tag>".' print(s) print(html.escape(s)) # Disable escaping of quotes print(html.escape(s, quote=False)) s = 'Spicy Jalapeño' print(s.enc...
StarcoderdataPython
4814444
# Desenvolva um programa que leia o primeiro termo e a razão de uma PA. No final, mostre os 10 primeiros termos dessa progressão. print('=' * 30) print('{:>5}'.format('10 TERMOS DE UMA P.A.')) print('=' * 30) termo = int(input('Primeiro termo: ')) razao = int(input('Razão: ')) decimo = termo + (11 - 1) * razao for c...
StarcoderdataPython
1649797
<reponame>IBPA/CowMetritis # standard imports import logging as log import os # third party imports import numpy as np import missingno as msno import matplotlib.pyplot as plt from pandas.plotting import scatter_matrix from sklearn.metrics import roc_curve, precision_recall_curve, average_precision_score, roc_auc_scor...
StarcoderdataPython
25863
#!/usr/bin/python import sys import csv def mapper(): reader = csv.reader(sys.stdin, delimiter='\t') writer = csv.writer(sys.stdout, delimiter='\t') tagFrequency = {} for line in reader: nodeType = line[5] if not nodeType == "question": continue tags...
StarcoderdataPython