id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
6593786 | <gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# MPK M2-editor
# No-UI module
# Copyright (C) 2017 <NAME> dam.pic AT free.fr
#
# 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, eithe... | StarcoderdataPython |
1606955 | import os
import random
from glob import glob
import cv2
import numpy as np
from augraphy.augmentations.lib import sobel
from augraphy.base.augmentation import Augmentation
from augraphy.utilities import *
class BleedThrough(Augmentation):
"""Emulates bleed through effect from the combination of ink bleed and
... | StarcoderdataPython |
4901064 | <filename>data/prepare_data.py
#!/usr/bin/env python3
import sys
import argparse
import os
import numpy
import subprocess
from essentia.standard import MonoLoader
import soundfile
vocal_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data-vocal")
novocal_dir = os.path.join(os.path.dirname(os.path.absp... | StarcoderdataPython |
9681036 | <gh_stars>1-10
from tempfile import NamedTemporaryFile
import contextlib
import os
import tarfile
import zipfile
from PIL import Image
class CbtFile(object):
ext = '.cbt'
@property
def pages(self):
widths = (256, 128, 64)
heights = (128, 128, 128)
orientation = ('horizontal', 'ho... | StarcoderdataPython |
1956747 | import json
import os
from typing import List
from urllib.parse import urlencode
import requests
from app.assess.models.application import Application
from app.assess.models.fund import Fund
from app.assess.models.round import Round
from app.config import APPLICATION_STORE_API_HOST
from app.config import FLASK_ROOT
fr... | StarcoderdataPython |
85628 | <reponame>CiscoTestAutomation/genietelemetrylibs
'''
GenieTelemetry CpuUtilizationCheck Plugin
'''
# Python
import copy
import logging
# argparse
from argparse import ArgumentParser
# ATS
from ats.log.utils import banner
from ats.utils import parser as argparse
from ats.datastructures import classproperty
# GenieTel... | StarcoderdataPython |
4888299 | # MIT License
#
# Copyright (c) 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publi... | StarcoderdataPython |
5073130 | <filename>vk_stats/stats.py
#!/usr/bin/env python3
# coding=utf-8
# SysRq ScadsStats. Finding active users on VK walls.
# Copyright (C) 2015-2016 <NAME>
#
# This file is part of SysRq VK Stats.
#
# SysRq VK Stats is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gene... | StarcoderdataPython |
329027 | # In[]
import os
import cv2
import numpy as np
import matplotlib.pyplot as plt
def expand_Size(srcPath, dstPath):
img = cv2.imread(srcPath)
img = np.asarray(img, dtype = "uint8")
kernel = np.ones((21,21))
img = cv2.dilate(img, kernel, iterations = 1)
cv2.imwrite(dstPath, img)
src = "D:/[... | StarcoderdataPython |
6527169 | <reponame>spascou/kappa
# -*- coding: utf-8 -*-
# Copyright (c) 2014, 2015 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | StarcoderdataPython |
6656940 | <reponame>trantinan2512/Francis<filename>web/apps/configs/migrations/0001_initial.py
# Generated by Django 2.1.3 on 2018-12-22 01:14
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | StarcoderdataPython |
3571165 | from numpy import *
from scipy.interpolate import *
from matplotlib import pyplot as plt
class projectP():
#def __init__(self):
### Any default variables go here, should they be needed
def regress(self):
j = 0
i = 1
data = []
count = []
while (i != None):
... | StarcoderdataPython |
5179976 | import fileinput
from typing import Tuple
import numpy as np
from task3 import Position, direction_actions, EXIT, WALL, WALKABLE, AGENT, MARK
class Agent:
class WallException(Exception):
pass
def __init__(self, board: np.ndarray, marking=False):
self.marking = marking
self.board = boa... | StarcoderdataPython |
385995 | from multiprocessing import Pool
import h5py
import numpy as np
class DataShapeError(Exception):
"""Basic exception for if loaded data cannot be reshaped into the required shape"""
pass
class Data_from_HDF5():
def __init__(self, training_data_file_list, testing_data_file_list, data_shape):
se... | StarcoderdataPython |
9623253 | <reponame>joewen85/mycmdb
# Generated by Django 2.2.17 on 2021-03-18 06:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('device', '0034_auto_20201009_1655'),
]
operations = [
migrations.AlterField(
model_name='deploy_recor... | StarcoderdataPython |
1661778 | import sys
from pathlib import Path
sys.path.append(str(Path(__file__).parent.parent.parent.absolute()))
from hybrid.sites import SiteInfo, flatirons_site
from hybrid.hybrid_simulation import HybridSimulation
from hybrid.dispatch.plot_tools import plot_battery_output, plot_battery_dispatch_error, plot_generation_prof... | StarcoderdataPython |
6515470 | <filename>chatterbot/output/terminal.py<gh_stars>1-10
from .output_adapter import OutputAdapter
class TerminalAdapter(OutputAdapter):
"""
A simple adapter that allows ChatterBot to
communicate through the terminal.
"""
def process_response(self, statement, session_id=None):
"""
Pr... | StarcoderdataPython |
96991 | """
.. module:: lidar_tour
:platform: Windows
:synopsis: Example starting in west_coast_usa with a vehicle that has a
Lidar attached and drives around the environment using the
builtin AI. Lidar data is displayed using the OpenGL-based
Lidar visualiser.
.. moduleaut... | StarcoderdataPython |
1653042 | <gh_stars>1-10
import attr
# For Attrib
IS_PROTO_FIELD = '__SAN11PK_PLATFORM__IS_PROTO_FIELD'
PROTO_PATH = '__SAN11PK_PLATFORM__PROTO_PATH'
PROTO_CONVERTER = '__SAN11PK_PLATFORM__PROTO_CONVERTER'
IS_DB_FIELD = '__SAN11PK_PLATFORM__IS_PROTO_FIELD'
DB_PATH = '__SAN11PK_PLATFORM__DB_PATH'
DB_CONVERTER = '__SAN11PK_PLATF... | StarcoderdataPython |
1796575 | <filename>database/models.py
# Database Models
from datetime import datetime
from flask_bcrypt import generate_password_hash, check_password_hash
from database import db
class Comment(db.EmbeddedDocument):
content = db.StringField(required=True)
sender = db.ReferenceField('User')
created_date = db.DateT... | StarcoderdataPython |
6657559 | <gh_stars>0
# Test for Exercise 17: Temperature Converter
import pytest
from exercises.exercise18 import temperature_converter
@pytest.mark.parametrize("convert, temperature, result",
[("C", 32, ("Celsius", 0)), ("C", 77, ("Celsius", 25)),
("C", 95, ("Celsius", 35)),... | StarcoderdataPython |
3386594 | <filename>src/models/UserModel.py
# -*- coding: utf-8 -*-
# src/models/UserModel.py
"""
...Web Flask com autorização JWT (Jason web token authorization)
------------------------------------------------------------------------
Modelo de usuário
----------------------------------------... | StarcoderdataPython |
6605342 | # List GKE nodes
# Official GCP SDK (Python) Documentation: https://googleapis.github.io/google-api-python-client/docs/dyn/
import json
import sys
import argparse
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
from google.cloud import resource_manager
client = resource_manager... | StarcoderdataPython |
3523509 | <reponame>hectorbenitez/flask-workshop<filename>app/routes.py
from flask import render_template
from app import app
@app.route('/')
@app.route('/index')
def index():
user = {'username': 'Hector'}
events = [
{
'name': 'Workshop Python',
'date': 'May 10'
},
{
'name': 'Captura la bandera',
'date': 'Ma... | StarcoderdataPython |
5191428 | import itertools, functools
n = int(input())
sectors = [n] + [int(input()) for _ in range(0, n - 1)]
def distances(items):
length = len(items)
items = list(enumerate(items + items + items))
return [min([abs(it[0] - index) for it in items if it[1] == items[index][1] + 1]) for index in range(length + 1, length * 2)]... | StarcoderdataPython |
385159 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=protected-access
from __future__ import (division, absolute_import, print_function,
unicode_literals)
class Car:
wheels = 0
def __init__(self, color, model, year):
self.color = color
self.model = model
... | StarcoderdataPython |
6414740 | <reponame>MGPoirot/GPEX
from os.path import basename
import os
import gpxpy
import gpxpy.gpx
from scipy.stats import skewtest
import numpy as np
from matplotlib import pyplot as plt
import matplotlib
import cartopy.crs as ccrs
import cartopy.io.img_tiles as cimgt
from scipy.signal import savgol_filter
def read_gpx(pat... | StarcoderdataPython |
3544454 | import json
import uuid
import logging
import pkg_resources
from itertools import count
from pathlib import Path
from urllib.parse import urlencode, urljoin
from banal import ensure_dict, ensure_list
from requests import RequestException, Session
from requests_toolbelt import MultipartEncoder # type: ignore
from typin... | StarcoderdataPython |
8020582 | <gh_stars>0
import requests
import random
import time
import re
import os
import csv
import urllib3
import datetime
from bs4 import BeautifulSoup
class DoubanBookCrawler:
def __init__(self):
self.userAgent = [
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/... | StarcoderdataPython |
4859770 | <filename>engine/graphics/src/waf_graphics.py
# Copyright 2020 The Defold Foundation
# Licensed under the Defold License version 1.0 (the "License"); you may not use
# this file except in compliance with the License.
#
# You may obtain a copy of the License, together with FAQs at
# https://www.defold.com/license
#
# ... | StarcoderdataPython |
1822912 | <reponame>rectcircle/celery-learn
# -*- coding: utf-8 -*-
from get_started.producer1 import product1
from celery.result import AsyncResult
from time import sleep
if __name__ == '__main__':
# 配置了backend,返回的就是AsyncResult对象
print "====测试使用backend===="
task_result1 = product1()
task_result2 = product1()
... | StarcoderdataPython |
6672956 | <reponame>linohan/Recommender-Systems-Samples<filename>RecSys Traditional/MF/FFM/util.py<gh_stars>10-100
# -*- coding: utf-8 -*-
from sklearn.preprocessing import StandardScaler
import pandas as pd
import numpy as np
import os
# In[1]:
class FieldHandler(object):
def __init__(self, train_file_path, test_file_path=N... | StarcoderdataPython |
6660401 | <gh_stars>0
NAME = 'PurpleCoin'
NAME_S = 'PurpleCoins'
SHORT_NAME = 'PURPLE'
START_REWARD = '8192'
REWARD_FIX = '210000'
BLOCKCHAIN_FILE = 'blockchain.sqlite'
PEERS_LIST_FILE = 'settings.sqlite'
SERVER_PORT = 45777
VERSION = '0.0.1'
| StarcoderdataPython |
6416869 | import os
import uuid
import shutil
import string
from configparser import ConfigParser
from importlib import import_module
from os.path import join, dirname, abspath, exists, splitext
import scrapx
from scrapx.commands import ScrapxCommand
from scrapy.utils.template import render_templatefile, string_camelcase
from ... | StarcoderdataPython |
5138659 | # =================================================================
#
# Authors: <NAME> <<EMAIL>>
#
# Copyright (c) 2021 <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
# res... | StarcoderdataPython |
5026709 | <reponame>rricard/dxr
"""Tests for searches involving wildcards (*, ?)"""
from dxr.testing import SingleFileTestCase
class WildcardTests(SingleFileTestCase):
source = r"""
int get_foo() {
return 0;
}
int get_bar() {
return 0;
}
int... | StarcoderdataPython |
1759662 | <reponame>amacd31/bom_data_parser
import pandas as pd
from bom_data_parser import mapper
def read_acorn_sat_csv(fname):
with open(fname) as f:
header_line = f.readline()
measurand = mapper.convert_key(header_line[0:8])
missing_value_key = 'missing_value='
missing_value_start = header_line.in... | StarcoderdataPython |
1708304 | from funcy_chain import getter
def test_names(Chain):
data = {
"user1": {
"firstname": "Alice",
"lastname": "Liddle",
},
"user2": {
"firstname": "Bob",
"lastname": "Kennedy",
},
}
names = (
Chain(data)
.values(... | StarcoderdataPython |
3404819 | <reponame>joncatanio/cannoli
class Test:
var = 2
def __init__(self, x, y):
self.x = x
self.y = y
def method(self):
print("method: self.x = " + str(self.x))
print("method: self.y = " + str(self.y))
print("Updating self.x")
self.x = "`method` updated my value"
def swapxy(... | StarcoderdataPython |
6423134 | import datetime
from matplotlib import dates
import numpy as np
import json
import re
import math
import time
import collections
import itertools
positions = ["_right_arm", "_mattrass"]
for vp_number in range(26, 32):
for smartphone_position in positions:
current_folder = "result_data_vp"+str(vp_number)+... | StarcoderdataPython |
9646856 | from django.urls import path
from .views import EventCreateView, EventDetailView, CategoryView
app_name = 'events'
urlpatterns = [
path('<int:pk>', EventDetailView.as_view(), name='detail'),
path('create/<int:pk>', EventCreateView.as_view(), name='create'),
path('category/<slug:category>', CategoryView.as_v... | StarcoderdataPython |
313619 | from .base_distribution import distribution
import numpy as np
from mpmath import mp
from scipy.optimize import minimize
class powerlaw(distribution):
'''
Discrete power law distributions, given by
P(x) ~ x^(-alpha)
'''
def __init__(self):
super(powerlaw, self).__init__()
self.nam... | StarcoderdataPython |
6534593 | <gh_stars>0
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Red Hat, 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/LICE... | StarcoderdataPython |
1697798 | import argparse
def int_or_str(text):
"""Helper function for argument parsing."""
try:
return int(text)
except ValueError:
return text
def parse(args):
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"-l",
"--list-devices",
actio... | StarcoderdataPython |
227022 | <filename>dynamics_learning/networks/kalman/core.py
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Optional, Tuple, overload
import numpy as np
import torch
from fannypack.utils import Buddy
from torch import nn as nn
from dynamics_learning.data.datasets import VisData
from d... | StarcoderdataPython |
3325399 | <gh_stars>1-10
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | StarcoderdataPython |
11260331 | <reponame>nbro/probability
# Copyright 2018 The TensorFlow Probability 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 r... | StarcoderdataPython |
5126816 | from header_common import *
from header_operations import *
from header_triggers import *
from header_scenes import *
from module_constants import *
####################################################################################################################
# Each scene record contains the following fields:
#... | StarcoderdataPython |
1937448 | <reponame>jqueguiner/ai-django-core<gh_stars>0
import re
from django.conf import settings
from django.core.mail.backends.smtp import EmailBackend as SMTPEmailBackend
class WhitelistEmailBackend(SMTPEmailBackend):
"""
Via the following settings it is possible to configure if mails are sent to all domains.
... | StarcoderdataPython |
11216747 | <reponame>frostidaho/python-asyncipc
# http://stackoverflow.com/a/27198531
# https://github.com/joidegn/leo-cli
# https://pymotw.com/2/socket/uds.html
import asyncio
from os import path as _path
from . import _utils
from .serializer import Serialize
from collections import namedtuple
Observer = namedtuple('Observer'... | StarcoderdataPython |
9724744 | import unittest
from conans.client import tools
from conans.client.build.visual_environment import VisualStudioBuildEnvironment
from conans.test.utils.conanfile import MockConanfile, MockSettings
from conans.test.utils.tools import TestClient
class VisualStudioBuildEnvironmentTest(unittest.TestCase):
def test_v... | StarcoderdataPython |
3418368 | """The ``agar`` package contains a number of general purpose utility modules containing classes and functions to help
develop with `Google App Engine python`_ and `webapp2`_."""
from _version import __version__
| StarcoderdataPython |
6701253 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2018 Etsy 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 required by ap... | StarcoderdataPython |
6466322 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. currentmodule:: test_cli
.. moduleauthor:: <NAME> <<EMAIL>>
This is the test module for the project's command-line interface (CLI)
module.
"""
import json
import luigi
# fmt: off
import bio3dbeacon
import bio3dbeacon.cli as cli
from bio3dbeacon import __version__... | StarcoderdataPython |
3421790 | <reponame>JONGWE1/BankManagement
from flask import render_template, redirect, request, url_for, flash, make_response
from .import imgpatient
from .form import ImgpCheckinForm, ImgpRecipeForm
from ..model import Medicine, Price, UserInfo, ImgDoctorTimetable, ImgpCheckin, ImgpCheckinAfford, ImgpRecipe, ImgpRecipeAffo... | StarcoderdataPython |
3458799 | <gh_stars>0
from setuptools import setup
setup(
name="GSVDevice",
version="0.0.1",
author="<NAME>",
author_email="",
description="A Python module for communicating with GSV6/8 devices",
url="",
packages=['GSVDevice'],
classifiers=[
"Programming Language :: Python :: 3",
... | StarcoderdataPython |
4984167 | <filename>src/train_detector.py
import dlib
options = dlib.simple_object_detector_training_options()
options.C = 1.0
options.num_threads = 8
options.be_verbose = True
dlib.train_simple_object_detector('/home/shammyz/repos/dlib-pupil/annotations.xml', '/home/shammyz/repos/dlib-pupil/detector.svm', options)
print("[INF... | StarcoderdataPython |
3524372 | <reponame>teambge/bge-python-sdk
from validator import Required, In, validate, Length
from bgesdk.management.constants import TAB_CHOICES, LANGUAGE_CHOICES
language = [x[0] for x in LANGUAGE_CHOICES]
tab = [x[0] for x in TAB_CHOICES]
def validator_doc(doc_data):
results = {}
result_errors = {}
validatio... | StarcoderdataPython |
4804978 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 9 20:21:23 2018
@author: <NAME>
"""
from CoTeTo.Loader import Loader
from os.path import isfile
from CoTeTo import jsonld_budo_to_ontology as bo
class BoundaryFile(Loader):
name = 'BoundaryFile'
description = 'load requirements of timeseries... | StarcoderdataPython |
1738622 | <filename>dbops_venv/lib/python3.5/site-packages/alembic/context.py
from .environment import EnvironmentContext
from . import util
# create proxy functions for
# each method on the EnvironmentContext class.
util.create_module_class_proxy(EnvironmentContext, globals(), locals())
| StarcoderdataPython |
9651223 | <gh_stars>0
# Built on top of the original implementation at https://github.com/papermsucode/mdmmt
#
# Modifications by Copyright 2022 Zilliz. 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 co... | StarcoderdataPython |
6699030 | # -*- coding: utf-8 -*-
"""Definition of meta model 'deprecatedelements'."""
from functools import partial
import pyecore.ecore as Ecore
from pyecore.ecore import *
from modality.pyuml2.types import Boolean
from ..portsandflows import FlowDirection
from . import deprecatedelements_mixins as _user_module
name = "depre... | StarcoderdataPython |
311565 | <filename>arekit/common/experiment/api/ctx_training.py
from arekit.common.experiment.api.ctx_base import DataIO
class TrainingData(DataIO):
""" Data, that is necessary for models training stage.
"""
def __init__(self, stemmer, labels_count):
super(TrainingData, self).__init__(stemmer)
se... | StarcoderdataPython |
11318333 | <filename>demos/aspect_polarity_classification/bert-baselines/train_apc_bert_baseline.py<gh_stars>10-100
# -*- coding: utf-8 -*-
# file: train_apc_bert_baseline.py
# time: 2021/7/27
# author: yangheng <<EMAIL>>
# github: https://github.com/yangheng95
# Copyright (C) 2021. All Rights Reserved.
from pyabsa impo... | StarcoderdataPython |
5176036 | #!/usr/bin/env python
#------------------------------------------------------------------------------
# Copyright 2015 Esri
# 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.apac... | StarcoderdataPython |
1972101 | import unittest
import os
import pyopenms
class TestChromatogramExtractor(unittest.TestCase):
def setUp(self):
dirname = os.path.dirname(os.path.abspath(__file__))
self.filename = os.path.join(dirname, "test.TraML")
self.filename_mzml = os.path.join(dirname, "test2.mzML")
def test_ex... | StarcoderdataPython |
6634797 | # -*- coding: utf-8 -*-
from __future__ import generator_stop
import json
from codecs import open
from pprint import pprint
import tatsu
from tatsu.ast import AST
from tatsu.walkers import NodeWalker
from codegen import PostfixCodeGenerator # pylint: disable= E0401 # noqa
def simple_parse():
grammar = open('g... | StarcoderdataPython |
8122055 | import unittest
from ..source.example import prove_works
class Test_example(unittest.TestCase):
def test_one(self):
example = prove_works()
self.assertEqual(example.mirror(1), 1)
if __name__=='__main__':
unittest.main()
| StarcoderdataPython |
364667 | from ansiscape.enums import InterpretationKey, NamedColor, SelectGraphicRendition
from ansiscape.handlers import get_color_interpreter, get_interpreter_for_sgr
from ansiscape.interpreters import register_interpreters
from ansiscape.sequence import Sequence
from ansiscape.types import Color, Interpretation, SequencePart... | StarcoderdataPython |
9788528 | <filename>table_enforcer/main_classes.py
# -*- coding: utf-8 -*-
"""Main module."""
import typing as t
import pandas as pd
from box import Box
from table_enforcer.errors import ValidationError, RecodingError
from .utils import validate as v
__all__ = [
"Enforcer",
"BaseColumn",
"Column",
"CompoundCol... | StarcoderdataPython |
3368741 | # API to submit Flight Declarations into Spotlight
from os import environ as env
import redis, json
import requests
import logging
from datetime import datetime, timedelta
class PassportCredentialsGetter():
def __init__(self):
pass
def get_cached_credentials(self):
r = redis.Redis(host=en... | StarcoderdataPython |
3291849 | from __future__ import absolute_import, division, print_function, unicode_literals
from six import python_2_unicode_compatible
from canvasapi.canvas_object import CanvasObject
from canvasapi.util import combine_kwargs
@python_2_unicode_compatible
class Login(CanvasObject):
def __str__(self):
return "{}... | StarcoderdataPython |
257041 | <reponame>jonadaly/neomodel<filename>test/test_relationship_models.py
from datetime import datetime
from pytest import raises
import pytz
from neomodel import (StructuredNode, StructuredRel, Relationship, RelationshipTo,
StringProperty, DateTimeProperty, DeflateError)
HOOKS_CALLED = {
'pre_... | StarcoderdataPython |
8041407 | <reponame>cam-parra/indy-plenum
from plenum.test import waits
from plenum.test.node_request.helper import sdk_ensure_pool_functional
from plenum.test.restart.helper import get_group, restart_nodes
nodeCount = 7
TestRunningTimeLimitSec = 150
def test_restart_groups_4_of_7_wp_tm(looper, txnPoolNodeSet, tconf, tdir,
... | StarcoderdataPython |
1652208 | <reponame>ClinGen/gene-and-variant-curation-tools<filename>gci-vci-serverless/tests/unit/test_ddb_update_expression_builder.py
import pytest
from src.db.ddb_client import UpdateExpressionBuilder
def test_builds_set_expression():
test_builder = UpdateExpressionBuilder()
test_builder.append_set('foo')
test_builde... | StarcoderdataPython |
143442 | # -*- coding: utf-8 -*-
# @Author : LG
"""
执行用时:104 ms, 在所有 Python3 提交中击败了64.10% 的用户
内存消耗:14.4 MB, 在所有 Python3 提交中击败了79.35% 的用户
解题思路:
具体实现见代码注释
"""
class Solution:
def mergeTrees(self, t1: TreeNode, t2: TreeNode) -> TreeNode:
def find(root1, root2): # 两棵树的对应节点
if root1 and root2: # 如果节点都存... | StarcoderdataPython |
6644305 | # Ler o nome de uma pessoa e diga se ela tem Silva no nome
name = input('Digite seu nome: ').strip()
print('Seu nome tem Silva? {} ' .format('silva' in name.lower()))
| StarcoderdataPython |
122016 | <reponame>junkert/helios
#!/usr/bin/python
import os
import sys
import time
import json
import pprint
import random
import signal
import shutil
import LPD8806
import colorsys
import threading
import traceback
# Globals
num_leds = 160
colors = {'r': 0, 'g': 0, 'b': 0, 'v': 1.0}
output_dict = {}
random.seed(time.time())... | StarcoderdataPython |
5170295 | <reponame>yvsdrop/UnityPy
from .EndianBinaryReader import EndianBinaryReader
from .EndianBinaryWriter import EndianBinaryWriter
| StarcoderdataPython |
1813009 | from .sql_base import SqlReader, NameCompare
from .engine import Engine
import copy
import warnings
import re
class PandasReader(SqlReader):
ENGINE = Engine.PANDAS
def __init__(self, df, metadata):
super().__init__()
# using string here, because we don't want to import .metadata due to circula... | StarcoderdataPython |
4947772 | <filename>BasicPythonPrograms/PythonOops.py<gh_stars>0
# Demonstration A Class
class Dog:
#A simple class attribute
attr1= "mammal"
attr2="Dog"
# A sample method
def fun(self):
print("I am a ",self.attr1)
print("I ma a ",self.attr2)
#Driver code
# Object instantiation
Rodger ... | StarcoderdataPython |
384966 | from pyjexl import JEXL
class QuestionJexl(JEXL):
def __init__(self, **kwargs):
super().__init__(**kwargs)
# TODO: add transforms
# self.add_transform("task", lambda spec: spec)
| StarcoderdataPython |
6514648 | <reponame>ads-ad-itcenter/qunomon.forked
# Copyright © 2019 National Institute of Advanced Industrial Science and Technology (AIST). All rights reserved.
from typing import List
from marshmallow import fields
from . import Result, ResultSchema, BaseSchema
class Format:
def __init__(self, id_: int, type_:... | StarcoderdataPython |
9658214 | <reponame>EnjoyLifeFund/macHighSierra-py36-pkgs
# test_smoke.py -- Functional tests for the Swift backend.
# Copyright (C) 2013 eNovance SAS <<EMAIL>>
#
# Author: <NAME> <<EMAIL>>
#
# Dulwich is dual-licensed under the Apache License, Version 2.0 and the GNU
# General Public License as public by the Free Software Found... | StarcoderdataPython |
1894663 | from uuid import uuid4
import arrow
import pytest
from databases import Database
from httpx import AsyncClient
from cyberbox import orm
from cyberbox.routes.auth import crypt_context
@pytest.fixture()
async def create_users(db: Database):
hashed_password = crypt_context.hash("<PASSWORD>")
values = [
... | StarcoderdataPython |
8002934 | <gh_stars>0
from constructs import Construct
from random import randint, randrange
from aws_cdk import (
Duration,
Stack,
aws_iam as iam,
aws_sqs as sqs,
aws_sns as sns,
aws_sns_subscriptions as subs,
aws_apigateway as apigateway,
aws_s3 as s3,
aws_stepfunctions as _aws_stepfunctions... | StarcoderdataPython |
9690580 | <gh_stars>1-10
"""Core code to be used for scheduling a task DAG with HEFT"""
import argparse
from collections import deque, namedtuple
from enum import Enum
import logging
from math import inf
import sys
from types import SimpleNamespace
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
from ... | StarcoderdataPython |
1831950 | <reponame>tonybaloney/retox
from setuptools import setup
import retox
with open('README.rst') as readme:
long_description = readme.read()
_version = retox.__version__
requirements = [
'tox==2.9.1',
'eventlet==0.21.0',
'asciimatics==1.9.0',
'pathlib2==2.3.0',
]
def main():
setup(
n... | StarcoderdataPython |
1617371 | from typing import Any, Optional, List
import sys
import signal
import time
import asyncio
import os.path
import shutil
import tempfile
import subprocess
import portpicker
import aiohttp
import logging
logger = logging.getLogger(__name__)
from .paths import Paths
from .controller import Controller
class kill_switch... | StarcoderdataPython |
6628710 | # Open3D: www.open3d.org
# The MIT License (MIT)
# See license file or visit www.open3d.org for details
# examples/python/Advanced/remove_geometry.py
import open3d as o3d
import numpy as np
import time
import copy
def visualize_non_blocking(vis, pcds):
for pcd in pcds:
vis.update_geometry(pcd)
vis.p... | StarcoderdataPython |
97735 | import os
from tweepy.auth import OAuthHandler
from tweepy.api import API
from dotenv import load_dotenv
load_dotenv(verbose=True)
class TweepyAuth:
"""
class used to handle app authentication
"""
consumer_key = os.getenv("API_KEY")
consumer_secret = os.getenv("API_SECRET_KEY")
access_token = ... | StarcoderdataPython |
32213 | # Copyright 2017 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.
# pylint: disable=no-member,relative-import
"""Unit tests for blink_idl_parser.py."""
import unittest
from blink_idl_parser import BlinkIDLParser
class B... | StarcoderdataPython |
3204531 | <reponame>kedixa/pyworkflow
import signal
import sys
import threading
import pywf as wf
def process(task):
req = task.get_req()
resp = task.get_resp()
resp.append_body(b"<html>\n") # as bytes
resp.append_body(
f"<p>{req.get_method()} "
f"{req.get_request_uri()} "
f"{req.get_... | StarcoderdataPython |
8156821 | <gh_stars>0
import numpy as np
from sidnet import MUSHR
import tflearn
import cv2
import time
WIDTH = 320
HEIGHT = 240
LR = 0.01
EPOCH = 1
MODEL_NAME ='MUSHR_-{}-{}-{}-{}.model'.format(LR,'TRAJ',EPOCH,'steering')
model = MUSHR(HEIGHT,WIDTH,LR)
model.load(MODEL_NAME)
output_path = "C:/Python37/Donke... | StarcoderdataPython |
3319275 | inp = int(input("Enter N: "))
m = []
for i in range(0 , inp):
n = int(input("Enter numbers: "))
m.append(n)
m.sort()
mis = 0
rep = 0
flg = 0
for i in range(1 , inp + 1):
flg = 0
for j in range(0 , len(m)):
if i == m[j]:
flg = 1
break
if flg == 0:
mis = i
... | StarcoderdataPython |
8133309 | import unittest
from pyEmitter.emitter import EventEmitter
class TestEventEmitter(unittest.TestCase):
def setUp(self):
self.emitter = EventEmitter();
def test_AddingHandlerToEvent(self):
self.assertIsNone(self.emitter.on("Test On", lambda *x: print(x)));
def test_EmittingEvent(self):
... | StarcoderdataPython |
1736756 | <filename>open_spiel/contrib/python/export_graph.py
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.... | StarcoderdataPython |
12809913 | <gh_stars>1-10
import tensorflow.keras.backend as K
from groupy.gconv.tensorflow_gconv.splitgconv2d import gconv2d_util
from tensorflow.keras.layers import InputSpec, Conv2D, Conv2DTranspose
from tensorflow.keras.utils import get_custom_objects
from keras_gcnn.transform_filter import transform_filter_2d_nhwc
class GC... | StarcoderdataPython |
305168 | #!/usr/bin/env python
# Copyright 2017 <NAME>
#
# Licensed under the modified BSD (3-clause BSD) License.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied... | StarcoderdataPython |
3379643 | <gh_stars>1-10
# For Discord
import discord
from discord.ext import commands
# from discord_slash import cog_ext, SlashContext
from tabulate import tabulate
import os
import speech_recognition as sr
# Function to write into database
def write_db(db: dict) -> None:
with open("database", 'w+') as file:
file... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.