id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1611143
<reponame>smiletechnologyunited/seminar_sample<gh_stars>1-10 #!/usr/bin/env python # coding=utf-8 from __future__ import absolute_import, division, print_function import maya.mel def _escape(msg): m = msg m = m.replace(u"\n", u"\\n") m = m.replace(u"\t", u"\\t") return m.replace(u"\"", u"'") def ...
StarcoderdataPython
86602
import pygame import scenes pygame.init() viewport = 800, 600 window = pygame.display.set_mode((viewport)) pygame.display.set_caption('Work In Progress') # name the window scene = scenes.Intro() # set up scene's properties player = scene.player ...
StarcoderdataPython
1654594
<gh_stars>1-10 from __future__ import print_function import logging from setuptools import setup from distutils.extension import Extension from Cython.Build import cythonize import numpy import cython_gsl extensions = [ Extension("AxiScan.axion_ll", ["AxiScan/axion_ll.pyx"], include_dirs=[numpy.get_...
StarcoderdataPython
1729296
<reponame>philcombiths/simplephonoanalysis # -*- coding: utf-8 -*- """ Created on Sun Feb 21 09:44:36 2021 @author: Philip Outline: input transcriptions as a string. Can be multiple rows. input segments as list of strings to search for distributions for each segment Generate empty list to store co...
StarcoderdataPython
3306579
import time from machine import Pin LED = Pin(0, Pin.OUT) while True: LED.value(0) time.sleep(0.5) LED.value(1) time.sleep(0.5)
StarcoderdataPython
47829
# Code generated by `typeddictgen`. DO NOT EDIT. """V1ISCSIVolumeSourceDict generated type.""" from typing import TypedDict, List from kubernetes_typed.client import V1LocalObjectReferenceDict V1ISCSIVolumeSourceDict = TypedDict( "V1ISCSIVolumeSourceDict", { "chapAuthDiscovery": bool, "chapAut...
StarcoderdataPython
85547
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/01_bbox_canvas.ipynb (unless otherwise specified). __all__ = ['points2bbox_coords', 'coords_scaled', 'BBoxCanvas', 'BBoxVideoCanvas'] # Internal Cell import io import attr from math import log from pubsub import pub from attr import asdict from pathlib import Path from ...
StarcoderdataPython
3302925
import logging import os from mpi4py import MPI from collections import namedtuple from deephyper.evaluator.evaluate import Evaluator logger = logging.getLogger(__name__) WaitResult = namedtuple("WaitResult", ["active", "done", "failed", "cancelled"]) class MPIFuture: """MPIFuture is a class meant to track a pe...
StarcoderdataPython
1772344
from icevision.backbones.vgg import * from icevision.backbones.resnet import * from icevision.backbones.mobilenet import * import icevision.backbones.resnet_fpn import icevision.backbones.resnest_fpn
StarcoderdataPython
32457
<gh_stars>1-10 # -*- coding: utf-8 -*- from ..helpers import construct_similarity_matrix_via_profiles class SimilarityMatrix: def __init__(self, keywords, matrix): self.keywords = keywords self.matrix = matrix def construct_similarity_matrix(relevance_matrix, relevance_threshold=0.2): """ ...
StarcoderdataPython
3313735
<filename>examples/nonlinear-diffusion/plot_nonlinear_diffusion.py from numpy import * from os import listdir from os.path import join from scipy.interpolate import CubicSpline import matplotlib.pyplot as plt #read the output files fns = [fn for fn in listdir('out') if ('_t' not in fn and fn != 'x')] fns = sorted(fns,...
StarcoderdataPython
3342639
# coding: utf-8 import pandas as pd import csv import codecs import numpy import matplotlib.pyplot as plt import statsmodels.api as sm path = "/Users/margo/Downloads/Building_Permits.csv" data = pd.read_csv(path, encoding='utf-8') csvFile = codecs.open(path, 'r', 'utf-8') NominalAttribute = ['Permit Type', 'Block', '...
StarcoderdataPython
1751700
from django.db import models # Create your models here. class University(models.Model): UNIVERSITY_TYPE = ( ('private', 'private'), ('state', 'state'), ('federal', 'federal') ) full_name = models.CharField(max_length=300) nick_name = models.CharField(max_length=50) campus...
StarcoderdataPython
3370112
<reponame>eigeneddie/multibodydynamics<filename>functionScript3.py # Custom Functions import numpy as np from numpy.core.fromnumeric import argmin import pandas as pd def ATransformMatrix (theta): #A theta = float(theta) ATransform = np.array([[np.cos(theta), -np.sin(theta)], [np.s...
StarcoderdataPython
1620202
<reponame>lmaycotte/cloudroast """ Copyright 2013 Rackspace 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 agre...
StarcoderdataPython
3288221
<reponame>kyprifog/mason from typing import Optional, Tuple, Union from mason.clients.response import Response from mason.engines.scheduler.models.dags.client_dag import ClientDag from mason.engines.scheduler.models.dags.valid_dag import ValidDag from mason.clients.engines.scheduler import SchedulerClient from mason.c...
StarcoderdataPython
3249969
class Solution: def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]: values = dict() for index, num in enumerate(sorted(nums)): if num not in values: values[num] = index return [values[num] for num in nums]
StarcoderdataPython
1600015
#!/usr/bin/python # # Error code # NOELEMENT = -1 INVALIDFORMULAR = -2 IMASS = 0 ICHARGE = 1 IKAI = 2 ICOVR = 3 IIONR = 4 IATMR = 5 # # Reference: # mass: http://ours.be/sci/aw.php # electronegativity: http://cec.ecust.edu.cn/jpkc/lessons/chemPage/element1.htm # atomic radius: http://cec.ecust.edu.cn/jpkc/les...
StarcoderdataPython
43074
<reponame>DSAutomations/py-parsehub<filename>setup.py<gh_stars>10-100 from setuptools import find_packages, setup setup(name="py-parsehub", version="0.1", description="Python3 module for interaction with Parsehub API", author="<NAME>", author_email='<EMAIL>', platforms=["linux"], li...
StarcoderdataPython
105488
<gh_stars>0 from amaranth import * from ..soc.bus import NativeBusSlave class NativeMemory(NativeBusSlave): def __init__(self, *, size, is_ram, is_async=False) -> None: super().__init__() # TODO probably want to limit this to power-of-two instances if (size % 4) != 0: raise V...
StarcoderdataPython
105457
<filename>t3nsor/layers.py<gh_stars>1-10 import torch import numpy as np import torch.nn as nn import t3nsor as t3 class TTEmbedding(nn.Module): def __init__(self, init=None, shape=None, voc_size=None, emb_size=None, auto_shapes=...
StarcoderdataPython
3225142
# Copyright (c) Microsoft Corporation # All rights reserved. # # MIT License # # 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 ...
StarcoderdataPython
142614
#!/usr/bin/python # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License...
StarcoderdataPython
1720051
import numpy as np import matplotlib.pyplot as plt from qiskit import( QuantumCircuit, execute, Aer) from qiskit.visualization import plot_histogram from qiskit.tools.visualization import ( plot_state_city, plot_bloch_multivector) # Use Aer's qasm_simulator #simulator = Aer.get_backend('qasm_simulator') simu...
StarcoderdataPython
3311653
<reponame>oms1226/20180811_mstrading # coding:utf-8 class FidList(object): """ receiveChejanData() 이벤트 메서드로 전달되는 FID 목록 """ CHEJAN = { 9201: '계좌번호', 9203: '주문번호', 9205: '관리자사번', 9001: '종목코드', 912: '주문업무분류', 913: '주문상태', 302: '종목명', 900: '주문수량', ...
StarcoderdataPython
3274297
from __future__ import print_function from alignment.sequence import Sequence from alignment.vocabulary import Vocabulary from alignment.sequencealigner import SimpleScoring, GlobalSequenceAligner # Create sequences to be aligned. a = Sequence('what a beautiful day'.split()) b = Sequence('what a disappointingly bad d...
StarcoderdataPython
138706
# Generated by Django 3.0.3 on 2020-03-22 22:00 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('stocks', '0019_auto_20200323_0458'), ] operations = [ migrations.RemoveField( model_name='stockin', name='is_in', ), ...
StarcoderdataPython
1603163
from apex.transformer import parallel_state from apex.transformer.pipeline_parallel.utils import get_num_microbatches from apex.transformer.pipeline_parallel.schedules.fwd_bwd_no_pipelining import ( forward_backward_no_pipelining, ) from apex.transformer.pipeline_parallel.schedules.fwd_bwd_pipelining_with_interleav...
StarcoderdataPython
3228223
<gh_stars>1-10 """hearthstone_api.py file.""" from .hearthstone_game_data_api import HearthstoneGameDataApi class HearthstoneApi: """Hearthstone API class. Attributes: client_id: A string client id supplied by Blizzard. client_secret: A string client secret supplied by Blizzard. """ ...
StarcoderdataPython
32675
import re class Solution: def helper(self, expression: str) -> List[str]: s = re.search("\{([^}{]+)\}", expression) if not s: return {expression} g = s.group(1) result = set() for c in g.split(','): result |= self.helper(expression.replace('{' + g + '}', c, ...
StarcoderdataPython
3388175
""" Copyright (c) 2017, <NAME>. Distributed under the terms of the MIT License. The full license is in the file LICENSE, distributed with this software. Created on Nov 18, 2017 @author: jrm """ from atom.api import List, set_default from .bridge import JavaBridgeObject, JavaMethod, JavaField from .android_activity...
StarcoderdataPython
1689194
# Aalto University, School of Science # T-61.5140 Machine Learning: Advanced probabilistic Methods # Author: <EMAIL>, 2016 import copy import numpy as np class EM_algo(): """ A superclass for different EM-fitted models. """ def __init__(self, hyperparams, X=None, Y=None, ndata=0, pdata=0): ...
StarcoderdataPython
3371968
#!/usr/bin/python # Copyright (c) 2012, United States Government, as represented by the # Administrator of the National Aeronautics and Space Administration. # All rights reserved. # # The NASA Tensegrity Robotics Toolkit (NTRT) v1 platform is licensed # under the Apache License, Version 2.0 (the "License"); # you may...
StarcoderdataPython
82202
''' Redis Management Modules and Models ''' from flask import g, current_app from redis import Redis def get_redis_cur(store_g=False): ''' Open DB Cursor Connection Params ------- store_g : if True, store to Flask Global Object g. ''' redis_cur = Redis( host=current_app.config['RE...
StarcoderdataPython
1760028
<filename>internetradio/src/InternetRadioCover.py<gh_stars>10-100 # # InternetRadio E2 # # Coded by Dr.Best (c) 2012 # Support: www.dreambox-tools.info # E-Mail: <EMAIL> # # This plugin is open source but it is NOT free software. # # This plugin may only be distributed to and executed on hardware which # is licensed by...
StarcoderdataPython
1746220
from func_getBin import * from func_getKmap import * def reduceKmap( kmap ): forms = [ ] mask = kmap var = 4 x = 0 y = 0 ''' for line in mask: for cell in line: if( cell == 1 ): detectRectangle( kmap, mask, x, y, var, forms ) x = ( x + 1 ) % var y += 1 ''' detectRectangle( ...
StarcoderdataPython
3251243
import datetime from decimal import Decimal from django.contrib.auth.models import AnonymousUser from django.contrib.messages import get_messages from django.core.urlresolvers import reverse from django.test import TestCase, RequestFactory from simplestore.cart.models import Cart, CartItem from simplestore.cart.templ...
StarcoderdataPython
1653571
from typing import Union import discord DiscordUser = Union[discord.User, discord.Member]
StarcoderdataPython
1737179
<reponame>joeljgeo/landlab #! /usr/env/python """ flow_director_to_many.py provides a private class to help create FlowDirectors. Provides the _FlowDirectorToMany component which makes sure all model grid fields are set up correctly. """ from landlab import FieldError from landlab.components.flow_director.flow_direc...
StarcoderdataPython
3399905
from roomballot.methods import generate_times, BallotInProgressException from django.core.management.base import BaseCommand, CommandError class Command(BaseCommand): help = 'Generates times at which students will pick their room.' def handle(self, *args, **options): try: generate_times() ...
StarcoderdataPython
123116
#!/usr/bin/env python import io, re, argparse, os.path, sys import oyaml as yaml from distutils.spawn import find_executable bash_exe=find_executable('bash') helm_exe = os.environ.get("HELM_BIN","helm") debug = os.environ.get("HELM_DEBUG","false") namespace = os.environ.get("HELM_NAMESPACE","kube-system") context = os...
StarcoderdataPython
120611
<gh_stars>0 import numpy as np import uncertainties.unumpy as unp def center(): return None # or the arg-number of the center. def f(x, k, weight): """ The normal function call for this function. Performs checks on valid arguments, then calls the "raw" function. This function calculates p_k{x} = we...
StarcoderdataPython
1680529
<reponame>EliasGabrielsson/tdtool-improved.py #!/usr/bin/env python # ****************************************** # # Python wrapper for libtelldus on Linux # # Developed by <NAME> # (<EMAIL>) # # Released as is without any garantees on # functionality. # # ******************************************* import platform i...
StarcoderdataPython
3258739
<reponame>is-a-clam/IA-stock-app from django.urls import path from . import views app_name = "accounts" urlpatterns = [ path("login/", views.loginView, name="login"), path("login-set-cookie/", views.loginSetCookie, name="setCSRF"), path("logout/", views.logoutView, name="logout"), path("register/", vi...
StarcoderdataPython
3392132
from authservice.app import app # NOQA
StarcoderdataPython
4818750
import sys import numpy as np import pandas as pd from pandas.api.types import is_string_dtype from pandas.api.types import is_numeric_dtype # function to replace NaN with a blank string def f_replace_nan(df): dfs = df.fillna('') return dfs # function to groupby one column def f_groupby(df, cols, values): ...
StarcoderdataPython
3291205
from typing import Any, Dict, List, Tuple from pandas import DataFrame, merge, Int64Dtype from lib.pipeline import DataPipeline, DefaultPipeline, PipelineChain from pipelines._common.wikidata_pipeline import WikidataPipeline class GeographyPipelineChain(PipelineChain): schema: Dict[str, type] = { "key": ...
StarcoderdataPython
1702898
<reponame>fedorov-ao/Vintage-Extended-Support import sublime, sublime_plugin import os def is_legal_path_char(c): # XXX make this platform-specific? return c not in " \n\"|*<>{}[]()" def move_while_path_character(view, start, is_at_boundary, increment=1): while True: if not is_legal_path_char(view...
StarcoderdataPython
159612
# =============================================================================== # # Copyright (c) 2013-2017 Qualcomm Technologies, Inc. # All Rights Reserved. # Confidential and Proprietary - Qualcomm Technologies, Inc. # # =============================================================================== """ Create...
StarcoderdataPython
1791739
STATUS = { "PENDING": "pending", "WORKING": "working", "DONE": "done", "RUNNING": "running", "ERROR": "error", } RANKS = { "NOT_CRITICAL": "not_critical", "CRITICAL": "critical" }
StarcoderdataPython
145453
from __future__ import annotations from abc import ABC, abstractmethod import time from datetime import datetime import statistics class Subject(ABC): @abstractmethod def attach(self, observer: Observer): pass @abstractmethod def detach(self, observer: Observer): pass @abstractme...
StarcoderdataPython
173646
import unittest from meerk40t.kernel import Kernel state = 0 class TestLifeCycle(unittest.TestCase): def test_kernel_lifecycle(self): def lifecycle_test(obj=None, lifecycle=None): global state if lifecycle == "preregister": self.assertEquals(state, 0) ...
StarcoderdataPython
3264371
<filename>py/pysparkling/ml/features.py import py_sparkling.ml.features class ColumnPruner(py_sparkling.ml.features.ColumnPruner): pass
StarcoderdataPython
1768652
import os from flask import Flask from github_webhook import Webhook from worker import invoke from github import Github app = Flask(__name__) webhook = Webhook(app, secret=os.environ.get('SECRET', 'youvebeenmade')) g = Github(os.environ.get('GH_ACCESS_TOKEN', '')) org = g.get_organization(os.environ.get('GH_ORGANIZAT...
StarcoderdataPython
3255791
#!/usr/bin/env python # coding: utf-8 # In[5]: import pandas as pd import numpy as np from datetime import datetime import matplotlib.pyplot as plt import seaborn as sns import squarify import json pd.options.display.float_format = '{:,.2f}'.format # In[15]: import geopandas as gpd from bokeh.io import output_n...
StarcoderdataPython
1680038
# -*- coding: utf-8 -*- # --author-- lanhua.zhou """ 修改mesh shape名,统一产线 """ from __future__ import print_function import maya.cmds as cmds import logging def fix_mesh_name(post_fix_name, group_list = []): """修改shape名 :param post_fix_name: 修改的后缀名称 :param group_list: 组列表, 按组改名 :rtype: None """...
StarcoderdataPython
161555
<filename>tests/test_utils_user_management.py """Test dtool lookup server user management helper functions.""" from . import tmp_app # NOQA def test_user_management_helper_functions(tmp_app): # NOQA from dtool_lookup_server.utils import ( register_users, get_user_info, list_users, ...
StarcoderdataPython
4838626
from sys import * import csv reader = csv.DictReader(open('t.tab', 'r'), delimiter='\t') for item in reader: iturl = item.get('item') it = iturl[iturl.rfind('/')+1:] l = item.get('itemLabel') print('{}|Len|"{}"'.format(it, l.replace(';',',')))
StarcoderdataPython
123923
from unittest.mock import patch from panoramic.cli.husky.core.taxonomy.getters import Taxonomy from panoramic.cli.husky.service.types.api_data_request_types import InternalDataRequest from panoramic.cli.husky.service.utils.simple_taxon_manager import SimpleTaxonManager from panoramic.cli.husky.service.utils.taxon_slug...
StarcoderdataPython
116841
""" The :mod:`sklearnext.metrics.regressio` contains various metrics for regression tasks. """ # Author: <NAME> <<EMAIL>> # Licence: MIT import numpy as np from sklearn.metrics.regression import _check_reg_targets, check_consistent_length from sklearn.externals.six import string_types def weighted_mean_squared_erro...
StarcoderdataPython
1700394
class Polinomio(list): def __add__(self, other): """Overloaded Method Sum. Return the sum of itself and other polynomial.""" if len(self) > len(other): polinomio_solucion = self[:] for x in enumerate(other): polinomio_solucion[x] += other[x] else: ...
StarcoderdataPython
64849
# This sample tests annotated types on global variables. # This should generate an error because the declared # type below does not match the assigned type. glob_var1 = 4 # This should generate an error because the declared # type doesn't match the later declared type. glob_var1 = Exception() # type: str glob_var1 ...
StarcoderdataPython
1665318
<gh_stars>1-10 # -*- coding: utf-8 -*- # @Author: Nate # @Date: 2018-09-21 12:54:57 # @Last Modified by: Nate # @Last Modified time: 2021-12-12 15:54:23 import scrapy from cartoonmad.items import CartoonmadItem import os from scrapy.crawler import CrawlerProcess from custom_url import urls as custom_urls...
StarcoderdataPython
185903
import logging from logging import NullHandler __title__ = "lilili" __description__ = "List the Licenses of the Libraries." __url__ = "https://github.com/poyo46/lilili" __version__ = "0.1.0" __author__ = "poyo46" __author_email__ = "<EMAIL>" __license__ = "Apache-2.0" __copyright__ = "Copyright 2021 poyo46" # Set def...
StarcoderdataPython
4827935
<filename>test/testflows/helpers/cluster.py<gh_stars>1-10 import os import time import inspect import threading import tempfile import glob import testflows.settings as settings from testflows.core import * from testflows.asserts import error from testflows.connect import Shell as ShellBase from testflows.uexpect imp...
StarcoderdataPython
3288029
<gh_stars>100-1000 from collections import OrderedDict import math import torch import torch.nn.functional as F import torch.nn as nn from torch.utils import model_zoo import pdb import copy import numpy as np import modules from torchvision import utils import senet import resnet import densenet import net_mask clas...
StarcoderdataPython
3265198
import configparser import discord import re import os if os.path.isfile("config.ini"): with open("config.ini", mode="r", encoding="utf-8_sig") as cfg: config = configparser.ConfigParser() config.read_file(cfg) replacetext = config["main"].get("replacetext") token = config["main"][...
StarcoderdataPython
1706514
import pytest def test_envvar_parsing(): from mpi4jax._src.decorators import _is_falsy, _is_truthy assert _is_truthy("1") assert not _is_falsy("1") assert not _is_truthy("false") assert _is_falsy("false") assert not _is_truthy("foo") assert not _is_falsy("foo") def test_missing_omnist...
StarcoderdataPython
3322443
from jellycc.project.parser import parse_project from jellycc.project.project import Project from jellycc.utils.source import source_file import argparse import os parser = argparse.ArgumentParser( description="Generate lexer and parser from formal description" ) parser.add_argument('--lexer-header', dest='lexer_he...
StarcoderdataPython
1608091
<reponame>Dina-Avitan/bci4als<filename>src/bci4als/experiments/feedback.py import os import sys import time import tkinter from collections import namedtuple from typing import Dict from psychopy import visual import playsound # name tuple object for the progress bar params Bar = namedtuple('Bar', ['pos', 'line_size', ...
StarcoderdataPython
3246599
from typing import Optional import numpy from scipy.sparse import csr_matrix from scipy.special import expit from tqdm.auto import trange, tqdm from .matrix_factorization_base import MatrixFactorizationBase class BPR(MatrixFactorizationBase): def __init__( self, factors: int, lr: float, ...
StarcoderdataPython
1714801
<gh_stars>0 """Prepare VuaApp to be directly importable""" # Standard library imports # Third party imports # Local imports from .app import VueApp from .router_example import VueAppRouter __all__ = ["VueApp", "VueAppRouter"]
StarcoderdataPython
72929
import serial import paho.mqtt.client as mqtt import json from datetime import datetime from o2_helper import GetO2Voltage import numpy as np import socket ser = serial.Serial('/dev/ttyUSB0', 9600) ser.readline() ser.readline() THINGSBOARD_HOST = '192.168.0.200' ACCESS_TOKEN = socket.gethostname() client = mqtt.Clien...
StarcoderdataPython
141181
<filename>libc/tools/gensyscalls.py #!/usr/bin/python # # this tool is used to generate the syscall assmbler templates # to be placed into arch-x86/syscalls, as well as the content # of arch-x86/linux/_syscalls.h # import sys, os.path, glob, re, commands, filecmp, shutil from bionic_utils import * if sys.version_inf...
StarcoderdataPython
3327497
# -*- coding: utf-8 -*- """ Created on Sat Sep 21 14:27:16 2019 created as example for aglos assignment 1 @author: rlk268 """ #%% from ..havsim.simulation.simulationold import * from ..havsim.simulation.models import * import matplotlib.pyplot as plt import numpy as np #example of doing simulation and plotting t...
StarcoderdataPython
1425
<reponame>charlesemurray/DistributedProgramming class Message: def __init__(self, from_channel=None, **kwargs): self._channel = from_channel if kwargs is not None: for key, value in kwargs.items(): setattr(self, key, value) @property def carrier(self): re...
StarcoderdataPython
1748067
<reponame>vk-brain/kutana<gh_stars>10-100 import os from kutana.helpers import get_path, get_random_string, pick, pick_by, uniq_by def test_get_random_string(): assert len(get_random_string(4)) == 4 def test_get_path(): path = os.path.join(os.path.dirname(__file__), "bruh") assert get_path(__file__, "br...
StarcoderdataPython
3383786
<filename>source/_static/code/matrix.py """ Implementation of simple matrix """ def create(row_num, col_num, val = None): """ :param row_num: the number of rows :type row_num: int :param col_num: the number of columns :type col_num: int :param val: the default value to fill the matrix :type val: any (None by ...
StarcoderdataPython
1429
<filename>launcher/src/main/scripts/bin/launcher.py #!/usr/bin/env python import errno import os import platform import sys import traceback from fcntl import flock, LOCK_EX, LOCK_NB from optparse import OptionParser from os import O_RDWR, O_CREAT, O_WRONLY, O_APPEND from os.path import basename, dirname, exists, rea...
StarcoderdataPython
4815873
# C = M^e mod n # you must number type quadruple e = int(input("Enter the value 'e' : ")) n = int(input("Enter the value 'n' : ")) numberQuadruple = int(input("Number of blocks with four : ")) i=0 answer=[] while(i<numberQuadruple): Quadruple = int(input("Enter the {}. quadr...
StarcoderdataPython
1632471
<filename>tests/integration/test_storage_s3/s3_mocks/unstable_server.py import http.server import random import re import socket import struct import sys def gen_n_digit_number(n): assert 0 < n < 19 return random.randint(10**(n-1), 10**n-1) def gen_line(): columns = 4 row = [] def add_number():...
StarcoderdataPython
3236104
<gh_stars>10-100 import _pickle as cPickle import numpy as np import os from os import walk import pandas as pd import collections from sklearn.model_selection import train_test_split from e2efold.common.utils import get_pairings dataset = 'rnastralign' rna_types = ['tmRNA', 'tRNA', 'telomerase', 'RNaseP', 'SRP',...
StarcoderdataPython
179456
from django.dispatch import Signal """ When an xform is received, either from posting or when finished playing. """ xform_received = Signal(providing_args=["form"]) """ When a form is finished playing (via the SMS apis) """ sms_form_complete = Signal(providing_args=["session_id", "form"])
StarcoderdataPython
98463
import json from os.path import join from tarfile import TarFile from enot.action import action_factory from enot.action.release import Release from enot.compiler.compiler_type import Compiler from enot.packages.config.config import ConfigFile, get_dep_info_from_hex from enot.packages.dep import Dep from enot.utils.fi...
StarcoderdataPython
3275243
#!/usr/bin/env python # -*- coding: utf-8 -*- import time #Library for the delay import termios time.sleep(4) #Wait for Arduino to boot port = '/dev/ttyUSB0' f = open(port) attrs = termios.tcgetattr(f) attrs[2] = attrs[2] & ~termios.HUPCL termios.tcsetattr(f, termios.TCSAFLUSH, attrs) f.close()
StarcoderdataPython
3204461
<gh_stars>0 # Generated by Django 3.2.6 on 2021-08-24 07:56 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('landingzones', '0007_update_jsonfields'), ] operations = [ migrations.AddField( model_name='landingzone', ...
StarcoderdataPython
1674570
<filename>src/markform/convert_text.py from helpers import create_html from helpers.parse_line import parse_line def convert_text(markform_text): input_lines = markform_text.split("\n") output_segments = [] # Convert document line by line. for line in input_lines: # Call functi...
StarcoderdataPython
1735646
# Extruder / Filament functions import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk from octopyclient.utils import * from octopyclient.common import CommonPanel, Singleton, BackgroundTask from octopyclient.igtk import * from .temperature import TemperaturePanel, EXTRUDE_MIN_TEMP class ExtrudePa...
StarcoderdataPython
23676
import logging from os.path import expanduser, join from unittest import mock import pytest from click.testing import CliRunner from configparser import ConfigParser from apparate.configure import configure from apparate.cli_commands import upload, upload_and_update logging.basicConfig(level=logging.INFO) logger = ...
StarcoderdataPython
3343136
<filename>indra/benchmarks/bioprocesses/__main__.py<gh_stars>100-1000 from __future__ import absolute_import, print_function, unicode_literals import sys from indra.benchmarks.bioprocesses import analyze if __name__ == '__main__': # Get the command line args if len(sys.argv) < 2: print("Usage: %s stmts...
StarcoderdataPython
4839988
from .arq import ARQ, Arq, GenericApiError, InvalidApiKey __all__ = ["Arq", "ARQ", "InvalidApiKey", "GenericApiError"]
StarcoderdataPython
3307809
<gh_stars>1000+ # Copyright 1996-2021 Cyberbotics Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
StarcoderdataPython
86296
<gh_stars>1-10 ''' Created on 2016年2月8日 @author: Darren ''' ''' Greedy Gift Givers A group of NP (2 ≤ NP ≤ 10) uniquely named friends has decided to exchange gifts of money. Each of these friends might or might not give some money to any or all of the other friends. Likewise, each friend might or might not receive mo...
StarcoderdataPython
109482
<gh_stars>0 def valid_palindrome(str): left, right = 0, len(str) - 1 while left < right: if not str[left].isalnum(): left += 1 elif not str[right].isalnum(): right -= 1 else: if str[left].lower() != str[right].lower(): print('False'...
StarcoderdataPython
1710330
from .util import * ## unify function that will bind variables in the search to their counterparts in the tree ## it takes two pl_expr and try to match the uppercased in lh or lh.domain with their corresponding ## values in rh itself or its domain def unify(lh, rh, lh_domain = None, rh_domain = None): if rh_domain...
StarcoderdataPython
1670777
<reponame>FredyJoelSis/herokuapi<gh_stars>10-100 from webob import Response as WebobResponse class Response(WebobResponse): """ Extended response object. """ pass
StarcoderdataPython
3317749
<filename>tests/lists_tests/test_copy.py from hypothesis import given from tests.utils import (AlternativeNativeListsPair, are_alternative_native_lists_equal) from . import strategies @given(strategies.lists_pairs) def test_basic(pair: AlternativeNativeListsPair) -> None: alternative, na...
StarcoderdataPython
1755551
<gh_stars>100-1000 #!/usr/bin/env python # Copyright (c) 2011 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. """ This module is a simple qa tool that installs extensions and tests whether the browser crashes while visitin...
StarcoderdataPython
1749069
from rest_framework.decorators import action from rest_framework.response import Response from django_log_entry_audit.models import LogEntry from django_log_entry_audit.serializers import LogEntrySerializer class HistoryViewSetMixin: @action(detail=True, methods=["get"]) def history(self, request, pk=None): ...
StarcoderdataPython
4819312
#!/usr/bin/env python # # Distributed under the OSI-approved Apache License, Version 2.0. See # accompanying file Copyright.txt for details. # # TestBPWriteTypes.py: test Python numpy types in ADIOS2 File Write # Created on: Feb 2, 2017 # Author: <NAME> <EMAIL> from adios2NPTypes import SmallTestData import a...
StarcoderdataPython