id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3386335 | import time
from django.core.wsgi import get_wsgi_application
import os
import subprocess
import logging
from loghandler.loghandler import setup_logging
setup_logging()
logger = logging.getLogger(__name__)
# Django specific settings
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
# Ensure settings are re... | StarcoderdataPython |
184922 | import numpy as np
import torch.nn as nn
from networks.ResidualBlocks import ResidualBlock1dTransposeConv
def make_res_block_decoder_feature_generator(channels_in, channels_out, a_val=2.0, b_val=0.3):
upsample = None;
if channels_in != channels_out:
upsample = nn.Sequential(nn.ConvTranspose1d(channe... | StarcoderdataPython |
3300086 | # x_4_9
#
# 1~15までの数字について
# 「3」で割り切れる場合は「Fizz」、「5」で割り切れる場合は「Buzz」
# 「3」でも「5」でも割り切れる場合は「FizzBuzz」
# それ以外はそのまま数字を表示するようにコードを修正してください
number = 1
print('Fizz')
print('Buzz')
print('FizzBuzz')
| StarcoderdataPython |
1738636 | ## This file is part of Scapy
## See http://www.secdev.org/projects/scapy for more informations
## Copyright (C) <NAME> <<EMAIL>>
## This program is published under a GPLv2 license
from base_classes import *
from config import *
from dadict import *
from data import *
from error import *
from themes import *
from arc... | StarcoderdataPython |
135807 | from ._pycdb import CDB, CDBMake
| StarcoderdataPython |
3365708 | import argparse
import Bio.SeqIO
from collections import OrderedDict
import numpy as np
import pandas as pd
import re
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--alignment", help="a fasta file")
parser.add_argument("--gaps", type=int, help="value of gaps per site ... | StarcoderdataPython |
1710232 | <filename>scripts/load_as_rst.py
#!/usr/bin/env python
"""
Used to convert Markdown files to RST for use in sphinx and PyPi.
"""
from __future__ import print_function
import os
import sys
import warnings
# This is called during setup, so we can't be sure six is installed.
# The only thing to pull in is raise_from, th... | StarcoderdataPython |
1758777 | """
Orthogonal Projection on Latent Structure (O-PLS)
"""
import numpy as np
from numpy import linalg as la
from typing import Tuple, Any, Union
from base import nipals
class OPLS:
"""
Orthogonal Projection on Latent Structure (O-PLS).
Methods
----------
predictive_scores: np.ndarray... | StarcoderdataPython |
3347290 | # Generated by Django 2.0.2 on 2018-03-07 20:04
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('protocols', '0002_auto_20180307_1953'),
]
operations = [
migrations.RemoveField(
model_name='protocol',
... | StarcoderdataPython |
1714678 | import numpy as np
import torch
def parameter_number(model):
return sum(p.numel() for p in model.parameters() if p.requires_grad)
def normal2unit(vertices: "(vertice_num, 3)"):
"""
Return: (vertice_num, 3) => normalized into unit sphere
"""
center = vertices.mean(dim= 0)
vertices -= center
... | StarcoderdataPython |
3226987 | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
#from scrapy.exception import DropItem
import codecs
import json
from datetime import datetime
from hashlib import md5
from scr... | StarcoderdataPython |
85674 | import csv
import os
import sys
import typing
import keras
import librosa
import numpy as np
sys.path.append(os.path.dirname(os.path.realpath(__file__))) # TODO(TK): replace this with a correct import when mevonai is a package
import bulkDiarize as bk
default_model_path = os.path.join(os.path.dirname(os.path.realpa... | StarcoderdataPython |
38435 | <gh_stars>1-10
from __future__ import print_function
import numpy as np
import dataprocessing as proc
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
# Training settings
parser = argparse.ArgumentParser(description='BASE... | StarcoderdataPython |
3249312 | #!/usr/bin/env python3
import os, sys
import pyqrcode, yaml
BASEURL = "http://knizky.cf/#"
OUT_DIR = sys.argv[1] if len(sys.argv) > 1 else '.'
books = yaml.load(open("_data/books.yml", "r"))
for book in books:
qr = pyqrcode.create(BASEURL + book)
qr.png(os.path.join(OUT_DIR, book + ".png"), scale=10)
| StarcoderdataPython |
159096 | <reponame>RosettaCommons/jade2<filename>jade2/deep_learning/torch/lightning_modules/__init__.py<gh_stars>1-10
from .GraphTask import *
from .GeneralTask import * | StarcoderdataPython |
3398235 | #!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
# Copyright (C) 2020 <NAME>
# Use of this source code is governed by the MIT License
###############################################################################
from . im... | StarcoderdataPython |
3244837 | <gh_stars>0
# x_5_6
#
# for文を使って「numbers」のそれぞれの数字を2倍にした数をリスト「nums_x_2」に追加してください
numbers = [2, 5, 7, 1, 3, 8, 1, 8, 2, 3]
numbers_x_2 = []
print(numbers_x_2)
| StarcoderdataPython |
1699419 | <gh_stars>0
import sys
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from Bio import AlignIO, SeqIO
from Bio.Seq import Seq
from Bio.Align import MultipleSeqAlignment
from Bio.SeqRecord import SeqRecord
alignment_file = sys.argv[1]
output_file = sys.argv[2]
alignment = AlignIO.read(alignment_... | StarcoderdataPython |
167707 | <reponame>cocoaaa/ReprLearn<filename>reprlearn/evaluator/qualitative.py
from pathlib import Path
from typing import List, Set, Dict, Tuple, Optional, Iterable, Mapping, Union, Callable, TypeVar
import torch
from torch.utils.tensorboard import SummaryWriter
from torch.utils.data import DataLoader
from torch import linal... | StarcoderdataPython |
33933 | <reponame>jmbjorndalen/pycsp_classic<gh_stars>0
#!/usr/bin/env python
# -*- coding: latin-1 -*-
from common import *
from pycsp import *
from pycsp.plugNplay import *
from pycsp.net import *
@process
def test1():
print("Test1")
waitForSignal()
c = getNamedChannel("foo1")
print("- Trying to write to cha... | StarcoderdataPython |
35395 | #!/usr/bin/env bash
trap 'ret=$?; printf "%s\n" "$ERR_MSG" >&2; exit "$ret"' ERR
for file in $(find $1 -name \*.lp.bz2) ; do
echo $file
outputname="../gr/subgraphs/$(basename $file).gr"
./lp2dgf.py -f $file > $outputname
if [ $? -ne 0 ]; then
echo 'ERROR stopping...'
exit 1
fi
done
| StarcoderdataPython |
1702810 | data=[6,5,3,1,8,7,2,4]
def merge_sort(array):
if len(array)>1:
#find the division point
mid=len(array)//2
left_array=array[:mid]
right_array=array[mid:]
print(left_array,right_array)
#use recursion to keep dividing
merge_sort(left_array)
merge_sort(r... | StarcoderdataPython |
190041 | # -*- coding: utf-8 -*-
import os
bin_names = 'md5sum, sha512sum, comm, uniq, nl, b2sum, sum, wc, sha256sum, ptx, sha1sum, join, dir, shuf, tail, tsort, ls, sort, base64, base32'
bin_names = bin_names.split(', ')
total_opcodes = 0
num_valid_funcs = 0
for name in bin_names:
op_dir = './%s_ops_info/' % name
... | StarcoderdataPython |
4819663 | <filename>ppms/__init__.py
from astropy.io.ascii import basic, core
from astropy.table import Table, MaskedColumn
from astropy import units as u, constants as c
import numpy as np
import dateutil.parser as dparser
from scipy.ndimage import median_filter
class MaglabHeader(basic.CsvHeader):
comment = r'\s*;'
w... | StarcoderdataPython |
1677982 | import amass
from amass.commands import CommonArgs, Arg
class Command(amass.commands.DjangoCommand):
usage = CommonArgs("""
Delete resource from AMASS
""",
[
Arg("resource", "Name of resource to delete"),
], [])
def __init__(self):
amass.commands.Command.__init__(self)
self.file = __file__
de... | StarcoderdataPython |
1645225 | <reponame>vinissimus/guillotina_s3storage
import os
import aiohttp
import pytest
from guillotina import task_vars
from guillotina import testing
def settings_configurator(settings):
if "applications" in settings:
settings["applications"].append("guillotina_s3storage")
else:
settings["applicat... | StarcoderdataPython |
152629 | from django.core.management.base import CommandError
from django.db import models
from django.utils.translation import ugettext_lazy as _
class DjCrontabSchedule(models.Model):
minute = models.CharField(max_length=64, default="*")
hour = models.CharField(max_length=64, default="*")
day_of_week = models.Ch... | StarcoderdataPython |
29929 | <filename>examples/decrypt.py
#!/usr/bin/env python
# Copyright (c) 2020 Janky <<EMAIL>>
# All right reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above... | StarcoderdataPython |
46718 | #-*-coding:utf8-*-
from __future__ import print_function # Python 2/3 compatibility
import boto3
import time
import json
import decimal
import datetime
import json
from boto3.dynamodb.conditions import Key, Attr
from botocore.exceptions import ClientError
class DecimalEncoder(json.JSONEncoder):
def default(self, ... | StarcoderdataPython |
4833357 | <filename>src/strategy.py
class Strategy:
def __init__(self,config):
self.config=config
def pickAndPlace(outputFile):
"create all the necessary modules"
"use the picker as an interator to get a list of parts"
"for each board"
"current board = this board"
"pick a part"
"place a part"
... | StarcoderdataPython |
19251 | from .technews_helper import TechNews
from .mail_helper import EmailContentHelper
| StarcoderdataPython |
67971 | <reponame>DLeinHellios/GrudgeMatch<gh_stars>0
import os, json, sys, sqlite3
class Config:
def __init__(self):
'''Holds configuration options'''
self.path = os.path.join('data', 'config.json')
self.load()
def create_default(self):
'''Creates the default config file is config i... | StarcoderdataPython |
193993 | <reponame>Alfon-sec/client-python
# coding: utf-8
import json
from dateutil.parser import parse
class Report:
def __init__(self, opencti):
self.opencti = opencti
self.properties = """
id
standard_id
entity_type
parent_types
spec_version... | StarcoderdataPython |
86561 | <reponame>chetat/market-research
from .. import db
class TrackingScript(db.Model):
__tablename__ = "tracking_script"
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50), nullable=False)
script = db.Column(db.String(150), nullable=False)
| StarcoderdataPython |
1768562 | <reponame>bntumb/Neural-Networks-Module-CE889
import pygame
'''
Class created using code from https://www.pygame.org/wiki/IntersectingLineDetection
Mathematic explanation: https://www.mathopenref.com/coordintersection.html
'''
class CollisionUtility:
@staticmethod
def check_lander_collision_w... | StarcoderdataPython |
1692912 | # Copyright (C) 2013-2014 SignalFuse, Inc.
# Copyright (C) 2015 SignalFx, Inc.
#
# Docker container orchestration utility.
from __future__ import print_function
import collections
import json
import time
from docker import auth
import os
try:
import urlparse
except ImportError:
# Try for Python3
from urll... | StarcoderdataPython |
118520 | """
Copyright (c) 2015 SONATA-NFV
ALL RIGHTS RESERVED.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | StarcoderdataPython |
1652266 | from typing import Tuple
import numpy as np
from pandas import DataFrame, Series
from spotify_confidence.analysis.constants import CI_LOWER, CI_UPPER, SFX1, SFX2
class BootstrapComputer(object):
def __init__(self, bootstrap_samples_column, interval_size):
self._bootstrap_samples = bootstrap_samples_colu... | StarcoderdataPython |
1737923 | class Solution(object):
def countSubstrings(self, s, t):
n, m = len(s), len(t)
def test(i, j):
res = pre = cur = 0
for k in xrange(min(n - i, m - j)):
cur += 1
if s[i + k] != t[j + k]:
pre, cur = cur, 0
res ... | StarcoderdataPython |
63730 | """Demo using test environment for grpc testing"""
import logging
from google.protobuf import json_format
from framework.config import settings
from tests.base_test import BaseTestCase
from utils.channel_factory import get_channel
from utils.builders.grpc_builders import build_number_from_file, build_number_from_dic... | StarcoderdataPython |
19462 | """
## ## ## ## ##
## ## ##
## ## ##
## ## ## ## ## ##
## ##
## ##
##
AUTHOR = <NAME> <<EMAIL>>
"""
import sys
import boto3
import click
import threading
from botocore.exceptions import ClientError
from secureaws import checkaws
from secureaws ... | StarcoderdataPython |
1657869 | <filename>tools/efro/error.py<gh_stars>1-10
# Copyright (c) 2011-2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# t... | StarcoderdataPython |
1723640 | def get_prefix_table(pattern):
table = [0]
pattern_length = len(pattern)
for i in range(1, pattern_length):
j = 0
while pattern[i] == pattern[j]:
j += 1
# j < pattern_length:
# if :
# if j == pattern_length:
# else:
... | StarcoderdataPython |
3266132 | <gh_stars>1-10
import shlex
import subprocess
import sys
import click
from ecstools.commands.service.env import container_selection
from ecstools.resources.service import Service
@click.command(short_help='Run ECS Exec')
@click.argument('cluster')
@click.argument('service')
@click.argument('command', default='/bin/b... | StarcoderdataPython |
1778901 | from setup import *
def get_general_ts_all(test_type):
"""
A generic function used to get all the rows of a specific general touchscreen test. After the csv is generated, it
will ask for the user to save the file in a directory. Used for Habituation 1 and 2, Initial Touch, Must Touch,
and Mus... | StarcoderdataPython |
1799009 | " Tensorflow version 1.x modeling codes. "
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import math
import collections
import re
import six
from six.moves import range
import tensorflow as tf
def bilinear_classifier(in1_BTH, in2_BTH, keep_prob, output_size=1,
... | StarcoderdataPython |
3382390 | import numpy as np
from perceptron import Perceptron
class MLP:
def __init__(self, X, i = 2, j = 2, k = 1, alpha = 0.1):
# X = input data
# i = number of neurons for the input layer
# j = number of neurons for the hidden layer
# k = number of neurons for the output layer
sel... | StarcoderdataPython |
3326974 | for _ in range(int(input())):
full_str = input()
full_list = list(full_str.split(" "))
#print(full_list)
lenght = len(full_list)
print("Count =", lenght) | StarcoderdataPython |
3278452 | from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.urls import path
from rest_framework.generics import DestroyAPIView
from loja.api.views import LojasView, LojasDetailView, LojaCreateAPIView, LojaUpdateAPIView, LojaDeleteAPIView
app_name = 'loja'
urlpatterns = [
... | StarcoderdataPython |
1626064 | <filename>src/hrflow_connectors/utils/logger.py
import logging
import sys
from typing import Union
LOGGER_NAME = "hrflow_connectors"
def get_logger() -> logging.Logger:
"""
Get logger with `NullHandler` by default
Returns:
logging.Logger: logger
"""
logger = logging.getLogger(LOGGER_NAME... | StarcoderdataPython |
3250297 | <reponame>itsayusharya/passwordmanger
import sqlite3
import random
class Password:
""""Password Generator"""
def __init__(self):
"""constructor"""
lower = "abcdefghijklmnopqrstuvwxyz"
upper = lower.upper()
numbers = "1234567890"
symbols = "!@#$%^&*()_+<>?"
# C... | StarcoderdataPython |
3360287 | #!/usr/bin/env python
# ~/sandboxes/PORTAGEshared/src/nn/test_portage_nnjm -native -s 2 -n 2 delme.bin <(echo '1 1 / 1 / 4')
from unpickle import Layer
from unpickle import Embed
from unpickle import writeModelToFile
import numpy as np
from numpy.random import random
from numpy import ones
from numpy import zeros
e... | StarcoderdataPython |
3284507 | <gh_stars>0
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
from __future__ import division, unicode_literals
import re
import ssl
import threading
import time
import traceback
from collections import defaultdict
from datetime import timedelta
from pyVim impo... | StarcoderdataPython |
3308244 | from itertools import count
import torch
import torch.optim as optim
from torch.utils.data import DataLoader
from tqdm import tqdm
import numpy as np
import os
from collections import deque
from autoencoder import Autoencoder
from config import *
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
... | StarcoderdataPython |
3266369 | <filename>movie/movie.py
class Movie(object):
def __init__(self):
self.name = ''
self.src = ''
self.update_time=''
self.score = ''
self.style = ''
self.desc = ''
self.size = ''
self.area = ''
self.actors = []
self.directors = []
... | StarcoderdataPython |
3374937 | # -*- coding: utf-8 -*-
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^survey/$', views.index, name='index'),
url(r'room/(?P<room_slug>[-\w]+)/survey$', views.survey, name='survey'),
url(r'room/(?P<room_slug>[-\w]+)/thanks$', views.thanks, name='thanks'),
] | StarcoderdataPython |
3200637 | <reponame>harupy/nyaggle
import os
import pytest
import numpy as np
import pandas as pd
from pandas.testing import assert_frame_equal
import nyaggle.feature_store as fs
from nyaggle.testing import get_temp_directory
def test_save_feature():
df = pd.DataFrame()
df['a'] = np.arange(100)
with get_temp_d... | StarcoderdataPython |
3263127 | <filename>lab3project/street/apps/main/admin.py
from django.contrib.gis import admin
from django.db import models
from .models import *
class SegmentStreetInline(admin.TabularInline):
model = SegmentStreet
autocomplete_fields = ['street', 'segment']
extra = 1
ordering = ('id',)
# def get_queryset(s... | StarcoderdataPython |
3351851 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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 |
3280805 | # --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), ... | StarcoderdataPython |
3285163 | import json
def readJsonFile(fileName):
json_data = open(fileName).read()
data = json.loads(json_data)
return data
def writeJsonFile(fileName,data):
with open(fileName,'w+') as file:
json.dump(data,file,indent=4) | StarcoderdataPython |
152394 | <reponame>baszalmstra/rosty<gh_stars>1-10
#!/usr/bin/python2
from __future__ import print_function
import sys
from rosgraph_msgs.msg import Log
def read_message():
"""Read the rust ROS message and check the values"""
name = "Test"
msg = "This is a test"
topics = ["Topic1", "Topic2"]
errors = ""
... | StarcoderdataPython |
1726444 | <gh_stars>0
# -*- coding: utf-8 -*-
import uqra, unittest,warnings,os, sys
from tqdm import tqdm
import numpy as np, scipy as sp
from uqra.solver.PowerSpectrum import PowerSpectrum
from uqra.environment import Kvitebjorn as Kvitebjorn
from sklearn import datasets
from sklearn.linear_model import LinearRegression
fro... | StarcoderdataPython |
34191 | <reponame>shuklaayush/badger-system
from brownie import interface
from rich.console import Console
from helpers.utils import snapBalancesMatchForToken
from .StrategyBaseSushiResolver import StrategyBaseSushiResolver
console = Console()
class StrategySushiDiggWbtcLpOptimizerResolver(StrategyBaseSushiResolver):
d... | StarcoderdataPython |
1666685 | # Copyright 2014
| StarcoderdataPython |
3238585 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Docker.
#
# 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 ap... | StarcoderdataPython |
1662439 | <reponame>eragasa/pypospack
import numpy as np
from pypospack.crystal import SimulationCell
class Diamond(SimulationCell):
def __init__(self,symbols=['Si'],a0=5.431,cell_type='cubic'):
SimulationCell.__init__(self)
cell_initializers = {}
cell_initializers['cubic'] = self.initiali... | StarcoderdataPython |
1671493 | <reponame>liaomars/douban_login
import requests
from PIL import Image
from pyquery import PyQuery as pq
HEADER = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.170 Safari/537.36',
'Referer': 'https://accounts.douban.com/login',
'Host... | StarcoderdataPython |
2489 | from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.core.urlresolvers import reverse
from django.shortcuts import render
from django.http import HttpResponseRedirect
from core.models import Po... | StarcoderdataPython |
3275811 | import os
import numpy as np
import tensorflow as tf
from keras.preprocessing.image import Iterator, img_to_array, array_to_img
from keras import backend as K
import logging
from utils.reporting.logging import log_message
from utils.data_and_files.file_utils import get_file_path
import lmdb
import pickle
from utils.dat... | StarcoderdataPython |
3295996 | <filename>tests/conftest.py
import os
import sys
import pytest
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import edi_835_parser
current_path = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture
def blue_cross_nc_sample():
path = current_path + '/test_edi_835_files/... | StarcoderdataPython |
3366551 | <filename>multidim_image_augmentation/python/kernel_tests/cubic_interpolation3d_op_test.py
# Lint as: python2, python3
# Copyright 2018 Google LLC
#
# 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... | StarcoderdataPython |
3231776 | <gh_stars>0
with open("advent2.txt", "r") as file:
input_ = file.read().split('\n')
modified_input = [[int((a := x.split('-'))[0]), int((b := a[1].split(' ', 1))[0]), b[1].split(': ')[0], b[1].split(': ')[1]] for x in input_]
correct_passwords = [x for x in modified_input if x[0] <= x[3].count(x[2]) <= x[1]]
pri... | StarcoderdataPython |
1741908 | # As we've called out earlier writing loops allows us to get our computer
# to do repetitive work for us. So this is one of the main benefit of writing scripts
# in IT is to save time by automating repetitive tasks, loops are super useful. So
# let's make sure you avoid some of the most common mistakes people make
# wh... | StarcoderdataPython |
4550 | <reponame>shane-breeze/AlphaTwirl
# <NAME> <<EMAIL>>
import pytest
try:
import unittest.mock as mock
except ImportError:
import mock
from alphatwirl.concurrently import TaskPackageDropbox
##__________________________________________________________________||
@pytest.fixture()
def workingarea():
return mo... | StarcoderdataPython |
1790697 | import sqlite3
DB_FILEPATH = ("northwind_small.sqlite3")
conn = sqlite3.connect(DB_FILEPATH)
curs = conn.cursor()
# Begin Part 2 queries
most_expensive_prod = """
SELECT *
FROM Product
ORDER BY UnitPrice DESC
LIMIT 10;
"""
curs.execute(most_expensive_prod)
avg_emp_age = """
SELECT AVG(
... | StarcoderdataPython |
3391042 | # -*- coding: utf-8 -*-
from shortcuts import *
from utils import default, bv, testValue, equalExcept1BV, verboseIt, evalVec, strList2Str, getIt, testValueVec, ifthenelse, ifthenelseFct, extract1BV
######################################
## UTILS for GRN inference problem ##
######################################
#... | StarcoderdataPython |
182199 | <gh_stars>0
#!/usr/bin/env python
import os
import sys
import argparse
from math import log,pow
from data_tools.lib.files import findNumber,ParameterParser
from data_tools.lib.group import Group,run_grouping
class MeanGroup(Group):
def __init__(self, tup):
super(MeanGroup, self).__init__(tup)
self... | StarcoderdataPython |
1729 | from server import roles
def hasRole(member, roleID):
role = member.guild.get_role(roleID)
return role in member.roles
def gainedRole(before, after, roleID):
role = before.guild.get_role(roleID)
return (role not in before.roles) and (role in after.roles)
def isExplorer(ctx):
return hasRole(ctx... | StarcoderdataPython |
3322509 | # https://leetcode.com/problems/largest-rectangle-in-histogram/
# Given an array of integers heights representing the histogram's bar height where
# the width of each bar is 1, return the area of the largest rectangle in the
# histogram.
################################################################################... | StarcoderdataPython |
4840286 | from .shapenet import *
from .modelnet import *
from .scan2cad import *
from .shrec import *
from .scannet import *
| StarcoderdataPython |
3353808 | from django.core.management.base import BaseCommand, CommandError
from django.db import IntegrityError
import olympia.core.logger
from olympia.access.models import Group, GroupUser
from olympia.users.models import UserProfile
class Command(BaseCommand):
help = 'Add a new user to a group.'
log = olympia.cor... | StarcoderdataPython |
192244 | """Crie um programa que leia um número inteiro e mostre na tela se ele é PAR ou ÍMPAR."""
num = int(input('Digite um número: '))
resultado = num % 2
if resultado == 0:
print('O NUMERO {} É PAR'.format(num))
else:
print('O NUMERO {} É IMPAR'.format(num))
| StarcoderdataPython |
1625087 | <filename>skills/echo.py
from typing import Text
from linebot.models import TextSendMessage
from models.message_request import MessageRequest
from skills import add_skill
@add_skill('{not_match}')
def get(message_request: MessageRequest):
return [
TextSendMessage(text=f'You said: {message_request.message}... | StarcoderdataPython |
1700634 | from datetime import date
print('\033[:33m=====\033[1:34mBem vindo ao serviço militar faça o seu registro\033[:33m=====\033[m')
print('\033[1mRegistro')
sexo = str(input('Qual é o seu sexo? ')).strip()
if sexo.lower() == 'masculino':
ano = int(input('\033[1:32mQual é o seu ano de nascimento?\033[m '))
atual = d... | StarcoderdataPython |
3294308 | <reponame>Abluceli/ConnectSix
import random
from .bot_base import Bot
class RandomBot(Bot):
def __init__(self, dim, name='random_bot'):
super().__init__(dim, name)
""" Example bot that runs randomly. """
def choose_action(self, state):
x = random.randrange(0, self.dim)
y = random.r... | StarcoderdataPython |
1636527 | <filename>utils/config.py
class Config(object):
DATA_BASE_PATH = '../data'
RAW_PATH = '../data/LabelingTool/'
DATA_IMAGE_PATH = DATA_BASE_PATH + '/Images'
DATA_MASK_PATH = DATA_BASE_PATH + '/Masks'
SHAPE = (512,768) | StarcoderdataPython |
1603998 | <filename>chapter4.py
# Condition
num = 100
if num % 2 == 0:
print("Even Number")
print("Thank You")
num = input("Please enter a number : ")
num = int(num)
if num % 2 == 0:
print("Even Number")
print("Thank You")
else:
print("Odd Number")
print("Come Again")
num = input("Please ... | StarcoderdataPython |
192359 | <reponame>rafaelbarretomg/Curso-Python-3<filename>Exercicios/mundo2-exercicios-36-71/ex066.py<gh_stars>0
# Crie um programa que leia varios numeros
# inteiros pelo teclado. O programa so
# vai parar quando o usuario digitar o
# valor 999, que eh a condicao de parada.
# No final, mostre quantos numeros foram
# digitados... | StarcoderdataPython |
1796755 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Assessment',
fields=[
... | StarcoderdataPython |
4810083 | # Title: 사분면 고르기
# Link: https://www.acmicpc.net/problem/14681
import sys
sys.setrecursionlimit(10 ** 6)
read_single_int = lambda: int(sys.stdin.readline().strip())
def solution(x: int, y: int):
if 0 < x:
return 1 if y > 0 else 4
else:
return 2 if y > 0 else 3
def main():
x = read_s... | StarcoderdataPython |
1750454 | <reponame>teknogeek/pyRedditWatch
#!/usr/bin/python
import json
from urllib import FancyURLopener
import urllib
import socket
import time
import ssl
import random
import threading
import os
import unidecode
import ConfigParser
genNick = "pyRedditChecker" + str(random.randint(0, 1000))
confParser = Config... | StarcoderdataPython |
150159 | <reponame>kaiden8/depthai-ros-examples<gh_stars>0
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription, launch_description_sources
from launch.actions import IncludeLaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions... | StarcoderdataPython |
180175 | <filename>pyminer/network/regressors.py
__author__ = 'Ralph'
import pandas as pd
from base import Node
from base import InputPort
from base import OutputPort
class Regressor(Node):
def __init__(self, name):
super(Regressor, self).__init__(name)
self.add_input_port(
InputPort(name='... | StarcoderdataPython |
1648013 | #########################################################################
#-*- coding:utf-8 -*-
# File Name: hello.py
# Author: wayne
# mail: <EMAIL>
# Created Time: 2015年08月17日 星期一 16时40分53秒
#########################################################################
#!/bin/python
print "hello"
| StarcoderdataPython |
3265245 | <filename>image-classification.py<gh_stars>0
"""
A TensorFlow Exercise That based on this URL:
Copyright By TensorFlow, under Apache and MIT License
Modified By <NAME> (bl6)
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import tensorflow as tf
# Import TensorFlow Datase... | StarcoderdataPython |
3339834 | from trueskill import Rating, quality_1vs1, rate_1vs1, rate, TrueSkill
import pandas as pd
import numpy as np
import csv
import time
todaytime = time.strftime("%d/%m/%Y")
class MarioBoard(object):
def __init__(self,db):
self.mariodb = db.mariodb
self.db = db
self.playerdf = self.load_db_... | StarcoderdataPython |
3210453 | import threadsafe_tkinter as tk
import tkinter.ttk as ttk
from copy import deepcopy
from traceback import format_exc
from binilla import editor_constants as e_c
from binilla.widgets.scroll_menu import ScrollMenu
from binilla.widgets.field_widgets import field_widget, container_frame,\
data_frame
class ArrayFra... | StarcoderdataPython |
3317350 | """
Codemonk link: https://www.hackerearth.com/practice/data-structures/trees/heapspriority-queues/practice-problems/algorithm/monk-and-champions-league/
Monk's favourite game is Football and his favourite club is "Manchester United". Manchester United has qualified for the
Champions League Final which is to be held a... | StarcoderdataPython |
3358398 | # Copyright 2018 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 applicable law or agreed to in writing,... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.