id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3332879 | ########################################
#
# These functions edit sessions
#
########################################
from datetime import date, timedelta, datetime
from skipole import FailPage, GoTo, ValidateError, ServerError
from .. import sun, database_ops
def fill_edit_sessions(skicall):
"""Populates the... | StarcoderdataPython |
1681199 | """Parse luxtonik visibilities."""
import logging
from .datatypes import Unknown
LOGGER = logging.getLogger("Luxtronik.Visibilities")
class Visibilities:
"""Class that holds all visibilities."""
visibilities = {
0: Unknown("ID_Visi_NieAnzeigen"),
1: Unknown("ID_Visi_ImmerAnzeigen"),
... | StarcoderdataPython |
1657188 | <reponame>pymike00/youtube-scripts
import socket
import sys
import pyfiglet
from rich.console import Console
from rich.table import Table
from utils import extract_json_data
console = Console()
class PScan:
PORTS_DATA_FILE = "./common_ports.json"
def __init__(self):
self.open_ports = []
s... | StarcoderdataPython |
3303113 | <filename>sublime/Plugins/Disable Word Completions/disable-word-completions-command.py
import sublime
import sublime_plugin
class DisableCompletionListener(sublime_plugin.EventListener):
def on_query_completions(self, view, prefix, locations):
return ([], sublime.INHIBIT_WORD_COMPLETIONS) | StarcoderdataPython |
1762587 | from mykrobe.metagenomics.phylo import SpeciesPredictor
from mykrobe.metagenomics.phylo import AMRSpeciesPredictor
from mykrobe.metagenomics.models import MykrobePredictorPhylogeneticsResult
| StarcoderdataPython |
154499 | <filename>examples/file/boxplot_multi.py
from bkcharts import BoxPlot, output_file, show, defaults
from bokeh.layouts import gridplot
from bokeh.sampledata.autompg import autompg as df
defaults.plot_width = 400
defaults.plot_height = 400
box_plot = BoxPlot(df, label='cyl', values='mpg',
title="labe... | StarcoderdataPython |
3235200 | height_cm = float(input("Enter your height in cm: "))
weight_kg = float(input("Enter your weight in kg: "))
height = height_cm / 100
bmi = weight_kg / (height * height)
bmi_list = [{
"min": 0,
"max": 18.5,
"status": "underweight"
}, {
"min": 18.5,
"max": 25,
"status": "normal"
}, {
"min": ... | StarcoderdataPython |
1750326 | import os
import json
import torch
from utils import loadImage, write_text_detection_results, write_recognition_results
import asterocr as ocr
torch.set_num_threads(1)
# read input image
env_file = 'env_local.list'
if os.path.isfile(env_file):
with open(env_file) as f:
for line in f:
name, va... | StarcoderdataPython |
3250316 | <gh_stars>0
__version__ = "0.0.1"
# Keep these within their sub-modules:
#from openmovement.load import *
#from openmovement.process import *
| StarcoderdataPython |
3331603 | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
from scrapy import Item, Field
from scrapy.loader.processors import TakeFirst
class Company(Item):
report_id = Field(output_processor=TakeFirst())
company_na... | StarcoderdataPython |
1730484 | <filename>8.py<gh_stars>1-10
from __future__ import division
"""
If you want to divide floating point numbers, have this at the start of your file
"""
x= 5.2/2
print x
"""
This is just a list of a number of built in functions that Python uses.
"""
l1='abcd'
l2=['a', 'X', 'm', 'd']
l3=''
"""
Check if a string is emp... | StarcoderdataPython |
139105 | import rpyc
import uuid
import os
from rpyc.utils.server import ThreadedServer
DATA_DIR = "/tmp/storage/"
class StorageService(rpyc.Service):
# exposed classes & methods
ALIAES = ["storage"]
def on_connect(self,conn):
print("[+] Client Connected {}".format(conn._channel.stream.sock.getpeername())... | StarcoderdataPython |
3382341 | # -*- coding: utf-8 -*-
"""
Utils template tags
"""
# django
from django import template
register = template.Library()
@register.filter
def group(array, group_length):
return zip(*(iter(array),) * group_length)
@register.filter
def get_item(dictionary, key):
return dictionary.get(key)
@register.filter(i... | StarcoderdataPython |
3306807 | #import urllib.request
import requests
import collections
import sys
from collections import OrderedDict
fobj = open("beer-list.txt", "r")
beers = []
#get beers from file
for line in fobj:
beers.append(line.rstrip())
fobj.close()
baseUrlStart = "http://localhost:61363/api/sitemap?url=https://untappd.com/search?... | StarcoderdataPython |
134993 | from datetime import timedelta
# 3rd party imports
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from django.urls import reverse
from django.utils.timezone import now
from libya_site.tests.factories import DEFAULT_USER_PASSWORD, UserFactory
from regi... | StarcoderdataPython |
1700540 | import os
import hashlib
import zipfile
import simplejson as json
from hmac import compare_digest
from fcntl import flock, LOCK_EX, LOCK_NB
from magic import Magic
from time import sleep
from datetime import datetime
from pytz import timezone
from rfc6266 import build_header
from requests import Session
from shutil imp... | StarcoderdataPython |
4821539 | import numpy as np
import tensorflow as tf
from .simple_replay_memory import SimpleDataSet
# util is used for AE
from .util import conv2d, linear
from ..base import BaseModel
from functools import reduce
from ..utils import onehot_actions
class AutoEncoder(BaseModel):
def __init__(self, name, sess, config):
... | StarcoderdataPython |
1636599 | "Vectorization demonstration"
from __future__ import print_function
from gpkit import Model, Variable, Vectorize
class Test(Model):
"""A simple scalar model
Upper Unbounded
---------------
x
"""
def setup(self):
x = self.x = Variable("x")
return [x >= 1]
print("SCALAR")
m = Te... | StarcoderdataPython |
1789302 | <reponame>osamamagdy/addons-server
from django.urls import re_path
from . import views
group_re = r'(?P<group>' + '|'.join(views.SERIES_GROUPS) + ')'
group_date_re = r'(?P<group>' + '|'.join(views.SERIES_GROUPS_DATE) + ')'
range_re = r'(?P<start>\d{8})-(?P<end>\d{8})'
format_re = r'(?P<format>' + '|'.join(views.SERI... | StarcoderdataPython |
1706131 | <reponame>Imperas/force-riscv
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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/LICENS... | StarcoderdataPython |
1768904 | #!/usr/bin/env python3
import os
from datetime import datetime
from math import inf
from subprocess import run
class Restructor(object):
def __init__(self, shell='bash'):
self.rules = {}
def add(self, target, prereqs, recipe=None):
"""Need an indirect rule? Just omit the recipe."""
... | StarcoderdataPython |
1625153 | <reponame>Open-Prose-Metrics/open_prose_metrics_app-core
from linty.linty import lint_text | StarcoderdataPython |
162196 | <reponame>Flowm/move-on-helium-sensors
#!/usr/bin/env python3
import argparse
import datetime
import logging
import re
logging.basicConfig(level=logging.DEBUG, format="%(asctime)-15s %(levelname)s %(message)s")
def main():
argparser = argparse.ArgumentParser(description="Add timestamps to sensors log based on r... | StarcoderdataPython |
1720920 | <filename>conversiones.py
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 23 13:07:10 2017
En este archivo (conversiones.py) se tendrán todos los factores de conversión útiles en la aplicación
@author: samez
"""
import numpy#se importa para las funciones de seno, coseno y tangente
def luminosidad_solar_a_vatios... | StarcoderdataPython |
1621214 | from unittest import TestCase
from openarticlegauge import models
from openarticlegauge import config
import json, redis, time
ARCHIVE = []
@classmethod
def mock_bulk(cls, bibjson_list):
global ARCHIVE
ARCHIVE += bibjson_list
@classmethod
def mock_bulk_blocked(cls, bibjson_list):
global ARCHIVE
ARCHI... | StarcoderdataPython |
58334 | while True:
palabra = input ("Estás atrapado en un ciclo infinito.Ingresa la palabra secreta para dejar el ciclo:")
if palabra == "chupacabra":
break
print("¡Has dejado el ciclo con éxito!") | StarcoderdataPython |
3347366 | <filename>tests/manager/and_every_test.py
# coding=utf-8
from __future__ import absolute_import, division, print_function, \
unicode_literals
from unittest import TestCase
from triggers.manager import TriggerManager, trigger_managers
from triggers.runners import ThreadingTaskRunner
from triggers.storages.base imp... | StarcoderdataPython |
3371262 | '''A module for iterating though results from the FEC API.
This module provides several useful utilities for iterating through paginated
results from the `FEC API <https://api.open.fec.gov/developers>`_. The meat of
this module is in the :class:`filing_iterator.FilingIterator` class, which
encapsulates the logic of in... | StarcoderdataPython |
28666 | <filename>Python/Uti1016_Distancia.py<gh_stars>0
km = int(input())
print('{} minutos'.format(km*2)) | StarcoderdataPython |
3236804 | #!/usr/bin/envs python
from statsnba import Game
import pandas as pd
import re
import requests_cache
requests_cache.install_cache('test_cache')
game_id = '0020901226'
def process_game_pbp(game_id):
game = Game(game_id)
playbyplay = game.PlayByPlay
def event_to_dict(event):
# TODO Kind of dirty... | StarcoderdataPython |
1711909 | # check minimum requirements: python 3 and minimum torch version
import sys
import torch
__version__ = '0.2.2'
if sys.version_info[0] < 3:
raise Exception("This only works with Python 3.5 or higher")
if sys.version_info[1] < 5:
raise Exception("This only works with Python 3.5 or higher")
try:
from p... | StarcoderdataPython |
3371767 | from unittest.mock import MagicMock
def mock_response(fixture_name):
"""
Accepts the name of a file in the fixtures directory
Returns a mocked response object
"""
f = open("tests/fixtures/" + fixture_name, "r")
fixture_content = f.read()
response = MagicMock()
response.content = fix... | StarcoderdataPython |
3223377 | <gh_stars>1-10
# written by <NAME>
# edited by <NAME> and <NAME>
# 6/26/2013
# first version of figure of merit functions for automated
# data processing
from intermediatefunctions_firstversion import numpy
import intermediatefunctions_firstversion as inter
# this dictionary is required to know which figures of mer... | StarcoderdataPython |
150769 | import cv2 as cv
import numpy as np
img = cv.imread('Photos/cats.jpg')
cv.imshow('Cats', img)
blank = np.zeros(img.shape[:2], dtype= 'uint8')
cv.imshow("Blank Image", blank)
mask = cv.circle(blank.copy(), (img.shape[1]//2, img.shape[0]//2), 100, 255, -1)
cv.imshow("mask", mask)
mask2 = cv.rectangle(blank.copy(), (i... | StarcoderdataPython |
3389213 | """
Module
------
LCExtract.py: Wrapper for lightcurve data extraction package
Summary
-------
Allows selection of file or manual input.
Allows filter selection.
Iterates through required entries
retrieving available data
summarising and plotting output
"""
# Self-authored package modules for i... | StarcoderdataPython |
3280804 | """Rules for writing tests with JUnit"""
load("@bazel_skylib//lib:dicts.bzl", _dicts = "dicts")
load(
"@io_bazel_rules_scala//scala/private:common_attributes.bzl",
"common_attrs",
"implicit_deps",
"launcher_template",
)
load("@io_bazel_rules_scala//scala/private:common_outputs.bzl", "common_outputs")
l... | StarcoderdataPython |
1732339 | <filename>api/documents/migrations/0005_convert_null_to_empty.py
# Generated by Django 3.1.2 on 2020-11-05 17:32
from django.db import migrations
def convert_null_to_empty(apps, schema_editor):
TeamMember = apps.get_model("documents", "Document")
TeamMember.objects.filter(archived_reason__isnull=True).update... | StarcoderdataPython |
3368531 | <reponame>capa89k/pyMeterBus
import json
from meterbus.wtelegram_body import WTelegramFrame
from meterbus.exceptions import (
MBusFrameDecodeError,
MBusFrameCRCError,
FrameMismatch)
class WTelegramSndNr(WTelegramFrame):
@staticmethod
def parse(data):
try:
if data[1] != 0x44: ... | StarcoderdataPython |
4827930 | <filename>synapse/state/v2.py
# Copyright 2018 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
98827 | import numpy as np
import sys
import os
import pandas as pd
from scipy import signal
from sklearn.metrics import accuracy_score
########## Note: Using Professor's code as a starting template ########################
########################################
### Read images from train directory ###
traindir = sys.... | StarcoderdataPython |
176059 | <filename>facturapi/types/exc.py
from dataclasses import dataclass
from typing import Any, Dict
class FacturapiException(Exception):
...
class NoResultFound(FacturapiException):
"""No results where found"""
class MultipleResultsFound(FacturapiException):
"""One result was expected but multiple were re... | StarcoderdataPython |
3333318 | <filename>actors/actions/chase_action.py
from actors.actions.action import Action
class ChaseAction(Action):
def __init__(self, target, movement):
self.target = target
self.movement = movement
def on(self, actor, tile, root):
target = self.target.with_area(root)
x, y = target... | StarcoderdataPython |
3238138 | from tir import Webapp
import unittest
class TECA700(unittest.TestCase):
@classmethod
def setUpClass(inst):
inst.oHelper = Webapp()
inst.oHelper.Setup("SIGATEC","11/12/2020","T1","D MG 01","28")
inst.oHelper.Program("TECA700")
def test_TECA700_001(self):
self.oHelper.SetButton("Incluir")
self.oHelper.Se... | StarcoderdataPython |
1669871 | # Generated by Django 2.1.4 on 2021-08-26 02:45
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0008_auto_20210821_0037'),
]
operations = [
migrations.AddField(
model_name='rol',
... | StarcoderdataPython |
1752117 | <filename>src/util/node.py
from __future__ import annotations
from src.util.state import State
class Node:
"""
A* tree search node
"""
__slots__ = 'state', 'cost', 'heuristic', 'collisions', 'value', 'delta_f', 'parent', 'time'
def __init__(self, state: State, cost: int, heuristic: int, collisi... | StarcoderdataPython |
1680015 | <filename>IGM/ransac_contfit.py
""" A continuum fitter class. This reads in a 1D spectrum and allows continuum fitting."""
import os
import time
import numpy as np
import matplotlib
matplotlib.use('TkAgg') #python 3 only
import ipdb
np.random.seed(1)
from linetools.spectra import io as tio
from scipy.signal import medf... | StarcoderdataPython |
49121 | <reponame>Darksidis/justiva-script
import re
import requests
from bs4 import BeautifulSoup
import urllib3
import schedule
import time
import regexp as r
from const import login, password
urllib3.disable_warnings()
s = requests.Session()
LOGIN_URL = 'https://justiva.ru/login'
headers = {
'accept': 'text/html,app... | StarcoderdataPython |
1790146 | <gh_stars>1-10
import pandas as pd
def user_cols(user_def_column_name, final_aoi_df, merged, analysis_names):
# to keep columns from getting too long:
new_cols = []
# if ID in shapefile, rename it otherwise join will fail
if 'ID' in final_aoi_df.columns:
final_aoi_df = final_aoi_df.rename(col... | StarcoderdataPython |
69933 | import io
from twisted.internet import reactor
from ygo.card import Card
from ygo.duel_reader import DuelReader
from ygo.parsers.duel_parser import DuelParser
from ygo.utils import process_duel
def msg_select_unselect_card(self, data):
data = io.BytesIO(data[1:])
player = self.read_u8(data)
finishabl... | StarcoderdataPython |
1796561 | from src.data_processing.data_wrangling import prepare_to_train_test_split
import pickle5 as pickle
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import OneHotEncoder
import pandas as pd
imdb_dataframe = pd.read_csv("../data/processed... | StarcoderdataPython |
4825415 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
#
# Licensed under the GNU General Public License, version 3 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://jxs... | StarcoderdataPython |
3236706 | <reponame>SamoraHunter/MPC-media-audit<gh_stars>0
import time
from IPython.display import clear_output
from selenium import webdriver
from selenium.webdriver.common.by import By
import math
import atexit
import wmi
options = webdriver.ChromeOptions()
#Enable for headless, driver should terminate on ... | StarcoderdataPython |
73468 | <filename>tests/routers/test_devicemanagement_router.py
import json
import pytest
from zenossapi.apiclient import ZenossAPIClientError
from zenossapi.routers.devicemanagement import DeviceManagementRouter, ZenossMaintenanceWindow, ZenossUserCommand, ZenossDeviceManagementAdmin
import devicemanagement_resp
pytest_plug... | StarcoderdataPython |
25307 | <filename>src/test_trained_webcam.py
import math
from sklearn import neighbors
import os
import os.path
import pickle
from PIL import Image, ImageDraw
import face_recognition
from face_recognition.face_recognition_cli import image_files_in_folder
import cv2
#from webapp import db
#from DB import Actor
ALLOWED_EXTENSIO... | StarcoderdataPython |
16995 | <reponame>1079278593/TreasureChest
#!/usr/bin/python2.7
import os
import KernelCollection
# Check that weak binds can be missing, so long as we check for the magic symbol
def check(kernel_cache):
kernel_cache.buildKernelCollection("arm64", "/kext-missing-weak-bind/main.kc", "/kext-missing-weak-bind/main.kernel",... | StarcoderdataPython |
80726 | from app.models import db, ma
class School(db.Model):
"""School
This table stores the configuration for each individual school.
Schools are addressed through their short name.
"""
__tablename__ = 'school'
id = db.Column(db.Integer, primary_key=True, unique=True, nullable=False)
school_n... | StarcoderdataPython |
38332 | <reponame>cheery/lever<filename>runtime/module_resolution.py
from space import *
import base
import bon
import evaluator
import core
import os
import pathobj
import stdlib
import sys
class ModuleScope(Object):
def __init__(self, local, parent=None, frozen=False):
self.cache = {} # maps absolute path -> mod... | StarcoderdataPython |
3381829 | # Copyright 2014 NeuroData (http://neurodata.io)
# Copyright 2016 The Johns Hopkins University Applied Physics Laboratory
#
# 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.ap... | StarcoderdataPython |
1742520 | <reponame>thispl/checkpro
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
# @frappe.whitelist()
# def case_count(batch):
# count = frappe.db.count("Case",{"batch":batch})
# frappe.errprint(count)
# b1 = frappe.get_all("Batch",{"name":batch})
# for b in ... | StarcoderdataPython |
182096 | <reponame>jpmarques19/tensorflwo-test
# Standard Library
import argparse
import os
import subprocess
import sys
from distutils.util import strtobool
# Third Party
from torch.cuda import device_count
HOROVOD_PYTORCH_TEST_MNIST_SCRIPT = "./horovod_mnist.py"
HOROVOD_MNIST_SCRIPT_NAME = "horovod_mnist.py"
def launch_... | StarcoderdataPython |
38445 | x = float(1)
y = float(2.8)
z = float("3")
w = float("4.2")
print(x)
print(y)
print(z)
print(w)
# Author: <NAME>
| StarcoderdataPython |
4839446 | <filename>Project1/Code/scripts/flip_celebA.py
"""
@Author: <NAME>
@Date: 2022.3.10
@Description:
This script is to flip the image and their label without
changing the L/R eye or brow or ears' direction.
Which means, for the mask, we first flip the mask, then recover
the label which has L/R att... | StarcoderdataPython |
115060 | <filename>feature_ranking/model/classifier_ditrl.py
import torch.nn as nn
from .feature_extractor import FeatureExtractor
from .spatial.spatial_ext_linear import SpatialExtLinear
from .temporal.temporal_pipeline import TemporalPipeline
from model_def import define_model
class ClassifierDITRL(nn.Module):
def __i... | StarcoderdataPython |
1707216 | <gh_stars>1-10
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# This script prints the output of test failures that were recorded by `stl-lit.py -o TEST_LOG_FILENAME`.
import json
import sys
if len(sys.argv) != 2:
sys.exit(f"Usage: python {sys.argv[0]} T... | StarcoderdataPython |
3387448 | <reponame>krantirk/keras-tuner<filename>kerastuner/engine/execution.py
# Copyright 2019 The Keras Tuner Authors
#
# 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/... | StarcoderdataPython |
138246 | <gh_stars>1-10
class Solution:
def noOfWays(self, M, N, X):
# code here
if X > M * N:
return 0
ways = [[0 for _ in range(M * N + 1)] for _ in range(N + 1)]
for i in range(1, M + 1):
ways[1][i] = 1
for i in range(2, N + 1)... | StarcoderdataPython |
130751 | """Amazon S3 Text Write Module (PRIVATE)."""
import csv
import logging
import uuid
from distutils.version import LooseVersion
from typing import Any, Dict, List, Optional, Tuple, Union
import boto3
import pandas as pd
from pandas.io.common import infer_compression
from awswrangler import _data_types, _utils, catalog... | StarcoderdataPython |
21851 | <filename>setup_win(MPL2).py
# Used successfully in Python2.5 with matplotlib 0.91.2 and PyQt4 (and Qt 4.3.3)
from distutils.core import setup
import py2exe
import sys
# no arguments
if len(sys.argv) == 1:
sys.argv.append("py2exe")
# We need to import the glob module to search for all files.
import glob
# We ne... | StarcoderdataPython |
4818112 | import pytest
import os
import boto3
from moto import mock_s3, mock_sqs
@pytest.fixture(scope="function")
def aws_credentials():
"""Mocked AWS Credentials for moto."""
os.environ["AWS_ACCESS_KEY_ID"] = "testing"
os.environ["AWS_SECRET_ACCESS_KEY"] = "testing"
os.environ["AWS_SECURITY_TOKEN"] = "testin... | StarcoderdataPython |
1640816 | import click
import subprocess
import os
from os.path import abspath, dirname, join
# Modify the path for node_modules
local_env = os.environ.copy()
local_env["PATH"] = "./node_modules/.bin" + os.pathsep + local_env["PATH"]
# Run webpack
def run_webpack(webpack_file, prod, opts=[]):
prod_str = 'development'
i... | StarcoderdataPython |
3338602 | # Copyright (c) 2021, Hitachi America 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 appli... | StarcoderdataPython |
1612531 | <gh_stars>0
# SPDX-FileCopyrightText: 2020 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
from datetime import datetime
import board
import digitalio
import adafruit_max31855
from google.oauth2.service_account import Credentials
from googleapiclient.discovery import build
#--| User Config... | StarcoderdataPython |
4837374 | import argparse
import os
import re
import requests
from hparams import hparams, hparams_debug_string
from synthesizer import Synthesizer
sentences = []
def get_output_base_path(checkpoint_path):
base_dir = os.path.dirname(checkpoint_path)
m = re.compile(r'.*?\.ckpt\-([0-9]+)').match(checkpoint_path)
name = '... | StarcoderdataPython |
1730297 | # 작성일 : 21-06-15
# 주제 : 문자열
# 난이도 : 하
# 문제명 : 그룹 단어 체커
# 문제설명 : 그룹단어란 문자가 연속해서 나타나는 경우를 말한다. 주어진 input값 중 그룹단어의 개수를 반환해라
# 백준 코드번호 : 1316
# 배운점
# 1. 전날 풀다가 안되어서 잠시 접었던 문제인데 오늘 아침에 다시 푸니 구현이 잘 되었다.
# + 노트에 전체적인 틀 그려보기!! 도움이 되었다.
# 역시 안되는 문제 계속 붙잡고 있는 거 보단 다른 쪽으로 잠깐 눈을 돌리는 것도 방법이라고 생각한다. 특히 프로그래밍할 때는
# 비슷한 맥... | StarcoderdataPython |
159112 | <gh_stars>0
import json
import re
from .struct_to_bio import struct_to_bio_dict, struct_to_bio_dict_rd
from seqeval.metrics.sequence_labeling import get_entities
def make_empty_ner_bio(struct_path, output_path):
bio_dir = struct_to_bio_dict(struct_path, 1, use_tags=False)
paragraphs = []
for doc_id in b... | StarcoderdataPython |
3280098 | # -*- coding: utf-8 -*-
import pickle
import numpy as np
from matplotlib import cm
import cv2
from numba import jit
@jit
def CalMandelbrotSet_dat(row, col, N, nmg, colorlist):
img = np.zeros((row,col,3),dtype=np.uint8)
for i in range(row):
for j in range(col):
if nmg[i,j] < N:
... | StarcoderdataPython |
3244969 | <gh_stars>1-10
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import numpy as np
from GT3.RadialTransport.Functions.CalcReducedMass import calc_reduced_mass
from GT3.RadialTransport.Functions.CalcCoulLog import calc_coul_log_j_k
def calc_nu_drag(n_j, m_j, v_tor_j, v_tor_k, mbal_rhs, nu_c):
nu_drag = (mbal_rhs +... | StarcoderdataPython |
1601433 | import numpy as np
from matplotlib import __version__ as mpl_version
from matplotlib import get_backend
from matplotlib.path import Path
from matplotlib.pyplot import close, subplots
from matplotlib.widgets import LassoSelector
from numpy import asanyarray, asarray, max, min, swapaxes
from packaging import version
fro... | StarcoderdataPython |
3377081 | from django.conf import settings
from celery import shared_task
from sentry_sdk import capture_exception
from app.content.models.strike import create_strike
from app.util.mail_creator import MailCreator
from app.util.notifier import Notify
from app.util.utils import datetime_format
@shared_task
def event_sign_off_d... | StarcoderdataPython |
4836311 | <reponame>Smiggel/home-assistant-custom-components<gh_stars>10-100
"""
Support for Volkswagen Carnet platform.
Customized for VW T-ROC.
"""
import logging
from custom_components.volkswagencarnet import VolkswagenEntity, RESOURCES
from homeassistant.components.binary_sensor import BinarySensorDevice
_LOGGER = logging.g... | StarcoderdataPython |
1650097 | import sys
import requests
import datetime
import json
import urlparse
if len(sys.argv) > 1:
root_url = sys.argv[1]
else:
root_url = 'http://localhost:8080/'
#root_url = 'http://meta-vm0/'
#root_url = 'http://kms1.isis.vanderbilt.edu:9999/'
node_prefix = 'template-test-slave'
num_new_s... | StarcoderdataPython |
194360 | """
By Dr <NAME> -Q, NAOC
v1 2019-04-27
"""
import numpy as np
from..util import *
def ydn2md():
pass
#;-------------------------------------------------------------
#;+
#; NAME:
#; YDN2MD
#; PURPOSE:
#; Convert from year and day number of year to month and day of month.
#; CA... | StarcoderdataPython |
3272240 | <reponame>mac-marg-pianist/visualizer_experiment
import json
MATCH_FILE = 'chrome-music-lab/pianoroll/custom_data/Ali01_match.txt'
OUT_FILE = 'chrome-music-lab/pianoroll/custom_data'
def time_to_tick(time, tempo=216):
return round(time*tempo)
def pitch_to_midi_pitch(step, alter, octave):
"""Convert MusicXML pit... | StarcoderdataPython |
3275924 | <reponame>tiwilliam/sverigesradio<gh_stars>1-10
# -*- coding: utf-8 -*-
import re
import json
import requests
from datetime import datetime
class Song(object):
def __init__(self, artist=None, title=None, description=None,
composer=None, conductor=None, **kwargs):
self.artist = artist.enc... | StarcoderdataPython |
1773526 | import tkinter
from tkinter import *
root=tkinter.Tk()
root.geometry("1366x768+0+0")
root.title("Login Page")
mi=PhotoImage(file="Aman.gif")
L3=Label(root,image=mi,font=("arial",15),bg="black",fg="white")
L3.place(x=0,y=0)
E1=Entry(root,font=("Comic Sans MS",18),fg="green")
E1.place(x=725,y=245)
E2=Entry(root... | StarcoderdataPython |
54616 | <filename>src/anaplan_api/ImportTask.py
from .TaskFactory import TaskFactory
from .AnaplanConnection import AnaplanConnection
from .Action import Action
from .ParameterAction import ParameterAction
from .Parser import Parser
from .ImportParser import ImportParser
class ImportTask(TaskFactory):
"""Factory to generate... | StarcoderdataPython |
1672455 | import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import copy
from load_toys_rev import *
filename = 'data/toys_rev2_sample10.csv'
sample_factor = 10
toy_list = load_toys_rev(filename)
count = [0]*3000
timesum = [0]*3000
for toy in toy_list:
if toy.duration < 3000:
timesum[toy.duration] += ... | StarcoderdataPython |
3265195 | <filename>auto_process_ngs/stats.py
#!/usr/bin/env python
#
# stats.py: utilities for generating run-related statistics
# Copyright (C) University of Manchester 2016-19 <NAME>
#
#########################################################################
"""
stats.py
Classes and functions for collecting and repo... | StarcoderdataPython |
3238873 | <gh_stars>0
"""""""""""""""""""""""""""""""""""""""""
# @author sonus
# @date 02 - Apr - 2016
# @copyright sonus
# GitHub http://github.com/sonus21
"""""""""""""""""""""""""""""""""""""""""
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from... | StarcoderdataPython |
3312302 | <reponame>mgrsantox/flask-mini<gh_stars>0
from flask import Flask
from os import environ
from . import config, users, routes
from .databse import db, migrate
def init_app():
"""Initialize the core application."""
app = Flask(__name__, instance_relative_config=False)
flask_env = environ.get("FLASK_ENV", No... | StarcoderdataPython |
1654531 | <filename>qualification/filters.py
import django_filters
from django_filters import CharFilter
from .models import *
from django import forms
class QualificationFilter(django_filters.FilterSet):
field=CharFilter(label='Field of Study',field_name='field',lookup_expr='icontains',widget=forms.TextInput(attrs={"placehold... | StarcoderdataPython |
3275403 | import cv2
import numpy as np
from sklearn.neighbors import NearestNeighbors
def nearest_neighbor(src, dst):
'''
Find the nearest (Euclidean) neighbor in src for each point in dst
Input:
src: template points
dst: destination points
Output:
distances: Euclidean distances of the ... | StarcoderdataPython |
3230598 | <reponame>fredmosc/RNNP-ITAIPU
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 22 2021
@author: jasmine
1) Preparar dados
2) Criar o modelo (input, output size, forward pass)
3) Criar a função de erro (loss) e o otimizador
4) Executar treinamento
"""
import os
import matplotlib.pyplot as plt
i... | StarcoderdataPython |
123465 | <filename>src/geometry_transferring/perspective_transformation.py<gh_stars>0
import cv2
import numpy as np
from matplotlib import pyplot as plot
img=cv2.imread('must_logo.png')
rows,cols,ch=img.shape
pts1 = np.float32([[56,65],[368,52],[28,387],[389,390]])
pts2 = np.float32([[0,0],[300,0],[0,300],[300,300]])
M=cv2.ge... | StarcoderdataPython |
2441 | from random import gauss
class MultiRotor:
"""Simple vertical dynamics for a multirotor vehicle."""
GRAVITY = -9.81
def __init__(
self, altitude=10, velocity=0, mass=1.54, emc=10.0, dt=0.05, noise=0.1
):
"""
Args:
altitude (float): initial altitude of the vehicle... | StarcoderdataPython |
1624301 | <filename>old_source_code/Experiment 4 Extended Game Convergency/plotting_epoch.py
'''
Create plots for experiments
'''
import numpy as np
import matplotlib.pyplot as plt
import pickle
import seaborn as sns
sns.set('paper')
results_dir = 'results'
plot_dir = 'plots'
experiment_name='baseline_3p5c'
iterations=50000
ma... | StarcoderdataPython |
3226231 | #
#
# 0=================================0
# | Kernel Point Convolutions |
# 0=================================0
#
#
# ----------------------------------------------------------------------------------------------------------------------
#
# Callable script to start a training on Myhal... | StarcoderdataPython |
87505 |
from requests_futures.sessions import FuturesSession
import os
session = FuturesSession(max_workers = 10)
def make_logs_query(log):
log_id = log['code']
query = """
{
reportData{
report(code: "%s"){
fights(difficulty: 5){
name
id
averageItemLevel
... | StarcoderdataPython |
1735374 | """
Handlers for video module.
StudentViewHandlers are handlers for video module instance.
StudioViewHandlers are handlers for video descriptor instance.
"""
import json
import logging
import math
from django.core.files.base import ContentFile
from django.utils.timezone import now
from edxval.api import create_exte... | StarcoderdataPython |
117824 | <filename>tk_ui/admin.py
import abc
import tkinter as tk
from tkinter import messagebox as msg
from tkinter import ttk
from _tkinter import TclError
from conf import Config
from core.garbage import GarbageBag
from core.user import User
from equipment.scan_garbage import write_gid_qr, write_all_gid_qr
from equipment.sc... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.