id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3440812 | <gh_stars>0
import pyfiglet
result = pyfiglet.figlet_format('LETS START')
print(result)
| StarcoderdataPython |
11301743 | """
Copyright 2015 <NAME>
Licensed under MIT (https://github.com/brianquach/udacity-nano-fullstack-movie-trailer/blob/master/LICENSE) # noqa
"""
import fresh_tomatoes
import media
def get_movie_list():
"""Fetches a list of movie objects.
Returns:
A list of movie objects; each movie object represents... | StarcoderdataPython |
199411 | <reponame>SorosWen/cs501-t1-assessment<gh_stars>0
from flask import Blueprint, request, make_response, jsonify
from flask.views import MethodView
from project.server import bcrypt, db
from project.server.models import User
user_index_blueprint = Blueprint('users', __name__)
class UserIndexAPI(MethodView):
"""
... | StarcoderdataPython |
198050 | <filename>generateData/constants.py
ACCOUNT_TYPES = [
'Cuenta de ahorro',
'Cuenta vista',
'Cuenta corriente',
'Cuenta rut',
]
BANK_NAMES = [
'BANCO DE CHILE/EDWARDS CITI',
'BANCO ESTADO',
'SCOTIABANK',
'BCI',
'CORPBANCA',
'BICE',
'HSBC',
'SANTANDER',
'ITAU',
'TH... | StarcoderdataPython |
23738 | from typing import Optional
from pydantic import BaseModel, root_validator, validator
from fief.crypto.encryption import decrypt
from fief.db.types import DatabaseType
from fief.errors import APIErrorCode
from fief.schemas.generics import UUIDSchema
from fief.settings import settings
def validate_all_database_setti... | StarcoderdataPython |
11303661 | <gh_stars>0
import numpy as np
from .agent import Agent
class UCB(Agent):
"""
Emulates the EGreedy algorithm described in 'Adversarial Attacks
Against Multi-Armed Bandits'
"""
def __init__(self, n_arms, sigmas):
"""
"""
super().__init__()
if n_arms<2:
rai... | StarcoderdataPython |
5109907 | <reponame>zanachka/autoextract-poet
import attr
import pytest
from autoextract_poet.items import (
GTIN,
AdditionalProperty,
Address,
Area,
Article,
ArticleFromList,
ArticleList,
AvailableAtOrFrom,
Breadcrumb,
Comment,
Comments,
ForumPost,
ForumPosts,
FuelEfficie... | StarcoderdataPython |
1743386 | #
# Copyright (c) 2013-2022 Contributors to the Eclipse Foundation
#
# See the NOTICE file distributed with this work for additional information regarding copyright
# ownership. All rights reserved. This program and the accompanying materials are made available
# under the terms of the Apache License, Version 2.0 whic... | StarcoderdataPython |
1762985 | <filename>helpers/draw.py
# Copyright 2019 D-Wave Systems Inc.
# 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 re... | StarcoderdataPython |
1998192 | from django.urls import path
from django.conf.urls import url
from voucher.views import VoucherDetail, CreateVoucherList, upload_email_list, upload_code_list, CreateOrganizationInVoucherList, VoucherTypeList
urlpatterns = [
path('voucher/', CreateVoucherList.as_view()),
path('voucher/addEmails/', upload_email... | StarcoderdataPython |
1675511 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import unittest
from unittest import mock
from pastepwn.actions.basicaction import BasicAction
from pastepwn.analyzers.bcrypthashanalyzer import BcryptHashAnalyzer
class TestBcryptHashAnalyzer(unittest.TestCase):
def setUp(self):
self.analyzer = BcryptHashAnalyz... | StarcoderdataPython |
3401600 | <gh_stars>0
class Stack:
def __init__(self):
self.items =[]
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def is_empty(self):
return self.items == []
def peek(self):
if not self.is_empty():
return self.ite... | StarcoderdataPython |
1897665 | <reponame>zzz0906/LeetCode
import bisect
from sortedcontainers import SortedList
class Solution:
def createSortedArray(self, instructions: List[int]) -> int:
"""O(NlogN) / O(N)"""
ans = 0
sorted_insts = SortedList()
for inst in instructions: # O(N)
l = sorted_insts.bis... | StarcoderdataPython |
8102209 | <reponame>nebulae/ntntn.io<filename>app/src/handlers.py
import os
import webapp2
import jinja2
import json
import logging
import datetime
from time import mktime
from google.appengine.api import users
from google.appengine.api import images
from google.appengine.api import search
from google.appengine.ext import ndb
... | StarcoderdataPython |
5024397 | <reponame>clach04/reviewboard<gh_stars>1-10
from django import forms
def validate_users(form, field='users'):
"""Validates that the users all have valid, matching LocalSites.
This will compare the LocalSite associated with the form to that of
each added User. If the form has a LocalSite set, then all Use... | StarcoderdataPython |
3399700 | <gh_stars>0
import single_coin_toss
def batch_toss_coins(batch_size):
heads_count = 0
for i in range(batch_size):
heads = single_coin_toss.toss_coin()
if heads:
heads_count = heads_count + 1
return heads_count | StarcoderdataPython |
3550975 | from os import getcwd
from os.path import join as pathjoin
from sciunit import settings as sciunit_settings
from cognibench.settings import settings
import sys
import os
sys.path.insert(0, os.getcwd())
from model_defs import PsPMModel
from libcommon import util
settings["CRASH_EARLY"] = True
sciunit_settings["CWD"] =... | StarcoderdataPython |
5100856 | <filename>test/test_hsm.py
from unittest import TestCase
from mock import patch, call
from flock.hsm import Hsm, HsmState
class TestHsm(Hsm):
class BaseState(HsmState):
def on_data(self, hsm, data):
return self
class State1(BaseState):
def on_data(self, hsm, data):
hsm... | StarcoderdataPython |
3425539 | <reponame>lordkyzr/launchkey-python
import unittest
from mock import patch
from formencode import Invalid
from datetime import datetime
from launchkey.exceptions import AuthorizationInProgress
class TestAuthorizationInProgressException(unittest.TestCase):
def setUp(self):
self.warnings_patch = \
... | StarcoderdataPython |
5141143 | # https://towardsdatascience.com/scraping-table-data-from-pdf-files-using-a-single-line-in-python-8607880c750
import tabula
infile_name ='/Users/craig/Documents/GEORGIAN-MEGRELIAN-LAZ-SVAN-ENGLISH_DICTIONARY.pdf'
table = tabula.read_pdf(infile_name,pages=1)
table[0]
| StarcoderdataPython |
9781707 | <gh_stars>0
import heterocl as hcl
import numpy as np
import time
import math
#import plotly.graph_objects as go
from compute_graphs.custom_graph_functions import *
from plots.plotting_utilities import *
from user_definer import *
from argparse import ArgumentParser
from compute_graphs.graph_3d import *
from compute_g... | StarcoderdataPython |
3265242 | # coding: utf-8
from __future__ import print_function, unicode_literals
import sys
import signal
import threading
from .broker_util import ExceptionalQueue
from .httpsrv import HttpSrv
from .util import FAKE_MP
from copyparty.authsrv import AuthSrv
class MpWorker(object):
"""one single mp instance"""
def _... | StarcoderdataPython |
6655703 | <gh_stars>0
import flask
from flask import request, jsonify
app = flask.Flask(__name__)
app.config["DEBUG"] = True
testdata = [
{
"date_of_news": "February 23, 2018",
"title": "nGen_LUX is here",
"hyperlink": "https://learn.colorfabb.com/ngen_lux-is-here/",
"organizations_entity": ... | StarcoderdataPython |
8018806 | from .gradient_descent import gradient_descent
from .optimizer import optimizer
| StarcoderdataPython |
9684328 | <reponame>windowssocket/py_leetcode
# refer to https://leetcode.com/problems/multiply-strings/discuss/17605/Easiest-JAVA-Solution-with-Graph-Explanation
class Solution(object):
def multiply(self, num1: str, num2: str) -> str:
# corner case
if len(num1) == 0 or len(num2) == 0:
return '0... | StarcoderdataPython |
5142024 | <reponame>arkadeepnc/Visual-6-DoF-pose-tracker<filename>src/DoDecahedronUtils.py
#Used this code to confirm that the tvec and rvec given by the
# estimatePoseSingleMarkers is of the marker frame wrt the camera frame
# from __future__ import division
import numpy as np
from numpy import linalg as LA
import cv2
impor... | StarcoderdataPython |
3598487 | #
# This file is subject to the terms and conditions defined in the
# file 'LICENSE', which is part of this source code package.
#
# Copyright (c) 2019 <NAME> - All Rights Reserved.
#
import unittest
from salty_orm.db.model import Max, Min, Count, Sum
from salty_orm.db.mysql_provider import MySQLDBConnection
from salt... | StarcoderdataPython |
8105208 | <filename>paprika/restraints/openmm.py
"""A module aimed at applying restraints directly to OpenMM systems."""
import logging
import numpy as np
import openmm as openmm
import openmm.unit as openmm_unit
import parmed as pmd
from openff.units import unit as pint_unit
from openff.units.simtk import to_simtk
logger = lo... | StarcoderdataPython |
11348157 | import pytest
from server.app import create_application
import sys
from os import getcwd
sys.path.append(getcwd())
@pytest.fixture
def app():
app = create_application()
yield app
@pytest.fixture
def server(loop, app, sanic_client):
return loop.run_until_complete(sanic_client(app))
async def test_index... | StarcoderdataPython |
3393293 | """
URLConf for Satchmo Newsletter app
Recommended usage is to use a call to ``include()`` in your project's
root URLConf to include this URLConf for any URL beginning with
'/newsletter/'.
"""
from django.conf.urls.defaults import *
urlpatterns = patterns('satchmo.newsletter.views',
(r'^subscribe/$', 'add_subsc... | StarcoderdataPython |
5123309 | # Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | StarcoderdataPython |
272722 | <filename>nicos_sinq/gui/panels/live.py
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redist... | StarcoderdataPython |
9631894 | # -*- coding: utf-8 -*-
# Copyright (c) 2017. Mount Sinai School of Medicine
#
# 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 req... | StarcoderdataPython |
1807116 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
-------------------------------------------------------------------------------
@Name: __init__.py
@Desc:
@Author: <EMAIL>
@Create: 2020.08.02 14:51
-------------------------------------------------------------------------------
@Change: ... | StarcoderdataPython |
1874528 | <gh_stars>1-10
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import QObject, pyqtSlot
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbarfrom
class Ui_Ma... | StarcoderdataPython |
3202702 | # 0CD - Quality of life utlities for obsessive compulsive CTF enthusiasts
# by b0bb (https://twitter.com/0xb0bb)
from binaryninja import PluginCommand, Settings
from .modules import stackguards
settings = Settings()
settings.register_group("0cd", "0CD")
settings.register_setting("0cd.stackguards.var_name", """
{
... | StarcoderdataPython |
3419350 | <gh_stars>0
from django.shortcuts import render,redirect
from .models import empresa,aboutme,skill,servicio,comments,categorias,proyectos
from .forms import ContactoForm,MensajeForm
# Create your views here.
def Hola(request):
miFormulario = MensajeForm(request.POST or None)
if miFormulario.is_valid():
for valor ... | StarcoderdataPython |
3552115 | <reponame>gpdev001/pawn
import frappe
from frappe.utils import formatdate, cint
def customer_validate(customer, method):
set_customer_no(customer)
def set_customer_no(customer):
if not customer.customer_no:
branch_code = frappe.db.get_value('Branch', customer.branch, 'branch_code')
count = ci... | StarcoderdataPython |
9715566 | <filename>morepath/toposort.py<gh_stars>0
"""Topological sort functionality.
"""
from dectate import topological_sort
def toposorted(infos):
"""Sort infos topologically.
Info object must have a ``key`` attribute, and ``before`` and ``after``
attributes that returns a list of keys. You can use :class:`Inf... | StarcoderdataPython |
6671344 | class Module():
def __init__(self, name):
self.name = name
def add_data(self, row):
raise NotImplementedError
def print_data(self, indent=0):
raise NotImplementedError
def get_property(self, name):
raise NotImplementedError
# Should return an iterable of tuple... | StarcoderdataPython |
1818343 | s=input()
print(s.count("cat"))
| StarcoderdataPython |
9698409 | # -*- coding: utf-8 -*-
import yfinance as yf
import pandas as pd
from datetime import datetime
from pathlib import Path
import logging
from tashares.cfg import config
logging.basicConfig(format='%(asctime)s %(levelname)s:%(message)s',
level=logging.INFO,
datefmt='%m/%d/%Y %I:%M... | StarcoderdataPython |
9759781 | from nbcheckorder import are_cells_sequential
import pytest
from pathlib import Path
TESTS_DIR = Path(__file__).parent
@pytest.mark.parametrize("filename,expected_result",
(
(TESTS_DIR / 'dirty_order.ipynb', False),
(TESTS_DIR / 'clean_order.ipynb', True),
))
def test_are_cells_sequential(filename, expecte... | StarcoderdataPython |
11300260 | # **args
def save_user(**user):
print(user["name"])
save_user(id=1, name='Sohail', email='<EMAIL>')
# arbitrary keyword arguments instead of arbitrary arguments
# o/p -> {'id': 1, 'name': 'Sohail', 'email': '<EMAIL>'} -> key : value
# the object we see here is called dictionary
| StarcoderdataPython |
6528226 | pietra = 0
for x in range(1, 7):
livy = int(input('digite a sua idade '))
if livy < 18:
print('você não está na maior idade ainda')
else:
pietra = pietra + 1
print('você está na maior idade')
print('o número de pessoas q estão na maior idade é igual a {}'.format(pietra)) | StarcoderdataPython |
3489203 | from setuptools import setup
setup(
name='to_tty',
author='Hixan',
author_email='<EMAIL>',
version='1.0.1',
py_modules=['to_tty'],
install_requires=['Click', 'to_tty'],
entry_points = '''
[console_scripts]
to-tty=to_tty:main
'''
)
| StarcoderdataPython |
5079784 | from lagury.service.core import start_service
if __name__ == '__main__':
start_service()
| StarcoderdataPython |
12861806 | #!/usr/bin/env python
import datetime
import os
import subprocess
import re
import urllib2
import math
####################################################################
## TODO: Replace this function by another one, which simply reads all lines from a file
#########################################################... | StarcoderdataPython |
3526728 | import contextlib
import re
import subprocess
from array import array
def run(cmd, **kwargs):
return subprocess.run(cmd, check=True, **kwargs)
def invoke(cmd, **kwargs):
try:
return run(cmd, **kwargs, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="UTF-8")
except subprocess.CalledProce... | StarcoderdataPython |
8085318 | from sentence_transformers import SentenceTransformer, util
model = SentenceTransformer('paraphrase-distilroberta-base-v1')
sentences1 = ['playlist',
'A man is playing guitar',
'The new movie is awesome']
sentences2 = ['playlist',
'A woman watches TV',
'The new mo... | StarcoderdataPython |
1829725 | #!/usr/bin/python3
"""
This script allows you to view ONE of the graphs relatively quickly, mostly for debugging the graph generators.
"""
import logging
import pygame
import sqlite3
import sys
import time
import config
import dataaccess
import graphics
__author__ = '<NAME>, N1KDO'
__copyright__ = 'Copyright 2016, ... | StarcoderdataPython |
6462141 | import unittest
import time
from scanpointgenerator import LineGenerator, CompoundGenerator
from malcolm.core import Process, Part, Context, AlarmStatus, \
AlarmSeverity, AbortedError
from malcolm.modules.scanning.parts import RunnableChildPart
from malcolm.modules.demo.blocks import ticker_block
from malcolm.com... | StarcoderdataPython |
8197971 | <filename>aliyun/log/es_migration/migration_task.py<gh_stars>0
#!/usr/bin/env python
# encoding: utf-8
# Copyright (C) Alibaba Cloud Computing
# All rights reserved.
import os
import os.path as op
import json
import traceback
from datetime import datetime
from elasticsearch.exceptions import NotFoundError
from aliyu... | StarcoderdataPython |
3271125 | # This is Jim's example code for making a plot of an adsorption isotherm
import matplotlib.pyplot as pyplot
import numpy as np
xmin=0
xmax=2.5
K=10
n=2
x=np.linspace(xmin,xmax,50, endpoint=True)
y=np.divide(K*np.power(x,n),(1+K*np.power(x,n)))
pyplot.plot(x,y)
pyplot.axis([xmin,xmax,0,2])
pyplot.show()
| StarcoderdataPython |
8138947 | <reponame>oxquantum/CVAE_for_QE<gh_stars>1-10
import os
import numpy as np
import tensorflow as tf
import pickle # to load model definition
from CVAE_type1 import CVAE_type1
from CVAE_type2 import CVAE_type2
from CVAE_contextloss_model import CVAE_contextloss
import data_feeder_tf
import test_and_plot as test
impor... | StarcoderdataPython |
1726597 | <reponame>ragnarok22/contactbot
from telegram.ext import Updater, CommandHandler, ConversationHandler, CallbackQueryHandler, MessageHandler, Filters
import callbacks
import constants
import conversations
from commands import start, cancel
from settings import TELEGRAM_KEY
from db import start_db
if __name__ == '__mai... | StarcoderdataPython |
291324 | """This module is for learning
This module has basic functions to work with numbers
"""
def is_even(number: int) -> bool:
"""
This method will find if the number passed is even or not
:param number : a number
:return: True if even False otherwise
"""
if number <= 0:
return False
... | StarcoderdataPython |
3451701 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Fri May 08 10:50:00 2020
@author: <NAME>
"""
import numpy as np
class Electrolyte:
def __init__(self, lambdaEq=10.53e-3):
self.lambdaEq = lambdaEq
class Reservoir:
def __init__(self, volume, concentration, electrolyte=Electrolyte()):
self.v... | StarcoderdataPython |
11346563 | <gh_stars>0
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> mat = True
>>> print mat
[DEBUG ON]
>>>
[DEBUG OFF]
>>>
| StarcoderdataPython |
4811158 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 <EMAIL>
# Licensed under the MIT license (http://opensource.org/licenses/MIT)
from __future__ import absolute_import, division, print_function, unicode_literals
from keyplus.version import __version__
IS_PRE_RELASE = ('pre' in __version__)
class DEBUG(o... | StarcoderdataPython |
11323370 | from typing import Dict, List, Set
from unittest import mock
import pandas as pd
import pytest
import great_expectations.exceptions as ge_exceptions
from great_expectations.core.batch import (
Batch,
BatchDefinition,
BatchMarkers,
BatchRequest,
)
from great_expectations.core.id_dict import BatchSpec, ... | StarcoderdataPython |
161618 | from django.shortcuts import render
from .models import *
from django.db.models import Q,F,Aggregate
from django.http import HttpResponse, HttpResponseRedirect, QueryDict, JsonResponse
from django.urls import reverse
from django.template import loader
# Create your views here.
def game(req):
return render(req,'2048... | StarcoderdataPython |
5029165 |
age = 36
if age < 2:
stage = 'a baby'
elif age < 4:
stage = 'a toddler'
elif age < 13:
stage = 'a kid'
elif age < 20:
stage = 'a teenager'
elif age < 65:
stage = 'an adult'
else:
stage = 'an elder'
print('The person is ' + stage)
| StarcoderdataPython |
30909 | #!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_nutnrb
@file marine-integrations/mi/dataset/parser/test/test_nutnrb.py
@author <NAME>
@brief Test code for a Nutnrb data parser
"""
import unittest
import gevent
from StringIO import StringIO
from nose.plugins.attrib import attr
from mi.core.log import g... | StarcoderdataPython |
6603453 | <gh_stars>0
p = float(input('Digite o seu peso: '))
a = float(input('Digite sua altura: '))
imc = p/a**2
if imc < 18.5:
print('Abaixo do peso!')
elif 18.5 <= imc < 25:
print('Peso ideal!')
elif 25 <= imc < 30:
print('Sobrepeso!')
elif 30 <= imc < 40:
print('Obesidade!')
else:
print('Obesidade mórbid... | StarcoderdataPython |
12815642 | <filename>tests/stdlib/test_time.py
import os
from unittest import expectedFailure
from ..utils import TranspileTestCase
class TimeModuleTests(TranspileTestCase):
#######################################################
# _STRUCT_TM_ITEMS
@expectedFailure
def test__STRUCT_TM_ITEMS(self):
self... | StarcoderdataPython |
8133278 | import datetime
from numbers import Number
from typing import Callable, Iterator, TypeVar, Optional, Union, Type
E = TypeVar('E')
def _range(lower: E, step: Callable[[E], E], condition: Callable[[E], bool]) -> Iterator[E]:
"""
Very generic range function. Yields a stream from lower, incremented by the given... | StarcoderdataPython |
232464 | <filename>python_binding/rdc_collectd.py
from RdcReader import RdcReader
from rdc_bootstrap import *
import collectd
default_field_ids = [
rdc_field_t.RDC_FI_GPU_MEMORY_USAGE,
rdc_field_t.RDC_FI_GPU_MEMORY_TOTAL,
rdc_field_t.RDC_FI_POWER_USAGE,
rdc_field_t.RDC_FI_GPU_CLOCK,
rdc_... | StarcoderdataPython |
4914341 | <gh_stars>0
#!/usr/bin/python3
# Importing Modules
# DATA analysis modules
import numpy as np
from scipy.optimize import curve_fit
from uncertainties import ufloat as uf
from uncertainties import unumpy as unp
# Custom functions
from timescan_plot import timescanplot
# Felion Modules
from FELion_definitions import ... | StarcoderdataPython |
3477160 | <filename>temp_sikdan.py
def hooseng_temp(check_date):
if check_date == '0416':
menu_list = [
"""
뚝배기 11:00~18:30\n
돌솥치즈부대찌개+라면사리
쌀밥
탕수육
깍두기
요거타임\n
가격 : 3,500
""",
"""
일품1 10:30~18:30\n
비스트로등심돈까스
아채스프
비트샐러드/드레싱
깍두기\n
가격 : 2,700
""",
"""
일품2 10:30~18:30\n
대학생협치즈돈까스
아채스프
비트샐러드/드레싱
웨지감자
깍두기
요구르트\n
가격 : 3,500
"... | StarcoderdataPython |
96608 | <gh_stars>1000+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Unit tests for Amazon DynamoDB batching code example.
"""
import time
import unittest.mock
from botocore.exceptions import ClientError
import pytest
import dynamo_batching
@pytest.mark.para... | StarcoderdataPython |
27374 | """
one agent chooses an action, says it. other agent does it. both get a point if right
this file was forked from mll/discrete_bottleneck_discrete_input.py
"""
import torch
import torch.nn.functional as F
from torch import nn, optim
# from envs.world3c import World
from ulfs import alive_sieve, rl_common
from ulfs.s... | StarcoderdataPython |
1836618 | <reponame>CyberFlameGO/wikidetox<gh_stars>10-100
r"""Dataflow Main.
Copyright 2017 Google Inc. 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... | StarcoderdataPython |
1639603 | #coding:utf-8
import requests
import os
import lxml.html
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
#创建浏览器对象
# browser = webdriver.PhantomJS(service_args=SERVICE_AR... | StarcoderdataPython |
9612835 | from typing import Optional
import argparse
import spacy
import importlib
from thinc.api import require_gpu
from scispacy.data_util import read_full_med_mentions, read_ner_from_tsv
from scispacy.train_utils import evaluate_ner
def main(model_path: str, dataset: str, output_path: str, code: Optional[str], med_menti... | StarcoderdataPython |
3218088 | import zmq
from queuer.topics import get_port_by_topic
# context = zmq.Context()
# socket = context.socket(zmq.SUB)
# socket.connect("tcp://localhost:5555")
class Subscriber:
def __init__(self, topic):
self.context = zmq.Context()
self.socket = self.context.socket(zmq.SUB)
port = get_por... | StarcoderdataPython |
11317836 | import os,sys
sys.path.append(r'./commonModule')
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' #close tf debug info
import numpy as np
import argparse
from commonModule.ImageBase import *
from commonModule.mainImagePlot import plotImagList
from mainTrainning import loadModel
#-----------------------------------------------... | StarcoderdataPython |
9775038 | <reponame>chromium/chromium
# python3
# Copyright 2021 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 re
import unittest
from lib import compiler
class CompilerTestCase(unittest.TestCase):
def assertListSort... | StarcoderdataPython |
5180545 | def build_shift_dict(shift):
try:
assert shift>= 0 and shift < 26
assert type(shift) == int
except AssertionError:
print('Error, Shift key must be an integer from 0 to 26 excluding 26')
except:
print('An error has occured with the shift type')
... | StarcoderdataPython |
6557411 | <gh_stars>1-10
"""
This problem was asked by Google.
Given an undirected graph represented as an adjacency matrix and an integer k,
write a function to determine whether each vertex in the graph can be colored
such that no two adjacent vertices share the same color using at most k colors.
"""
# creates a 2 object li... | StarcoderdataPython |
11777 | """
Environment for basic obstacle avoidance controlling a robotic arm from UR.
In this environment the obstacle is only moving up and down in a vertical line in front of the robot.
The goal is for the robot to stay within a predefined minimum distance to the moving obstacle.
When feasible the robot should continue to... | StarcoderdataPython |
3397938 | # Generated by Django 2.2 on 2020-03-26 16:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0002_auto_20200326_1918'),
]
operations = [
migrations.RenameModel(
old_name='Acceptor',
new_name='Accepts',
... | StarcoderdataPython |
5168755 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-19 22:33
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0021_game_treasury_shares_pay'),
]
operati... | StarcoderdataPython |
11356396 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from . import check_token, _query_nodeping_api, config
API_URL = config.API_URL
def get_results(token,
check_id,
customerid=None,
span=None,
limit=300,
start=None,
end=None,
... | StarcoderdataPython |
6602539 | <filename>venv/lib/python2.7/site-packages/nano-1.0a3-py2.7.egg/nano/user/tests.py<gh_stars>0
from django.utils.timezone import now as tznow
from django.test import TestCase
from... | StarcoderdataPython |
8118596 | import numpy as np
def compute_cost(A, Y):
m = Y.shape[1]
logprobs = np.multiply(-np.log(A), Y) + np.multiply(-np.log(1 - A), 1 - Y)
costs = 1./m * np.sum(logprobs)
return costs
# =============================================================================================== #
# ... | StarcoderdataPython |
5168792 | from django.shortcuts import redirect
from django.urls import reverse
from django.http import JsonResponse
from functools import wraps
from django.conf import settings
def auth_required(forid):
def realone(func):
@wraps(func)
def _wrapped_view(request, *args, **kw):
if reque... | StarcoderdataPython |
8028523 | import logging
from discord.ext import commands
from discord.ext.commands import Context
from cogbot import checks
from cogbot.cog_bot import CogBot
log = logging.getLogger(__name__)
class Say:
def __init__(self, bot):
self.bot: CogBot = bot
@checks.is_manager()
@commands.command(
pass... | StarcoderdataPython |
128491 | import mysql.connector
from contextlib import closing
with closing(mysql.connector.connect(
host="localhost",
port=3306,
user="root",
password="<PASSWORD>!"
)) as mydb:
print(mydb)
print(mydb.is_connected())
print(mydb.is_connected())
| StarcoderdataPython |
4917183 | <filename>EXERCICIOS/exercicio_ffmpeg/exercicio_ffmpeg.py
# https://ffmpeg.org/documentation.html
"""
ffmpeg -i "ENTRADA" -i "LEGENDA" -c:v libx264 -crf 23 -preset ultrafast -c:a aac -b:a 320k -c:s srt -map v:0 -map a
-map 1:0 -ss 00:00:00 -to 00:00:50 "SAIDA"
"""
import os, fnmatch, sys
if sys.platform == 'linux':
... | StarcoderdataPython |
1622541 | <reponame>ptesan777/model-optimization
# Copyright 2019 The TensorFlow 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/LIC... | StarcoderdataPython |
1699945 |
def test_stuff1():
assert True
def test_stuff2():
assert False
| StarcoderdataPython |
12839612 | <gh_stars>1-10
import os
import pickle
import numpy as np
import re
from string import ascii_letters
from datetime import datetime
import argparse
import gzip
def collect_datasets_is(folder = [],
model = [],
ndata = [],
nsubsample = []):
... | StarcoderdataPython |
8186234 | <filename>src/app.py
import logging
from config import conf
from factory.standard_discord_bot_factory import StandardDiscordBotFactory
from runner.standard_discord_bot_runner import StandardDiscordBotRunner
class App:
'''Entry point of the program.'''
def start(self) -> None:
'''Starts the program.'... | StarcoderdataPython |
1794504 | <filename>AKDPRFramework/mlops/knn.py
from AKDPRFramework.utils.dataops import euclidean_distance
import numpy as np
class KNN:
"""
K Nearest neighbor classifier in machine learning
Args:
- ``k`` (int): The number of closest neighbors.
Examples::
>>> from sklearn impo... | StarcoderdataPython |
4886475 | <filename>python/cfgmdl/__init__.py
""" Tools for configuration parsing and model building """
from .version import get_git_version
__version__ = get_git_version()
del get_git_version
from .unit import Unit
from .ref import Ref
from .array import Array
from .property import Property
from .derived import Derived, cach... | StarcoderdataPython |
118678 | <filename>1.two-sum.py<gh_stars>1-10
#
# @lc app=leetcode.cn id=1 lang=python3
#
# [1] 两数之和
#
# https://leetcode-cn.com/problems/two-sum/description/
#
# algorithms
# Easy (44.30%)
# Total Accepted: 243.9K
# Total Submissions: 547.9K
# Testcase Example: '[2,7,11,15]\n9'
#
# 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标... | StarcoderdataPython |
11367504 | # 主函数
from global_utils import print_summary
from options import parse_options
from global_utils import set_global_seed, save_performance, plot_data
import time
from agent_env_params import design_agent_and_env
from multiprocessing import Process
import random
from environment import Environment
from agent i... | StarcoderdataPython |
3296249 | import unittest
from quasimodo.statement_maker import StatementMaker
dataset = [
("why is", "is", ""),
("how is software piracy illegal in the first place?", "software", 'software piracy is illegal in the first place'),
("why are white monkeys superior to other races?", "white", 'white monkeys are superio... | StarcoderdataPython |
3332038 | <gh_stars>1-10
import os
import requests
import json
import threading
import copy
import common
from habitica import Habitica
import leancloud
from leancloud import LeanCloudError
from lc.api import LC
# 提供不背单词基本操作
class BBDC(object):
"""docstring for BBDC"""
# 单例模式加锁
_instance_lock = threading.Lock()
def __init... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.