id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
283611 | import gammalib
import math
import numpy as np
from ctadmtool.dmspectrum.dmspectra import dmspectrum
from ctadmtool.tools.misc import ValidValue , ValidString
from tqdm import tqdm
import warnings
ALLOWED_FERMIONS = ('Majorana', 'Dirac')
ALLOWED_CHANNELS = ('eL', 'eR', 'e',
'MuL', 'MuR', 'Mu', 'TauL', 'TauR', 'T... | StarcoderdataPython |
1793757 | #!/usr/bin/env python
# Copyright (C) 2015 Google 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 l... | StarcoderdataPython |
9641979 | #-------------------------------------------------------------------------------
# Name: settings.py
# Purpose:
#
# Author: <NAME>. - <EMAIL>
#
# Created: 08/07/2021
# Copyright: (c) <NAME>. 2021 [ACAI Engineering ia]
# Licence: MIT
#----------------------------------------------------------------... | StarcoderdataPython |
1912984 | from .symbol_table import SymbolTable
from ..visitor import symbols
class Visitor:
vocab_bases = {
"Compiler": "Compil",
"Interpreter": "Interpret",
"Transpiler": "Transpil"
}
def __init__(self, visitor_type, output_stream):
self.type = visitor_type
self.headers = s... | StarcoderdataPython |
5016731 | from Tkinter import *
root = Tk()
label_1 = Label(root, text = "Name: ")
label_2 = Label(root, text = "Password:")
entry_1 = Entry(root)
entry_2 = Entry(root)
label_1.grid(row = 0, sticky = E)
label_2.grid(row = 1, sticky = E)
entry_1.grid(row = 0, column = 1)
entry_2.grid(row = 1, column = 1)
c = C... | StarcoderdataPython |
9630835 | <gh_stars>10-100
from django.db.models import Count, Q
from vocgui.models import Discipline
from vocgui.utils import get_child_count
from django.core.exceptions import PermissionDenied
from vocgui.utils import get_key
from vocgui.models import GroupAPIKey
def get_filtered_discipline_queryset(discipline_view_set):
... | StarcoderdataPython |
1946461 | <reponame>DistrictDataLabs/logbook
# catalog.forms
# Forms and other HTML data handling from the web front end.
#
# Author: <NAME> <<EMAIL>>
# Created: Wed Oct 28 15:47:44 2015 -0400
#
# Copyright (C) 2015 District Data Labs
# For license information, see LICENSE.txt
#
# ID: forms.py [] <EMAIL> $
"""
Forms and othe... | StarcoderdataPython |
9668659 | <gh_stars>0
#!/usr/bin/env python
from random import randint as ri
print [n for n in [ri(1, 99) for i in range(9)] if n%2]
| StarcoderdataPython |
6538222 | from typing import Union
from lxml.etree import _Element
from utils.parse import parse_int
from utils.xmlutils import find_value
class Status:
code: Union[int, None]
status_type: Union[str, None]
def __init__(self, code: int = None, status_type: str = None):
"""
Args:
code (i... | StarcoderdataPython |
5020640 | # coding: utf-8
"""
HTCondor workflow implementation. See https://research.cs.wisc.edu/htcondor.
"""
__all__ = ["HTCondorWorkflow"]
import os
import logging
from abc import abstractmethod
from collections import OrderedDict
import luigi
from law.workflow.remote import BaseRemoteWorkflow, BaseRemoteWorkflowProxy
f... | StarcoderdataPython |
1993062 | <filename>recirq/qaoa/experiments/run-problem-generation.py
# Copyright 2020 Google
#
# 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
#
# Unl... | StarcoderdataPython |
45752 | from math import radians, cos, sqrt
from dbi import select_from_zip, select_from_id, create_connection
from api import *
import usaddress
def distance(lat1, lon1, lat2, lon2):
x = radians(lon1 - lon2) * cos(radians((lat1 + lat2) / 2))
y = radians(lat1 - lat2)
# 6371000 is the radius of earth, used to tria... | StarcoderdataPython |
302078 | """
-*- coding: utf-8 -*-
========================
AWS Lambda
========================
Contributor: <NAME> (<NAME>)
========================
"""
import boto3
from pprint import pprint
def lambda_handler(event, context):
s3 = boto3.resource("s3")
source_bucket = s3.Bucket("sbucket-name")
destination_bucket ... | StarcoderdataPython |
12822441 | <reponame>dperl-sol/cctbx_project
from __future__ import absolute_import, division, print_function
from scitbx import math
from scitbx.array_family import flex
from six.moves import range
def tst(N=3):
weights = flex.double(N)*0.0+1.0
mvo = math.multivariate_moments( weights )
for ii in range(100000):
tmp = ... | StarcoderdataPython |
1838503 | <filename>ironic/tests/conductor/test_task_manager.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance w... | StarcoderdataPython |
1894021 | #//
#//------------------------------------------------------------------------------
#// Copyright 2007-2011 Mentor Graphics Corporation
#// Copyright 2007-2010 Cadence Design Systems, Inc.
#// Copyright 2010 Synopsys, Inc.
#// Copyright 2019 <NAME> (tpoikela)
#// All Rights Reserved Worldwide
#//
#// Lice... | StarcoderdataPython |
1965393 | <gh_stars>0
# Copyright 2019 The TensorNetwork 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | StarcoderdataPython |
6667027 | from typing import List, Optional, Tuple
import numpy as np
import torch
import torch.nn as nn
from gluonts.core.component import validated
class QuantileLoss(nn.Module):
@validated()
def __init__(
self,
quantiles: List[float],
quantile_weights: Optional[List[float]] = None,
) -> ... | StarcoderdataPython |
5018170 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author: <NAME>
@Date: Arg 10, 2020
"""
# Import necessary packages
import os
import ssl
import json
import time
import requests
import numpy as np
import pandas as pd
from urllib import request
from bs4 import BeautifulSoup
from random import randint
import urllib3
i... | StarcoderdataPython |
9628415 | <gh_stars>0
n1 = float(input('Quanto em dinheiro você tem na carteira'))
dolar = n1 / 3.27
print('O valor que você tem na carteira corresponde a: {:.2f} dolares'.format(dolar)) | StarcoderdataPython |
6814 | <reponame>sbarguil/Testing-framework<filename>AutomationFramework/tests/interfaces/test_if_subif.py
import pytest
from AutomationFramework.page_objects.interfaces.interfaces import Interfaces
from AutomationFramework.tests.base_test import BaseTest
class TestInterfacesSubInterfaces(BaseTest):
test_case_file = 'if... | StarcoderdataPython |
6477315 | from math import gamma
import torch.nn as nn
import torch
import torch.optim as optim
from torchvision import datasets
from torchvision.transforms import ToTensor
from torch.utils.data import DataLoader, random_split
import time
import torch.optim.lr_scheduler as lr_s
import torchvision.transforms as transforms
from Bl... | StarcoderdataPython |
6644348 | <filename>run.py
import os
import sys
from baldrick import create_app
# Configure the app
app = create_app('astropy-bot')
# Load plugins from baldrick
import baldrick.plugins.github_milestones # noqa
# Load astropy-specific plugins
import astropy_bot.changelog_checker # noqa
import astropy_bot.autolabel # noqa
... | StarcoderdataPython |
285822 | from extended_rl.prerandom import agentrandom
class Q_learner:
"""
Basic Q-learning agent, see https://en.wikipedia.org/wiki/Q-learning.
"""
def __init__(self, epsilon=0.9, learning_rate=0.1, gamma=0.9, **kwags):
self.epsilon = epsilon
self.learning_rate = learning_rate
self.gamma = gamma
self... | StarcoderdataPython |
4890910 | <filename>man_in_the_middle/sniffer.py
from src.mitm import get_args, sniffer
interface = get_args()
sniffer(interface) | StarcoderdataPython |
1801323 | from django.conf.urls import url
from products import views
urlpatterns = [
url(
regex=r"^on-sale/$",
view=views.home,
name="landing_page"
),
url(
regex=r"^$",
view=views.ProductsListView.as_view(),
name="deals_page"
),
url(
regex=r... | StarcoderdataPython |
3400643 | <filename>web/app/syzygy/subscriptions/model.py
"""/web/app/syzygy/subscriptions/model.py
Author: <NAME> (<EMAIL>)
[Description]
Classes:
[ClassesList]
Functions:
[FunctionsList]
"""
import logging
from app import db
log = logging.getLogger(__name__)
class Subscription(db.Model):
"""[summary]
... | StarcoderdataPython |
6654630 | <gh_stars>1-10
# Copyright 2016 <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 law or agreed t... | StarcoderdataPython |
1806971 | import numpy as np
import torch
from torch import nn as nn
from torch.nn import functional as F
from . import thops
class InvertibleConv1x1(nn.Module):
def __init__(self, num_channels, LU_decomposed=False):
super().__init__()
w_shape = [num_channels, num_channels]
w_init = np.linalg.qr(np... | StarcoderdataPython |
4970310 | # Copyright 2017-2022 TensorHub, 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 writ... | StarcoderdataPython |
8196303 | <gh_stars>0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
from datetime import datetime
import os, pickle
import re
import time
import importlib
import sys
import numpy as np
import tensorflow as tf
import batching
import tensorflow.contrib.s... | StarcoderdataPython |
48142 | from cmx import doc
import gym
import numpy as np
from env_wrappers.flat_env import FlatGoalEnv
from sawyer.misc import space2dict, obs2dict
def test_start():
doc @ """
# Sawyer Blocks Environment
## To-do
- [ ] automatically generate the environment table
We include the following domain... | StarcoderdataPython |
5040339 | import os
import matplotlib
from data import PartNetDataset
from vis_utils import draw_partnet_objects
if __name__ =='__main__':
matplotlib.pyplot.ion()
# visualize one data
obj = PartNetDataset.load_object('/home/zhangxc/tmp/structurenet-master/data/results/pc_ae_chair_image_encoder_test/object-result.... | StarcoderdataPython |
372999 | <filename>code/python/src/slub_docsa/data/preprocess/__init__.py<gh_stars>10-100
"""Data pre-processing methods."""
| StarcoderdataPython |
318817 | from collections import namedtuple
Program = namedtuple("Program", ["structs", "funcs", "meta"])
Func = namedtuple("Func", ["name", "params", "insts"])
Struct = namedtuple("Struct", ["name", "ty"])
Name = namedtuple("Name", ["str", "ty"])
BinaryInst = namedtuple("BinaryInst", ["name", "l", "op", "r"])
BinaryOps = [... | StarcoderdataPython |
122261 | <filename>main.py<gh_stars>0
#!/usr/bin/env python
# If you keep OpenSCAD in an unusual location, uncomment the following line of code and
# set it to the full path to the openscad executable.
# Note: Windows/python now support forward-slash characters in paths, so please use
# those instead of backslashes which... | StarcoderdataPython |
9715865 | <reponame>FidelityInternational/django-cms
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib.auth import login as auth_login, REDIRECT_FIELD_NAME
from django.contrib.auth.views import redirect_to_login
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect,... | StarcoderdataPython |
350243 | <filename>game/rl/dqn/model.py<gh_stars>0
import os
from os import path
import numpy as np
import torch
import torch.nn as nn
from torch.optim import Adam
from pathlib import Path
from dataclasses import asdict
from utils.math_utils import to_numpy
from .network import DQN
from .configs.model import ModelConfig
from ... | StarcoderdataPython |
9790978 | <gh_stars>0
import KratosMultiphysics
import KratosMultiphysics.StructuralMechanicsApplication as StructuralMechanicsApplication
import KratosMultiphysics.KratosUnittest as KratosUnittest
class TestPatchTestShells(KratosUnittest.TestCase):
def setUp(self):
pass
def _add_variables(self,mp):
... | StarcoderdataPython |
6620051 | <gh_stars>1-10
import pytest
from ...tests.common_tests import OperatorTestTemplate, ParamTuple
from ..whitespace_tokenizer import WhiteSpaceTokenizer
class TestWhiteSpaceTokenizer(OperatorTestTemplate):
params = [
ParamTuple(
"a \t \t \nb c",
[1, 0, 0, 0, 0, 0, 0, 2, 0, 3],
... | StarcoderdataPython |
12855513 | <filename>testscripts/RDKB/component/CMAgent/TS_CMAGENT_SetSessionId.py
##########################################################################
# If not stated otherwise in this file or this component's Licenses.txt
# file the following copyright and licenses apply:
#
# Copyright 2016 RDK Management
#
# Licens... | StarcoderdataPython |
11276956 | <filename>tests/unit_tests.py
import pyredner
import redner
import numpy as np
import torch
def unit_tests():
redner.test_sample_primary_rays(False)
redner.test_scene_intersect(False)
redner.test_sample_point_on_light(False)
redner.test_active_pixels(False)
redner.test_camera_derivatives()
redn... | StarcoderdataPython |
8045032 | <filename>homeassistant/components/minecraft_server/const.py<gh_stars>1000+
"""Constants for the Minecraft Server integration."""
ATTR_PLAYERS_LIST = "players_list"
DEFAULT_HOST = "localhost:25565"
DEFAULT_NAME = "Minecraft Server"
DEFAULT_PORT = 25565
DOMAIN = "minecraft_server"
ICON_LATENCY_TIME = "mdi:signal"
IC... | StarcoderdataPython |
6652228 | #!/bin/env dls-python
import mock
import unittest
from dls_ade import dls_release
from mock import patch, ANY, MagicMock
from argparse import _StoreAction
from argparse import _StoreTrueAction
def set_up_mock(self, path):
patch_obj = patch(path)
self.addCleanup(patch_obj.stop)
mock_obj = patch_obj.star... | StarcoderdataPython |
9709453 | import os
import shutil
import tkinter
from tkinter import Button, Entry, Frame, Label, Listbox, OptionMenu, StringVar, filedialog
from tkinter.constants import BOTTOM, END, TOP
import time
def organiser_app_window():
mainscreen = tkinter.Tk()
mainscreen.title("organize it")
global scvalue, file_path, resu... | StarcoderdataPython |
3470308 | <reponame>JiangNanMax/mysite
from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import GenericRelation
from ckeditor.fields import RichTextField
from read_statistics.models import ReadNumExpandMethod, ReadDetail
##
from mdeditor.fields import MDTextF... | StarcoderdataPython |
8092010 | <filename>src/udgs/models/solve_lexicographic_pg.py
from udgs.models.forces_utils import ForcesException
import numpy as np
from udgs.models.forces_def import params, p_idx
from udgs.models.forces_def.car_util import set_p_car
def solve_optimization(model, solver, n_players, problem, behavior,
... | StarcoderdataPython |
3310175 | import logging
import re
import argparse
import glob
import json
import time
import sys
import win32evtlog
import win32api
import win32con
import pywintypes
import os
OUTPUT_FORMATS = "json".split(" ")
LANGID = win32api.MAKELANGID(win32con.LANG_NEUTRAL, win32con.SUBLANG_NEUTRAL)
DLLCACHE = {}
DLLMSGCACHE = {}
LOGGER = ... | StarcoderdataPython |
9753503 | <filename>RefMaterials/Machine-Learning/decision-tree.py
def entropy(class_probabilities):
return sum(-p * math.log(p,2)
for p in class_probabilities
if p) #ignore zero probability
def class_probabilities(labels):
total_count = len(labels)
return [count / total_count
for count in Counter(labels).valu... | StarcoderdataPython |
275378 | <filename>physical_arm_learning/genetic_agent.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 10 16:13:27 2020
@author: stan
"""
import numpy as np
class GeneticAgent(object):
"""
old_generation is a list of vector, reward pairs
"""
def __init__(self, p_mutation, p_crossover, ... | StarcoderdataPython |
8020631 | #!/usr/bin/python3
# -*- coding:utf-8 -*-
# Project: http://cloudedbats.org
# Copyright (c) 2016-2018 <NAME>
# License: MIT License (see LICENSE.txt or http://opensource.org/licenses/mit).
import os
import logging
import time
import wave
import pyaudio
import wurb_core
def default_settings():
""" Available setti... | StarcoderdataPython |
11321496 | import os
import io
from flaskr.services.signal_service import signalService
from flaskr.models import db
from flaskr.models.word import Word
class DictionaryService:
@staticmethod
def get_words_from_db():
words_list = []
query = db.session.query(Word.word).all()
for word in query:
... | StarcoderdataPython |
3539463 | from django.contrib.auth import get_user_model
from rest_framework.fields import CharField
from rest_framework.serializers import ModelSerializer
from grandchallenge.challenges.models import Challenge
from grandchallenge.components.serializers import (
ComponentInterfaceValueSerializer,
)
from grandchallenge.evalu... | StarcoderdataPython |
239668 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
"""
Helpers to process schemas.
"""
... | StarcoderdataPython |
1646558 | # collector package
| StarcoderdataPython |
1615314 |
# Data Plotting
import matplotlib.pyplot as plt
# Deep learning
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping
def main():
trainer_data = Im... | StarcoderdataPython |
5063683 | <gh_stars>0
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from bookstore.apps.catalog.views import (
BookListView,
BookDetailView,
AuthorListView,
AuthorDetailView,
Publi... | StarcoderdataPython |
1824852 | <filename>tests/test_base.py
# coding=utf-8
import os
import sys
import unittest
dirname = os.path.dirname(os.path.abspath(__file__))
project = os.path.dirname(dirname)
if project not in sys.path:
sys.path.insert(0, project)
class BaseTestCase(unittest.TestCase):
@staticmethod
def main():
retur... | StarcoderdataPython |
11269214 | <filename>utils/monitor.py
from datetime import datetime
class Monitor:
def __init__(self):
self.last_time = None
def output(self, current_state, total_state, extra=None):
if self.last_time is None:
self.last_time = datetime.now()
position = int(current_state / total_sta... | StarcoderdataPython |
6647657 | from django import forms
from .models import Loan
from books.models import Book
class LoanForm(forms.ModelForm):
code = forms.CharField(label='Book Code')
class Meta:
model = Loan
fields = [
'to',
]
| StarcoderdataPython |
1965214 | <gh_stars>1-10
import pandas as pd
import numpy as np
import os, sys, json
import warnings
warnings.filterwarnings("ignore")
from .utils import *
from .metadata import get_task2category, bm_metric_names, benchmark_names, bm_split_names
from .evaluator import Evaluator
class BenchmarkGroup:
def __init__(self, name, ... | StarcoderdataPython |
6510254 | <reponame>gray0018/Normal-integration-benchmark
import OpenEXR
import Imath
import sys
import scipy.io as io
import numpy as np
import cv2
from matplotlib import pyplot as plt
def split_channel(f, channel, float_flag=True):
dw = f.header()['dataWindow']
size = (dw.max.x - dw.min.x + 1, dw.max.y - dw.min.y + 1... | StarcoderdataPython |
9631950 | # pylint: disable=attribute-defined-outside-init
""" Proxy S3 as static file handler """
import logging
from tornado.web import StaticFileHandler
from .access_control import UserMixin
LOGGER = logging.getLogger(__name__)
class StaticFiles(UserMixin, StaticFileHandler): # pylint: disable=W0223
""" work around ""... | StarcoderdataPython |
6643489 | <gh_stars>10-100
# test_netdb.py - Test netdb.py
# Author: <NAME> <<EMAIL>>
# License: MIT
# Note: this uses py.test.
import netdb,os,random
'''
def test_inspect():
netdb.inspect()
'''
def test_sha256():
assert('d2f4e10adac32aeb600c2f57ba2bac1019a5c76baa65042714ed2678844320d0' == netdb.netdb.sha256('i2p is cool',... | StarcoderdataPython |
20041 | <reponame>Infinidat/infi.gevent-utils
from __future__ import absolute_import
from infi.gevent_utils.os import path
import sys
import os
sys.path.append(os.path.dirname(__file__))
from utils import GreenletCalledValidatorTestCase
class PathTestCase(GreenletCalledValidatorTestCase):
def test_exists(self):
... | StarcoderdataPython |
9755759 | <filename>inject/treeline.py
"""treeline.py -- utility functions for working with .trln files
read(path) -- read a .trln file
new(path) -- create a blank, new .trln file
save() -- save the .trln file
g[PATH] -- path of file, used when writing
g[CONTENT] -- the raw JSON content of the .trln file
Indexed fields... | StarcoderdataPython |
9604575 | password = input('Enter the password:')
if password in ['<PASSWORD>', '<PASSWORD>']:
print('You may enter.')
else:
print('Begone!')
| StarcoderdataPython |
186620 | <reponame>z3z1ma/dbt-osmosis
from enum import Enum
from itertools import chain
from pathlib import Path
from typing import (Any, Dict, Iterable, Iterator, List, Mapping,
MutableMapping, Optional, Set, Tuple, Union)
import agate
import dbt.config.runtime as dbt_config
import dbt.parser.manifest as d... | StarcoderdataPython |
8187524 | import os
import string
import os.path as op
import sys
import shutil
from collections import namedtuple
try:
from seqcluster import prepare_data as prepare
from seqcluster import templates as template_seqcluster
from seqcluster.seqbuster import _create_counts, _read_miraligner, _tab_output
except ImportEr... | StarcoderdataPython |
6478078 | import json
import os
import requests
import struct
import subprocess
import tempfile
import tempfile
import wave
from datetime import datetime
GOOGLE_SPEECH_API_KEY = "<KEY>"
GOOGLE_SPEECH_API_URL = "http://www.google.com/speech-api/v2/recognize" + \
"?client=chromium&lang={lang}&key={key}"
... | StarcoderdataPython |
9655174 | #!/usr/bin/python
import numpy;
import scipy;
import subprocess;
radarld="radar_ODR_5rlks";
width="1122";
wavelength=100.0*0.0565646;
cmd="\nrmg2mag_phs "+radarld+".unw "+radarld+".mag "+radarld+".phs "+width+"\n";
subprocess.call(cmd,shell=True);
file=open(radarld+".phs","rb");
phs=scipy.matrix(numpy.fromfile(file... | StarcoderdataPython |
8079066 | #!/usr/bin/env python
#
# Copyright (c) 2017-2018 The Bitcoin ABC developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Desciption:
# Quick and dirty script to read build output and report it to phabricator.
import sys... | StarcoderdataPython |
3590145 | <reponame>shimataro/syncfiles
#!/usr/bin/python
# coding: utf-8
""" Synchronize files
* Copy from newest file to others.
* Error when all files are not exist.
"""
import sys
import os
def main(scriptname, args):
""" main function
@param scriptname: script file name
@param args: command line arguments
... | StarcoderdataPython |
8015987 | <reponame>alex-dsouza777/Python-Basics
#pip install virtualenv --> Installs the package
#virtualenv myprojectenv --> Creates a new venv
#.\myprojectenv\Scripts\activate.ps1
#pip freeze > requirements.txt --> Creates requirements. txt
#pip install –r requirements.txt --> Installs all packages from requirements.txt
imp... | StarcoderdataPython |
49887 | <gh_stars>0
# -*- coding: utf-8 -*-
#BEGIN_HEADER
import logging
import os
import shutil
from Utils.mutantpooluploadUtilClient import mutantpooluploadUtil
from Utils.expsfileuploadUtilClient import expsfileuploadUtil
from Utils.barcodecountuploadUtilClient import barcodecountfileuploadUtil
from Utils.genetableuploadUti... | StarcoderdataPython |
6433757 | <filename>automix/model/inputOutput/serializer/xmlSerializer.py
class XmlSerialiser(object):
@staticmethod
def xmlDeserialize(path):
"""
get a track from the SegmXML format: http://www.ifs.tuwien.ac.at/mir/audiosegmentation.html
"""
tree = ET.parse(path)
root = tree.getro... | StarcoderdataPython |
12808588 | import copy
import datetime as dt
import json
import pytest
import requests
import time
import uuid
from src import env, utils
from src.utils import (assert_contains, ok_response_contains,
response_contains, response_contains_json)
CVE_ID_URL = '/api/cve-id'
cve_id = 'CVE-1999-0001'
#### GET /... | StarcoderdataPython |
315270 | from math import ceil
series_name: str = input()
episode_runtime: int = int(input())
lunch_break_duration: int = int(input())
timer: int = lunch_break_duration
timer -= episode_runtime
timer -= lunch_break_duration / 8
timer -= lunch_break_duration / 4
if timer >= 0:
print(f'You have enough time to watch {series... | StarcoderdataPython |
5114917 | # import modules
from .sql_kit import SQL_Kit
# libraries
import mysql.connector
from datetime import datetime
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import getpass
# this pulls data from the SQL database, then displays a dashboard of interactive plots, widgets and animations!
class D... | StarcoderdataPython |
4984338 | from txt2epub_pdf import txt2epub
from txt2epub_pdf import txt2pdf
class Testtxt2epub():
def test__make_1(self):
metadata = dict(
path="./tests/TEST BOOK",
title="テストブック",
title_ruby="てすとぶっく",
sub_title="txt2epub_pdfを使って",
author="Dr?Thomas",
... | StarcoderdataPython |
29700 | <reponame>leelige/mindspore
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | StarcoderdataPython |
323423 | # Routine to parse the data line received from the sensors
# 20160705
# Changed the format of the data from the sensor.
# New dust sensor with more data and re-ordered the data channels
from random import randint
import serial # Serial communications
import os #OS calls to control the screensaver and play sounds
impor... | StarcoderdataPython |
8099545 | #!/usr/bin/env python
# coding=utf-8
# Copyright The HuggingFace Team and The HuggingFace Inc. team. 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:... | StarcoderdataPython |
3369083 | <reponame>iltempe/osmosi<filename>sumo/tests/netedit/bugs/ticket2948/test.sikuli/test.py
#!/usr/bin/env python
"""
@file test.py
@author <NAME>
@date 2016-11-25
@version $Id$
python script used by sikulix for testing netedit
SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
Copyright (C) 2009-2017 DL... | StarcoderdataPython |
4986240 | from . import auth
import requests
import json
from types import SimpleNamespace
class FaceDataLib(object):
def fp_library_add(self, faceLibType, name, customInfo, host):
path = host+'/ISAPI/Intelligent/FDLib?format=json'
body = {
'faceLibType': faceLibType,
'name': name,
... | StarcoderdataPython |
199418 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 29 12:59:04 2020
@author: hartwgj
"""
# cth 1mm interferometer code
import scipy.constants
from scipy import fft,ifft
from cthmds import CTHData
import numpy as np
# input the chord
# return the density and time axis
# other possible keywords: numfwin, phase,SAVEintfr... | StarcoderdataPython |
3580149 | from threading import Thread, Lock
import time
import video_streaming_pb2,video_streaming_pb2_grpc
import numpy as np
import cv2
import imutils
class Camera(Thread):
def __init__(self, channel) -> None:
""" init thread and connect to chrys edge proxy grpc server """
Thread.__init__(self)
s... | StarcoderdataPython |
6409603 | <gh_stars>1000+
"""
Testing qmc5883 python driver
The below i2c configuration is needed in your board.json.
"qmc5883": {
"type": "I2C",
"port": 1,
"addrWidth": 7,
"freq": 400000,
"mode": "master",
"devAddr": 13
}
"""
from qmc5883 import QMC5883
print("Testing qmc5883 ...")
qmc5883Dev = QMC5883()
qmc5883D... | StarcoderdataPython |
1862457 | #
# Flask-PubSub
#
# Copyright (C) 2017 <NAME>
# All rights reserved
#
import base64
import json
import logging
import warnings
from flask import Blueprint, Response, abort, request
from flask.signals import Namespace
from six.moves.http_client import BAD_REQUEST, OK
logger = logging.getLogger('Flask-PubSub')
pu... | StarcoderdataPython |
5131127 | # !/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests related to crypto utils module"""
import pytest
import pyswitcheo.crypto_utils as cutils
@pytest.mark.parametrize("input_hex, want", [
('0101', True),
('', True),
('0x01', False),
])
def test_is_regex(input_hex, want):
"""Check regex parsing."""... | StarcoderdataPython |
3456834 | import big_csp
optimal = 0
while True:
encoder = big_csp.Encoder(bits=32)
x0 = big_csp.Entity(encoder)
x1 = big_csp.Entity(encoder)
x2 = big_csp.Entity(encoder)
x3 = big_csp.Entity(encoder)
x4 = big_csp.Entity(encoder)
x5 = big_csp.Entity(encoder)
x6 = big_csp.Entity(encoder)
x7 = big_csp.Entity(encoder)
x8... | StarcoderdataPython |
4871726 | from .supervised import (plot, plot_classification_categorical,
plot_regression_categorical,
plot_classification_continuous,
plot_regression_continuous,
class_hists)
from .utils import (find_pretty_grid, mosaic_plot, dis... | StarcoderdataPython |
12808923 | import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import argparse
import torch
import numpy as np
from algos.ddqn import DDQN_Agent
from common.buffers import ReplayBuffer
from common.networks import ConvAtariQsNet
from utils import train_tools
from utils.atari_wrappers ... | StarcoderdataPython |
6532171 | #!/usr/bin/python
import os, sys
import prettyformat
import fileinput
action = sys.argv[1]
module = sys.argv[2]
line = sys.stdin.readline()
while(line):
valid = True
if("Compiling " in line):
action = "CC"
elif("Linking " in line):
action = "LN"
elif("checking " in line):
act... | StarcoderdataPython |
9761064 |
""" Basic engine class, inherited in guishared.py and implemented by each GUI toolkit code """
import recorder, replayer
import os, sys, imp
try:
# In Py 2.x, the builtins were in __builtin__
BUILTINS = sys.modules['__builtin__']
except KeyError: # pragma: no cover - not worried about Python 3 yet...
# I... | StarcoderdataPython |
5033140 | import sys
import os
import json
from os.path import dirname
from pathlib import Path
import nibabel as nib
from nibabel.processing import resample_to_output
import numpy as np
import torch
from torchvision import transforms
from torch.utils.data import Dataset, DataLoader
from PIL import Image
np.set_printoptions(prec... | StarcoderdataPython |
6696944 | # -*- coding: utf-8 -*-
from webob import Request
from webob import Response
from webob import exc
def input_app(environ, start_response):
resp = Response()
req = Request(environ)
if req.path_info == '/':
resp.body = b'<input name="youyou" type="text" value="" />'
elif req.path_info == '/submi... | StarcoderdataPython |
3561363 | from setuptools import find_packages
from setuptools import setup
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(
name='py-modular',
version='0.0.1',
description='An experimental, modular audio programming environment in python',
long_description=long_descr... | StarcoderdataPython |
3278436 | <gh_stars>0
import json
import os
import zipfile
from django.contrib.auth.hashers import check_password, make_password
from django.http import HttpResponse, FileResponse, StreamingHttpResponse
from django.shortcuts import render
# Create your views here.
from RootAPP.models import PathItem, FileItem
from UserAPP.model... | StarcoderdataPython |
9786309 | print("connect setup")
import socket
HOST, PORT = "169.254.44.240", 9999 #"169.254.44.240",9999
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print("trying to establish a connection")
try:
sock.connect((HOST, PORT))
print("connect ready")
except:
print("CONNECTION FAILED.")
print("have you r... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.