id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3375638 | """Stage 5: Puzzle 4 of 10
Draw a triangle whose sides are all in different colors. Hint:
you'll have to figure out how far to turn by testing different
values for the `turn_right(degrees)` function. Note: we've added
`artist.random_color()` as well. Use it instead of a color to get
random colors. (`artist.random_colo... | StarcoderdataPython |
1756809 | import pytest
from datetime import datetime, timedelta
from modis_tools.auth import ModisSession, has_download_cookies
class TestModisSession:
def test_creates_session(self):
modis = ModisSession("test user", "test password")
assert modis.session
def test_no_credentials_raises_exception(se... | StarcoderdataPython |
4803105 | __author__ = '<NAME>'
'''
https://codeforces.com/problemset/problem/688/B
Solution: If we observe the first few palindromes of even length, for the first 9 palindromes,
we get 11 to 99. After that, we go to 1001 and then put these 11 to 99 between two 1s. This results in
palindromes 1111, 1221, 1331 to 1991. If we ob... | StarcoderdataPython |
52290 | <gh_stars>1-10
"""
Python script to print all zendesk domain articles as a single entity. Useful for checking global
formatting properties or your articles.
N.B. this python app currently does not have a wrapper script.
"""
import sys
from zendesk.api import DomainConfiguration
from zendesk.api import HelpCenter
fro... | StarcoderdataPython |
3363069 | # Copyright (C) 2014 Red Hat, Inc.
# Author: <NAME> <<EMAIL>>
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS... | StarcoderdataPython |
168219 | <reponame>gecco-evojax/evojax
# Copyright 2022 The EvoJAX 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | StarcoderdataPython |
50730 | # This file is part of comma, a generic and flexible library
# Copyright (c) 2011 The University of Sydney
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must ... | StarcoderdataPython |
3215001 | import pygame, math
from engine import Engine
from eventManager import Events
from brick import *
from paddle import *
class Ball(Engine.GUI.Widget):
def __init__(self, level):
super().__init__()
self.level = level
self.eventManager = EventManager()
self.radius = self.options.ball... | StarcoderdataPython |
4811953 | <reponame>kynan/lightlab<gh_stars>1-10
from . import VISAInstrumentDriver
from lightlab.equipment.abstract_drivers import TekScopeAbstract
from lightlab.laboratory.instruments import Oscilloscope
class Tektronix_TDS6154C_Oscope(VISAInstrumentDriver, TekScopeAbstract):
''' Real time scope.
See abstract dri... | StarcoderdataPython |
1739539 | <filename>{{cookiecutter.project_directory}}/{{cookiecutter.main_package_name}}/config.py<gh_stars>1-10
"""Application configuration."""
import logging
import os
class Config(object):
"""Base configuration."""
SECRET_KEY = os.environ.get('{{cookiecutter.main_package_name | upper}}_SECRET', 'default-secret-ke... | StarcoderdataPython |
24065 | <reponame>su226/IdhagnBot
from typing import Any
from .. import util
FORMAT = '''\
🤔 {username} 发布了……一些东西
https://t.bilibili.com/{id}
目前机器人还不能理解这个qwq'''
def handle(content: Any) -> str:
return FORMAT.format(
username=content["desc"]["user_profile"]["info"]["uname"],
id=content["desc"]["dynamic_id_str"])
| StarcoderdataPython |
3275654 | import sys
sys.path.append( '..' )
from PyRTF import *
def MergedCells( ) :
# another test for the merging of cells in a document
doc = Document()
section = Section()
doc.Sections.append( section )
# create the table that will get used for all of the "bordered" content
col1 = 1000
col2 = 1000... | StarcoderdataPython |
3362558 | from django.contrib import messages
from django.utils.safestring import mark_safe
from django.shortcuts import HttpResponseRedirect
from django.core.urlresolvers import reverse
from smartmin.views import SmartCRUDL, SmartCreateView, SmartListView
from .models import Transaction, Category
class CategoryCRUDL(SmartCRUD... | StarcoderdataPython |
3387096 | import json
import requests
import unittest
from unittest import mock
from sphinx_action import status_check
class TestStatusChecks(unittest.TestCase):
@mock.patch('sphinx_action.status_check.requests.post')
def test_create_check(self, mock_post):
mock_response = mock.NonCallableMock(requests.Respon... | StarcoderdataPython |
1666 | """
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... | StarcoderdataPython |
188425 | <filename>adv/pinon.py
from core.advbase import *
from module.template import SigilAdv
def module():
return Pinon
class Pinon(SigilAdv):
conf = {}
conf['slots.a'] = ['Primal_Crisis', 'His_Clever_Brother']
conf['slots.d'] = 'Dragonyule_Jeanne'
conf['acl'] = """
# `dragon(c3-s-end), s
... | StarcoderdataPython |
1743967 | import pandas as pd #for pandas see http://keisanbutsuriya.hateblo.jp/entry/201\
import argparse
import numpy as np
import math
import subprocess
import glob
import mylib
import time
import datetime
import sys
import os
# main
def myshell(cmd): #no stop even when error occured
try:
... | StarcoderdataPython |
1732822 | <gh_stars>0
# ROS
import roslibpy
# Tranlate functions
from .translate_functions import *
# Python
import sys
import time
import json
import math
import socket
# IS
from is_wire.core import Channel, Message, Logger, Status, StatusCode
from .is_ros_pb2 import ROSTranslateRequest, ROSTranslateReply
from is_wire.rpc im... | StarcoderdataPython |
40613 | import PIL.Image,PIL.ImageDraw,PIL.ImageFont,PIL.ImageFilter
import random
#随机字母
def rndchar():
return chr(random.randint(65, 90))
#random.randint()函数生成随机数字,数字范围为在65 到90内,在此范围内的美国标准信息编码是大写的A-Z
#chr(kk) 函数,kk为整数,asc编码值,函数返回asc编码为kk 的对应的字符
#随机颜色1
def rndcolor():
return random.randint(64, 255),random.randint(64... | StarcoderdataPython |
3387128 | from django.core import context_processors
from django.utils import encoding, functional, html
def csrf(request):
# Django does it lazy like this. I don't know why.
def _get_val():
token = context_processors.csrf(request)['csrf_token']
# This should be an md5 string so any broken Unicode is a... | StarcoderdataPython |
1619353 | <reponame>rafaellehmkuhl/OpenCV-Python-GUI<filename>main.py
if __name__ == '__main__':
import sys
from PyQt5.QtWidgets import QApplication
from CvPyGui import Main
app = QApplication(sys.argv)
window = Main.MyApp()
window.show()
sys.exit(app.exec_())
| StarcoderdataPython |
3375493 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class ActivityMerchantOrder(object):
def __init__(self):
self._activity_type = None
self._audit_result = None
self._fail_reason = None
self._order_id = None
... | StarcoderdataPython |
1722549 | from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AdminPasswordChangeForm, PasswordChangeForm, UserCreationForm
from django.contrib.auth import update_session_auth_hash, authenticate, login
from django.contrib import messages
from django.contrib.auth.models import User
from... | StarcoderdataPython |
3202917 | <reponame>tomasMasson/SfMNPV_genomics
#!/usr/bin/env python3
import argparse
from Bio import SearchIO
def parse_blast_result(blast_xml):
'''
This script takes a blast output file in xml format and
returns a table displaying the query id, the best hit id
and the annotation retrieved from Entrez databa... | StarcoderdataPython |
3282912 | import pytest
def test_custom_conf_does_not_apply_to_unknown_vhost(docker_compose, nginxproxy):
r = nginxproxy.get("http://nginx-proxy/")
assert r.status_code == 503
assert "X-test" not in r.headers
def test_custom_conf_applies_to_web1(docker_compose, nginxproxy):
r = nginxproxy.get("http://web1.nginx... | StarcoderdataPython |
1623217 | <filename>main/invoice.py
from docx import Document
import translate
class Invoice():
def __init__(self, customer, owner):
self.customer = customer
self.owner = owner
name = self.customer.data["Name"].replace(" ", "").lower()
self.file_name = "../data/temp/%d%s.docx" % (self.custo... | StarcoderdataPython |
3266200 | import os
import cv2
import time
import tkinter as tk
from tkinter import *
from tkinter import messagebox
from tkinter.ttk import *
import PIL.Image, PIL.ImageTk
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from src.attention_calculator import AttentionCalc
class Ap... | StarcoderdataPython |
1730439 | import random
from django.contrib.gis.geos import GEOSGeometry
from django.core.management import BaseCommand
from django_dynamic_fixture import G
from fleetassignment.vehicles.models import Vehicle, VehiclePosition
class Command(BaseCommand):
help = "This command is responsible for generating fake Vehicles dat... | StarcoderdataPython |
1610179 | <gh_stars>1-10
# from __future__ import absolute_import, division, print_function, unicode_literals
# 导入TensorFlow和tf.keras
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '1'
import tensorflow as tf
from tensorflow import keras
from keras import initializers
from keras import optimizers
from keras.callbacks import *
f... | StarcoderdataPython |
163987 | <filename>novice_stakes/tests/iso_speed_KA_sin.py
import numpy as np
import numexpr as ne
from math import pi
from scipy.optimize import newton
from scipy.signal import hilbert
from scipy.special import hankel2
import matplotlib.pyplot as plt
from novice_stakes import p_sca, initialize_nuttall
from novice_stakes.refra... | StarcoderdataPython |
1686355 | <filename>piano_utils/utils/flatten_json.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2016 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restri... | StarcoderdataPython |
9419 | # Copyright 2005-2008, <NAME>
# Copyright 2010, 2012 <NAME>
# This software's license gives you freedom; you can copy, convey,
# propagate, redistribute, modify and/or redistribute modified versions of
# this program under the terms of the GNU Affero General Public License
# (AGPL) as published by the Free Software Fo... | StarcoderdataPython |
22091 | <reponame>zaynahjaved/AWAC<gh_stars>0
'''
All cartgripper env modules built on cartrgipper implementation in
https://github.com/SudeepDasari/visual_foresight
'''
from abc import ABC
from mujoco_py import load_model_from_path, MjSim
import numpy as np
from base_env import BaseEnv
class BaseMujocoEnv(BaseEnv, ABC):
... | StarcoderdataPython |
161146 | import os
import random
import yaml
from collections import Counter
from nltk.corpus import movie_reviews
from nltk.corpus import senseval
import pandas as pd
import json
class datasetGenerator:
"""
creates a base dataset from senseval in NLTK
it generates data.json dataset by instanciating it
or by... | StarcoderdataPython |
142721 | <filename>test/cases/apps/stocking/actions_test.py
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).parent.parent.parent.parent.parent))
from apps.stocking.actions.fetch import fetch_data
from apps.stocking import logger
from apps.stocking.actions.make import make_x, make_y, make_xy
from apps.st... | StarcoderdataPython |
1624292 | from django.apps import AppConfig
class SchaftConfig(AppConfig):
name = 'schaft'
| StarcoderdataPython |
3315031 | <reponame>LyfeOnEdge/ursina
from ursina import *
from ursina.prefabs.grid_editor import GridEditor, PixelEditor
import re
class Tilemap(GridEditor):
def __init__(self, tilemap='', tileset='', tileset_size=(8,8), **kwargs):
if isinstance(tilemap, str):
self.tilemap = load_texture(tilemap)
... | StarcoderdataPython |
3216292 | <gh_stars>0
# Databricks notebook source
# MAGIC %run ./app/bootstrap
# COMMAND ----------
# MAGIC %load_ext autoreload
# MAGIC %autoreload 2
# COMMAND ----------
from daipeproject.test_modelu import print_hello
print_hello()
# COMMAND ----------
print_hello()
| StarcoderdataPython |
3366757 | import pandas as pd
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--saveFile', type='str')
args = parser.parse_args()
with open('pred_engg1.txt') as f:
preds = f.readlines()
with open('../../dataset/dataToUse/UrIIICompSents/evaluate.sum') as f:
inps = f.readlines()
with open('../... | StarcoderdataPython |
3341358 | # coding: utf8
'''
This code is about the graph we build - edges and nodes (nodes are called Blocks)
<NAME>
March 3rd, 2016
Copyright Xerox 2016
'''
DEBUG=0
#DEBUG=1
# --- Edge CLASSE -----------------------------------------
class Edge:
def __init__(self, A, B):
"""
An edge fro... | StarcoderdataPython |
4814670 | <gh_stars>1-10
'''
Tests for stoqcompiler.unitary modules.
'''
import pytest
import numpy as np
from stoqcompiler.unitary import (
Unitary,
UnitarySequence,
UnitarySequenceEntry,
UnitaryDefinitions,
ParameterizedUnitary,
ParameterizedUnitaryParameter,
ParameterizedUnitaryDefinitions)
clas... | StarcoderdataPython |
1711335 | from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, TextAreaField, SelectField
from wtforms.validators import DataRequired, Length, Email
class FeedbackForm(FlaskForm):
name = StringField('Name *', validators=[DataRequired(), Length(min=0, max=50)])
email = StringField('Email *', val... | StarcoderdataPython |
114588 | '''
Created by auto_sdk on 2016.03.15
'''
from top.api.base import RestApi
class FenxiaoDistributorItemsGetRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.distributor_id = None
self.end_modified = None
self.page_no = None
self.page_size = None... | StarcoderdataPython |
144030 | from .DBWorker import DatabaseWorker
from .models import Base
Base.metadata.create_all(DatabaseWorker.engine)
| StarcoderdataPython |
3351959 | import numpy as np
import chainer
from chainer.cuda import get_array_module
from chainer.functions import convolution_2d, deconvolution_2d
from chainer.backends import cuda
from src.function.pooling import factor
if cuda.available:
def normalize(arr, axis):
norm = cuda.reduce('T x', 'T out',
... | StarcoderdataPython |
3372531 | <gh_stars>1-10
from dataclasses import dataclass
from typing import Optional
from meeshkan.nlp.entity_extractor import EntityExtractor
from meeshkan.nlp.ids.gib_detect import GibberishDetector
from meeshkan.nlp.ids.id_classifier import IdClassifier, IdType
@dataclass(frozen=True)
class IdDesc:
value: Optional[s... | StarcoderdataPython |
3341709 | # Generated by Django 2.0.8 on 2019-01-23 02:44
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('conservation', '0005_auto_20190122_1638'),
]
operations = [
migrations.AddField(
model_name='ma... | StarcoderdataPython |
1645366 | <reponame>khaledghobashy/asurt_mbdt
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 27 08:49:16 2019
@author: khaled.ghobashy
"""
# Standard library imports
import os
# 3rd party library imports
import cloudpickle
import sympy as sm
# Local applicataion imports
from ...symbolic.components import joints as joints
from... | StarcoderdataPython |
3261365 | from django.db import models
class FeedTimetable(models.Model):
feed = models.ForeignKey('Feed')
timetable_url = models.URLField()
fetch_last_modified = models.CharField(max_length=50, blank=True, null=True)
last_processed_zip = models.CharField(max_length=50, blank=True, null=True)
active = model... | StarcoderdataPython |
3240161 | <reponame>LINXNet/pyOCNOS
"""
This test module covers tests cases for function pyocnos.diff.normalize_tree()
"""
from lxml import etree
from pyocnos.diff import normalize_tree
def test_normalize_tree():
"""
Ensure normalize_tree() wipe off name spaces, prefixes, redundant white spaces and new lines.
"""... | StarcoderdataPython |
1735386 | <filename>MATH2021/matrix.py
#! /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
# -*- coding: utf-8 -*-
print("Enter the vector: ")
a = [float(i) for i in input().strip().split(" ")]
b = [float(i) for i in input().strip().split(" ")]
if len(a) != len(b):
print("They are not in the same dimension")
qui... | StarcoderdataPython |
1778446 | <reponame>hamzaali15/mjt
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import cint, flt, getdate
def execute(filters=None):
if not filters: f... | StarcoderdataPython |
160869 | <reponame>mrakitin/opentrons
from copy import deepcopy
import json
import logging
import os
from dataclasses import asdict
from pathlib import Path
from typing import Any, Dict, List, Union, Optional, TypeVar, cast
from opentrons.config import CONFIG
from opentrons.hardware_control.types import BoardRevision
from .ty... | StarcoderdataPython |
1728126 | <reponame>plantpredict/python-sdk
"""This file contains the code for "Generate a module file from module datasheet" in the "Example Usage" section of the
documentation located at https://plantpredict-python.readthedocs.io."""
import plantpredict
from plantpredict.enumerations import CellTechnologyTypeEnum, PVModelType... | StarcoderdataPython |
171230 | # pylint: disable=missing-module-docstring
#
# Copyright (C) 2022 by YadavGulshan@Github, < https://github.com/YadavGulshan >.
#
# This file is part of < https://github.com/Yadavgulshan/pharmaService > project,
# and is released under the "BSD 3-Clause License Agreement".
# Please see < https://github.com/YadavGulshan/... | StarcoderdataPython |
20087 | class Solution:
2 def solve(self, matrix):
3 from functools import lru_cache
4 @lru_cache(None)
5 def dp(i, j):
6 if i < 0 or j < 0:
7 return 0
8 return max(dp(i - 1, j), dp(i, j - 1)) + matrix[i][j]
9 return dp(len(matrix) - 1, len(matrix[0]) - 1)
| StarcoderdataPython |
3308956 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | StarcoderdataPython |
3253571 | from sanic import response
from sanic import Blueprint
from .helpers import auth_route, user_to_json, validate
from .errors import ApiError, Unauthorized, UnknownUser
from .schemas import USERMOD_SCHEMA
from .auth import check_password
bp = Blueprint(__name__)
@bp.route('/api/users/@me')
@auth_route
async def get_... | StarcoderdataPython |
3244537 | <filename>bluespot/guest/const.py
SESSION_INIT = 1
SESSION_AUTHORIZED = 3
SESSION_EXPIRED = 4
SESSION_BAN = 5
GUESTRACK_INIT = 1 #Guesttrack creation
GUESTRACK_SESSION = 2 #guesttrack is assigned a session
GUESTRACK_NO_AUTH = 3 #guest track of no_auth sit... | StarcoderdataPython |
29191 | <reponame>engcristian/Python
'''
Arithmetic progression with 10 elements.
'''
first_term = int(input('Type the first term of this A.P: '))
reason = int(input('Type the reason of this A.P: '))
last_term = first_term + (50-1)*reason # A.P formula
for c in range (first_term, last_term + reason , reason):
print(c, end... | StarcoderdataPython |
44751 | """
Usage Instructions:
10-shot sinusoid:
python main.py --datasource=sinusoid --logdir=logs/sine/ --metatrain_iterations=70000 --norm=None --update_batch_size=10
10-shot sinusoid baselines:
python main.py --datasource=sinusoid --logdir=logs/sine/ --pretrain_iterations=70000 --metatrain_iterati... | StarcoderdataPython |
102334 | from __future__ import unicode_literals
from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
urlpatterns = patterns('',
url(r'^$', 'xue.bandexams.views.my_view'),
url(r'add/$', 'xue.bandexams.views.add_view'),
)
# vim:ai:et:ts=4:sw=4:sts=4:fenc=utf8:
| StarcoderdataPython |
1706849 | <gh_stars>1000+
try:
from urllib import quote_plus as quote
except ImportError:
from urllib.parse import quote_plus as quote
import time
from itchatmp.config import COMPANY_URL
from itchatmp.returnvalues import ReturnValue
from itchatmp.utils import retry, encode_send_dict
from ..requests import request... | StarcoderdataPython |
4811532 | from bokeh.io import output_file
from bokeh.layouts import column, row
from bokeh.models import HoverTool
from bokeh.models.callbacks import CustomJS
from bokeh.models.widgets import Select
from bokeh.plotting import figure, ColumnDataSource, save
import json
import numpy as np
import sobol_seq
class Slice1D:
de... | StarcoderdataPython |
3206330 | DEFAULT_PORT = "0.0.0.0:6789"
| StarcoderdataPython |
115327 | from app import logger, engine, parser
from app.utilities import export_db_to_excel, create_dataframe_from_sql, resolve_domains, export_to_excel, \
check_valid_domain_name
from app.get_certs import get_cert_ids_by_org, parse_domains_and_update_certsmasterdb, get_cert_by_domain_name
from app.filter import filter_dom... | StarcoderdataPython |
16374 | <gh_stars>0
#! /usr/bin/python
import sys
""" This script accepts the final annotation file and the lineage marker SNPs file """
""" and infers the lineage and possible sublineage classification of the isolate """
""" it requires a sample ID name (string) and an output file name(string) """
"""
Author: <NAME>
CPTR ... | StarcoderdataPython |
3379590 | <gh_stars>0
from floodsystem.stationdata import build_station_list
from floodsystem.geo import stations_within_radius
def run():
"""Requirements for Task 1C"""
r = 10
p = (52.2053, 0.1218)
stations = build_station_list()
stations = stations_within_radius(stations, p, r)
print(sorted([station.... | StarcoderdataPython |
38438 | # Generated by Django 4.0 on 2022-01-13 10:17
import uuid
import ckeditor_uploader.fields
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('funuser', '0004_alter_funuse... | StarcoderdataPython |
4830078 | <gh_stars>1-10
import textwrap
import re
import ipywidgets as widgets
import matplotlib.pyplot as pyplot
import numpy as np
import pandas as pd
from pyvis.network import Network
import matplotlib
import networkx as nx
import techminer.core.dashboard as dash
from techminer.core import (
Dashboard,
Network,
... | StarcoderdataPython |
119111 | import os
import sqlite3
import json
import datetime
from shutil import copyfile
from werkzeug._compat import iteritems, to_bytes, to_unicode
from jam.third_party.filelock import FileLock
import jam
LANG_FIELDS = ['id', 'f_name', 'f_language', 'f_country', 'f_abr', 'f_rtl']
LOCALE_FIELDS = [
'f_decimal_point', 'f... | StarcoderdataPython |
3258378 | <filename>github/methods/activity/events/list_network_repository_events.py
from github.scaffold import Scaffold
from github.types import Response
from github.utils import utils
class ListNetworkRepositoryEvents(Scaffold):
"""
List public events for a network of repositories
"""
def list_network_repos... | StarcoderdataPython |
76635 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Fuzz test for LlvmEnv.validate()."""
import numpy as np
import pytest
from compiler_gym.envs import LlvmEnv
from compiler_gym.errors import... | StarcoderdataPython |
151052 | #!/usr/bin/env python
import logging
import os
import sys
import argparse
from torch_scope import run
if __name__ == "__main__":
run()
| StarcoderdataPython |
1785882 | <gh_stars>1-10
from typing import Optional
from uuid import uuid4
from pydantic import BaseModel
from ..context import Context
from ..entity import Entity
from ..event import Event
from ..event_metadata import EventPayloadMetadata, EventMetadata
class EventPayload(BaseModel):
type: str
properties: Optional[... | StarcoderdataPython |
52480 | <filename>stdnet/orm/mapper.py
import copy
from stdnet import getdb
from query import Manager, UnregisteredManager
def clearall():
for meta in _registry.values():
meta.cursor.clear()
def register(model, backend = None, keyprefix = None, timeout = 0):
'''Register a :class:`stdnet.rom.StdNet` model... | StarcoderdataPython |
122659 | #!/usr/bin/env python2
from pwn import *
import time
level = 1
host = 'vortex.labs.overthewire.org'
user = 'vortex%i' % level
chal = 'vortex%i' % level
password = args['PASSWORD']
passfile = '/etc/vortex_pass/<PASSWORD>%i' % (level+1)
binary = '/vortex/%s' % chal
shell = ssh(host=host, user=user,... | StarcoderdataPython |
1662981 | <filename>scripts/backfill.py
import os
from loguru import logger
import googlemaps
import pandas as pd
from create_ltc_ids import drop_dupes, create_hash
google_key = os.getenv("GOOGLE_API_KEY")
if google_key is None:
raise ValueError("you must set a value for the GOOGLE_API_KEY env variable")
gmaps = googlema... | StarcoderdataPython |
1709535 | <reponame>franneck94/UdemyGAN
from tensorflow.keras.layers import Activation
from tensorflow.keras.layers import Conv2D
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import Flatten
from tensorflow.keras.layers import Input
from tensorflow.keras.layers import MaxPooling2D
from tensorflow.keras.m... | StarcoderdataPython |
103052 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name:decomposition
Description : 数据降维实例
旨在说明使用方法
Email : <EMAIL>
Date:2018/1/2
"""
from collections import namedtuple
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.datasets im... | StarcoderdataPython |
4807145 | import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt # noqa: E402
class ConvergenceChecker(object):
def __init__(self, min_iters=3, max_iters=int(1e13), min_confirmations=1):
assert min_confirmations > 0
self.min_iters = min(max(min_iters, 1 + 2 * min_confir... | StarcoderdataPython |
1755739 | <reponame>genialis/resolwe<gh_stars>10-100
"""Data viewset."""
from django.db.models import Prefetch, Q
from rest_framework import exceptions, mixins, viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from resolwe.flow.filters import DataFilter
from resolwe.flow.models... | StarcoderdataPython |
44648 | <filename>src/google-cloud-speech/python/client.py
#!/usr/bin/env python3
import sys
from google.cloud import speech as google_cloud_speech
# Create the object representing the API to the client.
client = google_cloud_speech.SpeechClient ()
content = open (sys.argv [1], 'rb').read ()
audio = google_cloud_speech.Rec... | StarcoderdataPython |
81292 | from __future__ import unicode_literals
import collections
import six
from egnyte import base, exc
class FileOrFolder(base.Resource):
"""Things that are common to both files and folders."""
_url_template = "pubapi/v1/fs%(path)s"
_lazy_attributes = {'name', 'folder_id', 'is_folder'}
def _action(sel... | StarcoderdataPython |
3394084 | <filename>pynder/models/user.py
import dateutil.parser
from datetime import date
from .. import constants
from six import text_type
from .message import Message
class User(object):
def __init__(self, data, session):
self._session = session
self._data = data
self.id = data['_id']
... | StarcoderdataPython |
1623086 | <reponame>acolley/protoactor-python
import asyncio
from datetime import timedelta
from threading import Thread
class AsyncTimer(Thread):
def __init__(self, interval: timedelta, function, args=None, kwargs=None):
super().__init__()
self.interval = interval
self.function = function
s... | StarcoderdataPython |
4801767 | import os
# In the template we named it `gitignore` so it does not interfere with
# the templates `.gitignore`.
# Rename gitignore -> .gitignore
os.rename("gitignore", ".gitignore")
| StarcoderdataPython |
45834 | <filename>segeval/ml/test.py
'''
Tests the machine learning (ML) statistics functions, and ml package.
.. moduleauthor:: <NAME> <<EMAIL>>
'''
from __future__ import absolute_import
import unittest
from decimal import Decimal
from segeval.ml import (
__precision__, precision, __recall__, recall, __fmeasure__,
f... | StarcoderdataPython |
84180 | import warnings
warnings.warn("pandas.types.common is deprecated and will be "
"removed in a future version, import "
"from pandas.api.types",
DeprecationWarning, stacklevel=3)
from pandas.core.dtypes.common import * # noqa
| StarcoderdataPython |
123707 | <filename>src/week_5/features/process_text/lemmatization.py
from nltk import pos_tag, word_tokenize
from nltk.corpus import wordnet
from nltk.stem import WordNetLemmatizer
def is_noun(tag):
return tag in ['NN', 'NNS', 'NNP', 'NNPS']
def is_verb(tag):
return tag in ['VB', 'VBD', 'VBG', 'VBN', 'VBP', 'VBZ']
... | StarcoderdataPython |
1707796 | <reponame>tarnover/tencentcloud-cli<gh_stars>0
version = "2018-05-22" | StarcoderdataPython |
173007 |
import unittest
from pysapets.ox import Ox
from pysapets.animal import Animal
import pysapets.constants as constants
from unittest.mock import patch
from io import StringIO
from copy import deepcopy
class OxTest(unittest.TestCase):
def setUp(self):
self.ox = Ox()
self.friends = [self.ox, Animal(2, 2), Anim... | StarcoderdataPython |
3314088 | '''
Author: <NAME>
Date: 3/15/19
Summary:
- Contains computation methods that board.py uses to
manage valid move seeks and piece placement.
- Methods use Numba with jit decorator that precompiles
types and makes runtime faster than normal python.
'''
from numba import jit
import numpy as np
import math
# def dum... | StarcoderdataPython |
1615799 | from django.contrib.auth.decorators import login_required
from django.utils.translation import ugettext as _
from questionnaire.views import generic_questionnaire_view_step
@login_required
def questionnaire_view_step(request, identifier, step):
"""
View rendering the form of a single step of a new Climate Ch... | StarcoderdataPython |
3321529 | """
Stepper configuration for verbose output
"""
debuglevel = 1 # 1: print HTTP headers, 0: don't print
show_page = True
| StarcoderdataPython |
4823092 | import math
import random
import time
import subprocess
from datetime import datetime, timedelta
import freesound
import giphy_client
import requests
from giphy_client.rest import ApiException
from googleapiclient.discovery import build
from pafy import pafy
from pixabay import Image
from tqdm import tqdm
import conf... | StarcoderdataPython |
1689165 | """
handlers.py:
Defines a set of base classes that allow for the system to handle various functions of the system. Primarily this
defines the "DataHandler" base class for handling data.
@author mstarch
"""
import abc
class DataHandler(abc.ABC):
"""
Defines the necessary functions required to handle data as... | StarcoderdataPython |
3389933 | import json
from jsonschema import Draft4Validator as Validator
import pytest
from jupyterlab_sql.request_decoder import decode, RequestDecodeError
test_schema = {
"type": "object",
"properties": {"prop": {"type": "string"}},
"required": ["prop"],
}
test_body = {"prop": "value"}
def test_decode_not_... | StarcoderdataPython |
1705787 | #Here we'll use the abc module (Abstract Base Classes)
import abc
class Pessoa(abc.ABC):
@abc.abstractmethod
def get_bonificacao(self):
pass
class Conta(abc.ABC):
def __init__(self, numero, titular, saldo=0, limite=1000.0):
self._numero = numero
self._titular = titular
self... | StarcoderdataPython |
3393723 | # -*- coding: utf-8 -*-
#
# Copyright 2021 Nitrokey Developers
#
# Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
# http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
# http://opensource.org/licenses/MIT>, at your option. This file may not be
# copied, modified, or distribute... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.