id
stringlengths
1
8
text
stringlengths
6
1.05M
dataset_id
stringclasses
1 value
1890761
<reponame>haribo0915/Spring-Cloud-in-Python # -*- coding: utf-8 -*- # standard library from abc import ABC, abstractmethod from typing import Optional __author__ = "Waterball (<EMAIL>)" __license__ = "Apache 2.0" __all__ = ["PathElement"] class PathElement(ABC): def __init__(self, pos: int, separator): ...
StarcoderdataPython
3345208
<reponame>MeganBeckett/great_expectations<gh_stars>0 import copy import itertools from abc import ABC, abstractmethod from dataclasses import asdict, dataclass, make_dataclass from typing import Any, Callable, Dict, List, Optional, Tuple, Union import numpy as np import great_expectations.exceptions as ge_exceptions ...
StarcoderdataPython
1861257
""" :mod:`zsl.utils.email_helper` ----------------------------- """ from __future__ import unicode_literals from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText import smtplib from zsl import Config, Injected, inject @inject(config=Config) def send_email(sender, receivers, subject, t...
StarcoderdataPython
5198423
from django_etuovi.utils.testing import check_dataclass_typing from connections.etuovi.etuovi_mapper import map_apartment_to_item from connections.tests.factories import ApartmentFactory, ApartmentMinimalFactory def test__apartment__to_item_mapping_types(): apartment = ApartmentFactory() item = map_apartment...
StarcoderdataPython
56235
# -*- coding: utf-8 -*- # @Author: 何睿 # @Create Date: 2019-04-09 12:37:36 # @Last Modified by: 何睿 # @Last Modified time: 2019-04-09 15:57:00 from collections import Counter class Solution: def topKFrequent(self, nums: [int], k: int) -> [int]: # 桶 bucket = dict() # 构建字...
StarcoderdataPython
4908601
<reponame>emersonnobre/python-basics<filename>print.py from datetime import datetime register_log_file = None try: register_log_file = open("data/register_log.txt", "r+") register = str(datetime.today()) + " || " + "Type the register >> 0" print(register, file=register_log_file) register_log_file.clos...
StarcoderdataPython
8023277
#!/usr/bin/env python """ Generate a file of X Mb with text, where X is fetched from the command line. """ def generate(Mb, filename='tmp.dat'): line = 'here is some line with a number %09d and no useful text\n' line_len = len(line) - 4 + 9 # length of each line nlines = int(Mb*1000000/line_len) # no of l...
StarcoderdataPython
314609
def moeda(p = 0, moeda = 'R$'): return (f'{moeda}{p:.2f}'.replace('.',',')) def metade(p = 0, formato=False): res = p/2 return res if formato is False else moeda(res) def dobro(p = 0, formato=False): res = p*2 return res if formato is False else moeda(res) def aumentar(p = 0, taxa = 0, formato...
StarcoderdataPython
3217505
# # Copyright (C) 2013 Webvirtmgr. # import libvirt import threading import socket from vrtManager import util from libvirt import libvirtError from vrtManager.rwlock import ReadWriteLock CONN_SOCKET = 4 CONN_TLS = 3 CONN_SSH = 2 CONN_TCP = 1 TLS_PORT = 16514 SSH_PORT = 22 TCP_PORT = 16509 LIBVIRT_KEEPALIVE_INTE...
StarcoderdataPython
1816859
""" 输入整数数组 arr ,找出其中最小的 k 个数。 例如,输入4、5、1、6、2、7、3、8这8个数字, 则最小的4个数字是1、2、3、4。 限制: 0 <= k <= arr.length <= 10000 0 <= arr[i] <= 10000 """ from typing import List from random import randint class Solution: def getLeastNumbers(self, arr: List[int], k: int) -> List[int]: """ 最简单的直接sort就完事儿了 o(nlo...
StarcoderdataPython
9653323
<reponame>Caleb68864/GTM_Link_Sender<filename>__main__.py import pandas import os import wx import FrmMain import webbrowser from difflib import get_close_matches class MyFrame(wx.Frame): def createLinkFile(self, meetingid, usersdir, user): filepath = "{}\\{}\Desktop\\IT_Help.bat".format(usersdir, user) ...
StarcoderdataPython
8036945
<reponame>TheNicGard/DungeonStar class Tile: def __init__(self, blocked, block_sight=None, window=None): self.blocked = blocked if block_sight is None: block_sight = blocked self.block_sight = block_sight self.window = window self.explored = False
StarcoderdataPython
1613209
# Copyright 2019 <NAME> and <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 to in wri...
StarcoderdataPython
3282117
import clr import time from System.Reflection import Assembly dynamoCore = Assembly.Load("DynamoCore") dynVersion = dynamoCore.GetName().Version.ToString() dynVersionInt = int(dynVersion[0])*10+int(dynVersion[2]) class WorksharingLog: def __init__(self, version, sessions): self.Version = version self.Sessions = ...
StarcoderdataPython
1733591
<reponame>pthalin/instaclient from instaclient.client import * if TYPE_CHECKING: from instaclient.client.instaclient import InstaClient from instaclient.client.checker import Checker class Navigator(Checker): # NAVIGATION PROCEDURES def _show_nav_bar(self:'InstaClient'): if self.driver.current_u...
StarcoderdataPython
6569324
<filename>ARMODServers/Apps/Index/migrations/0005_indexnavbar.py<gh_stars>1-10 # Generated by Django 3.1.4 on 2021-04-20 15:12 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Index', '0004_auto_20210420_2254'), ] operations = [ migratio...
StarcoderdataPython
8166101
<filename>boa3_test/test_sc/native_test/contractmanagement/DeployContract.py from typing import Any from boa3.builtin import public from boa3.builtin.interop.contract import Contract from boa3.builtin.nativecontract.contractmanagement import ContractManagement @public def Main(script: bytes, manifest: bytes, data: A...
StarcoderdataPython
12844592
<gh_stars>10-100 import dash_core_components as dcc import dash_html_components as html import dash_table as dt from openomics_web.utils.str_utils import longest_common_prefix def DataTableColumnSelect(columns): """ Args: columns: """ longest_common_prefixes = longest_common_prefix(columns) ...
StarcoderdataPython
1773435
<reponame>ConvertGroupLabs/pairing-functions # -*- coding: utf-8 -*- import pytest from pairing_functions.szudzik import pair, unpair class TestSzudzikPairing(object): def test_pair(self) -> None: assert pair(0, 0) == 0 assert pair(0, 1) == 1 assert pair(1, 0) == 2 assert pair(...
StarcoderdataPython
9787366
from flask import Flask, render_template import pymongo import random app = Flask(__name__) @app.route('/') def mostrar_usuario(): client = pymongo.MongoClient("mongodb://db:27017/") db = client["mi-bd"] personas = [] for x in db.coll.find(): personas.append(x) persona = personas[random.randint(0, len(persona...
StarcoderdataPython
8099916
<filename>openslides_backend/action/actions/poll/mixins.py from decimal import Decimal from typing import Any, Dict, List from ....permissions.permission_helper import has_perm from ....permissions.permissions import Permission, Permissions from ....services.datastore.commands import GetManyRequest from ....services.d...
StarcoderdataPython
9761408
<filename>lantern/grids/grid_qgrid.py<gh_stars>100-1000 def qgrid_grid(df): from qgrid import show_grid return show_grid(df)
StarcoderdataPython
4892234
from sqlalchemy import Boolean, Column, DateTime, Integer, String from sqlalchemy.ext.hybrid import hybrid_property from sqlalchemy_utils import ChoiceType, EmailType, PhoneNumberType from .base import BaseModel from .lib import OrderedEnum from .meta import Base class Role(OrderedEnum): USER = 10 ADMIN = 20...
StarcoderdataPython
3487891
# Sample code from http://www.redblobgames.com/pathfinding/ # Copyright 2014 <NAME> <<EMAIL>> # # Feel free to use this code in your own projects, including commercial projects # License: Apache v2.0 <http://www.apache.org/licenses/LICENSE-2.0.html> class SimpleGraph: def __init__(self): self.edges...
StarcoderdataPython
5086201
<gh_stars>1-10 import optmod import unittest import numpy as np class TestVariableDicts(unittest.TestCase): def test_construction_with_tuples(self): x = optmod.VariableDict([(1,2), ('tt', 4)], name='x') self.assertTrue(isinstance(x[(1,2)], optmod.VariableScalar)) self.assertTrue(isinstan...
StarcoderdataPython
4923056
<reponame>panghantian-kavout/DeepRL<filename>DeepRL/Agent/DoubleDQNAgent.py import typing from copy import deepcopy import numpy as np import torch import torch.nn as nn import torch.optim as optim from torch.autograd import Variable from DeepRL.Agent.AgentAbstract import AgentAbstract from DeepRL.Env import EnvAbstr...
StarcoderdataPython
3348587
<filename>URI.3.py a=0 b=0 c=0 d=0 while d!=4: d=int(input()) if d==1: a=a+1 if d==2: b=b+1 if d==3: c=c+1 print("MUITO OBRIGADO") print("Alcool: "+str(a)) print("Gasolina: "+str(b)) print("Diesel: "+str(c))
StarcoderdataPython
6465397
# -*- coding: utf-8 -*- from confiture import Confiture def test_empty(): confiture = Confiture('tests/yaml/template/empty.yaml') confiture.check('tests/yaml/config/empty_valid.yaml') confiture.check('tests/yaml/config/simple_valid.yaml') def test_simple(): confiture = Confiture('tests/yaml/template/...
StarcoderdataPython
6640949
<filename>setup.py import os import re from setuptools import find_packages, setup def read(f): return open(f, 'r', encoding='utf-8').read() def get_version(package): """ Return package version as listed in `__version__` in `init.py`. """ init_py = open(os.path.join(package, '__init__.py')).read...
StarcoderdataPython
6467087
import argparse import hypothesis import matplotlib.pyplot as plt import numpy as np import torch from hypothesis.stat import highest_density_level from util import MarginalizedAgePrior from util import Prior from scipy.stats import chi2 from util import load_ratio_estimator @torch.no_grad() def main(arguments): ...
StarcoderdataPython
3266205
a = 1 b = 2 c = 3
StarcoderdataPython
3213298
<reponame>wondadeveloppe26/checklist-seo from setuptools import setup, find_packages from readme_renderer.markdown import render long_description = "" with open('README.md', encoding='utf-8') as file: long_description = file.read() setup( name='checklist-seo', version='0.0.7', license='MIT', author=...
StarcoderdataPython
4894074
<filename>sqltask/base/engine.py import logging from typing import Any, Dict, Optional from sqlalchemy.engine import create_engine from sqlalchemy.engine.url import make_url from sqlalchemy.schema import MetaData from sqltask.engine_specs import get_engine_spec class EngineContext: def __init__(self, ...
StarcoderdataPython
6497730
<filename>4_SC_project/students/migrations/0002_auto_20190828_1013.py # Generated by Django 2.2.1 on 2019-08-28 10:13 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_de...
StarcoderdataPython
4964709
<gh_stars>1-10 #!/usr/bin/env python3 import click import os import sys import tempfile from operations.gif_it import GenerateGifIt DEFAULT_VIDEO = 'https://www.youtube.com/watch?v=CGOPPzh8TJ4' SHARE_DIR = '/usr/src/share' VIDEO_QUALITY = 'context_video_quality' def _generate_config(overrides={}): temp_dir = te...
StarcoderdataPython
6628577
import time import cv2 import numpy as np from display import Display from extractor import Extractor width = 1280//2 #1920//2 height = 720//2 #1080//2 disp = Display(width, height) fe = Extractor() def frames_per_motion(img): img = cv2.resize(img, (width, height)) matches = fe.extract(img) pri...
StarcoderdataPython
4907095
<filename>examples/inverted_pendulum.py<gh_stars>100-1000 import numpy as np import gym from pilco.models import PILCO from pilco.controllers import RbfController, LinearController from pilco.rewards import ExponentialReward import tensorflow as tf from gpflow import set_trainable # from tensorflow import logging np.ra...
StarcoderdataPython
3438976
<reponame>ardacoskunses/asitop<gh_stars>0 def parse_thermal_pressure(powermetrics_parse): return powermetrics_parse["thermal_pressure"] def parse_bandwidth_metrics(powermetrics_parse): bandwidth_metrics = powermetrics_parse["bandwidth_counters"] bandwidth_metrics_dict = {} data_fields = ["PCPU0 DCS RD...
StarcoderdataPython
11229803
<gh_stars>1-10 from forum.database.models.category import Category from flask_seeder import Seeder from slugify import slugify category_names = ["PHP", "Javascript", "Python", "HTML-CSS"] class CategorySeeder(Seeder): def run(self): for category_name in category_names: category = Category(n...
StarcoderdataPython
170076
# https://leetcode.com/problems/kids-with-the-greatest-number-of-candies/submissions/ class Solution: def kidsWithCandies(self, candies: [int], extraCandies: int) -> [bool]: maxCandies = max(candies, default=0) return [True if v + extraCandies >= maxCandies else False for v in candies]
StarcoderdataPython
9683997
<gh_stars>0 # Copyright 2020 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 or at # https://developers.google.com/open-source/licenses/bsd from __future__ import print_function from __future__ import division from __future...
StarcoderdataPython
134338
#!/usr/bin/env python3 from bisect import bisect_left from pathlib import Path import boto3 class S3Sync: """Class needed for syncing local direcory to a S3 bucket""" def __init__(self): """Initialize class with boto3 client""" self.s3 = boto3.client("s3") def upload_object(self, source...
StarcoderdataPython
12861121
<filename>Datasets/Terrain/us_ned_physio_diversity.py import ee from ee_plugin import Map dataset = ee.Image('CSP/ERGo/1_0/US/physioDiversity') physiographicDiversity = dataset.select('b1') physiographicDiversityVis = { 'min': 0.0, 'max': 1.0, } Map.setCenter(-94.625, 39.825, 7) Map.addLayer( physiographicDi...
StarcoderdataPython
4955143
############################################################################### # _ _ _ # # | | (_) | | # # _ __ _ _ | | __ _ _ __ _ __| | # ...
StarcoderdataPython
3463870
<gh_stars>10-100 import logging import time class ChromeLogin(): def __init__(self, driver): super().__init__(driver) self.driver = driver emailfield = "//*[@type='email']" passfield = "//*[@name='password']" passedLogin = "Control, protect, and secure your account, all in ...
StarcoderdataPython
134259
# Copyright 2020 <NAME>, <NAME>, <NAME>, <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
6661448
<gh_stars>0 #!/usr/bin/python3 # -*- coding: utf-8 -*- """ star_catalog_creator.py Script used for creating star catalogs, k-vectors, etc. Distributed under the 3-Clause BSD License (below) Copyright 2019 Rensselaer Polytechnic Institute (Dr. <NAME>, <NAME>, <NAME>) Redistribution and use in source and binary form...
StarcoderdataPython
4998455
<filename>src/meetshaus.jmscontent/meetshaus/jmscontent/bannerviewlet.py from five import grok from Acquisition import aq_inner from zope.component import getMultiAdapter from Products.CMFCore.utils import getToolByName from plone.app.layout.navigation.interfaces import INavigationRoot from plone.app.layout.viewlets.in...
StarcoderdataPython
6518337
<filename>example/blog/event_hooks.py event_hooks = []
StarcoderdataPython
4848733
<reponame>PackAssembler/PackAssembler import pytest from base import BaseTest, match_request from packassembler.schema import User from factories import UserFactory @pytest.fixture def user(request): user = UserFactory() def fin(): user.delete() request.addfinalizer(fin) return user class...
StarcoderdataPython
8160253
<gh_stars>1-10 import streamlit as st from multiapp import MultiApp from apps import home, svm, knn, logistic_regression # decision_tree, random_forest, naive_bayes app = MultiApp() app.add_app("-----", home.app) app.add_app("KNN", knn.app) app.add_app("SVM", svm.app) app.add_app("Logistic Regression", logi...
StarcoderdataPython
281060
<gh_stars>1-10 #Standard python libraries import os import warnings import copy import time import itertools import functools #Dependencies - numpy, scipy, matplotlib, pyfftw import numpy as np import pyx class DiagramDrawer: """This class is used to draw double-sided Feynman diagrams and save them as pdf files "...
StarcoderdataPython
4918127
<filename>docs/examples/compute/cloudframes/functionality.py import uuid from libcloud.compute.types import Provider, NodeState from libcloud.compute.providers import get_driver CloudFrames = get_driver(Provider.CLOUDFRAMES) driver = CloudFrames(url='http://admin:admin@cloudframes:80/appserver/xmlrpc') # get an avai...
StarcoderdataPython
149758
<filename>beartype/cave/__init__.py #!/usr/bin/env python3 # --------------------( LICENSE )-------------------- # Copyright (c) 2014-2021 Beartype authors. # See "LICENSE" for further details. ''' **Beartype cave.** This submodule collects common types (e.g., :class:`NoneType`, the type of ...
StarcoderdataPython
9689065
<filename>recv.py import random EXTENDED_ASCII = 0 ASCII = 1 BASE64 = 2 BASE32 = 3 BASE16 = 4 BASE8 = 5 class Portal(object): def __init__(mode = 3, waitCallback = None, secs = 0.2): self.bins = ([256, 128, 64, 32, 16, 8])[mode] if not self.bins: raise AttributeException("Invalid mode"...
StarcoderdataPython
6491416
import r2cloud.api import r2cloud.tools.common import matplotlib.pyplot as plot from scipy.io import wavfile # init api station = r2cloud.api('https://XXXXXXXXXX') # login to r2cloud station.login("XXXXXXXXXXXX", "XXXXXXXXXX") # get all observatios of NOAA 19 observations = station.observationList() # keep only wit...
StarcoderdataPython
8181356
import datetime from collections import namedtuple import psycopg2 class Type: def __init__(self, type_name, is_serial=False): self.type_name = type_name self.is_serial = is_serial def __str__(self): return self.type_name def __repr__(self): return self.type_name serial32 = Type('serial', True) serial...
StarcoderdataPython
174254
from collections import namedtuple from .command import Command from .utils import update_termination_protection, \ is_stack_does_not_exist_exception class StackDeleteOptions(namedtuple('StackDeleteOptions', ['no_wait', 'ignore_missing'])):...
StarcoderdataPython
1935114
<reponame>Amourspirit/ooo_uno_tmpl # coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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-...
StarcoderdataPython
9787870
"""Test constants.""" from .const_account_family import PRIMARY_EMAIL, APPLE_ID_EMAIL, ICLOUD_ID_EMAIL # Base AUTHENTICATED_USER = PRIMARY_EMAIL REQUIRES_2FA_TOKEN = "requires_2fa_token" REQUIRES_2FA_USER = "requires_2fa_user" VALID_USERS = [AUTHENTICATED_USER, REQUIRES_2FA_USER, APPLE_ID_EMAIL, ICLOUD_ID_EMAIL] VALID...
StarcoderdataPython
3210362
# O(n) runtime with memoization, O(n) space def find_path(grid, r = 0, c = 0, cache = {}): if len(grid) == 0 or len(grid[0]) == 0: return False, None if grid[r][c] == 1: return False, None loc = [(r,c)] if loc[0] in cache: return cache[loc[0]] if r == len(grid) - 1 and c == ...
StarcoderdataPython
11284910
<gh_stars>0 import json import logging import random import string import sys import traceback from os import environ from loguru import logger from settings import conf LOG_LEVEL = conf.LOG_LEVEL DEFAULT_FORMAT = ( "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | " "<level>{level: <8}</level> | " "<cyan...
StarcoderdataPython
3540460
#!/usr/bin/env python ## ## @file stripPackage.py ## @brief Strips the given package from the given SBML file. ## @author <NAME> ## ## ## This file is part of libSBML. Please visit http://sbml.org for more ## information about SBML, and the latest version of libSBML. import sys import os.path import libsbml d...
StarcoderdataPython
174211
<gh_stars>100-1000 import cv2 capture = cv2.VideoCapture(0) fgbg = cv2.createBackgroundSubtractorMOG2() while True: _, frame = capture.read() fmask = fgbg.apply(frame) cv2.imshow("Orignal Frame", frame) cv2.imshow("F Mask", fmask) if cv2.waitKey(30) & 0xff == 27: break capture.release()...
StarcoderdataPython
1740655
<filename>Modulo_3/semana 2/treeview/treewview.py import tkinter as tk from tkinter import ttk from tkinter.messagebox import showinfo #Disparo de evento al seleccionar def item_selected(event): for selected_item in tree.selection(): item = tree.item(selected_item) record = item['values'] ...
StarcoderdataPython
1630077
<gh_stars>1-10 from .model import QANet
StarcoderdataPython
12818158
<filename>exifeditor.py import piexif, os from datetime import datetime def filename2date(filename): date = datetime.strptime('20' + filename, r'%Y-%m-%d_%H%M') return date.strftime(r'%Y:%m:%d %H:%M') def editexif(date, file): exif_dict = piexif.load(file) exif_dict['Exif'][36...
StarcoderdataPython
11361203
<filename>models/caption_module.py import torch import torch.nn as nn import numpy as np from torch.nn.modules import dropout class Caption_Module_Architecture(nn.Module): def __init__(self,options, device) -> None: """This is a captioning Constructor Function Args: Returns: ...
StarcoderdataPython
6618918
<filename>server.py #!/usr/bin/env python import bz2 import pickle import argparse from collections import defaultdict from pathlib import Path from flask import render_template, Flask, url_for from flask_caching import Cache from src.lib import parse_multeval_results_table, parse_ranksys from src.utils import natura...
StarcoderdataPython
11232005
<reponame>WallabyLester/Machine_Learning_From_Scratch import numpy as np def test_l1_regularization_forward(): """ Test the forward pass of the L1Regularization class. """ from your_code import L1Regularization X = np.array([[-1, 2, 1], [-3, 4, 1]]) regularizer = L1Regularization(reg_param=0....
StarcoderdataPython
98676
<gh_stars>0 from .starts import prepare_seed, prepare_logger, get_machine_info, save_checkpoint, copy_checkpoint from .optimizers import get_optim_scheduler
StarcoderdataPython
189514
from .model import BaseModel from .tiramisu import DenseUNet, DenseBlock, DenseLayer from .tiramisu import ( ModuleName, DEFAULT_MODULE_BANK, UPSAMPLE2D_NEAREST, UPSAMPLE2D_PIXELSHUFFLE, UPSAMPLE2D_TRANPOSE, ) __all__ = [ "BaseModel", "DenseUNet", "DenseBlock", "DenseLayer", "Mo...
StarcoderdataPython
1800203
# -*- coding: utf-8 -*- """ Created on Thu May 27 10:41:46 2021 @author: freeridingeo """ import numpy as np import sys sys.path.append("D:/Code/eotopia/core") import constants sentinel1_parameter = dict() sentinel1_parameter["wavelength"] = 0.5547 # m sentinel1_parameter["antenna_length"] = 12.3 # m sentin...
StarcoderdataPython
9602313
import numpy as np import matplotlib.pyplot as plt deepsea="/home/fast/onimaru/encode/deepsea/deepsea_pred.txt" deepshark="/home/fast/onimaru/encode/deepsea/deepshark_Tue_Apr_17_183529_2018.ckpt-57883_prediction.log" deepsea_dict={} with open(deepsea, 'r') as fin: for line in fin: if not line.startswith...
StarcoderdataPython
5073479
<filename>tests/examples-good-external/7.py<gh_stars>1-10 import itertools from itertools import groupby as uniq import nonexistingmodule itertools.groupby("AAASDAADSD") uniq("AAAAA") nonexistingmodule.array([1,2]) ## does not exist
StarcoderdataPython
4955758
#!/usr/bin/env python # coding: utf-8 import pandas as pd import matplotlib.pyplot as plt from optparse import OptionParser ##Parse the options usage = "USAGE: python Plot_dat_file_catal.py --f1 First_dat_file --f2 Second_dat_file --c1 Chem1 --c2 Chem2 --jobid PNG_file_name\n" parser = OptionParser(usage=usage) ##o...
StarcoderdataPython
12844240
<reponame>grillbaer/data-logger """ Communication with APATOR EC3 power meter to get its actual readings. """ from __future__ import annotations __author__ = '<NAME>' __copyright__ = 'Copyright 2021, <NAME>, Bavaria/Germany' __license__ = 'Apache License 2.0' import logging import time from typing import NamedTuple,...
StarcoderdataPython
3262415
<reponame>Neurita/pypes # -*- coding: utf-8 -*- """ Functions to create pipelines for public and not so public available datasets. """ from collections import OrderedDict from neuro_pypes.io import build_crumb_workflow from neuro_pypes.config import update_config from neuro_pypes.anat import ( attach_spm_anat_pre...
StarcoderdataPython
5129866
<reponame>esemve/Dreya from Dreya import Dreya
StarcoderdataPython
6506064
<filename>scripts/generate_root_tld_to_nameservers.py import requests import pickle response = requests.get( url='http://www.internic.net/domain/root.zone', ) root_zone_file_data = response.text ns_records = {} a_records = {} for line in root_zone_file_data.splitlines(): if '\tIN\tNS\t' in line: spli...
StarcoderdataPython
1760017
<gh_stars>0 from .linear import linear from .step import step from .sigmoid import sigmoid from .relu import relu from .softmax import softmax
StarcoderdataPython
11394626
"""Script used to generate ablations parameters from base config file.""" import os import stat import json from copy import deepcopy ABLATIONS_SEED_SHIFT = 100 ablations = { "vanilla" : { "controller:entropy_weight" : 0.0, "training:baseline" : "ewma_R", "training:b_jumpstart" : False, ...
StarcoderdataPython
8193895
import json import requests import os try: # extract token with open('./cache/token.json', "r") as read_file: tkns = json.load(read_file) read_file.close() # extract url with open('./cache/cache.json', "r") as read_file: cache = json.load(read_file) read_file.close() # infor...
StarcoderdataPython
8085595
# time complexity could be O(n^3), three for loops # and the same for space, list size n, each cell def wordBreak(s, wordDict): results = [[] for _ in range(len(s) + 1)] results[len(s)] = [''] for i in range(len(s) - 1, -1, -1): for j in range(i + 1, len(s) + 1): if s[i:j] in wordDict:...
StarcoderdataPython
11236787
import glob import os import sys import numpy as np try: sys.path.append(glob.glob('../../carla/dist/carla-*%d.%d-%s.egg' % ( sys.version_info.major, sys.version_info.minor, 'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0]) except IndexError: pass import carla # Script level im...
StarcoderdataPython
9779730
# -*- coding: utf-8 -*- import numpy as np from . import Filter # prevent circular import in Python < 3.5 class Simoncelli(Filter): r"""Design 2 filters with the Simoncelli construction (tight frame). This function creates a Parseval filter bank of 2 filters. The low-pass filter is defined by the func...
StarcoderdataPython
11396714
# Generated by Django 2.0.2 on 2018-03-08 21:20 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('stra...
StarcoderdataPython
1822923
<reponame>kmkurn/ptst-semeval2021<gh_stars>1-10 #!/usr/bin/env python # Copyright (c) 2021 <NAME> from collections import defaultdict from pathlib import Path from statistics import median import math import os import pickle import tempfile from anafora import AnaforaData from rnnr import Event, Runner from rnnr.at...
StarcoderdataPython
3227895
<reponame>najsham/pysnobal #!/usr/bin/env python # -*- coding: utf-8 -*- import os import glob import sys import numpy from setuptools import setup, find_packages, Extension # from distutils.extension import Extension from Cython.Distutils import build_ext with open('README.md') as readme_file: readme = readme_...
StarcoderdataPython
6580180
<reponame>renaudll/maya-mock<filename>tests/unit_tests/base_tests/test_node.py<gh_stars>10-100 """ Test cases for MockedNode """ def test_dagpath(session): """Validate that the correct dagpath is returned for a node with a unique name.""" node = session.create_node("transform") assert node.dagpath == "|tr...
StarcoderdataPython
3392139
# 3rd party lib import torch import torch.nn as nn import torch.nn.functional as F # mm lib from openselfsup.models import HEADS @HEADS.register_module class DynamicResslHead(nn.Module): """Head for contrastive learning. Args: temperature (float): The temperature hyper-parameter that ...
StarcoderdataPython
5198190
<reponame>agupta54/ulca MODULE_CONTEXT = {'metadata': {'module': 'USER-MANAGEMENT'},'userID':None}
StarcoderdataPython
3496346
<filename>spaghetti/analysis.py import numpy as np class NetworkBase(object): """Base object for performing network analysis on a ``spaghetti.Network`` object. Parameters ---------- ntw : spaghetti.Network spaghetti Network object. pointpattern : spaghetti.network.PointP...
StarcoderdataPython
5070306
<reponame>marklogg/mini_demo import asyncio from mini import mini_sdk as MiniSdk from mini.apis.api_content import LanType from mini.apis.api_content import QueryWiKi, WikiResponse from mini.apis.api_content import StartTranslate, TranslateResponse from mini.apis.base_api import MiniApiResultType from mini.dns.dns_bro...
StarcoderdataPython
9736606
# -*- mode: python; coding: utf-8 -*- # # Copyright (C) 1990 - 2016 CONTACT Software GmbH # All rights reserved. # http://www.contact.de/ __docformat__ = "restructuredtext en" __revision__ = "$Id: main.py 142800 2016-06-17 12:53:51Z js $" import os from cdb import rte from cdb import sig from cs.platf...
StarcoderdataPython
3251826
# -*- coding: utf-8 -*- """ zine.importers.wordpress ~~~~~~~~~~~~~~~~~~~~~~~~ Implements an importer for WordPress extended RSS feeds. :copyright: (c) 2010 by the Zine Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import re from time import strptime from date...
StarcoderdataPython
3334622
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import six from functools import wraps, WRAPPER_ASSIGNMENTS import tensorflow as tf class TfTemplate(object): """This decorator wraps a method with `tf.make_template`. For example, Examples: ```python >>> @tf_...
StarcoderdataPython
12804448
<filename>src/oci/database_migration/models/update_agent_details.py # coding: utf-8 # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2...
StarcoderdataPython
1684803
<reponame>peerchemist/py-v-sdk """ account contains account-related resources """ from __future__ import annotations import os from typing import Any, Dict, TYPE_CHECKING, Type, Union from loguru import logger # https://stackoverflow.com/a/39757388 if TYPE_CHECKING: from py_v_sdk import chain as ch from py_v_...
StarcoderdataPython
272971
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
StarcoderdataPython