id stringlengths 2 8 | text stringlengths 16 264k | dataset_id stringclasses 1
value |
|---|---|---|
125307 | # Each new term in the Fibonacci sequence is generated by adding
# the previous two terms. By starting with 1 and 2, the first 10
# terms will be:
#
# 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
#
# By considering the terms in the Fibonacci sequence whose values
# do not exceed four million, find the sum of the even-valu... | StarcoderdataPython |
3327878 | import sys
#import numpy
import pythoncyc
meta = pythoncyc.select_organism('meta')
from pythoncyc.PToolsFrame import PFrame
class CSV2PathwayToolsPlugin:
def input(self, filename):
self.myfile = filename
filestuff = open(self.myfile, 'r')
mapper = dict()
for line in filestuff:
c... | StarcoderdataPython |
99366 | import logging
import discord
from discord.ext import commands
class Errors(commands.Cog, name="Error handler"):
def __init__(self, bot):
self.bot = bot
self.logger = logging.getLogger(__name__)
@commands.Cog.listener()
async def on_ready(self):
self.logger.info("I'm ready!")
... | StarcoderdataPython |
6457689 | import os
from posixpath import dirname
from sys import dont_write_bytecode
import time
import shutil
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def _dict_2_df(dict):
return pd.DataFrame.from_dict(dict, orient="index")
def _get_file_path(dir, file):
return os.path.join(dir, file)... | StarcoderdataPython |
11306820 | # Create your tasks here
from __future__ import absolute_import, unicode_literals
import time
from celery import shared_task
@shared_task
def add(x, y):
time.sleep(10)
print('the sum is:',x+y)
return x + y
@shared_task
def mul(x, y):
return x * y
@shared_task
def xsum(numbers):
return sum(num... | StarcoderdataPython |
1648249 | <gh_stars>1-10
import tensorflow as tf
from keras.models import load_model
from FeatureExtraction import stft_matrix, get_random_samples
from FeaturePreprocess import prep_full_test, keras_img_prep
def get_predictions_from_cnn(audio):
data = get_random_samples(stft_matrix(audio),46,125)
data = prep_full_test(d... | StarcoderdataPython |
9794371 | <reponame>woolpeeker/Face_Pytorch
from __future__ import absolute_import, division, print_function, unicode_literals
import math
import warnings
from abc import ABCMeta, abstractmethod
from functools import partial
from typing import List, Tuple, Optional
import torch
import torch.nn as nn
def _with_args(cls_or_self... | StarcoderdataPython |
204479 | #!/usr/bin/env python3
# Copyright (c) 2019 The Bitcoin Unlimited developers
"""
Tests the cashaccount features of the Electrum server.
"""
from test_framework.util import waitFor, assert_equal
from test_framework.test_framework import BitcoinTestFramework
from test_framework.electrumutil import compare, bitcoind_elect... | StarcoderdataPython |
11261162 | <reponame>contek-io/contek-tusk
from __future__ import annotations
from typing import Optional, Dict
DATABASE = 'database'
TABLE = 'table'
class Table:
def __init__(
self,
database: Optional[str],
table_name: str,
time_column: Optional[str] = None,
) -> None:
self._d... | StarcoderdataPython |
8140941 | import os
import torch
import tabulate
import torch.nn as nn
import pandas as pd
import matplotlib
import numpy as np
matplotlib.use('svg')
import matplotlib.pyplot as plt
plt.rcParams.update({'font.size': 24})
class Hook_record_input():
def __init__(self, module):
self.hook = module.register_forward_hook(... | StarcoderdataPython |
248115 | from jsonschema import validate
from pkg_trainmote import libInstaller
import os.path
import json
class Validator:
def validateDict(self, json, name: str):
schema = self.get_schema(name)
if schema is not None:
try:
validate(instance=json, schema=schema)
... | StarcoderdataPython |
3359088 | from numpy import *
from nn.base import NNBase
from nn.math import softmax, make_onehot
from misc import random_weight_matrix
##
# Evaluation code; do not change this
##
from sklearn import metrics
def full_report(y_true, y_pred, tagnames):
cr = metrics.classification_report(y_true, y_pred, target_names=tagnames)... | StarcoderdataPython |
228871 | """
Hackerrank Problem: https://www.hackerrank.com/challenges/iterables-and-iterators/problem
"""
import itertools
# Read in the inputs which consists of three lines:
# The first line contains the integer N, denoting the length of the list. The next line consists of N space-separated
# lowercase English letters, denot... | StarcoderdataPython |
3440098 | <gh_stars>0
# -*- coding: utf-8 -*-
__version__ = '0.5.2'
import logging
import requests
#import lxml
import re
import datetime
from bs4 import BeautifulSoup as bs
from parser_exceptions import *
from parser_abc import Parser, Restaurant, Day, Food
from restaurant_urls import UNICA_RESTAURANTS as unica_urls
__foodm... | StarcoderdataPython |
6455047 | import abc
from enum import Enum
import json
import typing
from typing import List, Dict
# The status of the request.
class RequestStatus(Enum):
# The request failed for any reason, see the response message.
Failed = "Failed"
# The request was success but the token being used on the incoming called is NOT... | StarcoderdataPython |
12843738 | <reponame>guilhermebaos/Advent-of-Code-Solutions
# Puzzle Input ----------
with open('Day06-Input.txt', 'r') as file:
puzzle = list(map(int, file.read().split(',')))
with open('Day06-Test01.txt', 'r') as file:
test01 = list(map(int, file.read().split(',')))
# Main Code ----------
# Count the first few fish ... | StarcoderdataPython |
9779021 | <reponame>pbierkortte/Example-Data-Driven-Webapp
import json
import unittest
from src.crawler import Crawler
file_input_intercepted = open("test_data/input_intercepted.json")
input_intercepted = json.load(file_input_intercepted)
file_input_intercepted.close()
file_daily_clicks_by_country = open("test_data/output_avg_... | StarcoderdataPython |
11358808 | <reponame>zzzDavid/heterocl<filename>python/heterocl/platforms.py
import os, subprocess, json, time, sys
from .devices import Platform, CPU, FPGA, PIM, Project
from .devices import HBM, PLRAM, LUTRAM, BRAM, URAM
from .tools import *
class AWS_F1(Platform):
def __init__(self):
name = "aws_f1"
devs =... | StarcoderdataPython |
9655062 | from typing import Iterable, Set
ALL_SEGS = set(("a", "b", "c", "d", "e", "f", "g"))
class Display:
"""
0: 1: 2: 3: 4:
aaaa .... aaaa aaaa ....
b c . c . c . c b c
b c . c . c . c b c
.... .... dddd dddd ddd... | StarcoderdataPython |
1847205 | <filename>libs/svn/nxpy/svn/_test/test_svnadmin.py
# nxpy_svn --------------------------------------------------------------------
# Copyright <NAME> 2010 - 2018
# Use, modification, and distribution are subject to the Boost Software
# License, Version 1.0. (See accompanying file LICENSE.txt or copy at
# http://www.bo... | StarcoderdataPython |
3292687 | <filename>tests/orca_unit_testing/test_combining_merge.py
import unittest
import orca
import os.path as path
from setup.settings import *
from pandas.util.testing import *
class Csv:
pdf_csv_left = None
pdf_csv_right = None
odf_csv_left = None
odf_csv_right = None
class MergeTest(unittest.TestCase):... | StarcoderdataPython |
11259014 | <reponame>sorhus/tensorflow<filename>tensorflow/python/kernel_tests/accumulate_n_test.py
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Lic... | StarcoderdataPython |
12823255 | # coding=utf-8
"""
Copyright (c) 2021 <NAME>
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, copy, modify, merge, publish, dist... | StarcoderdataPython |
3495694 | <gh_stars>1-10
#---------------------------------------------------------------------
# Debug notification hook test
#
# This script start the executable and steps through the first five
# instructions. Each instruction is disassembled after execution.
#
# Original Author: <NAME> <<EMAIL>>
#
# Maintained By: IDAPython ... | StarcoderdataPython |
3286527 | <filename>genoome/payments/urls.py
from django.conf.urls import url, include
from django.contrib.auth.decorators import login_required
import payments.signals # noqa
from . import views
urlpatterns = [
url(r'^paypal-callback/', include('paypal.standard.ipn.urls'),
name='paypal_callback'),
url(r'^rede... | StarcoderdataPython |
1954229 | <filename>epytope/test/external/TestExternalEpitopePrediction.py
"""
Unittest for external epitope prediction methods
"""
import unittest
import os
from epytope.Core import Allele, CombinedAllele
from epytope.Core import Peptide
from epytope.Core import Transcript
from epytope.EpitopePrediction import EpitopePredict... | StarcoderdataPython |
11216075 | <reponame>felix-walter/pydtnsim<gh_stars>1-10
import math
import pytest
from pydtnsim.routing import cgr_anchor
from pydtnsim.routing import cgr_basic
from pydtnsim.routing import scgr
from pydtnsim.backend import QSim
from pydtnsim.routing.cgr_basic import Route, Neighbor
from pydtnsim import Contact, ContactPlan,... | StarcoderdataPython |
8184910 | <filename>adventure_game/__init__.py<gh_stars>1-10
from .contracts import *
from .factories import *
from .models import *
from .providers import *
| StarcoderdataPython |
3568952 | #from nltk.corpus import words
from nltk import ngrams
import nltk
import enchant
from nltk.sentiment.vader import SentimentIntensityAnalyzer
d = enchant.Dict("en_US")
class Features:
def __init__(self,essay):
# To Do: Incorporate Google snippets match
# self.google_snippets_match = 0
self.... | StarcoderdataPython |
8065653 | <reponame>edwinfeener/monolithe
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retai... | StarcoderdataPython |
3458803 | import numpy as np
import os
import time
import tensorflow as tf
from shark.shark_trainer import SharkTrainer
from shark.parser import parser
from urllib import request
parser.add_argument(
"--download_mlir_path",
type=str,
default="bert_tf_training.mlir",
help="Specifies path to target mlir file that... | StarcoderdataPython |
21453 | # -*- coding: utf-8 -*-
# Copyright (c) 2020, Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can be
# found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
import numpy as np
from coremltools.converters.mil.mil import Builder as mb... | StarcoderdataPython |
255979 | <reponame>samj1912/python-libcnb
import sys
from pathlib import Path
import pytest
import toml
import libcnb
@pytest.fixture
def mock_layers(tmp_path):
return tmp_path / "layers"
@pytest.fixture
def mock_build_context(
mock_platform_path, mock_layers, mock_plan, monkeypatch, mock_buildpack_path
):
mon... | StarcoderdataPython |
313902 | from .abstractanalyzer import AbstractAnalyzer
from vaderSentiment import vaderSentiment
class VaderAnalyzer(AbstractAnalyzer):
def __init__(self):
pass
def analyze(self, text_content):
pass
| StarcoderdataPython |
8173447 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | StarcoderdataPython |
11264921 | import datetime
import json
import logging
import util
from google.appengine.api import app_identity
from google.appengine.api import urlfetch
def timedelta_to_sql_time(delta):
# https://stackoverflow.com/questions/8906926/formatting-python-timedelta-objects
days = delta.days
hours, h_remainder = divmod(... | StarcoderdataPython |
3375646 | import nextcord
from nextcord.ext import commands
class say(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def say(self, ctx, *,message=None):
if message == None:
await ctx.reply('Give me a word to say!')
else:
e=nextcor... | StarcoderdataPython |
1738180 | <filename>projecteuler/problems/problem_1.py
"""Problem one of https://projecteuler.net"""
def problem_1():
"""Solution to problem one."""
answer = sum([x for x in range(1, 1000) if x % 3 == 0 or x % 5 == 0])
return answer
| StarcoderdataPython |
1818004 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file based on https://github.com/kennethreitz/setup.py/blob/master/setup.py
# From https://packaging.python.org/discussions/install-requires-vs-requirements/#requirements-files :
#
# Whereas install_requires defines the dependencies for a single project,
# requirem... | StarcoderdataPython |
5103657 | #! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# Written by <NAME> <<EMAIL>>
#
# Changed by Christian 'Tiran' Heimes <<EMAIL>> for the placeless
# translation service (PTS) of zope
#
# Slightly updated by <NAME> <<EMAIL>>
#
# Included by Ingeniweb from PlacelessTranslationService 1.4.8
"""Generate binary message ... | StarcoderdataPython |
371830 | # Generated by Django 2.0.5 on 2018-07-25 11:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("core", "0010_notification")]
operations = [
migrations.AlterModelOptions(
name="notification", options={"ordering": ["-pk"]}
),
... | StarcoderdataPython |
9711300 |
import os
import sys
import json
current_path = os.path.dirname(os.path.abspath(__file__))
if current_path not in sys.path:
sys.path.append(current_path)
import launcher_log
root_path = os.path.abspath( os.path.join(current_path, os.pardir))
data_path = os.path.join(root_path, 'data')
config_path = os.path.join(... | StarcoderdataPython |
8149499 | <reponame>DanielVenturini/BCDetect<filename>NodeManager.py<gh_stars>1-10
# -*- coding:ISO-8859-1 -*-
import subprocess
import re
'''
This file contains the implementations of the functions that are
responsable to change the node version.
'''
# 0.11.16 -> 2015-01-14
# 1.8.2 -> 2015-05-04
# 2.5.0 -> 2015-08-04
# 3... | StarcoderdataPython |
11375160 | #! /usr/bin/python3
import sys
import pennylane as qml
from pennylane import numpy as np
# DO NOT MODIFY any of these parameters
a = 0.7
b = -0.3
dev = qml.device("default.qubit", wires=3)
def natural_gradient(params):
"""Calculate the natural gradient of the qnode() cost function.
The code you write for th... | StarcoderdataPython |
3488204 | <reponame>ea42gh/holoviews
from __future__ import absolute_import, division, unicode_literals
import param
from .chart import ScatterPlot
from ...element import Tiles
class LabelPlot(ScatterPlot):
xoffset = param.Number(default=None, doc="""
Amount of offset to apply to labels along x-axis.""")
yoff... | StarcoderdataPython |
6608127 | from sitemap import Siteindex, Sitemap
def test_siteindex():
siteindex = Siteindex()
sitemap = Sitemap('https://www.example.com/sitemap.xml')
siteindex.add_sitemap(sitemap)
expected = '''<?xml version=\'1.0\' encoding=\'utf-8\'?>\n<siteindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:... | StarcoderdataPython |
6462238 | <filename>components/stdproc/orbit/mocompbaseline/Mocompbaseline.py
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2010 California Institute of Technology. ALL RIGHTS RESERVED.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file ... | StarcoderdataPython |
6421546 | """
--- Day 20: Particle Swarm ---
Suddenly, the GPU contacts you, asking for help. Someone has asked it to simulate too many particles, and it won't be
able to finish them all in time to render the next frame at this rate.
It transmits to you a buffer (your puzzle input) listing each particle in order (starting with... | StarcoderdataPython |
1722439 | <filename>Interview-Preparation/Facebook/ArraysStrings-valid-palindrome.py
class Solution:
def isPalindrome(self, s: str) -> bool:
s = s.lower()
s = s.replace(' ','')
for p in string.punctuation:
s = s.replace(p, '')
i, j = 0, len(s)-1
while i < j:
if ... | StarcoderdataPython |
1623739 | <filename>Algorithms/A Number After a Double Reversal/solution.py
class Solution:
def isSameAfterReversals(self, num: int) -> bool:
return str(num) == str(num).rstrip("0") or num == 0
| StarcoderdataPython |
1889844 | import sys
from cs50 import get_string
def main():
if len(sys.argv) != 2:
print("Usage: ./caesar k")
sys.exit(1)
k = int(sys.argv[1])
plaintext = get_string("plaintext: ")
print("ciphertext: ", end="")
for ch in plaintext:
if not ch.isalpha():
print(ch, end="... | StarcoderdataPython |
179989 | <filename>1-computer-vision/1-cv-preprocess-augmentation.py
# Understand how ImageDataGenerator labels images based on the directory structure | StarcoderdataPython |
9617753 | <reponame>Hyeji-Kim/ENC<gh_stars>10-100
import numpy as np
import copy
import json
import os
import os.path as osp
import sys
import time
import itertools
import google.protobuf as pb
import random
from argparse import ArgumentParser
from pprint import pprint
import subprocess
from scipy import interpolate
from scipy... | StarcoderdataPython |
1871593 | <reponame>hussam-almarzoq/django-versatileimagefield
# -*- coding: utf-8 -*-
from distutils.core import setup
from setuptools import find_packages
setup(
name='django-versatileimagefield',
packages=find_packages(),
version='1.11',
author=u'<NAME>',
author_email='<EMAIL>',
url='http://github.com... | StarcoderdataPython |
1785933 | # @property
# def urls():
# import django
# if django.VERSION < (1, 9):
# from .mfa_urls import url_patterns
# return url_patterns, 'mfa', ''
# else:
# from .mfa_urls import url_patterns
# return url_patterns,'mfa'
#
| StarcoderdataPython |
11339307 | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by <NAME>, <EMAIL>, All rights reserved.
# LLNL-CODE-647188
#
# For det... | StarcoderdataPython |
1775209 | <gh_stars>0
import json
from django import template
register = template.Library()
@register.filter
def here(page, request):
return request.path.startswith(page.get_absolute_url())
@register.simple_tag
def node_module(path):
return '/node_modules/{}'.format(path)
@register.assignment_tag(takes_context=Tr... | StarcoderdataPython |
195846 | import sys
import os
import torch
import pandas as pd
import datetime
from argparse import ArgumentParser
import numpy as np
from torch import nn, optim
import torch.nn.functional as F
from torch.utils.data import DataLoader, random_split
import pytorch_lightning as pl
from pytorch_lightning.metrics import functional ... | StarcoderdataPython |
1935169 | <gh_stars>0
import math
num=int(input("Want to find out if a number is prime? Enter a number here: "))
nroot=int(math.sqrt(num))
start=2
stop=nroot+1
if num==2:
print("Your number is prime and special. 2 is the only even prime number.")
if num > 1:
for i in range(2, nroot):
if (num%i)==0:
... | StarcoderdataPython |
3390226 | """ Plot Dwell Time
This script will be useful for plotting existing dwell time files.
The calculation of dwell times, similar to diffusion coefficients, can often
take 10-30 min, depending on how many trajectories are analyzed. If a user
would rather configure plots on a pre-existing CSV files, they can do so here.
... | StarcoderdataPython |
1953768 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
from .vq_ema import VectorQuantizerEMA
from .ulosd_layers_modified import FeatureMapsToKeyPoints, KeyPointsToFeatureMaps
class Residual(nn.Module):
def __init__(self, in_channels, num_hiddens, num_resi... | StarcoderdataPython |
11317293 | """ Entry point to the sdem cli. """
import typer
from . import state # global settings
from . import template
from .cli import run, dvc, clean, vis, sync, setup, rollback, install, info
import warnings
from time import sleep
commands_no_start_up_check = ["setup", "install"]
app = typer.Typer()
# Construct cli ... | StarcoderdataPython |
3364136 | def get_max(lst):
max_v = lst[0]
for item in lst:
if item > max_v:
max_v = item
return max_v
def get_min(lst):
min_v = lst[0]
for item in lst:
if item < min_v:
min_v = item
return min_v
def cal_max_diff(lst):
max_v = get_max(lst)
min_v = get_mi... | StarcoderdataPython |
8098585 | """Test the basic DAP functions."""
import numpy as np
from six import MAXSIZE
from pydap.model import (DatasetType, BaseType,
StructureType)
from pydap.exceptions import ConstraintExpressionError
from pydap.lib import (quote, encode, fix_slice, combine_slices, hyperslab,
... | StarcoderdataPython |
1988884 | <reponame>ahammadshawki8/Proggraming-Terms
# WET = Write Everything Twice
# DRY = Don't Repeat Yourself.
# it is a principle of software developmment, aimed at reducing repeatition of information of all kinds.
# wet is totally different from dry. we have to always make our code dey.
def homePage():
print("<div cl... | StarcoderdataPython |
3206978 | <reponame>RaimundoLima/Zivot
from .base import Base
from sqlalchemy import DateTime,Time,ForeignKey,Column, Integer, Numeric, Binary, String,VARCHAR,Float
from sqlalchemy.orm import relationship
class Notificacoes(Base):
titulo = Column(VARCHAR(50), nullable=False)
descricao= Column(VARCHAR(200),nullable=False... | StarcoderdataPython |
3582750 | from typing import Optional
from pydantic import BaseModel, Field
__all__ = ["SetTrackingId"]
class SetTrackingId(BaseModel):
tracking_id: str = Field(None, title="New Tracking ID")
comment: Optional[str] = Field(None, title="Optional comment")
class Config:
schema_extra = {
"exampl... | StarcoderdataPython |
51957 | from floodsystem.station import MonitoringStation
from floodsystem.geo import rivers_by_station_number
def test_rivers_by_station_number():
"""Test for Task1E functions"""
#create 4 test stations
station_id = "Test station_id"
measure_id = "Test measure_id"
label = "Test station"
coord = (0.0,... | StarcoderdataPython |
3465224 | from flask import jsonify, make_response, request
from flask_restful import Resource
from app.api.v2.request import Request
from app.api.v2.models.user import User
from werkzeug.security import check_password_hash
from flask_jwt_extended import create_access_token, jwt_required
import datetime
class AuthController(R... | StarcoderdataPython |
1868105 | # Generated by Django 3.2.10 on 2022-01-25 05:17
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myapi', '0044_auto_20220118_1205'),
]
operations = [
migrations.AlterModelOptions(
name='regdevdata',
... | StarcoderdataPython |
5146031 | from random import randint
num1 = randint(0, 10)
num2 = randint(0, 10)
num3 = randint(0, 10)
num4 = randint(0, 10)
num5 = randint(0, 10)
lista = (num1, num2, num3, num4, num5)
print(f'Os valores sorteados foram: {lista}')
print(f'O menor valor sorteado foi {sorted(lista)[0]}')
print(f'O maior valor sorteado foi {sorted... | StarcoderdataPython |
6415697 | import connexion
import six
from mcenter_server_api.models.pipeline_pattern import PipelinePattern # noqa: E501
from mcenter_server_api import util
def onboarding_pipeline_patterns_get(): # noqa: E501
"""Get list of all pipeline patterns
# noqa: E501
:rtype: List[PipelinePattern]
"""
return... | StarcoderdataPython |
1897768 | from __future__ import absolute_import, print_function
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
# Consumer key and secret
consumer_key="YOUR_CONSUMER_KEY"
CONSUMER_secret="YOUR_CONSUMER_SECRET"
# Access token
access_token="YOUR_ACCESS_TOKEN"
access_toke... | StarcoderdataPython |
6568165 | from ...models import DOCUMENT_CLASSIFICATION, SEQ2SEQ, SEQUENCE_LABELING
from . import catalog, data, dataset, label
def get_data_class(project_type: str):
text_projects = [DOCUMENT_CLASSIFICATION, SEQUENCE_LABELING, SEQ2SEQ]
if project_type in text_projects:
return data.TextData
else:
re... | StarcoderdataPython |
1903181 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Advent of Code 2020
Day 25, Part 1
"""
def main():
with open('in.txt') as f:
card_key, door_key = map(int, f.readlines())
subject_number = 7
value = 1
card_loop = 0
while True:
card_loop += 1
value *= subject_number
... | StarcoderdataPython |
6509847 | <filename>pantra/components/loader.py
from __future__ import annotations
import os
import re
import typing
import traceback
import cssutils
import sass
from antlr4 import FileStream, CommonTokenStream, IllegalStateException
from antlr4.error.ErrorListener import ErrorListener
from pantra.common import UniNode, ADict
... | StarcoderdataPython |
4894712 | #
# MIT License
#
# (C) Copyright 2019-2022 Hewlett Packard Enterprise Development LP
#
# 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... | StarcoderdataPython |
355295 | import toolbox_extended as te
import toolbox_02450 as tb
import numpy as np
import pandas as pd
from exam_toolbox import *
import re
import os
class exam:
# ----------------------------------------------- OPG 1-----------------------------------------------
def opg1():
return "E"
# ------------... | StarcoderdataPython |
6679866 | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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 |
292385 | from .io import *
from .lever import *
from .address import *
| StarcoderdataPython |
120768 | <filename>binocular/hrfc.py
from binocular.reservoir_hrfc import *
from binocular import pattern_functions
from matplotlib.pyplot import *
# from matplotlib2tikz import save as tikz_save
patterns = []
# for p in [53, 54, 10, 36]:
for p in [54, 36]:
patterns.append(pattern_functions.patterns[p])
reservoir = Res... | StarcoderdataPython |
1726353 | <gh_stars>0
from setuptools import setup
setup(name='yeelight',
version='1.0',
description='Yeelight Smart Bult Python Package',
url='#',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=['yeelight'],
zip_safe=False)
| StarcoderdataPython |
1833637 | <gh_stars>0
import os, time, random
from behave import given, then, when
from lib.Config import Config
from support.Search_Page import Search
from selenium.webdriver.common.keys import Keys
cf = Config()
sp = Search()
baaqmd_qa_eng = cf.get_config('config/config.ini', 'search', 'baaqmd_qa_eng')
baaqmd_prod_main_eng... | StarcoderdataPython |
4968892 | # This file deletes a list of documents
# from the meta_container collection.
# ObjectId's to be deleted should be in ids.txt
# one id per line.
import pathmagic
from db_pool import *
from bson.objectid import ObjectId
def main():
collection = db[envget('db_metadata_collection')]
f = open("ids.txt", "r")
... | StarcoderdataPython |
11283931 | """
@author: MatteoRaso
"""
from math import pi, sqrt
from random import uniform
from statistics import mean
from typing import Callable
def pi_estimator(iterations: int):
"""
An implementation of the Monte Carlo method used to find pi.
1. Draw a 2x2 square centred at (0,0).
2. Inscribe a circle withi... | StarcoderdataPython |
4943684 | <gh_stars>1-10
# 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
from typing import Any, Mapping, Optional, Sequence, Union, overload... | StarcoderdataPython |
4867713 | #!/usr/bin/env python
import os
import pandas as pd
import numpy as np
from sklearn.externals import joblib
from math import (
log,
exp
)
from matplotlib import pyplot as plt
import util
def assess_threshold_and_decide(
np_matrix_traj_by_time,
curve_owner,
state_no,
output_dir,
data_c... | StarcoderdataPython |
1794203 | <reponame>demasterr/GH_PersonalityInference
import mysql.connector
import pandas as pd
from sklearn import preprocessing
class ReadDB:
def __init__(self, *, config, db_config):
self.config = config
self.db_config = db_config
METHOD_COLUMNS = {
'pi': {
'pi_openness': 'PI_O... | StarcoderdataPython |
9688685 | <reponame>aletuf93/logproj
# -*- coding: utf-8 -*-
#import datetime as date
#import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import datetime as date
import numpy as np
# import stat packages
from fbprophet import Prophet
#from fbprophet.diagnostics import cross_validation
from fbprophet.plot im... | StarcoderdataPython |
3429197 | <gh_stars>1-10
from .tracker import GAStatistics
| StarcoderdataPython |
9624973 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | StarcoderdataPython |
11322118 | #Adding directory to the path where Python searches for modules
import os
import sys
cmd_folder = os.path.dirname('/home/arvind/Documents/Me/My_Projects/Git/Crypto/modules/')
sys.path.insert(0, cmd_folder)
#Importing common crypto module
import common
import block
'''
- Edit the ciphertext using key, nonce, counter, ... | StarcoderdataPython |
1817979 |
import dsz
MENU_TEXT = 'List all network interfaces'
def main():
dsz.ui.Echo('Running network interface commands...', dsz.GOOD)
dsz.control.echo.Off()
dsz.cmd.Run('background log devicequery -deviceclass net', dsz.RUN_FLAG_RECORD)
dsz.cmd.Run('background log performance -data NetworkInterface', dsz.RU... | StarcoderdataPython |
1650079 | #codigo que se genera para poder copiarlo a mathlab
code='''
splX = spline(1:length(a),a,1:0.1:length(a));
splY = spline(1:length(b),b,1:0.1:length(b));
fill(splX, splY, [0.6824 0.8353 0.5059])
hold on
'''
#en el archivo in estan los puntos que extraimos en Geogebra
fichero = open('in')
lista=fichero.readlines() #'... | StarcoderdataPython |
11275150 | <filename>file_formats/gff_intersect.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# https://github.com/shenwei356/bio_scripts
# Author : <NAME>
# Contact : <EMAIL>
# LastUpdate : 2015-06-26
from __future__ import print_function, division
import argparse
import os
import shutil
import sys
import gzip
from co... | StarcoderdataPython |
297767 | # Importing non-modules that are not used explicitly
from .update import UpdateApplicationClass # noqa
| StarcoderdataPython |
1836169 | <reponame>rootless4real/rpi_ai
import config
import os
# Get Google Tasks
def getTasks(dayBool):
if not config.tasksLoaded:
loadTasks()
config.tasksLoaded = True
if dayBool==0:
myTasks = ""
numTasks = 0
with open("tasks_today.txt") as f:
for line in f:
a=line.split(".")
b=a[1].spli... | StarcoderdataPython |
3297630 | #!/usr/bin/env python3
import math
import pickle
import sys
word_uses = {}
for line in sys.stdin:
word, uses = line.split()
word_uses[word] = int(uses)
total_words = sum(word_uses.values())
word_freq_log = {}
for word, uses in word_uses.items():
word_freq_log[word] = math.log(float(uses) / total_words)
pickle.du... | StarcoderdataPython |
9699287 | from Skin import Skin
from Node import Node
from Animation import Animation
from Scene import Scene
from Mesh import Mesh
from Material import Material | StarcoderdataPython |
6666215 | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import os
import random
import sys
import pandas as pd
import numpy as np
# test dictionary of dictionaries similar to json file
swe_dict = {"mem111":"Desi","mem112":"Laura"}
test_dict = dict({"SWE":swe_dict,"NDNYC":{"mem11... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.