id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
98790
<reponame>fyndata/lib-cl-sii-python<filename>cl_sii/cte/f29/data_models.py """ CTE Form 29 Data Models ======================= """ from __future__ import annotations import dataclasses import logging from dataclasses import field as dc_field from datetime import date from typing import ( Any, ClassVar, It...
StarcoderdataPython
1650529
<filename>setup.py<gh_stars>1-10 from setuptools import setup, find_packages import codecs import pathlib import re here = pathlib.Path(__file__).parent.resolve() def read(*parts): """ Build an absolute path from *parts* and and return the contents of the resulting file. Assume UTF-8 encoding. """ ...
StarcoderdataPython
4816744
<reponame>nickderobertis/regtools from regtools.differenced import _is_diff_reg_str from regtools.lag.create import varname_to_lagged_varname def _set_regressor_order(regressor_order, reg_kwargs): if isinstance(regressor_order, tuple): regressor_order = list(regressor_order) # processing needed for ...
StarcoderdataPython
118726
<reponame>jtalmi/pre-commit-dbt import pytest from pre_commit_dbt.check_source_has_all_columns import get_catalog_nodes from pre_commit_dbt.check_source_has_all_columns import main # Input schema, valid_catalog, expected return value TESTS = ( ( """ sources: - name: catalog tables: - name: wi...
StarcoderdataPython
4832676
<reponame>Shiqan/daily-coding-problem #!/usr/bin/env python """ Problem 91 daily-coding-problem.com """ import dis original_functions = [] new_functions = [] for i in range(10): original_functions.append(lambda: i) new_functions.append(lambda i=i: i) if __name__ == "__main__": for f in original_function...
StarcoderdataPython
1620626
import re import os import yaml import random import logging import shutil import numpy as np import oneflow as flow import argparse from otrans.model import End2EndModel, LanguageModel from otrans.train.scheduler import BuildOptimizer, BuildScheduler from otrans.train.trainer import Trainer from otrans.utils import co...
StarcoderdataPython
38858
<filename>tests/utils/test_string_utils.py import pytest from mlflow.utils.string_utils import strip_prefix, strip_suffix, is_string_type @pytest.mark.parametrize( "original,prefix,expected", [("smoketest", "smoke", "test"), ("", "test", ""), ("", "", ""), ("test", "", "test")], ) def test_strip_prefix(origi...
StarcoderdataPython
23504
from hyperopt import hp # Define the search space here, e.g. # from hyperopt.pyll.base import scope # search_space = { # 'epochs': hp.qloguniform('epochs', 0, 4, 2), # 'max_df': hp.uniform('max_df', 1, 2), # 'max_ngrams': scope.int(hp.quniform('max_ngram', 3, 9, 1)) # } # Default search space: Try di...
StarcoderdataPython
3287564
<reponame>briehanrahan/subdiver """ Pushshift.io API Wrapper (for reddit.com public comment/submission search) https://github.com/dmarx/psaw """ from .PushshiftAPI import PushshiftAPI, PushshiftAPIMinimal __version__ = '0.0.7'
StarcoderdataPython
1614226
from Components.Converter.Converter import Converter class HddInfo(Converter): MODEL = 0 CAPACITY = 1 FREE = 2 def __init__(self, type): Converter.__init__(self, type) self.type = { "Model": self.MODEL, "Capacity": self.CAPACITY, "Free": self.FREE, }[type] def getText(self): hdd ...
StarcoderdataPython
156426
<filename>tests/tests_data.py<gh_stars>1-10 import numpy as np import pandas as pd import neurokit2 as nk import os path_data = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "data") # ============================================================================= # Data # ==================...
StarcoderdataPython
4805315
<reponame>shibi391/project-justapad<gh_stars>0 from tkinter import * from tkinter.filedialog import asksaveasfile from tkinter.filedialog import askopenfile from tkinter import messagebox import tkinter.font as tkFont #**** Window Settings **** root = Tk() root.title("justapad") root.iconbitmap("icon.ico") ...
StarcoderdataPython
3250923
# -*- coding: utf-8 -*- # website: https://loovien.github.io # author: luowen<<EMAIL>> # time: 2018/9/29 21:41 # desc: import ffmpeg import traceback from PIL import ImageFont, ImageDraw, Image from pathlib import Path import shutil import click import glob def image(): with open("../output/fc68997c9c27b1a47ff7a...
StarcoderdataPython
6044
<filename>nvvm/core/nvvm.py from pycu.nvvm import (get_libdevice, ir_version, version, add_module_to_program, compile_program, create_program, destroy_program, get_compiled_result, get_compiled_result_size, get_program_log, get_program_log_size, lazy_add_module_to_program, verify_program) import os imp...
StarcoderdataPython
3357075
# SPDX-FileCopyrightText: Copyright (c) 2021 Electronics and Telecommunications Research Institute # SPDX-License-Identifier: Apache-2.0 import tvm from dMazeRunner.dataflow import ConvLayer from dMazeRunner.common import expr_parameters import collections spm_ordering = () dram_ordering = () def setup(): layer ...
StarcoderdataPython
1736581
"""Command line interface to schema-salad.""" import argparse import logging import os import sys from typing import Any, Dict, List, Mapping, MutableSequence, Optional, Union, cast from urllib.parse import urlparse import pkg_resources # part of setuptools from rdflib import __version__ as rdflib_version from rdfli...
StarcoderdataPython
1754271
<gh_stars>1-10 from django.db import models from admin_log import middleware class AutoCreatedByField(models.ForeignKey): """ Automatically sets current admin user as object creator.""" def __init__(self, to, on_delete, **kwargs): kwargs.setdefault('default', middleware.AdminLogMiddleware.get_user_id...
StarcoderdataPython
86339
""" This command essentially migrates data used for a number of items used by the R class. This should fix any issues related to: WRONGTYPE Operation against a key holding the wrong kind of value These include: * """ from __future__ import unicode_literals import json from django.core.management.base import No...
StarcoderdataPython
1653713
<reponame>GameDungeon/DocStats<gh_stars>1-10 """Generate Callgraphs for documentation.""" import os import subprocess from typing import List from docutils.nodes import Node from docutils.parsers.rst import Directive from sphinx.ext.graphviz import graphviz from sphinx.util.typing import OptionSpec callgraph_count =...
StarcoderdataPython
3203609
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 import sys from awsglue.transforms import * from awsglue.utils import getResolvedOptions from awsglue.context import GlueContext from awsglue.job import Job from awsglue.dynamicframe import DynamicFrame from pyspa...
StarcoderdataPython
4819213
<filename>rally/benchmark/scenarios/heat/stacks.py # Copyright 2014: Mirantis 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.apach...
StarcoderdataPython
1724013
<filename>samitorch/inputs/utils.py # -*- coding: utf-8 -*- # Copyright 2019 SAMITorch Authors. All Rights Reserved. # # # Licensed under the MIT License; # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # # https://opensource.org/licenses/MIT # ...
StarcoderdataPython
3272739
<filename>code/ch07-mem-and-functions/app_counting_closer.py from typing import Callable def main(): c1 = create_counter(7, 3) c2 = create_counter(0, 10) print(c1()) print(c1()) print("#2", c2()) print("#2", c2()) print("#2", c2()) print("#2", c2()) print(c1()) print(c1()) d...
StarcoderdataPython
1668404
<filename>perfect number.py def factor(n): factorlist=[] for i in range(1,n): if n%i==0: factorlist.append(i) return factorlist def perfecto(n): f_list=factor(n) sum_f=sum(f_list) if sum_f==n: return True else: return False
StarcoderdataPython
3263260
<filename>src/ShowForm.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ShowForm.py' # # Created by: PyQt5 UI code generator 5.10.1 # # WARNING! All changes made in this file will be lost! from SelectFolderWindow import Ui_Form from PyQt5 import QtWidgets from PyQt5.QtWidgets import QFi...
StarcoderdataPython
3254917
from whatnot import whatif a: float = whatif(20) b: int = 20 + whatif(6) c = a // b # must be `float`
StarcoderdataPython
3240949
<filename>lecture4/demostd.py from numpy.random import normal import numpy as np import matplotlib.pyplot as plt save_path = '/home/thkam/Documents/Presentations/TelecomSystems/lecture3/' mu = 1 sigma1 = 2 sigma2 = 6 Nsamples = 1000 xn1 = normal(mu, sigma1, Nsamples) xn2 = normal(mu, sigma2, Nsamples) plt.close('all...
StarcoderdataPython
1759556
from SaveAndLoad.JSONSerializer import JSONSerializer import os from PyQt5 import QtCore from PyQt5.QtWidgets import QSizePolicy, QGridLayout, QFrame, QLabel, QPushButton, QTextEdit, QSpinBox, QMessageBox, QAction, QInputDialog from Core.DiceRoller import DiceRollerWithPresetRolls from Interface.Dialogs.AddPresetRoll...
StarcoderdataPython
3267307
<gh_stars>1-10 *n,=map(int,open(0)) f=lambda x:sum(i<j for i,j in zip(n,n[x:])) print(f(1),f(3))
StarcoderdataPython
1673713
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
StarcoderdataPython
1660877
<reponame>Xrenya/algorithms a, b, c, d = list(map(int, input().split(" "))) def dim(a, b, c, d): square = 0 ans = [] dim1 = max(b, c) * (a + d) ans.append([max(b, c), (a + d)]) dim2 = max(b, d) * (a + c) ans.append([max(b, d), (a + c)]) dim3 = max(a, d) * (b + c) ans.append([max(a, d), (...
StarcoderdataPython
4840338
# USAGE # python object_size.py --image images/example_01.png --width 0.955 (add your own width this is just an example) # python object_size.py --image images/example_02.png --width 0.955 # python object_size.py --image images/example_03.png --width 3.5 # import the necessary packages from scipy.spatial import distan...
StarcoderdataPython
1601315
<filename>web_api/views.py from rest_framework import viewsets, mixins from django.contrib.contenttypes.models import ContentType from rest_framework.decorators import detail_route, api_view, permission_classes from rest_framework.response import Response from rest_framework import status from django.conf import settin...
StarcoderdataPython
3286047
<reponame>aslten/skodaconnect<filename>skodaconnect/vehicle.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """Vehicle class for Skoda Connect.""" import re import time import logging import asyncio import hashlib from datetime import datetime, timedelta, timezone from json import dumps as to_json from collections i...
StarcoderdataPython
49132
"""A simple library to ask the user for a password. Similar to getpass.getpass() but allows to specify a default mask (like '*' instead of blank).""" __version__ = "0.5.5" from sys import platform, stdin if platform == "win32": from msvcrt import getch as __getch def getch(): return __getch().decode...
StarcoderdataPython
1730103
<reponame>olivakar/azure-iot-sdk-python # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # ---------------------------------------------...
StarcoderdataPython
176791
import base64 import datetime import hashlib from io import BytesIO from logging import getLogger import OpenSSL.crypto import asn1crypto.ocsp import pytz from OpenSSL import crypto from OpenSSL.crypto import X509StoreContextError from asn1crypto import pem from bankid.experimental.helper import CompletionDataContain...
StarcoderdataPython
1634106
<filename>preprocess/utils.py import argparse import os import csv import numpy as np from tqdm import tqdm from nltk import word_tokenize def phrase_process(): f = open(os.path.join('AutoPhrase', 'models', args.dataset, 'segmentation.txt')) g = open(args.out_file, 'w') for line in tqdm(f): doc = '' ...
StarcoderdataPython
1639401
<gh_stars>0 from __future__ import print_function from io import StringIO from argparse import ArgumentParser from os.path import join as osp_join import sys from catkin_tools.verbs.catkin_build import ( prepare_arguments as catkin_build_prepare_arguments, main as catkin_build_main, ) from catkin_tools.verbs...
StarcoderdataPython
3392638
<reponame>den1130/sc-projects<filename>SC101 - Assignment4/SC101 - Assignment4/milestone1.py """ File: Milestone1.py Name: ----------------------- This file tests the milestone 1 for our babyname.py project """ import sys def add_data_for_name(name_data, year, rank, name): add_name = name # 用盒子去接進來的數值 add_...
StarcoderdataPython
1796278
<filename>packages/pyright-internal/src/tests/samples/annotations5.py # This sample tests the handling of tuple expressions within a subscript # when used with type annotations. from typing import Dict, List a: Dict[(str, str)] = {"hi": "there"} b: List[(int,)] = [3, 4, 5]
StarcoderdataPython
107731
import os import numpy as np import cv2 as cv from tests_common import NewOpenCVTests def generate_test_trajectory(): result = [] angle_i = np.arange(0, 271, 3) angle_j = np.arange(0, 1200, 10) for i, j in zip(angle_i, angle_j): x = 2 * np.cos(i * 3 * np.pi/180.0) * (1.0 + 0.5 * np.cos(1.2 + ...
StarcoderdataPython
80028
<reponame>harshp2124/My-Python-Codes import os from flask import Flask from flask import render_template from flask import request from flask import redirect from flask_sqlalchemy import SQLAlchemy project_dir = os.path.dirname(os.path.abspath(__file__)) database_file = "sqlite:///{}".format( os.path.join(projec...
StarcoderdataPython
1782138
<reponame>aws-samples/tabular-document-digitization # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 from shared.defines import * from shared.environ import * from shared.loggers import Logger from shared.database import Database from shared.document import Documen...
StarcoderdataPython
99263
import RPi.GPIO as GPIO import time import subprocess from datetime import datetime from pprint import pprint import sys import time card = '' counter = 1 while True: rfid = open('/dev/bus/usb/001/021', 'rb') RFID_input = rfid.read() #RFID_output = rfid.write(card) print(f"read {counter}: ", RFID_input...
StarcoderdataPython
3292471
<reponame>bennifuchs/AbqPlugins ''' MIT License Copyright (c) 2019 <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 the rights to use, copy...
StarcoderdataPython
75495
from flask import current_app from flask import request from switchmng.typing import FlaskResponse from switchmng import database from .blueprint import restbp from .errors import * @restbp.route('/switch_models', methods = ['POST']) def post_switch_model() -> FlaskResponse: session = current_app.config['SWITCHM...
StarcoderdataPython
4799
import cv2 import os import numpy as np from PIL import Image def frame2video(im_dir, video_dir, fps): im_list = os.listdir(im_dir) im_list.sort(key=lambda x: int(x.replace("_RBPNF7", "").split('.')[0])) img = Image.open(os.path.join(im_dir, im_list[0])) img_size = img.size # 获得图片分辨率,im_dir文件夹下的图片分辨率...
StarcoderdataPython
23708
<filename>networks/rnn.py # pytorch import torch import torch.nn as nn import torch.nn.functional as F # ********************************************** # rnn class # ********************************************** class BasicRNNCell(nn.Module): def __init__(self, inputs, hidden, outputs): super(BasicRNNCell...
StarcoderdataPython
1679470
<gh_stars>10-100 import numpy as np import torch from gym.spaces import Dict import torch import torch.nn as nn from torch.autograd import Variable from torch.optim import Adam from rllab.misc.instrument import VariantGenerator import rlkit.torch.pytorch_util as ptu from rlkit.envs.wrappers import NormalizedBoxEnv f...
StarcoderdataPython
3317877
<filename>tracing/tracing/mre/mre_result_unittest.py # Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import unittest from tracing.mre import function_handle from tracing.mre import map_single_trace from t...
StarcoderdataPython
3275901
from lenstronomy.SimulationAPI.observation_api import SingleBand __all__ = ['get_noise_sigma2_lenstronomy'] def get_noise_sigma2_lenstronomy(img, pixel_scale, exposure_time, magnitude_zero_point, read_noise=None, ccd_gain=None, sky_brightness=None, seeing=None, num_exposures=1, psf_type='GAUSSIAN', kernel_point_source...
StarcoderdataPython
1638395
"""exam URL Configuration""" from django.urls import path from . import views app_name = 'exams' urlpatterns = [ path('', views.home, name='home'), path('exams/', views.exams, name='exams'), path('exams/add/', views.exam_add, name='exam-add'), path('exams/<int:exmid>/', views.exam_detail, name='exam-d...
StarcoderdataPython
3324044
<gh_stars>0 #!/usr/bin/env python3 # -*- coding: iso-8859-1 -*- #pylint3: disable=missing-docstring, line-too-long, empty-docstring, too-many-locals, invalid-name, trailing-newlines #------------------------------------------------------------------------------- # # Project: VirES-AEOLUS # Purpose: ...
StarcoderdataPython
1775766
<reponame>ghoul-lover/manjiro_sano<filename>tg_bot/modules/farewell.py from aiogram import types from asyncpg import StringDataRightTruncationError from tg_bot.utils.db_api import db_helpers async def farewell_left_member(message: types.Message): """ Saying goodbye to the departed """ try: fa...
StarcoderdataPython
3273349
<filename>libraries/cells/gridInsalataCell.py from libraries.cells.gridPizzaCell import PizzaCell import tkinter as tk import tkinter.font as TkFont class InsalataCell(PizzaCell): """ This cell contains: - insalata name - price - ingredients - allergens """ def __init__(self, window, na...
StarcoderdataPython
52422
<filename>wef/items/views/__init__.py from .booksale import BookSale from .postdetail import PostDetail from .postlist import PostList from .search import SearchView from .postdelete import PostDelete from .introduce import IntroduceView
StarcoderdataPython
71001
<filename>scripts/practice/Amazon/NumberOfProvinces.py<gh_stars>0 """ Number of Provinces There are n cities. Some of them are connected, while some are not. If city a is connected directly with city b, and city b is connected directly with city c, then city a is connected indirectly with city c. A province is a g...
StarcoderdataPython
1765794
from __future__ import print_function, absolute_import, division import os import sys from contextlib import contextmanager from string import Template from invoke.exceptions import UnexpectedExit from .config import venv, WORKSPACE def get_env(envdict, name, default=''): return envdict.get(name) or default ...
StarcoderdataPython
1612537
import requests import RPi.GPIO as GPIO import time sensor = 4 GPIO.setmode(GPIO.BCM) GPIO.setup(sensor, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) previous_state = False current_state = False last_movement = time.time() light_on = False while True: time.sleep(0.5) previous_state = current_state current_state ...
StarcoderdataPython
3226323
""" cmd.do('fetch ${1:3nd3},name=${1:3nd3}, type=pdb, async=0') cmd.do('select ${2:temp}, ${3:3nd3} and chain A;') cmd.do('run ${3:/Users/blaine-mooers/Scripts/PyMOLScripts/msms_pymol.py};') cmd.do('calc_msms_area ${2:temp};') """ cmd.do('fetch 3nd3,name=3nd3, type=pdb, async=0') cmd.do('select temp, 3nd3 and chain A;'...
StarcoderdataPython
88906
<filename>_common/__init__.py default_app_config = '_common.apps.CommonConfig'
StarcoderdataPython
3223630
# Embedded file name: /Users/versonator/Jenkins/live/output/mac_64_static/Release/python-bundle/MIDI Remote Scripts/_Framework/__init__.py # Compiled at: 2018-04-23 20:27:04 from __future__ import absolute_import, print_function, unicode_literals
StarcoderdataPython
1665176
# 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
134446
#!/usr/bin/env python3 import os import shutil import unittest import tempfile import platform import getpass import tarfile from gppylib.db import dbconn from gppylib.gparray import GpArray from contextlib import closing from gppylib.commands import gp from gppylib.commands.unix import Scp from gppylib.commands.base...
StarcoderdataPython
1698001
import sys sys.path.insert(1,'Lib\site-packages') #to get all the package import pygame import pygame.midi from pygame.locals import * import Pianos # import random pygame.init() pygame.midi.init() input_id = pygame.midi.get_default_input_id() i = pygame.midi.Input( input_id ) pygame.fastevent.init() event_get = pyg...
StarcoderdataPython
3275370
<gh_stars>1000+ """ Test minsize property. """ from flexx import flx class Tester(flx.Widget): def init(self): super().init() with flx.VBox(): flx.Label(text='You should see 5 pairs of buttons') with flx.HFix(): # Use minsize in CSS of button widget wi...
StarcoderdataPython
1603413
from lxml import etree class norm_arxiv: def remove_math_prefix(self, mt_string): return mt_string.replace('<m:', '<').replace('</m:', '</') def remove_annotation(self, mt): ''' mt: an xml element TODO: 1. Remove the latex and MathML Content annotations...
StarcoderdataPython
3361484
class Solution: # @param A : list of integers # @return an integer def findMinXor(self, A): n = len(A) A.sort() min_val = float("inf") for i in range(n-1) : min_val = min(min_val, A[i]^A[i+1]) return min_val
StarcoderdataPython
1610253
<reponame>covariant/addons-server import re from django.db.transaction import non_atomic_requests from django.utils.decorators import classonlymethod from rest_framework.mixins import ListModelMixin from rest_framework.response import Response from rest_framework.viewsets import GenericViewSet from waffle import swit...
StarcoderdataPython
1750369
''' The initialization module for the performance measures package. ''' from .jaccard_similarity import (jaccard_index_binary_masks, jaccard_index_multipolygons) __all__ = [ 'jaccard_index_binary_masks', 'jaccard_index_multipolygons', ]
StarcoderdataPython
1727089
<reponame>eugene-UiO/IN1910 import numpy as np import matplotlib.pyplot as plt from scipy.integrate import solve_ivp class ExponentialDecay(): """Exponential decay class.""" def __init__(self, a): """ExponentialDecay class takes a decay constant a as argument.""" self.a = a def __call__(...
StarcoderdataPython
1750839
<gh_stars>10-100 # -*- coding: utf-8 -*- # # Error tracker flasks plugins default value # # :copyright: 2019 <NAME> # :license: BSD-3-Clause # # Whether notification should be send or not APP_ERROR_SEND_NOTIFICATION = False # List of email recipients, these users would be send an email APP_ERROR_RECIPIENT_EMA...
StarcoderdataPython
3374022
from __future__ import annotations from dataclasses import * from typing import * from .moves import Move import re import socket from . import gripper prelude = ''' # Set TCP so that RPY makes sense set_tcp(p[0, 0, 0, -1.2092, 1.2092, 1.2092]) set_gravity([0.0, 0.0, 9.82]) set_payload(0.1) gl...
StarcoderdataPython
28973
<filename>nosai/numbers.py """ 1999- Nineteen Ninty Nine 1888 - Eighteen Eighty Eight 1777 - Seventeen Seventy Seven 1111 - Oneeen Onety One Not fully huristics """ from num2words import num2words def spell(N): if N // 1_0000 ==0: N = divmod(N, 100) top, bot = N[0], N[1] result = [ ] ...
StarcoderdataPython
3202991
import time import csv from pymongo import MongoClient client = MongoClient('127.0.0.1', 27017) # database db = client['test_database'] # collection collection = db['test_collection'] with open('sample.csv', 'r') as rf: reader = csv.reader(rf) with open('find.csv', 'w') as wf: writer = csv.writer(wf) ...
StarcoderdataPython
1650803
<gh_stars>1-10 import logging import subprocess from pathlib import Path from typing import Dict, Union import colorlog def get_pretty_logger(name: str): handler = colorlog.StreamHandler() handler.setFormatter(colorlog.ColoredFormatter("%(log_color)s%(asctime)s - %(name)s - %(levelname)s - %(message)s")) ...
StarcoderdataPython
4809768
import requests import urllib.request, urllib.parse, urllib.error from bs4 import BeautifulSoup ''' # A biblioteca BeatifulSoup permite a construção de uma árvore a partir de vários elementos de uma página HTML e fornece uma simples interface para acessar estes elementos. # A biblioteca requests é para realizar pedido...
StarcoderdataPython
118151
<reponame>docker-swing/swing-server import os import re from werkzeug.security import check_password_hash, generate_password_hash version_regex = r'^\d+(?:\.\d+)+$' name_regex = r'^[a-z]+(?:-[a-z]+)*$' zip_regex = r'^[a-z]+(?:-[a-z]+)*\-\d+(?:\.\d+)+\.zip' def is_valid_filename(filename) -> bool: return bool(re...
StarcoderdataPython
1724810
#-*- coding: utf-8 -*- from confiture import Confiture from .i_command import ICommand from src.shell.chart.arity import ArityChart from src.shell.chart.type import TypeChart from src.shell.chart.couple import CoupleChart from src.shell.chart.alloc import AllocChart class ChartCmd(ICommand): """ usage: c...
StarcoderdataPython
22050
"""Base class for rotor tests.""" import unittest from enigma.rotor.reflector import Reflector from enigma.rotor.rotor import Rotor class RotorTest(unittest.TestCase): """Provides tools testing rotors.""" def get_rotor( self, wiring="EKMFLGDQVZNTOWYHXUSPAIBRCJ", ring_setting=1, ...
StarcoderdataPython
134915
<filename>test/integration/broken/maint/test_vpc_host_maintenance.py # 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 u...
StarcoderdataPython
33523
# utils/test_kronecker.py """Tests for rom_operator_inference.utils._kronecker.""" import pytest import numpy as np import rom_operator_inference as opinf # Index generation for fast self-product kronecker evaluation ================= def test_kron2c_indices(n_tests=100): """Test utils._kronecker.kron2c_indices...
StarcoderdataPython
125663
#!/usr/bin/env python import csv from sys import stdout import alcazar def main(): scraper = alcazar.Scraper( cache_root_path='cache', ) page = scraper.fetch('http://www.ucmp.berkeley.edu/fosrec/Olson2.html') table = page.one('p[./a[@name="TABLE2"]]/following-sibling::table') writer = cs...
StarcoderdataPython
163448
from .classification import ClassificationTask from .ner import NERTask
StarcoderdataPython
186359
import time from pynput import keyboard import morse WPM = morse.WPM FS = morse.FS def info(): print("Keyboard :") print(" None") def main(message, wpm=-1, fs=-1, key="caps"): wpm = WPM if wpm == -1 else wpm fs = FS if fs == -1 else fs code = morse.stringToMorse(message) flip_intervals = m...
StarcoderdataPython
3381705
class Stack: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): return self.items[-1] def size(self): ...
StarcoderdataPython
32318
import requests import ssl from requests.adapters import HTTPAdapter, PoolManager class MyAdapter(HTTPAdapter): def init_poolmanager(self, connections, maxsize): super(MyAdapter, self).__init__() self.poolmanager = PoolManager(num_pools=connections, maxsize=maxsize, ssl_version=ssl.PROTOCOL_SSLv3)...
StarcoderdataPython
3243058
<reponame>hahn/apiapi #!/bin/python import urllib from bs4 import BeautifulSoup import time from datetime import date import json from urlparse import urlparse kategori = ['persib','bandung','bandung-juara','jabar','jabar-kahiji','sport','edukasi','ekonomi','serba-serbi','selebritas','life-style','syiar','bogor'] cat...
StarcoderdataPython
1721048
# =============================================================================== # 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/LI...
StarcoderdataPython
166669
<filename>bin/local-align.py #!/usr/bin/env python """ Aligns each FASTA sequence in one file to each sequence in another. """ from __future__ import print_function import argparse from dark.fasta import FastaReads from dark.local_align import LocalAlignment parser = argparse.ArgumentParser( formatter_class=a...
StarcoderdataPython
1611037
input = """ f(X,Y) | g(X,Y) :- a(X,Y). a(1,2). a(2,1). :- f(X,Y), g(Y,X). """ output = """ f(X,Y) | g(X,Y) :- a(X,Y). a(1,2). a(2,1). :- f(X,Y), g(Y,X). """
StarcoderdataPython
1649275
<reponame>Brokenshire/codewars-projects # Python solution for 'Exes and Ohs' codewars question. # Level: 7 kyu # Tags: Fundamentals. # Author: <NAME> # Date: 15/02/2020 import unittest def xo(s): """ Check to see if a string has the same amount of 'x's and 'o's. The method must return a boolean and be ca...
StarcoderdataPython
1700953
# coding: utf-8 import numpy as np import math import functools import json import datetime import uuid import chainer import chainer.functions as F import chainer.links as L from chainer import Variable, serializers from chainer.backends import cuda def choice_random(player): _, _, putable_position_nums = player...
StarcoderdataPython
1767989
<reponame>BoTranVan/claircli #!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup from claircli.version import __version__ requires = [ 'requests', 'docker', 'Jinja2', 'pyyaml', 'six', 'colorlog', ] setup( name='claircli', version=__version__, description='Simp...
StarcoderdataPython
4823002
<filename>notebooks/_solutions/90_package_numpy14.py # Calculate the min and max for each channel h_min = herstappe_data.min(axis=(1, 2), keepdims=True) h_max = herstappe_data.max(axis=(1, 2), keepdims=True)
StarcoderdataPython
136795
<reponame>caternuson/rpi-camera #=========================================================================== # timelapser.py # # Timelapse thread class. # # 2016-07-16 # <NAME> #=========================================================================== import threading import time import os class TimeLapser(threading...
StarcoderdataPython
1617231
# -*- coding: utf-8 -*- ### # (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP # # 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
19165
<reponame>WamBamBoozle/pants<gh_stars>0 # coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literal...
StarcoderdataPython
1775961
# Copyright 2019 DeepMind Technologies Ltd. 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