id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
105683 | <reponame>zhjpqq/scaledensenet
# cifar10 #####################
ci7 = {'stages': 3, 'depth': 22, 'branch': 3, 'rock': 'U', 'kldloss': False,
'layers': (3, 3, 3), 'blocks': ('D', 'D', 'S'), 'slink': ('A', 'A', 'A'),
'growth': (0, 0, 0), 'classify': (0, 0, 0), 'expand': (1 * 22, 2 * 22),
'dfunc': ('O... | StarcoderdataPython |
3294615 | <reponame>kjappelbaum/aeml
# -*- coding: utf-8 -*-
import os
import pickle
import time
from collections import defaultdict
from copy import deepcopy
import click
import joblib
import numpy as np
import pandas as pd
from darts import TimeSeries
import torch
from aeml.models.forecast import parallelized_inference, for... | StarcoderdataPython |
1712474 | <reponame>antoilouis/netbert<gh_stars>100-1000
from setuptools import setup, find_packages
requires = [] # Let conda handle requires
setup(
name="exbert",
description="Vis",
packages=find_packages(),
author="<NAME>",
include_package_data=True,
install_requires=requires
) | StarcoderdataPython |
1639406 | def reverse(text):
TETO = ''
x = len(text)
while (x > 0):
TETO = TETO + text[x - 1]
x = x - 1
print(TETO)
return TETO
| StarcoderdataPython |
1650637 | <reponame>uzum/cran-simulator<filename>entities/baseband_unit.py<gh_stars>0
import simpy
from simulation.sim_parameters import SimulationParams
class BasebandUnit(object):
def __init__(self, env, id, rec_arrivals=True, absolute_arrivals=False, rec_waits=True, selector=None):
self.store = simpy.Store(env)
... | StarcoderdataPython |
123099 | <gh_stars>1-10
import airflow
from airflow import models, settings
from airflow.contrib.auth.backends.password_auth import PasswordUser
user = PasswordUser(models.User())
#user.username = os.environ['AIRFLOW_ADMIN_USSR']
#user.email = os.environ['AIRFLOW_ADMIN_EMAIL']
#user.password = os.environ['AIRFLOW_ADMIN_PASS']
... | StarcoderdataPython |
1695054 | from collections import Counter
from datetime import date, datetime, time
from unittest.mock import Mock
import pytest
from django.core.exceptions import NON_FIELD_ERRORS
from django.utils.timezone import utc
from rest_framework import serializers
from datahub.company.contact_matching import ContactMatchingStatus
fro... | StarcoderdataPython |
3204930 | <reponame>jasonwaters/media-organizer<gh_stars>1-10
DOWNLOAD_FOLDER = "/path/to/downloads"
TV_FOLDER = "/path/to/tvshows"
MOVIE_FOLDER = "/path/to/movies"
TRASH_FOLDER = "/path/to/trashcan"
SONARR_API_URL = "http://localhost:8989/api"
SONARR_API_KEY = "your_key_here"
SONARR_TV_FOLDER = "path_to_tv_folder" # may be dif... | StarcoderdataPython |
1776448 | <reponame>MetaOfX/python-spanner-orm
# python3
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | StarcoderdataPython |
1613103 | <filename>flask_appbuilder/tests/test_mvc.py
import datetime
import json
import logging
from typing import Set
from flask import Flask, make_response, redirect, request, session
from flask_appbuilder import AppBuilder, SQLA
from flask_appbuilder.actions import action
from flask_appbuilder.baseviews import expose
from ... | StarcoderdataPython |
1679297 | import algorithms.utils as utils
import numpy as np
def fill_matrix(s, t):
"""
Takes two strings and scores the length of the longest common subsequence at each index
:param s:string1
:param t:string2
:return:Matrix where the score at each index M(i,j) is the length of the longest common subseque... | StarcoderdataPython |
1676627 | <filename>furry/sequential.py
import furry.data
import furry.module
from furry.__register import module_register
class Sequential(furry.module.Module):
def __init__(self, *layers, dtype=furry.data.float32, name=None, dev=None):
super().__init__(input_rank=None, dtype=dtype, name=name, dev=dev)
self... | StarcoderdataPython |
70228 | <reponame>keunhong/scanner
import cv2
def write_video(path, frames, fps=24.0):
assert len(frames) > 0
output = cv2.VideoWriter(
path,
cv2.VideoWriter_fourcc(*'X264'),
fps,
(frames[0].shape[1], frames[0].shape[0]))
for frame in frames:
output.write(cv2.cvtColor(fram... | StarcoderdataPython |
1734087 | import models.baselines.DNN as DNN
import _settings
import numpy as np
import torch
import pandas as pd
import os
import utils.utils as utils
import datetime
import shutil
import tqdm
import ipdb
import data.dataloader as dld
TRAIN, VALID, TEST = 'train', 'val', 'test'
def pretrain_general(X, Y, seed=_settings.RANDOM... | StarcoderdataPython |
1602969 | import sqlalchemy as sa
from sqlalchemy import MetaData, Table, Column, String
from sqlalchemy import Integer, ForeignKey, Boolean, DateTime, Text
from sqlalchemy.dialects.mysql import TEXT
from sqlalchemy.ext.declarative import declarative_base
#from sqlalchemy.orm import relationship
import logging
log = logging.getL... | StarcoderdataPython |
3299369 | <reponame>ZwEin27/dig-extractor<filename>dige/extractor/faerie_extractor/__init__.py
# -*- coding: utf-8 -*-
# @Author: ZwEin
# @Date: 2016-09-25 15:21:54
# @Last Modified by: ZwEin
# @Last Modified time: 2016-09-25 19:37:10
import faerie
import os
import json
import codecs
FAERIE_CONF_DIR = os.path.join(os.path... | StarcoderdataPython |
1679467 | # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""build system library"""
import subprocess
import os
class BuildSystem(object):
"""Implements a build system"""
def __init__(self, verbose,... | StarcoderdataPython |
156659 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Topic: 分数运算
Desc :
"""
from fractions import Fraction
def frac():
a = Fraction(5, 4)
b = Fraction(7, 16)
print(print(a + b))
print(a.numerator, a.denominator)
c = a + b
print(float(c))
print(type(c.limit_denominator(8)))
print(c.lim... | StarcoderdataPython |
193566 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Interpreter version: python 2.7
#
# Imports =====================================================================
from hist import *
from xex import *
| StarcoderdataPython |
1729851 | import logging
import urllib.parse
from datetime import timezone
from pathlib import Path
from typing import Any
from typing import Dict
from typing import List
import dateutil.parser
import twitter
from nefelibata.announcers import Announcer
from nefelibata.announcers import Response
from nefelibata.post import Post... | StarcoderdataPython |
3224915 | <filename>request.py
import requests
#import urllib.request as ur
from lxml import etree
#这是不需要验证码的提交post表单案例
s = requests.Session()
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36',\
'Referer':'https://www.hellobi.com... | StarcoderdataPython |
3327636 | #!/bin/python
# path to python
# where is your writable directory? Jobs will be managed in a .queue directory here.
SCRATCH="FULL_PATH_TO_YOUR_SCRATCH_SPACE"
# username
USER="YOUR_USERNAME_HERE"
# how big is one batch of jobs? ex 10 means there must be 10 free slots to run another batch.
JOB_ARRAY_MAX=20
# max tota... | StarcoderdataPython |
1613582 | from datetime import timedelta
def convert_to_timedelta(time_val):
"""
From: code.activestate.com/recipes/577894-convert-strings-like-5d-and-60s-to-timedelta-objec
Given a *time_val* (string) such as '5d', returns a timedelta object
representing the given value (e.g. timedelta(days=5)). Accepts the
... | StarcoderdataPython |
3387908 | import json
from datetime import datetime
import pytz
from django.utils.timezone import now
from typing import List
from easy_eddie.clients import get_boto_client
from easy_eddie.helpers import get_cloud_watch_filter_pattern, get_cloud_watch_time_tuple_for_sms_events
from easy_eddie.models import SMSEvent
from easy_e... | StarcoderdataPython |
4813970 | #
# Jacobi function for CFD calculation
#
# Basic Python version using lists
#
import sys
import math
def jacobi(niter, psi):
# Get the inner dimensions
m = len(psi) - 2
n = len(psi[0]) -2
# Compute normalisation factor for error
bnorm = 0.0
for i in range(0,m+2):
for j in range(0... | StarcoderdataPython |
1648556 | __author__ = 'JordSti'
import object_wrap
class gui_state(object_wrap.object_wrap):
def __init__(self):
object_wrap.object_wrap.__init__(self)
self.obj = self.lib.GuiState_new()
def add(self, item):
self.lib.GuiState_add(self.obj, item.obj)
def on_resize(self, width, height):
... | StarcoderdataPython |
1681440 | <gh_stars>0
from keras.layers import Dense, Lambda, multiply
from keras.layers.wrappers import TimeDistributed
from keras import backend as K
def separation_layers(features, input_layer, bottom_layer):
"""
Separation layer/filter using a wiener filter with 3 sigmoid
activated dense layers
... | StarcoderdataPython |
31769 | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 9 09:42:00 2021
@author: barraly
"""
import sabs_pkpd
import numpy as np
import matplotlib.pyplot as plt
import os
# Select the folder in which this repo is downloaded in the line below
os.chdir('The/location/of/the/root/folder/of/this/repo')
# In[Loa... | StarcoderdataPython |
1678991 | <filename>asclient/tests/osc/v1/test_instance.py
# Copyright 2016 Huawei, Inc. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/lice... | StarcoderdataPython |
3275794 | import json
import requests_mock
from nose.tools import eq_, raises
from responses import GET_TASK_RESPONSE
from sdelements.SDEClient import SDEClient
@requests_mock.Mocker()
class TestGetTask(object):
def test_get_task_basic_auth(self, m):
sde_client = SDEClient("http://localhost/sde", "Basic", None, "... | StarcoderdataPython |
3358147 | <gh_stars>1-10
# Created By: <NAME>
# Created On: 2005/01/14
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/... | StarcoderdataPython |
3353463 | from django.db import models
from easydata.db.mysql.fields import C_SmallIntegerField, C_AutoField, C_IntegerField
class Note(models.Model):
id = C_AutoField(max_length=8, primary_key=True)
uid = C_IntegerField(max_length=11, default=0)
username = models.CharField(max_length=30)
content = models.TextFi... | StarcoderdataPython |
3361863 | <reponame>minorg/cidoc-crm-types
from dataclasses import dataclass
@dataclass
class P141Assigned:
"""
Scope note:
This property associates an instance of E13 Attribute Assignment with the instance of E1 CRM Entity used in the attribution. The instance of E1 CRM Entity here plays the role of the range of the attri... | StarcoderdataPython |
114475 | <gh_stars>1-10
from wtforms.fields import StringField
from app.utils.forms import RedirectForm
from tests import AppTestCase
class TestRedirectForm(AppTestCase):
class TestForm(RedirectForm):
foo = StringField()
bar = StringField()
def test_populate_obj(self):
# Simulates an object, ... | StarcoderdataPython |
1781202 | # :coding: utf-8
# :copyright: Copyright (c) 2013 <NAME>
# :license: See LICENSE.txt.
from PySide import QtGui, QtCore
class Widget(QtGui.QFrame):
'''Base widget.
Subclass to create widgets that reflect specific schema fragments.
'''
# Emit when value changes.
valueChanged = QtCore.Signal()
... | StarcoderdataPython |
3283323 | <reponame>MindaugasVaitkus2/gilfoyle
import os
import re
import numpy as np
import pandas as pd
from weasyprint import HTML
from jinja2 import Environment
from jinja2 import FileSystemLoader
class Report:
def __init__(self,
output,
template='assets/template.html',
... | StarcoderdataPython |
3206257 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Prandtl-Meyer Expansion Waves
"""
import math
from scipy import optimize
def nu(M, gamma):
"""Prandtl-Meyer function (eq. 4.44)
:param <float> M: Mach # before the shock
:param <float> gamma: Specific heat ratio
:return <float> Prandtl-Meyer functio... | StarcoderdataPython |
90334 | import random
words = open('words.txt', 'r').readlines()
words = [word.replace('\n', ' ').replace('\"', ' ').strip() for word in words]
def play_hangman():
hangman_word = words[random.randint(0, len(words) - 1)]
underscore_array = ['_' for i in hangman_word]
game_end = false
while game_end == false:... | StarcoderdataPython |
1620778 | from conans.errors import RequestErrorException, NotFoundException, ForbiddenException
from conans.server.store.file_manager import FileManager
import os
import jwt
from conans.util.files import mkdir
from conans.model.ref import PackageReference
from conans.util.log import logger
from conans.search.search import searc... | StarcoderdataPython |
4800153 | <filename>neupy/algorithms/regularization/base.py
from neupy.core.config import Configurable
from neupy.algorithms.gd import WEIGHT_PENALTY
__all__ = ('WeightUpdateConfigurable',)
class WeightUpdateConfigurable(Configurable):
"""
Configuration class for algorithms that update weights.
Warns
-----
... | StarcoderdataPython |
1644522 | <filename>Tests/test_threads.py
import sys
sys.path.insert(1, '../')
from Dataset import *
from datetime import *
import time
import pytz
#dataset = Dataset('../TestData/Dados.csv')
dataset = Dataset()
begin_date = datetime.strptime('2021-09-1 12:00',"%Y-%m-%d %H:%M")
end_date = datetime.strptime('2021-09-7 12:00',"... | StarcoderdataPython |
1716418 | import sys
from collections import deque
n,m = list(map(int,sys.stdin.readline().rstrip("\n").split(" ")))
target = list(map(int,sys.stdin.readline().rstrip("\n").split(" ")))
d = deque(range(1,n+1))
count= 0
for i in target:
if d.index(i) < len(d)/2:
while(d[0] != i):
d.append(d.popleft())
... | StarcoderdataPython |
3345147 |
class TerrainClassification:
"""
Takes a Yukon cerrain classification label and parses it into its constituent
parts.
"""
import re
def __init__(self, terrainString = ""):
self.terrainString = terrainString
self.geomorphologicalProcess = self._getGeomorphologicalProcess()
self.components = se... | StarcoderdataPython |
1783984 | <reponame>Taschee/schafkopf
import pytest
from schafkopf.game_modes import NO_GAME, PARTNER_MODE, WENZ, SOLO
from schafkopf.players.mc_node import MCNode
from schafkopf.suits import SUITS, LEAVES
@pytest.fixture
def next_state(player_hands_partner):
leading_player = 0
current_player = 1
mode_proposals = ... | StarcoderdataPython |
3361604 | #!/usr/bin/env python
# Copyright (c) 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies 'AR' in make_global_settings.
"""
import os
import sys
import TestGyp
def resolve_path(test, path):
if path ... | StarcoderdataPython |
3333526 | __version__ = '1.2.1'
import os
from .core import LiveSlides
from .utils import write
from .data_variables import animations
__all__ = ['initialize','init','demo']
__all__.extend(['LiveSlides', 'write'])
if __name__ == '__main__':
print('Use this package in Jupyter notebook!')
def __parse_md_... | StarcoderdataPython |
134371 | ###############################################################################
# Copyright (c) 2015-2019, Lawrence Livermore National Security, LLC.
#
# Produced at the Lawrence Livermore National Laboratory
#
# LLNL-CODE-716457
#
# All rights reserved.
#
# This file is part of Ascent.
#
# For details, see: http://asc... | StarcoderdataPython |
152647 | import arcpy
#gdb = r'X:\Env-dat.081\source\yt_courbe_niveau_imperial.gdb'
gdb = r'D:\s\yt_courbe_niveau_imperial.gdb'
def arcpy_listFC(gdb):
arcpy.env.workspace = gdb
print 'Looking in "%s" ' % arcpy.env.workspace
fcs = arcpy.ListFeatureClasses()
return fcs
fcs = arcpy_listFC(gdb)
print 'Feature cl... | StarcoderdataPython |
112673 | <reponame>JoaoP-Rodrigues/CursoPython3-Aulas<gh_stars>0
from utilidadesCeV import moeda, dado
num = dado.validacao('Digite o preço: R$ ')
moeda.resumo(num, 10, 15)
| StarcoderdataPython |
3396847 | #!/usr/bin/env python3
from aws_cdk import App, Environment
from stacks.simulator_stack import SimulatorStack
env = Environment(region="eu-west-1")
app = App()
simulator_stack = SimulatorStack(app, "SimulatorStack", env=env)
app.synth()
| StarcoderdataPython |
182607 | #! /bin/env python3
import argparse
import datetime
import json
import pystache
import string
import uuid
def compute_amounts(data):
rate = data['exchange_rate']
for item in data['items']:
vat = item['vat']
if type(item['vat']) == str:
vat = 0
net_amount = item['net_price'... | StarcoderdataPython |
139653 | <filename>plugins/counter.py
import time
crontable = []
outputs = []
crontable.append([120,"say_time"])
def say_time():
#NOTE: you must add a real channel ID for this to work
outputs.append(["D0FEYBP9V", time.time()])
| StarcoderdataPython |
4814173 | from urllib.parse import urljoin
import responses
from django import test
from django.core.exceptions import ObjectDoesNotExist
from django.utils import timezone
from hexa.pipelines.models import Index
from hexa.pipelines.sync import EnvironmentSyncResult
from hexa.plugins.connector_airflow.models import (
DAG,
... | StarcoderdataPython |
4832878 | <reponame>aricooperman/Jzipline
# Copyright 2016 Quantopian, 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 app... | StarcoderdataPython |
3377541 | """A check to ensure author initials are separated by a space."""
import re
import bibcheck.checker
class InitialsIssue(bibcheck.checker.Issue):
"""Represents an issue with missing spaces in author initials."""
@property
def message(self):
"""Get the message for this issue."""
return "A... | StarcoderdataPython |
1772199 | from .Solver import *
class SGD(Solver):
def __init__(self, *args, **kwargs):
Solver.__init__(self, *args, **kwargs)
def update(self, l):
params = l.params
grads = l.grads
mlr = self.lr * l.lr
for i in range(len(grads)):
params[i] -= grads[i] * mlr
| StarcoderdataPython |
3358256 | <filename>gaft/mpiutil.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Utitlities for parallelize Genetic Algorithm by using MPI interfaces
in distributed MPI environment.
'''
import logging
from itertools import chain
from functools import wraps
try:
from mpi4py import MPI
MPI_INSTALLED = True
except Im... | StarcoderdataPython |
71489 | import torch
import torch.nn as nn
import torch.nn.functional as F
import logging
from typing import Iterator
import time
import json
from seq2seq.helpers import sequence_accuracy
from seq2seq.ReaSCAN_dataset import ReaSCANDataset
import pdb
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
logger ... | StarcoderdataPython |
3346039 | import pygame
from pygame.surface import Surface
import bataillenavale.colorizer
import time
from bataillenavale.engine import DIRECTION_UP, DIRECTION_LEFT, BOAT_CARRIER, \
DIRECTION_DOWN, BOAT_BATTLESHIP, BOAT_CRUISER, BOAT_SUBMARINE, \
BOAT_DESTROYER, HIT_SUCCESS, HIT_MISS, DESTROYED, PLAYER_1, HIT_DE... | StarcoderdataPython |
61604 | #encoding=utf8
## 参考https://blog.csdn.net/dengxing1234/article/details/73739836
import xgboost as xgb
from sklearn.datasets import load_svmlight_file
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_curve, auc, roc_auc_score
from sk... | StarcoderdataPython |
1723208 | <filename>tests/test_language.py
#!/usr/bin/env python
# coding: utf-8
from salada import language
class TestSegment:
def equals_to_other_which_has_same_proporties(self):
a = language.Segment('foo', True, False)
b = language.Segment('foo', True, False)
assert a == b and b == a
def te... | StarcoderdataPython |
5487 | n, k = map(int, input().split())
w = list(map(int, input().split()))
r = sum(map(lambda x: (x+k-1)//k, w))
print((r+1)//2)
| StarcoderdataPython |
191880 | <reponame>arthurfas123/Curso-De-Python<filename>ex072.py<gh_stars>0
print('NUMEROS POR EXTENSO!!!')
print('=-=' * 15)
numeros = ('Zero', 'Um', 'Dois', 'Tres', 'Quatro', 'Cinco', 'Seis', 'Sete', 'Oito', 'Nove', 'Dez', 'Onze', 'Doze',
'Treze', 'Quatorze', 'Quinze', 'Dezesseis', 'Dezessete', 'Dezoito', 'Dezenov... | StarcoderdataPython |
65087 | # coding=UTF-8
# python version=3.5
import socket
import sys
import time
import threading
class ServerSocket(object):
conn = None
addr = None
mesStr = []
recv = ''
name = 'a'
threadLock1 = threading.Lock()
"""docstring for ServerSocket"""
def __init__(self):
super(ServerSocke... | StarcoderdataPython |
1727656 | from typing import Optional
import problog
from problog.engine import GenericEngine, DefaultEngine, ClauseDB
from problog.logic import Term, Var
from problog.program import LogicProgram, SimpleProgram, PrologString
from refactor.tilde_essentials.evaluation import TestEvaluator
from refactor.tilde_essentials.example i... | StarcoderdataPython |
4804424 | <reponame>AcharyaRakesh/Raki-Gesture-Assist
import cv2
import numpy
import mediapipe as mp
import time
class handdetector():
def __init__(self,mode=False,maxHands=2,detectionCon=0.5,trackCon=0.5):
self.mode = mode
self.maxHands=maxHands
self.detectionCon=detectionCon
sel... | StarcoderdataPython |
3283168 | <reponame>winken2004/xmlproc
#!/usr/bin/python
"""
A command-line interface to the xmlproc parser. It continues parsing
even after fatal errors, in order to be find more errors, since this
does not mean feeding data to the application after a fatal error
(which would be in violation of the spec).
"""
usage=\
""" ... | StarcoderdataPython |
1708458 | <reponame>DuckShyamalan/Basic-Rest-API-Python-Flask<filename>app.py
import datetime
from flask import Flask, jsonify, request, Response
import json
from BookModel import *
from settings import *
import jwt
from UserModel import User
from functools import wraps
app.config["SECRET_KEY"] = "secret"
@app... | StarcoderdataPython |
1624408 | <filename>tensorflow_gan/python/features/random_tensor_pool_test.py
# coding=utf-8
# Copyright 2021 The TensorFlow GAN 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
#
# http://... | StarcoderdataPython |
1612413 | <reponame>liu-bin-fluid/PySPOD
import os
import sys
import xarray as xr
import numpy as np
from pathlib import Path
# Current, parent and file paths
CWD = os.getcwd()
CF = os.path.realpath(__file__)
CFD = os.path.dirname(CF)
# Import library specific modules
sys.path.append(os.path.join(CFD, "../../../"))
from pysp... | StarcoderdataPython |
39620 | import FWCore.ParameterSet.Config as cms
from ElectroWeakAnalysis.ZMuMu.ZMuMuCategoriesSequences_cff import *
import copy
zPlots = cms.PSet(
histograms = cms.VPSet(
cms.PSet(
min = cms.untracked.double(0.0),
max = cms.untracked.double(200.0),
nbins = cms.untracked.int32(200),
name = cms.untra... | StarcoderdataPython |
4827201 | """Uses PPO to training an attack policy against a fixed, embedded policy."""
import functools
import json
import logging
import os
import os.path as osp
import pkgutil
from typing import Callable, Iterable
from gym.spaces import Box
from sacred import Experiment
from sacred.observers import FileStorageObserver
impor... | StarcoderdataPython |
1662793 | import pandas as pd
import pytest
from toucan_data_sdk.utils.postprocess import json_to_table
data = pd.DataFrame(
[
{
'name': 'blah',
'list_col': [{'a': 1}, {'a': 2}],
'adict_col': {'a': 1, 'b': {'c': 1}},
'bdict_list_col': {'a': [{'b': 1}, {'b': 2}]},
... | StarcoderdataPython |
119811 | <reponame>adele2020/object-detection-assistance
import pytest
import requests
def test_code():
response = requests.get(url="http://localhost:5000" + "/healthz")
assert response.status_code == 200 | StarcoderdataPython |
1626902 | import scrapy
import re
from DouBanSpider.db_handler import connection, cursor
from DouBanSpider.items import IMDbRatings
class ImdbRatingsSpider(scrapy.Spider):
name = 'IMDb_ratings'
allowed_domains = ['imdb.com']
sql = "SELECT douban_id,imdb_url FROM movie_detail WHERE douban_id NOT IN (SELECT douban_i... | StarcoderdataPython |
1710550 | import random
import time
import warnings
import json
import re
import requests
import chromedriver_autoinstaller
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.common.exceptions import (ElementClickInterceptedException,
NoSuchElementException)
from ... | StarcoderdataPython |
1636512 | <filename>foundation/press/templatetags/press.py
from django import template
from django.utils import timezone
from datetime import timedelta
register = template.Library()
@register.filter
def active_release(release_date):
week_ago = timezone.now() - timedelta(weeks=1)
return release_date > week_ago
| StarcoderdataPython |
1721753 | import logging
import os
import sys
from argparse import ArgumentParser
from pathlib import Path
from typing import Callable, Optional, Sequence
from vistautils.logging_utils import configure_logging_from
from vistautils.parameters import Parameters, YAMLParametersLoader
log = logging.getLogger(__name__) # pylint:di... | StarcoderdataPython |
1628151 | <filename>examples/joy_featherwing.py
from Adafruit_Seesaw import Seesaw
import time
BUTTON_RIGHT = 6
BUTTON_DOWN = 7
BUTTON_LEFT = 9
BUTTON_UP = 10
BUTTON_SEL = 14
button_mask = (1 << BUTTON_RIGHT) | (1 << BUTTON_DOWN) | (1 << BUTTON_LEFT) | (1 << BUTTON_UP) | (1 << BUTTON_SEL)
ss = Seesaw()
ss.pin_mode_bu... | StarcoderdataPython |
1740457 | # Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | StarcoderdataPython |
4823542 | '''
This code does the following three things:
1. Extracts the figure references and makes a dictionary of these referenced by the appropriate figure number
2. Extracts the table references and makes a dictionary of these referenced by the appropriate table number
3. Extracts the figure attributions and puts them in a ... | StarcoderdataPython |
3339892 | from django.db import models
from rest_framework import serializers
from rest_framework_json_schema.auto import from_serializer, auto_schema
from rest_framework_json_schema.schema import ResourceObject
from rest_framework_json_schema.transforms import CamelCaseTransform
class MyModel(models.Model):
my_int = mode... | StarcoderdataPython |
4820263 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# author arrti
from . import dashboard
from . import manage
from . import add
from . import login | StarcoderdataPython |
67009 | """Variational DA methods (iEnKS, 4D-Var, etc)."""
from typing import Optional
import numpy as np
import scipy.linalg as sla
from dapper.da_methods.ensemble import hyperprior_coeffs, post_process, zeta_a
from dapper.stats import center, inflate_ens, mean0
from dapper.tools.linalg import pad0, svd0, tinv
from dapper.... | StarcoderdataPython |
1787369 | """
Wrapper for a loaded mesh / vao with properties
"""
from typing import List, TYPE_CHECKING
import numpy
from pyrr import matrix44
if TYPE_CHECKING:
from moderngl_window.scene import Camera, Mesh
class Node:
"""A generic scene node containing a mesh or camera
and/or a container for other nodes. Nodes ... | StarcoderdataPython |
3304535 | from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String
import json
engine = create_engine('sqlite:///flag.db')
Session = sessionmaker(bind=engine)
session = Session()
Base = declarative_base(... | StarcoderdataPython |
29664 | # coding: utf-8
from unittest import TestCase
import os
import ibm_watson
import pytest
import json
import time
from ibm_watson.natural_language_understanding_v1 import Features, EntitiesOptions, KeywordsOptions
@pytest.mark.skipif(os.getenv('NATURAL_LANGUAGE_UNDERSTANDING_APIKEY') is None,
reason=... | StarcoderdataPython |
11990 | <filename>Chapter11/web_03.py
import urllib.request
import urllib.parse
import json
def http_request(url, query=None, method=None, headers={}, data=None):
"""Perform an HTTP request and return the associated response."""
parts = vars(urllib.parse.urlparse(url))
if query:
parts['query'] = urllib.pa... | StarcoderdataPython |
1759842 | <gh_stars>0
"""
MIT License
Copyright (c) 2021 UltronRoBo
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,... | StarcoderdataPython |
3223670 | #!/usr/bin/python3
# coding: utf-8
""" Módulo Matrix. """
import abc
class Agente(metaclass=abc.ABCMeta):
""" Classe abstrata Agente. """
modo_agente = False
def mode_on(self):
""" Método para ativação do agente. """
self.modo_agente = True
@abc.abstractmethod
def __init__(self, ... | StarcoderdataPython |
3274550 | <reponame>wrieg123/pytrader
from .futures import FuturesFactory
from .etfs import ETFFactory
| StarcoderdataPython |
3293010 | <gh_stars>0
#!/usr/local/bin/python3.5
# -*- coding: utf-8 -*-
#Se requiere ingresar por pantalla notas de alumnos y sus respectivos nombres.
#Los nombres deberán contener minimamente 5 caracteres y su nota será entre 0 y 10.
#Es necesario calcular el promedio de los alumnos.
if __name__ == '__main__':
diccionari... | StarcoderdataPython |
126095 | from setuptools import setup, find_packages
import re
# Get the version, following advice from https://stackoverflow.com/a/7071358/851699
VERSIONFILE="artemis/_version.py"
verstrline = open(VERSIONFILE, "rt").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, verstrline, re.M)
if mo:
verstr =... | StarcoderdataPython |
4821214 | <gh_stars>1-10
# Copyright (c) 2017 <NAME> (<EMAIL>)
# MIT License <https://opensource.org/licenses/MIT>
from .idope import (IDopeSpider,)
# from .rarbg import (RarbgSpider,)
from .torlock import (TorlockSpider,)
from .torrentz2 import (Torrentz2Spider,)
from .skytorrents import (SkyTorrentsSpider,)
from .thepiratebay... | StarcoderdataPython |
4802882 | <filename>_unittests/ut_faq/test_faq_gpu.py
"""
@brief test log(time=7s)
"""
import unittest
from pyquickhelper.pycode import ExtTestCase
from ensae_teaching_dl.faq.faq_gpu import pyopencl_status
class TestFaqGPU(ExtTestCase):
def test_pyopencl_status(self):
res = pyopencl_status()
self.asse... | StarcoderdataPython |
3219217 | from flask import Blueprint
from libs.tools import json_response, QueuePool
from queue import Empty
blueprint = Blueprint(__name__, __name__)
@blueprint.route('/state/<string:token>', methods=['GET'])
def state(token):
q = QueuePool.get_queue(token)
if q is None:
return json_response(message='No such... | StarcoderdataPython |
22410 | <filename>simfile/_private/serializable.py<gh_stars>10-100
from abc import ABCMeta, abstractmethod
from io import StringIO
from typing import TextIO
class Serializable(metaclass=ABCMeta):
@abstractmethod
def serialize(self, file: TextIO) -> None:
"""
Write the object to provided text file obj... | StarcoderdataPython |
3355366 | import BTrees
import StringIO
import asm.cms
import asm.cmsui.tinymce
import asm.cmsui.form
import asm.cmsui.retail
import asm.schedule.interfaces
import asm.workflow.interfaces
import csv
import datetime
import dateutil.parser
import grok
import json
import persistent
import re
import zope.interface
from asm.workflow.... | StarcoderdataPython |
192340 | <reponame>knightman/skybitz-gatewaydemo
import requests
import xmltodict
import json
import os
class Gateway:
'''Gateway class'''
def __init__(self):
'''Establish a gateway connection using a connection URL and auth credentials'''
self.url = 'http://dev.tanklink.com/latlontdg/service.asmx?WSDL... | StarcoderdataPython |
132061 | <gh_stars>0
from .check_srm import check_srm | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.