id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
1712127
S = input() match = int(S.replace('/','')) if 20190430 >= match: print('Heisei') else: print('TBD')
StarcoderdataPython
29178
#!/usr/bin/env python from __future__ import print_function import sys import serial import time from math import sin, cos, pi import argparse import ast from comms import * from boards import * from livegraph import livegraph if __name__ == '__main__': parser = argparse.ArgumentParser(description='Drive motor m...
StarcoderdataPython
3230907
<filename>tests/test_06_math/test_608_intersection_line_line_2d.py # Copyright (c) 2020 <NAME> # License: MIT License import pytest from ezdxf.math import intersection_line_line_2d, Vec2 def vec2(x, y): return Vec2((x, y)) def test_intersect_virtual(): ray1 = (vec2(10, 1), vec2(20, 10)) ray2 = (vec2(17,...
StarcoderdataPython
3332833
<reponame>mmendez3800/web-crawler-scraper from rtypes import pcc_set, dimension, primarykey @pcc_set class Register(object): crawler_id = primarykey(str) load_balancer = dimension(tuple) fresh = dimension(bool) invalid = dimension(bool) def __init__(self, crawler_id, fresh): self.crawler_...
StarcoderdataPython
1606736
""" Unit test for selection operators. """ import random from math import nan import numpy as np import pytest from leap_ec import Individual from leap_ec import ops, statistical_helpers from leap_ec.binary_rep.problems import MaxOnes from leap_ec.data import test_population from leap_ec.real_rep.problems import ...
StarcoderdataPython
85079
from gusto import * from firedrake import (IcosahedralSphereMesh, cos, sin, SpatialCoordinate, FunctionSpace) import sys dt = 900. day = 24.*60.*60. if '--running-tests' in sys.argv: tmax = dt else: tmax = 14*day refinements = 4 # number of horizontal cells = 20*(4^refinements) R = 63...
StarcoderdataPython
3242033
"""preactresnet in pytorch [1] <NAME>, <NAME>, <NAME>, <NAME> Identity Mappings in Deep Residual Networks https://arxiv.org/abs/1603.05027 """ import torch import torch.nn as nn import torch.nn.functional as F class SepConv(nn.Module): def __init__(self, channel_in, channel_out, kernel_size=3, stride=2...
StarcoderdataPython
3251443
<filename>08.Graph/TSP.py #input # 4 9 # 0 1 2 # 1 0 1 # 0 2 9 # 1 2 6 # 2 1 7 # 1 3 4 # 3 1 3 # 3 0 6 # 2 3 8 def pprint(arr): for line in arr: print(line) N, M = map(int, input().split(" ")) W = [[0] * N for _ in range(N)] D = [] for _ in range(M): v1, v2, cost = map(int, input().split(" ")) W[v...
StarcoderdataPython
3344750
<gh_stars>10-100 class Solution(object): def isPalindrome(self, x: int) -> bool: if x < 0: return False b = int(str(x) [::-1]) if b == x: return True return False
StarcoderdataPython
1625449
def metodogauss(A, n, b): for k in range(n - 1): for i in range(k + 1, n): m = ((-1) * A[i][k]) / A[k][k] for j in range(k, n): A[i][j] = A[i][j] + m * A[k][j] b[i] = b[i] + m * b[k] return A, b def read_a(A, n): for i in range(0, n): fo...
StarcoderdataPython
4806833
<gh_stars>1-10 import numpy as np from matplotlib.colors import ListedColormap def psf_lut(): """ PSF LUT created by <NAME> Fiji. """ colors = [ [255, 0, 0], [249, 5, 2], [243, 10, 4], [237, 16, 6], [231, 21, 8], [226, 26, 10], [220, 32, 13], ...
StarcoderdataPython
1738010
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
StarcoderdataPython
1603403
<gh_stars>1-10 from elasticsearch_dsl import Text from document.base import BaseDocument class ConnectionDocument(BaseDocument): """Represents an connection between execution environments and network links.""" # id already defined by Elasticsearch exec_env_id = Text(required=True) network_lin...
StarcoderdataPython
4817727
import numpy as np import pycollo class BackendMock: def __init__(self, ocp): self.ocp = ocp ocp = pycollo.OptimalControlProblem("Dummy OCP") ocp.settings.quadrature_method = "gauss" # ocp.settings.quadrature_method = "lobatto" backend = BackendMock(ocp) quadrature = pycollo.quadrature.Quadrature(back...
StarcoderdataPython
1708381
<filename>tests/test_zfs.py import os import unittest from zfs_uploader.config import Config from zfs_uploader.zfs import (create_filesystem, create_snapshot, destroy_filesystem, destroy_snapshot, open_snapshot_stream, open_snaps...
StarcoderdataPython
102949
s=input() if s[-1] in '24579': print('hon') elif s[-1] in '0168': print('pon') else: print('bon')
StarcoderdataPython
39110
from flask import Flask, jsonify, request, render_template from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate app = Flask(__name__) app.config['CUSTOM_VAR'] = 5 app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///web_app.db' db = SQLAlchemy(app) migrate = Migrate(app, db) class User(db.Model)...
StarcoderdataPython
1757776
from itertools import product # 入力 H, W = map(int, input().split()) c = [list(map(int, input().split())) for _ in range(10)] A = [list(map(int, input().split())) for _ in range(H)] # 整数 i を 0 に書き換えるのに必要な魔力の最小量を求める G = [{} for _ in range(10)] for i, j in product(range(10), repeat=2): G[i][j] = c[i][j] INF = 10**10...
StarcoderdataPython
133074
<reponame>bozbil/Diffie-Hellman-and-RC4 #kahramankostas #Lab_Assignment_2.py ################COMBINED LINEAR CONGRUENTIAL GENERATOR ########### import random m_1 = 2147483563 m_2 = 2147483399 a_1 = 40014 a_2 = 20692 y_1 = (random.randint(1, m_1 - 1)) y_2 = (random.randint(1, m_1 - 1)) one_time_private_ke...
StarcoderdataPython
3390208
# Generated by Django 2.2.5 on 2019-11-03 23:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('libros', '0003_auto_20191026_1059'), ] operations = [ migrations.AlterField( model_name='pagina', name='numero', ...
StarcoderdataPython
106324
print("welcome to SBI bank ATM") restart=('y') chances = 3 balance = 1000 while chances>0: restart=('y') pin = int(input("please enter your secret number")) if pin == 1234: print('you entered your pin correctly\n') while restart not in ('n','N','no','NO'): print('press ...
StarcoderdataPython
4836572
# -*- coding: utf-8 -*- # # Copyright (C) 2013-2014 <NAME> # # The following terms apply to all files associated # with the software unless explicitly disclaimed in individual files. # # The authors hereby grant permission to use, copy, modify, distribute, # and license this software and its documentation for any purpo...
StarcoderdataPython
189023
<filename>TrackingTools/GeomPropagators/python/AnyDirectionAnalyticalPropagator_cfi.py import FWCore.ParameterSet.Config as cms AnyDirectionAnalyticalPropagator = cms.ESProducer("AnalyticalPropagatorESProducer", MaxDPhi = cms.double(1.6), ComponentName = cms.string('AnyDirectionAnalyticalPropagator'), Prop...
StarcoderdataPython
3363995
from copy import copy import pytest from mock import mock, patch from tweet.bills import Bills from tweet.conftest import EXAMPLE_INTRODUCTIONS from tweet.ocd_api import BillsRequestParams, BillsAPI from tweet.query import get_new_introductions, filter_already_exists, filter_missing_date, save_introductions @pytest...
StarcoderdataPython
1799753
<reponame>Data-Science-in-Mechanical-Engineering/vision-based-furuta-pendulum """ Examples for calibrating the real Qube to a theta of 0. @Author: <NAME> """ from gym_brt.control import calibrate, QubeFlipUpControl from gym_brt.envs.reinforcementlearning_extensions.wrapper import CalibrationWrapper from gym_brt.envs i...
StarcoderdataPython
3311236
from django.shortcuts import render def index(req): return render( req, "accounts/index2.html")
StarcoderdataPython
1602899
<gh_stars>1-10 import pytest import sys sys.path.append('../') from codemaker import CodeMaker # NOQA @pytest.fixture def codemaker_player(): return CodeMaker() def test_code_generation(codemaker_player): """ 1. Test if the length of code is correct 2. Test if all the elements of the code belong t...
StarcoderdataPython
161324
import torch from tools.engine import Engine from tools.config import use_cuda class GMF(torch.nn.Module): def __init__(self, config): super(GMF, self).__init__() self.num_users = config['num_users'] self.num_items = config['num_items'] self.latent_dim = config['latent_dim'] ...
StarcoderdataPython
1722676
"""Main module.""" from collections import deque, defaultdict import json from typing import AnyStr, Dict class ListNode: def __init__(self, x): self.val = x self.next = None class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None clas...
StarcoderdataPython
4836092
# -*- coding: utf-8 -*- from __future__ import unicode_literals from collections import defaultdict from django.utils.translation import ugettext_lazy as _ from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from aldryn_people import models, forms, DEFAULT_APP_NAMESPACE from .utils im...
StarcoderdataPython
3222149
<gh_stars>1-10 def box_print(string_array): width = max(*map(len, string_array)) print("*"*(width+4)) [print_fix_width(x, width) for x in string_array] print("*"*(width+4)) def print_fix_width(string, size): print(f'* {string}{" "*(size - len(string))} *') if __name__ == '__main__': ...
StarcoderdataPython
1694999
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' @Author: Adam @Date: 2020-04-17 14:07:14 @LastEditTime: 2020-04-17 14:19:53 @LastEditors: Please set LastEditors @Description: In User Settings Edit @FilePath: /LearnPython/web/hello.py ''' def application(environ, start_response): start_response('200 OK',[('Conten...
StarcoderdataPython
134943
<filename>rl/utils/return_utils.py import torch from torch import Tensor __all__ = ['compute_return', 'compute_gae_return'] def compute_return( rewards: Tensor, terminals: Tensor, bootstrap_value: Tensor, discount_rate: float, batch_first: bool = False) -> Tensor: """Compu...
StarcoderdataPython
1608423
# Software License Agreement (BSD License) # # Copyright (c) 2010, <NAME>, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyri...
StarcoderdataPython
3231643
<reponame>kwanhur/leetcode<gh_stars>0 #! /usr/bin/env python # _*_ coding:utf-8 _*_ def revert(str): if not str or len(str) == 1: return str i, base, s = -1, -len(str), '' while True: s += str[i] i -= 1 if i < base: break return s def revert_iterator(str)...
StarcoderdataPython
3207784
<reponame>B-ROY/TESTGIT<filename>app/customer/models/chat.py # coding=utf-8 from django.db import models import logging import datetime from wi_model_util.imodel import * from mongoengine import * from base.settings import CHATPAMONGO from app.util.messageque.msgsender import MessageSender from app.customer.models.use...
StarcoderdataPython
1630252
"""HandleImport transformation takes care of importing user-defined modules.""" from pythran.passmanager import Transformation from pythran.tables import MODULES, pythran_ward from pythran.syntax import PythranSyntaxError import gast as ast import logging import os logger = logging.getLogger('pythran') def add_file...
StarcoderdataPython
3240889
from markdown.test_tools import TestCase from cell_row_span import CellRowSpanExtension class colspan(TestCase): def runTest(self): src = self.dedent(""" c11 | c12 | c13 ----|-----|----- c21 || c22 c31 | c32 | c33 """) exp = self.dedent(""" <tab...
StarcoderdataPython
1732188
<filename>jplib/ocr.py #!/usr/bin/env python3 """ OCR with the Tesseract engine from Google this is a wrapper around pytesser (http://code.google.com/p/pytesser/) # from jabbapylib.ocr import ocr """ from jplib import config as cfg from jplib.process import get_simple_cmd_output TEST_DIR = cfg.TEST_ASSETS_DIR + '/o...
StarcoderdataPython
953
<filename>store/adminshop/templatetags/admin_extras.py # -*- coding: utf-8 -*- # @Author: <NAME> <valle> # @Date: 27-Aug-2017 # @Email: <EMAIL> # @Filename: admin_extras.py # @Last modified by: valle # @Last modified time: 02-Feb-2018 # @License: Apache license vesion 2.0 from django import template from django....
StarcoderdataPython
86590
#!/usr/bin/env python3 """ This script is used for course notes. Author: <NAME> Date: 01/06/2020 """ import psutil def check_cpu_usage(percent): usage = psutil.cpu_percent(1) print("DEBUG: usage: {}".format(usage)) return usage < percent if not check_cpu_usage(75): print("ERROR! CPU is overloaded...
StarcoderdataPython
1631618
<filename>poky-dunfell/meta/lib/oeqa/runtime/cases/_qemutiny.py<gh_stars>10-100 # # SPDX-License-Identifier: MIT # from oeqa.runtime.case import OERuntimeTestCase class QemuTinyTest(OERuntimeTestCase): def test_boot_tiny(self): status, output = self.target.run_serial('uname -a') msg = "Cannot det...
StarcoderdataPython
3208185
<filename>Downsize_Update/ledapp/ledapp.py import serial, time, datetime from datetime import timedelta from flask import Flask, render_template, request, jsonify app = Flask(__name__) @app.route("/") def hello(): global hardware hardware=1 global on on=False if 'ser' not in locals(): global...
StarcoderdataPython
3326818
from django.contrib.auth.models import AbstractUser from django.db import models from django.urls import reverse from django.utils.translation import ugettext_lazy as _ class User(AbstractUser): # First Name and Last Name do not cover name patterns # around the globe. name = models.CharField(_("Name of Us...
StarcoderdataPython
1309
import os import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import numpy as np import matplotlib.pyplot as plt # local model import sys sys.path.append("../network") import Coral from lstm import LSTMHardSigmoid from AdaBN import AdaBN sys.path.append("../network/Aut...
StarcoderdataPython
1694781
<filename>src/packageschema/schema.py<gh_stars>1-10 """This contains all schema related bits of packageschema. This serves a dual-purpose: 1. It has the versioned schema that validates the ``packageschema.yaml`` files. 2. It reads and parses the ``packageschema.yaml`` files. As a result, there are a ...
StarcoderdataPython
16052
import time from annotypes import Anno, add_call_types from malcolm.core import PartRegistrar from malcolm.modules import builtin # Pull re-used annotypes into our namespace in case we are subclassed APartName = builtin.parts.APartName AMri = builtin.parts.AMri with Anno("The demand value to move our counter motor ...
StarcoderdataPython
1723435
from utils.bert_utils import get_bert_layer_representations import time as tm import numpy as np import torch import os import argparse def save_layer_representations(model_layer_dict, model_name, seq_len, save_dir): for layer in model_layer_dict.keys(): np.save('{}/{}_length...
StarcoderdataPython
1615352
import unittest import os import subprocess import socket import json import sys bin_path = os.path.join(os.getcwd(), "..", "..", "bin") if os.name == "nt": client = os.path.join(bin_path, "Debug", "client.exe") else: client = os.path.join(bin_path, "client") address = "localhost" port = 5750 def convert(val): ...
StarcoderdataPython
42284
#!/usr/bin/env python import glob import os import shutil import subprocess import uuid def renameFiles(tooldir, dadir, fromnames, toname): "Recursively replace file names and contents." tooldir = os.path.join('..', tooldir) os.chdir(dadir) for fromname in fromnames: fromspaced = "".join([x if x.islower() else ...
StarcoderdataPython
3251670
<filename>UC. Curso em Aula II/A1D5.py n1 = float(input('Digite a sua 1 nota: ')) n2 = float(input('Digite a sua 2 nota: ')) media = (n1+n2)/2 if media < 5.1: print('Reprovado') elif media > 6.9: print('Aprovado') else: print('Recuperação')
StarcoderdataPython
4834391
from __future__ import absolute_import from __future__ import print_function import math import functools from collections import OrderedDict import veriloggen.core.vtypes as vtypes import veriloggen.types.axi as axi from veriloggen.fsm.fsm import FSM from veriloggen.optimizer import try_optimize as optimize from .t...
StarcoderdataPython
1787079
<gh_stars>0 import os from boogie.configurations.tools import module_exists from .paths import PathsConf class TemplatesConf(PathsConf): """ Configure templates. """ def get_templates(self): templates = [self.DJANGO_TEMPLATES, self.JINJA_TEMPLATES] return [x for x in templates if x] ...
StarcoderdataPython
1752735
import numpy as np import torch def generate_eom(q, qdot): M = np.array([ [5/3 + np.cos(q[1]), 1/3 + 1/2*np.cos(q[1])], [1/3 + 1/2*np.cos(q[1]), 1/3 ] ]) c = np.array([ [-1/2*(2*qdot[0]*qdot[1] + qdot[1]**2)*np.sin(q[1])], [1/2*(qdot[0]**2)*np.sin(q[1])] ...
StarcoderdataPython
1678527
from typing import Optional from fastapi.encoders import jsonable_encoder from .models import Conversation, ConversationCreate, ConversationUpdate def get(*, db_session, conversation_id: int) -> Optional[Conversation]: """Returns a conversation based on the given conversation id.""" return db_session.query(...
StarcoderdataPython
3218343
<filename>crypto_trading/algo/security.py import json import logging from . import model from . import utils class Security(object): """Class to thread hold to sell when the lost in a transaction is too high.""" def __init__(self, config_dict): """Class Initialisation.""" logging.debug(''...
StarcoderdataPython
3384070
<filename>test_to_padding.py import cv2 import os import numpy as np #coding=utf-8 def get_file_name(path): file_list=[] for root, dirs, files in os.walk(path, topdown=False): for file in files: #full_file=os.path.join(root,file) file_list.append(file) return file_list if _...
StarcoderdataPython
1733790
<filename>cdk/infrastructure/stages/dev.py import aws_cdk as cdk from constructs import Construct from infrastructure.constructs.existing import igvf_dev from infrastructure.config import Config from infrastructure.stacks.backend import BackendStack from infrastructure.stacks.postgres import PostgresStack from typi...
StarcoderdataPython
63092
<filename>libft/regularizers/__init__.py from libft.regularizers.l1 import L1 from libft.regularizers.l1l2 import L1L2 from libft.regularizers.l2 import L2 from libft.regularizers.regularizer import Regularizer REGULARIZERS = { 'l1': L1, 'l2': L2, 'l1l2': L1L2, } def get(identifier, **kwargs): """Regu...
StarcoderdataPython
3263230
<reponame>AllenInstitute/OpenScope_CA_Analysis """ corr_analys.py This script contains functions for USI correlation analysis. Authors: <NAME> Date: January, 2021 Note: this code uses python 3.7. """ import copy import logging import numpy as np import pandas as pd from sklearn.linear_model import LinearRegressio...
StarcoderdataPython
3227230
<reponame>gowtham3105/guardAIns-environment import random import time from Action import Action from Cells.Beast import Beast from Cells.Cell import Cell from Cells.Clue import Clue from Cells.HealPoint import HealPoint from Cells.Teleporter import Teleporter # from Cells.Cell import Cell from Feedback import Feedback...
StarcoderdataPython
72639
<reponame>PaulRaid/H-index-prediction<gh_stars>0 import networkx as nx import pandas as pd import argparse import progress_bar as pb pb.init(1, _prefix="Refactoring metrics \t \t") parser = argparse.ArgumentParser( description="GCN") parser.add_argument("edge_index") parser.add_argument("author_abstract_count") p...
StarcoderdataPython
147485
<filename>fluentcheck/tests/tests_is/test_collections_is.py import unittest from fluentcheck import Is from fluentcheck.exceptions import CheckError # noinspection PyStatementEffect class TestIsCollectionsAssertions(unittest.TestCase): def test_is_set_pass(self): obj = set() self.assertIsInstanc...
StarcoderdataPython
3296611
<filename>FunUQ/qoi.py # FunUQ v0.1, 2018; <NAME>; Strachan Research Group # https://github.rcac.purdue.edu/StrachanGroup # import general import sys, os, subprocess, shutil, numpy as np from random import random, sample; from glob import glob from matplotlib import pyplot as plt from copy import deepcopy # import lo...
StarcoderdataPython
3343439
<filename>apispec_oneofschema/plugin.py # apispec-oneofschema - Plugin for apispec providing support for # Marshmallow-OneOfSchema schemas # Copyright (C) 2019 <NAME> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public Lice...
StarcoderdataPython
109139
<filename>docs/structs/small.py f = open('graph.dot') def find_between( s, first, last ): try: start = s.index( first ) + len( first ) end = s.index( last, start ) return s[start:end] except ValueError: return "" s1 = "digraph " s2 = """ { graph [ rankdir="RL" ] """ s3 = "}" ...
StarcoderdataPython
3382227
<reponame>umairwaheed/scrapy-do #------------------------------------------------------------------------------- # Author: <NAME> <<EMAIL>> # Date: 26.11.2017 # # Licensed under the 3-Clause BSD License, see the LICENSE file for details. #-------------------------------------------------------------------------------...
StarcoderdataPython
3393076
<filename>models/database.py #!/usr/local/bin/python # -*- coding: utf-8 -*- # Database Connection model import MySQLdb as mdb class MySQL_DB(): def __init__(self): self.connection = mdb.connect(host='localhost', user='root', passwd='', db='con_science_bot') self.cur = self.connection.cursor...
StarcoderdataPython
111326
# Assignment 1 # CSC 486 - Spring 2022 # Author: Dr. <NAME> # Purpose: to test your installation of PyCharm and make sure some of our common # libraries are installed and working correctly. import networkx import matplotlib.pyplot as plt def main(): # Draws a complete graph of 10 nodes, then presents it on the ...
StarcoderdataPython
1781793
from django.contrib.auth.models import Group as AbstractGroup from django.core.validators import RegexValidator from django.db import models from organizations.abstract import ( AbstractOrganization, AbstractOrganizationInvitation, AbstractOrganizationOwner, AbstractOrganizationUser, ) from openwisp_us...
StarcoderdataPython
3254815
<gh_stars>0 # Mth To Last elements # # https://www.codeeval.com/open_challenges/10/ # # Challenge Description: Write a program which determines the Mth to the last # element in a list. import sys input_file = sys.argv[1] try: test_cases = open(input_file, 'r') except IOError: print('No such file ' + input_fi...
StarcoderdataPython
1686138
<filename>py/kubeflow/kfctl/testing/pytests/jupyter_test.py<gh_stars>10-100 """Test jupyter custom resource. This file tests that we can create notebooks using the Jupyter custom resource. It is an integration test as it depends on having access to a Kubeflow cluster with the custom resource test installed. We use the ...
StarcoderdataPython
1690719
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # iterative bfs class Solution: def maxDepth(self, root: TreeNode) -> int: level = 0 q = collections.deque([root]) if root else None ...
StarcoderdataPython
1673745
<gh_stars>0 #!/usr/bin/env python # -*- coding:utf-8 -*- __author__ = '<NAME><<EMAIL>>' import uuid import json def pack_outgoing_message_to_nest(pattern, data): ''' put pattern and data in correct format message format, refer to https://stackoverflow.com/questions/55628093/use-socket-client-with-nestj...
StarcoderdataPython
128456
__author__ = 'jhlee' import cPickle import numpy as np import csv import sys import time import os.path EVENT = {'Ev101': 1, 'Ev102': 2, 'Ev103': 3, 'Ev104': 4, 'Ev105': 5, 'Ev106': 6, 'Ev107': 7, 'Ev108': 8, 'Ev109': 9, 'Ev110': 0} RATIO = {'Training': 0, 'Test': 1} class YLIMED(): def __init__(self, pathInfo, ...
StarcoderdataPython
44462
<gh_stars>1-10 #!/usr/bin/env python import os import sys from box import Box import numpy as np import torch import gym from model import Model from trainer import Trainer def print_config(config, d=0): tabs = ' ' * d * 4 for k in config.keys(): if isinstance(config[k], Box): print('{}...
StarcoderdataPython
1668172
<filename>eCommerce/store/views.py from django.shortcuts import render, redirect, get_object_or_404 from django.contrib.auth.decorators import login_required from django.contrib import messages from django.contrib.auth.models import User from django.views.decorators.http import require_POST from django.http import Http...
StarcoderdataPython
186983
# SPDX-FileCopyrightText: 2021 Division of Intelligent Medical Systems, DKFZ # SPDX-FileCopyrightText: 2021 <NAME> # SPDX-License-Identifier: MIT import simpa as sp import numpy as np def create_custom_absorber(): wavelengths = np.linspace(200, 1500, 100) absorber = sp.Spectrum(spectrum_name="random absorber...
StarcoderdataPython
32181
<reponame>maojanlin/gAIRRsuite<gh_stars>1-10 import argparse import pickle import os import numpy as np #from parse_contig_realign import mark_edit_region, variant_link_graph, haplotyping_link_graph, output_contig_correction from parse_contig_realign import variant_link_graph, output_contig_correction, parse_CIGAR, par...
StarcoderdataPython
4818285
__author__ = 'mla' # import pymysql.cursors # 2 import mysql.connector # 3 from fixture.db import DbFixture # 4 SPRAWDZAMY ORM dla groups from fixture.orm import ORMFixture # 5 SPRAWDZAMY ORM dla contacts # 6 SPRAWDZAMY ORM dla contacts in group from model.group import Group # 7 SPRAWDZAMY ORM dla get_contac...
StarcoderdataPython
3326952
<reponame>khchine5/lino """ Deserves documentation. """ #~ import lino.changes #~ from lino.utils import gendoc #~ print [unicode(e) for e in gendoc.ENTRIES_LIST]
StarcoderdataPython
180312
<gh_stars>1-10 # Copyright 2021 The NPLinker Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
StarcoderdataPython
1795333
from query_filter_builder import v0_to_v01 def test_v0_to_v1(): v0_object = { "col1": "asd", "col2": "~asd", "col3": [1, 2, 3], "col4": "<5>=3.2" } correct_v1_object = { "version": 0.1, "filters": [ { "col": "col1", ...
StarcoderdataPython
14148
<filename>rnacentral_pipeline/rnacentral/r2dt/should_show.py # -*- coding: utf-8 -*- """ Copyright [2009-2021] EMBL-European Bioinformatics Institute 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 ...
StarcoderdataPython
1605325
#coding=utf-8 import requests import argparse parser = argparse.ArgumentParser(description="Zhihu_markdown_eq_converter") parser.add_argument("--file", help="your md file path", default="rl.md") args = parser.parse_args() with open(args.file, 'r', encoding='utf-8') as f: data = f.readlines() data_st...
StarcoderdataPython
3332044
import time from datetime import date # Third-Party from algoliasearch_django.decorators import disable_auto_indexing from openpyxl import Workbook from openpyxl.writer.excel import save_virtual_workbook from phonenumber_field.validators import validate_international_phonenumber # Django from django.apps import apps ...
StarcoderdataPython
3301400
import numpy as np from matplotlib.axes import Axes def align_yaxis(ax1: Axes, ax2: Axes) -> None: """Align zeros of the two axes, zooming them out by same ratio.""" axes = np.array([ax1, ax2]) extrema = np.array([ax.get_ylim() for ax in axes]) tops = extrema[:, 1] / (extrema[:, 1] - extrema[:, 0]) ...
StarcoderdataPython
1705346
import logging from pytorch_pretrained_bert import BertTokenizer logger = logging.getLogger(__name__) def get_tokenizer(tokenizer_name): logger.info(f"Loading Tokenizer {tokenizer_name}") if tokenizer_name.startswith("bert"): do_lower_case = "uncased" in tokenizer_name tokenizer = BertToken...
StarcoderdataPython
180945
<gh_stars>0 """ Provides models and utilities for displaying different types of Twitter feeds. """ from mezzanine import __version__
StarcoderdataPython
1696758
<gh_stars>0 from django.db import models # Create your models here. class Program(models.Model): key = models.IntegerField(primary_key=True) class KeywordManager(models.Manager): def keyword_array(self): return self.all().distinct().values_list("text", flat=True) class Keyword(models.Model): p...
StarcoderdataPython
3303573
<filename>meine_stadt_transparent/settings/__init__.py import json import logging import os import subprocess import warnings from importlib.util import find_spec from logging import Filter, LogRecord from subprocess import CalledProcessError from typing import Dict, Union, Optional from pathlib import Path import se...
StarcoderdataPython
1743166
# # Copyright (C) 2018 The Android Open Source Project # # 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 la...
StarcoderdataPython
1608228
# Generated by Django 3.1.5 on 2021-01-31 06:07 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('notes', '0001_initial'), ] operations = [ migrations.AlterField( model_name='note', name='date_created', ...
StarcoderdataPython
3368977
<reponame>inshadsajeev143/utube<filename>youtube_dl/version.py from __future__ import unicode_literals __version__ = '2019.04.17'
StarcoderdataPython
1621510
<filename>test/regression/daily/test_pte.py ###################################################################### # To execute: # Install: sudo apt-get install python python-pytest # Run on command line: py.test -v --junitxml results.xml ./test_pte.py import unittest import subprocess TEST_PASS_STRING="RESULT=PASS"...
StarcoderdataPython
3323655
<reponame>shiminasai/plataforma_FADCANIC # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import ckeditor.fields class Migration(migrations.Migration): dependencies = [ ('biblioteca', '0002_auto_20160328_2122'), ] operations = [ mi...
StarcoderdataPython
45442
#py_screener.py def screener(user_inp=None): """A function to square only floating points. Returns custom exceptions if an int or complex is encountered.""" #make sure something was input if not user_inp: print("Ummm...did you type in ANYTHING?") return #If it *might* be a floa...
StarcoderdataPython
1635534
<reponame>fossabot/bevrand class ErrorModel(): def __init__(self, valid, message, status_code): self.valid = valid self.message = message self.status_code = status_code class SuccessModelRedis(): def __init__(self, sorted_list): self.sorted_list = sorted_list
StarcoderdataPython
4813540
<gh_stars>0 from __future__ import unicode_literals import frappe def second_totals(doc, method): total = 0.0 for data in doc.optional_items: data.amount = data.qty * data.rate total += data.amount doc.optional_total = total
StarcoderdataPython
84484
<gh_stars>0 # flake8: noqa from timeCalculator.calculator import add_time
StarcoderdataPython