id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
258478 | # import tensorflow as tf
import oneflow as flow
import oneflow.typing as tp
from typing import Tuple
import math
import shutil
import numpy as np
import time
from core.function import train
from core.function import validate
from core.loss import JointsMSELoss
from core.make_dataset import CocoDataset
from core.hrne... | StarcoderdataPython |
6614857 | <gh_stars>1-10
import os
import itertools
import json
import requests
import numpy as np
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
KEY = os.environ.get('KEY')
SENDGRID_API_KEY = os.environ.get('SENDGRID_API_KEY')
SENDER = os.environ.get('SENDER')
def driving_time_and_distance(ori,... | StarcoderdataPython |
6656331 | """
File: DaqDevDiscovery02.py
Library Call Demonstrated: mcculw.ul.get_net_device_descriptor()
mcculw.ul.create_daq_device()
mcculw.ul.release_daq_device()
Purpose: Discovers a Network DAQ device and assigns board
... | StarcoderdataPython |
3566609 | <reponame>threefoldtech/jumpscale_core9<gh_stars>0
from jumpscale import j
import base64
from .SerializerBase import SerializerBase
class SerializerBase64(SerializerBase):
def __init__(self):
SerializerBase.__init__(self)
def dumps(self, s):
if j.data.types.string.check(s):
b = s... | StarcoderdataPython |
1686706 | <gh_stars>1-10
import os
__author__ = "<NAME>"
__version__ = 1.0
def xmlMarkup(games, team_ab, team_name, team_record):
'''Markup the RSS feed using the data obtained.
:param games: list of games that the team played this season
:type games: list of GameData
:param team_ab: the team's abbreviated name
... | StarcoderdataPython |
4841614 | import math, inspect, os, sys, time
import pymel.core as pm
import maya.cmds as cmds
from zMayaTools.menus import Menu
from zMayaTools import maya_logging, maya_helpers
log = maya_logging.get_log()
# Notes:
#
# - This doesn't handle inbetween targets. There's no good way to export those to
# use them with game engin... | StarcoderdataPython |
8182583 | from abc import ABCMeta, abstractmethod
class StrategyBase(metaclass=ABCMeta):
def __init__(self, n, m, k):
self.loads = [0] * n
self.n = n
self.m = m
self.k = k
self.choices_left = k
@abstractmethod
def decide(self, bin): # TODO: might add a choices_left as an i... | StarcoderdataPython |
12830990 | <gh_stars>1-10
"""exact-astro setup.py."""
import io
import pathlib
import re
from setuptools import setup
__version__ = re.search(
r'__version__\s*=\s*[\'"]([^\'"]*)[\'"]', # It excludes inline comment too
io.open('exact/__init__.py', encoding='utf_8_sig').read(),
).group(1)
install_requires = ['numpy', '... | StarcoderdataPython |
11213443 | # _*_ coding: utf-8 _*_
"""
Created by Alimazing on 2018/6/17.
"""
from sqlalchemy import Column, Integer, String, SmallInteger
from app.models.base import Base
__author__ = 'Alimazing'
class Image(Base):
id = Column(Integer, primary_key=True, autoincrement=True)
_url = Column('url', String(255))
_from = Column(... | StarcoderdataPython |
365164 | """Custom User Manager."""
from django.contrib.auth.models import BaseUserManager
from django.utils.translation import ugettext_lazy as _
class UserManager(BaseUserManager):
"""
Custom user manager model where email is the unique identifier
for authentication instead of username.
"""
use_in_migr... | StarcoderdataPython |
6549634 | """Decodes a binary string to a json representation of the intervals
after the merge overlapping intervals turing machine have processed them. Reads
json from the command line and outputs the initial tape."""
import json
import sys
from vim_turing_machine.constants import BITS_PER_NUMBER
from vim_turing_machine.consta... | StarcoderdataPython |
1698969 | from __future__ import unicode_literals
from decimal import Decimal
from django.db import models
class Movie(models.Model):
title = models.CharField(
verbose_name='Movie Title',
max_length=255
)
genre = models.CharField(
verbose_name='Genre',
max_length=255
)
ratin... | StarcoderdataPython |
1949772 | <filename>parrot/settings.py<gh_stars>0
import environ
from pathlib import Path
env = environ.Env()
BASE_DIR = Path(__file__).parent.parent
environ.Env.read_env(str(BASE_DIR / '.env'))
SECRET_KEY = env('PARROT_SECRET_KEY')
DEBUG = env.bool('DEBUG', False)
ALLOWED_HOSTS = env.list('PARROT_ALLOWED_HOSTS', default=['... | StarcoderdataPython |
8050833 | <reponame>ahme0307/Ynet
from __future__ import print_function
import os
import numpy as np
import pdb
import cv2
from fnmatch import fnmatch
from skimage.io import imsave, imread
import pickle
import pylab
import imageio
import matplotlib.pyplot as plt
#Prepare training and test set
def create_train_data(param):
f... | StarcoderdataPython |
5098613 | <reponame>stonebig/opt_einsum<gh_stars>0
"""
Support for random optimizers, including the random-greedy path.
"""
import functools
import heapq
import math
import numbers
import random
import time
from collections import deque
from . import helpers, paths
__all__ = ["RandomGreedy", "random_greedy", "random_greedy_12... | StarcoderdataPython |
361398 | # Enter your code here. Read input from STDIN. Print output to STDOUT
n_input = input()
int_input = input().split()
print(all([int(i) > 0 for i in int_input]) and any([j == j[::-1] for j in int_input]))
| StarcoderdataPython |
9771732 | <filename>Main/Articles/urls.py
from django.urls import path
from .views import (
PostListView,
PostDetailView,
PostCreateView,
PostUpdateView,
PostDeleteView
)
urlpatterns = [
path("",PostListView.as_view(), name="art_list"),
path("art_add/",PostCreateView.as_view(), name="art_add"),
path("art_desc/<int:pk... | StarcoderdataPython |
87253 | <filename>sutils/applications/cancel/cancel.py<gh_stars>0
import sys
from . import core
def run(options):
if options['all']:
run_all(force=options['force'])
elif options['last'] is not None:
run_last(options['last'], force=options['force'])
elif options['first'] is not None:
run_fir... | StarcoderdataPython |
142959 | <reponame>Bpowers4/turicreate<gh_stars>1-10
# -*- coding: utf-8 -*-
# Copyright © 2019 Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can
# be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from __future__ import print_function a... | StarcoderdataPython |
5086605 | <reponame>ska-sa/scape
"""Unit test suite for scape."""
import unittest
# pylint: disable-msg=W0403
import test_stats
import test_gaincal
import test_scan
import test_scape
import test_xdmfits
def suite():
loader = unittest.TestLoader()
testsuite = unittest.TestSuite()
testsuite.addTests(loader.loadTests... | StarcoderdataPython |
38929 | <reponame>xswz8015/infra
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import subprocess
import argparse
import sys
import os
import re
import json
import codecs
import platform
# Used to run commands t... | StarcoderdataPython |
1806957 | <gh_stars>1000+
import unittest
class TestMixins(unittest.TestCase):
def testLocal(self):
from pulsar.utils.structures import AttributeDictionary
from pulsar.utils.log import LocalMixin
elem = LocalMixin()
el = elem.local
self.assertTrue(isinstance(el, AttributeDictionary)... | StarcoderdataPython |
224727 | <filename>secure_transfer/forms.py
from django import forms
from django.core.exceptions import ValidationError
from .models import ProtectedItem
class ProtectedWithPasswordForm(forms.Form):
token = forms.CharField(widget=forms.HiddenInput)
password = forms.CharField(widget=forms.PasswordInput)
def clean... | StarcoderdataPython |
114697 | <gh_stars>0
def fibonacci(n):
if n == 0:
return (0, 1)
else:
a, b = fibonacci(n // 2)
c = a * (b * 2 - a)
d = a * a + b * b
if n % 2 == 0:
return (c, d)
else:
return (d, c + d)
x = 0
y = 0
num = 1
while len(str(x)) < 1000:
... | StarcoderdataPython |
8022689 | from prometheus_client import make_wsgi_app, Gauge
from wsgiref.simple_server import make_server
from redis.sentinel import Sentinel
import redis,sys,os
APP_HOSTNAME = os.getenv('APP_HOSTNAME', '127.0.0.1')
APP_PORT = os.getenv('APP_PORT', 9000)
REDIS_HOSTNAME = os.getenv('REDIS_HOSTNAME', '127.0.0.1')
REDIS_PORT = os... | StarcoderdataPython |
11220179 | <filename>2021/day15.py
from mylib.aoc_frame import Day
import mylib.no_graph_lib as nog
class PartA(Day):
def compute(self, d): # return puzzle result, get parsing data from attributes of d
return do(d, 1)
class PartB(PartA):
def compute(self, d): # return puzzle result, get parsing data from att... | StarcoderdataPython |
5009798 | import json
import pytest
from pathlib import Path
from core import GeneratorFactory, Config, resize, make_transparent
base_dir = Path().cwd() / 'example'
background_path = base_dir / 'small_bg.jpg'
sub_image_path = base_dir / 'wings.png'
logo_first_part_path = base_dir / 'shikimori-glyph.png'
logo_second_part_path =... | StarcoderdataPython |
8185148 | <filename>safe_transaction_service/contracts/migrations/0002_auto_20210119_1136.py
# Generated by Django 3.1.5 on 2021-01-19 11:36
from django.db import migrations, models
import safe_transaction_service.contracts.models
class Migration(migrations.Migration):
dependencies = [
("contracts", "0001_initia... | StarcoderdataPython |
3232986 | <filename>src/day13/day13-1.py<gh_stars>0
f = open('day13.txt', 'r')
data = f.readlines()
timestamp = int(data[0])
buses = list(data[1].strip().split(','))
while 'x' in buses:
buses.remove('x')
buses = list(map(int, buses))
print(timestamp)
print(buses)
reminders = list(map(lambda x: timestamp % x, buses))
print(... | StarcoderdataPython |
1688042 | import re
regex_pattern = r'(?<=^)M{0,3}(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[VX]|V?I{0,3})(?=$)' # Do not delete 'r'.
print(str(bool(re.match(regex_pattern, input()))))
| StarcoderdataPython |
3434904 | <filename>seeds/utils/parsing.py<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Collection of functions that perform different types of parsing
"""
__author__ = "<NAME> <<EMAIL>>"
__credits__ = "<NAME>"
import re
from seeds.SEEDSError import *
def parse_int_rangelist(s, sorted=False):
"""Parse a list of numeric r... | StarcoderdataPython |
1944767 | <filename>neutron/tests/unit/agent/linux/test_tc_lib.py
# Copyright 2016 OVH SAS
# 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 |
12820335 | <filename>scripts/clear_lists.py
from database import *
'''
С помощью этого скрипта вы можете очистить списки бота.
После выполнения этой программы необходимо перезапустить бота,
чтобы изменения вступили в силу.
'''
if __name__ == '__main__':
if database:
delete_lists = [
"blacklisted", # чёр... | StarcoderdataPython |
3261523 | <reponame>gojek/CureIAM<filename>CureIAM/models/__init__.py
"""A package for models as data store packaged with this project.
"""
| StarcoderdataPython |
5125532 | <gh_stars>1-10
import os
from setuptools import setup
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open(os.path.... | StarcoderdataPython |
356001 | <gh_stars>1-10
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackQueryHandler # Extended Telegram API
import logging
import telegram
from telegram.chataction import ChatAction # pure Telegram API (send_message method) #REVIEW
from telegram import InlineKeyboardButton, InlineKeyboardMar... | StarcoderdataPython |
8101111 | <gh_stars>1-10
#!/usr/bin/env python3
#============================================================
# IMSNG Pipeline
# => Processing
# Data Monitoring => Processing => Transient Search
#============================================================
#%%
# Library
#----------------------------------------------------------... | StarcoderdataPython |
11390836 | <reponame>nolim1t/specter-diy<filename>demo_apps/__init__.py
__all__ = [
'helloworld',
]
| StarcoderdataPython |
4963760 | <reponame>Rijksmuseum-Voice-Inference/voice-to-voice-translation<filename>scripts/extract_features_for_merlin.py
import os
import sys
import shutil
import glob
import time
import multiprocessing as mp
import numpy as np
import wave
if len(sys.argv)!=5:
print("Usage: ")
print("python extract_features_for_merlin... | StarcoderdataPython |
4980103 | from aocd import get_data
import re
def get_first_last_winning_boards(data):
input = [s for s in re.split("\n\n|\n", data)]
numbers = [int(n) for n in input[0].split(",")]
boards = [re.split("\s+", n.lstrip()) for n in input[1:]]
winner_boards = set()
bsize = 5
draw = 5
bingo = False
n... | StarcoderdataPython |
4893975 | <reponame>ilomon10/face-mask-detector
from threading import Timer
def debounce(wait):
""" Decorator that will postpone a functions
execution until after wait seconds
have elapsed since the last time it was invoked. """
def decorator(fn):
def debounced(*args, **kwargs):
def c... | StarcoderdataPython |
8055374 | <gh_stars>10-100
# -*- coding: utf-8 -*-
import filters
class LockDetector():
"""
LockDetector instances are objects that can determine whether or not
a particular tracking channel is locked or not.
For more information:
Kaplan and Hegarty pages 234-235
note to self: Consider impl... | StarcoderdataPython |
3589835 | import distutils.util
print(distutils.util.get_platform()) | StarcoderdataPython |
3401296 | from . import get
from . import post
from . import put | StarcoderdataPython |
144456 | <filename>core/utils/mod2div.py
from core.utils.xor import xor
# Performs Modulo-2 division
def mod2div(dividend, divisor):
# Number of bits to be XORed at a time.
pick = len(divisor)
# Slicing the dividend to appropriate
# length for particular step
tmp = dividend[0: pick]
while pick < len(... | StarcoderdataPython |
6610780 |
import pandas as pd
import os
import subprocess
import tempfile
from inference_results import InferenceResults
from config import Config
from dataset import get_synth_dataset
from ranked_list import RankedList
import re
from typing import List, Tuple, Any
import javalang
from source_code_utils import get_source_code, ... | StarcoderdataPython |
9692786 | from copy import deepcopy
from typing import List, Tuple, Dict, Union, Optional
EncodeDecodeMappings = List[Tuple[int, str, str]]
Predictions = List[Dict[str, Union[str, Dict]]]
class TextEncoder:
def __init__(
self,
encoding: Dict[str, str],
model_special_tokens: Optional[List[str]] = No... | StarcoderdataPython |
6591795 | <reponame>wgjak47/supervisor_numplus
from supervisor.options import UnhosedConfigParser
from supervisor.datatypes import list_of_strings
from supervisor.states import SupervisorStates
from supervisor.states import STOPPED_STATES
from supervisor.xmlrpc import Faults as SupervisorFaults
from supervisor.xmlrpc import RPCE... | StarcoderdataPython |
4945082 | <reponame>hcmus-nlp-chatbot/CRSLab
from .topic_bert import TopicBERTModel
| StarcoderdataPython |
136730 | <filename>dsutils/__init__.py
from dsutils_dev.dsutils.evaluate import get_eda_plots
from dsutils_dev.dsutils.convert import DataFrameConverter
from dsutils_dev.dsutils.colab_utils import mount_drive #, get_spark_environment
__version__ = '0.0.1'
#from dsutils_dev.evaluate import get_eda_plots
| StarcoderdataPython |
1732928 | # Initialize a variable with a user-specified value.
user = input( 'I am Python. What is your name? : ' )
# Output a string and a variable value.
print( 'Welcome' , user )
# Initialize another variable with a user-specified value.
lang = input( 'Favorite programming language? : ' )
# Output a string and a ... | StarcoderdataPython |
6676908 | """
Server for pyglidein
"""
import json
import logging
from tornado.web import HTTPError
from rest_tools.server import (RestServer, RestHandler, RestHandlerSetup,
from_environment, role_authorization)
from . import __version__ as version
from .condor import CondorCache
from .clients i... | StarcoderdataPython |
6654024 | <reponame>pengfei-chen/algorithm_qa
"""
问题描述:给定一个二叉树的头结点head,已知其中没有重复值的节点,实现两个函数分别判断这棵二叉树是否是
搜索二叉树和完全二叉树。
"""
from binarytree.toolcls import Node
class JudgeTool:
@classmethod
def is_bst_tree(cls, head):
if head is None:
return True
res = [True]
cls.is_bst_tree_detail(hea... | StarcoderdataPython |
4928075 | <gh_stars>0
# MongoDB stores data in JSON-like documents, which makes the database very flexible and scalable.
# Python needs a MongoDB driver to access the MongoDB database.
# One of the most known MongoDB driver's is "PyMongo".
from pymongo import MongoClient
import pandas as pd
# Establishes a connection with Clust... | StarcoderdataPython |
5066204 | <filename>old/direct/replica_count_for_rse_cx.py
import cx_Oracle, sys, uuid
from dburl import schema as oracle_schema, user, password, host, port, service
conn = cx_Oracle.connect(user, password, "%s:%s/%s" % (host, port, service))
rse_name = sys.argv[1]
c = conn.cursor()
c.execute("""select id from %(schema)s.rs... | StarcoderdataPython |
1783658 | import ast
class KeywordTransformer(ast.NodeTransformer):
def visit_FunctionDef(self, node):
return node
def visit_AsyncFunctionDef(self, node):
return node
def visit_ClassDef(self, node):
return node
def visit_Return(self, node):
if node.value is None:
return node
return ast.If(
... | StarcoderdataPython |
4902841 | #!/usr/bin/env python3
# -----------------------------------------------------------------------------
#
# P A G E B O T E X A M P L E S
#
# www.pagebot.io
# Licensed under MIT conditions
#
# -----------------------------------------------------------------------------
#
# E03_BabelStringMetrics.py
#
# ... | StarcoderdataPython |
3592763 | <filename>angr/angr/procedures/win_user32/wprintf.py
from ..libc.sprintf import sprintf as wsprintfA | StarcoderdataPython |
5141471 | <gh_stars>0
from __future__ import absolute_import, division, print_function
from builtins import * # @UnusedWildImport
from mcculw import ul
from mcculw.ul import ULError
from mcculw.enums import BoardInfo, InfoType, ULRange, ErrorCode, ScanOptions
class AoInfo:
"""Provides analog output information for the de... | StarcoderdataPython |
6611697 | <filename>ensemble_clustering.py
import sys
import copy
from munkres import Munkres
from sklearn.cluster import KMeans, AgglomerativeClustering, SpectralClustering
from increasing_cluster import tran_increase
from plot_cluster import generating_KMeans_plot, generating_Spectral_plot, generating_Agglomerative_plot, gener... | StarcoderdataPython |
5088345 | <gh_stars>0
# Copyright (C) 2018 Bloomberg LP
#
# 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... | StarcoderdataPython |
3330626 | <filename>hard/Median Of Two Sorted Arrays/test_solution.py
import pytest
from median_two_sorted_arrays import Solution as Solution
def test_example_1():
### Example 1:
##Input:
nums1 = [1,3]
nums2 = [2]
##Output:
output = 2.00000
##Explanation: merged array = [1,2,3] and median is 2.
... | StarcoderdataPython |
11244083 | timeout = 300
capture_output = True
accesslog = '/home/dockeruser/gunicorn-access.log'
errorlog = '/home/dockeruser/gunicorn-error.log'
loglevel = 'debug'
bind = "0.0.0.0:9000"
secure_scheme_headers = {
'X-FORWARDED-PROTOCOL': 'ssl',
'X-FORWARDED-PROTO': 'https',
'X-FORWARDED-SSL': 'on'
}
def post_fork(se... | StarcoderdataPython |
11371987 | <reponame>manninosi/Data_Incubator_LET<filename>Data_Inc_Section1.py
import numpy as np
import pandas as pd
file = "county_lex_2020-04-14.csv.gz"
df = pd.read_csv(file, compression='gzip', header=0)
countys = df.columns.values[1:]
col_names = dict(zip(countys, ["a" + lab for lab in countys] ))
df = df.rename(colum... | StarcoderdataPython |
44989 | <gh_stars>10-100
from .mlm import MLMTopicClassifier
from .mnli import NLITopicClassifierWithMappingHead, NLITopicClassifier
from .nsp import NSPTopicClassifier
from .babeldomains import BabelDomainsClassifier
from .wndomains import WNDomainsClassifier
__all__ = [
"NLITopicClassifierWithMappingHead",
"NLITopic... | StarcoderdataPython |
9697826 | if __name__ == '__main__':
input = [[int(y) for y in x.strip()] for x in open('input', 'r').readlines()]
oxygen = input.copy()
co2 = input.copy()
for i in range(len(input[0])):
if(len(oxygen) > 1):
oxygen = [x for x in oxygen if x[i] == int(sum([x[i] for x in oxygen]) >= len(oxygen)... | StarcoderdataPython |
6497181 | <filename>src/leetcode_1771_maximize_palindrome_length_from_subsequences.py
# @l2g 1771 python3
# [1771] Maximize Palindrome Length From Subsequences
# Difficulty: Hard
# https://leetcode.com/problems/maximize-palindrome-length-from-subsequences
#
# You are given two strings, word1 and word2. You want to construct a st... | StarcoderdataPython |
3268217 | import pytest
import json
from discopy.biclosed import Ty
from lambeq.ccg2discocat.ccg_tree import CCGTree
@pytest.fixture
def tree():
n, s = Ty('n'), Ty('s')
the = CCGTree(text='the', biclosed_type=n << n)
do = CCGTree(text='do', biclosed_type=s >> s)
do_unary = CCGTree(text='do', rule='U', biclos... | StarcoderdataPython |
8033703 | <gh_stars>0
from fishtext.api import FishTextJson, FishTextHtml, FishTextAPI | StarcoderdataPython |
3242209 | <gh_stars>1-10
import agents
import argparse
from habitat.core.challenge import Challenge
import importlib
from submit_args import fill_args
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"--phase", type=str, required=False, choices=["dev", "standard", "challenge", "video"]
)
... | StarcoderdataPython |
1805488 | from django.test import TestCase, Client
class AboutURLTest(TestCase):
@classmethod
def setUpClass(cls):
# Создаём экземпляр клиента. Он неавторизован.
super().setUpClass()
cls.guest_client = Client()
def test_urls_exists_at_desired_locations(self):
about_response = AboutU... | StarcoderdataPython |
127107 | <gh_stars>0
# Generated by Django 2.1.5 on 2020-01-03 10:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shop', '0006_orders_amount'),
]
operations = [
migrations.AlterField(
model_name='product',
name='desc',... | StarcoderdataPython |
11201901 | <filename>bananadbg.py<gh_stars>0
# Copyright (c) 2017 Akuli
# 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, modi... | StarcoderdataPython |
5091732 | import argparse
import cv2
import numpy as np
import torch
import torchvision.transforms as transforms
from PIL import Image
from torch.autograd import Variable
from torchvision.transforms import ToTensor, ToPILImage
from tqdm import tqdm
from model import Generator
if __name__ == "__main__":
parser = argparse.A... | StarcoderdataPython |
6423256 | #
# Copyright 2019 FMR LLC <<EMAIL>>
#
# SPDX-License-Identifier: MIT
#
"""Test role access to the accounts specified.
## Overview
The access_report command will display the number of accounts that the IAM
role does not have access to. For example:
$ awsrun --account 100200300400 --account 200300400100 access_r... | StarcoderdataPython |
1904753 | <filename>datasets/MNINST/dnn_3_hidden_layers_with_batch_normalization/dnn_3_hidden_layers_with_batch_normalization.py
########################################
#
# Reproduced work of <NAME> Szegedy's paper
# Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift (https://arxiv.or... | StarcoderdataPython |
3212799 | <reponame>CrepeGoat/cdf-estimation
from collections import namedtuple
import numpy as np
from scipy.interpolate import PPoly
import cvxopt
cvxopt.solvers.options['show_progress'] = False
cvxopt.solvers.options['maxiters'] = 500 # seems to reduce errors (unconfirmed)
from likelihood_funcs import *
'''
TODO
- imp... | StarcoderdataPython |
214797 | <filename>reviewboard/scmtools/tests/test_repository.py
class RepositoryTests(TestCase):
"""Unit tests for Repository operations."""
fixtures = ["test_scmtools"]
def setUp(self):
super(RepositoryTests, self).setUp()
self.local_repo_path = os.path.join(os.path.dirname(__file__), "..", "testdata", "git_repo")
se... | StarcoderdataPython |
12825950 | # (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import json
import os
import mock
import pytest
from datadog_checks.citrix_hypervisor import CitrixHypervisorCheck
from . import common
@pytest.mark.usefixtures('mock_responses')
def test_collect_meta... | StarcoderdataPython |
1753989 | def disassemble_script(inp, ip_reg):
r_names = ['A', 'B', 'C', 'D', 'E', 'F']
r_names[ip_reg] = 'IP'
for n, line in enumerate(inp):
op, *params = line.split()
a, b, c = map(int, params)
print(f'{n:>2}: ', end='')
if op == 'addr':
print(f'{op} {r_names[a]} + {r_nam... | StarcoderdataPython |
3362475 | # THIS IS NOT INTENDED TO RUN AS IS, THE IMPORTS WILL FAIL.
# PLEASE READ THE COMMENTS
import argparse
import slurm as om
# Note: The slurm repo has to be added as a submodule within that path
# that you will be working in. Thus you'll use something like:
# ` import slurm as om` were slurm is this package's ... | StarcoderdataPython |
1632098 | <reponame>sun1638650145/CRNN
from .utils import decode_predictions
from .utils import get_dataset_summary
from .utils import get_image_format
from .utils import visualize_train_data
from .preprocessing import character_decoder
from .preprocessing import character_encoder
from .preprocessing import create_tf_dataset
fro... | StarcoderdataPython |
9786281 | <filename>pypcode_emu/ntypes.py<gh_stars>10-100
import operator
from typing import Type
import nativetypes as nt
from bidict import bidict
uint1 = nt.nint_type("uint1", 1, False)
int1 = nt.nint_type("int1", 1, True)
size2uintN = bidict({0: uint1, 1: nt.uint8, 2: nt.uint16, 4: nt.uint32, 8: nt.uint64})
size2intN = bi... | StarcoderdataPython |
6478337 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 <NAME> <EMAIL>
#
import logging
import ctypes
from haystack.reverse import config
from haystack.reverse import structure
"""
the Python classes to represent the guesswork record and field typing of
allocations.
"""
log = logging.getLogger('field... | StarcoderdataPython |
3550051 | <reponame>emilybache/ApprovalTools<filename>approve_all.py
#!/usr/bin/env python3
import os
import re
import shutil
import argparse
def approve_all(directory, verbose=True):
regex = re.compile(r"(.*)\.received(\..*)")
for root, dirs, files in os.walk(directory):
for filename in files:
mat... | StarcoderdataPython |
1906222 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-26 12:19
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('blog', '0005_category'),
]
operations = [
... | StarcoderdataPython |
9663157 | <reponame>nigeljyng/textacy
# -*- coding: utf-8 -*-
"""
Load, process, iterate, transform, and save text content paired with metadata
— a document.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from collections import Counter
import os
import warnings
from cytoolz import itert... | StarcoderdataPython |
8080093 | import os
import pandas as pd
RANK_DIR = "rank"
FILE_IN = "rank_unordered.tsv"
FILE_OUT = "rank_ordered.csv"
file_path_in = os.path.join(RANK_DIR, FILE_IN)
df = pd.read_csv(file_path_in, sep="\t", names=["rank"]).rename_axis("node").sort_values(by='rank', ascending=False)
file_path_out = os.path.join(RANK_DIR, FILE_O... | StarcoderdataPython |
251404 | <reponame>Maxsior/BotCom
from commands.base import Command
from messengers import Messenger
from entities import Message
from storage import Storage
import entities.keyboards as keyboards
class LangCommand(Command):
def execute(self):
sender = self.msg.sender
messenger = Messenger.get_instance(sen... | StarcoderdataPython |
3315724 | <reponame>1067511899/tornado-learn
'''
Divisors of 42 are : 1, 2, 3, 6, 7, 14, 21, 42. These divisors squared are: 1, 4, 9, 36, 49, 196, 441, 1764. The sum of the squared divisors is 2500 which is 50 * 50, a square!
Given two integers m, n (1 <= m <= n) we want to find all integers between m and n whose sum of squared... | StarcoderdataPython |
71386 | <gh_stars>1-10
from spark.tests import TestCase
from nose.tools import eq_
from users.models import User, CompletedChallenge
from challenges.models import Challenge
from challenges.utils import award_hidden_badges
class AwardHiddenBadges(TestCase):
fixtures = ['boost.json', 'challenges.json', 'completed_challen... | StarcoderdataPython |
4825421 | from bzt.utils import SoapUIScriptConverter
from tests.unit import BZTestCase, RESOURCES_DIR, ROOT_LOGGER
class TestSoapUIConverter(BZTestCase):
def test_minimal(self):
obj = SoapUIScriptConverter(ROOT_LOGGER)
config = obj.convert_script(RESOURCES_DIR + "soapui/project.xml")
self.assertIn... | StarcoderdataPython |
6594948 | <gh_stars>0
from array import *
##################################################################
# 1. Create an array and traverse.
myarray = array('i', [1,2,3,4,5,6]) # i means int
print(myarray)
myarray1 = array('d', [1.3,2.4,3.2,4.1,5.5]) # d means double
print(myarray1)
##########################################... | StarcoderdataPython |
9720669 | <gh_stars>0
"""Axis conftest."""
from typing import Optional
from unittest.mock import patch
from axis.rtsp import (
SIGNAL_DATA,
SIGNAL_FAILED,
SIGNAL_PLAYING,
STATE_PLAYING,
STATE_STOPPED,
)
import pytest
from tests.components.light.conftest import mock_light_profiles # noqa: F401
@pytest.fi... | StarcoderdataPython |
63444 | import collections
import typing
from . import tags
from .iterators import chunked_iterable
from .models import Project
def list_cluster_arns_in_account(ecs_client):
"""
Generates the ARN of every ECS cluster in an account.
"""
paginator = ecs_client.get_paginator("list_clusters")
for page in pa... | StarcoderdataPython |
1631838 | #!/usr/bin/env python
# encoding:utf-8
from handler.public import (BasePage, BaseApi, Auth)
from fastweb import coroutine
import sys
import datetime
reload(sys)
sys.setdefaultencoding('utf-8')
# 平台首页
class LogHandler(BasePage):
@coroutine
@Auth.authUser
def get(self):
self.end('lo... | StarcoderdataPython |
3211739 | <filename>linkedlist/addTwoNumbersTwo.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: <NAME>
# You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and return it as a linked lis... | StarcoderdataPython |
268067 | from beem.account import Account
from beem.amount import Amount
from beem import Steem
from beem.instance import set_shared_steem_instance
from beem.nodelist import NodeList
from beem.utils import formatTimeString
import re
import json
import os
from time import sleep
import dataset
import json
from steembi.parse_hist_... | StarcoderdataPython |
12863991 | import pytest
from Door import Door
def test_find_password():
door_id = "abc"
door = Door(door_id)
assert(door.find_password() == "<PASSWORD>")
def test_find_password2():
door_id = "abc"
door = Door(door_id)
assert(door.find_password2() == "<PASSWORD>") | StarcoderdataPython |
3254957 | <gh_stars>1-10
# tests/test_py
from ttlockwrapper import TTLock,TTlockAPIError, constants
import requests_mock
import requests
import re
import pytest
FAKE_CLIENT_ID='34144ff6749ea9ced96cbd2470db12f2'
FAKE_ACCESS_TOKEN='<KEY>'
TOKEN_ERROR_CODES = [10003]
INVALID_CURRENT_TIMESTAMP_ERROR = 80000
LOCK_STATE_RESPONSE = '... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.