id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1667201 | #====================================================
# text_reply.py
## decide the response according to the input text
# YIHAN LINE BOT
# Created by <NAME> on May 21, 2021.
# Copyright © 2021 <NAME>. All rights reserved.
#====================================================
from linebot import (
LineBotApi, Web... | StarcoderdataPython |
3313286 | <filename>sphinx_js/nodes.py
from docutils import nodes
from docutils.nodes import Node
class automodulestoctree(nodes.comment):
pass
def automodules_noop(self: nodes.NodeVisitor, node: Node) -> None:
pass
def automodules_toc_visit_html(self: nodes.NodeVisitor, node: automodulestoctree) -> None:
... | StarcoderdataPython |
3215711 | from floodsystem.stationdata import build_station_list as stations
def test_1D():
#Task 1D (1) Produce a list of rivers with stations without reiteration and in alphabetical order (SZ)
def rivers_with_station(stations):
"""takes station object list.
returns a set of rivers which have stations... | StarcoderdataPython |
34970 | <reponame>codernayeem/python-cheat-sheet
# Functions
print("************* Function ***********")
# Simple function without any arguments/parameters
def say_welocme():
return print('Welocme')
# Simple function with arguments/parameters
def say_helo(name, age):
print('Helo', name, age)
# this function retur... | StarcoderdataPython |
3393682 | from slack_sms_gw.config import (
LoggingConfig,
SlackConfig
)
from slack_sms_gw.slack.client import SlackClient
from requests import Response, PreparedRequest
from requests.structures import CaseInsensitiveDict
class SlackClientHelper:
def __init__(self, log_config: LoggingConfig, config: SlackConfig):
... | StarcoderdataPython |
3335221 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('genealogio', '0018_person_last_name_current'),
]
operations = [
migrations.AlterField(
model_name='timelineitem'... | StarcoderdataPython |
42988 | <gh_stars>0
from datadog import initialize, api
options = {
'api_key': 'api_key',
'app_key': 'app_key'
}
initialize(**options)
start_time = 1419436850
end_time = 1419436870
api.Event.query(start=start_time, end=end_time, priority="normal", tags=["application:web"])
| StarcoderdataPython |
3212434 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
##-------- [PPC] Jobshop Scheduling ---------
# * Author: <NAME>
# * Date: Apr 30th, 2020
# * Description:
# Using the event-driven scheuling method
# to solve the JSS prob. Here is a sample
# code with the style of OOP. Feel free to
# modify it a... | StarcoderdataPython |
65967 | <reponame>kainstan/stealer
import re
from typing import Optional
from django.http import HttpResponse
from core.interface import Service
from core.model import Result, ErrorResult
from tools import http_utils
from core import config
from core.type import Video
headers = {
"user-agent": config.user_agent
}
inf... | StarcoderdataPython |
181360 | <reponame>ADrozdova/ASR
import random
import librosa as lr
import torch
from torch import Tensor
from hw_asr.augmentations.base import AugmentationBase
class PitchShift(AugmentationBase):
def __init__(self, **kwargs):
self.steps = kwargs.get("steps")
self.sampling_rate = kwargs.get("sampling_rat... | StarcoderdataPython |
1694662 | # Generated by Django 3.0 on 2020-03-16 19:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('administration', '0020_auto_20200316_1325'),
]
operations = [
migrations.CreateModel(
name='Variable',
fields=[
... | StarcoderdataPython |
3364807 | import tensorflow as tf
import tensorflow.keras as K
import tensorflow_probability as tfp
class UNet(K.Model):
def __init__(self,
base_channels=64,
fixed_size=False,
in_channels=3,
in_size=(512, 512),
classes=21,
... | StarcoderdataPython |
15901 | from os.path import abspath, join, dirname
from colibris.conf import settings
STATIC_PATH = abspath(join(dirname(__file__), 'swagger'))
UI_URL = settings.API_DOCS_URL
STATIC_URL = '{}/static'.format(UI_URL)
APISPEC_URL = '{}/apispec'.format(UI_URL)
| StarcoderdataPython |
3329915 | <reponame>S73ph4n/octavvs<gh_stars>0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: <NAME>
Atmospheric and scattering correction
"""
import gc
import os.path
from time import monotonic
import numpy as np
import sklearn.linear_model
import sklearn.cluster
#import statsmodels.multivariate.pca
from scipy.i... | StarcoderdataPython |
1781182 | from splinter import Browser
from time import sleep
b = Browser()
b.visit('http://ddg.gg')
print(f'Título: {b.title}')
# print(f'html: {b.html}')
print(f'URL: {b.url}')
b.visit('http://google.com')
b.back()
sleep(3)
b.forward()
sleep(2)
b.quit()
| StarcoderdataPython |
1603791 | #
#
# Copyright (c) 2013, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, ... | StarcoderdataPython |
90357 | <filename>macord/bot.py
import aiohttp
import asyncio
import json
import requests
from typing import Any, Callable
from .message import *
class Bot(object):
def __init__(self, token: str) -> None:
self.__token: str = token
self.__heartbeat_interval: float = 0.0
self.__gateway_url: str = N... | StarcoderdataPython |
62951 | <gh_stars>1-10
# Copyright (C) 2013-2015 Ragpicker Developers.
# This file is part of Ragpicker Malware Crawler - http://code.google.com/p/malware-crawler/
from yapsy.IPlugin import IPlugin
from core.abstracts import Report
class MySQL(IPlugin, Report):
"""Stores data from long-run analysis in MySQL."""
def... | StarcoderdataPython |
4804383 | """
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
from test.unit.rules import BaseRuleTestCase
from cfnlint.rules.resources.properties.ListDuplicatesAllowed import ListDuplicatesAllowed # pylint: disable=E0401
class TestListDuplicatesAllowed(BaseRuleTestCase):
... | StarcoderdataPython |
106531 | import torch.nn as nn
import torch
import numpy as np
class VNet(nn.Module):
def __init__(self, nb_classes, in_channels=1, depth=5,
start_filters=16, batchnorm=True, mode="AE", input_size=None):
assert mode in ['AE', 'classifier'], "Unknown mode selected, currently supported are: 'AE' an... | StarcoderdataPython |
87624 | import os
config = {
'project_path': os.getcwd() + '/../openfoam/run/Airfoil2D_full/'
} | StarcoderdataPython |
7741 |
import torch
import logging
# Transformer version 4.9.1 - Newer versions may not work.
from transformers import AutoTokenizer
from trained_gpt_model import get_inference2
def t5_supp_inference(review_text):
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # CPU may not work, got to check.
... | StarcoderdataPython |
120099 | <gh_stars>1-10
from threading import Thread
from time import sleep
from os import _exit as kill
from _thread import interrupt_main as terminate
import logging
_log = logging.getLogger(__name__)
class Watchdog(object):
def __init__(self, timeout_seconds):
# type: (float) -> Watchdog
"""
A watchdog service that ... | StarcoderdataPython |
1703987 | from typing import AsyncIterable, Iterable, Any, List
from os import scandir, DirEntry, stat_result
from .wrap import to_thread
class EntryWrapper:
__slots__ = "entry",
def __init__(self, entry: DirEntry):
self.entry = entry
def __getattr__(self, attr: str) -> Any:
return getattr(self.e... | StarcoderdataPython |
101187 | <reponame>KenWoo/Algorithm<filename>Algorithms/Easy/1309. Decrypt String from Alphabet to Integer Mapping/answer.py<gh_stars>0
from typing import List
class Solution:
def freqAlphabets(self, s: str) -> str:
dict = {}
for i in range(1, 10):
dict[str(i)] = chr(97+i-1)
for i in ra... | StarcoderdataPython |
3363839 | <reponame>BenjaminAllardEngineer/Adversarial-Attacks-on-Neural-Networks
# Generate adversarial examples for the FC model
# Save some of them in a file
filename = 'data/pickle/fc_adv_examples'
# Create and export 200 adversarial examples for later with epsilon=0.05
fc_model = torch.load(model_2_file)
acc, ex = test_att... | StarcoderdataPython |
1755228 | <gh_stars>1-10
"""
============
Mirai 配置
============
"""
from pydantic import BaseModel
class Config(BaseModel):
"""
Mirai 配置类,将在适配器被加载时被混入到机器人主配置中。
"""
__config_name__ = 'mirai'
"""
配置名称。
"""
adapter_type: str = 'ws'
"""
适配器类型,需要和 mirai-api-http 配置相同。
:type: str
... | StarcoderdataPython |
193331 | from setuptools import setup
import sys
import os
import re
IS_PY_2 = (sys.version_info[0] <= 2)
def read_readme():
with open('README.md') as f:
return f.read()
def read_version():
# importing gpustat causes an ImportError :-)
__PATH__ = os.path.abspath(os.path.dirname(__file__))
with open(o... | StarcoderdataPython |
3293796 | from Colors_Initialize import color_lookup
def color_pair_to_string(major_color, minor_color):
return f'{major_color}\t\t{minor_color}'
def console_print_ref_manual():
print('################# Reference Manual #################')
print('Major Color\tMinor Color\tPair Number')
pair_id = 1
for m... | StarcoderdataPython |
1695220 | <filename>gapid_tests/command_buffer_tests/vkCmdSetStencilReference_test/vkCmdSetStencilReference.py
# Copyright 2017 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://ww... | StarcoderdataPython |
1756280 | import numpy as np
class Statistic:
def __init__(self, data=None):
if data is not None:
self._data = list(data)
else:
self._data = []
def append(self, value):
self._data.append(value)
def extend(self, data):
self._data.extend(data)
... | StarcoderdataPython |
4840096 | <filename>python/paddle/fluid/tests/unittests/test_unique_name.py
# Copyright (c) 2018 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
#
# htt... | StarcoderdataPython |
3362410 | <gh_stars>0
from rest_framework import status
from rest_framework.authentication import BasicAuthentication, SessionAuthentication
from rest_framework.generics import RetrieveAPIView, ListAPIView
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from rest_framework.response import Response
from rest_fram... | StarcoderdataPython |
1620945 | <gh_stars>0
from pyglet import image
import os, sys
base = os.getcwd() + "/Assets/"
icon = image.load(base + 'icon.png')
mario_img = image.load(base + 'mario.png')
luigi_img = image.load(base + 'luigi.png')
| StarcoderdataPython |
1651997 | <reponame>Inch4Tk/label_server<filename>flask_label/api.py
import json
import os
import random
import xml.etree.ElementTree as ET
from xml.dom import minidom
import tensorflow as tf
from flask import (
Blueprint, current_app, send_from_directory, jsonify, request
)
from object_detection.utils import dataset_util
... | StarcoderdataPython |
78274 | # TODO: Faire un test QUI MARCHE sur une des annales du hashcode
# TODO: Coder une solution algo genetique.
# TODO: Voir si splitter Problem en une seconde classe (Solver?) (qui gère parsing + output) est pas plus pratique. C'est surement plus lisible.
import glob
import os
import collections
import ntpath
from typin... | StarcoderdataPython |
3368324 | <reponame>doersino/handwriting
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Designed to run on Uberspace. Get yourself an account and follow these guides:
# https://wiki.uberspace.de/database:postgresql
# https://gist.github.com/tessi/82981559017f79a06042d2229bfd72a8 (s/9.6/10.4/g)
import cgi
import json
import s... | StarcoderdataPython |
4818090 | <gh_stars>1-10
from django.db import models
class Snapshot(models.Model):
snapped_at = models.DateField(unique=True)
href = models.CharField(max_length=55)
completed = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now... | StarcoderdataPython |
4800302 | <filename>tests/test_fields.py
import re
from datetime import datetime
from decimal import Decimal
import pytest
from bson import ObjectId, Decimal128
from aiomongodel import Document, EmbeddedDocument
from aiomongodel.errors import ValidationError
from aiomongodel.fields import (
AnyField, StrField, IntField, Fl... | StarcoderdataPython |
199839 | # Copyright (c) 2018, NVIDIA CORPORATION. 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 |
1738288 | import base64
import math
class DotDict(dict):
"""
a dictionary that supports dot notation access
as well as dictionary access notation
"""
def __init__(self, dictionary):
for key, val in dictionary.items():
self[key] = val
def __setitem__(self, key, val):
if isins... | StarcoderdataPython |
173034 | """
:Copyright: 2006-2021 <NAME>
:License: Revised BSD (see `LICENSE` file for details)
"""
from byceps.services.authentication.session.models.current_user import (
CurrentUser,
)
from byceps.services.authentication.session import service as session_service
from byceps.services.shop.cart.models import Cart
from by... | StarcoderdataPython |
3388440 | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 13 11:31:53 2020
@author: tobia
"""
import networkx as nx
#import network
filepath = ''
print("importing network from" + filepath)
comment_network = nx.read_gpickle(filepath)
#define function to be applied in different shapes
def surpress_problematic_nodes... | StarcoderdataPython |
1791573 | <filename>common/camera_info.py
import json
import cv2
import numpy as np
OAK_L_CALIBRATION_JSON = open('../resources/14442C10218CCCD200.json')
OAK_L_CALIBRATION_DATA = json.load(OAK_L_CALIBRATION_JSON)
OAK_L_CAMERA_RGB = OAK_L_CALIBRATION_DATA['cameraData'][2][1]
OAK_L_CAMERA_LEFT = OAK_L_CALIBRATION_DATA['cameraD... | StarcoderdataPython |
1697697 | """
Creating signor database
:argument: DB_TYPE: name of the source database
:argument: DB_DESTINATION: saving location of the created database files
:argument: CSV_LIST: list of .csv files of each signalink pathway
:argument: FILENAME_TO_PATHWAY_MAP: dictionary from files name to SL... | StarcoderdataPython |
1755031 | <filename>demo/lib/faker_demo.py<gh_stars>1-10
from random import choice
import faker
f = faker.Faker('zh_CN')
# address
print('f.country(): {}'.format(f.country()))
print('f.country_code(): {}'.format(f.country_code()))
print('f.address(): {}'.format(f.address()))
print('f.city: {}'.format(f.city()))
print('f.city_... | StarcoderdataPython |
1629895 | """
Stores the class for TimeSeriesDisplay.
"""
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import datetime as dt
import warnings
from re import search as re_search
from matplotlib import colors as mplcolors
from mpl_toolkits.axes_grid1 import make_axes_locatable
from .plot import Display... | StarcoderdataPython |
122327 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) Huawei Technologies Co., Ltd. 2020-2021. 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.apa... | StarcoderdataPython |
3276216 | <gh_stars>0
from pygolang.io_callback import IO
from pygolang.errors import StopPyGoLangInterpreterError
class FakeIO(IO):
def __init__(self, stdin_as_str_list):
"""
:param list[str] stdin_as_str_list: list(or iterable) of strings, to
simulate the lines from stdin
"""
s... | StarcoderdataPython |
182200 | from flask import Flask, render_template, request, redirect, url_for
from joblib import load
from auth import get_related_tweets
pipeline = load("twitter_classification.joblib")
def requestResults(name):
tweets = get_related_tweets(name)
tweets['prediction'] = pipeline.predict(tweets['tweet_text'])
data... | StarcoderdataPython |
1768706 | <filename>memote/suite/tests/test_annotation.py<gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2017 Novo Nordisk Foundation Center for Biosustainability,
# Technical University of Denmark.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | StarcoderdataPython |
3383384 | <filename>test/with_server/test_server.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
test/test_server.py
~~~~~~~~~~~~~~~~~~~
Tests the pyrc server by actually spinning up an actual server, and actually
sending actual socket messages to it. This is integration testing, not unit
testing, but it's suitably useful that it'... | StarcoderdataPython |
3278577 | '''Forge URLs and utility functions'''
from . import AFWExceptions
AUTODESK_BASE_URL = "https://developer.api.autodesk.com"
TOKENFLEX_API = AUTODESK_BASE_URL+"/tokenflex/v1"
RECAP_API = AUTODESK_BASE_URL+"/photo-to-3d/v1"
AUTH_API = AUTODESK_BASE_URL+"/authentication/v1"
INFO_AUTH = AUTODESK_BASE_URL+"/user... | StarcoderdataPython |
196178 | import re
from collections import defaultdict
from django.db import migrations
def add_users_to_groups_based_on_users_permissions(apps, schema_editor):
"""Add every user to group with "user_permissions" if exists, else create new one.
For each user, if the group with the exact scope of permissions exists,
... | StarcoderdataPython |
4802523 | <gh_stars>1-10
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('challenges.views',
url(r'$', 'show', name='challenge_show'),
url(r'entries/$', 'entries_all', name='entries_all'),
url(r'entries/add/$', 'create_entry', name='entry_create'),
url(r'entries/(?P<entry_id>\d+)/$', '... | StarcoderdataPython |
61642 | <reponame>mjachowdhury/PracticalMachineLearning<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 9 15:24:36 2020
@author: Ted.Scully
"""
import numpy as np
from sklearn.ensemble import IsolationForest
from sklearn.linear_model import Lasso
def main():
trainAll = np.genfromtxt("trainingData.cs... | StarcoderdataPython |
3244979 | <reponame>StillScripts/react-generator
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 23 16:28:26 2022
@author: danie
"""
def create_file(path, content):
index_file = open(path, 'w')
index_file.write(content)
index_file.close
print(f"MAKING FILE - {path}") | StarcoderdataPython |
3285679 | # Generated by Django 3.1.6 on 2021-02-26 14:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("workstation_configs", "0001_squashed_0008_auto_20201001_0758"),
]
operations = [
migrations.AddField(
model_name="workstationcon... | StarcoderdataPython |
1694605 | import discord
import os
import yaml
import random
from datetime import datetime
from discord.ext import commands
from discord.utils import get
from discord.ext.commands.errors import CommandNotFound, CommandInvokeError
from dotenv import load_dotenv
from os import system
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKE... | StarcoderdataPython |
161054 | <reponame>krizex/fund
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import tensorflow as tf
from fund.log.logger import log
__author__ = '<NAME>'
"""
Created on 07/03/2017
@author: <NAME>
"""
# http://www.shareditor.com/blogshow/?blogId=94
class SoftmaxTrainer(object):
def __init__(self, feature_cou... | StarcoderdataPython |
3341277 | from model.utils import *
from dataloader.util_func import *
class LanguageModelsAgent(RetrievalBaseAgent):
'''no train mode, only test'''
def __init__(self, vocab, model, args):
super(LanguageModelsAgent, self).__init__()
self.args = args
self.vocab, self.model = vocab, model
... | StarcoderdataPython |
4807052 | from pytest import mark
from mysign_app.management.commands.seed import Command
from mysign_app.models import Company, DoorDevice, User
from mysign_app.tests.factories import CompanyFactory
@mark.django_db
def test_objects_are_seeded():
# Run seeds
Command().handle()
assert Company.objects.count() == 20... | StarcoderdataPython |
3212185 | <reponame>mcgreevy/chromium-infra
#!/usr/bin/env python
# This file mocks typical recipes.py that normally runs a recipe.
import argparse
import json
import sys
import shutil
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--output-result-json')
parser.add_argument('--properties-file')
arg... | StarcoderdataPython |
3229116 | <gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
from PIL import Image, ImageDraw, ImageFont
import random
import sys
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders
class crypto:
def __init... | StarcoderdataPython |
3315580 | <gh_stars>10-100
from __future__ import print_function
from lm import lm
import sys
import codecs
stdin = codecs.getreader('utf-8')(sys.stdin)
stdout = codecs.getwriter('utf-8')(sys.stdout)
lm = lm.LM()
lm.load('../data/')
collationLM_sum = 0
ngramLM_sum = 0
count = 0
for line in stdin:
line = line.rstrip('\n')
... | StarcoderdataPython |
1781294 | # -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('payment', '0004_auto_20150415_2210'),
]
operations = [
migrations.CreateModel(
name='PaymentPrice',
fields=[
('id', models.... | StarcoderdataPython |
4819125 | <reponame>Hadisalman/AirSim
import copy
import json
import threading
import numpy as np
import torch
from robustness import airsim
from .sim_object import SimObject
class AdversarialObjects(SimObject):
def __init__(self, name='3DAdversary', car=None, **kwargs):
super().__init__(name)
assert 'res... | StarcoderdataPython |
4822399 | <gh_stars>0
'''
@description 86.【Python面向对象】重写父类的方法 2019/10/04 10:44
'''
class Person(object):
def __init__(self, name, age):
self.name = name
self.age = age
def eat(self):
print('人在吃饭!....')
class Student(Person):
# 1.如果父类的方法不能满足子类的需求,那么可以重写这个方法,以后对象调用同名
# 方法的时候,就会执行子类的这个方法。... | StarcoderdataPython |
1693217 | """Locations class module for Squaredown.
"""
from aracnid_logger import Logger
from squaredown.connector import Connector
# initialize logging
logger = Logger(__name__).get_logger()
class Locations(Connector):
"""Contains the code to connect and pull locations from Square to MongoDB.
Environment Variables... | StarcoderdataPython |
1695818 | import math
def nth_fact(nth):
# Enter your code here
return(math.factorial(nth)) | StarcoderdataPython |
4820974 | <reponame>faraixyz/farais-code-graveyard
from base64 import urlsafe_b64encode
from hashlib import sha1
import hmac
import json
import pprint
import secrets
from urllib.parse import quote_plus, quote
from time import time
import requests
with open('config.json', 'rb') as config_file:
CONFIG = json.load(config_file)
#... | StarcoderdataPython |
4838030 | <gh_stars>0
class Dessin():
"""docstring for Dessin."""
def __init__(self, nom):
self.nom = nom
self.liste = []
def add(self, obj):
self.liste.append(obj)
def affiche(self):
print("===",self.nom,"===")
for f in self.liste:
f.affiche()
| StarcoderdataPython |
1611177 | <reponame>RCTom168/Intro-to-Python-1<gh_stars>0
# Write a function is_even that will return true if the passed-in number is even.
# YOUR CODE HERE
def is_even(num): # Define the function
if num % 2 == 0:
return True
# Read a number from the keyboard
num = input("Enter a number: ")
num = int(num)
# Print out "Eve... | StarcoderdataPython |
1644072 | """
Defines upper bounds of YPD media for FBA
"""
from yeast.core.media.constants import reagents
from yeast.core.media.yp.base import yp
d = {
reagents["D-glucose"]: 22.6,
}
ypd = {**yp, **d}
| StarcoderdataPython |
1757653 | <reponame>Ljqiii/google_translate_api_python
from .GetTKK import getTKK
import time
import ctypes
import requests
class GoogleTranslate():
def __init__(self, sl='', tl='', domainnames=""):
"""
A python wrapped free and unlimited API for Google Translate.
:param sl:from Language
... | StarcoderdataPython |
4839862 | <gh_stars>100-1000
__all__ = ["filters", "generators"] | StarcoderdataPython |
3279784 | <gh_stars>1-10
""" This script is an example of benchmarking the continuous mlp baseline."""
import datetime
import os
import os.path as osp
import random
from baselines.bench import benchmarks
import dowel
from dowel import logger as dowel_logger
import gym
import pytest
import tensorflow as tf
from metarl.envs impo... | StarcoderdataPython |
66073 | <filename>hazelcast/transaction.py
import logging
import threading
import time
import uuid
from hazelcast.errors import TransactionError, IllegalStateError
from hazelcast.invocation import Invocation
from hazelcast.protocol.codec import (
transaction_create_codec,
transaction_commit_codec,
transaction_roll... | StarcoderdataPython |
122108 | <filename>examples/distributed/simple_sync_distributed.py
#!/usr/bin/env python
""" Simple example of using leap_ec.distrib.synchronous
"""
import os
import multiprocessing.popen_spawn_posix # Python 3.9 workaround for Dask. See https://github.com/dask/distributed/issues/4168
from distributed import Client
import t... | StarcoderdataPython |
3244860 | from __future__ import division
import fire
from pathlib import Path
import torch
from torchvision import transforms
from tea.config.app_cfg import parse_cfg, print_cfg, get_epochs, get_data_in_dir, get_model_out_dir, get_device
import tea.data.data_loader_factory as DLFactory
import tea.models.factory as MFactory
fro... | StarcoderdataPython |
119420 | <filename>core/migrations/0025_course_welcome_email.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0024_coursestudent_is_active'),
]
operations = [
migrations.A... | StarcoderdataPython |
3371955 | from bank_bot.bankbot.core import bot, client_factory, safe_send_message
from bank_bot import settings
from bank_bot.banking_system import UserError, TransactionError, Database, HackerError, MessageError, AddressRecordError
@bot.message_handler(regexp=r"\/message [a-zA-Z0-9]{10} [\w\W]+")
def send_message(message):
... | StarcoderdataPython |
3300711 | <filename>lieutenant/lieutenant/urls.py
from django.conf.urls import patterns, include, url
from django.contrib import admin
from lieutenant.views import Home
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'lieutenant.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^$', ... | StarcoderdataPython |
45518 | <reponame>automation-liberation/deployment-helper
from enum import Enum
class ChangelogEntryEnum(Enum):
ADDED = 'Added'
CHANGED = 'Changed'
FIXED = 'Fixed'
REMOVED = 'Removed'
| StarcoderdataPython |
3399838 | <gh_stars>0
def aoc(data):
x, y, d = 0, 0, 0
moves = {
"E": (1, 0, 0),
"S": (0, 1, 0),
"W": (-1, 0, 0),
"N": (0, -1, 0),
"R": (0, 0, 1),
"L": (0, 0, -1),
}
for move, step in [(i[0], int(i[1:])) for i in data.split()]:
if move == "F":
x ... | StarcoderdataPython |
4805177 | <reponame>laffra/pava
def add_native_methods(clazz):
def selectAlternative__boolean__java_lang_invoke_MethodHandle__java_lang_invoke_MethodHandle__(a0, a1, a2):
raise NotImplementedError()
clazz.selectAlternative__boolean__java_lang_invoke_MethodHandle__java_lang_invoke_MethodHandle__ = staticmethod(se... | StarcoderdataPython |
3369197 | import pytest
from pathlib import Path
from pandas.testing import assert_frame_equal
import pandas as pd
from sqlalchemy.exc import DatabaseError
from prestest.fixtures import container, start_container, db_manager, create_temporary_table
from prestest.container import CONTAINER_NAMES
resource_folder = Path(".").res... | StarcoderdataPython |
1776819 | <filename>libs/pose_sphere.py<gh_stars>1-10
from __future__ import print_function
import math
import threading
import time
class PoseSphere:
def __init__(self, name, priority=1):
self.position = (0.0, 0.0, 0.0)
self.p2 = (0.0, 0.0, 0.0)
self.type = 'sphere'
self.angle = 0.0
... | StarcoderdataPython |
112915 | <reponame>Farbfetzen/Advent_of_Code
from unittest import TestCase
from src.util.load_data import load_data
from src.year2020.day13 import part_1, part_2, part_2_without_crt, prepare_data
from test.decorators import sample
data = load_data(2020, 13)
@sample
class Test2020Day13Samples(TestCase):
prepared_data: ... | StarcoderdataPython |
3296016 | <gh_stars>0
#!/usr/bin/env python3
from collections import defaultdict
from pgmpy.factors import TabularCPD, TreeCPD, RuleCPD
import itertools
import networkx as nx
class DirectedGraph(nx.DiGraph):
"""
Base class for directed graphs.
Directed graph assumes that all the nodes in graph are either random
... | StarcoderdataPython |
1727584 | # https://codeforces.com/problemset/problem/479/A
a = int(input())
b = int(input())
c = int(input())
a1=a+b*c
a2=a*(b+c)
a3=a*b*c
a4=(a+b)*c
a5=a+b+c
print(max(a1,a2,a3,a4,a5))
| StarcoderdataPython |
1637985 | <filename>map_label_tool/py_proto/cyber/proto/perception_pb2.py
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: cyber/proto/perception.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.proto... | StarcoderdataPython |
3301302 | <reponame>MrKomish/pymono<gh_stars>1-10
from cocos.director import director
from cocos.text import Label
from pymono.lib.cocos2d import *
from pymono.lib.observable import Observable
from pymono.models.cells.StreetCell import StreetCell, StreetPrices
from pymono.config import rgba_colors
from pymono.models.Cell import... | StarcoderdataPython |
194537 | <gh_stars>0
"""Append file."""
from os import getcwd
from os.path import abspath, realpath, join, dirname
content = 'Some text Lorem ipsum dolor sit amet |::|\n\t\t@treedbox'
appendMe = '\n1º New bit of information'
appendMeToo = '2º New bit of information'
filename = 'filename.txt'
dir = abspath(dirname(__file__))... | StarcoderdataPython |
1673000 | <reponame>Winzarten/SecondMonitor
import ac
import acsys
import sys
import os.path
import platform
import configparser
import ctypes
from ctypes import *
from smshared_mem import SecondMonitorShared
sharedMem = SecondMonitorShared()
pluginVersion = "1.0.0"
timer = 0
def updateSharedMemory():
... | StarcoderdataPython |
129991 | <filename>ganonymizer-v3/app/api/router.py<gh_stars>0
from flask import request
from api import app
from api import controller as controller
from api import middleware as middleware
from api.gano import load_config, load_model
@app.before_first_request
def init():
load_config()
load_model()
@app.route("/he... | StarcoderdataPython |
3263678 | # Ultroid - UserBot
# Copyright (C) 2020 TeamUltroid
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
import os
import requests
from asyncio import sleep
from bs4 import Beauti... | StarcoderdataPython |
190700 | import inspect
from importlib import import_module
from .base import BaseState, INIT_REMOTE_API
from ..transport import new_session
def create_class(pkg_class: str):
"""Create a class from a package.module.class string
:param pkg_class: full class location,
e.g. "sklearn.model_select... | StarcoderdataPython |
3287772 | <reponame>niemela/problemtools
from __future__ import print_function
import os
import re
import os.path
import glob
import tempfile
import shutil
# For backwards compatibility, remove in bright and shiny future.
def detect_version(problemdir, problemtex):
# Check for 0.1 - lack of \problemname
if open(problem... | StarcoderdataPython |
4810424 | <reponame>lundholmx/advent-of-code-2021
from collections import defaultdict
from itertools import pairwise
def parse_input(lines: list[str]) -> tuple[str, dict]:
template = lines[0]
rules = {}
for line in lines[2:]:
[a, b] = line.split(" -> ")
rules[a] = b
return template, rules
def ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.