id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
1600691 | import re
class MagCard(object):
track_1 = r"\B(\d+?)\^([^\^]+?)\^(.{4})"
def __init__(self, data):
self._info = {
"PAN": None,
"First": None,
"Last": None,
"Expiration": None
}
self._data = ""
self.data = data
@property
def data(self):
return self._info
@data.setter
def data(self, text... | StarcoderdataPython |
79922 | <filename>tf_semseg/model/esanet.py
import tensorflow as tf
from .util import *
from . import resnet, erfnet, pspnet, config, senet, shortcut
def stem(rgb, depth, se_reduction=16, name=None, config=config.Config()):
def resnet_stem_b_no_pool(x, name):
x = conv_norm_act(x, filters=64, kernel_size=7, s... | StarcoderdataPython |
227020 | <reponame>best-coloc-ever/globibot
from .plugin import UrbanDictionary
plugin_cls = UrbanDictionary
| StarcoderdataPython |
3383381 | from flake8_alphabetize.core import Alphabetize
from ._version import get_versions
__version__ = get_versions()["version"]
del get_versions
Alphabetize.version = __version__
__all__ = ["Alphabetize", "__version__"]
| StarcoderdataPython |
5148752 | <filename>scripts/pad-script.py
#!C:/local/Python37/python.exe
#
from tkinter import *
import tkinter.ttk as ttk
import serial
E2J = {'"': '@', '&': '^', '\'' : '&', '(' : '*', ')' : '(',
'=' : '_', '^' : '=', '~' : '+', '@' : '[', '`' : '{' , '[' : ']' , '{' : '}',
'+' : ':', ':' : '\'', '*' : '"', ']' ... | StarcoderdataPython |
6641616 | import sys
import os.path
sys.path.append(os.path.abspath(os.pardir))
import disaggregator as da
import unittest
class ApplianceTypeTestCase(unittest.TestCase):
def setUp(self):
pass
def test_(self):
pass
if __name__ == "__main__":
unittest.main()
| StarcoderdataPython |
6422734 | <reponame>SmilingHeretic/ethernaut-solutions-brownie
from brownie import (
network,
accounts,
config,
interface,
Contract,
)
from scripts.helpful_scripts import (
get_account,
get_new_instance,
submit_instance,
)
from web3 import Web3
def main():
player = get_account()
instance... | StarcoderdataPython |
4804205 | #!/usr/bin/python
# -*- encoding: utf-8 -*-
from secretpy import SimpleSubstitution, CryptMachine, alphabets as al
from secretpy.cmdecorators import Block, SaveAll
cipher = SimpleSubstitution()
alphabet = al.GERMAN
plaintext = u"schweißgequältvomödentextzürnttypografjakob"
key = u"<KEY>"
print(plaintext)
enc = ciph... | StarcoderdataPython |
5178789 | from .pvserver import pvserver_connect
from .post import get_csv_data
from .post import get_case_parameters
from .post import get_case_parameters_str
from .post import print_html_parameters
from .post import get_case_root, get_case_report
from .post import get_fw_csv_data
from .post import for_each
from .post impo... | StarcoderdataPython |
8152520 | <reponame>mitpokerbots/scrimmage<filename>migrations/versions/4b3121fe5023_.py
"""Add more values to enum
Revision ID: <KEY>
Revises: <KEY>
Create Date: 2019-01-21 19:42:37.230599
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
r... | StarcoderdataPython |
11273306 | <filename>finappservice/migrations/0019_currency.py<gh_stars>0
# Generated by Django 3.1.4 on 2021-04-21 13:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('finappservice', '0018_internaltransacthistory_date_created'),
]
operations = [
... | StarcoderdataPython |
1723143 | <reponame>j4ckstraw/pybrowscap<filename>pybrowscap/test/loader/csv/test_loader.py
import unittest
import os
from datetime import datetime
from pybrowscap.loader.csv import load_file
from pybrowscap.loader import Browscap, TYPE_CSV
class LoaderTest(unittest.TestCase):
browscap_file1 = os.path.join(os.path.dirnam... | StarcoderdataPython |
3391918 | <gh_stars>0
"""
Implements the Nelder-Mead algorithm for maximizing a function with one or more
variables.
test changes
"""
import numpy as np
from numba import njit
from collections import namedtuple
results = namedtuple('results', 'x fun success nit final_simplex')
@njit
def nelder_mead(fun, x0, bounds=np.array... | StarcoderdataPython |
1960377 | class DificilJogadas:
def __init__(self, ambiente, entrada, dificilSensores,
getJogadorUmPeca, simboloCampoVazio):
self.IAmbiente = ambiente
self.IEntrada = entrada
self.IDificilSensores = dificilSensores
self.IGetJogadorUmPeca = getJogadorUmPeca
self.ISimbol... | StarcoderdataPython |
8083244 | import hashlib
import json
import logging
import os
import numpy as np
from ecdsa import VerifyingKey, SECP256k1
from abc import ABC, abstractmethod
from datetime import datetime
from sklearn.cluster import KMeans
from .merkle_tree import MerkleTree
from db.mapper import Mapper
class Serializable(ABC):
... | StarcoderdataPython |
6450597 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Decompose 0/1 loss into bias variance using meny learning methods in classification
Reference
http://www-bcf.usc.edu/~gareth/research/bv.pdf
"""
import os
import numpy as np
from sklearn.utils import resample
from sklearn.grid_search import GridSearchCV
from sklearn.m... | StarcoderdataPython |
9621984 | <gh_stars>0
#
# Copyright (C) 2016 The Android Open Source Project
#
# 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 a... | StarcoderdataPython |
384538 | #!/usr/bin/python2
import rospy as rp
import rospkg
import yaml
import math
from upo_msgs.msg import PersonPoseUPO
from upo_msgs.msg import PersonPoseArrayUPO
#from hri_feedback_msgs.msg import HRIFeedbackFromInterface
from upo_decision_making.msg import ControlEvent, IDArray, HRIFeedbackFromInterface
class EventPubl... | StarcoderdataPython |
4979869 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import time
import requests
import ui
# check data every 10 minutes
SLEEP = 10 * 60
URL = 'http://api.waqi.info/feed/shanghai/us-consulate/?token=' + os.getenv('AQI_TOKEN', '<PASSWORD>')
def main():
# wait until network is ready
... | StarcoderdataPython |
5147936 | <filename>predict.py
from __future__ import print_function
import argparse
import skimage
import skimage.io
import skimage.transform
from PIL import Image
from tqdm import tqdm
import os
import torch
import torch.nn.parallel
import torch.distributed as dist
from torch.autograd import Variable
import numpy as np
import ... | StarcoderdataPython |
8067307 | <reponame>sbonner0/temporal-offset-reconstruction<filename>src/models/GAE.py<gh_stars>1-10
from __future__ import print_function
from __future__ import division
import torch
import torch.nn as nn
import torch.nn.functional as F
from .layers import GraphConvolution
class GAE(nn.Module):
"""Graph Auto Encoder (see... | StarcoderdataPython |
315955 | from dropbeat.models import User
from django.contrib.auth import SESSION_KEY
from django.core.exceptions import ObjectDoesNotExist
def auth_required(f):
def wrap(self, request, *args, **kwargs):
if SESSION_KEY not in request.session:
# Malformed session detected.
return self.on_un... | StarcoderdataPython |
3274227 | <filename>src/data/build_data.py
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 1 19:00:55 2018
@author: sandr
"""
import numpy as np
import pandas as pd
import get_raw_data as grd
import logging
import os
from dotenv import find_dotenv, load_dotenv
import data_classes
import balanced_data_classes
import Normalizer
i... | StarcoderdataPython |
5011661 | # -*- coding: utf-8 -*-
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
import libscanbuild.clang as sut
from . import fixtures
import os.path
class GetClangArgumentsTest(fixtures.TestCase):
d... | StarcoderdataPython |
4836341 | <reponame>wilsaj/flask-admin-old
# -*- coding: utf-8 -*-
"""
flask.ext.datastore.mongoalchemy
~~~~~~~~~~~~~~
:copyright: (c) 2011 by wilsaj.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import types
import mongoalchemy as ma
from mongoalchemy.document impor... | StarcoderdataPython |
6536980 | <reponame>korenlev/calipso-cvim<gh_stars>0
###############################################################################
# Copyright (c) 2017-2020 <NAME> (Cisco Systems), #
# <NAME> (Cisco Systems), <NAME> (Cisco Systems) and others #
# ... | StarcoderdataPython |
4895065 | <reponame>penguinnnnn/HKJCData
import random
import numpy as np
import matplotlib.pyplot as plt
fix_bet = 10
with open('data/odds.txt') as f:
odds_data = f.read().splitlines()
X = [[float(i) for i in d.split('\t')[0].split()] for d in odds_data]
Y = [int(d.split('\t')[1]) for d in odds_data]
plt.style.use('ggp... | StarcoderdataPython |
11207115 | <reponame>mineo/beets<gh_stars>0
# This file is part of beets.
# Copyright 2012, <NAME>.
#
# 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 limitation ... | StarcoderdataPython |
279112 | # -*- coding: utf-8 -*-
import collections
c = collections.Counter('extremely')
c['z'] = 0
print(c)
print(list(c.elements()))
| StarcoderdataPython |
8121754 | <filename>apim-migration-testing-tool/Python/ApiMangerConfigUtil/remove_files.py
import os
from properties import *
def remove_tenant_loaderJar():
if not os.remove('%s/wso2am-%s/repository/components/dropins/tenantloader-1.0.jar' % (APIM_HOME_PATH, NEW_VERSION)):
print("Successfully removed tenantloader-1.... | StarcoderdataPython |
6666560 | # -*- coding: utf-8 -*-
def write(text=' '):
import datetime, os
time = datetime.datetime.today()
path = "./log/new/" + time.strftime("%Y//%m//%d")
if not os.path.exists(path):
os.makedirs(path)
f = open(time.strftime("./log/new/%Y/%m/%d/%H:%M.log"), 'a')
f.write(text)
f.close()
def ... | StarcoderdataPython |
4954225 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
''' IMPORTS '''
from requests import HTTPError
from typing import Dict, Any
from json.decoder import JSONDecodeError
import json
import traceback
import requests
import math
# Disable insecure warnings
requests.packag... | StarcoderdataPython |
1779314 | """
String generation functions.
"""
import binascii
import hashlib
import os
import random
import string
def generate_password(length=20):
"""
Generate random password of the given ``length``.
Beware that the string will be generate as random data from urandom,
and returned as headecimal string of ... | StarcoderdataPython |
5102950 | import ast
import macropy.core.macros
from macropy.core.hquotes import macros, hq, unhygienic
from macropy.core import Captured
macros = macropy.core.macros.Macros()
value = 2
def double(x):
return x * value
@macros.expr
def expand(tree, gen_sym, **kw):
tree = hq[str(value) + "x: " + double(ast_literal[tre... | StarcoderdataPython |
4856117 | <gh_stars>0
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from django.core.exceptions import ValidationError
from django.test import TestCase
from django.utils import six
from django.utils.functional import lazy
from fancy_cronfield.fields import CronField
from fancy_cronfield.utils.compat import DJANGO_1_6, DJAN... | StarcoderdataPython |
311184 | # Please setup this dependent package 'https://github.com/BorealisAI/advertorch'
import torch.nn as nn
from advertorch.attacks import LinfPGDAttack, FABAttack, LinfFABAttack
from advertorch.attacks.utils import multiple_mini_batch_attack
from advertorch_examples.utils import get_cifar10_test_loader
from models... | StarcoderdataPython |
3460592 | <gh_stars>0
"""
Django settings for backend project.
Generated by 'django-admin startproject' using Django 3.2.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""
... | StarcoderdataPython |
3486347 | <reponame>DeuroIO/Deuro-scikit-learn
"""
=====================================================
Prediction Intervals for Gradient Boosting Regression
=====================================================
This example shows how quantile regression can be used
to create prediction intervals.
"""
import numpy as np
impor... | StarcoderdataPython |
4932256 | # -*- coding: utf-8 -*-
# 模式-设备数据
# 作者: 三石
# 时间: 2022-01-21
from pydantic import BaseModel, conint
class SchemaUpdateCurrent(BaseModel):
"""模式-更新当前数据"""
# 地址
address: conint(ge=0, le=9999)
# 最新值
value: conint(ge=0, le=99)
| StarcoderdataPython |
3556362 | <reponame>c-yan/atcoder
# Union Find 木
from sys import setrecursionlimit
def find(parent, i):
t = parent[i]
if t < 0:
return i
t = find(parent, t)
parent[i] = t
return t
def unite(parent, i, j):
i = find(parent, i)
j = find(parent, j)
if i == j:
return
parent[j] +... | StarcoderdataPython |
9670438 | import sys
def main():
try:
from src.run import run
run()
except Exception:
sys.exit(1)
return
if __name__ == "__main__":
main()
| StarcoderdataPython |
3208124 | print('niahi')
print('niahi') | StarcoderdataPython |
1896438 | """`Thompson2003Model`, `Thompson2003Spatial` [Thompson2003]_"""
import numpy as np
import copy
from ..utils import Curcio1990Map, sample
from ..models import Model, SpatialModel
from ._thompson2003 import fast_thompson2003
# Log all warnings.warn() at the WARNING level:
import warnings
import logging
logging.capture... | StarcoderdataPython |
377949 | <reponame>QiangZiBro/stacked_capsule_autoencoders.pytorch
# -*- coding: UTF-8 -*-
"""
@Project -> File :cnn_models_comparation.pytorch -> __init__
@IDE :PyCharm
@Author :QiangZiBro
@Date :2020/5/23 12:56 下午
@Desc : use factory method to add model,loss,Metrics,Optimizer
"""
import torch
import model.models as m... | StarcoderdataPython |
11360692 | class ApiResponseMessage:
# Patient
PATIENT_NOT_IMPLEMENT = 'Patient {method} method is not support on this site.'
PATIENT_EXECUTED = 'Patient has been executed.'
PATIENT_IMAGE_EXECUTED = 'Patient image has been executed.'
PATIENT_IMAGE_NOT_IMPLEMENT = 'Patient image {method} method is not support... | StarcoderdataPython |
3232785 | <reponame>fcnjd/soundrts
import threading
import time
import pygame
from pygame.locals import KEYDOWN
from soundrts.lib.message import Message
from soundrts.lib.sound import DEFAULT_VOLUME
from soundrts.lib.voicechannel import VoiceChannel
class _Voice(object):
msgs = [] # said and unsaid messages
acti... | StarcoderdataPython |
9615770 | '''
Create a AlexNet-Style network.
Exact network parameters are from (for sake of comparision): https://arxiv.org/abs/1801.01423
author: <NAME>
'''
import tensorflow as tf
from tensorflow.keras import layers as lyrs
conv_params = {
"padding": "same",
#"kernel_initializer": tf.keras.initializers.glor... | StarcoderdataPython |
6566894 | # (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
import pymysql
import pytest
from datadog_checks.dev import WaitFor, docker_run
from . import common, tags
MYSQL_FLAVOR = os.getenv('MYSQL_FLAVOR')
MYSQL_VERSION = os.getenv('MYSQL_VERSION')
COMPOSE_... | StarcoderdataPython |
3584250 | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 3 08:48:50 2020
@author: ebuit
Inspired in examples taken from:
https://dash.plotly.com/dash-core-components/input
https://stackoverflow.com/questions/51407191/python-dash-get-value-from-input-text
https://github.com/AdamSpannbauer/app_rasa_chat_bot/b... | StarcoderdataPython |
5070422 | <filename>webqq/views.py
from django.shortcuts import render
from django.shortcuts import HttpResponse
import json
import datetime
from webqq import utils
from bbs import models
# Create your views here.
global_msg_dic = {}
def dashboard(request):
return render(request, 'webqq/dashboard.html', locals())
def ... | StarcoderdataPython |
3421696 | import pytest
import redriver
from mock import call
@pytest.fixture
def mock_sqs_helper(mocker):
mocker.patch.object(redriver, 'sqs_helper')
return redriver.sqs_helper
def test_missing_dlq_url():
with pytest.raises(ValueError):
redriver.redrive({'MaxMessageCount': 10}, None)
def test_missing_ma... | StarcoderdataPython |
3277528 | <filename>gplay_apk_download_multidex/apk_multidex.py
#!/usr/bin/env python3
import subprocess
import os
APKANALYZER = "/Users/amitseal/Android/Sdk/tools/bin/apkanalyzer"
APKANALYZER_COMMAND = "{} dex list {}"
def is_multidex(apk_path: str):
global APKANALYZER
global APKANALYZER_COMMAND
# command = shl... | StarcoderdataPython |
391809 | <filename>app/models/base.py
from app import db
class Base(db.Model):
__tablename__ = 'base_tbl'
id = db.Column(db.Integer, primary_key=True)
type = db.Column(db.String(), nullable=False)
__mapper_args__ = {'polymorphic_on': type}
def __init__(self):
pass
def __repr__(self):
return '<>'
| StarcoderdataPython |
6492647 | # 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 agreed to in writing, ... | StarcoderdataPython |
3335893 |
class DatabaseResource(object):
def __init__(self, conn):
self.conn = conn
def resource_list_only(self):
c = self.conn.cursor()
c.execute("""
SELECT DISTINCT RS.id, RS.url, RS.url_blacklisted, RS.is_truncated, RS.is_external
FROM devtools_request AS RQ
... | StarcoderdataPython |
3527265 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('cms', '0013_urlconfrevision'),
]
operations = [
migrations.CreateModel(
name='Birt... | StarcoderdataPython |
9734081 | import logging
from datetime import timedelta
from enum import Enum
import celery
from celery import Celery
from celery.apps.beat import Beat
from celery.apps.worker import Worker
from celery.schedules import crontab
from spaceone.core import config
DEFAULT_SPACEONE_BEAT = 'spaceone.core.celery.schedulers.SpaceOneSc... | StarcoderdataPython |
6493572 | <reponame>abhinavDhulipala/SAM-URL
from flask import Flask, render_template, redirect, request, jsonify, url_for, flash
import secrets
import boto_utils
from local_constants import DEPLOYED_GATEWAY
import requests
from urllib3.exceptions import HTTPError
from requests.exceptions import RequestException
app = Flask(__n... | StarcoderdataPython |
11331080 | """Main entry points to tentaclio-io."""
from typing import ContextManager
from tentaclio import protocols
from tentaclio.credentials import authenticate
from .stream_registry import STREAM_HANDLER_REGISTRY
__all__ = ["open"]
VALID_MODES = ("", "rb", "wb", "rt", "wt", "r", "w", "b", "t")
def open(url: str, mode:... | StarcoderdataPython |
4829482 | '''
Instance of a standard Python type does not have a '__dict__'.
Instance of the subclass of that type has '__dict__'.
object().__dict__ # -> AttributeError
class MyObject(object): pass
MyObject().__dict__
'''
import builtins
import sys
# === Not tested ===
# cell
# TextFile
# === Basic ===
# object
try:
o... | StarcoderdataPython |
1781419 | <gh_stars>1-10
# this file is to merge the jupyter notebooks into one.
# source: https://towardsdatascience.com/how-to-easily-merge-multiple-jupyter-notebooks-into-one-e464a22d2dc4
import json
import copy
# functions
def read_ipynb(notebook_path):
with open(notebook_path, 'r', encoding='utf-8') as f:
ret... | StarcoderdataPython |
3378210 | <reponame>LucasRouckhout/microCTImageAnalyser<gh_stars>1-10
#!/usr/bin/env python3
import sys
def ask():
reply = input(">> ")
if reply == 'quit':
sys.exit()
return reply
| StarcoderdataPython |
8079922 | <reponame>PlasticMem/tencentcloud-sdk-python<filename>tencentcloud/mgobe/v20201014/errorcodes.py
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | StarcoderdataPython |
151314 | <reponame>rodelrebucas/dev-overload-starterpack
"""
Time complexity O(n)
"""
# Search for maximum number
l = [2, 4, 5, 1, 80, 5, 99]
maximum = l[0]
for item in l:
if item > maximum:
maximum = item
print(maximum)
| StarcoderdataPython |
3397713 | import bpy
from sklearn.cluster import DBSCAN, OPTICS
bl_info = {
"name": "Clustering",
"author": "<NAME>, <NAME> (Wakeone)",
"version": (0, 1),
"blender": (2, 80, 0),
"description": "Runs a clustering algorithm on the selected objects.",
"category": "Object",
}
clustering_algorithm = [
'D... | StarcoderdataPython |
199700 | <reponame>Chrispresso/PyGenoCar
from Box2D import *
from settings import get_boxcar_constant
class Wheel(object):
def __init__(self, world: b2World, radius: float, density: float, restitution: float = 0.2):
self.radius = radius
self.density = density
# self.motor_speed = motor_speed ... | StarcoderdataPython |
5033711 | """Defines the anvil logging module.
"""
__author__ = '<EMAIL>'
from anvil import enums
from anvil import util
class WorkUnit(object):
"""A class used to keep track of work progress.
The WorkUnit class uses total and complete metrics to keep track of work
completed. WorkUnits can be chained in parent-child r... | StarcoderdataPython |
11398527 | <filename>JellyBot/api/responses/ar/__init__.py
from .add import AutoReplyAddResponse, AutoReplyAddExecodeResponse
from .validate import ContentValidationResponse
from .tag import AutoReplyTagPopularityResponse
| StarcoderdataPython |
8197846 | <gh_stars>0
import lxml.objectify
import lxml.etree
from flexi.xml import serializer_registry
def xml_element_injector(element):
def wrapper(cls):
serializer_registry.xml_serializers.append(cls)
cls.xml_element = element
return cls
return wrapper
# Class decorators
def xml_element... | StarcoderdataPython |
5031109 | <filename>tests/test_integration_workflows.py
# Copyright 2020 MONAI Consortium
# 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 |
323187 | # Copyright 2017: Orange
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | StarcoderdataPython |
6698586 | <gh_stars>1-10
import discord
from discord.ext import commands
from discord import app_commands
from discord.app_commands import Choice, choices, Group, checks
import aiohttp
class webhook(commands.Cog, name="webhook", description="Manage the servers webhooks"):
def __init__(self, client):
self.client = cl... | StarcoderdataPython |
11212726 | """
Mako based Configuration Generator
"""
import logging
import re
from mako.exceptions import CompileException, SyntaxException
from mako.template import Template
logger = logging.getLogger("confgen")
class TemplateSyntaxException(BaseException):
"""
This exception is raised, if the rendering of the mako ... | StarcoderdataPython |
4884764 | <gh_stars>100-1000
from textbox.evaluator.base_evaluator import *
| StarcoderdataPython |
4833528 | __all__ = ('VERSION',)
VERSION = '0.3'
| StarcoderdataPython |
11274431 | <reponame>KonikaChaurasiya-GSLab/j2lint
"""statement.py - Class and variables for jinja statements.
"""
import re
JINJA_STATEMENT_TAG_NAMES = [
('for', 'else', 'endfor'),
('if', 'elif', 'else', 'endif'),
]
class JinjaStatement:
"""Class for representing a jinja statement.
"""
begin = None
words... | StarcoderdataPython |
9668500 | <filename>core/migrations/0003_pontoturistico_attraction_list.py
# Generated by Django 2.2.5 on 2019-09-14 22:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('attractions', '0001_initial'),
('core', '0002_auto_20190914_2202'),
]
opera... | StarcoderdataPython |
5173508 | <filename>project_2/launch/bringup_thebot.launch.py
from ament_index_python.packages import get_package_share_path
import launch
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from launch_ros.parameter_descriptions import ParameterValue
from launch_ros.actions import Node
from launch.substit... | StarcoderdataPython |
1849428 | import numpy as np
from scipy import interpolate
##
# filter a list given indices
# @param alist a list
# @param indices indices in that list to select
def filter(alist, indices):
rlist = []
for i in indices:
rlist.append(alist[i])
return rlist
##
# Given a list of 1d time arrays, find the seq... | StarcoderdataPython |
9798149 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from numpy.testing import assert_array_equal
from sktracker.tracker.lapjv import lapjv
def test_lapjv():
i = [0, 0, 0, 0, 0, 0, 1, 1, ... | StarcoderdataPython |
3344141 | import warnings
from .common import Alignment, CursorMode, ShiftMode, BacklightMode
from .contextmanagers import cursor, cleared
from .gpio import CharLCD as GpioCharLCD
class CharLCD(GpioCharLCD):
def __init__(self, *args, **kwargs):
warnings.warn("Using RPLCD.CharLCD directly is deprecated. " +
... | StarcoderdataPython |
3424238 | """Grad-CAM class for analyzing CNN network.
- Author: <NAME>
- Contact: <EMAIL>
- Paper: https://arxiv.org/pdf/1610.02391v1.pdf
- Reference: https://github.com/RRoundTable/XAI
"""
from collections import OrderedDict
from typing import Callable
import numpy as np
import torch
import torch.nn as nn
from torch.nn impo... | StarcoderdataPython |
9753871 | import pytest
from src.decko.debug import (
raise_error_if,
)
@pytest.mark.parametrize("test_case", [
(2, 5, 5),
(200, 500, 600)
])
def test_raise_errors_if(test_case):
first_num, second_num, threshold_value = test_case
def sum_greater_than_threshold(total_sum):
return threshold_value < t... | StarcoderdataPython |
321453 | """Class to perform over-sampling using ADASYN."""
# Authors: <NAME> <<EMAIL>>
# <NAME>
# License: MIT
import numpy as np
from scipy import sparse
from sklearn.utils import check_random_state
from sklearn.utils import _safe_indexing
from imblearn.over_sampling.base import BaseOverSampler
from imblearn.util... | StarcoderdataPython |
1605281 | <filename>src/server/import/parser/docInfo.py
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 5 14:39:35 2015
@author: smichel
"""
def get(soup, docType=None):
other = False
# CFR criteria
if docType == "cfr" or soup.find("cfrdoc"):
docType = "cfr"
docNumTag = "titlenum"#soup.find("title... | StarcoderdataPython |
3468125 | <reponame>elfido/node-java-c
{
"targets":[
{
"target_name": "fibo",
"sources": ["fib.cc"]
}
]
}
| StarcoderdataPython |
3419176 | <filename>src/plotly.py<gh_stars>0
from dfply import *
import warnings
import numpy as np
import plotly.offline as offline
from plotly.graph_objs import Scatter, Annotation, Heatmap, Trace, Bar
import cufflinks as cf
def init():
#offline.init_notebook_mode()
cf.set_config_file(offline=True, offline_show_link=... | StarcoderdataPython |
1870366 | <filename>bot/plugins/gdrive.py<gh_stars>0
import asyncio
import base64
import json
import re
from datetime import datetime, timedelta
from typing import Any, AsyncIterator, ClassVar, Iterable, List, MutableMapping, Optional, Set, Tuple, Union
import pyrogram
from aiopath import AsyncPath
from google.auth.transport.re... | StarcoderdataPython |
11314896 | """ Rabbitai utilities for pandas.DataFrame.
"""
import warnings
from typing import Any, Dict, List
import pandas as pd
from rabbitai.utils.core import JS_MAX_INTEGER
def _convert_big_integers(val: Any) -> Any:
"""
Cast integers larger than ``JS_MAX_INTEGER`` to strings.
:param val: the value to proces... | StarcoderdataPython |
3214942 | <reponame>Zeref-Draganeel/hata<filename>hata/discord/events/handling_helpers.py
__all__ = ('EventHandlerBase', 'EventWaitforBase', 'eventlist', )
import sys
from functools import partial as partial_func
from ...backend.utils import FunctionType, RemovedDescriptor, MethodLike, WeakKeyDictionary, NEEDS_DUMMY_INIT
from ... | StarcoderdataPython |
3259483 | <reponame>Sky-zzt/lintcodePractice
class Solution:
"""
@param triangle: a list of lists of integers
@return: An integer, minimum path sum
"""
import sys
best = sys.maxsize
def minimumTotal(self, triangle):
# write your code here
import sys
best = sys.maxsize
... | StarcoderdataPython |
8104178 | <reponame>6un9-h0-Dan/mixbox<filename>mixbox/idgen.py
# Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
"""Methods for generating IDs"""
import uuid
import contextlib
from .namespaces import Namespace
EXAMPLE_NAMESPACE = Namespace("http://example.com", "example"... | StarcoderdataPython |
6458604 | <filename>pythonlearn/python_script/lib/pidfile.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pid file manager
"""
import os
import sys
import fcntl
import atexit
def register_pidfile(pidfile):
try:
fd = os.open(pidfile, os.O_RDWR|os.O_CREAT|os.O_NONBLOCK|os.O_DSYNC)
fcntl... | StarcoderdataPython |
84405 | <filename>legal_radar/entrypoints/streamlit_app/__init__.py<gh_stars>0
#!/usr/bin/python3
# __init__.py
# Date: 27.08.2021
# Author: <NAME>
# Email: <EMAIL>
| StarcoderdataPython |
6531231 | <reponame>vishnuyar/supreme-court-data
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_bootstrap_components as dbc
import dash_html_components as html
from datetime import datetime as dt
import plotly.graph_objs as go
from joblib import load
import numpy as np
import pandas a... | StarcoderdataPython |
321781 | import os
from flask import Flask
from flask_appconfig import HerokuConfig
from flask_bootstrap import Bootstrap
from .frontend import frontend
def create_app(configfile=None):
app = Flask(__name__)
HerokuConfig(app, configfile)
Bootstrap(app)
app.register_blueprint(frontend)
app.config['BOOT... | StarcoderdataPython |
3526797 | #
# Copyright (C) 2008 The Android Open Source Project
#
# 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 la... | StarcoderdataPython |
3409959 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 18 12:10:06 2021
@author: philippbst
"""
import os
import numpy as np
def getProjectPaths(pathToProject):
# Set up path structure of the project
cwd = os.getcwd()
pathToProject = pathToProject #cwd [:-4]
pathNames = ['pathToProje... | StarcoderdataPython |
9716817 | <reponame>TomNicholas/xBOUT-1
from pathlib import Path
import re
import pytest
import numpy as np
from xarray import DataArray, Dataset, concat
from xarray.tests.test_dataset import create_test_data
import xarray.testing as xrt
from natsort import natsorted
from xbout.load import _check_filetype, _expand_wildcards... | StarcoderdataPython |
4842107 | import pytest
from app_data.selectors.amazon import NEXT_BUTTON
from helpers import dom
from helpers.amazon import do_search, verify_search_result_summary
URL = {
'link': 'https://www.amazon.com/',
'title': 'Amazon.com: Online Shopping for Electronics, Apparel, Computers, Books, DVDs & more'
}
@pytest.mark.... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.