id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
12811716 | # -*- coding: utf-8 -*-
import time as builtin_time
import pandas as pd
import numpy as np
import platform
import os
import pickle
import gzip
# ==============================================================================
# ==============================================================================
# ===========... | StarcoderdataPython |
3413822 |
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from mpl_toolkits.axes_grid1 import make_axes_locatable
from src.utils import unflatten
def rank_labels(pd_ser):
'''
rank behaviour variables and ignore labels of sparsed variables.
return label and a flatten array ... | StarcoderdataPython |
1944697 | <gh_stars>0
def ascii():
val = input("Enter single char: ")
while True:
print(ord(val))
break
return val
ascii()
| StarcoderdataPython |
9707335 | <reponame>OdincoGaming/Text-Posting
import facebook
def postupdate():
return(1)
def prepareupdate():
# top10 ############################################################
top10 = t10()
#end of top 10 #####################################################
# objectives ###############################... | StarcoderdataPython |
5195614 | from distutils.core import setup
setup(
name='pydojo4',
packages=['pydojo4'],
version='4.0.3',
description='A playful way to learn coding with Python',
author='<NAME>, <NAME>',
author_email='<EMAIL>, <EMAIL>',
url='https://github.com/pog87/PYDOJO',
keywords=['game', 'development', 'learn... | StarcoderdataPython |
1784674 | <reponame>jannetasa/haravajarjestelma<filename>areas/migrations/0006_add_contract_zone_secondary_contact_info.py
# Generated by Django 2.2.8 on 2020-02-22 23:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("areas", "0005_allow_multiple_users_per_contract_zone"... | StarcoderdataPython |
374011 | import unittest
import random
from dramakul.sites import SITES
QUERY = "beauty"
class TestSite(unittest.TestCase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.sites = [site() for site in SITES]
def test_site_functions(self):
for site in self.sites:
... | StarcoderdataPython |
11312685 | import torch
from torch.nn import functional as F
from torch import nn
from policies.models.dqn import Flatten
class DISTRIBUTIONAL_DQN(nn.Module):
"""Implements a 3 layer convolutional network with 2 fully connected layers at the end as explained by:
Bellamare et al. (2017) - https://arxiv.org/abs/1707.0688... | StarcoderdataPython |
11246167 | # 19. strip() -> Retorna a string recortada por determinado valor.
texto = 'vou Treinar todo Dia Python'
print(texto.strip('vou'))
print(texto.strip('Python')) | StarcoderdataPython |
1711072 | import threading
import multiprocessing
import collections
import itertools
from ..primitives import bundle
from ..primitives import chain
from .. import signals
from ..chainsend import eager_send
CPU_CONCURRENCY = multiprocessing.cpu_count()
class StoredFuture(object):
"""
Call stored for future execution... | StarcoderdataPython |
109854 | import numpy as np
import scipy.linalg
from numpy.linalg import cond, norm
from scipy.linalg import toeplitz
from scipy.linalg import solve_triangular
import time
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('darkgrid')
PI = np.pi
CRED = '\033[91m'
CGREEN = '\033[32m'
CEND = ... | StarcoderdataPython |
335282 |
import os
import numpy as np
import scipy.io as scpio
import tofu as tf
_PATH_HERE = os.path.dirname(__file__)
_PATH_INPUTS = os.path.dirname(_PATH_HERE)
_PATH_SAVE = _PATH_INPUTS
# #############################################################################
# ################################################... | StarcoderdataPython |
3394598 | """Calculate the area of a glyph."""
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.pens.basePen import BasePen
class AreaPen(BasePen):
def __init__(self, glyphset=None):
BasePen.__init__(self, glyphset)
self.value = 0
def _moveTo(self, p0):
... | StarcoderdataPython |
3303142 | #!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Setup for PyAuto functional tests.
Use the following in your scripts to run them standalone:
# This should be at the top
import p... | StarcoderdataPython |
5059261 | <filename>deeprankcore/tools/pssm_3dcons_to_deeprank.py<gh_stars>0
import glob
import sys
def pssm_3dcons_to_deeprank(pssm_file):
# pssm = open(pssm_file, 'r').readlines()
with open(pssm_file, "r", encoding = "utf-8") as f:
pssm = f.readlines()
pssm_name = pssm_file.rsplit(".", 1)[0]
with o... | StarcoderdataPython |
240506 | <filename>certego_saas/settings.py
import os
import stripe
from django.conf import settings
from django.test.signals import setting_changed
from rest_framework.settings import APISettings
# placeholder for later
get_secret = os.environ.get
TEST_RUNNER = "tests.timed_runner.TimedRunner"
# stripe-python
STRIPE_LIVE_MO... | StarcoderdataPython |
4952769 | # Definition for binary tree with next pointer.
# class TreeLinkNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# self.next = None
class Solution(object):
def connect(self, root):
"""
:type root: TreeLinkNode
:... | StarcoderdataPython |
6686489 | import limix.modules.data as DATA
import limix.modules.genotype_reader as gr
import limix.modules.phenotype_reader as phr
import scipy as SP
file_name = './../../tutorials/data/smith_2008/smith08.hdf5'
geno_reader = gr.genotype_reader_tables(file_name)
pheno_reader = phr.pheno_reader_tables(file_name)
data = DATA.QT... | StarcoderdataPython |
5185419 | <filename>python/cudf/cudf/tests/test_cut.py<gh_stars>0
# Copyright (c) 2021, NVIDIA CORPORATION.
"""
Test related to Cut
"""
import pandas as pd
import numpy as np
from cudf.core.cut import cut
import pytest
from cudf.tests.utils import assert_eq
@pytest.mark.parametrize(
"x", [[1, 7, 5, 4, 6, 3], [1, 7], np.a... | StarcoderdataPython |
3481722 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | StarcoderdataPython |
3517641 | """
File: caesar.py
Name: <NAME>
------------------------------
This program demonstrates the idea of caesar cipher.
Users will be asked to input a number to produce shifted
ALPHABET as the cipher table. After that, any strings typed
in will be encrypted.
"""
# This constant shows the original order of alphabetic seq... | StarcoderdataPython |
3304879 | from pathlib import Path
root_dir = Path(__file__).parent.parent
schema_dir = root_dir / "schema"
vrs_yaml_path = schema_dir / "vrs.yaml"
vrs_json_path = schema_dir / "vrs.json"
| StarcoderdataPython |
11252164 |
import unittest
import ramda as R
from .helpers.Maybe import Just
"""
https://github.com/ramda/ramda/blob/master/test/union.js
"""
M = [1, 2, 3, 4]
N = [3, 4, 5, 6]
class TestUnion(unittest.TestCase):
def test_combines_two_lists_into_the_set_of_all_their_elements(self):
self.assertEqual([1, 2, 3, 4, 5, 6],... | StarcoderdataPython |
11236145 | <filename>spdx/tv_to_rdf.py
#!/usr/bin/env python
# Copyright (C) 2017 BMW AG
# Author: <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... | StarcoderdataPython |
4919605 | <reponame>aengelke/z-plot<gh_stars>10-100
#! /usr/bin/env python
from zplot import *
# describe the drawing surface
import sys
ctype = 'eps' if len(sys.argv) < 2 else sys.argv[1]
c = canvas(ctype, title='example-multi', dimensions=[300,210])
t = table(file='example-multi.data')
t.addcolumns(columns=['ylower','yhighe... | StarcoderdataPython |
307409 | #
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 2015-02-27 4174 nabowle Output full stacktrace.
# 2018-10-05 <EMAIL> Fix returned retVal encoding.
#
... | StarcoderdataPython |
9778182 | <reponame>kcosta42/Multilayer_Perceptron
import libft.backend.math as M
from libft.initializers.initializer import Initializer
class VarianceScaling(Initializer):
"""Initializer capable of adapting its scale to the shape of weights.
With `distribution="normal"`, samples are drawn from a truncated normal
... | StarcoderdataPython |
9760912 | from units import brokers, sensors, data, ingestionClients
import sys
import argparse
import yaml
import os
# read yaml file and set config obj
def load_config(path):
config = None
with open(path, 'r') as config_file:
config = yaml.load(config_file,Loader=yaml.FullLoader)
return config
def main(pa... | StarcoderdataPython |
4898199 | <filename>build/sphinx/mongoc_common.py
import os
needs_sphinx = '1.6'
author = 'MongoDB, Inc'
# -- Options for HTML output ----------------------------------------------
smart_quotes = False
html_show_sourcelink = False
# Note: http://www.sphinx-doc.org/en/1.5.1/config.html#confval-html_copy_source
# This will deg... | StarcoderdataPython |
4943055 | <gh_stars>1-10
from src.main.beans.items.base_item import BaseItem
from src.main.managers.items.item_manager import ItemManager
class Shield(BaseItem):
CATEGORY_NAME = ItemManager.SHIELD_CATEGORY_NAME
_AVERAGE_DEF_BOOST = 5
_DEF_SPREAD = 1
def __init__(self, attack=None, defense=None, speed=None, sp... | StarcoderdataPython |
8052542 | # pylint: disable=no-self-use,invalid-name
import numpy
from allennlp.common.testing import AllenNlpTestCase
from allennlp.data import Token, Vocabulary
from allennlp.data.fields import TextField, LabelField, ListField, IndexField, SequenceLabelField
from allennlp.data.token_indexers import SingleIdTokenIndexer, Token... | StarcoderdataPython |
6468405 | from secrets import token_bytes
from ariadne import MutationType
from classes.user import User
MUTATION = MutationType()
@MUTATION.field("logout")
async def r_logout(user: User, *_, universal: bool = True) -> None:
if universal:
await user.update(key=token_bytes(32)).apply()
return None
| StarcoderdataPython |
3338272 | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
class AnimespiderItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
name = scrapy.Field() # 番... | StarcoderdataPython |
11202246 | # Copyright (c) 2017-2019, <NAME>
# Copyright (c) 2014-2018, iocage
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted providing that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# noti... | StarcoderdataPython |
1755400 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from sys import path
from os.path import abspath
from os.path import join
from os import pardir
from cv2 import imshow
from cv2 import flip
from cv2 import cvtColor
from cv2 import COLOR_BGR2GRAY
path.append(abspath(join(__file__, pardir, pardir, 'src')))
from vcapture im... | StarcoderdataPython |
1649658 | ###########################################################################
#
## @file valet.py
#
###########################################################################
import os
import grpc
from . import communicate_pb2_grpc
from . import communicate_pb2
from .server import Server
from .environment import Env... | StarcoderdataPython |
5124035 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from addnn.controller.proto import controller_pb2 as addnn_dot_controller_dot_proto_dot_controller__pb2
from google.protobuf import empty_pb2 as google_dot_proto... | StarcoderdataPython |
4906034 | <reponame>Eroica-cpp/LeetCode
#!/usr/bin/python
# ==============================================================================
# Author: <NAME> (<EMAIL>)
# Date: May 7, 2015
# Question: 075-Sort-Colors
# Link: https://leetcode.com/problems/sort-colors/
# =====================================================... | StarcoderdataPython |
12800341 | <reponame>tiagosm1/Python_Nilo_Ney<filename>exercicios_resolvidos3/exercicios3/capitulo 09/exercicio-09-16.py
##############################################################################
# Parte do livro Introdução à Programação com Python
# Autor: <NAME>
# Editora Novatec (c) 2010-2020
# Primeira edição - Novembro/2... | StarcoderdataPython |
3555670 | import re
from aocd import get_data
def part1(inp):
out = re.sub(r"!.", "", inp)
out = re.sub(r"<[^>]*>", "", out)
lvl = 1
res = 0
for c in out:
if c == '{':
res += lvl
lvl += 1
elif c == '}':
lvl -= 1
return res
def part2(inp):
out = ... | StarcoderdataPython |
11275858 | # Copyright 2018 Inspur Corp.
# 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 |
3462428 | from isitfit.cost.ec2_analyze import Ec2Iterator
from isitfit.utils import logger
import pandas as pd
from tabulate import tabulate
import tempfile
import csv
from collections import OrderedDict
# https://pypi.org/project/termcolor/
from termcolor import colored
def df2tabulate(df):
return tabulate(df.set_i... | StarcoderdataPython |
218152 | # 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 use ... | StarcoderdataPython |
11200559 | from keras.models import load_model
from PIL import Image
import numpy as np
def predict_digit(img):
img = Image.open(img)
model = load_model('mnist.h5')
# resize image to 28x28 pixels
img = img.resize((28, 28))
# convert rgb to grayscale
img = img.convert('L')
img = np.array(i... | StarcoderdataPython |
4978737 | #! /usr/bin/env python
# Convert MH directories (1 message per file) or MMDF mailboxes (4x^A
# delimited) to unix mailbox (From ... delimited) on stdout.
# If -f is given, files contain one message per file (e.g. MH messages)
import rfc822
import sys
import time
import os
import stat
import getopt
import regex
def ... | StarcoderdataPython |
33416 | <reponame>FelixTheoret/Ergocycle<filename>source/StimulationScreen.py<gh_stars>0
"""
Created on Wed March 30 11::00 2022
@author: <NAME>
"""
from tracemalloc import start
from numpy import number
from Screen import Screen as Screen
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QFon... | StarcoderdataPython |
4935784 | <reponame>Floogen/jmod-bloodhound<gh_stars>10-100
import praw
import time
import operator
import re
from datetime import datetime
from praw.models import MoreComments
def comment_check(comment_list, subreddit_name, comment_count):
if subreddit_name == '2007scape' and len(comment_list) > 0:
return True
... | StarcoderdataPython |
5101733 | <gh_stars>0
import subprocess
import os
import sys
if not '/mnt/SSD/sim/python/src/aux/' in sys.path: sys.path.append('/mnt/SSD/sim/python/src/aux/')
import paths
#runs = ['Q kur 0', 'F kur 0', 'Q kur 1', 'F kur 1', 'Q fal 1', 'F fal 1']
runs = ['Q kur 0', 'F kur 0', 'Q fal 1', 'F fal 1']
#runs = ['Q fal 1', 'F fal ... | StarcoderdataPython |
5135163 | import nltk
import sys
def load_fcfg(grammar_filename):
'''
load a grammar file
Args: grammar_filename(str): a filename for a fcfg
Returns: nltk grammar
'''
return nltk.parse.FeatureEarleyChartParser(nltk.data.load(grammar_filename, format='fcfg'))
def load_test_sentences(input_sentence_filenam... | StarcoderdataPython |
1738569 | <reponame>alexcapstick/minder_utils<filename>minder_utils/evaluate/eval_utils.py
from sklearn.metrics import f1_score, accuracy_score
from sklearn.metrics import confusion_matrix
import numpy as np
from sklearn.model_selection import train_test_split, StratifiedKFold
from ..formatting.format_util import y_to_categorica... | StarcoderdataPython |
1686509 | class User:
pass
| StarcoderdataPython |
6580350 | <reponame>Chocowaffres/SRE_Tests<gh_stars>0
### https://xang1234.github.io/multi-label/
import sklearn.metrics as metrics
from skmultilearn.dataset import load_dataset, save_to_arff
from skmultilearn.problem_transform import ClassifierChain, BinaryRelevance, LabelPowerset
from sklearn.ensemble import GradientBoostingC... | StarcoderdataPython |
127183 | from .schema import ReactionNames, ReactionECs, ReactionMetabolites, ReactionAlternatives
def ecs(rid):
query = ReactionECs.select().where(ReactionECs.rid == rid)
return [item.ec for item in query]
def ids(ec):
query = ReactionECs.select().where(ReactionECs.ec == ec)
return [item.rid for item i... | StarcoderdataPython |
11252734 | from django.contrib import admin
from .models import User, Profile, Application, UserReward
class UserAdmin(admin.ModelAdmin):
model = User
admin.site.register(User, UserAdmin)
admin.site.register(Profile)
admin.site.register(Application)
admin.site.register(UserReward)
| StarcoderdataPython |
6659943 | <gh_stars>0
# BEGIN: Copyright
# Copyright (C) 2019 Rector and Visitors of the University of Virginia
# All rights reserved
# END: Copyright
# BEGIN: License
# 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 co... | StarcoderdataPython |
1947469 | <gh_stars>0
# --------------
# Importing header files
import numpy as np
import warnings
warnings.filterwarnings('ignore')
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Reading file
data = np.genfromtxt(path, delimiter=",", skip_header=1)
print("\nData: \n\n", data)
print("\nType of data: \n... | StarcoderdataPython |
6596820 | <gh_stars>0
import re
from typing import Optional
from il2fb.ds.events.definitions.cheating import CheatingInfo
from il2fb.ds.events.definitions.cheating import CheatingDetectedEvent
from .base import PlainLineParser
from ._utils import export
CHEATING_REGEX = re.compile(
r"^socket channel '(?P<channel_no>\d+)'... | StarcoderdataPython |
3360880 | """
The :mod:`kavica.parser` module includes data file parsers.
"""
from .prvparse import (ControlCZInterruptHandler,
ExtensionPathType,
ParsedArgs,
Parser)
__all__ = ['ControlCZInterruptHandler',
'ExtensionPathType',
'ParsedAr... | StarcoderdataPython |
6490865 | import requests
from bs4 import BeautifulSoup
for i in range(0, 200):
r = requests.post('http://howstat.com/cricket/Quiz/Quiz.asp',data = {'cboCategory': 'J', 'txtAction': 'Start'})
s = BeautifulSoup(r.text, 'lxml')
x = s.find_all('td', {'class': 'TextCrimsonBold10'})
question = x[0].text.strip()
... | StarcoderdataPython |
12826031 | <reponame>patmloi/PalettePal
# Copyright 2021, <NAME>, mailto:<EMAIL>
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file excep... | StarcoderdataPython |
6627271 | <reponame>kaichengyan/amplify-ci-support<filename>src/integ_test_resources/ios/sdk/integration/cdk/cdk_integration_tests_ios/polly_stack.py
from aws_cdk import aws_iam, aws_s3, core
from common.common_stack import CommonStack
from common.platforms import Platform
from common.region_aware_stack import RegionAwareStack
... | StarcoderdataPython |
9732894 | <reponame>BDonnot/grid2op_pp_baseline
__all__ = [
"PandapowerOPFAgent",
"evaluate",
]
from l2rpn_baselines.PandapowerOPFAgent.PandapowerOPFAgent import PandapowerOPFAgent
from l2rpn_baselines.PandapowerOPFAgent.evaluate import evaluate
"""
In the __init__ file, it is expected to export 3 classes with names tha... | StarcoderdataPython |
112934 | # Copyright 2019 Toyota Research Institute. All rights reserved.
import importlib
import os
from setuptools import find_packages, setup
from setuptools.command.build_py import build_py
from setuptools.command.develop import develop
from setuptools.command.install import install
def build_protos():
SETUP_DIR = os... | StarcoderdataPython |
11257083 | <reponame>Michael8968/skulpt<gh_stars>1-10
import turtle
for i in range(6):
turtle.forward(100)
turtle.right(60)
turtle.done()
| StarcoderdataPython |
3570688 | import unittest
import pytest
from pyalink.alink import *
class TestEnvironment(unittest.TestCase):
@pytest.mark.pyflink
def test_batch_get_table(self):
source = CsvSourceBatchOp() \
.setSchemaStr(
"sepal_length double, sepal_width double, petal_length double, petal_width dou... | StarcoderdataPython |
6706669 | import tensorflow as tf
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))
| StarcoderdataPython |
1999982 | <gh_stars>10-100
from al_services.alsvc_mcafee.mcafee import McAfee
| StarcoderdataPython |
12831340 | from __future__ import division
inner_phil_str = """\
scanbox_windows = 101 51 51
#.type = ints(size_min=1, size_max=3, value_min=10)
# future: variable number of window passes
.type = ints(size=3, value_min=10)
.help = "Integer scanbox sizes for calculating background,"
"for cycles 1,2, ... | StarcoderdataPython |
9682790 | theAnswer=42
def quote_marvin():
print('I\'m Sam , how are u ?')
| StarcoderdataPython |
6654753 | <reponame>timgates42/lore<gh_stars>1000+
import inspect
import importlib
import json
import logging
import pkgutil
import lore
import lore.util
import lore.env
from lore.env import require
from lore.util import timer
require(
lore.dependencies.PANDAS +
lore.dependencies.FLASK
)
import pandas
from flask impor... | StarcoderdataPython |
11222703 | <gh_stars>0
# coding: utf-8
from .admin_forms import ChangeProductCategoryXMLForm, ChangeProductPrintTypeForm, \
ChangeCategoryXMLCategorySiteForm, ChangeBrandMakerBrandForm, \
ChangePrintTypeMakerPrintTypeForm, ChangeCategoryXMLMakerForm, \
ChangeProductBrandForm, ChangeProductMakerForm, ChangeProductSta... | StarcoderdataPython |
8056803 | <filename>binarytree_impl.py
from trees.binarytree import BinaryTree
r = BinaryTree('a')
print r.get_root_value()
print r.get_left_child()
r.insert_left('b')
print r.get_left_child()
print r.get_left_child().get_root_value()
r.insert_right('c')
print r.get_right_child()
print r.get_right_child().get_root_value()
r.get... | StarcoderdataPython |
93470 | from Spread.stddevct import StdDevCT
from Operations.differencepower import DifferencePower
from Spread.generalizedvariance import GeneralizedVariance
class StandardDeviation (GeneralizedVariance):
def __init__ (self, length, min_value, max_value, arithmetic_mean):
GeneralizedVariance.__init__ (self, length, min_v... | StarcoderdataPython |
6662473 | <reponame>emmo-repo/EMMO-python<filename>tests/test_basic.py
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ontopy.ontology import Ontology
def test_basic(emmo: "Ontology") -> None:
from ontopy import get_ontology
emmo.sync_reasoner()
onto = get_ontology('onto.owl')
onto.imported_ontol... | StarcoderdataPython |
8026732 | <reponame>sekilas13/Python<filename>Basic/21_regex/regex_code.py
import re
text = "@robot9 "
print(re.findall(r"\d", text))
print(re.findall(r"\w", text))
print(re.findall(r"\s", text))
angka = "1234"
text = "Budi suka makan buah apel"
print(re.findall(r"\d+", angka))
print(re.findall(r"\w+", text))
text = "<NAME... | StarcoderdataPython |
8100875 | ##Task
##The provided code stub reads two integers from STDIN,a and b. Add code to print three lines where:
##1.The first line contains the sum of the two numbers.
##2.The second line contains the difference of the two numbers (first - second).
##3.The third line contains the product of the two numbers.
if __na... | StarcoderdataPython |
8037911 | import test
# Return value test
def square(x):
return x*x
test.testEqual(square(3), 9)
# Side effect test
def update_counts(letters, counts_d):
for c in letters:
counts_d[c] = 1
if c in counts_d:
counts_d[c] = counts_d[c] + 1
counts = {'a': 3, 'b': 2}
update_counts("aaab", count... | StarcoderdataPython |
5030398 | import sys
import logging
import tensorflow as tf
import pandas as pd
class Recorder(object):
'''
TF 2.0 Recorder
'''
def __init__(self, cp_dir, log_dir, excel_dir, logger2file, model=None):
self.writer = tf.summary.create_file_writer(log_dir)
self.checkpoint = tf.train.Checkpoint(pol... | StarcoderdataPython |
9634083 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-21 06:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0002_auto_20170817_0530'),
]
operations = [
migration... | StarcoderdataPython |
1987924 | """
TODO: Exit out of all demon programs when quit
"""
import pathlib as pathlib
import world as world
import enemies as enemies
import command_parser as command_parser
verbs_path = pathlib.Path.cwd() / 'Resources' / 'verbs.txt'
with verbs_path.open(mode='r') as file:
verbs = file.readlines()
verbs = [x.stri... | StarcoderdataPython |
399384 | <gh_stars>1-10
import random
from typing import Any, Dict, List, Tuple
from src.rankings.event_pred import read
from src.rankings.event_pred.models import (
elo as elo_model,
opr as opr_model,
rps as rps_model,
tiebreakers,
)
def get_dicts(event_key: str, year: int):
key = str(year) + event_key
... | StarcoderdataPython |
308158 | <reponame>TiagoJLeandro/maquininha-de-troco<filename>tests/test_calculate_change.py
import pytest
from calculate_change import calculate_change
default_coins_list = [
200, 100, 50, 20, 10, 5,
2, 1, 0.5, 0.25, 0.10, 0.05, 0.01
]
@pytest.mark.parametrize('prod_value,received,expected',
... | StarcoderdataPython |
3361233 | <filename>tests/bitly/test_bitly_history.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import ecstasy
import os
import pytest
import requests
import time
from collections import namedtuple
import tests.paths
import lnk.bitly.history
VERSION = 3
API = 'https:... | StarcoderdataPython |
12839994 | <gh_stars>0
# Generated by Django 2.0.6 on 2018-07-02 10:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('parkingsystem', '0015_auto_20180629_1215'),
]
operations = [
migrations.AlterField(
model_name='parkinglot',
... | StarcoderdataPython |
8136277 | <gh_stars>1-10
###############################################################################
#
# Copyright 2009-2011, Universitat P<NAME>
#
# This file is part of Wok.
#
# Wok is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# ... | StarcoderdataPython |
261101 | <filename>keystone/contrib/oauth1/migrate_repo/versions/001_add_oauth_tables.py
# Copyright 2013 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.apach... | StarcoderdataPython |
6522336 | <reponame>rexsimiloluwah/Python-Experiments
from django.views.generic import View
from django.http import HttpResponse
from app.models import Movie
import json
from .mixins import CSRFExemptMixin
from app.mixins import HttpResponseMixin
from .forms import MovieModelForm
from .utilities import validate_json
# Using C... | StarcoderdataPython |
9689821 | import argparse
import codecs
import json
import pandas as pd
def get_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--ideology', nargs='+', type=str,
help='set <input.csv> (required) and <output.js> (optional, \"ideologies.js\" by d... | StarcoderdataPython |
11341682 | import logging
import os
import shutil
import time
from pathlib import Path
log = logging.getLogger(__name__)
class CompletedSeed:
"""
Object representing a download that has completed seeding
determines if any post-processing of files is required and executes steps including:
1. deleting unwante... | StarcoderdataPython |
29897 | from typing import List
from django.shortcuts import render
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from assignment.models import Assignment
from course.models import Course
class CourseListView(ListView):
template_name = 'course/course_list.html'
model... | StarcoderdataPython |
1638548 | """Top-level package for utilities for bootcamp."""
from .na_utils import *
from .bioinfo_dicts import *
__author__ = '<NAME>'
__email__ = '<EMAIL>'
__version__ = '0.0.1'
| StarcoderdataPython |
1942447 | <filename>xschem/fractional_n_divider/tests/lfsr_fib/test_lfsr_fib_coverage.py
import cocotb
from cocotb.triggers import RisingEdge, ReadOnly
from cocotb_coverage.coverage import *
# auxiliary relation function to define bins matching within a range
range_relation = lambda val_, bin_ : bin_[0] <= val_ <= bin_[1]
clas... | StarcoderdataPython |
5118459 | <gh_stars>0
import random
import math
def quickselect(l, k, pivot_fn = random.choice):
if (len(l) == 1):
assert k==0
return l[0]
pivot = pivot_fn(l)
less = [i for i in l if i < pivot]
greater = [i for i in l if i > pivot]
pivots = [i for i in l if i == pivot]
... | StarcoderdataPython |
1644114 | <reponame>MalteIwanicki/simple_thread
from threading import Thread
class SimpleThread(Thread):
"""Creates and starts a thread with the given function and parameter"""
def __init__(self, function, parameters=()):
if not isinstance(parameters, tuple):
parameters = (parameters,)
Thre... | StarcoderdataPython |
6623859 | from setuptools import setup
from meta import __version__
setup(
name='mergeyaml',
version=__version__,
author="<NAME>",
py_modules=['mergeyaml'],
license="MIT",
install_requires=[
"click==6.7",
"PyYAML==3.12",
"oyaml>=0.4",
],
entry_points='''
[console_s... | StarcoderdataPython |
59039 | <filename>setup.py
#
# This file is part of the Fonolo Python Wrapper package.
#
# (c) Foncloud, Inc.
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
import os
import sys
try:
from setuptools import setup
except ImportError:
from... | StarcoderdataPython |
6682179 | <reponame>jphacks/D_2010
#coding: utf-8
import datetime
from django.db import models
from django.utils import timezone
#liveのURLを管理
class Live(models.Model):
liveName = models.CharField(verbose_name='liveName', max_length=100)
liveUser = models.CharField(verbose_name='liveUser', max_length=100)
... | StarcoderdataPython |
6631777 | <reponame>scotthavens/smrf
'''
2015-11-30 <NAME>
updated 2015-12-31 <NAME>
- start using panda dataframes to help keep track of stations
Distributed forcing data over a grid using different methods
'''
import numpy as np
class IDW:
'''
Inverse distance weighting class for distributing input data. Availa... | StarcoderdataPython |
9697798 | <reponame>xuwenyihust/warp-gallery<filename>bilibili/run.py
from bilibili.WordCloudGenerator import WordCloudGenerator
from bilibili.UserInfo import user_info_map
def run(uid, mask_file_path):
word_cloud_generator = WordCloudGenerator()
videos = word_cloud_generator.get_videos_by_user(uid, 100)
barrages_... | StarcoderdataPython |
1730332 | <gh_stars>0
def to_rna(dna_strand):
map_dna_to_rna = {
"G": "C",
"C": "G",
"T": "A",
"A": "U",
}
rna = []
for dna in dna_strand:
rna.append(map_dna_to_rna.get(dna, ""))
return "".join(rna)
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.