id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3228119 | <filename>hs_odm2/management/commands/odm2-sync.py
"""This synchronizes the ODM variable class with the external website.
* By default, prints errors on stdout.
"""
from django.core.management.base import BaseCommand
from hs_odm2.models import ODM2Variable
class Command(BaseCommand):
help = "synchronize ODM2 va... | StarcoderdataPython |
3289178 | <gh_stars>0
# -*- coding: utf-8 -*-
import json
import re
import scrapy
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
class HibachisanSpider(scrapy.Spider):
name = "hibachisan"
item_attributes = {"brand": "Hibachisan"}
allowed_domains = ["hibachisan.com"]
star... | StarcoderdataPython |
4803691 | from octopus.lib import cli
from octopus.modules.sheets import commasep, sheets
from StringIO import StringIO
import argparse, json, codecs
class Csv(cli.Script):
def run(self, argv):
parser = argparse.ArgumentParser()
parser.add_argument("-r", "--read", help="sheet read mode", action="store_tru... | StarcoderdataPython |
62009 | import sys
import threading
import time
import serial
import binascii
from linptech.packet import Packet
from linptech.constant import SerialConfig
import logging
try:
import queue
except ImportError:
import Queue as queue
logging.getLogger().setLevel(logging.ERROR)
class LinptechSerial(threading.Thread):
"""
- 实... | StarcoderdataPython |
1706461 | <gh_stars>1-10
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
packages = find_packages(exclude=['tests*'])
# Taken from https://github.com/python-telegram-bot/python-telegram-bot/blob/9d99660ba95b103b3e1dc80414a5ce2fd805260b/setup.py#L9
def requirements():
"""Build the requirements... | StarcoderdataPython |
112676 | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 28 20:15:39 2022
@author1: <NAME> - Correo: <EMAIL>
@author2: <NAME> - Correo: <EMAIL>
@author3: <NAME> - Correo: <EMAIL>
UNIVERSIDAD DEL VALLE - INGENIERÍA TOPOGRÁFICA
2022-1
OBJETIVO DEL SCRIPT:
Graficación de resultados y parámetros obtenidos con Step2_gr... | StarcoderdataPython |
192791 | <reponame>xenten9/game-x
"""All entities."""
from random import random
from time import sleep
from pygame.event import Event, post
from main.code.constants import SIZE
from main.code.engine.components.output_handler import Draw
from main.code.engine.components.maths import f_limit
from main.code.engine.components.m... | StarcoderdataPython |
1696205 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""SchedulerServer base."""
from uuid import UUID
import time
import random
import logging
from heapq import heappush, heappop
from twisted.internet import reactor, task
from twisted.web import server
from twisted.internet.defer import inlineCallbacks
from txamqp.content... | StarcoderdataPython |
140073 | <gh_stars>0
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import math
import numpy as np
from torch.nn.parameter import Parameter
from Algorithm.tools.TENsor.utils import reverse_tensor
from torch.autograd import Variable
class FeatureRegression(nn.Module):
def __i... | StarcoderdataPython |
1749806 | <reponame>gideontong/CodeQuest<gh_stars>1-10
"""
Source: Stack Abuse
Binary search follows a divide and conquer methodology. It is faster than linear search but
requires that the array be sorted before the algorithm is executed
"""
def BinarySearch(lys, val):
first = 0
last = len(lys)-1
index = -1
w... | StarcoderdataPython |
1790620 | <gh_stars>100-1000
"""Test module for Submitty autograder."""
| StarcoderdataPython |
109616 | <reponame>npang1/nativepython
# Copyright 2018 <NAME>
#
# 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 app... | StarcoderdataPython |
3294084 | from .mixture import Labels, CRPLabels, Mixture, MixtureDistribution, CollapsedMixture, CRPMixture
from .factor_analysis import FactorAnalysis | StarcoderdataPython |
1702607 | # coding=utf-8
# Created by OhBonsai at 2018/3/14
from tests.data.users import sketch, create_group
from tests.data import add_fixture
from tests import check_db_object
from app.models.user import User, Group
def test_user_model(db_session):
user, _ = sketch()
add_fixture(db_session, user)
expected_result... | StarcoderdataPython |
3358041 | <reponame>vaultboy324/ExecBot
from entities.user import User
from helper.requests_helper import RequestsHelper
from helper.db_helper import DBRequest
class Requests:
@staticmethod
def get_user(user: User):
request = DBRequest()
data = RequestsHelper.get_user(user, request)
request.... | StarcoderdataPython |
3254274 | <reponame>tchewik/isanlp_rst<filename>src/isanlp_rst/td_rst_parser/src/utils/scratch_discourse.py
import os
import torch
import torch.nn as nn
from src.models import PointingDiscourseModel
from src.parsers.parser import Parser
from src.utils import Config, Dataset, Embedding
from src.utils.common import bos, eos, pad,... | StarcoderdataPython |
102793 | <reponame>Zigazou/dietpdf
import pytest
from random import seed, randrange
from dietpdf.infopdf import infopdf
__author__ = "<NAME>"
__copyright__ = "Copyright 2022, <NAME>"
__credits__ = ["<NAME>"]
__license__ = "mit"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
def test_infopdf():
"""diet("test.pdf")"""
| StarcoderdataPython |
30270 | <gh_stars>10-100
description = 'Some kind of SKF chopper'
pv_root = 'LabS-Embla:Chop-Drv-0601:'
devices = dict(
skf_drive_temp=device('nicos.devices.epics.pva.EpicsReadable',
description='Drive temperature',
readpv='{}DrvTmp_Stat'.format(pv_root),
monitor=True,
),
skf_motor_temp=de... | StarcoderdataPython |
131650 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from distutils.version import LooseVersion
from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth import get_user_model
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers imp... | StarcoderdataPython |
3356886 | class MaxRetriesExceeded(Exception):
pass
| StarcoderdataPython |
3296053 | <filename>lm/tensorflow-lm/atr.py
# coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
import tensorflow.contrib.rnn as rnn
class ATRCell(rnn.RNNCell):
def __init__(self, num_units):
self.num_units = num_unit... | StarcoderdataPython |
160373 | <reponame>phyletica/codiv-sanger-bake-off<filename>docs-source/source/conf.py
# -*- coding: utf-8 -*-
import time
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/m... | StarcoderdataPython |
4831875 | <filename>run_reset_database.py<gh_stars>10-100
#!/usr/bin/env python3
import time
from env import env
from run_common import AWSCli
from run_create_codebuild_vpc import run_create_vpc_project
from run_terminate_codebuild_common import run_terminate_vpc_project
if __name__ == "__main__":
from run_common import pa... | StarcoderdataPython |
148622 | <reponame>cutz-j/Paper2Code
#import keras
from keras.layers import Dense, Conv2D, BatchNormalization, Activation
from keras.layers import AveragePooling2D, Input, Flatten, GlobalAveragePooling2D
from keras.optimizers import Adam, SGD, RMSprop
from keras.callbacks import ModelCheckpoint, LearningRateScheduler, ReduceLRO... | StarcoderdataPython |
106195 | from statdp.algorithms import *
def test_noisymax():
# add no noise to the array
assert noisy_max_v1a([1, 2, 1], float('inf')) == 1
assert noisy_max_v1b([1, 3, 1], float('inf')) == 3
assert noisy_max_v2a([1, 3, 1], float('inf')) == 1
assert noisy_max_v2b([1, 3, 1], float('inf')) == 3
def test_sp... | StarcoderdataPython |
79589 | """
Our modification of the OpenAI Gym Continuous Mountain Car by <NAME>:
https://github.com/openai/gym/blob/master/gym/envs/classic_control/continuous_mountain_car.py
which was (ultimately) based on Sutton's implementation:
http://incompleteideas.net/sutton/MountainCar/MountainCar1.cp
"""
from pilco.errors import En... | StarcoderdataPython |
187563 | '''
Infers pseudo log likelihood approximations from ESM models.
'''
import argparse
from collections import defaultdict
import os
import pathlib
import numpy as np
import pandas as pd
import torch
from esm import Alphabet, FastaBatchedDataset, ProteinBertModel, pretrained, BatchConverter
from utils import read_fas... | StarcoderdataPython |
3389133 | """
Copyright (C) 2010 - 2013 TopCoder Inc., All Rights Reserved.
This file contains claim type's detail info.
@version 1.0 (Healthcare Fraud Prevention - Partner Database Appliance - Assembly)
@author: zeadom, TCSASSEMBLER
@since 2013-12-10
"""
import os, sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__fil... | StarcoderdataPython |
4829262 | <filename>mergeforms/from cms10/test_PDFMergeForm.py
from unittest import TestCase, skip
from abstract_merge_template import PDFMergeForm
import os
class TestPDFMergeForm(TestCase):
def setUp(self):
self.APP_DIR = os.path.abspath(os.path.dirname(__file__)) # This directory
self.FIXTURE_DIR = os.... | StarcoderdataPython |
4837940 | import os
import dolfin as df
from numpy import average
from finmag.energies import Demag
from finmag.field import Field
from finmag.util.meshes import from_geofile
TOL = 1e-3
MODULE_DIR = os.path.dirname(os.path.abspath(__file__))
Ms = 1e6
def test_field():
"""
Test the demag field.
H_demag should be eq... | StarcoderdataPython |
1606317 | <filename>aray/aray/partial.py
#!/usr/bin/env python3
# partial.py - partial solution to the problem
import random
import matplotlib.pyplot as plt
from typing import List, Dict, Optional, Set
from dataclasses import dataclass
from .problem import Problem, Pose
from .types import Point, Edge
from .stretch import stret... | StarcoderdataPython |
3376829 | # Collect two inputs from the user
# Make a range out of it
# Add numbers under range
# Divide by numbers under range
# Make a 'counter' out of range
# x is first and y is second input
# let z be constant; z = 1
x = int(input("Enter you first value: -> "))
y = int(input("Enter you second value: -> "))
lim = x - y or y... | StarcoderdataPython |
160208 | <reponame>basiralab/BrainNet-ML-ToolBox
"""
Target Problem:
---------------
* A classifier for the diagnosis of Autism Spectrum Disorder (ASD)
Proposed Solution (Machine Learning Pipeline):
----------------------------------------------
* MRMR algorithm -> Gradient Boosting
Input to Proposed Solution:
---------------... | StarcoderdataPython |
3234058 | <reponame>lcls-daq/pyADioc<filename>pyADioc/db.py
import numpy as np
CONFIG = {
'Opal1k': {
'model': "Adimec",
'manufacturer': "1000m/CL",
'shape': (1024, 1024, 12),
'size': 2
},
'Pulnix' : {
'model': 'TM6740CL',
'manufacturer': 'PULNIX',
'shape': (48... | StarcoderdataPython |
3278450 | from functools import wraps
from moj_irat.healthchecks import HealthcheckResponse, registry
def _track_calls(func):
@wraps(func)
def inner(*args, **kwargs):
func.calls.append({
'args': args,
'kwargs': kwargs,
})
return func(*args, **kwargs)
func.calls = []... | StarcoderdataPython |
107045 | print("======================")
print("RADAR ELETRÔNICO!")
print("======================")
limite = 80.0
multa = 7
velocidade = float(input("Qual a sua velocidade: "))
if velocidade <= limite:
print("Boa Tarde, cuidado na estrada, siga viagem!")
else:
valor = (velocidade - limite) * 7
print(f"Você ultrap... | StarcoderdataPython |
5546 | # input
N, M = map(int, input().split())
Ds = [*map(int, input().split())]
# compute
dp = [False] * (N+1)
for ni in range(N+1):
if ni == 0:
dp[ni] = True
for D in Ds:
if ni >= D:
dp[ni] = dp[ni] or dp[ni-D]
# output
print("Yes" if dp[-1] else "No")
| StarcoderdataPython |
3243683 | from os import environ
from scipy.optimize import curve_fit
import numpy as np
import matplotlib.pyplot as plt
import os
import time
from random import randint
import subprocess
from itertools import combinations
import matplotlib
matplotlib.use('Agg')
pp = "./build/release/examples/"
graphs = [
"graph_alexnet"... | StarcoderdataPython |
1749115 | <filename>scripts/video_loop.py<gh_stars>100-1000
import argparse
import time
import cv2
import numpy as np
from concurrent_videocapture import ConcurrentVideoCapture
from python_path import PythonPath
with PythonPath("."):
import pyfakewebcam
# Parser
parser = argparse.ArgumentParser()
parser.add_argument("--r... | StarcoderdataPython |
4830170 | <reponame>zegheim/sonLib
#!/usr/bin/env python
#Copyright (C) 2006-2012 by <NAME> (<EMAIL>)
#
#Released under the MIT license, see LICENSE.txt
import unittest
from . import bioioTest
from . import cigarsTest
from . import treeTest
from . import kvdbTest
import socket
try:
import networkx as NX
networkx_instal... | StarcoderdataPython |
3295971 | <reponame>solomonkinard/vanguard-api
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from enum import Enum
class ValueConversionFailure(Exception):
pass
class TextType(Enum):
plain, percent, dollar = range(3)
class Converters(object):
@staticmethod
def convert(v, textType):
if textType == TextType.perc... | StarcoderdataPython |
3338196 | #!/usr/bin/env python3
#
# Copyright 2015 Dovetail Genomics LLC
#
#
## Double threshold
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-o','--outhist')
parser.add_argument("-t", "--threshold")
args = parser.parse_args()
h={}
while True:
l= sys.stdin.readline()
if not l:... | StarcoderdataPython |
158271 | '''Application Exceptions'''
import logging
from fastapi import HTTPException, status
class ApplicationExceptions:
"""Application Exceptons"""
@staticmethod
def too_many_rquests():
"""Too Many Requests"""
logging.info('🛑 Request is limited')
raise HTTPException(
status... | StarcoderdataPython |
3342960 | <filename>slyd/slyd/resources/route.py
from collections import Sequence
import json
from operator import attrgetter
from django.utils.functional import cached_property
from marshmallow import ValidationError
from marshmallow_jsonapi.exceptions import IncorrectTypeError
from six import iteritems
from six.moves import m... | StarcoderdataPython |
135481 | from flask import request
import json
import graphene # type: ignore
from graphene.types.datetime import Date # type: ignore
from graphql import GraphQLError # type: ignore
import inject # type: ignore
from books.schemas.types import BookType, Upload
from books.use_cases import *
from books.use_cases.exceptions impo... | StarcoderdataPython |
148667 | <gh_stars>1-10
import os
os.environ['APP_ENV'] = 'pytest'
| StarcoderdataPython |
1714259 | import numpy as np
for i in range(4,11):
print(i)
validation_score = np.zeros((1,))
data_nn = np.zeros((1,))
data_em = np.zeros((1,))
for j in range(1,13):
data = np.genfromtxt(str(i)+"/simple_validation_"+str(j)+".txt", usecols=(0,1))
data_nn = np.append(data_nn, data[:,0])
... | StarcoderdataPython |
179283 | #!/usr/bin/env python
#
# Copyright 2010 <NAME>, <NAME>
#
# 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 la... | StarcoderdataPython |
1616142 | <filename>Tests/EndToEndTests/CNTKv2Python/Manual/Manual_How_to_create_user_minibatch_sources_test.py
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# =============================================================... | StarcoderdataPython |
3314129 | import pandas as pd
#I am importin pandas
from sklearn.tree import DecisionTreeClassifier
# I am importing decision tree from scikit learn package
import joblib
#importing joblib to dump and load our models so that we dont need to create again and train our models. we can use existing pre-trained model
music = pd.r... | StarcoderdataPython |
3389118 |
# Import pandas as pd
import pandas as pd
# Pre-defined lists
names = ['United States', 'Australia', 'Japan', 'India', 'Russia', 'Morocco', 'Egypt']
dr = [True, False, False, False, True, True, True]
cpc = [809, 731, 588, 18, 200, 70, 45]
"""print(cars.keys)"""
# Create dictionary my_dict with three key:value pair... | StarcoderdataPython |
3270801 | # -------------------------------------------------------------------------------
# (c) 2019-2020 Siemens AG
# All Rights Reserved.
# Author: <EMAIL>
#
# Licensed under the MIT license.
# SPDX-License-Identifier: MIT
# -------------------------------------------------------------------------------
"""
Check a project ... | StarcoderdataPython |
1663394 | import random as r
def mock(f=0, t=1000, neg=False):
if f is None:
f = 0
if t is None:
t = f+1000
if neg == True:
return int(r.uniform(f,t)) * -1
return int(r.uniform(f,t)) | StarcoderdataPython |
3228777 | from dtreeviz.trees import *
know = pd.read_csv("data/knowledge.csv")
class_names = ['very_low', 'Low', 'Middle', 'High']
know['UNS'] = know['UNS'].map({n: i for i, n in enumerate(class_names)})
max_depth=3
x_train = know.PEG
y_train = know['UNS']
figsize = (6,2)
fig, ax = plt.subplots(1, 1, figsize=figsize)
ct = ctr... | StarcoderdataPython |
160615 | from ws2812 import *
from RGBs import *
from random import *
np = ws2812b(60, 0, 22)
def fill_breath(RGB, top_bright):
R = RGB[0]
G = RGB[1]
B = RGB[2]
while True:
for i in range(1, 100, 1):
np.brightness(i)
np.fill(R, G, B)
np.s... | StarcoderdataPython |
3336575 | <gh_stars>0
from sklearn.ensemble import RandomForestClassifier
from sklearn.svm import SVC
from titanic.model import TrainingModel
from titanic.data import clean_data
from titanic.utils import load_titanic_data
if __name__ == "__main__":
train_data, test_data = load_titanic_data()
ids = test_data[["Passenge... | StarcoderdataPython |
1690906 | <gh_stars>1-10
#!/usr/bin/env python3
# Find the occurrences of each word in the following sentence.
# Return the word and the number of occurrences.
sentence = """
<NAME>, who adopted the name <NAME> early
in his literary career, was born in Washington, D.C. in 1894.
Jean is the son of <NAME> was a mixed-race freedm... | StarcoderdataPython |
1651852 | <filename>CIM100/IEC61968/Common/__init__.py
# Copyright (C) 2010-2011 <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 ... | StarcoderdataPython |
3370152 | # coding: utf-8
from typing import List
from pydantic import BaseModel, validator
from ....shared.data import validators
class DataItem(BaseModel):
# fields are populated in the order they're defined in the class
name: str
value: str
desc: List[str]
_str_null_empty = validator('name','value', allow... | StarcoderdataPython |
3325947 | <reponame>millerta/LaGriT-1
from pylagrit import PyLaGriT
l = PyLaGriT()
mhex = l.read_fehm('fehm.grid')
#mhex.paraview()
mtet = l.create(elem_type='tet')
mtet = mhex.copypts()
mtet.connect()
mtet.paraview()
| StarcoderdataPython |
1735136 | <filename>test/test_tools.py
#!/usr/bin/env python
import unittest
from nebulizer.tools import Tool
from nebulizer.tools import Repository
from nebulizer.tools import ToolPanelSection
from nebulizer.tools import handle_repository_spec
from nebulizer.tools import normalise_toolshed_url
class TestTool(unittest.TestCase... | StarcoderdataPython |
32558 | import collections
import logging
import json
import os
import luigi
import gokart
import tqdm
import torch
import sentencepiece as spm
import sacrebleu
import MeCab
from fairseq.models.transformer import TransformerModel
from fairseq.data import LanguagePairDataset
from context_nmt.pipelines.conversation_dataset_mer... | StarcoderdataPython |
1628398 | <gh_stars>0
#!/usr/bin/env python
"""
Copyright 2011 <NAME> - http://worldofpiggy.com
HO-NG Hearer-Only Naming Game simulator
"""
from pylab import *
import subprocess
import os
from multiprocessing import Process
import sys
from collections import deque
from Queue import Queue
import time
import random
from matplot... | StarcoderdataPython |
1636558 | #!/usr/bin/python
#
#
# Vanderbilt University Computer Science
# Author: <NAME>
# Course: CS 6381 Distributed Systems Principles
# Created: Spring 2018
# Modified: Spring 2019 (to make compliant with Python 3)
#
# Purpose: Demonstrate Zookeeper Barrier Synchronization
#
# This is the Driver program
#
# Approach:
#
# ... | StarcoderdataPython |
3315146 | """
This script includes some help functions for the EEG tutorial of
the course Methods in Cognitive Neuroscience @ Max Planck School of Cognition
Prepared by <NAME> @ MPI CBS, Leipzig, Germany, <EMAIL>
June 2020
"""
import numpy as np
import scipy.signal as sp
from matplotlib import pyplot as plt
import mne
def... | StarcoderdataPython |
3274728 | <reponame>elsandal/pyclesperanto_prototype<filename>tests/test_reduction.py
import pyclesperanto_prototype as cle
import numpy as np
def test_min():
example = np.asarray([[
[0, 0, 0, 1],
[0, 0, 3, 1],
],[
[0, 0, 3, 1],
[1, 1, 1, 1]
]])
gpu_example = ... | StarcoderdataPython |
1777074 | <gh_stars>0
#!/usr/bin/env python
# encoding=utf-8
import sys
import os
import traceback
sstr1 = "Most Normal String\n"
sstr2 = "我是str string\n"
ustr1 = u"unicode string WITHOUT Chinese\n"
ustr2 = u"我是unicode string\n"
def test(new_file_name, method, *args):
try:
with open(new_file_name, 'w') as f:
... | StarcoderdataPython |
87955 | <filename>Python/Day1/code.py
"""
--- Day 1: Report Repair ---
After saving Christmas five years in a row, you've decided to take a
vacationat a nice resort on a tropical island.Surely, Christmas will go
on without you.
The tropical island has its own currency and is entirely cash-only. The
gold coins used there have ... | StarcoderdataPython |
3220374 | <gh_stars>0
import json
from twisted.python import usage, log
from twisted.application import internet
from twisted.internet import reactor, endpoints
from twisted.web import resource, static, server
import subprocess
# curl --data-binary '{"password_hex": "<PASSWORD>", "msg1_hex": "<PASSWORD>"}' http://localhost:8705... | StarcoderdataPython |
80592 | print ('Inside Case 7')
self.logResult("Just checking if a log file gets generated")
self.reportTCResults("p") | StarcoderdataPython |
1603698 | <reponame>valtron/symbench-athens-client
from symbench_athens_client.athens_client import SymbenchAthensClient
if __name__ == "__main__":
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument(
"url", type=str, metavar="JENKINS_URL", help="The URL of the jenkins server"
... | StarcoderdataPython |
179010 | <reponame>mavenium/az-iranian-bank-intro
from azbankintro.exceptions import CardValidationException
def card_validate(value):
if not len(value) == 16:
raise CardValidationException()
items = []
for i in range(0, len(value)):
k = ((i + 1) % 2) + 1
r = k * int(value[i])
item... | StarcoderdataPython |
116363 | <gh_stars>0
def tennis_set(s1, s2):
n1 = min(s1, s2)
n2 = max(s1, s2)
if n2 == 6:
return n1 < 5
return n2 == 7 and n1 >= 5 and n1 < n2
| StarcoderdataPython |
18934 | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : prepare.py
# Author : <NAME>, <NAME>
# Email : <EMAIL>, <EMAIL>
# Date : 17.07.2019
# Last Modified Date: 03.12.2019
# Last Modified By : Chi Han
#
# This file is part of the VCML codebase
# Distri... | StarcoderdataPython |
58359 | import numpy as np
a = np.arange(15).reshape(3,5)
print(a)
print(a.shape) | StarcoderdataPython |
3372030 | from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.sites.shortcuts import get_current_site
from django.contrib.auth import login
from django.contrib.auth.models import User
from accounts.forms import SignupForm
def signup_view(request):
if request.method == 'POST':
signup... | StarcoderdataPython |
141312 | <reponame>anunaym14/api<gh_stars>0
def get_date_from_zip(zip_name: str) -> str:
"""
Helper function to parse a date from a ROM zip's name
"""
return zip_name.split("-")[-1].split(".")[0]
def get_metadata_from_zip(zip_name: str) -> (str, str, str, str):
"""
Helper function to parse some dat... | StarcoderdataPython |
3243132 | <filename>tests/test_database_frame.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pytest # type: ignore
from nixnet import constants
from nixnet import database
from nixnet import errors
@pytest.mark.integration
def test_database_frame_contai... | StarcoderdataPython |
1659621 | #vim: encoding=utf-8
import gevent
from gevent.wsgi import WSGIServer
from gevent.queue import Queue
from gevent.monkey import patch_all
from gevent.subprocess import Popen, PIPE, STDOUT
patch_all()
import os
import time
import json
import glob
from flask import Flask, request, render_template, send_from_directory, ... | StarcoderdataPython |
118176 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 <NAME> <<EMAIL>>
__version__ = '0.2.5a'
__date__ = '2014-09-27'
__author__ = '<NAME> <<EMAIL>>'
__license__ = 'MIT'
from hornet import *
from hornet.symbols import (
fizzbuzz, word, show, divisible, W, Ws, N, N1, Max, D, R, S,
)
def main():... | StarcoderdataPython |
21628 | <gh_stars>0
import tensorflow as tf
import argparse
import logging
from src.helpers.NNHelper import NNHelper
from src.controller.Controller import Controller
from src.params.Parameters import Parameters
def createParser():
parser = argparse.ArgumentParser(prog='langid_server',
... | StarcoderdataPython |
1633923 | <filename>examples/Defense/defense_poisoning.py
import graphgallery as gg
import graphgallery.functional as gf
import tensorflow as tf
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
gg.set_backend("th")
def forward(A, X, target, w1, w2):
A = gf.normalize_adj_tensor(A)
h... | StarcoderdataPython |
121635 | <reponame>shaymk1/Wai-Studio-Mandala-Shop<gh_stars>0
from django.shortcuts import render
def home(request):
context = {}
return render(request, 'store/home.html', context)
| StarcoderdataPython |
3209284 | # -*- coding: utf-8 -*-
"""Exception classes."""
class APISpecError(Exception):
"""Base class for all apispec-related errors."""
class PluginMethodNotImplementedError(APISpecError, NotImplementedError):
"""Raised when calling an unimplemented helper method in a plugin"""
class DuplicateComponentNameError(... | StarcoderdataPython |
172388 | <reponame>jameschen0117/gazebo_visual<filename>src/strategy/scripts/GA/calculate.py
import rospy
from transfer.msg import PPoint
# Normalization
HALF_MAX_DIS = 1500 #cm
FULL_MAX_DIS = 2163 #cm
input_std_list = []
def input2std_list(data):
input_list = [data.rival_An, data.rival_Dis, data.right_angle, data.right_r... | StarcoderdataPython |
3348473 | #This program will give you a random number
import random
from tkinter import *
def randomNumber():
lowestNumber=eval(lowNumEnt.get())
highestNumber=eval(highNumEnt.get())
randomNumber=random.randint(lowestNumber,highestNumber)
randNum.set(randomNumber)
#creates the title and window for th... | StarcoderdataPython |
4825074 | # -*- coding: utf-8 -*-
from ..items import SpiderJobItem
from ..models import SpiderJob
from .base import BaseDownloadPipeline
from .base import ModelPipeline
__all__ = ['SampleFilePipeline', 'SamplePipeline', ]
class SampleFilePipeline(BaseDownloadPipeline):
pipeline_allowed = 'sample'
item_allowed = Spi... | StarcoderdataPython |
138223 | # Copyright 2013 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | StarcoderdataPython |
3366314 | <reponame>silverguo/pants
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
"""Linter for Java (deprecated).
See http://findbugs.sourceforge.net.
"""
from pants.base.deprecated import _deprecated_contrib_plugin
from pants.goal.task_regis... | StarcoderdataPython |
3380504 | <reponame>akirbaes/InfoVis2021<filename>Geodata_visualisation/rasterize_all.py
import geoplot as gplt
import geopandas as gpd
import geoplot.crs as gcrs
import imageio
import pandas as pd
import pathlib
import matplotlib.pyplot as plt
import mapclassify as mc
import numpy as np
import mapclassify as mc
import time
from... | StarcoderdataPython |
121720 | <reponame>verdverm/pypge
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pandas as pd
explicit_problems=[
"koza_01;out",
"koza_02;out",
"koza_03;out",
"lipson_01;out",
"lipson_02;out",
"lipson_03;out",
"nguyen_01;out",
"nguyen_02;out",
"n... | StarcoderdataPython |
1749557 | <reponame>bobalazek/tensorflow-simple-trainer<filename>train.py<gh_stars>1-10
from simple_trainer import *
simple_trainer = SimpleTrainer()
simple_trainer.prepare()
simple_trainer.load_model()
epochs = 64 # TODO: arg
print 'Starting to learn ...'
for i in xrange(epochs):
print 'Starting epoch %s' % (i)
simp... | StarcoderdataPython |
1657642 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Scale a model using scaling strategies from "Fast and Accurate Model Scaling".
For reference on scaling strategie... | StarcoderdataPython |
127399 | <reponame>Africahouse/afrohub<gh_stars>0
#application.py
# System Dependecies
from flask import Flask, render_template
# Initialize
app = Flask(__name__)
# Configure
app.config['PORT'] = 12600
app.config['HOST'] = '0.0.0.0'
app.config['SECRET_KEY'] = 'ghana tribes'
@app.route('/')
def index():
return render_tem... | StarcoderdataPython |
4816872 | # -*- coding: utf-8 -*-
from flask_restplus import Namespace, Resource, fields
from core.utils import paginate, validate_key
from flask import request
from core.connection import conn
from urllib import unquote_plus
import datetime
import settings
api = Namespace('properties', description='Property related operations'... | StarcoderdataPython |
169794 | <filename>classes/migrations/0003_remove_class_teacher.py<gh_stars>1-10
# Generated by Django 2.2.10 on 2020-04-01 19:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('classes', '0002_class_teacher'),
]
operations = [
migrations.RemoveField(
... | StarcoderdataPython |
57653 | import MetaTrader5 as _mt5
from collections import namedtuple
from typing import Callable
from typing import Iterable
from typing import Tuple
from typing import Union
from typing import Any
from typing import Optional
from typing import Type
# custom namedtuples
CopyRate = namedtuple("CopyRate", "time, open, high, l... | StarcoderdataPython |
4813533 | #!/usr/bin/env python
'''
Takes input SLCP filename and outputs the COD product name
'''
from __future__ import print_function
import os
import re
import json
import argparse
import datetime
from dateutil.parser import parse as dtparse
def main(fn1, fn2):
reg = '_M([0-9S]*)_TN([0-9]*)_([0-9]+T[0-9]*)-([0-9]+T[0-... | StarcoderdataPython |
3300280 | <reponame>Timicxx/pyGL
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant... | StarcoderdataPython |
4813448 | <reponame>Intsights/flake8-intsights<gh_stars>10-100
import tokenize
from . import _checker
class Checker(
_checker.BaseChecker,
):
@classmethod
def check(
cls,
filename,
lines,
tokens,
start_position_to_token,
ast_tree,
astroid_tree,
all_as... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.