id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1648384 | #!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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 agree... | StarcoderdataPython |
4842868 | import pymongo.results
import pytest
from aiohttp.test_utils import make_mocked_coro
import virtool.db.core
import virtool.utils
@pytest.fixture
def create_test_collection(mocker, test_motor):
def func(
name="samples", projection=None, silent=False
) -> virtool.db.core.Collection:
processor =... | StarcoderdataPython |
1642697 | import pytest
from brownie import interface, Contract
from utils.voting import create_vote
from utils.config import (lido_dao_voting_address,
lido_dao_agent_address,
balancer_deployed_manager,
lido_dao_token_manager_address,
... | StarcoderdataPython |
1613208 | <reponame>suvit/speedydeploy
from webserver import * # XXX remove this file | StarcoderdataPython |
107561 | N, K = map(int, input().split())
A = list(map(int, input().split()))
bcs = [0] * 41
for i in range(N):
a = A[i]
for j in range(41):
if a & (1 << j) != 0:
bcs[j] += 1
X = 0
for i in range(40, -1, -1):
if bcs[i] >= N - bcs[i]:
continue
t = 1 << i
if X + t <= K:
X ... | StarcoderdataPython |
110151 | <filename>introduccion/time.py
import pygame
import sys
pygame.init()
width = 500
height = 400
surface = pygame.display.set_mode((width, height))
pygame.display.set_caption('Tiempo')
white = (255, 255, 255)
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()... | StarcoderdataPython |
119598 | import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm, t
np.random.seed(1)
#%%
N = 1_0
mu = 5
sd = 2
#%%
x = np.random.randn(N)*sd + mu
#%% Z-CI
mu_hat = x.mean()
sigma_hat = x.std(ddof=1)
z_left = norm.ppf(0.0250)
z_right = norm.ppf(0.9750)
left_ci = mu_hat + z_left*sigma_hat/np.sqrt(N)
ri... | StarcoderdataPython |
3385879 | <filename>Heap/BinaryHeap.py
# coding=utf-8
"""Min Binary Heap Python implementation."""
class MinBinaryHeap:
"""Min Binary Heap class."""
def __init__(self):
self.heap = []
def parent(self, i):
"""Get index of parent of node i."""
return (i - 1) // 2
def left_child(self, i):... | StarcoderdataPython |
1713751 | <reponame>bletourmy/django-terms
# coding: utf-8
from __future__ import unicode_literals
import sys
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.db.models import Model, CharField, TextField, BooleanField
from django.utils.translation import ugettext_lazy as _
from .manag... | StarcoderdataPython |
1788782 | <reponame>ForrestPi/VAEGAN
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
from model.modules import ConvBNLReLU, UpsampleNearestCBLR
class Encoder(nn.Module):
def __init__(self, nc, fmaps, latent_variable_size):
super().__init__()
self.nc = nc
self.fmaps = f... | StarcoderdataPython |
13185 | <gh_stars>1-10
from Sender import Sender
from Receiver import Receiver
import scipy
import numpy as np
import scipy.io
import scipy.io.wavfile
import matplotlib.pyplot as plt
from scipy import signal
def readFromFile(path):
file = open(path, "rb")
data = file.read()
file.close()
return data
def readW... | StarcoderdataPython |
1686374 | import os
from fast_align.generate_alignments import generate_word_alignments_fast_align
from mgiza.generate_alignments import generate_word_alignments_mgiza
from SimAlign.generate_alignments import generate_word_alignments_simalign
from awesome.generate_alignments import generate_word_alignments_awesome
from typing im... | StarcoderdataPython |
3313616 | <filename>maintcont.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
The controller bot for maintainer.py
Exactly one instance should be running of it. To check, use /whois maintcont on irc.freenode.net
This script requires the Python IRC library http://python-irclib.sourceforge.net/
Warning: experimental softwa... | StarcoderdataPython |
3274073 | <gh_stars>1-10
import psycopg2
import os
import json
test_data = '''
{
"received": [
{
"from": {
"display": "mail.example.com",
"reverse": "Unknown",
"ip": "10.0.0.2"
},
"by": "mailsrv.example.com",
"protocol": ... | StarcoderdataPython |
1645794 | import numpy as np
import argparse
import config
import os
import datetime
import sys
import tensorflow.keras as keras
from tensorflow.keras.layers import Input, Conv2D, Flatten, Dense, Conv2DTranspose, Lambda, Reshape, Layer
from tensorflow.keras.models import Model
from tensorflow.keras.optimizers import Adam
from te... | StarcoderdataPython |
1724857 | <gh_stars>1-10
from __future__ import division
import numpy as np
from scipy.sparse import csr_matrix, coo_matrix
from scipy.linalg import blas
from pyscf.nao.m_sparsetools import csr_matvec, csc_matvec, csc_matvecs
import math
def chi0_mv(self, dvin, comega=1j*0.0, dnout=None):
"""
Apply the non-interac... | StarcoderdataPython |
3364218 | """
Neuron __init__.
"""
try:
from spikey.snn.neuron.neuron import Neuron
from spikey.snn.neuron.rand_potential import RandPotential
except ImportError as e:
raise ImportError(f"neuron/__init__.py failed: {e}")
| StarcoderdataPython |
1792897 | from enum import Enum
from .site_models import News
from selenium import webdriver
from datetime import datetime
from typing import List
from . import dong_fang
from . import can_kao_xiao_xi
# from . import renmin
# from . import sina
# from . import zhong_guo_xin_wen
class SupportedSites(Enum):
'''
支持的所有网站
... | StarcoderdataPython |
1763055 | <reponame>ZimCodes/Zyod<gh_stars>1-10
import os
from lib.driver import browser
from selenium.webdriver.chromium.options import ChromiumOptions
from selenium.webdriver.chromium.webdriver import ChromiumDriver
class Chromium(browser.Browser):
"""Chromium WebDriver"""
def __init__(self, opts, driver_opts=Chrom... | StarcoderdataPython |
1648107 | """
Scripts to query BPL Solr to find expired/removed Overdrive records
"""
import json
import os
import time
from bookops_bpl_solr import SolrSession
from utils import save2csv
def get_creds(fh):
with open(fh, "rb") as jsonfile:
creds = json.load(jsonfile)
return creds
def find_total_hits(re... | StarcoderdataPython |
3347672 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('questions', '0003_question_owner'),
]
operations = [
migrations.CreateModel(
name='Answer',
fields=[... | StarcoderdataPython |
1616947 | <gh_stars>0
import unittest
from dialogapi.requests import Requests
class RequestsTest(unittest.TestCase):
def test_method_call(self):
url = "https://www.nttdocomo.co.jp/"
res = Requests(verify=True).get(url)
self.assertEqual(res.status_code, 200)
| StarcoderdataPython |
1734004 | <filename>21608.py
import sys
input = sys.stdin.readline
'''
최대 학생 수는 400명이니까
완전탐색 하면 대략 16만 회 << 가능할듯?
학생 번호가 주어졌을 때 조건에 맞는 자리 찾아주는 함수 필요
'''
# functions
def find_seat(student, like, N):
"""classroom 배열에 학생 배치"""
seat_pos = (-1, -1)
seat_adj_like = -1
seat_adj_empty = -1
for r in range(N):
... | StarcoderdataPython |
1798391 | from abc import ABC, abstractmethod
import torch
from data_utils import helper
from data_utils import pose_features
# A normalizer provides an interface to normalize and denormalize a batch of poses.
# The normalization/denormalization is always a deterministic process.
class BaseNormalizer(ABC):
@classmethod
... | StarcoderdataPython |
40460 | <reponame>WolffunGame/experiment-agent<filename>tests/acceptance/test_acceptance/__init__.py
# __init__ is empty
| StarcoderdataPython |
3355489 | <reponame>ark-1/circleci-jetbrains-space-orb
import base64
import os
import subprocess
import json
from typing import Optional, List
def substitute_envs(s: str) -> str:
shell = if_not_empty(
subprocess.check_output("command -v bash; exit 0", shell=True, universal_newlines=True).strip()
) or subprocess... | StarcoderdataPython |
4823496 |
__copyright__ = "Copyright 2013-2016, http://radical.rutgers.edu"
__license__ = "MIT"
from .base import AgentSchedulingComponent
# ------------------------------------------------------------------------------
#
# This is a scheduler which does not schedule, at all. It leaves all placement
# to executors such as ... | StarcoderdataPython |
1759040 | """Module provider for Infomaniak"""
import json
import logging
import requests
from lexicon.exceptions import AuthenticationError
from lexicon.providers.base import Provider as BaseProvider
LOGGER = logging.getLogger(__name__)
ENDPOINT = "https://api.infomaniak.com"
NAMESERVER_DOMAINS = ["infomaniak.com"]
def p... | StarcoderdataPython |
3224314 | <reponame>DanTGL/AdventOfCode2020<gh_stars>0
import math
inputs = [(line[0], int(line[1:])) for line in open("day12/input").read().splitlines()]
dirs = {
"E": [ 1, 0],
"N": [ 0, 1],
"W": [-1, 0],
"S": [-1, 0]
}
dir = 0
pos = [0, 0]
for i in inputs:
if i[0] == "L":
dir += math.radians(i[... | StarcoderdataPython |
3293867 | <reponame>stefanmerb/dash_webapp<filename>simple_webapp.py
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_bootstrap_components as dbc
app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
server = app.server
ap... | StarcoderdataPython |
1695635 | <filename>run_queries.py
import argparse
import os
from inverted_index import InvertedIndex
from preprocessor import Preprocessor
from similarity_measures import TF_Similarity, TFIDF_Similarity, BM25_Similarity
parser = argparse.ArgumentParser(description='Run all queries on the inverted index.')
parser.add_a... | StarcoderdataPython |
1787296 | <filename>Sec20_Greedy/q1029.py<gh_stars>1-10
#!/usr/bin/env python
# encoding: utf-8
class Solution:
def twoCitySchedCost(self, costs: List[List[int]]) -> int:
costs.sort(key = lambda x: x[0] - x[1])
ans = 0
n = len(costs) // 2
for i in range(n):
ans += costs[i][0] + c... | StarcoderdataPython |
3260066 | <reponame>Panopto/universal-content-library-specification
import argparse
import os.path
import hashlib
import boto
import boto3
import re
from botocore.errorfactory import ClientError
from boto.s3.connection import S3Connection
def get_file_from_s3(aws_access_key,
aws_secret_key,
... | StarcoderdataPython |
1763520 | from flappy import *
def nextGeneration():
birds = [None]*POPULATION
for i in range(POPULATION):
birds[i] = bird()
birds[i].initialize()
return birds | StarcoderdataPython |
3298049 | import torch
import torch.nn as nn
import torch.nn.functional as F
from dataset_cl import ContrastiveData
class Encoder(nn.Module):
def __init__(self, embed_size, hidden_size, temperature):
super(Encoder, self).__init__()
self.skill_embed_size = embed_size
self.hidden_size = hidden_size
... | StarcoderdataPython |
1627240 | from multiprocessing import Process, Queue
import os
import time, random
def put_proc(q, urls):
print("Child putting process %s started. " % (os.getpid(),))
for url in urls:
q.put(url)
print('Putting %s to queue.' % (url,))
time.sleep(random.random() * 3)
def get_proc(q):
print("... | StarcoderdataPython |
3398962 | <reponame>farfanoide/libhdd-sched
import unittest
import json
from lib.algorithms import FCFS
from lib.simulation import Simulation, SimulationResult
from lib.parsers import parse_lot
class TestFcfs(unittest.TestCase):
simulation_dict = json.loads(file.read(open('./examples/protosimulation.json')))
simulatio... | StarcoderdataPython |
3385059 | <reponame>fabric-testbed/UserInformationService<filename>server/swagger_server/test/test_preferences_controller.py
# coding: utf-8
from __future__ import absolute_import
from flask import json
from six import BytesIO
from swagger_server.models.preference_type import PreferenceType # noqa: E501
from swagger_server.m... | StarcoderdataPython |
1781620 | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import os.path as op
import wget
if sys.version_info[0] < 3:
int_types = (int, long)
urlopen = urllib.urlopen
else:
int_types = (int,)
basestring = str
from urllib.request import urlopen
def download_file(src_ftp, ds... | StarcoderdataPython |
144129 | <reponame>RoyMachineLearning/lofo-importance
import numpy as np
import pandas as pd
from sklearn.model_selection import cross_validate
from tqdm import tqdm_notebook
import multiprocessing
import warnings
from lofo.infer_defaults import infer_model
class LOFOImportance:
def __init__(self, df, features, target,
... | StarcoderdataPython |
3367083 | <reponame>cedeplar/crawler<filename>tests/test_HouseRequest.py
import responses
from crawler.HouseRequest import HouseRequest
def test_get_request():
house = HouseRequest()
assert house._venda_or_locacao == 'venda'
expected = 'https://www.netimoveis.com/venda/&pagina=10&busca=' \
'{"valorM... | StarcoderdataPython |
1705588 | <reponame>kesia-barros/exercicios-python<gh_stars>0
lista = ('Lapis', 1.75,'Borracha', 2.00, "Caderno", 15.00,
"Estojo", 25.00, "Transferidor", 4.20, "Compasso", 9.99,
"Mochila", 120.32, "Canetas", 22.30, "livro", 34.90)
print("-="*20)
print(" LISTAGEM DE PREÇOS")
print("-="*20)
for pos in ra... | StarcoderdataPython |
1764203 | <reponame>nderkach/mitmproxy<filename>libmproxy/web/__init__.py
from __future__ import absolute_import, print_function
import tornado.ioloop
import tornado.httpserver
from .. import controller, flow
from . import app
class Stop(Exception):
pass
class WebState(flow.State):
def __init__(self):
flow.St... | StarcoderdataPython |
3367058 | # Copyright 2018 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | StarcoderdataPython |
5721 | <filename>ics/mergeGatingSets.py
#!/usr/bin/env python
"""
Usage examples:
python /home/agartlan/gitrepo/utils/ics/mergeGatingSets.py --function functions --ncpus 4 --out functions_extract.csv
sbatch -n 1 -t 3-0 -c 4 -o functions_slurm.txt --wrap="python /home/agartlan/gitrepo/utils/ics/mergeGatingSets.py --function ... | StarcoderdataPython |
3386860 | <reponame>Sunfacing/sc-projects
"""
stanCode Breakout Project
Adapted from <NAME>'s Breakout by
<NAME>, <NAME>, <NAME>,
and <NAME>
This class provides attributes of Ball / Bricks / Paddle
and necessary methods that help run the game
"""
from campy.graphics.gwindow import GWindow
from campy.graphics.gobjects import GO... | StarcoderdataPython |
4824709 | <reponame>sjg20/ec
#!/usr/bin/python3.6
# Copyright 2020 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import hashlib
import os
import subprocess
import tempfile
# SDK install path
SDK_INSTALL_PATH = '/opt/zephyr-sdk... | StarcoderdataPython |
3342109 | from flask_login import UserMixin
from datetime import datetime
from app import db, login
from werkzeug.security import generate_password_hash, check_password_hash
import uuid
like = db.Table('like',
db.Column('user_id', db.Integer, db.ForeignKey('user.id')),
db.Column('post_id', db.Integer, db.ForeignKey('po... | StarcoderdataPython |
1779119 | <reponame>ch1huizong/learning
#! /usr/bin/env python3
# -*-coding:UTF-8 -*-
# @Time : 2019/01/05 11:31:20
# @Author : che
# @Email : <EMAIL>
import time
class Timer(object):
def __init__(self, func=time.perf_counter):
self.elapsed = 0.0
self._func = func
self._start = None
def... | StarcoderdataPython |
140329 | from RappCloud.Objects import (
File,
Payload)
from Cloud import (
CloudMsg,
CloudRequest,
CloudResponse)
class SpeechRecognitionGoogle(CloudMsg):
""" Speech Recognition Google Cloud Message object """
class Request(CloudRequest):
""" Speech Recognition Google Cloud Request obje... | StarcoderdataPython |
150870 | a = 5
print(a)
| StarcoderdataPython |
13771 | <filename>src/data_module.py
# Created by xieenning at 2020/10/19
from argparse import ArgumentParser, Namespace
from typing import Optional, Union, List
from pytorch_lightning import LightningDataModule
from transformers import BertTokenizer
from transformers import ElectraTokenizer
from transformers.utils import logg... | StarcoderdataPython |
1784563 | # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System
# All trademark and other rights reserved by their respective owners
# Copyright 2008-2021 Neongecko.com Inc.
# BSD-3
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the fo... | StarcoderdataPython |
196275 | import operator
import re
from koapy.backend.kiwoom_open_api_plus.core.KiwoomOpenApiPlusError import (
KiwoomOpenApiPlusError,
KiwoomOpenApiPlusNegativeReturnCodeError,
)
from koapy.backend.kiwoom_open_api_plus.core.KiwoomOpenApiPlusTrInfo import (
KiwoomOpenApiPlusTrInfo,
)
from koapy.backend.kiwoom_open_... | StarcoderdataPython |
3377036 | <filename>tools/find_missing.py
# -*- coding: utf-8 -*-
# find missing glyphs needed to render given txt's
import json
def find_missing(pths):
missing = {}
for p in pths:
txt = open(p,'r').read()
js = json.loads(open("./dist/min-trad-compiled.json",'r').read())
for c in txt:
... | StarcoderdataPython |
1667159 | <gh_stars>0
# initialise relevant variables
numbers = []
count = 0
total = 0
lowest = None
highest = None
TEMPLATE = 'count = {0} sum = {1} lowest = {2} highest = {3} mean = {4}'
# while loop will continue to seek new inputs until the user enters Enter, at
# which point loop terminates
while True:
new_input = inpu... | StarcoderdataPython |
3268139 | <filename>hackerrank/BreakingTheRecords.py
import os
def breakingRecords(scores):
h = 0
l = 0
min_score = scores[0]
max_score = scores[0]
for s in scores[1:]:
if s > max_score:
max_score = s
h += 1
if s < min_score:
min_score =... | StarcoderdataPython |
3382142 | <reponame>CCSS-Utrecht/ninolearn
#from ninolearn.IO import read_raw
import xarray as xr
import numpy as np
import iris
import iris.analysis
from iris.coords import DimCoord
from iris.cube import Cube
def to2_5x2_5(data):
"""
Regrids data the 2.5x2.5 from the NCEP reanalysis data set.
:param data: An xar... | StarcoderdataPython |
189030 |
import torch
from .regularizers import overlapping_on_depths
from ..networks.primitive_parameters import PrimitiveParameters
from ..primitives import get_implicit_surface, _compute_accuracy_and_recall
from ..utils.stats_logger import StatsLogger
from ..utils.value_registry import ValueRegistry
from ..utils.metrics im... | StarcoderdataPython |
3390831 | <filename>makeBismarkMethylationExtractorPlusPlusReadPosScript.py
def makeBismarkMethylationExtractorPlusPlusReadPosScript(bismarkFileNameListFileName, outputDir, ignoreR2Val, maxLen, maxLenR2, scriptFileName, codePath):
# Write a script that will extract the methylation status from Bismark output files
bismarkFileNa... | StarcoderdataPython |
1631908 | import base64
import pickle
from django_redis import get_redis_connection
def merge_cookie_to_redis(request,user,response):
"""
将cookie中的购物车数据,合并到redis中
:param request:
:param user:
:param response:
:return:
"""
cart_cookie = request.COOKIES.get('cart')
if cart_cookie is not None... | StarcoderdataPython |
3304664 | import unittest
from kbmod import *
class test_search(unittest.TestCase):
def setUp(self):
# test pass thresholds
self.pixel_error = 0
self.velocity_error = 0.05
self.flux_error = 0.15
# image properties
self.imCount = 20
self.dim_x = 80
self.dim_y = 60
self.n... | StarcoderdataPython |
3356916 | def corrente(texto, indice):
tamanhoP = len(texto)
resultado = None
if indice < tamanhoP and indice > 0:
if texto[indice].isalnum():
iStart = iEnd = indice
while iStart - 1 > 0 and texto[iStart - 1].isalnum():
iStart -= 1
while iEnd < tamanhoP a... | StarcoderdataPython |
85332 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from astropy.time import Time
def open_avro(fname):
with open(fname,'rb') as f:
freader = fastavro.reader(f)
schema = freader.writer_schema
for packet in freader:
return packet
def make_dataframe(packet):
... | StarcoderdataPython |
4806960 | <gh_stars>1-10
#! /usr/bin/python3
from sys import exit
import gi; gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
if __name__ == "__main__":
#dialog = Gtk.ColorChooserDialog()
dialog = Gtk.ColorSelectionDialog()
if dialog.run() == Gtk.ResponseType.OK:
color = dialog.get_color_selec... | StarcoderdataPython |
94993 | from wsgiref.simple_server import make_server
from fs.osfs import OSFS
from wsgi import serve_fs
osfs = OSFS('~/')
application = serve_fs(osfs)
httpd = make_server('', 8000, application)
print "Serving on http://127.0.0.1:8000"
httpd.serve_forever()
| StarcoderdataPython |
1695456 | <reponame>scottstickells/AWS-Scripts<gh_stars>0
#Built with Python 3.3.2
#This script allows for the interactive input from a user to create an EBS volume snapshot and select from what date and time snapshots should be retained and anything older than the specified date and time will be deleted
#The script will prompt ... | StarcoderdataPython |
1749184 | def chat_import(filepath):
chat = open(filepath, "r+")
return chat | StarcoderdataPython |
1747740 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 4 15:23:44 2021
@author: py
"""
from adafruit_servokit import ServoKit
import rospy
import sensor_msgs.msg
from sensor_msgs.msg import LaserScan
from std_msgs.msg import Float32MultiArray
import message_filters
import time
kit = Se... | StarcoderdataPython |
1641598 | #!/usr/bin/env python3.7
"""A hashlife style solution for day 12.
TODO: document this!
"""
from __future__ import annotations
import sys
from collections import defaultdict, deque
from typing import Dict, List, Union, Tuple, Optional, Any
from dataclasses import dataclass
@dataclass(eq=False, frozen=True)
class No... | StarcoderdataPython |
1766190 | """
Testing the CLI
"""
import os
from click.testing import CliRunner
from asaplib.cli.cmd_asap import asap
def test_cmd_gen_soap():
"""Test the command for generating soap descriptors"""
test_folder = os.path.split(__file__)[0]
xyzpath = os.path.abspath(os.path.join(test_folder, 'small_molecules-1000.x... | StarcoderdataPython |
27062 | #/bin/python3
## Step1 scan recursively over all files
import os
import re
import pdb
import datetime
path = "./notes"
dest = "_posts"
magic_prefix = "Active-"
def extractModifiedDate(string):
regexp = r"\d+-\d+-\d+T\d+:\d+:\d+.\d+Z"
date_strings_all = re.findall(regexp,string)
date = None
if (len(da... | StarcoderdataPython |
3205073 | from typing import Optional, List
from rdflib import Graph, URIRef, Literal
from rdflib.namespace import RDF, RDFS, OWL, DCTERMS, XSD
from client.model._TERN import TERN
from client.model.klass import Klass
from client.model.agent import Agent
from client.model.concept import Concept
import re
class RDFDataset(Klas... | StarcoderdataPython |
3219291 | from typing import Dict, List, Tuple
import torch
import torch.multiprocessing as mp
from leafdp.utils import model_utils
from leafdp.flower import flower_helpers
import argparse
from datetime import datetime
import numpy as np
import flwr as fl
import os
# Needs this if we want to launch grpc client
if os.enviro... | StarcoderdataPython |
115326 | <reponame>Paul3MK/NewsBlur
import datetime
from django.contrib.auth.models import User
from django.shortcuts import render
from django.views import View
from apps.profile.models import Profile, RNewUserQueue
class Users(View):
def get(self, request):
last_month = datetime.datetime.utcnow() - datetime.ti... | StarcoderdataPython |
1675385 | """
Train our RNN on extracted features or images.
"""
from keras.callbacks import TensorBoard, ModelCheckpoint, EarlyStopping, CSVLogger
from models import ResearchModels
from data import DataSet
import time
import os.path
def train(data_type, seq_length, model, saved_model=None,
class_limit=None, image_sha... | StarcoderdataPython |
3323107 | <filename>perception/scripts/transform_service.py
#! /usr/bin/env python
import rospy
from transform_helper import Transformer
from perception.srv import *
def get_transform_point_cb(req):
resp = GetTransformPointResponse()
resp.point = transformer.transform_point(req.point, req.from_frame, req.to_frame)
r... | StarcoderdataPython |
187289 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Advent of Code 2020, day five."""
INPUT_FILE = 'data/day_05.txt'
def main() -> None:
"""Identify missing ticket."""
with open(INPUT_FILE, encoding='utf-8') as input_file:
tkt = sorted([int(x.strip().replace('F', '0').replace('B', '1')
... | StarcoderdataPython |
3212745 | # Copyright 2015/2016 by <NAME> (RabbitStack)
# All Rights Reserved.
# http://rabbitstack.github.io
# 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... | StarcoderdataPython |
3318516 | <reponame>Gabriel-15/tytus
from flask import Flask, jsonify, request
from flask_cors import CORS
from user import users
'''# archivos de parser team16
import interprete as Inter
import Ast2 as ast
from Instruccion import *
import Gramatica as g
import ts as TS
import jsonMode as JSON_INGE
import jsonMode as json
impor... | StarcoderdataPython |
4804218 | <reponame>zooed/meanfield<gh_stars>0
"""Self Play
"""
import os
import magent
import argparse
import numpy as np
import tensorflow as tf
import tools
from four_model import spawn_ai
from senario_battle import play
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
if __name__ == '__main__':
parser = argpa... | StarcoderdataPython |
106453 | <gh_stars>0
import logging
import threading
import time
import ipcqueue.posixmq
import prometheus_client.registry
from django.apps import apps
from django.core.exceptions import ImproperlyConfigured
from django.core.management import call_command
from django.core.management.base import BaseCommand
from ...backends.p... | StarcoderdataPython |
158561 | <filename>portfolio/blog/urls.py
from django.conf.urls import url
from portfolio.blog.views import BlogFormView, BlogView
urlpatterns = [
url(r'^add/$', BlogFormView.as_view(), name='blog_add'),
url(r'^$', BlogView.as_view(), name='blog_index'),
] | StarcoderdataPython |
77213 | from flask import Flask
from flask_socketio import SocketIO
from .boxoffice import *
app = Flask(__name__)
if not app.debug:
import os
base_dir = os.path.split(os.path.realpath(__file__))[0]
import logging
from logging.handlers import RotatingFileHandler
file_handler = RotatingFileHandler(base_dir... | StarcoderdataPython |
1604580 | from django.test import TestCase
from survey.forms.question_set import BatchForm
from survey.models.locations import *
from survey.models import EnumerationArea
from survey.models import Interviewer
from survey.models.access_channels import *
from survey.models.batch import Batch
from survey.models.surveys import Surve... | StarcoderdataPython |
3355597 | #
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#
"""
This file contains implementation of data model for SVC monitor
"""
from pysandesh.gen_py.sandesh.ttypes import SandeshLevel
from cfgm_common.vnc_db import DBBase
from cfgm_common import svc_info
class DBBaseSM(DBBase):
obj_type = __name__
... | StarcoderdataPython |
3272607 | <reponame>scjs/buckeye<gh_stars>10-100
"""Container for a chunk of speech bounded by long pauses.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .containers import Pause
class Utterance(object):
"""It... | StarcoderdataPython |
4806432 | from setuptools import setup
def readme():
with open('README.md', encoding='utf-8') as f:
return f.read()
setup(
name="smooth",
version="0.1.2",
description="Data approximation using a cubic smoothing spline",
long_description=readme(),
long_description_content_type='text/markdown',
... | StarcoderdataPython |
131538 | <filename>sdk/python/pulumi_azure/servicebus/get_namespace_authorization_rule.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
fr... | StarcoderdataPython |
3315589 | <filename>src/test/tests/plots/pseudocolor.py
# ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: pseudocolor.py
#
# Tests: meshes - 2D rectilinear
# plots - pseudocolor
#
# Defect ID: '1016, '987
#
# Programmer: <NAME>
# Dat... | StarcoderdataPython |
143170 | <filename>cowait/tasks/definition.py<gh_stars>0
from __future__ import annotations
from datetime import datetime, timezone
from marshmallow import Schema, fields, post_load
from ..utils import uuid
def generate_task_id(name: str) -> str:
if '.' in name:
dot = name.rfind('.')
name = name[dot+1:]
... | StarcoderdataPython |
1663849 | <filename>tests/dataset_tests/parsers_tests/test_sdf_parser.py
import os
import pytest
import numpy as np
from rdkit.Chem import rdDistGeom, rdmolfiles, rdmolops
from profit.dataset.parsers.sdf_parser import SDFFileParser
from profit.dataset.preprocessors.egcn_preprocessor import EGCNPreprocessor
from profit.utils.i... | StarcoderdataPython |
1730241 | <gh_stars>1-10
from pyramid.view import (
view_config,
forbidden_view_config
)
from pyramid.response import Response
from pyramid.httpexceptions import (
HTTPNotImplemented,
HTTPUnauthorized,
HTTPForbidden
)
from ns_portal.core.resources.metarootresource import (
CustomErrorParsingArgs,
MyNo... | StarcoderdataPython |
1725899 | <reponame>szcyd-chian/soliwordsapi<filename>extras/sandbox.py<gh_stars>0
class Test:
def __init__(self):
self.value = 5
@property
def test_attr(self):
return self.value
def test_self(self, value):
arg = value ** 2
return arg
| StarcoderdataPython |
20788 | import os
import sys
import jinja2
import yaml
with open(".information.yml") as fp:
information = yaml.safe_load(fp)
loader = jinja2.FileSystemLoader(searchpath="")
environment = jinja2.Environment(loader=loader, keep_trailing_newline=True)
template = environment.get_template(sys.argv[1])
result = template.rend... | StarcoderdataPython |
102026 | """
Async Yadacoin node poc
"""
import sys
import importlib
import pkgutil
import json
import logging
import os
import ssl
import ntpath
import binascii
import socket
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir)
from datetime import datetim... | StarcoderdataPython |
4830464 | <reponame>kuzxnia/typer<filename>typer/util/statistic.py
from __future__ import division
from typer.util.keystroke import score_for_words
def cpm(correct_words: list, duration: float):
return score_for_words(correct_words) // (duration / 60.0)
def wpm(correct_words: list, duration: float):
return cpm(corre... | StarcoderdataPython |
1624407 | #from server.djangoapp.models import DealerReview
from django.contrib import auth
from django.http.response import JsonResponse
from djangoapp.models import DealerReview, CarDealer
from django.shortcuts import render
from django.http import HttpResponseRedirect, HttpResponse
from django.contrib.auth.models import User
... | StarcoderdataPython |
3296588 | from unittest import mock
from os import environ
from unittest import TestCase
import sewer
from . import test_utils
class TestClouDNS(TestCase):
"""
Tests the ClouDNS DNS provider class.
"""
def setUp(self):
self.domain_name = "example.com"
self.domain_dns_value = "mock-domain_dns_... | StarcoderdataPython |
105130 | <reponame>zmoon/monetio
""" Obs Utilities """
import datetime
import sys
import numpy as np
def find_near(df, latlon, distance=100, sid="site_num", drange=None):
"""find all values in the df dataframe column sid which are within distance
(km) of lat lon point. output dictionary with key as value in column s... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.