id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
63122 | <gh_stars>0
import os
from flask import (
Flask, flash, render_template,
redirect, request, session, url_for)
from flask_pymongo import PyMongo
from bson.objectid import ObjectId
from werkzeug.security import generate_password_hash, check_password_hash
if os.path.exists("env.py"):
import env
app = Flask(_... | StarcoderdataPython |
3258730 | import inspect
import types
from . import _main as main
from . import _writer as writer
from ._manager import LogManager, LogSimpleManager
from . import settings
def loggable(
log_addr='*',
*,
log_args=True,
log_results=True,
log_enter=True,
log_exit=True,
log_path=True,
short=None,
... | StarcoderdataPython |
3235669 | from django.contrib.admin import helpers
from django.core.urlresolvers import reverse
from django.db import transaction
from django.shortcuts import render, redirect
from django.template.response import TemplateResponse
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as ... | StarcoderdataPython |
1764629 | import numpy as np
import probtorch
import torch
from torchvision.utils import make_grid
from base import BaseTrainer
from utils import inf_loop, MetricTracker
class Trainer(BaseTrainer):
"""
Trainer class
"""
def __init__(self, model, criterion, metric_ftns, optimizer, config, data_loader,
... | StarcoderdataPython |
3263573 | import time
import pyautogui
# Prevents pyautogui.FailSafeException to be raised if the
# mouse is in one of the screen corners during move(),
# see https://pyautogui.readthedocs.io/en/latest/#fail-safes
pyautogui.FAILSAFE = False
SECONDS_BETWEEN_MOVEMENTS = 60 * 3
def move():
pyautogui.move(+1, +1) # 1 pixel ... | StarcoderdataPython |
195643 | # Copyright 2016 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 |
15974 | <reponame>ZhengyangXu/Algorithm-Daily-Practice
#
# @lc app=leetcode.cn id=461 lang=python3
#
# [461] 汉明距离
#
# https://leetcode-cn.com/problems/hamming-distance/description/
#
# algorithms
# Easy (79.21%)
# Likes: 459
# Dislikes: 0
# Total Accepted: 137K
# Total Submissions: 170K
# Testcase Example: '1\n4'
#
# 两个... | StarcoderdataPython |
108178 | <reponame>raccoongang/askup<filename>askup_lti/urls.py
from django.conf.urls import url
from .provider import lti_launch
urlpatterns = [
url(r'^launch/?(?:/qset/(?P<qset_id>\d+)/?)?$', lti_launch, name='launch'),
]
| StarcoderdataPython |
10560 |
class IOEngine(object):
def __init__(self, node):
self.node = node
self.inputs = []
self.outputs = []
def release(self):
self.inputs = None
self.outputs = None
self.node = None
def updateInputs(self, names):
# remove prior outputs
for input... | StarcoderdataPython |
148021 | <reponame>tschoonj/cgat-daisy<filename>daisy/tasks/FASTQMetrics.py
from .BAMMetrics import run_metric_bam_fastqc
class run_metric_fastq_fastqc(run_metric_bam_fastqc):
name = "fastq_fastqc"
| StarcoderdataPython |
1612847 | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | StarcoderdataPython |
3285375 | #!/usr/bin/env python
"""
This Script does the preprocessing of a data set in form
of a shifting window over the data. This is needed for
the Saliency and the Word Influence Calculations.
"""
import os
import sys
import argparse
import numpy
import h5py
import itertools
__author__ = '<NAME>'
class Indexer:
def... | StarcoderdataPython |
1671270 | import sublime
import sublime_plugin
import os
import sys
import subprocess
import locale
class MailtoCommand(sublime_plugin.TextCommand):
def run(self, edit):
try:
settings = sublime.load_settings('Mailto.sublime-settings')
self.run_bin(settings.get('command'))
except (Exception) as (except... | StarcoderdataPython |
3322281 | from collections import Iterable
from django.http import HttpResponse, JsonResponse
from xm_s_common.decorator import common_ajax_response
from xm_s_common.utils import format_return, generate_date_range
from xm_s_common.page import Page
from explorer.interface import ExplorerBase
@common_ajax_response
def stat_aut... | StarcoderdataPython |
1645573 | from os import path as op
from sys import path as pat
pa = op.abspath(op.join(op.dirname(__file__), '..', '..'))
pa = pa + "/common"
pat.insert(1, pa)
import general_log_switch
# I suck at file navigation especially in c++, slows me down to a great extent, thats why using this script as an redirector to general_log... | StarcoderdataPython |
3393545 | import numpy as np
import eolearn
from eolearn.core import FeatureType, EOTask
from pathlib import Path
from osgeo import gdal
import os
import shutil
import subprocess
import rasterio
from eolearn.io.local_io import ExportToTiffTask, ImportFromTiffTask
class MultitempSpeckleFiltering(EOTask):
... | StarcoderdataPython |
3273667 | <gh_stars>0
from sprite import FacingSprite
from sprite import VEC
STARTING_HEALTH = 3
KNOCKBACK_DISTANCE = 20
class Enemy(FacingSprite):
def __init__(self,
x,
y,
width,
height,
walking_path,
image_dir,
... | StarcoderdataPython |
1741182 | from django.db.models import Case, When, IntegerField
from rest_framework import mixins, viewsets, generics
from allauth.socialaccount.providers.facebook.views import FacebookOAuth2Adapter
from rest_auth.registration.views import SocialLoginView
from rest_framework import filters
from rest_framework.permissions import ... | StarcoderdataPython |
1743420 | <reponame>xyleey/SNH48Live
import base64
import email.mime.text
import auth
gmail_client = None # Uninitialized
# Optionally called from command line scripts to pass in args. If not
# called manually, the client is still initialized on first use.
def init_gmail_client(args=None, scopes='gmail.send'):
global g... | StarcoderdataPython |
4809430 | from data_collection.management.commands import (
BaseXpressDCCsvInconsistentPostcodesImporter,
)
class Command(BaseXpressDCCsvInconsistentPostcodesImporter):
council_id = "E06000038"
addresses_name = "local.2019-05-02/Version 1/Democracy_Club__02May2019Reading.tsv"
stations_name = "local.2019-05-02/V... | StarcoderdataPython |
3314641 | <reponame>allenai/zest
"""Tests for zest.modeling.tasks."""
| StarcoderdataPython |
3226662 | import optparse
import tokenize
import warnings
# Polyfill stdin loading/reading lines
# https://gitlab.com/pycqa/flake8-polyfill/blob/1.0.1/src/flake8_polyfill/stdin.py#L52-57
try:
from flake8.engine import pep8
stdin_get_value = pep8.stdin_get_value
readlines = pep8.readlines
except ImportError:
from... | StarcoderdataPython |
111924 | <reponame>AndreHenkel/dl_visualisation_comparison
#loads images from a predefined folder and puts it into a torch batch
import torch
import utils
import torchvision as tv
from torchvision import transforms
import urllib.request
import tarfile
import os, random
class DataLoader:
def __init__(self, path, data_se... | StarcoderdataPython |
196240 | #!/usr/bin/env python3
import json
import threading
from urllib.request import urlopen
#nodemcu v2 running espeasy
nodemcu='http://192.168.0.70/json'
class json_noise:
def __init__(self, callback):
self.is_alive=True
self._noise=0
self.thread=None
self.startreading()
self._callback=callback
def print_ms... | StarcoderdataPython |
3369409 | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
"""Tests for client.py covering NotebookClient."""
# Third-party imports
import pytest
from qtpy.QtWidgets import QWidget
import requests
# Local imports
from spyder_notebook.widgets.client import Notebo... | StarcoderdataPython |
120483 | <gh_stars>0
assert __name__ == "__main__"
from roca import *
from revoice import *
from roca.common import *
import sys, os, getopt
dbPath = os.environ.get("ROCA_VOICEDB_PATH", None)
wavPath = None
outName = None
analyzeF0, analyzeHNM, analyzeSinEnv = False, False, False
optList, args = getopt.getopt(sys... | StarcoderdataPython |
3320809 | from kodexa import Assistant, AssistantResponse, AssistantContext
from kodexa.model.model import BaseEvent
class ExampleAssistant(Assistant):
"""
This is an example of an assistant
"""
def __init__(self, my_param: str):
self.my_param = my_param
def process_event(self, event: BaseEvent, c... | StarcoderdataPython |
1714281 | """C190701Permission URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/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')
C... | StarcoderdataPython |
3394004 | <filename>api/routes/v3/evaluationroutes.py<gh_stars>1-10
from flask import Blueprint
from flask import request
from api.utils.helpers import ServerMethods
from api.utils.vsae.formater import EquationFormating
# import modules for binary tree parsing
from api.modules.binarytree.stacktotree import Index as buildTreeFro... | StarcoderdataPython |
3253909 | # Copyright (c) 2008 - 2011, <NAME> <<EMAIL>>,
# <NAME> <<EMAIL>>
# This is Free Software. See LICENSE for license information.
import sys
import email
import re
import logging
import gettor.utils
import gettor.packages
class requestMail:
def __init__(self, config):
""" Read ... | StarcoderdataPython |
55157 | from .utils import simple_hash
from .torrentbase import TorrentBase
from .torrentdetails import TorrentDetails
class Torrent(TorrentBase):
def fetch_details(self, timeout=30) -> TorrentDetails:
"""
Retrieve details about this torrent (e.g link, description, files...)
Parameters:
... | StarcoderdataPython |
137258 | <reponame>kathatherine/anaconda-project
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2016, Anaconda, Inc. All rights reserved.
#
# Licensed under the terms of the BSD 3-Clause License.
# The full license is in the file LICENSE.txt, distributed w... | StarcoderdataPython |
185059 | import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
import tensorflow as tf
from ccgnet import experiment as exp
from ccgnet.finetune import *
from ccgnet import layers
from ccgnet.layers import *
import numpy as np
import time
import random
from sklearn.metrics import bal... | StarcoderdataPython |
1725150 | <filename>hwhandler_api/core/__init__.py
from .base_system import *
from .base_command import *
from .system_fsm import * | StarcoderdataPython |
3262565 | <reponame>warrenbailey/github
import requests
from requests.auth import HTTPBasicAuth
import sys
BASE_URL = "https://api.github.com"
def list_repos(username, api_token):
url = BASE_URL + f"/users/{username}/repos"
print(f"Sending request to {url}")
response = requests.get(url, auth=HTTPBasicAuth(usernam... | StarcoderdataPython |
68499 | from django.urls import path
from .views import AccessDeniedView
urlpatterns = [
path("access-denied/", AccessDeniedView.as_view(), name="access-denied"),
]
| StarcoderdataPython |
3332249 | """The main program"""
from .app import run
if __name__ == '__main__':
run()
| StarcoderdataPython |
1717179 | import bge
scene = bge.logic.getCurrentScene()
controller = bge.logic.getCurrentController()
collection_parent = controller.owner.get('d3dt_collection')
collection = { obj.name: obj for obj in scene.objectsInactive if obj.parent and obj.parent.name == collection_parent }
def add(charObj):
return scene.addObject(cha... | StarcoderdataPython |
1733749 | <gh_stars>10-100
from __future__ import unicode_literals
from django.apps import AppConfig
class AccessConfig(AppConfig):
name = 'access'
| StarcoderdataPython |
3345624 | <filename>ufcrl/fighters.py<gh_stars>1-10
###############################################################################################
# mens
###############################################################################################
MENS_CATCH_WEIGHT = 'mens catch weight' # ??.?kg
MENS_STRAWWEIGHT = 'mens s... | StarcoderdataPython |
1623736 | # -*- coding: utf-8 -*-
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('bpp', '0002_auto_20141020_1738'),
]
operations = [
migrations.AlterField(
model_name='patent',
name='utworzono',
... | StarcoderdataPython |
89500 | <gh_stars>0
"""
Bring full functionality to light and media player controllers.
From turning devices on/off to changing the color lights.
https://github.com/xaviml/controllerx
"""
from cx_core import (
CallServiceController,
Controller,
CoverController,
CustomCoverController,
CustomLightController,... | StarcoderdataPython |
3384843 | colour_list=["red","blue","green","black"]
print('first and last in array')
print('%s %s'%(colour_list[0],colour_list[3]))
#array starts from 0
print('%s %s'%(colour_list[0],colour_list[-1]))
#goes back to the end in a loop
print('%s %s'%(colour_list[0],colour_list[-5]))
#above is not a valid statement | StarcoderdataPython |
1692685 | <filename>src/larksuiteoapi/service/ehr/v1/api.py
# -*- coding: UTF-8 -*-
# Code generated by lark suite oapi sdk gen
from typing import *
from ....api import Request, Response, set_timeout, set_tenant_key, set_user_access_token, set_path_params, \
set_query_params, set_response_stream, set_is_response_stream, Fo... | StarcoderdataPython |
25034 | <reponame>PKUfudawei/cmssw
import FWCore.ParameterSet.Config as cms
from ..modules.hltBTagPFPuppiDeepCSV0p865DoubleEta2p4_cfi import *
from ..modules.hltDoublePFPuppiJets128Eta2p4MaxDeta1p6_cfi import *
from ..modules.hltDoublePFPuppiJets128MaxEta2p4_cfi import *
from ..modules.l1tDoublePFPuppiJet112offMaxEta2p4_cfi i... | StarcoderdataPython |
66470 | # Author: <NAME>
# Contributors: <NAME>
import numpy as np
import scipy
import torch
class Geometry():
"""Helper class to calculate distances, angles, and dihedrals
with a unified, vectorized framework depending on whether pytorch
or numpy is used.
Parameters
----------
method : 'torch' or '... | StarcoderdataPython |
198567 | <filename>midca/examples/nbeacons_aaai17_agent3.py
#!/usr/bin/env python
import MIDCA
from MIDCA import base, goals
from MIDCA.modules import simulator, guide, evaluate, perceive, intend, planning, act, note, assess
from MIDCA.metamodules import monitor, control, interpret, metaintend, plan
from MIDCA.worldsim import d... | StarcoderdataPython |
115525 | <filename>venv/Lib/site-packages/baron/future.py
import re
def has_print_function(tokens):
for pos in range(len(tokens)):
if tokens_define_print_function(tokens[pos:]):
return True
return False
def tokens_define_print_function(tokens):
token = iter(tokens)
try:
if next(to... | StarcoderdataPython |
185048 | <reponame>openearth/hydro-osm
__all__ = ["check", "tasks", "filter", "io", "config", "log", "utm"] | StarcoderdataPython |
14770 | <gh_stars>0
"Used to reference the nested workspaces for examples in /WORKSPACE"
ALL_EXAMPLES = [
"angular",
"app",
"kotlin",
"nestjs",
"parcel",
"protocol_buffers",
"user_managed_deps",
"vendored_node",
"vendored_node_and_yarn",
"web_testing",
"webapp",
"worker",
]
| StarcoderdataPython |
3369833 | <reponame>trakken/gtm_manager
# pylint: disable=missing-docstring
from gtm_manager.folder import GTMFolder
def test_init(mock_service):
service, responses = mock_service("folders_get.json")
folder_get = responses[0]
folder = GTMFolder(
path="accounts/1234/containers/1234/workspace/1/folders/1", s... | StarcoderdataPython |
3242606 | """Generate the Go code to parse and serialize a mapry object graph."""
import collections
import re
from typing import List, Set
import icontract
from icontract import ensure
import mapry
import mapry.naming
WARNING = "// File automatically generated by mapry. DO NOT EDIT OR APPEND!"
def comment(text: str) -> str... | StarcoderdataPython |
156211 | <filename>pyFM/optimize/base_functions.py
import numpy as np
def descr_preservation(C, descr1_red, descr2_red):
"""
Compute the descriptor preservation constraint
Parameters
---------------------
C : (K2,K1) Functional map
descr1 : (K1,p) descriptors on first basis
descr2 : (K2,p) de... | StarcoderdataPython |
1607518 | <reponame>PatBall1/DeepForestcast<filename>src/models/2DCNN_test.py<gh_stars>0
"""
SCRIPT FOR TESTING 2DCNN MODELS
"""
import time
import torch
import numpy as np
from datetime import datetime
from CNN import CNNmodel
from Training import ImbalancedDatasetUnderSampler
from Training import test_model
from Testing import... | StarcoderdataPython |
3213937 | from _recast import * | StarcoderdataPython |
1661761 | <gh_stars>0
import os
import base64
from datetime import date
from mailmerge import MailMerge
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
from docx2pdf import convert
from utils import *
from mail import googleAPIcre... | StarcoderdataPython |
1735957 | <gh_stars>1000+
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from copy import copy, deepcopy
import numpy as np
from addict import Dict
from .fake_quantize_configuration import read_all_fake_quantize_configurations, get_configurations_by_preset, \
get_configurations_by_qschem... | StarcoderdataPython |
1771069 | """
================================================================
Demo of the histogram function's different ``histtype`` settings
================================================================
* Histogram with step curve that has a color fill.
* Histogram with step curve with no fill.
* Histogram with custom and... | StarcoderdataPython |
130228 | <reponame>stanford-futuredata/sketchstore<filename>python/testdata/msftmunge.py
import numpy as np
import pandas as pd
import random
from tqdm import tqdm
import math
import os
import json
fname = "/Users/edwardgan/Documents/Projects/datasets/msft/mb200k.tsv"
outfname = "/Users/edwardgan/Documents/Projects/datasets/ms... | StarcoderdataPython |
97829 | <filename>hand_writing_detection.py
import cv2
# loads the handwriting
img = cv2.imread("phrase_handwritten.png")
# img_rot = img[::-1]
img_rot = cv2.rotate(img, cv2.ROTATE_180)
cv2.imshow("Rotated Image", img_rot)
# cv2.imshow("inverted image", img_rot)
# create a copy of the image
img_copy = img_r... | StarcoderdataPython |
1701421 | <reponame>cohortfsllc/cohort-cocl2-sandbox<filename>pnacl/scripts/parse_llvm_test_report.py
#!/usr/bin/python
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Parse the report output of the llvm... | StarcoderdataPython |
3370761 | from . import VEXObject
import logging
l = logging.getLogger("pyvex.expr")
class IRExpr(VEXObject):
"""
IR expressions in VEX represent operations without side effects.
"""
tag = None
def __init__(self):
VEXObject.__init__(self)
def pp(self):
print self.__str__()
@prope... | StarcoderdataPython |
1616036 | import yaml
y = yaml.safe_load(open("kustomize/katib-db/base/katib-db-deployment.yaml"))
y["spec"]["template"]["spec"]["containers"][0]["securityContext"]={}
y["spec"]["template"]["spec"]["containers"][0]["securityContext"]["privileged"]=True
y["spec"]["template"]["spec"]["securityContext"]={}
y["spec"]["template"]["s... | StarcoderdataPython |
4829853 | from datetime import datetime
from typing import Optional
from constance import config
from django.db import transaction
from posthog.async_migrations.definition import AsyncMigrationOperation
from posthog.async_migrations.setup import DEPENDENCY_TO_ASYNC_MIGRATION
from posthog.celery import app
from posthog.constant... | StarcoderdataPython |
1666798 | <filename>hwt/serializer/hwt/context.py
class ValueWidthRequirementScope():
"""
Context manager which temporarily swaps the _valueWidthRequired on specified context
.. code-block:: python
with ValueWidthRequirementScope(ctx, True):
#...
"""
def __init__(self, ctx, val):
... | StarcoderdataPython |
3258439 | <reponame>rgalhama/wordrep_cmcl2020
import sys, os
import pandas as pd
import numpy as np
from scipy import stats
import statsmodels.api as sm
import statsmodels.formula.api as smf
from statsmodels.stats.outliers_influence import variance_inflation_factor
import warnings
warnings.filterwarnings("ignore", category=Runti... | StarcoderdataPython |
3292146 | <reponame>Food-X-Technologies/foodx_devops_tools<filename>tests/manual/test_auth.py
# Copyright (c) 2021 Food-X Technologies
#
# This file is part of foodx_devops_tools.
#
# You should have received a copy of the MIT License along with
# foodx_devops_tools. If not, see <https://opensource.org/licenses/MIT>.
"""Run... | StarcoderdataPython |
1700066 | <filename>venv/lib/python3.8/site-packages/pip/_vendor/requests/certs.py
/home/runner/.cache/pip/pool/9d/74/55/abd0ed1a6bffd4061bc234eef54ae001c749bf4e59be435e6a82ce6716 | StarcoderdataPython |
163024 | alpha = "abcdefghijklmnopqrstuvwxyz"
key = "<KEY>"
message = input("enter the message : ")
cipher = ""
for i in message:
cipher+=key[alpha.index(i)]
print(cipher) | StarcoderdataPython |
95041 | <filename>comparison/sciclone/convert_outputs.py
import argparse
import json
import csv
from collections import defaultdict
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
import inputparser
def convert_clusters(scresultsfn, varid_map):
clusters = defaultdict(list)
garbag... | StarcoderdataPython |
3322586 | <gh_stars>100-1000
import gc
import unittest
from comtypes.client import PumpEvents
class PumpEventsTest(unittest.TestCase):
def test_pump_events_doesnt_leak_cycles(self):
gc.collect()
for i in range(3):
PumpEvents(0.05)
ncycles = gc.collect()
self.assertEqual(... | StarcoderdataPython |
3379508 | <reponame>DevTotti/pizzafeed<gh_stars>0
"""from apscheduler.schedulers.blocking import BlockingScheduler
from optimized import *
sched = BlockingScheduler()
@sched.scheduled_job('interval', minutes=30)
def index():
#sc.run_pending()
main()
sched.start()
"""
#clock: python clock.py | StarcoderdataPython |
1648781 | <reponame>meawoppl/babyfood
# From https://www.digikey.com/Web%20Export/Supplier%20Content/Vishay_8026/PDF/VishayBeyschlag_SolderPad.pdf?redirected=1
from babyfood.pcb.PCBUnits import mil
from babyfood.features.basic import CenteredRectangle, FilledCenteredRectangle
from babyfood.components.ABC import AbstractSMACompo... | StarcoderdataPython |
1680704 | import os
import torch
import random
import numpy as np
from torchvision import datasets, transforms
from torch.utils.data import DataLoader
from PIL import Image
class Dataset():
def __init__(self, train_dir, basic_types = None, shuffle = True, single_channel = False):
self.train_dir = train_dir
self.basic_types... | StarcoderdataPython |
1780603 | <reponame>alphamatic/amp
import io
import logging
import os
import pandas as pd
import dataflow.core.nodes.sinks as dtfconosin
import helpers.hunit_test as hunitest
_LOG = logging.getLogger(__name__)
class TestWriteDf(hunitest.TestCase):
def test_write(self) -> None:
"""
Round-trip test on df s... | StarcoderdataPython |
1674523 | <filename>python/test.py
import time
import numpy
import orjson
def list_vs_array():
resol = 128
lst = [[[3.14 for _ in range(resol)] for _ in range(resol)] for _ in range(resol)]
arr = numpy.full((resol, resol, resol), 3.14, dtype=numpy.float32)
t0 = time.time()
l = orjson.dumps(lst)
t1 = t... | StarcoderdataPython |
4821788 | <reponame>PratikGarai/Coding-Challenges<filename>Hackerrank/MaximumPalindromes.py
def getRes(counts):
l = 0
o = 0
res = 1
den = 1
for i in counts :
for j in range(1,(i//2)+1):
res = (res*(l+j)//j)
l += i//2
o += i%2
if not o:
o = 1
res = o... | StarcoderdataPython |
3254802 | <reponame>mdalzell/advent-of-code-2019
from aoc2019.shared.intcode import IntCode
class SpringBot:
def __init__(self, program):
self.__computer = IntCode(program)
def loadSpringScript(self, commands):
asciiValues = []
for command in commands:
for character in command:
... | StarcoderdataPython |
135142 | <gh_stars>0
import importlib
import importlib.machinery
import importlib.util
import os
import re
import tempfile
from mako import exceptions
from mako.template import Template
from .exc import CommandError
def template_to_file(template_file, dest, output_encoding, **kw):
template = Template(filename=template_f... | StarcoderdataPython |
3687 | <reponame>imaroger/sot-talos-balance
'''Test feet admittance control'''
from sot_talos_balance.utils.run_test_utils import run_ft_calibration, run_test, runCommandClient
try:
# Python 2
input = raw_input # noqa
except NameError:
pass
run_test('appli_feet_admittance.py')
run_ft_calibration('robot.ftc')
i... | StarcoderdataPython |
89482 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `dicom_wsi` package."""
import datetime
import os
from yaml import load, BaseLoader
from ..dicom_wsi.base_attributes import build_base
from ..dicom_wsi.parse_wsi import get_wsi
from ..dicom_wsi.sequence_attributes import build_sequences
from ..dicom_wsi.shar... | StarcoderdataPython |
4824693 | import sys
import os
import signal
import json
from distutils.spawn import find_executable
from textwrap import shorten
from psutil import process_iter
from subprocess import Popen, DEVNULL
from time import sleep
from pytg.sender import Sender
from pytg.receiver import Receiver
from pytg.utils import coroutine
from p... | StarcoderdataPython |
3205085 | from rest_framework.test import APITestCase, APIClient
from api.models import Sample, Disease, Mutation, Gene
class SampleTests(APITestCase):
sample_keys = ['sample_id',
'disease',
'mutations',
'gender',
'age_diagnosed']
def setUp(se... | StarcoderdataPython |
1685749 | #!/user/bin/env python3
# Note that all the tests in this module require dataset (either network access or cached)
import os
import torch
import torchtext
import json
import hashlib
from torchtext.legacy import data
from parameterized import parameterized
from ..common.torchtext_test_case import TorchtextTestCase
from ... | StarcoderdataPython |
4818728 | <reponame>Carmo-sousa/telegram-bot
"""
All commands of Bot
"""
import logging
from telegram import Update
from telegram.ext import CallbackContext
# Enable logging
logger = logging.getLogger(__name__)
# TODO: Terminar de escrever a pagina de ajuda.
HELP_MESSAGE = """
Bem vindo ao seu gerenciador de usuário e senha!... | StarcoderdataPython |
4805623 | <reponame>amirhertz/shadowpix
from image_utils import *
from mesh_utils import *
import numpy as np
epsilon = 1e-10
def check_constrains(r, u, v):
constrains = [r <= u[:, :-1] + epsilon, r <= u[:, 1:] + + epsilon, r[: -1, :] <= v[1:, :] + epsilon]
for idx, constrain in enumerate(constrains):
if not ... | StarcoderdataPython |
4804290 | """Test for TaskContextConnection"""
from unittest.mock import Mock
import pytest
from pynocular.aiopg_transaction import LockedConnection, TaskContextConnection
@pytest.fixture()
def locked_connection():
"""Return a locked connection"""
return LockedConnection(Mock())
@pytest.mark.asyncio()
async def tes... | StarcoderdataPython |
4837065 | <reponame>nanbi/Python-software
import numpy as np
from scipy.stats import norm as ndist
import regreg.api as rr
from selection.tests.flags import SMALL_SAMPLES, SET_SEED
from selection.tests.instance import gaussian_instance
from selection.tests.decorators import wait_for_return_value, set_seed_iftrue, set_sampling_... | StarcoderdataPython |
1670056 | bootstrap_servers = 'kafka-instance-1-vm:9092'
send_to_kafka = 1
kafka_topic = 'topicz1'
time_delay = 5
number_of_threads = 100
| StarcoderdataPython |
61641 | <reponame>mmcenta/2048gym
from stable_baselines.common.env_checker import check_env
from gym_text2048.envs import Text2048Env, Text2048CappedEnv, Text2048WithHeuristicEnv, Text2048CappedWithHeuristicEnv
if __name__ == "__main__":
envs = [
Text2048Env(),
Text2048CappedEnv(),
Text2048WithHeu... | StarcoderdataPython |
1740476 | import functools
from math import log
import numpy as np
import tree
from ray.rllib.models.action_dist import ActionDistribution
from ray.rllib.models.torch.torch_modelv2 import TorchModelV2
from ray.rllib.utils.annotations import override
from ray.rllib.utils.framework import try_import_torch
from ray.rllib.utils.num... | StarcoderdataPython |
1655515 | <filename>recoapis/__init__.py
from .baserecoapi import TrainingException, RecommendationException
from .abacusrecoapi import AbacusRecoApi
from .amazonrecoapi import AmazonRecoApi
from .dummyrecoapi import DummyRecoApi
from .recombeerecoapi import RecombeeRecoApi
from .xmindsrecoapi import XMindsRecoApi
APIS = {
... | StarcoderdataPython |
1678215 | #!/usr/bin/env python
from distutils.version import LooseVersion
from setuptools import setup, find_packages
def get_docker_client_requirement():
DOCKER_PY_REQUIREMENT = 'docker-py >= 1.8.1, < 2'
DOCKER_RRQUIREMENT = 'docker >= 2.0.0, < 3'
docker_client_installed = True
try:
import docker
... | StarcoderdataPython |
1731373 | <filename>new_preprocess_and_augment.py
from settings import *
import random
from scipy import ndarray
import cv2 as cv2
import numpy as np
import math
import skimage as sk
from skimage import transform
from skimage import util
from skimage import io
from skimage.transform import SimilarityTransform
import os
import gl... | StarcoderdataPython |
1719127 | from typing import List
from time import sleep
from models.client import Client
from models.account import Account
accounts: List[Account] = []
def main() -> None:
menu()
def menu() -> None:
print('=============================')
print('============ATM==============')
print('=========Python Bank==... | StarcoderdataPython |
3354865 | <gh_stars>0
from distutils.core import setup
setup(
name='Flyrc',
version='0.1.1',
author='<NAME>',
author_email='<EMAIL>',
packages=['flyrc'],
url='https://github.com/mrflea/flyrc',
license='LICENSE.txt',
description='Fully-featured IRC client library.',
long_description=open('README.md').read(),
classifier... | StarcoderdataPython |
3203035 | <reponame>qpit/CVQKDsim
# utilities.py
# Copyright 2020 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by a... | StarcoderdataPython |
186488 | # @copyright@
# Copyright (c) 2006 - 2020 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
DOCUMENTATION = """
module: stacki_storage_controller_info
short_description: Return data about Stacki storage controllers
description:
- If n... | StarcoderdataPython |
3319421 | <reponame>Ifyokoh/End-to-End-Machine-Learning
from setuptools import setup, find_packages
classifiers = [
'Intended Audience :: Education',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3'
]
setup(
name='propertypro-scrapper',
version='2.0',
description='A scraper that he... | StarcoderdataPython |
86768 | from opentrons import robot, containers, instruments
robot.head_speed(x=18000, y=18000, z=5000, a=700, b=700)
#Deck setup
tiprack_1000 = containers.load("tiprack-1000ul-H", "B3")
source_row = containers.load("FluidX_24_5ml", "A1", "acid")
source_col = containers.load("FluidX_24_5ml", "A2", "amine")
source_trough4row... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.