id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
1678560 | # coding: utf-8
import io
import sys
sys.stdout.reconfigure(encoding='gb18030')#IDE调试、间接调用
#sys.stdout.reconfigure(encoding='utf-8')#Terminal运行
import my_server
if __name__ == '__main__':
# print(sys.getdefaultencoding())
# sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding='gb18030')
my_server.Run()
| StarcoderdataPython |
6562306 | <reponame>withshubh/dagster
# pylint: disable=unused-import
import os
import sys
import uuid
import pytest
from airflow.exceptions import AirflowException
from airflow.utils import timezone
from dagster.core.definitions.reconstructable import ReconstructableRepository
from dagster.core.utils import make_new_run_id
fro... | StarcoderdataPython |
3396594 | #!/usr/bin/env python
"""
Split a given file into the specified number of files.
Order is preserved.
Author: <NAME>
Contact: <EMAIL>
Date: 2014
"""
from os import path
import argparse
import math
import os
import sys
#-----------------------------------------------------------------------------#
# ... | StarcoderdataPython |
3552214 | """ Unit test file. """
import pytest
import numpy as np
from ..BaumWelch import do_E_step, calculate_log_likelihood
from ..LineageTree import LineageTree
from ..tHMM import tHMM
from ..figures.figureCommon import pi, T, E
@pytest.mark.parametrize("cens", [0, 2])
@pytest.mark.parametrize("nStates", [1, 2, 3])
def tes... | StarcoderdataPython |
5151078 | import json
import numpy as np
import re
# defining regex pattern
# pattern = re.compile(r"[^\u0E00-\u0E7F0-9]|^'|'$|''")
path = 'D:/Users/Patdanai/th-qasys-db/tokenized_wiki_corpus/' # default development path
def load_article(dir_path, art_id):
with open(dir_path + str(art_id) + '.json', 'r', encoding='utf-8', ... | StarcoderdataPython |
1613592 | """ Testing unittest_assertions/base.py """
from typing import (
Callable,
Iterable,
Mapping,
)
import pytest
from unittest_assertions.base import Assertion
from unittest_assertions.equality import AssertEqual
class TestBuiltinAssertion:
"""Testing builtin assertions"""
@pytest.mark.parametrize... | StarcoderdataPython |
6520878 | '''
Created on 2014-11-1
@author: eluoyng
'''
import wsgi
class ControllerTest(object):
def __init__(self):
print "ControllerTest!!!!"
def test(self, req):
print "req", req
return {
'name': "test",
'properties': "test"
}
class MyControllerTest(objec... | StarcoderdataPython |
5131907 | <gh_stars>10-100
# 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 agree... | StarcoderdataPython |
9721067 | import os
from setuptools import find_packages, setup
deps = [
"aiofiles",
"authlib",
"boto3",
"click",
"click-aliases",
"colorama",
"cryptography",
"databases[postgresql]",
"elasticsearch>=7.0.0,<8.0.0",
"fastapi",
"fastapi-users",
"fastapi-contrib",
"ffmpeg-python... | StarcoderdataPython |
4814032 | <gh_stars>0
import logging
import sys
from logging.handlers import RotatingFileHandler
from pathlib import Path
from naucse.freezer import NaucseFreezer
if sys.version_info[0] <3 :
raise RuntimeError('We love Python 3.')
from naucse.cli import cli
from naucse.views import app, lesson_static_generator
def main(... | StarcoderdataPython |
1630406 | # -*- coding: utf-8 -*-
'''
Filter out those sequences where at least 6 saccades are not valid.
'''
import gazelib
def run(input_files, output_files):
# List of sequence lists
sequences = gazelib.io.load_json(input_files[0])
complete_sequences = []
validity = 'heuristic_saccade_validity'
for seq ... | StarcoderdataPython |
3327879 | <gh_stars>0
n = int(input())
for _ in range(n):
e = input()
if len(e) >10:
print(e[0]+str(len(e)-2)+e[len(e)-1])
else:
print(e)
| StarcoderdataPython |
4872062 | import os
import sys
sys.path.append(os.getcwd() + "/facerecognition/PyFaceRecClient/simple-faster-rcnn-pytorch/")
import torchvision
import torch
import numpy as np
from models.utils.bbox_tools import bbox2loc, bbox_iou, loc2bbox
from models.utils.nms import non_maximum_suppression
'''
class ProposalTargetCreator(ob... | StarcoderdataPython |
11251590 | <filename>test/imputation/cs/test_fast_knn.py
"""test_fast_knn.py"""
import unittest
import numpy as np
import impyute as impy
# pylint:disable=invalid-name
class TestFastKNN(unittest.TestCase):
""" Tests for Fast KNN """
def setUp(self):
"""
self.data_c: Complete dataset/No missing values
... | StarcoderdataPython |
4954178 | <reponame>lhuett/insights-core
from ...parsers import saphostctrl, ParseException, SkipException
from ...parsers.saphostctrl import SAPHostCtrlInstances
from ...tests import context_wrap
import doctest
import pytest
SAPHOSTCTRL_HOSTINSTANCES_DOCS = '''
*********************************************************
Creatio... | StarcoderdataPython |
5057597 | # this module has all string related algorithm
def is_permutation(string1, string2):
""" check if string1 is permutation of string2 """
return len(string1) == len(string2) and sorted(string1) == sorted(string2)
| StarcoderdataPython |
3266773 | <gh_stars>1-10
import json
from rest_framework import status
from rest_framework.test import APIClient, APITestCase
from django.urls import reverse
from django.contrib.auth import get_user_model
from blitz_api.factories import UserFactory, AdminFactory
from blitz_api.services import remove_translation_fields
from .... | StarcoderdataPython |
9610784 | # Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
# useful for handling different item types with a single interface
from scrapy.exporters import CsvItemExporter
from nlu_link_collector.items import... | StarcoderdataPython |
4995500 | import numpy as np
import sys
from random import randint
from copy import copy
from numpy import matrix
from seidel_algo import seidel_algo
def floyd_warshall_algo(input_graph):
graph = copy(input_graph)
n = graph.shape[0]
inf = 10 ** 9 + 7
for i in range(n):
for j in range(n):
if... | StarcoderdataPython |
1865004 | """
loadColorTables.py
Purpose: Utility script that loads GEMPAK color table files and converts them to HootPy fconfig files.
Started: <NAME> on March 5, 2012
"""
def main():
import argparse
parser = argparse.ArgumentParser(prog='loadColorTables',description='Load a GEMPAK or matplotlib color table and conve... | StarcoderdataPython |
8116976 | <reponame>sorinsuciu-msft/openai-python
#!/usr/bin/env python
import argparse
import logging
import sys
import openai
from openai.cli import api_register, display_error, tools_register, wandb_register
logger = logging.getLogger()
formatter = logging.Formatter("[%(asctime)s] %(message)s")
handler = logging.StreamHandl... | StarcoderdataPython |
1679275 | from .base_model import BaseModel
class QuestionModel(BaseModel):
""" Question Model."""
table = 'questions'
def save(self, data):
""" Save a new question."""
query = "INSERT INTO {} (title, body, meetup_id, user_id) \
VALUES('{}','{}','{}', '{}') RETURNING *".format(... | StarcoderdataPython |
11370647 | <filename>src/Genome/sequence/EulerPath.py<gh_stars>0
class Node():
def __init__(self, name):
self.name = name
self.ins = []
self.outs = []
class EulerPath():
def __init__(self, adj):
self.graph = {}
for src,destlist in adj.items():
srcnode = self.getNode(src)
... | StarcoderdataPython |
1860313 | <gh_stars>1-10
# Generated by Django 3.0.3 on 2020-02-21 14:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0013_auto_20190918_1438'),
]
operations = [
migrations.AddField(
model_name='registrant',
n... | StarcoderdataPython |
4946828 | __author__ = "<NAME>"
import json
import urllib.request
if __name__ == "__main__":
req = urllib.request.Request(
"https://raw.githubusercontent.com/github/gemoji/master/db/emoji.json")
with urllib.request.urlopen(req) as response:
js = json.loads(response.read())
for i in js[:10]:
... | StarcoderdataPython |
135437 | import re
from recipes.site_listers.base import TwoLevelSitemapLister
class TheHappyFoodieLister(TwoLevelSitemapLister):
""" """
start_url = "https://thehappyfoodie.co.uk/sitemap_index.xml"
sitemap_path_regex = re.compile(r"^/recipes-sitemap\d+\.xml$")
recipes_path_regex = re.compile(r"^/recipes/.+$... | StarcoderdataPython |
1783752 | <reponame>nabin-info/hackerrank.com<filename>project_euler/n009.py<gh_stars>0
#!/usr/bin/python
import sys
def input_arg(tr=str): return tr(raw_input().strip())
def input_args(tr=str): return map(tr, list(input_arg().split(' ')))
def input_arglines(n,tr=str): return [input_arg(tr) for x in range(n)]
def cktri(n):
... | StarcoderdataPython |
172786 | from src.params.ParamsPING import *
from src.izhikevich_simulation.IzhikevichNetworkOutcome import *
from src.params.ParamsFrequencies import *
import numpy as np
from math import floor, pi
from scipy import fft
import matplotlib.pyplot as plt
from collections import Counter
from tqdm import tqdm
import warnings
cl... | StarcoderdataPython |
6514764 | <filename>src/ipaparser/_code/definitions/brackets.py
from enum import Enum
__all__ = [
'BracketStrategy',
]
class BracketStrategy(str, Enum):
KEEP = 'keep'
EXPAND = 'expand'
STRIP = 'strip'
| StarcoderdataPython |
4982138 | <gh_stars>0
from dataclasses import dataclass
from greenberry.types.blockchain_format.sized_bytes import bytes32
from greenberry.util.ints import uint32
from greenberry.util.streamable import Streamable, streamable
@dataclass(frozen=True)
@streamable
class PoolTarget(Streamable):
puzzle_hash: bytes32
max_hei... | StarcoderdataPython |
5170283 | <filename>myCSV.py
import numpy as np
import csv
class myCSV():
def open(name, ct=-1, hasHead=True, delimiter=','):
idx, data, dic, c = [], [], {}, 0
with open(name, newline='') as csvfile:
spamreader = csv.reader(csvfile, delimiter=delimiter, quotechar='|')
if ct < 0:
... | StarcoderdataPython |
224849 | # vim: fdm=marker
'''
author: <NAME>
date: 22/05/14
content: Build a coordinate map of the initial reference of a patient to an
external reference seq (e.g. HXB2). This is useful to quickly find
genes and stuff like that.
'''
# Modules
import os
import argparse
from operator import ... | StarcoderdataPython |
4874269 | #
# Potassium current (IK) toy model based on the model by Hodgkin & Huxley (HH).
#
# This file is part of PINTS.
# Copyright (c) 2017-2019, University of Oxford.
# For licensing information, see the LICENSE file distributed with the PINTS
# software package.
#
#
from __future__ import absolute_import, division
from... | StarcoderdataPython |
3425261 | <filename>tensorflow/contrib/distribute/python/prefetching_ops_v2.py
# 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... | StarcoderdataPython |
11268610 | import torch
import vision_transformer
from TorchSUL import Model as M
import torch.nn as nn
import config
from vision_transformer import Block
class DepthToSpace(M.Model):
def initialize(self, block_size):
self.block_size = block_size
def forward(self, x):
bsize, chn, h, w = x.shape[0], x.shape[1], x.shape... | StarcoderdataPython |
9732587 | <filename>tests/misc/cursor_util_test.py<gh_stars>1-10
# -*- coding: utf-8 -*-
#
# This file is part of AceQL Python Client SDK.
# AceQL Python Client SDK: Remote SQL access over HTTP with AceQL HTTP.
# Copyright (C) 2021, KawanSoft SAS
# (http://www.kawansoft.com). All rights reserved.
#
# Licensed under the Apache L... | StarcoderdataPython |
1985845 | class Solution:
def countAndSay(self, n: int) -> str:
if n == 1:
return "1"
final_string = "1"
for _ in range(1, n):
previous = final_string[0]
count = 0
temp_string = ""
for each_string in final_string:
if each_stri... | StarcoderdataPython |
6648171 | <gh_stars>0
from .account import (
Account,
)
from .chain import (
Chain,
)
from .meta import (
Meta,
)
from .module import (
Module,
)
from .state import (
State,
)
from .system import (
System,
)
__all__ = [
"Account",
"Chain",
"Meta",
"Module",
"State",
"System",
]
| StarcoderdataPython |
6676535 | <filename>pytorch_toolbelt/utils/torch_utils.py
"""Common functions to marshal data to/from PyTorch
"""
import collections
from typing import Optional, Sequence, Union, Dict
import numpy as np
import torch
from torch import nn
__all__ = [
"rgb_image_from_tensor",
"tensor_from_mask_image",
"tensor_from_rg... | StarcoderdataPython |
6406248 | def index_to_clearcontrol_filename(index : int ):
return ("000000" + str(index))[-6:] + ".raw"
| StarcoderdataPython |
9772513 | from abc import ABC, abstractmethod
from typing import Any
from tools37.tkfw._commented.events import Transmitter
__all__ = [
'Dynamic',
'DynamicContainer',
'DynamicBinder',
]
class Dynamic(Transmitter, ABC):
"""
HasView objects are dynamic objects.
They must implement a view method ... | StarcoderdataPython |
1683054 | # -*- coding: utf-8 -*-
# Copyright 2010-2021, Google Inc.
# 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 the above copyright
# notice, this... | StarcoderdataPython |
1603728 | <filename>Combined Neural Network/FAC/importData_image_quality.py
from __future__ import absolute_import
from __future__ import print_function
import pickle
import numpy as np
from keras.preprocessing.image import load_img, img_to_array
from scipy.misc import imresize
class importData(object):
def __init__(self, c... | StarcoderdataPython |
6568900 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Script to test and demonstrate methods for importing data from NODLE excel
template
@author: RIHY
"""
import nodle
from common import read_block
import matplotlib.pyplot as plt
plt.close('all')
#%%
fname = 'NODLE_demo.xlsx'
COO_df = nodle.read_COO(fname)
print(COO_df)
MEM... | StarcoderdataPython |
3531679 | # External module dependencies
from typing import Callable, Optional, List, Dict, Set
from threading import Thread
from queue import Queue, Empty
from time import sleep
# Internal module dependencies
from .util import SingleWriteMultipleReadLock
from . import log
######################################################... | StarcoderdataPython |
11305966 | <gh_stars>0
"""
This module contains our Django helper functions for the "tutor" application.
"""
import json
import re
import time
import urllib
import websockets
from django.contrib.auth.models import User
import core.models
from accounts.models import UserInformation
from core.models import Lesson
from data_analys... | StarcoderdataPython |
9652793 | <reponame>kuis-isle3hw/simple_assembler
import os
import sys
def read_data():
"""
コマンドライン引数の一番目で指定されたファイルから読み取り、一行ずつリストにして返す。
コマンドライン引数が指定されなかった場合は、usageを表示してプログラムを終了する。
"""
if len(sys.argv) < 2:
print("usage: python3 assembler.py input-file [output-file]", file=sys.stderr)
exit(1)... | StarcoderdataPython |
4882998 | <reponame>abcdefg-dev-dd/asxdcvfg<filename>main.py
from __future__ import division
import argparse
from dataset.pems_d import *
from utils.metrics import *
from utils.process import *
import os
from trainer.ctrainer import CTrainer
from trainer.rtrainer import RTrainer
from nets.traverse_net import TraverseNet, Travers... | StarcoderdataPython |
1775035 | <filename>solthiruthi/resources.py
## -*- coding: utf-8 -*-
## This file is part of Open-Tamil project.
## (C) 2015,2020 <NAME>
##
from __future__ import print_function
import os
def _make_dict_with_path( srcfiles ):
return dict( [( srcfile.split(u".txt")[0], mk_path( srcfile ) ) \
for srcfi... | StarcoderdataPython |
8072854 | <reponame>noahf100/sitemap-generator<filename>scrapy_sitemap.py
import scrapy
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
class RecipeSpider(CrawlSpider):
name = 'recipe_spider'
def __init__(self):
self.start_urls = ['https://www.hellofresh.com']
... | StarcoderdataPython |
4883598 | # Generated by Django 2.2.3 on 2020-04-14 06:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Filmmakers', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='celebrity',
name='celebrity_name',... | StarcoderdataPython |
5042788 | <reponame>cs-nerds/lishebora-shipping-service
from geopy import distance
def get_distance_km(point1: tuple, point2: tuple) -> float:
return distance.distance(point1, point2).km
| StarcoderdataPython |
5198162 | from __future__ import absolute_import, print_function
import collections
import unittest
import huffman
class TestCodebookGeneration(unittest.TestCase):
def test_basic(self):
output = huffman.codebook([("A", 2), ("B", 4), ("C", 1), ("D", 1)])
expected = {"A": "10", "B": "0", "C": "110", "D": "1... | StarcoderdataPython |
9728345 | #!/opt/local/bin/python
# Checked to see which directions we'll be dealing with in the input with the following:
'''
computer:12 paul$ grep L 12_input.txt | tr -d L | sort | uniq -c
26 180
7 270
62 90
computer:12 paul$ grep R 12_input.txt | tr -d R | sort | uniq -c
22 180
5 270
58 90
'''
# So, we're only... | StarcoderdataPython |
11235480 | <reponame>mipsu/Kiny-Painel<gh_stars>1-10
#---------------------------------------#
global R,B,C,G
R='\033[1;31m';B='\033[1;34m';C='\033[1;37m';G='\033[1;32m';Format="\033[0m";Letra="\033[38;5;15m";Fundo="\033[48;5;19m"
from os import system
from os import execl
from sys import executable
from sys import argv
from os i... | StarcoderdataPython |
8187364 | <filename>labs/backend/migrations/0003_auto_20200117_1317.py
# Generated by Django 2.2.6 on 2020-01-17 13:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0002_threadtask'),
]
operations = [
migrations.RemoveField(
... | StarcoderdataPython |
8042605 | import os
import glob
import json
from collections import OrderedDict
from colorama import Fore
from toolset.databases import databases
from toolset.utils.output_helper import log
class Metadata:
supported_dbs = []
for name in databases:
supported_dbs.append((name, '...'))
def __init__(self, be... | StarcoderdataPython |
172086 | <filename>riptable/rt_dataset.py
# -*- coding: utf-8 -*-
__all__ = ['Dataset', ]
from collections import abc, Counter, namedtuple
import operator
import os
from typing import Any, Callable, Iterable, List, Mapping, Optional, Sequence, Tuple, Union, TYPE_CHECKING
import warnings
import numpy as np
from .r... | StarcoderdataPython |
395057 | <filename>tests/utils/test_slugify.py
# -*- coding: utf-8 -*-
import unittest
from unittest import skipUnless
from pulsar.utils.slugify import slugify, unidecode
@skipUnless(unidecode, 'Requires unidecode package')
class TestSlugify(unittest.TestCase):
def test_manager(self):
txt = "This is a test ---... | StarcoderdataPython |
5181034 | """This module contains the general information for BiosVfCPUPerformance ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class BiosVfCPUPerformanceConsts:
VP_CPUPERFORMANCE_CUSTOM = "custom"
VP_CPUPERFORMANCE_ENTERPRISE... | StarcoderdataPython |
3494309 | <gh_stars>0
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 11 06:37:50 2016
@author: i026e
"""
import re
import sys
from sys import argv
if sys.version_info >= (3, 0):
import tkinter as tk
from tkinter import font
from tkinter import filedialog
else:
import Tkinter as tk
import... | StarcoderdataPython |
3206008 | <reponame>hpatel1567/pymatgen<filename>pymatgen/entries/__init__.py
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module contains entry related tools. Essentially, entries are containers
for calculated information, which is used in many analyses.... | StarcoderdataPython |
3553802 | first=0
second=1
n=int(input("How many steps did you want to execute?"))
def fibonacci(num):
if num==0:
return 0
elif num==1:
return 1
else:
return fibonacci(num-1)+fibonacci(num-2)
print("Fibonacci Series are")
for i in range(0,n):
print(fibonacci(i))
| StarcoderdataPython |
6593652 | from distutils.core import setup
from setuptools import find_packages
setup(
name='AWSLeR',
author='<NAME>',
author_email='<EMAIL>',
install_requires=['boto3', 'docopt'],
long_description=open('README.md').read(),
packages=find_packages(exclude=['docs', 'tests']),
url='https://github.com/fo... | StarcoderdataPython |
11215181 |
import math
i = 2
N = 1500450271
iPrime = False
while i < math.sqrt(N):
if N % i == 0:
isPrime = False
i+=1
# Time taken by B's program = 1ms * number of divisions
# = 1ms * square root of 1500450271
# = approximately 40000ms = 40 seconds. | StarcoderdataPython |
6519134 | from keras.models import Model
from keras.layers import Input, Reshape, merge, dot, Activation
from keras.layers.embeddings import Embedding
import keras.initializers
from keras.utils import Sequence
from keras.preprocessing import sequence
import wordvectors.physicaldata.tools as tools
import wordvectors.phys... | StarcoderdataPython |
4814822 | import os
import os.path
import shutil
import subprocess
import sys
import tempfile
import zipfile
def check_call(command, *args, **kwargs):
command = list(command)
print('Launching: ')
for arg in command:
print(' {}'.format(arg))
return subprocess.check_call(command, *args, **kwargs)
de... | StarcoderdataPython |
5011825 | <reponame>jlconlin/PhDThesis
__id__ = "$Id: powerMC.py 163 2007-10-05 12:35:38Z jlconlin $"
__author__ = "$Author: jlconlin $"
__version__ = " $Revision: 163 $"
__date__ = "$Date: 2007-10-05 06:35:38 -0600 (Fri, 05 Oct 2007) $"
import random
import math
import time
import Gnuplot
import scipy.stats
impor... | StarcoderdataPython |
1996376 | <reponame>certik/sympy-oldcore
import sys
sys.path.append("..")
from sympy.numerics import *
from sympy.numerics.utils_ import *
from sympy.numerics.constants import pi_float
import math
from time import clock
def display_fraction(digits, skip=0, colwidth=10, columns=5):
perline = colwidth * columns
... | StarcoderdataPython |
5045795 | import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="soso-event",
version="0.0.1",
author="<NAME>",
author_email="<EMAIL>",
description="A simple event handling library",
long_description=long_description,
long_desc... | StarcoderdataPython |
3528947 | <gh_stars>0
#check for divisibilty between two numbers using if-else
number1 = int(input("Enter first number: "))
number2 = int(input("Enter second number: "))
if number1 % number2 == 0:
print(str(number1)+" is divisible by "+str(number2))
else:
print(str(number1)+" is not divisible by "+str(number2))
| StarcoderdataPython |
3538913 | import os, json, pickle
import numpy as np
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
from sklearn.manifold import TSNE
np.random.seed(13)
fp = '../../data/SCOTUS/'
case_path = fp+'dvectors/sco50d/'
total_cases = (len(os.listdir(case_path))/2)
tr... | StarcoderdataPython |
3390467 | """Standard setuptools.
"""
from os import path
from setuptools import setup, find_packages
here = path.abspath(path.dirname(__file__))
README = path.join(here, 'README.txt')
if path.isfile(README):
with open(README) as f:
long_description = f.read()
else:
long_description = ''
setup(
name='djan... | StarcoderdataPython |
1806939 | <gh_stars>0
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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 |
4924732 | # Tries: 1
rows = int(input())
boards = []
board = ""
for i in range(4 * rows + 3):
line = input()
if not line:
boards.append(board)
board = ""
else:
board += line
boards.append(board)
def difference(board_in, type=0):
to_return = 0
for i in board_in:
to_return += i... | StarcoderdataPython |
4044 | from keras.callbacks import ModelCheckpoint,Callback,LearningRateScheduler,TensorBoard
from keras.models import load_model
import random
import numpy as np
from scipy import misc
import gc
from keras.optimizers import Adam
from imageio import imread
from datetime import datetime
import os
import json
import models
from... | StarcoderdataPython |
3597684 | """ Tests for CLI doctrans subparser (__main__.py) """
from os import path
from tempfile import TemporaryDirectory
from unittest import TestCase
from unittest.mock import patch
from cdd.tests.utils_for_tests import mock_function, run_cli_test, unittest_main
class TestCliDocTrans(TestCase):
"""Test class for __m... | StarcoderdataPython |
4955819 | import unittest
from geopar.tf_validator import TF_Validator
from geopar.triangulated_figure_class import TriangulatedFigure
from geopar.triangle_class import Triangle
__author__ = 'satbek'
# URL1:
# https://docs.google.com/presentation/d/1nddxo9JPaoxz-Colod8qd6Yuj_k7LXhBfO3JlVSYXrE/edit?usp=sharing
# URL 2:
# https... | StarcoderdataPython |
11359 | # Copyright 2019 Huawei Technologies Co., Ltd
#
# 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... | StarcoderdataPython |
292432 | <filename>compyler/warning.py
#!/usr/bin/python3
# 2019-1-27
# <NAME>
import sys
from termcolor import colored
class Warning:
def __init__(self, module, message, line=None, pos=None):
self.module = module
self.message = message
self.line = line
self.pos = pos
self.warn()
... | StarcoderdataPython |
1988013 | """Test reading and writing of program data."""
import unittest
from core import *
from google.appengine.ext import db
from named import QualtricsLink
import unit_test_helper
class QualtricsTestCase(unit_test_helper.PopulatedInconsistentTestCase):
def test_stuff(self):
"""Test that QualtricsLink.get_li... | StarcoderdataPython |
5123436 | <reponame>fitahol/fitahol
# coding=utf-8
from django.contrib import admin
from django.template.defaultfilters import truncatechars_html
from fitness.models import GoalRecord, InBodyRecords, FitGoal
from fitness.models import FitnessEquipment, FitnessExercise, FitnessPicture, \
FitnessVideo, ExerciseCategory, Muscl... | StarcoderdataPython |
4910813 | import math
import json
import glob
import string
import os
import pprint
#having trouble with python packages not working, (nltk, numpy, metapy, pandas). Suspect Big Sur compatibility issues. Could also be a file path issue
"""term_vector_rec.py
Module Overview
- Static Inputs: (recipes Corpus, list of user-relevant ... | StarcoderdataPython |
1950653 | <filename>logquacious/tests/test_backport_configurable_stacklevel.py<gh_stars>10-100
import logging
from unittest import TestCase
import pytest
from logquacious.backport_configurable_stacklevel import PatchedLoggerMixin
class RecordingHandler(logging.NullHandler):
def __init__(self, *args, **kwargs):
s... | StarcoderdataPython |
4954112 | from __future__ import print_function
from builtins import range
import json
import random
import time
import itertools
from ethereum import utils
from ethereum.utils import parse_as_bin, big_endian_to_int, is_string
from ethereum.meta import apply_block
from ethereum.common import update_block_env_variables
from ether... | StarcoderdataPython |
8079273 | from sqlalchemy.ext.declarative import declarative_base
import datetime
from sqlalchemy import Column, Integer, String, create_engine ,DateTime
# 宣告對映
Base = declarative_base()
class File(Base):
__tablename__ = 'box'
id = Column(String(50), primary_key=True)
root = Column(String(100), nullable=False)
... | StarcoderdataPython |
1898751 | from django.apps import AppConfig
class PunishmentConfig(AppConfig):
name = "punishment"
| StarcoderdataPython |
1601029 | import os
import pytest
import json
try:
from urllib import quote # Python 2.X
except ImportError:
from urllib.parse import quote # Python 3+
from pigskin.pigskin import pigskin
pytest.gp_username = os.getenv('PIGSKIN_USER', '')
pytest.gp_password = os.getenv('PIGSKIN_PASS', '')
scrub_list = []
for i in [... | StarcoderdataPython |
6658439 | <gh_stars>0
version = '1.6.3'
revision = ''
milestone = 'Yoitsu'
release_number = '75'
projectURL = 'https://syncplay.pl/'
| StarcoderdataPython |
1843696 | from clikit.api.args.format import Argument
from clikit.api.args.format import Option
from cleo import argument
from cleo import option
def test_argument():
arg = argument("foo", "Foo")
assert "Foo" == arg.description
assert arg.is_required()
assert not arg.is_optional()
assert not arg.is_multi_... | StarcoderdataPython |
3303216 | <gh_stars>0
from django.db import models
from django.utils import timezone
# Create your models here.
#model for book that asks for page , genre and publish date
class Book(models.Model):
page_number= models.IntegerField()
genre = models.CharField(max_length=100)
publish_date = models.DateField(default=... | StarcoderdataPython |
6564009 | <reponame>jlopezNEU/scikit-learn
import os
import shutil
import tempfile
import warnings
from pickle import loads
from pickle import dumps
from functools import partial
from importlib import resources
import pytest
import numpy as np
from sklearn.datasets import get_data_home
from sklearn.datasets import clear_data_ho... | StarcoderdataPython |
8097257 | <gh_stars>0
WAVFILE = '/home/pi/projects/baby-activity-logger/baby_activity_logger/alert_button/alert.wav'
import pygame
from pygame import *
import sys
from gpiozero import Button
from time import sleep
import os
class AlertButton:
def __init__(self, gpio_pin):
self.alert_on = False
self.play_but... | StarcoderdataPython |
111850 | <reponame>echim/pySteps
from core.helpers.point import Point
class Circle:
def __init__(self, center: Point, radius: int):
self._center: Point = center
self._radius: int = radius
@property
def center(self):
return self._center
@center.setter
def center(self, new_center: ... | StarcoderdataPython |
1909513 | <gh_stars>0
"""
SPDX-License-Identifier: BSD-3
"""
from enum import Enum, auto
class CallbackType(Enum):
"""Kinds of c callbacks. Typically, their signature differs."""
FAPI_AUTH = auto()
CALLBACK_COUNT = 10
CALLBACK_BASE_NAME = {CallbackType.FAPI_AUTH: "_auth_callback_wrapper_"}
| StarcoderdataPython |
375290 | #!/usr/bin/env python3
"""
Histórico:
2022-01-16 - Criar a versão 0.2.3
2021-12-12 - Alterar o nome de commandlib para cmdlib.
2021-11-07 - Inserir a função is_admin().
"""
from setuptools import setup
import os
import sys
file_setup = os.path.abspath(os.path.realpath(__file__))
dir_of_project = os.path.dirname(fi... | StarcoderdataPython |
365476 | from collections import deque
class Solution:
def updateMatrix(self, matrix: List[List[int]]) -> List[List[int]]:
q = deque()
# traverse each node, get zero node
h, w = len(matrix), len(matrix[0])
max_step = h * w
for y in range(h):
for x in range(w):
... | StarcoderdataPython |
249574 | # %%
import json
import twitter as tw
import pandas as pd
import urllib.parse as p
from io import StringIO
class TwitterScraper:
def __init__(self, access_token_key, access_token_secret, consumer_key, consumer_secret, id_csv_location="./id.csv"):
self.access_token_key = access_token_key
self.acces... | StarcoderdataPython |
1722938 | import sqlite3
# open("Path", "r")
# text in file
conn = sqlite3.connect("Training.db")
c = conn.cursor()
# f.write() or f.read()
c.execute("CREATE TABLE IF NOT EXISTS iceCubeMelting(time INT,"+
"temperature REAL, date TEXT)")
conn.commit()
c.close()
conn.close() | StarcoderdataPython |
3452141 | <filename>pointcloud_feature_visualization_open3d/features_vis_save.py
import os
from datetime import datetime
import numpy as np
import matplotlib as mpl
import matplotlib.cm as cm
'''
Created by DogyoonLee
https://github.com/dogyoonlee/pointcloud_visualizer/tree/main/pointcloud_feature_visualization_open3d
''... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.