id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3303104 | from math import sin, radians
size(500, 500)
speed(30)
def setup():
global frame
frame = 1
def draw():
global frame
frame += 1
fill(0, 0.25, 0.25)
rect(0, 0, WIDTH, HEIGHT)
for i in range(30):
nofill()
stroke(0.5, 1, 0)
strokewidth(1)
rot... | StarcoderdataPython |
3324546 | import json
import boto3
import logging
import cfnresponse
logger = logging.getLogger()
logger.setLevel(logging.INFO)
ssm = boto3.client('ssm')
def handler(event, context):
kwargs = event['ResourceProperties'].copy()
if 'ServiceToken' in kwargs:
del kwargs['ServiceToken']
logging.info('content... | StarcoderdataPython |
1781564 | <filename>Action_Recognition/1_Process_Enactments/extract_hand_poses.py
from enactment import *
acceptable_pose_sources = ['IK', 'sensor']
def main():
global acceptable_pose_sources
params = get_command_line_params() # Collect parameters
if params['helpme'] or len(params['enactments']) == 0 or params['pos... | StarcoderdataPython |
1600871 | <reponame>antfootAlex/HanLP
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2020-02-17 15:46
_PTB_HOME = 'https://github.com/KhalilMrini/LAL-Parser/archive/master.zip#data/'
PTB_TRAIN = _PTB_HOME + '02-21.10way.clean'
'''Training set of PTB without empty categories. PoS tags are automatically predicted using 10-fold ... | StarcoderdataPython |
1647974 | from LucidDynamodb import DynamoDb
from LucidDynamodb.exceptions import (
TableNotFound
)
import logging
logging.basicConfig(level=logging.INFO)
if __name__ == "__main__":
try:
db = DynamoDb()
db.delete_table(table_name='dev_jobs')
logging.info("Table deleted successfully")
tabl... | StarcoderdataPython |
1690720 | from .deform_conv_func import DeformConvFunction, DeformIm2colFunction
from .modulated_deform_conv_func import ModulatedDeformConvFunction
from .deform_psroi_pooling_func import DeformRoIPoolingFunction | StarcoderdataPython |
25204 | <gh_stars>0
import unittest
import os
from test.aiml_tests.client import TestClient
from programy.config.sections.brain.file import BrainFileConfiguration
class BasicTestClient(TestClient):
def __init__(self):
TestClient.__init__(self)
def load_configuration(self, arguments):
super(BasicTestC... | StarcoderdataPython |
3224680 | #
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.
#
import re
import socket
from cfgm_common import PERMS_RX
from vnc_api.gen.resource_common import VirtualDns
from vnc_cfg_api_server.resources._resource_base import ResourceMixin
class VirtualDnsServer(ResourceMixin, VirtualDns):
@classmethod
... | StarcoderdataPython |
1657068 | <reponame>rakshitraj/findFire
import os
import sys
import glob
import getpass
def remove1000():
path = os.path.join('/home', getpass.getuser(), 'findFire/local/raw/*.jpg')
files = glob.glob(path)
for f in files:
try:
os.remove(f)
except OSError as e:
print("Erro... | StarcoderdataPython |
1661307 | <reponame>bachirlahad86/Python-access-CLI
# Copyright 2016 Netfishers
#
# 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... | StarcoderdataPython |
3302699 | <filename>lazyjson.py<gh_stars>0
"""
lazyjson.py v0.0.1
MIT License
Copyright (c) 2019 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation th... | StarcoderdataPython |
1766207 | # !/usr/bin/python3
# Controller.py
"""
Solar Powered Pool Controller.
This is the main module for this controller.
It runs using a dummy DataSource by detecting it is not on a Raspberry Pi
and setting the global constant REAL to False.
"""
from datetime import datetime, timedelta
from platform import machin... | StarcoderdataPython |
9695 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent 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
# no... | StarcoderdataPython |
1784016 | #!/usr/bin/env python
#-*- coding: utf-8 -*-
# Sample module to bind to GitLab webhook request
# Usage: gitlab-webhook-receiver.py --module glhook
def main(token, payload, request, cmdargs):
if token == "xxx":
request.send_response(401, "Gitlab Token not authorized")
else:
print("foo")
... | StarcoderdataPython |
72360 | import unittest
# import io
# import sys
import lecture_cdn as sut
class TestLectureCDN(unittest.TestCase):
def test_get_tokens(self):
tokens = sut.extract_tokens('trainer:housey;course:csharp-oop-basics;lecture:polymorphism;duration:3h05m')
self.assertSequenceEqual(
sorted(['polymorph... | StarcoderdataPython |
3341203 | <reponame>luccasocastro/Curso-Python<filename>exercicios/ex022.py
cidade = str(input('Informe a cidade em que você nasceu: ')).strip().upper()
div = cidade.split()
print('SANTO' in div[0])
| StarcoderdataPython |
4807474 | # !/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Vincent<<EMAIL>>
# http://wax8280.github.io
# Created on 18-7-30 上午11:52
def send_mobi(path):
if not path:
import os
path = os.getcwd()
from zhihu2kindle.libs.send_email import ... | StarcoderdataPython |
1798865 | import json
import traceback
from django.http import JsonResponse
from ..models import ApigeeMgmtLog
from ..env import Env
from ..utils import REQUEST_KEYS_NO_ARTIFACTS
from ..validate import validate_payload, ValidationException
from .sharedflows import migrate_shared_flows
from .proxies import migrate_proxies
from ... | StarcoderdataPython |
84946 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the partition file entry implementation using pytsk3."""
import unittest
from dfvfs.path import os_path_spec
from dfvfs.path import tsk_partition_path_spec
from dfvfs.resolver import context
from dfvfs.vfs import tsk_partition_file_entry
from dfvfs.vfs import... | StarcoderdataPython |
35947 | <filename>game-ai-ui/video/video.py
import logging
import re
import os
import mimetypes
from flask import Response
LOG = logging.getLogger(__name__)
MB = 1 << 20
BUFF_SIZE = 10 * MB
def partial_response(path, start, end=None):
LOG.info('Requested: %s, %s', start, end)
file_size = os.path.getsize(path)
#... | StarcoderdataPython |
1617986 | <filename>day04.py
class BoardField:
def __init__(self, input_value):
self.value = input_value
self.is_marked = False
class Board:
def __init__(self, size_x, size_y):
self.size_x = size_x
self.size_y = size_y
self.board = [[BoardField(0) for x in range(size_x)] for y in... | StarcoderdataPython |
190271 | <gh_stars>0
# Ahjo - Database deployment framework
#
# Copyright 2019, 2020, 2021 ALM Partners Oy
# SPDX-License-Identifier: Apache-2.0
"""Module for operations requiring SQLServer backend."""
from ahjo.operations.tsql.create_db import create_db
from ahjo.operations.tsql.create_db_login import create_db_login
from ah... | StarcoderdataPython |
3250300 | <filename>paper_experiments_work_log/turntaking/core_scripts_to_reproduce_experiments/nn_preprocess_data_for_training.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# Creates the hd5 preprocessing egocom features for each future setting that are
# used by `nn_turntaking_all_experiments.py`
... | StarcoderdataPython |
88132 | <filename>data/AVA/generate_splits.py
# TESTING SPLIT COMES FROM THE END OF THE TRAINING SPLIT
# TRAINING AND VAL ARE JUST SUBSETS OF MINI_SPLIT_X_BIG
import csv
import numpy as np
def writeCSV(filename, videoName, keyFrame, bb, action):
csvLine = videoName + ',' + keyFrame + ',' + str(bb[0]) + ',' + str(b... | StarcoderdataPython |
1628248 | <filename>app/responder.py
import ast
import iso8601
import json
import random
import re
import requests
def check_custom_stop(custom_stops, received_text):
"""Check for defined custom stops based on received text"""
d = ast.literal_eval(custom_stops)
for word in received_text.split():
... | StarcoderdataPython |
76811 | """Summation of primes
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
"""
from euler.solutions import solution_3
def prime_sum(limit):
"""Compute the sum of all primes below the given limit.
Arguments:
limit (int): The limit below which prime... | StarcoderdataPython |
1668121 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
from pyisaf.utils import int_to_digits
class TestUtils(unittest.TestCase):
def test_int_to_digits_1230_returns_1_2_3_0(self):
self.assertEqual(int_to_digits(1230), [1, 2, 3, 0])
def test_int_to_digits_negative_123_retu... | StarcoderdataPython |
3378035 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import admin
from osnovni.models import *
admin.site.register(KategorijaPredmeta)
admin.site.register(VrstaZbirke)
admin.site.register(NacinNabavke)
admin.site.register(MuzejskiPredmet)
admin.site.register(IstorijaIzmenaPredmeta) | StarcoderdataPython |
166185 | <gh_stars>0
#!/usr/bin/python3
#https://practice.geeksforgeeks.org/problems/a-simple-fraction/0
def sol(n, d):
res = []
r = {}
i = int(n/d)
rem = n%d
res.append(i)
if rem:
res.append(".")
r[rem] = 0
p = 1
while rem:
div = rem*10
q = div//d
... | StarcoderdataPython |
144287 | <reponame>awesomedeba10/ocr-automation-api
from flask import Blueprint, json, request, render_template
import os, sys
from app import app
from app.helper import *
from app.middleware import param_required
from app.modules.templates.schema import *
from app.services.open_cv import CVImage
template_blueprint = Blueprin... | StarcoderdataPython |
1641564 | # The Github-specific SarifState
import sarif_filenames
from sarif_state import SarifState
from sarif_parser import sarif_assert
from sarif_parser import unhandled_warning
from sarif_parser import is_legacy_version
from comment import Comment
from comment import PositionalComment
class GithubSarifState(SarifState):... | StarcoderdataPython |
155271 | <reponame>singsaker/intern
# Generated by Django 3.2.10 on 2022-01-17 13:05
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('rooms', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='RoomCategory',
new_n... | StarcoderdataPython |
114371 | <filename>tests/test_merge.py
# Test unit for decomon with Dense layers
from __future__ import absolute_import
import pytest
import numpy as np
from decomon.layers.decomon_layers import to_monotonic
from decomon.layers.decomon_merge_layers import (
DecomonConcatenate,
DecomonAverage,
DecomonMaximum,
Dec... | StarcoderdataPython |
128182 | import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
import disciplina as disc
import os.path
import pickle
#Exceptions de tratamento
class PreenchaTudo(Exception):
pass
class FaltouAno(Exception):
pass
class FaltouCode(Exception):
pass
class FaltouSemestre(Exception):
pass
c... | StarcoderdataPython |
3266244 | import json
from datadog import api as datadog_api
import requests
from django.core.management import call_command
from django.template.loader import render_to_string
from dimagi.utils import gitinfo
from django.core.management.base import BaseCommand
from corehq.apps.hqadmin.models import HqDeploy
from datetime import... | StarcoderdataPython |
3287038 | LICENSES = {
"AAL": "AAL",
"AFL-1.2": "AFL-1.2",
"AFL-2.0": "AFL-2.0",
"AFL-2.1": "AFL-2.1",
"AFL-3.0": "AFL-3.0",
"AGPL-3.0": "AGPL-3.0",
"ANTLR-PD": "ANTLR-PD",
"APL-1.0": "APL-1.0",
"APL2": "Apache-2.0",
"APSL-1.0": "APSL-1.0",
"APSL-1.1": "APSL-1.1",
"APSL-1.2": "APSL... | StarcoderdataPython |
56540 | <filename>gbe/scheduling/forms/schedule_basic_form.py<gh_stars>1-10
from django.forms import (
ChoiceField,
FloatField,
ModelForm,
IntegerField,
ModelChoiceField,
)
from gbe.models import (
Event,
Room
)
from gbe.functions import get_current_conference
from datetime import (
timedelta,
t... | StarcoderdataPython |
4056 | <filename>FOR/Analisador-completo/main.py<gh_stars>1-10
# Exercício Python 56: Desenvolva um programa que leia o nome, idade e sexo de 4 pessoas. No final do programa, mostre: a média de idade do grupo, qual é o nome do homem mais velho e quantas mulheres têm menos de 20 anos.
mediaidade = ''
nomelista = []
idadelista... | StarcoderdataPython |
2073 | def create_auction(self):
expected_http_status = '201 Created'
request_data = {"data": self.auction}
entrypoint = '/auctions'
response = self.app.post_json(entrypoint, request_data)
self.assertEqual(response.status, expected_http_status)
def create_auction_check_minNumberOfQualifiedBids(self):
... | StarcoderdataPython |
3395512 | from sklearn.datasets import fetch_olivetti_faces
import datetime
# Load the dataset
faces = fetch_olivetti_faces()
# Prove the dataset was loaded
# print(faces.data.shape)
class Person:
def __init__(self, name, photo, date_of_birth):
self.name = (
name
) # Each argument is copied i... | StarcoderdataPython |
167906 | <gh_stars>0
#!/usr/bin/env python3
"""
determine the shape of a matrix
"""
def matrix_shape(matrix):
"""
function to calculatre matrix shape
"""
shape = []
while type(matrix) is list:
shape.append(len(matrix))
matrix = matrix[0]
return shape
| StarcoderdataPython |
3264372 | from QueueLinkedlist import *
import sys
Q = Queue()
while True :
print("##############################################")
print("1. Masukkan Kegiatan.")
print('2. Lihat Kegiatan')
print("3. Hapus Kegiatan")
print("4. Start Pomodoro")
print("5. Exit")
print("################################... | StarcoderdataPython |
41302 | <reponame>avim2809/CameraSiteBlocker<filename>venv/Lib/site-packages/configurationutil/gui/add_edit_inheritable.py
# encoding: utf-8
import logging_helper
from future.utils import with_metaclass
from abc import abstractmethod, ABCMeta
from configurationutil import DefaultInheritableConstant, Configuration
from uiutil ... | StarcoderdataPython |
3286832 | import pytest
import byte
@pytest.mark.parametrize('b1, b2, expected', [
(bytes([0b11000000]), bytes([0b10000001]), 2),
(bytes([0b11000000]), bytes([0b00000001]), 3),
(bytes([0b11000000]), bytes([0b10001111]), 5),
])
def test__hamming_distance__single_byte(b1, b2, expected):
assert byte.hamming_distanc... | StarcoderdataPython |
86199 | from Include.Tuple import *
class Matrix4:
length = 4
def __init__(self):
self.m = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
@staticmethod
def identity_matrix():
M = Matrix4()
M.m[0][0] = 1.0
M.m[1][1] = 1.0
M.m[2][2] = 1.0
M.m[3][3] = 1.... | StarcoderdataPython |
1618023 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""A parser for the Chrome preferences file."""
import json
import logging
import os
from plaso.events import time_events
from plaso.lib import errors
from plaso.lib import eventdata
from plaso.parsers import interface
from plaso.parsers import manager
class ChromeExtensionIns... | StarcoderdataPython |
1671396 | # Useful control abstractions. | StarcoderdataPython |
1659579 | <reponame>groupsome/groupsome
from .context import *
class HomeTestCase(HOSLiveServerTestCase):
def setUp(self):
self.browser = get_webdriver()
self.browser.implicitly_wait(10)
self.user = create_user()
def tearDown(self):
for method, error in self._outcome.errors:
... | StarcoderdataPython |
46205 | import datetime
import feedparser
import json
import os
import shutil
import sys
import time
from .common import p, FEEDS_FILE_NAME
from .config import TIMEZONE
def do(target_category=None, log=False):
def getFeedFromRSS(category, urls, show_author=False, log=False):
rslt = {}
for source, url i... | StarcoderdataPython |
1613048 | from .._abstract.abstract import BaseAGSServer, DynamicData, BaseSecurityHandler
import layer
from ..common.general import Feature
from layer import FeatureLayer, TableLayer, RasterLayer
from ..common import filters, geometry
from ..security import security
import json
import time
from ..common.geometry import Polygon
... | StarcoderdataPython |
1757414 | <reponame>fidsusj/SmartWarehouse
import keyboard as keyboard
import numpy
import cv2
import torch.backends.cudnn as cudnn
from PIL import Image, ImageDraw, ImageFont
from SSD.utils import *
from torchvision import transforms
def detect(original_image, min_score, max_overlap, top_k, model, suppress=None):
"""
... | StarcoderdataPython |
1611050 | <filename>examples/modifications.py
#***************************************************#
# This file is part of PFNET. #
# #
# Copyright (c) 2015, <NAME>. #
# #
# PFNET is released under the ... | StarcoderdataPython |
1607176 | '''
Created on Mar 10, 2017
@author: cesar
'''
import json
import unittest
import matplotlib.pyplot as plt
import numpy as np
from tag2hierarchy.hierarchy import HTMLPLOT, treeHandlers
from tag2hierarchy.hierarchy import tree2Dict
from tag2hierarchy.hierarchy import treeHandlers
from tag2hierarchy.inference import t... | StarcoderdataPython |
1622978 | import numpy as np
import matplotlib.pyplot as plt
import skimage
from skimage import filters
import skimage.io
from skimage.color import rgb2gray
from scipy.signal import convolve2d
def grad_energy(img, sigma = 3):
"""
Compute the gradient magnitude of an image by doing
1D convolutions with the derivativ... | StarcoderdataPython |
134282 | # Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | StarcoderdataPython |
160637 | <filename>api/league/migrations/0001_initial.py
# Generated by Django 2.0 on 2018-03-24 21:43
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('nucleus', '0003_a... | StarcoderdataPython |
1716856 | <gh_stars>0
import pymongo
from datetime import datetime, timedelta
import sys
sys.path.insert(0, '/home/pi/develop/instabot.py/instabot_py/models')
from followers_model import FollowersModel
from likes_model import LikesModel
from follows_model import FollowsModel
from comments_model import CommentsModel
from consolid... | StarcoderdataPython |
1795977 | <filename>aaweb/views/destinations.py<gh_stars>0
# -*- coding: utf-8 -*-
from flask import render_template
from aaweb import app
from aaweb.models import Route, RouteAssignment
@app.route('/about/destinations.html')
def view_destinations():
active_routes = [route for route in Route.select() if RouteAssignment.sel... | StarcoderdataPython |
88280 | <reponame>lepture/june
# coding: utf-8
from .suite import BaseSuite
class TestSignup(BaseSuite):
def test_get(self):
rv = self.client.get('/account/signup')
assert '</form>' in rv.data
def test_required_fields(self):
rv = self.client.post('/account/signup')
assert 'This field... | StarcoderdataPython |
3247000 | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | StarcoderdataPython |
3328520 | <filename>image_classification/image_classification/builders/network_builder.py
#Internal framework imports
#Typing imports
class NetworkBuilder:
def __init__(self):
self.image_shape = None
self.image_format = None
self.resize_method = None
self.ratios = None
... | StarcoderdataPython |
3234038 | <reponame>axonepro/sdk-ooti<filename>resources/expenses.py
import requests
import json
from .helper import Helper
class Expenses(Helper):
def __init__(self, base_url, org_pk, teams_pk, access_token, _csrf_token, headers, pagination):
super().__init__(base_url, org_pk, teams_pk, access_token, _csrf_token,... | StarcoderdataPython |
3238029 | <reponame>JamesALeedham/lusid-python-tools
import unittest
from unittest.mock import patch
from parameterized import parameterized
from lusidtools.lpt import lpt
class LptTests(unittest.TestCase):
@parameterized.expand(
[
(
"Windows absolute path with a sheet",
... | StarcoderdataPython |
1733362 | <reponame>rgxb2807/pygliss<filename>pygliss/mus21.py
import numpy as np
import math
from pygliss.note import Note
from music21 import pitch, corpus, midi, stream, tempo, duration, note as m21note, tie
def get_mus21_pitch(note):
"""Convert pygliss.note to music21.pitch."""
if note.accidental == '+':
return pitch.P... | StarcoderdataPython |
1674383 | <gh_stars>0
import os
import yaml
import uuid
from context import abci_util
script_save_dir = '/home/acb10767ym/scratch/FourierBasisDB/logs/abci/gen_dataset'
run_path = '/home/acb10767ym/scratch/FourierBasisDB/apps'
output_log_dir = '/home/acb10767ym/scratch/FourierBasisDB/logs/abci/abcilog/gen_dataset'
# targetdir = ... | StarcoderdataPython |
3313823 | import pytest
from bocadillo import App, view
from bocadillo.constants import ALL_HTTP_METHODS
def test_can_register_class_based_view(app: App):
@app.route("/")
class Index:
pass
@pytest.mark.parametrize("method", map(str.lower, ALL_HTTP_METHODS))
def test_if_method_not_implemented_then_405(app: Ap... | StarcoderdataPython |
17731 | from common import small_buffer
import pytest
import numpy as np
import pyarrow as pa
import vaex
def test_unique_arrow(df_factory):
ds = df_factory(x=vaex.string_column(['a', 'b', 'a', 'a', 'a', 'b', 'b', 'b', 'b', 'a']))
with small_buffer(ds, 2):
assert set(ds.unique(ds.x)) == {'a', 'b'}
v... | StarcoderdataPython |
124506 | <gh_stars>0
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY;... | StarcoderdataPython |
1724249 | __author__ = 'saeedamen' # <NAME> / <EMAIL>
#
# Copyright 2015 Thalesians Ltd. - http//www.thalesians.com / @thalesians
#
# 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/li... | StarcoderdataPython |
146936 | <gh_stars>1-10
import numpy as np
import matplotlib.pyplot as plt
from statsmodels.tsa.arima_process import ArmaProcess
def poles(k):
"""
Generates k pairs of poles in the unit circle
Returns the resulting polynomial coefficients
"""
pol = np.array([1])
for _ in range(k):
theta = np.ra... | StarcoderdataPython |
1704490 | #!/usr/bin/env python3
import sys
s = sys.argv[1]
print('[ print "' + s + '" ]')
i = 0
for c in s:
c = ord(c)
if c < i :
line = '-' * (i - c)
else:
line = '+' * (c - i)
line += '.'
while len(line) > 10:
print(line[:10])
line = line[10:]
print(line)
i = c
print... | StarcoderdataPython |
3392577 | <reponame>gnikonorov/pytest-dynamicrerun
# This file contains tests specific to the dynamic_rerun_attempts option
import pytest
from helpers import _assert_result_outcomes
@pytest.mark.parametrize("rerun_amount", [0, -1, 2.23, "foobar"])
def test_non_positive_integer_rerun_attempts_rejected(testdir, rerun_amount):
... | StarcoderdataPython |
1706046 | # pylint: disable=invalid-name,no-self-use,protected-access
import numpy
from numpy.testing import assert_almost_equal
import torch
from torch.nn import Parameter
from allennlp.common import Params
from allennlp.common.testing.test_case import AllenNlpTestCase
from allennlp.modules.matrix_attention import LinearMatrix... | StarcoderdataPython |
47228 | import subprocess
from datetime import datetime
from pathlib import Path
from typing import Any
from typing import List
from typing import Optional
from typing import Union
from pyspark.sql import DataFrame
from pyspark.sql import functions as F
from cishouseholds.edit import assign_from_map
from cishouseholds.edit i... | StarcoderdataPython |
1777516 | <reponame>jmherbst/GimelStudio
from .exceptions import NodeExistsError, NodeNotFoundError | StarcoderdataPython |
3368383 | import json
from enum import Enum
from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Tuple, Type, Union
from .typing import AnyCallable
from .utils import GetterDict
if TYPE_CHECKING:
from typing import overload
import typing_extensions
from .fields import ModelField
from .main import ... | StarcoderdataPython |
3256515 | <gh_stars>0
from azure.servicebus import QueueClient, Message
queue_conn_str="Endpoint=sb://andrew-serbus1.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=dKEM47RWGwc96uyV23QR24iKLEp5zTV/qv3UZP7sS38="
queue_client = QueueClient.from_connection_string(queue_conn_str, "twin-queue1")... | StarcoderdataPython |
1668112 | <filename>play/views.py
from django.shortcuts import render
from django.http import StreamingHttpResponse
from django.conf import settings
from index.models import *
_ = settings.PLAY_VIEW
def playView(request, id):
"""path '<int:id>.html' handler """
# 热搜歌曲
searchs = Dynamic.objects.select_rela... | StarcoderdataPython |
14951 | <reponame>Ballot-Drop/ballot-source
# Generated by Django 3.0.9 on 2020-08-24 20:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sources', '0003_sourcedetail_last_pull'),
]
operations = [
migrations.AlterField(
model_name... | StarcoderdataPython |
80659 | #!/usr/bin/env python3
import re
import fire
import requests
import logging as logger
CONFIG = {
'SERVER_ADDRESS': 'http://localhost',
'SERVER_PORT': 5050
}
def interact():
"""
Interactively call the model's server
"""
address = f"{CONFIG['SERVER_ADDRESS']}:{CONFIG['SERVER_PORT']}"
wh... | StarcoderdataPython |
3332312 | <reponame>ashmoreinc/Snake<filename>GUI.py
import json
import tkinter as tk
import tkinter.ttk as ttk
from time import time
from tkinter.messagebox import showerror
import PIL.Image
import PIL.ImageTk
import logic as game
# from tkinter.colorchooser import askcolor
FONT_L = ("Helvetica", 24)
FONT_M = ("Helvetica", ... | StarcoderdataPython |
3287262 | import os,sys
# change the path accoring to the test folder in system
sys.path.append('/home/ubuntu/fogflow/test/UnitTest')
from datetime import datetime
import copy
import json
import requests
import time
import pytest
import data
import sys
# change it by broker ip and port
brokerIp="http://192.168.100.120:8070"
#... | StarcoderdataPython |
54442 | <reponame>alexamies/chinesenotes-python
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Versi... | StarcoderdataPython |
3206418 | <filename>som/__init__.py
#!/usr/bin/env python
# encoding: utf-8
__title__ = 'som'
__version__ = '0.1'
__author__ = '<NAME>'
__license__ = 'MIT'
__copyright__ = 'Copyright 2014 <NAME>'
from .som import *
from . import basic_som, asom
| StarcoderdataPython |
108432 | import socket
import struct
import binascii
import time
import json
import urllib2
import requests
macs = {
'74c246c3e349' : 'dash_tide'
}
def post_data():
data = {
"date": time.strftime("%Y-%m-%d"),
"tally": '1'
}
requests.post("https://sheetsu.com/apis/390c6259", data)
def record_tal... | StarcoderdataPython |
1799471 | <reponame>jaraco/jaraco.office
import contextlib
from jaraco.path import tempfile_context
def sheet_as_dict(worksheet):
"""
Take an xsrd worksheet and convert it to a dict, using the first
row as a header (to create keys for the subsequent rows).
"""
keys = worksheet.row_values(0)
value_range... | StarcoderdataPython |
1742725 | <reponame>stoneyangxu/python-kata
import time
if __name__ == '__main__':
seq_a = [i for i in range(1000000)]
seq_b = [i for i in range(1000001, 2000000)]
start = time.time()
for k in seq_b:
seq_a.append(k)
print('append: {:3f}'.format(time.time() - start))
seq_a = [i for i in range(10... | StarcoderdataPython |
23827 | from subprocess import PIPE, Popen
# Converts celsius temps to fahrenheit
def c2f(celsius):
return (9.0 / 5) * celsius + 32
# Gets the CPU temperature in degrees C
def get_cpu_temperature():
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE)
output, _error = process.communicate()
return floa... | StarcoderdataPython |
5920 | <filename>juriscraper/opinions/united_states/state/minnctapp.py
#Scraper for Minnesota Court of Appeals Published Opinions
#CourtID: minnctapp
#Court Short Name: MN
#Author: mlr
#Date: 2016-06-03
from juriscraper.opinions.united_states.state import minn
class Site(minn.Site):
# Only subclasses minn for the _dow... | StarcoderdataPython |
19138 | #! usr/bin/dev python
from stages import Stages #Le as fases
from code import tanks #Responsável pelos tanques do player
from images import imagens #imagens do jogo
import pygame
import random
screen_Dimension=[32*20,32*20]
pygame.init()
screen = pygame.display.set_mode(screen_Dimension)
pygame.display.... | StarcoderdataPython |
1719958 | # Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
183562 | from parameterized import parameterized
from integration.helpers.base_test import BaseTest
class TestIntrinsicFunctionsSupport(BaseTest):
# test code definition uri object and serverless function properties support
@parameterized.expand(
[
"combination/intrinsics_code_definition_uri",
... | StarcoderdataPython |
1666989 | from floodsystem.stationdata import build_station_list, update_water_levels
from floodsystem.station import MonitoringStation
from floodsystem.flood import stations_level_over_threshold
def run():
"""Requirements for Task2B"""
# Build list of stations
stations = build_station_list()
update_water_leve... | StarcoderdataPython |
1703099 | #!/usr/bin/python3
xb, yb = map(int, input().split())
x1, y1, x2, y2 = map(int, input().split())
def gcd(a, b): return a if b == 0 else gcd(b, a%b)
g = gcd(xb, yb)
xs1, ys1 = xb//g, yb//g
xs2, ys2 = xb-xs1, yb-ys1
def cut(x, y): return x1 <= x and x <= x2 and y1 <= y and y <= y2
if g == 1 or (cut(xs1, ys1) and cu... | StarcoderdataPython |
1772557 | from typing import Tuple, List
Color = Tuple[int, int, int]
Point = Tuple[int, int]
PointList = List[Point]
Triangle = Tuple[int, int, int, int, int, int, int, int, int]
TriangleList = List[Triangle]
| StarcoderdataPython |
1614729 | import datetime
import hashlib
from django.contrib.auth.models import UserManager, AbstractUser
from django.contrib.sites.models import Site
from django.db import models
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
GENDER_C... | StarcoderdataPython |
3262409 | # coding: utf-8
"""
Marketing API v.1.0
IMPORTANT: This swagger links to Criteo production environment. Any test applied here will thus impact real campaigns. # noqa: E501
The version of the OpenAPI document: v.1.0
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F... | StarcoderdataPython |
1654955 | <filename>setup.py<gh_stars>0
#!/usr/bin/env pypy-c
import os
from setuptools import setup
rest = []
base = os.path.join(os.path.dirname(__file__), '_jitviewer')
for dirname, _, filenames in os.walk(os.path.join(base, 'static')):
dirname = os.path.relpath(dirname, base)
for x in filenames:
rest.append... | StarcoderdataPython |
1784961 | # encoding:utf-8
import os
import demjson
import requests
import datetime
from jqdatadir.china.common.util_file import *
'''
20190724
查找2B法则,在日线中查找
中间间隔>3
1 明显趋势 顶底都高于/低于前顶底
2 横盘趋势 ABC 顶底点的大小关系不明确 左尖/右尖三角,乱形都有
只处理 趋势 和 2B 其他不识别
'''
url_season = "http://172.16.17.32:8281/json/data.... | StarcoderdataPython |
4808442 | # demonstrating the dining philosopher's problem
# not actually searching for a deadlock state here
import ImplDwave as dp
import matplotlib.pyplot as plt
p = dp.ImplDwave(7)
p.solve(False)
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.