id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1724359 | <gh_stars>1-10
from .base import BaseNode, ComputeNode, EventNode
from .params import IntParam, FloatParam, StringParam, ListParam, Param
from .params import INPUT_PLUG, OUTPUT_PLUG, PARAM
class ToStr(StringParam):
def __init__(self, int_param, zeropad_param, name=None, pluggable=None):
super().__init__(n... | StarcoderdataPython |
84614 | <filename>src/message_loop_gtk.py
# Copyright 2011 Google 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 appli... | StarcoderdataPython |
1604028 | <reponame>Eric-Arellano/flake8-pantsbuild
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import ast
import sys
import tokenize
from collections import defaultdict
from typing import Iterator, List, NamedTuple, Set
if sys.version_info ... | StarcoderdataPython |
81503 | <filename>mars/serialization/ray.py<gh_stars>1-10
# Copyright 1999-2021 Alibaba Group Holding 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/LICE... | StarcoderdataPython |
1798628 | <reponame>cls1991/leetcode
# coding: utf8
"""
题目链接: https://leetcode.com/problems/house-robber-ii/description.
题目描述:
Note: This is an extension of House Robber.
After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will
not get too much at... | StarcoderdataPython |
4830091 | from . import db
from contextlib import contextmanager
'''
csv_address
call_type
crm_uuid
product_code
agent
caller_id_name
caller_id_number
destination_number
old_destination_number
dialplan
context
start_stamp
answer_stamp
end_stamp
bleg_start_stamp
bleg... | StarcoderdataPython |
1741902 | <reponame>AneeshUkidve/blue_pigs<filename>_morse/morse_code.py<gh_stars>0
import winsound
import time
import letters
sentence=input("\nEnter something to write: ")
def bleat(sty):
for i in sty:
if i==".":
winsound.Beep(700,200)
elif i=="-":
winsound.Beep(700,600)... | StarcoderdataPython |
108090 | <gh_stars>1000+
# -*- coding: utf-8 -*-
#
# Copyright 2020 Data61, CSIRO
#
# 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 b... | StarcoderdataPython |
3367538 | import scipy.stats as st
import numpy as np
import matplotlib.pyplot as plt
def normal_qq(data):
"""Get the Q-Q for the normal distribution.
Returns the theoretical values and the order statistics to be plotted against
each other.
For a normal distribution, we expect Phi(x_(k)) (the cdf of the kth ord... | StarcoderdataPython |
32652 | import numpy as np
from numexpr_kernel import numexpr_kernel
from numba_kernel import numba_kernel
N = 10000
x = np.random.rand(N)
y = np.random.rand(N)
z = np.random.rand(N)
tau = np.random.rand(N)
r1 = numexpr_kernel(x, y, z, tau)
r1 = numexpr_kernel(x, y, z, tau)
r2 = np.zeros(N, dtype=float)
numba_kernel(x, y, z,... | StarcoderdataPython |
1625782 | import face_recognition
import cv2
path1 = r"D:\pythonProject2\known\non coded images\Elon_Musk_Royal_Society_(crop1).jpg"
path2 = r"D:\pythonProject2\known\non coded images\download.jpg"
img = cv2.imread(filename=path1)
locations = face_recognition.face_locations(img)
for (a, b, c, d) in locations:
cv2.... | StarcoderdataPython |
3247708 | <gh_stars>1-10
import logging
import re
from typing import Any, Dict
logger = logging.getLogger(__name__)
def read_tir_file(file_path: str) -> Dict[str, Any]:
"""Create tire data dictionary from Pacejka .tir file.
Args:
file_path (str): tir file path.
Returns:
Dict[str, Any]: flat parame... | StarcoderdataPython |
3315719 | from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.optim.lr_scheduler import StepLR
import os
"""
This is the adapted version of the example code for Amazon SageMak... | StarcoderdataPython |
71496 | <filename>dev.py
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import numpy as np
import cv2
import os
import sys
import glob
import pickle
from sklearn.preprocessing import StandardScaler
from skimage.feature import hog
from sklearn.svm import LinearSVC
from sklearn.model_selection import train_tes... | StarcoderdataPython |
197437 | # <NAME> <<EMAIL>>
import os
import sys
import pytest
try:
import unittest.mock as mock
except ImportError:
import mock
import atnanoaod
##__________________________________________________________________||
@pytest.fixture()
def query_files_for(monkeypatch):
ret = mock.MagicMock()
module = sys.modul... | StarcoderdataPython |
1670902 | <reponame>google-cloud-sdk-unofficial/google-cloud-sdk<gh_stars>1-10
# -*- coding: utf-8 -*- #
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License a... | StarcoderdataPython |
1782871 | # W, H, C, N, K, S, R, Wpad, Hpad, Wstride, Hstride
layer_sizes = {
'cifar-10':
{
"vgg": [
# Conv1
(28, 28, 3, 1, 64, 3, 3, 1, 1, 1, 1),
(28, 28, 64, 1, 64, 3, 3, 1, 1, 1, 1),
# # Conv2
(14, 14, 64, 1, 128, 3, 3, 1, 1, 1, 1),
(14, 14, 128, 1, 128, 3, 3, 1, 1, 1, 1),
# # Con... | StarcoderdataPython |
1783164 | #!/usr/bin/env python
# ====================================================================
# Copyright (c) 2004-2005 CollabNet. All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http:/... | StarcoderdataPython |
65875 | <reponame>cool199966/AutoCoverLetter<filename>backend/letters/models.py
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class CoverLetter(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
title = models.CharField(max_length=255)
mes... | StarcoderdataPython |
4807409 |
def divide(n1, n2):
if n2 == 0:
raise ValueError("Divisão por 0 impossível")
return n1 / n2
print(divide(2,0))
print("Você tentou dividir um valor por 0, tente novamente!")
print("continua") | StarcoderdataPython |
3240902 | #!/usr/bin/env python3
"""
Copyright 2019 <NAME>
If you need a full Python package look at f90nml
read_namelist() reads a single namelist, returning the values in a dict()
It strips extraneous apostrophes
"""
import typing as T
import re
from pathlib import Path
def namelist_exists(fn: Path, namelist: str) -> bool:... | StarcoderdataPython |
1642003 | <gh_stars>1-10
"""Generates archive format 2.X test data from real archive data.
Data is written to the current directory.
"""
from os import path
import numpy as np
import h5py
from ch_util import andata
ARCHIVE_ROOT = "/mnt/gong/archive/"
ARCHIVE_VERSION = "3.0"
ACQ = "20190114T082356Z_chimestack_corr"
FILEN... | StarcoderdataPython |
131362 | <gh_stars>1-10
# Copyright The OpenTelemetry 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 o... | StarcoderdataPython |
3235457 | <gh_stars>0
#Exercício Python 046:
# Faça um programa que mostre na tela uma contagem regressiva para o estouro de fogos de artifício,
# indo de 10 até 0, com uma pausa de 1 segundo entre eles.
from time import sleep
r = 10
for i in range(10, -1, -1):
print(i)
sleep(0.5)
print('bUm!!!') | StarcoderdataPython |
165417 | <filename>TEMpcPlot/Symmetry/spacegroup.py
# Copyright (C) 2010, <NAME>
# (see accompanying license files for details).
"""Definition of the Spacegroup class.
from ase library
few change for extinctions
This module only depends on NumPy and the space group database.
"""
import os
import warnings
from functools import ... | StarcoderdataPython |
3325638 | default_app_config = 'oi_seattracker.apps.OiSeattrackerConfig'
| StarcoderdataPython |
1755989 | from expfactory.logger import bot
from flask import (
Blueprint,
render_template,
)
from expfactory.views.utils import (
perform_checks,
clear_session
)
from expfactory.server import app, csrf
import os
teacher_practice = Blueprint('teacher_practice', __name__,
static_u... | StarcoderdataPython |
3381788 | <reponame>emmamcbryde/AuTuMN-1
from numpy import tanh
def tanh_based_scaleup(shape, inflection_time, start_asymptote, end_asymptote=1.0):
"""
return the function t: (1 - sigma) / 2 * tanh(b * (a - c)) + (1 + sigma) / 2
:param shape: shape parameter
:param inflection_time: inflection point
:param s... | StarcoderdataPython |
1675340 | <reponame>AlanTheKnight/easygmail<gh_stars>0
from . import utils
import base64
class Parcer(object):
"""
Class for parcing information from ``get()`` API call
and processing it to ``Message`` class.
Attributes:
message - Message class
msg - get() API call result
"""
def __init... | StarcoderdataPython |
1635968 | from enum import IntEnum
from dataclasses import dataclass
import numpy as np
class StepType(IntEnum):
FIRST = 0
MID = 1
LAST = 2
@dataclass
class TimeStep:
step_type: StepType
observation: object
reward: float
done: bool
info: dict
def __getitem__(self, key):
return... | StarcoderdataPython |
45733 | <filename>luno_python/base_client.py
import json
import platform
import requests
import six
try:
from json.decoder import JSONDecodeError
except ImportError:
JSONDecodeError = ValueError
from . import VERSION
from .error import APIError
DEFAULT_BASE_URL = 'https://api.mybitx.com'
DEFAULT_TIMEOUT = 10
PYTHON_... | StarcoderdataPython |
42780 | # flake8: noqa
from pandas.computation.eval import eval
from pandas.computation.expr import Expr
| StarcoderdataPython |
151256 | #!/usr/bin/env python
# Copyright (C) 2021 ByteDance 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... | StarcoderdataPython |
3280882 | <filename>autoio-interfaces/mess_io/reader/_lump.py
""" Read the merged wells from the auxiliary file
"""
def merged_wells(mess_aux_str):
""" Parse the auxiliary MESS output file string for all of the groups
of wells which merged from a Master Equation simulation.
:param mess_aux_str: string for ... | StarcoderdataPython |
3312228 | import sys
import os
import tempfile
from pathlib import Path
import shutil
import glob
from PIL import Image
import cog
sys.path.insert(0, "inference")
from inference import run_inference
class Predictor(cog.Predictor):
def setup(self):
self.basepath = os.getcwd()
@cog.input("image", type=Path, he... | StarcoderdataPython |
4833323 | <filename>tests/models/xsd/test_alternative.py
from unittest import TestCase
from xsdata.models.xsd import Alternative
class AlternativeTests(TestCase):
def test_property_real_name(self):
obj = Alternative()
self.assertEqual("value", obj.real_name)
obj.id = "foo"
self.assertEqual... | StarcoderdataPython |
68415 | <reponame>SakuragawaAsaba/pnc-cli<gh_stars>0
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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/license... | StarcoderdataPython |
3215755 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import os
import uuid
import numpy as np
import tensorflow as tf
from niftynet.engine.application_driver import ApplicationDriver
from niftynet.engine.application_variables import global_vars_init_or_restore
from niftynet.engine.handler_m... | StarcoderdataPython |
1689283 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'OutgoingSMS.delivery_message'
db.add_column('mobile_outgoingsms', 'delivery_message', self... | StarcoderdataPython |
81278 |
from south.db import db
from django.db import models
from apps.analyzer.models import *
class Migration:
def forwards(self, orm):
# Adding model 'FeatureCategory'
db.create_table('analyzer_featurecategory', (
('id', orm['analyzer.FeatureCategory:id']),
('user'... | StarcoderdataPython |
118660 | <gh_stars>0
from __future__ import annotations
from dataclasses import dataclass, field
from requests.models import Response
from ..digitaloceanapi.accounts import Accounts
from ..common.cloudapiexceptions import *
import json
import threading
import time
import re
@dataclass
class AccountAttributes:
droplet_li... | StarcoderdataPython |
1693514 | <reponame>UCL/scikit-surgeryfredbackend<gh_stars>0
# -*- coding: utf-8 -*-
"""
Functions for point based registration using Orthogonal Procrustes.
"""
from sksurgeryfredbe.algorithms.scores import calculate_score
class Ablator():
"""
handles the simulated ablation for scikit-surgery fred
"""
def __i... | StarcoderdataPython |
3227762 | <reponame>vinaymundada27/Hue
#!/usr/bin/env python
from setuptools import setup
setup(
name="django-auth-ldap",
version="1.2.0",
description="Django LDAP authentication backend",
long_description=open('README').read(),
url="http://bitbucket.org/psagers/django-auth-ldap/",
author="<NAME>",
... | StarcoderdataPython |
1662065 | <gh_stars>0
class Solution:
"""
@param nums: A list of integers
@return: A list of integers includes the index of the first number
and the index of the last number
"""
def subarraySum(self, nums):
# write your code here
n = len(nums)
map_ = {}
sum_ = 0
... | StarcoderdataPython |
153845 | from fish import Fish
WIDTH = 640
HEIGHT = 416
NFISHES = 15 # Anzahl der Fische
FPS = 60
fishes = []
def setup():
global bg
size(WIDTH, HEIGHT)
this.surface.setTitle(u"<NAME>, bonbonbuntes Aquarium")
bg = loadImage("background.png")
for _ in range(NFISHES):
fishes.append(Fish())
fram... | StarcoderdataPython |
3344146 | <reponame>Bobbyorr007/ivy
"""
Collection of TensorFlow general functions, wrapped to fit Ivy syntax and signature.
"""
# global
import ivy
_round = round
import numpy as _np
import math as _math
import tensorflow as _tf
from numbers import Number
import tensorflow_probability as _tfp
import multiprocessing as _multipr... | StarcoderdataPython |
3291956 | import torch
import datetime
from .wordebd import WORDEBD
from .cxtebd import CXTEBD
from .avg import AVG
from .cnn import CNN
from .idf import IDF
from .meta import META
from .lstmatt import LSTMAtt
def get_embedding(vocab, args):
print("{}, Building embedding".format(
datetime.datetime.now().strftime(... | StarcoderdataPython |
1638023 | import pytest
from mathy_core import (
AbsExpression,
AddExpression,
BinaryExpression,
ConstantExpression,
DivideExpression,
EqualExpression,
ExpressionParser,
FunctionExpression,
MathExpression,
MultiplyExpression,
NegateExpression,
PowerExpression,
SgnExpression,
... | StarcoderdataPython |
3353938 | <gh_stars>0
import mmcv
import numpy as np
import pycocotools.mask as mask_util
import torch
import torch.nn as nn
from ..builder import build_loss
from ..builder import HEADS
from ..model_utils import ConvModule
# from mmdet.core import mask_target
# replace mmdet.core with mmcv.runner
from mmcv.runner import auto_... | StarcoderdataPython |
3302270 | <reponame>juanjorgegarcia/Z01
# <NAME> @ <EMAIL>
# Dez/2017
# Disciplina Elementos de Sistemas
#
# Run maven jar package from other dir
import os,sys
# Verificar se testes unitários passaram
def checkUnitTests(dirname):
hasErrors = False
# rotina de leitura do arquivo de teste
for filename in... | StarcoderdataPython |
3219158 | <gh_stars>0
from dataclasses import dataclass
#from az_custom_logging.config.project_config import ProjectConfig
"""
Find a way to read customer_id and shared_key
for the respective project Log Analytics Workspace
"""
@dataclass(frozen=True)
class CustomLogConfig:
customer_id: str
shared_key: str
log_name: str... | StarcoderdataPython |
4195 | """
Demonstration of numbers in Python
"""
# Python has an integer type called int
print("int")
print("---")
print(0)
print(1)
print(-3)
print(70383028364830)
print("")
# Python has a real number type called float
print("float")
print("-----")
print(0.0)
print(7.35)
print(-43.2)
print("")
# Limited precision
print... | StarcoderdataPython |
3387602 | import nltk
import os
import sys
import mlflow
import numpy as np
import pandas as pd
from nltk.corpus import stopwords
from nltk.stem import PorterStemmer
from gensim.models import Word2Vec
from sklearn.metrics import accuracy_score
from sklearn.preprocessing import OneHotEncoder
from sklearn.ensemble import RandomFor... | StarcoderdataPython |
3215544 | <gh_stars>0
# Copyright 2012 OpenStack Foundation
#
# 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 ... | StarcoderdataPython |
171894 | import wx
import sys
import threading
import traceback
import inspect
import weakref
class Signal(object):
def __init__(self, owner=None):
self.__lock = threading.Lock()
self.__handlers = []
if isinstance(owner, wx.Window):
owner.Bind(wx.EVT_WINDOW_DESTROY, lambda evt: self.dest... | StarcoderdataPython |
114424 | <gh_stars>0
from configparser import ConfigParser
from pathlib import Path
from typing import List, Any
true_path = Path(__file__).parent / 'config.ini'
_parser = ConfigParser()
_parser.read(str(true_path.resolve()), encoding='utf-8')
class Config(object):
@staticmethod
def get_property_string(section_name: ... | StarcoderdataPython |
18269 | import numpy as np
import matplotlib.pyplot as plt
#Dahlquist test
#sol1ex = lambda t: np.exp(-t)
#sol2ex = lambda t: np.exp(-2*t)
#oscillator 1
sol1ex = lambda t: np.cos(t**2/2)
sol2ex = lambda t: np.sin(t**2/2)
#oscillator 2
#sol1ex = lambda t: np.exp(np.sin(t**2))
#sol2ex = lambda t: np.exp(np.cos(t**2))
name = 'O... | StarcoderdataPython |
98921 | import datetime
from app.models.base.base import BaseModel
from app import db
class WeChatWantBuyModel(db.Model, BaseModel):
__bind_key__ = "a_social"
__tablename__ = "wechat_want_buy"
id = db.Column(db.Integer, primary_key=True)
seller_id = db.Column(db.Integer, default=0)
buyer_id = db.Column(d... | StarcoderdataPython |
191170 | # comment on each line
# Here we are setting variables, in this case X, the x variable creates within it a formatted variable which is also set in this creation.
x = "There are %d types of people." % 10
# creating the variable binary
binary = "binary"
# creating variable do_not
do_not = "don't"
# creating variable ... | StarcoderdataPython |
3251699 | from lettuceUI import LettuceUI
__all__ = ['LettuceUI'
]
| StarcoderdataPython |
3393325 | <reponame>ryosuke0825/atcoder_python
n = int(input())
print(((n-1)*n)//2)
| StarcoderdataPython |
1693867 | <reponame>Jumpscale/lib9
"""
This modules defines types related to signatures
"""
from JumpScale9Lib.clients.blockchain.rivine.encoding import binary
SIGEd25519 = 'ed25519'
SPECIFIER_SIZE = 16
class SiaPublicKeyFactory:
"""
SiaPublicKeyFactory class
"""
@staticmethod
def from_stri... | StarcoderdataPython |
3303137 | <reponame>mofilamamra/APP-WILAYA<gh_stars>0
# auth.py
from flask import Blueprint, render_template, redirect, url_for, request, flash, session
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import login_user, logout_user, login_required
from app.models.Model import User, ACC... | StarcoderdataPython |
63817 | <reponame>SmartStake/harmonyanalytics<filename>harmonyanalyticsutils/harmonyNodeHealth.py
import datetime
import json
import subprocess
import sys
import commonUtils
import constants
import logUtil
logger = logUtil.l()
if len(sys.argv) < 5:
raise Exception("correct syntax is: python harmonyNodeHealth dev/prod lo... | StarcoderdataPython |
1733726 | <filename>data_parsing_code/scrap_wiki_verb_roots_inflections.py
# Import libraries
import requests
from bs4 import BeautifulSoup
import pandas as pd
import codecs
import mysql.connector as MySQL
mysql = MySQL.connect(host='localhost',
database='ar_nlg'
, user='root'
... | StarcoderdataPython |
3234695 | <reponame>maclema/aws-parallelcluster<gh_stars>100-1000
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
# with the License. A copy of the License is located at
#
# http://aws.amaz... | StarcoderdataPython |
3292962 | #!/usr/bin/env python
#
# test_fsl_data_utils.py -
#
# Author: <NAME> <<EMAIL>>
#
import shutil
import os
import os.path as op
import numpy as np
import fsl.utils.tempdir as tempdir
import fsl.data.utils as dutils
import fsl.utils.path as fslpath
import fsl.data.im... | StarcoderdataPython |
199769 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2020/5/8 下午8:29
# @Author : MaybeShewill-CV
# @Site : https://github.com/MaybeShewill-CV/sfnet-tensorflow
# @File : make_cityscapes_tfrecords.py
# @IDE: PyCharm
"""
Generate cityscapes tfrecords tools
"""
from data_provider.cityscapes import cityscapes_... | StarcoderdataPython |
3307199 | import pytest
from selenium import webdriver
@pytest.fixture
def driver(request):
wd = webdriver.Chrome()
request.addfinalizer(wd.quit)
return wd
def test_example(driver):
driver.get("http://localhost/litecart/admin/login.php")
driver.find_element_by_name('username').send_keys('admin')
driver.... | StarcoderdataPython |
1754348 | #!/usr/bin/python
# Copyright (c) 2017, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... | StarcoderdataPython |
142320 | <filename>rest_framework_security/brute_force_protection/exceptions.py<gh_stars>1-10
class BruteForceProtectionException(Exception):
pass
class BruteForceProtectionBanException(BruteForceProtectionException):
pass
class BruteForceProtectionCaptchaException(BruteForceProtectionException):
pass
| StarcoderdataPython |
1738419 | <reponame>wikimedia/operations-debs-python-flask-login<gh_stars>0
# -*- coding: utf-8 -*-
"""
flask.ext.login
==============
This module provides user session management for Flask. It lets you log your
users in and out in a database-independent manner.
:copyright: (C) 2011 by <NAME>.
:license: MIT/X11, see LICENSE ... | StarcoderdataPython |
1723695 | #
__doc__ = '''
Primitive functions to be embeded in model/test templates
'''
MODEL_PRIMITIVE_FUNCTIONS = """@{
# Available classes
# Module()
# Pin()
# Metric()
# Param()
import sys
import os
from dave.common.misc import dec2bin
##############################
# primitive functions
##############################
de... | StarcoderdataPython |
1629880 | n = 1
p = i = 0
while n != 0:
n = int(input('Digite um valor: '))
if n % 2 == 0:
p += 1
if n % 2 != 0:
i += 1
print('Qtd de Pares: '.format(c))
print('Qtd de Impares: '.format(i))
| StarcoderdataPython |
1607151 | <gh_stars>0
from django.shortcuts import render,redirect
from django.http import HttpResponse,Http404
from .models import Image,Location,Category
# Create your views here.
def all_images(request):
photos = Image.get_images()
locations = Location.objects.all()
categories = Category.objects.all()
return ... | StarcoderdataPython |
1733730 | # -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies Pvt Ltd and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class ReleaseSettings(Document):
pass
| StarcoderdataPython |
3317639 | """
This module solves for the orbit of the planet given Keplerian parameters.
"""
import numpy as np
import astropy.units as u
import astropy.constants as consts
from orbitize import cuda_ext, cext
if cext:
from . import _kepler
if cuda_ext:
# Configure GPU context for CUDA accelerated compute
from orbi... | StarcoderdataPython |
1573 | import SimpleXMLRPCServer as xmls
def echo(msg):
print 'Got', msg
return msg
class echoserver(xmls.SimpleXMLRPCServer):
allow_reuse_address = True
server = echoserver(('127.0.0.1', 8001))
server.register_function(echo, 'echo')
print 'Listening on port 8001'
try:
server.serve_forever()
except:
ser... | StarcoderdataPython |
1735694 | <reponame>jmshnds/eventstore_grpc
"""
Resign Node.
"""
from eventstore_grpc.proto import operations_pb2, operations_pb2_grpc, shared_pb2
def resign_node(stub: operations_pb2_grpc.OperationsStub, **kwargs) -> shared_pb2.Empty:
"""Resign Node."""
return stub.ResignNode(shared_pb2.Empty(), **kwargs)
| StarcoderdataPython |
3271537 | from .rcnn_heads import ORCNNROIHeads
from .mask_heads import (
build_amodal_mask_head,
build_visible_mask_head
)
from .pooler import ROIPooler
| StarcoderdataPython |
3293622 | """W&B Sweep Functionality."""
import os
import signal
import subprocess
import sys
import json
from typing import Tuple
from ast import literal_eval
import pdb
DEFAULT_CONFIG = {
"dataset": "RetinaDatasetWrapper",
"model": "RetinaModel",
"network": "resnetconv",
"train_args": {"batch_size": 128, "epoc... | StarcoderdataPython |
3339321 | <gh_stars>0
# Generated by Django 3.0.6 on 2020-06-05 20:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('merchant_game', '0022_auto_20200605_2237'),
]
operations = [
migrations.AddConstraint(
model_name='loan',
... | StarcoderdataPython |
85948 | from tkinter import *
from tkinter.font import BOLD
root = Tk()
def click():
mylabel = Label(root, text=f"Hello, {a.get()}")
mylabel.pack()
a = Entry(root, width=30)
a.pack()
a.insert(0, "Enter Your Name")
btn = Button(root, text='Click Me', command=click)
btn.pack()
root.mainloop()
| StarcoderdataPython |
1734876 | """Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the
License. A copy of the License is located at
http://aws.amazon.com/apache2.0/
or in the "license" file accompanyi... | StarcoderdataPython |
199906 | <reponame>nocproject/noc<gh_stars>10-100
# ---------------------------------------------------------------------
# Rotek.BT.get_inventory
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# ----------------------------------------... | StarcoderdataPython |
1781253 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Написать программу, которая будет удалять все комментарии из исходного файла
с кодом на языке Python. Пройдите по всем строкам в файле на предмет поиска
символа #. Обнаружив его, программа должна удалить все содержимое,
начиная с этого символа и до конца строки.
"""
... | StarcoderdataPython |
3264767 | <gh_stars>1-10
"""
FLI.device.py
Object-oriented base interface for handling FLI USB devices
author: <NAME>, Yankee Environmental Systems
author_email: <EMAIL>
"""
__author__ = '<NAME>'
__date__ = '2012-08-16'
import sys, time
import ctypes
from ctypes import pointer, POINTER, byref, c_char, c_char... | StarcoderdataPython |
66108 | import argparse
from typing import List, Iterable, Tuple, Optional
from dejima.plugin import NoteField, SourcePlugin, CardTemplate, Note
__version__ = "0.1.0"
class SomeSource(SourcePlugin):
# These can be named anything you want, and will become fields on
# your notes in Anki. Note that the templates in ... | StarcoderdataPython |
149886 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 The Project U-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
'''
Take bitstream .bit files and decode t... | StarcoderdataPython |
4802059 | <reponame>SebasHernandezMD/AutomatO<filename>Automat_Script.py
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 12 21:42:45 2021
@author: SebastianHdz
Script para automatizar pipeline-analisis de WGS-TB:
En la carpeta debe tener 3 archivos en formato UNIX-UNIOCODE UTF8:
-> automat_script.py #Este programa
-... | StarcoderdataPython |
119256 | # coding:utf-8
#数据存储器
#对提取的数据进行整理和存储
#更新时间:2016/3/8
#创建时间:2016/3/2
#作者:debbie
import urllib2
import cookielib
class HtmlOutputer(object):
def __init__(self):
self.datas=[]
#存储得到的根页面数据
def collect_topic(self,topic_data):
if topic_data is None:
return
fout=open('data.dat','w')
for ... | StarcoderdataPython |
3311283 | <reponame>lebedevsergey/poet-ex-machina<gh_stars>10-100
# -*- coding: utf-8 -*-
# Copyright 2016 <NAME>
# Licensed under the Apache License, Version 2.0
import includes.utils as utils
class RhymesAndRitms:
# new algorithm that works with word syllables
@staticmethod
def getRhymedEnd(rhymedWor... | StarcoderdataPython |
174792 | <reponame>williamfzc/sepmachine
from sepmachine.pipeline.base import BasePipeline
| StarcoderdataPython |
3204958 | <reponame>openstack/airship-armada<gh_stars>10-100
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.... | StarcoderdataPython |
3208051 | # Copyright 2020 Soil, Inc.
import eventlet
from pyVmomi import vim
from soil.api.utils.common import sizeof_fmt
from soil.api.utils.vmware import vCenterPropertyCollector
class ViewBuilder(object):
_collection_name = "vcenter"
def __init__(self):
super(ViewBuilder, self).__init__()
def _deta... | StarcoderdataPython |
149185 | <reponame>azuline/cryptopals
"""
Detect single-character XOR
"""
import sys # isort:skip
from pathlib import Path # isort:skip
sys.path.append(str(Path(__file__).parent.resolve().parent))
from itertools import chain
from set1.c03 import get_options, select_option
DATA_PATH = Path(__file__).parent / "data" / "04.... | StarcoderdataPython |
3337513 | <filename>webapp/migrations/0008_auto_20191016_1649.py<gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-10-16 14:49
from __future__ import unicode_literals
from django.db import migrations
import tinymce.models
class Migration(migrations.Migration):
dependencies = [
('webapp', '0007... | StarcoderdataPython |
1644086 | import os
import sys
import argparse
from src.agent import Agent
from src.utils import register_model_args
import tensorflow as tf
def main():
parser = argparse.ArgumentParser(description='LUBAN runner')
register_model_args(parser)
params, unparsed = parser.parse_known_args(sys.argv)
sess = tf.Sessi... | StarcoderdataPython |
165924 | #!/usr/bin/env python
import os
import sys
from twit.wsgi import application
WSGI_APPLICATION = 'twit.wsgi.application'
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "twit.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys... | StarcoderdataPython |
3384491 | import random
from requests import Response
from starlette import status
from app.main import ITEMS, HELLO_WORLD
def test_root(test_client):
response: Response = test_client.get("/")
assert response.status_code == status.HTTP_200_OK
assert response.json() == HELLO_WORLD
def test_items(test_client):
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.