id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1625094 | #coding: utf-8;
def quick(array, init, end):
pivot = array[init];
while True:
while array[init] < pivot:
init += 1;
while array[end] > pivot:
end -= 1;
if init >= end:
return end;
swap(array, init, end);
init += 1;
end -= 1;
def swap(array, i, j):
array[i], a... | StarcoderdataPython |
1711932 | from .certification_regression_api import CertificationRegressionAPI
| StarcoderdataPython |
3336166 | <gh_stars>0
OWNER = []
OP = []
USERDATABASE = ""
PASSWORDDATABASE = ""
DATABASE = ""
EMBEDFOOTERS = ''
PREFIX = ''
is_maintenance = False
MAINTENANCE_AUTHORIZE = []
SERVER_WHITELISTED = []
TOKEN = '' | StarcoderdataPython |
114429 | <reponame>NewKnowledge/deepar
from .dataset.time_series import TimeSeriesTrain, TimeSeriesTest
from .model.learner import DeepARLearner
| StarcoderdataPython |
33212 | <gh_stars>0
from __future__ import division
import shutil
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
from matplotlib import cm
from matplotlib.colors import ListedColormap, LinearSegmentedColormap
from path import Path
from collections import OrderedDict
import datetime
e... | StarcoderdataPython |
3344403 | # -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-权限中心(BlueKing-IAM) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with th... | StarcoderdataPython |
3208919 | #!flask/bin/python
from application import app
| StarcoderdataPython |
3329253 | # -*- coding: utf-8 -*-
"""Tests for the models from the flowcelltools Django app
"""
import datetime
from uuid import uuid4
from django.forms.models import model_to_dict
from django.core.exceptions import ValidationError
from test_plus.test import TestCase
from .. import models
class SequencingMachineMixin:
... | StarcoderdataPython |
1777165 | # temporary script for add exchangeing record to data
import argparse
from data.dataloader import Data
from script_add_user import check_user
def add_exchange(data, exchange_content, translator_name, exchange_integral):
exchange_record = {'type': '减去积分', 'integral': exchange_integral, 'content': exchange_content... | StarcoderdataPython |
3366994 | <filename>discreteMSE/entropy.py
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 18 20:12:55 2022
@author: Wuestney
Some variable naming is chosen to be in line with the notation used in the papers by Pincus (1991)
and Richman & Moorman (2000).
"""
import numpy as np
def discrete_renyi(n, alpha=2):
"""
Given ... | StarcoderdataPython |
1635967 | # isort: skip_file
# flake8: noqa: F401
from datasets.plugins.executors.metaflow_executor import MetaflowExecutor
from datasets.plugins.batch.batch_dataset_plugin import BatchDatasetPlugin
from datasets.plugins.batch.batch_flow_dataset_plugin import BatchFlowDatasetPlugin
from datasets.plugins.register_plugins import r... | StarcoderdataPython |
3336695 | <filename>tomef/vocab/main.py
import data
import config
from util import iterate, BreakIteration
from base import nbprint
from vocab.common import get_vocab_builder
from vocab.vocab_util import check_requirements
def check_tokens(info):
# Check if Tokens exist
if not check_requirements(info):
nbprint(... | StarcoderdataPython |
115305 | <gh_stars>1-10
'''
This module contains all necessary functions to scrape
both base info (description, release date, etc.) and
advanced info (versions, add-ons, etc.) for a video game
provided a BeautifulSoup object containing the corresponding
base/advance data page.
'''
import re
def get_name(info_page):
'''
... | StarcoderdataPython |
3236026 | # Copyright (c) 2021 PaddlePaddle 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 appli... | StarcoderdataPython |
1780689 | from typing import List
def test_unhandled_partial_gh1467():
"""Test that previously failed due to incorrect partial unification.
Submitted by BAH.
Fixed in https://github.com/osohq/oso/pull/1467."""
POLICY = """\
actor User {}
allow(actor, action, resource) if has_permission(actor, action, resourc... | StarcoderdataPython |
1725181 | <filename>enas_ori/__init__.py
from .layer_collection import *
from .macro_child import *
from .macro_controller import *
from .model import *
from .listeners import * | StarcoderdataPython |
3358345 | <filename>lib/turkish_lemmer/trLemmer/attributes.py
import functools
from enum import Enum, auto
import sys
from typing import Set, Union, NamedTuple
# print(sys.path)
# sys.path.pop(0)
from . import tr
class PrimaryPos(Enum):
Noun = "Noun"
Adjective = "Adj"
Adverb = "Adv"
Conjunction = "Conj"
In... | StarcoderdataPython |
4841899 | # Importing Required Packages
from DataSource import data
from functions import divide
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
'''
Kerela Data
'''
KL_Data = data[data['Detected State'] == 'Kerala']
KL_Data = KL_Data.dropna()
KL_df = divide(KL_Data)
# Defining a Bar Graph
plt.bar(KL_df... | StarcoderdataPython |
3340829 | import math
import numpy as np
import numpy.random as rand
from scipy import special
from scipy.misc import logsumexp
import logging
from . import loggers
from .wrappers import exp, log, gammaln
logger = logging.getLogger(__name__)
def sampleCatDist(wts):
"""Draw 0-based index from categorical distribution"""
... | StarcoderdataPython |
3378273 | <filename>diesel/resolver.py
"""Fetches the A record for a given name in a green thread, keeps a cache."""
import os
import random
import time
import socket
from diesel.protocols.DNS import DNSClient, NotFound, Timeout
from diesel.util.pool import ConnectionPool
from diesel.util.lock import synchronized
DNS_CACHE_TIM... | StarcoderdataPython |
156905 | <gh_stars>100-1000
# from .keyframe_model import TransformData | StarcoderdataPython |
10880 | from .lexer import SolidityLexer, YulLexer
__all__ = ['SolidityLexer', 'YulLexer']
| StarcoderdataPython |
4834583 | <gh_stars>1-10
# Copyright 2017 StreamSets Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | StarcoderdataPython |
1788141 | """app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vie... | StarcoderdataPython |
33321 | <reponame>lusing/algo
import gym
import numpy as np
env = gym.make('FrozenLake-v0')
#env = env.unwrapped
print(env.observation_space)
print(env.action_space)
def play_policy(env, policy, render=True):
total_reward = 0
observation = env.reset()
while True:
if render:
env.render()
... | StarcoderdataPython |
1706380 | <reponame>brendenvogt/PYderman
import bs4 as bs
import urllib.request
import requests
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class Spider():
def __init__(self, url):
self.url = url
def getStaticSoup(self):
# START option 1 Requests
# content = ... | StarcoderdataPython |
55647 | from typing import List
from collections import Counter
def top_k_frequent(words: List[str], k: int) -> List[str]:
words = sorted(words)
freq = Counter(words)
freq = sorted(freq.items(), key=lambda x: x[1], reverse=True)
return [i[0] for i in freq[:k]]
if __name__ == '__main__':
pr... | StarcoderdataPython |
3240988 | <filename>{{cookiecutter.project_slug}}/backend.py
"""Runner for Flask app"""
from api import create_app, global_config
app = create_app()
if __name__ == "__main__":
app.run(debug=True, use_debugger=False, use_reloader=False, passthrough_errors=True,
threaded=True, host=global_config.HOST, port=glob... | StarcoderdataPython |
1777116 | import pandas as pd
import numpy as np
from datetime import datetime
###############
# SELECT DATA #
###############
print("Selecting attributes...")
# GIT_COMMITS
gitCommits = pd.read_csv("../../data/raw/GIT_COMMITS.csv")
attributes = ['projectID', 'commitHash', 'author', 'committer', 'committerDate']
gitCommits =... | StarcoderdataPython |
3392288 | <reponame>eduard1963/userpages
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os
import re
import filecmp
redundant = re.compile('.+ \(\d{1}\)')
def processDir(rootDir):
# http://www.tutorialspoint.com/python/os_walk.htm
for root, dirs, files in os.walk(rootDir):
for filename in files:
# http://st... | StarcoderdataPython |
106056 | #!/usr/bin/env python
"""
Created on Mar 7, 2013
Create a report on the demographics of a course, and create an anonymized
csv file for the students in the course. The demographics include the gender and
age distribution, level of education, and the country of the student. All of
the information is self-reported, and ... | StarcoderdataPython |
3393459 | #coding=utf-8
import requests
import unittest
from HTMLTestRunner import HTMLTestRunner
import APIBOSS,time,Qudzs,Equipment
testunit = unittest.TestSuite()
#将测试用例加入到测试套件中
# testunit.addTest(unittest.makeSuite(APIBOSS.ApiBossTest))
# testunit.addTest(unittest.makeSuite(Qudzs.ApiQudzs))
testunit.addTest(unittest.makeS... | StarcoderdataPython |
3317035 | <reponame>SanaMobile/sana.pchr.oss-web<filename>sana_pchr/settings_aws.py
from sana_pchr.settings_base import *
"""
Django settings for sana_pchr project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.dja... | StarcoderdataPython |
45548 | <reponame>mrakitin/profile_collection-smi
#Align GiSAXS sample
import numpy as np
def run_giwaxs_Kim(t=1):
# define names of samples on sample bar
sample_list = ['7-1_wideangle_10nm_MIM', '7-2_wideangle_20nm_MIM', '7-3_wideangle_4nm_MIM', '7-4_wideangle_Hf0.75', '7-5_wideangle_Hf0.25','7-6_wideangle_Z... | StarcoderdataPython |
126176 | #-*- coding: utf-8 -*-
#
# dlc2blgr.py --- post delicious log to Blogger
#
# external packages
# - lxml
# - gdata-python-client
#
# API reference
# 1. Delicious API reference
# http://delicious.com/help/api
#
#
__author__ = 'ymotongpoo <<EMAIL>>'
__version__ = '1.0'
__date__ = '2009/12/09 (Tue)'
import lxm... | StarcoderdataPython |
132768 | <filename>chrome/tools/build/mac/run_verify_order.py
# Copyright 2016 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 argparse
import os.path
import sys
import subprocess
# Wraps chrome/tools/build/mac/verify_order... | StarcoderdataPython |
55101 | <filename>z42/z42/lib/b64uuid.py
#!/usr/bin/env python
#coding:utf-8
from uuid import uuid4
from base64 import urlsafe_b64encode
def b64uuid():
return urlsafe_b64encode(uuid4().bytes).rstrip('=')
if __name__ == '__main__':
print b64uuid()
| StarcoderdataPython |
184203 | from match import match
from reddit import reddit
from freeRotation import freeRotation
from email_me import email_me
from twitch import twitch
from slack import slack
import time
class index:
def __init__(self):
self.match = match()
self.reddit = reddit()
self.email_me = email_me()
self.twitch = twitch()
s... | StarcoderdataPython |
124223 | <filename>main.py
from utils.config import Config, main
from repo import aws, jaguar
from urllib import parse
from flask import Flask, request, jesonify
app = Flask('__name__')
@app.route('/')
@app.route('/index')
def index():
return "Hello home!"
@app.route('/get-instances/<string:tag_name>', methods=['GET'])
def ... | StarcoderdataPython |
56028 | # -*- coding: utf-8 -*-
"""
Test and look for unknown tokens using PromQLLexer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexers import get_lexer_by_name
from pygments.to... | StarcoderdataPython |
3224172 | from Pypeline.Pypes.Trie import Trie
import pytest
import unittest
class NodeTest(unittest.TestCase):
"""
Tests for methods in the Node class.
"""
@classmethod
def setUpClass(cls):
pass #TODO
@classmethod
def tearDownClass(cls):
pass #TODO
def setUp(self):
pass #TODO
def tearDown(self):
pass #TODO... | StarcoderdataPython |
4840696 | import collections
import logging
import subprocess
from concurrent.futures import ThreadPoolExecutor
from django.db import connection
logger = logging.getLogger(__name__)
class TaskProcess(object):
"""Wraps a Task subprocess up and handles logic specifically for the application.
If the child process calls ... | StarcoderdataPython |
1610563 | <reponame>OpenXAIProject/Variational_Dropouts<gh_stars>10-100
from layers import *
from bbdropout import ber_concrete
class DBBDropout(object):
def __init__(self, n_in, beta_init=10.0, thres=1e-3, name='dbbd', reuse=None):
self.n_in = n_in
self.thres = thres
with tf.variable_scope(name, reu... | StarcoderdataPython |
4824900 | <reponame>tedye/leetcode
class Solution(object):
def combinationSum3(self, k, n):
"""
:type k: int
:type n: int
:rtype: List[List[int]]
"""
cur = []
res = []
x = [i for i in range(1,10)]
self.helper(x,res,cur,k,n)
return res
... | StarcoderdataPython |
3375728 | <reponame>bdshieh/pyfield<filename>pyfield/__init__.py
from . import util
from .core import PyField
| StarcoderdataPython |
188278 | <reponame>alexartwww/geekbrains
from common import input_value
task = '''
Поработайте с переменными, создайте несколько, выведите на экран, запросите у пользователя несколько чисел и строк
и сохраните в переменные, выведите на экран.
'''
if __name__ == '__main__':
print(task)
a = 1
b = 2.3445
c = 'hel... | StarcoderdataPython |
3386338 | import tensorflow as tf
import numpy as np
from margarine.processing import _forward_transform
from tensorflow_probability import distributions as tfd
class maf_calculations(object):
r"""
This class, once initalised with a trained MAF and samples from
that bijector, can be used to calculate marginal KL ... | StarcoderdataPython |
49616 | from dipy.denoise.nlmeans import nlmeans_3d, nlmeans
from dipy.denoise.noise_estimate import estimate_sigma
import cv2 as cv
import numpy as np
import nibabel as nib
def preprocess(nifti, name):
"""Preprocess the 3D MRI image before image segmentation"""
image = nifti.get_fdata()
sigma = estimate_sigma(im... | StarcoderdataPython |
3206791 | <filename>apps/cms/migrations/0006_auto_20200819_1638.py
# Generated by Django 3.1 on 2020-08-19 16:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cms', '0005_auto_20200819_1637'),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
1714905 | import os
import sys
import pytest
from django.core.exceptions import ImproperlyConfigured
from .utils import render_template
# Needed for the custom filter tests
sys.path.append(os.path.dirname(__file__))
@pytest.mark.django_db
def test_with_custom_filter_simple(simple_content, settings):
settings.TINYCONTENT... | StarcoderdataPython |
197123 | # Generated by Django 3.1.3 on 2021-01-30 08:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('store', '0023_customuser_username'),
]
operations = [
migrations.AlterField(
model_name='cartdetail',
name='quantity... | StarcoderdataPython |
3202018 | <reponame>afifa125/Automated-Feature-Synthesis
"""
Comparison of regression with LGCP and GP, with different n_clusters values.
Displays graphs and the models' likelihood.
"""
# Author: <NAME>
# for ALFA Group, CSAIL, MIT
# The MIT License (MIT)
# Copyright (c) 2015 <NAME>
# Permission is hereby granted, free of... | StarcoderdataPython |
165907 | <reponame>fabiommendes/sidekick
from .zombie import UNARY_METHODS, BINARY_METHODS, RBINARY_METHODS, ARBITRARY_METHODS
from ..functions import call
class Proxy:
"""
Base class for proxy types.
"""
__slots__ = ("_proxy_obj_",)
def __init__(self, obj):
self._proxy_obj_ = obj
def __repr... | StarcoderdataPython |
25039 | import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk as gtk
class Ked:
def __init__(self, app_path, ufile=None):
glade_layout = f'{app_path}/data/ked_layout.glade'
self.builder = gtk.Builder()
self.builder.add_from_file(glade_layout)
win = self.builder.get_obje... | StarcoderdataPython |
3238607 | <filename>add_and_subtract.py
def sum_numbers(a, b):
return a + b
def subtract(sum, c):
return sum - c
first_num = int(input())
second_num = int(input())
third_num = int(input())
result = subtract(sum_numbers(first_num, second_num), third_num)
print(result)
| StarcoderdataPython |
3354456 | """
Module that contains the command line app.
Why does this file exist, and why not put this in __main__?
You might be tempted to import things from __main__ later, but that will cause
problems: the code will get executed twice:
- When you run `python -mclusterman` python will execute
``__main__.py`` as a... | StarcoderdataPython |
3350064 | from typing import Any, Callable, Optional, Union
from peal.community import Community
from peal.genetics import GPTerminal
from peal.population import Individual, Population
class Fitness:
"""Class that is responsible for calculating the fitness of
individuals in an environment.
Args:
method (c... | StarcoderdataPython |
98684 | # -*- coding:utf-8 -*-
from src.Client.Conf.config import *
class ChangeLanguage():
def change(self, languageType):
pass
| StarcoderdataPython |
3207495 | #
# General Electricity sector Decarbonization Model (GEDM)
# Copyright (C) 2020 <NAME>.
# Licensed under the MIT License (see LICENSE file).
#
# Module note:
# Define process(technology) class
#
from numpy import zeros
#------------ technology/process -------------
# basic process definition at country level
class ... | StarcoderdataPython |
3259462 | import os
from flask import Flask, request, render_template, jsonify
from twitter import TwitterClient
app = Flask(__name__)
api = TwitterClient('@neerajkrbansal')
@app.route('/')
def index():
return render_template("home.html")
@app.route('/tweets')
def tweets():
query = request.args.get('query')
a... | StarcoderdataPython |
3301336 | import json
import random
import time
from lib.Cb_constants.CBServer import CbServer
from lib.membase.api.rest_client import RestConnection
from lib.remote.remote_util import RemoteMachineShellConnection
from pytests.basetestcase import BaseTestCase
from pytests.security.ntonencryptionBase import ntonencryptionBase
fr... | StarcoderdataPython |
1603743 | from flask import Flask
from getloc import GetLoc
gl = GetLoc()
app = Flask(__name__)
from app import views
| StarcoderdataPython |
3212091 | <gh_stars>10-100
import torch
import torch.nn as nn
import torch.nn.functional as F
def dot_prod_attention(h_t, src_encoding, src_encoding_att_linear, mask=None):
"""
:param h_t: (batch_size, hidden_size)
:param src_encoding: (batch_size, src_sent_len, hidden_size * 2)
:param src_encoding_att_linear:... | StarcoderdataPython |
1612322 | import os
import MySQLdb
from mindsdb import Predictor, MySqlDS
con = MySQLdb.connect("localhost", "root", "", "mysql")
cur = con.cursor()
cur.execute('DROP TABLE IF EXISTS test_mindsdb')
cur.execute('CREATE TABLE test_mindsdb(col_1 Text, col_2 BIGINT, col_3 BOOL)')
for i in range(0,5000):
cur.execute(f'INSERT... | StarcoderdataPython |
1641179 | <filename>10_testy_jednostkowe/01_wylapywanie_bledow.py
# -*- coding: utf-8 -*-
"""
@author: <EMAIL>
@site: e-smartdata.org
"""
# %%
1 / 0
# %%
4 + '4'
# %%
int('f')
# %%
float('sd')
# %%
try:
1 / 0
except:
print('Nie dzieli się przez zero!')
# %%
try:
1 / 0
except ZeroDivisionError:
print('... | StarcoderdataPython |
178241 | # -- coding: utf-8 --
# GENERATEUR DE FEATURE COLLECTION
# DE POLYGONES DEPUIS UN POINT GEO
# carré:
# "({1}-{3},{2}+{3})({1}{3},{2}{3})({1}{3},{2}{3})({1}{3},{2}{3})({1}{3},{2}{3})"
# soit:
# ({1}{4}{3},{2}{5}{3})n+1 fois(signe1,signe2)
# n étant le nombre d'arêtes
# et avec {4},{5} ou signe1,signe2 décrivant:
# __
# ... | StarcoderdataPython |
3357769 | <filename>src/unsupervised_class3/vae_tf.py
# https://deeplearningcourses.com/c/deep-learning-gans-and-variational-autoencoders
# https://www.udemy.com/deep-learning-gans-and-variational-autoencoders
from __future__ import print_function, division
from builtins import range, input
# Note: you may need to update your ve... | StarcoderdataPython |
4821378 | import os
from shutil import copyfile
import subprocess
import time
import mediapipe as mp
import cv2
import numpy as np
# 找出人物位置並置中 調成768*1024
def pretreat(path,output):
mp_pose = mp.solutions.pose
# For static images:
IMAGE_FILES = [f"{path}/{file}"for file in os.listdir(path)]
with ... | StarcoderdataPython |
1770136 | <reponame>lukebiggerstaff/simple-python-algorithms
import unittest
from .knapsack import knapsack
class TestKnapsack(unittest.TestCase):
def test_knapsack_can_find_best_value(self):
result = knapsack(
[(1, 1), (3, 2), (2, 4)],
4
)
expected = [
[0, 0, 0... | StarcoderdataPython |
3267094 | <gh_stars>0
#!/usr/bin/env python2
from sys import stdin, stdout, stderr
from json import loads, dumps
import re
def reducer():
is_a_row = re.compile('(\d+)\t(.*)')
line = stdin.readline()
pr = dict()
while line:
m = is_a_row.match(line)
if m:
src = int(m.group(1))
... | StarcoderdataPython |
1754671 | # Copyright (c) 2018 PaddlePaddle 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 appli... | StarcoderdataPython |
8925 | # Copyright (c) 2010-2011, Found IT A/S and Piped Project Contributors.
# See LICENSE for details.
| StarcoderdataPython |
113460 |
import sys
import signal
import os
import subprocess
import selectors
import importlib
logger = importlib.import_module("logger")
tun = importlib.import_module("tun")
crypto = importlib.import_module("crypto")
udp = importlib.import_module("udp")
tun_name = ""
mode = None
addr = None
key = None
auth_msg = b"Infini... | StarcoderdataPython |
4841448 | #%%
# import needed liraries
import numpy as np
import pandas as pd
import pycountry_convert as pc
# %%
#read the original csv file
import os
os. chdir("C:\\Users\\malakm\\Documents\\Gwu\DataVisualization\\Final Project")
dirpath = os.getcwd() # print("current directory is : " + dirpath)
print(dirpath)
#%%
#Read th... | StarcoderdataPython |
3318686 | <gh_stars>1-10
#!/usr/bin/env python
"""
Standard Launcher for the spf (Speed Phishing Framework)
"""
import sys, traceback
from core.framework import Framework
if __name__ == "__main__":
framework = Framework()
try:
framework.run(sys.argv[1:])
except KeyboardInterrupt:
framework.ctrlc()
... | StarcoderdataPython |
1666273 | <reponame>happyspace/Parallel-Counting
# Uses python3
import sys
def lcm(a, b):
#write your code here
return a*b
if __name__ == '__main__':
input = sys.stdin.read()
a, b = map(int, input.split())
print(lcm(a, b))
| StarcoderdataPython |
1679041 |
import subprocess
import os
import numpy as np
import pymesh
'''
Partitions a mesh into a number of patches defined by @partitions using METIS
'''
def mesh_partitioning(filename, mesh, partitions):
if partitions < 2:
return [mesh], [range(mesh.num_vertices)]
# Get only the name of the file (with... | StarcoderdataPython |
1675901 | <gh_stars>0
import signal
from enum import Enum
import os
from subprocess import Popen, PIPE
from src.data_holder import Location
N = 2
Debug_AI = False
Timeout = False
PIPE_READ = 0
PIPE_WRITE = 1
FirstTurnTime = 1*(1 if Timeout else 10)
TimeLimit = 0.1 * (1 if Timeout else 10)
stop = False
LocationToString = ["... | StarcoderdataPython |
3247181 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# TODO: different stars sizes dependending on their flux
# TODO: map where only FOV and center is a current 'polar star' analogue (zenith)
# TODO: case when not all stars were downloaded
# TODO: implement constellations as graphs
# TODO: implement ... | StarcoderdataPython |
1759901 | import unittest
# function spelling mistake is from CodeWars
from katas.beta.binary_pyramid_101 import binary_piramid
class BinaryPyramidTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(binary_piramid(1, 4), '1111010')
def test_equals_2(self):
self.assertEqual(binary_pira... | StarcoderdataPython |
1656105 | arr = []
new_arr = []
for i in range(3):
arr.append(list(map(int, input().split())))
new_arr.append([0,0,0])
def total(arr,i,j):
valid = list(range(3))
ans = arr[i][j]
if (i + 1) in valid:
ans += arr[i + 1][j]
if (j + 1) in valid:
ans += arr[i][j + 1]
if (i - 1) in valid:
... | StarcoderdataPython |
3351144 | <reponame>aldesfi/codeDasarPyhton
import argparse
import sys
import helloword
import contohModule
# from main import contohClass
parser = argparse.ArgumentParser(
description='Code Dasar Pyhton Untuk Dicoba Belajar')
parser.add_argument('--version', action='version',
version='helloword ' + helloword._... | StarcoderdataPython |
22502 | <reponame>Amantechcse/cricket-fantasy-game
import sqlite3
book=sqlite3.connect("bookstore.db")
curbook=book.cursor()
#curbook.execute('''create table books (book_id integer primary key autoincrement , book_name text(20), author text(20), price integer);''')
while True:
x=input("want to enter data yes/no: ")
i... | StarcoderdataPython |
3241381 | <gh_stars>1-10
import os
import scipy.interpolate as spi
dataLabel = ["one", "two", "three", "four"]
dataRoot = "../toneclassifier/train"
normalLen = 200
for label in dataLabel:
subsetPath = dataRoot + "/" + label
dataset = set()
for filename in os.listdir(subsetPath):
if filename[0] == ".":
... | StarcoderdataPython |
3239822 | <filename>Pyton_Exp/__temp_migrations/consent/0001_initial.py
# Generated by Django 2.2.12 on 2021-03-16 06:40
from django.db import migrations, models
import django.db.models.deletion
import otree.db.idmap
import otree.db.models
class Migration(migrations.Migration):
initial = True
dependencies = [
... | StarcoderdataPython |
4840733 |
class TaskControlException(Exception):
pass
class Cancel(TaskControlException):
pass
class TaskFatalError(Exception):
pass
class TaskLoadingError(TaskFatalError):
"""The task's python code failed to load"""
def __init__(self, exception):
super().__init__(str(exception))
| StarcoderdataPython |
1789806 | <filename>project/app/api/city.py<gh_stars>0
from collections import OrderedDict
from typing import List
from fastapi import APIRouter, HTTPException
from app.database import fetch_query_records
from app import schemas
router = APIRouter()
@router.get('/{city_id}')
async def city(city_id: int):
"""
Returns ... | StarcoderdataPython |
1782926 | <filename>source/comparative_genomics/heatmap_VF.py
import pandas as pd
import numpy as np; np.random.seed(0)
import seaborn as sns; sns.set_theme()
from matplotlib import pyplot as plt
file=pd.read_csv('/home/Documents/Acads/CompGenomics/Proj_ComparitiveGenomics/vf_merged_results.tsv', sep='\t')
VF=list(file['Virul... | StarcoderdataPython |
3311901 | <reponame>nikitadragaa/---
a=int(input())
a = a % 100
print(a // 10)
| StarcoderdataPython |
3384752 | '''
Created on Feb 10, 2011
@author: vgapeyev
'''
import os.path, sys, shutil
from obsparser import app
def mk_fname(dir, base, ext):
return os.path.join(dir, base + "." + ext)
def churn(src_dir, dest_dir, work_dir):
#Ensure work_dir is empty
work_files = [f for f in os.listdir(work_dir) if not f... | StarcoderdataPython |
3344001 | from tests.testmodels import Event, Team, Tournament
from tortoise.contrib import test
from tortoise.exceptions import FieldError
from tortoise.functions import Length, Trim
class TestValues(test.TestCase):
async def test_values_related_fk(self):
tournament = await Tournament.create(name="New Tournament")... | StarcoderdataPython |
103959 | import io
import time
import picamera
framerate = 90
quality = 100
resolutions = [(1920, 1080), (1280, 720), (800, 600), (640, 480), (320, 240)]
samples = 50
with picamera.PiCamera(framerate=framerate) as camera:
time.sleep(2) # camera warm-up time
for res in resolutions:
camera.resolution = res
... | StarcoderdataPython |
3249540 | <filename>blaze/compute/air/execution/tests/test_jit_interp.py
from __future__ import absolute_import, division, print_function
import unittest
from datashape import dshape
import blaze
from blaze import array
from blaze.compute.ops.ufuncs import add, multiply
import numpy as np
#-----------------------------------... | StarcoderdataPython |
3233033 | import sublime, sublime_plugin, re, urllib
EXISTING_JS_COMMENT_RE = re.compile(r'^// ?javascript:.+', re.M)
KILL_COMMENTS_RE = re.compile('^\s*//.+\n', re.M)
TABS_TO_SPACES_RE = re.compile('\t', re.M)
SPACE_RUNS_TO_ONE_SPACE_RE = re.compile('[ ]{2,}', re.M)
KILL_LINE_LEADING... | StarcoderdataPython |
184262 | import json
from channels import Group
from .models import Game, RoundScore
def _round_scores_for_game(game):
data = []
rounds = range(1, game.number_of_rounds + 1)
for score in game.score_set.all():
round_scores = {s.round_number: s.value for s in score.roundscore_set.all()}
for r in ro... | StarcoderdataPython |
3221234 | from arm.logicnode.arm_nodes import *
class WorldToScreenSpaceNode(ArmLogicTreeNode):
"""Transforms the given world coordinates into screen coordinates."""
bl_idname = 'LNWorldToScreenSpaceNode'
bl_label = 'World to Screen Space'
arm_section = 'matrix'
arm_version = 1
def init(self, context):
... | StarcoderdataPython |
3298224 |
from decimal import Decimal
from dateutil import parser as dateutil_parser
from unittest import mock
from django.urls import reverse
from rest_framework import status
from django.conf import settings
from freezegun import freeze_time
from .base import BaseTestCase
from website.constants import WIDGET_NAMES
class ... | StarcoderdataPython |
52135 | <gh_stars>0
import logging
import matplotlib.pyplot as plt
from .beam import Beam
from .lattice import Lattice
from .transfer_matrix import TransferMatrix
logger = logging.getLogger(__name__)
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)
plt.rcParams["figure.facecolor"] = "white"
| StarcoderdataPython |
3268730 | from django.db.models.deletion import SET_NULL
from allauth.socialaccount.models import SocialAccount
from django.contrib.postgres.fields import ArrayField, JSONField
from django.db import models
from django.db.models import Sum
from user.related_models.profile_image_storage import ProfileImageStorage
from user.relate... | StarcoderdataPython |
3336519 | <filename>unit_02/04_object-oriented/2-Inheritance/characters.py
#
# Object-Oriented Python: Inheritance Characters
# Python Techdegree
#
# Created by <NAME> on 12/13/18.
# Copyright (c) 2018 ddApps. All rights reserved.
# ------------------------------------------------
# Classes are great, but they're even bette... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.