id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3278546 | '''
@author: davandev
'''
import abc
class ServiceIf(object):
'''
Interface for services
'''
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def handle_request(self, input):
"""
Abstract method to override to handle received request.
"""
re... | StarcoderdataPython |
1747639 | <reponame>revl/pants<gh_stars>1-10
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.backend.python.register import build_file_aliases
from pants.base.exceptions import TargetDefinitionException
from pants.testutil.test_base im... | StarcoderdataPython |
1633458 | from contract import Forge
FIXED_DEPOSIT_AMOUNT = 10000 * 10**18
print("投资数量为:",FIXED_DEPOSIT_AMOUNT)
def getEthSupply():
eth = Forge.functions.eth_supply().call()
print("当前ETH供应量为:",eth/10 **18)
ndao = Forge.functions.ndao_supply().call()
print("当前NDAO供应量为:",ndao/10 ** 18)
return eth,ndao
def ... | StarcoderdataPython |
3347196 | from assemblyline import odm
from . import PerformanceTimer
MSG_TYPES = {"DispatcherHeartbeat"}
LOADER_CLASS = "assemblyline.odm.messages.dispatcher_heartbeat.DispatcherMessage"
@odm.model()
class Queues(odm.Model):
ingest = odm.Integer()
files = odm.Integer()
@odm.model()
class Inflight(odm.Model):
ma... | StarcoderdataPython |
4834568 | <filename>miriad/squint.py
#!/usr/bin/python3
import shutil, glob, os
import miriad
def split(uvo, uvc, so, lines=[]):
""" Split in different files LL and RR """
from subprocess import CalledProcessError
stks = ['ll', 'rr', 'lr', 'rl']
for stk in stks:
for lin in lines:
path = '{}/{}.{}.{}'.format(uvc, so, ... | StarcoderdataPython |
139298 | from setuptools import setup
# Version meaning (X.Y.Z)
# X: Major version (e.g. vastly different scene, platform, etc)
# Y: Minor version (e.g. new tasks, major changes to existing tasks, etc)
# Z: Patch version (e.g. small changes to tasks, bug fixes, etc)
setup(name='rlbench',
version='1.0.8',
descripti... | StarcoderdataPython |
65189 | <reponame>dpetrovykh/DPy
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 9 10:00:13 2020
@author: dpetrovykh
"""
import math
class Circle:
def __init__(self, radius= 1):
self.radius = float(radius)
@classmethod
def fromDiameter(cls, diameter):
return cls(radius ... | StarcoderdataPython |
187275 | <filename>openai_ros/src/openai_ros/task_envs/turtlebot3/turtlebot3_world.py<gh_stars>0
#!/usr/bin/env python3
import rospy
from openai_ros.robot_envs import turtlebot3_env
from gym import spaces
import numpy as np
class TurtleBot3WorldEnv(turtlebot3_env.TurtleBot3Env):
"""
TurtleBot3WorldEnv class is an ... | StarcoderdataPython |
12311 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Bcache(MakefilePackage):
"""Bcache is a patch for the Linux kernel to use SSDs to cache ot... | StarcoderdataPython |
3286049 | <reponame>redwankarimsony/SSD-Mobilenet-People-Detection
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 8 15:45:16 2019
@author: viswanatha
"""
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Conv2d, Sequential, ModuleList, ReLU
import torch
from mobilenet_ssd_priors ... | StarcoderdataPython |
1662448 | <filename>examples/custom_providers_example.py
from devoutils.faker import SyslogFakeGenerator
import random
from devo.sender import Sender
def get_choices():
return ["Failed", "Success", "Totally broken", "404", "500", "What?"]
if __name__ == "__main__":
with open("./custom_providers_template.jinja2", 'r')... | StarcoderdataPython |
3379984 | <gh_stars>0
#!/bin/env python
from setuptools import setup
setup(
name="interpol",
version="0.1",
description="A way to interpolate data yielded from iterators",
url="https://github.com/radium226/interpol",
license="GPL",
packages=["interpol"],
zip_safe=Tr... | StarcoderdataPython |
3287854 | from talon import Context, Module, actions, ui
# ctx = Context()
mod = Module()
mod.tag("cdda", desc="Cataclysm: Dark Days Ahead")
# ctx.matches = r"""
# app: cataclysm-tiles
# """
@mod.action_class
class Actions:
def key_repeat(key: str, count: int):
"""Play key with delay"""
for i in range(0, c... | StarcoderdataPython |
1759562 | <gh_stars>1-10
# coding: utf-8
__author__ = 'baocaixiong'
from message import ConfirmMessage, QueryMessage
from messageio import writer
def confirm_message(message_id, token):
cm = ConfirmMessage()
cm.token = token
cm.update_content({'id': message_id})
return writer(cm)
query_message = lambda **kw... | StarcoderdataPython |
1636863 | from photons_app.errors import ApplicationCancelled, ApplicationStopped
from photons_app.errors import UserQuit
from photons_app import helpers as hp
import platform
import asyncio
import logging
import signal
import sys
log = logging.getLogger("photons_app.tasks.runner")
class Runner:
def __init__(self, task, ... | StarcoderdataPython |
1791611 | <reponame>Anioko/CMS
import json
import os
import cv2
from datetime import datetime
from logging import log
from time import time
from app import db
class Workplace(db.Model):
###Places of work to be listed here
__tablename__ = 'workplaces'
id = db.Column(db.Integer, primary_key=True)
user_id = db.Co... | StarcoderdataPython |
4833534 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import wshop.models.fields.autoslugfield
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('catalogue', '0001_initial'),
migrations.swappable_dependenc... | StarcoderdataPython |
1634623 | import sys
import pandas as pd
import numpy as np
from sqlalchemy import create_engine
'''
run this file from root folder:
python3 datasets/process_data.py datasets/messages.csv datasets/categories.csv datasets/DisasterResponse.db
'''
def load_data(messages_filepath, categories_filepath):
"""
PARAMETER:
m... | StarcoderdataPython |
131605 | <gh_stars>10-100
import _codecs_iso2022, codecs
import _multibytecodec as mbc
codec = _codecs_iso2022.getcodec('iso2022_jp_2')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, codecs.
IncrementalEncoder):
codec = codec
... | StarcoderdataPython |
90431 | # Copyright (C) 2015-2016 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# a... | StarcoderdataPython |
3284337 | <reponame>Ivan1225/NameViz
import json
import jsonpickle
import os
import getopt, sys
import re
from analysis_name import check_outlier
class Name:
def __init__(self, name, filename, filepath, line, position, nametype, vartype, parent):
self.name = name
self.fileName = filename
self.filePat... | StarcoderdataPython |
3360817 | <gh_stars>100-1000
# 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 applicable law or agr... | StarcoderdataPython |
68935 | # 461. Hamming Distance
class Solution:
def hammingDistance(self, x: int, y: int) -> int:
return bin(x ^ y).count('1') | StarcoderdataPython |
194273 | """A collection of decorators to modify rule docstrings for Sphinx."""
from sqlfluff.core.rules.config_info import STANDARD_CONFIG_INFO_DICT
from sqlfluff.core.rules.base import rules_logger # noqa
FIX_COMPATIBLE = "``sqlfluff fix`` compatible."
def document_fix_compatible(cls):
"""Mark the rule as fixable in... | StarcoderdataPython |
125783 | <reponame>alfredo-milani/ParseScript<gh_stars>0
import threading
class ParseThread(threading.Thread):
"""
"""
__lock = threading.Lock()
def __init__(self, target, target_args=(), callback=None, callback_args=(), *args, **kwargs):
super(ParseThread, self).__init__(target=self.__target_with_c... | StarcoderdataPython |
1730056 | <gh_stars>0
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import Group
from .forms import CustomUserChangeForm, CustomUserCreationForm
from .models import Address, CustomUser, Profile, TOTPRequest
# Register your models here.
admin.site.site_header ... | StarcoderdataPython |
1605618 | <gh_stars>1-10
#!/usr/bin/env python
import hashlib
import os
import sys
from abc import ABC, abstractmethod
from binascii import hexlify
from getpass import getpass
from optparse import OptionParser
import sha3
from mnemonic.mnemonic import Mnemonic
from pycoin.contrib.segwit_addr import bech32_encode, convertbits
fr... | StarcoderdataPython |
1774701 | <reponame>matthewelse/bleep<gh_stars>10-100
# bleep: BLE Abstraction Library for Python
#
# Copyright (c) 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/... | StarcoderdataPython |
1694642 | from aws_cdk import (
aws_lambda as _lambda,
aws_sns as sns,
aws_sns_subscriptions as subscriptions,
aws_dynamodb as dynamo_db,
core
)
class TheDynamoFlowStack(core.Stack):
def __init__(self, scope: core.Construct, id: str, sns_topic_arn: str, **kwargs) -> None:
super().__init__(scope,... | StarcoderdataPython |
4827100 | from datetime import datetime
from datetime import timedelta
def date_plus_days(date, days):
if date == '':
return current_day()
my_date = datetime(int(date[0:4]), int(date[4:6]), int(date[6:8]))
my_date = my_date + timedelta(days=days)
if my_date > datetime.today():
print(current_day(... | StarcoderdataPython |
3237441 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import json as json
from collections import defaultdict
import pickle
import ipdb as ipdb
#import apply_lexical_rule
from pprint import pprint
import segment_phrases.segment_phrases as seg
class TestLexicalRule(unittest.TestCase):
# setup -- create a... | StarcoderdataPython |
1684624 | <reponame>PedroHenriqueSimoes/Exercicios-Python
sal = (float(input('Qual é seu salario? ')))
if sal <= 1250.00:
print('O salario que era de R${:.2f} passou para R${:.2f}'.format(sal, ((sal * 15) / 100) + sal))
print('por conta de 15 por cento de aumento.')
else:
print('O salario que era de R${:.2f} passou p... | StarcoderdataPython |
17451 | <filename>examples/nni_data_augmentation/basenet/data.py
#!/usr/bin/env python
"""
data.py
"""
import itertools
def loopy_wrapper(gen):
while True:
for x in gen:
yield x
class ZipDataloader:
def __init__(self, dataloaders):
self.dataloaders = dataloaders
self._len = l... | StarcoderdataPython |
100652 | <filename>07/solve.py
import re
import json
import ast
f = open("input.txt","r").read()
rx = re.sub(r"\n", r'",\n"', f)
rx = '[\n\"'+rx+'\"\n]'
d = ast.literal_eval(rx)
print(d)
rules = {}
colors = {}
def handle(str):
[src,content] = str.split("bags contain")
src = src[:-1]
content = content.split(",")
... | StarcoderdataPython |
1691314 | import re
from fuzzywuzzy import fuzz
major_matcher = re.compile(r'(?<={).*?(?=})')
def judge_answer(user_answer, question_answer):
"""Judge answer response as correct or not
"""
user_answer = user_answer.lower()
question_answer = question_answer.lower()
if user_answer == "":
return Fals... | StarcoderdataPython |
4780 | <gh_stars>1000+
# coding=utf-8
# Copyright 2021 The Google Research 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 requ... | StarcoderdataPython |
1746978 | <filename>models/Global-Flow-Local-Attention/data/hmubi_dataset.py
import os.path
from data.base_dataset import BaseDataset
from data.image_folder import make_dataset
import pandas as pd
from util import pose_utils
import numpy as np
import torch
from tqdm import tqdm
class HMUBIDataset(BaseDataset):
@staticmeth... | StarcoderdataPython |
1714629 | <reponame>chenwenxiao/DOI
from enum import Enum
from typing import *
import mltk
import numpy as np
from .types import *
__all__ = [
'ArrayMapper', 'ArrayMapperList',
'Identity', 'Reshape', 'Flatten', 'Transpose', 'Pad',
'ChannelTranspose', 'ChannelFirstToLast', 'ChannelLastToFirst',
'ChannelLastToDe... | StarcoderdataPython |
1653197 | from mathutils import MathUtils
import os
import numpy as np
import re
from glogpy.dynamics_job import dynamics_job as dj
class ParseLogAll():
def parse(txt, step_lim=None):
sections = re.split("\*{4} Time.{1,}\d{1,}\.\d{1,}.{1,}\*{4}", txt )
res = []
nsteps = 0
for s in sections... | StarcoderdataPython |
158307 | import csv
from pathlib import Path
equity_funding = [
{"Company": "CryptoVisors", "Amount": 200000, "Series": "A"},
{"Company": "Flutterwave", "Amount": 65000000, "Series": "D"},
{"Company": "nCino", "Amount": 80000000, "Series": "D"},
{"Company": "Privacy.com", "Amount": 10000000, "Series": "B"},
]
... | StarcoderdataPython |
149529 | <gh_stars>0
import csv
import math
import random
import operator
import logging
logging.basicConfig(format='[%(asctime)s] [%(name)s:%(lineno)d] | [%(levelname)s]: %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
def load_data(filename, split, trainingSet=None, testSet=None):
"""load IRIS da... | StarcoderdataPython |
1712198 | <reponame>jonasrla/desafio_youse<filename>parte_2/Context/create_policy_context.py
from .base_context import BaseContext
from pyspark.sql import functions as f
class CreatePolicyContext(BaseContext):
def __init__(self, file_path):
self.app_name = 'Process Create Policy'
super().__init__(file_path)... | StarcoderdataPython |
4839958 | <reponame>GeGao2014/fairlearn
"""Script to dynamically update the ReadMe file for a particular release
Since PyPI and GitHub have slightly different ideas about markdown, we have to update
the ReadMe file when we upload to PyPI. This script makes the necessary changes.
Most of the updates performed should be fairly ro... | StarcoderdataPython |
3392720 | <gh_stars>0
"""empty message
Revision ID: f82b5fe93062
Revises: <PASSWORD>
Create Date: 2020-07-15 19:04:44.063507
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
#... | StarcoderdataPython |
3270996 | <gh_stars>100-1000
"""
Copyright 2019, ETH Zurich
This file is part of L3C-PyTorch.
L3C-PyTorch is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
L3C-PyTorch... | StarcoderdataPython |
1774265 | <gh_stars>1-10
#! /usr/bin/env python
#! /opt/casa/packages/RHEL7/release/current/bin/python
#
# AAP = Admit After Pipeline
#
# Example python script (and module) that for a given directory finds all ALMA pbcor.fits files
# and runs a suite of predefined ADMIT recipes on them, in a local directory named madmit_<Y... | StarcoderdataPython |
3276163 | import torch
from torch.nn import functional as F
class WSDDNLossComputation(object):
"""
Computes the loss for WSDDN, which is a multi-label image-level binary cross-entropy loss
"""
def __init__(self, cfg):
self.config = cfg
self.background_weight = cfg.MODEL.ROI_BOX_HEAD.LOSS_WEIGHT_... | StarcoderdataPython |
1687080 | <reponame>mindis/rnd-reco-gym
import numpy as np
from numpy.random.mtrand import RandomState
from sklearn.linear_model import LogisticRegression
from recogym import DefaultContext, Observation
from recogym.agents import Agent
from recogym.envs.session import OrganicSessions
from recogym.agents import FeatureProvider
... | StarcoderdataPython |
1722287 | #!/usr/bin/env python
# encoding: utf-8
class Solution(object):
def findKthLargest(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: int
"""
import random
if len(nums) >= 1:
less = [];greater = []
if len(nums) == 1:return... | StarcoderdataPython |
1893 | # type: ignore
from typing import Union, List, Dict
from urllib.parse import urlparse
import urllib3
from pymisp import ExpandedPyMISP, PyMISPError, MISPObject, MISPSighting, MISPEvent, MISPAttribute
from pymisp.tools import GenericObjectGenerator
import copy
from pymisp.tools import FileObject
from CommonServerPytho... | StarcoderdataPython |
1791956 | <reponame>syqu22/django-react-blog
from posts.models import Post
from rest_framework import status
from rest_framework.test import APITestCase
from users.models import User
class TestViews(APITestCase):
def setUp(self):
self.user = User.objects.create_user(
username='test', email='<EMAIL>', p... | StarcoderdataPython |
4815130 | # -*- coding: utf-8 -*-
import numpy as np
from numpy import pi, sqrt, exp, sin, cos, tan, log, log10
import const
## Mass of the star
M_s = const.M_sol
## Mean molecular weigth (assumed to be constant)
mu = 1
## Atmosphere loss model of <NAME> (2007) [https://ui.adsabs.harvard.edu/abs/2007P&SS...55.1426G]
dotM_... | StarcoderdataPython |
1664070 | <filename>salt/tls-terminator/test_tls_terminator.py
import json
import os
from collections import OrderedDict
try:
from importlib.machinery import SourceFileLoader
def load_source(module, path):
return SourceFileLoader(module, path).load_module()
except ImportError:
# python 2
import imp
de... | StarcoderdataPython |
4832745 | <filename>mnistsvhntext/flags.py
import argparse
from utils.BaseFlags import parser as parser
# DATASET NAME
parser.add_argument('--dataset', type=str, default='SVHN_MNIST_text', help="name of the dataset")
# DATA DEPENDENT
# to be set by experiments themselves
parser.add_argument('--style_m1_dim', type=int, default... | StarcoderdataPython |
4806074 | <filename>mysite/timesheets/apps.py
from django.apps import AppConfig
class TimesheetsConfig(AppConfig):
name = 'timesheets'
| StarcoderdataPython |
14321 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import OrderedDict
from moz_sql_parser import parse as parse_sql
import pyparsing
import re
from six.moves.urllib import parse
FROM_REGEX = re.compile... | StarcoderdataPython |
4977 | <filename>Back-End/Python/timers/clock_named_tuple.py
from collections import namedtuple
MainTimer = namedtuple('MainTimer', 'new_time_joined, end_period, new_weekday, days')
def add_time(start, duration, start_weekday=None):
weekdays = [
'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday',
... | StarcoderdataPython |
1759539 | # PiFrame weather.py
# Manages weather data as well as forecast for the "Weather" Extension
# Uses Open Weather API https://openweathermap.org/api
import requests, settings, json, datetime
# Request URLS for weather
currentWeatherRequestURL = lambda zip, apiKey : ("http://api.openweathermap.org/data/2.5/weather?zip=%s... | StarcoderdataPython |
1618975 | <filename>tieba/items.py
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class TiebaItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
forum = scrapy.... | StarcoderdataPython |
1679174 | #!/usr/bin/env python
#
# Integration with an Adafruit Arduino Motor Shield (V2) (http://www.adafruit.com/products/1438).
# Although this shield is built for the Arduino series boards, it can be modified/used in other
# applications. This tutorial will use the board connected to a Raspberry Pi 3 B+ with the following
#... | StarcoderdataPython |
1692349 | <reponame>xieyujia/RWOC
# ==========================================================================
#
# This file is a part of implementation for paper:
# DeepMOT: A Differentiable Framework for Training Multiple Object Trackers.
# This contribution is headed by Perception research team, INRIA.
#
# Contributor(s) : <N... | StarcoderdataPython |
3300502 | '''
====================================================================
(c) 2003-2016 <NAME>. All rights reserved.
This software is licensed as described in the file LICENSE.txt,
which you should have received as part of this distribution.
====================================================================
... | StarcoderdataPython |
1728353 | import urllib.parse
from flask import request, abort, render_template
from flask_login import current_user
from wikked.views import add_auth_data, add_navigation_data
from wikked.web import app, get_wiki
from wikked.webimpl import url_from_viewarg
from wikked.webimpl.decorators import requires_permission
from wikked.we... | StarcoderdataPython |
3368214 | import boto3
client = boto3.client("config")
response = client.put_config_rule(
ConfigRule={
"ConfigRuleName": "ec2-stopped-instance",
"Source": {"Owner": "AWS", "SourceIdentifier": "EC2_STOPPED_INSTANCE",},
"InputParameters": '{"AllowedDays":"30"}',
}
)
print(response)
| StarcoderdataPython |
1743351 | <reponame>mpipool/mpipool<gh_stars>1-10
from errr.tree import make_tree as _t, exception as _e
_t(globals(), MPIPoolError=_e(MPIProcessError=_e()))
| StarcoderdataPython |
4828628 | import xarray as xr
import xgcm
import numpy as np
import warnings
from xnemogcm import open_nemo_and_domain_cfg
import pytest
from xbasin.operations import Grid_ops
_metrics = {
("X",): ["e1t", "e1u", "e1v", "e1f"], # X distances
("Y",): ["e2t", "e2u", "e2v", "e2f"], # Y distances
("Z",): ["e3t_0", "e3u... | StarcoderdataPython |
4806250 | <filename>tensorflow/python/ops/image_ops.py<gh_stars>1-10
# Copyright 2015 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.apa... | StarcoderdataPython |
1691689 | #!/usr/bin/env python3
import csv
from io import StringIO
import scrape_common as sc
url = 'https://www.sg.ch/ueber-den-kanton-st-gallen/statistik/covid-19/_jcr_content/Par/sgch_downloadlist_729873930/DownloadListPar/sgch_download.ocFile/KantonSG_C19-Tests_download.csv'
data = sc.download(url, silent=True)
# strip ... | StarcoderdataPython |
3379731 | from nose.tools import assert_equal, assert_is_not_none, assert_almost_equal
from demagfacts import rectprism
# table for spheroid
# table = ((2.0, 0.17356),
# (3.0, 0.10871),
# (4.0, 0.075407),
# (5.0, 0.055821),
# (6.0, 0.043230),
# (7.0, 0.034609)... | StarcoderdataPython |
1608433 | <filename>pyxform/tests_v1/test_settings_auto_send_delete.py
from pyxform.tests_v1.pyxform_test_case import PyxformTestCase
class SettingsAutoSendDelete(PyxformTestCase):
def test_settings_auto_send_true(self):
self.assertPyxformXform(
name="data",
md="""
| survey | ... | StarcoderdataPython |
1702349 | <filename>lewis_emulators/rkndio/interfaces/stream_interface.py
from lewis.adapters.stream import StreamInterface
from lewis.utils.command_builder import CmdBuilder
from lewis.utils.replies import conditional_reply
class RkndioStreamInterface(StreamInterface):
# Commands that we expect via serial during normal o... | StarcoderdataPython |
1658521 | import rclpy
from rclpy.time import Time, Duration
from rclpy.node import Node
from std_msgs.msg import Header
from tf2_ros import LookupException, ExtrapolationException, ConnectivityException
from tf2_ros.buffer import Buffer
from tf2_ros.transform_broadcaster import TransformBroadcaster
from tf2_ros.transform_listen... | StarcoderdataPython |
3330670 | <reponame>ValentynaGorbachenko/cd2
'''
Given two arrays, write a function to compute their intersection.
Example 1:
Input: nums1 = [1,2,2,1], nums2 = [2,2]
Output: [2]
Example 2:
Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4]
Output: [9,4]
Note:
Each element in the result must be unique.
The result can be in any order... | StarcoderdataPython |
72588 | <filename>tests/djvu_tests.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Unit tests for djvutext.py script."""
#
# (C) Pywikibot team, 2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import unicode_literals
import os
import subprocess
from tests import _data_dir
from tests.aspects impo... | StarcoderdataPython |
1632742 | <reponame>formiel/speech-translation
"""
Organize multilingual data to prepare for training
"""
import os
import re
import shutil
import json
import subprocess
import argparse
SPLITS = ['train_sp', 'dev', 'tst-COMMON', 'tst-HE']
def get_info(tgt_langs="de_es_fr_it_nl_pt_ro_ru", use_lid=True, use_joint_dict=True):
... | StarcoderdataPython |
150061 | <reponame>renmcc/bk-PaaS
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not u... | StarcoderdataPython |
3285931 | <filename>metrics/metrics.py
from sklearn.metrics import roc_auc_score, auc, precision_recall_curve, recall_score, matthews_corrcoef, f1_score, \
average_precision_score
from lifelines.utils import concordance_index
import numpy as np
from metrics.timeroc.timeROC import timeROC
from metrics.iauc.integrateAUC import... | StarcoderdataPython |
170677 | from openslides.utils.exceptions import OpenSlidesError
class WorkflowError(OpenSlidesError):
"""Exception raised when errors in a workflow or state accure."""
pass
| StarcoderdataPython |
1833 | """ Defines the PolygonPlot class.
"""
from __future__ import with_statement
# Major library imports
import numpy as np
# Enthought library imports.
from enable.api import LineStyle, black_color_trait, \
transparent_color_trait
from kiva.agg import points_in_polygon
from traits.api ... | StarcoderdataPython |
4833726 | <filename>priv/python2/erlport/tests/stdio_tests.py
# Copyright (c) 2009-2013, <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain th... | StarcoderdataPython |
146475 | from src.end_point import EndPoint
class Collection:
def __init__(self, collection_json):
self.end_points = [EndPoint(x) for x in collection_json["item"]]
def get_end_points(self):
return self.end_points
def remove_end_point(self, end_point):
self.end_points.remove(end_point)
| StarcoderdataPython |
1698536 | <filename>code/image-tagging-flickr8kcn/tf_tagging/utility.py
import os
import numpy as np
def load_config(config_path):
variables = {}
exec(compile(open(config_path, "rb").read(), config_path, 'exec'), variables)
return variables['config']
def get_concept_file(collection, annotation_name, rootpath):
... | StarcoderdataPython |
51282 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Constant settings for Cowbird application.
Constants defined with format ``COWBIRD_[VARIABLE_NAME]`` can be matched with corresponding
settings formatted as ``cowbird.[variable_name]`` in the ``cowbird.ini`` configuration file.
.. note::
Since the ``cowbird.ini`` ... | StarcoderdataPython |
82988 | """ bgasync.api - BGAPI classes, constants, and utility functions. """
# This file is auto-generated. Edit at your own risk!
from struct import Struct
from collections import namedtuple
from enum import Enum
from .apibase import *
class event_system_boot(Decodable):
decoded_type = namedtuple('event_system_boot_typ... | StarcoderdataPython |
3346361 | <gh_stars>1-10
# Generated by Django 3.1.5 on 2021-02-09 10:55
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependen... | StarcoderdataPython |
61965 | <filename>src/gamesystem/scene_transision.py
class SceneManager:
def __init__(self):
self.scene_list = {}
self.current_scene = None
def append_scene(self, scene_name, scene):
self.scene_list[scene_name] = scene
def set_current_scene(self, scene_name):
self.current_scene = s... | StarcoderdataPython |
3397119 | from savu.plugins.plugin_tools import PluginTools
class StageMotionTools(PluginTools):
"""A Plugin to calculate stage motion from motion positions.
"""
def define_parameters(self):
"""
in_datasets:
visibility: datasets
dtype: [list[],list[str]]
descriptio... | StarcoderdataPython |
3306702 | <reponame>Goyatuzo/HackerRank<gh_stars>0
def reverse_words(words_string):
return " ".join(reversed(words_string.strip().split(" "))) | StarcoderdataPython |
1703217 | # A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2021 NV Access Limited
# This file may be used under the terms of the GNU General Public License, version 2 or later.
# For more details see: https://www.gnu.org/licenses/gpl-2.0.html
"""Logic for reading text using NVDA in the notepad text editor.
"""
# impo... | StarcoderdataPython |
55880 | import json
import os
import time
def get_cache_path():
home = os.path.expanduser("~")
return home + '/package_list.cdncache'
def time_has_passed(last_time, time_now):
time_is_blank = time_now is None or last_time is None
if time_is_blank:
return time_is_blank
time_difference = int(time.t... | StarcoderdataPython |
3344998 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
__... | StarcoderdataPython |
3370061 | from keras.models import model_from_json
json_file = open('model.json', 'r')
loaded_model_json = json_file.read()
json_file.close()
loaded_model = model_from_json(loaded_model_json)
# load weights into new model
loaded_model.load_weights("saved_models/Emotion_Voice_Detection_Model.h5")
print("Loaded model from disk")
... | StarcoderdataPython |
4841202 | """Auto-generated file, do not edit by hand. CZ metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_CZ = PhoneMetadata(id='CZ', country_code=None, international_prefix=None,
general_desc=PhoneNumberDesc(national_number_pattern='1\\d{2,5}', possible_number_pattern='\\... | StarcoderdataPython |
1604793 | import numpy as np
import matplotlib.pyplot as plt
from multilayer_perceptron import MLP
from gradient_boosting_decision_tree import GBDT
from xgboost import XGBoost
from random_forest import RandomForest
from adaboost import AdaBoost
from factorization_machines import FactorizationMachines
from support_vector_machine ... | StarcoderdataPython |
3327519 | <reponame>Lucassardao/WebProjetoPradopolis
from flask import Flask, render_template
#criar a instancia do flask
app = Flask(__name__)
#criar a rota
@app.route('/')
def index():
return render_template("index.html")
@app.route('/index.html')
def index_1():
return render_template("index.html")
@app.route("/reg... | StarcoderdataPython |
3360614 | <reponame>triplejingle/cito
function_name = "test"
def test():
print("hoi")
| StarcoderdataPython |
1739236 | from ecdsa import SigningKey
from ecdsa.keys import VerifyingKey
class Card:
def __init__(self, poke_id, name, poke_type, hp, attack, defense, speed, total, legendary):
self.poke_id = poke_id
self.name = name
self.poke_type = poke_type
self.hp = hp
self.attack = attack
... | StarcoderdataPython |
1745042 | <reponame>mlockett42/eosfactory
#!/usr/bin/python3
import sys
import os
import json
import re
import eosfactory.core. config as config
import eosfactory.core.logger as logger
import eosfactory.core.interface as interface
import eosfactory.core.setup as setup
import eosfactory.core.teos as teos
import eosfactory.core.c... | StarcoderdataPython |
1797084 | <filename>chrF/measure.py
#!/usr/bin/env python3
# -*- coding: utf-8
"""
chrF - Reimplementation of the character-F evaluation measure for SMT
<NAME>. (2015). ChrF: character n-gram F-score
for automatic MT evaluation. EMNLP 2015, 392.
This implementation (c) <NAME> 2016.
"""
import collections
import itertools
impor... | StarcoderdataPython |
22850 | <gh_stars>100-1000
from django.conf.urls import url, patterns
from .views import tutorial_email, tutorial_message
urlpatterns = patterns("", # flake8: noqa
url(r"^mail/(?P<pk>\d+)/(?P<pks>[0-9,]+)/$", tutorial_email, name="tutorial_email"),
url(r"^message/(?P<pk>\d+)/$", tutorial_message, name="tutorial_messa... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.