id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3446400 | import pandas as pd
class Operation:
def __init__(self):
self.operation = pd.DataFrame(
{'u': [4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., 15., 16., 17., 18., 19., 20., 21.,
22., 23., 24., 25., ],
'pitch': [2.751, 1.966, 0.896, 0., 0., 0., 0., 0., 4.502, 7... | StarcoderdataPython |
11374187 | <gh_stars>0
import pickle
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from config import Config
Config.MODELS_PATH.mkdir(parents=True, exist_ok=True)
X_train = pd.read_csv(str(Config.FEATURES_PATH / "train_features.csv"))
y_train = pd.read_csv(str(Config.FEATURES_PATH / "train_labels.csv")... | StarcoderdataPython |
1937775 | <filename>charge_density_methods_VASP/path_slice.py
from numpy import zeros, shape, dot, array
from numpy.linalg import norm, inv
import matplotlib.pyplot as plt
from matplotlib.patches import Patch
from math import floor
from matplotlib.ticker import FormatStrFormatter
from copy import deepcopy
from lib import parse_... | StarcoderdataPython |
11285652 | import os
import sqlite3
from process_cities import get_cities
def export_db(db, file_path):
with open(file_path, 'w') as f:
for line in db.iterdump():
f.write(line + '\n')
def create_db(output_dir, full=False):
basename = 'cities'
if full:
basename += '-full'
db_filepath... | StarcoderdataPython |
1620412 | from __future__ import unicode_literals
import json
from textwrap import dedent
from django.utils import six
from django.utils.six.moves.urllib.parse import urlparse
from reviewboard.hostingsvcs.models import HostingServiceAccount
from reviewboard.hostingsvcs.tests.testcases import ServiceTests
from reviewboard.scmt... | StarcoderdataPython |
4832722 | <gh_stars>1-10
#!/usr/bin/python3
import unittest
import logging
logging.basicConfig(level=logging.INFO)
from time import sleep
from unittest.case import TestCase
from SiddhiCEP3.core.SiddhiManager import SiddhiManager
from SiddhiCEP3.core.stream.output.StreamCallback import StreamCallback
from Tests.Util.AtomicInt ... | StarcoderdataPython |
188457 | <gh_stars>1-10
from haystack.indexes import *
from oscar.core.loading import import_module
product_models = import_module('product.models', ['Item'])
class AbstractProductIndex(SearchIndex):
u"""
Base class for products solr index definition. Overide by creating your
own copy of oscar.search_indexes.py
... | StarcoderdataPython |
6561244 | # Copyright 2016 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/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
266795 | <gh_stars>0
from application.service.blockchain_response import get_blockchain_for_token_response
from application.service.conversion_fee_respose import get_conversion_fee_response
from constants.entity import TokenPairEntities, TokenEntities
def get_token_response(token):
return {
TokenEntities.ID.value:... | StarcoderdataPython |
1693805 | from direct.interval.FunctionInterval import Func
from direct.interval.LerpInterval import LerpFunc
from direct.interval.MetaInterval import Sequence
from panda3d.core import TextNode
from toontown.toonbase import ToontownGlobals
import CogdoGameConsts
class CogdoGameMessageDisplay:
UpdateMessageTaskName = 'Messag... | StarcoderdataPython |
394242 | <gh_stars>1-10
import unittest
import os
from datetime import datetime, timedelta
from unittest.mock import patch
from spaceone.core.unittest.result import print_data
from spaceone.core.unittest.runner import RichTestRunner
from spaceone.core import config
from spaceone.core import utils
from spaceone.core.transaction... | StarcoderdataPython |
18186 | <filename>moex/tests/test_service.py
import asyncio
import unittest
from moex.service import Cbr, Moex
class CbrTest(unittest.TestCase):
def setUp(self) -> None:
self.cbr = Cbr('01.01.2021')
def test_usd(self):
self.assertEqual(self.cbr.USD, 73.88)
def test_euro(self):
self.ass... | StarcoderdataPython |
79542 | """
You are playing the following Bulls and Cows game with your friend: You
write down a number and ask your friend to guess what the number is. Each
time your friend makes a guess, you provide a hint that indicates how many
digits in said guess match your secret number exactly in both digit and
... | StarcoderdataPython |
3337307 | <gh_stars>0
import os
from evaluation.simple_evaluation import evaluate
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
import numpy as np
import pandas as pd
import tensorflow.keras.models as models
from data.get_data import get_feature_targets
from sklearn.model_selection ... | StarcoderdataPython |
9673281 | #!/usr/bin/python3
# -------------------------------------------------------------------------------
# movies.py
# by <NAME>
# Scrapes website for movies playing in Edmonton, fetches ratings
# and compiles list of high rated movies. Emails list
# !!!
# This product uses the TMDb API but is not endorsed or certified by ... | StarcoderdataPython |
117187 | <reponame>jordyril/PythonLaTeX<filename>pythonlatex/float.py
"""
"""
from pylatex import Command, NoEscape, Package
from pylatex.base_classes import Float
class FloatAdditions(Float):
def __init__(self):
self._label = ""
def add_caption_description(self, caption, above=True, description=None):
... | StarcoderdataPython |
5199378 | import os
import torch
import json
import collections
import gtimer as gt
from tqdm import tqdm
from importlib import import_module
from torch import nn
from tensorboardX import SummaryWriter
from alfred.utils import data_util, model_util
class LearnedModel(nn.Module):
def __init__(self, args, embs_ann, vocab_o... | StarcoderdataPython |
9786134 | <reponame>EkremBayar/bayar<gh_stars>0
# -*- coding: utf-8 -*-
import os
import sys
from copy import deepcopy
from contextlib import suppress
from itertools import chain
from types import SimpleNamespace as NS
from warnings import warn
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import ... | StarcoderdataPython |
123276 | <filename>src/901_1000/0917_reverse-only-letters/reverse-only-letters.py<gh_stars>1-10
class Solution(object):
def reverseOnlyLetters(self, S):
"""
:type S: str
:rtype: str
"""
if not S:
return S
n = len(S)
i = 0
j = n-1
arr = list(S)
while i<j:
if not arr[i].isalpha():
i += 1
elif no... | StarcoderdataPython |
9713500 | # ============= COMP90024 - Assignment 2 ============= #
#
# The University of Melbourne
# Team 37
#
# ** Authors: **
#
# <NAME> 1048105
# <NAME> 694209
# <NAME> 980433
# <NAME> 640975
# <NAME> 1024577
#
# Location: Melbourne
# ==... | StarcoderdataPython |
3436858 | """Virtual server order options."""
# :license: MIT, see LICENSE for more details.
import os
import os.path
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
@click.command()
@environment.pass_env
def cli(env):
"""Virtual server order options."""
vsi =... | StarcoderdataPython |
11319698 | """
Python functions that takes a Web request and returns a Web response.
"""
from django.shortcuts import render, redirect
from django.http import JsonResponse
from api.utils import interactions
from api.utils import sessions
import api.models
def index(request):
"""
Home page
"""
user ... | StarcoderdataPython |
3422839 | __version__ = "0.1.0"
default_app_config = "rest_scaffold.apps.CustomConfig"
| StarcoderdataPython |
4956307 | <reponame>lcscim/python-demo
import numpy as np
"""
函数说明:创建数据集
Parameters:
无
Returns:
group - 数据集
labels - 分类标签
Modify:
2017-07-13
"""
def createDataSet():
#四组二维特征
group = np.array([[1,101],[5,89],[108,5],[115,8]])
#四组特征的标签
labels = ['爱情片','爱情片','动作片','动作片']
return group, labels
if... | StarcoderdataPython |
6688686 | <reponame>indobenchmark/indonlg<gh_stars>10-100
from argparse import ArgumentParser
from transformers import AlbertConfig, AlbertTokenizer, AlbertForSequenceClassification, AlbertModel
from transformers import BertConfig, BertTokenizer, BertForSequenceClassification, BertForPreTraining, BertModel
from transformers impo... | StarcoderdataPython |
9717868 | #!/usr/bin/env python3
# ==============================================================================
# Copyright 2018-2020 Intel Corporation
#
# 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 Licens... | StarcoderdataPython |
6475056 | <reponame>MaastrichtU-IDS/prodigy-drug-indication-annotation
import spacy
nlp=spacy.load('diseases-model')
with open('../drugcentral-dailymed-labels.txt') as f:
for l in f:
doc =nlp(l)
nents= [(ent.text, ent.label_) for ent in doc.ents]
print (l)
print (nents)
input("next")
| StarcoderdataPython |
8038343 | <gh_stars>1000+
#===----------------------------------------------------------------------===##
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------... | StarcoderdataPython |
3298872 | # Python 3
def binary_search(array, item):
"""返回 item 在 array 中的下标,没找到返回 None。"""
low = 0
high = len(array) - 1
while low <= high:
mid = (low + high) // 2
guess = array[mid]
if guess == item:
return mid
elif guess > item:
high = mid - 1
el... | StarcoderdataPython |
3582066 | import discord
import os
from discord.ext import commands
from config import TOKEN, PREFIX
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix=PREFIX, intents=intents)
bot.remove_command("help")
@bot.event
async def on_ready():
await bot.change_presence(status=discord.S... | StarcoderdataPython |
9734718 | <gh_stars>1-10
# gpl: author <NAME>
import bpy
import os
# Allow changing the original material names from the .blend file
# by replacing them with the UI Names from the EnumProperty
def get_ui_mat_name(mat_name):
mat_ui_name = "CrackIt Material"
try:
# access the Scene type directly to get the name ... | StarcoderdataPython |
6775 | # Copyright 2017 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/LICENSE-2.0
#
# Unless required by... | StarcoderdataPython |
1629430 | <reponame>bimri/programming_python<filename>chapter_6/split-join-Usage.py
"Usage Variations"
'''
When run without full command-line arguments, both
split and join are smart enough to input their parameters interactively.
'''
"""
C:\temp> python C:\...\PP4E\System\Filetools\split.py
File to be split? python-3.1.msi
Dir... | StarcoderdataPython |
334159 | from .forms import AgentForm, UserSignup
from allauth.account.views import SignupView
class AgentFormView(SignupView):
form_class = AgentForm
template_name = 'account/agent_signup.html'
class UserFormView(SignupView):
form_class = UserSignup
template_name = 'account/signup.html'
| StarcoderdataPython |
383919 | <filename>rcc_dp/experiment_test.py
# Copyright 2021, Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | StarcoderdataPython |
1986434 | <gh_stars>0
api_token = "acd44<PASSWORD>"
secret_key = "4aef76e06c55ad53"
tokens = ['3df6633de8a6326a8c7851dedf02e83d16f80d3a9b744c4b037a29c05c597b42']
| StarcoderdataPython |
1875806 | <reponame>monomonedula/veil<gh_stars>1-10
from inspect import iscoroutinefunction
from typing import Optional, Dict, Any
from wrapt import ObjectProxy
from veils._async_dummy import async_dummy
from veils.veil_factory import VeilFactory
class Unpiercable:
__slots__ = (
"_origin",
"_methods",
... | StarcoderdataPython |
8114213 | <gh_stars>1-10
from __future__ import print_function, absolute_import
from ortools.constraint_solver import pywrapcp
from ortools.constraint_solver import routing_enums_pb2
from . import basicrouter
class MultiVehicleRouter(basicrouter.BasicRouter):
def __init__(self, input_addresses, api_key, num_vehicles, start... | StarcoderdataPython |
1809437 | #! /usr/bin/env python
"""Tests for ``catalog_seed_generator.py`` module
Authors
-------
<NAME>
Use
---
These tests can be run via the command line:
::
pytest -s test_catalog_seed_generator.py
"""
from astropy.table import Table
import numpy as np
import os
import pytest
import sys
import web... | StarcoderdataPython |
6426957 | import os
import pytest
from ekorpkit import eKonf
def test_setiment_lexicon():
ngram_cfg = eKonf.compose(config_group="model/ngram=mpko_lex")
ngram_cfg.verbose = True
ngram_cfg.auto.load = True
ngram = eKonf.instantiate(ngram_cfg)
sentence = "투기를 억제하기 위해 금리를 인상해야 한다."
tokens = ngram.ngramize... | StarcoderdataPython |
3327316 | <reponame>fuco99/bjt_devsim
# Copyright 2016 Devsim LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | StarcoderdataPython |
1884445 | # Version of the aspect-based-sentiment-analysis package
__version__ = "2.0.3"
from .alignment import tokenize
from .alignment import make_alignment
from .alignment import merge_tensor
from .aux_models import ReferenceRecognizer
from .aux_models import BasicReferenceRecognizer
from .aux_models import PatternRecognize... | StarcoderdataPython |
210227 | """Submission execution internals for PyBryt"""
__all__ = ["check_time_complexity", "MemoryFootprint", "no_tracing", "TimeComplexityResult"]
import os
import dill
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
from copy import deepcopy
from tempfile import mkstemp
from typing import Any, Lis... | StarcoderdataPython |
3263167 | <reponame>inactivist/twitter-streamer
#!/usr/bin/env python
import re
from setuptools import find_packages, setup
VERSION_FILE = "streamer/__init__.py"
with open(VERSION_FILE) as version_file:
match = re.search(
r"^__version__ = ['\"]([^'\"]*)['\"]", version_file.read(), re.MULTILINE
)
if match:
... | StarcoderdataPython |
9725101 | #!/usr/bin/env python
"""
.. currentmodule:: test_core
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import re
from copy import deepcopy
from dataclasses import replace
from pathlib import Path
import pytest
from aiidalab_launch.instance import RequiresContainerInstance
from aiidalab_launch.profile import Profile
async d... | StarcoderdataPython |
5162720 | from jieba import analyse
tfidf = analyse.extract_tags
for line in open("../data/data_full.txt", 'r', encoding='utf-8'):
text = line
keywords = tfidf(text,allowPOS=('ns','nr','nt','nz','nl','n', 'vn','vd','vg','v','vf','a','an','i'))
result=[]
for keyword in keywords:
result.a... | StarcoderdataPython |
8185299 | <filename>itest/base.py<gh_stars>10-100
import sys
from subprocess import PIPE, Popen, STDOUT
from threading import Thread
import os.path
import tempfile
from Queue import Queue, Empty
ON_POSIX = 'posix' in sys.builtin_module_names
__all__ = [
"read_until",
"AirpnpProcess",
]
def enqueue_output(out, queue)... | StarcoderdataPython |
8011054 | # Example
# %%
from ipyccmd import display_ccmd, DisplayType
from ipyccmd import md_print
import numpy as np
r = 5
h = 20
volume = np.pi * r**2 * h
"---".md()
"## Using `display_ccmd()` or curse `.md()`".md(dtype=DisplayType.MARKDOWN)
"<hr>".md(dtype=DisplayType.HTML)
"""Thus we have calculated the **volum... | StarcoderdataPython |
1759822 | <reponame>Pipal2k/dynatrace-sql-plugin
import pymongo
from mongodb import MongoDB
from bson.objectid import ObjectId
import json
from time import time
import config
import requests
class DynatraceAPI:
def __init__(self,config):
self.server = config['DTAPIURL']
self.token = config['dtAPIToken']
se... | StarcoderdataPython |
1953941 | <reponame>xinhaiwang/piot-python-components
#####
#
# This class is part of the Programming the Internet of Things
# project, and is available via the MIT License, which can be
# found in the LICENSE file at the top level of this repository.
#
# Copyright (c) 2020 by <NAME>
#
import logging
import unittest
import ... | StarcoderdataPython |
6670871 | <filename>gui_components/utils.py
import pygame.locals as pl
from gui_components.defines import *
class Button:
def __init__(self, name, surface, rect, border_width=None):
self.name = name
self.surface = surface
self.rect = rect
self.border_width = border_width
def draw_bord... | StarcoderdataPython |
366412 | from cose.algorithms import CoseAlgorithm, Direct, A128GCM, AESCCM1664128
from cose.headers import Algorithm
def test_header():
alg_1 = Algorithm
alg_2 = Algorithm
assert alg_1 == alg_2
assert id(alg_1) == id(alg_2)
assert Algorithm == alg_2
assert int(Algorithm()) == alg_2.identifier
as... | StarcoderdataPython |
3219700 | <filename>pglifecycle/validation.py<gh_stars>1-10
"""
Data validation using bundled JSON-Schema files
"""
import functools
import logging
import pathlib
import jsonschema
from jsonschema import exceptions
import pkg_resources
from pglifecycle import yaml
LOGGER = logging.getLogger(__name__)
def validate_object(ob... | StarcoderdataPython |
154314 | '''
N = int(input())
notas100 = N//100
notas50 = (N-(notas100*100))//50
notas20 = (N-(notas100*100+notas50*50))//20
notas10 = (N-(notas100*100+notas50*50+notas20*20))//10
notas5 = (N-(notas100*100+notas50*50+notas20*20+notas10*10))//5
notas2 = (N-(notas100*100+notas50*50+notas20*20+notas10*10+notas5*5))//2
notas1 = (N-... | StarcoderdataPython |
62096 | from rest_framework import serializers
from .models import Image, Video
class ImageSerializer(serializers.ModelSerializer):
class Meta:
model = Image
fields= '__all__'
class VideoSerializer(serializers.ModelSerializer):
class Meta:
model = Video
fields= '__all__' | StarcoderdataPython |
8086799 | <reponame>TS-at-WS/cloudify-manager<gh_stars>0
#########
# Copyright (c) 2017 GigaSpaces 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:/... | StarcoderdataPython |
8025214 | import numpy as np
import transformers
import spacy
from spacy.lang.en import English
import tokenizations
import networkx as nx
# import matplotlib.pyplot as plt
import datamodules
if __name__ == '__main__':
model = transformers.AutoModelForMultipleChoice.from_pretrained("LIAMF-USP/roberta-large-finetuned-race... | StarcoderdataPython |
9665508 | <filename>sims-g2/vlasov-test-ptcls/c6/plot-oscc-e-1d.py
from pylab import *
import postgkyl as pg
style.use('../code/postgkyl.mplstyle')
def plotFig(i,fr):
print("Working on %d ..." % i)
data = pg.GData("c6-oscc-E_ions_%d.bp" % fr)
dg = pg.data.GInterpModal(data, 2, "ms")
XX, q = dg.interpolate()
... | StarcoderdataPython |
8107272 | '''Pre-processing image.'''
import cv2
import recognition
import solution
_WIDTH = 500
def _cut_img(img, bbox):
'''Crop an image.'''
x, y, w, h = bbox
return img[y:y+h, x:x+w]
def _find_larger_cells(img, thresh=0):
'''Find larger cells.'''
img_gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
_,... | StarcoderdataPython |
6425202 | <gh_stars>10-100
"""Grammar for BigQuery types."""
from typing import List, Sequence, Tuple, Union # noqa: F401
from .bq_abstract_syntax_tree import AppliedRuleOutputType # noqa: F401
from .bq_types import BQType # noqa: F401
from .bq_types import BQArray, BQScalarType, BQStructType
from .query_helper import apply... | StarcoderdataPython |
3456302 | <gh_stars>1-10
from torchflare.interpreters.base_cam import BaseCam
from torchflare.interpreters.grad_cam import GradCam
from torchflare.interpreters.grad_campp import GradCamPP
from torchflare.interpreters.gradients import SaveHooks
from torchflare.interpreters.visualize import visualize_cam
__all__ = ["BaseCam", "Gr... | StarcoderdataPython |
6703679 | <filename>otp/otpbase/PythonUtil.py
import __builtin__
# class 'decorator' that records the stack at the time of creation
# be careful with this, it creates a StackTrace, and that can take a
# lot of CPU
def recordCreationStack(cls):
if not hasattr(cls, '__init__'):
raise 'recordCreationStack: class \'%s\'... | StarcoderdataPython |
5012789 | <gh_stars>100-1000
import warnings
warnings.filterwarnings("ignore")
import numpy as np
from sklearn.model_selection import StratifiedKFold, train_test_split
from sklearn.neural_network import MLPClassifier
from uq360.utils.transformers.feature_transformer import FeatureTransformer
from uq360.utils.transformers.confi... | StarcoderdataPython |
1849063 | from .app import APP
#APP = create_app()
| StarcoderdataPython |
3383984 | <filename>test/tests/polymorphism_small.py
class Union(object):
def __init__(self, subs):
self.subs = subs
def score(self):
t = 0
for s in self.subs:
t += s.score()
t /= len(self.subs) ** 2.0
return t
class Simple(object):
def score(self):
return... | StarcoderdataPython |
5091882 | <reponame>LuRenJiasWorld/ncm-playlist-syncer<filename>init.py
# -----------------------------------------------------------
# ------------Netease Cloud Music Playlist Syncer------------
# ---https://github.com/LuRenJiasWorld/ncm-playlist-syncer---
# ----------------- © LuRenJiasWorld 2018 -------------------
# --------... | StarcoderdataPython |
3567366 | <gh_stars>1-10
# Copyright (c) 2019 <NAME> <<EMAIL>>
# ISC License <https://opensource.org/licenses/isc>
import io
import re
import collections
import configparser
DEFAULT_DELIMITER = ":"
class INIParser(configparser.ConfigParser):
""" A custom INI (config) parser which obeys the Mozilla files specification.
... | StarcoderdataPython |
9749440 | <gh_stars>0
"""
This package contains the source for stripstream.
""" | StarcoderdataPython |
1915322 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | StarcoderdataPython |
6619623 | ###############################################################################
# Copyright Kitware Inc. and Contributors
# Distributed under the Apache License, 2.0 (apache.org/licenses/LICENSE-2.0)
# See accompanying Copyright.txt and LICENSE files for details
#########################################################... | StarcoderdataPython |
1906107 | """
schema for asyncpg sessions is "asyncpg_telethon"
"""
from typing import List, Optional, Dict, Any, Union, Callable, Tuple
import asyncio
import uuid
from abc import ABC
import datetime
import logging
import asyncpg
from telethon import utils
from telethon.crypto import AuthKey
from telethon.tl import types
from... | StarcoderdataPython |
1719611 | <reponame>michal-narajowski/pts-keys-watchdog<gh_stars>0
import xml.etree.ElementTree as ET
import time
class NetworkData:
def __init__(self, index, network_key, iv_index):
self.index = index
self.network_key = network_key
self.iv_index = iv_index
def __str__(self):
... | StarcoderdataPython |
361991 | # mcu.py
# a comprehensive library for communicating with the MATE OQBot.
# please read docs/packet_structure.md and docs/command_list.md for more information.
# there is a CLI for testing available at mcu_cli.py. read docs/mcu_cli.md for usage.
import serial
import struct
import time
import threading
from queue impor... | StarcoderdataPython |
4880069 | <reponame>tunealog/python-web-scraping
# Python Web Scraping
# Title : Export CSV
# Date : 2020-08-26
# Creator : tunealog
import csv
import requests
from bs4 import BeautifulSoup
url = "https://finance.naver.com/sise/sise_market_sum.nhn?sosok=0&page="
filename = "Stock1-200.csv"
f = open(filename, "w", encoding="u... | StarcoderdataPython |
3340297 | <reponame>Passer-D/GameAISDK<filename>tools/SDKTool/src/WrappedDeviceAPI/deviceAPI/pcDevice/iPcDeviceAPI.py
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making GameAISDK available.
This source code file is licensed under the GNU General Public License Version 3.
For full detai... | StarcoderdataPython |
1747131 | <filename>airflow_indexima/operators/indexima.py
"""Indexima operators module definition."""
import datetime
from typing import Optional, Union
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
from airflow_indexima.connection import ConnectionDecorator
from airflow_indexima.... | StarcoderdataPython |
8179139 | <gh_stars>1-10
from django.test import TestCase
from django.utils import timezone
from django_iot.apps.devices.models import Device
from django_iot.apps.observations.models import Attribute, PowerStatus
from datetime import timedelta
class TestAttribute(TestCase):
def setUp(self):
# set up device
... | StarcoderdataPython |
4971235 | # from binaryninja import *
import os
import webbrowser
import time
try:
from urllib import pathname2url # Python 2.x
except:
from urllib.request import pathname2url # Python 3.x
from binaryninja.interaction import get_save_filename_input, show_message_box
from binaryninja.enums import MessageBoxButt... | StarcoderdataPython |
5164367 | <gh_stars>1-10
import numpy
import pygame
from pygame.locals import *
from sys import exit
import random
import pygame.surfarray as surfarray
pygame.init()
screen = pygame.display.set_mode((640,480),0,32)
#Creating 2 bars, a ball and background.
back = pygame.Surface((640,480))
background = back.convert()
background... | StarcoderdataPython |
157446 | <gh_stars>10-100
#!/usr/bin/python
import getpass
url = ''
usr = ''
passwd = <PASSWORD>()
| StarcoderdataPython |
8169918 | #!/usr/bin/env python3
import argparse
import contextlib
import os
import subprocess
import sys
STDIN = sys.stdin.fileno()
STDOUT = sys.stdout.fileno()
def error(msg):
print('Error: ' + msg, file=sys.stderr)
def calc_md5(filename):
try:
rv = subprocess.check_output(['md5sum', '--binary', filename... | StarcoderdataPython |
9684109 | description = 'Tensile machine'
group = 'optional'
nameservice = 'antaresctrl.antares.frm2'
devices = dict(
teload = device('nicos.devices.vendor.caress.Motor',
description = 'load value of the tensile machine',
nameserver = '%s' % (nameservice,),
config = 'TELOAD 500 TensileLoad.Controll... | StarcoderdataPython |
8173221 | <reponame>Tehsmash/ironic<gh_stars>0
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# 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... | StarcoderdataPython |
6620400 | <reponame>nichuguen/led-matrix-rpi<gh_stars>0
pathprog = "/home/pi/LED-Project/led-matrix-rpi/c"
clear = pathprog + "/test-clear.run"
ledmatrix = pathprog + "/led-matrix.run"
| StarcoderdataPython |
1855113 | <gh_stars>1-10
from collections import Counter
import re
import numpy as np
import nltk
from .utils import UNK_TOKEN, PAD_TOKEN, MissingDict, BASE_VOCAB
class Preprocessing:
methods = None
def __init__(
self,
standardize=False,
segment_hashtags=0,
contraction... | StarcoderdataPython |
6424897 | # https://github.com/ethereum/py-evm/tree/master/evm/db/backends
| StarcoderdataPython |
368129 | import unittest
import threading
import nanomsg as nn
class ThreadedPipelineTest(unittest.TestCase):
def test_pipeline(self):
result = []
def ping(url, ack):
with nn.Socket(protocol=nn.NN_PUSH) as sock, sock.connect(url):
sock.send(b'Hello, world!')
... | StarcoderdataPython |
5066873 | import torch, os, time, numpy as np
import torch.nn as nn
import torch.optim as optim
from initValues import config
from helper import GanHelper
from tensorboard import summary
import datetime
from torch.autograd import Variable
class Trainer(object):
def __init__(self, outDir):
self.currentTime = str(date... | StarcoderdataPython |
3249279 | <reponame>zseen/hackerrank-challenges
#!/bin/python3
import sys
class BookPage(object):
def __init__(self, left=None, right=None):
self.__left = left
self.__right = right
def matches(self, page):
if page == self.__left or page == self.__right:
return True
return F... | StarcoderdataPython |
9638527 | <filename>src/utils.py<gh_stars>1-10
from csv import reader
import os
import json
import Consent.ADuo as ADuo
import random
def createBasicSet(data_root, diabetes, healthy, outpath):
patientList = []
dirsDiabetes = os.listdir(data_root + diabetes)
patientList = createPatientList(data_root, patientList, di... | StarcoderdataPython |
6473754 | <filename>lab/serializers.py
from rest_framework import serializers
from .models import LabCode, LabProgress
class LabCodeSerializer(serializers.ModelSerializer):
class Meta:
fields = (
'id',
'code',
'date',
)
model = LabCode
class LabProgressSerializer... | StarcoderdataPython |
1774571 | from selenium.webdriver.common.by import By
from constant import PHONE_NUMBER
def login_testing(driver):
print("========test officially started========")
agree_btn = driver.find_element(By.XPATH, "//*[@text='同意并继续']")
agree_btn.click()
driver.find_element(By.XPATH, "//*[@resource-id='<EMAIL>:id/iv_s... | StarcoderdataPython |
1729361 | <reponame>nkpydev/Python-Learning<filename>EXAMPLES/Selenium/webdriver-chrome-example.py<gh_stars>0
#--- Selenium Specific Imports ---#
from selenium import webdriver
from selenium.webdriver import Chrome
#--- Generic Imports ---#
import time
if __name__ == '__main__':
url = 'http://google.com'
browser... | StarcoderdataPython |
253939 | """
This is essentially wrapper arround HiYaPyCo project with streamlined and extended API and couple of work-arrounds.
This module depends on some 3-rd party dependencies, in order to use it, you should have installed first. To do it
run `python3 -m pip install alex-ber-utils[yml]`.
This module doesn't use any packa... | StarcoderdataPython |
12812859 | <reponame>hearai/hearai
import torch.nn as nn
from models.common.simple_sequential_model import SimpleSequentialModel
class LandmarksSequentialModel(nn.Module):
""" Basic sequential model for processing landmarks """
def __init__(self, representation_size=1024, dropout_rate=0.2):
super().__init__()
... | StarcoderdataPython |
4918084 | from src.prefixes import CHEMBLCOMPOUND
from src.babel_utils import pull_via_ftp, make_local_name
import ftplib
import pyoxigraph
def pull_chembl(moleculefilename):
fname = get_latest_chembl_name()
if not fname is None:
# fname should be like chembl_28.0_molecule.ttl.gz
#Pull via ftp is going t... | StarcoderdataPython |
4833060 | from .app import ReactAppAdmin
from .models import ReactTortoiseModelAdmin | StarcoderdataPython |
9605926 | <reponame>jonco3/dynamic<gh_stars>1-10
# output: ok
# Check enough stack space is reserved for handling default arguments
def rr(a = 1, b = 2, c = 3):
return 5
def rrr(a = 1, b = 2, c = 3):
return rr()
assert rrr() == 5
print("ok")
| StarcoderdataPython |
6529995 | <reponame>OtisRed/pah-fm<gh_stars>1-10
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
class BasePage:
def __init__(
self, browser, base_url="http://localhost:8080/login",
logou... | StarcoderdataPython |
9714484 | from trex.stl.trex_stl_hltapi import STLHltStream
class STLS1(object):
'''
Create Eth/IP/UDP steam with random packet size (L3 size from 50 to 9*1024)
'''
def get_streams (self, direction = 0, random_seed = 0, **kwargs):
min_size = 50
max_size = 9*1024
return [STLHltStream(len... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.