id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
11390120 | from . import (
align_submodels,
bundle,
compute_depthmaps,
compute_statistics,
create_rig,
create_submodels,
create_tracks,
detect_features,
export_bundler,
export_colmap,
export_geocoords,
export_openmvs,
export_ply,
export_pmvs,
export_report,
export_vi... | StarcoderdataPython |
196350 | <gh_stars>1-10
from .activities import (
Activity,
ActivityRegistration,
)
from .event import Event
from .polls import (
Poll,
PollDesign,
PollVote,
)
__all__ = [
"Activity",
"ActivityRegistration",
"Event",
"Poll",
"PollDesign",
"PollVote",
]
| StarcoderdataPython |
8172565 | <reponame>vikas04599/Fire-X
import asyncio
import random
from uniborg.util import fire_on_cmd
from firebot import CMD_HELP
@fire.on(fire_on_cmd(pattern=r"lol"))
async def _(event):
if event.fwd_from:
return
await event.edit("Typing...")
await asyncio.sleep(2)
x = random.randrange(1, 28)... | StarcoderdataPython |
3262774 | # -*- coding: utf-8 -*-
"""
Created on Fri May 15 00:41:28 2020
@author: Tom
"""
num_dict = {}
for i in range(1, 28123):
d_a = 0
for j in range(1, int(i ** 0.5) + 1):
if i % j == 0:
if j != i // j:
d_a += j + i // j
else:
d_a += j
num_dict[i]... | StarcoderdataPython |
12858084 | #
# Program: www_utils.py
# Version: 0.10
# Description:
# Generic search functions for Cheshire 3
#
# Language: Python
# Author: <NAME> <<EMAIL>>
# Date: 19 December 2007
#
# Copyright: © University of Liverpool 2005-2007
#
# Version History:
# 0.01 - 13/04/2005 - JH - Ported from Cheshire... | StarcoderdataPython |
12866035 | <gh_stars>0
import assistantResume
from speak_module import speak
from database import speak_is_on
def output(o):
# For command line input
if speak_is_on():
speak(o)
print(assistantResume.name +": "+o+"\n") | StarcoderdataPython |
4806052 | <gh_stars>0
#!/usr/bin/env python3
import socket
import time
import select
class Connection:
"""
Establishes a connection to a server,
then keeps it up (TODO!),
or reconnects if needed.
You should only ever need the method run()
"""
def __init__ (self, server, port, nicknames, realname, i... | StarcoderdataPython |
74628 | #!/usr/bin/python
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import re
import sys
filename = sys.argv[1]
def extract_artifact(line):
splitline = line.split('%')
org = re.sub(r'^revision\.[a-z_]+\.', '... | StarcoderdataPython |
1651113 | import numpy as np
from .filter import Filter
from .ideal_high_pass import IdealHighPass as HP
class HighBoost(Filter):
def __init__(self, shape, cutoff, a):
super().__init__(shape)
self.cutoff = cutoff
self.a = a
def build_filter(self):
hp = HP(self.shape, self.cutoff)
... | StarcoderdataPython |
3219320 | #*****************************************
# split big .csv file into small .csv file
# <NAME>
# <EMAIL>
#*****************************************
import pandas as pd
import math
import sys
species = sys.argv[1]
df = pd.read_csv('../'+species+'_merge.csv')
line_num = df.shape[0]
part_num = int(math.ceil(line_num / 10... | StarcoderdataPython |
5072622 | <reponame>hbutsuak95/iv_rl
from .dqn import DQNAgent, LossAttDQN
from .mcdropDQN import MCDropDQN
from .ensembleDQN import EnsembleDQN, MaskEnsembleDQN, RPFMaskEnsembleDQN, BootstrapDQN, RPFBootstrapDQN, Lakshminarayan, LakshmiBootstrapDQN
from .iv_dqn import IV_DQN, IV_MaskEnsembleDQN, IV_LossAttDQN, IV_RPFMaskEnsembl... | StarcoderdataPython |
9714575 | <filename>cogs/pokemon.py
import re
import disnake
from disnake.ext import commands
from utils.command.clip import *
from utils.tools.globals import httpgetter, logger
from utils.tools.helpers import *
from cogs.audio import AudioPlayerNotFoundError
from cogs.mangocog import *
async def pokeapi_query(url, fullurl=F... | StarcoderdataPython |
9628962 | <gh_stars>10-100
import torch
import numpy as np
from torchvision import transforms
import cv2
from PIL import Image
import custom_model
# Number of classes in the dataset
num_classes = 5
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
model, input_size = custom_model.initialize_model(num_cl... | StarcoderdataPython |
6341 | # Copyright (c) 2010-2014 openpyxl
import pytest
from openpyxl.styles.borders import Border, Side
from openpyxl.styles.fills import GradientFill
from openpyxl.styles.colors import Color
from openpyxl.writer.styles import StyleWriter
from openpyxl.tests.helper import get_xml, compare_xml
class DummyWorkbook:
st... | StarcoderdataPython |
8023276 | <gh_stars>1-10
# This program is free software: you can redistribute it and/or modify it under the
# terms of the Apache License (v2.0) as published by the Apache Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MER... | StarcoderdataPython |
9650193 | <reponame>satyrus3/satyrus3.github.io<filename>docs/v3.0.7/_static/examples/text.py
from satyrus import Posiform, SatAPI
class text(SatAPI):
def solve(self, energy: Posiform, **params):
return str(energy)
| StarcoderdataPython |
9739943 | <filename>torchlab/nnlib/affine_align/__init__.py
from .pose_align import templates
from .pose_align import templates17to29
from .pose_align import Template
from .pose_align import PoseAffineTemplate
from .alignlayer import calcAffineMatrix
from .alignlayer import affine_align
from .alignlayer import affine_align_gpu
... | StarcoderdataPython |
398064 | from datetime import datetime, date
import numpy
import pandas
import copy
import uuid
from past.builtins import basestring # pip install future
from pandas.io.formats.style import Styler
from functools import partial, reduce
from .offline import iplot, plot
from IPython.core.display import HTML, display
import... | StarcoderdataPython |
3491226 | <reponame>panda-mute/ykdl
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
A simple Javascript engines' wrapper.
Description:
This library wraps the Javascript interpreter to python.
System's built-in Javascript interpreter:
macOS: JavascriptCore
Linux: Gjs on Gnome, CJS on Cinnamon
... | StarcoderdataPython |
394877 | <gh_stars>1-10
from setuptools import setup, find_packages
setup(name='clusterweb',
version='0.0.0.2',
description='ClusterWeb, a distributed system API for SSH and PBS systems',
long_description=open('README.md').read(),
url='https://github.com/gndctrl2mjrtm/cweb-project',
author='<NAME>... | StarcoderdataPython |
4922268 | from flask import Flask
from flask_bootstrap import Bootstrap
from config import config_options
# Initializing application
app = Flask(__name__,instance_relative_config = True)
def create_app(config_name):
app = Flask(__name__)
# Creating the app configurations
app.config.from_object(config_options[con... | StarcoderdataPython |
1633098 | <filename>test/test_jsonhash.py
import subprocess
import json
import jsonhash
DATA = [
{'a': 1},
{'a': 1, 'b': 2, 'c': 3, 'd': 4},
[1, 3, 2, 5, 43, 3, 1.25],
{'a': 'just some dict', '1': [
'with lists', 1, 'and intergeres',
{'a': {'and even more': 'stuff', 'c': -1}}
]}
]
code = "... | StarcoderdataPython |
9694683 | import numpy as np
def VGGPreprocessing(originImgMatrix):
"The only preprocessing we do is subtracting the mean RGB value, \
computed on the training set, from each pixel.\
原论文中对输入的RGB矩阵做了一个减去均值的预处理,该函数实现这个预处理"
if type(originImgMatrix) is not np.ndarray:
originImgMatrix = np.ndarray(originImgMa... | StarcoderdataPython |
12844677 | #!/usr/bin/env python3
import sys, os, shutil, json, yaml
from time import localtime
ONLY_SIMULATED = False
ONLY_GIAB = True
# Make import from parent directory possible
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
import modules.file_utils as file_utils
with open(... | StarcoderdataPython |
4989457 | <reponame>TerezijaKrecic/euler-problems
# vsota praštevil pod 10 je 2+3+5+7 = 17.
# poišči vsoto praštevil pod 2 milijona
def ali_je_prastevilo(n):
"""preveri, ali je n praštevilo"""
if n < 2:
return False
else:
for i in range(2, n):
if n % i == 0:
return False
... | StarcoderdataPython |
6605250 | import os
# ------------------------------------------------
# MAIN-CONFIG ------------------------------------
# ------------------------------------------------
c.NotebookApp.allow_origin = '*'
c.NotebookApp.allow_root = True
c.NotebookApp.allow_remote_access = True
c.NotebookApp.ip = '*'
c.NotebookApp.notebook_dir ... | StarcoderdataPython |
1742989 | <filename>google/appengine/tools/devappserver2/java_runtime.py
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | StarcoderdataPython |
3442660 | from selenium import webdriver
from http.client import CannotSendRequest
from socket import error
from selenium.webdriver.remote.command import Command
import os
import random
CURDIR = os.path.dirname(os.path.abspath(__file__))
class DriverManager():
def __init__(self):
self.drivers = {"main":None}
... | StarcoderdataPython |
9679658 | <filename>mysite/myAPI/checkcode.py
# -*- coding: utf-8 -*-
# python3.5
import os,sys
from io import BytesIO as StringIO
from django.shortcuts import render
import random
from django.http.response import HttpResponseRedirect, HttpResponse
from PIL import Image, ImageDraw, ImageFont, ImageFilter
FONT_TYPE = "static_comm... | StarcoderdataPython |
4908582 | import sys
input = sys.stdin.readline
n, a, b = map(int, input().split())
if (b - a) % 2 == 0:
print('Alice')
else:
print('Borys')
| StarcoderdataPython |
6608214 | print('=====Desafio 008=====')
m=float(input('Uma distância em metros: '))
km= m*0.001
hm= m*0.01
dam= m*0.1
dm=m*10
cm= m*100
mm= m*1000
print( 'A medida de {} metros corresponde a \n {:.3f} kilômetros \n {:.2f} '
'hectrometros \n {:.1f} decametros \n {:.0f} decimetros \n {:.0f} '
'centimetros \n {:.0f... | StarcoderdataPython |
3481787 | import logging
from checkov.arm.parser import cfn_yaml
from yaml.parser import ParserError, ScannerError
from yaml import YAMLError
from checkov.common.parsers.node import dict_node
from checkov.common.parsers.json import parse as json_parse
LOGGER = logging.getLogger(__name__)
def parse(filename):
"""
... | StarcoderdataPython |
9761380 | <gh_stars>0
# comanage_api/_copersonroles.py
"""
CoPersonRole API - https://spaces.at.internet2.edu/display/COmanage/CoPersonRole+API
Methods
-------
coperson_roles_add(coperson_id: int, cou_id: int, status: str = None, affiliation: str = None) -> dict
Add a new CO Person Role.
coperson_roles_delete(coperson_role... | StarcoderdataPython |
290556 | from pathlib import Path
def loadNotebook(notebookPath: Path) -> str:
with notebookPath.open('r', encoding='utf-8') as f:
return f.read()
| StarcoderdataPython |
5034932 | <filename>tests/test_generator.py
import unittest
from tempfile import TemporaryDirectory
import os
from os.path import join as pjoin, getsize as filesize
from textwrap import dedent
from yaml import dump as ymldump
import cv_generator.generator
class CVGeneratorTest(unittest.TestCase):
"""Testing the CVGenerato... | StarcoderdataPython |
79962 | <reponame>rschroll/ipyaml
import yaml
import nbformat
WHITELIST = ['nbformat', 'nbformat_minor', 'metadata', 'kernelspec', 'display_name',
'language', 'name', 'cells']
class SourceCode(unicode):
pass
class SourceDumper(yaml.SafeDumper):
def analyze_scalar(self, scalar):
# The default a... | StarcoderdataPython |
11318585 | #!/bin/python
import Tkinter, tkFileDialog
from kafka import KafkaProducer
import re
def cleanup(value):
if value[0]=='/':
return cleanup(value[1:])
if value[len(value)-1]==':':
return cleanup(value[:-1])
return value
def parse(uri,regex,default):
p=re.compile(regex)
found=p.find... | StarcoderdataPython |
3345601 | """
==================================
Set Axis Range When Plotting a Map
==================================
In this example we are going to look at how to set the axes
range using Matplotlib's ``set_xlim`` and ``set_ylim`` when plotting a
Map with WCSAxes.
"""
import matplotlib.pyplot as plt
from astropy import uni... | StarcoderdataPython |
3481159 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 The F4PGA Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
""" Classes for representing and creating a physic... | StarcoderdataPython |
6611679 | if __name__ == "__main__":
from src import cli
cli.app()
| StarcoderdataPython |
3357384 | """
PyBpf
=====
This package is meant for a modern interface for dealing with the
outputs of Budapest-Florida code (Yecko et al. 1996.).
Current Features
----------------
- Full interface for fort.95,fort.18 and fort.19 files
- OOP datastructure for easy acces all the data
- Ionization fraction calculations for t... | StarcoderdataPython |
331043 | '''
HOW TO RUN THIS CODE (if tests are within the assignment 1 root):
python -m py.test tests/test_neural_to_solutions.py -vv -s -q
python -m py.test tests/test_neural_to_solutions.py -vv -s -q --cov
py.test.exe --cov=cs224d/ tests/test_neural_to_solutions.py --cov-report html
(if the tests are within the subfolder t... | StarcoderdataPython |
1874407 | # Copyright (c) Microsoft Corporation
# Licensed under the MIT License.
"""Data validations for responsibleai module."""
from typing import List, Optional
import numpy as np
import pandas as pd
from responsibleai.exceptions import UserConfigValidationException
def validate_train_test_categories(
train_data: pd... | StarcoderdataPython |
3356288 | from rest_framework import serializers
from accelerator.models import Location
class LocationSerializer(serializers.ModelSerializer):
class Meta:
model = Location
fields = ['id', 'street_address', 'timezone', 'country',
'state', 'name', 'city', ]
| StarcoderdataPython |
1978374 | import glob
import numpy as np
import os
from astropy.io import fits
from specklepy.io import config
from specklepy.io.config import read
from specklepy.io.filearchive import ReductionFileArchive
from specklepy.logging import logger
from specklepy.reduction import dark, flat, sky
from specklepy.utils.array import fra... | StarcoderdataPython |
5093643 | <filename>job-queue-portal/postgres_django_queue/djangoenv/lib/python3.8/site-packages/django_celery_results/migrations/0008_chordcounter.py
# Generated by Django 3.0.6 on 2020-05-12 12:05
from __future__ import unicode_literals, absolute_import
from django.conf import settings
from django.db import migrations, models... | StarcoderdataPython |
4802128 | <reponame>beastzx18/Tron
import threading
from sys import platform
from sqlalchemy import (
Column,
String,
Integer
)
from . import SESSION, BASE
# save user ids in whitelists
class data(BASE):
__tablename__ = "database var"
keys = Column(String, primary_key=True)
values = Column(String)
def __init_... | StarcoderdataPython |
11297842 | <gh_stars>1-10
from distutils.core import setup
setup(name='collective_classification',
version='0.1',
package_dir={'collective_classification': ''},
packages=['collective_classification.components', 'collective_classification.examples'],
) | StarcoderdataPython |
3560087 | import pathlib
import pygubu
try:
import Tkinter as tk
import Tkinter.ttk as ttk
from Tkinter.messagebox import showinfo, showerror, askyesno
from Tkinter import Toplevel
from Tkinter.filedialog import askopenfilename, asksaveasfilename
except:
import tkinter as tk
import tkinter.ttk as ttk
... | StarcoderdataPython |
5124709 | <gh_stars>10-100
from network_pipeline.consts import SOURCE
from network_pipeline.consts import FORWARD_EXCHANGE
from network_pipeline.consts import FORWARD_ROUTING_KEY
from network_pipeline.consts import FORWARD_QUEUE
from spylunking.log.setup_logging import console_logger
from network_pipeline.utils import rnow
from ... | StarcoderdataPython |
1756757 |
import math
import torch
import torch.nn as nn
def bbox_overlaps(bboxes1, bboxes2, mode='iou', is_aligned=False, eps=1e-6):
assert mode in ['iou', 'giou', 'diou', 'ciou'], f'Unsupported mode {mode}'
assert (bboxes1.size(-1) == 4 or bboxes1.size(0) == 0)
assert (bboxes2.size(-1) == 4 or bboxes2.size(0) == ... | StarcoderdataPython |
3313924 | #!/usr/bin/env vpython3
# Copyright (c) 2022 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. Al... | StarcoderdataPython |
9779180 | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import re
import sys
import shutil
import copy
import socket
import ruamel.yaml
import six
from ordereddict_ba... | StarcoderdataPython |
12864117 | def decode(to_be_decoded):
"""
Decodes a run-length encoded string.
:param to_be_decoded: run-length encoded string
:return: run-length decoded string
"""
to_be_decoded_list = list(to_be_decoded)
decoded_str_as_list = list()
num_to_print_as_list = list()
for c in to_be_decoded_list:... | StarcoderdataPython |
6615017 | from rest_framework import serializers, viewsets
from .models import Article, Publication
class ArticleSerializer(serializers.ModelSerializer):
class Meta:
model = Article
fields = "__all__"
class PublicationSerializer(serializers.ModelSerializer):
class Meta:
model = P... | StarcoderdataPython |
8104086 | from os import pipe
import numpy as np
from sklearn import datasets, tree, model_selection, metrics, preprocessing, pipeline
from sklearn.feature_extraction.text import TfidfTransformer, TfidfVectorizer
from sklearn.pipeline import Pipeline, make_pipeline
from sklearn.naive_bayes import BernoulliNB
import matplotlib.py... | StarcoderdataPython |
1687477 | import json
from rest_framework import serializers
from v1.accounts.models.account import Account
from v1.bank_transactions.models.bank_transaction import BankTransaction
from v1.blocks.models.block import Block
from v1.confirmation_blocks.models.confirmation_block import ConfirmationBlock
from v1.keys.models.key impo... | StarcoderdataPython |
4971015 | #
# Copyright (c) 2009-2015, <NAME>
# All rights reserved.
#
# This file is part of Elemental and is under the BSD 2-Clause License,
# which can be found in the LICENSE file in the root directory, or at
# http://opensource.org/licenses/BSD-2-Clause
#
from El.core import *
from El.lapack_like.factor import *
(FU... | StarcoderdataPython |
3479279 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import division
import importlib
from lime import LIME
import numpy as np
class Model(object):
def test_auc(self):
"""Returns the area under ROC curve for the test data."""
raise NotImplementedEr... | StarcoderdataPython |
8064317 | <gh_stars>10-100
# -*- coding: utf-8 -*-
import numpy
class MolecularModel:
"""Representation of a non-Quantarhei molecule.
This class handles conversion of non-Quantarhei models of molecules
"""
def __init__(self, model_type=None):
self.model_type = model_type
s... | StarcoderdataPython |
3594531 | <gh_stars>10-100
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-22 18:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('intake', '0063_purgedapplication_purgedstatusupdate'),
]
operation... | StarcoderdataPython |
1860288 | <reponame>vincealdrin/Tutu<filename>detector/categorizer.py<gh_stars>1-10
from db import get_articles_filtered
from sklearn.feature_extraction.stop_words import ENGLISH_STOP_WORDS
from sklearn.metrics import confusion_matrix, classification_report, auc, roc_curve, accuracy_score
from sklearn.model_selection import trai... | StarcoderdataPython |
4934523 | <reponame>matthiask/django-historylinks
"""Adapters for registering models with django-HistoryLinks."""
from __future__ import unicode_literals
import sys
from itertools import chain
from threading import local
from functools import wraps
from django.core.signals import request_finished
from django.contrib.contenttyp... | StarcoderdataPython |
4880399 | <reponame>killdary/Minicourse_malware
import socket
HOST = '' # Endereco IP do Servidor
PORT = 5000 # Porta que o Servidor esta
tcp = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #cria um socket para conectar o cliente e o servidor
orig = (HOST, PORT)
tcp.bind(orig) ... | StarcoderdataPython |
4969833 | """
Abstractions and operations, which may or may not be protocol related, specific to the voting namespace
"""
from flask import g, current_app
from computable.contracts import Voting
from core.protocol import get_voting
def filter_candidate_added(from_block, to_block, arg_filters=None):
"""
given filter crea... | StarcoderdataPython |
9779404 | <reponame>fizista/django
from optparse import make_option
from django.core.management.commands.startproject import Command as BaseCommand
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option('--extra',
action='store', dest='extra',
help... | StarcoderdataPython |
4940462 | def main():
n = int(input())
a, b, c = list(map(int, input().split()))
n_a = [i * a for i in range(1, n // a + 1)]
n_b = [i * b for i in range(1, n // b + 1)]
n_c = [i * c for i in range(1, n // c + 1)]
print(len(set(n_a + n_b + n_c)))
def fizzbuzz():
for i in range(100):
print(i... | StarcoderdataPython |
8170440 | class Solution:
def canAttendMeetings(self, intervals: List[List[int]]) -> bool:
intervals = sorted(intervals, key=lambda x: x[1])
end = -1
for interval in intervals:
if interval[0] >= end:
end = interval[1]
continue
return False
... | StarcoderdataPython |
20542 | import os
from datetime import datetime
import sys
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from jet_bridge_base import configuration
from jet_bridge.configuration import JetBridgeConfiguration
conf = JetBridgeConfiguration()
configuration.set_configuration(conf)
from jet_bridge_b... | StarcoderdataPython |
6558764 | <filename>resources/colors.py
# With the only proper notation WITHOUT U
white = (255, 255, 255)
background = (10, 10, 30)
backup = (125, 125, 125)
| StarcoderdataPython |
1885050 | from parallelm.mlapp_directory.mlapp_from_directory_builder import MLAppFromDirectoryBuilder
from parallelm.mlapp_directory.mlapp_defs import MLAppProfileKeywords
from parallelm.mcenter_cli.delete_mlapp import MLAppDeleteHelper
def _is_mlapp_exists(mclient, mlapp_name):
for profile_info in mclient.list_ion_profil... | StarcoderdataPython |
3360972 | import sys
import os
import json
import bsddb
import marshal
TEMP_DATA_FILE = "old_temp_data.db"
def get_data_keys():
data_keys = set()
for key,val in cass.getRowRange(TEMPFILES, columns=['size']):
# Have to check for a column since deleted rows can still be returned here
# See: http://wiki.ap... | StarcoderdataPython |
3332832 | import sys
lines = []
for line in sys.stdin:
lines.append(line.rstrip('\n'))
for line in lines[1:]:
if (len(line) % 2 == 0 and line[0:round(len(line)/2)] == line[round(len(line)/2):]):
print("YES")
else:
print("NO") | StarcoderdataPython |
8173642 | <reponame>chnghia/pytorch-lightning-gan<filename>models/modules.py
import os
import numpy as np
from PIL import Image
from torch.utils import data
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
from torch.autograd import Variable
import torchvision.transforms as t... | StarcoderdataPython |
3409237 | <reponame>onap/optf-osdf
# -------------------------------------------------------------------------
# Copyright (c) 2020 AT&T Intellectual Property
#
# 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 t... | StarcoderdataPython |
1818624 | import os
import unittest
from unittest.mock import patch
from kubernetes import config
from xcube_hub.k8scfg import K8sCfg
class TestK8sCfg(unittest.TestCase):
@patch.object(config, 'load_incluster_config')
def test_load_config_once(self, incluster_cfg_p):
K8sCfg.load_config_once()
self.as... | StarcoderdataPython |
4885527 | from viraal.config.config import *
| StarcoderdataPython |
3576472 | <filename>LeetCode/python/tree/populating-next-right-pointers-in-each-node[1].py
# 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):
... | StarcoderdataPython |
4877778 | a = input("Enter a Character: ")
print("The ASCII value of " + a + " is", ord(a)) | StarcoderdataPython |
11371018 | # ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import os
def retrieve_model(model, **kwargs):
# if data not extracted, download zip and extract
outdirname = 'models.5.15.2019'
... | StarcoderdataPython |
6543144 | <reponame>Remydeme/zodiac
import unittest
import pytest
from dateutil import parser
from GmailAnalyser import GmailAnalytics,GmailClient
@pytest.fixture(scope="module")
def sutime():
return GmailClient()
def test_fetch_message_from_forum(self):
pass
def test_fetch_2_page_from_forum(self):
pass
def test_h... | StarcoderdataPython |
6668776 | # 792->心理科普 876->婚恋情感 660->家庭关系 2206->人际社交 2199->自我察觉 862->成长学习 823->心理健康 844->职场技能
ARTICLE_CLASS = {'792': '心理科普', '876': '婚恋情感', '660': '家庭关系',
'2206': '人际社交', '2199': '自我察觉', '862': '成长学习', '823': '心理健康', '844': '职场技能'}
PAGEREAD = 2
PAGEQUESTIONANDANSWER = 6
# mongodb数据库链接
MONGO_URL = 'localhost'... | StarcoderdataPython |
4883684 | import docker
import random
import thread
import time
import os
import psutil
from gnlpy.cgroupstats import CgroupstatsClient
client = docker.from_env()
JOB_RANDOM_PARAM = 0.7
TIME_DELAY_JOBS_MIN = 3
TIME_DELAY_JOBS_MAX = 7
def stop_all_containers():
for container in client.containers.list():
container.s... | StarcoderdataPython |
9654280 | <gh_stars>1-10
#
# Jasy - Web Tooling Framework
# Copyright 2010-2012 Zynga Inc.
# Copyright 2013-2014 <NAME>
#
import jasy.script.api.Text as Text
from jasy.script.util import *
import jasy.core.Console as Console
from jasy import UserError
class ApiData():
"""
Container for all relevant API data.
Au... | StarcoderdataPython |
6668393 | <reponame>ChaitanyaJoshiX/Pirple-Python
"""
Creating a dictionary of my favourite song.
Printing out each key and it's value through a loop.
Also, creating a function that allows the user to guess the value of any key .
If the key exists in dictionary and the value is correct, function returns true.
Or else, it re... | StarcoderdataPython |
378944 | import json
from django.http import HttpResponse
from swiper.common import status_code as STATUS
def render_json(data, code=STATUS.STATUS_OK):
result = {
'code': code,
'data': data
}
json_str = json.dumps(result, ensure_ascii=False,indent=2, sort_keys=True)
return HttpResponse(json_str) | StarcoderdataPython |
5184669 | <filename>scripts/tools/memory/memdf/df.py
#
# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | StarcoderdataPython |
8036000 | import requests
def compare_holiday_counts(country_code1, country_code2, year=2019):
"""Returns the difference between the holiday counts of country 1 and country 2.
Args:
country_code1: The ISO 3166-1 alpha-2 country code for country 1.
country_code2: The ISO 3166-1 alpha-2 country code for ... | StarcoderdataPython |
1775560 | from functools import wraps
from timeit import default_timer
from typing import Any, Iterable, List, Dict
'''
timer - 1.0
此版本调用起来不够优雅,以及类型注解等一些细节没做好
故重构为 1.1 版本,该版本源码留作纪念
'''
funcs: List[Any] = []
times: List[float] = []
funcs_times: Dict[str, float] = {}
def timer(flag: str = None, input: Iterable = None):
i... | StarcoderdataPython |
3212213 | <filename>Django/Cycl/migrations/0002_auto_20190804_1641.py
# Generated by Django 2.2.3 on 2019-08-04 14:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Cycl', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
... | StarcoderdataPython |
1933693 | # Copyright (c) 2017-2020 <NAME>. All rights reserved.
# Use of this source code is governed by an MIT license that can be
# found in the LICENSE file.
import re
import socket
import urllib.error
import urllib.request
import pynvim
__version__ = '1.1'
API_URL = 'https://www.gitignore.io/api/{}'
USER_AGENT = 'fzf-gi... | StarcoderdataPython |
3598290 | from enum import Enum
LEFT_PORT = 'INPUT'
RIGHT_PORT = 'OUTPUT'
class NODE_TYPE(Enum):
art = 0
mod = 1
trk = 2
rig = 3
tex = 4
shd = 5
ani = 6
vfx = 7
cfx = 8
lgt = 9
render = 10
roto = 12
mat = 13
cmp = 14
user = 15
file = 16
c... | StarcoderdataPython |
11225594 | <reponame>ravinkohli/Auto-PyTorch
from typing import Any, Dict, Type, Union
from autoPyTorch.pipeline.components.base_component import (
ThirdPartyComponents,
)
from autoPyTorch.pipeline.components.setup.traditional_ml.traditional_learner.base_traditional_learner import \
BaseTraditionalLearner
from autoPyTorc... | StarcoderdataPython |
282442 | <reponame>Apkawa/django-modeltranslation-rosetta<gh_stars>0
# coding=utf-8
from __future__ import unicode_literals
from django.contrib import admin
from .models import (
Article
)
@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
pass
| StarcoderdataPython |
9682428 | <filename>LittlePerformance/module/insane_part.py
import time
import random
import sys
from naoqi import ALProxy
argvs = sys.argv
ip = argvs[1]
port = int(argvs[2])
REPEAT = int(argvs[3])
MODE = int(argvs[4])
try:
motion_proxy = ALProxy('ALMotion',ip,port)
except:
quit()
part = 'Body'
if MODE == 0: # only h... | StarcoderdataPython |
3393621 | <filename>project1/application.py
import os
import requests
from flask import Flask, session, render_template, request
from flask_session import Session
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from datetime import datetime
# from flask.ext.heroku import Heroku
os.g... | StarcoderdataPython |
177964 | from app import __metadata__ as meta
from configparser import ConfigParser, ExtendedInterpolation
from pathlib import Path
from shutil import copy
import os
import io
import logging
log = logging.getLogger(__name__)
APP = meta.APP_NAME
'''
This component is responsible for configuration management.
If this is the fir... | StarcoderdataPython |
8150636 | # Copyright (c) AIRBUS and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
from dataclasses import asdict
from enum import EnumMeta
from typing import Dict, Generic, Iterable, List, Sequence,... | StarcoderdataPython |
1944119 | <filename>RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/interface/gre/gre.py
# Copyright 1997 - 2018 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software w... | StarcoderdataPython |
11285813 | ''' Make a table to keep track of maximum form each node. Apply
dfs on each node and collect the max length from all four sides. Increment + 1
while returning and store in the table so that next time it will directly fetch
the value from the table'''
class Solution:
def __init__(self):
self.max_len = ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.