id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
38536 | """
An implementation of a greedy transition-based dependency parser (unlabeled parsing only).
Released under BSD license.
Code is an adapted version of <NAME>'s parser:
https://explosion.ai/blog/parsing-english-in-python
-- change: move core logic to separate myparserutils file
modified by bplank, 03/2017
"""
###... | StarcoderdataPython |
1998504 | #!C:\A_Visit\ForRegression\visit-deps\windowsbuild\MSVC2017\python\3.7.7\python.exe
# EASY-INSTALL-SCRIPT: 'docutils==0.15.2','rst2pseudoxml.py'
__requires__ = 'docutils==0.15.2'
__import__('pkg_resources').run_script('docutils==0.15.2', 'rst2pseudoxml.py')
| StarcoderdataPython |
8188333 | <gh_stars>0
from tests.unit.dataactcore.factories.staging import DetachedAwardFinancialAssistanceFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs35_detached_award_financial_assistance_1'
def test_column_headers(database):
expected_subset = {'row_number', 'legal_... | StarcoderdataPython |
3202685 | """avatar hash
Revision ID: 00cf5297ed33
Revises: <PASSWORD>
Create Date: 2017-11-21 09:38:39.433065
"""
# revision identifiers, used by Alembic.
revision = '00cf5297ed33'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic - plea... | StarcoderdataPython |
1610667 | <filename>disturbance/migrations/0130_auto_20200817_1114.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2020-08-17 03:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('disturbance', '0129_auto_2020081... | StarcoderdataPython |
144870 | from flask import Flask, render_template, request
from werkzeug.utils import secure_filename
from fitparse import FitFile
import os
import subprocess
import json
app = Flask(__name__)
app.config["UPLOAD_FOLDER"] = "temp/"
app.config["MAX_CONTENT_PATH"] = 5000000
@app.route('/')
def upload():
return render_templat... | StarcoderdataPython |
4899932 | """
Module for generating PBS files for executing many jobs with the same
number of nodes.
TODO: define a common interface for schedulers, that works with at least
SLURM and PBS.
TODO: codify dir structure - scheduler dir contains scheduler script, has
subdir for each set of experiment parameters.
"""
import os.path... | StarcoderdataPython |
8053873 | ################################################################################
# Copyright (C) 2002-2011 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version ... | StarcoderdataPython |
9627629 | <reponame>camillobruni/pygirl
import autopath
import py, os
from pypy.config.config import OptionDescription, BoolOption, IntOption, ArbitraryOption, FloatOption
from pypy.config.config import ChoiceOption, StrOption, to_optparse, Config
DEFL_INLINE_THRESHOLD = 32.4 # just enough to inline add__Int_Int()
# and just... | StarcoderdataPython |
6493739 | from typing import Optional
from discord import ButtonStyle, ui
from discord.ext.commands import Context
from discord import Interaction
from motor.motor_asyncio import AsyncIOMotorCollection
class ConfirmView(ui.View):
def __init__(self, ctx: Context):
super().__init__()
self.ctx = ctx
s... | StarcoderdataPython |
6591257 | <reponame>wpwbb510582246/PocketFIlm
# -*- coding: utf-8 -*-
import json
import scrapy
from selenium.webdriver import ActionChains
from PocketLifeSpider.items import MovieItem
from PocketLifeSpider.util.MongoDbUtils import MongoDbUtils
from PocketLifeSpider.util.CommonUtils import *
class IqiyiSpider(scrapy.Spider):
... | StarcoderdataPython |
338659 | #!/usr/bin/python
var1 = 1
var2 = 10
print "Value of var1 is : ", var1
print "Value of var2 is : ", var2
del var1
#print "Value of var1 is : ", var1
print "Value of var2 is : ", var2
var_a = 100
var_b = 1000L
var_c = 1.125
var_d = 10 + 3j
print "==============================================================="
print... | StarcoderdataPython |
3216344 | <filename>helical_thread/__init__.py<gh_stars>0
"""Top-level package for helical_thread."""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__version__ = "0.2.3"
from .helicalthread import HelicalThread, ThreadHelixes, helical_thread
| StarcoderdataPython |
1830438 | import turtle
import time
def quitfn():
turtle.bye()
if __name__=="__main__":
turtle.onkey(quitfn,'q') #call quit function when q key is pressed
turtle.title("Bharath's programming")
s = turtle.Screen()
t = turtle.Turtle()
t.goto(100,100) # Go to the given location
t.setpos(-100,100) #... | StarcoderdataPython |
9734175 | <reponame>Naidile/ML-LAB<filename>Find-s.py
import csv
#!usr/bin/python
#list creatin
hypo=['ɸ','ɸ','ɸ','ɸ','ɸ','ɸ'];
with open('Training_examples.csv') as csv_file:
readcsv = csv.reader(csv_file, delimiter=',')
print(readcsv)
data = []
print("\nThe given training examples are:")
for row in readcsv:
print(ro... | StarcoderdataPython |
341999 | <filename>ALTSCAN/scripts/removeTranscriptsFailingCrossMap.py
#!/usr/bin/env python
import re
import sys
import pdb
if (__name__ == "__main__"):
failed_loci = set()
with open(sys.argv[1],'r') as ip:
for line in ip:
line = line.strip()
if (line != ''):
try:
... | StarcoderdataPython |
5036839 | <reponame>PatrickRoot/six-site
"""
Copyright (c) [2019] [sixlab.cn]
[https://github.com/PatrickRoot/six-site] is licensed under the Mulan PSL v1.
You can use this software according to the terms and conditions of the Mulan PSL v1.
You may obtain a copy of Mulan PSL v1 at:
http://license.coscl.org.cn/MulanPSL
THIS S... | StarcoderdataPython |
12857638 | ## Module to obtain packet data from a pcap/dump file
## and save it in csv format using tshark.
## Filenames of input pcap files are taken from InputFiles.txt
## Tshark options are present in TsharkOptions.txt
## TsharkOptions.txt should not contain the -r option.
## usage: python FilterPackets.py
#import global con... | StarcoderdataPython |
6407932 | <gh_stars>1-10
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
# This script runs each of the example scripts. It acts as a system test.
import os
import pytest
def examples_path():
if not os.path.isdir("BIDS-NIRS-Tapping"):
os.system("git clone --depth 1 "
"https://github.com... | StarcoderdataPython |
1616984 | #!/usr/bin/env python3
import jsonschema
import especifico
from especifico.decorators.validation import RequestBodyValidator
from especifico.json_schema import Draft4RequestValidator
def echo(data):
return data
# via https://python-jsonschema.readthedocs.io/
def extend_with_set_default(validator_class):
v... | StarcoderdataPython |
9692299 | <reponame>gds101054108/MOC-Detector
import random
import numpy as np
import cv2
from .ACT_utils import iou2d
def random_brightness(imglist, brightness_prob, brightness_delta):
if random.random() < brightness_prob:
brig = random.uniform(-brightness_delta, brightness_delta)
for i in range(len(imglis... | StarcoderdataPython |
11318802 | # PPO implementation
# Based on the half-rainbow implementation,
# with Loss-cliping
# name and version information
NAME = "PPO"
VERSION = 2
# torch imports
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Variable
from torch.utils.tensorboard... | StarcoderdataPython |
1640787 | # coding: utf-8
import os
import urllib
from .generic_utils import readable_bytes
from .monitor_utils import progress_reporthook_create
from .print_utils import pretty_3quote
from ._colorings import toBLUE, toRED, toGREEN
# Use Specific Opener
opener = urllib.request.build_opener()
opener.addheaders=[('User-Agent','M... | StarcoderdataPython |
3475449 | <filename>servcttk/iotools.py
from pathlib import Path
import numpy as np
import cv2
import os
import errno
import json
def load_subpix_png(path, scale_factor=256.0):
"""load one channel images holding decimal information and stored as 16-bit
pngs and normalize them by scale_factor.
Args:
path... | StarcoderdataPython |
4877210 | <filename>classes/Maps.py
import numpy as np
from math import pow, tanh
from datetime import datetime
from perlin_noise import PerlinNoise
class Map:
"""
This shall be a very broad class with all tools necessary to create, tweak and modify maps.
Any future implementation of 3D maps will be done in a diffe... | StarcoderdataPython |
3377199 | import os
import requests
import json
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from django.db.models import Q
from scanner.models import Contact, Attendance, ParticipantStatusType
from scanner.conf import settings
CIVICRM_API_DRYRUN_ENVVAR = 'CIVICRM_API_DRY... | StarcoderdataPython |
44584 | <reponame>Sup3rGeo/allure-docx<gh_stars>10-100
from allure_docx.piechart import create_piechart
data = {
"broken": 1,
"failed": 2,
"skipped": 3,
"passed": 4,
}
create_piechart(data, "C:\\Users\\victo\\Desktop\\piechart.png") | StarcoderdataPython |
96870 | #==============================================================================
# provision.py
# This is API library for Exosite's One-Platform provision interface.
#==============================================================================
##
## Tested with python 2.6
##
## Copyright (c) 2011, Exosite LLC
## All r... | StarcoderdataPython |
5011274 | <filename>lib/galaxy/tool_shed/tool_dependencies/fabric_util.py
# For Python 2.5
from __future__ import with_statement
import os, shutil, tempfile
from contextlib import contextmanager
import common_util
from galaxy import eggs
import pkg_resources
pkg_resources.require('ssh' )
pkg_resources.require( 'Fabric' )
fro... | StarcoderdataPython |
3400088 | <reponame>sukantamaikap/pyRep<gh_stars>1-10
word_list = "word_play/sowpods.txt"
words = open(word_list).readlines()
# Get rid of the lowercase and new line
wordList = [word.lower().strip() for word in words]
scores = {"a": 1, "c": 3, "b": 3, "e": 1, "d": 2, "g": 2, "f": 4,
"i": 1, "h": 4, "k": 5, "j": 8, "m... | StarcoderdataPython |
1660314 | # Lint as: python3
# Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | StarcoderdataPython |
358664 | <gh_stars>0
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^community/$', views.community_statistics, name="community_statistics"),
url(r'^individual/$', views.individual_statistics, name="individual_statistics"),
] | StarcoderdataPython |
3511360 | <filename>nspmessage/apps.py
from django.apps import AppConfig
class NspmessageConfig(AppConfig):
name = 'nspmessage'
| StarcoderdataPython |
347231 | <reponame>AntonStange/rpaframework<filename>packages/main/src/RPA/Notifier.py
import logging
from notifiers import notify
class Notifier:
"""`Notifier` is a library interfacting with different notification providers.
**Supported providers**
- email
- gmail
- pushover
- slack
- telegram
... | StarcoderdataPython |
5116412 | <reponame>sublimationAC/DDE<filename>another/net_regress/cpu_net_regress.py
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 11 19:26:40 2019
@author: Pavilion
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 3 09:49:17 2019
@author: Pavilion
"""
import numpy as np
import torch
import torch.nn.func... | StarcoderdataPython |
8162156 | from flask import Flask, render_template
app = Flask(__name__)
@app.route("/")
def index():
names = ["Mohammed", "Yasmeen", "Ahmed", "Hams"]
return render_template("index.html", names=names)
if __name__ == "__main__":
app.run(debug=True)
| StarcoderdataPython |
12808699 | <gh_stars>1-10
"""Downloads Flickr8k dataset using the Kaggle API and sets up /assets
directory by creating train and val splits of the dataset.
"""
import sys
import json
import shutil
import argparse
import zipfile
import subprocess
from pathlib import Path
from rubrix import pathfinder
DATASET_ID = "adityajn105/f... | StarcoderdataPython |
6486401 | import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
BATCH_SIZE = 20
IMSIZE = (576, 576, 1)
LEARNING_RATE = 3e-4
EPOCHS = 500
label_encoder = {'ER': 0, 'NR': 1}
DATA_PATH = 'c:/MAIN FOLDER/idao dataset/idao_dataset/'
TRAIN_PATH = os.path.join(DATA_PATH, 'train')
PRIVATE_TEST_PATH = os.path.join(DATA_PATH,... | StarcoderdataPython |
4801132 | #!/usr/bin/python
# Copyright (c) 2014-2017 Oracle and/or its affiliates. All rights reserved.
#
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
#
# Script to make simple EDQ 12.2.1 domain
# ---------------------------------------
execfile("/u01/oracle/container-s... | StarcoderdataPython |
11397934 | <filename>aeg-analysis/main.py
import argparse
import logging
import importlib
import os
Commands = dict()
logger = logging.getLogger("aeg")
logger.setLevel(logging.DEBUG)
def create_parser():
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(dest='cmd', help='sub-command help')
comma... | StarcoderdataPython |
336819 | from stack_queue_brackets import __version__
from stack_queue_brackets.stack_queue_brackets import validate_brackets
def test_version():
assert __version__ == '0.1.0'
def test_validate_bracket1():
actual=validate_brackets('{}(){}')
expected=True
assert actual==expected
def test_validate_bracket2():... | StarcoderdataPython |
6547797 | #!/usr/bin/env python3
# type: ignore
import os
import argparse
import signal
import sys
import cereal.messaging as messaging
from cereal import log
from selfdrive.monitoring.hands_on_wheel_monitor import HandsOnWheelStatus
from selfdrive.controls.lib.events import Events
HandsOnWheelState = log.DriverMonitoringStat... | StarcoderdataPython |
5153869 | #!/usr/bin/env python
from distutils.core import setup
setup(name='Hadoop',
version='0.2',
description='Python Hadoop I/O Utilities',
license="Apache Software License 2.0 (ASF)",
author='<NAME> & <NAME>',
author_email='<EMAIL> & <EMAIL>',
url='http://hadoop.apache.org',
packa... | StarcoderdataPython |
1878798 | """Icy air Gibbs energy and related properties.
This module provides the Gibbs function for ice-saturated (icy) air and
related thermodynamic properties. The primary variables are the total
dry air fraction, temperature, and pressure. The 'total' fraction here
is the mass fraction of dry air in the total parcel (inclu... | StarcoderdataPython |
3211945 | import os
import requests
import json
from rich import print
from rich.console import Console
import webbrowser
from tqdm import tqdm
def clear():
if os.name == 'nt':
os.system("cls")
else:
os.system("clear")
def strip(x):
return x.strip()
def manually_filter(publications):
con... | StarcoderdataPython |
8095314 |
class Restaurant:
def __init__(self,restaurant_name , cuisine_type):
self.restaurant_name = restaurant_name
self.cuisine_type = cuisine_type
def describe_restaurant(self):
print('Restaurant name: {}'.format(self.restaurant_name))
print('Cuisine type: {}'.format(self.cuisi... | StarcoderdataPython |
8016669 | import json
from aiohttp import web
from marshmallow import ValidationError
from .utils import issubclass_py37fix
def get_apispec_schemas(request, handler, schemas_type):
orig_handler = request.match_info.handler
if hasattr(orig_handler, schemas_type):
return getattr(orig_handler, schemas_type)
... | StarcoderdataPython |
6541093 | <filename>automap/accuracy.py
import numpy as np
import math
# residuals
def distances(obsx, obsy, predx, predy, metric='eucledian'):
# to arrays
obsx = np.array(obsx)
obsy = np.array(obsy)
predx = np.array(predx)
predy = np.array(predy)
# calc distances
if metric == 'eucledian':
... | StarcoderdataPython |
296693 | from hadar_dashboard.dashboard import dashboard
import hadar as hd
# Dashboard use the same version than hadar
__version__ = hd.__version__
| StarcoderdataPython |
3313213 | """Common imports for generated dns client library."""
# pylint:disable=wildcard-import
import pkgutil
from googlecloudsdk.third_party.apitools.base.py import *
from googlecloudsdk.third_party.apis.dns.v1.dns_v1_client import *
from googlecloudsdk.third_party.apis.dns.v1.dns_v1_messages import *
__path__ = pkgutil.e... | StarcoderdataPython |
6468779 | <filename>sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2018_11_27_preview/models/_monitor_management_client_enums.py
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License... | StarcoderdataPython |
6461995 | <reponame>akashtalole/python-flask-restful-api<filename>app/api/helpers/mail.py<gh_stars>1-10
import base64
import logging
from datetime import datetime
from flask import current_app
from app import get_settings
from app.api.helpers.db import save_to_db
from app.api.helpers.files import make_frontend_url
from app.api... | StarcoderdataPython |
4829206 | <reponame>Joe-Doyle/moos-ivp-agent
#!/usr/bin/env python3
import argparse
import time
from mivp_agent.manager import MissionManager
from mivp_agent.util.math import dist
from mivp_agent.util.display import ModelConsole
from mivp_agent.aquaticus.const import FIELD_BLUE_FLAG
from constants import DEFAULT_RUN_MODEL
from... | StarcoderdataPython |
9702359 | <gh_stars>0
2 + 2
2.0 + 2.0
4.5e10 * 4.5e10
#addition
2 + 2
2.0 + 2.0
#multiplication
3 * 9
#division
5 / 3
6 / 3.0
5 // 3 #floor division
#modulo
5 % 3
#number systems
#AND OR XOR NOT
| StarcoderdataPython |
6562551 | <filename>discogui/draw.py
"""
drawing rectangles for debugging
"""
from PIL import Image, ImageDraw
from discogui.screenrect import ScreenRect
def draw_textrect(im, rect, text=None, color="red"):
"""
draw rectangle and text in center
"""
im = im.copy()
draw = ImageDraw.Draw(im)
draw.rectan... | StarcoderdataPython |
99804 | """
Test the high-level compile function
"""
import unittest
from six import StringIO
from lesscpy import compile
class TestCompileFunction(unittest.TestCase):
"""
Unit tests for compile
"""
def test_compile_from_stream(self):
"""
It can compile input from a file-like object
... | StarcoderdataPython |
9711562 | from Tile import tile
class copper (tile):
def __init__(self,parentWorld,colRow):
super().__init__(parentWorld,colRow,25,1)#parentWorld,colRow,tileID,z
self.durability = 45
self.drop = 13
self.lightBlock = 25
def setter(parentWorld, colRow):
x = copper(parentWorld, colRow)
... | StarcoderdataPython |
62035 | import datajoint as dj
if 'custom' not in dj.config:
dj.config['custom'] = {}
db_prefix = dj.config['custom'].get('database.prefix', '')
| StarcoderdataPython |
3392930 | import enum
import re
from marshmallow import ValidationError
from webargs.flaskparser import abort, parser
@enum.unique
class Status(enum.Enum):
"""API body response statuses."""
CREATED = "created"
SUCCESS = "success"
EXPIRED = "expired"
INVALID = "invalid"
ERROR = "error"
@parser.error_... | StarcoderdataPython |
8027725 | import unittest
from datetime import datetime, date
from t77_date import end_of_month
class EndOfMonthTestCase(unittest.TestCase):
def test_new_object(self):
"""end_of_month create a new object"""
now = datetime.now()
eom = end_of_month(now)
self.assertNotEqual(now, eom)
def ... | StarcoderdataPython |
1707220 | """
Provides Pydantic models for representing the JSON elements in the Mason standard
https://github.com/JornWildt/Mason/blob/master/Documentation/Mason-draft-2.md
From: https://github.com/joniumGit/pydantic-mason
"""
from datetime import datetime
from enum import Enum
from typing import Optional, Dict, List
from py... | StarcoderdataPython |
8076035 | import os
import sys
import pytest
import coverage
def add_core_package_to_path():
test_path = os.path.dirname(__file__)
core_relative_path = os.path.join(test_path, '..', 'app', 'core-service')
core_path = os.path.abspath(core_relative_path)
sys.path.insert(0, core_path)
def run_tests():
test... | StarcoderdataPython |
11375202 | <reponame>svdpuranik/python-hci<gh_stars>10-100
from struct import pack, unpack
from enum import IntEnum
from ..command_packet import CommandPacket
class HCI_EXT_OnePktPerEvt(CommandPacket):
class Control(IntEnum):
HCI_EXT_DISABLE_ONE_PKT_PER_EVT = 0x00
HCI_EXT_ENABLE_ONE_PKT_PER_EVT = 0x01
... | StarcoderdataPython |
8131961 | __author__ = 'ian'
import pandas as pd
import os
import fnmatch
def find_files(directory, pattern):
for root, dirs, files in os.walk(directory):
for basename in files:
if fnmatch.fnmatch(basename, pattern):
fullpath = os.path.join(root, basename)
yield fullpath... | StarcoderdataPython |
12827930 | import pytest
from indy import pool, error
# noinspection PyUnusedLocal
@pytest.mark.asyncio
@pytest.mark.parametrize("pool_handle_cleanup", [False])
async def test_close_pool_ledger_works(pool_handle, pool_handle_cleanup):
await pool.close_pool_ledger(pool_handle)
# noinspection PyUnusedLocal
@pytest.mark.asy... | StarcoderdataPython |
6486553 | <reponame>whitebeard4708/hackerrank
#!/bin/python3
import math
import os
import random
import re
import sys
def check_email(email):
pattern = "[a-z.]+(@gmail\\.com)$"
return re.match(pattern, email)
if __name__ == '__main__':
N = int(input())
proper_name = []
for N_itr in range(N):
firstN... | StarcoderdataPython |
14724 | <filename>foo/pictureR/wordsTemplate.py<gh_stars>100-1000
from PIL import Image, ImageDraw, ImageFont
from numpy import asarray
from cv2 import cvtColor, COLOR_RGB2BGR, imshow, waitKey
from os import getcwd
def getFontSize_name(resolution):
x = resolution[0]
if x <= 1024:
return (16, (1024,576))
el... | StarcoderdataPython |
11370394 | import smtplib
import pyrebase
config={
"apiKey": "<KEY>",
"authDomain": "golf-trail-8ae58.firebaseapp.com",
"databaseURL": "https://golf-trail-8ae58.firebaseio.com",
"projectId": "golf-trail-8ae58",
"storageBucket": "golf-trail-8ae58.appspot.com",
"messagingSenderId": "946041798814",
"appI... | StarcoderdataPython |
335877 | <reponame>aleksipirttimaa/unattended-ripping-playbooks
import re
from session import READING_TOC, RIPPING
def any_line_matches(r, lines):
for line in lines:
if re.search(r, line):
return True
return False
def search_first_matching_line(r, lines, group=None):
for line in lines:
... | StarcoderdataPython |
1804507 | <reponame>dsmits/scriptcwl<filename>tests/test_scriptcwl.py
from scriptcwl.scriptcwl import is_url
def test_is_url():
assert is_url('https://www.esciencecenter.nl/')
assert is_url('http://www.esciencecenter.nl/')
assert not is_url('file:///home/xxx/cwl-working-dir/test/cwl')
| StarcoderdataPython |
5185203 | <reponame>Carayolj/NetworkAttackSimulator<gh_stars>0
"""
For summarizing and displaying the results generating by evaluating trained agents
using agent_perf_exp.py
Specifically, displays mean episode timesteps and reward for each agent for a given
scenario
Timesteps and rewards are averaged over the number of evaluat... | StarcoderdataPython |
4991701 | <reponame>BrunoHarlis/Solucoes_LeetCode
# Fonte: https://leetcode.com/problems/substring-with-concatenation-of-all-words/
# Autor: <NAME>
# Data: 24/08/2021
"""
PROBLEMA PROPOSTO:
Você recebe uma string 's' e um array de strings 'words' do mesmo comprimento.
Retorne todos os índices iniciais de substring (s) em s que... | StarcoderdataPython |
5081954 | <filename>hardware/testbenches/node/nx_node_core/testbench/testcases/execute.py
# Copyright 2021, <NAME>, mailto:<EMAIL>
#
# 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.... | StarcoderdataPython |
3396089 | # Crie um programa que leia nome e duas notas de vários alunos e guarde tudo em uma lista composta. No final,
# mostre um boletim contendo a média de cada um e permita que o usuário possa mostrar as notas de cada aluno
# individualmente.
record = []
s = 0
while True:
print('-'*30)
name = str(input(f'Aluno ... | StarcoderdataPython |
3304045 | <filename>epitran/download.py
import os
import requests
import gzip
CEDICT_URL='https://www.mdbg.net/chinese/export/cedict/cedict_1_0_ts_utf-8_mdbg.txt.gz'
def get_dir():
data_dir = os.path.expanduser('~/epitran_data/')
os.makedirs(data_dir, exist_ok=True)
return data_dir
def get_cedict_file():
retur... | StarcoderdataPython |
1822372 | <gh_stars>0
from random import choice
class RandomWalk():
"""class to generate random walks."""
def __init__(self, num_points=5000):
"""Initialize attributes of a walk"""
self.num_points = num_points
#All walks start from (0, 0)
self.x_values = [0]
self.y_values = [0]... | StarcoderdataPython |
253434 | from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect
from encomenda.models import Encomenda
from encomenda.forms import EncomendaForm
def encomendar(request):
args = {}
if request.method == 'POST':
form = EncomendaForm(request.POST)
... | StarcoderdataPython |
5136537 | class Node:
def __init__(self, key, value):
self.child = [None, None]
self.parent = None
self.size = 1
self.key = key
self.value = value
class Splay:
def __init__(self, limit=10000):
self.root = None
self.limit = limit
def breakLink(self, x):
... | StarcoderdataPython |
8183330 | <filename>athenatools/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-10-24 23:50
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
init... | StarcoderdataPython |
6494783 | from .resource import Canary # noqa: F401
| StarcoderdataPython |
4846137 | <filename>cloudservice/resources.py
# -*- coding: utf-8 -*-
#
# The contents of this file are subject to the terms listed in the LICENSE file you received with this code.
#
# Project: Atmosphere, iPlant Collaborative
# Author: <NAME>
# Twitter: @seungjin
# GitHub: seungjin
#
from django.http import HttpResponse
from ... | StarcoderdataPython |
9603119 | <filename>pyci/tests/shell/commands/test_release.py
#############################################################################
# Copyright (c) 2018 <NAME>. 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 ... | StarcoderdataPython |
3251089 | from ds_queue.dsqueue import DsQueue
from linkedList.singleLLNode import Node
class Graph:
def __init__(self, adjList):
self.adjList = adjList
self.color = ['white' for i in range(len(self.adjList))]
self.predecessor = [None for i in range(len(self.adjList))]
self.distance = [0 for... | StarcoderdataPython |
3363763 | # Author: <NAME>
# Approach:
# Counting sort, like radix sort and bucket sort,
# is an integer based algorithm (i.e. the values of the input
# array are assumed to be integers). Hence counting sort is
# among the fastest sorting algorithms around, in theory. The
# particular distinction for counting sort is tha... | StarcoderdataPython |
6646197 | <reponame>SaTa999/PyKrige
from .latinhypercube import * | StarcoderdataPython |
6542027 | <filename>projet5.py
#poblem 5 <NAME>, the solution made sense to me, but i did not come up with it- https://www.youtube.com/watch?v=EMTcsNMFS_g
def prob5():
i=20
while 1:
i+=20
if i%11==0 and i%12==0 and i%13==0 and \
i%14==0 and i%15==0 and i%16==0 and \
i%17==0 and i... | StarcoderdataPython |
3512187 | <reponame>Shecspi/Running-Alien
# Running Alien v.0.3
#
# Copyright © 2020 <NAME> (<EMAIL>)
# Licensed under the Apache License, Version 2.0
""" Draws some menu on the screen.
This class has three public method:
'display_start_menu' to display start menu;
'display_pause_menu' to display pause menu;
'di... | StarcoderdataPython |
8035028 |
import numpy as np
import cv2
#-- read pixels to ndarray
im0 = cv2.imread('../images/img001.png')
#-- pixel operation
width = im0.shape[1]
height = im0.shape[0]
alpha = np.tile( np.linspace(0, 255, width), (height,1) )
im3f = np.dstack((im0, alpha))
#-- save to png
cv2.imwrite('z230.png', im3f)
| StarcoderdataPython |
11325512 | <gh_stars>1-10
# pyOCD debugger
# Copyright (c) 2021 <NAME>
# SPDX-License-Identifier: Apache-2.0
#
# 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 |
3420839 | <reponame>diegojromerolopez/djanban
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-02-24 19:18
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('members', '0015_member_de... | StarcoderdataPython |
1662641 | <reponame>jonathan-taylor/l0bnb
from copy import deepcopy
import numpy as np
from ..relaxation import cd_solve, l0gurobi, l0mosek
from ._utils import upper_bound_solve
class Node:
def __init__(self, parent, zlb: list, zub: list, **kwargs):
"""
Initialize a Node
Parameters
------... | StarcoderdataPython |
6623560 |
import StringIO
from datetime import datetime
import smtplib
import traceback
from scrapy import signals
from scrapy import log
from nrc import settings
class FailLogger(object):
@classmethod
def from_crawler(cls, crawler):
ext = cls()
crawler.signals.connect(ext.spider_error, signal=signa... | StarcoderdataPython |
6463209 | <filename>py/airflow_test.py<gh_stars>1-10
"""Unittest for airflow."""
import datetime
import unittest
import mock
from py import airflow
class AirflowTest(unittest.TestCase):
@mock.patch('py.airflow.prow')
@mock.patch('py.airflow.wait_for_tf_k8s_tests')
@mock.patch('py.airflow.trigger_tf_k8s_tests_dag')
de... | StarcoderdataPython |
1905997 | <reponame>pathbreak/linode-cluster-toolkit
import importlib
from lct.utils.dpath_utils import dpath_get
from lct.utils.dynamic_class_loader import instantiate
class SecretsService(object):
'''
Interface for storing and querying secrets such as API keys,
passwords or SSH private keys.
This service ... | StarcoderdataPython |
5024771 | <gh_stars>0
""" Thermodynamics routine using definitions based on the work by
<NAME> Kuang (2010), but with specific humidities rather than
mixing ratios.
"""
import numpy as np
import xarray as xr
cpd = 1005.7 # specific heat at constant pressure (dry air).
cpv = 1870.0 # specific heat at constant pressure (vapour)... | StarcoderdataPython |
3504782 | <reponame>josemanimala/lint-review
from __future__ import absolute_import
import logging
import os
import re
import lintreview.docker as docker
from lintreview.tools import Tool
log = logging.getLogger(__name__)
# matches: ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint'
# mat... | StarcoderdataPython |
340475 | # Copyright 2014 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.
from telemetry.page import page as page_module
from telemetry import story
class ToughFiltersCasesPage(page_module.Page):
def __init__(self, url, page_se... | StarcoderdataPython |
1702858 | <reponame>rudolfwilliam/higher_order_adversarial_robustness
from utils.config import CIFAR_CONFIG
from main import train_CURE
from parameter_tuning import objective_CURE, objective_find_best_lambdas, tune_hyperparameters
import json
from pathlib import Path
def store_config(config, file_name):
"""
Stores a co... | StarcoderdataPython |
1828424 | # (c) 2017 <NAME>
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.patches import Rectangle
import nanopores
from find_binding_probability import (binding_prob,
binding_prob_from_data, invert_monotone)
# load data
P2 = np.linspace(0, 1, 100)
P2a = P2[P2 > 0.... | StarcoderdataPython |
3384706 | <reponame>thb1314/MQBench
import onnx
import numpy as np
from onnx import numpy_helper
from collections import namedtuple
from typing import Any, Dict, Optional
from functools import partial
from nndct_shared.base import NNDCT_OP
from nndct_shared.nndct_graph.base_tensor import Tensor
from nndct_shared.utils import ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.