id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
1859869 | <gh_stars>1-10
"""
Given an unsorted array of positive integers.
Find the number of triangles that can be formed with three different array elements as three sides of triangles.
For a triangle to be possible from 3 values, the sum of any two values (or sides) must be greater than the third value (or third side).
For ex... | StarcoderdataPython |
8189681 | <reponame>red1408/healthcare-deid<filename>eval/run_pipeline_lib.py
# Copyright 2017 Google Inc. 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.apach... | StarcoderdataPython |
1707105 | <filename>pycqed/instrument_drivers/meta_instrument/LutMans/mw_lutman.py
from .base_lutman import Base_LutMan, get_redundant_codewords, get_wf_idx_from_name
import numpy as np
from collections.abc import Iterable
from collections import OrderedDict
from qcodes.instrument.parameter import ManualParameter
from qcodes.uti... | StarcoderdataPython |
62425 | """
This is a simplified version to find statistical prevalence that counts instances and is numerically equivalent
to the confidence metric in association rules (# of occurrences / total occurrences).
"""
import csv
def count_stuff(filename):
"""
Counts instances and sorts them by prevalence
... | StarcoderdataPython |
3344267 | import lasagne.layers as L
import lasagne.nonlinearities as NL
import lasagne.init
import numpy as np
import theano.tensor as TT
from rllab.rllab.core.lasagne_layers import ParamLayer
from rllab.rllab.core.lasagne_powered import LasagnePowered
from rllab.rllab.core.network import GRUNetwork
from rllab.rllab.core.seria... | StarcoderdataPython |
5158379 | <reponame>ed-ortizm/sdss-spectra-processing
from setuptools import setup, find_packages
with open("README.md", "r") as file:
long_description = file.read()
setup(
name="sdss",
version="0.0.1",
author="<NAME>",
author_email="<EMAIL>",
packages=find_packages(
where="src", include=["[a-z]... | StarcoderdataPython |
6464 | import function_exercise_01 as st
st.sandwich_toppings('meatballs', 'salad')
| StarcoderdataPython |
1915647 | # Copyright (c) 2021 PaddlePaddle Authors. 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 appli... | StarcoderdataPython |
3509254 | <reponame>cbergmiller/bacpypes
import logging
from ..debugging import DebugContents
from ..task import call_later
from ..apdu import ComplexAckPDU, ConfirmedRequestPDU, encode_max_segments_accepted, encode_max_apdu_length_accepted
from .ssm_states import *
_logger = logging.getLogger(__name__)
__all__ = ['SSM']
cla... | StarcoderdataPython |
397532 | # vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
import re
import sys
import subprocess
import shlex
from powerline.config import POWERLINE_ROOT, TMUX_CONFIG_DIRECTORY
from powerline.lib.config import ConfigLoader
from powerline import genera... | StarcoderdataPython |
3381021 | import pytest
import dumbc.ast.ast as ast
from dumbc.errors import DumbTypeError
from dumbc.errors import DumbNameError
from dumbc.transform.attr_pass import AttrPass
def test_no_attrs_has_body():
foo_func = ast.Function(
ast.FunctionProto('foo', [], ast.BuiltinTypes.I32),
ast.Block([
... | StarcoderdataPython |
11202293 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | StarcoderdataPython |
356130 | <reponame>MLcoinTeam/MLCoin
import argparse
from PIL import Image
# import imageio
import numpy as np
import tensorflow as tf
def load_labels(label_file):
label = []
proto_as_ascii_lines = tf.gfile.GFile(label_file).readlines()
for l in proto_as_ascii_lines:
label.append(l.rstrip())
return label
def read_... | StarcoderdataPython |
6602134 | from commander import Commander
import time
import rospy
rospy.init_node('init_drone')
con = Commander()
time.sleep(0.5)
con.move(-5,0,0)
time.sleep(0.5)
| StarcoderdataPython |
142265 | #vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
from project import *
#from project.tables import db,User
from Authentication import UserAuth
from contacts import *
class UserAuthentication(Resource):
def get(self):
headers = {'Content-Type': 'text/html'}
return make_response(render_template(... | StarcoderdataPython |
8141426 | import warnings
import pytest
from ..gateways.utils import get_supported_currencies
from ..interface import GatewayConfig
@pytest.fixture
def gateway_config():
return GatewayConfig(
gateway_name="Dummy",
auto_capture=True,
supported_currencies="",
connection_params={"secret-key":... | StarcoderdataPython |
3373865 | <filename>denovonear/ensembl_cache.py
""" caches sequence information requested from ensembl, so we don't have to
repeatedly re-request information from the REST API if we have done so recently.
"""
import os
import sqlite3
import sys
import time
import random
import zlib
from pathlib import Path
import json
from date... | StarcoderdataPython |
8039625 | <reponame>mgelbart/ray
from ray.autoscaler.sdk.sdk import (
create_or_update_cluster,
teardown_cluster,
run_on_cluster,
rsync,
get_head_node_ip,
get_worker_node_ips,
request_resources,
configure_logging,
bootstrap_config,
fillout_defaults,
register_callback_handler,
get_d... | StarcoderdataPython |
75896 | class Building(object):
"""Class representing all the data for a building
'attribute name': 'type'
swagger_types = {
'buildingId': 'str',
'nameList': 'list[str]',
'numWashers': 'int',
'numDryers': 'int',
}
'attribute name': 'Attribute name in Swagger Docs'
attribute_map = {
'buildingId': 'buildingId... | StarcoderdataPython |
1782809 | <reponame>chainedfarmsnetwork/quick-n-dirty-meme-contest-handler
# Generated by Django 3.2.3 on 2021-05-21 21:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('web', '0001_initial'),
]
operations = [
mi... | StarcoderdataPython |
364906 | from .void_element import VoidElement
from ..attribute.composite import Common, HasFixedSize
from ..attribute import (
AttributeRenderer,
Accept, Alternative, Autocomplete,
Capture, Checked, DirectionName,
Disabled, Form, FormAction, FormEncodingType,
FormMethod, FormNoValidate, FormTarget, List,
... | StarcoderdataPython |
1660300 | <filename>src/nodemgr/common/windows_process_mem_cpu.py
#
# Copyright (c) 2018 Juniper Networks, Inc. All rights reserved.
#
from sandesh.nodeinfo.cpuinfo.ttypes import ProcessCpuInfo
class WindowsProcessMemCpuUsageData(object):
def __init__(self, _id, last_cpu, last_time):
self.last_cpu = last_cpu
... | StarcoderdataPython |
4864012 | '''
给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。
'''
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
if len(s) <= 1:
return len(s)
maxLen = 0
strlen = len(s)
end = -1
map = set()
for i in range(strlen):
if i != 0:
map.r... | StarcoderdataPython |
3509227 | import os
from flask import Flask
from config import Config
def create_app(config_class=Config):
"""
Application factory function.
Create and configure the application.
:return: app instance
"""
BASEDIR = os.path.abspath(os.path.dirname(__file__))
app = Flask(__name__, instance_relative_c... | StarcoderdataPython |
4875128 | <gh_stars>10-100
"""Install script for ``proxpi``."""
import setuptools
setuptools.setup()
| StarcoderdataPython |
9616503 | """
run.py (arxiv_collect)
----------------------
Collect a portion of "raw" arXiv data from the bulk API, and parse to the MySQL database.
"""
import boto3
import logging
import os
from sqlalchemy.orm.exc import NoResultFound
from urllib.parse import urlsplit
from nesta.core.orms.orm_utils import get_mysql_engine, ... | StarcoderdataPython |
5041495 | # Generated by Django 3.1.13 on 2021-08-03 14:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nomenclatoare', '0010_historicaltiparcbolta_tiparcbolta'),
('biserici', '0038_finisajaltar_finisajnaos_finisajportic_finisajpronaos_historicalfinisa... | StarcoderdataPython |
295533 | import json
import argparse
import numpy as np
import os
import ray
import train
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--gpu", "-g", type=str, help="number of gpus")
args, _ = parser.parse_known_args()
if int(args.gpu) > 4:
ray.init(address='auto',... | StarcoderdataPython |
27495 | import logging, traceback, time
from bottle import request
from snuggle import configuration
from snuggle import mediawiki
from snuggle import errors
from snuggle.data import types
from snuggle.web.util import responses, user_data
logger = logging.getLogger("snuggle.web.processing.users")
class Events:
def __init__... | StarcoderdataPython |
290882 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import pickle
from models.GSEM import GSEM
## definition of paths
negative_multipliers = [1, 5, 10, 15, 20, 30, 50, 100]
dataset_base_path = './data/'
result_path = './results/'
project_name = 'msb201126'
... | StarcoderdataPython |
215861 | from time import sleep
import pytest
import requests
import utils
import client_simulator_api_tests as cs
from config import BASE_URL
@pytest.fixture(autouse=True)
def run_before_each_test():
utils.remove_everything_from_db()
# ^ before each test
yield
# v after each test
@pytest.fixture(scope='modu... | StarcoderdataPython |
3532281 | # Copyright 2014 <NAME>. 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... | StarcoderdataPython |
1709264 | <filename>api/esprr_api/tests/test_compute.py
import pandas as pd
import numpy as np
import pytest
from esprr_api import compute, models, settings
from esprr_api.data import nsrdb
@pytest.mark.parametrize(
"args,kwargs",
(
((), {}),
((0,), {}),
((9,), {"a": "b"}),
((), {"pres... | StarcoderdataPython |
3227035 | #!/usr/bin/env python3
from .constant_mean import ConstantMean
from .constant_mean_grad import ConstantMeanGrad
from .linear_mean import LinearMean
from .mean import Mean
from .multitask_mean import MultitaskMean
from .zero_mean import ZeroMean
__all__ = ["Mean", "ConstantMean", "ConstantMeanGrad", "LinearMean", "Mul... | StarcoderdataPython |
9651294 | <reponame>jkbm/esports<filename>hsapp/misc.py
import requests
import urllib.request
from datetime import datetime
import time
from bs4 import BeautifulSoup
from .models import Match, Tournament, Player, Game, Group, Deck, Deckset
from django.db.models import Q
from django.core.files import File
import json
import re
f... | StarcoderdataPython |
11382284 | <reponame>mattnickerson993/clinnotes2<filename>clinnotes/reflections/models.py<gh_stars>0
from django.db import models
from django.contrib.auth import get_user_model
from django.utils import timezone
from django.conf import settings
from clinnotes.users.models import EpisodeOfCare, Patient
# Create your models here.
... | StarcoderdataPython |
11347081 | <filename>model_h.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from modules import CoAttentionMessagePassingNetwork
class DrugDrugInteractionNetworkH(nn.Module):
def __init__(
self,
n_atom_type, n_bond_type,
d_node, d_edge, d_atom_feat, d_hid,
n_prop_step,
n_side_effect=None,... | StarcoderdataPython |
3219042 | <reponame>trenton/aws-sam-cli<gh_stars>1-10
"""
Init module to scaffold a project app from a template
"""
import itertools
import logging
from cookiecutter.exceptions import CookiecutterException
from cookiecutter.main import cookiecutter
from samcli.local.common.runtime_template import RUNTIME_DEP_TEMPLATE_MAPPING
f... | StarcoderdataPython |
8020119 | import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
from ECAgent.Core import Model
# Can be used to customize CSS of Visualizer
external_stylesheets = ['https://rawgit.com/BrandonGower-Winter/ABMECS/master/Assets/VisualizerCustom.css',
... | StarcoderdataPython |
8106178 | # -*- coding: utf-8 -*-
"""
@date: 2020/12/9 上午11:54
@file: test_resnet3d_basicblock.py
@author: zj
@description:
"""
import torch
import torch.nn as nn
from tsn.model.backbones.resnet3d_basicblock import ResNet3DBasicBlock
def test_resnet3d_basicblock():
data = torch.randn(1, 64, 1, 56, 56)
inplanes = 64... | StarcoderdataPython |
6413879 | from marshmallow import Schema, fields
from pfms.pfapi.base.pfms_base_schema import PfBaseSchema
class BaseResponse(Schema):
status = fields.String()
code = fields.String()
def get_data_response_def(self, data: dict = None):
if not data:
data = {}
data["status"] = fields.Strin... | StarcoderdataPython |
8090356 | import pandas as pd
import numpy as np
import os
from sklearn.metrics import *
def getfile(root, filename):
if root[-1]!='/':
root+='/'
if '.csv' not in filename:
filename = filename+'.csv'
file = root+filename
df = pd.read_csv(file,header=None)
df = np.asarray(df)
... | StarcoderdataPython |
44998 | Mein neuer Code...
Neue zeite Codezeile ...
| StarcoderdataPython |
11361632 | input = [line.strip().split(' ') for line in open('input/day12.txt').readlines()]
registers = {
'a':0,
'b':0,
'c':0,
'd':0
}
def run_program(part=1):
if part > 1:
registers['c'] = 1
i = 0
while i < len(input):
line = input[i]
cmd = line[0]
if cmd == 'cpy':
... | StarcoderdataPython |
4918749 | class X:
def display(self):
"""Display Configuration values."""
print("\nConfigurations:")
for a in dir(self):
if not a.startswith("__") and not callable(getattr(self, a)):
print("{:30} {}".format(a, getattr(self, a)))
print("\n"
| StarcoderdataPython |
348349 | from django.contrib import admin
from .models import UserGrade, UserLog
@admin.register(UserGrade)
class UserGradeAdmin(admin.ModelAdmin):
list_display = ('user', 'grade')
@admin.register(UserLog)
class UserLogAdmin(admin.ModelAdmin):
list_display = ('time', 'user')
list_filter = ('time', 'user')
# Regi... | StarcoderdataPython |
1998351 | # -*- test-case-name: openid.test.test_server -*-
"""OpenID server protocol and logic.
Overview
========
An OpenID server must perform three tasks:
1. Examine the incoming request to determine its nature and validity.
2. Make a decision about how to respond to this request.
3. Format th... | StarcoderdataPython |
1849976 | <gh_stars>0
# Copyright 2015 Google Inc. 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... | StarcoderdataPython |
4993645 | import typing
import orm
from orm import Base
def init_tables(database, replica_database=None):
metadata = orm.utils.init_tables(Base, database, replica_database=replica_database)
return metadata
| StarcoderdataPython |
8186965 | """
Toy Indexer
===========
Toy indexing example for testing purposes.
:Authors: <NAME>, <NAME>
"""
from nordlys.core.retrieval.elastic import Elastic
def main():
index_name = "toy_index"
mappings = {
"title": Elastic.analyzed_field(),
"content": Elastic.analyzed_field(),
}
docs = ... | StarcoderdataPython |
11312437 | <gh_stars>10-100
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | StarcoderdataPython |
11234406 | <gh_stars>1-10
import utils
import hlir
import draw
class Function(draw.NodeContainer):
def __init__(self, header_node, num_params, num_retvals, external):
draw.NodeContainer.__init__(self, header_node)
self.address = self.header_node.address
self.params = []
self.num_params = num_params
self.num_retvals ... | StarcoderdataPython |
5134144 | <gh_stars>0
if __name__ == '__main__':
x = [5, 7, 8, 1, 2]
y = []
for num in x:
num **= 2
y.append(num)
y.sort(reverse=True)
print(y) | StarcoderdataPython |
11282028 | from __future__ import absolute_import, division, print_function, unicode_literals
import torch
import torch.nn.functional as F
from tests.utils import jitVsGlow
import unittest
class TestRelu(unittest.TestCase):
def test_relu_basic(self):
"""Basic test of the PyTorch relu Node on Glow."""
def ... | StarcoderdataPython |
11239345 | <filename>samples/iot gateway example.py
# -------------------------------------------------------------------------
# Copyright (c) 2020, PTC Inc. and/or all its affiliates. All rights reserved.
# See License.txt in the project root for
# license information.
# ---------------------------------------------------------... | StarcoderdataPython |
5057848 | <filename>alf/algorithms/memory.py
# Copyright (c) 2019 Horizon Robotics. 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-... | StarcoderdataPython |
1855010 | def isNum(n):#异常连续捕获分阶段判断
try:
(complex)(n)
return True
except (TypeError,ValueError):
try:
(float)(n)
return True
except (TypeError,ValueError):
try:
(int)(n)
return True
except (TypeError,ValueError... | StarcoderdataPython |
12811911 | <gh_stars>0
def count_letters(text):
result={}
for letter in text:
if letter not in result:
result[letter] = 0
result[letter] += 1
return result
# The key is a letter and the value is how many times that letter is present.
count_letters("aaaaa")
{'a': 5}
count_letters("tenant")... | StarcoderdataPython |
11216302 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 16 17:56:31 2015
@author: Paco
"""
import numpy as np
class Metrics(object):
_batch_size = 10000
def __init__(self): pass
def braycurtis_pond_dist(self,X,pairs,M):
n_pairs = pairs.shape[0]
dist = np.ones((n_pairs,), dtype=np.dt... | StarcoderdataPython |
1799805 | <filename>appengine/monorail/api/api_proto/features_prpc_pb2.py
# Generated by the pRPC protocol buffer compiler plugin. DO NOT EDIT!
# source: api/api_proto/features.proto
import base64
import zlib
from google.protobuf import descriptor_pb2
# Includes description of the api/api_proto/features.proto and all of its ... | StarcoderdataPython |
11386518 | <reponame>ahameedx/intel-inb-manageability
# -*- coding: utf-8 -*-
"""
This module is to check the current node package installed on Yocto system.
Copyright (C) 2019-2022 Intel Corporation
SPDX-License-Identifier: Apache-2.0
"""
import logging
from typing import Optional
from node.constant import NODE_VER... | StarcoderdataPython |
1785086 | <filename>adjacent_attention_network/__init__.py
from adjacent_attention_network.adjacent_attention_network import AdjacentAttentionNetwork
| StarcoderdataPython |
6423947 | <gh_stars>10-100
from sm.engine.formula_parser import format_ion_formula, safe_generate_ion_formula
ION_INS = (
'INSERT INTO graphql.ion (ion, formula, chem_mod, neutral_loss, adduct, charge, ion_formula) '
'VALUES (%s, %s, %s, %s, %s, %s, %s) '
'RETURNING id'
)
ION_SEL = (
'WITH ions AS ('
' SEL... | StarcoderdataPython |
8138175 | <reponame>BensonRen/AEM_DIM_Bench
"""
This file serves as a modulized evaluation interface for the network
"""
# Built in
import os
import sys
sys.path.append('../utils/')
# Torch
# Own
import flag_reader
from class_wrapper import Network
from model_maker import NA
from utils import data_reader
from util... | StarcoderdataPython |
1900063 | ## Copyright 2015-2019 <NAME>, <NAME>
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
## http://www.apache.org/licenses/LICENSE-2.0
## Unless required by applicable law or agreed to i... | StarcoderdataPython |
132073 | import tempfile
from src.script_handler import *
from src.cyk import cyk
def run_script(s):
temp = tempfile.NamedTemporaryFile()
f = open(temp.name, 'w')
f.write(s)
f.close()
return handle_script_from_file(temp.name)
def test_list_all_graphs(capsys):
path = os.path.dirname(__file__) + '/res... | StarcoderdataPython |
5115985 | from fastapi import APIRouter
from typing import Any, List
from fastapi import Depends, FastAPI
from starlette.status import HTTP_201_CREATED, HTTP_404_NOT_FOUND
from sqlalchemy.orm import Session
from app.infra.postgres.crud.user import users
from app.schemas import user
from app.infra.postgres.models.base import get_... | StarcoderdataPython |
8115490 | from hypercomplex import Order, Names
import argparse as ap
import matplotlib as mpl
import seaborn as sea
import pylab as pyl
import numpy as np
# Color Maps: https://matplotlib.org/stable/tutorials/colors/colormaps.html
def plot(**options):
def option(name, default, **options):
if name in options:
return ... | StarcoderdataPython |
9788952 | <filename>code/main.py
import sys
import torch
from tqdm import tqdm
from const import MODEL_NAME, TMP_FOLDER
from model import Module
from utils import (bar, cal_auc, cal_num, get_data_loader, make_submit,
setup_seed)
GPU = torch.device('cuda:0')
PATIENCE = 5
BATCH_SIZE = 100
EPOCH = 2000
LR ... | StarcoderdataPython |
3381396 | <reponame>windowssocket/py_leetcode
class Solution:
def canCompleteCircuit(self, gas, cost):
"""
:type gas: List[int]
:type cost: List[int]
:rtype: int
"""
ret = -1
sum = total = 0
k = 0
comb = [gas[i] - cost[i] for i in range(len(gas))]
... | StarcoderdataPython |
1632124 | <filename>src/conference_scheduler/validator.py
from conference_scheduler import converter
from conference_scheduler.lp_problem import constraints
def array_violations(array, events, slots, beta=None):
"""Take a schedule in array form and return any violated constraints
Parameters
----------
arra... | StarcoderdataPython |
4930175 | from distutils.core import setup
setup(
name = 'Categorical_similarity_measures',
packages = ['Categorical_similarity_measures'],
version = '0.4',
license='MIT',
description = 'Similarity Measures Utility Package',
long_description="Determining similarity or distance between two objects is a key step for se... | StarcoderdataPython |
378102 | <filename>tests/zxpy_test.py
import ast
import os
import pytest
import zx
@pytest.mark.parametrize(
('command', 'output'),
(
('echo hello world', 'hello world'),
('ls | tail -6 | wc -l', '6'),
("find . -maxdepth 1 -name '*\\.py' | grep -v test | wc -l", '3'),
("cat /etc/shadow... | StarcoderdataPython |
8007096 | #!/usr/bin/python3
import os.path
import devpipeline_core.paths
import devpipeline_configure.parser
import devpipeline_configure.modifiers
def get_override_path(config, override_name, package_name):
return devpipeline_core.paths.make_path(
config, "overrides.d", override_name, "{}.conf".format(package_... | StarcoderdataPython |
9665613 | <filename>deathgod/map_view.py
#!/usr/bin/env python
# encoding: utf-8
""" map_view.py - module containing classes for drawing the game map. """
import pygame
from pygame.locals import *
from . import settings
from .view import View
from .ordered_pair import x, y
from . import colors
class MapView(View):
"""This ... | StarcoderdataPython |
4903243 | # test cases for MynesBoard
from Pod7.MynesBoard import MynesBoard
import unittest
class MyneBoardTestCase(unittest.TestCase):
def test_board_default(self):
"""
Test if the default values of the board's attributes are correct
"""
test_board = MynesBoard()
self.assertEqual... | StarcoderdataPython |
5163904 | # Definition for a binary tree node.
import math
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def __init__(self):
self.x = 0
self.y = 0
def isBalanced(self, root: TreeNode) -> bool:
if... | StarcoderdataPython |
9631591 | from django.contrib import admin
from core.models import Evento
class EventoAdmin(admin.ModelAdmin):
list_display = ('titulo', 'data_evento', 'data_criacao')
list_filter = ['usuario', ]
admin.site.register(Evento, EventoAdmin)
| StarcoderdataPython |
6447087 | <gh_stars>0
from enum import Enum
from ..base import Base
from .material import *
from .axis import Axis
STRUCTURAL_PROPERTY = "Objectives.Structural.Properties"
class MemberType(int, Enum):
Beam = 0
Column = 1
Generic1D = 2
Slab = 3
Wall = 4
Generic2D = 5
VoidCutter1D = 6
VoidCutt... | StarcoderdataPython |
8044609 | # coding: utf-8
# flake8: noqa
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.16.7
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# import models into model package
from gitea_api.mod... | StarcoderdataPython |
3417079 | <reponame>zoheezus/python-bootcamp
my_dict = {"key1":"value1", "key2":"value2"}
print(my_dict)
print(my_dict["key1"])
prices_lookup = {"apple":2.99,"oranges":1.99,"milk":5.80}
print(prices_lookup["apple"])
d = {"k1":123,"k2":[0,1,2],"k3":{"insideKey":100}}
print(d["k2"])
print(d["k3"])
# stacking index calls
print(d[... | StarcoderdataPython |
1745407 | <filename>pdf_rendering_service/documents/migrations/0003_auto_20210124_1643.py
# Generated by Django 3.1.5 on 2021-01-24 16:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('documents', '0002_auto_20210124_1557'),
]
operations = [
mig... | StarcoderdataPython |
5025269 | <gh_stars>1-10
import unittest
from unittest.mock import patch
from constants.env_variables import read_list_from_env
def dict_mock(variable, default):
return {"block": '42', "multistr": "hello;my,world", 'multiint': '1,2;3'}.get(variable, default)
class UtilTest(unittest.TestCase):
def setUp(self) -> Non... | StarcoderdataPython |
11286495 | <reponame>Wattyyy/LeetCode<gh_stars>0
# https://leetcode.com/problems/uncrossed-lines
from collections import defaultdict
class Solution:
def maxUncrossedLines(self, A, B):
dp, m, n = defaultdict(int), len(A), len(B)
for i in range(m):
for j in range(n):
dp[(i, j)] = ... | StarcoderdataPython |
9618701 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 10 22:09:03 2018
@author: <NAME>
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
dataset = pd.read_csv('StudentsPerformance.csv')
X = dataset[['gender', 'race/ethnicity', 'parental level of education', 'lunch', 'test preparation co... | StarcoderdataPython |
57098 | <gh_stars>1-10
"""Provide a class for csv character list import.
Copyright (c) 2021 <NAME>
For further information see https://github.com/peter88213/PyWriter
Published under the MIT License (https://opensource.org/licenses/mit-license.php)
"""
import os
import re
from pywriter.csv.csv_file import CsvFile
... | StarcoderdataPython |
1724878 | <reponame>CHHOrganization/BlackDoc
import os,sys,time
Banner_msg = "Follow Us At Telegram To Stay Upto Date."
Line = "*****************************************"
Endl2 = " 100% DC. Tool Is Done Loading "
DCWMs = " Welcome 2 DarkCity - DC. Tool "
#Clearing Screen
def clearConsole():
Refresh = 'c... | StarcoderdataPython |
1664237 | <reponame>LoveBootCaptain/WeatherPi<gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
from init_logging import log_string
class Config:
def __init__(self):
# read the config file
self.config_data = open('/home/pi/WeatherPi/config.json').read()
self.config = json.loads(... | StarcoderdataPython |
8061742 | import datetime
import os
import shutil
import StringIO
from collections import Counter
from operator import attrgetter
from flask import current_app, render_template, request, flash, session, render_template_string, jsonify, redirect, make_response
from emonitor.extensions import scheduler, db, signal
from emonitor.mo... | StarcoderdataPython |
11324076 | from os.path import join, dirname
from setuptools import setup, find_packages
exec(open(join(dirname(__file__),
'src', 'JenkinsLibrary', 'version.py')).read())
PACKAGE = 'robotframework-jenkins'
DESCRIPTION = '''Library for Robot Framework for Jenkins interaction'''
REQUIREMENTS = [
'python-jenkins>... | StarcoderdataPython |
3514841 | <gh_stars>0
import re
from scrappybara.preprocessing.sanitization import sanitize
class Tokenizer(object):
"""Rule based tokenizer, using precompiled regex patterns"""
# SANITIZATION
# -------------------------------------------------------------------------->
__re_sanitization = [
(re.comp... | StarcoderdataPython |
4872270 | <filename>examples/bio_based/run_test_SMA2.py
#!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "Thieu" at 11:20, 20/10/2021 %
# ... | StarcoderdataPython |
4842573 | <filename>paper_uploads/views/__init__.py<gh_stars>1-10
from . import collection, file, image # noqa: 401
| StarcoderdataPython |
6556774 | <reponame>VimalArjunan51437/HACKERRANK-PYTHON
# FOR LEARNING PURPOSE
# BASICS OF STRINGS
def merge(string, k):
for i in range(0, len(string), k):
ans = "" # empty string to store sub_string
for x in string[i : i+k]:
if (x not in ans): #it will not allow repeated character in subs... | StarcoderdataPython |
11219556 | <reponame>Nataliyi/aioaerospike
from dataclasses import dataclass
from enum import IntEnum
from struct import Struct
from typing import List, Type
from bcrypt import hashpw
BCRYPT_SALT = b"$2a$10$7EqJtq98hPqEX7fNZaFWoO"
class AdminCommandsType(IntEnum):
AUTHENTICATE = 0
CREATE_USER = 1
DROP_USER = 2
... | StarcoderdataPython |
8029676 | #! /usr/bin/python3
import sys
import os
import time
from typing import Dict, List, Set, Tuple
import re
import math
from collections import defaultdict
Values = Tuple[int, ...]
Particle = Tuple[Values, Values, Values]
def get_manhatan_value(values: Values) -> int:
return abs(values[0]) + abs(values[1]) + abs(v... | StarcoderdataPython |
6427662 | import inspect
import itertools
import logging
import warnings
from collections import OrderedDict
from collections.abc import Mapping
from timeit import default_timer
import nengo
import nengo.utils.numpy as npext
import numpy as np
from nengo.builder.processes import SimProcess
from nengo.exceptions import ReadonlyE... | StarcoderdataPython |
3309486 | from pprint import pprint # noqa
import csv
from memorious.helpers import make_id
from opensanctions.models import Entity
def parse_row(context, data):
row = data.get('row')
uid = make_id(row.get('Effective_Date'), row.get('Name'))
entity = Entity.create('us-bis-denied', uid)
entity.type = Entity.T... | StarcoderdataPython |
3576633 | from loaders.gene_loader import GeneLoader
from loaders.disease_loader import DiseaseLoader
import gzip
import csv
from files import *
from mod import MOD
class SGD(MOD):
species = "Saccharomyces cerevisiae"
@staticmethod
def gene_href(gene_id):
return "http://www.yeastgenome.org/locus/" + gene_i... | StarcoderdataPython |
4835049 | <gh_stars>10-100
# -*- coding: utf-8 -*-
u"""
ノードタイプのラッパークラスのマネージャー。
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from ..common import *
from ..pyutils import Singleton, parentClasses
from .typeinfo import isDerivedNodeType, getInheritedNodeTypes
__a... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.