id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
8185997
import pytest @pytest.mark.xfail def test_that_you_wrote_tests(): from textwrap import dedent assertion_string = dedent( """\ No, you have not written tests. However, unless a test is run, the pytest execution will fail due to no tests or missing coverage. So, write a real test and t...
StarcoderdataPython
5097828
#!venv/bin/python """ This module imports Flask-Manager script, adds our create_db command and run it. You can pass following arguments: * create_db => creates sqlite database and all the tables * shell => runs python shell inside application context * runserver => runs Flask development server * db => ...
StarcoderdataPython
79020
# Generated by Django 3.1 on 2020-08-13 02:38 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ("core", "0011_auto_20200214_1939"), ] operations = [ migrations.AlterField( model_name="note", ...
StarcoderdataPython
3397396
str = input() total = 0 for letter in str: if letter == 'a': total = total + 1 elif letter == 'e': total = total + 2 elif letter == 'i': total = total + 3 elif letter == 'o': total = total + 4 elif letter == 'u': total = total + 5 print(total)
StarcoderdataPython
1787322
<reponame>tbcey74123/Difference-Subspace-Search # python synthetic_experiment_global.py [--test] import os, sys import time import numpy as np from GlobalOptimizer.SLSOptimizer import SLSOptimizer from GlobalOptimizer.JacobianOptimizer import JacobianOptimizer from GlobalOptimizer.JacobianOptimizerLocalLine...
StarcoderdataPython
1833595
# esfera.py # Alumna: <NAME> # Ejercicio 1.13: # En tu directorio de trabajo de esta clase, escribí un programa llamado esfera.py que le pida al usuario que ingrese por teclado el radio r de una esfera y # calcule e imprima el volumen de la misma. Sugerencia: recordar que el volúmen de una esfera es 4/3 πr^3. # Fina...
StarcoderdataPython
1945684
<reponame>dylanlee101/leetcode ''' 颠倒给定的 32 位无符号整数的二进制位。   示例 1: 输入: 00000010100101000001111010011100 输出: 00111001011110000010100101000000 解释: 输入的二进制串 00000010100101000001111010011100 表示无符号整数 43261596, 因此返回 964176192,其二进制表示形式为 00111001011110000010100101000000。 示例 2: 输入:11111111111111111111111111111101 输出:10111...
StarcoderdataPython
5019098
# -*- coding: utf-8 -*- """ The MIT License (MIT) Copyright (c) 2020 <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 the rights to use, c...
StarcoderdataPython
11268645
"""The tests for the Ring sensor platform.""" import unittest from unittest import mock from homeassistant.components.sensor import ring from tests.common import get_test_home_assistant VALID_CONFIG = { "platform": "ring", "username": "foo", "password": "<PASSWORD>", "monitored_conditions": [ ...
StarcoderdataPython
295041
<reponame>matthiask/django-imagefield from __future__ import unicode_literals from django.conf import settings from django.conf.urls.static import static from django.contrib import admin try: from django.urls import re_path except ImportError: from django.conf.urls import url as re_path # from testapp impo...
StarcoderdataPython
8149435
<filename>botorch/posteriors/__init__.py #! /usr/bin/env python3 from .gpytorch import GPyTorchPosterior from .posterior import Posterior __all__ = ["GPyTorchPosterior", "Posterior"]
StarcoderdataPython
3450704
import unittest import math from generativepy.drawing import setup, make_image, ROUND, BUTT from image_test_helper import run_image_test from generativepy.color import Color from generativepy.graph import Axes, Plot from generativepy.geometry import LinearGradient """ Test the graph module. """ class TestGraphImages...
StarcoderdataPython
6421493
<filename>gamesAlgorithms/islemGames.py<gh_stars>0 import numpy as np # this code is wrote for a Bir Kelime Bir Islem game # It estimates the math operation among many number with respec to a result def feval(funcName, *args): return eval(funcName)(*args) def topla(x,y): toplam = x+y return toplam def ...
StarcoderdataPython
80911
import os import sys import random import numpy as np sys.path.insert(1, os.path.join(sys.path[0], '..')) from h01_data.parse import get_data as get_raw_data from h02_learn.model import opt_params from h02_learn.train import convert_to_loader, _run_language, write_csv, get_data from utils import argparser from utils i...
StarcoderdataPython
6574287
# Copyright 2019 Extreme Networks, 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 agreed to i...
StarcoderdataPython
138137
from setuptools import setup, find_packages import torch from torch.utils.cpp_extension import CppExtension, CUDAExtension, CUDA_HOME ext_modules = [ CppExtension('sym3eig_cpu', ['cpu/sym3eig.cpp']), ] cmdclass = {'build_ext': torch.utils.cpp_extension.BuildExtension} if CUDA_HOME is not None: ext_modules += ...
StarcoderdataPython
6667296
# This function takes a single filename string as an argument, e.g. robin.txt # It should open the file, and work through it to produce the output. from collections import OrderedDict import operator def word_count(s): cache = {} # Ignore each of the following characters: " : , . - + = / \ | [] {}() * ...
StarcoderdataPython
6685577
<reponame>sireliah/polish-python """Wrapper to the POSIX crypt library call oraz associated functionality.""" zaimportuj _crypt zaimportuj string jako _string z random zaimportuj SystemRandom jako _SystemRandom z collections zaimportuj namedtuple jako _namedtuple _saltchars = _string.ascii_letters + _string.digits +...
StarcoderdataPython
4835939
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # @PROJECT : jupyter_Projects # @Time : 2018/4/17 10:09 # @Author : <NAME> # @Mail : <EMAIL> # @File : learn_utils.py # @Software: PyCharm from __future__ import absolute_import, unicode_literals import sys, os import tensorflow as tf import time sys.path.appen...
StarcoderdataPython
5185285
print("import: 'flask'") import flask print("import: 'flask.json'") import flask.json
StarcoderdataPython
4926673
<filename>platforms/fomu.py # Support for the Fomu # More information can be found here https://github.com/im-tomu/foboot.git from litex.build.lattice.platform import LatticePlatform from litex.build.generic_platform import Pins, IOStandard, Misc, Subsignal _io_evt = [ ("serial", 0, Subsignal("rx", Pins("...
StarcoderdataPython
11312370
import re import os import datetime import logging import shutil from invoke.exceptions import UnexpectedExit # third party imports from patchwork.files import exists ''' execute_command ''' def execute_command(connection, cmd, hide=True): result = connection.run(cmd, hide=hide) msg = "Ran {0.command!r} on {...
StarcoderdataPython
1715640
# Important Imports import numpy as np from PIL import Image from scipy.signal import find_peaks # image = PIL.Image, n = Number of Segments # ignoreBottomTop = Segmentation of top and bottom of Image # axis = 0 (for vertical-lines) or 1 (for horizontal-lines) # Returns a gray image, PIL Image. def recursiveXYCut(imag...
StarcoderdataPython
11339941
<filename>tests/cupy_tests/linalg_tests/test_norms.py import unittest import numpy from cupy import testing @testing.gpu class TestTrace(unittest.TestCase): _multiprocess_can_split_ = True @testing.for_all_dtypes() @testing.numpy_cupy_allclose() def test_trace(self, xp, dtype): a = testing...
StarcoderdataPython
121773
<reponame>IoTtalk/os-IoTtalk import multiprocessing import time import os.path import logging from logging.handlers import TimedRotatingFileHandler import db import ec_config db.connect(ec_config.DB_NAME) import csmapi from . import clogging from . import esm_project FileLock = multiprocessing.Lock() MAIN_LOG_FILE...
StarcoderdataPython
39997
import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator from tqdm import tqdm import torch from torch.utils.data import DataLoader import torch.nn.functional as F from model.model import BaseNet from model.config import arguments from dataset.dataset import FlowerData def ge...
StarcoderdataPython
9714278
# Copyright 2020 the V8 project authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # 0x00 (module # 0x08 [type] # (type $type0 (func (param i32 i32) (result i32))) # 0x11 [function] # 0x15 (export "mul" (func $func0)) # 0x1e ...
StarcoderdataPython
1796975
# @Title: 从链表中删去总和值为零的连续节点 (Remove Zero Sum Consecutive Nodes from Linked List) # @Author: 18015528893 # @Date: 2021-02-05 12:38:31 # @Runtime: 176 ms # @Memory: 15.2 MB # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solutio...
StarcoderdataPython
6517203
<reponame>ergonyc/SneakerGen ################## # part 1: choose the best model... beta ~ 2 or 4 # how to i choose the best beta? use the disentangled metrics??? # or just visualize the latent space # part 2: visualize the latent space # part 3: create umap / tsne summaries... # part 4: create a ...
StarcoderdataPython
5179590
<filename>pyf/_readdir.py def _readdir(DIR): """Implementation of perl readdir in scalar context""" try: result = (DIR[0])[DIR[1]] DIR[1] += 1 return result except IndexError: return None
StarcoderdataPython
1850750
from amaru.utilities import constants def choose_structure(structure_list, idx=0, location=None, complete_locations=None, final_platforms=None, final_pig_positions=None, final_TNT_positions=None): nr_structures_we_have = len(structure_list) if location is None: location = [2, con...
StarcoderdataPython
8120424
<filename>squids/dataset/maker.py """A module for creating synthetic datasets.""" import copy import json import random import datetime from pathlib import Path from shutil import rmtree from tqdm import tqdm from .image import create_synthetic_image from .shape import Ellipse, Triangle, Rectangle from .palette impo...
StarcoderdataPython
11343324
<filename>sensors/pyrosim/objects.py from pyrosim import PYROSIM sim = PYROSIM(playPaused=True, evalTime=1000) sim.Send_Cylinder( objectID=0, x=0 , y=0 , z=0.6 , length=1.0 , radius=0.1 ) sim.Send_Cylinder( objectID=1 , x=0 , y=0.5 , z=1.1 , r=1 , g=0 , b=0 , r1=0 , r2=1 , r3=0 ) # sim.Send_Cylinder( length=1.0 , radiu...
StarcoderdataPython
9794324
from django.db import models from django.urls import reverse from django.utils.html import format_html import operator from decimal import Decimal from organization.models import Organization from products.models import Product # Create your models here. """Abstract models for invoicing(Purchase and Sales)""" class ...
StarcoderdataPython
8041657
import numpy from numpy.linalg import norm from scipy.fft import dct from skimage.metrics import mean_squared_error def spectral_psnr(norm_true_image, norm_test_image): """Spectral PSNR calculation Parameters ---------- norm_true_image : numpy.typing.ArrayLike norm_test_image : numpy.typing.Array...
StarcoderdataPython
12828513
#!/usr/bin/env python # -*- coding: utf-8 -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Utilities to handle BIDS inputs ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Fetch some test data >>> import os >>> from niworkflows import data >>> data_r...
StarcoderdataPython
3469747
import torch from ._nmf_batch_base import NMFBatchBase from ..utils import nnls_bpp from typing import Union class NMFBatchNnlsBpp(NMFBatchBase): def __init__( self, n_components: int, init: str, beta_loss: float, tol: float, random_state: int, alpha_W: flo...
StarcoderdataPython
3428016
<reponame>Awesome-RJ/lk21<gh_stars>10-100 from . import BaseExtractor class Anitoki(BaseExtractor): tag = "anime" host = "https://www.anitoki.com" def extract_meta(self, id: str) -> dict: """ Ambil semua metadata dari halaman web Args: id: type 'str' """ ...
StarcoderdataPython
6538657
#!/usr/bin/env python from setuptools import setup, find_packages from usda_nutrition import __version__ def readme(): with open('README.md') as f: return f.read() setup( name='django-usda-nutrition', version=__version__, packages=find_packages(exclude=('tests*',)), include_package_data...
StarcoderdataPython
3384040
# coding=utf-8 import click import os import io import sys import pybee from pybee.path import working_dir current_dir = os.path.abspath(os.getcwd()) script_dir = os.path.abspath(os.path.dirname(__file__)) #default_build_dir = os.path.join(script_dir, 'build') default_build_dir = os.path.expanduser('~/manjaro-linux...
StarcoderdataPython
6671944
<reponame>atseplyaev/django-flatpages-api from rest_framework import serializers from rest_polymorphic.serializers import PolymorphicSerializer from .models import Content, Video, Text, Audio, Page class ContentSerializer(serializers.ModelSerializer): """ Базовый сериализатор блока контента От него должн...
StarcoderdataPython
8033358
<reponame>FINRAOS/MLiy """ Mliy web app main views """ ''' Copyright 2017 MLiy Contributors 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...
StarcoderdataPython
8161244
from picamera.array import PiRGBArray from picamera import PiCamera import cv2 import numpy as np import gpiozero camera = PiCamera() image_width = 640 image_height = 480 camera.resolution = (image_width, image_height) camera.framerate = 32 rawCapture = PiRGBArray(camera, size=(image_width, image_height)) center_image...
StarcoderdataPython
5038205
<filename>ubiquiti_config_generator/nodes/global_settings.py<gh_stars>1-10 """ Configurable global options """ import shlex from typing import List from ubiquiti_config_generator.nodes.validatable import Validatable GLOBAL_SETTINGS_TYPES = {} class GlobalSettings(Validatable): """ Global options """ ...
StarcoderdataPython
8160390
from __future__ import print_function from netCDF4 import Dataset, date2num, num2date from datetime import datetime, timedelta import numpy as np import interp2D import interpolation as interp import IOwrite import os import barotropic import IOinitial import datetimeFunctions import forcingFilenames as fc try: im...
StarcoderdataPython
6438533
<filename>Python/Utils/elfutils/tests/TestFiles.py ''' Created on May 27, 2012 @author: Charlie ''' import os import shutil import unittest import elfutils.elffiles as elfFiles class TestFiles(unittest.TestCase): def setUp(self): self.curDir = os.getcwd() self.tempStartDir = os.path.join...
StarcoderdataPython
12821692
<filename>app/grandchallenge/container_exec/backends/docker.py import io import json import os import tarfile import uuid from contextlib import contextmanager from json import JSONDecodeError from pathlib import Path from random import randint from time import sleep from typing import Tuple import docker from django....
StarcoderdataPython
3467546
<filename>apiserver/apiserver/scripts/print_db_proxy_instance.py from .. import config if __name__ == "__main__": print("{}:{}:{}".format(config.DATABASE_PROJECT_ID, config.DATABASE_REGION, config.DATABASE_INSTANCE_NAME))
StarcoderdataPython
1692996
from relogic.logickit.scorer.scorer import Scorer from relogic.logickit.utils.utils import softmax, sigmoid import torch.nn.functional as F import torch from tqdm import tqdm import os import subprocess import json class RecallScorer(Scorer): def __init__(self, label_mapping, topk, correct_label='1', dump_to_file=No...
StarcoderdataPython
1853411
<reponame>CrazyChamelion/snake<filename>main.py from turtle import Screen import arcade import os import random import math from numpy import append # Constants SCREEN_WIDTH = 1280 SCREEN_HEIGHT = 720 SCREEN_TITLE = "Snake Game" # Sprite paths SNAKE_PATH = "assets/snakeSection.png" FOOD_PATH = "assets/food.png" # v...
StarcoderdataPython
3524775
<gh_stars>100-1000 __author__ = 'esteban'
StarcoderdataPython
4909884
<reponame>epicosy/cgc-repair<gh_stars>0 import time from queue import Queue from typing import List from threading import Thread from cement import Handler from cement.core.log import LogHandler from cgcrepair.core.data.store import Runner, TaskData from cgcrepair.core.interfaces import RunnerInterface class TaskW...
StarcoderdataPython
6417503
# Write a function that when given a URL as a string, parses out just the # domain name and returns it as a string. For example: # domain_name("http://github.com/carbonfive/raygun") == "github" # domain_name("http://www.zombie-bites.com") == "zombie-bites" # domain_name("https://www.cnet.com") == "cnet" def domain_na...
StarcoderdataPython
1936974
<reponame>Frinalal/zero-btc-screen<gh_stars>0 import json import random import time import numpy as np from datetime import datetime, timezone, timedelta from urllib.error import HTTPError, URLError from urllib.request import Request, urlopen from config.builder import Builder from config.config import config from log...
StarcoderdataPython
6549167
''' THIS IS THE WAR GAME. ''' import random suits = ("Hearts", "Spades", "Diamonds", "Clubs") ranks = ("Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King", "Ace") values = {"Two":2, "Three":3, "Four":4, "Five":5, "Six":6, "Seven":7, "Eight":8, "Nine":9, "Ten":10, ...
StarcoderdataPython
4977697
# Generated by Django 3.2 on 2021-05-15 18:18 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0001_initial'), ] operations = [ migrations.AlterField( model_name='housing', name='images', field=...
StarcoderdataPython
11332196
from .check import is_hangul, is_hanja, has_coda ################################################################################ # Decomposition & Combination ################################################################################ def compose(onset: str, nucleus: str, coda: str = '') -> str: """This f...
StarcoderdataPython
3574124
import os import sys import csv import shutil import argparse import datetime import logging import traceback from collections import defaultdict from os.path import basename, join, dirname from cached_property import cached_property from egcg_core import executor, rest_communication, clarity from egcg_core.app_logging...
StarcoderdataPython
4862358
from OpenGLCffi.EGL import params @params(api='egl', prms=['dpy', 'stream']) def eglStreamConsumerGLTextureExternalKHR(dpy, stream): pass @params(api='egl', prms=['dpy', 'stream']) def eglStreamConsumerAcquireKHR(dpy, stream): pass @params(api='egl', prms=['dpy', 'stream']) def eglStreamConsumerReleaseKHR(dpy, st...
StarcoderdataPython
5125677
<gh_stars>1-10 import os originalPath = '../../DATA/patients_documents/SPINE_MET_pdfs' oldPath = '../../DATA/patients_documents/TS_MET_pdfs' newSet = os.listdir(originalPath) allOld = [os.listdir(os.path.join(oldPath,f)) for f in os.listdir(oldPath)] # print len([item for sublist in allOld for item in sublist]) flat_l...
StarcoderdataPython
8093566
<gh_stars>0 #!/usr/bin/python class Solution(object): def lengthOfLastWord(self, s): """ :type s: str :rtype: int """ if not s: return 0 i = len(s) - 1 found = False last_char = None while i >= 0: if s[i] == ' ': ...
StarcoderdataPython
8174751
# -*- coding: utf-8 -*- from peewee import * import datetime import unittest from Model.DataAccessor.DbAccessor.DbOrmAccessor import db, BaseModel from Model.DataAccessor.Configure import config class Timeline(BaseModel): date = DateField(unique=True, default=datetime.date.today) class Flesh(BaseModel): ""...
StarcoderdataPython
261001
<filename>opentamp/util_classes/ik_controller.py<gh_stars>1-10 """ Adapted from: https://github.com/StanfordVL/robosuite/blob/master/robosuite/controllers/baxter_ik_controller.py @inproceedings{corl2018surreal, title={SURREAL: Open-Source Reinforcement Learning Framework and Robot Manipulation Benchmark}, author={...
StarcoderdataPython
11208128
#!/usr/bin/env python # a bar plot with errorbars import matplotlib import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Ellipse, Polygon width = 0.97 # the width of the bars font = {'family' : 'sans-serif', 'variant' : 'normal', 'weight' : 'light', 'size' : 13} ...
StarcoderdataPython
8063069
<filename>soteria/components/parameter.py class Parameter: ''' This holds function/procedure parameters defined in the specificaiton ''' def __init__(self, name, datatype): self.name = name self.datatype = datatype def __eq__(self, other): if self.name == other.name and se...
StarcoderdataPython
11356150
<reponame>emillon/opam-monorepo #!/usr/bin/env python # This is a simple demonstration client for the "0install slave" JSON API. # This file is in the Public Domain. import subprocess, json import logging, sys # 0 = low # 1 = show our messages # 2 = enabled logging in slave verbosity = 0 if verbosity > 0: logging....
StarcoderdataPython
6523002
from dbt.contracts.graph.unparsed import UnparsedNode from dbt.node_types import NodeType from dbt.parser.base import MacrosKnownParser import os class ArchiveParser(MacrosKnownParser): @classmethod def parse_archives_from_project(cls, config): archives = [] archive_configs = config.archive ...
StarcoderdataPython
6681714
from tools.imageProvider import ImageProvider from tools.imageQueryParser import ImageQuery from tools.isType import is_type import logging import requests class DuckDuckGoImagesProvider(ImageProvider): URL = "https://duckduckgo.com/i.js?q=%s&s=%d" def __init__(self): ImageProvider.__init__(self) ...
StarcoderdataPython
6610109
<gh_stars>1-10 #!/usr/bin/env python3 """ TODO """ REGSTR_INT = r'[+-]?[0-9]+' REGSTR_FLOAT = r'[+-]?[0-9]*\.[0-9]+(?:[eE][+-]?[0-9]+)?' RESTR_BOOL = r'\.TRUE\.|\.FALSE\.' def vasp_file_lines(vasp_file, line_continuation=False): """ Parses one line of data in file Parameters ---------- vasp_file : ...
StarcoderdataPython
3326980
from enum import Enum import json from typing import Dict from api.db.models.base import BaseSchema class IssueCredentialProtocolType(str, Enum): v10 = "v1.0" v20 = "v2.0" class CredentialType(str, Enum): anoncreds = "anoncreds" json_ld = "json_ld" class CredentialRoleType(str, Enum): issuer ...
StarcoderdataPython
3573346
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'AboutUI.ui' # # Created by: PyQt5 UI code generator 5.12.3 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_AboutDialog(object): def setupUi(self, AboutDialog): Abou...
StarcoderdataPython
93971
from tests.utils import W3CTestCase class TestFlexbox_AlignItemsFlexend(W3CTestCase): vars().update(W3CTestCase.find_tests(__file__, 'flexbox_align-items-flexend'))
StarcoderdataPython
9620182
<filename>SIGNUS/modules/crawler/sj_crawling/sj42.py from bs4 import BeautifulSoup import datetime from modules.crawler.list.url_list import List from modules.crawler.list.date_cut import date_cut_dict from modules.crawler.etc.post_wash import post_wash from modules.crawler.etc.img_size import img_size now = datetime...
StarcoderdataPython
8137685
<reponame>ethz-asl/ros_task_manager #! /usr/bin/env python # Task Generic configuration # PACKAGE='task_manager_lib' # import roslib; roslib.load_manifest(PACKAGE) from dynamic_reconfigure.parameter_generator_catkin import * def TaskParameterGenerator(): gen = ParameterGenerator() # Name ...
StarcoderdataPython
3860
<reponame>mcroydon/django-tumbleweed<filename>tumbleweed/models.py # These are not the droids you are looking for.
StarcoderdataPython
362832
<gh_stars>1-10 #!/usr/bin/env python3 # -*- coding: utf-8 -*- from keras.callbacks import EarlyStopping, ModelCheckpoint from keras.layers import Embedding, LSTM, Dense from keras.models import Sequential from keras.utils import to_categorical from keras.optimizers import Adadelta import numpy as np from keras.utils im...
StarcoderdataPython
87854
<filename>arquitetura-de-computadores/Projeto 5 - ALU + RegFile/riscv-cpu/create_test.py<gh_stars>1-10 #! /usr/bin/env python3 import xml.etree.ElementTree as ET import argparse import os import re def main(assembly_files, num_cycles): save_num_cycles = num_cycles for assembly_file in assembly_files: ...
StarcoderdataPython
6546238
<filename>goodreads.com/goodreads_books.py # -*- coding: utf-8 -*- # (c) dlancer, 2017 import re from scrapy import Spider, Request, FormRequest BASE_URL = 'https://www.goodreads.com' CATEGORIES = ['present-tense'] USERNAME = '' PASSWORD = '' class GoodreadsBooksSpider(Spider): name = 'goodreads_books' allo...
StarcoderdataPython
181769
from xu.src.python.Request.Model.APIAnalysis import APIAnalysis from xu.src.python.Request.Model.APILink import APILink from xu.src.python.Request.Model.MyFile import MyFile from xu.src.python.Request.Model.APIConfig import APIConfig from xu.src.python.Request.Model.APIResponse import APIResponse from xu.src.python.Req...
StarcoderdataPython
9777762
# Generated by Django 2.2.10 on 2020-04-26 14:55 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('pacientes', '0013_consulta_turno'), ] operations = [ migrations.CreateModel( ...
StarcoderdataPython
11321322
<reponame>wyaadarsh/LeetCode-Solutions class Solution: def moveZeroes(self, nums): """ :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. """ i = 0 for num in nums: if num != 0: nums[i] = num ...
StarcoderdataPython
3543378
from ..mapper import PropertyMapper, ApiInterfaceBase from ..mapper.types import Timestamp, AnyType __all__ = ['QPExtraInfo', 'QPExtraInfoInterface'] class QPExtraInfoInterface(ApiInterfaceBase): surface: int extra_info: str class QPExtraInfo(PropertyMapper, QPExtraInfoInterface): pass
StarcoderdataPython
1612515
<gh_stars>0 import abc import json import typing from typing import Any, Dict, Optional, Sequence, Union import attr from bitarray import bitarray from pyais.constants import TalkerID, NavigationStatus, ManeuverIndicator, EpfdType, ShipType, NavAid, StationType, \ TransmitMode, StationIntervals from pyais.excepti...
StarcoderdataPython
4875048
<reponame>nkem1010/python-challenge-solutions sentence = "a string that you \"don't\" have to escape\nThis\nis a ....... multi-line\nheredoc string --------> example" print(sentence)
StarcoderdataPython
9755218
""" @author: Shy118 @IP: GlobalFoundries Singapore """ import warnings warnings.filterwarnings("ignore") import traceback, sys, os from PyQt5 import QtWidgets as qtw from PyQt5 import QtCore, QtGui from PyQt5 import QtWebEngineWidgets from PyQt5.QtGui import QColor, QIcon, QPixmap, QImage, QFont from PyQt5...
StarcoderdataPython
11230004
import math class CTreeNode(object): u_price = 0.0 # Price of underlying opt_price = 0.0 # Price of option intrinsic_value = 0.0 # Exercise value is_ex = False # Exercise indicator class CTreeBranch(object): def __init__(self): self.node = [] ...
StarcoderdataPython
6459663
import os import sys from typing import Dict import uuid from core.constructs.backend import Backend_Configuration from core.constructs.settings import Settings_Info from core.default.workspace import local_workspace from core.constructs.workspace import Workspace_Info from ..constructs import test_workspace as work...
StarcoderdataPython
3391166
# Discovering interpretable features # In this chapter, you'll learn about a dimension reduction technique called "Non-negative matrix factorization" ("NMF") that expresses samples as combinations of interpretable parts. For example, it expresses documents as combinations of topics, and images in terms of commonly occu...
StarcoderdataPython
5147263
# coding=utf-8 # Copyright 2021 The Tensor2Robot 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 ...
StarcoderdataPython
6599237
<filename>alfred/lib.py import io import os import sys from typing import List, Iterator import click from alfred.type import path ROOT_DIR = os.path.realpath(os.path.join(__file__, '..')) class InvalidPythonModule(Exception): pass def import_python(python_path: path) -> dict: module = {"__file__": pyth...
StarcoderdataPython
8328
<filename>desktop/core/ext-py/openpyxl-2.3.0-b2/openpyxl/drawing/shape.py from __future__ import absolute_import # Copyright (c) 2010-2015 openpyxl from openpyxl.styles.colors import Color, BLACK, WHITE from openpyxl.utils.units import ( pixels_to_EMU, EMU_to_pixels, short_color, ) from openpyxl.compat i...
StarcoderdataPython
1812228
<reponame>MohammedRakib/Django from django.shortcuts import render, redirect from django.http import HttpResponse from django.contrib.auth.decorators import login_required from django.contrib.auth.forms import AdminPasswordChangeForm, PasswordChangeForm, UserCreationForm from django.contrib.auth import update_session_a...
StarcoderdataPython
1752567
<filename>Currency Converter/exchange.py sa__author__ = "FOX" import requests import sys from PyQt5.QtWidgets import QWidget,QApplication,QLabel,QFileDialog,QMainWindow,qApp,QLineEdit,QComboBox,QPushButton,QDesktopWidget from PyQt5.QtCore import QDate, Qt,QTimer,QDateTime from PyQt5.QtGui import QIcon,QPixmap,QDoubleV...
StarcoderdataPython
3361978
#!/usr/bin/env python3 # vim: set et sw=4 sts=4 fileencoding=utf-8: # # The colorzero color library # # Copyright (c) 2016-2021 <NAME> <<EMAIL>> # # SPDX-License-Identifier: BSD-3-Clause import sys import os import configparser from datetime import datetime from pathlib import Path on_rtd = os.environ.get('READTHEDOC...
StarcoderdataPython
72139
<filename>02_reaction_game.py #02_reaction_game.py # Written for <NAME>'s Electronics Starter Kit for the Raspberry Pi by <NAME> (@pi_tutor) #Thanks to <NAME> from the Raspberry Pi Foundation for the GPIO Zero library #Import relevant libraries from gpiozero import * from time import sleep import random #Set pin num...
StarcoderdataPython
90240
#!/usr/bin/env python from butter.clone import unshare, setns import pytest @pytest.mark.clone def test_setns(mock): m = mock.patch('butter.clone._lib') m = mock.patch('butter.clone._lib.setns') m.return_value = 0 setns(fd=5)
StarcoderdataPython
12826395
<reponame>terhardt/DO-progression import numpy as np import matplotlib.pyplot as plt import pandas as pd import joblib as jl from code.model import linear_ramp from code.plotting import parcolors from scipy.stats import gaussian_kde def calc_med_iqr(y, q=[5, 95], axis=None): qs = np.percentile(y, [q[0], 50, q[-1]...
StarcoderdataPython
8020019
<reponame>dust39/FFL_project_2022 import pandas as pd import matplotlib.pyplot as plt import sys msg="Welcome to my Python Fantasy Football Project 2022" print(msg) def getuserinput(): year=input("Hello, please enter a four digit year from 1970 to 2019 to see the top 10 fantasy scorers from that year!") con...
StarcoderdataPython
1704554
from django.contrib.auth.models import User from rest_framework import serializers from collector.models import icmp_results, targets from .models import UserTargets class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = User fields = ('id', 'username', 'email', 'password...
StarcoderdataPython
322181
import os import tkinter as tk import tkinter.messagebox as tkm import tkinter.ttk as ttk from tkinter import filedialog from uninas.main import Main from uninas.register import Register from uninas.utils.args import MetaArgument, Argument from uninas.utils.paths import standard_paths, replace_standard_paths, get_class...
StarcoderdataPython