id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
9723388 | """
MEGNetTrain.py, SciML-SCD, RAL
Trains on the optical properties of materials using the MEGNet
of materials. Refer to https://github.com/materialsvirtuallab/megnet
for more information on MEGNet.
"""
import sys
import subprocess
import logging
import os
logging.basicConfig(level=os.environ.get("LOGLEVEL", "INF... | StarcoderdataPython |
6604004 | <reponame>laloe/djangoRest
from django.conf.urls import url, include
from .models import (Proveedor, Producto,
Unidad, Inventario, Entradas)
from rest_framework import routers, serializers, viewsets, generics
from rest_framework.response import Response
from rest_framework import filters
from .form... | StarcoderdataPython |
11264414 | <reponame>fei-protocol/checkthechain
from __future__ import annotations
import typing
from ctc import spec
from ctc import rpc
from . import block_time_search
from . import block_time_singular
async def async_get_blocks_of_timestamps(
timestamps: typing.Sequence[int],
block_timestamps: typing.Optional[typi... | StarcoderdataPython |
6412409 | # -*- coding: utf-8 -*-
# ==============================================================================
#
# Authors: <NAME> <<EMAIL>>
#
# Copyright (c) 2017 <NAME> . All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# f... | StarcoderdataPython |
8125108 | <gh_stars>10-100
import scipy.stats as sc
import numpy as np
def test_lognorm_pdf():
from numba_stats import lognorm
x = np.linspace(0, 5, 10)
got = lognorm.pdf(x, 1.5, 0.1, 1.2)
expected = sc.lognorm.pdf(x, 1.5, 0.1, 1.2)
np.testing.assert_allclose(got, expected)
def test_lognorm_cdf():
fr... | StarcoderdataPython |
5181210 | # Provided under the CC-BY-SA license. Please cite the accompanying paper when using TOP dataset -
# @ARTICLE {
# author = "<NAME> and <NAME> and <NAME> and <NAME> and <NAME>",
# title = "Semantic Parsing for Task Oriented Dialog using Hierarchical Representations",
# journal = "Conference on Empirical M... | StarcoderdataPython |
6523879 | <reponame>TeriForey/fawkes
# -*- coding: utf-8 -*-
import pytest
# ``py.test --runslow`` causes the entire testsuite to be run, including test
# that are decorated with ``@@slow`` (scaffolding tests).
# see http://pytest.org/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option # Noq... | StarcoderdataPython |
1955330 | import os
import unittest
import numpy as np
import pytest
from geopyspark.geotrellis import (SpatialKey,
Tile,
ProjectedExtent,
Extent,
RasterLayer,
... | StarcoderdataPython |
9761149 | <filename>query_flight/tests/conftest.py
import pytest
from django.utils import timezone
from query_flight.models import Airport, Flight, Search, Layover
@pytest.fixture(scope='function', params=[str, timezone.pytz.timezone])
def tz_func(request):
return request.param
@pytest.fixture
def atl_dict():
return ... | StarcoderdataPython |
1708047 | <reponame>dakhnovskaya/tenders
from django.shortcuts import render
from .models import Tender
from django.shortcuts import render, get_object_or_404
from .form import TenderForm
from django.shortcuts import redirect
def tender_list(request):
tenders = Tender.objects.all()
return render(request, 'tenders_api/t... | StarcoderdataPython |
4929585 | """
Processing of data from SPM Fig. 8
"""
from pathlib import Path
import pandas as pd
import scmdata
from .badc import read_badc
from .utils import convert_percentile_to_stats, convert_ssp_name, force_col_to_int
def compile_spm_fig_8_timeseries(raw_data_path):
directories_metadata = (
# path, start_st... | StarcoderdataPython |
1865270 | <reponame>delair-ai/DISCA<gh_stars>1-10
import warnings
import cv2
import numpy as np
from sklearn.metrics import f1_score as sk_f1
from tqdm import tqdm
warnings.simplefilter(action='ignore', category=RuntimeWarning)
def accuracy(input, target):
"""Computes the total accuracy"""
return 100 * float(np.count... | StarcoderdataPython |
350843 | """ SeleniumBase Exceptions
NoSuchFileException => Called when self.assert_downloaded_file(...) fails.
NotUsingChromeException => Used by Chrome-only methods if not using Chrome.
OutOfScopeException => Used by BaseCase methods when setUp() is skipped.
TextNotVisibleException => Called when expected text... | StarcoderdataPython |
5164480 | <filename>conv_is_all_you_need/src/Cropping_Window_Xception/scripts/resize_pictures.py
from skimage.io import imread, imsave
import os
import cv2
from os.path import join as pjoin, basename, splitext
from lib.utils import info, multiprocessing, debug
def resize_one_img(task):
fn = task['fn']
input_dir = task[... | StarcoderdataPython |
4806687 | from common.common_classes import Scenario, Executor
import numpy as np
#################################
# 1x2 2x2 3x2 3x3 5x4 5xRand
# Scenario\Executor configs | 0 | 1 | 2 | 3 | 4 | 5 |
# 04 0 | 001 | 002 | 003 | 004 | 005 | 006 |
# 06 ... | StarcoderdataPython |
3235638 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.3.0
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %run 0-Base.ipynb
SOUR... | StarcoderdataPython |
73161 | #!/usr/bin/env python3
import re
import csv
import glob
from matplotlib import pyplot as plt
from matplotlib.ticker import FuncFormatter
from adjustText import adjust_text
compilePlots = [
[ "XXD, random data", "work/compile-times-xxd-random.csv" ],
[ "XXD, text data", "work/compile-... | StarcoderdataPython |
1890997 |
# TODO: create a function that can help easily map raw pheno files that do not
# TODO: have the participant_session id that CPAC uses
def read_group_list_text_file(group_list_text_file):
"""Read in the group-level analysis participant-session list text file."""
with open(group_list_text_file, "r") as f:
... | StarcoderdataPython |
8093923 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.md') as readme_file:
readme = readme_file.read()
requirements = [
"wheel>=0.23.0",
"requests>=2.7.0",
"pandas>=0.16.2",
"docopt>=0.6.2",... | StarcoderdataPython |
1602409 | <gh_stars>0
import pyowm
owm = pyowm.OWM('797153f746aae22307499da4ad723468')
observation = owm.weather_at_place('Almere,nl')
w = observation.get_weather()
print(w)
wind = w.get_wind()
temp = w.get_temperature('celsius')
print(wind)
print(temp)
observation_list = owm.weather_around_coords(52.371353, 5.222124) | StarcoderdataPython |
8009147 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 23 16:31:18 2021
@author: ilmrd77
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import math
#Creating boxes which return some values between its +-2.0 original value
class box():
def __init__(self,q):
... | StarcoderdataPython |
6512499 | from BioModelsDAG import *
from BioModelsDAG.utils import timeit, yield_model_paths, to_csv
def flatten_reaction_data(data):
"""
Flattens each (Child, Edge, Parent) 3-tuple from reactions_parser
into relevant information to write to a CSV file.
:param data: Generator of (Child, Edge, Parent) 3-tuples... | StarcoderdataPython |
204618 | <reponame>UCLA-SEAL/Sibyl
# NLP | Train
from transformers import (
AutoModelForSequenceClassification,
AutoTokenizer,
Trainer,
TrainingArguments,
TrainerCallback,
EarlyStoppingCallback
)
from sklearn.metrics import accuracy_score, precision_recall_fscore_support
from transformers.trainer_... | StarcoderdataPython |
150015 | #!/usr/bin/env python2.7
# coding=utf-8
'''
@date = '17/4/7'
@author = 'chenliang'
@email = '<EMAIL>'
'''
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from . import ui_fatermainwin
from . import editwidget
import os
import threading
from . import settingdlg
from . import statisticswidget
import... | StarcoderdataPython |
5171925 | <filename>tests/sketchingdev/image_to_ascii/test_converter.py
import unittest
import ntpath
import os
from os import path
from parameterized import parameterized
from sketchingdev.image_to_ascii.converter import format_image
def get_current_directory():
return os.path.dirname(os.path.realpath(__file__))
def r... | StarcoderdataPython |
4955923 | from math import floor
def calculate_fuel(mass: int) -> float:
"""
Calculate fuel based on the mass
Args:
mass (int): Mass to calculate fuel
Returns:
None
"""
fuel = floor(mass / 3) - 2
return fuel
def main():
with open('input.txt.txt', 'r') as file:
fuel = ... | StarcoderdataPython |
3565135 | <reponame>datosgobar/series-tiempo-ar-api
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2019-02-08 18:09
from __future__ import unicode_literals
from django.db import migrations
# No op mantenida para consistencia
def delete_all_but_last_periodicity(*_):
pass
def revert(*_):
pass
class Migratio... | StarcoderdataPython |
9681710 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Provides methods for accessing the interface eAE API.
"""
import json
import stat
import os
import zipfile
import http.client as http
from subprocess import call
from uuid import uuid4
__author__ = "<NAME>"
__copyright__ = "Copyright 2017, <NAME>"
__credits__ = []
__... | StarcoderdataPython |
3216360 | <reponame>yeshess/cloudify-manager
#########
# Copyright (c) 2017 GigaSpaces Technologies Ltd. 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.... | StarcoderdataPython |
3222968 | <reponame>Arfey/aiohttp_admin2<filename>tests/test_connection_injectors.py<gh_stars>10-100
from aiohttp_admin2.connection_injectors import ConnectionInjector
from aiohttp import web
async def test_connection_injector(aiohttp_client):
"""
In this test we check corrected work of ConnectionInjector:
1. ... | StarcoderdataPython |
8108883 | import os
#import argparse
import torch
import mixed_precision
from stats import StatTracker
from datasets import Dataset, build_dataset, get_dataset, get_encoder_size
from model import Model
from checkpoint import Checkpointer
from task_self_supervised import train_self_supervised
from task_classifiers import train_... | StarcoderdataPython |
313745 |
matrix = [
#0, 1, 2, 3, 4, 5, 6, 7], #0
[0, 1, 1, 0, 0, 0, 0, 0], #0
[1, 0, 1, 1, 0, 0, 0, 0], #1
[1, 1, 0, 0, 0, 0, 0, 0], #2
[0, 1, 0, 0, 1, 1, 0, 0], #3
[0, 0, 0, 1, 0, 0, 1, 0], #4
[0, 0, 0, 1, 0, 0, 1, 0], #5
[0, 0, 0, 0, 1, 1, 0, 1], #6
[0, 0, 0, 0, 0, 0, 1, 0], #7... | StarcoderdataPython |
9712219 | <reponame>6RiverSystems/pure_pursuit
#!/usr/bin/env python
import rospy
from std_msgs.msg import String, Header
from nav_msgs.msg import Odometry, Path
from geometry_msgs.msg import Twist, PoseStamped
import math
import sys
import time
import tf
from srslib_framework.msg import MsgUpdateToteLights
def messageCr... | StarcoderdataPython |
276686 | <filename>rpmrepo/util.py
"""rpmrepo - utilities
A module with a wide array of different utility functions that extend the
standard library.
"""
# pylint: disable=invalid-name
import contextlib
import errno
import os
@contextlib.contextmanager
def suppress_oserror(*errnos):
"""Suppress OSError Exceptions
... | StarcoderdataPython |
11224853 | <reponame>bavodenys/KitesurfApp<filename>KiteSurfApp.py<gh_stars>0
from kivymd.app import MDApp
from kivy.lang import Builder
from kivy.core.window import Window
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.boxlayout import BoxLayout
from kivymd.uix.list import OneLineListItem
import Spe... | StarcoderdataPython |
3368841 | # Distributed DL Client runs on the master node
# @author: <NAME>
# @created date: 2021-06-28
# @last modified date:
# @note:
from ddlf.cluster import *
code1 = '''
def f(self):
self.data['total'] = 1000
setattr(Worker, 'ff', f)
self.ff()
'''
code2 = '''
self.data['price'] = 1... | StarcoderdataPython |
1772929 | """test_mainmodel.py - tests the mainmodel module
<NAME> (TRI/Austin, Inc.)
"""
__author__ = '<NAME>'
import models.mainmodel as model
import models.dataio as dataio
import models.abstractplugin as abstractplugin
import models.config as config
import models.ultrasonicgate as ultrasonicgate
import controllers.pathfin... | StarcoderdataPython |
12818712 | # SPDX-License-Identifier: MIT
# Copyright (C) 2018-present iced project and contributors
# ⚠️This file was generated by GENERATOR!🦹♂️
# pylint: disable=invalid-name
# pylint: disable=line-too-long
# pylint: disable=too-many-lines
"""
Operand, register and memory access
"""
import typing
if typing.TYPE_CHECKING:
... | StarcoderdataPython |
245535 | import argparse
import math
import os
import torch
import torch.nn.functional as F
import torchvision
from torch import optim
from tqdm import tqdm
from src.models.stylegan import Generator
def conv_warper(layer, input, style, noise):
"""[summary]
Args:
layer (nn.Module): StyleConv
input ([... | StarcoderdataPython |
11277541 | #!/usr/bin/env/python3
# -*- coding:utf-8 -*-
"""
@project: apiAutoTest
@author: zy7y
@file: run.py
@ide: PyCharm
@time: 2020/12/16
@github: https://github.com/zy7y
@site: https://cnblogs.com/zy7y
@desc: 运行文件
"""
import os
import shutil
from test.conftest import pytest
from tools import logger
from tools.read_file imp... | StarcoderdataPython |
224082 | <reponame>abought/zorp
import pytest
from zorp import parsers
##
# Sample preconfigured parsers that work with the data in these test suites
# These were defined at a time before optional columns were introduced, so in practice many of our tests have the
# same layout and order of fields
@pytest.fixture(scope='mod... | StarcoderdataPython |
3357078 | #!/usr/bin/env python
# encoding: utf-8
"""Azkaban CLI: a lightweight command line interface for Azkaban.
Usage:
azkaban build [-cp PROJECT] [-a ALIAS | -u URL | [-r] ZIP] [-o OPTION ...]
azkaban info [-p PROJECT] [-f | -o OPTION ... | [-i] JOB ...]
azkaban log [-a ALIAS | -u URL] EXECUTION [JOB]
azkaban run ... | StarcoderdataPython |
3401641 | <filename>Project Euler Qusetions 51 - 60/Project Euler Question 57.py<gh_stars>1-10
#Project Euler Question 57
#Square root convergents
fraction_list = 0
x = 3
y = 2
for num in range(1, 1000):
xy = x + y
x = xy + y
y = xy
if len(str(x)) > len(str(y)):
fraction_list += 1
print (fraction_list) | StarcoderdataPython |
3405926 | <filename>Oplevering-2/geslachtsverandering.py
# klopt niet
def vertaal(word, vertaling):
new_word = ""
if word.isupper():
for k,v in vertalingen.items():
if k == word:
new_word += v.upper()
else:
new_word += k.upper()
else:
for k,v in ... | StarcoderdataPython |
148346 | #!/usr/bin/python3
''' Summary: Script to process images and update the database '''
import datetime
import os
import sqlite3
from pathlib import Path
from sqlite3 import Error
import cv2
import numpy as np
from numpy import array
from shapely.geometry import Polygon, asPoint
import mrcnn.config
from mrcnn.model impo... | StarcoderdataPython |
11203213 | # Time: O(m + n), excluding ctor of result
# Space: O(1)
# optimized from Solution2 since we can find next i, j pair without nested loops
class Solution(object):
def restoreMatrix(self, rowSum, colSum):
"""
:type rowSum: List[int]
:type colSum: List[int]
:rtype: List[List[int]]
... | StarcoderdataPython |
8152014 | # Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | StarcoderdataPython |
5040884 | from __future__ import absolute_import
from typing import Tuple, List, Callable, Any
import numpy as np # type: ignore
from sklearn.utils import check_random_state # type: ignore
import matplotlib.pyplot as plt
import pickle
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
... | StarcoderdataPython |
1971098 | # -*- coding: utf-8 -*-
from requests import get
from requests.exceptions import RequestException
from contextlib import closing
from bs4 import BeautifulSoup
import sys
import re
f = open("portraits_qs.txt", "w")
counter = 0
raw_html = open('portrait2015.html').read()
html = BeautifulSoup(raw_html, 'html.parser')
for... | StarcoderdataPython |
1777689 | <filename>app/api/tests/test_friend_request_api.py
from django.test import TestCase
from django.urls import reverse
from rest_framework.test import APIClient
from rest_framework import status
from .utils import create_user, create_friend_request
from core.models import FriendRequest
CREATE_FRIEND_REQUEST_URL = reve... | StarcoderdataPython |
1972565 | from time import sleep
from datetime import datetime
import os
import requests
def post_to_discord(msg):
from discord_endpoint import discord_endpoint
data = { "content": msg}
requests.post(discord_endpoint, json = data)
bIsBuilding = False
while 1:
PROCNAME = "UnrealLightmass.exe"
output = os.po... | StarcoderdataPython |
3579366 | <filename>collector-agent/CollectorAgent/TCGenerator.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# ------------------------------------------------------------------------------
# Copyright 2020. NAVER Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use t... | StarcoderdataPython |
11284956 | from django.db import models
class Edge(models.Model):
"""
Django model to hold Edge information
"""
# Now parse the relevant CSV file and bulk add the data
exclude_smiles = models.CharField(max_length=200)
exclude_type = models.CharField(max_length=200)
rebuilt_smiles = models.CharField(ma... | StarcoderdataPython |
1740244 | <filename>python/GafferRenderManUI/RenderManRenderUI.py
##########################################################################
#
# Copyright (c) 2012-2014, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided t... | StarcoderdataPython |
351753 | <reponame>easy-electrophysiology/load-heka-python<filename>run_test_load_heka.py<gh_stars>0
from test import test_load_heka
from os.path import join, basename, dirname
import glob
def test_file(test_path, dp_thr=1e-6, info_type="max_dp_match", assert_mode=False):
"""
Convenience function around test_load_heka.... | StarcoderdataPython |
12810729 | # Title: 피보나치 수 5
# Link: https://www.acmicpc.net/problem/10870
import sys
sys.setrecursionlimit(10 ** 6)
read_single_int = lambda: int(sys.stdin.readline().strip())
def get_fibonacci(n: int):
if n == 0:
return 0
if n == 1:
return 1
return get_fibonacci(n-1) + get_fibonacci(n-2)
def ... | StarcoderdataPython |
3270564 | <filename>src/aoc21/log.py
from logging import getLogger, INFO, Formatter, StreamHandler, WARNING
from sys import stderr
def setup_logging(verbosity: int):
logger = getLogger("aoc21")
logger.setLevel(INFO if verbosity > 0 else WARNING)
inner_logger = getLogger("aoc21.days")
inner_logger.setLevel(INFO... | StarcoderdataPython |
9775081 | <filename>api/src/app/database/models.py
from sqlalchemy import Boolean, Column, Table, ForeignKey, Integer, BigInteger, String, DateTime
from sqlalchemy.orm import relationship
from sqlalchemy_utils import UUIDType
from app.database.base import Base
from datetime import datetime
import uuid
follow_table = Table('f... | StarcoderdataPython |
1729878 | #------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... | StarcoderdataPython |
165222 | <filename>craft2onnx.py<gh_stars>1-10
import io
import numpy as np
from torch import nn
import torch.utils.model_zoo as model_zoo
import torch.onnx
import torch.backends.cudnn as cudnn
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.init as init
from craft import CRAFT
from colle... | StarcoderdataPython |
1862157 | from functools import lru_cache
class Solution:
def countSubstrings(self, s: str) -> int:
n = len(s)
dp = [[False for _ in range(n)] for _ in range(n)]
ret = 0
for j in range(n):
for i in range(j, -1, -1):
if i == j:
dp[i][j] = True
... | StarcoderdataPython |
4987920 | import sys
def solve1(groups):
sum = 0
for group in groups:
yes = set()
for ans in group:
for q in ans:
yes.add(q)
sum += len(yes)
return sum
def solve2(groups):
az = [chr(ord('a')+i) for i in range(26)]
sum = 0
for group in groups:
y... | StarcoderdataPython |
11301992 | #!/usr/bin/env python
#
# MIT License
#
# Copyright (c) 2022 GT4SD team
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use... | StarcoderdataPython |
4801903 | #!/usr/bin/env python3
tests = [
# RMW Hz, runs
('f', 80, 10),
('c', 80, 10),
('f', 100, 10),
('c', 100, 10),
('f', 120, 10),
('c', 120, 10),
]
rmw_names = {'f': 'FastRTPS', 'c': 'CycloneDDS'}
rmw_colors = {
'f': [
'#0000ff',
'#0000ef',
'#0000df',
'#0000c... | StarcoderdataPython |
6425430 | from flask import Flask
from app import app
from flask import render_template
from flask import request
from flask import url_for
@app.route('/')
def home():
create_link = "<a href= '"+url_for('create')+"'> <h2>Create a Question </h2></a>"
return """
<html>
<head>
<titl... | StarcoderdataPython |
9767377 | #!/usr/bin/env python
import numpy as np
import unittest
import ray
from ray.rllib.agents.registry import get_agent_class
from ray.rllib.utils.test_utils import framework_iterator
def get_mean_action(alg, obs):
out = []
for _ in range(2000):
out.append(float(alg.compute_action(obs)))
return np.m... | StarcoderdataPython |
9678808 | """
PDF highlighter module
"""
import re
import sys
from pdfminer.high_level import extract_pages
from pdfminer.layout import LAParams, LTTextBox, LTTextLine
from pdf_annotate import PdfAnnotator, Location, Appearance
from . import base
class Highlighter(base.Highlighter):
"""
Finds text and adds annotatio... | StarcoderdataPython |
11394980 | <gh_stars>1000+
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
import numpy as np
from pathlib import Path
from MiniFramework.EnumDef_5_0 import *
from MiniFramework.Optimizer_1_0 import *
class WeightsBias_2_1(obje... | StarcoderdataPython |
8078096 | from output.models.ms_data.attribute.att_j018_xsd.att_j018 import (
Doc,
Test,
)
__all__ = [
"Doc",
"Test",
]
| StarcoderdataPython |
11363438 | # Copyright (c) 2019, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | StarcoderdataPython |
65027 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-05-20 10:23
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('driver', '0003_auto_20180520_1217'),
]
operations = [
migrations.AlterModelOptions(
... | StarcoderdataPython |
5106525 | from convokit.model import Corpus, Utterance, Speaker
# test utterances
GRATITUDE = 'I really appreciate that you have done them. Thanks a lot.'
DEFERENCE = 'Nice work so far on your rewrite.'
GREETING = 'Hey, how are you doing these days?'
APOLOGY = 'Sorry to bother you, but I need someone to work on this project.'
... | StarcoderdataPython |
5043582 | <reponame>TheOnlyWayUp/hangmanSolver<gh_stars>1-10
from .main import HangmanSolver | StarcoderdataPython |
11215403 | <filename>extractSpeech.py<gh_stars>0
# from library
import speech_recognition
import moviepy.editor as moviepy
import librosa
import os
class SpeechExtraction:
VideoClipFile = ""
ConvertedClipFile = "converted.wav"
audio_path = "converted.wav" #By default
clip = ""
audio = ""
result = ""
... | StarcoderdataPython |
1866617 | #!/usr/bin/python
# Copyright (C) 2013 <NAME>, FoldedSoft e.U.
#
# 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 |
1704919 | '''
Script to generate embeddings from resnet trained using pcl
Command to run:
python eval_kmeans.py --pretrained experiment_pcl_resume/checkpoint.pth.tar /home/mprabhud/dataset/shapenet_renders/npys/
'''
from __future__ import print_function
import os
import sys
import time
import torch
import torch.nn as nn
impo... | StarcoderdataPython |
3397570 | <gh_stars>1-10
# source: https://github.com/kuangliu/pytorch-cifar/blob/master/models/densenet.py
'''DenseNet in PyTorch.'''
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from cnns.nnlib.pytorch_layers.conv_picker import Conv
def conv3x3(in_planes, out_planes, args, stride=1):
"... | StarcoderdataPython |
8172993 | import os
import subprocess
import traceback
from celery import shared_task
from imagekit.utils import open_image, save_image
from django.conf import settings
from django.db import transaction
from django.contrib.contenttypes.models import ContentType
from shapes.models import SubmittedShape, MaterialShape, ShapeSub... | StarcoderdataPython |
12814242 | from collections import defaultdict
class Solution:
def largestWordCount(self, messages: List[str], senders: List[str]) -> str:
dc = defaultdict(int)
max_cnt = 0
cand_list = []
for i in range(len(senders)):
dc[senders[i]] += len(messages[i].split())
if dc[send... | StarcoderdataPython |
12811168 | <reponame>BytewaveMLP/Advent-of-Code-2020<filename>Day 18/part2.py
import sys
import re
input_lines = [line for line in open(sys.argv[1]).read().split('\n') if line != '']
class N:
def __init__(self, n):
self.n = n
def __truediv__(self, b):
return N(self.n + b.n)
def __add__(self, b):
return N(self.n * b.n)
... | StarcoderdataPython |
6501211 | <reponame>mshafer1/preview-ahk-gen<gh_stars>10-100
import re
from collections import defaultdict
from enum import Enum
import pytest
from selenium.webdriver.common.by import By
class TriggerTypes(Enum):
KEY = "KEY"
STRING = "STRING"
class AssertionObject:
def __init__(self, expected_trigger_types=[], e... | StarcoderdataPython |
1851076 | # Description: Delete all H-bonds in the selection, which is all by default.
# Source: placeHolder
"""
cmd.do('cmd.delete("hbonds")')
"""
cmd.do('cmd.delete("hbonds")')
| StarcoderdataPython |
1917966 | <reponame>Borda/kaggle_cell-inst-segm
import os.path
_ROOT_TESTS = os.path.dirname(__file__)
_ROOT_DATA = os.path.join(_ROOT_TESTS, "_data")
| StarcoderdataPython |
3406516 | # Main entry point for server
import logging
import threading
from config import SERVER_CONFIG
from app import App, Handler
from sys import exit, stdin
from utils import random_string
if __name__ == "__main__":
# Configure logging
logging.basicConfig(
level=SERVER_CONFIG['log_level'],
format='[%... | StarcoderdataPython |
8101242 | <filename>1.1/1.1.py
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # Suppress warning that it can't use CUDA
import tensorflow as tf
v = tf.Variable(0)
@tf.function
def increment(v):
v = tf.add(v, 1)
return v
for _ in range(3):
v = increment(v)
print(v)
a = tf.constant([5])
b = tf.constant([... | StarcoderdataPython |
9656244 | from Block import Block
from ListaBlockchain import *
l = BlockChain()
tabla = []
#VERIFICAR QUE FUNCIONE BIEN EL METODO AL HACER LAS LLAMADAS!!!!!!!!!
def activar_SaveModo(registro):
tabla = registro
genesis_block = Block("0", tabla)
if l.listaVacia() is True:
#genesis_block = Block("0... | StarcoderdataPython |
393676 | <gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
import sentry.db.models.fields.bounded
import sentry.db.models.fields.foreignkey
class Migration(migrations.Migration):
# This flag is used to mark that a migration sh... | StarcoderdataPython |
12855950 | from rest_framework.reverse import reverse
from rest_framework.test import APITestCase
from fdadb.models import MedicationName, MedicationNDC, MedicationStrength
class APITests(APITestCase):
def setUp(self):
for name in ("DrugName", "OtherDrugName", "DruuuugName", "NamedDrug"):
medication_nam... | StarcoderdataPython |
8178998 | <filename>beginner_source/former_torchies/nnft_tutorial.py<gh_stars>1000+
# -*- coding: utf-8 -*-
"""
nn package
==========
We’ve redesigned the nn package, so that it’s fully integrated with
autograd. Let's review the changes.
**Replace containers with autograd:**
You no longer have to use Containers like ``Con... | StarcoderdataPython |
11239807 | <gh_stars>1-10
import pytest
from wemake_python_styleguide.violations.consistency import (
InconsistentReturnVariableViolation,
)
from wemake_python_styleguide.visitors.ast.keywords import (
ConsistentReturningVariableVisitor,
)
# Correct:
correct_example1 = """
def some_function():
return 1
"""
correct... | StarcoderdataPython |
9781813 | <gh_stars>0
# stdlib
import re
import sys
from typing import Any
from typing import List
from typing import Tuple
from typing import Union
# third party
from google.protobuf.reflection import GeneratedProtocolMessageType
from nacl.signing import VerifyKey
# syft relative
from ... import serialize
from ...proto.core.n... | StarcoderdataPython |
6560677 | <reponame>nevooronni/PasswordLocker<filename>accounts.py
import pyperclip
import random
import string
class User:
"""
class that generates new instance of users
"""
#class variables
user_list = []
def save_user(self):
"""
save_account method save accounts into the user_list
""... | StarcoderdataPython |
6493958 | # Задача 12. Вариант 7.
# Разработайте игру "Крестики-нолики". (см. М.Доусон Программируем на Python гл. 6)
# <NAME>.
# 26.05.2016
import random
#крестики-нолики
X = "X"
O = "O"
EMPTY = " "
TIE = "ничья"
NUM_SQUARES = 9
def main():
return 0
def display_instruct():
print ("""
0 | 1 | 2
—--... | StarcoderdataPython |
1932240 | # -*- coding: utf-8 -*-
#pylint: skip-file
"""
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 unde... | StarcoderdataPython |
175478 | #
# CircleCI
#
from utils import abort_with_message
import constants
import json
import os
import requests
import sys
def get_circleci_api_token():
circleci_api_token = os.environ.get(constants.CIRCLECI_API_TOKEN_ENV_VAR)
if not circleci_api_token:
abort_with_message('You need to set the CIRCLECI_API... | StarcoderdataPython |
313928 | from __future__ import division
import unittest
import tttrlib
import numpy as np
class Tests(unittest.TestCase):
def test_getter_setter_pda(self):
# test getter and setter
pda = tttrlib.Pda()
pda.hist2d_valid = True
self.assertEqual(pda.hist2d_valid, True)
pda.hist2d_va... | StarcoderdataPython |
3579821 | ##
# Copyright (c) 2014-2015 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | StarcoderdataPython |
6509166 | {
"name": "Library Book Checkout",
"description": "Members can borrow books from the library.",
"author": "<NAME>",
"depends": ["library_member", "mail"],
"data": [
"security/ir.model.access.csv",
"views/library_menu.xml",
"views/checkout_view.xml",
"wizard/checkout_m... | StarcoderdataPython |
1626366 | <filename>comm/communication_server.py
import http.server
class ServerMain(http.server.SimpleHTTPRequestHandler):
def do_HEAD(self):
self.send_response(200)
self.send_header('Allow', 'GET, POST, OPTIONS')
self.send_header("Content-Type", "text/html")
self.send_header("charset", "ut... | StarcoderdataPython |
3404966 | #
# Copyright (c) SAS Institute Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.