id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
1745396 | <reponame>mrjojo11/malpaca-pub
#!/usr/bin/python3
import math
import dpkt, datetime, glob, os, csv
import socket
from pathlib import Path
import matplotlib
from PIL import Image
from matplotlib.pyplot import cm
from collections import deque
from sklearn import metrics
import numpy as np
import pandas as pd
import jo... | StarcoderdataPython |
1708120 | from abc import abstractmethod
from typing import Protocol, List
class PinController(Protocol):
"""Interface to controll the pins"""
@abstractmethod
def initialize_pinlist(self, pinlist: List[int]):
raise NotImplementedError
@abstractmethod
def activate_pinlist(self, pinlist: List[int]):
... | StarcoderdataPython |
3322279 | <filename>recursive/Delete-Digit-From-Numbers-In-List.py
def deleteDigitFromList(TheList, sizeOfList, digit):
newList = []
STRdigit = str(digit)
newList = deleteDigitFromList2(TheList, sizeOfList, STRdigit, newList)
newList.reverse()
return newList
def deleteDigitFromList2(TheList, sizeOfList, STRd... | StarcoderdataPython |
1689531 | <filename>Old scripts/Filtro.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
data = pd.read_csv(
'C:\\Users\\nahue\\Desktop\\Tesis\\Datos\\Datos.csv',
delimiter = ',',
decimal = '.',
engine = 'python'
)
data = data.drop(columns=['Un... | StarcoderdataPython |
3235077 | import asyncio
import unittest
from hackq_trivia.question_handler import QuestionHandler
class MyTestCase(unittest.TestCase):
async def setUpAsync(self):
self.qh = QuestionHandler()
def setUp(self) -> None:
self.loop = asyncio.get_event_loop()
self.loop.run_until_complete(self.setUpA... | StarcoderdataPython |
3284291 | #!/usr/bin/env python3
"""Symlinks, or on Windows copies, an existing file to a second location.
Overwrites the target location if it exists.
Updates the mtime on a stamp file when done."""
import argparse
import errno
import os
import sys
def main():
parser = argparse.ArgumentParser(description=__doc__)
p... | StarcoderdataPython |
37472 | import qiskit
import qtm.progress_bar
import qtm.constant
import qtm.qfim
import qtm.noise
import qtm.optimizer
import qtm.fubini_study
import numpy as np
import types, typing
def measure(qc: qiskit.QuantumCircuit, qubits, cbits=[]):
"""Measuring the quantu circuit which fully measurement gates
Args:
... | StarcoderdataPython |
3266767 | <filename>Slide Generator/img_generator.py<gh_stars>0
from PIL import Image, ImageFont, ImageDraw
from transformers import pipeline, set_seed
import textwrap
import pandas as pd
import random
import colorsys
import math
import os
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
from xml.etree im... | StarcoderdataPython |
3311777 | import datetime
import numbers
import django
from django.db.models.fields import FieldDoesNotExist
from django.utils import tree
from django.core.exceptions import FieldError
try:
from django.db.models.sql.constants import LOOKUP_SEP
except:
from django.db.models.constants import LOOKUP_SEP
class HStoreConstr... | StarcoderdataPython |
1714765 | <filename>src/PGAN/helper/checks.py
import torch
import math
def isinf(tensor):
if not isinstance(tensor, torch.Tensor):
raise ValueError("The argument is not a tensor", str(tensor))
return tensor.abs() == math.inf
def isnan(tensor):
if not isinstance(tensor, torch.Tensor):
raise ValueErr... | StarcoderdataPython |
23441 | <filename>examples/driving_in_traffic/scenarios/loop/scenario.py<gh_stars>1-10
from pathlib import Path
from smarts.sstudio import gen_scenario
from smarts.sstudio import types as t
traffic = t.Traffic(
flows=[
t.Flow(
route=t.RandomRoute(),
rate=60 * 60,
actors={t.Traf... | StarcoderdataPython |
4817648 | # Standard Library
import ast
import configparser
import logging
logger = logging.getLogger(__name__)
class TemplateMinerConfig:
def __init__(self):
self.profiling_enabled = False
self.profiling_report_sec = 60
self.snapshot_interval_minutes = 5
self.snapshot_compress_state = True... | StarcoderdataPython |
40394 | from output.models.nist_data.atomic.unsigned_int.schema_instance.nistschema_sv_iv_atomic_unsigned_int_min_exclusive_1_xsd.nistschema_sv_iv_atomic_unsigned_int_min_exclusive_1 import NistschemaSvIvAtomicUnsignedIntMinExclusive1
__all__ = [
"NistschemaSvIvAtomicUnsignedIntMinExclusive1",
]
| StarcoderdataPython |
141955 | def leiaInt(msg):
while True:
try:
n = int(input(msg))
except (ValueError, TypeError):
print('\033[31mErro:Por favor, digite um número inteiro válido\033[m')
continue
except (keyboardInterrupt):
print('\n\033[31mUsuário preferiu não digitar ess... | StarcoderdataPython |
4806491 | <reponame>Bhaskers-Blu-Org1/BlueMatter
#!/usr/bin/env python
from __future__ import print_function
import DB2
import sys
import mx.DateTime
import time
import os.path
import pwd
if len(sys.argv) < 3:
print(sys.argv[0], "dbName ctp_id (to be cloned)", file=sys.stderr)
sys.exit(-1)
dbName = sys.argv[1]
old_ctp ... | StarcoderdataPython |
3245345 | <filename>src/paper/migrations/0052_paper_external_source_id.py
# Generated by Django 2.2.12 on 2020-05-09 05:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('paper', '0051_additionalfile'),
]
operations = [
migrations.AddField(
... | StarcoderdataPython |
3278801 | <gh_stars>10-100
import os
import sys
from shapeworks import *
success = True
def probevolumeTest():
mesh = Mesh(os.environ["DATA"] + "/femur.vtk")
img = Image(os.environ["DATA"] + "/femurVtkDT.nrrd")
mesh.probeVolume(img)
compareMesh = Mesh(os.environ["DATA"] + "/probe.vtk")
return mesh == compareMesh
s... | StarcoderdataPython |
3209617 | <reponame>ChuchuHan/DMRNet<filename>mmdetection/mmdet/models/reid_head/reid.py
import torch
import torch.nn.functional as F
from torch import nn
from .loss import make_reid_loss_evaluator
class REIDModule(torch.nn.Module):
def __init__(self, cfg):
super(REIDModule, self).__init__()
self.cfg = cfg
... | StarcoderdataPython |
3378704 | <gh_stars>0
# 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 json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables
... | StarcoderdataPython |
168068 |
import pandas as pd
import os
import time
import io
import http.client, urllib.request, urllib.parse, urllib.error, base64, json
import time
import requests
import operator
import numpy as np
def run_microsoft_classifier(microsoft_api_key, path_save, path_source, image_list):
print('Loading Microsoft classifier... | StarcoderdataPython |
5702 | from .IFileConverter import IFileConverter
| StarcoderdataPython |
89090 | <reponame>FAIRDataPipeline/data-registry
from .base_settings import *
ALLOWED_HOSTS = ['192.168.20.10', '127.0.0.1', 'localhost']
| StarcoderdataPython |
3354837 | """
=======
Cliques
=======
Find and manipulate cliques of graphs.
Note that finding the largest clique of a graph has been
shown to be an NP-complete problem; the algorithms here
could take a long time to run.
http://en.wikipedia.org/wiki/Clique_problem
"""
# Copyright (C) 2004-2008 by
# <NAME> <<EMAIL>>
# ... | StarcoderdataPython |
1728829 | <filename>datahub/dbmaintenance/management/commands/update_company_created_on.py
from logging import getLogger
import reversion
from dateutil.parser import parse, parserinfo
from datahub.company.models import Company
from datahub.dbmaintenance.management.base import CSVBaseCommand
from datahub.dbmaintenance.utils imp... | StarcoderdataPython |
3315387 | if __name__ == '__main__':
x = 0 # before loop line
for i in range(10): # for line
print(i) # print line
print('TEST SUCEEDED!')
| StarcoderdataPython |
3362630 | <reponame>Minoolian/Coding_Test
# Sum
# 리스트를 이용한 풀이.
# https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV13_BWKACUCFAYh&categoryId=AV13_BWKACUCFAYh&categoryType=CODE
for tc in range(1,11):
n=input()
lis=[list(map(int,input().split())) for _ in range(100)]
ver=[0 for _ in range... | StarcoderdataPython |
1743619 | # Copyright 2016 OpenStack Foundation
# 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 requ... | StarcoderdataPython |
158276 | <gh_stars>0
import copy
import json
from enum import Enum
from spine_json_lib.data.constants import SPINE_3_8_VERSION
from spine_json_lib.data.spine_version_type import SpineVersion
from spine_json_lib.graph.spamnode import SpamNode, DEFAULT_NODE_TYPE
from spine_json_lib.graph.factories import INodeFactory, IGraphPar... | StarcoderdataPython |
103862 | def input_journal(path: str):
journal = {}
count = int(input("Введите количество записей: "))
for i in range(count):
name = input("Введите Имя и Фамилию: ")
mark = int(input(f"Введите оценку для {name}: "))
journal[name] = mark
with open(path, "w") as file:
file.write(str... | StarcoderdataPython |
3292985 | """
Tests for lookups of elemental data
"""
import pytest
from basis_set_exchange import lut
_all_elements = list(range(1, 119))
_all_elements_str = [str(x) for x in _all_elements]
_all_elements.extend(_all_elements_str)
_all_am = list(range(1, 13))
@pytest.mark.parametrize('Z', _all_elements)
def test_element_data... | StarcoderdataPython |
3378011 | import string
class Tree:
def __init__(self,u,vs):
self.u = u
self.vs = vs
def distance(self,w):
if w == self.u:
return 0,[w]
for v in self.vs:
d,path = v.distance(w)
if d != -1:
return d+1,[self.u]+path
return -1,[]... | StarcoderdataPython |
3216386 | """Tools for interacting with Amazon Mechanical Turk."""
| StarcoderdataPython |
3327284 | <reponame>mwk0408/codewars_solutions<gh_stars>1-10
def Guess_it(n,m):
center=0
res=[]
flag=False
while (n>0):
if m//n>=5 or (m//n==3 and m%n==0):
flag=True
break
center+=1
m-=4
n-=1
left=0
right=0
if n:
left=n if m//n>=5 else 0
... | StarcoderdataPython |
1788229 | <reponame>MarkThe/Mark-Tools<filename>util/spamservers.py<gh_stars>1-10
import requests
import Mark
from colorama import Fore
from util.plugins.common import print_slow, getheaders, proxy
def SpamServers(token, Server_Name):
count = 0
for i in range(100):#change this to the amount of servers you want to creat... | StarcoderdataPython |
1761001 | # Copyright 2020 kubeflow.org.
#
# 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 |
1778336 | from setuptools import find_packages, setup
setup(
name='vevestaX',
packages=find_packages(include=['vevestaX']),
version='5.1.0',
description='Stupidly simple library to track machine learning experiments as well as features',
author='<NAME>',
license='Apache 2.0',
install_requires=['pand... | StarcoderdataPython |
3314107 | <reponame>augmentedfabricationlab/am_hackathon<filename>src/am_hackathon/control/test_scripts/enable_concrete_extruder.py
import sys, time
sys.path.append("C:/Users/Gido/Documents/workspace/development/mobile_additive_manufacturing/src/mobile_additive_manufacturing/control")
from clay_extruder_control import ExtruderCl... | StarcoderdataPython |
3300934 | <filename>c1-divide-and-conquer/merge_sort_count_inversions.py
# -*- coding: utf-8 -*-
"""
count number of inversions in an array, i.e. i < j and a[i] > a[j],
using merge sort
"""
import time
import random
def count_inversion(x):
n = len(x)
y = 0
for i in range(n):
for j in range(n):
... | StarcoderdataPython |
1687431 | from app.core.crud import CrudRouter
from app.rest.users.models import User
from app.rest.users.relations import UserCrudRelations
from app.rest.users.serializers import UserSerializer
from app.rest.users.views import UsersView
users_router = CrudRouter(
model=User,
serializer=UserSerializer,
relations=Use... | StarcoderdataPython |
133526 | # what commands to type before starting
# pip install pipenv
# pipenv shell
# pipenv install face_recognition
# face_recognition --tolerance 0.50 --show-distance true --cpus 8 ./images/known ./images/unknown/ | cut -d ',' -f2
| StarcoderdataPython |
197197 | #!/usr/bin/env python3
def main():
with open("dnsservers.txt", "r") as dnsfile:
for svr in dnsfile:
svr = svr.rstrip('\n') # remove newline char if exists
# would exists on all but last line
# IF the string svr ends with 'org'
if svr.endswith('org'):
... | StarcoderdataPython |
1714041 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 29 21:55:06 2018
@author: leandrodemarcovedelago
"""
import numpy as np
import numpy.matlib as npmatlib
import math
import Utils
class Acor:
def __init__(self, alg_variant, uses_log):
"""
* alg_variant should be one of the ... | StarcoderdataPython |
3355019 | import networkx as nx
import numpy as np
from ...Fragment.FragmentChain import FragmentChain
from ..AssemblyMixError import AssemblyMixError
class ConstructsMixin:
"""Mixin for AssemblyMix"""
def compute_random_circular_fragments_sets(
self, staling_cutoff=100, fragments_sets_filters=()
):
... | StarcoderdataPython |
16559 | # this version is adapted from http://wiki.ipython.org/Old_Embedding/GTK
"""
Backend to the console plugin.
@author: <NAME>
@organization: IBM Corporation
@copyright: Copyright (c) 2007 IBM Corporation
@license: BSD
All rights reserved. This program and the accompanying materials are made
available under the term... | StarcoderdataPython |
97348 | <reponame>haruiz/PytorchCvStudio
from .repo_form import NewRepoForm
| StarcoderdataPython |
4823211 | import json
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.multiclass import OneVsRestClassifier
from sklearn.preprocessing import MultiLabelBinarizer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.svm import LinearSVC
from sklearn.pipeline import Pipeline
import num... | StarcoderdataPython |
85575 | <filename>phi/math/blas.py<gh_stars>10-100
# coding=utf-8
from phi.backend.dynamic_backend import DYNAMIC_BACKEND as math
def conjugate_gradient(k, apply_A, initial_x=None, accuracy=1e-5, max_iterations=1024, back_prop=False):
"""
Solve the linear system of equations Ax=k using the conjugate gradient (CG) alg... | StarcoderdataPython |
93077 | """
This is an example to train a task with DDPG algorithm.
Here it creates a gym environment InvertedDoublePendulum. And uses a DDPG with
1M steps.
Results:
AverageReturn: 250
RiseTime: epoch 499
"""
import gym
import tensorflow as tf
from garage.misc.instrument import run_experiment
from garage.replay_buff... | StarcoderdataPython |
114211 | from registration.models import Participant, College, verificationEmail
from intro.models import IntroReg
from registration.views import generate_password
from django.db.models.signals import post_save
from django.contrib.auth.models import User
from django.template.loader import render_to_string, get_template
from dj... | StarcoderdataPython |
83359 | import datetime
import os.path
lines = []
# --- NUMERIC DICTIONARIES ---
numbers = {
0: "zero",
1: "one",
2: "two",
3: "three",
4: "four",
5: "five",
6: "six",
7: "seven",
8: "eight",
9: "nine",
10: "ten",
11: "eleven",
12: "twelve",
13: "thirteen",
14: "fo... | StarcoderdataPython |
3257639 | <filename>Python/best-time-to-buy-and-sell-stock-iv.py
# Time: O(k * n)
# Space: O(k)
def maxProfit(self, k, prices):
"""
:type k: int
:type prices: List[int]
:rtype: int
"""
def maxAtMostNPairsProfit(sprices):
profit = 0
for i in xrange(len(pric... | StarcoderdataPython |
1761300 | """
A Lambda function that is triggered by the Control Tower CloudWatch Event 'CreateManagedAccount'.
It automates configuration items that are not included in Control Tower.
The Amazon copyright covers the GuardDuty functions taken from:
https://github.com/aws-samples/amazon-guardduty-multiaccount-scripts
Copyright ... | StarcoderdataPython |
1728364 | from tool.runners.python import SubmissionPy
import heapq
class YouyounSubmission(SubmissionPy):
def run(self, s):
"""
:param s: input in string format
:return: solution flag
"""
seats = s.strip().replace('F', '0').replace('B', '1').replace('R', '1').replace('L', '0').split... | StarcoderdataPython |
4842600 | from flask import Flask, render_template
from flask_debugtoolbar import DebugToolbarExtension
from flask_sqlalchemy import SQLAlchemy
app = Flask('basic_app')
app.debug = True
app.config['SECRET_KEY'] = 'abc123'
# make sure these are printable in the config panel
app.config['BYTES_VALUE'] = b'\x00'
app.config['UNICOD... | StarcoderdataPython |
1766825 | <filename>AcridotheresCristatellusExpansion/ACExpansion/admin.py
from django.contrib import admin
from ACExpansion.models import ACRecord
admin.site.register(ACRecord)
| StarcoderdataPython |
182813 | <filename>lineage/figures/figureS11.py
""" This is a file to put together 4 conditions of lapatinib together. """
from .figureCommon import getSetup
from string import ascii_lowercase
def makeFigure():
"""
Makes figure 100.
"""
titles = ["Control", "Lapatinib 25 nM", "Lapatinib 50 nM", "Lapatinib 25... | StarcoderdataPython |
1756166 | import pytest
import urllib.parse
from crawler.http_handler import UrllibHandler, get_urls_async
class TestUrllibHandler:
def test_get_return_redeable_object(self):
handler = UrllibHandler("https://stackoverflow.com/")
response = handler.get()
assert hasattr(response, 'read')
@pytest... | StarcoderdataPython |
1744971 | import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.cm as cm
from matplotlib.colors import Normalize
from mpl_toolkits.mplot3d import Axes3D
def plotSwarm( sim, t ):
fig = plt.figure()
ax = fig.gca(projection='3d')
locations = []
directions = []
for fish in... | StarcoderdataPython |
3261388 | <reponame>swrobel/fhir<gh_stars>100-1000
#
# Copyright 2020 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 ... | StarcoderdataPython |
172890 | <reponame>oevans/ago-tools
#!/usr/bin/env python
import urllib
import json
import csv
from datetime import date, timedelta
class Admin:
'''A class of tools for administering AGO Orgs or Portals'''
def __init__(self, username, portal=None, password=None):
from . import User
self.user = User(use... | StarcoderdataPython |
1740527 | import unittest
import numpy
import pytest
import cupy
from cupy import testing
from cupy.testing import attr
import cupyx
from cupyx import lapack
@testing.parameterize(*testing.product({
'dtype': [numpy.float32, numpy.float64, numpy.complex64, numpy.complex128],
'n': [3],
'nrhs': [None, 1, 4],
'or... | StarcoderdataPython |
3296368 | # Copyright (c) 2014 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and the ... | StarcoderdataPython |
4835204 | <filename>ExploitTemplates/scripts/rsa-exponent-bruteforce.py
import gmpy
from libnum import *
# get N with: openssl rsa -in key.pem -pubin -text -modulus
N = long('00b0...0bd', 16)
orig = s2n(open("enc.dat").read().rstrip())
c = orig
while True:
m = gmpy.root(c, 3)[0]
if pow(m, 3, N) == orig:
print "... | StarcoderdataPython |
1782534 | <gh_stars>1-10
from django.contrib.postgres.fields import JSONField
from django.db import models
class Pastes(models.Model):
title = models.TextField()
user = models.TextField(default='anonymous')
paste = JSONField()
token = models.TextField(default='null') | StarcoderdataPython |
3288288 | <filename>tests/examples/test_1.py
#!/usr/bin/env python3
import sys
from autograde import NotebookTest
nbt = NotebookTest('demo notebook test', cell_timeout=1., test_timeout=.1)
@nbt.register(target='square', label='t1')
def test_square(square):
for i in range(10):
assert i ** 2 == square(i)
@nbt.re... | StarcoderdataPython |
70503 | import unittest
import shutil
import os
from poor_trader.screening import indicator
from poor_trader import market, config
from poor_trader.screening.entity import Direction
from poor_trader.screening.indicator import DefaultIndicatorFactory, IndicatorRunnerFactory, DefaultIndicatorRunnerFactory
TEMP_INDICATORS_PATH ... | StarcoderdataPython |
3265248 | <reponame>code-goodbuy/Goodbuy<gh_stars>1-10
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.urls import include, path
from accounts import views as acccount_views
from goodbuyDatabase import en... | StarcoderdataPython |
3348683 | <filename>migrations/versions/a005fc9e7cce_.py
"""empty message
Revision ID: a005fc9e7cce
Revises: <KEY>
Create Date: 2020-10-15 13:40:29.696495
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a005fc9e7cce'
down_revision = '<KEY>'
branch_labels = None
depends_... | StarcoderdataPython |
111156 | <filename>python/overlapintegrals/overlapintegrals.py
from functools import reduce
from math import exp, floor, pi
from typing import Tuple, Union
from scipy.special import binom as binomial
Number = Union[int, float]
def dist2(
xa: Number, ya: Number, za: Number, xb: Number, yb: Number, zb: Number
) -> float:... | StarcoderdataPython |
1662111 | <filename>src/multiple_trees/build_surface.py
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from src.multiple_trees.matrix_diff import MatrixDiff
from src.single_tree.global_params import GlobalParams
# Build matrices and corr coef only
systematic_tree = "morph"
cluster_a... | StarcoderdataPython |
3391779 | <filename>setup.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import subprocess
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from distutils.sysconfig import get_python_inc
import distutils.sysconfig as sysconfig
class CMakeBuild(build_ext):
de... | StarcoderdataPython |
3373539 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2015, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#----------------------------------------... | StarcoderdataPython |
1726588 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | StarcoderdataPython |
45781 | <filename>generated-libraries/python/netapp/net/net_ifgrp_info.py<gh_stars>1-10
from netapp.netapp_object import NetAppObject
class NetIfgrpInfo(NetAppObject):
"""
Network interface group information
When returned as part of the output, all elements of this typedef
are reported, unless limited by a set... | StarcoderdataPython |
120519 | <reponame>praekeltfoundation/ge-messaging-consent
from setuptools import find_packages, setup
setup(
name="messaging-consenter",
version="1.0.0",
url="http://github.com/praekeltfoundation/messaging-consenter",
license="BSD",
author="<NAME>",
author_email="<EMAIL>",
packages=find_packages(),... | StarcoderdataPython |
3336728 | <reponame>tvorogme/pytg
# -*- coding: utf-8 -*-
import pytg
__author__ = 'luckydonald'
"""
This is more a TEST, not an example...
You probably should NOT start with this.
"""
def main():
import signal
signal.signal(signal.SIGINT, sigint_handler)
tg = pytg.Telegram(telegram="/path/to/tg/bin/teleg... | StarcoderdataPython |
142065 | import numpy as np
import numpy.random as npr
from .base import Environment, Feedback, Spec
class ContextualEnv(Environment):
def __init__(self, arms, sd):
super().__init__()
self.arms = arms
self.sd = sd
self.max_rew = None
self.mean_rews = None
@property
def ... | StarcoderdataPython |
3246952 | <filename>train/config.py<gh_stars>100-1000
# Copyright 2021 the Ithaca Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | StarcoderdataPython |
1634401 | <reponame>Fede112/pytorch-cifar
'''Train CIFAR10 with PyTorch.'''
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
from torch.optim.lr_scheduler import StepLR, MultiStepLR
import torchvision
import torchvision.transforms as transforms
... | StarcoderdataPython |
3388172 | <gh_stars>0
"""Tests for what eos_db says when user does not authenticate.
$ ~/eoscloud-venv/bin/python3 -m unittest eos_db.test.test_unauthenticated_api
"""
import unittest
import os
from webtest import TestApp
# Note that pyramid.paster does work in Py3, since PasteDeploy
# is ported, though most of Paste is not... | StarcoderdataPython |
3310478 | import streamlit as st
def main():
st.title('Hello world')
st.markdown('Botao')
botao = st.button('botao')
if botao:
st.markdown('clicado')
st.markdown('checkbox')
check = st.checkbox('Checkbox')
if check:
st.markdown('clicado')
st.markdown('radio')
radio = st.radio('Escolha as opcoes', { '... | StarcoderdataPython |
1667022 | <gh_stars>1-10
def comp_Ld(self):
"""Compute and set the stator winding inductance along d-axis for the EEC
Parameters
----------
self : EEC_PMSM
an EEC_PMSM object
"""
Id = self.OP.get_Id_Iq()["Id"]
if Id not in [None, 0]:
if self.Phid is None:
self.comp_Phidq... | StarcoderdataPython |
1778043 | <filename>Tensile/SolutionSelectionLibrary.py
################################################################################
# Copyright (C) 2016-2019 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated do... | StarcoderdataPython |
161296 | import datetime
def celcius_to_fahrenheit(celsius):
"""
Converts a temperature from celcius to fahrenheit
:param celsius: The temperature in Celcius
:return: The converted fahrenheit temperature
"""
return round((celsius * 9 / 5) + 32, 2)
def get_tomorrow_date():
"""
Creates and retu... | StarcoderdataPython |
3388094 | #!/usr/bin/env python
# Python script to post a link to delicious
import getpass
import sys
import json
# pip install requests
# pip install requests[security] (fpr SSL support)
# pip install requests_ntlm for NTLM
import requests
def usage():
print "usage: postlink URL Description Tags"
print ""
print " URL\... | StarcoderdataPython |
3295807 | <gh_stars>1-10
# third party
from google.protobuf.reflection import GeneratedProtocolMessageType
# relative
from ...... import deserialize
from ...... import serialize
from ......proto.core.node.domain.service.request_answer_message_pb2 import (
RequestAnswerMessage as RequestAnswerMessage_PB,
)
from ......proto.c... | StarcoderdataPython |
45669 | <reponame>erikedin/aoc2016
from behave import *
import aoc2016.securitydoor as securitydoor
import aoc2016.day5 as day5
@given(u'a door with door id "{door_id}"')
def step_impl(context, door_id):
context.door_breaker = securitydoor.DoorBreaker(door_id)
@given(u'a second door with door id "{door_id}"')
def step_im... | StarcoderdataPython |
1661818 | # -*- coding: utf-8 -*-
"""
Convert a Python expression in a LaTeX formula
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import ast
import sys
import six
try:
from woc.latexcore import LatexVisitor, preprocessing, simplify, \
uprint, replace_scientific
from ... | StarcoderdataPython |
3256530 | <filename>util/copy_iem_network.py<gh_stars>1-10
"""For testing purposes, copy IEM network into mesosite."""
# stdlib
import sys
import os
# Third Party
import requests
# Put the pywwa library into sys.path
sys.path.insert(0, os.path.join(os.path.abspath(__file__), "../parsers"))
# pylint: disable=wrong-import-positi... | StarcoderdataPython |
1712868 | '''
create : creates a project with the projectaile structure
from the projectaile template.
'''
def create():
return | StarcoderdataPython |
31544 | #!/usr/bin/env python
import _init_paths
from evb.test import test_net
from evb.config import cfg, cfg_from_file, cfg_from_list
from datasets.factory import get_imdb
import caffe
import argparse
import pprint
import time, os, sys
def parse_args():
"""
Parse input arguments
"""
parser = argparse.Argumen... | StarcoderdataPython |
3286286 | <reponame>BDALab/GENEActiv-sleep-analyses-system
from django.contrib import admin
from nested_inline.admin import NestedTabularInline, NestedModelAdmin
from .models import Subject, CsvData, PsData, SleepDiaryDay, WakeInterval, RBDSQ
# Register your models here.
class PsDataInline(admin.TabularInline):
inlines ... | StarcoderdataPython |
92762 | <filename>stac_api/utils/auth.py
from typing import Dict, Optional
from pydantic import HttpUrl
import httpx
import json
from jose.utils import base64url_decode
from jose import jwt
from stac_api.utils.config import jwk_url, client_id
async def get_key_dict(url: HttpUrl = jwk_url) -> Dict:
"""
Get JWK keys f... | StarcoderdataPython |
4838296 | <reponame>hunterhector/EvmEval<gh_stars>10-100
#!/usr/bin/python
"""
A simple validator that check whether the format can at be parsed by the scorer
It might not be able to detect all the problems so please double-check the results
carefully.
Author: <NAME> ( <EMAIL> )
"""
import argparse
import logg... | StarcoderdataPython |
156979 | <reponame>HazemMeqdad/anti-raid
import discord
from discord.ext import commands
import database as db
import config
class AntiBan(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_member_ban(self, guild, user):
member = None
async for log... | StarcoderdataPython |
3374228 | from setuptools import setup, find_packages
import cpp_ast_parser
setup(name='CPP AST Parser',
version=cpp_ast_parser.__version__,
description='C++ AST Parser: Parser for c++ code to an AST representation and also from the AST back to code.',
author='<NAME>',
author_email='<EMAIL>',
url='... | StarcoderdataPython |
1705422 | <reponame>hjalti/passwordlib
from . import nsa
| StarcoderdataPython |
3278242 | from rest_framework import serializers
from rest_framework.fields import SerializerMethodField
from rest_polymorphic.serializers import PolymorphicSerializer
from app.common.serializers import BaseModelSerializer
from app.forms.enums import FormFieldType
from app.forms.models import EventForm, Field, Form, Option
fro... | StarcoderdataPython |
3338536 | <reponame>graybeal/info-engineering
"""
This file contains all the HTTP routes for classes used in this service
"""
from flask import Blueprint, request, Response
import _config as config
import pyldapi
import requests
from io import BytesIO
from lxml import etree
from pyldapi import ContainerRenderer
from model.pet im... | StarcoderdataPython |
1658595 |
{% macro newArgInput(args) -%}
{% for ar in args %}
{%- for arg, val in ar.items() %}
self.newInput("{{ args_types[val] }}", "{{ arg }}", "{{arg +inp }}")
{%- endfor %}{%- endfor %}
{%- endmacro %}
{%- macro newOptInput() %}
{%- for opt, val in fn.opts|dictsort %}
{%- if opts_types[opt] == "Text" %... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.